@vue/language-core 2.1.8 → 2.2.0
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/lib/codegen/globalTypes.js +12 -5
- package/lib/codegen/localTypes.js +3 -3
- package/lib/codegen/script/component.js +42 -42
- package/lib/codegen/script/componentSelf.js +14 -13
- package/lib/codegen/script/context.js +2 -2
- package/lib/codegen/script/index.d.ts +5 -3
- package/lib/codegen/script/index.js +24 -37
- package/lib/codegen/script/scriptSetup.js +240 -193
- package/lib/codegen/script/src.js +6 -6
- package/lib/codegen/script/styleModulesType.js +5 -5
- package/lib/codegen/script/template.d.ts +1 -1
- package/lib/codegen/script/template.js +89 -99
- package/lib/codegen/template/context.d.ts +13 -3
- package/lib/codegen/template/context.js +21 -12
- package/lib/codegen/template/element.d.ts +2 -4
- package/lib/codegen/template/element.js +132 -105
- package/lib/codegen/template/elementChildren.d.ts +1 -1
- package/lib/codegen/template/elementChildren.js +8 -8
- package/lib/codegen/template/elementDirectives.d.ts +1 -0
- package/lib/codegen/template/elementDirectives.js +28 -22
- package/lib/codegen/template/elementEvents.d.ts +2 -2
- package/lib/codegen/template/elementEvents.js +32 -65
- package/lib/codegen/template/elementProps.d.ts +3 -2
- package/lib/codegen/template/elementProps.js +119 -122
- package/lib/codegen/template/index.js +52 -60
- package/lib/codegen/template/interpolation.d.ts +5 -3
- package/lib/codegen/template/interpolation.js +18 -19
- 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 +13 -13
- package/lib/codegen/template/styleScopedClasses.d.ts +1 -1
- package/lib/codegen/template/styleScopedClasses.js +11 -8
- package/lib/codegen/template/templateChild.d.ts +1 -1
- package/lib/codegen/template/templateChild.js +31 -19
- 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 → utils}/camelized.js +2 -2
- package/lib/codegen/{common.d.ts → utils/index.d.ts} +1 -2
- package/lib/codegen/{common.js → utils/index.js} +4 -15
- 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 +67 -81
- package/lib/parsers/scriptSetupRanges.js +195 -166
- 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-template-html.js +6 -2
- package/lib/plugins/vue-template-inline-css.js +1 -1
- package/lib/plugins/vue-template-inline-ts.js +13 -5
- package/lib/plugins/vue-tsx.d.ts +101 -72
- package/lib/plugins/vue-tsx.js +65 -69
- package/lib/types.d.ts +19 -10
- package/lib/utils/buildMappings.d.ts +1 -1
- package/lib/utils/parseSfc.d.ts +5 -0
- package/lib/utils/parseSfc.js +7 -2
- package/lib/utils/ts.d.ts +1 -1
- package/lib/utils/ts.js +38 -24
- package/lib/virtualFile/computedEmbeddedCodes.d.ts +1 -2
- package/lib/virtualFile/computedSfc.js +23 -12
- package/lib/virtualFile/computedVueSfc.d.ts +1 -1
- package/lib/virtualFile/vueFile.d.ts +3 -3
- package/package.json +5 -5
- package/lib/codegen/types.d.ts +0 -9
- package/lib/codegen/types.js +0 -3
- package/lib/utils/findDestructuredProps.d.ts +0 -1
- package/lib/utils/findDestructuredProps.js +0 -3
- /package/lib/codegen/{template → utils}/camelized.d.ts +0 -0
- /package/lib/codegen/{template → utils}/stringLiteralKey.d.ts +0 -0
|
@@ -3,17 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generateVFor = generateVFor;
|
|
4
4
|
exports.parseVForNode = parseVForNode;
|
|
5
5
|
const CompilerDOM = require("@vue/compiler-dom");
|
|
6
|
-
const
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
7
|
const interpolation_1 = require("./interpolation");
|
|
8
8
|
const templateChild_1 = require("./templateChild");
|
|
9
|
-
function* generateVFor(options, ctx, node
|
|
9
|
+
function* generateVFor(options, ctx, node) {
|
|
10
10
|
const { source } = node.parseResult;
|
|
11
11
|
const { leftExpressionRange, leftExpressionText } = parseVForNode(node);
|
|
12
12
|
const forBlockVars = [];
|
|
13
13
|
yield `for (const [`;
|
|
14
14
|
if (leftExpressionRange && leftExpressionText) {
|
|
15
|
-
const collectAst = (0,
|
|
16
|
-
(0,
|
|
15
|
+
const collectAst = (0, utils_1.createTsAst)(options.ts, node.parseResult, `const [${leftExpressionText}]`);
|
|
16
|
+
(0, utils_1.collectVars)(options.ts, collectAst, collectAst, forBlockVars);
|
|
17
17
|
yield [
|
|
18
18
|
leftExpressionText,
|
|
19
19
|
'template',
|
|
@@ -24,13 +24,13 @@ function* generateVFor(options, ctx, node, currentComponent, componentCtxVar) {
|
|
|
24
24
|
yield `] of `;
|
|
25
25
|
if (source.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
|
|
26
26
|
yield `__VLS_getVForSourceType(`;
|
|
27
|
-
yield* (0, interpolation_1.generateInterpolation)(options, ctx,
|
|
27
|
+
yield* (0, interpolation_1.generateInterpolation)(options, ctx, 'template', ctx.codeFeatures.all, source.content, source.loc.start.offset, source.loc, '(', ')');
|
|
28
28
|
yield `!)`; // #3102
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
yield `{} as any`;
|
|
32
32
|
}
|
|
33
|
-
yield `) {${
|
|
33
|
+
yield `) {${utils_1.newLine}`;
|
|
34
34
|
for (const varName of forBlockVars) {
|
|
35
35
|
ctx.addLocalVariable(varName);
|
|
36
36
|
}
|
|
@@ -46,8 +46,8 @@ function* generateVFor(options, ctx, node, currentComponent, componentCtxVar) {
|
|
|
46
46
|
for (const prop of argument.returns.props.properties) {
|
|
47
47
|
if (prop.value.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION
|
|
48
48
|
&& !prop.value.isStatic) {
|
|
49
|
-
yield* (0, interpolation_1.generateInterpolation)(options, ctx,
|
|
50
|
-
yield
|
|
49
|
+
yield* (0, interpolation_1.generateInterpolation)(options, ctx, 'template', ctx.codeFeatures.all, prop.value.content, prop.value.loc.start.offset, prop.value.loc, '(', ')');
|
|
50
|
+
yield utils_1.endOfLine;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -57,14 +57,14 @@ function* generateVFor(options, ctx, node, currentComponent, componentCtxVar) {
|
|
|
57
57
|
}
|
|
58
58
|
let prev;
|
|
59
59
|
for (const childNode of node.children) {
|
|
60
|
-
yield* (0, templateChild_1.generateTemplateChild)(options, ctx, childNode,
|
|
60
|
+
yield* (0, templateChild_1.generateTemplateChild)(options, ctx, childNode, prev, true);
|
|
61
61
|
prev = childNode;
|
|
62
62
|
}
|
|
63
63
|
for (const varName of forBlockVars) {
|
|
64
64
|
ctx.removeLocalVariable(varName);
|
|
65
65
|
}
|
|
66
66
|
yield* ctx.generateAutoImportCompletion();
|
|
67
|
-
yield `}${
|
|
67
|
+
yield `}${utils_1.newLine}`;
|
|
68
68
|
}
|
|
69
69
|
function parseVForNode(node) {
|
|
70
70
|
const { value, key, index } = node.parseResult;
|
|
@@ -75,7 +75,7 @@ function parseVForNode(node) {
|
|
|
75
75
|
}
|
|
76
76
|
: undefined;
|
|
77
77
|
const leftExpressionText = leftExpressionRange
|
|
78
|
-
? node.loc.source.
|
|
78
|
+
? node.loc.source.slice(leftExpressionRange.start - node.loc.start.offset, leftExpressionRange.end - node.loc.start.offset)
|
|
79
79
|
: undefined;
|
|
80
80
|
return {
|
|
81
81
|
leftExpressionRange,
|
|
@@ -2,4 +2,4 @@ import * as CompilerDOM from '@vue/compiler-dom';
|
|
|
2
2
|
import type { Code } from '../../types';
|
|
3
3
|
import type { TemplateCodegenContext } from './context';
|
|
4
4
|
import type { TemplateCodegenOptions } from './index';
|
|
5
|
-
export declare function generateVIf(options: TemplateCodegenOptions, ctx: TemplateCodegenContext, node: CompilerDOM.IfNode
|
|
5
|
+
export declare function generateVIf(options: TemplateCodegenOptions, ctx: TemplateCodegenContext, node: CompilerDOM.IfNode): Generator<Code>;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generateVIf = generateVIf;
|
|
4
4
|
const CompilerDOM = require("@vue/compiler-dom");
|
|
5
5
|
const muggle_string_1 = require("muggle-string");
|
|
6
|
-
const
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
7
|
const interpolation_1 = require("./interpolation");
|
|
8
8
|
const templateChild_1 = require("./templateChild");
|
|
9
|
-
function* generateVIf(options, ctx, node
|
|
9
|
+
function* generateVIf(options, ctx, node) {
|
|
10
10
|
let originalBlockConditionsLength = ctx.blockConditions.length;
|
|
11
11
|
for (let i = 0; i < node.branches.length; i++) {
|
|
12
12
|
const branch = node.branches[i];
|
|
@@ -22,7 +22,7 @@ function* generateVIf(options, ctx, node, currentComponent, componentCtxVar) {
|
|
|
22
22
|
let addedBlockCondition = false;
|
|
23
23
|
if (branch.condition?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
|
|
24
24
|
const codes = [
|
|
25
|
-
...(0, interpolation_1.generateInterpolation)(options, ctx,
|
|
25
|
+
...(0, interpolation_1.generateInterpolation)(options, ctx, 'template', ctx.codeFeatures.all, branch.condition.content, branch.condition.loc.start.offset, branch.condition.loc, '(', ')'),
|
|
26
26
|
];
|
|
27
27
|
for (const code of codes) {
|
|
28
28
|
yield code;
|
|
@@ -31,17 +31,17 @@ function* generateVIf(options, ctx, node, currentComponent, componentCtxVar) {
|
|
|
31
31
|
addedBlockCondition = true;
|
|
32
32
|
yield ` `;
|
|
33
33
|
}
|
|
34
|
-
yield `{${
|
|
34
|
+
yield `{${utils_1.newLine}`;
|
|
35
35
|
if (isFragment(node)) {
|
|
36
36
|
yield* ctx.resetDirectiveComments('end of v-if start');
|
|
37
37
|
}
|
|
38
38
|
let prev;
|
|
39
39
|
for (const childNode of branch.children) {
|
|
40
|
-
yield* (0, templateChild_1.generateTemplateChild)(options, ctx, childNode,
|
|
40
|
+
yield* (0, templateChild_1.generateTemplateChild)(options, ctx, childNode, prev);
|
|
41
41
|
prev = childNode;
|
|
42
42
|
}
|
|
43
43
|
yield* ctx.generateAutoImportCompletion();
|
|
44
|
-
yield `}${
|
|
44
|
+
yield `}${utils_1.newLine}`;
|
|
45
45
|
if (addedBlockCondition) {
|
|
46
46
|
ctx.blockConditions[ctx.blockConditions.length - 1] = `!(${ctx.blockConditions[ctx.blockConditions.length - 1]})`;
|
|
47
47
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateCamelized = generateCamelized;
|
|
4
4
|
const shared_1 = require("@vue/shared");
|
|
5
|
-
const
|
|
5
|
+
const index_1 = require("./index");
|
|
6
6
|
function* generateCamelized(code, offset, info) {
|
|
7
7
|
const parts = code.split('-');
|
|
8
8
|
for (let i = 0; i < parts.length; i++) {
|
|
@@ -21,7 +21,7 @@ function* generateCamelized(code, offset, info) {
|
|
|
21
21
|
(0, shared_1.capitalize)(part),
|
|
22
22
|
'template',
|
|
23
23
|
offset,
|
|
24
|
-
|
|
24
|
+
index_1.combineLastMapping,
|
|
25
25
|
];
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type * as ts from 'typescript';
|
|
2
|
-
import type { Code, SfcBlock, VueCodeInformation } from '
|
|
2
|
+
import type { Code, SfcBlock, VueCodeInformation } from '../../types';
|
|
3
3
|
export declare const newLine = "\n";
|
|
4
4
|
export declare const endOfLine = ";\n";
|
|
5
5
|
export declare const combineLastMapping: VueCodeInformation;
|
|
6
6
|
export declare const variableNameRegex: RegExp;
|
|
7
|
-
export declare function conditionWrapWith(condition: boolean, startOffset: number, endOffset: number, features: VueCodeInformation, ...wrapCodes: Code[]): Generator<Code>;
|
|
8
7
|
export declare function wrapWith(startOffset: number, endOffset: number, features: VueCodeInformation, ...wrapCodes: Code[]): Generator<Code>;
|
|
9
8
|
export declare function collectVars(ts: typeof import('typescript'), node: ts.Node, ast: ts.SourceFile, results?: string[]): string[];
|
|
10
9
|
export declare function collectIdentifiers(ts: typeof import('typescript'), node: ts.Node, results?: [id: ts.Identifier, isRest: boolean][], isRest?: boolean): [id: ts.Identifier, isRest: boolean][];
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.variableNameRegex = exports.combineLastMapping = exports.endOfLine = exports.newLine = void 0;
|
|
4
|
-
exports.conditionWrapWith = conditionWrapWith;
|
|
5
4
|
exports.wrapWith = wrapWith;
|
|
6
5
|
exports.collectVars = collectVars;
|
|
7
6
|
exports.collectIdentifiers = collectIdentifiers;
|
|
8
7
|
exports.createTsAst = createTsAst;
|
|
9
8
|
exports.generateSfcBlockSection = generateSfcBlockSection;
|
|
10
|
-
const scriptSetupRanges_1 = require("
|
|
11
|
-
exports.newLine =
|
|
9
|
+
const scriptSetupRanges_1 = require("../../parsers/scriptSetupRanges");
|
|
10
|
+
exports.newLine = `\n`;
|
|
12
11
|
exports.endOfLine = `;${exports.newLine}`;
|
|
13
12
|
exports.combineLastMapping = { __combineLastMapping: true };
|
|
14
13
|
exports.variableNameRegex = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
|
|
15
|
-
function* conditionWrapWith(condition, startOffset, endOffset, features, ...wrapCodes) {
|
|
16
|
-
if (condition) {
|
|
17
|
-
yield* wrapWith(startOffset, endOffset, features, ...wrapCodes);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
for (const wrapCode of wrapCodes) {
|
|
21
|
-
yield wrapCode;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
14
|
function* wrapWith(startOffset, endOffset, features, ...wrapCodes) {
|
|
26
15
|
yield ['', 'template', startOffset, features];
|
|
27
16
|
let offset = 1;
|
|
@@ -70,10 +59,10 @@ function createTsAst(ts, astHolder, text) {
|
|
|
70
59
|
}
|
|
71
60
|
function generateSfcBlockSection(block, start, end, features) {
|
|
72
61
|
return [
|
|
73
|
-
block.content.
|
|
62
|
+
block.content.slice(start, end),
|
|
74
63
|
block.name,
|
|
75
64
|
start,
|
|
76
65
|
features,
|
|
77
66
|
];
|
|
78
67
|
}
|
|
79
|
-
//# sourceMappingURL=
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateStringLiteralKey = generateStringLiteralKey;
|
|
4
|
-
const
|
|
4
|
+
const index_1 = require("./index");
|
|
5
5
|
function* generateStringLiteralKey(code, offset, info) {
|
|
6
6
|
if (offset === undefined || !info) {
|
|
7
|
-
yield `
|
|
7
|
+
yield `'${code}'`;
|
|
8
8
|
}
|
|
9
9
|
else {
|
|
10
|
-
yield* (0,
|
|
10
|
+
yield* (0, index_1.wrapWith)(offset, offset + code.length, info, `'`, [code, 'template', offset, index_1.combineLastMapping], `'`);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=stringLiteralKey.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateUnicode = generateUnicode;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
function* generateUnicode(code, offset, info) {
|
|
6
|
+
if (needToUnicode(code)) {
|
|
7
|
+
yield* (0, index_1.wrapWith)(offset, offset + code.length, info, toUnicode(code));
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
yield [code, 'template', offset, info];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function needToUnicode(str) {
|
|
14
|
+
return str.includes('\\') || str.includes('\n');
|
|
15
|
+
}
|
|
16
|
+
function toUnicode(str) {
|
|
17
|
+
return str.split('').map(value => {
|
|
18
|
+
const temp = value.charCodeAt(0).toString(16).padStart(4, '0');
|
|
19
|
+
if (temp.length > 2) {
|
|
20
|
+
return '\\u' + temp;
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}).join('');
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=unicode.js.map
|
package/lib/languagePlugin.js
CHANGED
|
@@ -90,7 +90,7 @@ function createVueLanguagePlugin(ts, compilerOptions, vueCompilerOptions, asFile
|
|
|
90
90
|
getServiceScript(root) {
|
|
91
91
|
for (const code of (0, language_core_1.forEachEmbeddedCode)(root)) {
|
|
92
92
|
if (/script_(js|jsx|ts|tsx)/.test(code.id)) {
|
|
93
|
-
const lang = code.id.
|
|
93
|
+
const lang = code.id.slice('script_'.length);
|
|
94
94
|
return {
|
|
95
95
|
code,
|
|
96
96
|
extension: '.' + lang,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TextRange } from '../types';
|
|
2
1
|
import type * as ts from 'typescript';
|
|
2
|
+
import type { TextRange } from '../types';
|
|
3
3
|
export interface ScriptRanges extends ReturnType<typeof parseScriptRanges> {
|
|
4
4
|
}
|
|
5
5
|
export declare function parseScriptRanges(ts: typeof import('typescript'), ast: ts.SourceFile, hasScriptSetup: boolean, withNode: boolean): {
|
|
@@ -14,5 +14,10 @@ export declare function parseScriptRanges(ts: typeof import('typescript'), ast:
|
|
|
14
14
|
inheritAttrsOption: string | undefined;
|
|
15
15
|
}) | undefined;
|
|
16
16
|
classBlockEnd: number | undefined;
|
|
17
|
-
bindings:
|
|
17
|
+
bindings: {
|
|
18
|
+
range: TextRange;
|
|
19
|
+
moduleName?: string;
|
|
20
|
+
isDefaultImport?: boolean;
|
|
21
|
+
isNamespace?: boolean;
|
|
22
|
+
}[];
|
|
18
23
|
};
|
|
@@ -1,89 +1,75 @@
|
|
|
1
1
|
import type * as ts from 'typescript';
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextRange, VueCompilerOptions } from '../types';
|
|
3
|
+
type CallExpressionRange = {
|
|
4
|
+
callExp: TextRange;
|
|
5
|
+
exp: TextRange;
|
|
6
|
+
arg?: TextRange;
|
|
7
|
+
typeArg?: TextRange;
|
|
8
|
+
};
|
|
9
|
+
type DefineProp = {
|
|
10
|
+
localName?: TextRange;
|
|
11
|
+
name?: TextRange;
|
|
12
|
+
type?: TextRange;
|
|
13
|
+
modifierType?: TextRange;
|
|
14
|
+
runtimeType?: TextRange;
|
|
15
|
+
defaultValue?: TextRange;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
isModel?: boolean;
|
|
18
|
+
};
|
|
19
|
+
type DefineProps = CallExpressionRange & {
|
|
20
|
+
name?: string;
|
|
21
|
+
destructured?: Set<string>;
|
|
22
|
+
destructuredRest?: string;
|
|
23
|
+
statement: TextRange;
|
|
24
|
+
};
|
|
25
|
+
type WithDefaults = Pick<CallExpressionRange, 'callExp' | 'exp' | 'arg'>;
|
|
26
|
+
type DefineEmits = CallExpressionRange & {
|
|
27
|
+
name?: string;
|
|
28
|
+
hasUnionTypeArg?: boolean;
|
|
29
|
+
statement: TextRange;
|
|
30
|
+
};
|
|
31
|
+
type DefineSlots = CallExpressionRange & {
|
|
32
|
+
name?: string;
|
|
33
|
+
isObjectBindingPattern?: boolean;
|
|
34
|
+
statement: TextRange;
|
|
35
|
+
};
|
|
36
|
+
type DefineOptions = {
|
|
37
|
+
name?: string;
|
|
38
|
+
inheritAttrs?: string;
|
|
39
|
+
};
|
|
40
|
+
type UseTemplateRef = CallExpressionRange & {
|
|
41
|
+
name?: string;
|
|
42
|
+
};
|
|
3
43
|
export interface ScriptSetupRanges extends ReturnType<typeof parseScriptSetupRanges> {
|
|
4
44
|
}
|
|
5
45
|
export declare function parseScriptSetupRanges(ts: typeof import('typescript'), ast: ts.SourceFile, vueCompilerOptions: VueCompilerOptions): {
|
|
6
46
|
leadingCommentEndOffset: number;
|
|
7
47
|
importSectionEndOffset: number;
|
|
8
|
-
bindings:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
destructuredRest?: string;
|
|
14
|
-
define?: ReturnType<(node: ts.CallExpression) => TextRange & {
|
|
15
|
-
exp: TextRange;
|
|
16
|
-
arg?: TextRange;
|
|
17
|
-
typeArg?: TextRange;
|
|
18
|
-
}> & {
|
|
19
|
-
statement: TextRange;
|
|
20
|
-
};
|
|
21
|
-
withDefaults?: TextRange & {
|
|
22
|
-
arg?: TextRange;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
slots: {
|
|
26
|
-
name?: string;
|
|
27
|
-
isObjectBindingPattern?: boolean;
|
|
28
|
-
define?: ReturnType<(node: ts.CallExpression) => TextRange & {
|
|
29
|
-
exp: TextRange;
|
|
30
|
-
arg?: TextRange;
|
|
31
|
-
typeArg?: TextRange;
|
|
32
|
-
}>;
|
|
33
|
-
};
|
|
34
|
-
emits: {
|
|
35
|
-
name?: string;
|
|
36
|
-
define?: ReturnType<(node: ts.CallExpression) => TextRange & {
|
|
37
|
-
exp: TextRange;
|
|
38
|
-
arg?: TextRange;
|
|
39
|
-
typeArg?: TextRange;
|
|
40
|
-
}> & {
|
|
41
|
-
statement: TextRange;
|
|
42
|
-
hasUnionTypeArg?: boolean;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
expose: {
|
|
46
|
-
name?: string;
|
|
47
|
-
define?: ReturnType<(node: ts.CallExpression) => TextRange & {
|
|
48
|
-
exp: TextRange;
|
|
49
|
-
arg?: TextRange;
|
|
50
|
-
typeArg?: TextRange;
|
|
51
|
-
}>;
|
|
52
|
-
};
|
|
53
|
-
options: {
|
|
54
|
-
name?: string;
|
|
55
|
-
inheritAttrs?: string;
|
|
56
|
-
};
|
|
57
|
-
cssModules: {
|
|
58
|
-
define: ReturnType<(node: ts.CallExpression) => TextRange & {
|
|
59
|
-
exp: TextRange;
|
|
60
|
-
arg?: TextRange;
|
|
61
|
-
typeArg?: TextRange;
|
|
62
|
-
}>;
|
|
63
|
-
}[];
|
|
64
|
-
defineProp: {
|
|
65
|
-
localName: TextRange | undefined;
|
|
66
|
-
name: TextRange | undefined;
|
|
67
|
-
type: TextRange | undefined;
|
|
68
|
-
modifierType?: TextRange | undefined;
|
|
69
|
-
runtimeType: TextRange | undefined;
|
|
70
|
-
defaultValue: TextRange | undefined;
|
|
71
|
-
required: boolean;
|
|
72
|
-
isModel?: boolean;
|
|
48
|
+
bindings: {
|
|
49
|
+
range: TextRange;
|
|
50
|
+
moduleName?: string;
|
|
51
|
+
isDefaultImport?: boolean;
|
|
52
|
+
isNamespace?: boolean;
|
|
73
53
|
}[];
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
export declare function getStartEnd(ts: typeof import('typescript'), node: ts.Node, sourceFile: ts.SourceFile): {
|
|
86
|
-
start: number;
|
|
87
|
-
end: number;
|
|
54
|
+
defineProp: DefineProp[];
|
|
55
|
+
defineProps: DefineProps | undefined;
|
|
56
|
+
withDefaults: WithDefaults | undefined;
|
|
57
|
+
defineEmits: DefineEmits | undefined;
|
|
58
|
+
defineSlots: DefineSlots | undefined;
|
|
59
|
+
defineExpose: CallExpressionRange | undefined;
|
|
60
|
+
defineOptions: DefineOptions | undefined;
|
|
61
|
+
useAttrs: CallExpressionRange[];
|
|
62
|
+
useCssModule: CallExpressionRange[];
|
|
63
|
+
useSlots: CallExpressionRange[];
|
|
64
|
+
useTemplateRef: UseTemplateRef[];
|
|
88
65
|
};
|
|
89
|
-
export declare function
|
|
66
|
+
export declare function parseBindingRanges(ts: typeof import('typescript'), ast: ts.SourceFile): {
|
|
67
|
+
range: TextRange;
|
|
68
|
+
moduleName?: string;
|
|
69
|
+
isDefaultImport?: boolean;
|
|
70
|
+
isNamespace?: boolean;
|
|
71
|
+
}[];
|
|
72
|
+
export declare function findBindingVars(ts: typeof import('typescript'), left: ts.BindingName, ast: ts.SourceFile): TextRange[];
|
|
73
|
+
export declare function getStartEnd(ts: typeof import('typescript'), node: ts.Node, ast: ts.SourceFile): TextRange;
|
|
74
|
+
export declare function getNodeText(ts: typeof import('typescript'), node: ts.Node, ast: ts.SourceFile): string;
|
|
75
|
+
export {};
|