@vue/compiler-core 3.4.21 → 3.4.23
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.4.
|
|
2
|
+
* @vue/compiler-core v3.4.23
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2533,7 +2533,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2533
2533
|
if (isImplied) {
|
|
2534
2534
|
setLocEnd(el.loc, backTrack(end, 60));
|
|
2535
2535
|
} else {
|
|
2536
|
-
setLocEnd(el.loc, end + 1);
|
|
2536
|
+
setLocEnd(el.loc, lookAhead(end, 62) + 1);
|
|
2537
2537
|
}
|
|
2538
2538
|
if (tokenizer.inSFCRoot) {
|
|
2539
2539
|
if (el.children.length) {
|
|
@@ -2628,6 +2628,12 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2628
2628
|
}
|
|
2629
2629
|
}
|
|
2630
2630
|
}
|
|
2631
|
+
function lookAhead(index, c) {
|
|
2632
|
+
let i = index;
|
|
2633
|
+
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
|
|
2634
|
+
i++;
|
|
2635
|
+
return i;
|
|
2636
|
+
}
|
|
2631
2637
|
function backTrack(index, c) {
|
|
2632
2638
|
let i = index;
|
|
2633
2639
|
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
@@ -3529,7 +3535,6 @@ function createCodegenContext(ast, {
|
|
|
3529
3535
|
generatedLine: context.line,
|
|
3530
3536
|
generatedColumn: context.column - 1,
|
|
3531
3537
|
source: filename,
|
|
3532
|
-
// @ts-expect-error it is possible to be null
|
|
3533
3538
|
name
|
|
3534
3539
|
});
|
|
3535
3540
|
}
|
|
@@ -5290,13 +5295,30 @@ const transformElement = (node, context) => {
|
|
|
5290
5295
|
function resolveComponentType(node, context, ssr = false) {
|
|
5291
5296
|
let { tag } = node;
|
|
5292
5297
|
const isExplicitDynamic = isComponentTag(tag);
|
|
5293
|
-
const isProp = findProp(
|
|
5298
|
+
const isProp = findProp(
|
|
5299
|
+
node,
|
|
5300
|
+
"is",
|
|
5301
|
+
false,
|
|
5302
|
+
true
|
|
5303
|
+
/* allow empty */
|
|
5304
|
+
);
|
|
5294
5305
|
if (isProp) {
|
|
5295
5306
|
if (isExplicitDynamic || isCompatEnabled(
|
|
5296
5307
|
"COMPILER_IS_ON_ELEMENT",
|
|
5297
5308
|
context
|
|
5298
5309
|
)) {
|
|
5299
|
-
|
|
5310
|
+
let exp;
|
|
5311
|
+
if (isProp.type === 6) {
|
|
5312
|
+
exp = isProp.value && createSimpleExpression(isProp.value.content, true);
|
|
5313
|
+
} else {
|
|
5314
|
+
exp = isProp.exp;
|
|
5315
|
+
if (!exp) {
|
|
5316
|
+
exp = createSimpleExpression(`is`, false, isProp.loc);
|
|
5317
|
+
{
|
|
5318
|
+
exp = isProp.exp = processExpression(exp, context);
|
|
5319
|
+
}
|
|
5320
|
+
}
|
|
5321
|
+
}
|
|
5300
5322
|
if (exp) {
|
|
5301
5323
|
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
5302
5324
|
exp
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.4.
|
|
2
|
+
* @vue/compiler-core v3.4.23
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2529,7 +2529,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2529
2529
|
if (isImplied) {
|
|
2530
2530
|
setLocEnd(el.loc, backTrack(end, 60));
|
|
2531
2531
|
} else {
|
|
2532
|
-
setLocEnd(el.loc, end + 1);
|
|
2532
|
+
setLocEnd(el.loc, lookAhead(end, 62) + 1);
|
|
2533
2533
|
}
|
|
2534
2534
|
if (tokenizer.inSFCRoot) {
|
|
2535
2535
|
if (el.children.length) {
|
|
@@ -2594,6 +2594,12 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2594
2594
|
}
|
|
2595
2595
|
}
|
|
2596
2596
|
}
|
|
2597
|
+
function lookAhead(index, c) {
|
|
2598
|
+
let i = index;
|
|
2599
|
+
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
|
|
2600
|
+
i++;
|
|
2601
|
+
return i;
|
|
2602
|
+
}
|
|
2597
2603
|
function backTrack(index, c) {
|
|
2598
2604
|
let i = index;
|
|
2599
2605
|
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
@@ -3470,7 +3476,6 @@ function createCodegenContext(ast, {
|
|
|
3470
3476
|
generatedLine: context.line,
|
|
3471
3477
|
generatedColumn: context.column - 1,
|
|
3472
3478
|
source: filename,
|
|
3473
|
-
// @ts-expect-error it is possible to be null
|
|
3474
3479
|
name
|
|
3475
3480
|
});
|
|
3476
3481
|
}
|
|
@@ -5195,13 +5200,30 @@ const transformElement = (node, context) => {
|
|
|
5195
5200
|
function resolveComponentType(node, context, ssr = false) {
|
|
5196
5201
|
let { tag } = node;
|
|
5197
5202
|
const isExplicitDynamic = isComponentTag(tag);
|
|
5198
|
-
const isProp = findProp(
|
|
5203
|
+
const isProp = findProp(
|
|
5204
|
+
node,
|
|
5205
|
+
"is",
|
|
5206
|
+
false,
|
|
5207
|
+
true
|
|
5208
|
+
/* allow empty */
|
|
5209
|
+
);
|
|
5199
5210
|
if (isProp) {
|
|
5200
5211
|
if (isExplicitDynamic || isCompatEnabled(
|
|
5201
5212
|
"COMPILER_IS_ON_ELEMENT",
|
|
5202
5213
|
context
|
|
5203
5214
|
)) {
|
|
5204
|
-
|
|
5215
|
+
let exp;
|
|
5216
|
+
if (isProp.type === 6) {
|
|
5217
|
+
exp = isProp.value && createSimpleExpression(isProp.value.content, true);
|
|
5218
|
+
} else {
|
|
5219
|
+
exp = isProp.exp;
|
|
5220
|
+
if (!exp) {
|
|
5221
|
+
exp = createSimpleExpression(`is`, false, isProp.loc);
|
|
5222
|
+
{
|
|
5223
|
+
exp = isProp.exp = processExpression(exp, context);
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
}
|
|
5205
5227
|
if (exp) {
|
|
5206
5228
|
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
5207
5229
|
exp
|
package/dist/compiler-core.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
|
|
2
2
|
import { ParserPlugin } from '@babel/parser';
|
|
3
|
-
import { RawSourceMap, SourceMapGenerator } from 'source-map-js';
|
|
4
3
|
export { generateCodeFrame } from '@vue/shared';
|
|
5
4
|
|
|
6
5
|
export declare const FRAGMENT: unique symbol;
|
|
@@ -670,6 +669,7 @@ export interface ParserOptions extends ErrorHandlingOptions, CompilerCompatOptio
|
|
|
670
669
|
delimiters?: [string, string];
|
|
671
670
|
/**
|
|
672
671
|
* Whitespace handling strategy
|
|
672
|
+
* @default 'condense'
|
|
673
673
|
*/
|
|
674
674
|
whitespace?: 'preserve' | 'condense';
|
|
675
675
|
/**
|
|
@@ -924,6 +924,41 @@ export interface CodegenOptions extends SharedTransformCodegenOptions {
|
|
|
924
924
|
}
|
|
925
925
|
export type CompilerOptions = ParserOptions & TransformOptions & CodegenOptions;
|
|
926
926
|
|
|
927
|
+
/**
|
|
928
|
+
* The `SourceMapGenerator` type from `source-map-js` is a bit incomplete as it
|
|
929
|
+
* misses `toJSON()`. We also need to add types for internal properties which we
|
|
930
|
+
* need to access for better performance.
|
|
931
|
+
*
|
|
932
|
+
* Since TS 5.3, dts generation starts to strangely include broken triple slash
|
|
933
|
+
* references for source-map-js, so we are inlining all source map related types
|
|
934
|
+
* here to to workaround that.
|
|
935
|
+
*/
|
|
936
|
+
export interface CodegenSourceMapGenerator {
|
|
937
|
+
setSourceContent(sourceFile: string, sourceContent: string): void;
|
|
938
|
+
toJSON(): RawSourceMap;
|
|
939
|
+
_sources: Set<string>;
|
|
940
|
+
_names: Set<string>;
|
|
941
|
+
_mappings: {
|
|
942
|
+
add(mapping: MappingItem): void;
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
export interface RawSourceMap {
|
|
946
|
+
file?: string;
|
|
947
|
+
sourceRoot?: string;
|
|
948
|
+
version: string;
|
|
949
|
+
sources: string[];
|
|
950
|
+
names: string[];
|
|
951
|
+
sourcesContent?: string[];
|
|
952
|
+
mappings: string;
|
|
953
|
+
}
|
|
954
|
+
interface MappingItem {
|
|
955
|
+
source: string;
|
|
956
|
+
generatedLine: number;
|
|
957
|
+
generatedColumn: number;
|
|
958
|
+
originalLine: number;
|
|
959
|
+
originalColumn: number;
|
|
960
|
+
name: string | null;
|
|
961
|
+
}
|
|
927
962
|
type CodegenNode = TemplateChildNode | JSChildNode | SSRCodegenNode;
|
|
928
963
|
export interface CodegenResult {
|
|
929
964
|
code: string;
|
|
@@ -939,7 +974,7 @@ export interface CodegenContext extends Omit<Required<CodegenOptions>, 'bindingM
|
|
|
939
974
|
offset: number;
|
|
940
975
|
indentLevel: number;
|
|
941
976
|
pure: boolean;
|
|
942
|
-
map?:
|
|
977
|
+
map?: CodegenSourceMapGenerator;
|
|
943
978
|
helper(key: symbol): string;
|
|
944
979
|
push(code: string, newlineIndex?: number, node?: CodegenNode): void;
|
|
945
980
|
indent(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compiler-core v3.4.
|
|
2
|
+
* @vue/compiler-core v3.4.23
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -2298,7 +2298,7 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2298
2298
|
if (isImplied) {
|
|
2299
2299
|
setLocEnd(el.loc, backTrack(end, 60));
|
|
2300
2300
|
} else {
|
|
2301
|
-
setLocEnd(el.loc, end + 1);
|
|
2301
|
+
setLocEnd(el.loc, lookAhead(end, 62) + 1);
|
|
2302
2302
|
}
|
|
2303
2303
|
if (tokenizer.inSFCRoot) {
|
|
2304
2304
|
if (el.children.length) {
|
|
@@ -2393,6 +2393,12 @@ function onCloseTag(el, end, isImplied = false) {
|
|
|
2393
2393
|
}
|
|
2394
2394
|
}
|
|
2395
2395
|
}
|
|
2396
|
+
function lookAhead(index, c) {
|
|
2397
|
+
let i = index;
|
|
2398
|
+
while (currentInput.charCodeAt(i) !== c && i < currentInput.length - 1)
|
|
2399
|
+
i++;
|
|
2400
|
+
return i;
|
|
2401
|
+
}
|
|
2396
2402
|
function backTrack(index, c) {
|
|
2397
2403
|
let i = index;
|
|
2398
2404
|
while (currentInput.charCodeAt(i) !== c && i >= 0)
|
|
@@ -4605,13 +4611,27 @@ const transformElement = (node, context) => {
|
|
|
4605
4611
|
function resolveComponentType(node, context, ssr = false) {
|
|
4606
4612
|
let { tag } = node;
|
|
4607
4613
|
const isExplicitDynamic = isComponentTag(tag);
|
|
4608
|
-
const isProp = findProp(
|
|
4614
|
+
const isProp = findProp(
|
|
4615
|
+
node,
|
|
4616
|
+
"is",
|
|
4617
|
+
false,
|
|
4618
|
+
true
|
|
4619
|
+
/* allow empty */
|
|
4620
|
+
);
|
|
4609
4621
|
if (isProp) {
|
|
4610
4622
|
if (isExplicitDynamic || isCompatEnabled(
|
|
4611
4623
|
"COMPILER_IS_ON_ELEMENT",
|
|
4612
4624
|
context
|
|
4613
4625
|
)) {
|
|
4614
|
-
|
|
4626
|
+
let exp;
|
|
4627
|
+
if (isProp.type === 6) {
|
|
4628
|
+
exp = isProp.value && createSimpleExpression(isProp.value.content, true);
|
|
4629
|
+
} else {
|
|
4630
|
+
exp = isProp.exp;
|
|
4631
|
+
if (!exp) {
|
|
4632
|
+
exp = createSimpleExpression(`is`, false, isProp.loc);
|
|
4633
|
+
}
|
|
4634
|
+
}
|
|
4615
4635
|
if (exp) {
|
|
4616
4636
|
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
|
|
4617
4637
|
exp
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/compiler-core",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.23",
|
|
4
4
|
"description": "@vue/compiler-core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/compiler-core.esm-bundler.js",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/vuejs/core/tree/main/packages/compiler-core#readme",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@babel/parser": "^7.
|
|
49
|
+
"@babel/parser": "^7.24.1",
|
|
50
50
|
"entities": "^4.5.0",
|
|
51
51
|
"estree-walker": "^2.0.2",
|
|
52
|
-
"source-map-js": "^1.0
|
|
53
|
-
"@vue/shared": "3.4.
|
|
52
|
+
"source-map-js": "^1.2.0",
|
|
53
|
+
"@vue/shared": "3.4.23"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@babel/types": "^7.
|
|
56
|
+
"@babel/types": "^7.24.0"
|
|
57
57
|
}
|
|
58
58
|
}
|