@vue/compiler-sfc 3.3.10 → 3.3.11
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/compiler-sfc.cjs.js
CHANGED
|
@@ -15672,6 +15672,7 @@ class ScriptCompileContext {
|
|
|
15672
15672
|
constructor(descriptor, options) {
|
|
15673
15673
|
this.descriptor = descriptor;
|
|
15674
15674
|
this.options = options;
|
|
15675
|
+
this.isCE = false;
|
|
15675
15676
|
this.source = this.descriptor.source;
|
|
15676
15677
|
this.filename = this.descriptor.filename;
|
|
15677
15678
|
this.s = new MagicString(this.source);
|
|
@@ -15698,6 +15699,11 @@ class ScriptCompileContext {
|
|
|
15698
15699
|
const scriptSetupLang = scriptSetup && scriptSetup.lang;
|
|
15699
15700
|
this.isJS = scriptLang === "js" || scriptLang === "jsx" || scriptSetupLang === "js" || scriptSetupLang === "jsx";
|
|
15700
15701
|
this.isTS = scriptLang === "ts" || scriptLang === "tsx" || scriptSetupLang === "ts" || scriptSetupLang === "tsx";
|
|
15702
|
+
const customElement = options.customElement;
|
|
15703
|
+
const filename = this.descriptor.filename;
|
|
15704
|
+
if (customElement) {
|
|
15705
|
+
this.isCE = typeof customElement === "boolean" ? customElement : customElement(filename);
|
|
15706
|
+
}
|
|
15701
15707
|
const plugins = resolveParserPlugins(
|
|
15702
15708
|
scriptLang || scriptSetupLang,
|
|
15703
15709
|
options.babelParserPlugins
|
|
@@ -19385,6 +19391,15 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
19385
19391
|
defaultString
|
|
19386
19392
|
])} }`;
|
|
19387
19393
|
} else {
|
|
19394
|
+
if (ctx.isCE) {
|
|
19395
|
+
if (defaultString) {
|
|
19396
|
+
return `${finalKey}: ${`{ ${defaultString}, type: ${toRuntimeTypeString(
|
|
19397
|
+
type
|
|
19398
|
+
)} }`}`;
|
|
19399
|
+
} else {
|
|
19400
|
+
return `${finalKey}: {type: ${toRuntimeTypeString(type)}}`;
|
|
19401
|
+
}
|
|
19402
|
+
}
|
|
19388
19403
|
return `${finalKey}: ${defaultString ? `{ ${defaultString} }` : `{}`}`;
|
|
19389
19404
|
}
|
|
19390
19405
|
}
|
|
@@ -20629,7 +20644,7 @@ function isStaticNode(node) {
|
|
|
20629
20644
|
return false;
|
|
20630
20645
|
}
|
|
20631
20646
|
|
|
20632
|
-
const version = "3.3.
|
|
20647
|
+
const version = "3.3.11";
|
|
20633
20648
|
const parseCache = parseCache$1;
|
|
20634
20649
|
const walk = estreeWalker.walk;
|
|
20635
20650
|
|
package/dist/compiler-sfc.d.ts
CHANGED
|
@@ -144,6 +144,10 @@ export interface SFCScriptCompileOptions {
|
|
|
144
144
|
* using it, disable this and switch to the [Vue Macros implementation](https://vue-macros.sxzz.moe/features/reactivity-transform.html).
|
|
145
145
|
*/
|
|
146
146
|
reactivityTransform?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Transform Vue SFCs into custom elements.
|
|
149
|
+
*/
|
|
150
|
+
customElement?: boolean | ((filename: string) => boolean);
|
|
147
151
|
}
|
|
148
152
|
interface ImportBinding {
|
|
149
153
|
isType: boolean;
|
|
@@ -355,6 +359,7 @@ export declare class ScriptCompileContext {
|
|
|
355
359
|
options: Partial<SFCScriptCompileOptions>;
|
|
356
360
|
isJS: boolean;
|
|
357
361
|
isTS: boolean;
|
|
362
|
+
isCE: boolean;
|
|
358
363
|
scriptAst: Program | null;
|
|
359
364
|
scriptSetupAst: Program | null;
|
|
360
365
|
source: string;
|
|
@@ -275,20 +275,29 @@ const replacer = (_key, val) => {
|
|
|
275
275
|
return replacer(_key, val.value);
|
|
276
276
|
} else if (isMap(val)) {
|
|
277
277
|
return {
|
|
278
|
-
[`Map(${val.size})`]: [...val.entries()].reduce(
|
|
279
|
-
entries[
|
|
280
|
-
|
|
281
|
-
|
|
278
|
+
[`Map(${val.size})`]: [...val.entries()].reduce(
|
|
279
|
+
(entries, [key, val2], i) => {
|
|
280
|
+
entries[stringifySymbol(key, i) + " =>"] = val2;
|
|
281
|
+
return entries;
|
|
282
|
+
},
|
|
283
|
+
{}
|
|
284
|
+
)
|
|
282
285
|
};
|
|
283
286
|
} else if (isSet(val)) {
|
|
284
287
|
return {
|
|
285
|
-
[`Set(${val.size})`]: [...val.values()]
|
|
288
|
+
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
|
|
286
289
|
};
|
|
290
|
+
} else if (isSymbol$1(val)) {
|
|
291
|
+
return stringifySymbol(val);
|
|
287
292
|
} else if (isObject$2(val) && !isArray$3(val) && !isPlainObject(val)) {
|
|
288
293
|
return String(val);
|
|
289
294
|
}
|
|
290
295
|
return val;
|
|
291
296
|
};
|
|
297
|
+
const stringifySymbol = (v, i = "") => {
|
|
298
|
+
var _a;
|
|
299
|
+
return isSymbol$1(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
|
|
300
|
+
};
|
|
292
301
|
|
|
293
302
|
function defaultOnError(error) {
|
|
294
303
|
throw error;
|
|
@@ -47048,6 +47057,7 @@ class ScriptCompileContext {
|
|
|
47048
47057
|
constructor(descriptor, options) {
|
|
47049
47058
|
this.descriptor = descriptor;
|
|
47050
47059
|
this.options = options;
|
|
47060
|
+
this.isCE = false;
|
|
47051
47061
|
this.source = this.descriptor.source;
|
|
47052
47062
|
this.filename = this.descriptor.filename;
|
|
47053
47063
|
this.s = new MagicString(this.source);
|
|
@@ -47074,6 +47084,11 @@ class ScriptCompileContext {
|
|
|
47074
47084
|
const scriptSetupLang = scriptSetup && scriptSetup.lang;
|
|
47075
47085
|
this.isJS = scriptLang === "js" || scriptLang === "jsx" || scriptSetupLang === "js" || scriptSetupLang === "jsx";
|
|
47076
47086
|
this.isTS = scriptLang === "ts" || scriptLang === "tsx" || scriptSetupLang === "ts" || scriptSetupLang === "tsx";
|
|
47087
|
+
const customElement = options.customElement;
|
|
47088
|
+
const filename = this.descriptor.filename;
|
|
47089
|
+
if (customElement) {
|
|
47090
|
+
this.isCE = typeof customElement === "boolean" ? customElement : customElement(filename);
|
|
47091
|
+
}
|
|
47077
47092
|
const plugins = resolveParserPlugins(
|
|
47078
47093
|
scriptLang || scriptSetupLang,
|
|
47079
47094
|
options.babelParserPlugins
|
|
@@ -48663,6 +48678,15 @@ function genRuntimePropFromType(ctx, { key, required, type, skipCheck }, hasStat
|
|
|
48663
48678
|
defaultString
|
|
48664
48679
|
])} }`;
|
|
48665
48680
|
} else {
|
|
48681
|
+
if (ctx.isCE) {
|
|
48682
|
+
if (defaultString) {
|
|
48683
|
+
return `${finalKey}: ${`{ ${defaultString}, type: ${toRuntimeTypeString(
|
|
48684
|
+
type
|
|
48685
|
+
)} }`}`;
|
|
48686
|
+
} else {
|
|
48687
|
+
return `${finalKey}: {type: ${toRuntimeTypeString(type)}}`;
|
|
48688
|
+
}
|
|
48689
|
+
}
|
|
48666
48690
|
return `${finalKey}: ${defaultString ? `{ ${defaultString} }` : `{}`}`;
|
|
48667
48691
|
}
|
|
48668
48692
|
}
|
|
@@ -49921,7 +49945,7 @@ function isStaticNode(node) {
|
|
|
49921
49945
|
return false;
|
|
49922
49946
|
}
|
|
49923
49947
|
|
|
49924
|
-
const version = "3.3.
|
|
49948
|
+
const version = "3.3.11";
|
|
49925
49949
|
const parseCache = parseCache$1;
|
|
49926
49950
|
const walk = walk$1;
|
|
49927
49951
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-sfc",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.11",
|
|
4
4
|
"description": "@vue/compiler-sfc",
|
|
5
5
|
"main": "dist/compiler-sfc.cjs.js",
|
|
6
6
|
"module": "dist/compiler-sfc.esm-browser.js",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"magic-string": "^0.30.5",
|
|
38
38
|
"postcss": "^8.4.32",
|
|
39
39
|
"source-map-js": "^1.0.2",
|
|
40
|
-
"@vue/compiler-
|
|
41
|
-
"@vue/compiler-
|
|
42
|
-
"@vue/
|
|
43
|
-
"@vue/
|
|
44
|
-
"@vue/
|
|
40
|
+
"@vue/compiler-dom": "3.3.11",
|
|
41
|
+
"@vue/compiler-ssr": "3.3.11",
|
|
42
|
+
"@vue/shared": "3.3.11",
|
|
43
|
+
"@vue/compiler-core": "3.3.11",
|
|
44
|
+
"@vue/reactivity-transform": "3.3.11"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@babel/types": "^7.23.5",
|