@vuebro/loader-sfc 2.3.18 → 2.3.19
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 +13 -14
- package/dist/loader-sfc.js +27 -33
- package/package.json +2 -2
|
@@ -23699,32 +23699,31 @@ const Xg = async (e) => {
|
|
|
23699
23699
|
URL.revokeObjectURL(t);
|
|
23700
23700
|
}
|
|
23701
23701
|
}, JP = async (e, { parseOptions: t, scriptOptions: { templateOptions: { compilerOptions: { expressionPlugins: s, ...n } = {}, ...i } = {}, ...o } = {}, styleOptions: c } = {}) => {
|
|
23702
|
-
|
|
23703
|
-
|
|
23704
|
-
const C = [], A = document.getElementById(l) instanceof HTMLStyleElement ? Promise.resolve([]) : Promise.all(g.map(async ({ content: Y, module: le, scoped: J = !1, src: $ }) => {
|
|
23702
|
+
let l = "";
|
|
23703
|
+
const p = `data-v-${zT(e)}`, d = [], { descriptor: f, errors: m } = ib(await Xg(e) ?? "<template></template>", { filename: e, ...t }), { script: x, scriptSetup: g, slotted: y, styles: v, template: b } = f, E = new Set([x, g].filter((Y) => Y !== null).flatMap(({ lang: Y = "js" }) => [.../[jt]sx$/.test(Y) ? ["jsx"] : [], .../tsx?$/.test(Y) ? ["typescript"] : []])), w = { expressionPlugins: [.../* @__PURE__ */ new Set([...s ?? [], ...E])], filename: e, scopeId: p, slotted: y, ...n }, C = { compilerOptions: w, filename: e, id: p, scoped: v.some(({ scoped: Y }) => Y), slotted: y, ...i }, A = { id: p, templateOptions: C, ...o }, O = document.getElementById(p) instanceof HTMLStyleElement ? Promise.resolve([]) : Promise.all(v.map(async ({ content: Y, module: le, scoped: J = !1, src: $ }) => {
|
|
23705
23704
|
const ie = !!le;
|
|
23706
|
-
if (ie && !
|
|
23705
|
+
if (ie && !l) return l = "<style module> is not supported in the playground.", "";
|
|
23707
23706
|
{
|
|
23708
|
-
const { code: Q, errors: se } = await sP({ filename: e, id:
|
|
23709
|
-
return
|
|
23707
|
+
const { code: Q, errors: se } = await sP({ filename: e, id: p, modules: ie, scoped: J, source: $ ? await Xg($) ?? "" : Y, ...c });
|
|
23708
|
+
return d.push(...se), Q;
|
|
23710
23709
|
}
|
|
23711
|
-
})),
|
|
23712
|
-
U && (
|
|
23713
|
-
const { code: V, errors: F, tips: q } = !
|
|
23714
|
-
[...
|
|
23710
|
+
})), D = { jsxRuntime: "preserve", transforms: [...E] }, { ast: N, content: j = "" } = b ?? {}, { bindings: U, content: X, warnings: W } = x || g ? WP(f, A) : {};
|
|
23711
|
+
U && (w.bindingMetadata = U);
|
|
23712
|
+
const { code: V, errors: F, tips: q } = !b || g && A.inlineTemplate ? {} : l0({ ...N, filename: e, id: p, source: j, ...C });
|
|
23713
|
+
[...m, ...F ?? [], ...d].forEach((Y) => {
|
|
23715
23714
|
co.error(Y);
|
|
23716
|
-
}), [...W ?? [], ...
|
|
23715
|
+
}), [...W ?? [], ...l ? [l] : []].forEach((Y) => {
|
|
23717
23716
|
co.warn(Y);
|
|
23718
23717
|
}), [...q ?? []].forEach((Y) => {
|
|
23719
23718
|
co.info(Y);
|
|
23720
23719
|
});
|
|
23721
|
-
const [G, ee, ae] = await Promise.all([
|
|
23720
|
+
const [G, ee, ae] = await Promise.all([O, X ? Kg(E.size ? nd(X, D).code : X) : Promise.resolve(void 0), V ? Kg(E.size ? nd(V, D).code : V) : Promise.resolve(void 0)]), be = G.join(`
|
|
23722
23721
|
`).trim();
|
|
23723
23722
|
if (be) {
|
|
23724
23723
|
const Y = document.createElement("style");
|
|
23725
|
-
Y.id =
|
|
23724
|
+
Y.id = p, Y.textContent = be, document.head.appendChild(Y);
|
|
23726
23725
|
}
|
|
23727
|
-
return { __scopeId:
|
|
23726
|
+
return { __scopeId: p, ...ee?.default, ...ae };
|
|
23728
23727
|
};
|
|
23729
23728
|
export {
|
|
23730
23729
|
JP as default
|
package/dist/loader-sfc.js
CHANGED
|
@@ -21,39 +21,14 @@ const fetching = async (input) => {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
export default async (filename, { parseOptions, scriptOptions: { templateOptions: { compilerOptions: { expressionPlugins, ...restCompilerOptions } = {}, ...restTemplateOptions } = {}, ...restScriptOptions } = {}, styleOptions, } = {}) => {
|
|
24
|
-
|
|
25
|
-
const { descriptor, errors: parseErrors } = parse((await fetching(filename)) ?? "<template></template>", { filename, ...parseOptions });
|
|
26
|
-
const { script, scriptSetup, slotted, styles, template } = descriptor;
|
|
24
|
+
let styleWarning = "";
|
|
25
|
+
const id = `data-v-${hash(filename)}`, styleErrors = [], { descriptor, errors: parseErrors } = parse((await fetching(filename)) ?? "<template></template>", { filename, ...parseOptions }), { script, scriptSetup, slotted, styles, template } = descriptor;
|
|
27
26
|
const langs = new Set([script, scriptSetup]
|
|
28
27
|
.filter((scriptBlock) => scriptBlock !== null)
|
|
29
28
|
.flatMap(({ lang = "js" }) => [
|
|
30
29
|
...(/[jt]sx$/.test(lang) ? ["jsx"] : []),
|
|
31
30
|
...(/tsx?$/.test(lang) ? ["typescript"] : []),
|
|
32
|
-
])),
|
|
33
|
-
let styleWarning = "";
|
|
34
|
-
const styleErrors = [];
|
|
35
|
-
const style = !(document.getElementById(id) instanceof HTMLStyleElement)
|
|
36
|
-
? Promise.all(styles.map(async ({ content, module, scoped = false, src }) => {
|
|
37
|
-
const modules = !!module;
|
|
38
|
-
if (modules && !styleWarning) {
|
|
39
|
-
styleWarning = "<style module> is not supported in the playground.";
|
|
40
|
-
return "";
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
const { code, errors } = await compileStyleAsync({
|
|
44
|
-
filename,
|
|
45
|
-
id,
|
|
46
|
-
modules,
|
|
47
|
-
scoped,
|
|
48
|
-
source: src ? ((await fetching(src)) ?? "") : content,
|
|
49
|
-
...styleOptions,
|
|
50
|
-
});
|
|
51
|
-
styleErrors.push(...errors);
|
|
52
|
-
return code;
|
|
53
|
-
}
|
|
54
|
-
}))
|
|
55
|
-
: Promise.resolve([]);
|
|
56
|
-
const compilerOptions = {
|
|
31
|
+
])), compilerOptions = {
|
|
57
32
|
expressionPlugins: [
|
|
58
33
|
...new Set([...(expressionPlugins ?? []), ...langs]),
|
|
59
34
|
],
|
|
@@ -72,11 +47,31 @@ export default async (filename, { parseOptions, scriptOptions: { templateOptions
|
|
|
72
47
|
id,
|
|
73
48
|
templateOptions,
|
|
74
49
|
...restScriptOptions,
|
|
75
|
-
},
|
|
50
|
+
}, style = !(document.getElementById(id) instanceof HTMLStyleElement)
|
|
51
|
+
? Promise.all(styles.map(async ({ content, module, scoped = false, src }) => {
|
|
52
|
+
const modules = !!module;
|
|
53
|
+
if (modules && !styleWarning) {
|
|
54
|
+
styleWarning =
|
|
55
|
+
"<style module> is not supported in the playground.";
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const { code, errors } = await compileStyleAsync({
|
|
60
|
+
filename,
|
|
61
|
+
id,
|
|
62
|
+
modules,
|
|
63
|
+
scoped,
|
|
64
|
+
source: src ? ((await fetching(src)) ?? "") : content,
|
|
65
|
+
...styleOptions,
|
|
66
|
+
});
|
|
67
|
+
styleErrors.push(...errors);
|
|
68
|
+
return code;
|
|
69
|
+
}
|
|
70
|
+
}))
|
|
71
|
+
: Promise.resolve([]), sucraseOptions = {
|
|
76
72
|
jsxRuntime: "preserve",
|
|
77
73
|
transforms: [...langs],
|
|
78
|
-
};
|
|
79
|
-
const { bindings, content, warnings: scriptWarnings, } = script || scriptSetup ? compileScript(descriptor, scriptOptions) : {};
|
|
74
|
+
}, { ast, content: source = "" } = template ?? {}, { bindings, content, warnings: scriptWarnings, } = script || scriptSetup ? compileScript(descriptor, scriptOptions) : {};
|
|
80
75
|
if (bindings)
|
|
81
76
|
compilerOptions.bindingMetadata = bindings;
|
|
82
77
|
const { code, errors: templateErrors, tips: templateTips, } = template && (!scriptSetup || !scriptOptions.inlineTemplate)
|
|
@@ -105,8 +100,7 @@ export default async (filename, { parseOptions, scriptOptions: { templateOptions
|
|
|
105
100
|
code
|
|
106
101
|
? inject(langs.size ? transform(code, sucraseOptions).code : code)
|
|
107
102
|
: Promise.resolve(undefined),
|
|
108
|
-
]);
|
|
109
|
-
const textContent = styleResult.join("\n").trim();
|
|
103
|
+
]), textContent = styleResult.join("\n").trim();
|
|
110
104
|
if (textContent) {
|
|
111
105
|
const el = document.createElement("style");
|
|
112
106
|
el.id = id;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuebro/loader-sfc",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.19",
|
|
4
4
|
"description": "Vue3 Single File Component (SFC) loader. Load .vue files directly from your browser without any build step.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@rollup/plugin-terser": "^0.4.4",
|
|
45
45
|
"@types/hash-sum": "^1.0.2",
|
|
46
46
|
"@types/node": "^24.9.2",
|
|
47
|
-
"@vuebro/configs": "^1.1.
|
|
47
|
+
"@vuebro/configs": "^1.1.56",
|
|
48
48
|
"eslint": "^9.39.0",
|
|
49
49
|
"vite": "^7.1.12"
|
|
50
50
|
}
|