@vuebro/loader-sfc 2.3.34 → 2.3.35
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/README.md +4 -4
- package/dist/loader-sfc.esm-browser.prod.js +1 -3
- package/dist/loader-sfc.js +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,8 +41,8 @@ To load .vue files dynamically at runtime just use the `loadModule` function:
|
|
|
41
41
|
import { defineAsyncComponent } from "vue";
|
|
42
42
|
import loadModule from "@vuebro/loader-sfc";
|
|
43
43
|
|
|
44
|
-
const AdminPage = defineAsyncComponent(() =>
|
|
45
|
-
loadModule("./components/AdminPageComponent.vue"),
|
|
44
|
+
const AdminPage = defineAsyncComponent(async () =>
|
|
45
|
+
loadModule(await (await fetch("./components/AdminPageComponent.vue")).text()),
|
|
46
46
|
);
|
|
47
47
|
</script>
|
|
48
48
|
|
|
@@ -59,8 +59,8 @@ You can pass configuration options to customize the compilation process:
|
|
|
59
59
|
import { defineAsyncComponent } from "vue";
|
|
60
60
|
import loadModule from "@vuebro/loader-sfc";
|
|
61
61
|
|
|
62
|
-
const MyComponent = defineAsyncComponent(() =>
|
|
63
|
-
loadModule("./components/MyComponent.vue", {
|
|
62
|
+
const MyComponent = defineAsyncComponent(async () =>
|
|
63
|
+
loadModule(await (await fetch("./components/MyComponent.vue")).text(), {
|
|
64
64
|
scriptOptions: {
|
|
65
65
|
templateOptions: {
|
|
66
66
|
compilerOptions: {
|
|
@@ -23757,9 +23757,7 @@ const ZP = async (e) => {
|
|
|
23757
23757
|
}
|
|
23758
23758
|
}, eA = async (e, { parseOptions: t, scriptOptions: { templateOptions: { compilerOptions: { expressionPlugins: s, ...n } = {}, ...i } = {}, ...o } = {}, styleOptions: c } = {}) => {
|
|
23759
23759
|
let l = "";
|
|
23760
|
-
const p = [], { descriptor: d, errors: f } = ab(e || "<template></template>", t), { filename: m, script: x, scriptSetup: g, slotted: y, styles: v, template: T } = d
|
|
23761
|
-
console.log({ filename: m });
|
|
23762
|
-
const k = `data-v-${KT(m)}`, E = new Set([x, g].filter((se) => se !== null).flatMap(({ lang: se = "js" }) => [.../[jt]sx$/.test(se) ? ["jsx"] : [], .../tsx?$/.test(se) ? ["typescript"] : []])), C = { expressionPlugins: [.../* @__PURE__ */ new Set([...s ?? [], ...E])], filename: m, scopeId: k, slotted: y, ...n }, A = { compilerOptions: C, filename: m, id: k, scoped: v.some(({ scoped: se }) => se), slotted: y, ...i }, O = { id: k, templateOptions: A, ...o }, F = document.getElementById(k) instanceof HTMLStyleElement ? Promise.resolve([]) : Promise.all(v.map(async ({ content: se, module: J, scoped: $ = !1, src: oe }) => {
|
|
23760
|
+
const p = [], { descriptor: d, errors: f } = ab(e || "<template></template>", t), { filename: m, script: x, scriptSetup: g, slotted: y, styles: v, template: T } = d, k = `data-v-${KT(e)}`, E = new Set([x, g].filter((se) => se !== null).flatMap(({ lang: se = "js" }) => [.../[jt]sx$/.test(se) ? ["jsx"] : [], .../tsx?$/.test(se) ? ["typescript"] : []])), C = { expressionPlugins: [.../* @__PURE__ */ new Set([...s ?? [], ...E])], filename: m, scopeId: k, slotted: y, ...n }, A = { compilerOptions: C, filename: m, id: k, scoped: v.some(({ scoped: se }) => se), slotted: y, ...i }, O = { id: k, templateOptions: A, ...o }, F = document.getElementById(k) instanceof HTMLStyleElement ? Promise.resolve([]) : Promise.all(v.map(async ({ content: se, module: J, scoped: $ = !1, src: oe }) => {
|
|
23763
23761
|
const Y = !!J;
|
|
23764
23762
|
if (Y && !l) return l = "<style module> is not supported in the playground.", "";
|
|
23765
23763
|
{
|
package/dist/loader-sfc.js
CHANGED
|
@@ -23,8 +23,7 @@ const fetching = async (input) => {
|
|
|
23
23
|
export default async (sfc, { parseOptions, scriptOptions: { templateOptions: { compilerOptions: { expressionPlugins, ...restCompilerOptions } = {}, ...restTemplateOptions } = {}, ...restScriptOptions } = {}, styleOptions, } = {}) => {
|
|
24
24
|
let styleWarning = "";
|
|
25
25
|
const styleErrors = [], { descriptor, errors: parseErrors } = parse(sfc || "<template></template>", parseOptions), { filename, script, scriptSetup, slotted, styles, template } = descriptor;
|
|
26
|
-
|
|
27
|
-
const id = `data-v-${hash(filename)}`, langs = new Set([script, scriptSetup]
|
|
26
|
+
const id = `data-v-${hash(sfc)}`, langs = new Set([script, scriptSetup]
|
|
28
27
|
.filter((scriptBlock) => scriptBlock !== null)
|
|
29
28
|
.flatMap(({ lang = "js" }) => [
|
|
30
29
|
...(/[jt]sx$/.test(lang) ? ["jsx"] : []),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package",
|
|
3
3
|
"name": "@vuebro/loader-sfc",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.35",
|
|
5
5
|
"description": "A lightweight library that enables loading Vue 3 Single File Components (.vue files) directly in the browser at runtime without requiring a build step. Supports TypeScript and JSX transformations for dynamic component loading.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"vue",
|