@microsoft/fast-build 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/fast.js +9 -8
- package/package.json +1 -1
- package/wasm/microsoft_fast_build_bg.wasm +0 -0
package/bin/fast.js
CHANGED
|
@@ -223,13 +223,13 @@ function staticPrefixDir(pattern) {
|
|
|
223
223
|
* @param {string} html
|
|
224
224
|
* @param {string} filePath - used in warning messages
|
|
225
225
|
* @param {object} wasm - the loaded WASM module
|
|
226
|
-
* @returns {{ name: string, content: string, shadowrootAttributes: { name: string, value: string | null }[] }[]}
|
|
226
|
+
* @returns {{ name: string, content: string, shadowrootAttributes: { name: string, value: string | null }[], hostAttributes: { name: string, value: string | null }[] }[]}
|
|
227
227
|
*/
|
|
228
228
|
function parseFTemplates(html, filePath, wasm) {
|
|
229
|
-
/** @type {{ name: string | null, content: string, shadowrootAttributes?: { name: string, value: string | null }[] }[]} */
|
|
229
|
+
/** @type {{ name: string | null, content: string, shadowrootAttributes?: { name: string, value: string | null }[], hostAttributes?: { name: string, value: string | null }[] }[]} */
|
|
230
230
|
const parsed = JSON.parse(wasm.parse_f_templates(html));
|
|
231
231
|
const results = [];
|
|
232
|
-
for (const { name, content, shadowrootAttributes } of parsed) {
|
|
232
|
+
for (const { name, content, shadowrootAttributes, hostAttributes } of parsed) {
|
|
233
233
|
if (name === null) {
|
|
234
234
|
process.stderr.write(
|
|
235
235
|
`Warning: <f-template> without a 'name' attribute in '${filePath}': ${content.trim()}\n`
|
|
@@ -239,6 +239,7 @@ function parseFTemplates(html, filePath, wasm) {
|
|
|
239
239
|
name,
|
|
240
240
|
content,
|
|
241
241
|
shadowrootAttributes: shadowrootAttributes || [],
|
|
242
|
+
hostAttributes: hostAttributes || [],
|
|
242
243
|
});
|
|
243
244
|
}
|
|
244
245
|
}
|
|
@@ -252,7 +253,7 @@ function parseFTemplates(html, filePath, wasm) {
|
|
|
252
253
|
* Warns (but does not error) if the base directory does not exist.
|
|
253
254
|
* @param {string} pattern
|
|
254
255
|
* @param {object} wasm - the loaded WASM module
|
|
255
|
-
* @returns {{ name: string, content: string, shadowrootAttributes: { name: string, value: string | null }[] }[]}
|
|
256
|
+
* @returns {{ name: string, content: string, shadowrootAttributes: { name: string, value: string | null }[], hostAttributes: { name: string, value: string | null }[] }[]}
|
|
256
257
|
*/
|
|
257
258
|
function resolvePattern(pattern, wasm) {
|
|
258
259
|
const baseDir = staticPrefixDir(pattern);
|
|
@@ -266,8 +267,8 @@ function resolvePattern(pattern, wasm) {
|
|
|
266
267
|
if (globMatch(pattern, file)) {
|
|
267
268
|
const html = fs.readFileSync(file, "utf8");
|
|
268
269
|
const templates = parseFTemplates(html, file, wasm);
|
|
269
|
-
for (const { name, content, shadowrootAttributes } of templates) {
|
|
270
|
-
results.push({ name, content, shadowrootAttributes });
|
|
270
|
+
for (const { name, content, shadowrootAttributes, hostAttributes } of templates) {
|
|
271
|
+
results.push({ name, content, shadowrootAttributes, hostAttributes });
|
|
271
272
|
}
|
|
272
273
|
}
|
|
273
274
|
}
|
|
@@ -313,13 +314,13 @@ async function runBuild(args) {
|
|
|
313
314
|
`Warning: No template files found for pattern "${pattern}".\n`
|
|
314
315
|
);
|
|
315
316
|
}
|
|
316
|
-
for (const { name, content, shadowrootAttributes } of matches) {
|
|
317
|
+
for (const { name, content, shadowrootAttributes, hostAttributes } of matches) {
|
|
317
318
|
if (name in templatesMap) {
|
|
318
319
|
process.stderr.write(
|
|
319
320
|
`Warning: Duplicate template name "${name}" — later file overwrites earlier.\n`
|
|
320
321
|
);
|
|
321
322
|
}
|
|
322
|
-
templatesMap[name] = { content, shadowrootAttributes };
|
|
323
|
+
templatesMap[name] = { content, shadowrootAttributes, hostAttributes };
|
|
323
324
|
}
|
|
324
325
|
}
|
|
325
326
|
}
|
package/package.json
CHANGED
|
Binary file
|