@vue/language-core 3.3.6 → 3.3.8
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/README.md +1 -0
- package/lib/codegen/script/index.js +4 -4
- package/lib/codegen/script/scriptSetup.js +2 -2
- package/lib/codegen/style/common.js +4 -4
- package/lib/codegen/style/index.d.ts +2 -2
- package/lib/codegen/style/index.js +1 -1
- package/lib/codegen/style/modules.d.ts +1 -1
- package/lib/codegen/style/modules.js +1 -1
- package/lib/codegen/style/scopedClasses.d.ts +2 -1
- package/lib/codegen/style/scopedClasses.js +5 -4
- package/lib/codegen/template/context.d.ts +2 -2
- package/lib/codegen/template/context.js +2 -2
- package/lib/codegen/template/element.js +12 -98
- package/lib/codegen/template/elementDirectives.d.ts +1 -1
- package/lib/codegen/template/elementDirectives.js +74 -46
- package/lib/codegen/template/elementEvents.js +8 -5
- package/lib/codegen/template/elementProps.js +10 -10
- package/lib/codegen/template/index.d.ts +3 -2
- package/lib/codegen/template/index.js +2 -2
- package/lib/codegen/template/interpolation.js +2 -2
- package/lib/codegen/template/objectProperty.js +2 -2
- package/lib/codegen/template/slotOutlet.js +8 -8
- package/lib/codegen/template/styleScopedClasses.d.ts +3 -0
- package/lib/codegen/template/styleScopedClasses.js +124 -2
- package/lib/codegen/template/vSlot.js +6 -6
- package/lib/codegen/utils/boundary.d.ts +4 -3
- package/lib/codegen/utils/boundary.js +7 -6
- package/lib/codegen/utils/stringLiteralKey.d.ts +1 -1
- package/lib/codegen/utils/stringLiteralKey.js +6 -11
- package/lib/codegen/utils/unicode.js +2 -2
- package/lib/compilerOptions.js +1 -0
- package/lib/plugins/vue-tsx.d.ts +2 -2
- package/lib/plugins/vue-tsx.js +2 -0
- package/lib/types.d.ts +2 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -110,6 +110,7 @@ Configure Vue compiler behavior through the `vueCompilerOptions` field in `tscon
|
|
|
110
110
|
| :--- | :--- | :--- | :--- |
|
|
111
111
|
| `lib` | `string` | `'vue'` | Vue package name, used for generating import statements. |
|
|
112
112
|
| `skipTemplateCodegen` | `boolean` | `false` | Skip virtual code generation for templates. |
|
|
113
|
+
| `vapor` | `boolean` | `false` | Enable Vapor mode for all Vue SFCs. |
|
|
113
114
|
| `fallthroughAttributes` | `boolean` | `false` | Enable type inference for fallthrough attributes. |
|
|
114
115
|
| `checkRequiredFallthroughAttributes` | `boolean` | `false` | Check required fallthrough attributes. |
|
|
115
116
|
| `jsxSlots` | `boolean` | `false` | Use JSX-style slots types. |
|
|
@@ -61,7 +61,7 @@ function* generateWorker(options, ctx) {
|
|
|
61
61
|
src = src.slice(0, -'.tsx'.length) + '.jsx';
|
|
62
62
|
}
|
|
63
63
|
yield `import ${names_1.names.src} from `;
|
|
64
|
-
const boundary = yield* boundary_1.Boundary.start('main', script.src.offset, {
|
|
64
|
+
const boundary = yield* boundary_1.Boundary.start('main', script.src.offset, script.src.offset + script.src.text.length, {
|
|
65
65
|
...codeFeatures_1.codeFeatures.all,
|
|
66
66
|
...src !== script.src.text ? codeFeatures_1.codeFeatures.navigationWithoutRename : {},
|
|
67
67
|
});
|
|
@@ -69,7 +69,7 @@ function* generateWorker(options, ctx) {
|
|
|
69
69
|
yield [src.slice(0, script.src.text.length), 'main', script.src.offset, boundary.features];
|
|
70
70
|
yield src.slice(script.src.text.length);
|
|
71
71
|
yield `'`;
|
|
72
|
-
yield boundary.end(
|
|
72
|
+
yield boundary.end();
|
|
73
73
|
yield utils_1.endOfLine;
|
|
74
74
|
yield `export default ${names_1.names.src}${utils_1.endOfLine}`;
|
|
75
75
|
yield* (0, template_1.generateTemplate)(options, ctx, names_1.names.src);
|
|
@@ -194,9 +194,9 @@ function* generateGlobalTypesReference({ typesRoot, lib, target, checkUnknownPro
|
|
|
194
194
|
}
|
|
195
195
|
function* generateExportDeclareEqual(block, name) {
|
|
196
196
|
yield `const `;
|
|
197
|
-
const boundary = yield* boundary_1.Boundary.start(block.name, 0, codeFeatures_1.codeFeatures.doNotReportTs6133);
|
|
197
|
+
const boundary = yield* boundary_1.Boundary.start(block.name, 0, block.content.length, codeFeatures_1.codeFeatures.doNotReportTs6133);
|
|
198
198
|
yield name;
|
|
199
|
-
yield boundary.end(
|
|
199
|
+
yield boundary.end();
|
|
200
200
|
yield ` = `;
|
|
201
201
|
}
|
|
202
202
|
//# sourceMappingURL=index.js.map
|
|
@@ -161,9 +161,9 @@ function* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, bo
|
|
|
161
161
|
else {
|
|
162
162
|
transforms.push((0, transform_1.insert)(callExp.end, function* () {
|
|
163
163
|
yield ` as ${type}[`;
|
|
164
|
-
const boundary = yield* boundary_1.Boundary.start(scriptSetup.name, exp.start, codeFeatures_1.codeFeatures.verification);
|
|
164
|
+
const boundary = yield* boundary_1.Boundary.start(scriptSetup.name, exp.start, exp.end, codeFeatures_1.codeFeatures.verification);
|
|
165
165
|
yield `'$style'`;
|
|
166
|
-
yield boundary.end(
|
|
166
|
+
yield boundary.end();
|
|
167
167
|
yield `])`;
|
|
168
168
|
}));
|
|
169
169
|
}
|
|
@@ -7,22 +7,22 @@ const utils_1 = require("../utils");
|
|
|
7
7
|
const boundary_1 = require("../utils/boundary");
|
|
8
8
|
function* generateClassProperty(source, classNameWithDot, offset, propertyType) {
|
|
9
9
|
yield `${utils_1.newLine} & { `;
|
|
10
|
-
const boundary = yield* boundary_1.Boundary.start(source, offset, codeFeatures_1.codeFeatures.navigation);
|
|
10
|
+
const boundary = yield* boundary_1.Boundary.start(source, offset, offset + classNameWithDot.length, codeFeatures_1.codeFeatures.navigation);
|
|
11
11
|
yield `'`;
|
|
12
12
|
yield [classNameWithDot.slice(1), source, offset + 1, boundary.features];
|
|
13
13
|
yield `'`;
|
|
14
|
-
yield boundary.end(
|
|
14
|
+
yield boundary.end();
|
|
15
15
|
yield `: ${propertyType}`;
|
|
16
16
|
yield ` }`;
|
|
17
17
|
}
|
|
18
18
|
function* generateStyleImports(style) {
|
|
19
19
|
if (typeof style.src === 'object') {
|
|
20
20
|
yield `${utils_1.newLine} & typeof import(`;
|
|
21
|
-
const boundary = yield* boundary_1.Boundary.start('main', style.src.offset, codeFeatures_1.codeFeatures.navigationAndVerification);
|
|
21
|
+
const boundary = yield* boundary_1.Boundary.start('main', style.src.offset, style.src.offset + style.src.text.length, codeFeatures_1.codeFeatures.navigationAndVerification);
|
|
22
22
|
yield `'`;
|
|
23
23
|
yield [style.src.text, 'main', style.src.offset, boundary.features];
|
|
24
24
|
yield `'`;
|
|
25
|
-
yield boundary.end(
|
|
25
|
+
yield boundary.end();
|
|
26
26
|
yield `).default`;
|
|
27
27
|
}
|
|
28
28
|
for (const { text, offset } of style.imports) {
|
|
@@ -25,9 +25,9 @@ declare function generate(options: StyleCodegenOptions): {
|
|
|
25
25
|
getInternalVariable: () => string;
|
|
26
26
|
scopes: {
|
|
27
27
|
add(value: string): /*elided*/ any;
|
|
28
|
+
clear(): void;
|
|
28
29
|
declare(...variables: string[]): void;
|
|
29
30
|
end(): Generator<Code, any, any>;
|
|
30
|
-
clear(): void;
|
|
31
31
|
delete(value: string): boolean;
|
|
32
32
|
forEach(callbackfn: (value: string, value2: string, set: Set<string>) => void, thisArg?: any): void;
|
|
33
33
|
has(value: string): boolean;
|
|
@@ -40,9 +40,9 @@ declare function generate(options: StyleCodegenOptions): {
|
|
|
40
40
|
}[];
|
|
41
41
|
scope: () => {
|
|
42
42
|
add(value: string): any;
|
|
43
|
+
clear(): void;
|
|
43
44
|
declare(...variables: string[]): void;
|
|
44
45
|
end(): Generator<Code, any, any>;
|
|
45
|
-
clear(): void;
|
|
46
46
|
delete(value: string): boolean;
|
|
47
47
|
forEach(callbackfn: (value: string, value2: string, set: Set<string>) => void, thisArg?: any): void;
|
|
48
48
|
has(value: string): boolean;
|
|
@@ -22,7 +22,7 @@ function generate(options) {
|
|
|
22
22
|
function* generateWorker(options, ctx) {
|
|
23
23
|
const scope = ctx.scope();
|
|
24
24
|
scope.declare(...options.setupConsts);
|
|
25
|
-
yield* (0, scopedClasses_1.generateStyleScopedClasses)(options);
|
|
25
|
+
yield* (0, scopedClasses_1.generateStyleScopedClasses)(options, ctx);
|
|
26
26
|
yield* (0, modules_1.generateStyleModules)(options, ctx);
|
|
27
27
|
yield* generateCssVars(options, ctx);
|
|
28
28
|
yield* scope.end();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Code } from '../../types';
|
|
2
2
|
import type { TemplateCodegenContext } from '../template/context';
|
|
3
3
|
import type { StyleCodegenOptions } from '.';
|
|
4
|
-
export declare function generateStyleModules({
|
|
4
|
+
export declare function generateStyleModules({ vueCompilerOptions, styles }: StyleCodegenOptions, ctx: TemplateCodegenContext): Generator<Code>;
|
|
@@ -5,7 +5,7 @@ const codeFeatures_1 = require("../codeFeatures");
|
|
|
5
5
|
const names_1 = require("../names");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const common_1 = require("./common");
|
|
8
|
-
function* generateStyleModules({
|
|
8
|
+
function* generateStyleModules({ vueCompilerOptions, styles }, ctx) {
|
|
9
9
|
const styleModules = styles.filter(style => style.module);
|
|
10
10
|
if (!styleModules.length) {
|
|
11
11
|
return;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Code } from '../../types';
|
|
2
|
+
import type { TemplateCodegenContext } from '../template/context';
|
|
2
3
|
import type { StyleCodegenOptions } from '.';
|
|
3
|
-
export declare function generateStyleScopedClasses({ vueCompilerOptions, styles }: StyleCodegenOptions): Generator<Code>;
|
|
4
|
+
export declare function generateStyleScopedClasses({ vueCompilerOptions, styles }: StyleCodegenOptions, ctx: TemplateCodegenContext): Generator<Code>;
|
|
@@ -5,7 +5,7 @@ const names_1 = require("../names");
|
|
|
5
5
|
const styleScopedClasses_1 = require("../template/styleScopedClasses");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const common_1 = require("./common");
|
|
8
|
-
function* generateStyleScopedClasses({ vueCompilerOptions, styles }) {
|
|
8
|
+
function* generateStyleScopedClasses({ vueCompilerOptions, styles }, ctx) {
|
|
9
9
|
const { resolveStyleClassNames, resolveStyleImports } = vueCompilerOptions;
|
|
10
10
|
if (!resolveStyleClassNames) {
|
|
11
11
|
return;
|
|
@@ -14,8 +14,9 @@ function* generateStyleScopedClasses({ vueCompilerOptions, styles }) {
|
|
|
14
14
|
if (!scopedStyles.length) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
+
ctx.generatedTypes.add(names_1.names.StyleScopedClasses);
|
|
17
18
|
const visited = new Set();
|
|
18
|
-
const
|
|
19
|
+
const deferredGenerates = [];
|
|
19
20
|
yield `type ${names_1.names.StyleScopedClasses} = {}`;
|
|
20
21
|
for (const style of scopedStyles) {
|
|
21
22
|
if (resolveStyleImports) {
|
|
@@ -27,12 +28,12 @@ function* generateStyleScopedClasses({ vueCompilerOptions, styles }) {
|
|
|
27
28
|
yield* (0, common_1.generateClassProperty)(style.name, className.text, className.offset, 'boolean');
|
|
28
29
|
}
|
|
29
30
|
else {
|
|
30
|
-
|
|
31
|
+
deferredGenerates.push((0, styleScopedClasses_1.generateStyleScopedClassReference)(style, className.text.slice(1), className.offset + 1));
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
yield utils_1.endOfLine;
|
|
35
|
-
for (const generate of
|
|
36
|
+
for (const generate of deferredGenerates) {
|
|
36
37
|
yield* generate;
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -20,9 +20,9 @@ export declare function createTemplateCodegenContext(): {
|
|
|
20
20
|
getInternalVariable: () => string;
|
|
21
21
|
scopes: {
|
|
22
22
|
add(value: string): /*elided*/ any;
|
|
23
|
+
clear(): void;
|
|
23
24
|
declare(...variables: string[]): void;
|
|
24
25
|
end(): Generator<Code, any, any>;
|
|
25
|
-
clear(): void;
|
|
26
26
|
delete(value: string): boolean;
|
|
27
27
|
forEach(callbackfn: (value: string, value2: string, set: Set<string>) => void, thisArg?: any): void;
|
|
28
28
|
has(value: string): boolean;
|
|
@@ -35,9 +35,9 @@ export declare function createTemplateCodegenContext(): {
|
|
|
35
35
|
}[];
|
|
36
36
|
scope: () => {
|
|
37
37
|
add(value: string): any;
|
|
38
|
+
clear(): void;
|
|
38
39
|
declare(...variables: string[]): void;
|
|
39
40
|
end(): Generator<Code, any, any>;
|
|
40
|
-
clear(): void;
|
|
41
41
|
delete(value: string): boolean;
|
|
42
42
|
forEach(callbackfn: (value: string, value2: string, set: Set<string>) => void, thisArg?: any): void;
|
|
43
43
|
has(value: string): boolean;
|
|
@@ -94,13 +94,13 @@ function createTemplateCodegenContext() {
|
|
|
94
94
|
const info = stack.pop();
|
|
95
95
|
commentBuffer.length = 0;
|
|
96
96
|
if (info.expectError !== undefined) {
|
|
97
|
-
const boundary = yield* boundary_1.Boundary.start('template', info.expectError.node.loc.start.offset, {
|
|
97
|
+
const boundary = yield* boundary_1.Boundary.start('template', info.expectError.node.loc.start.offset, info.expectError.node.loc.end.offset, {
|
|
98
98
|
verification: {
|
|
99
99
|
shouldReport: () => info.expectError.token === 0,
|
|
100
100
|
},
|
|
101
101
|
});
|
|
102
102
|
yield `// @ts-expect-error`;
|
|
103
|
-
yield boundary.end(
|
|
103
|
+
yield boundary.end();
|
|
104
104
|
yield `${utils_1.newLine}${utils_1.endOfLine}`;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -173,22 +173,22 @@ function* generateComponent(options, ctx, node) {
|
|
|
173
173
|
yield propsStr;
|
|
174
174
|
yield `}))${utils_1.endOfLine}`;
|
|
175
175
|
yield `const `;
|
|
176
|
-
const boundary = yield* boundary_1.Boundary.start('template', node.loc.start.offset, codeFeatures_1.codeFeatures.doNotReportTs6133);
|
|
176
|
+
const boundary = yield* boundary_1.Boundary.start('template', node.loc.start.offset, node.loc.end.offset, codeFeatures_1.codeFeatures.doNotReportTs6133);
|
|
177
177
|
yield vnodeVar;
|
|
178
|
-
yield boundary.end(
|
|
178
|
+
yield boundary.end();
|
|
179
179
|
yield ` = ${functionalVar}`;
|
|
180
180
|
const commentInfo = ctx.getCommentInfo();
|
|
181
181
|
if (commentInfo.generic) {
|
|
182
182
|
const { content, offset } = commentInfo.generic;
|
|
183
|
-
const boundary = yield* boundary_1.Boundary.start('template', offset, codeFeatures_1.codeFeatures.verification);
|
|
183
|
+
const boundary = yield* boundary_1.Boundary.start('template', offset, offset + content.length, codeFeatures_1.codeFeatures.verification);
|
|
184
184
|
yield `<`;
|
|
185
185
|
yield [content, 'template', offset, codeFeatures_1.codeFeatures.all];
|
|
186
186
|
yield `>`;
|
|
187
|
-
yield boundary.end(
|
|
187
|
+
yield boundary.end();
|
|
188
188
|
}
|
|
189
189
|
const shouldInheritAttrs = hasVBindAttrs(options, ctx, node);
|
|
190
190
|
yield `(`;
|
|
191
|
-
const boundary2 = yield* boundary_1.Boundary.start('template', startTagOffset, shouldInheritAttrs && options.vueCompilerOptions.checkRequiredFallthroughAttributes
|
|
191
|
+
const boundary2 = yield* boundary_1.Boundary.start('template', startTagOffset, startTagOffset + tag.length, shouldInheritAttrs && options.vueCompilerOptions.checkRequiredFallthroughAttributes
|
|
192
192
|
? {}
|
|
193
193
|
: codeFeatures_1.codeFeatures.verification);
|
|
194
194
|
yield `{`;
|
|
@@ -196,7 +196,7 @@ function* generateComponent(options, ctx, node) {
|
|
|
196
196
|
yield utils_1.newLine;
|
|
197
197
|
yield* propCodes;
|
|
198
198
|
yield `}`;
|
|
199
|
-
yield boundary2.end(
|
|
199
|
+
yield boundary2.end();
|
|
200
200
|
yield `, ...${names_1.names.functionalComponentArgsRest}(${functionalVar}))${utils_1.endOfLine}`;
|
|
201
201
|
yield* generateFailedExpressions(options, ctx, failedPropExps);
|
|
202
202
|
yield* (0, elementEvents_1.generateElementEvents)(options, ctx, node, componentVar, getCtxVar, getPropsVar);
|
|
@@ -229,7 +229,7 @@ function* generateComponent(options, ctx, node) {
|
|
|
229
229
|
ctx.inheritedAttrVars.add(getPropsVar());
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
yield* generateStyleScopedClassReferences(options, node);
|
|
232
|
+
yield* (0, styleScopedClasses_1.generateStyleScopedClassReferences)(options, node);
|
|
233
233
|
const slotDir = node.props.find(CompilerDOM.isVSlot);
|
|
234
234
|
if (slotDir || node.children.length) {
|
|
235
235
|
yield* (0, vSlot_1.generateVSlot)(options, ctx, node, slotDir, getCtxVar());
|
|
@@ -253,11 +253,11 @@ function* generateElement(options, ctx, node) {
|
|
|
253
253
|
yield* (0, propertyAccess_1.generatePropertyAccess)(options, ctx, node.tag, endTagOffset, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
|
254
254
|
}
|
|
255
255
|
yield `)(`;
|
|
256
|
-
const boundary = yield* boundary_1.Boundary.start('template', startTagOffset, codeFeatures_1.codeFeatures.verification);
|
|
256
|
+
const boundary = yield* boundary_1.Boundary.start('template', startTagOffset, startTagOffset + node.tag.length, codeFeatures_1.codeFeatures.verification);
|
|
257
257
|
yield `{${utils_1.newLine}`;
|
|
258
258
|
yield* (0, elementProps_1.generateElementProps)(options, ctx, node, node.props, options.vueCompilerOptions.checkUnknownProps, failedPropExps);
|
|
259
259
|
yield `}`;
|
|
260
|
-
yield boundary.end(
|
|
260
|
+
yield boundary.end();
|
|
261
261
|
yield `)${utils_1.endOfLine}`;
|
|
262
262
|
yield* generateFailedExpressions(options, ctx, failedPropExps);
|
|
263
263
|
yield* (0, elementDirectives_1.generateElementDirectives)(options, ctx, node);
|
|
@@ -275,7 +275,7 @@ function* generateElement(options, ctx, node) {
|
|
|
275
275
|
if (hasVBindAttrs(options, ctx, node)) {
|
|
276
276
|
ctx.inheritedAttrVars.add(`${names_1.names.intrinsics}.${node.tag}`);
|
|
277
277
|
}
|
|
278
|
-
yield* generateStyleScopedClassReferences(options, node);
|
|
278
|
+
yield* (0, styleScopedClasses_1.generateStyleScopedClassReferences)(options, node);
|
|
279
279
|
for (const child of node.children) {
|
|
280
280
|
yield* (0, templateChild_1.generateTemplateChild)(options, ctx, child);
|
|
281
281
|
}
|
|
@@ -285,103 +285,17 @@ function* generateFragment(options, ctx, node) {
|
|
|
285
285
|
// special case for <template v-for="..." :key="..." />
|
|
286
286
|
if (node.props.length) {
|
|
287
287
|
yield `__VLS_asFunctionalElement(__VLS_intrinsics.template)(`;
|
|
288
|
-
const boundary = yield* boundary_1.Boundary.start('template', startTagOffset, codeFeatures_1.codeFeatures.verification);
|
|
288
|
+
const boundary = yield* boundary_1.Boundary.start('template', startTagOffset, startTagOffset + node.tag.length, codeFeatures_1.codeFeatures.verification);
|
|
289
289
|
yield `{${utils_1.newLine}`;
|
|
290
290
|
yield* (0, elementProps_1.generateElementProps)(options, ctx, node, node.props, options.vueCompilerOptions.checkUnknownProps);
|
|
291
291
|
yield `}`;
|
|
292
|
-
yield boundary.end(
|
|
292
|
+
yield boundary.end();
|
|
293
293
|
yield `)${utils_1.endOfLine}`;
|
|
294
294
|
}
|
|
295
295
|
for (const child of node.children) {
|
|
296
296
|
yield* (0, templateChild_1.generateTemplateChild)(options, ctx, child);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
function* generateStyleScopedClassReferences({ template, typescript: ts }, node) {
|
|
300
|
-
for (const prop of node.props) {
|
|
301
|
-
if (prop.type === CompilerDOM.NodeTypes.ATTRIBUTE
|
|
302
|
-
&& prop.name === 'class'
|
|
303
|
-
&& prop.value) {
|
|
304
|
-
const [text, start] = (0, shared_2.normalizeAttributeValue)(prop.value);
|
|
305
|
-
for (const [className, offset] of forEachClassName(text)) {
|
|
306
|
-
yield* (0, styleScopedClasses_1.generateStyleScopedClassReference)(template, className, start + offset);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
else if (prop.type === CompilerDOM.NodeTypes.DIRECTIVE
|
|
310
|
-
&& prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
|
|
311
|
-
&& prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
|
|
312
|
-
&& prop.arg.content === 'class') {
|
|
313
|
-
const content = '(' + prop.exp.content + ')';
|
|
314
|
-
const startOffset = prop.exp.loc.start.offset - 1;
|
|
315
|
-
const ast = (0, utils_1.getTypeScriptAST)(ts, template, content);
|
|
316
|
-
const literals = [];
|
|
317
|
-
for (const node of (0, utils_1.forEachNode)(ts, ast)) {
|
|
318
|
-
if (!ts.isExpressionStatement(node)
|
|
319
|
-
|| !ts.isParenthesizedExpression(node.expression)) {
|
|
320
|
-
continue;
|
|
321
|
-
}
|
|
322
|
-
const { expression } = node.expression;
|
|
323
|
-
if (ts.isStringLiteralLike(expression)) {
|
|
324
|
-
literals.push(expression);
|
|
325
|
-
}
|
|
326
|
-
else if (ts.isArrayLiteralExpression(expression)) {
|
|
327
|
-
yield* walkArrayLiteral(expression);
|
|
328
|
-
}
|
|
329
|
-
else if (ts.isObjectLiteralExpression(expression)) {
|
|
330
|
-
yield* walkObjectLiteral(expression);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
for (const literal of literals) {
|
|
334
|
-
const start = literal.end - literal.text.length - 1 + startOffset;
|
|
335
|
-
for (const [className, offset] of forEachClassName(literal.text)) {
|
|
336
|
-
yield* (0, styleScopedClasses_1.generateStyleScopedClassReference)(template, className, start + offset);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
function* walkArrayLiteral(node) {
|
|
340
|
-
const { elements } = node;
|
|
341
|
-
for (const element of elements) {
|
|
342
|
-
if (ts.isStringLiteralLike(element)) {
|
|
343
|
-
literals.push(element);
|
|
344
|
-
}
|
|
345
|
-
else if (ts.isObjectLiteralExpression(element)) {
|
|
346
|
-
yield* walkObjectLiteral(element);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
function* walkObjectLiteral(node) {
|
|
351
|
-
const { properties } = node;
|
|
352
|
-
for (const property of properties) {
|
|
353
|
-
if (ts.isPropertyAssignment(property)) {
|
|
354
|
-
const { name } = property;
|
|
355
|
-
if (ts.isIdentifier(name)) {
|
|
356
|
-
const text = (0, shared_2.getNodeText)(ts, name, ast);
|
|
357
|
-
yield* (0, styleScopedClasses_1.generateStyleScopedClassReference)(template, text, name.end - text.length + startOffset);
|
|
358
|
-
}
|
|
359
|
-
else if (ts.isStringLiteral(name)) {
|
|
360
|
-
literals.push(name);
|
|
361
|
-
}
|
|
362
|
-
else if (ts.isComputedPropertyName(name)) {
|
|
363
|
-
const { expression } = name;
|
|
364
|
-
if (ts.isStringLiteralLike(expression)) {
|
|
365
|
-
literals.push(expression);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
else if (ts.isShorthandPropertyAssignment(property)) {
|
|
370
|
-
const text = (0, shared_2.getNodeText)(ts, property.name, ast);
|
|
371
|
-
yield* (0, styleScopedClasses_1.generateStyleScopedClassReference)(template, text, property.name.end - text.length + startOffset);
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
function* forEachClassName(content) {
|
|
379
|
-
let offset = 0;
|
|
380
|
-
for (const className of content.split(' ')) {
|
|
381
|
-
yield [className, offset];
|
|
382
|
-
offset += className.length + 1;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
299
|
function* generateFailedExpressions(options, ctx, failedPropExps) {
|
|
386
300
|
for (const { node, prefix, suffix } of failedPropExps) {
|
|
387
301
|
yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, codeFeatures_1.codeFeatures.all, node.loc.source, node.loc.start.offset, prefix, suffix);
|
|
@@ -3,4 +3,4 @@ import type { Code } from '../../types';
|
|
|
3
3
|
import type { TemplateCodegenContext } from './context';
|
|
4
4
|
import type { TemplateCodegenOptions } from './index';
|
|
5
5
|
export declare function generateElementDirectives(options: TemplateCodegenOptions, ctx: TemplateCodegenContext, node: CompilerDOM.ElementNode): Generator<Code>;
|
|
6
|
-
export declare function generateModifiers(options: TemplateCodegenOptions, ctx: TemplateCodegenContext, prop: CompilerDOM.DirectiveNode, propertyName?: string): Generator<Code>;
|
|
6
|
+
export declare function generateModifiers(options: TemplateCodegenOptions, ctx: TemplateCodegenContext, prop: CompilerDOM.DirectiveNode, propertyName?: string, asBindingProperty?: boolean): Generator<Code>;
|
|
@@ -55,22 +55,33 @@ function* generateElementDirectives(options, ctx, node) {
|
|
|
55
55
|
|| prop.name === 'bind') {
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
58
|
-
const boundary = yield* boundary_1.Boundary.start('template', prop.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
const boundary = yield* boundary_1.Boundary.start('template', prop.loc.start.offset, prop.loc.end.offset, codeFeatures_1.codeFeatures.verification);
|
|
59
|
+
if (options.isVapor && !(0, shared_1.isBuiltInDirective)(prop.name)) {
|
|
60
|
+
// vapor custom directives receive a value getter instead of a vdom binding object
|
|
61
|
+
yield* generateIdentifier(options, ctx, prop);
|
|
62
|
+
yield `(null!, `;
|
|
63
|
+
yield* generateValue(options, ctx, prop, false);
|
|
64
|
+
yield* generateArg(options, ctx, prop, false);
|
|
65
|
+
yield* generateModifiers(options, ctx, prop, 'modifiers', false);
|
|
66
|
+
yield `)`;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
yield `${names_1.names.asFunctionalDirective}(`;
|
|
70
|
+
yield* generateIdentifier(options, ctx, prop);
|
|
71
|
+
yield `, {} as import('${options.vueCompilerOptions.lib}').ObjectDirective)(null!, { ...${names_1.names.directiveBindingRestFields}, `;
|
|
72
|
+
yield* generateArg(options, ctx, prop);
|
|
73
|
+
yield* generateModifiers(options, ctx, prop);
|
|
74
|
+
yield* generateValue(options, ctx, prop);
|
|
75
|
+
yield `}, null!, null!)`;
|
|
76
|
+
}
|
|
77
|
+
yield boundary.end();
|
|
67
78
|
yield utils_1.endOfLine;
|
|
68
79
|
}
|
|
69
80
|
}
|
|
70
81
|
function* generateIdentifier(options, ctx, prop) {
|
|
71
82
|
const rawName = 'v-' + prop.name;
|
|
72
83
|
const startOffset = prop.loc.start.offset;
|
|
73
|
-
const boundary = yield* boundary_1.Boundary.start('template', startOffset, codeFeatures_1.codeFeatures.verification);
|
|
84
|
+
const boundary = yield* boundary_1.Boundary.start('template', startOffset, startOffset + rawName.length, codeFeatures_1.codeFeatures.verification);
|
|
74
85
|
yield names_1.names.directives;
|
|
75
86
|
yield `.`;
|
|
76
87
|
yield* (0, camelized_1.generateCamelized)(rawName, 'template', prop.loc.start.offset, {
|
|
@@ -80,52 +91,69 @@ function* generateIdentifier(options, ctx, prop) {
|
|
|
80
91
|
if (!(0, shared_1.isBuiltInDirective)(prop.name)) {
|
|
81
92
|
ctx.accessVariable('template', (0, shared_1.camelize)(rawName), prop.loc.start.offset);
|
|
82
93
|
}
|
|
83
|
-
yield boundary.end(
|
|
94
|
+
yield boundary.end();
|
|
84
95
|
}
|
|
85
|
-
function* generateArg(options, ctx, prop) {
|
|
96
|
+
function* generateArg(options, ctx, prop, asBindingProperty = true) {
|
|
86
97
|
const { arg } = prop;
|
|
87
|
-
if (arg?.type
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
if (arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
|
|
99
|
+
const startOffset = arg.loc.start.offset + arg.loc.source.indexOf(arg.content);
|
|
100
|
+
if (asBindingProperty) {
|
|
101
|
+
const boundary = yield* boundary_1.Boundary.start('template', startOffset, startOffset + arg.content.length, codeFeatures_1.codeFeatures.verification);
|
|
102
|
+
yield `arg`;
|
|
103
|
+
yield boundary.end();
|
|
104
|
+
yield `: `;
|
|
105
|
+
}
|
|
106
|
+
if (arg.isStatic) {
|
|
107
|
+
yield* (0, stringLiteralKey_1.generateStringLiteralKey)(arg.content, startOffset, codeFeatures_1.codeFeatures.all);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
yield* (0, interpolation_1.generateInterpolation)(options, ctx, options.template, codeFeatures_1.codeFeatures.all, arg.content, startOffset, `(`, `)`);
|
|
111
|
+
}
|
|
112
|
+
yield `, `;
|
|
97
113
|
}
|
|
98
|
-
else {
|
|
99
|
-
yield
|
|
114
|
+
else if (!asBindingProperty) {
|
|
115
|
+
yield `undefined, `;
|
|
100
116
|
}
|
|
101
|
-
yield `, `;
|
|
102
117
|
}
|
|
103
|
-
function* generateModifiers(options, ctx, prop, propertyName = 'modifiers') {
|
|
118
|
+
function* generateModifiers(options, ctx, prop, propertyName = 'modifiers', asBindingProperty = true) {
|
|
104
119
|
const { modifiers } = prop;
|
|
105
|
-
if (
|
|
106
|
-
|
|
120
|
+
if (modifiers.length) {
|
|
121
|
+
if (asBindingProperty) {
|
|
122
|
+
const boundary = yield* boundary_1.Boundary.start('template', modifiers[0].loc.start.offset - 1, modifiers.at(-1).loc.end.offset, codeFeatures_1.codeFeatures.verification);
|
|
123
|
+
yield propertyName;
|
|
124
|
+
yield boundary.end();
|
|
125
|
+
yield `: `;
|
|
126
|
+
}
|
|
127
|
+
yield `{ `;
|
|
128
|
+
for (const mod of modifiers) {
|
|
129
|
+
yield* (0, objectProperty_1.generateObjectProperty)(options, ctx, mod.content, mod.loc.start.offset, codeFeatures_1.codeFeatures.withoutHighlight);
|
|
130
|
+
yield `: true, `;
|
|
131
|
+
}
|
|
132
|
+
yield `}, `;
|
|
107
133
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const boundary = yield* boundary_1.Boundary.start('template', startOffset, codeFeatures_1.codeFeatures.verification);
|
|
111
|
-
yield propertyName;
|
|
112
|
-
yield boundary.end(endOffset);
|
|
113
|
-
yield `: { `;
|
|
114
|
-
for (const mod of modifiers) {
|
|
115
|
-
yield* (0, objectProperty_1.generateObjectProperty)(options, ctx, mod.content, mod.loc.start.offset, codeFeatures_1.codeFeatures.withoutHighlight);
|
|
116
|
-
yield `: true, `;
|
|
134
|
+
else if (!asBindingProperty) {
|
|
135
|
+
yield `undefined, `;
|
|
117
136
|
}
|
|
118
|
-
yield `}, `;
|
|
119
137
|
}
|
|
120
|
-
function* generateValue(options, ctx, prop) {
|
|
138
|
+
function* generateValue(options, ctx, prop, asBindingProperty = true) {
|
|
121
139
|
const { exp } = prop;
|
|
122
|
-
if (exp?.type
|
|
123
|
-
|
|
140
|
+
if (exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
|
|
141
|
+
const boundary = yield* boundary_1.Boundary.start('template', exp.loc.start.offset, exp.loc.end.offset, codeFeatures_1.codeFeatures.verification);
|
|
142
|
+
if (asBindingProperty) {
|
|
143
|
+
yield `value`;
|
|
144
|
+
yield boundary.end();
|
|
145
|
+
yield `: `;
|
|
146
|
+
yield* (0, elementProps_1.generatePropExp)(options, ctx, prop, exp);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
yield `() => `;
|
|
150
|
+
yield* (0, elementProps_1.generatePropExp)(options, ctx, prop, exp);
|
|
151
|
+
yield boundary.end();
|
|
152
|
+
}
|
|
153
|
+
yield `, `;
|
|
154
|
+
}
|
|
155
|
+
else if (!asBindingProperty) {
|
|
156
|
+
yield `undefined, `;
|
|
124
157
|
}
|
|
125
|
-
const boundary = yield* boundary_1.Boundary.start('template', exp.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
126
|
-
yield `value`;
|
|
127
|
-
yield boundary.end(exp.loc.end.offset);
|
|
128
|
-
yield `: `;
|
|
129
|
-
yield* (0, elementProps_1.generatePropExp)(options, ctx, prop, exp);
|
|
130
158
|
}
|
|
131
159
|
//# sourceMappingURL=elementDirectives.js.map
|
|
@@ -129,18 +129,17 @@ function* generateEventArg(options, name, start, directive = 'on', features) {
|
|
|
129
129
|
if (directive.length) {
|
|
130
130
|
name = (0, shared_1.capitalize)(name);
|
|
131
131
|
}
|
|
132
|
+
const boundary = yield* boundary_1.Boundary.start('template', start, start + name.length, features);
|
|
132
133
|
if (utils_2.identifierRE.test((0, shared_1.camelize)(name))) {
|
|
133
|
-
const boundary = yield* boundary_1.Boundary.start('template', start, features);
|
|
134
134
|
yield directive;
|
|
135
135
|
yield* (0, camelized_1.generateCamelized)(name, 'template', start, boundary.features);
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
|
-
const boundary = yield* boundary_1.Boundary.start('template', start, features);
|
|
139
138
|
yield `'`;
|
|
140
139
|
yield directive;
|
|
141
140
|
yield* (0, camelized_1.generateCamelized)(name, 'template', start, boundary.features);
|
|
142
141
|
yield `'`;
|
|
143
|
-
yield boundary.end(
|
|
142
|
+
yield boundary.end();
|
|
144
143
|
}
|
|
145
144
|
}
|
|
146
145
|
function* generateEventExpression(options, ctx, prop) {
|
|
@@ -154,9 +153,13 @@ function* generateEventExpression(options, ctx, prop) {
|
|
|
154
153
|
scope.declare('$event');
|
|
155
154
|
yield* ctx.generateConditionGuards();
|
|
156
155
|
if (isSingleExpression(options.typescript, ast)) {
|
|
157
|
-
yield `return `;
|
|
156
|
+
yield `return (`;
|
|
157
|
+
yield* interpolation;
|
|
158
|
+
yield `)`;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
yield* interpolation;
|
|
158
162
|
}
|
|
159
|
-
yield* interpolation;
|
|
160
163
|
yield utils_2.endOfLine;
|
|
161
164
|
yield* scope.end();
|
|
162
165
|
yield `}`;
|
|
@@ -114,21 +114,21 @@ function* generateElementProps(options, ctx, node, props, checkUnknownProps, fai
|
|
|
114
114
|
if (shouldSpread) {
|
|
115
115
|
yield `...{ `;
|
|
116
116
|
}
|
|
117
|
-
const boundary = yield* boundary_1.Boundary.start('template', prop.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
117
|
+
const boundary = yield* boundary_1.Boundary.start('template', prop.loc.start.offset, prop.loc.end.offset, codeFeatures_1.codeFeatures.verification);
|
|
118
118
|
if (prop.arg) {
|
|
119
119
|
yield* (0, objectProperty_1.generateObjectProperty)(options, ctx, propName, prop.arg.loc.start.offset, features, shouldCamelize);
|
|
120
120
|
}
|
|
121
121
|
else {
|
|
122
|
-
const boundary2 = yield* boundary_1.Boundary.start('template', prop.loc.start.offset, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
|
122
|
+
const boundary2 = yield* boundary_1.Boundary.start('template', prop.loc.start.offset, prop.loc.start.offset + 'v-model'.length, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
|
123
123
|
yield propName;
|
|
124
|
-
yield boundary2.end(
|
|
124
|
+
yield boundary2.end();
|
|
125
125
|
}
|
|
126
126
|
yield `: `;
|
|
127
127
|
const argLoc = prop.arg?.loc ?? prop.loc;
|
|
128
|
-
const boundary3 = yield* boundary_1.Boundary.start('template', argLoc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
128
|
+
const boundary3 = yield* boundary_1.Boundary.start('template', argLoc.start.offset, argLoc.end.offset, codeFeatures_1.codeFeatures.verification);
|
|
129
129
|
yield* generatePropExp(options, ctx, prop, prop.exp);
|
|
130
|
-
yield boundary3.end(
|
|
131
|
-
yield boundary.end(
|
|
130
|
+
yield boundary3.end();
|
|
131
|
+
yield boundary.end();
|
|
132
132
|
if (shouldSpread) {
|
|
133
133
|
yield ` }`;
|
|
134
134
|
}
|
|
@@ -153,7 +153,7 @@ function* generateElementProps(options, ctx, node, props, checkUnknownProps, fai
|
|
|
153
153
|
if (shouldSpread) {
|
|
154
154
|
yield `...{ `;
|
|
155
155
|
}
|
|
156
|
-
const boundary = yield* boundary_1.Boundary.start('template', prop.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
156
|
+
const boundary = yield* boundary_1.Boundary.start('template', prop.loc.start.offset, prop.loc.end.offset, codeFeatures_1.codeFeatures.verification);
|
|
157
157
|
const prefix = options.template.content.slice(prop.loc.start.offset, prop.loc.start.offset + 1);
|
|
158
158
|
if (prefix === '.' || prefix === '#') {
|
|
159
159
|
// Pug shorthand syntax
|
|
@@ -174,7 +174,7 @@ function* generateElementProps(options, ctx, node, props, checkUnknownProps, fai
|
|
|
174
174
|
else {
|
|
175
175
|
yield `true`;
|
|
176
176
|
}
|
|
177
|
-
yield boundary.end(
|
|
177
|
+
yield boundary.end();
|
|
178
178
|
if (shouldSpread) {
|
|
179
179
|
yield ` }`;
|
|
180
180
|
}
|
|
@@ -187,10 +187,10 @@ function* generateElementProps(options, ctx, node, props, checkUnknownProps, fai
|
|
|
187
187
|
failedPropExps?.push({ node: prop.exp, prefix: `(`, suffix: `)` });
|
|
188
188
|
}
|
|
189
189
|
else {
|
|
190
|
-
const boundary = yield* boundary_1.Boundary.start('template', prop.exp.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
190
|
+
const boundary = yield* boundary_1.Boundary.start('template', prop.exp.loc.start.offset, prop.exp.loc.end.offset, codeFeatures_1.codeFeatures.verification);
|
|
191
191
|
yield `...`;
|
|
192
192
|
yield* generatePropExp(options, ctx, prop, prop.exp);
|
|
193
|
-
yield boundary.end(
|
|
193
|
+
yield boundary.end();
|
|
194
194
|
yield `,${utils_1.newLine}`;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -4,6 +4,7 @@ export interface TemplateCodegenOptions {
|
|
|
4
4
|
typescript: typeof ts;
|
|
5
5
|
vueCompilerOptions: VueCompilerOptions;
|
|
6
6
|
template: IRTemplate;
|
|
7
|
+
isVapor: boolean;
|
|
7
8
|
setupRefs: Set<string>;
|
|
8
9
|
setupConsts: Set<string>;
|
|
9
10
|
hasDefineSlots?: boolean;
|
|
@@ -31,9 +32,9 @@ declare function generate(options: TemplateCodegenOptions): {
|
|
|
31
32
|
getInternalVariable: () => string;
|
|
32
33
|
scopes: {
|
|
33
34
|
add(value: string): /*elided*/ any;
|
|
35
|
+
clear(): void;
|
|
34
36
|
declare(...variables: string[]): void;
|
|
35
37
|
end(): Generator<Code, any, any>;
|
|
36
|
-
clear(): void;
|
|
37
38
|
delete(value: string): boolean;
|
|
38
39
|
forEach(callbackfn: (value: string, value2: string, set: Set<string>) => void, thisArg?: any): void;
|
|
39
40
|
has(value: string): boolean;
|
|
@@ -46,9 +47,9 @@ declare function generate(options: TemplateCodegenOptions): {
|
|
|
46
47
|
}[];
|
|
47
48
|
scope: () => {
|
|
48
49
|
add(value: string): any;
|
|
50
|
+
clear(): void;
|
|
49
51
|
declare(...variables: string[]): void;
|
|
50
52
|
end(): Generator<Code, any, any>;
|
|
51
|
-
clear(): void;
|
|
52
53
|
delete(value: string): boolean;
|
|
53
54
|
forEach(callbackfn: (value: string, value2: string, set: Set<string>) => void, thisArg?: any): void;
|
|
54
55
|
has(value: string): boolean;
|
|
@@ -94,9 +94,9 @@ function* generateSlotsType(options, ctx) {
|
|
|
94
94
|
yield* (0, objectProperty_1.generateObjectProperty)(options, ctx, slot.name, slot.offset, codeFeatures_1.codeFeatures.navigation);
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
97
|
-
const boundary = yield* boundary_1.Boundary.start('template', slot.tagRange
|
|
97
|
+
const boundary = yield* boundary_1.Boundary.start('template', ...slot.tagRange, codeFeatures_1.codeFeatures.navigation);
|
|
98
98
|
yield `default`;
|
|
99
|
-
yield boundary.end(
|
|
99
|
+
yield boundary.end();
|
|
100
100
|
}
|
|
101
101
|
yield `?: (props: typeof ${slot.propsVar}) => any }`;
|
|
102
102
|
}
|
|
@@ -45,7 +45,7 @@ function* generateInterpolation({ typescript, setupRefs }, ctx, block, data, cod
|
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
47
|
// #1205, #1264
|
|
48
|
-
const boundary = yield* boundary_1.Boundary.start(block.name, start + offset, codeFeatures_1.codeFeatures.verification);
|
|
48
|
+
const boundary = yield* boundary_1.Boundary.start(block.name, start + offset, start + offset + name.length, codeFeatures_1.codeFeatures.verification);
|
|
49
49
|
if (ctx.dollarVars.has(name)) {
|
|
50
50
|
yield names_1.names.dollars;
|
|
51
51
|
}
|
|
@@ -62,7 +62,7 @@ function* generateInterpolation({ typescript, setupRefs }, ctx, block, data, cod
|
|
|
62
62
|
? { ...data, __shorthandExpression: 'js' }
|
|
63
63
|
: data,
|
|
64
64
|
];
|
|
65
|
-
yield boundary.end(
|
|
65
|
+
yield boundary.end();
|
|
66
66
|
}
|
|
67
67
|
prevEnd = offset + name.length;
|
|
68
68
|
}
|
|
@@ -22,11 +22,11 @@ function* generateObjectProperty(options, ctx, code, offset, features, shouldCam
|
|
|
22
22
|
yield* (0, camelized_1.generateCamelized)(code, 'template', offset, features);
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
|
-
const boundary = yield* boundary_1.Boundary.start('template', offset, features);
|
|
25
|
+
const boundary = yield* boundary_1.Boundary.start('template', offset, offset + code.length, features);
|
|
26
26
|
yield `'`;
|
|
27
27
|
yield* (0, camelized_1.generateCamelized)(code, 'template', offset, boundary.features);
|
|
28
28
|
yield `'`;
|
|
29
|
-
yield boundary.end(
|
|
29
|
+
yield boundary.end();
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
@@ -77,26 +77,26 @@ function* generateSlotOutlet(options, ctx, node) {
|
|
|
77
77
|
else {
|
|
78
78
|
codes = [`['default']`];
|
|
79
79
|
}
|
|
80
|
-
const boundary = yield* boundary_1.Boundary.start('template', nameProp.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
80
|
+
const boundary = yield* boundary_1.Boundary.start('template', nameProp.loc.start.offset, nameProp.loc.end.offset, codeFeatures_1.codeFeatures.verification);
|
|
81
81
|
yield options.slotsAssignName ?? names_1.names.slots;
|
|
82
82
|
yield* codes;
|
|
83
|
-
yield boundary.end(
|
|
83
|
+
yield boundary.end();
|
|
84
84
|
}
|
|
85
85
|
else {
|
|
86
|
-
const boundary = yield* boundary_1.Boundary.start('template', startTagOffset, codeFeatures_1.codeFeatures.verification);
|
|
86
|
+
const boundary = yield* boundary_1.Boundary.start('template', startTagOffset, startTagEndOffset, codeFeatures_1.codeFeatures.verification);
|
|
87
87
|
yield `${options.slotsAssignName ?? names_1.names.slots}[`;
|
|
88
|
-
const boundary2 = yield* boundary_1.Boundary.start('template', startTagOffset, codeFeatures_1.codeFeatures.verification);
|
|
88
|
+
const boundary2 = yield* boundary_1.Boundary.start('template', startTagOffset, startTagEndOffset, codeFeatures_1.codeFeatures.verification);
|
|
89
89
|
yield `'default'`;
|
|
90
|
-
yield boundary2.end(
|
|
90
|
+
yield boundary2.end();
|
|
91
91
|
yield `]`;
|
|
92
|
-
yield boundary.end(
|
|
92
|
+
yield boundary.end();
|
|
93
93
|
}
|
|
94
94
|
yield `)(`;
|
|
95
|
-
const boundary = yield* boundary_1.Boundary.start('template', startTagOffset, codeFeatures_1.codeFeatures.verification);
|
|
95
|
+
const boundary = yield* boundary_1.Boundary.start('template', startTagOffset, startTagEndOffset, codeFeatures_1.codeFeatures.verification);
|
|
96
96
|
yield `{${utils_1.newLine}`;
|
|
97
97
|
yield* (0, elementProps_1.generateElementProps)(options, ctx, node, node.props.filter(prop => prop !== nameProp), true);
|
|
98
98
|
yield `}`;
|
|
99
|
-
yield boundary.end(
|
|
99
|
+
yield boundary.end();
|
|
100
100
|
yield `)${utils_1.endOfLine}`;
|
|
101
101
|
}
|
|
102
102
|
else {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as CompilerDOM from '@vue/compiler-dom';
|
|
1
2
|
import type { Code, IRBlock } from '../../types';
|
|
3
|
+
import type { TemplateCodegenOptions } from './index';
|
|
2
4
|
export declare const references: WeakMap<IRBlock, [version: string, [className: string, offset: number][]]>;
|
|
5
|
+
export declare function generateStyleScopedClassReferences({ template, typescript: ts }: TemplateCodegenOptions, node: CompilerDOM.ElementNode): Generator<Code>;
|
|
3
6
|
export declare function generateStyleScopedClassReference(block: IRBlock, className: string, offset: number, fullStart?: number): Generator<Code>;
|
|
@@ -1,7 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.references = void 0;
|
|
37
|
+
exports.generateStyleScopedClassReferences = generateStyleScopedClassReferences;
|
|
4
38
|
exports.generateStyleScopedClassReference = generateStyleScopedClassReference;
|
|
39
|
+
const CompilerDOM = __importStar(require("@vue/compiler-dom"));
|
|
40
|
+
const shared_1 = require("../../utils/shared");
|
|
5
41
|
const codeFeatures_1 = require("../codeFeatures");
|
|
6
42
|
const names_1 = require("../names");
|
|
7
43
|
const utils_1 = require("../utils");
|
|
@@ -10,6 +46,92 @@ const escaped_1 = require("../utils/escaped");
|
|
|
10
46
|
const classNameEscapeRE = /([\\'])/;
|
|
11
47
|
// For language-service/lib/plugins/vue-scoped-class-links.ts usage
|
|
12
48
|
exports.references = new WeakMap();
|
|
49
|
+
function* generateStyleScopedClassReferences({ template, typescript: ts }, node) {
|
|
50
|
+
for (const prop of node.props) {
|
|
51
|
+
if (prop.type === CompilerDOM.NodeTypes.ATTRIBUTE
|
|
52
|
+
&& prop.name === 'class'
|
|
53
|
+
&& prop.value) {
|
|
54
|
+
const [text, start] = (0, shared_1.normalizeAttributeValue)(prop.value);
|
|
55
|
+
for (const [className, offset] of forEachClassName(text)) {
|
|
56
|
+
yield* generateStyleScopedClassReference(template, className, start + offset);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else if (prop.type === CompilerDOM.NodeTypes.DIRECTIVE
|
|
60
|
+
&& prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
|
|
61
|
+
&& prop.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
|
|
62
|
+
&& prop.arg.content === 'class') {
|
|
63
|
+
const content = '(' + prop.exp.content + ')';
|
|
64
|
+
const startOffset = prop.exp.loc.start.offset - 1;
|
|
65
|
+
const ast = (0, utils_1.getTypeScriptAST)(ts, template, content);
|
|
66
|
+
const literals = [];
|
|
67
|
+
for (const node of (0, utils_1.forEachNode)(ts, ast)) {
|
|
68
|
+
if (!ts.isExpressionStatement(node)
|
|
69
|
+
|| !ts.isParenthesizedExpression(node.expression)) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const { expression } = node.expression;
|
|
73
|
+
if (ts.isStringLiteralLike(expression)) {
|
|
74
|
+
literals.push(expression);
|
|
75
|
+
}
|
|
76
|
+
else if (ts.isArrayLiteralExpression(expression)) {
|
|
77
|
+
yield* walkArrayLiteral(expression);
|
|
78
|
+
}
|
|
79
|
+
else if (ts.isObjectLiteralExpression(expression)) {
|
|
80
|
+
yield* walkObjectLiteral(expression);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (const literal of literals) {
|
|
84
|
+
const start = literal.end - literal.text.length - 1 + startOffset;
|
|
85
|
+
for (const [className, offset] of forEachClassName(literal.text)) {
|
|
86
|
+
yield* generateStyleScopedClassReference(template, className, start + offset);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function* walkArrayLiteral(node) {
|
|
90
|
+
const { elements } = node;
|
|
91
|
+
for (const element of elements) {
|
|
92
|
+
if (ts.isStringLiteralLike(element)) {
|
|
93
|
+
literals.push(element);
|
|
94
|
+
}
|
|
95
|
+
else if (ts.isObjectLiteralExpression(element)) {
|
|
96
|
+
yield* walkObjectLiteral(element);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function* walkObjectLiteral(node) {
|
|
101
|
+
const { properties } = node;
|
|
102
|
+
for (const property of properties) {
|
|
103
|
+
if (ts.isPropertyAssignment(property)) {
|
|
104
|
+
const { name } = property;
|
|
105
|
+
if (ts.isIdentifier(name)) {
|
|
106
|
+
const text = (0, shared_1.getNodeText)(ts, name, ast);
|
|
107
|
+
yield* generateStyleScopedClassReference(template, text, name.end - text.length + startOffset);
|
|
108
|
+
}
|
|
109
|
+
else if (ts.isStringLiteral(name)) {
|
|
110
|
+
literals.push(name);
|
|
111
|
+
}
|
|
112
|
+
else if (ts.isComputedPropertyName(name)) {
|
|
113
|
+
const { expression } = name;
|
|
114
|
+
if (ts.isStringLiteralLike(expression)) {
|
|
115
|
+
literals.push(expression);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else if (ts.isShorthandPropertyAssignment(property)) {
|
|
120
|
+
const text = (0, shared_1.getNodeText)(ts, property.name, ast);
|
|
121
|
+
yield* generateStyleScopedClassReference(template, text, property.name.end - text.length + startOffset);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function* forEachClassName(content) {
|
|
129
|
+
let offset = 0;
|
|
130
|
+
for (const className of content.split(' ')) {
|
|
131
|
+
yield [className, offset];
|
|
132
|
+
offset += className.length + 1;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
13
135
|
function* generateStyleScopedClassReference(block, className, offset, fullStart = offset) {
|
|
14
136
|
if (!className) {
|
|
15
137
|
yield `/** @type {${names_1.names.StyleScopedClasses}['`;
|
|
@@ -27,11 +149,11 @@ function* generateStyleScopedClassReference(block, className, offset, fullStart
|
|
|
27
149
|
cache[1].push([className, offset]);
|
|
28
150
|
}
|
|
29
151
|
yield `/** @type {${names_1.names.StyleScopedClasses}[`;
|
|
30
|
-
const boundary = yield* boundary_1.Boundary.start(block.name, fullStart, codeFeatures_1.codeFeatures.navigationAndCompletion);
|
|
152
|
+
const boundary = yield* boundary_1.Boundary.start(block.name, fullStart, offset + className.length, codeFeatures_1.codeFeatures.navigationAndCompletion);
|
|
31
153
|
yield `'`;
|
|
32
154
|
yield* (0, escaped_1.generateEscaped)(className, block.name, offset, boundary.features, classNameEscapeRE);
|
|
33
155
|
yield `'`;
|
|
34
|
-
yield boundary.end(
|
|
156
|
+
yield boundary.end();
|
|
35
157
|
yield `]} */${utils_1.endOfLine}`;
|
|
36
158
|
}
|
|
37
159
|
//# sourceMappingURL=styleScopedClasses.js.map
|
|
@@ -53,17 +53,17 @@ function* generateVSlot(options, ctx, node, slotDir, ctxVar) {
|
|
|
53
53
|
yield* (0, objectProperty_1.generateObjectProperty)(options, ctx, slotDir.arg.loc.source, slotDir.arg.loc.start.offset, slotDir.arg.isStatic ? codeFeatures_1.codeFeatures.withoutHighlight : codeFeatures_1.codeFeatures.all, false, true);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
const boundary = yield* boundary_1.Boundary.start('template', slotDir.loc.start.offset, codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
|
56
|
+
const boundary = yield* boundary_1.Boundary.start('template', slotDir.loc.start.offset, slotDir.loc.start.offset + (slotDir.rawName?.length ?? 0), codeFeatures_1.codeFeatures.withoutHighlightAndCompletion);
|
|
57
57
|
yield `default`;
|
|
58
|
-
yield boundary.end(
|
|
58
|
+
yield boundary.end();
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
62
62
|
yield `const { `;
|
|
63
63
|
// #932: reference for implicit default slot
|
|
64
|
-
const boundary = yield* boundary_1.Boundary.start('template', node.loc.start.offset, codeFeatures_1.codeFeatures.navigation);
|
|
64
|
+
const boundary = yield* boundary_1.Boundary.start('template', node.loc.start.offset, node.loc.end.offset, codeFeatures_1.codeFeatures.navigation);
|
|
65
65
|
yield `default`;
|
|
66
|
-
yield boundary.end(
|
|
66
|
+
yield boundary.end();
|
|
67
67
|
}
|
|
68
68
|
yield `: ${slotVar} } = ${ctxVar}.slots!${utils_1.endOfLine}`;
|
|
69
69
|
const scope = ctx.scope();
|
|
@@ -129,11 +129,11 @@ function* generateSlotParameters(options, ctx, ast, exp, slotVar) {
|
|
|
129
129
|
yield `] = ${names_1.names.vSlot}(${slotVar}!`;
|
|
130
130
|
if (types.some(t => t)) {
|
|
131
131
|
yield `, `;
|
|
132
|
-
const boundary = yield* boundary_1.Boundary.start('template', exp.loc.start.offset, codeFeatures_1.codeFeatures.verification);
|
|
132
|
+
const boundary = yield* boundary_1.Boundary.start('template', exp.loc.start.offset, exp.loc.end.offset, codeFeatures_1.codeFeatures.verification);
|
|
133
133
|
yield `(`;
|
|
134
134
|
yield* types.flatMap(type => type ? [`_`, type, `, `] : `_, `);
|
|
135
135
|
yield `) => [] as any`;
|
|
136
|
-
yield boundary.end(
|
|
136
|
+
yield boundary.end();
|
|
137
137
|
}
|
|
138
138
|
yield `)${utils_1.endOfLine}`;
|
|
139
139
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Code, VueCodeInformation } from '../../types';
|
|
2
2
|
export declare class Boundary {
|
|
3
|
-
source
|
|
3
|
+
private source;
|
|
4
|
+
private endOffset;
|
|
4
5
|
features: VueCodeInformation;
|
|
5
6
|
private constructor();
|
|
6
|
-
static start(source: string,
|
|
7
|
-
end(
|
|
7
|
+
static start(source: string, start: number, end: number, features: VueCodeInformation): Generator<Code, Boundary>;
|
|
8
|
+
end(): Code;
|
|
8
9
|
}
|
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Boundary = void 0;
|
|
4
4
|
class Boundary {
|
|
5
|
-
constructor(source, features) {
|
|
5
|
+
constructor(source, endOffset, features) {
|
|
6
6
|
this.source = source;
|
|
7
|
+
this.endOffset = endOffset;
|
|
7
8
|
this.features = features;
|
|
8
9
|
}
|
|
9
|
-
static *start(source,
|
|
10
|
+
static *start(source, start, end, features) {
|
|
10
11
|
features = { ...features, __combineToken: Symbol() };
|
|
11
|
-
yield [``, source,
|
|
12
|
-
return new Boundary(source, features);
|
|
12
|
+
yield [``, source, start, features];
|
|
13
|
+
return new Boundary(source, end, features);
|
|
13
14
|
}
|
|
14
|
-
end(
|
|
15
|
-
return [``, this.source,
|
|
15
|
+
end() {
|
|
16
|
+
return [``, this.source, this.endOffset, this.features];
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
exports.Boundary = Boundary;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Code, VueCodeInformation } from '../../types';
|
|
2
|
-
export declare function generateStringLiteralKey(code: string, offset
|
|
2
|
+
export declare function generateStringLiteralKey(code: string, offset: number, features: VueCodeInformation): Generator<Code>;
|
|
@@ -2,16 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateStringLiteralKey = generateStringLiteralKey;
|
|
4
4
|
const boundary_1 = require("./boundary");
|
|
5
|
-
function* generateStringLiteralKey(code, offset,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
yield `'`;
|
|
12
|
-
yield [code, 'template', offset, boundary.features];
|
|
13
|
-
yield `'`;
|
|
14
|
-
yield boundary.end(offset + code.length);
|
|
15
|
-
}
|
|
5
|
+
function* generateStringLiteralKey(code, offset, features) {
|
|
6
|
+
const boundary = yield* boundary_1.Boundary.start('template', offset, offset + code.length, features);
|
|
7
|
+
yield `'`;
|
|
8
|
+
yield [code, 'template', offset, boundary.features];
|
|
9
|
+
yield `'`;
|
|
10
|
+
yield boundary.end();
|
|
16
11
|
}
|
|
17
12
|
//# sourceMappingURL=stringLiteralKey.js.map
|
|
@@ -4,9 +4,9 @@ exports.generateUnicode = generateUnicode;
|
|
|
4
4
|
const boundary_1 = require("./boundary");
|
|
5
5
|
function* generateUnicode(code, offset, features) {
|
|
6
6
|
if (needToUnicode(code)) {
|
|
7
|
-
const boundary = yield* boundary_1.Boundary.start('template', offset, features);
|
|
7
|
+
const boundary = yield* boundary_1.Boundary.start('template', offset, offset + code.length, features);
|
|
8
8
|
yield toUnicode(code);
|
|
9
|
-
yield boundary.end(
|
|
9
|
+
yield boundary.end();
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
12
|
yield [code, 'template', offset, features];
|
package/lib/compilerOptions.js
CHANGED
|
@@ -210,6 +210,7 @@ function getDefaultCompilerOptions(target = 99, lib = 'vue', strictTemplates = f
|
|
|
210
210
|
inferTemplateDollarRefs: false,
|
|
211
211
|
inferTemplateDollarSlots: false,
|
|
212
212
|
skipTemplateCodegen: false,
|
|
213
|
+
vapor: false,
|
|
213
214
|
fallthroughAttributes: false,
|
|
214
215
|
checkRequiredFallthroughAttributes: false,
|
|
215
216
|
resolveStyleImports: false,
|
package/lib/plugins/vue-tsx.d.ts
CHANGED
|
@@ -67,9 +67,9 @@ export declare const tsCodegen: WeakMap<IR, {
|
|
|
67
67
|
getInternalVariable: () => string;
|
|
68
68
|
scopes: {
|
|
69
69
|
add(value: string): /*elided*/ any;
|
|
70
|
+
clear(): void;
|
|
70
71
|
declare(...variables: string[]): void;
|
|
71
72
|
end(): Generator<import("../types").Code, any, any>;
|
|
72
|
-
clear(): void;
|
|
73
73
|
delete(value: string): boolean;
|
|
74
74
|
forEach(callbackfn: (value: string, value2: string, set: Set<string>) => void, thisArg?: any): void;
|
|
75
75
|
has(value: string): boolean;
|
|
@@ -82,9 +82,9 @@ export declare const tsCodegen: WeakMap<IR, {
|
|
|
82
82
|
}[];
|
|
83
83
|
scope: () => {
|
|
84
84
|
add(value: string): any;
|
|
85
|
+
clear(): void;
|
|
85
86
|
declare(...variables: string[]): void;
|
|
86
87
|
end(): Generator<import("../types").Code, any, any>;
|
|
87
|
-
clear(): void;
|
|
88
88
|
delete(value: string): boolean;
|
|
89
89
|
forEach(callbackfn: (value: string, value2: string, set: Set<string>) => void, thisArg?: any): void;
|
|
90
90
|
has(value: string): boolean;
|
package/lib/plugins/vue-tsx.js
CHANGED
|
@@ -93,6 +93,7 @@ function useCodegen(ts, vueCompilerOptions, fileName, ir) {
|
|
|
93
93
|
}
|
|
94
94
|
return vueCompilerOptions;
|
|
95
95
|
});
|
|
96
|
+
const getIsVapor = (0, alien_signals_1.computed)(() => getResolvedOptions().vapor || !!(ir.scriptSetup?.attrs.vapor || ir.template?.attrs.vapor));
|
|
96
97
|
const getScriptRanges = (0, alien_signals_1.computed)(() => ir.script && validLangs.has(ir.script.lang)
|
|
97
98
|
? (0, scriptRanges_1.parseScriptRanges)(ts, ir.script.ast, getResolvedOptions())
|
|
98
99
|
: undefined);
|
|
@@ -182,6 +183,7 @@ function useCodegen(ts, vueCompilerOptions, fileName, ir) {
|
|
|
182
183
|
typescript: ts,
|
|
183
184
|
vueCompilerOptions: getResolvedOptions(),
|
|
184
185
|
template: ir.template,
|
|
186
|
+
isVapor: getIsVapor(),
|
|
185
187
|
componentName: getComponentName(),
|
|
186
188
|
setupConsts: getSetupConsts(),
|
|
187
189
|
setupRefs: getSetupRefs(),
|
package/lib/types.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export interface VueCompilerOptions {
|
|
|
43
43
|
inferTemplateDollarRefs: boolean;
|
|
44
44
|
inferTemplateDollarSlots: boolean;
|
|
45
45
|
skipTemplateCodegen: boolean;
|
|
46
|
+
vapor: boolean;
|
|
46
47
|
fallthroughAttributes: boolean;
|
|
47
48
|
checkRequiredFallthroughAttributes: boolean;
|
|
48
49
|
resolveStyleImports: boolean;
|
|
@@ -71,7 +72,7 @@ export interface VueCompilerOptions {
|
|
|
71
72
|
}
|
|
72
73
|
export declare const validVersions: readonly [2, 2.1, 2.2];
|
|
73
74
|
export interface VueLanguagePluginReturn {
|
|
74
|
-
version:
|
|
75
|
+
version: typeof validVersions[number];
|
|
75
76
|
name?: string;
|
|
76
77
|
order?: number;
|
|
77
78
|
requiredCompilerOptions?: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"index.d.ts",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"@volar/language-core": "2.4.28",
|
|
23
23
|
"@vue/compiler-dom": "^3.5.0",
|
|
24
24
|
"@vue/shared": "^3.5.0",
|
|
25
|
-
"alien-signals": "^3.2.
|
|
25
|
+
"alien-signals": "^3.2.1",
|
|
26
26
|
"muggle-string": "^0.4.1",
|
|
27
27
|
"path-browserify": "^1.0.1",
|
|
28
28
|
"picomatch": "^4.0.4"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@types/node": "^
|
|
31
|
+
"@types/node": "^26.0.1",
|
|
32
32
|
"@types/path-browserify": "^1.0.3",
|
|
33
33
|
"@types/picomatch": "^4.0.3",
|
|
34
34
|
"@volar/typescript": "2.4.28",
|
|
35
35
|
"@vue/compiler-sfc": "^3.5.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "876b0278ad0d1995c74c975c1f9fd4a8dc00e092"
|
|
38
38
|
}
|