@vue/language-core 3.1.2 → 3.1.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/index.d.ts +1 -0
- package/index.js +1 -0
- package/lib/codegen/globalTypes.js +9 -10
- package/lib/codegen/script/index.js +16 -9
- package/lib/codegen/script/template.js +0 -4
- package/lib/codegen/template/context.js +6 -2
- package/lib/codegen/template/element.js +5 -5
- package/lib/codegen/template/index.d.ts +4 -6
- package/lib/codegen/template/index.js +0 -35
- package/lib/codegen/template/templateChild.js +5 -12
- package/lib/codegen/template/vIf.js +5 -7
- package/lib/plugins/vue-template-inline-css.js +2 -2
- package/lib/utils/forEachTemplateNode.d.ts +3 -0
- package/lib/utils/forEachTemplateNode.js +68 -0
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './lib/parsers/scriptSetupRanges';
|
|
|
6
6
|
export * from './lib/plugins';
|
|
7
7
|
export * from './lib/types';
|
|
8
8
|
export * from './lib/utils/collectBindings';
|
|
9
|
+
export * from './lib/utils/forEachTemplateNode';
|
|
9
10
|
export * from './lib/utils/parseSfc';
|
|
10
11
|
export * from './lib/utils/shared';
|
|
11
12
|
export * from './lib/virtualFile/vueFile';
|
package/index.js
CHANGED
|
@@ -23,6 +23,7 @@ __exportStar(require("./lib/parsers/scriptSetupRanges"), exports);
|
|
|
23
23
|
__exportStar(require("./lib/plugins"), exports);
|
|
24
24
|
__exportStar(require("./lib/types"), exports);
|
|
25
25
|
__exportStar(require("./lib/utils/collectBindings"), exports);
|
|
26
|
+
__exportStar(require("./lib/utils/forEachTemplateNode"), exports);
|
|
26
27
|
__exportStar(require("./lib/utils/parseSfc"), exports);
|
|
27
28
|
__exportStar(require("./lib/utils/shared"), exports);
|
|
28
29
|
__exportStar(require("./lib/virtualFile/vueFile"), exports);
|
|
@@ -25,17 +25,14 @@ function generateGlobalTypes(options) {
|
|
|
25
25
|
const __VLS_directiveBindingRestFields: { instance: null, oldValue: null, modifiers: any, dir: any };
|
|
26
26
|
const __VLS_unref: typeof import('${lib}').unref;
|
|
27
27
|
const __VLS_placeholder: any;
|
|
28
|
+
const __VLS_intrinsics: ${target >= 3.3
|
|
29
|
+
? `import('${lib}/jsx-runtime').JSX.IntrinsicElements`
|
|
30
|
+
: `globalThis.JSX.IntrinsicElements`};
|
|
28
31
|
|
|
29
|
-
type
|
|
30
|
-
type __VLS_IntrinsicElements = ${target >= 3.3
|
|
31
|
-
? `import('${lib}/jsx-runtime').JSX.IntrinsicElements;`
|
|
32
|
-
: `globalThis.JSX.IntrinsicElements;`}
|
|
33
|
-
type __VLS_Element = ${target >= 3.3
|
|
34
|
-
? `import('${lib}/jsx-runtime').JSX.Element;`
|
|
35
|
-
: `globalThis.JSX.Element;`}
|
|
32
|
+
type __VLS_Elements = __VLS_SpreadMerge<SVGElementTagNameMap, HTMLElementTagNameMap>;
|
|
36
33
|
type __VLS_GlobalComponents = ${target >= 3.5
|
|
37
|
-
? `import('${lib}').GlobalComponents
|
|
38
|
-
: `import('${lib}').GlobalComponents & Pick<typeof import('${lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'
|
|
34
|
+
? `import('${lib}').GlobalComponents`
|
|
35
|
+
: `import('${lib}').GlobalComponents & Pick<typeof import('${lib}'), 'Transition' | 'TransitionGroup' | 'KeepAlive' | 'Suspense' | 'Teleport'>`};
|
|
39
36
|
type __VLS_GlobalDirectives = import('${lib}').GlobalDirectives;
|
|
40
37
|
type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
|
|
41
38
|
type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
|
|
@@ -57,7 +54,9 @@ function generateGlobalTypes(options) {
|
|
|
57
54
|
? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
|
|
58
55
|
: T extends (props: infer P, ...args: any) => any ? P
|
|
59
56
|
: {};
|
|
60
|
-
type __VLS_FunctionalComponent<T> = (props: ${fnPropsType}, ctx?: any) =>
|
|
57
|
+
type __VLS_FunctionalComponent<T> = (props: ${fnPropsType}, ctx?: any) => ${target >= 3.3
|
|
58
|
+
? `import('${lib}/jsx-runtime').JSX.Element`
|
|
59
|
+
: `globalThis.JSX.Element`} & {
|
|
61
60
|
__ctx?: {
|
|
62
61
|
attrs?: any;
|
|
63
62
|
slots?: T extends { $slots: infer Slots } ? Slots : Record<string, any>;
|
|
@@ -115,19 +115,26 @@ function* generateExportDefault(options) {
|
|
|
115
115
|
yield* (0, src_1.generateSrc)(options.sfc.script.src);
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
let suffix;
|
|
118
|
+
const expression = `{} as typeof __VLS_export`;
|
|
120
119
|
if (options.sfc.script && options.scriptRanges?.exportDefault) {
|
|
121
120
|
const { exportDefault, componentOptions } = options.scriptRanges;
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, exportDefault.start, (componentOptions ?? exportDefault).expression.start, codeFeatures_1.codeFeatures.all);
|
|
122
|
+
yield expression;
|
|
123
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, (componentOptions ?? exportDefault).expression.end, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
124
124
|
}
|
|
125
125
|
else {
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
yield `export `;
|
|
127
|
+
if (options.sfc.template) {
|
|
128
|
+
for (let i = 0; i < 'template'.length + 1; i++) {
|
|
129
|
+
yield [
|
|
130
|
+
``,
|
|
131
|
+
'main',
|
|
132
|
+
options.sfc.template.start + 1 + i,
|
|
133
|
+
i ? { __combineOffset: i } : codeFeatures_1.codeFeatures.navigationWithoutRename,
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
yield `default ${expression}${utils_1.endOfLine}`;
|
|
128
138
|
}
|
|
129
|
-
yield prefix;
|
|
130
|
-
yield `{} as typeof __VLS_export`;
|
|
131
|
-
yield suffix;
|
|
132
139
|
}
|
|
133
140
|
//# sourceMappingURL=index.js.map
|
|
@@ -15,7 +15,6 @@ function* generateTemplate(options, ctx) {
|
|
|
15
15
|
ctx.generatedTemplate = true;
|
|
16
16
|
yield* generateSelf(options);
|
|
17
17
|
yield* generateTemplateCtx(options, ctx);
|
|
18
|
-
yield* generateTemplateElements();
|
|
19
18
|
yield* generateTemplateComponents(options);
|
|
20
19
|
yield* generateTemplateDirectives(options);
|
|
21
20
|
yield* generateTemplateBody(options, ctx);
|
|
@@ -93,9 +92,6 @@ function* generateTemplateCtx(options, ctx) {
|
|
|
93
92
|
yield* (0, merge_1.generateSpreadMerge)(exps);
|
|
94
93
|
yield utils_1.endOfLine;
|
|
95
94
|
}
|
|
96
|
-
function* generateTemplateElements() {
|
|
97
|
-
yield `let __VLS_elements!: __VLS_IntrinsicElements${utils_1.endOfLine}`;
|
|
98
|
-
}
|
|
99
95
|
function* generateTemplateComponents(options) {
|
|
100
96
|
const types = [`typeof __VLS_ctx`];
|
|
101
97
|
if (options.sfc.script && options.scriptRanges?.componentOptions?.components) {
|
|
@@ -125,8 +125,12 @@ function createTemplateCodegenContext(options, templateAst) {
|
|
|
125
125
|
return {
|
|
126
126
|
...features,
|
|
127
127
|
verification: {
|
|
128
|
-
shouldReport: () => {
|
|
129
|
-
|
|
128
|
+
shouldReport: (source, code) => {
|
|
129
|
+
if (typeof features.verification !== 'object'
|
|
130
|
+
|| !features.verification.shouldReport
|
|
131
|
+
|| features.verification.shouldReport(source, code) === true) {
|
|
132
|
+
data.expectError.token++;
|
|
133
|
+
}
|
|
130
134
|
return false;
|
|
131
135
|
},
|
|
132
136
|
},
|
|
@@ -182,10 +182,10 @@ function* generateComponent(options, ctx, node) {
|
|
|
182
182
|
function* generateElement(options, ctx, node) {
|
|
183
183
|
const [startTagOffset, endTagOffset] = (0, shared_2.getElementTagOffsets)(node, options.template);
|
|
184
184
|
const failedPropExps = [];
|
|
185
|
-
yield `__VLS_asFunctionalElement(
|
|
185
|
+
yield `__VLS_asFunctionalElement(__VLS_intrinsics`;
|
|
186
186
|
yield* (0, propertyAccess_1.generatePropertyAccess)(options, ctx, node.tag, startTagOffset, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
|
187
187
|
if (endTagOffset !== undefined) {
|
|
188
|
-
yield `,
|
|
188
|
+
yield `, __VLS_intrinsics`;
|
|
189
189
|
yield* (0, propertyAccess_1.generatePropertyAccess)(options, ctx, node.tag, endTagOffset, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
|
190
190
|
}
|
|
191
191
|
yield `)(`;
|
|
@@ -195,17 +195,17 @@ function* generateElement(options, ctx, node) {
|
|
|
195
195
|
yield* (0, elementDirectives_1.generateElementDirectives)(options, ctx, node);
|
|
196
196
|
const reference = yield* generateElementReference(options, ctx, node);
|
|
197
197
|
if (reference) {
|
|
198
|
-
let typeExp = `
|
|
198
|
+
let typeExp = `__VLS_Elements['${node.tag}']`;
|
|
199
199
|
if (ctx.inVFor) {
|
|
200
200
|
typeExp += `[]`;
|
|
201
201
|
}
|
|
202
202
|
ctx.addTemplateRef(reference.name, typeExp, reference.offset);
|
|
203
203
|
}
|
|
204
204
|
if (ctx.singleRootNodes.has(node)) {
|
|
205
|
-
ctx.singleRootElTypes.push(`
|
|
205
|
+
ctx.singleRootElTypes.push(`__VLS_Elements['${node.tag}']`);
|
|
206
206
|
}
|
|
207
207
|
if (hasVBindAttrs(options, ctx, node)) {
|
|
208
|
-
ctx.inheritedAttrVars.add(`
|
|
208
|
+
ctx.inheritedAttrVars.add(`__VLS_intrinsics.${node.tag}`);
|
|
209
209
|
}
|
|
210
210
|
(0, styleScopedClasses_1.collectStyleScopedClassReferences)(options, ctx, node);
|
|
211
211
|
const { currentComponent } = ctx;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as CompilerDOM from '@vue/compiler-dom';
|
|
2
1
|
import type * as ts from 'typescript';
|
|
3
2
|
import type { Code, Sfc, VueCompilerOptions } from '../../types';
|
|
4
3
|
export interface TemplateCodegenOptions {
|
|
@@ -23,7 +22,7 @@ declare function generate(options: TemplateCodegenOptions): {
|
|
|
23
22
|
ignoreError?: boolean;
|
|
24
23
|
expectError?: {
|
|
25
24
|
token: number;
|
|
26
|
-
node:
|
|
25
|
+
node: import("@vue/compiler-dom").CommentNode;
|
|
27
26
|
};
|
|
28
27
|
generic?: {
|
|
29
28
|
content: string;
|
|
@@ -54,7 +53,7 @@ declare function generate(options: TemplateCodegenOptions): {
|
|
|
54
53
|
}[];
|
|
55
54
|
emptyClassOffsets: number[];
|
|
56
55
|
inlayHints: import("../inlayHints").InlayHintInfo[];
|
|
57
|
-
bindingAttrLocs:
|
|
56
|
+
bindingAttrLocs: import("@vue/compiler-dom").SourceLocation[];
|
|
58
57
|
inheritedAttrVars: Set<string>;
|
|
59
58
|
templateRefs: Map<string, {
|
|
60
59
|
typeExp: string;
|
|
@@ -65,7 +64,7 @@ declare function generate(options: TemplateCodegenOptions): {
|
|
|
65
64
|
used: boolean;
|
|
66
65
|
} | undefined;
|
|
67
66
|
singleRootElTypes: string[];
|
|
68
|
-
singleRootNodes: Set<
|
|
67
|
+
singleRootNodes: Set<import("@vue/compiler-dom").ElementNode | null>;
|
|
69
68
|
addTemplateRef(name: string, typeExp: string, offset: number): void;
|
|
70
69
|
accessExternalVariable(name: string, offset?: number): void;
|
|
71
70
|
hasLocalVariable(name: string): boolean;
|
|
@@ -76,7 +75,6 @@ declare function generate(options: TemplateCodegenOptions): {
|
|
|
76
75
|
generateHoistVariables(): Generator<string, void, unknown>;
|
|
77
76
|
generateConditionGuards(): Generator<string, void, unknown>;
|
|
78
77
|
generateAutoImportCompletion(): Generator<Code>;
|
|
79
|
-
enter(node:
|
|
78
|
+
enter(node: import("@vue/compiler-dom").RootNode | import("@vue/compiler-dom").TemplateChildNode | import("@vue/compiler-dom").SimpleExpressionNode): boolean;
|
|
80
79
|
exit(): Generator<Code>;
|
|
81
80
|
};
|
|
82
|
-
export declare function forEachElementNode(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode): Generator<CompilerDOM.ElementNode>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateTemplate = generate;
|
|
4
|
-
exports.forEachElementNode = forEachElementNode;
|
|
5
|
-
const CompilerDOM = require("@vue/compiler-dom");
|
|
6
4
|
const codeFeatures_1 = require("../codeFeatures");
|
|
7
5
|
const utils_1 = require("../utils");
|
|
8
6
|
const wrapWith_1 = require("../utils/wrapWith");
|
|
@@ -140,37 +138,4 @@ function* generateRootEl(ctx) {
|
|
|
140
138
|
yield utils_1.endOfLine;
|
|
141
139
|
return `__VLS_RootEl`;
|
|
142
140
|
}
|
|
143
|
-
function* forEachElementNode(node) {
|
|
144
|
-
if (node.type === CompilerDOM.NodeTypes.ROOT) {
|
|
145
|
-
for (const child of node.children) {
|
|
146
|
-
yield* forEachElementNode(child);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else if (node.type === CompilerDOM.NodeTypes.ELEMENT) {
|
|
150
|
-
const patchForNode = (0, templateChild_1.getVForNode)(node);
|
|
151
|
-
if (patchForNode) {
|
|
152
|
-
yield* forEachElementNode(patchForNode);
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
yield node;
|
|
156
|
-
for (const child of node.children) {
|
|
157
|
-
yield* forEachElementNode(child);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
else if (node.type === CompilerDOM.NodeTypes.IF) {
|
|
162
|
-
// v-if / v-else-if / v-else
|
|
163
|
-
for (const branch of node.branches) {
|
|
164
|
-
for (const childNode of branch.children) {
|
|
165
|
-
yield* forEachElementNode(childNode);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
else if (node.type === CompilerDOM.NodeTypes.FOR) {
|
|
170
|
-
// v-for
|
|
171
|
-
for (const child of node.children) {
|
|
172
|
-
yield* forEachElementNode(child);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
141
|
//# sourceMappingURL=index.js.map
|
|
@@ -167,22 +167,15 @@ function getVIfNode(node) {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
function parseInterpolationNode(node, template) {
|
|
170
|
-
let content = node.content.loc.source;
|
|
171
170
|
let start = node.content.loc.start.offset;
|
|
172
|
-
let
|
|
173
|
-
let rightCharacter;
|
|
171
|
+
let end = node.content.loc.end.offset;
|
|
174
172
|
// fix https://github.com/vuejs/language-tools/issues/1787
|
|
175
|
-
while (
|
|
173
|
+
while (template[start - 1]?.trim() === '') {
|
|
176
174
|
start--;
|
|
177
|
-
content = leftCharacter + content;
|
|
178
175
|
}
|
|
179
|
-
while (
|
|
180
|
-
|
|
181
|
-
content = content + rightCharacter;
|
|
176
|
+
while (template[end]?.trim() === '') {
|
|
177
|
+
end++;
|
|
182
178
|
}
|
|
183
|
-
return [
|
|
184
|
-
content,
|
|
185
|
-
start,
|
|
186
|
-
];
|
|
179
|
+
return [template.slice(start, end), start];
|
|
187
180
|
}
|
|
188
181
|
//# sourceMappingURL=templateChild.js.map
|
|
@@ -9,6 +9,10 @@ const elementChildren_1 = require("./elementChildren");
|
|
|
9
9
|
const interpolation_1 = require("./interpolation");
|
|
10
10
|
function* generateVIf(options, ctx, node) {
|
|
11
11
|
const originalBlockConditionsLength = ctx.blockConditions.length;
|
|
12
|
+
const isFragment = node.codegenNode
|
|
13
|
+
&& 'consequent' in node.codegenNode
|
|
14
|
+
&& 'tag' in node.codegenNode.consequent
|
|
15
|
+
&& node.codegenNode.consequent.tag === CompilerDOM.FRAGMENT;
|
|
12
16
|
for (let i = 0; i < node.branches.length; i++) {
|
|
13
17
|
const branch = node.branches[i];
|
|
14
18
|
if (i === 0) {
|
|
@@ -29,7 +33,7 @@ function* generateVIf(options, ctx, node) {
|
|
|
29
33
|
yield ` `;
|
|
30
34
|
}
|
|
31
35
|
yield `{${utils_1.newLine}`;
|
|
32
|
-
yield* (0, elementChildren_1.generateElementChildren)(options, ctx, branch.children, isFragment
|
|
36
|
+
yield* (0, elementChildren_1.generateElementChildren)(options, ctx, branch.children, i !== 0 || isFragment);
|
|
33
37
|
yield `}${utils_1.newLine}`;
|
|
34
38
|
if (addedBlockCondition) {
|
|
35
39
|
ctx.blockConditions[ctx.blockConditions.length - 1] = `!${ctx.blockConditions[ctx.blockConditions.length - 1]}`;
|
|
@@ -37,10 +41,4 @@ function* generateVIf(options, ctx, node) {
|
|
|
37
41
|
}
|
|
38
42
|
ctx.blockConditions.length = originalBlockConditionsLength;
|
|
39
43
|
}
|
|
40
|
-
function isFragment(node) {
|
|
41
|
-
return node.codegenNode
|
|
42
|
-
&& 'consequent' in node.codegenNode
|
|
43
|
-
&& 'tag' in node.codegenNode.consequent
|
|
44
|
-
&& node.codegenNode.consequent.tag === CompilerDOM.FRAGMENT;
|
|
45
|
-
}
|
|
46
44
|
//# sourceMappingURL=vIf.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const CompilerDOM = require("@vue/compiler-dom");
|
|
4
|
-
const
|
|
4
|
+
const forEachTemplateNode_1 = require("../utils/forEachTemplateNode");
|
|
5
5
|
const shared_1 = require("./shared");
|
|
6
6
|
const codeFeatures = {
|
|
7
7
|
...shared_1.allCodeFeatures,
|
|
@@ -28,7 +28,7 @@ const plugin = () => {
|
|
|
28
28
|
};
|
|
29
29
|
exports.default = plugin;
|
|
30
30
|
function* generate(templateAst) {
|
|
31
|
-
for (const node of (0,
|
|
31
|
+
for (const node of (0, forEachTemplateNode_1.forEachElementNode)(templateAst)) {
|
|
32
32
|
for (const prop of node.props) {
|
|
33
33
|
if (prop.type === CompilerDOM.NodeTypes.DIRECTIVE
|
|
34
34
|
&& prop.name === 'bind'
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as CompilerDOM from '@vue/compiler-dom';
|
|
2
|
+
export declare function forEachElementNode(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode): Generator<CompilerDOM.ElementNode>;
|
|
3
|
+
export declare function forEachInterpolationNode(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode | CompilerDOM.SimpleExpressionNode): Generator<CompilerDOM.InterpolationNode>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.forEachElementNode = forEachElementNode;
|
|
4
|
+
exports.forEachInterpolationNode = forEachInterpolationNode;
|
|
5
|
+
const CompilerDOM = require("@vue/compiler-dom");
|
|
6
|
+
function* forEachElementNode(node) {
|
|
7
|
+
if (node.type === CompilerDOM.NodeTypes.ROOT) {
|
|
8
|
+
for (const child of node.children) {
|
|
9
|
+
yield* forEachElementNode(child);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
else if (node.type === CompilerDOM.NodeTypes.ELEMENT) {
|
|
13
|
+
yield node;
|
|
14
|
+
for (const child of node.children) {
|
|
15
|
+
yield* forEachElementNode(child);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else if (node.type === CompilerDOM.NodeTypes.IF) {
|
|
19
|
+
for (const branch of node.branches) {
|
|
20
|
+
for (const childNode of branch.children) {
|
|
21
|
+
yield* forEachElementNode(childNode);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else if (node.type === CompilerDOM.NodeTypes.FOR) {
|
|
26
|
+
for (const child of node.children) {
|
|
27
|
+
yield* forEachElementNode(child);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function* forEachInterpolationNode(node) {
|
|
32
|
+
if (node.type === CompilerDOM.NodeTypes.ROOT) {
|
|
33
|
+
for (const child of node.children) {
|
|
34
|
+
yield* forEachInterpolationNode(child);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
else if (node.type === CompilerDOM.NodeTypes.ELEMENT) {
|
|
38
|
+
for (const child of node.children) {
|
|
39
|
+
yield* forEachInterpolationNode(child);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (node.type === CompilerDOM.NodeTypes.TEXT_CALL) {
|
|
43
|
+
yield* forEachInterpolationNode(node.content);
|
|
44
|
+
}
|
|
45
|
+
else if (node.type === CompilerDOM.NodeTypes.COMPOUND_EXPRESSION) {
|
|
46
|
+
for (const child of node.children) {
|
|
47
|
+
if (typeof child === 'object') {
|
|
48
|
+
yield* forEachInterpolationNode(child);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (node.type === CompilerDOM.NodeTypes.INTERPOLATION) {
|
|
53
|
+
yield node;
|
|
54
|
+
}
|
|
55
|
+
else if (node.type === CompilerDOM.NodeTypes.IF) {
|
|
56
|
+
for (const branch of node.branches) {
|
|
57
|
+
for (const childNode of branch.children) {
|
|
58
|
+
yield* forEachInterpolationNode(childNode);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (node.type === CompilerDOM.NodeTypes.FOR) {
|
|
63
|
+
for (const child of node.children) {
|
|
64
|
+
yield* forEachInterpolationNode(child);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=forEachTemplateNode.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"optional": true
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "9670176c727993d16f9224f48406077e20972353"
|
|
40
40
|
}
|