@vue/language-core 1.8.18 → 1.8.20

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.
@@ -5,7 +5,7 @@ import * as muggle from 'muggle-string';
5
5
  import type * as ts from 'typescript/lib/tsserverlibrary';
6
6
  import { Sfc, VueCompilerOptions } from '../types';
7
7
  type Code = Segment<FileRangeCapabilities>;
8
- export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, sourceTemplate: string, sourceLang: string, sfc: Sfc, hasScriptSetupSlots: boolean, slotsAssignName: string | undefined, propsAssignName: string | undefined, codegenStack: boolean): {
8
+ export declare function generate(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, template: NonNullable<Sfc['template']>, shouldGenerateScopedClasses: boolean, stylesScopedClasses: Set<string>, hasScriptSetupSlots: boolean, slotsAssignName: string | undefined, propsAssignName: string | undefined, codegenStack: boolean): {
9
9
  codes: Code[];
10
10
  codeStacks: muggle.StackNode[];
11
11
  formatCodes: Code[];
@@ -13,7 +13,7 @@ export declare function generate(ts: typeof import('typescript/lib/tsserverlibra
13
13
  cssCodes: Code[];
14
14
  cssCodeStacks: muggle.StackNode[];
15
15
  tagNames: Record<string, number[]>;
16
- identifiers: Set<string>;
16
+ accessedGlobalVariables: Set<string>;
17
17
  hasSlot: boolean;
18
18
  };
19
19
  export declare function walkElementNodes(node: CompilerDOM.RootNode | CompilerDOM.TemplateChildNode, cb: (node: CompilerDOM.ElementNode) => void): void;
@@ -84,7 +84,7 @@ const transformContext = {
84
84
  },
85
85
  expressionPlugins: ['typescript'],
86
86
  };
87
- function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourceLang, sfc, hasScriptSetupSlots, slotsAssignName, propsAssignName, codegenStack) {
87
+ function generate(ts, compilerOptions, vueCompilerOptions, template, shouldGenerateScopedClasses, stylesScopedClasses, hasScriptSetupSlots, slotsAssignName, propsAssignName, codegenStack) {
88
88
  const nativeTags = new Set(vueCompilerOptions.nativeTags);
89
89
  const [codes, codeStacks] = codegenStack ? muggle.track([]) : [[], []];
90
90
  const [formatCodes, formatCodeStacks] = codegenStack ? muggle.track([]) : [[], []];
@@ -92,9 +92,9 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
92
92
  const slots = new Map();
93
93
  const slotExps = new Map();
94
94
  const tagNames = collectTagOffsets();
95
- const localVars = {};
95
+ const localVars = new Map();
96
96
  const tempVars = [];
97
- const identifiers = new Set();
97
+ const accessedGlobalVariables = new Set();
98
98
  const scopedClasses = [];
99
99
  const blockConditions = [];
100
100
  const hasSlotElements = new Set();
@@ -104,12 +104,15 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
104
104
  let ignoreStart;
105
105
  let expectedErrorStart;
106
106
  let expectedErrorNode;
107
+ if (slotsAssignName) {
108
+ localVars.set(slotsAssignName, 1);
109
+ }
107
110
  if (propsAssignName) {
108
- localVars[propsAssignName] = 1;
111
+ localVars.set(propsAssignName, 1);
109
112
  }
110
113
  generatePreResolveComponents();
111
- if (sfc.templateAst) {
112
- visitNode(sfc.templateAst, undefined, undefined, undefined);
114
+ if (template.ast) {
115
+ visitNode(template.ast, undefined, undefined, undefined);
113
116
  }
114
117
  generateStyleScopedClasses();
115
118
  if (!hasScriptSetupSlots) {
@@ -124,7 +127,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
124
127
  cssCodes,
125
128
  cssCodeStacks,
126
129
  tagNames,
127
- identifiers,
130
+ accessedGlobalVariables,
128
131
  hasSlot,
129
132
  };
130
133
  function createSlotsTypeCode() {
@@ -151,14 +154,6 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
151
154
  return codes;
152
155
  }
153
156
  function generateStyleScopedClasses() {
154
- const allClasses = new Set();
155
- for (const block of sfc.styles) {
156
- if (block.scoped || vueCompilerOptions.experimentalResolveStyleCssClasses === 'always') {
157
- for (const className of block.classNames) {
158
- allClasses.add(className.text.substring(1));
159
- }
160
- }
161
- }
162
157
  codes.push(`if (typeof __VLS_styleScopedClasses === 'object' && !Array.isArray(__VLS_styleScopedClasses)) {\n`);
163
158
  for (const { className, offset } of scopedClasses) {
164
159
  codes.push(`__VLS_styleScopedClasses[`);
@@ -168,7 +163,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
168
163
  offset,
169
164
  {
170
165
  ...capabilitiesPresets.scopedClassName,
171
- displayWithLink: allClasses.has(className),
166
+ displayWithLink: stylesScopedClasses.has(className),
172
167
  },
173
168
  ]));
174
169
  codes.push(`];\n`);
@@ -205,7 +200,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
205
200
  const names = nativeTags.has(tagName) ? [tagName] : getPossibleOriginalComponentName(tagName);
206
201
  for (const name of names) {
207
202
  for (const tagRange of tagRanges) {
208
- codes.push(nativeTags.has(tagName) ? '({} as __VLS_IntrinsicElements)' : '__VLS_components', ...createPropertyAccessCode([
203
+ codes.push(nativeTags.has(tagName) ? '__VLS_intrinsicElements' : '__VLS_components', ...createPropertyAccessCode([
209
204
  name,
210
205
  'template',
211
206
  tagRange,
@@ -215,6 +210,10 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
215
210
  normalize: tagName === name ? capabilitiesPresets.tagReference.rename.normalize : camelizeComponentName,
216
211
  apply: getTagRenameApply(tagName),
217
212
  },
213
+ ...nativeTags.has(tagName) ? {
214
+ ...capabilitiesPresets.tagHover,
215
+ ...capabilitiesPresets.diagnosticOnly,
216
+ } : {},
218
217
  },
219
218
  ]), ';');
220
219
  }
@@ -247,10 +246,10 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
247
246
  }
248
247
  function collectTagOffsets() {
249
248
  const tagOffsetsMap = {};
250
- if (!sfc.templateAst) {
249
+ if (!template.ast) {
251
250
  return tagOffsetsMap;
252
251
  }
253
- walkElementNodes(sfc.templateAst, node => {
252
+ walkElementNodes(template.ast, node => {
254
253
  if (node.tag === 'slot') {
255
254
  // ignore
256
255
  }
@@ -267,10 +266,10 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
267
266
  else {
268
267
  tagOffsetsMap[node.tag] ??= [];
269
268
  const offsets = tagOffsetsMap[node.tag];
270
- const source = sourceTemplate.substring(node.loc.start.offset);
269
+ const source = template.content.substring(node.loc.start.offset);
271
270
  const startTagOffset = node.loc.start.offset + source.indexOf(node.tag);
272
271
  offsets.push(startTagOffset); // start tag
273
- if (!node.isSelfClosing && sourceLang === 'html') {
272
+ if (!node.isSelfClosing && template.lang === 'html') {
274
273
  const endTagOffset = node.loc.start.offset + node.loc.source.lastIndexOf(node.tag);
275
274
  if (endTagOffset !== startTagOffset) {
276
275
  offsets.push(endTagOffset); // end tag
@@ -387,11 +386,11 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
387
386
  let leftCharacter;
388
387
  let rightCharacter;
389
388
  // fix https://github.com/vuejs/language-tools/issues/1787
390
- while ((leftCharacter = sourceTemplate.substring(start - 1, start)).trim() === '' && leftCharacter.length) {
389
+ while ((leftCharacter = template.content.substring(start - 1, start)).trim() === '' && leftCharacter.length) {
391
390
  start--;
392
391
  content = leftCharacter + content;
393
392
  }
394
- while ((rightCharacter = sourceTemplate.substring(start + content.length, start + content.length + 1)).trim() === '' && rightCharacter.length) {
393
+ while ((rightCharacter = template.content.substring(start + content.length, start + content.length + 1)).trim() === '' && rightCharacter.length) {
395
394
  content = content + rightCharacter;
396
395
  }
397
396
  codes.push(...createInterpolationCode(content, node.content.loc, start, capabilitiesPresets.all, '(', ');\n'));
@@ -456,9 +455,9 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
456
455
  codes.push(`for (const [`);
457
456
  if (leftExpressionRange && leftExpressionText) {
458
457
  const collectAst = createTsAst(node.parseResult, `const [${leftExpressionText}]`);
459
- (0, transform_1.colletVars)(ts, collectAst, forBlockVars);
458
+ (0, transform_1.collectVars)(ts, collectAst, forBlockVars);
460
459
  for (const varName of forBlockVars)
461
- localVars[varName] = (localVars[varName] ?? 0) + 1;
460
+ localVars.set(varName, (localVars.get(varName) ?? 0) + 1);
462
461
  codes.push([leftExpressionText, 'template', leftExpressionRange.start, capabilitiesPresets.all]);
463
462
  formatCodes.push(...createFormatCode(leftExpressionText, leftExpressionRange.start, formatBrackets.normal));
464
463
  }
@@ -477,12 +476,12 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
477
476
  formatCodes.push(...createFormatCode(source.content, source.loc.start.offset, formatBrackets.normal));
478
477
  }
479
478
  for (const varName of forBlockVars)
480
- localVars[varName]--;
479
+ localVars.set(varName, localVars.get(varName) - 1);
481
480
  }
482
481
  function visitElementNode(node, parentEl, componentCtxVar) {
483
482
  codes.push(`{\n`);
484
- const startTagOffset = node.loc.start.offset + sourceTemplate.substring(node.loc.start.offset).indexOf(node.tag);
485
- let endTagOffset = !node.isSelfClosing && sourceLang === 'html' ? node.loc.start.offset + node.loc.source.lastIndexOf(node.tag) : undefined;
483
+ const startTagOffset = node.loc.start.offset + template.content.substring(node.loc.start.offset).indexOf(node.tag);
484
+ let endTagOffset = !node.isSelfClosing && template.lang === 'html' ? node.loc.start.offset + node.loc.source.lastIndexOf(node.tag) : undefined;
486
485
  if (endTagOffset === startTagOffset) {
487
486
  endTagOffset = undefined;
488
487
  }
@@ -516,7 +515,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
516
515
  }
517
516
  const isIntrinsicElement = nativeTags.has(tag) && tagOffsets.length;
518
517
  if (isIntrinsicElement) {
519
- codes.push('const ', var_originalComponent, ` = ({} as __VLS_IntrinsicElements)[`, ...createStringLiteralKeyCode([
518
+ codes.push('const ', var_originalComponent, ` = __VLS_intrinsicElements[`, ...createStringLiteralKeyCode([
520
519
  tag,
521
520
  'template',
522
521
  tagOffsets[0],
@@ -543,34 +542,20 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
543
542
  codes.push(`const ${var_functionalComponent} = __VLS_asFunctionalComponent(`, `${var_originalComponent}, `, `new ${var_originalComponent}({`, ...createPropsCode(node, props, 'extraReferences'), '})', ');\n');
544
543
  }
545
544
  for (const offset of tagOffsets) {
546
- if (isNamespacedTag || dynamicTagExp) {
545
+ if (isNamespacedTag || dynamicTagExp || isIntrinsicElement) {
547
546
  continue;
548
547
  }
549
- else if (isIntrinsicElement) {
550
- codes.push(`({} as __VLS_IntrinsicElements).`);
551
- codes.push([
552
- tag,
553
- 'template',
554
- [offset, offset + tag.length],
555
- {
556
- ...capabilitiesPresets.tagHover,
557
- ...capabilitiesPresets.diagnosticOnly,
558
- },
559
- ], ';\n');
560
- }
561
- else {
562
- const key = toCanonicalComponentName(tag);
563
- codes.push(`({} as { ${key}: typeof ${var_originalComponent} }).`);
564
- codes.push([
565
- key,
566
- 'template',
567
- [offset, offset + tag.length],
568
- {
569
- ...capabilitiesPresets.tagHover,
570
- ...capabilitiesPresets.diagnosticOnly,
571
- },
572
- ], ';\n');
573
- }
548
+ const key = toCanonicalComponentName(tag);
549
+ codes.push(`({} as { ${key}: typeof ${var_originalComponent} }).`);
550
+ codes.push([
551
+ key,
552
+ 'template',
553
+ [offset, offset + tag.length],
554
+ {
555
+ ...capabilitiesPresets.tagHover,
556
+ ...capabilitiesPresets.diagnosticOnly,
557
+ },
558
+ ], ';\n');
574
559
  }
575
560
  if (vueCompilerOptions.strictTemplates) {
576
561
  // with strictTemplates, generate once for props type-checking + instance type
@@ -636,7 +621,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
636
621
  }
637
622
  generateDirectives(node);
638
623
  generateElReferences(node); // <el ref="foo" />
639
- if (sfc.styles.some(s => s.scoped || vueCompilerOptions.experimentalResolveStyleCssClasses === 'always')) {
624
+ if (shouldGenerateScopedClasses) {
640
625
  generateClassScoped(node);
641
626
  }
642
627
  if (componentCtxVar) {
@@ -661,7 +646,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
661
646
  if (slotDir?.exp?.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */) {
662
647
  formatCodes.push(...createFormatCode(slotDir.exp.content, slotDir.exp.loc.start.offset, formatBrackets.params));
663
648
  const slotAst = createTsAst(slotDir, `(${slotDir.exp.content}) => {}`);
664
- (0, transform_1.colletVars)(ts, slotAst, slotBlockVars);
649
+ (0, transform_1.collectVars)(ts, slotAst, slotBlockVars);
665
650
  hasProps = true;
666
651
  if (slotDir.exp.content.indexOf(':') === -1) {
667
652
  codes.push('const [', [
@@ -698,8 +683,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
698
683
  }
699
684
  codes.push(';\n');
700
685
  slotBlockVars.forEach(varName => {
701
- localVars[varName] ??= 0;
702
- localVars[varName]++;
686
+ localVars.set(varName, (localVars.get(varName) ?? 0) + 1);
703
687
  });
704
688
  let prev;
705
689
  for (const childNode of node.children) {
@@ -707,8 +691,9 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
707
691
  prev = childNode;
708
692
  }
709
693
  resolveComment();
694
+ generateAutoImportCompletionCode();
710
695
  slotBlockVars.forEach(varName => {
711
- localVars[varName]--;
696
+ localVars.set(varName, localVars.get(varName) - 1);
712
697
  });
713
698
  let isStatic = true;
714
699
  if (slotDir?.arg?.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */) {
@@ -774,7 +759,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
774
759
  },
775
760
  },
776
761
  },
777
- ]), `) };\n`, `${eventVar} = {\n`);
762
+ ]), `) };\n`, `${eventVar} = { `);
778
763
  if (prop.arg.loc.source.startsWith('[') && prop.arg.loc.source.endsWith(']')) {
779
764
  codes.push('[(', ...createInterpolationCode(prop.arg.loc.source.slice(1, -1), prop.arg.loc, prop.arg.loc.start.offset + 1, capabilitiesPresets.all, '', ''), ')!]');
780
765
  }
@@ -788,7 +773,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
788
773
  }
789
774
  codes.push(`: `);
790
775
  appendExpressionNode(prop);
791
- codes.push(`};\n`);
776
+ codes.push(` };\n`);
792
777
  }
793
778
  else if (prop.type === 7 /* CompilerDOM.NodeTypes.DIRECTIVE */
794
779
  && prop.name === 'on'
@@ -821,14 +806,16 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
821
806
  }
822
807
  let prefix = '(';
823
808
  let suffix = ')';
809
+ let isFirstMapping = true;
824
810
  if (isCompoundExpression) {
825
- prefix = '$event => {\n';
811
+ codes.push('$event => {\n');
812
+ localVars.set('$event', (localVars.get('$event') ?? 0) + 1);
813
+ prefix = '';
814
+ suffix = '';
826
815
  for (const blockCondition of blockConditions) {
827
816
  prefix += `if (!(${blockCondition})) return;\n`;
828
817
  }
829
- suffix = '\n}';
830
818
  }
831
- let isFirstMapping = true;
832
819
  codes.push(...createInterpolationCode(prop.exp.content, prop.exp.loc, prop.exp.loc.start.offset, () => {
833
820
  if (isCompoundExpression && isFirstMapping) {
834
821
  isFirstMapping = false;
@@ -836,6 +823,12 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
836
823
  }
837
824
  return capabilitiesPresets.all;
838
825
  }, prefix, suffix));
826
+ if (isCompoundExpression) {
827
+ localVars.set('$event', localVars.get('$event') - 1);
828
+ codes.push(';\n');
829
+ generateAutoImportCompletionCode();
830
+ codes.push('}\n');
831
+ }
839
832
  formatCodes.push(...createFormatCode(prop.exp.content, prop.exp.loc.start.offset, isCompoundExpression ? formatBrackets.event : formatBrackets.normal));
840
833
  }
841
834
  else {
@@ -1029,7 +1022,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
1029
1022
  && prop.name === 'bind'
1030
1023
  && !prop.arg
1031
1024
  && prop.exp?.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */) {
1032
- codes.push('...', ...createInterpolationCode(prop.exp.content, prop.exp.loc, prop.exp.loc.start.offset, caps_all, '(', ')'), ', ');
1025
+ codes.push(['', 'template', prop.exp.loc.start.offset, capabilitiesPresets.diagnosticOnly], '...', ...createInterpolationCode(prop.exp.content, prop.exp.loc, prop.exp.loc.start.offset, caps_all, '(', ')'), ['', 'template', prop.exp.loc.end.offset, capabilitiesPresets.diagnosticOnly], ', ');
1033
1026
  if (mode === 'normal') {
1034
1027
  formatCodes.push(...createFormatCode(prop.exp.content, prop.exp.loc.start.offset, formatBrackets.normal));
1035
1028
  }
@@ -1092,7 +1085,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
1092
1085
  && prop.name !== 'model'
1093
1086
  && prop.name !== 'bind'
1094
1087
  && (prop.name !== 'scope' && prop.name !== 'data')) {
1095
- identifiers.add((0, shared_1.camelize)('v-' + prop.name));
1088
+ accessedGlobalVariables.add((0, shared_1.camelize)('v-' + prop.name));
1096
1089
  if (prop.arg?.type === 4 /* CompilerDOM.NodeTypes.SIMPLE_EXPRESSION */ && !prop.arg.isStatic) {
1097
1090
  codes.push(...createInterpolationCode(prop.arg.content, prop.arg.loc, prop.arg.loc.start.offset + prop.arg.loc.source.indexOf(prop.arg.content), capabilitiesPresets.all, '(', ')'), ';\n');
1098
1091
  formatCodes.push(...createFormatCode(prop.arg.content, prop.arg.loc.start.offset, formatBrackets.normal));
@@ -1236,7 +1229,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
1236
1229
  else {
1237
1230
  codes.push(...createInterpolationCode(slotNameExpNode.content, slotNameExpNode, undefined, undefined, '(', ')'));
1238
1231
  }
1239
- codes.push(`;\n`);
1232
+ codes.push(` as const;\n`);
1240
1233
  slotExps.set(varSlotExp, {
1241
1234
  varName: varSlot,
1242
1235
  });
@@ -1342,7 +1335,7 @@ function generate(ts, compilerOptions, vueCompilerOptions, sourceTemplate, sourc
1342
1335
  }
1343
1336
  codes.push(addSuffix);
1344
1337
  }
1345
- }, localVars, identifiers, vueCompilerOptions);
1338
+ }, localVars, accessedGlobalVariables, vueCompilerOptions);
1346
1339
  if (start !== undefined) {
1347
1340
  for (const v of vars) {
1348
1341
  v.offset = start + v.offset - prefix.length;
package/out/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export * from './generators/template';
2
2
  export * from './languageModule';
3
3
  export * from './parsers/scriptSetupRanges';
4
4
  export * from './plugins';
5
- export * from './sourceFile';
5
+ export * from './virtualFile/vueFile';
6
6
  export * from './types';
7
7
  export * from './utils/ts';
8
8
  export * from './utils/parseSfc';
package/out/index.js CHANGED
@@ -31,7 +31,7 @@ __exportStar(require("./generators/template"), exports);
31
31
  __exportStar(require("./languageModule"), exports);
32
32
  __exportStar(require("./parsers/scriptSetupRanges"), exports);
33
33
  __exportStar(require("./plugins"), exports);
34
- __exportStar(require("./sourceFile"), exports);
34
+ __exportStar(require("./virtualFile/vueFile"), exports);
35
35
  __exportStar(require("./types"), exports);
36
36
  __exportStar(require("./utils/ts"), exports);
37
37
  __exportStar(require("./utils/parseSfc"), exports);
@@ -1,5 +1,5 @@
1
1
  import type { Language } from '@volar/language-core';
2
- import { VueFile } from './sourceFile';
2
+ import { VueFile } from './virtualFile/vueFile';
3
3
  import { VueCompilerOptions } from './types';
4
4
  import type * as ts from 'typescript/lib/tsserverlibrary';
5
5
  export declare function createVueLanguage(ts: typeof import('typescript/lib/tsserverlibrary'), compilerOptions?: ts.CompilerOptions, _vueCompilerOptions?: Partial<VueCompilerOptions>, codegenStack?: boolean): Language<VueFile>;
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.createLanguages = exports.createVueLanguage = void 0;
27
27
  const path_1 = require("path");
28
28
  const plugins_1 = require("./plugins");
29
- const sourceFile_1 = require("./sourceFile");
29
+ const vueFile_1 = require("./virtualFile/vueFile");
30
30
  const sharedTypes = __importStar(require("./utils/globalTypes"));
31
31
  const ts_1 = require("./utils/ts");
32
32
  const fileRegistries = [];
@@ -73,7 +73,7 @@ function createVueLanguage(ts, compilerOptions = {}, _vueCompilerOptions = {}, c
73
73
  reusedVueFile.update(snapshot);
74
74
  return reusedVueFile;
75
75
  }
76
- const vueFile = new sourceFile_1.VueFile(fileName, snapshot, vueCompilerOptions, plugins, ts, codegenStack);
76
+ const vueFile = new vueFile_1.VueFile(fileName, snapshot, vueCompilerOptions, plugins, ts, codegenStack);
77
77
  fileRegistry.set(fileName, vueFile);
78
78
  return vueFile;
79
79
  }
@@ -4,7 +4,7 @@ exports.parseScriptRanges = void 0;
4
4
  const scriptSetupRanges_1 = require("./scriptSetupRanges");
5
5
  function parseScriptRanges(ts, ast, hasScriptSetup, withNode) {
6
6
  let exportDefault;
7
- const bindings = hasScriptSetup ? (0, scriptSetupRanges_1.parseBindingRanges)(ts, ast, false) : [];
7
+ const bindings = hasScriptSetup ? (0, scriptSetupRanges_1.parseBindingRanges)(ts, ast) : [];
8
8
  ast.forEachChild(raw => {
9
9
  if (ts.isExportAssignment(raw)) {
10
10
  let node = raw;
@@ -6,19 +6,32 @@ export declare function parseScriptSetupRanges(ts: typeof import('typescript/lib
6
6
  leadingCommentEndOffset: number;
7
7
  importSectionEndOffset: number;
8
8
  bindings: TextRange[];
9
- withDefaultsArg: TextRange | undefined;
10
- withDefaults: TextRange | undefined;
11
- defineProps: TextRange | undefined;
12
- defineSlots: TextRange | undefined;
13
- defineEmits: TextRange | undefined;
14
- defineExpose: TextRange | undefined;
15
- propsAssignName: string | undefined;
16
- propsRuntimeArg: TextRange | undefined;
17
- propsTypeArg: TextRange | undefined;
18
- slotsAssignName: string | undefined;
19
- emitsAssignName: string | undefined;
20
- exposeRuntimeArg: TextRange | undefined;
21
- exposeTypeArg: TextRange | undefined;
9
+ props: {
10
+ name?: string | undefined;
11
+ define?: (TextRange & {
12
+ statement: TextRange;
13
+ arg?: TextRange | undefined;
14
+ typeArg?: TextRange | undefined;
15
+ }) | undefined;
16
+ withDefaults?: (TextRange & {
17
+ arg?: TextRange | undefined;
18
+ }) | undefined;
19
+ };
20
+ slots: {
21
+ name?: string | undefined;
22
+ define?: TextRange | undefined;
23
+ };
24
+ emits: {
25
+ name?: string | undefined;
26
+ define?: TextRange | undefined;
27
+ };
28
+ expose: {
29
+ name?: string | undefined;
30
+ define?: (TextRange & {
31
+ arg?: TextRange | undefined;
32
+ typeArg?: TextRange | undefined;
33
+ }) | undefined;
34
+ };
22
35
  defineProp: {
23
36
  name: TextRange | undefined;
24
37
  nameIsString: boolean;
@@ -27,7 +40,7 @@ export declare function parseScriptSetupRanges(ts: typeof import('typescript/lib
27
40
  required: boolean;
28
41
  }[];
29
42
  };
30
- export declare function parseBindingRanges(ts: typeof import('typescript/lib/tsserverlibrary'), sourceFile: ts.SourceFile, isType: boolean): TextRange[];
43
+ export declare function parseBindingRanges(ts: typeof import('typescript/lib/tsserverlibrary'), sourceFile: ts.SourceFile): TextRange[];
31
44
  export declare function findBindingVars(ts: typeof import('typescript/lib/tsserverlibrary'), left: ts.BindingName, sourceFile: ts.SourceFile): TextRange[];
32
45
  export declare function getStartEnd(node: ts.Node, sourceFile: ts.SourceFile): {
33
46
  start: number;