@vue/language-core 1.7.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/out/generators/script.d.ts +14 -0
  3. package/out/generators/script.js +881 -0
  4. package/out/generators/template.d.ts +16 -0
  5. package/out/generators/template.js +1389 -0
  6. package/out/index.d.ts +12 -0
  7. package/out/index.js +30 -0
  8. package/out/languageModule.d.ts +5 -0
  9. package/out/languageModule.js +91 -0
  10. package/out/parsers/scriptRanges.d.ts +15 -0
  11. package/out/parsers/scriptRanges.js +58 -0
  12. package/out/parsers/scriptSetupRanges.d.ts +32 -0
  13. package/out/parsers/scriptSetupRanges.js +295 -0
  14. package/out/plugins/file-html.d.ts +3 -0
  15. package/out/plugins/file-html.js +80 -0
  16. package/out/plugins/file-md.d.ts +3 -0
  17. package/out/plugins/file-md.js +62 -0
  18. package/out/plugins/file-vue.d.ts +3 -0
  19. package/out/plugins/file-vue.js +39 -0
  20. package/out/plugins/vue-sfc-customblocks.d.ts +3 -0
  21. package/out/plugins/vue-sfc-customblocks.js +31 -0
  22. package/out/plugins/vue-sfc-scripts.d.ts +3 -0
  23. package/out/plugins/vue-sfc-scripts.js +39 -0
  24. package/out/plugins/vue-sfc-styles.d.ts +3 -0
  25. package/out/plugins/vue-sfc-styles.js +31 -0
  26. package/out/plugins/vue-sfc-template.d.ts +3 -0
  27. package/out/plugins/vue-sfc-template.js +27 -0
  28. package/out/plugins/vue-template-html.d.ts +3 -0
  29. package/out/plugins/vue-template-html.js +165 -0
  30. package/out/plugins/vue-tsx.d.ts +14 -0
  31. package/out/plugins/vue-tsx.js +158 -0
  32. package/out/plugins.d.ts +23 -0
  33. package/out/plugins.js +52 -0
  34. package/out/sourceFile.d.ts +71 -0
  35. package/out/sourceFile.js +528 -0
  36. package/out/types.d.ts +100 -0
  37. package/out/types.js +3 -0
  38. package/out/utils/directorySharedTypes.d.ts +6 -0
  39. package/out/utils/directorySharedTypes.js +169 -0
  40. package/out/utils/parseCssClassNames.d.ts +4 -0
  41. package/out/utils/parseCssClassNames.js +19 -0
  42. package/out/utils/parseCssVars.d.ts +5 -0
  43. package/out/utils/parseCssVars.js +26 -0
  44. package/out/utils/parseSfc.d.ts +2 -0
  45. package/out/utils/parseSfc.js +135 -0
  46. package/out/utils/shared.d.ts +1 -0
  47. package/out/utils/shared.js +8 -0
  48. package/out/utils/transform.d.ts +8 -0
  49. package/out/utils/transform.js +182 -0
  50. package/out/utils/ts.d.ts +8 -0
  51. package/out/utils/ts.js +196 -0
  52. package/out/utils/vue2TemplateCompiler.d.ts +3 -0
  53. package/out/utils/vue2TemplateCompiler.js +101 -0
  54. package/package.json +29 -0
