@vuebro/loader-sfc 2.3.14 → 2.3.15
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 +5244 -5021
- package/dist/loader-sfc.js +9 -17
- package/package.json +2 -2
package/dist/loader-sfc.js
CHANGED
|
@@ -1,24 +1,9 @@
|
|
|
1
1
|
import { compileStyleAsync, compileTemplate, compileScript, parse, } from "vue/compiler-sfc";
|
|
2
2
|
import { consola } from "consola/browser";
|
|
3
3
|
import { transform } from "sucrase";
|
|
4
|
+
import { ofetch } from "ofetch";
|
|
4
5
|
import hash from "hash-sum";
|
|
5
|
-
const
|
|
6
|
-
try {
|
|
7
|
-
const response = await fetch(input);
|
|
8
|
-
if (response.ok) {
|
|
9
|
-
const method = response[resolver];
|
|
10
|
-
if (typeof method === "function")
|
|
11
|
-
return await method();
|
|
12
|
-
else
|
|
13
|
-
throw new Error(`Invalid resolver "${resolver}"`);
|
|
14
|
-
}
|
|
15
|
-
else
|
|
16
|
-
throw new Error(`Response status: ${response.status.toString()}`);
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
consola.error(error);
|
|
20
|
-
}
|
|
21
|
-
}, inject = async (code) => {
|
|
6
|
+
const inject = async (code) => {
|
|
22
7
|
const objectURL = URL.createObjectURL(new Blob([code], { type: "application/javascript" }));
|
|
23
8
|
try {
|
|
24
9
|
return (await import(objectURL));
|
|
@@ -26,6 +11,13 @@ const fetching = async (input, resolver = "text") => {
|
|
|
26
11
|
finally {
|
|
27
12
|
URL.revokeObjectURL(objectURL);
|
|
28
13
|
}
|
|
14
|
+
}, fetching = async (input) => {
|
|
15
|
+
try {
|
|
16
|
+
return await ofetch(input);
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
consola.error(error);
|
|
20
|
+
}
|
|
29
21
|
};
|
|
30
22
|
export default async (filename, { scriptOptions: { templateOptions: { compilerOptions: { expressionPlugins, ...restCompilerOptions } = {}, ...restTemplateOptions } = {}, ...restScriptOptions } = {}, parseOptions, styleOptions, } = {}) => {
|
|
31
23
|
const id = `data-v-${hash(filename)}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuebro/loader-sfc",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.15",
|
|
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",
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
"@rollup/plugin-terser": "^0.4.4",
|
|
42
42
|
"@types/hash-sum": "^1.0.2",
|
|
43
43
|
"@types/node": "^24.9.1",
|
|
44
|
-
"@vuebro/configs": "^1.1.
|
|
44
|
+
"@vuebro/configs": "^1.1.42"
|
|
45
45
|
}
|
|
46
46
|
}
|