@vue/compiler-core 3.2.31 → 3.2.34-beta.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.
|
@@ -2235,6 +2235,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
2235
2235
|
}
|
|
2236
2236
|
|
|
2237
2237
|
const PURE_ANNOTATION = `/*#__PURE__*/`;
|
|
2238
|
+
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
2238
2239
|
function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap: sourceMap$1 = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssrRuntimeModuleName = 'vue/server-renderer', ssr = false, isTS = false, inSSR = false }) {
|
|
2239
2240
|
const context = {
|
|
2240
2241
|
mode,
|
|
@@ -2362,9 +2363,7 @@ function generate(ast, options = {}) {
|
|
|
2362
2363
|
// function mode const declarations should be inside with block
|
|
2363
2364
|
// also they should be renamed to avoid collision with user properties
|
|
2364
2365
|
if (hasHelpers) {
|
|
2365
|
-
push(`const { ${ast.helpers
|
|
2366
|
-
.map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
|
|
2367
|
-
.join(', ')} } = _Vue`);
|
|
2366
|
+
push(`const { ${ast.helpers.map(aliasHelper).join(', ')} } = _Vue`);
|
|
2368
2367
|
push(`\n`);
|
|
2369
2368
|
newline();
|
|
2370
2369
|
}
|
|
@@ -2426,7 +2425,6 @@ function genFunctionPreamble(ast, context) {
|
|
|
2426
2425
|
const VueBinding = ssr
|
|
2427
2426
|
? `require(${JSON.stringify(runtimeModuleName)})`
|
|
2428
2427
|
: runtimeGlobalName;
|
|
2429
|
-
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
2430
2428
|
// Generate const declaration for helpers
|
|
2431
2429
|
// In prefix mode, we place the const declaration at top so it's done
|
|
2432
2430
|
// only once; But if we not prefixing, we place the declaration inside the
|
|
@@ -3260,7 +3258,7 @@ function isReferenced(node, parent, grandparent) {
|
|
|
3260
3258
|
// no: export { NODE as foo } from "foo";
|
|
3261
3259
|
case 'ExportSpecifier':
|
|
3262
3260
|
// @ts-expect-error
|
|
3263
|
-
if (grandparent
|
|
3261
|
+
if (grandparent?.source) {
|
|
3264
3262
|
return false;
|
|
3265
3263
|
}
|
|
3266
3264
|
return parent.local === node;
|
|
@@ -3358,7 +3356,9 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
3358
3356
|
const isUpdateArg = parent && parent.type === 'UpdateExpression' && parent.argument === id;
|
|
3359
3357
|
// ({ x } = y)
|
|
3360
3358
|
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
|
|
3361
|
-
if (type === "setup-const" /* SETUP_CONST */ ||
|
|
3359
|
+
if (type === "setup-const" /* SETUP_CONST */ ||
|
|
3360
|
+
type === "setup-reactive-const" /* SETUP_REACTIVE_CONST */ ||
|
|
3361
|
+
localVars[raw]) {
|
|
3362
3362
|
return raw;
|
|
3363
3363
|
}
|
|
3364
3364
|
else if (type === "setup-ref" /* SETUP_REF */) {
|
|
@@ -3412,11 +3412,11 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
3412
3412
|
else if (type === "props" /* PROPS */) {
|
|
3413
3413
|
// use __props which is generated by compileScript so in ts mode
|
|
3414
3414
|
// it gets correct type
|
|
3415
|
-
return
|
|
3415
|
+
return shared.genPropsAccessExp(raw);
|
|
3416
3416
|
}
|
|
3417
3417
|
else if (type === "props-aliased" /* PROPS_ALIASED */) {
|
|
3418
3418
|
// prop with a different local alias (from defineProps() destructure)
|
|
3419
|
-
return
|
|
3419
|
+
return shared.genPropsAccessExp(bindingMetadata.__propsAliases[raw]);
|
|
3420
3420
|
}
|
|
3421
3421
|
}
|
|
3422
3422
|
else {
|
|
@@ -3425,7 +3425,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
3425
3425
|
return `$setup.${raw}`;
|
|
3426
3426
|
}
|
|
3427
3427
|
else if (type === "props-aliased" /* PROPS_ALIASED */) {
|
|
3428
|
-
return `$props
|
|
3428
|
+
return `$props['${bindingMetadata.__propsAliases[raw]}']`;
|
|
3429
3429
|
}
|
|
3430
3430
|
else if (type) {
|
|
3431
3431
|
return `$${type}.${raw}`;
|
|
@@ -3690,14 +3690,14 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3690
3690
|
}
|
|
3691
3691
|
}
|
|
3692
3692
|
function createIfBranch(node, dir) {
|
|
3693
|
+
const isTemplateIf = node.tagType === 3 /* TEMPLATE */;
|
|
3693
3694
|
return {
|
|
3694
3695
|
type: 10 /* IF_BRANCH */,
|
|
3695
3696
|
loc: node.loc,
|
|
3696
3697
|
condition: dir.name === 'else' ? undefined : dir.exp,
|
|
3697
|
-
children:
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
userKey: findProp(node, `key`)
|
|
3698
|
+
children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
|
|
3699
|
+
userKey: findProp(node, `key`),
|
|
3700
|
+
isTemplateIf
|
|
3701
3701
|
};
|
|
3702
3702
|
}
|
|
3703
3703
|
function createCodegenNodeForBranch(branch, keyIndex, context) {
|
|
@@ -3732,7 +3732,8 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
3732
3732
|
let patchFlagText = shared.PatchFlagNames[64 /* STABLE_FRAGMENT */];
|
|
3733
3733
|
// check if the fragment actually contains a single valid child with
|
|
3734
3734
|
// the rest being comments
|
|
3735
|
-
if (
|
|
3735
|
+
if (!branch.isTemplateIf &&
|
|
3736
|
+
children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
|
|
3736
3737
|
patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
|
|
3737
3738
|
patchFlagText += `, ${shared.PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
|
|
3738
3739
|
}
|
|
@@ -4526,7 +4527,8 @@ function resolveSetupReference(name, context) {
|
|
|
4526
4527
|
return PascalName;
|
|
4527
4528
|
}
|
|
4528
4529
|
};
|
|
4529
|
-
const fromConst = checkType("setup-const" /* SETUP_CONST */)
|
|
4530
|
+
const fromConst = checkType("setup-const" /* SETUP_CONST */) ||
|
|
4531
|
+
checkType("setup-reactive-const" /* SETUP_REACTIVE_CONST */);
|
|
4530
4532
|
if (fromConst) {
|
|
4531
4533
|
return context.inline
|
|
4532
4534
|
? // in inline mode, const setup bindings (e.g. imports) can be used as-is
|
|
@@ -4829,10 +4831,11 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4829
4831
|
classProp.value = createCallExpression(context.helper(NORMALIZE_CLASS), [classProp.value]);
|
|
4830
4832
|
}
|
|
4831
4833
|
if (styleProp &&
|
|
4832
|
-
!isStaticExp(styleProp.value) &&
|
|
4833
4834
|
// the static style is compiled into an object,
|
|
4834
4835
|
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
|
|
4835
4836
|
(hasStyleBinding ||
|
|
4837
|
+
(styleProp.value.type === 4 /* SIMPLE_EXPRESSION */ &&
|
|
4838
|
+
styleProp.value.content.trim()[0] === `[`) ||
|
|
4836
4839
|
// v-bind:style and style both exist,
|
|
4837
4840
|
// v-bind:style with static literal object
|
|
4838
4841
|
styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
|
|
@@ -5241,11 +5244,7 @@ const transformText = (node, context) => {
|
|
|
5241
5244
|
const next = children[j];
|
|
5242
5245
|
if (isText(next)) {
|
|
5243
5246
|
if (!currentContainer) {
|
|
5244
|
-
currentContainer = children[i] =
|
|
5245
|
-
type: 8 /* COMPOUND_EXPRESSION */,
|
|
5246
|
-
loc: child.loc,
|
|
5247
|
-
children: [child]
|
|
5248
|
-
};
|
|
5247
|
+
currentContainer = children[i] = createCompoundExpression([child], child.loc);
|
|
5249
5248
|
}
|
|
5250
5249
|
// merge adjacent text node into current
|
|
5251
5250
|
currentContainer.children.push(` + `, next);
|
|
@@ -5751,6 +5750,7 @@ exports.findDir = findDir;
|
|
|
5751
5750
|
exports.findProp = findProp;
|
|
5752
5751
|
exports.generate = generate;
|
|
5753
5752
|
exports.getBaseTransformPreset = getBaseTransformPreset;
|
|
5753
|
+
exports.getConstantType = getConstantType;
|
|
5754
5754
|
exports.getInnerRange = getInnerRange;
|
|
5755
5755
|
exports.getMemoedVNodeCall = getMemoedVNodeCall;
|
|
5756
5756
|
exports.getVNodeBlockHelper = getVNodeBlockHelper;
|
|
@@ -2185,6 +2185,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
2185
2185
|
}
|
|
2186
2186
|
|
|
2187
2187
|
const PURE_ANNOTATION = `/*#__PURE__*/`;
|
|
2188
|
+
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
2188
2189
|
function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap: sourceMap$1 = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssrRuntimeModuleName = 'vue/server-renderer', ssr = false, isTS = false, inSSR = false }) {
|
|
2189
2190
|
const context = {
|
|
2190
2191
|
mode,
|
|
@@ -2312,9 +2313,7 @@ function generate(ast, options = {}) {
|
|
|
2312
2313
|
// function mode const declarations should be inside with block
|
|
2313
2314
|
// also they should be renamed to avoid collision with user properties
|
|
2314
2315
|
if (hasHelpers) {
|
|
2315
|
-
push(`const { ${ast.helpers
|
|
2316
|
-
.map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
|
|
2317
|
-
.join(', ')} } = _Vue`);
|
|
2316
|
+
push(`const { ${ast.helpers.map(aliasHelper).join(', ')} } = _Vue`);
|
|
2318
2317
|
push(`\n`);
|
|
2319
2318
|
newline();
|
|
2320
2319
|
}
|
|
@@ -2376,7 +2375,6 @@ function genFunctionPreamble(ast, context) {
|
|
|
2376
2375
|
const VueBinding = ssr
|
|
2377
2376
|
? `require(${JSON.stringify(runtimeModuleName)})`
|
|
2378
2377
|
: runtimeGlobalName;
|
|
2379
|
-
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
2380
2378
|
// Generate const declaration for helpers
|
|
2381
2379
|
// In prefix mode, we place the const declaration at top so it's done
|
|
2382
2380
|
// only once; But if we not prefixing, we place the declaration inside the
|
|
@@ -3197,7 +3195,7 @@ function isReferenced(node, parent, grandparent) {
|
|
|
3197
3195
|
// no: export { NODE as foo } from "foo";
|
|
3198
3196
|
case 'ExportSpecifier':
|
|
3199
3197
|
// @ts-expect-error
|
|
3200
|
-
if (grandparent
|
|
3198
|
+
if (grandparent?.source) {
|
|
3201
3199
|
return false;
|
|
3202
3200
|
}
|
|
3203
3201
|
return parent.local === node;
|
|
@@ -3295,7 +3293,9 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
3295
3293
|
const isUpdateArg = parent && parent.type === 'UpdateExpression' && parent.argument === id;
|
|
3296
3294
|
// ({ x } = y)
|
|
3297
3295
|
const isDestructureAssignment = parent && isInDestructureAssignment(parent, parentStack);
|
|
3298
|
-
if (type === "setup-const" /* SETUP_CONST */ ||
|
|
3296
|
+
if (type === "setup-const" /* SETUP_CONST */ ||
|
|
3297
|
+
type === "setup-reactive-const" /* SETUP_REACTIVE_CONST */ ||
|
|
3298
|
+
localVars[raw]) {
|
|
3299
3299
|
return raw;
|
|
3300
3300
|
}
|
|
3301
3301
|
else if (type === "setup-ref" /* SETUP_REF */) {
|
|
@@ -3349,11 +3349,11 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
3349
3349
|
else if (type === "props" /* PROPS */) {
|
|
3350
3350
|
// use __props which is generated by compileScript so in ts mode
|
|
3351
3351
|
// it gets correct type
|
|
3352
|
-
return
|
|
3352
|
+
return shared.genPropsAccessExp(raw);
|
|
3353
3353
|
}
|
|
3354
3354
|
else if (type === "props-aliased" /* PROPS_ALIASED */) {
|
|
3355
3355
|
// prop with a different local alias (from defineProps() destructure)
|
|
3356
|
-
return
|
|
3356
|
+
return shared.genPropsAccessExp(bindingMetadata.__propsAliases[raw]);
|
|
3357
3357
|
}
|
|
3358
3358
|
}
|
|
3359
3359
|
else {
|
|
@@ -3362,7 +3362,7 @@ asRawStatements = false, localVars = Object.create(context.identifiers)) {
|
|
|
3362
3362
|
return `$setup.${raw}`;
|
|
3363
3363
|
}
|
|
3364
3364
|
else if (type === "props-aliased" /* PROPS_ALIASED */) {
|
|
3365
|
-
return `$props
|
|
3365
|
+
return `$props['${bindingMetadata.__propsAliases[raw]}']`;
|
|
3366
3366
|
}
|
|
3367
3367
|
else if (type) {
|
|
3368
3368
|
return `$${type}.${raw}`;
|
|
@@ -3614,14 +3614,14 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3614
3614
|
}
|
|
3615
3615
|
}
|
|
3616
3616
|
function createIfBranch(node, dir) {
|
|
3617
|
+
const isTemplateIf = node.tagType === 3 /* TEMPLATE */;
|
|
3617
3618
|
return {
|
|
3618
3619
|
type: 10 /* IF_BRANCH */,
|
|
3619
3620
|
loc: node.loc,
|
|
3620
3621
|
condition: dir.name === 'else' ? undefined : dir.exp,
|
|
3621
|
-
children:
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
userKey: findProp(node, `key`)
|
|
3622
|
+
children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
|
|
3623
|
+
userKey: findProp(node, `key`),
|
|
3624
|
+
isTemplateIf
|
|
3625
3625
|
};
|
|
3626
3626
|
}
|
|
3627
3627
|
function createCodegenNodeForBranch(branch, keyIndex, context) {
|
|
@@ -4424,7 +4424,8 @@ function resolveSetupReference(name, context) {
|
|
|
4424
4424
|
return PascalName;
|
|
4425
4425
|
}
|
|
4426
4426
|
};
|
|
4427
|
-
const fromConst = checkType("setup-const" /* SETUP_CONST */)
|
|
4427
|
+
const fromConst = checkType("setup-const" /* SETUP_CONST */) ||
|
|
4428
|
+
checkType("setup-reactive-const" /* SETUP_REACTIVE_CONST */);
|
|
4428
4429
|
if (fromConst) {
|
|
4429
4430
|
return context.inline
|
|
4430
4431
|
? // in inline mode, const setup bindings (e.g. imports) can be used as-is
|
|
@@ -4704,10 +4705,11 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4704
4705
|
classProp.value = createCallExpression(context.helper(NORMALIZE_CLASS), [classProp.value]);
|
|
4705
4706
|
}
|
|
4706
4707
|
if (styleProp &&
|
|
4707
|
-
!isStaticExp(styleProp.value) &&
|
|
4708
4708
|
// the static style is compiled into an object,
|
|
4709
4709
|
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
|
|
4710
4710
|
(hasStyleBinding ||
|
|
4711
|
+
(styleProp.value.type === 4 /* SIMPLE_EXPRESSION */ &&
|
|
4712
|
+
styleProp.value.content.trim()[0] === `[`) ||
|
|
4711
4713
|
// v-bind:style and style both exist,
|
|
4712
4714
|
// v-bind:style with static literal object
|
|
4713
4715
|
styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
|
|
@@ -5113,11 +5115,7 @@ const transformText = (node, context) => {
|
|
|
5113
5115
|
const next = children[j];
|
|
5114
5116
|
if (isText(next)) {
|
|
5115
5117
|
if (!currentContainer) {
|
|
5116
|
-
currentContainer = children[i] =
|
|
5117
|
-
type: 8 /* COMPOUND_EXPRESSION */,
|
|
5118
|
-
loc: child.loc,
|
|
5119
|
-
children: [child]
|
|
5120
|
-
};
|
|
5118
|
+
currentContainer = children[i] = createCompoundExpression([child], child.loc);
|
|
5121
5119
|
}
|
|
5122
5120
|
// merge adjacent text node into current
|
|
5123
5121
|
currentContainer.children.push(` + `, next);
|
|
@@ -5622,6 +5620,7 @@ exports.findDir = findDir;
|
|
|
5622
5620
|
exports.findProp = findProp;
|
|
5623
5621
|
exports.generate = generate;
|
|
5624
5622
|
exports.getBaseTransformPreset = getBaseTransformPreset;
|
|
5623
|
+
exports.getConstantType = getConstantType;
|
|
5625
5624
|
exports.getInnerRange = getInnerRange;
|
|
5626
5625
|
exports.getMemoedVNodeCall = getMemoedVNodeCall;
|
|
5627
5626
|
exports.getVNodeBlockHelper = getVNodeBlockHelper;
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -79,6 +79,10 @@ export declare const enum BindingTypes {
|
|
|
79
79
|
* template expressions.
|
|
80
80
|
*/
|
|
81
81
|
SETUP_CONST = "setup-const",
|
|
82
|
+
/**
|
|
83
|
+
* a const binding that does not need `unref()`, but may be mutated.
|
|
84
|
+
*/
|
|
85
|
+
SETUP_REACTIVE_CONST = "setup-reactive-const",
|
|
82
86
|
/**
|
|
83
87
|
* a const binding that may be a ref.
|
|
84
88
|
*/
|
|
@@ -528,6 +532,8 @@ export { generateCodeFrame }
|
|
|
528
532
|
|
|
529
533
|
export declare function getBaseTransformPreset(prefixIdentifiers?: boolean): TransformPreset;
|
|
530
534
|
|
|
535
|
+
export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode, context: TransformContext): ConstantTypes;
|
|
536
|
+
|
|
531
537
|
export declare function getInnerRange(loc: SourceLocation, offset: number, length: number): SourceLocation;
|
|
532
538
|
|
|
533
539
|
export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
|
|
@@ -551,6 +557,7 @@ export declare interface IfBranchNode extends Node_2 {
|
|
|
551
557
|
condition: ExpressionNode | undefined;
|
|
552
558
|
children: TemplateChildNode[];
|
|
553
559
|
userKey?: AttributeNode | DirectiveNode;
|
|
560
|
+
isTemplateIf?: boolean;
|
|
554
561
|
}
|
|
555
562
|
|
|
556
563
|
export declare interface IfConditionalExpression extends ConditionalExpression {
|
|
@@ -2189,6 +2189,7 @@ function createStructuralDirectiveTransform(name, fn) {
|
|
|
2189
2189
|
}
|
|
2190
2190
|
|
|
2191
2191
|
const PURE_ANNOTATION = `/*#__PURE__*/`;
|
|
2192
|
+
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
2192
2193
|
function createCodegenContext(ast, { mode = 'function', prefixIdentifiers = mode === 'module', sourceMap = false, filename = `template.vue.html`, scopeId = null, optimizeImports = false, runtimeGlobalName = `Vue`, runtimeModuleName = `vue`, ssrRuntimeModuleName = 'vue/server-renderer', ssr = false, isTS = false, inSSR = false }) {
|
|
2193
2194
|
const context = {
|
|
2194
2195
|
mode,
|
|
@@ -2265,9 +2266,7 @@ function generate(ast, options = {}) {
|
|
|
2265
2266
|
// function mode const declarations should be inside with block
|
|
2266
2267
|
// also they should be renamed to avoid collision with user properties
|
|
2267
2268
|
if (hasHelpers) {
|
|
2268
|
-
push(`const { ${ast.helpers
|
|
2269
|
-
.map(s => `${helperNameMap[s]}: _${helperNameMap[s]}`)
|
|
2270
|
-
.join(', ')} } = _Vue`);
|
|
2269
|
+
push(`const { ${ast.helpers.map(aliasHelper).join(', ')} } = _Vue`);
|
|
2271
2270
|
push(`\n`);
|
|
2272
2271
|
newline();
|
|
2273
2272
|
}
|
|
@@ -2327,7 +2326,6 @@ function generate(ast, options = {}) {
|
|
|
2327
2326
|
function genFunctionPreamble(ast, context) {
|
|
2328
2327
|
const { ssr, prefixIdentifiers, push, newline, runtimeModuleName, runtimeGlobalName, ssrRuntimeModuleName } = context;
|
|
2329
2328
|
const VueBinding = runtimeGlobalName;
|
|
2330
|
-
const aliasHelper = (s) => `${helperNameMap[s]}: _${helperNameMap[s]}`;
|
|
2331
2329
|
// Generate const declaration for helpers
|
|
2332
2330
|
// In prefix mode, we place the const declaration at top so it's done
|
|
2333
2331
|
// only once; But if we not prefixing, we place the declaration inside the
|
|
@@ -3045,14 +3043,14 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
3045
3043
|
}
|
|
3046
3044
|
}
|
|
3047
3045
|
function createIfBranch(node, dir) {
|
|
3046
|
+
const isTemplateIf = node.tagType === 3 /* TEMPLATE */;
|
|
3048
3047
|
return {
|
|
3049
3048
|
type: 10 /* IF_BRANCH */,
|
|
3050
3049
|
loc: node.loc,
|
|
3051
3050
|
condition: dir.name === 'else' ? undefined : dir.exp,
|
|
3052
|
-
children:
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
userKey: findProp(node, `key`)
|
|
3051
|
+
children: isTemplateIf && !findDir(node, 'for') ? node.children : [node],
|
|
3052
|
+
userKey: findProp(node, `key`),
|
|
3053
|
+
isTemplateIf
|
|
3056
3054
|
};
|
|
3057
3055
|
}
|
|
3058
3056
|
function createCodegenNodeForBranch(branch, keyIndex, context) {
|
|
@@ -3088,6 +3086,7 @@ function createChildrenCodegenNode(branch, keyIndex, context) {
|
|
|
3088
3086
|
// check if the fragment actually contains a single valid child with
|
|
3089
3087
|
// the rest being comments
|
|
3090
3088
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
3089
|
+
!branch.isTemplateIf &&
|
|
3091
3090
|
children.filter(c => c.type !== 3 /* COMMENT */).length === 1) {
|
|
3092
3091
|
patchFlag |= 2048 /* DEV_ROOT_FRAGMENT */;
|
|
3093
3092
|
patchFlagText += `, ${PatchFlagNames[2048 /* DEV_ROOT_FRAGMENT */]}`;
|
|
@@ -4084,10 +4083,11 @@ function buildProps(node, context, props = node.props, ssr = false) {
|
|
|
4084
4083
|
classProp.value = createCallExpression(context.helper(NORMALIZE_CLASS), [classProp.value]);
|
|
4085
4084
|
}
|
|
4086
4085
|
if (styleProp &&
|
|
4087
|
-
!isStaticExp(styleProp.value) &&
|
|
4088
4086
|
// the static style is compiled into an object,
|
|
4089
4087
|
// so use `hasStyleBinding` to ensure that it is a dynamic style binding
|
|
4090
4088
|
(hasStyleBinding ||
|
|
4089
|
+
(styleProp.value.type === 4 /* SIMPLE_EXPRESSION */ &&
|
|
4090
|
+
styleProp.value.content.trim()[0] === `[`) ||
|
|
4091
4091
|
// v-bind:style and style both exist,
|
|
4092
4092
|
// v-bind:style with static literal object
|
|
4093
4093
|
styleProp.value.type === 17 /* JS_ARRAY_EXPRESSION */)) {
|
|
@@ -4456,11 +4456,7 @@ const transformText = (node, context) => {
|
|
|
4456
4456
|
const next = children[j];
|
|
4457
4457
|
if (isText(next)) {
|
|
4458
4458
|
if (!currentContainer) {
|
|
4459
|
-
currentContainer = children[i] =
|
|
4460
|
-
type: 8 /* COMPOUND_EXPRESSION */,
|
|
4461
|
-
loc: child.loc,
|
|
4462
|
-
children: [child]
|
|
4463
|
-
};
|
|
4459
|
+
currentContainer = children[i] = createCompoundExpression([child], child.loc);
|
|
4464
4460
|
}
|
|
4465
4461
|
// merge adjacent text node into current
|
|
4466
4462
|
currentContainer.children.push(` + `, next);
|
|
@@ -4855,4 +4851,4 @@ function baseCompile(template, options = {}) {
|
|
|
4855
4851
|
|
|
4856
4852
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
4857
4853
|
|
|
4858
|
-
export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText, isVSlot, locStub, makeBlock, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
|
4854
|
+
export { BASE_TRANSITION, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, OPEN_BLOCK, POP_SCOPE_ID, PUSH_SCOPE_ID, RENDER_LIST, RENDER_SLOT, RESOLVE_COMPONENT, RESOLVE_DIRECTIVE, RESOLVE_DYNAMIC_COMPONENT, RESOLVE_FILTER, SET_BLOCK_TRACKING, SUSPENSE, TELEPORT, TO_DISPLAY_STRING, TO_HANDLERS, TO_HANDLER_KEY, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, extractIdentifiers, findDir, findProp, generate, getBaseTransformPreset, getConstantType, getInnerRange, getMemoedVNodeCall, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isBuiltInType, isCoreComponent, isFunctionType, isInDestructureAssignment, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText, isVSlot, locStub, makeBlock, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, traverseNode, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.34-beta.1",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@vue/shared": "3.2.
|
|
35
|
+
"@vue/shared": "3.2.34-beta.1",
|
|
36
36
|
"@babel/parser": "^7.16.4",
|
|
37
37
|
"estree-walker": "^2.0.2",
|
|
38
38
|
"source-map": "^0.6.1"
|