@vuebro/loader-sfc 1.5.22 → 1.6.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/dist/loader-sfc.esm-browser.prod.js +20 -19
- package/dist/loader-sfc.js +20 -9
- package/package.json +4 -4
|
@@ -23320,29 +23320,30 @@ const jp = "<template></template>", io = async (e) => {
|
|
|
23320
23320
|
e.forEach((t) => {
|
|
23321
23321
|
console.log(t);
|
|
23322
23322
|
});
|
|
23323
|
-
}, Mg =
|
|
23324
|
-
const
|
|
23325
|
-
|
|
23326
|
-
|
|
23327
|
-
|
|
23328
|
-
|
|
23329
|
-
i.
|
|
23330
|
-
|
|
23331
|
-
|
|
23323
|
+
}, Mg = async (e) => {
|
|
23324
|
+
const t = URL.createObjectURL(new Blob([e], { type: "application/javascript" })), s = await import(t);
|
|
23325
|
+
return URL.revokeObjectURL(t), s;
|
|
23326
|
+
}, uP = async (e) => {
|
|
23327
|
+
const t = `data-v-${qw(e)}`, { descriptor: s, errors: n } = Hy(await (await io(e)).text() || jp, { filename: e }), i = { cacheHandlers: !0, comments: !1, expressionPlugins: [], hoistStatic: !0, optimizeImports: !0, scopeId: t, sourceMap: !1, ssr: !1 }, o = ["script", "scriptSetup"], c = await Promise.all(o.map(async (f) => {
|
|
23328
|
+
const { lang: x = "js", src: m } = s[f] ?? {};
|
|
23329
|
+
return /[jt]sx$/.test(x) && i.expressionPlugins?.push("jsx"), /tsx?$/.test(x) && i.expressionPlugins?.push("typescript"), m && await (await io(m)).text();
|
|
23330
|
+
})), l = "preserve", p = {}, d = s.styles.some(({ scoped: f }) => f), { expressionPlugins: g } = i;
|
|
23331
|
+
if (Mn(n), d && (p.__scopeId = t), s.script || s.scriptSetup) {
|
|
23332
|
+
o.forEach((y, v) => {
|
|
23333
|
+
const b = s[y];
|
|
23334
|
+
b && c[v] !== void 0 && (b.content = c[v]);
|
|
23332
23335
|
});
|
|
23333
|
-
const { bindings: f, content: x, warnings: m = [] } = Nw(
|
|
23334
|
-
Mn(m), f && (
|
|
23336
|
+
const { bindings: f, content: x, warnings: m = [] } = Nw(s, { id: t });
|
|
23337
|
+
Mn(m), f && (i.bindingMetadata = f), Object.assign(p, (await Mg(g.length ? Rg(x, { jsxRuntime: l, transforms: g }).code : x)).default);
|
|
23335
23338
|
}
|
|
23336
|
-
if (
|
|
23337
|
-
const { code: f, errors: x, tips: m } = Xx({ ast:
|
|
23339
|
+
if (s.template) {
|
|
23340
|
+
const { code: f, errors: x, tips: m } = Xx({ ast: s.template.ast, compilerOptions: i, filename: s.filename, id: t, scoped: d, slotted: s.slotted, source: s.template.src ? await (await io(s.template.src)).text() : s.template.content, vapor: s.vapor });
|
|
23338
23341
|
Mn(x), Mn(m), Object.assign(p, await Mg(g.length ? Rg(f, { jsxRuntime: l, transforms: g }).code : f));
|
|
23339
23342
|
}
|
|
23340
|
-
return
|
|
23341
|
-
|
|
23342
|
-
|
|
23343
|
-
|
|
23344
|
-
})(c, t, f);
|
|
23345
|
-
}), p;
|
|
23343
|
+
return await Promise.all(s.styles.map((f) => (async (x, { filename: m }, { content: y, module: v, scoped: b = !1, src: E }) => {
|
|
23344
|
+
const { code: w, errors: C } = await qE({ filename: m, id: x, modules: !!v, scoped: b, source: E ? await (await io(E)).text() : y });
|
|
23345
|
+
Mn(C), Bw(w, b ? { id: x } : void 0);
|
|
23346
|
+
})(t, s, f))), p;
|
|
23346
23347
|
};
|
|
23347
23348
|
export {
|
|
23348
23349
|
uP as default
|
package/dist/loader-sfc.js
CHANGED
|
@@ -25,18 +25,31 @@ const addStyle = async (id, { filename }, { content, module, scoped = false, src
|
|
|
25
25
|
});
|
|
26
26
|
log(errors);
|
|
27
27
|
useStyleTag(code, scoped ? { id } : undefined);
|
|
28
|
-
}, inject = (code) =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
}, inject = async (code) => {
|
|
29
|
+
const objectURL = URL.createObjectURL(new Blob([code], { type: "application/javascript" })),
|
|
30
|
+
/* @vite-ignore */
|
|
31
|
+
value = (await import(objectURL));
|
|
32
|
+
URL.revokeObjectURL(objectURL);
|
|
33
|
+
return value;
|
|
34
|
+
}, loadModule = async (filename) => {
|
|
35
|
+
const id = `data-v-${hash(filename)}`, { descriptor, errors } = parse((await (await fetchText(filename)).text()) || body, { filename });
|
|
36
|
+
const compilerOptions = {
|
|
37
|
+
cacheHandlers: true,
|
|
38
|
+
comments: false,
|
|
39
|
+
expressionPlugins: [],
|
|
40
|
+
hoistStatic: true,
|
|
41
|
+
optimizeImports: true,
|
|
42
|
+
scopeId: id,
|
|
43
|
+
sourceMap: false,
|
|
44
|
+
ssr: false,
|
|
45
|
+
}, scriptBlocks = ["script", "scriptSetup"], contents = await Promise.all(scriptBlocks.map(async (key) => {
|
|
33
46
|
const { lang = "js", src } = (descriptor[key] ?? {});
|
|
34
47
|
if (/[jt]sx$/.test(lang))
|
|
35
48
|
compilerOptions.expressionPlugins?.push("jsx");
|
|
36
49
|
if (/tsx?$/.test(lang))
|
|
37
50
|
compilerOptions.expressionPlugins?.push("typescript");
|
|
38
51
|
return src && (await (await fetchText(src)).text());
|
|
39
|
-
})),
|
|
52
|
+
})), jsxRuntime = "preserve", module = {}, scoped = descriptor.styles.some(({ scoped }) => scoped), { expressionPlugins: transforms } = compilerOptions;
|
|
40
53
|
log(errors);
|
|
41
54
|
if (scoped)
|
|
42
55
|
module.__scopeId = id;
|
|
@@ -75,9 +88,7 @@ const addStyle = async (id, { filename }, { content, module, scoped = false, src
|
|
|
75
88
|
? transform(code, { jsxRuntime, transforms }).code
|
|
76
89
|
: code));
|
|
77
90
|
}
|
|
78
|
-
descriptor.styles.
|
|
79
|
-
void addStyle(id, descriptor, style);
|
|
80
|
-
});
|
|
91
|
+
await Promise.all(descriptor.styles.map((style) => addStyle(id, descriptor, style)));
|
|
81
92
|
return module;
|
|
82
93
|
};
|
|
83
94
|
export default loadModule;
|
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "git+https://github.com/vuebro/loader-sfc.git"
|
|
22
22
|
},
|
|
23
23
|
"license": "AGPL-3.0-only",
|
|
24
|
-
"version": "1.
|
|
24
|
+
"version": "1.6.0",
|
|
25
25
|
"type": "module",
|
|
26
26
|
"main": "./dist/loader-sfc.js",
|
|
27
27
|
"types": "./dist/loader-sfc.d.ts",
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"@eslint/js": "^9.36.0",
|
|
35
35
|
"@rollup/plugin-terser": "^0.4.4",
|
|
36
36
|
"@types/hash-sum": "^1.0.2",
|
|
37
|
-
"@types/node": "^24.6.
|
|
37
|
+
"@types/node": "^24.6.1",
|
|
38
38
|
"eslint": "^9.36.0",
|
|
39
39
|
"eslint-config-prettier": "^10.1.8",
|
|
40
40
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
41
41
|
"eslint-plugin-import-x": "^4.16.1",
|
|
42
42
|
"eslint-plugin-perfectionist": "^4.15.0",
|
|
43
43
|
"eslint-plugin-prettier": "^5.5.4",
|
|
44
|
-
"jiti": "^2.6.
|
|
45
|
-
"typescript": "^5.9.
|
|
44
|
+
"jiti": "^2.6.1",
|
|
45
|
+
"typescript": "^5.9.3",
|
|
46
46
|
"typescript-eslint": "^8.45.0",
|
|
47
47
|
"vite": "^7.1.7"
|
|
48
48
|
},
|