@vue/language-core 2.1.10 → 2.2.2
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 +0 -1
- package/index.js +1 -2
- package/lib/codeFeatures.d.ts +1 -0
- package/lib/codeFeatures.js +3 -0
- package/lib/codegen/codeFeatures.d.ts +83 -0
- package/lib/codegen/codeFeatures.js +71 -0
- package/lib/codegen/globalTypes.d.ts +3 -1
- package/lib/codegen/globalTypes.js +39 -14
- package/lib/codegen/localTypes.d.ts +1 -1
- package/lib/codegen/localTypes.js +7 -7
- package/lib/codegen/script/binding.d.ts +4 -0
- package/lib/codegen/script/binding.js +41 -0
- package/lib/codegen/script/component.d.ts +1 -1
- package/lib/codegen/script/component.js +44 -44
- package/lib/codegen/script/componentSelf.d.ts +1 -1
- package/lib/codegen/script/componentSelf.js +14 -14
- package/lib/codegen/script/context.d.ts +1 -1
- package/lib/codegen/script/context.js +2 -2
- package/lib/codegen/script/index.d.ts +6 -11
- package/lib/codegen/script/index.js +21 -63
- package/lib/codegen/script/scriptSetup.d.ts +1 -1
- package/lib/codegen/script/scriptSetup.js +236 -205
- package/lib/codegen/script/src.js +8 -8
- package/lib/codegen/script/styleModulesType.d.ts +1 -1
- package/lib/codegen/script/styleModulesType.js +7 -7
- package/lib/codegen/script/template.d.ts +2 -2
- package/lib/codegen/script/template.js +81 -114
- package/lib/codegen/template/context.d.ts +29 -15
- package/lib/codegen/template/context.js +51 -96
- package/lib/codegen/template/element.d.ts +2 -4
- package/lib/codegen/template/element.js +124 -317
- package/lib/codegen/template/elementChildren.d.ts +1 -1
- package/lib/codegen/template/elementChildren.js +10 -11
- package/lib/codegen/template/elementDirectives.d.ts +1 -0
- package/lib/codegen/template/elementDirectives.js +43 -30
- package/lib/codegen/template/elementEvents.d.ts +2 -2
- package/lib/codegen/template/elementEvents.js +32 -65
- package/lib/codegen/template/elementProps.d.ts +5 -3
- package/lib/codegen/template/elementProps.js +116 -123
- package/lib/codegen/template/index.d.ts +1 -0
- package/lib/codegen/template/index.js +67 -69
- package/lib/codegen/template/interpolation.d.ts +5 -3
- package/lib/codegen/template/interpolation.js +30 -27
- package/lib/codegen/template/objectProperty.js +8 -8
- package/lib/codegen/template/propertyAccess.js +4 -4
- package/lib/codegen/template/slotOutlet.d.ts +1 -1
- package/lib/codegen/template/slotOutlet.js +47 -25
- package/lib/codegen/template/styleScopedClasses.d.ts +4 -1
- package/lib/codegen/template/styleScopedClasses.js +152 -8
- package/lib/codegen/template/templateChild.d.ts +1 -1
- package/lib/codegen/template/templateChild.js +39 -20
- package/lib/codegen/template/vFor.d.ts +1 -1
- package/lib/codegen/template/vFor.js +11 -11
- package/lib/codegen/template/vIf.d.ts +1 -1
- package/lib/codegen/template/vIf.js +6 -6
- package/lib/codegen/template/vSlot.d.ts +5 -0
- package/lib/codegen/template/vSlot.js +80 -0
- package/lib/codegen/utils/camelized.d.ts +2 -0
- package/lib/codegen/utils/camelized.js +31 -0
- package/lib/codegen/utils/index.d.ts +21 -0
- package/lib/codegen/utils/index.js +79 -0
- package/lib/codegen/utils/src.d.ts +2 -0
- package/lib/codegen/utils/src.js +19 -0
- package/lib/codegen/{template → utils}/stringLiteralKey.js +3 -3
- package/lib/codegen/utils/unicode.d.ts +2 -0
- package/lib/codegen/utils/unicode.js +25 -0
- package/lib/languagePlugin.js +1 -1
- package/lib/parsers/scriptRanges.d.ts +7 -2
- package/lib/parsers/scriptSetupRanges.d.ts +69 -83
- package/lib/parsers/scriptSetupRanges.js +194 -171
- package/lib/parsers/vueCompilerOptions.d.ts +2 -0
- package/lib/parsers/vueCompilerOptions.js +23 -0
- package/lib/plugins/file-html.js +4 -3
- package/lib/plugins/file-md.js +1 -1
- package/lib/plugins/file-vue.js +4 -4
- package/lib/plugins/vue-root-tags.js +2 -2
- package/lib/plugins/vue-style-class-names.d.ts +5 -0
- package/lib/plugins/vue-style-class-names.js +32 -0
- package/lib/plugins/vue-style-reference-link.d.ts +1 -0
- package/lib/plugins/vue-style-reference-link.js +3 -0
- package/lib/plugins/vue-style-reference-links.d.ts +3 -0
- package/lib/plugins/vue-style-reference-links.js +26 -0
- package/lib/plugins/vue-template-html.js +6 -2
- package/lib/plugins/vue-template-inline-css.js +1 -1
- package/lib/plugins/vue-template-inline-ts.js +66 -17
- package/lib/plugins/vue-tsx.d.ts +126 -92
- package/lib/plugins/vue-tsx.js +114 -97
- package/lib/plugins/vue-vine.d.ts +3 -0
- package/lib/plugins/vue-vine.js +35 -0
- package/lib/types.d.ts +25 -12
- package/lib/utils/buildMappings.d.ts +1 -1
- package/lib/utils/parseCssImports.d.ts +4 -0
- package/lib/utils/parseCssImports.js +19 -0
- package/lib/utils/parseSfc.d.ts +5 -0
- package/lib/utils/parseSfc.js +11 -5
- package/lib/utils/signals.d.ts +2 -0
- package/lib/utils/signals.js +54 -0
- package/lib/utils/ts.d.ts +14 -2
- package/lib/utils/ts.js +134 -91
- package/lib/virtualFile/computedEmbeddedCodes.d.ts +1 -2
- package/lib/virtualFile/computedEmbeddedCodes.js +11 -11
- package/lib/virtualFile/computedSfc.d.ts +1 -2
- package/lib/virtualFile/computedSfc.js +87 -79
- package/lib/virtualFile/computedVueSfc.d.ts +1 -2
- package/lib/virtualFile/computedVueSfc.js +7 -7
- package/lib/virtualFile/vueFile.d.ts +5 -5
- package/lib/virtualFile/vueFile.js +6 -6
- package/package.json +6 -6
- /package/lib/codegen/{template → utils}/stringLiteralKey.d.ts +0 -0
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateComponentSelf = generateComponentSelf;
|
|
4
4
|
const path = require("path-browserify");
|
|
5
|
-
const
|
|
5
|
+
const codeFeatures_1 = require("../codeFeatures");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
6
7
|
const component_1 = require("./component");
|
|
7
|
-
const index_1 = require("./index");
|
|
8
8
|
const template_1 = require("./template");
|
|
9
9
|
function* generateComponentSelf(options, ctx, templateCodegenCtx) {
|
|
10
10
|
if (options.sfc.scriptSetup && options.scriptSetupRanges) {
|
|
11
|
-
yield `const __VLS_self = (await import('${options.vueCompilerOptions.lib}')).defineComponent({${
|
|
12
|
-
yield `setup() {${
|
|
13
|
-
yield `return {${
|
|
11
|
+
yield `const __VLS_self = (await import('${options.vueCompilerOptions.lib}')).defineComponent({${utils_1.newLine}`;
|
|
12
|
+
yield `setup() {${utils_1.newLine}`;
|
|
13
|
+
yield `return {${utils_1.newLine}`;
|
|
14
14
|
if (ctx.bypassDefineComponent) {
|
|
15
15
|
yield* (0, component_1.generateComponentSetupReturns)(options.scriptSetupRanges);
|
|
16
16
|
}
|
|
@@ -22,15 +22,15 @@ function* generateComponentSelf(options, ctx, templateCodegenCtx) {
|
|
|
22
22
|
? [options.sfc.script.content, options.scriptRanges.bindings]
|
|
23
23
|
: ['', []],
|
|
24
24
|
]) {
|
|
25
|
-
for (const
|
|
26
|
-
const varName = content.
|
|
25
|
+
for (const { range } of bindings) {
|
|
26
|
+
const varName = content.slice(range.start, range.end);
|
|
27
27
|
if (!templateUsageVars.has(varName) && !templateCodegenCtx.accessExternalVariables.has(varName)) {
|
|
28
28
|
continue;
|
|
29
29
|
}
|
|
30
30
|
const templateOffset = options.getGeneratedLength();
|
|
31
31
|
yield `${varName}: ${varName} as typeof `;
|
|
32
32
|
const scriptOffset = options.getGeneratedLength();
|
|
33
|
-
yield `${varName},${
|
|
33
|
+
yield `${varName},${utils_1.newLine}`;
|
|
34
34
|
options.linkedCodeMappings.push({
|
|
35
35
|
sourceOffsets: [scriptOffset],
|
|
36
36
|
generatedOffsets: [templateOffset],
|
|
@@ -39,8 +39,8 @@ function* generateComponentSelf(options, ctx, templateCodegenCtx) {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
yield `}${
|
|
43
|
-
yield `},${
|
|
42
|
+
yield `}${utils_1.endOfLine}`; // return {
|
|
43
|
+
yield `},${utils_1.newLine}`; // setup() {
|
|
44
44
|
if (options.sfc.scriptSetup && options.scriptSetupRanges && !ctx.bypassDefineComponent) {
|
|
45
45
|
const emitOptionCodes = [...(0, component_1.generateEmitsOption)(options, options.scriptSetupRanges)];
|
|
46
46
|
for (const code of emitOptionCodes) {
|
|
@@ -50,15 +50,15 @@ function* generateComponentSelf(options, ctx, templateCodegenCtx) {
|
|
|
50
50
|
}
|
|
51
51
|
if (options.sfc.script && options.scriptRanges?.exportDefault?.args) {
|
|
52
52
|
const { args } = options.scriptRanges.exportDefault;
|
|
53
|
-
yield (0,
|
|
53
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, args.start + 1, args.end - 1, codeFeatures_1.codeFeatures.all);
|
|
54
54
|
}
|
|
55
|
-
yield `})${
|
|
55
|
+
yield `})${utils_1.endOfLine}`; // defineComponent {
|
|
56
56
|
}
|
|
57
57
|
else if (options.sfc.script) {
|
|
58
|
-
yield `let __VLS_self!: typeof import('./${path.basename(options.fileName)}').default${
|
|
58
|
+
yield `let __VLS_self!: typeof import('./${path.basename(options.fileName)}').default${utils_1.endOfLine}`;
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
|
-
yield `const __VLS_self = (await import('${options.vueCompilerOptions.lib}')).defineComponent({})${
|
|
61
|
+
yield `const __VLS_self = (await import('${options.vueCompilerOptions.lib}')).defineComponent({})${utils_1.endOfLine}`;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
//# sourceMappingURL=componentSelf.js.map
|
|
@@ -19,7 +19,7 @@ export declare function createScriptCodegenContext(options: ScriptCodegenOptions
|
|
|
19
19
|
readonly PrettifyLocal: string;
|
|
20
20
|
readonly OmitKeepDiscriminatedUnion: string;
|
|
21
21
|
readonly WithDefaults: string;
|
|
22
|
-
readonly
|
|
22
|
+
readonly WithSlots: string;
|
|
23
23
|
readonly PropsChildren: string;
|
|
24
24
|
readonly TypePropsToOption: string;
|
|
25
25
|
readonly OmitIndexSignature: string;
|
|
@@ -11,8 +11,8 @@ function createScriptCodegenContext(options) {
|
|
|
11
11
|
scriptSetupGeneratedOffset: undefined,
|
|
12
12
|
bypassDefineComponent: options.lang === 'js' || options.lang === 'jsx',
|
|
13
13
|
bindingNames: new Set([
|
|
14
|
-
...options.scriptRanges?.bindings.map(range => options.sfc.script.content.
|
|
15
|
-
...options.scriptSetupRanges?.bindings.map(range => options.sfc.scriptSetup.content.
|
|
14
|
+
...options.scriptRanges?.bindings.map(({ range }) => options.sfc.script.content.slice(range.start, range.end)) ?? [],
|
|
15
|
+
...options.scriptSetupRanges?.bindings.map(({ range }) => options.sfc.scriptSetup.content.slice(range.start, range.end)) ?? [],
|
|
16
16
|
]),
|
|
17
17
|
localTypes,
|
|
18
18
|
inlayHints,
|
|
@@ -2,32 +2,27 @@ import type { Mapping } from '@volar/language-core';
|
|
|
2
2
|
import type * as ts from 'typescript';
|
|
3
3
|
import type { ScriptRanges } from '../../parsers/scriptRanges';
|
|
4
4
|
import type { ScriptSetupRanges } from '../../parsers/scriptSetupRanges';
|
|
5
|
-
import type { Code, Sfc,
|
|
5
|
+
import type { Code, Sfc, VueCompilerOptions } from '../../types';
|
|
6
6
|
import type { TemplateCodegenContext } from '../template/context';
|
|
7
7
|
import { ScriptCodegenContext } from './context';
|
|
8
|
-
export declare const codeFeatures: {
|
|
9
|
-
all: VueCodeInformation;
|
|
10
|
-
none: VueCodeInformation;
|
|
11
|
-
verification: VueCodeInformation;
|
|
12
|
-
navigation: VueCodeInformation;
|
|
13
|
-
navigationWithoutRename: VueCodeInformation;
|
|
14
|
-
};
|
|
15
8
|
export interface ScriptCodegenOptions {
|
|
16
|
-
fileName: string;
|
|
17
9
|
ts: typeof ts;
|
|
18
10
|
compilerOptions: ts.CompilerOptions;
|
|
19
11
|
vueCompilerOptions: VueCompilerOptions;
|
|
20
12
|
sfc: Sfc;
|
|
13
|
+
edited: boolean;
|
|
14
|
+
fileName: string;
|
|
21
15
|
lang: string;
|
|
22
16
|
scriptRanges: ScriptRanges | undefined;
|
|
23
17
|
scriptSetupRanges: ScriptSetupRanges | undefined;
|
|
24
18
|
templateCodegen: TemplateCodegenContext & {
|
|
25
19
|
codes: Code[];
|
|
26
20
|
} | undefined;
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
destructuredPropNames: Set<string>;
|
|
22
|
+
templateRefNames: Set<string>;
|
|
29
23
|
getGeneratedLength: () => number;
|
|
30
24
|
linkedCodeMappings: Mapping[];
|
|
25
|
+
appendGlobalTypes: boolean;
|
|
31
26
|
}
|
|
32
27
|
export declare function generateScript(options: ScriptCodegenOptions): Generator<Code, ScriptCodegenContext>;
|
|
33
28
|
export declare function generateScriptSectionPartiallyEnding(source: string, end: number, mark: string): Generator<Code>;
|
|
@@ -1,39 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.codeFeatures = void 0;
|
|
4
3
|
exports.generateScript = generateScript;
|
|
5
4
|
exports.generateScriptSectionPartiallyEnding = generateScriptSectionPartiallyEnding;
|
|
6
5
|
const path = require("path-browserify");
|
|
7
|
-
const
|
|
6
|
+
const codeFeatures_1 = require("../codeFeatures");
|
|
8
7
|
const globalTypes_1 = require("../globalTypes");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
9
|
const componentSelf_1 = require("./componentSelf");
|
|
10
10
|
const context_1 = require("./context");
|
|
11
11
|
const scriptSetup_1 = require("./scriptSetup");
|
|
12
12
|
const src_1 = require("./src");
|
|
13
13
|
const styleModulesType_1 = require("./styleModulesType");
|
|
14
14
|
const template_1 = require("./template");
|
|
15
|
-
exports.codeFeatures = {
|
|
16
|
-
all: {
|
|
17
|
-
verification: true,
|
|
18
|
-
completion: true,
|
|
19
|
-
semantic: true,
|
|
20
|
-
navigation: true,
|
|
21
|
-
},
|
|
22
|
-
none: {},
|
|
23
|
-
verification: {
|
|
24
|
-
verification: true,
|
|
25
|
-
},
|
|
26
|
-
navigation: {
|
|
27
|
-
navigation: true,
|
|
28
|
-
},
|
|
29
|
-
navigationWithoutRename: {
|
|
30
|
-
navigation: {
|
|
31
|
-
shouldRename() {
|
|
32
|
-
return false;
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
15
|
function* generateScript(options) {
|
|
38
16
|
const ctx = (0, context_1.createScriptCodegenContext)(options);
|
|
39
17
|
if (options.vueCompilerOptions.__setupedGlobalTypes) {
|
|
@@ -43,10 +21,10 @@ function* generateScript(options) {
|
|
|
43
21
|
if (relativePath !== globalTypes.absolutePath && !relativePath.startsWith('./') && !relativePath.startsWith('../')) {
|
|
44
22
|
relativePath = './' + relativePath;
|
|
45
23
|
}
|
|
46
|
-
yield `/// <reference types="${relativePath}" />${
|
|
24
|
+
yield `/// <reference types="${relativePath}" />${utils_1.newLine}`;
|
|
47
25
|
}
|
|
48
26
|
else {
|
|
49
|
-
yield `/// <reference types=".vue-global-types/${
|
|
27
|
+
yield `/// <reference types=".vue-global-types/${(0, globalTypes_1.getGlobalTypesFileName)(options.vueCompilerOptions)}" />${utils_1.newLine}`;
|
|
50
28
|
}
|
|
51
29
|
}
|
|
52
30
|
else {
|
|
@@ -61,14 +39,13 @@ function* generateScript(options) {
|
|
|
61
39
|
&& options.sfc.script.content[exportDefault.expression.start] === '{';
|
|
62
40
|
if (options.sfc.scriptSetup && options.scriptSetupRanges) {
|
|
63
41
|
yield* (0, scriptSetup_1.generateScriptSetupImports)(options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
64
|
-
yield* generateDefineProp(options, options.sfc.scriptSetup);
|
|
65
42
|
if (exportDefault) {
|
|
66
|
-
yield (0,
|
|
43
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, 0, exportDefault.expression.start, codeFeatures_1.codeFeatures.all);
|
|
67
44
|
yield* (0, scriptSetup_1.generateScriptSetup)(options, ctx, options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
68
|
-
yield (0,
|
|
45
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, exportDefault.expression.end, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
69
46
|
}
|
|
70
47
|
else {
|
|
71
|
-
yield (0,
|
|
48
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, 0, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
72
49
|
yield* generateScriptSectionPartiallyEnding(options.sfc.script.name, options.sfc.script.content.length, '#3632/both.vue');
|
|
73
50
|
yield* (0, scriptSetup_1.generateScriptSetup)(options, ctx, options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
74
51
|
}
|
|
@@ -93,32 +70,31 @@ function* generateScript(options) {
|
|
|
93
70
|
? options.vueCompilerOptions.optionsWrapper[1]
|
|
94
71
|
: '[Missing optionsWrapper[1]]',
|
|
95
72
|
});
|
|
96
|
-
yield (0,
|
|
73
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, 0, exportDefault.expression.start, codeFeatures_1.codeFeatures.all);
|
|
97
74
|
yield options.vueCompilerOptions.optionsWrapper[0];
|
|
98
|
-
yield (0,
|
|
75
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, exportDefault.expression.start, exportDefault.expression.end, codeFeatures_1.codeFeatures.all);
|
|
99
76
|
yield options.vueCompilerOptions.optionsWrapper[1];
|
|
100
|
-
yield (0,
|
|
77
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, exportDefault.expression.end, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
101
78
|
}
|
|
102
79
|
else if (classBlockEnd !== undefined) {
|
|
103
80
|
if (options.vueCompilerOptions.skipTemplateCodegen) {
|
|
104
|
-
yield (0,
|
|
81
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, 0, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
105
82
|
}
|
|
106
83
|
else {
|
|
107
|
-
yield (0,
|
|
108
|
-
yield `__VLS_template = () => {${
|
|
84
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, 0, classBlockEnd, codeFeatures_1.codeFeatures.all);
|
|
85
|
+
yield `__VLS_template = () => {${utils_1.newLine}`;
|
|
109
86
|
const templateCodegenCtx = yield* (0, template_1.generateTemplate)(options, ctx);
|
|
110
87
|
yield* (0, componentSelf_1.generateComponentSelf)(options, ctx, templateCodegenCtx);
|
|
111
|
-
yield `}${
|
|
112
|
-
yield (0,
|
|
88
|
+
yield `}${utils_1.endOfLine}`;
|
|
89
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, classBlockEnd, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
113
90
|
}
|
|
114
91
|
}
|
|
115
92
|
else {
|
|
116
|
-
yield (0,
|
|
93
|
+
yield (0, utils_1.generateSfcBlockSection)(options.sfc.script, 0, options.sfc.script.content.length, codeFeatures_1.codeFeatures.all);
|
|
117
94
|
}
|
|
118
95
|
}
|
|
119
96
|
else if (options.sfc.scriptSetup && options.scriptSetupRanges) {
|
|
120
97
|
yield* (0, scriptSetup_1.generateScriptSetupImports)(options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
121
|
-
yield* generateDefineProp(options, options.sfc.scriptSetup);
|
|
122
98
|
yield* (0, scriptSetup_1.generateScriptSetup)(options, ctx, options.sfc.scriptSetup, options.scriptSetupRanges);
|
|
123
99
|
}
|
|
124
100
|
if (options.sfc.script) {
|
|
@@ -128,44 +104,26 @@ function* generateScript(options) {
|
|
|
128
104
|
yield* generateScriptSectionPartiallyEnding(options.sfc.scriptSetup.name, options.sfc.scriptSetup.content.length, '#4569/main.vue');
|
|
129
105
|
}
|
|
130
106
|
if (!ctx.generatedTemplate) {
|
|
131
|
-
yield `function __VLS_template() {${common_1.newLine}`;
|
|
132
107
|
const templateCodegenCtx = yield* (0, template_1.generateTemplate)(options, ctx);
|
|
133
|
-
yield `}${common_1.endOfLine}`;
|
|
134
108
|
yield* (0, componentSelf_1.generateComponentSelf)(options, ctx, templateCodegenCtx);
|
|
135
109
|
}
|
|
136
110
|
// #4788
|
|
137
111
|
yield* (0, styleModulesType_1.generateStyleModulesType)(options, ctx);
|
|
138
112
|
if (options.edited) {
|
|
139
|
-
yield `type __VLS_IntrinsicElementsCompletion = __VLS_IntrinsicElements${
|
|
113
|
+
yield `type __VLS_IntrinsicElementsCompletion = __VLS_IntrinsicElements${utils_1.endOfLine}`;
|
|
140
114
|
}
|
|
141
115
|
yield* ctx.localTypes.generate([...ctx.localTypes.getUsedNames()]);
|
|
142
116
|
if (options.appendGlobalTypes) {
|
|
143
|
-
yield (0, globalTypes_1.generateGlobalTypes)(options.vueCompilerOptions
|
|
117
|
+
yield (0, globalTypes_1.generateGlobalTypes)(options.vueCompilerOptions);
|
|
144
118
|
}
|
|
145
119
|
if (options.sfc.scriptSetup) {
|
|
146
|
-
yield ['', 'scriptSetup', options.sfc.scriptSetup.content.length,
|
|
120
|
+
yield ['', 'scriptSetup', options.sfc.scriptSetup.content.length, codeFeatures_1.codeFeatures.verification];
|
|
147
121
|
}
|
|
148
122
|
return ctx;
|
|
149
123
|
}
|
|
150
124
|
function* generateScriptSectionPartiallyEnding(source, end, mark) {
|
|
151
125
|
yield `;`;
|
|
152
|
-
yield ['', source, end,
|
|
153
|
-
yield `/* PartiallyEnd: ${mark} */${
|
|
154
|
-
}
|
|
155
|
-
function* generateDefineProp(options, scriptSetup) {
|
|
156
|
-
const definePropProposalA = scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=kevinEdition') || options.vueCompilerOptions.experimentalDefinePropProposal === 'kevinEdition';
|
|
157
|
-
const definePropProposalB = scriptSetup.content.trimStart().startsWith('// @experimentalDefinePropProposal=johnsonEdition') || options.vueCompilerOptions.experimentalDefinePropProposal === 'johnsonEdition';
|
|
158
|
-
if (definePropProposalA || definePropProposalB) {
|
|
159
|
-
yield `type __VLS_PropOptions<T> = Exclude<import('${options.vueCompilerOptions.lib}').Prop<T>, import('${options.vueCompilerOptions.lib}').PropType<T>>${common_1.endOfLine}`;
|
|
160
|
-
if (definePropProposalA) {
|
|
161
|
-
yield `declare function defineProp<T>(name: string, options: ({ required: true } | { default: T }) & __VLS_PropOptions<T>): import('${options.vueCompilerOptions.lib}').ComputedRef<T>${common_1.endOfLine}`;
|
|
162
|
-
yield `declare function defineProp<T>(name?: string, options?: __VLS_PropOptions<T>): import('${options.vueCompilerOptions.lib}').ComputedRef<T | undefined>${common_1.endOfLine}`;
|
|
163
|
-
}
|
|
164
|
-
if (definePropProposalB) {
|
|
165
|
-
yield `declare function defineProp<T>(value: T | (() => T), required?: boolean, options?: __VLS_PropOptions<T>): import('${options.vueCompilerOptions.lib}').ComputedRef<T>${common_1.endOfLine}`;
|
|
166
|
-
yield `declare function defineProp<T>(value: T | (() => T) | undefined, required: true, options?: __VLS_PropOptions<T>): import('${options.vueCompilerOptions.lib}').ComputedRef<T>${common_1.endOfLine}`;
|
|
167
|
-
yield `declare function defineProp<T>(value?: T | (() => T), required?: boolean, options?: __VLS_PropOptions<T>): import('${options.vueCompilerOptions.lib}').ComputedRef<T | undefined>${common_1.endOfLine}`;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
126
|
+
yield ['', source, end, codeFeatures_1.codeFeatures.verification];
|
|
127
|
+
yield `/* PartiallyEnd: ${mark} */${utils_1.newLine}`;
|
|
170
128
|
}
|
|
171
129
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ScriptSetupRanges } from '../../parsers/scriptSetupRanges';
|
|
2
2
|
import type { Code, Sfc } from '../../types';
|
|
3
3
|
import type { ScriptCodegenContext } from './context';
|
|
4
|
-
import { ScriptCodegenOptions } from './index';
|
|
4
|
+
import { type ScriptCodegenOptions } from './index';
|
|
5
5
|
export declare function generateScriptSetupImports(scriptSetup: NonNullable<Sfc['scriptSetup']>, scriptSetupRanges: ScriptSetupRanges): Generator<Code>;
|
|
6
6
|
export declare function generateScriptSetup(options: ScriptCodegenOptions, ctx: ScriptCodegenContext, scriptSetup: NonNullable<Sfc['scriptSetup']>, scriptSetupRanges: ScriptSetupRanges): Generator<Code>;
|