package/out/types.d.ts ADDED
@@ -0,0 +1,100 @@
1
+ import * as embedded from '@volar/language-core';
2
+ import { SFCParseResult } from '@vue/compiler-sfc';
3
+ import * as CompilerDom from '@vue/compiler-dom';
4
+ import type * as ts from 'typescript/lib/tsserverlibrary';
5
+ import { VueEmbeddedFile } from './sourceFile';
6
+ export type { SFCParseResult } from '@vue/compiler-sfc';
7
+ export interface VueLanguageServiceHost extends embedded.LanguageServiceHost {
8
+ getVueCompilationSettings(): VueCompilerOptions | undefined;
9
+ }
10
+ export type RawVueCompilerOptions = Partial<Omit<VueCompilerOptions, 'target' | 'plugins'>> & {
11
+ target?: 'auto' | 2 | 2.7 | 3 | 3.3;
12
+ plugins?: string[];
13
+ };
14
+ export interface VueCompilerOptions {
15
+ target: number;
16
+ lib: string;
17
+ extensions: string[];
18
+ jsxSlots: boolean;
19
+ strictTemplates: boolean;
20
+ skipTemplateCodegen: boolean;
21
+ dataAttributes: string[];
22
+ htmlAttributes: string[];
23
+ optionsWrapper: [string, string] | [];
24
+ macros: {
25
+ defineProps: string[];
26
+ defineSlots: string[];
27
+ defineEmits: string[];
28
+ defineExpose: string[];
29
+ withDefaults: string[];
30
+ };
31
+ plugins: VueLanguagePlugin[];
32
+ hooks: string[];
33
+ experimentalDefinePropProposal: 'kevinEdition' | 'johnsonEdition' | false;
34
+ experimentalResolveStyleCssClasses: 'scoped' | 'always' | 'never';
35
+ experimentalModelPropName: Record<string, Record<string, boolean | Record<string, string> | Record<string, string>[]>>;
36
+ experimentalUseElementAccessInTemplate: boolean;
37
+ experimentalAdditionalLanguageModules: string[];
38
+ }
39
+ export type VueLanguagePlugin = (ctx: {
40
+ modules: {
41
+ typescript: typeof import('typescript/lib/tsserverlibrary');
42
+ '@vue/compiler-dom': typeof import('@vue/compiler-dom');
43
+ };
44
+ compilerOptions: ts.CompilerOptions;
45
+ vueCompilerOptions: VueCompilerOptions;
46
+ }) => {
47
+ version: 1;
48
+ name?: string;
49
+ order?: number;
50
+ parseSFC?(fileName: string, content: string): SFCParseResult | undefined;
51
+ updateSFC?(oldResult: SFCParseResult, textChange: {
52
+ start: number;
53
+ end: number;
54
+ newText: string;
55
+ }): SFCParseResult | undefined;
56
+ resolveTemplateCompilerOptions?(options: CompilerDom.CompilerOptions): CompilerDom.CompilerOptions;
57
+ compileSFCTemplate?(lang: string, template: string, options: CompilerDom.CompilerOptions): CompilerDom.CodegenResult | undefined;
58
+ updateSFCTemplate?(oldResult: CompilerDom.CodegenResult, textChange: {
59
+ start: number;
60
+ end: number;
61
+ newText: string;
62
+ }): CompilerDom.CodegenResult | undefined;
63
+ getEmbeddedFileNames?(fileName: string, sfc: Sfc): string[];
64
+ resolveEmbeddedFile?(fileName: string, sfc: Sfc, embeddedFile: VueEmbeddedFile): void;
65
+ };
66
+ export interface SfcBlock {
67
+ name: string;
68
+ start: number;
69
+ end: number;
70
+ startTagEnd: number;
71
+ endTagStart: number;
72
+ lang: string;
73
+ content: string;
74
+ attrs: Record<string, string | true>;
75
+ }
76
+ export interface Sfc {
77
+ template: SfcBlock | null;
78
+ script: (SfcBlock & {
79
+ src: string | undefined;
80
+ srcOffset: number;
81
+ }) | null;
82
+ scriptSetup: SfcBlock & {
83
+ generic: string | undefined;
84
+ genericOffset: number;
85
+ } | null;
86
+ styles: (SfcBlock & {
87
+ module: string | undefined;
88
+ scoped: boolean;
89
+ })[];
90
+ customBlocks: (SfcBlock & {
91
+ type: string;
92
+ })[];
93
+ templateAst: CompilerDom.RootNode | undefined;
94
+ scriptAst: ts.SourceFile | undefined;
95
+ scriptSetupAst: ts.SourceFile | undefined;
96
+ }
97
+ export interface TextRange {
98
+ start: number;
99
+ end: number;
100
+ }
package/out/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,6 @@
1
+ import { VueCompilerOptions } from '../types';
2
+ import type * as ts from 'typescript/lib/tsserverlibrary';
3
+ export declare const baseName = "__VLS_types.d.ts";
4
+ export declare function getImportName(compilerOptions: ts.CompilerOptions): "./__VLS_types" | "./__VLS_types.js";
5
+ export declare function getTypesCode(vueCompilerOptions: VueCompilerOptions): string;
6
+ export declare function genConstructorOverloads(name?: string, nums?: number): string;
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.genConstructorOverloads = exports.getTypesCode = exports.getImportName = exports.baseName = void 0;
4
+ const shared_1 = require("./shared");
5
+ exports.baseName = '__VLS_types.d.ts';
6
+ function getImportName(compilerOptions) {
7
+ if (!compilerOptions.module || compilerOptions.module === 1) {
8
+ return './__VLS_types';
9
+ }
10
+ return './__VLS_types.js';
11
+ }
12
+ exports.getImportName = getImportName;
13
+ ;
14
+ function getTypesCode(vueCompilerOptions) {
15
+ return `
16
+ // @ts-nocheck
17
+ import type {
18
+ ObjectDirective,
19
+ FunctionDirective,
20
+ VNode,
21
+ } from '${vueCompilerOptions.lib}';
22
+
23
+ export type IntrinsicElements = PickNotAny<import('vue/jsx-runtime').JSX.IntrinsicElements, PickNotAny<JSX.IntrinsicElements, Record<string, any>>>;
24
+ export type Element = PickNotAny<import('vue/jsx-runtime').JSX.Element, JSX.Element>;
25
+
26
+ type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
27
+ export type PickNotAny<A, B> = IsAny<A> extends true ? B : A;
28
+
29
+ export type Prettify<T> = {
30
+ [K in keyof T]: T[K];
31
+ } & {};
32
+
33
+ export type GlobalComponents =
34
+ // @ts-ignore
35
+ PickNotAny<import('vue').GlobalComponents, {}>
36
+ // @ts-ignore
37
+ & PickNotAny<import('@vue/runtime-core').GlobalComponents, {}>
38
+ // @ts-ignore
39
+ & PickNotAny<import('@vue/runtime-dom').GlobalComponents, {}>
40
+ & Pick<typeof import('${vueCompilerOptions.lib}'),
41
+ // @ts-ignore
42
+ 'Transition'
43
+ | 'TransitionGroup'
44
+ | 'KeepAlive'
45
+ | 'Suspense'
46
+ | 'Teleport'
47
+ >;
48
+
49
+ // v-for
50
+ export declare function getVForSourceType(source: number): [number, number, number][];
51
+ export declare function getVForSourceType(source: string): [string, number, number][];
52
+ export declare function getVForSourceType<T extends any[]>(source: T): [
53
+ T[number], // item
54
+ number, // key
55
+ number, // index
56
+ ][];
57
+ export declare function getVForSourceType<T extends { [Symbol.iterator](): Iterator<any> }>(source: T): [
58
+ T extends { [Symbol.iterator](): Iterator<infer T1> } ? T1 : never, // item
59
+ number, // key
60
+ undefined, // index
61
+ ][];
62
+ export declare function getVForSourceType<T>(source: T): [
63
+ T[keyof T], // item
64
+ keyof T, // key
65
+ number, // index
66
+ ][];
67
+
68
+ export declare function getSlotParams<T>(slot: T): Parameters<PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
69
+ export declare function getSlotParam<T>(slot: T): Parameters<PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
70
+ export declare function directiveFunction<T>(dir: T):
71
+ T extends ObjectDirective<infer E, infer V> | FunctionDirective<infer E, infer V> ? (el: E, value: V) => void
72
+ : T;
73
+ export declare function withScope<T, K>(ctx: T, scope: K): ctx is T & K;
74
+ export declare function makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
75
+
76
+ export type SelfComponent<N, C> = string extends N ? {} : N extends string ? { [P in N]: C } : {};
77
+ export type WithComponent<N0 extends string, Components, N1 extends string, N2 extends string, N3 extends string> =
78
+ IsAny<IntrinsicElements[N0]> extends true ? (
79
+ N1 extends keyof Components ? N1 extends N0 ? Pick<Components, N0> : { [K in N0]: Components[N1] } :
80
+ N2 extends keyof Components ? N2 extends N0 ? Pick<Components, N0> : { [K in N0]: Components[N2] } :
81
+ N3 extends keyof Components ? N3 extends N0 ? Pick<Components, N0> : { [K in N0]: Components[N3] } :
82
+ ${vueCompilerOptions.strictTemplates ? '{}' : '{ [K in N0]: any }'}
83
+ ) : Pick<IntrinsicElements, N0>;
84
+
85
+ export type FillingEventArg_ParametersLength<E extends (...args: any) => any> = IsAny<Parameters<E>> extends true ? -1 : Parameters<E>['length'];
86
+ export type FillingEventArg<E> = E extends (...args: any) => any ? FillingEventArg_ParametersLength<E> extends 0 ? ($event?: undefined) => ReturnType<E> : E : E;
87
+ export type EmitEvent<F, E> =
88
+ F extends {
89
+ (event: E, ...payload: infer P): any
90
+ } ? (...payload: P) => void
91
+ : F extends {
92
+ (event: E, ...payload: infer P): any
93
+ (...args: any): any
94
+ } ? (...payload: P) => void
95
+ : F extends {
96
+ (event: E, ...payload: infer P): any
97
+ (...args: any): any
98
+ (...args: any): any
99
+ } ? (...payload: P) => void
100
+ : F extends {
101
+ (event: E, ...payload: infer P): any
102
+ (...args: any): any
103
+ (...args: any): any
104
+ (...args: any): any
105
+ } ? (...payload: P) => void
106
+ : unknown | '[Type Warning] Volar could not infer $emit event more than 4 overloads without DefineComponent. see https://github.com/vuejs/language-tools/issues/60';
107
+ export declare function asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
108
+ T extends new (...args: any) => any
109
+ ? (props: (K extends { $props: infer Props } ? Props : any)${vueCompilerOptions.strictTemplates ? '' : ' & Record<string, unknown>'}, ctx?: {
110
+ attrs?: any,
111
+ slots?: K extends { ${(0, shared_1.getSlotsPropertyName)(vueCompilerOptions.target)}: infer Slots } ? Slots : any,
112
+ emit?: K extends { $emit: infer Emit } ? Emit : any
113
+ }) => JSX.Element & { __ctx?: typeof ctx & { props?: typeof props; expose?(exposed: K): void; } }
114
+ : T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
115
+ : T extends (...args: any) => any ? T
116
+ : (_: T extends VNode | VNode[] | string ? {}: T & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: unknown, expose?: unknown, slots?: unknown, emit?: unknown, props?: T & Record<string, unknown> } }; // IntrinsicElement
117
+ declare function functionalComponentArgsRest<T extends (...args: any) => any>(t: T): Parameters<T>['length'] extends 2 ? [any] : [];
118
+ export declare function pickEvent<Emit, K, E>(emit: Emit, emitKey: K, event: E): FillingEventArg<
119
+ PickNotAny<
120
+ AsFunctionOrAny<E>,
121
+ AsFunctionOrAny<EmitEvent<Emit, K>>
122
+ >
123
+ >;
124
+ export declare function pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): PickNotAny<
125
+ K extends { __ctx?: infer Ctx } ? Ctx : any,
126
+ T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
127
+ >;
128
+ type AsFunctionOrAny<F> = unknown extends F ? any : ((...args: any) => any) extends F ? F : any;
129
+
130
+ export declare function componentProps<T, K>(comp: T, fnReturn: K):
131
+ PickNotAny<K, {}> extends { __ctx: { props: infer P } } ? NonNullable<P>
132
+ : T extends (props: infer P, ...args: any) => any ? NonNullable<P> :
133
+ {};
134
+ `.trim();
135
+ }
136
+ exports.getTypesCode = getTypesCode;
137
+ // TODO: not working for overloads > n (n = 8)
138
+ // see: https://github.com/vuejs/language-tools/issues/60
139
+ function genConstructorOverloads(name = 'ConstructorOverloads', nums) {
140
+ let code = '';
141
+ code += `type ${name}<T> =\n`;
142
+ if (nums === undefined) {
143
+ for (let i = 8; i >= 1; i--) {
144
+ gen(i);
145
+ }
146
+ }
147
+ else if (nums > 0) {
148
+ gen(nums);
149
+ }
150
+ code += `// 0\n`;
151
+ code += `{};\n`;
152
+ return code;
153
+ function gen(i) {
154
+ code += `// ${i}\n`;
155
+ code += `T extends {\n`;
156
+ for (let j = 1; j <= i; j++) {
157
+ code += `(event: infer E${j}, ...payload: infer P${j}): void;\n`;
158
+ }
159
+ code += `} ? (\n`;
160
+ for (let j = 1; j <= i; j++) {
161
+ if (j > 1)
162
+ code += '& ';
163
+ code += `(E${j} extends string ? { [K${j} in E${j}]: (...payload: P${j}) => void } : {})\n`;
164
+ }
165
+ code += `) :\n`;
166
+ }
167
+ }
168
+ exports.genConstructorOverloads = genConstructorOverloads;
169
+ //# sourceMappingURL=directorySharedTypes.js.map
@@ -0,0 +1,4 @@
1
+ export declare function parseCssClassNames(styleContent: string): Generator<{
2
+ start: number;
3
+ end: number;
4
+ }, void, unknown>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseCssClassNames = void 0;
4
+ const parseCssVars_1 = require("./parseCssVars");
5
+ function* parseCssClassNames(styleContent) {
6
+ styleContent = (0, parseCssVars_1.clearComments)(styleContent);
7
+ const cssClassNameRegex = /(?=([\.]{1}[a-zA-Z_]+[\w\_\-]*)[\s\.\+\{\>#\:]{1})/g;
8
+ const matchs = styleContent.matchAll(cssClassNameRegex);
9
+ for (const match of matchs) {
10
+ if (match.index !== undefined) {
11
+ const matchText = match[1];
12
+ if (matchText !== undefined) {
13
+ yield { start: match.index, end: match.index + matchText.length };
14
+ }
15
+ }
16
+ }
17
+ }
18
+ exports.parseCssClassNames = parseCssClassNames;
19
+ //# sourceMappingURL=parseCssClassNames.js.map
@@ -0,0 +1,5 @@
1
+ export declare function parseCssVars(styleContent: string): Generator<{
2
+ start: number;
3
+ end: number;
4
+ }, void, unknown>;
5
+ export declare function clearComments(css: string): string;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.clearComments = exports.parseCssVars = void 0;
4
+ // https://github.com/vuejs/core/blob/main/packages/compiler-sfc/src/cssVars.ts#L47-L61
5
+ function* parseCssVars(styleContent) {
6
+ styleContent = clearComments(styleContent);
7
+ const reg = /\bv-bind\(\s*(?:'([^']+)'|"([^"]+)"|([^'"][^)]*))\s*\)/g;
8
+ const matchs = styleContent.matchAll(reg);
9
+ for (const match of matchs) {
10
+ if (match.index !== undefined) {
11
+ const matchText = match[1] ?? match[2] ?? match[3];
12
+ if (matchText !== undefined) {
13
+ const offset = match.index + styleContent.slice(match.index).indexOf(matchText);
14
+ yield { start: offset, end: offset + matchText.length };
15
+ }
16
+ }
17
+ }
18
+ }
19
+ exports.parseCssVars = parseCssVars;
20
+ function clearComments(css) {
21
+ return css
22
+ .replace(/\/\*([\s\S]*?)\*\//g, match => `/*${' '.repeat(match.length - 4)}*/`)
23
+ .replace(/\/\/([\s\S]*?)\n/g, match => `//${' '.repeat(match.length - 3)}\n`);
24
+ }
25
+ exports.clearComments = clearComments;
26
+ //# sourceMappingURL=parseCssVars.js.map
@@ -0,0 +1,2 @@
1
+ import type { SFCParseResult } from '@vue/compiler-sfc';
2
+ export declare function parse(source: string): SFCParseResult;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parse = void 0;
4
+ const compiler = require("@vue/compiler-dom");
5
+ function parse(source) {
6
+ const errors = [];
7
+ const ast = compiler.parse(source, {
8
+ // there are no components at SFC parsing level
9
+ isNativeTag: () => true,
10
+ // preserve all whitespaces
11
+ isPreTag: () => true,
12
+ getTextMode: ({ tag, props }, parent) => {
13
+ if ((!parent && tag !== 'template')
14
+ || (tag === 'template'
15
+ && props.some(p => p.type === 6 /* compiler.NodeTypes.ATTRIBUTE */ &&
16
+ p.name === 'lang' &&
17
+ p.value &&
18
+ p.value.content &&
19
+ p.value.content !== 'html'))) {
20
+ return 2 /* compiler.TextModes.RAWTEXT */;
21
+ }
22
+ else {
23
+ return 0 /* compiler.TextModes.DATA */;
24
+ }
25
+ },
26
+ onError: e => {
27
+ errors.push(e);
28
+ },
29
+ comments: true,
30
+ });
31
+ const descriptor = {
32
+ filename: 'anonymous.vue',
33
+ source,
34
+ template: null,
35
+ script: null,
36
+ scriptSetup: null,
37
+ styles: [],
38
+ customBlocks: [],
39
+ cssVars: [],
40
+ slotted: false,
41
+ shouldForceReload: () => false,
42
+ };
43
+ ast.children.forEach(node => {
44
+ if (node.type !== 1 /* compiler.NodeTypes.ELEMENT */) {
45
+ return;
46
+ }
47
+ switch (node.tag) {
48
+ case 'template':
49
+ const templateBlock = (descriptor.template = createBlock(node, source));
50
+ templateBlock.ast = node;
51
+ break;
52
+ case 'script':
53
+ const scriptBlock = createBlock(node, source);
54
+ const isSetup = !!scriptBlock.attrs.setup;
55
+ if (isSetup && !descriptor.scriptSetup) {
56
+ descriptor.scriptSetup = scriptBlock;
57
+ break;
58
+ }
59
+ if (!isSetup && !descriptor.script) {
60
+ descriptor.script = scriptBlock;
61
+ break;
62
+ }
63
+ break;
64
+ case 'style':
65
+ const styleBlock = createBlock(node, source);
66
+ descriptor.styles.push(styleBlock);
67
+ break;
68
+ default:
69
+ descriptor.customBlocks.push(createBlock(node, source));
70
+ break;
71
+ }
72
+ });
73
+ return {
74
+ descriptor,
75
+ errors,
76
+ };
77
+ }
78
+ exports.parse = parse;
79
+ function createBlock(node, source) {
80
+ const type = node.tag;
81
+ let { start, end } = node.loc;
82
+ let content = '';
83
+ if (node.children.length) {
84
+ start = node.children[0].loc.start;
85
+ end = node.children[node.children.length - 1].loc.end;
86
+ content = source.slice(start.offset, end.offset);
87
+ }
88
+ else {
89
+ const offset = node.loc.source.indexOf(`</`);
90
+ if (offset > -1) {
91
+ start = {
92
+ line: start.line,
93
+ column: start.column + offset,
94
+ offset: start.offset + offset
95
+ };
96
+ }
97
+ end = Object.assign({}, start);
98
+ }
99
+ const loc = {
100
+ source: content,
101
+ start,
102
+ end
103
+ };
104
+ const attrs = {};
105
+ const block = {
106
+ type,
107
+ content,
108
+ loc,
109
+ attrs
110
+ };
111
+ node.props.forEach(p => {
112
+ if (p.type === 6 /* compiler.NodeTypes.ATTRIBUTE */) {
113
+ attrs[p.name] = p.value ? p.value.content || true : true;
114
+ if (p.name === 'lang') {
115
+ block.lang = p.value && p.value.content;
116
+ }
117
+ else if (p.name === 'src') {
118
+ block.src = p.value && p.value.content;
119
+ }
120
+ else if (type === 'style') {
121
+ if (p.name === 'scoped') {
122
+ block.scoped = true;
123
+ }
124
+ else if (p.name === 'module') {
125
+ block.module = attrs[p.name];
126
+ }
127
+ }
128
+ else if (type === 'script' && p.name === 'setup') {
129
+ block.setup = attrs.setup;
130
+ }
131
+ }
132
+ });
133
+ return block;
134
+ }
135
+ //# sourceMappingURL=parseSfc.js.map
@@ -0,0 +1 @@
1
+ export declare function getSlotsPropertyName(vueVersion: number): "$scopedSlots" | "$slots";
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSlotsPropertyName = void 0;
4
+ function getSlotsPropertyName(vueVersion) {
5
+ return vueVersion < 3 ? '$scopedSlots' : '$slots';
6
+ }
7
+ exports.getSlotsPropertyName = getSlotsPropertyName;
8
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1,8 @@
1
+ import type * as ts from 'typescript/lib/tsserverlibrary';
2
+ import { VueCompilerOptions } from '../types';
3
+ export declare function walkInterpolationFragment(ts: typeof import('typescript/lib/tsserverlibrary'), code: string, ast: ts.SourceFile, cb: (fragment: string, offset: number | undefined, isJustForErrorMapping?: boolean) => void, localVars: Record<string, number>, identifiers: Set<string>, vueOptions: VueCompilerOptions): {
4
+ text: string;
5
+ isShorthand: boolean;
6
+ offset: number;
7
+ }[];
8
+ export declare function colletVars(ts: typeof import('typescript/lib/tsserverlibrary'), node: ts.Node, result: string[]): void;