@vue/language-core 3.0.6 → 3.0.7-alpha.1
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 -1
- package/index.js +1 -1
- package/lib/codegen/script/index.d.ts +20 -3
- package/lib/codegen/script/index.js +10 -16
- package/lib/codegen/template/elementDirectives.js +3 -1
- package/lib/codegen/template/index.d.ts +63 -3
- package/lib/codegen/template/index.js +17 -16
- package/lib/codegen/template/interpolation.js +19 -5
- package/lib/codegen/template/vSlot.js +15 -25
- package/lib/{utils/ts.d.ts → compilerOptions.d.ts} +1 -2
- package/lib/compilerOptions.js +294 -0
- package/lib/plugins/vue-tsx.d.ts +5 -5
- package/lib/plugins/vue-tsx.js +6 -25
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './lib/codegen/globalTypes';
|
|
2
2
|
export * from './lib/codegen/template';
|
|
3
|
+
export * from './lib/compilerOptions';
|
|
3
4
|
export * from './lib/languagePlugin';
|
|
4
5
|
export * from './lib/parsers/scriptSetupRanges';
|
|
5
6
|
export * from './lib/plugins';
|
|
@@ -7,7 +8,6 @@ export * from './lib/types';
|
|
|
7
8
|
export * from './lib/utils/collectBindings';
|
|
8
9
|
export * from './lib/utils/parseSfc';
|
|
9
10
|
export * from './lib/utils/shared';
|
|
10
|
-
export * from './lib/utils/ts';
|
|
11
11
|
export * from './lib/virtualFile/vueFile';
|
|
12
12
|
export { tsCodegen } from './lib/plugins/vue-tsx';
|
|
13
13
|
export * from '@volar/language-core';
|
package/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.tsCodegen = void 0;
|
|
18
18
|
__exportStar(require("./lib/codegen/globalTypes"), exports);
|
|
19
19
|
__exportStar(require("./lib/codegen/template"), exports);
|
|
20
|
+
__exportStar(require("./lib/compilerOptions"), exports);
|
|
20
21
|
__exportStar(require("./lib/languagePlugin"), exports);
|
|
21
22
|
__exportStar(require("./lib/parsers/scriptSetupRanges"), exports);
|
|
22
23
|
__exportStar(require("./lib/plugins"), exports);
|
|
@@ -24,7 +25,6 @@ __exportStar(require("./lib/types"), exports);
|
|
|
24
25
|
__exportStar(require("./lib/utils/collectBindings"), exports);
|
|
25
26
|
__exportStar(require("./lib/utils/parseSfc"), exports);
|
|
26
27
|
__exportStar(require("./lib/utils/shared"), exports);
|
|
27
|
-
__exportStar(require("./lib/utils/ts"), exports);
|
|
28
28
|
__exportStar(require("./lib/virtualFile/vueFile"), exports);
|
|
29
29
|
var vue_tsx_1 = require("./lib/plugins/vue-tsx");
|
|
30
30
|
Object.defineProperty(exports, "tsCodegen", { enumerable: true, get: function () { return vue_tsx_1.tsCodegen; } });
|
|
@@ -3,8 +3,6 @@ import type { ScriptRanges } from '../../parsers/scriptRanges';
|
|
|
3
3
|
import type { ScriptSetupRanges } from '../../parsers/scriptSetupRanges';
|
|
4
4
|
import type { Code, Sfc, VueCompilerOptions } from '../../types';
|
|
5
5
|
import type { TemplateCodegenContext } from '../template/context';
|
|
6
|
-
import { type ScriptCodegenContext } from './context';
|
|
7
|
-
export * from './context';
|
|
8
6
|
export interface ScriptCodegenOptions {
|
|
9
7
|
ts: typeof ts;
|
|
10
8
|
compilerOptions: ts.CompilerOptions;
|
|
@@ -20,5 +18,24 @@ export interface ScriptCodegenOptions {
|
|
|
20
18
|
destructuredPropNames: Set<string>;
|
|
21
19
|
templateRefNames: Set<string>;
|
|
22
20
|
}
|
|
23
|
-
export
|
|
21
|
+
export { generate as generateScript };
|
|
22
|
+
declare function generate(options: ScriptCodegenOptions): {
|
|
23
|
+
codes: Code[];
|
|
24
|
+
generatedTemplate: boolean;
|
|
25
|
+
generatedPropsType: boolean;
|
|
26
|
+
bypassDefineComponent: boolean;
|
|
27
|
+
bindingNames: Set<string>;
|
|
28
|
+
localTypes: {
|
|
29
|
+
generate: (names: string[]) => Generator<string, void, unknown>;
|
|
30
|
+
getUsedNames(): Set<string>;
|
|
31
|
+
readonly PrettifyLocal: string;
|
|
32
|
+
readonly OmitKeepDiscriminatedUnion: string;
|
|
33
|
+
readonly WithDefaults: string;
|
|
34
|
+
readonly WithSlots: string;
|
|
35
|
+
readonly PropsChildren: string;
|
|
36
|
+
readonly TypePropsToOption: string;
|
|
37
|
+
readonly OmitIndexSignature: string;
|
|
38
|
+
};
|
|
39
|
+
inlayHints: import("../inlayHints").InlayHintInfo[];
|
|
40
|
+
};
|
|
24
41
|
export declare function generateScriptSectionPartiallyEnding(source: string, end: number, mark: string, delimiter?: string): Generator<Code>;
|
|
@@ -1,29 +1,23 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.generateScript =
|
|
3
|
+
exports.generateScript = generate;
|
|
18
4
|
exports.generateScriptSectionPartiallyEnding = generateScriptSectionPartiallyEnding;
|
|
19
5
|
const path = require("path-browserify");
|
|
20
6
|
const codeFeatures_1 = require("../codeFeatures");
|
|
21
7
|
const utils_1 = require("../utils");
|
|
22
8
|
const componentSelf_1 = require("./componentSelf");
|
|
9
|
+
const context_1 = require("./context");
|
|
23
10
|
const scriptSetup_1 = require("./scriptSetup");
|
|
24
11
|
const src_1 = require("./src");
|
|
25
12
|
const template_1 = require("./template");
|
|
26
|
-
|
|
13
|
+
function generate(options) {
|
|
14
|
+
const context = (0, context_1.createScriptCodegenContext)(options);
|
|
15
|
+
const codegen = generateScript(options, context);
|
|
16
|
+
return {
|
|
17
|
+
...context,
|
|
18
|
+
codes: [...codegen],
|
|
19
|
+
};
|
|
20
|
+
}
|
|
27
21
|
function* generateScript(options, ctx) {
|
|
28
22
|
yield* generateGlobalTypesPath(options);
|
|
29
23
|
if (options.sfc.script?.src) {
|
|
@@ -29,7 +29,9 @@ function* generateElementDirectives(options, ctx, node) {
|
|
|
29
29
|
|| prop.name === 'bind') {
|
|
30
30
|
continue;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
if (!builtInDirectives.has(prop.name)) {
|
|
33
|
+
ctx.accessExternalVariable((0, shared_1.camelize)('v-' + prop.name), prop.loc.start.offset);
|
|
34
|
+
}
|
|
33
35
|
yield* (0, wrapWith_1.wrapWith)(prop.loc.start.offset, prop.loc.end.offset, codeFeatures_1.codeFeatures.verification, `__VLS_asFunctionalDirective(`, ...generateIdentifier(options, prop), `)(null!, { ...__VLS_directiveBindingRestFields, `, ...generateArg(options, ctx, prop), ...generateModifiers(options, ctx, prop), ...generateValue(options, ctx, prop), ` }, null!, null!)`);
|
|
34
36
|
yield utils_1.endOfLine;
|
|
35
37
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as CompilerDOM from '@vue/compiler-dom';
|
|
2
2
|
import type * as ts from 'typescript';
|
|
3
3
|
import type { Code, Sfc, VueCompilerOptions } from '../../types';
|
|
4
|
-
import type { TemplateCodegenContext } from './context';
|
|
5
|
-
export * from './context';
|
|
6
4
|
export interface TemplateCodegenOptions {
|
|
7
5
|
ts: typeof ts;
|
|
8
6
|
compilerOptions: ts.CompilerOptions;
|
|
@@ -18,5 +16,67 @@ export interface TemplateCodegenOptions {
|
|
|
18
16
|
inheritAttrs: boolean;
|
|
19
17
|
selfComponentName?: string;
|
|
20
18
|
}
|
|
21
|
-
export
|
|
19
|
+
export { generate as generateTemplate };
|
|
20
|
+
declare function generate(options: TemplateCodegenOptions): {
|
|
21
|
+
codes: Code[];
|
|
22
|
+
currentInfo: {
|
|
23
|
+
ignoreError?: boolean;
|
|
24
|
+
expectError?: {
|
|
25
|
+
token: number;
|
|
26
|
+
node: CompilerDOM.CommentNode;
|
|
27
|
+
};
|
|
28
|
+
generic?: {
|
|
29
|
+
content: string;
|
|
30
|
+
offset: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
resolveCodeFeatures: (features: import("../../types").VueCodeInformation) => import("../../types").VueCodeInformation;
|
|
34
|
+
inlineTsAsts: Map<string, ts.SourceFile> | undefined;
|
|
35
|
+
inVFor: boolean;
|
|
36
|
+
slots: {
|
|
37
|
+
name: string;
|
|
38
|
+
offset?: number;
|
|
39
|
+
tagRange: [number, number];
|
|
40
|
+
nodeLoc: any;
|
|
41
|
+
propsVar: string;
|
|
42
|
+
}[];
|
|
43
|
+
dynamicSlots: {
|
|
44
|
+
expVar: string;
|
|
45
|
+
propsVar: string;
|
|
46
|
+
}[];
|
|
47
|
+
dollarVars: Set<string>;
|
|
48
|
+
accessExternalVariables: Map<string, Set<number>>;
|
|
49
|
+
blockConditions: string[];
|
|
50
|
+
scopedClasses: {
|
|
51
|
+
source: string;
|
|
52
|
+
className: string;
|
|
53
|
+
offset: number;
|
|
54
|
+
}[];
|
|
55
|
+
emptyClassOffsets: number[];
|
|
56
|
+
inlayHints: import("../inlayHints").InlayHintInfo[];
|
|
57
|
+
bindingAttrLocs: CompilerDOM.SourceLocation[];
|
|
58
|
+
inheritedAttrVars: Set<string>;
|
|
59
|
+
templateRefs: Map<string, {
|
|
60
|
+
typeExp: string;
|
|
61
|
+
offset: number;
|
|
62
|
+
}[]>;
|
|
63
|
+
currentComponent: {
|
|
64
|
+
ctxVar: string;
|
|
65
|
+
used: boolean;
|
|
66
|
+
} | undefined;
|
|
67
|
+
singleRootElTypes: string[];
|
|
68
|
+
singleRootNodes: Set<CompilerDOM.ElementNode | null>;
|
|
69
|
+
addTemplateRef(name: string, typeExp: string, offset: number): void;
|
|
70
|
+
accessExternalVariable(name: string, offset?: number): void;
|
|
71
|
+
hasLocalVariable(name: string): boolean;
|
|
72
|
+
addLocalVariable(name: string): void;
|
|
73
|
+
removeLocalVariable(name: string): void;
|
|
74
|
+
getInternalVariable(): string;
|
|
75
|
+
getHoistVariable(originalVar: string): string;
|
|
76
|
+
generateHoistVariables(): Generator<string, void, unknown>;
|
|
77
|
+
generateConditionGuards(): Generator<string, void, unknown>;
|
|
78
|
+
generateAutoImportCompletion(): Generator<Code>;
|
|
79
|
+
enter(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode | CompilerDOM.SimpleExpressionNode): boolean;
|
|
80
|
+
exit(): Generator<Code>;
|
|
81
|
+
};
|
|
22
82
|
export declare function forEachElementNode(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode): Generator<CompilerDOM.ElementNode>;
|
|
@@ -1,30 +1,31 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.generateTemplate =
|
|
3
|
+
exports.generateTemplate = generate;
|
|
18
4
|
exports.forEachElementNode = forEachElementNode;
|
|
19
5
|
const CompilerDOM = require("@vue/compiler-dom");
|
|
20
6
|
const shared_1 = require("../../utils/shared");
|
|
21
7
|
const codeFeatures_1 = require("../codeFeatures");
|
|
22
8
|
const utils_1 = require("../utils");
|
|
23
9
|
const wrapWith_1 = require("../utils/wrapWith");
|
|
10
|
+
const context_1 = require("./context");
|
|
24
11
|
const objectProperty_1 = require("./objectProperty");
|
|
25
12
|
const styleScopedClasses_1 = require("./styleScopedClasses");
|
|
26
13
|
const templateChild_1 = require("./templateChild");
|
|
27
|
-
|
|
14
|
+
function generate(options) {
|
|
15
|
+
const context = (0, context_1.createTemplateCodegenContext)(options, options.template.ast);
|
|
16
|
+
const codegen = generateTemplate(options, context);
|
|
17
|
+
const codes = [];
|
|
18
|
+
for (const code of codegen) {
|
|
19
|
+
if (typeof code === 'object') {
|
|
20
|
+
code[3] = context.resolveCodeFeatures(code[3]);
|
|
21
|
+
}
|
|
22
|
+
codes.push(code);
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
...context,
|
|
26
|
+
codes,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
28
29
|
function* generateTemplate(options, ctx) {
|
|
29
30
|
if (options.slotsAssignName) {
|
|
30
31
|
ctx.addLocalVariable(options.slotsAssignName);
|
|
@@ -140,8 +140,13 @@ function walkIdentifiers(ts, node, ast, cb, ctx, blockVars, isRoot = false) {
|
|
|
140
140
|
ctx.addLocalVariable(name);
|
|
141
141
|
blockVars.push(name);
|
|
142
142
|
}
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
walkIdentifiersInBinding(ts, node, ast, cb, ctx, blockVars);
|
|
144
|
+
}
|
|
145
|
+
else if (ts.isArrayBindingPattern(node) || ts.isObjectBindingPattern(node)) {
|
|
146
|
+
for (const element of node.elements) {
|
|
147
|
+
if (ts.isBindingElement(element)) {
|
|
148
|
+
walkIdentifiersInBinding(ts, element, ast, cb, ctx, blockVars);
|
|
149
|
+
}
|
|
145
150
|
}
|
|
146
151
|
}
|
|
147
152
|
else if (ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {
|
|
@@ -194,13 +199,22 @@ function walkIdentifiers(ts, node, ast, cb, ctx, blockVars, isRoot = false) {
|
|
|
194
199
|
}
|
|
195
200
|
}
|
|
196
201
|
}
|
|
202
|
+
function walkIdentifiersInBinding(ts, node, ast, cb, ctx, blockVars) {
|
|
203
|
+
if ('type' in node && node.type) {
|
|
204
|
+
walkIdentifiersInTypeNode(ts, node.type, cb);
|
|
205
|
+
}
|
|
206
|
+
if (!ts.isIdentifier(node.name)) {
|
|
207
|
+
walkIdentifiers(ts, node.name, ast, cb, ctx, blockVars);
|
|
208
|
+
}
|
|
209
|
+
if (node.initializer) {
|
|
210
|
+
walkIdentifiers(ts, node.initializer, ast, cb, ctx, blockVars);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
197
213
|
function walkIdentifiersInFunction(ts, node, ast, cb, ctx) {
|
|
198
214
|
const functionArgs = [];
|
|
199
215
|
for (const param of node.parameters) {
|
|
200
216
|
functionArgs.push(...(0, collectBindings_1.collectBindingNames)(ts, param.name, ast));
|
|
201
|
-
|
|
202
|
-
walkIdentifiersInTypeNode(ts, param.type, cb);
|
|
203
|
-
}
|
|
217
|
+
walkIdentifiersInBinding(ts, param, ast, cb, ctx, functionArgs);
|
|
204
218
|
}
|
|
205
219
|
for (const varName of functionArgs) {
|
|
206
220
|
ctx.addLocalVariable(varName);
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateVSlot = generateVSlot;
|
|
4
4
|
const CompilerDOM = require("@vue/compiler-dom");
|
|
5
|
+
const muggle_string_1 = require("muggle-string");
|
|
5
6
|
const collectBindings_1 = require("../../utils/collectBindings");
|
|
6
|
-
const shared_1 = require("../../utils/shared");
|
|
7
7
|
const codeFeatures_1 = require("../codeFeatures");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const wrapWith_1 = require("../utils/wrapWith");
|
|
10
10
|
const elementChildren_1 = require("./elementChildren");
|
|
11
|
+
const interpolation_1 = require("./interpolation");
|
|
11
12
|
const objectProperty_1 = require("./objectProperty");
|
|
12
13
|
function* generateVSlot(options, ctx, node, slotDir) {
|
|
13
14
|
if (!ctx.currentComponent) {
|
|
@@ -38,7 +39,7 @@ function* generateVSlot(options, ctx, node, slotDir) {
|
|
|
38
39
|
if (slotDir?.exp?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
|
|
39
40
|
const slotAst = (0, utils_1.createTsAst)(options.ts, ctx.inlineTsAsts, `(${slotDir.exp.content}) => {}`);
|
|
40
41
|
slotBlockVars.push(...(0, collectBindings_1.collectBindingNames)(options.ts, slotAst, slotAst));
|
|
41
|
-
yield* generateSlotParameters(options, slotAst, slotDir.exp, slotVar);
|
|
42
|
+
yield* generateSlotParameters(options, ctx, slotAst, slotDir.exp, slotVar);
|
|
42
43
|
}
|
|
43
44
|
for (const varName of slotBlockVars) {
|
|
44
45
|
ctx.addLocalVariable(varName);
|
|
@@ -69,7 +70,7 @@ function* generateVSlot(options, ctx, node, slotDir) {
|
|
|
69
70
|
yield `}${utils_1.newLine}`;
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
function* generateSlotParameters(options, ast, exp, slotVar) {
|
|
73
|
+
function* generateSlotParameters(options, ctx, ast, exp, slotVar) {
|
|
73
74
|
const { ts } = options;
|
|
74
75
|
const statement = ast.statements[0];
|
|
75
76
|
if (!ts.isExpressionStatement(statement) || !ts.isArrowFunction(statement.expression)) {
|
|
@@ -77,42 +78,31 @@ function* generateSlotParameters(options, ast, exp, slotVar) {
|
|
|
77
78
|
}
|
|
78
79
|
const { expression } = statement;
|
|
79
80
|
const startOffset = exp.loc.start.offset - 1;
|
|
80
|
-
const modifies = [];
|
|
81
81
|
const types = [];
|
|
82
|
+
const interpolation = [...(0, interpolation_1.generateInterpolation)(options, ctx, 'template', codeFeatures_1.codeFeatures.all, ast.text, startOffset)];
|
|
83
|
+
(0, muggle_string_1.replaceSourceRange)(interpolation, 'template', startOffset, startOffset + `(`.length);
|
|
84
|
+
(0, muggle_string_1.replaceSourceRange)(interpolation, 'template', startOffset + ast.text.length - `) => {}`.length, startOffset + ast.text.length);
|
|
82
85
|
for (const { name, type } of expression.parameters) {
|
|
83
86
|
if (type) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
types.push([
|
|
88
|
+
ast.text.slice(name.end, type.end),
|
|
89
|
+
'template',
|
|
90
|
+
startOffset + name.end,
|
|
91
|
+
codeFeatures_1.codeFeatures.all,
|
|
88
92
|
]);
|
|
89
|
-
|
|
93
|
+
(0, muggle_string_1.replaceSourceRange)(interpolation, 'template', startOffset + name.end, startOffset + type.end);
|
|
90
94
|
}
|
|
91
95
|
else {
|
|
92
96
|
types.push(null);
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
yield `const [`;
|
|
96
|
-
|
|
97
|
-
for (const [codes, start, end] of modifies) {
|
|
98
|
-
yield chunk(nextStart, start);
|
|
99
|
-
yield* codes;
|
|
100
|
-
nextStart = end;
|
|
101
|
-
}
|
|
102
|
-
yield chunk(nextStart, expression.equalsGreaterThanToken.pos - 1);
|
|
100
|
+
yield* interpolation;
|
|
103
101
|
yield `] = __VLS_getSlotParameters(${slotVar}!`;
|
|
104
102
|
if (types.some(t => t)) {
|
|
105
103
|
yield `, `;
|
|
106
|
-
yield* (0, wrapWith_1.wrapWith)(exp.loc.start.offset, exp.loc.end.offset, codeFeatures_1.codeFeatures.verification, `(`, ...types.flatMap(type => type ? [`_
|
|
104
|
+
yield* (0, wrapWith_1.wrapWith)(exp.loc.start.offset, exp.loc.end.offset, codeFeatures_1.codeFeatures.verification, `(`, ...types.flatMap(type => type ? [`_`, type, `, `] : `_, `), `) => [] as any`);
|
|
107
105
|
}
|
|
108
106
|
yield `)${utils_1.endOfLine}`;
|
|
109
|
-
function chunk(start, end) {
|
|
110
|
-
return [
|
|
111
|
-
ast.text.slice(start, end),
|
|
112
|
-
'template',
|
|
113
|
-
startOffset + start,
|
|
114
|
-
codeFeatures_1.codeFeatures.all,
|
|
115
|
-
];
|
|
116
|
-
}
|
|
117
107
|
}
|
|
118
108
|
//# sourceMappingURL=vSlot.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as ts from 'typescript';
|
|
2
|
-
import type { RawVueCompilerOptions, VueCompilerOptions, VueLanguagePlugin } from '
|
|
2
|
+
import type { RawVueCompilerOptions, VueCompilerOptions, VueLanguagePlugin } from './types';
|
|
3
3
|
interface ParseConfigHost extends Omit<ts.ParseConfigHost, 'readDirectory'> {
|
|
4
4
|
}
|
|
5
5
|
export interface ParsedCommandLine extends Omit<ts.ParsedCommandLine, 'fileNames'> {
|
|
@@ -9,7 +9,6 @@ export declare function createParsedCommandLineByJson(ts: typeof import('typescr
|
|
|
9
9
|
export declare function createParsedCommandLine(ts: typeof import('typescript'), host: ParseConfigHost, configFileName: string): ParsedCommandLine;
|
|
10
10
|
export declare class CompilerOptionsResolver {
|
|
11
11
|
fileExists?: ((path: string) => boolean) | undefined;
|
|
12
|
-
configRoots: Set<string>;
|
|
13
12
|
options: Omit<RawVueCompilerOptions, 'target' | 'globalTypesPath' | 'plugins'>;
|
|
14
13
|
target: number | undefined;
|
|
15
14
|
globalTypesPath: string | undefined;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompilerOptionsResolver = void 0;
|
|
4
|
+
exports.createParsedCommandLineByJson = createParsedCommandLineByJson;
|
|
5
|
+
exports.createParsedCommandLine = createParsedCommandLine;
|
|
6
|
+
exports.getDefaultCompilerOptions = getDefaultCompilerOptions;
|
|
7
|
+
exports.writeGlobalTypes = writeGlobalTypes;
|
|
8
|
+
const shared_1 = require("@vue/shared");
|
|
9
|
+
const path_browserify_1 = require("path-browserify");
|
|
10
|
+
const globalTypes_1 = require("./codegen/globalTypes");
|
|
11
|
+
const shared_2 = require("./utils/shared");
|
|
12
|
+
function createParsedCommandLineByJson(ts, host, rootDir, json, configFileName) {
|
|
13
|
+
const extendedPaths = new Set();
|
|
14
|
+
const proxyHost = {
|
|
15
|
+
...host,
|
|
16
|
+
readFile(fileName) {
|
|
17
|
+
if (!fileName.endsWith('/package.json')) {
|
|
18
|
+
extendedPaths.add(fileName);
|
|
19
|
+
}
|
|
20
|
+
return host.readFile(fileName);
|
|
21
|
+
},
|
|
22
|
+
readDirectory() {
|
|
23
|
+
return [];
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const parsed = ts.parseJsonConfigFileContent(json, proxyHost, rootDir, {}, configFileName);
|
|
27
|
+
const resolver = new CompilerOptionsResolver(host.fileExists);
|
|
28
|
+
for (const extendPath of [...extendedPaths].reverse()) {
|
|
29
|
+
try {
|
|
30
|
+
const configFile = ts.readJsonConfigFile(extendPath, host.readFile);
|
|
31
|
+
const obj = ts.convertToObject(configFile, []);
|
|
32
|
+
const rawOptions = obj?.vueCompilerOptions ?? {};
|
|
33
|
+
resolver.addConfig(rawOptions, path_browserify_1.posix.dirname(configFile.fileName));
|
|
34
|
+
}
|
|
35
|
+
catch { }
|
|
36
|
+
}
|
|
37
|
+
// ensure the rootDir is added to the config roots
|
|
38
|
+
resolver.addConfig({}, rootDir);
|
|
39
|
+
return {
|
|
40
|
+
...parsed,
|
|
41
|
+
vueOptions: resolver.build(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function createParsedCommandLine(ts, host, configFileName) {
|
|
45
|
+
try {
|
|
46
|
+
const extendedPaths = new Set();
|
|
47
|
+
const proxyHost = {
|
|
48
|
+
...host,
|
|
49
|
+
readFile(fileName) {
|
|
50
|
+
if (!fileName.endsWith('/package.json')) {
|
|
51
|
+
extendedPaths.add(fileName);
|
|
52
|
+
}
|
|
53
|
+
return host.readFile(fileName);
|
|
54
|
+
},
|
|
55
|
+
readDirectory() {
|
|
56
|
+
return [];
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
const config = ts.readJsonConfigFile(configFileName, proxyHost.readFile);
|
|
60
|
+
const parsed = ts.parseJsonSourceFileConfigFileContent(config, proxyHost, path_browserify_1.posix.dirname(configFileName), {}, configFileName);
|
|
61
|
+
const resolver = new CompilerOptionsResolver(host.fileExists);
|
|
62
|
+
for (const extendPath of [...extendedPaths].reverse()) {
|
|
63
|
+
try {
|
|
64
|
+
const configFile = ts.readJsonConfigFile(extendPath, host.readFile);
|
|
65
|
+
const obj = ts.convertToObject(configFile, []);
|
|
66
|
+
const rawOptions = obj?.vueCompilerOptions ?? {};
|
|
67
|
+
resolver.addConfig(rawOptions, path_browserify_1.posix.dirname(configFile.fileName));
|
|
68
|
+
}
|
|
69
|
+
catch { }
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
...parsed,
|
|
73
|
+
vueOptions: resolver.build(),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch { }
|
|
77
|
+
return {
|
|
78
|
+
options: {},
|
|
79
|
+
errors: [],
|
|
80
|
+
vueOptions: getDefaultCompilerOptions(),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
class CompilerOptionsResolver {
|
|
84
|
+
constructor(fileExists) {
|
|
85
|
+
this.fileExists = fileExists;
|
|
86
|
+
this.options = {};
|
|
87
|
+
this.plugins = [];
|
|
88
|
+
}
|
|
89
|
+
addConfig(options, rootDir) {
|
|
90
|
+
for (const key in options) {
|
|
91
|
+
switch (key) {
|
|
92
|
+
case 'target':
|
|
93
|
+
if (options[key] === 'auto') {
|
|
94
|
+
this.target = findVueVersion(rootDir);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.target = options[key];
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case 'globalTypesPath':
|
|
101
|
+
if (options[key] !== undefined) {
|
|
102
|
+
this.globalTypesPath = path_browserify_1.posix.join(rootDir, options[key]);
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
case 'plugins':
|
|
106
|
+
this.plugins = (options.plugins ?? [])
|
|
107
|
+
.flatMap((pluginPath) => {
|
|
108
|
+
try {
|
|
109
|
+
const resolvedPath = resolvePath(pluginPath, rootDir);
|
|
110
|
+
if (resolvedPath) {
|
|
111
|
+
const plugin = require(resolvedPath);
|
|
112
|
+
plugin.__moduleName = pluginPath;
|
|
113
|
+
return plugin;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
console.warn('[Vue] Load plugin failed:', pluginPath);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
console.warn('[Vue] Resolve plugin path failed:', pluginPath, error);
|
|
121
|
+
}
|
|
122
|
+
return [];
|
|
123
|
+
});
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
// @ts-expect-error
|
|
127
|
+
this.options[key] = options[key];
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (options.target === undefined) {
|
|
132
|
+
this.target ??= findVueVersion(rootDir);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
build(defaults) {
|
|
136
|
+
defaults ??= getDefaultCompilerOptions(this.target, this.options.lib, this.options.strictTemplates);
|
|
137
|
+
const resolvedOptions = {
|
|
138
|
+
...defaults,
|
|
139
|
+
...this.options,
|
|
140
|
+
plugins: this.plugins,
|
|
141
|
+
macros: {
|
|
142
|
+
...defaults.macros,
|
|
143
|
+
...this.options.macros,
|
|
144
|
+
},
|
|
145
|
+
composables: {
|
|
146
|
+
...defaults.composables,
|
|
147
|
+
...this.options.composables,
|
|
148
|
+
},
|
|
149
|
+
fallthroughComponentNames: [
|
|
150
|
+
...defaults.fallthroughComponentNames,
|
|
151
|
+
...this.options.fallthroughComponentNames ?? [],
|
|
152
|
+
].map(shared_2.hyphenateTag),
|
|
153
|
+
// https://github.com/vuejs/vue-next/blob/master/packages/compiler-dom/src/transforms/vModel.ts#L49-L51
|
|
154
|
+
// https://vuejs.org/guide/essentials/forms.html#form-input-bindings
|
|
155
|
+
experimentalModelPropName: Object.fromEntries(Object.entries(this.options.experimentalModelPropName ?? defaults.experimentalModelPropName).map(([k, v]) => [(0, shared_1.camelize)(k), v])),
|
|
156
|
+
};
|
|
157
|
+
if (resolvedOptions.globalTypesPath === shared_1.NOOP) {
|
|
158
|
+
if (this.fileExists && this.globalTypesPath === undefined) {
|
|
159
|
+
const fileDirToGlobalTypesPath = new Map();
|
|
160
|
+
resolvedOptions.globalTypesPath = fileName => {
|
|
161
|
+
const fileDir = path_browserify_1.posix.dirname(fileName);
|
|
162
|
+
if (fileDirToGlobalTypesPath.has(fileDir)) {
|
|
163
|
+
return fileDirToGlobalTypesPath.get(fileDir);
|
|
164
|
+
}
|
|
165
|
+
const root = this.findNodeModulesRoot(fileDir, resolvedOptions.lib);
|
|
166
|
+
const result = root
|
|
167
|
+
? path_browserify_1.posix.join(root, 'node_modules', '.vue-global-types', (0, globalTypes_1.getGlobalTypesFileName)(resolvedOptions))
|
|
168
|
+
: undefined;
|
|
169
|
+
fileDirToGlobalTypesPath.set(fileDir, result);
|
|
170
|
+
return result;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
resolvedOptions.globalTypesPath = () => this.globalTypesPath;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return resolvedOptions;
|
|
178
|
+
}
|
|
179
|
+
findNodeModulesRoot(dir, lib) {
|
|
180
|
+
while (!this.fileExists(path_browserify_1.posix.join(dir, 'node_modules', lib, 'package.json'))) {
|
|
181
|
+
const parentDir = path_browserify_1.posix.dirname(dir);
|
|
182
|
+
if (dir === parentDir) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
dir = parentDir;
|
|
186
|
+
}
|
|
187
|
+
return dir;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.CompilerOptionsResolver = CompilerOptionsResolver;
|
|
191
|
+
function findVueVersion(rootDir) {
|
|
192
|
+
const resolvedPath = resolvePath('vue/package.json', rootDir);
|
|
193
|
+
if (resolvedPath) {
|
|
194
|
+
const vuePackageJson = require(resolvedPath);
|
|
195
|
+
const versionNumbers = vuePackageJson.version.split('.');
|
|
196
|
+
return Number(versionNumbers[0] + '.' + versionNumbers[1]);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
// console.warn('Load vue/package.json failed from', folder);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function resolvePath(scriptPath, root) {
|
|
203
|
+
try {
|
|
204
|
+
if (require?.resolve) {
|
|
205
|
+
return require.resolve(scriptPath, { paths: [root] });
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
// console.warn('failed to resolve path:', scriptPath, 'require.resolve is not supported in web');
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
// console.warn(error);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function getDefaultCompilerOptions(target = 99, lib = 'vue', strictTemplates = false) {
|
|
216
|
+
return {
|
|
217
|
+
target,
|
|
218
|
+
lib,
|
|
219
|
+
globalTypesPath: shared_1.NOOP,
|
|
220
|
+
extensions: ['.vue'],
|
|
221
|
+
vitePressExtensions: [],
|
|
222
|
+
petiteVueExtensions: [],
|
|
223
|
+
jsxSlots: false,
|
|
224
|
+
strictVModel: strictTemplates,
|
|
225
|
+
strictCssModules: false,
|
|
226
|
+
checkUnknownProps: strictTemplates,
|
|
227
|
+
checkUnknownEvents: strictTemplates,
|
|
228
|
+
checkUnknownDirectives: strictTemplates,
|
|
229
|
+
checkUnknownComponents: strictTemplates,
|
|
230
|
+
inferComponentDollarEl: false,
|
|
231
|
+
inferComponentDollarRefs: false,
|
|
232
|
+
inferTemplateDollarAttrs: false,
|
|
233
|
+
inferTemplateDollarEl: false,
|
|
234
|
+
inferTemplateDollarRefs: false,
|
|
235
|
+
inferTemplateDollarSlots: false,
|
|
236
|
+
skipTemplateCodegen: false,
|
|
237
|
+
fallthroughAttributes: false,
|
|
238
|
+
resolveStyleImports: false,
|
|
239
|
+
resolveStyleClassNames: 'scoped',
|
|
240
|
+
fallthroughComponentNames: [
|
|
241
|
+
'Transition',
|
|
242
|
+
'KeepAlive',
|
|
243
|
+
'Teleport',
|
|
244
|
+
'Suspense',
|
|
245
|
+
],
|
|
246
|
+
dataAttributes: [],
|
|
247
|
+
htmlAttributes: ['aria-*'],
|
|
248
|
+
optionsWrapper: target >= 2.7
|
|
249
|
+
? [`(await import('${lib}')).defineComponent(`, `)`]
|
|
250
|
+
: [`(await import('${lib}')).default.extend(`, `)`],
|
|
251
|
+
macros: {
|
|
252
|
+
defineProps: ['defineProps'],
|
|
253
|
+
defineSlots: ['defineSlots'],
|
|
254
|
+
defineEmits: ['defineEmits'],
|
|
255
|
+
defineExpose: ['defineExpose'],
|
|
256
|
+
defineModel: ['defineModel'],
|
|
257
|
+
defineOptions: ['defineOptions'],
|
|
258
|
+
withDefaults: ['withDefaults'],
|
|
259
|
+
},
|
|
260
|
+
composables: {
|
|
261
|
+
useAttrs: ['useAttrs'],
|
|
262
|
+
useCssModule: ['useCssModule'],
|
|
263
|
+
useSlots: ['useSlots'],
|
|
264
|
+
useTemplateRef: ['useTemplateRef', 'templateRef'],
|
|
265
|
+
},
|
|
266
|
+
plugins: [],
|
|
267
|
+
experimentalModelPropName: {
|
|
268
|
+
'': {
|
|
269
|
+
input: true,
|
|
270
|
+
},
|
|
271
|
+
value: {
|
|
272
|
+
input: { type: 'text' },
|
|
273
|
+
textarea: true,
|
|
274
|
+
select: true,
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
function writeGlobalTypes(vueOptions, writeFile) {
|
|
280
|
+
const originalFn = vueOptions.globalTypesPath;
|
|
281
|
+
if (!originalFn) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const writed = new Set();
|
|
285
|
+
vueOptions.globalTypesPath = (fileName) => {
|
|
286
|
+
const result = originalFn(fileName);
|
|
287
|
+
if (result && !writed.has(result)) {
|
|
288
|
+
writed.add(result);
|
|
289
|
+
writeFile(result, (0, globalTypes_1.generateGlobalTypes)(vueOptions));
|
|
290
|
+
}
|
|
291
|
+
return result;
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
//# sourceMappingURL=compilerOptions.js.map
|
package/lib/plugins/vue-tsx.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Sfc, VueLanguagePlugin } from '../types';
|
|
2
2
|
export declare const tsCodegen: WeakMap<Sfc, {
|
|
3
3
|
getLang: () => string;
|
|
4
4
|
getScriptRanges: () => {
|
|
@@ -118,7 +118,7 @@ export declare const tsCodegen: WeakMap<Sfc, {
|
|
|
118
118
|
} | undefined;
|
|
119
119
|
getSetupSlotsAssignName: () => string | undefined;
|
|
120
120
|
getGeneratedScript: () => {
|
|
121
|
-
codes: Code[];
|
|
121
|
+
codes: import("../types").Code[];
|
|
122
122
|
generatedTemplate: boolean;
|
|
123
123
|
generatedPropsType: boolean;
|
|
124
124
|
bypassDefineComponent: boolean;
|
|
@@ -137,7 +137,7 @@ export declare const tsCodegen: WeakMap<Sfc, {
|
|
|
137
137
|
inlayHints: import("../codegen/inlayHints").InlayHintInfo[];
|
|
138
138
|
};
|
|
139
139
|
getGeneratedTemplate: () => {
|
|
140
|
-
codes: Code[];
|
|
140
|
+
codes: import("../types").Code[];
|
|
141
141
|
currentInfo: {
|
|
142
142
|
ignoreError?: boolean;
|
|
143
143
|
expectError?: {
|
|
@@ -194,9 +194,9 @@ export declare const tsCodegen: WeakMap<Sfc, {
|
|
|
194
194
|
getHoistVariable(originalVar: string): string;
|
|
195
195
|
generateHoistVariables(): Generator<string, void, unknown>;
|
|
196
196
|
generateConditionGuards(): Generator<string, void, unknown>;
|
|
197
|
-
generateAutoImportCompletion(): Generator<Code>;
|
|
197
|
+
generateAutoImportCompletion(): Generator<import("../types").Code>;
|
|
198
198
|
enter(node: import("@vue/compiler-dom").RootNode | import("@vue/compiler-dom").TemplateChildNode | import("@vue/compiler-dom").SimpleExpressionNode): boolean;
|
|
199
|
-
exit(): Generator<Code>;
|
|
199
|
+
exit(): Generator<import("../types").Code>;
|
|
200
200
|
} | undefined;
|
|
201
201
|
}>;
|
|
202
202
|
declare const plugin: VueLanguagePlugin;
|
package/lib/plugins/vue-tsx.js
CHANGED
|
@@ -6,11 +6,11 @@ const alien_signals_1 = require("alien-signals");
|
|
|
6
6
|
const path = require("path-browserify");
|
|
7
7
|
const script_1 = require("../codegen/script");
|
|
8
8
|
const template_1 = require("../codegen/template");
|
|
9
|
+
const compilerOptions_1 = require("../compilerOptions");
|
|
9
10
|
const scriptRanges_1 = require("../parsers/scriptRanges");
|
|
10
11
|
const scriptSetupRanges_1 = require("../parsers/scriptSetupRanges");
|
|
11
12
|
const vueCompilerOptions_1 = require("../parsers/vueCompilerOptions");
|
|
12
13
|
const signals_1 = require("../utils/signals");
|
|
13
|
-
const ts_1 = require("../utils/ts");
|
|
14
14
|
exports.tsCodegen = new WeakMap();
|
|
15
15
|
const validLangs = new Set(['js', 'jsx', 'ts', 'tsx']);
|
|
16
16
|
const plugin = ctx => {
|
|
@@ -68,7 +68,7 @@ function createTsx(fileName, sfc, ctx) {
|
|
|
68
68
|
const getResolvedOptions = (0, alien_signals_1.computed)(() => {
|
|
69
69
|
const options = (0, vueCompilerOptions_1.parseVueCompilerOptions)(sfc.comments);
|
|
70
70
|
if (options) {
|
|
71
|
-
const resolver = new
|
|
71
|
+
const resolver = new compilerOptions_1.CompilerOptionsResolver();
|
|
72
72
|
resolver.addConfig(options, path.dirname(fileName));
|
|
73
73
|
return resolver.build(ctx.vueCompilerOptions);
|
|
74
74
|
}
|
|
@@ -144,7 +144,7 @@ function createTsx(fileName, sfc, ctx) {
|
|
|
144
144
|
if (getResolvedOptions().skipTemplateCodegen || !sfc.template) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
|
|
147
|
+
return (0, template_1.generateTemplate)({
|
|
148
148
|
ts,
|
|
149
149
|
compilerOptions: ctx.compilerOptions,
|
|
150
150
|
vueCompilerOptions: getResolvedOptions(),
|
|
@@ -158,23 +158,10 @@ function createTsx(fileName, sfc, ctx) {
|
|
|
158
158
|
propsAssignName: getSetupPropsAssignName(),
|
|
159
159
|
inheritAttrs: getSetupInheritAttrs(),
|
|
160
160
|
selfComponentName: getComponentSelfName(),
|
|
161
|
-
};
|
|
162
|
-
const context = (0, template_1.createTemplateCodegenContext)(options, sfc.template.ast);
|
|
163
|
-
const codegen = (0, template_1.generateTemplate)(options, context);
|
|
164
|
-
const codes = [];
|
|
165
|
-
for (const code of codegen) {
|
|
166
|
-
if (typeof code === 'object') {
|
|
167
|
-
code[3] = context.resolveCodeFeatures(code[3]);
|
|
168
|
-
}
|
|
169
|
-
codes.push(code);
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
...context,
|
|
173
|
-
codes,
|
|
174
|
-
};
|
|
161
|
+
});
|
|
175
162
|
});
|
|
176
163
|
const getGeneratedScript = (0, alien_signals_1.computed)(() => {
|
|
177
|
-
|
|
164
|
+
return (0, script_1.generateScript)({
|
|
178
165
|
ts,
|
|
179
166
|
compilerOptions: ctx.compilerOptions,
|
|
180
167
|
vueCompilerOptions: getResolvedOptions(),
|
|
@@ -186,13 +173,7 @@ function createTsx(fileName, sfc, ctx) {
|
|
|
186
173
|
templateCodegen: getGeneratedTemplate(),
|
|
187
174
|
destructuredPropNames: getSetupDestructuredPropNames(),
|
|
188
175
|
templateRefNames: getSetupTemplateRefNames(),
|
|
189
|
-
};
|
|
190
|
-
const context = (0, script_1.createScriptCodegenContext)(options);
|
|
191
|
-
const codegen = (0, script_1.generateScript)(options, context);
|
|
192
|
-
return {
|
|
193
|
-
...context,
|
|
194
|
-
codes: [...codegen],
|
|
195
|
-
};
|
|
176
|
+
});
|
|
196
177
|
});
|
|
197
178
|
return {
|
|
198
179
|
getLang,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue/language-core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7-alpha.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"optional": true
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "320fc626c871e9ff17c0e4e92ea7ddb0c7641f34"
|
|
41
41
|
}
|