@vue/language-core 2.0.13 → 2.0.15
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/common.d.ts +11 -0
- package/lib/codegen/common.js +70 -0
- package/lib/codegen/script/component.d.ts +9 -0
- package/lib/codegen/script/component.js +109 -0
- package/lib/codegen/script/context.d.ts +25 -0
- package/lib/codegen/script/context.js +124 -0
- package/lib/{generators → codegen/script}/globalTypes.d.ts +1 -1
- package/lib/codegen/script/globalTypes.js +135 -0
- package/lib/codegen/script/index.d.ts +33 -0
- package/lib/codegen/script/index.js +127 -0
- package/lib/codegen/script/internalComponent.d.ts +5 -0
- package/lib/codegen/script/internalComponent.js +58 -0
- package/lib/codegen/script/scriptSetup.d.ts +6 -0
- package/lib/codegen/script/scriptSetup.js +371 -0
- package/lib/codegen/script/src.d.ts +2 -0
- package/lib/codegen/script/src.js +52 -0
- package/lib/codegen/script/template.d.ts +5 -0
- package/lib/codegen/script/template.js +196 -0
- package/lib/codegen/template/camelized.d.ts +2 -0
- package/lib/codegen/template/camelized.js +32 -0
- package/lib/codegen/template/context.d.ts +44 -0
- package/lib/codegen/template/context.js +170 -0
- package/lib/codegen/template/element.d.ts +8 -0
- package/lib/codegen/template/element.js +378 -0
- package/lib/codegen/template/elementChildren.d.ts +5 -0
- package/lib/codegen/template/elementChildren.js +26 -0
- package/lib/codegen/template/elementDirectives.d.ts +5 -0
- package/lib/codegen/template/elementDirectives.js +46 -0
- package/lib/codegen/template/elementEvents.d.ts +9 -0
- package/lib/codegen/template/elementEvents.js +157 -0
- package/lib/codegen/template/elementProps.d.ts +5 -0
- package/lib/codegen/template/elementProps.js +275 -0
- package/lib/codegen/template/index.d.ts +60 -0
- package/lib/codegen/template/index.js +130 -0
- package/lib/codegen/template/interpolation.d.ts +6 -0
- package/lib/{utils/transform.js → codegen/template/interpolation.js} +76 -46
- package/lib/codegen/template/objectProperty.d.ts +4 -0
- package/lib/codegen/template/objectProperty.js +31 -0
- package/lib/codegen/template/propertyAccess.d.ts +4 -0
- package/lib/codegen/template/propertyAccess.js +24 -0
- package/lib/codegen/template/slotOutlet.d.ts +5 -0
- package/lib/codegen/template/slotOutlet.js +72 -0
- package/lib/codegen/template/stringLiteralKey.d.ts +2 -0
- package/lib/codegen/template/stringLiteralKey.js +14 -0
- package/lib/codegen/template/templateChild.d.ts +7 -0
- package/lib/codegen/template/templateChild.js +160 -0
- package/lib/codegen/template/vFor.d.ts +12 -0
- package/lib/codegen/template/vFor.js +69 -0
- package/lib/codegen/template/vIf.d.ts +5 -0
- package/lib/codegen/template/vIf.js +53 -0
- package/lib/languageModule.d.ts +3 -4
- package/lib/languageModule.js +31 -14
- package/lib/parsers/scriptSetupRanges.d.ts +1 -0
- package/lib/parsers/scriptSetupRanges.js +6 -1
- package/lib/plugins/file-html.js +63 -66
- package/lib/plugins/file-md.js +47 -50
- package/lib/plugins/shared.d.ts +2 -0
- package/lib/plugins/shared.js +12 -0
- package/lib/plugins/vue-sfc-customblocks.js +2 -2
- package/lib/plugins/vue-sfc-scripts.js +2 -3
- package/lib/plugins/vue-sfc-styles.js +3 -3
- package/lib/plugins/vue-sfc-template.js +2 -2
- package/lib/plugins/vue-template-inline-css.js +34 -2
- package/lib/plugins/vue-template-inline-ts.js +10 -8
- package/lib/plugins/vue-tsx.d.ts +43 -5
- package/lib/plugins/vue-tsx.js +38 -28
- package/lib/plugins.d.ts +2 -1
- package/lib/plugins.js +18 -9
- package/lib/types.d.ts +3 -3
- package/lib/utils/ts.js +20 -32
- package/lib/virtualFile/computedFiles.d.ts +2 -1
- package/lib/virtualFile/computedFiles.js +41 -15
- package/lib/virtualFile/computedMappings.js +3 -3
- package/lib/virtualFile/computedSfc.js +22 -1
- package/lib/virtualFile/embeddedFile.d.ts +2 -3
- package/lib/virtualFile/embeddedFile.js +1 -2
- package/lib/virtualFile/vueFile.d.ts +3 -5
- package/lib/virtualFile/vueFile.js +6 -8
- package/package.json +3 -3
- package/lib/generators/globalTypes.js +0 -135
- package/lib/generators/inlineCss.d.ts +0 -3
- package/lib/generators/inlineCss.js +0 -37
- package/lib/generators/script.d.ts +0 -13
- package/lib/generators/script.js +0 -981
- package/lib/generators/template.d.ts +0 -19
- package/lib/generators/template.js +0 -1578
- package/lib/generators/utils.d.ts +0 -5
- package/lib/generators/utils.js +0 -54
- package/lib/utils/transform.d.ts +0 -8
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateScript = exports.codeFeatures = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const context_1 = require("./context");
|
|
6
|
+
const globalTypes_1 = require("./globalTypes");
|
|
7
|
+
const scriptSetup_1 = require("./scriptSetup");
|
|
8
|
+
const src_1 = require("./src");
|
|
9
|
+
const template_1 = require("./template");
|
|
10
|
+
exports.codeFeatures = {
|
|
11
|
+
all: {
|
|
12
|
+
verification: true,
|
|
13
|
+
completion: true,
|
|
14
|
+
semantic: true,
|
|
15
|
+
navigation: true,
|
|
16
|
+
},
|
|
17
|
+
none: {},
|
|
18
|
+
verification: {
|
|
19
|
+
verification: true,
|
|
20
|
+
},
|
|
21
|
+
navigation: {
|
|
22
|
+
navigation: true,
|
|
23
|
+
},
|
|
24
|
+
referencesCodeLens: {
|
|
25
|
+
navigation: true,
|
|
26
|
+
__referencesCodeLens: true,
|
|
27
|
+
},
|
|
28
|
+
cssClassNavigation: {
|
|
29
|
+
navigation: {
|
|
30
|
+
resolveRenameNewName: normalizeCssRename,
|
|
31
|
+
resolveRenameEditText: applyCssRename,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
function* generateScript(options) {
|
|
36
|
+
const ctx = (0, context_1.createScriptCodegenContext)(options);
|
|
37
|
+
yield `/* __placeholder__ */${common_1.newLine}`;
|
|
38
|
+
if (options.sfc.script?.src) {
|
|
39
|
+
yield* (0, src_1.generateSrc)(options.sfc.script, options.sfc.script.src);
|
|
40
|
+
}
|
|
41
|
+
if (options.sfc.script && options.scriptRanges) {
|
|
42
|
+
const { exportDefault } = options.scriptRanges;
|
|
43
|
+
const isExportRawObject = exportDefault
|
|
44
|
+
&& options.sfc.script.content[exportDefault.expression.start] === '{';
|
|
45
|
+
if (options.sfc.scriptSetup && options.scriptSetupRanges) {
|
|
46
|
+
yield (0, scriptSetup_1.generateScriptSetupImports)(options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
47
|
+
if (exportDefault) {
|
|
48
|
+
yield (0, common_1.generateSfcBlockSection)(options.sfc.script, 0, exportDefault.expression.start, exports.codeFeatures.all);
|
|
49
|
+
yield* (0, scriptSetup_1.generateScriptSetup)(options, ctx, options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
50
|
+
yield (0, common_1.generateSfcBlockSection)(options.sfc.script, exportDefault.expression.end, options.sfc.script.content.length, exports.codeFeatures.all);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
yield (0, common_1.generateSfcBlockSection)(options.sfc.script, 0, options.sfc.script.content.length, exports.codeFeatures.all);
|
|
54
|
+
yield* (0, scriptSetup_1.generateScriptSetup)(options, ctx, options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (exportDefault && isExportRawObject && options.vueCompilerOptions.optionsWrapper.length) {
|
|
58
|
+
yield (0, common_1.generateSfcBlockSection)(options.sfc.script, 0, exportDefault.expression.start, exports.codeFeatures.all);
|
|
59
|
+
yield options.vueCompilerOptions.optionsWrapper[0];
|
|
60
|
+
yield [
|
|
61
|
+
'',
|
|
62
|
+
'script',
|
|
63
|
+
exportDefault.expression.start,
|
|
64
|
+
{
|
|
65
|
+
__hint: {
|
|
66
|
+
setting: 'vue.inlayHints.optionsWrapper',
|
|
67
|
+
label: options.vueCompilerOptions.optionsWrapper.length
|
|
68
|
+
? options.vueCompilerOptions.optionsWrapper[0]
|
|
69
|
+
: '[Missing optionsWrapper]',
|
|
70
|
+
tooltip: [
|
|
71
|
+
'This is virtual code that is automatically wrapped for type support, it does not affect your runtime behavior, you can customize it via `vueCompilerOptions.optionsWrapper` option in tsconfig / jsconfig.',
|
|
72
|
+
'To hide it, you can set `"vue.inlayHints.optionsWrapper": false` in IDE settings.',
|
|
73
|
+
].join('\n\n'),
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
yield (0, common_1.generateSfcBlockSection)(options.sfc.script, exportDefault.expression.start, exportDefault.expression.end, exports.codeFeatures.all);
|
|
78
|
+
yield [
|
|
79
|
+
'',
|
|
80
|
+
'script',
|
|
81
|
+
exportDefault.expression.end,
|
|
82
|
+
{
|
|
83
|
+
__hint: {
|
|
84
|
+
setting: 'vue.inlayHints.optionsWrapper',
|
|
85
|
+
label: options.vueCompilerOptions.optionsWrapper.length === 2
|
|
86
|
+
? options.vueCompilerOptions.optionsWrapper[1]
|
|
87
|
+
: '[Missing optionsWrapper]',
|
|
88
|
+
tooltip: '',
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
yield options.vueCompilerOptions.optionsWrapper[1];
|
|
93
|
+
yield (0, common_1.generateSfcBlockSection)(options.sfc.script, exportDefault.expression.end, options.sfc.script.content.length, exports.codeFeatures.all);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
yield (0, common_1.generateSfcBlockSection)(options.sfc.script, 0, options.sfc.script.content.length, exports.codeFeatures.all);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else if (options.sfc.scriptSetup && options.scriptSetupRanges) {
|
|
100
|
+
yield (0, scriptSetup_1.generateScriptSetupImports)(options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
101
|
+
yield* (0, scriptSetup_1.generateScriptSetup)(options, ctx, options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
102
|
+
}
|
|
103
|
+
if (options.globalTypes) {
|
|
104
|
+
yield (0, globalTypes_1.generateGlobalTypes)(options.vueCompilerOptions);
|
|
105
|
+
}
|
|
106
|
+
yield* ctx.generateHelperTypes();
|
|
107
|
+
yield `\ntype __VLS_IntrinsicElementsCompletion = __VLS_IntrinsicElements${common_1.endOfLine}`;
|
|
108
|
+
if (!ctx.generatedTemplate) {
|
|
109
|
+
yield* (0, template_1.generateTemplate)(options, ctx);
|
|
110
|
+
}
|
|
111
|
+
if (options.sfc.scriptSetup) {
|
|
112
|
+
yield [
|
|
113
|
+
'',
|
|
114
|
+
'scriptSetup',
|
|
115
|
+
options.sfc.scriptSetup.content.length,
|
|
116
|
+
exports.codeFeatures.verification,
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.generateScript = generateScript;
|
|
121
|
+
function normalizeCssRename(newName) {
|
|
122
|
+
return newName.startsWith('.') ? newName.slice(1) : newName;
|
|
123
|
+
}
|
|
124
|
+
function applyCssRename(newName) {
|
|
125
|
+
return '.' + newName;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Code } from '../../types';
|
|
2
|
+
import type { TemplateCodegenContext } from '../template/context';
|
|
3
|
+
import type { ScriptCodegenContext } from './context';
|
|
4
|
+
import type { ScriptCodegenOptions } from './index';
|
|
5
|
+
export declare function generateInternalComponent(options: ScriptCodegenOptions, ctx: ScriptCodegenContext, templateCodegenCtx: TemplateCodegenContext): Generator<Code>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateInternalComponent = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const component_1 = require("./component");
|
|
6
|
+
const template_1 = require("./template");
|
|
7
|
+
function* generateInternalComponent(options, ctx, templateCodegenCtx) {
|
|
8
|
+
if (options.sfc.scriptSetup && options.scriptSetupRanges) {
|
|
9
|
+
yield `const __VLS_internalComponent = (await import('${options.vueCompilerOptions.lib}')).defineComponent({${common_1.newLine}`;
|
|
10
|
+
yield `setup() {${common_1.newLine}`;
|
|
11
|
+
yield `return {${common_1.newLine}`;
|
|
12
|
+
if (ctx.bypassDefineComponent) {
|
|
13
|
+
yield* (0, component_1.generateComponentSetupReturns)(options.scriptSetupRanges);
|
|
14
|
+
}
|
|
15
|
+
// bindings
|
|
16
|
+
const templateUsageVars = (0, template_1.getTemplateUsageVars)(options, ctx);
|
|
17
|
+
for (const [content, bindings] of [
|
|
18
|
+
[options.sfc.scriptSetup.content, options.scriptSetupRanges.bindings],
|
|
19
|
+
options.sfc.script && options.scriptRanges
|
|
20
|
+
? [options.sfc.script.content, options.scriptRanges.bindings]
|
|
21
|
+
: ['', []],
|
|
22
|
+
]) {
|
|
23
|
+
for (const expose of bindings) {
|
|
24
|
+
const varName = content.substring(expose.start, expose.end);
|
|
25
|
+
if (!templateUsageVars.has(varName) && !templateCodegenCtx.accessGlobalVariables.has(varName)) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const templateOffset = options.getGeneratedLength();
|
|
29
|
+
yield `${varName}: ${varName} as typeof `;
|
|
30
|
+
const scriptOffset = options.getGeneratedLength();
|
|
31
|
+
yield `${varName},${common_1.newLine}`;
|
|
32
|
+
options.linkedCodeMappings.push({
|
|
33
|
+
sourceOffsets: [scriptOffset],
|
|
34
|
+
generatedOffsets: [templateOffset],
|
|
35
|
+
lengths: [varName.length],
|
|
36
|
+
data: undefined,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
yield `}${common_1.endOfLine}`; // return {
|
|
41
|
+
yield `},${common_1.newLine}`; // setup() {
|
|
42
|
+
if (options.sfc.scriptSetup && options.scriptSetupRanges && !ctx.bypassDefineComponent) {
|
|
43
|
+
yield* (0, component_1.generateScriptSetupOptions)(options, ctx, options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
44
|
+
}
|
|
45
|
+
if (options.sfc.script && options.scriptRanges) {
|
|
46
|
+
yield* (0, component_1.generateScriptOptions)(options.sfc.script, options.scriptRanges);
|
|
47
|
+
}
|
|
48
|
+
yield `})${common_1.endOfLine}`; // defineComponent {
|
|
49
|
+
}
|
|
50
|
+
else if (options.sfc.script) {
|
|
51
|
+
yield `const __VLS_internalComponent = (await import('./${options.fileBaseName}')).default${common_1.endOfLine}`;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
yield `const __VLS_internalComponent = (await import('${options.vueCompilerOptions.lib}')).defineComponent({})${common_1.endOfLine}`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.generateInternalComponent = generateInternalComponent;
|
|
58
|
+
//# sourceMappingURL=internalComponent.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ScriptSetupRanges } from '../../parsers/scriptSetupRanges';
|
|
2
|
+
import type { Code, Sfc } from '../../types';
|
|
3
|
+
import type { ScriptCodegenContext } from './context';
|
|
4
|
+
import { ScriptCodegenOptions } from './index';
|
|
5
|
+
export declare function generateScriptSetupImports(scriptSetup: NonNullable<Sfc['scriptSetup']>, scriptSetupRanges: ScriptSetupRanges): Code;
|
|
6
|
+
export declare function generateScriptSetup(options: ScriptCodegenOptions, ctx: ScriptCodegenContext, scriptSetup: NonNullable<Sfc['scriptSetup']>, scriptSetupRanges: ScriptSetupRanges): Generator<Code>;
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateScriptSetup = exports.generateScriptSetupImports = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const component_1 = require("./component");
|
|
6
|
+
const index_1 = require("./index");
|
|
7
|
+
const template_1 = require("./template");
|
|
8
|
+
function generateScriptSetupImports(scriptSetup, scriptSetupRanges) {
|
|
9
|
+
return [
|
|
10
|
+
scriptSetup.content.substring(0, Math.max(scriptSetupRanges.importSectionEndOffset, scriptSetupRanges.leadingCommentEndOffset)) + common_1.newLine,
|
|
11
|
+
'scriptSetup',
|
|
12
|
+
0,
|
|
13
|
+
index_1.codeFeatures.all,
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
exports.generateScriptSetupImports = generateScriptSetupImports;
|
|
17
|
+
function* generateScriptSetup(options, ctx, scriptSetup, scriptSetupRanges) {
|
|
18
|
+
const definePropMirrors = new Map();
|
|
19
|
+
if (scriptSetup.generic) {
|
|
20
|
+
if (!options.scriptRanges?.exportDefault) {
|
|
21
|
+
yield `export default `;
|
|
22
|
+
}
|
|
23
|
+
yield `(<`;
|
|
24
|
+
yield [
|
|
25
|
+
scriptSetup.generic,
|
|
26
|
+
scriptSetup.name,
|
|
27
|
+
scriptSetup.genericOffset,
|
|
28
|
+
index_1.codeFeatures.all,
|
|
29
|
+
];
|
|
30
|
+
if (!scriptSetup.generic.endsWith(`,`)) {
|
|
31
|
+
yield `,`;
|
|
32
|
+
}
|
|
33
|
+
yield `>(${common_1.newLine}`
|
|
34
|
+
+ ` __VLS_props: Awaited<typeof __VLS_setup>['props'],${common_1.newLine}`
|
|
35
|
+
+ ` __VLS_ctx?: ${ctx.helperTypes.Prettify.name}<Pick<Awaited<typeof __VLS_setup>, 'attrs' | 'emit' | 'slots'>>,${common_1.newLine}` // use __VLS_Prettify for less dts code
|
|
36
|
+
+ ` __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>['expose'],${common_1.newLine}`
|
|
37
|
+
+ ` __VLS_setup = (async () => {${common_1.newLine}`;
|
|
38
|
+
yield* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, undefined, definePropMirrors);
|
|
39
|
+
yield ` return {} as {${common_1.newLine}`
|
|
40
|
+
+ ` props: ${ctx.helperTypes.Prettify.name}<typeof __VLS_functionalComponentProps & __VLS_PublicProps> & __VLS_BuiltInPublicProps,${common_1.newLine}`
|
|
41
|
+
+ ` expose(exposed: import('${options.vueCompilerOptions.lib}').ShallowUnwrapRef<${scriptSetupRanges.expose.define ? 'typeof __VLS_exposed' : '{}'}>): void,${common_1.newLine}`
|
|
42
|
+
+ ` attrs: any,${common_1.newLine}`
|
|
43
|
+
+ ` slots: ReturnType<typeof __VLS_template>,${common_1.newLine}`
|
|
44
|
+
+ ` emit: typeof ${scriptSetupRanges.emits.name ?? '__VLS_emit'} & typeof __VLS_modelEmitsType,${common_1.newLine}`
|
|
45
|
+
+ ` }${common_1.endOfLine}`;
|
|
46
|
+
yield ` })(),${common_1.newLine}`; // __VLS_setup = (async () => {
|
|
47
|
+
yield `) => ({} as import('${options.vueCompilerOptions.lib}').VNode & { __ctx?: Awaited<typeof __VLS_setup> }))`;
|
|
48
|
+
}
|
|
49
|
+
else if (!options.sfc.script) {
|
|
50
|
+
// no script block, generate script setup code at root
|
|
51
|
+
yield* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, 'export default', definePropMirrors);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
if (!options.scriptRanges?.exportDefault) {
|
|
55
|
+
yield `export default `;
|
|
56
|
+
}
|
|
57
|
+
yield `await (async () => {${common_1.newLine}`;
|
|
58
|
+
yield* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, 'return', definePropMirrors);
|
|
59
|
+
yield `})()`;
|
|
60
|
+
}
|
|
61
|
+
if (ctx.scriptSetupGeneratedOffset !== undefined) {
|
|
62
|
+
for (const defineProp of scriptSetupRanges.defineProp) {
|
|
63
|
+
if (!defineProp.name) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const propName = scriptSetup.content.substring(defineProp.name.start, defineProp.name.end);
|
|
67
|
+
const propMirror = definePropMirrors.get(propName);
|
|
68
|
+
if (propMirror !== undefined) {
|
|
69
|
+
options.linkedCodeMappings.push({
|
|
70
|
+
sourceOffsets: [defineProp.name.start + ctx.scriptSetupGeneratedOffset],
|
|
71
|
+
generatedOffsets: [propMirror],
|
|
72
|
+
lengths: [defineProp.name.end - defineProp.name.start],
|
|
73
|
+
data: undefined,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.generateScriptSetup = generateScriptSetup;
|
|
80
|
+
function* generateSetupFunction(options, ctx, scriptSetup, scriptSetupRanges, syntax, definePropMirrors) {
|
|
81
|
+
const definePropProposalA = scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=kevinEdition') || options.vueCompilerOptions.experimentalDefinePropProposal === 'kevinEdition';
|
|
82
|
+
const definePropProposalB = scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=johnsonEdition') || options.vueCompilerOptions.experimentalDefinePropProposal === 'johnsonEdition';
|
|
83
|
+
if (options.vueCompilerOptions.target >= 3.3) {
|
|
84
|
+
yield `const { `;
|
|
85
|
+
for (const macro of Object.keys(options.vueCompilerOptions.macros)) {
|
|
86
|
+
if (!ctx.bindingNames.has(macro)) {
|
|
87
|
+
yield macro + `, `;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
yield `} = await import('${options.vueCompilerOptions.lib}')${common_1.endOfLine}`;
|
|
91
|
+
}
|
|
92
|
+
if (definePropProposalA) {
|
|
93
|
+
yield `declare function defineProp<T>(name: string, options: { required: true } & Record<string, unknown>): import('${options.vueCompilerOptions.lib}').ComputedRef<T>${common_1.endOfLine}`;
|
|
94
|
+
yield `declare function defineProp<T>(name: string, options: { default: any } & Record<string, unknown>): import('${options.vueCompilerOptions.lib}').ComputedRef<T>${common_1.endOfLine}`;
|
|
95
|
+
yield `declare function defineProp<T>(name?: string, options?: any): import('${options.vueCompilerOptions.lib}').ComputedRef<T | undefined>${common_1.endOfLine}`;
|
|
96
|
+
}
|
|
97
|
+
if (definePropProposalB) {
|
|
98
|
+
yield `declare function defineProp<T>(value: T | (() => T), required?: boolean, rest?: any): import('${options.vueCompilerOptions.lib}').ComputedRef<T>${common_1.endOfLine}`;
|
|
99
|
+
yield `declare function defineProp<T>(value: T | (() => T) | undefined, required: true, rest?: any): import('${options.vueCompilerOptions.lib}').ComputedRef<T>${common_1.endOfLine}`;
|
|
100
|
+
yield `declare function defineProp<T>(value?: T | (() => T), required?: boolean, rest?: any): import('${options.vueCompilerOptions.lib}').ComputedRef<T | undefined>${common_1.endOfLine}`;
|
|
101
|
+
}
|
|
102
|
+
ctx.scriptSetupGeneratedOffset = options.getGeneratedLength() - scriptSetupRanges.importSectionEndOffset;
|
|
103
|
+
let setupCodeModifies = [];
|
|
104
|
+
const propsRange = scriptSetupRanges.props.withDefaults ?? scriptSetupRanges.props.define;
|
|
105
|
+
if (propsRange && scriptSetupRanges.props.define) {
|
|
106
|
+
const statement = scriptSetupRanges.props.define.statement;
|
|
107
|
+
if (scriptSetupRanges.props.define.typeArg) {
|
|
108
|
+
setupCodeModifies.push([[
|
|
109
|
+
`let __VLS_typeProps!: `,
|
|
110
|
+
(0, common_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.props.define.typeArg.start, scriptSetupRanges.props.define.typeArg.end, index_1.codeFeatures.all),
|
|
111
|
+
common_1.endOfLine,
|
|
112
|
+
], statement.start, statement.start]);
|
|
113
|
+
setupCodeModifies.push([[`typeof __VLS_typeProps`], scriptSetupRanges.props.define.typeArg.start, scriptSetupRanges.props.define.typeArg.end]);
|
|
114
|
+
}
|
|
115
|
+
if (!scriptSetupRanges.props.name) {
|
|
116
|
+
if (statement.start === propsRange.start && statement.end === propsRange.end) {
|
|
117
|
+
setupCodeModifies.push([[`const __VLS_props = `], propsRange.start, propsRange.start]);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
if (scriptSetupRanges.props.define.typeArg) {
|
|
121
|
+
setupCodeModifies.push([[
|
|
122
|
+
`const __VLS_props = `,
|
|
123
|
+
(0, common_1.generateSfcBlockSection)(scriptSetup, propsRange.start, scriptSetupRanges.props.define.typeArg.start, index_1.codeFeatures.all),
|
|
124
|
+
], statement.start, scriptSetupRanges.props.define.typeArg.start]);
|
|
125
|
+
setupCodeModifies.push([[
|
|
126
|
+
(0, common_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.props.define.typeArg.end, propsRange.end, index_1.codeFeatures.all),
|
|
127
|
+
`${common_1.endOfLine}`,
|
|
128
|
+
(0, common_1.generateSfcBlockSection)(scriptSetup, statement.start, propsRange.start, index_1.codeFeatures.all),
|
|
129
|
+
`__VLS_props`,
|
|
130
|
+
], scriptSetupRanges.props.define.typeArg.end, propsRange.end]);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
setupCodeModifies.push([[
|
|
134
|
+
`const __VLS_props = `,
|
|
135
|
+
(0, common_1.generateSfcBlockSection)(scriptSetup, propsRange.start, propsRange.end, index_1.codeFeatures.all),
|
|
136
|
+
`${common_1.endOfLine}`,
|
|
137
|
+
(0, common_1.generateSfcBlockSection)(scriptSetup, statement.start, propsRange.start, index_1.codeFeatures.all),
|
|
138
|
+
`__VLS_props`,
|
|
139
|
+
], statement.start, propsRange.end]);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (scriptSetupRanges.slots.define) {
|
|
145
|
+
if (!scriptSetupRanges.slots.name) {
|
|
146
|
+
setupCodeModifies.push([[`const __VLS_slots = `], scriptSetupRanges.slots.define.start, scriptSetupRanges.slots.define.start]);
|
|
147
|
+
}
|
|
148
|
+
else if (scriptSetupRanges.slots.isObjectBindingPattern) {
|
|
149
|
+
setupCodeModifies.push([
|
|
150
|
+
[`__VLS_slots;\nconst __VLS_slots = `],
|
|
151
|
+
scriptSetupRanges.slots.define.start,
|
|
152
|
+
scriptSetupRanges.slots.define.start,
|
|
153
|
+
]);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (scriptSetupRanges.emits.define && !scriptSetupRanges.emits.name) {
|
|
157
|
+
setupCodeModifies.push([[`const __VLS_emit = `], scriptSetupRanges.emits.define.start, scriptSetupRanges.emits.define.start]);
|
|
158
|
+
}
|
|
159
|
+
if (scriptSetupRanges.expose.define) {
|
|
160
|
+
if (scriptSetupRanges.expose.define?.typeArg) {
|
|
161
|
+
setupCodeModifies.push([
|
|
162
|
+
[
|
|
163
|
+
`let __VLS_exposed!: `,
|
|
164
|
+
(0, common_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.expose.define.typeArg.start, scriptSetupRanges.expose.define.typeArg.end, index_1.codeFeatures.navigation),
|
|
165
|
+
`${common_1.endOfLine}`,
|
|
166
|
+
],
|
|
167
|
+
scriptSetupRanges.expose.define.start,
|
|
168
|
+
scriptSetupRanges.expose.define.start,
|
|
169
|
+
]);
|
|
170
|
+
}
|
|
171
|
+
else if (scriptSetupRanges.expose.define?.arg) {
|
|
172
|
+
setupCodeModifies.push([
|
|
173
|
+
[
|
|
174
|
+
`const __VLS_exposed = `,
|
|
175
|
+
(0, common_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.expose.define.arg.start, scriptSetupRanges.expose.define.arg.end, index_1.codeFeatures.navigation),
|
|
176
|
+
`${common_1.endOfLine}`,
|
|
177
|
+
],
|
|
178
|
+
scriptSetupRanges.expose.define.start,
|
|
179
|
+
scriptSetupRanges.expose.define.start,
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
setupCodeModifies.push([
|
|
184
|
+
[`const __VLS_exposed = {}${common_1.endOfLine}`],
|
|
185
|
+
scriptSetupRanges.expose.define.start,
|
|
186
|
+
scriptSetupRanges.expose.define.start,
|
|
187
|
+
]);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
setupCodeModifies = setupCodeModifies.sort((a, b) => a[1] - b[1]);
|
|
191
|
+
if (setupCodeModifies.length) {
|
|
192
|
+
yield (0, common_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.importSectionEndOffset, setupCodeModifies[0][1], index_1.codeFeatures.all);
|
|
193
|
+
while (setupCodeModifies.length) {
|
|
194
|
+
const [codes, _start, end] = setupCodeModifies.shift();
|
|
195
|
+
for (const code of codes) {
|
|
196
|
+
yield code;
|
|
197
|
+
}
|
|
198
|
+
if (setupCodeModifies.length) {
|
|
199
|
+
const nextStart = setupCodeModifies[0][1];
|
|
200
|
+
yield (0, common_1.generateSfcBlockSection)(scriptSetup, end, nextStart, index_1.codeFeatures.all);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
yield (0, common_1.generateSfcBlockSection)(scriptSetup, end, scriptSetup.content.length, index_1.codeFeatures.all);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
yield (0, common_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.importSectionEndOffset, scriptSetup.content.length, index_1.codeFeatures.all);
|
|
209
|
+
}
|
|
210
|
+
if (scriptSetupRanges.props.define?.typeArg && scriptSetupRanges.props.withDefaults?.arg) {
|
|
211
|
+
// fix https://github.com/vuejs/language-tools/issues/1187
|
|
212
|
+
yield `const __VLS_withDefaultsArg = (function <T>(t: T) { return t })(`;
|
|
213
|
+
yield (0, common_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.props.withDefaults.arg.start, scriptSetupRanges.props.withDefaults.arg.end, index_1.codeFeatures.navigation);
|
|
214
|
+
yield `)${common_1.endOfLine}`;
|
|
215
|
+
}
|
|
216
|
+
yield* generateComponentProps(options, ctx, scriptSetup, scriptSetupRanges, definePropMirrors);
|
|
217
|
+
yield* generateModelEmits(options, scriptSetup, scriptSetupRanges);
|
|
218
|
+
yield* (0, template_1.generateTemplate)(options, ctx);
|
|
219
|
+
if (syntax) {
|
|
220
|
+
if (!options.vueCompilerOptions.skipTemplateCodegen && (options.templateCodegen?.hasSlot || scriptSetupRanges?.slots.define)) {
|
|
221
|
+
yield `const __VLS_component = `;
|
|
222
|
+
yield* (0, component_1.generateComponent)(options, ctx, scriptSetup, scriptSetupRanges);
|
|
223
|
+
yield common_1.endOfLine;
|
|
224
|
+
yield `${syntax} `;
|
|
225
|
+
yield `{} as ${ctx.helperTypes.WithTemplateSlots.name}<typeof __VLS_component, ReturnType<typeof __VLS_template>>${common_1.endOfLine}`;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
yield `${syntax} `;
|
|
229
|
+
yield* (0, component_1.generateComponent)(options, ctx, scriptSetup, scriptSetupRanges);
|
|
230
|
+
yield common_1.endOfLine;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function* generateComponentProps(options, ctx, scriptSetup, scriptSetupRanges, definePropMirrors) {
|
|
235
|
+
if (scriptSetupRanges.props.define?.arg || scriptSetupRanges.emits.define) {
|
|
236
|
+
yield `const __VLS_fnComponent = `
|
|
237
|
+
+ `(await import('${options.vueCompilerOptions.lib}')).defineComponent({${common_1.newLine}`;
|
|
238
|
+
if (scriptSetupRanges.props.define?.arg) {
|
|
239
|
+
yield ` props: `;
|
|
240
|
+
yield (0, common_1.generateSfcBlockSection)(scriptSetup, scriptSetupRanges.props.define.arg.start, scriptSetupRanges.props.define.arg.end, index_1.codeFeatures.navigation);
|
|
241
|
+
yield `,${common_1.newLine}`;
|
|
242
|
+
}
|
|
243
|
+
if (scriptSetupRanges.emits.define) {
|
|
244
|
+
yield ` emits: ({} as __VLS_NormalizeEmits<typeof `;
|
|
245
|
+
yield scriptSetupRanges.emits.name ?? '__VLS_emit';
|
|
246
|
+
yield `>),${common_1.newLine}`;
|
|
247
|
+
}
|
|
248
|
+
yield `})${common_1.endOfLine}`;
|
|
249
|
+
yield `let __VLS_functionalComponentProps!: `;
|
|
250
|
+
yield `${ctx.helperTypes.OmitKeepDiscriminatedUnion.name}<InstanceType<typeof __VLS_fnComponent>['$props'], keyof __VLS_BuiltInPublicProps>`;
|
|
251
|
+
yield common_1.endOfLine;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
yield `let __VLS_functionalComponentProps!: {}${common_1.endOfLine}`;
|
|
255
|
+
}
|
|
256
|
+
yield `type __VLS_BuiltInPublicProps =${common_1.newLine}`
|
|
257
|
+
+ ` import('${options.vueCompilerOptions.lib}').VNodeProps${common_1.newLine}`
|
|
258
|
+
+ ` & import('${options.vueCompilerOptions.lib}').AllowedComponentProps${common_1.newLine}`
|
|
259
|
+
+ ` & import('${options.vueCompilerOptions.lib}').ComponentCustomProps${common_1.endOfLine}`;
|
|
260
|
+
if (scriptSetupRanges.defineProp.length) {
|
|
261
|
+
yield `const __VLS_defaults = {${common_1.newLine}`;
|
|
262
|
+
for (const defineProp of scriptSetupRanges.defineProp) {
|
|
263
|
+
if (defineProp.defaultValue) {
|
|
264
|
+
if (defineProp.name) {
|
|
265
|
+
yield scriptSetup.content.substring(defineProp.name.start, defineProp.name.end);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
yield `modelValue`;
|
|
269
|
+
}
|
|
270
|
+
yield `: `;
|
|
271
|
+
yield scriptSetup.content.substring(defineProp.defaultValue.start, defineProp.defaultValue.end);
|
|
272
|
+
yield `,${common_1.newLine}`;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
yield `}${common_1.endOfLine}`;
|
|
276
|
+
}
|
|
277
|
+
yield `type __VLS_PublicProps = `;
|
|
278
|
+
if (scriptSetupRanges.slots.define && options.vueCompilerOptions.jsxSlots) {
|
|
279
|
+
if (ctx.generatedPropsType) {
|
|
280
|
+
yield ` & `;
|
|
281
|
+
}
|
|
282
|
+
ctx.generatedPropsType = true;
|
|
283
|
+
yield `${ctx.helperTypes.PropsChildren.name}<typeof __VLS_slots>`;
|
|
284
|
+
}
|
|
285
|
+
if (scriptSetupRanges.defineProp.length) {
|
|
286
|
+
if (ctx.generatedPropsType) {
|
|
287
|
+
yield ` & `;
|
|
288
|
+
}
|
|
289
|
+
ctx.generatedPropsType = true;
|
|
290
|
+
yield `{${common_1.newLine}`;
|
|
291
|
+
for (const defineProp of scriptSetupRanges.defineProp) {
|
|
292
|
+
let propName = 'modelValue';
|
|
293
|
+
if (defineProp.name && defineProp.nameIsString) {
|
|
294
|
+
// renaming support
|
|
295
|
+
yield (0, common_1.generateSfcBlockSection)(scriptSetup, defineProp.name.start, defineProp.name.end, index_1.codeFeatures.navigation);
|
|
296
|
+
}
|
|
297
|
+
else if (defineProp.name) {
|
|
298
|
+
propName = scriptSetup.content.substring(defineProp.name.start, defineProp.name.end);
|
|
299
|
+
definePropMirrors.set(propName, options.getGeneratedLength());
|
|
300
|
+
yield propName;
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
yield propName;
|
|
304
|
+
}
|
|
305
|
+
yield defineProp.required
|
|
306
|
+
? `: `
|
|
307
|
+
: `?: `;
|
|
308
|
+
if (defineProp.type) {
|
|
309
|
+
yield scriptSetup.content.substring(defineProp.type.start, defineProp.type.end);
|
|
310
|
+
}
|
|
311
|
+
else if (!defineProp.nameIsString) {
|
|
312
|
+
yield `NonNullable<typeof ${propName}['value']>`;
|
|
313
|
+
}
|
|
314
|
+
else if (defineProp.defaultValue) {
|
|
315
|
+
yield `typeof __VLS_defaults['${propName}']`;
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
yield `any`;
|
|
319
|
+
}
|
|
320
|
+
yield `,${common_1.newLine}`;
|
|
321
|
+
if (defineProp.modifierType) {
|
|
322
|
+
let propModifierName = 'modelModifiers';
|
|
323
|
+
if (defineProp.name) {
|
|
324
|
+
propModifierName = `${scriptSetup.content.substring(defineProp.name.start + 1, defineProp.name.end - 1)}Modifiers`;
|
|
325
|
+
}
|
|
326
|
+
const modifierType = scriptSetup.content.substring(defineProp.modifierType.start, defineProp.modifierType.end);
|
|
327
|
+
definePropMirrors.set(propModifierName, options.getGeneratedLength());
|
|
328
|
+
yield `${propModifierName}?: Record<${modifierType}, true>,${common_1.endOfLine}`;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
yield `}`;
|
|
332
|
+
}
|
|
333
|
+
if (scriptSetupRanges.props.define?.typeArg) {
|
|
334
|
+
if (ctx.generatedPropsType) {
|
|
335
|
+
yield ` & `;
|
|
336
|
+
}
|
|
337
|
+
ctx.generatedPropsType = true;
|
|
338
|
+
yield `typeof __VLS_typeProps`;
|
|
339
|
+
}
|
|
340
|
+
if (!ctx.generatedPropsType) {
|
|
341
|
+
yield `{}`;
|
|
342
|
+
}
|
|
343
|
+
yield common_1.endOfLine;
|
|
344
|
+
}
|
|
345
|
+
function* generateModelEmits(options, scriptSetup, scriptSetupRanges) {
|
|
346
|
+
yield `let __VLS_modelEmitsType!: {}`;
|
|
347
|
+
if (scriptSetupRanges.defineProp.length) {
|
|
348
|
+
yield ` & ReturnType<typeof import('${options.vueCompilerOptions.lib}').defineEmits<{${common_1.newLine}`;
|
|
349
|
+
for (const defineProp of scriptSetupRanges.defineProp) {
|
|
350
|
+
if (!defineProp.isModel) {
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
let propName = 'modelValue';
|
|
354
|
+
if (defineProp.name) {
|
|
355
|
+
propName = scriptSetup.content.substring(defineProp.name.start, defineProp.name.end);
|
|
356
|
+
propName = propName.replace(/['"]+/g, '');
|
|
357
|
+
}
|
|
358
|
+
yield `'update:${propName}': [${propName}:`;
|
|
359
|
+
if (defineProp.type) {
|
|
360
|
+
yield scriptSetup.content.substring(defineProp.type.start, defineProp.type.end);
|
|
361
|
+
}
|
|
362
|
+
else {
|
|
363
|
+
yield `any`;
|
|
364
|
+
}
|
|
365
|
+
yield `]${common_1.endOfLine}`;
|
|
366
|
+
}
|
|
367
|
+
yield `}>>`;
|
|
368
|
+
}
|
|
369
|
+
yield common_1.endOfLine;
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=scriptSetup.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateSrc = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
function* generateSrc(script, src) {
|
|
7
|
+
if (src.endsWith('.d.ts')) {
|
|
8
|
+
src = src.substring(0, src.length - '.d.ts'.length);
|
|
9
|
+
}
|
|
10
|
+
else if (src.endsWith('.ts')) {
|
|
11
|
+
src = src.substring(0, src.length - '.ts'.length);
|
|
12
|
+
}
|
|
13
|
+
else if (src.endsWith('.tsx')) {
|
|
14
|
+
src = src.substring(0, src.length - '.tsx'.length) + '.jsx';
|
|
15
|
+
}
|
|
16
|
+
if (!src.endsWith('.js') && !src.endsWith('.jsx')) {
|
|
17
|
+
src = src + '.js';
|
|
18
|
+
}
|
|
19
|
+
yield `export * from `;
|
|
20
|
+
yield [
|
|
21
|
+
`'${src}'`,
|
|
22
|
+
'script',
|
|
23
|
+
script.srcOffset - 1,
|
|
24
|
+
{
|
|
25
|
+
...index_1.codeFeatures.all,
|
|
26
|
+
navigation: src === script.src
|
|
27
|
+
? true
|
|
28
|
+
: {
|
|
29
|
+
shouldRename: () => false,
|
|
30
|
+
resolveRenameEditText(newName) {
|
|
31
|
+
if (newName.endsWith('.jsx') || newName.endsWith('.js')) {
|
|
32
|
+
newName = newName.split('.').slice(0, -1).join('.');
|
|
33
|
+
}
|
|
34
|
+
if (script?.src?.endsWith('.d.ts')) {
|
|
35
|
+
newName = newName + '.d.ts';
|
|
36
|
+
}
|
|
37
|
+
else if (script?.src?.endsWith('.ts')) {
|
|
38
|
+
newName = newName + '.ts';
|
|
39
|
+
}
|
|
40
|
+
else if (script?.src?.endsWith('.tsx')) {
|
|
41
|
+
newName = newName + '.tsx';
|
|
42
|
+
}
|
|
43
|
+
return newName;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
];
|
|
48
|
+
yield common_1.endOfLine;
|
|
49
|
+
yield `export { default } from '${src}'${common_1.endOfLine}`;
|
|
50
|
+
}
|
|
51
|
+
exports.generateSrc = generateSrc;
|
|
52
|
+
//# sourceMappingURL=src.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Code } from '../../types';
|
|
2
|
+
import type { ScriptCodegenContext } from './context';
|
|
3
|
+
import { type ScriptCodegenOptions } from './index';
|
|
4
|
+
export declare function generateTemplate(options: ScriptCodegenOptions, ctx: ScriptCodegenContext): Generator<Code>;
|
|
5
|
+
export declare function getTemplateUsageVars(options: ScriptCodegenOptions, ctx: ScriptCodegenContext): Set<string>;
|