@vue/compiler-core 3.5.0-alpha.2 → 3.5.0-alpha.4
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-core.cjs.js +260 -249
- package/dist/compiler-core.cjs.prod.js +255 -244
- package/dist/compiler-core.d.ts +25 -16
- package/dist/compiler-core.esm-bundler.js +246 -216
- package/package.json +4 -4
package/dist/compiler-core.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { PatchFlags } from '@vue/shared';
|
|
2
|
+
export { generateCodeFrame } from '@vue/shared';
|
|
1
3
|
import { Node as Node$1, Identifier, Function, BlockStatement as BlockStatement$1, Program, ObjectProperty } from '@babel/types';
|
|
2
4
|
import { ParserPlugin } from '@babel/parser';
|
|
3
|
-
export { generateCodeFrame } from '@vue/shared';
|
|
4
5
|
|
|
5
6
|
export declare const FRAGMENT: unique symbol;
|
|
6
7
|
export declare const TELEPORT: unique symbol;
|
|
@@ -34,7 +35,14 @@ export declare const CAMELIZE: unique symbol;
|
|
|
34
35
|
export declare const CAPITALIZE: unique symbol;
|
|
35
36
|
export declare const TO_HANDLER_KEY: unique symbol;
|
|
36
37
|
export declare const SET_BLOCK_TRACKING: unique symbol;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated no longer needed in 3.5+ because we no longer hoist element nodes
|
|
40
|
+
* but kept for backwards compat
|
|
41
|
+
*/
|
|
37
42
|
export declare const PUSH_SCOPE_ID: unique symbol;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated kept for backwards compat
|
|
45
|
+
*/
|
|
38
46
|
export declare const POP_SCOPE_ID: unique symbol;
|
|
39
47
|
export declare const WITH_CTX: unique symbol;
|
|
40
48
|
export declare const UNREF: unique symbol;
|
|
@@ -88,7 +96,7 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
|
|
|
88
96
|
hoists: (JSChildNode | null)[];
|
|
89
97
|
imports: ImportItem[];
|
|
90
98
|
temps: number;
|
|
91
|
-
cached:
|
|
99
|
+
cached: (CacheExpression | null)[];
|
|
92
100
|
identifiers: {
|
|
93
101
|
[name: string]: number | undefined;
|
|
94
102
|
};
|
|
@@ -112,7 +120,7 @@ export interface TransformContext extends Required<Omit<TransformOptions, keyof
|
|
|
112
120
|
addIdentifiers(exp: ExpressionNode | string): void;
|
|
113
121
|
removeIdentifiers(exp: ExpressionNode | string): void;
|
|
114
122
|
hoist(exp: string | JSChildNode | ArrayExpression): SimpleExpressionNode;
|
|
115
|
-
cache
|
|
123
|
+
cache(exp: JSChildNode, isVNode?: boolean): CacheExpression;
|
|
116
124
|
constantCache: WeakMap<TemplateChildNode, ConstantTypes>;
|
|
117
125
|
filters?: Set<string>;
|
|
118
126
|
}
|
|
@@ -200,7 +208,7 @@ export interface RootNode extends Node {
|
|
|
200
208
|
directives: string[];
|
|
201
209
|
hoists: (JSChildNode | null)[];
|
|
202
210
|
imports: ImportItem[];
|
|
203
|
-
cached:
|
|
211
|
+
cached: (CacheExpression | null)[];
|
|
204
212
|
temps: number;
|
|
205
213
|
ssrHelpers?: symbol[];
|
|
206
214
|
codegenNode?: TemplateChildNode | JSChildNode | BlockStatement;
|
|
@@ -278,7 +286,7 @@ export interface DirectiveNode extends Node {
|
|
|
278
286
|
export declare enum ConstantTypes {
|
|
279
287
|
NOT_CONSTANT = 0,
|
|
280
288
|
CAN_SKIP_PATCH = 1,
|
|
281
|
-
|
|
289
|
+
CAN_CACHE = 2,
|
|
282
290
|
CAN_STRINGIFY = 3
|
|
283
291
|
}
|
|
284
292
|
export interface SimpleExpressionNode extends Node {
|
|
@@ -363,8 +371,8 @@ export interface VNodeCall extends Node {
|
|
|
363
371
|
type: NodeTypes.VNODE_CALL;
|
|
364
372
|
tag: string | symbol | CallExpression;
|
|
365
373
|
props: PropsExpression | undefined;
|
|
366
|
-
children: TemplateChildNode[] | TemplateTextChildNode | SlotsExpression | ForRenderListExpression | SimpleExpressionNode | undefined;
|
|
367
|
-
patchFlag:
|
|
374
|
+
children: TemplateChildNode[] | TemplateTextChildNode | SlotsExpression | ForRenderListExpression | SimpleExpressionNode | CacheExpression | undefined;
|
|
375
|
+
patchFlag: PatchFlags | undefined;
|
|
368
376
|
dynamicProps: string | SimpleExpressionNode | undefined;
|
|
369
377
|
directives: DirectiveArguments | undefined;
|
|
370
378
|
isBlock: boolean;
|
|
@@ -418,7 +426,8 @@ export interface CacheExpression extends Node {
|
|
|
418
426
|
type: NodeTypes.JS_CACHE_EXPRESSION;
|
|
419
427
|
index: number;
|
|
420
428
|
value: JSChildNode;
|
|
421
|
-
|
|
429
|
+
needPauseTracking: boolean;
|
|
430
|
+
needArraySpread: boolean;
|
|
422
431
|
}
|
|
423
432
|
export interface MemoExpression extends CallExpression {
|
|
424
433
|
callee: typeof WITH_MEMO;
|
|
@@ -478,7 +487,7 @@ export interface SlotsObjectProperty extends Property {
|
|
|
478
487
|
value: SlotFunctionExpression;
|
|
479
488
|
}
|
|
480
489
|
export interface SlotFunctionExpression extends FunctionExpression {
|
|
481
|
-
returns: TemplateChildNode[];
|
|
490
|
+
returns: TemplateChildNode[] | CacheExpression;
|
|
482
491
|
}
|
|
483
492
|
export interface DynamicSlotsExpression extends CallExpression {
|
|
484
493
|
callee: typeof CREATE_SLOTS;
|
|
@@ -514,7 +523,7 @@ export interface ForCodegenNode extends VNodeCall {
|
|
|
514
523
|
tag: typeof FRAGMENT;
|
|
515
524
|
props: undefined;
|
|
516
525
|
children: ForRenderListExpression;
|
|
517
|
-
patchFlag:
|
|
526
|
+
patchFlag: PatchFlags;
|
|
518
527
|
disableTracking: boolean;
|
|
519
528
|
}
|
|
520
529
|
export interface ForRenderListExpression extends CallExpression {
|
|
@@ -522,7 +531,7 @@ export interface ForRenderListExpression extends CallExpression {
|
|
|
522
531
|
arguments: [ExpressionNode, ForIteratorExpression];
|
|
523
532
|
}
|
|
524
533
|
export interface ForIteratorExpression extends FunctionExpression {
|
|
525
|
-
returns
|
|
534
|
+
returns?: BlockCodegenNode;
|
|
526
535
|
}
|
|
527
536
|
export declare const locStub: SourceLocation;
|
|
528
537
|
export declare function createRoot(children: TemplateChildNode[], source?: string): RootNode;
|
|
@@ -537,7 +546,7 @@ type InferCodegenNodeType<T> = T extends typeof RENDER_SLOT ? RenderSlotCall : C
|
|
|
537
546
|
export declare function createCallExpression<T extends CallExpression['callee']>(callee: T, args?: CallExpression['arguments'], loc?: SourceLocation): InferCodegenNodeType<T>;
|
|
538
547
|
export declare function createFunctionExpression(params: FunctionExpression['params'], returns?: FunctionExpression['returns'], newline?: boolean, isSlot?: boolean, loc?: SourceLocation): FunctionExpression;
|
|
539
548
|
export declare function createConditionalExpression(test: ConditionalExpression['test'], consequent: ConditionalExpression['consequent'], alternate: ConditionalExpression['alternate'], newline?: boolean): ConditionalExpression;
|
|
540
|
-
export declare function createCacheExpression(index: number, value: JSChildNode,
|
|
549
|
+
export declare function createCacheExpression(index: number, value: JSChildNode, needPauseTracking?: boolean): CacheExpression;
|
|
541
550
|
export declare function createBlockStatement(body: BlockStatement['body']): BlockStatement;
|
|
542
551
|
export declare function createTemplateLiteral(elements: TemplateLiteral['elements']): TemplateLiteral;
|
|
543
552
|
export declare function createIfStatement(test: IfStatement['test'], consequent: IfStatement['consequent'], alternate?: IfStatement['alternate']): IfStatement;
|
|
@@ -834,7 +843,7 @@ export interface TransformOptions extends SharedTransformCodegenOptions, ErrorHa
|
|
|
834
843
|
*/
|
|
835
844
|
prefixIdentifiers?: boolean;
|
|
836
845
|
/**
|
|
837
|
-
*
|
|
846
|
+
* Cache static VNodes and props objects to `_hoisted_x` constants
|
|
838
847
|
* @default false
|
|
839
848
|
*/
|
|
840
849
|
hoistStatic?: boolean;
|
|
@@ -1018,14 +1027,14 @@ export declare function isTemplateNode(node: RootNode | TemplateChildNode): node
|
|
|
1018
1027
|
export declare function isSlotOutlet(node: RootNode | TemplateChildNode): node is SlotOutletNode;
|
|
1019
1028
|
export declare function injectProp(node: VNodeCall | RenderSlotCall, prop: Property, context: TransformContext): void;
|
|
1020
1029
|
export declare function toValidAssetId(name: string, type: 'component' | 'directive' | 'filter'): string;
|
|
1021
|
-
export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | undefined, ids: TransformContext['identifiers']): boolean;
|
|
1030
|
+
export declare function hasScopeRef(node: TemplateChildNode | IfBranchNode | ExpressionNode | CacheExpression | undefined, ids: TransformContext['identifiers']): boolean;
|
|
1022
1031
|
export declare function getMemoedVNodeCall(node: BlockCodegenNode | MemoExpression): VNodeCall | RenderSlotCall;
|
|
1023
1032
|
export declare const forAliasRE: RegExp;
|
|
1024
1033
|
|
|
1025
1034
|
/**
|
|
1026
1035
|
* Return value indicates whether the AST walked can be a constant
|
|
1027
1036
|
*/
|
|
1028
|
-
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;
|
|
1037
|
+
export declare function walkIdentifiers(root: Node$1, onIdentifier: (node: Identifier, parent: Node$1 | null, parentStack: Node$1[], isReference: boolean, isLocal: boolean) => void, includeAll?: boolean, parentStack?: Node$1[], knownIds?: Record<string, number>): void;
|
|
1029
1038
|
export declare function isReferencedIdentifier(id: Identifier, parent: Node$1 | null, parentStack: Node$1[]): boolean;
|
|
1030
1039
|
export declare function isInDestructureAssignment(parent: Node$1, parentStack: Node$1[]): boolean;
|
|
1031
1040
|
export declare function isInNewExpression(parentStack: Node$1[]): boolean;
|
|
@@ -1069,5 +1078,5 @@ interface SlotOutletProcessResult {
|
|
|
1069
1078
|
}
|
|
1070
1079
|
export declare function processSlotOutlet(node: SlotOutletNode, context: TransformContext): SlotOutletProcessResult;
|
|
1071
1080
|
|
|
1072
|
-
export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode, context: TransformContext): ConstantTypes;
|
|
1081
|
+
export declare function getConstantType(node: TemplateChildNode | SimpleExpressionNode | CacheExpression, context: TransformContext): ConstantTypes;
|
|
1073
1082
|
|