@vue/compiler-core 3.4.26 → 3.5.0-alpha.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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.
|
|
2
|
+
* @vue/compiler-core v3.5.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2195,10 +2195,11 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2195
2195
|
}
|
|
2196
2196
|
},
|
|
2197
2197
|
onselfclosingtag(end) {
|
|
2198
|
+
var _a;
|
|
2198
2199
|
const name = currentOpenTag.tag;
|
|
2199
2200
|
currentOpenTag.isSelfClosing = true;
|
|
2200
2201
|
endOpenTag(end);
|
|
2201
|
-
if (stack[0]
|
|
2202
|
+
if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
|
|
2202
2203
|
onCloseTag(stack.shift(), end);
|
|
2203
2204
|
}
|
|
2204
2205
|
},
|
|
@@ -2514,7 +2515,7 @@ function endOpenTag(end) {
|
|
|
2514
2515
|
function onText(content, start, end) {
|
|
2515
2516
|
const parent = stack[0] || currentRoot;
|
|
2516
2517
|
const lastNode = parent.children[parent.children.length - 1];
|
|
2517
|
-
if (lastNode
|
|
2518
|
+
if ((lastNode == null ? void 0 : lastNode.type) === 2) {
|
|
2518
2519
|
lastNode.content += content;
|
|
2519
2520
|
setLocEnd(lastNode.loc, end);
|
|
2520
2521
|
} else {
|
|
@@ -2648,10 +2649,11 @@ function isFragmentTemplate({ tag, props }) {
|
|
|
2648
2649
|
return false;
|
|
2649
2650
|
}
|
|
2650
2651
|
function isComponent({ tag, props }) {
|
|
2652
|
+
var _a;
|
|
2651
2653
|
if (currentOptions.isCustomElement(tag)) {
|
|
2652
2654
|
return false;
|
|
2653
2655
|
}
|
|
2654
|
-
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent
|
|
2656
|
+
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
|
|
2655
2657
|
return true;
|
|
2656
2658
|
}
|
|
2657
2659
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -2684,6 +2686,7 @@ function isUpperCase(c) {
|
|
|
2684
2686
|
}
|
|
2685
2687
|
const windowsNewlineRE = /\r\n/g;
|
|
2686
2688
|
function condenseWhitespace(nodes, tag) {
|
|
2689
|
+
var _a, _b;
|
|
2687
2690
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
2688
2691
|
let removedWhitespace = false;
|
|
2689
2692
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -2691,8 +2694,8 @@ function condenseWhitespace(nodes, tag) {
|
|
|
2691
2694
|
if (node.type === 2) {
|
|
2692
2695
|
if (!inPre) {
|
|
2693
2696
|
if (isAllWhitespace(node.content)) {
|
|
2694
|
-
const prev = nodes[i - 1]
|
|
2695
|
-
const next = nodes[i + 1]
|
|
2697
|
+
const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
|
|
2698
|
+
const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
|
|
2696
2699
|
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
2697
2700
|
removedWhitespace = true;
|
|
2698
2701
|
nodes[i] = null;
|
|
@@ -2852,7 +2855,7 @@ function baseParse(input, options) {
|
|
|
2852
2855
|
}
|
|
2853
2856
|
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
2854
2857
|
tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
|
|
2855
|
-
const delimiters = options
|
|
2858
|
+
const delimiters = options == null ? void 0 : options.delimiters;
|
|
2856
2859
|
if (delimiters) {
|
|
2857
2860
|
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
2858
2861
|
tokenizer.delimiterClose = toCharCodes(delimiters[1]);
|
|
@@ -4210,6 +4213,7 @@ function genReturnStatement({ returns }, context) {
|
|
|
4210
4213
|
}
|
|
4211
4214
|
|
|
4212
4215
|
const isLiteralWhitelisted = /* @__PURE__ */ shared.makeMap("true,false,null,this");
|
|
4216
|
+
const constantBailRE = /\w\s*\(|\.[^\d]/;
|
|
4213
4217
|
const transformExpression = (node, context) => {
|
|
4214
4218
|
if (node.type === 5) {
|
|
4215
4219
|
node.content = processExpression(
|
|
@@ -4304,6 +4308,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4304
4308
|
return `_ctx.${raw}`;
|
|
4305
4309
|
};
|
|
4306
4310
|
const rawExp = node.content;
|
|
4311
|
+
const bailConstant = constantBailRE.test(rawExp);
|
|
4307
4312
|
let ast = node.ast;
|
|
4308
4313
|
if (ast === false) {
|
|
4309
4314
|
return node;
|
|
@@ -4365,7 +4370,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4365
4370
|
node2.name = rewriteIdentifier(node2.name, parent, node2);
|
|
4366
4371
|
ids.push(node2);
|
|
4367
4372
|
} else {
|
|
4368
|
-
if (!(needPrefix && isLocal) &&
|
|
4373
|
+
if (!(needPrefix && isLocal) && !bailConstant) {
|
|
4369
4374
|
node2.isConstant = true;
|
|
4370
4375
|
}
|
|
4371
4376
|
ids.push(node2);
|
|
@@ -4409,7 +4414,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4409
4414
|
ret.ast = ast;
|
|
4410
4415
|
} else {
|
|
4411
4416
|
ret = node;
|
|
4412
|
-
ret.constType = 3;
|
|
4417
|
+
ret.constType = bailConstant ? 0 : 3;
|
|
4413
4418
|
}
|
|
4414
4419
|
ret.identifiers = Object.keys(knownIds);
|
|
4415
4420
|
return ret;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.
|
|
2
|
+
* @vue/compiler-core v3.5.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2191,10 +2191,11 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
2191
2191
|
}
|
|
2192
2192
|
},
|
|
2193
2193
|
onselfclosingtag(end) {
|
|
2194
|
+
var _a;
|
|
2194
2195
|
const name = currentOpenTag.tag;
|
|
2195
2196
|
currentOpenTag.isSelfClosing = true;
|
|
2196
2197
|
endOpenTag(end);
|
|
2197
|
-
if (stack[0]
|
|
2198
|
+
if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
|
|
2198
2199
|
onCloseTag(stack.shift(), end);
|
|
2199
2200
|
}
|
|
2200
2201
|
},
|
|
@@ -2510,7 +2511,7 @@ function endOpenTag(end) {
|
|
|
2510
2511
|
function onText(content, start, end) {
|
|
2511
2512
|
const parent = stack[0] || currentRoot;
|
|
2512
2513
|
const lastNode = parent.children[parent.children.length - 1];
|
|
2513
|
-
if (lastNode
|
|
2514
|
+
if ((lastNode == null ? void 0 : lastNode.type) === 2) {
|
|
2514
2515
|
lastNode.content += content;
|
|
2515
2516
|
setLocEnd(lastNode.loc, end);
|
|
2516
2517
|
} else {
|
|
@@ -2614,10 +2615,11 @@ function isFragmentTemplate({ tag, props }) {
|
|
|
2614
2615
|
return false;
|
|
2615
2616
|
}
|
|
2616
2617
|
function isComponent({ tag, props }) {
|
|
2618
|
+
var _a;
|
|
2617
2619
|
if (currentOptions.isCustomElement(tag)) {
|
|
2618
2620
|
return false;
|
|
2619
2621
|
}
|
|
2620
|
-
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent
|
|
2622
|
+
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
|
|
2621
2623
|
return true;
|
|
2622
2624
|
}
|
|
2623
2625
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -2650,6 +2652,7 @@ function isUpperCase(c) {
|
|
|
2650
2652
|
}
|
|
2651
2653
|
const windowsNewlineRE = /\r\n/g;
|
|
2652
2654
|
function condenseWhitespace(nodes, tag) {
|
|
2655
|
+
var _a, _b;
|
|
2653
2656
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
2654
2657
|
let removedWhitespace = false;
|
|
2655
2658
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -2657,8 +2660,8 @@ function condenseWhitespace(nodes, tag) {
|
|
|
2657
2660
|
if (node.type === 2) {
|
|
2658
2661
|
if (!inPre) {
|
|
2659
2662
|
if (isAllWhitespace(node.content)) {
|
|
2660
|
-
const prev = nodes[i - 1]
|
|
2661
|
-
const next = nodes[i + 1]
|
|
2663
|
+
const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
|
|
2664
|
+
const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
|
|
2662
2665
|
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
2663
2666
|
removedWhitespace = true;
|
|
2664
2667
|
nodes[i] = null;
|
|
@@ -2811,7 +2814,7 @@ function baseParse(input, options) {
|
|
|
2811
2814
|
}
|
|
2812
2815
|
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
2813
2816
|
tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
|
|
2814
|
-
const delimiters = options
|
|
2817
|
+
const delimiters = options == null ? void 0 : options.delimiters;
|
|
2815
2818
|
if (delimiters) {
|
|
2816
2819
|
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
2817
2820
|
tokenizer.delimiterClose = toCharCodes(delimiters[1]);
|
|
@@ -4139,6 +4142,7 @@ function genReturnStatement({ returns }, context) {
|
|
|
4139
4142
|
}
|
|
4140
4143
|
|
|
4141
4144
|
const isLiteralWhitelisted = /* @__PURE__ */ shared.makeMap("true,false,null,this");
|
|
4145
|
+
const constantBailRE = /\w\s*\(|\.[^\d]/;
|
|
4142
4146
|
const transformExpression = (node, context) => {
|
|
4143
4147
|
if (node.type === 5) {
|
|
4144
4148
|
node.content = processExpression(
|
|
@@ -4233,6 +4237,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4233
4237
|
return `_ctx.${raw}`;
|
|
4234
4238
|
};
|
|
4235
4239
|
const rawExp = node.content;
|
|
4240
|
+
const bailConstant = constantBailRE.test(rawExp);
|
|
4236
4241
|
let ast = node.ast;
|
|
4237
4242
|
if (ast === false) {
|
|
4238
4243
|
return node;
|
|
@@ -4294,7 +4299,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4294
4299
|
node2.name = rewriteIdentifier(node2.name, parent, node2);
|
|
4295
4300
|
ids.push(node2);
|
|
4296
4301
|
} else {
|
|
4297
|
-
if (!(needPrefix && isLocal) &&
|
|
4302
|
+
if (!(needPrefix && isLocal) && !bailConstant) {
|
|
4298
4303
|
node2.isConstant = true;
|
|
4299
4304
|
}
|
|
4300
4305
|
ids.push(node2);
|
|
@@ -4338,7 +4343,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
|
|
|
4338
4343
|
ret.ast = ast;
|
|
4339
4344
|
} else {
|
|
4340
4345
|
ret = node;
|
|
4341
|
-
ret.constType = 3;
|
|
4346
|
+
ret.constType = bailConstant ? 0 : 3;
|
|
4342
4347
|
}
|
|
4343
4348
|
ret.identifiers = Object.keys(knownIds);
|
|
4344
4349
|
return ret;
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -1022,9 +1022,6 @@ export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | Exp
|
|
|
1022
1022
|
export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
|
|
1023
1023
|
export declare const forAliasRE: RegExp;
|
|
1024
1024
|
|
|
1025
|
-
/**
|
|
1026
|
-
* Return value indicates whether the AST walked can be a constant
|
|
1027
|
-
*/
|
|
1028
1025
|
export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
|
|
1029
1026
|
export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
|
|
1030
1027
|
export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.
|
|
2
|
+
* @vue/compiler-core v3.5.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1959,10 +1959,11 @@ const tokenizer = new Tokenizer(stack, {
|
|
|
1959
1959
|
}
|
|
1960
1960
|
},
|
|
1961
1961
|
onselfclosingtag(end) {
|
|
1962
|
+
var _a;
|
|
1962
1963
|
const name = currentOpenTag.tag;
|
|
1963
1964
|
currentOpenTag.isSelfClosing = true;
|
|
1964
1965
|
endOpenTag(end);
|
|
1965
|
-
if (stack[0]
|
|
1966
|
+
if (((_a = stack[0]) == null ? void 0 : _a.tag) === name) {
|
|
1966
1967
|
onCloseTag(stack.shift(), end);
|
|
1967
1968
|
}
|
|
1968
1969
|
},
|
|
@@ -2273,15 +2274,16 @@ function endOpenTag(end) {
|
|
|
2273
2274
|
currentOpenTag = null;
|
|
2274
2275
|
}
|
|
2275
2276
|
function onText(content, start, end) {
|
|
2277
|
+
var _a;
|
|
2276
2278
|
{
|
|
2277
|
-
const tag = stack[0]
|
|
2279
|
+
const tag = (_a = stack[0]) == null ? void 0 : _a.tag;
|
|
2278
2280
|
if (tag !== "script" && tag !== "style" && content.includes("&")) {
|
|
2279
2281
|
content = currentOptions.decodeEntities(content, false);
|
|
2280
2282
|
}
|
|
2281
2283
|
}
|
|
2282
2284
|
const parent = stack[0] || currentRoot;
|
|
2283
2285
|
const lastNode = parent.children[parent.children.length - 1];
|
|
2284
|
-
if (lastNode
|
|
2286
|
+
if ((lastNode == null ? void 0 : lastNode.type) === 2) {
|
|
2285
2287
|
lastNode.content += content;
|
|
2286
2288
|
setLocEnd(lastNode.loc, end);
|
|
2287
2289
|
} else {
|
|
@@ -2415,10 +2417,11 @@ function isFragmentTemplate({ tag, props }) {
|
|
|
2415
2417
|
return false;
|
|
2416
2418
|
}
|
|
2417
2419
|
function isComponent({ tag, props }) {
|
|
2420
|
+
var _a;
|
|
2418
2421
|
if (currentOptions.isCustomElement(tag)) {
|
|
2419
2422
|
return false;
|
|
2420
2423
|
}
|
|
2421
|
-
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || currentOptions.isBuiltInComponent
|
|
2424
|
+
if (tag === "component" || isUpperCase(tag.charCodeAt(0)) || isCoreComponent(tag) || ((_a = currentOptions.isBuiltInComponent) == null ? void 0 : _a.call(currentOptions, tag)) || currentOptions.isNativeTag && !currentOptions.isNativeTag(tag)) {
|
|
2422
2425
|
return true;
|
|
2423
2426
|
}
|
|
2424
2427
|
for (let i = 0; i < props.length; i++) {
|
|
@@ -2451,6 +2454,7 @@ function isUpperCase(c) {
|
|
|
2451
2454
|
}
|
|
2452
2455
|
const windowsNewlineRE = /\r\n/g;
|
|
2453
2456
|
function condenseWhitespace(nodes, tag) {
|
|
2457
|
+
var _a, _b;
|
|
2454
2458
|
const shouldCondense = currentOptions.whitespace !== "preserve";
|
|
2455
2459
|
let removedWhitespace = false;
|
|
2456
2460
|
for (let i = 0; i < nodes.length; i++) {
|
|
@@ -2458,8 +2462,8 @@ function condenseWhitespace(nodes, tag) {
|
|
|
2458
2462
|
if (node.type === 2) {
|
|
2459
2463
|
if (!inPre) {
|
|
2460
2464
|
if (isAllWhitespace(node.content)) {
|
|
2461
|
-
const prev = nodes[i - 1]
|
|
2462
|
-
const next = nodes[i + 1]
|
|
2465
|
+
const prev = (_a = nodes[i - 1]) == null ? void 0 : _a.type;
|
|
2466
|
+
const next = (_b = nodes[i + 1]) == null ? void 0 : _b.type;
|
|
2463
2467
|
if (!prev || !next || shouldCondense && (prev === 3 && (next === 3 || next === 1) || prev === 1 && (next === 3 || next === 1 && hasNewlineChar(node.content)))) {
|
|
2464
2468
|
removedWhitespace = true;
|
|
2465
2469
|
nodes[i] = null;
|
|
@@ -2597,7 +2601,7 @@ function baseParse(input, options) {
|
|
|
2597
2601
|
}
|
|
2598
2602
|
tokenizer.mode = currentOptions.parseMode === "html" ? 1 : currentOptions.parseMode === "sfc" ? 2 : 0;
|
|
2599
2603
|
tokenizer.inXML = currentOptions.ns === 1 || currentOptions.ns === 2;
|
|
2600
|
-
const delimiters = options
|
|
2604
|
+
const delimiters = options == null ? void 0 : options.delimiters;
|
|
2601
2605
|
if (delimiters) {
|
|
2602
2606
|
tokenizer.delimiterOpen = toCharCodes(delimiters[0]);
|
|
2603
2607
|
tokenizer.delimiterClose = toCharCodes(delimiters[1]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0-alpha.1",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"entities": "^4.5.0",
|
|
51
51
|
"estree-walker": "^2.0.2",
|
|
52
52
|
"source-map-js": "^1.2.0",
|
|
53
|
-
"@vue/shared": "3.
|
|
53
|
+
"@vue/shared": "3.5.0-alpha.1"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@babel/types": "^7.24.0"
|