@vuebro/loader-sfc 2.3.35 → 2.4.1
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.d.ts +1 -1
- package/dist/loader-sfc.esm-browser.prod.js +21831 -21831
- package/dist/loader-sfc.js +4 -5
- package/package.json +3 -3
package/dist/loader-sfc.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { compileScript, compileStyleAsync, compileTemplate, parse, } from "@vue/compiler-sfc";
|
|
1
2
|
import { consola } from "consola/browser";
|
|
2
|
-
import
|
|
3
|
+
import hash_sum from "hash-sum";
|
|
3
4
|
import { ofetch } from "ofetch";
|
|
4
5
|
import { transform } from "sucrase";
|
|
5
|
-
import { compileScript, compileStyleAsync, compileTemplate, parse, } from "vue/compiler-sfc";
|
|
6
6
|
const fetching = async (input) => {
|
|
7
7
|
try {
|
|
8
8
|
return await ofetch(input, { responseType: "text" });
|
|
@@ -22,8 +22,8 @@ const fetching = async (input) => {
|
|
|
22
22
|
};
|
|
23
23
|
export default async (sfc, { parseOptions, scriptOptions: { templateOptions: { compilerOptions: { expressionPlugins, ...restCompilerOptions } = {}, ...restTemplateOptions } = {}, ...restScriptOptions } = {}, styleOptions, } = {}) => {
|
|
24
24
|
let styleWarning = "";
|
|
25
|
-
const styleErrors = [], { descriptor, errors: parseErrors } = parse(sfc || "<template></template>", parseOptions), { filename, script, scriptSetup, slotted, styles, template } = descriptor;
|
|
26
|
-
const id = `data-v-${hash
|
|
25
|
+
const hash = hash_sum(sfc), styleErrors = [], { descriptor, errors: parseErrors } = parse(sfc || "<template></template>", { filename: `${hash}.vue`, ...parseOptions }), { filename, script, scriptSetup, slotted, styles, template } = descriptor;
|
|
26
|
+
const id = `data-v-${hash}`, langs = new Set([script, scriptSetup]
|
|
27
27
|
.filter((scriptBlock) => scriptBlock !== null)
|
|
28
28
|
.flatMap(({ lang = "js" }) => [
|
|
29
29
|
...(/[jt]sx$/.test(lang) ? ["jsx"] : []),
|
|
@@ -72,7 +72,6 @@ export default async (sfc, { parseOptions, scriptOptions: { templateOptions: { c
|
|
|
72
72
|
jsxRuntime: "preserve",
|
|
73
73
|
transforms: [...langs],
|
|
74
74
|
}, { ast, content: source = "" } = template ?? {}, { bindings, content, warnings: scriptWarnings, } = script || scriptSetup ? compileScript(descriptor, scriptOptions) : {};
|
|
75
|
-
console.log({ id });
|
|
76
75
|
if (bindings)
|
|
77
76
|
compilerOptions.bindingMetadata = bindings;
|
|
78
77
|
const { code, errors: templateErrors, tips: templateTips, } = template && (!scriptSetup || !scriptOptions.inlineTemplate)
|
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.
|
|
4
|
+
"version": "2.4.1",
|
|
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",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"prettier": "@vuebro/configs/prettierrc",
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@vue/compiler-sfc": "^3.5.25",
|
|
38
39
|
"consola": "^3.4.2",
|
|
39
40
|
"hash-sum": "^2.0.0",
|
|
40
41
|
"ofetch": "^1.5.1",
|
|
41
|
-
"sucrase": "^3.35.1"
|
|
42
|
-
"vue": "^3.5.25"
|
|
42
|
+
"sucrase": "^3.35.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@rollup/plugin-terser": "^0.4.4",
|