@skaldapp/loader-sfc 2.4.21 → 2.4.22
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.js
CHANGED
|
@@ -12,15 +12,7 @@ const fetching = async (input) => {
|
|
|
12
12
|
catch (error) {
|
|
13
13
|
console.error(error);
|
|
14
14
|
}
|
|
15
|
-
return;
|
|
16
|
-
}, inject = async (code) => {
|
|
17
|
-
const objectURL = URL.createObjectURL(new Blob([code], { type: "application/javascript" }));
|
|
18
|
-
try {
|
|
19
|
-
return (await import(objectURL));
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
URL.revokeObjectURL(objectURL);
|
|
23
|
-
}
|
|
15
|
+
return undefined;
|
|
24
16
|
};
|
|
25
17
|
export default async (sfc, { parseOptions, scriptOptions: { templateOptions: { compilerOptions: { expressionPlugins, ...restCompilerOptions } = {}, ...restTemplateOptions } = {}, ...restScriptOptions } = {}, styleOptions, } = {}) => {
|
|
26
18
|
let styleWarning = "";
|
|
@@ -88,14 +80,20 @@ export default async (sfc, { parseOptions, scriptOptions: { templateOptions: { c
|
|
|
88
80
|
[...parseErrors, ...(templateErrors ?? []), ...styleErrors].forEach(console.error);
|
|
89
81
|
[...(scriptWarnings ?? []), ...(styleWarning ? [styleWarning] : [])].forEach(console.warn);
|
|
90
82
|
[...(templateTips ?? [])].forEach(console.info);
|
|
91
|
-
const
|
|
83
|
+
const inject = async (code) => {
|
|
84
|
+
const objectURL = URL.createObjectURL(new Blob([langs.size ? transform(code, sucraseOptions).code : code], {
|
|
85
|
+
type: "application/javascript",
|
|
86
|
+
}));
|
|
87
|
+
try {
|
|
88
|
+
return (await import(objectURL));
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
URL.revokeObjectURL(objectURL);
|
|
92
|
+
}
|
|
93
|
+
}, [styleResult, scriptResult, templateResult] = await Promise.all([
|
|
92
94
|
style,
|
|
93
|
-
content
|
|
94
|
-
|
|
95
|
-
: Promise.resolve(undefined),
|
|
96
|
-
code
|
|
97
|
-
? inject(langs.size ? transform(code, sucraseOptions).code : code)
|
|
98
|
-
: Promise.resolve(undefined),
|
|
95
|
+
content ? inject(content) : Promise.resolve(undefined),
|
|
96
|
+
code ? inject(code) : Promise.resolve(undefined),
|
|
99
97
|
]), textContent = styleResult.join("\n").trim();
|
|
100
98
|
if (textContent) {
|
|
101
99
|
const el = document.createElement("style");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package",
|
|
3
3
|
"name": "@skaldapp/loader-sfc",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.22",
|
|
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,12 +35,12 @@
|
|
|
35
35
|
},
|
|
36
36
|
"prettier": "@skaldapp/configs/prettierrc",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@vue/compiler-sfc": "^3.5.
|
|
38
|
+
"@vue/compiler-sfc": "^3.5.28",
|
|
39
39
|
"hash-sum": "^2.0.0",
|
|
40
40
|
"sucrase": "^3.35.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@skaldapp/configs": "^1.2.
|
|
43
|
+
"@skaldapp/configs": "^1.2.58",
|
|
44
44
|
"@types/hash-sum": "^1.0.2",
|
|
45
45
|
"@types/node": "^25.2.2",
|
|
46
46
|
"eslint": "^9.39.2",
|