@vue/compiler-core 3.6.0-alpha.4 → 3.6.0-alpha.5
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.6.0-alpha.
|
|
2
|
+
* @vue/compiler-core v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2306,7 +2306,43 @@ function getMemoedVNodeCall(node) {
|
|
|
2306
2306
|
return node;
|
|
2307
2307
|
}
|
|
2308
2308
|
}
|
|
2309
|
+
function filterNonCommentChildren(node) {
|
|
2310
|
+
return node.children.filter((n) => n.type !== 3);
|
|
2311
|
+
}
|
|
2312
|
+
function hasSingleChild(node) {
|
|
2313
|
+
return filterNonCommentChildren(node).length === 1;
|
|
2314
|
+
}
|
|
2315
|
+
function isSingleIfBlock(parent) {
|
|
2316
|
+
let hasEncounteredIf = false;
|
|
2317
|
+
for (const c of filterNonCommentChildren(parent)) {
|
|
2318
|
+
if (c.type === 9 || c.type === 1 && findDir(c, "if")) {
|
|
2319
|
+
if (hasEncounteredIf) return false;
|
|
2320
|
+
hasEncounteredIf = true;
|
|
2321
|
+
} else if (
|
|
2322
|
+
// node before v-if
|
|
2323
|
+
!hasEncounteredIf || // non else nodes
|
|
2324
|
+
!(c.type === 1 && findDir(c, /^else(-if)?$/, true))
|
|
2325
|
+
) {
|
|
2326
|
+
return false;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
return true;
|
|
2330
|
+
}
|
|
2309
2331
|
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
|
|
2332
|
+
function isAllWhitespace(str) {
|
|
2333
|
+
for (let i = 0; i < str.length; i++) {
|
|
2334
|
+
if (!isWhitespace(str.charCodeAt(i))) {
|
|
2335
|
+
return false;
|
|
2336
|
+
}
|
|
2337
|
+
}
|
|
2338
|
+
return true;
|
|
2339
|
+
}
|
|
2340
|
+
function isWhitespaceText(node) {
|
|
2341
|
+
return node.type === 2 && isAllWhitespace(node.content) || node.type === 12 && isWhitespaceText(node.content);
|
|
2342
|
+
}
|
|
2343
|
+
function isCommentOrWhitespace(node) {
|
|
2344
|
+
return node.type === 3 || isWhitespaceText(node);
|
|
2345
|
+
}
|
|
2310
2346
|
|
|
2311
2347
|
const defaultParserOptions = {
|
|
2312
2348
|
parseMode: "base",
|
|
@@ -2926,14 +2962,6 @@ function condenseWhitespace(nodes) {
|
|
|
2926
2962
|
}
|
|
2927
2963
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
2928
2964
|
}
|
|
2929
|
-
function isAllWhitespace(str) {
|
|
2930
|
-
for (let i = 0; i < str.length; i++) {
|
|
2931
|
-
if (!isWhitespace(str.charCodeAt(i))) {
|
|
2932
|
-
return false;
|
|
2933
|
-
}
|
|
2934
|
-
}
|
|
2935
|
-
return true;
|
|
2936
|
-
}
|
|
2937
2965
|
function hasNewlineChar(str) {
|
|
2938
2966
|
for (let i = 0; i < str.length; i++) {
|
|
2939
2967
|
const c = str.charCodeAt(i);
|
|
@@ -4773,13 +4801,11 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
4773
4801
|
let i = siblings.indexOf(node);
|
|
4774
4802
|
while (i-- >= -1) {
|
|
4775
4803
|
const sibling = siblings[i];
|
|
4776
|
-
if (sibling && sibling
|
|
4777
|
-
context.removeNode(sibling);
|
|
4778
|
-
comments.unshift(sibling);
|
|
4779
|
-
continue;
|
|
4780
|
-
}
|
|
4781
|
-
if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
|
|
4804
|
+
if (sibling && isCommentOrWhitespace(sibling)) {
|
|
4782
4805
|
context.removeNode(sibling);
|
|
4806
|
+
if (sibling.type === 3) {
|
|
4807
|
+
comments.unshift(sibling);
|
|
4808
|
+
}
|
|
4783
4809
|
continue;
|
|
4784
4810
|
}
|
|
4785
4811
|
if (sibling && sibling.type === 9) {
|
|
@@ -5297,7 +5323,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
5297
5323
|
let prev;
|
|
5298
5324
|
while (j--) {
|
|
5299
5325
|
prev = children[j];
|
|
5300
|
-
if (
|
|
5326
|
+
if (!isCommentOrWhitespace(prev)) {
|
|
5301
5327
|
break;
|
|
5302
5328
|
}
|
|
5303
5329
|
}
|
|
@@ -5375,7 +5401,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
5375
5401
|
} else if (implicitDefaultChildren.length && // #3766
|
|
5376
5402
|
// with whitespace: 'preserve', whitespaces between slots will end up in
|
|
5377
5403
|
// implicitDefaultChildren. Ignore if all implicit children are whitespaces.
|
|
5378
|
-
implicitDefaultChildren.
|
|
5404
|
+
!implicitDefaultChildren.every(isWhitespaceText)) {
|
|
5379
5405
|
if (hasNamedDefaultSlot) {
|
|
5380
5406
|
context.onError(
|
|
5381
5407
|
createCompilerError(
|
|
@@ -5448,11 +5474,6 @@ function hasForwardedSlots(children) {
|
|
|
5448
5474
|
}
|
|
5449
5475
|
return false;
|
|
5450
5476
|
}
|
|
5451
|
-
function isNonWhitespaceContent(node) {
|
|
5452
|
-
if (node.type !== 2 && node.type !== 12)
|
|
5453
|
-
return true;
|
|
5454
|
-
return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
|
|
5455
|
-
}
|
|
5456
5477
|
|
|
5457
5478
|
const directiveImportMap = /* @__PURE__ */ new WeakMap();
|
|
5458
5479
|
const transformElement = (node, context) => {
|
|
@@ -6864,6 +6885,7 @@ exports.defaultOnError = defaultOnError;
|
|
|
6864
6885
|
exports.defaultOnWarn = defaultOnWarn;
|
|
6865
6886
|
exports.errorMessages = errorMessages;
|
|
6866
6887
|
exports.extractIdentifiers = extractIdentifiers;
|
|
6888
|
+
exports.filterNonCommentChildren = filterNonCommentChildren;
|
|
6867
6889
|
exports.findDir = findDir;
|
|
6868
6890
|
exports.findProp = findProp;
|
|
6869
6891
|
exports.forAliasRE = forAliasRE;
|
|
@@ -6876,8 +6898,11 @@ exports.getVNodeBlockHelper = getVNodeBlockHelper;
|
|
|
6876
6898
|
exports.getVNodeHelper = getVNodeHelper;
|
|
6877
6899
|
exports.hasDynamicKeyVBind = hasDynamicKeyVBind;
|
|
6878
6900
|
exports.hasScopeRef = hasScopeRef;
|
|
6901
|
+
exports.hasSingleChild = hasSingleChild;
|
|
6879
6902
|
exports.helperNameMap = helperNameMap;
|
|
6880
6903
|
exports.injectProp = injectProp;
|
|
6904
|
+
exports.isAllWhitespace = isAllWhitespace;
|
|
6905
|
+
exports.isCommentOrWhitespace = isCommentOrWhitespace;
|
|
6881
6906
|
exports.isConstantNode = isConstantNode;
|
|
6882
6907
|
exports.isCoreComponent = isCoreComponent;
|
|
6883
6908
|
exports.isFnExpression = isFnExpression;
|
|
@@ -6892,6 +6917,7 @@ exports.isMemberExpressionBrowser = isMemberExpressionBrowser;
|
|
|
6892
6917
|
exports.isMemberExpressionNode = isMemberExpressionNode;
|
|
6893
6918
|
exports.isReferencedIdentifier = isReferencedIdentifier;
|
|
6894
6919
|
exports.isSimpleIdentifier = isSimpleIdentifier;
|
|
6920
|
+
exports.isSingleIfBlock = isSingleIfBlock;
|
|
6895
6921
|
exports.isSlotOutlet = isSlotOutlet;
|
|
6896
6922
|
exports.isStaticArgOf = isStaticArgOf;
|
|
6897
6923
|
exports.isStaticExp = isStaticExp;
|
|
@@ -6902,6 +6928,7 @@ exports.isTemplateNode = isTemplateNode;
|
|
|
6902
6928
|
exports.isText = isText$1;
|
|
6903
6929
|
exports.isVPre = isVPre;
|
|
6904
6930
|
exports.isVSlot = isVSlot;
|
|
6931
|
+
exports.isWhitespaceText = isWhitespaceText;
|
|
6905
6932
|
exports.locStub = locStub;
|
|
6906
6933
|
exports.noopDirectiveTransform = noopDirectiveTransform;
|
|
6907
6934
|
exports.processExpression = processExpression;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.6.0-alpha.
|
|
2
|
+
* @vue/compiler-core v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2302,7 +2302,43 @@ function getMemoedVNodeCall(node) {
|
|
|
2302
2302
|
return node;
|
|
2303
2303
|
}
|
|
2304
2304
|
}
|
|
2305
|
+
function filterNonCommentChildren(node) {
|
|
2306
|
+
return node.children.filter((n) => n.type !== 3);
|
|
2307
|
+
}
|
|
2308
|
+
function hasSingleChild(node) {
|
|
2309
|
+
return filterNonCommentChildren(node).length === 1;
|
|
2310
|
+
}
|
|
2311
|
+
function isSingleIfBlock(parent) {
|
|
2312
|
+
let hasEncounteredIf = false;
|
|
2313
|
+
for (const c of filterNonCommentChildren(parent)) {
|
|
2314
|
+
if (c.type === 9 || c.type === 1 && findDir(c, "if")) {
|
|
2315
|
+
if (hasEncounteredIf) return false;
|
|
2316
|
+
hasEncounteredIf = true;
|
|
2317
|
+
} else if (
|
|
2318
|
+
// node before v-if
|
|
2319
|
+
!hasEncounteredIf || // non else nodes
|
|
2320
|
+
!(c.type === 1 && findDir(c, /^else(-if)?$/, true))
|
|
2321
|
+
) {
|
|
2322
|
+
return false;
|
|
2323
|
+
}
|
|
2324
|
+
}
|
|
2325
|
+
return true;
|
|
2326
|
+
}
|
|
2305
2327
|
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
|
|
2328
|
+
function isAllWhitespace(str) {
|
|
2329
|
+
for (let i = 0; i < str.length; i++) {
|
|
2330
|
+
if (!isWhitespace(str.charCodeAt(i))) {
|
|
2331
|
+
return false;
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
return true;
|
|
2335
|
+
}
|
|
2336
|
+
function isWhitespaceText(node) {
|
|
2337
|
+
return node.type === 2 && isAllWhitespace(node.content) || node.type === 12 && isWhitespaceText(node.content);
|
|
2338
|
+
}
|
|
2339
|
+
function isCommentOrWhitespace(node) {
|
|
2340
|
+
return node.type === 3 || isWhitespaceText(node);
|
|
2341
|
+
}
|
|
2306
2342
|
|
|
2307
2343
|
const defaultParserOptions = {
|
|
2308
2344
|
parseMode: "base",
|
|
@@ -2892,14 +2928,6 @@ function condenseWhitespace(nodes) {
|
|
|
2892
2928
|
}
|
|
2893
2929
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
2894
2930
|
}
|
|
2895
|
-
function isAllWhitespace(str) {
|
|
2896
|
-
for (let i = 0; i < str.length; i++) {
|
|
2897
|
-
if (!isWhitespace(str.charCodeAt(i))) {
|
|
2898
|
-
return false;
|
|
2899
|
-
}
|
|
2900
|
-
}
|
|
2901
|
-
return true;
|
|
2902
|
-
}
|
|
2903
2931
|
function hasNewlineChar(str) {
|
|
2904
2932
|
for (let i = 0; i < str.length; i++) {
|
|
2905
2933
|
const c = str.charCodeAt(i);
|
|
@@ -4696,11 +4724,7 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
4696
4724
|
let i = siblings.indexOf(node);
|
|
4697
4725
|
while (i-- >= -1) {
|
|
4698
4726
|
const sibling = siblings[i];
|
|
4699
|
-
if (sibling && sibling
|
|
4700
|
-
context.removeNode(sibling);
|
|
4701
|
-
continue;
|
|
4702
|
-
}
|
|
4703
|
-
if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
|
|
4727
|
+
if (sibling && isCommentOrWhitespace(sibling)) {
|
|
4704
4728
|
context.removeNode(sibling);
|
|
4705
4729
|
continue;
|
|
4706
4730
|
}
|
|
@@ -5212,7 +5236,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
5212
5236
|
let prev;
|
|
5213
5237
|
while (j--) {
|
|
5214
5238
|
prev = children[j];
|
|
5215
|
-
if (
|
|
5239
|
+
if (!isCommentOrWhitespace(prev)) {
|
|
5216
5240
|
break;
|
|
5217
5241
|
}
|
|
5218
5242
|
}
|
|
@@ -5290,7 +5314,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
5290
5314
|
} else if (implicitDefaultChildren.length && // #3766
|
|
5291
5315
|
// with whitespace: 'preserve', whitespaces between slots will end up in
|
|
5292
5316
|
// implicitDefaultChildren. Ignore if all implicit children are whitespaces.
|
|
5293
|
-
implicitDefaultChildren.
|
|
5317
|
+
!implicitDefaultChildren.every(isWhitespaceText)) {
|
|
5294
5318
|
if (hasNamedDefaultSlot) {
|
|
5295
5319
|
context.onError(
|
|
5296
5320
|
createCompilerError(
|
|
@@ -5363,11 +5387,6 @@ function hasForwardedSlots(children) {
|
|
|
5363
5387
|
}
|
|
5364
5388
|
return false;
|
|
5365
5389
|
}
|
|
5366
|
-
function isNonWhitespaceContent(node) {
|
|
5367
|
-
if (node.type !== 2 && node.type !== 12)
|
|
5368
|
-
return true;
|
|
5369
|
-
return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
|
|
5370
|
-
}
|
|
5371
5390
|
|
|
5372
5391
|
const directiveImportMap = /* @__PURE__ */ new WeakMap();
|
|
5373
5392
|
const transformElement = (node, context) => {
|
|
@@ -6741,6 +6760,7 @@ exports.defaultOnError = defaultOnError;
|
|
|
6741
6760
|
exports.defaultOnWarn = defaultOnWarn;
|
|
6742
6761
|
exports.errorMessages = errorMessages;
|
|
6743
6762
|
exports.extractIdentifiers = extractIdentifiers;
|
|
6763
|
+
exports.filterNonCommentChildren = filterNonCommentChildren;
|
|
6744
6764
|
exports.findDir = findDir;
|
|
6745
6765
|
exports.findProp = findProp;
|
|
6746
6766
|
exports.forAliasRE = forAliasRE;
|
|
@@ -6753,8 +6773,11 @@ exports.getVNodeBlockHelper = getVNodeBlockHelper;
|
|
|
6753
6773
|
exports.getVNodeHelper = getVNodeHelper;
|
|
6754
6774
|
exports.hasDynamicKeyVBind = hasDynamicKeyVBind;
|
|
6755
6775
|
exports.hasScopeRef = hasScopeRef;
|
|
6776
|
+
exports.hasSingleChild = hasSingleChild;
|
|
6756
6777
|
exports.helperNameMap = helperNameMap;
|
|
6757
6778
|
exports.injectProp = injectProp;
|
|
6779
|
+
exports.isAllWhitespace = isAllWhitespace;
|
|
6780
|
+
exports.isCommentOrWhitespace = isCommentOrWhitespace;
|
|
6758
6781
|
exports.isConstantNode = isConstantNode;
|
|
6759
6782
|
exports.isCoreComponent = isCoreComponent;
|
|
6760
6783
|
exports.isFnExpression = isFnExpression;
|
|
@@ -6769,6 +6792,7 @@ exports.isMemberExpressionBrowser = isMemberExpressionBrowser;
|
|
|
6769
6792
|
exports.isMemberExpressionNode = isMemberExpressionNode;
|
|
6770
6793
|
exports.isReferencedIdentifier = isReferencedIdentifier;
|
|
6771
6794
|
exports.isSimpleIdentifier = isSimpleIdentifier;
|
|
6795
|
+
exports.isSingleIfBlock = isSingleIfBlock;
|
|
6772
6796
|
exports.isSlotOutlet = isSlotOutlet;
|
|
6773
6797
|
exports.isStaticArgOf = isStaticArgOf;
|
|
6774
6798
|
exports.isStaticExp = isStaticExp;
|
|
@@ -6779,6 +6803,7 @@ exports.isTemplateNode = isTemplateNode;
|
|
|
6779
6803
|
exports.isText = isText$1;
|
|
6780
6804
|
exports.isVPre = isVPre;
|
|
6781
6805
|
exports.isVSlot = isVSlot;
|
|
6806
|
+
exports.isWhitespaceText = isWhitespaceText;
|
|
6782
6807
|
exports.locStub = locStub;
|
|
6783
6808
|
exports.noopDirectiveTransform = noopDirectiveTransform;
|
|
6784
6809
|
exports.processExpression = processExpression;
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -983,7 +983,6 @@ export interface BaseCodegenResult {
|
|
|
983
983
|
}
|
|
984
984
|
export interface CodegenResult extends BaseCodegenResult {
|
|
985
985
|
ast: RootNode;
|
|
986
|
-
helpers: Set<symbol>;
|
|
987
986
|
}
|
|
988
987
|
export declare enum NewlineType {
|
|
989
988
|
/** Start with `\n` */
|
|
@@ -1054,7 +1053,13 @@ export declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Prope
|
|
|
1054
1053
|
export declare function toValidAssetId(name: string, type: 'component' | 'directive' | 'filter'): string;
|
|
1055
1054
|
export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | CacheExpression | undefined, ids: TransformContext['identifiers']): boolean;
|
|
1056
1055
|
export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
|
|
1056
|
+
export declare function filterNonCommentChildren(node: ParentNode): TemplateChildNode[];
|
|
1057
|
+
export declare function hasSingleChild(node: ParentNode): boolean;
|
|
1058
|
+
export declare function isSingleIfBlock(parent: ParentNode): boolean;
|
|
1057
1059
|
export declare const forAliasRE: RegExp;
|
|
1060
|
+
export declare function isAllWhitespace(str: string): boolean;
|
|
1061
|
+
export declare function isWhitespaceText(node: TemplateChildNode): boolean;
|
|
1062
|
+
export declare function isCommentOrWhitespace(node: TemplateChildNode): boolean;
|
|
1058
1063
|
|
|
1059
1064
|
/**
|
|
1060
1065
|
* Return value indicates whether the AST walked can be a constant
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.6.0-alpha.
|
|
2
|
+
* @vue/compiler-core v3.6.0-alpha.5
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -1967,7 +1967,43 @@ function getMemoedVNodeCall(node) {
|
|
|
1967
1967
|
return node;
|
|
1968
1968
|
}
|
|
1969
1969
|
}
|
|
1970
|
+
function filterNonCommentChildren(node) {
|
|
1971
|
+
return node.children.filter((n) => n.type !== 3);
|
|
1972
|
+
}
|
|
1973
|
+
function hasSingleChild(node) {
|
|
1974
|
+
return filterNonCommentChildren(node).length === 1;
|
|
1975
|
+
}
|
|
1976
|
+
function isSingleIfBlock(parent) {
|
|
1977
|
+
let hasEncounteredIf = false;
|
|
1978
|
+
for (const c of filterNonCommentChildren(parent)) {
|
|
1979
|
+
if (c.type === 9 || c.type === 1 && findDir(c, "if")) {
|
|
1980
|
+
if (hasEncounteredIf) return false;
|
|
1981
|
+
hasEncounteredIf = true;
|
|
1982
|
+
} else if (
|
|
1983
|
+
// node before v-if
|
|
1984
|
+
!hasEncounteredIf || // non else nodes
|
|
1985
|
+
!(c.type === 1 && findDir(c, /^else(-if)?$/, true))
|
|
1986
|
+
) {
|
|
1987
|
+
return false;
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
return true;
|
|
1991
|
+
}
|
|
1970
1992
|
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;
|
|
1993
|
+
function isAllWhitespace(str) {
|
|
1994
|
+
for (let i = 0; i < str.length; i++) {
|
|
1995
|
+
if (!isWhitespace(str.charCodeAt(i))) {
|
|
1996
|
+
return false;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
return true;
|
|
2000
|
+
}
|
|
2001
|
+
function isWhitespaceText(node) {
|
|
2002
|
+
return node.type === 2 && isAllWhitespace(node.content) || node.type === 12 && isWhitespaceText(node.content);
|
|
2003
|
+
}
|
|
2004
|
+
function isCommentOrWhitespace(node) {
|
|
2005
|
+
return node.type === 3 || isWhitespaceText(node);
|
|
2006
|
+
}
|
|
1971
2007
|
|
|
1972
2008
|
const defaultParserOptions = {
|
|
1973
2009
|
parseMode: "base",
|
|
@@ -2590,14 +2626,6 @@ function condenseWhitespace(nodes) {
|
|
|
2590
2626
|
}
|
|
2591
2627
|
return removedWhitespace ? nodes.filter(Boolean) : nodes;
|
|
2592
2628
|
}
|
|
2593
|
-
function isAllWhitespace(str) {
|
|
2594
|
-
for (let i = 0; i < str.length; i++) {
|
|
2595
|
-
if (!isWhitespace(str.charCodeAt(i))) {
|
|
2596
|
-
return false;
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
return true;
|
|
2600
|
-
}
|
|
2601
2629
|
function hasNewlineChar(str) {
|
|
2602
2630
|
for (let i = 0; i < str.length; i++) {
|
|
2603
2631
|
const c = str.charCodeAt(i);
|
|
@@ -4044,13 +4072,11 @@ function processIf(node, dir, context, processCodegen) {
|
|
|
4044
4072
|
let i = siblings.indexOf(node);
|
|
4045
4073
|
while (i-- >= -1) {
|
|
4046
4074
|
const sibling = siblings[i];
|
|
4047
|
-
if (sibling && sibling
|
|
4048
|
-
context.removeNode(sibling);
|
|
4049
|
-
!!(process.env.NODE_ENV !== "production") && comments.unshift(sibling);
|
|
4050
|
-
continue;
|
|
4051
|
-
}
|
|
4052
|
-
if (sibling && sibling.type === 2 && !sibling.content.trim().length) {
|
|
4075
|
+
if (sibling && isCommentOrWhitespace(sibling)) {
|
|
4053
4076
|
context.removeNode(sibling);
|
|
4077
|
+
if (!!(process.env.NODE_ENV !== "production") && sibling.type === 3) {
|
|
4078
|
+
comments.unshift(sibling);
|
|
4079
|
+
}
|
|
4054
4080
|
continue;
|
|
4055
4081
|
}
|
|
4056
4082
|
if (sibling && sibling.type === 9) {
|
|
@@ -4522,7 +4548,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
4522
4548
|
let prev;
|
|
4523
4549
|
while (j--) {
|
|
4524
4550
|
prev = children[j];
|
|
4525
|
-
if (
|
|
4551
|
+
if (!isCommentOrWhitespace(prev)) {
|
|
4526
4552
|
break;
|
|
4527
4553
|
}
|
|
4528
4554
|
}
|
|
@@ -4600,7 +4626,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
|
|
|
4600
4626
|
} else if (implicitDefaultChildren.length && // #3766
|
|
4601
4627
|
// with whitespace: 'preserve', whitespaces between slots will end up in
|
|
4602
4628
|
// implicitDefaultChildren. Ignore if all implicit children are whitespaces.
|
|
4603
|
-
implicitDefaultChildren.
|
|
4629
|
+
!implicitDefaultChildren.every(isWhitespaceText)) {
|
|
4604
4630
|
if (hasNamedDefaultSlot) {
|
|
4605
4631
|
context.onError(
|
|
4606
4632
|
createCompilerError(
|
|
@@ -4673,11 +4699,6 @@ function hasForwardedSlots(children) {
|
|
|
4673
4699
|
}
|
|
4674
4700
|
return false;
|
|
4675
4701
|
}
|
|
4676
|
-
function isNonWhitespaceContent(node) {
|
|
4677
|
-
if (node.type !== 2 && node.type !== 12)
|
|
4678
|
-
return true;
|
|
4679
|
-
return node.type === 2 ? !!node.content.trim() : isNonWhitespaceContent(node.content);
|
|
4680
|
-
}
|
|
4681
4702
|
|
|
4682
4703
|
const directiveImportMap = /* @__PURE__ */ new WeakMap();
|
|
4683
4704
|
const transformElement = (node, context) => {
|
|
@@ -5872,4 +5893,4 @@ const BindingTypes = {
|
|
|
5872
5893
|
|
|
5873
5894
|
const noopDirectiveTransform = () => ({ props: [] });
|
|
5874
5895
|
|
|
5875
|
-
export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, NewlineType, NodeTypes, 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, TS_NODE_TYPES, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, defaultOnError, defaultOnWarn, errorMessages, extractIdentifiers, findDir, findProp, forAliasRE, generate, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getSelfName, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, helperNameMap, injectProp, isConstantNode, isCoreComponent, isFnExpression, isFnExpressionBrowser, isFnExpressionNode, isFunctionType, isInDestructureAssignment, isInNewExpression, isLiteralWhitelisted, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticNode, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVPre, isVSlot, locStub, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, transformVBindShorthand, traverseNode, unwrapTSNode, validFirstIdentCharRE, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
|
5896
|
+
export { BASE_TRANSITION, BindingTypes, CAMELIZE, CAPITALIZE, CREATE_BLOCK, CREATE_COMMENT, CREATE_ELEMENT_BLOCK, CREATE_ELEMENT_VNODE, CREATE_SLOTS, CREATE_STATIC, CREATE_TEXT, CREATE_VNODE, CompilerDeprecationTypes, ConstantTypes, ElementTypes, ErrorCodes, FRAGMENT, GUARD_REACTIVE_PROPS, IS_MEMO_SAME, IS_REF, KEEP_ALIVE, MERGE_PROPS, NORMALIZE_CLASS, NORMALIZE_PROPS, NORMALIZE_STYLE, NewlineType, NodeTypes, 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, TS_NODE_TYPES, UNREF, WITH_CTX, WITH_DIRECTIVES, WITH_MEMO, advancePositionWithClone, advancePositionWithMutation, assert, baseCompile, baseParse, buildDirectiveArgs, buildProps, buildSlots, checkCompatEnabled, convertToBlock, createArrayExpression, createAssignmentExpression, createBlockStatement, createCacheExpression, createCallExpression, createCompilerError, createCompoundExpression, createConditionalExpression, createForLoopParams, createFunctionExpression, createIfStatement, createInterpolation, createObjectExpression, createObjectProperty, createReturnStatement, createRoot, createSequenceExpression, createSimpleExpression, createStructuralDirectiveTransform, createTemplateLiteral, createTransformContext, createVNodeCall, defaultOnError, defaultOnWarn, errorMessages, extractIdentifiers, filterNonCommentChildren, findDir, findProp, forAliasRE, generate, getBaseTransformPreset, getConstantType, getMemoedVNodeCall, getSelfName, getVNodeBlockHelper, getVNodeHelper, hasDynamicKeyVBind, hasScopeRef, hasSingleChild, helperNameMap, injectProp, isAllWhitespace, isCommentOrWhitespace, isConstantNode, isCoreComponent, isFnExpression, isFnExpressionBrowser, isFnExpressionNode, isFunctionType, isInDestructureAssignment, isInNewExpression, isLiteralWhitelisted, isMemberExpression, isMemberExpressionBrowser, isMemberExpressionNode, isReferencedIdentifier, isSimpleIdentifier, isSingleIfBlock, isSlotOutlet, isStaticArgOf, isStaticExp, isStaticNode, isStaticProperty, isStaticPropertyKey, isTemplateNode, isText$1 as isText, isVPre, isVSlot, isWhitespaceText, locStub, noopDirectiveTransform, processExpression, processFor, processIf, processSlotOutlet, registerRuntimeHelpers, resolveComponentType, stringifyExpression, toValidAssetId, trackSlotScopes, trackVForSlotScopes, transform, transformBind, transformElement, transformExpression, transformModel, transformOn, transformVBindShorthand, traverseNode, unwrapTSNode, validFirstIdentCharRE, walkBlockDeclarations, walkFunctionParams, walkIdentifiers, warnDeprecation };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.6.0-alpha.
|
|
3
|
+
"version": "3.6.0-alpha.5",
|
|
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.1",
|
|
53
|
-
"@vue/shared": "3.6.0-alpha.
|
|
53
|
+
"@vue/shared": "3.6.0-alpha.5"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@babel/types": "^7.28.5"
|