@vue/language-core 3.1.5 → 3.1.6

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 (100) hide show
  1. package/index.d.ts +2 -1
  2. package/index.js +3 -2
  3. package/lib/codegen/codeFeatures.d.ts +5 -9
  4. package/lib/codegen/codeFeatures.js +5 -5
  5. package/lib/codegen/globalTypes.js +12 -18
  6. package/lib/codegen/localTypes.d.ts +1 -1
  7. package/lib/codegen/localTypes.js +6 -6
  8. package/lib/codegen/names.d.ts +30 -0
  9. package/lib/codegen/names.js +34 -0
  10. package/lib/codegen/script/component.js +45 -54
  11. package/lib/codegen/script/context.d.ts +2 -5
  12. package/lib/codegen/script/context.js +1 -7
  13. package/lib/codegen/script/index.d.ts +10 -12
  14. package/lib/codegen/script/index.js +74 -73
  15. package/lib/codegen/script/scriptSetup.d.ts +3 -2
  16. package/lib/codegen/script/scriptSetup.js +209 -283
  17. package/lib/codegen/script/src.js +9 -3
  18. package/lib/codegen/script/template.js +64 -108
  19. package/lib/codegen/style/common.d.ts +3 -0
  20. package/lib/codegen/style/common.js +43 -0
  21. package/lib/codegen/style/index.d.ts +63 -0
  22. package/lib/codegen/style/index.js +38 -0
  23. package/lib/codegen/style/modules.d.ts +3 -2
  24. package/lib/codegen/style/modules.js +12 -11
  25. package/lib/codegen/style/scopedClasses.d.ts +2 -3
  26. package/lib/codegen/style/scopedClasses.js +23 -21
  27. package/lib/codegen/template/context.d.ts +7 -16
  28. package/lib/codegen/template/context.js +81 -93
  29. package/lib/codegen/template/element.js +151 -55
  30. package/lib/codegen/template/elementDirectives.js +32 -12
  31. package/lib/codegen/template/elementEvents.js +27 -28
  32. package/lib/codegen/template/elementProps.d.ts +2 -2
  33. package/lib/codegen/template/elementProps.js +49 -23
  34. package/lib/codegen/template/index.d.ts +8 -19
  35. package/lib/codegen/template/index.js +85 -80
  36. package/lib/codegen/template/interpolation.d.ts +3 -3
  37. package/lib/codegen/template/interpolation.js +90 -136
  38. package/lib/codegen/template/objectProperty.js +8 -4
  39. package/lib/codegen/template/propertyAccess.d.ts +1 -1
  40. package/lib/codegen/template/propertyAccess.js +5 -7
  41. package/lib/codegen/template/slotOutlet.js +25 -8
  42. package/lib/codegen/template/styleScopedClasses.d.ts +3 -6
  43. package/lib/codegen/template/styleScopedClasses.js +23 -149
  44. package/lib/codegen/template/templateChild.d.ts +0 -1
  45. package/lib/codegen/template/templateChild.js +11 -68
  46. package/lib/codegen/template/vFor.js +10 -13
  47. package/lib/codegen/template/vIf.js +5 -3
  48. package/lib/codegen/template/vSlot.js +20 -15
  49. package/lib/codegen/utils/boundary.d.ts +3 -0
  50. package/lib/codegen/utils/boundary.js +13 -0
  51. package/lib/codegen/utils/camelized.js +3 -3
  52. package/lib/codegen/utils/escaped.js +4 -2
  53. package/lib/codegen/utils/index.d.ts +3 -4
  54. package/lib/codegen/utils/index.js +42 -16
  55. package/lib/codegen/utils/merge.d.ts +2 -2
  56. package/lib/codegen/utils/merge.js +9 -9
  57. package/lib/codegen/utils/stringLiteralKey.js +6 -3
  58. package/lib/codegen/utils/transform.d.ts +8 -0
  59. package/lib/codegen/utils/transform.js +27 -0
  60. package/lib/codegen/utils/unicode.js +4 -2
  61. package/lib/compilerOptions.d.ts +5 -2
  62. package/lib/compilerOptions.js +67 -44
  63. package/lib/languagePlugin.d.ts +1 -1
  64. package/lib/languagePlugin.js +2 -2
  65. package/lib/plugins/vue-template-inline-css.js +2 -6
  66. package/lib/plugins/vue-template-inline-ts.js +12 -14
  67. package/lib/plugins/vue-tsx.d.ts +11 -20
  68. package/lib/plugins/vue-tsx.js +121 -68
  69. package/lib/plugins.js +1 -1
  70. package/lib/types.d.ts +5 -4
  71. package/lib/utils/parseSfc.js +7 -3
  72. package/lib/utils/shared.d.ts +1 -1
  73. package/lib/utils/shared.js +7 -6
  74. package/lib/utils/signals.d.ts +2 -2
  75. package/lib/utils/signals.js +8 -6
  76. package/lib/virtualCode/embeddedCodes.d.ts +12 -0
  77. package/lib/virtualCode/embeddedCodes.js +249 -0
  78. package/lib/{virtualFile/vueFile.d.ts → virtualCode/index.d.ts} +9 -9
  79. package/lib/virtualCode/index.js +81 -0
  80. package/lib/virtualCode/ir.d.ts +4 -0
  81. package/lib/{virtualFile/computedSfc.js → virtualCode/ir.js} +59 -94
  82. package/lib/virtualCode/normalize.d.ts +2 -0
  83. package/lib/virtualCode/normalize.js +170 -0
  84. package/package.json +4 -4
  85. package/lib/codegen/style/classProperty.d.ts +0 -2
  86. package/lib/codegen/style/classProperty.js +0 -18
  87. package/lib/codegen/style/imports.d.ts +0 -2
  88. package/lib/codegen/style/imports.js +0 -27
  89. package/lib/codegen/template/elementChildren.d.ts +0 -5
  90. package/lib/codegen/template/elementChildren.js +0 -12
  91. package/lib/codegen/utils/wrapWith.d.ts +0 -2
  92. package/lib/codegen/utils/wrapWith.js +0 -15
  93. package/lib/virtualFile/computedEmbeddedCodes.d.ts +0 -4
  94. package/lib/virtualFile/computedEmbeddedCodes.js +0 -262
  95. package/lib/virtualFile/computedSfc.d.ts +0 -6
  96. package/lib/virtualFile/computedVueSfc.d.ts +0 -4
  97. package/lib/virtualFile/computedVueSfc.js +0 -41
  98. package/lib/virtualFile/embeddedFile.d.ts +0 -11
  99. package/lib/virtualFile/embeddedFile.js +0 -14
  100. package/lib/virtualFile/vueFile.js +0 -49
@@ -3,22 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateIntersectMerge = generateIntersectMerge;
4
4
  exports.generateSpreadMerge = generateSpreadMerge;
5
5
  const index_1 = require("./index");
6
- function* generateIntersectMerge(codes) {
7
- yield codes[0];
8
- for (let i = 1; i < codes.length; i++) {
6
+ function* generateIntersectMerge(generates) {
7
+ yield* generates[0];
8
+ for (let i = 1; i < generates.length; i++) {
9
9
  yield ` & `;
10
- yield codes[i];
10
+ yield* generates[i];
11
11
  }
12
12
  }
13
- function* generateSpreadMerge(codes) {
14
- if (codes.length === 1) {
15
- yield codes[0];
13
+ function* generateSpreadMerge(generates) {
14
+ if (generates.length === 1) {
15
+ yield* generates[0];
16
16
  }
17
17
  else {
18
18
  yield `{${index_1.newLine}`;
19
- for (const code of codes) {
19
+ for (const generate of generates) {
20
20
  yield `...`;
21
- yield code;
21
+ yield* generate;
22
22
  yield `,${index_1.newLine}`;
23
23
  }
24
24
  yield `}`;
@@ -1,14 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateStringLiteralKey = generateStringLiteralKey;
4
- const index_1 = require("./index");
5
- const wrapWith_1 = require("./wrapWith");
4
+ const boundary_1 = require("./boundary");
6
5
  function* generateStringLiteralKey(code, offset, info) {
7
6
  if (offset === undefined || !info) {
8
7
  yield `'${code}'`;
9
8
  }
10
9
  else {
11
- yield* (0, wrapWith_1.wrapWith)('template', offset, offset + code.length, info, `'`, [code, 'template', offset, index_1.combineLastMapping], `'`);
10
+ const token = yield* (0, boundary_1.startBoundary)('template', offset, info);
11
+ yield `'`;
12
+ yield [code, 'template', offset, { __combineToken: token }];
13
+ yield `'`;
14
+ yield (0, boundary_1.endBoundary)(token, offset + code.length);
12
15
  }
13
16
  }
14
17
  //# sourceMappingURL=stringLiteralKey.js.map
@@ -0,0 +1,8 @@
1
+ import type { Code } from '../../types';
2
+ export interface CodeTransform {
3
+ range: [start: number, end: number];
4
+ generate(): Iterable<Code>;
5
+ }
6
+ export declare function replace(start: number, end: number, replacement: () => Iterable<Code>): CodeTransform;
7
+ export declare function insert(position: number, insertion: () => Iterable<Code>): CodeTransform;
8
+ export declare function generateCodeWithTransforms(start: number, end: number, transforms: CodeTransform[], section: (start: number, end: number) => Iterable<Code>): Generator<Code>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replace = replace;
4
+ exports.insert = insert;
5
+ exports.generateCodeWithTransforms = generateCodeWithTransforms;
6
+ function replace(start, end, replacement) {
7
+ return {
8
+ range: [start, end],
9
+ generate: replacement,
10
+ };
11
+ }
12
+ function insert(position, insertion) {
13
+ return {
14
+ range: [position, position],
15
+ generate: insertion,
16
+ };
17
+ }
18
+ function* generateCodeWithTransforms(start, end, transforms, section) {
19
+ const sortedTransforms = transforms.sort((a, b) => a.range[0] - b.range[0]);
20
+ for (const { range, generate } of sortedTransforms) {
21
+ yield* section(start, range[0]);
22
+ yield* generate();
23
+ start = range[1];
24
+ }
25
+ yield* section(start, end);
26
+ }
27
+ //# sourceMappingURL=transform.js.map
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateUnicode = generateUnicode;
4
- const wrapWith_1 = require("./wrapWith");
4
+ const boundary_1 = require("./boundary");
5
5
  function* generateUnicode(code, offset, info) {
6
6
  if (needToUnicode(code)) {
7
- yield* (0, wrapWith_1.wrapWith)('template', offset, offset + code.length, info, toUnicode(code));
7
+ const token = yield* (0, boundary_1.startBoundary)('template', offset, info);
8
+ yield toUnicode(code);
9
+ yield (0, boundary_1.endBoundary)(token, offset + code.length);
8
10
  }
9
11
  else {
10
12
  yield [code, 'template', offset, info];
@@ -1,10 +1,12 @@
1
1
  import type * as ts from 'typescript';
2
2
  import type { RawVueCompilerOptions, VueCompilerOptions, VueLanguagePlugin } from './types';
3
+ interface ParseConfigHost extends Omit<ts.ParseConfigHost, 'readDirectory'> {
4
+ }
3
5
  export interface ParsedCommandLine extends Omit<ts.ParsedCommandLine, 'fileNames'> {
4
6
  vueOptions: VueCompilerOptions;
5
7
  }
6
- export declare const createParsedCommandLineByJson: (ts: typeof import("typescript"), host: Omit<ts.ParseConfigHost, "readDirectory">, rootDir: string, json: any, configFileName?: string | undefined) => ParsedCommandLine;
7
- export declare const createParsedCommandLine: (ts: typeof import("typescript"), host: Omit<ts.ParseConfigHost, "readDirectory">, configFileName: string) => ParsedCommandLine;
8
+ export declare function createParsedCommandLineByJson(ts: typeof import('typescript'), host: ParseConfigHost, rootDir: string, json: any, configFileName?: string): ParsedCommandLine;
9
+ export declare function createParsedCommandLine(ts: typeof import('typescript'), host: ParseConfigHost, configFileName: string): ParsedCommandLine;
8
10
  export declare class CompilerOptionsResolver {
9
11
  fileExists?: ((path: string) => boolean) | undefined;
10
12
  options: Omit<RawVueCompilerOptions, 'target' | 'globalTypesPath' | 'plugins'>;
@@ -22,3 +24,4 @@ export declare function createGlobalTypesWriter(vueOptions: VueCompilerOptions,
22
24
  * @deprecated use `createGlobalTypesWriter` instead
23
25
  */
24
26
  export declare function writeGlobalTypes(vueOptions: VueCompilerOptions, writeFile: (fileName: string, data: string) => void): void;
27
+ export {};
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompilerOptionsResolver = exports.createParsedCommandLine = exports.createParsedCommandLineByJson = void 0;
3
+ exports.CompilerOptionsResolver = void 0;
4
+ exports.createParsedCommandLineByJson = createParsedCommandLineByJson;
5
+ exports.createParsedCommandLine = createParsedCommandLine;
4
6
  exports.getDefaultCompilerOptions = getDefaultCompilerOptions;
5
7
  exports.createGlobalTypesWriter = createGlobalTypesWriter;
6
8
  exports.writeGlobalTypes = writeGlobalTypes;
@@ -8,54 +10,75 @@ const shared_1 = require("@vue/shared");
8
10
  const path_browserify_1 = require("path-browserify");
9
11
  const globalTypes_1 = require("./codegen/globalTypes");
10
12
  const shared_2 = require("./utils/shared");
11
- exports.createParsedCommandLineByJson = create((ts, host, rootDir, json, configFileName) => {
12
- // `parseJsonConfigFileContent` is missing in tsc
13
- return 'parseJsonConfigFileContent' in ts
14
- ? ts.parseJsonConfigFileContent(json, host, rootDir, {}, configFileName)
15
- : ts.parseJsonSourceFileConfigFileContent(ts.parseJsonText(configFileName ?? 'tsconfig.json', JSON.stringify(json)), host, rootDir, {}, configFileName);
16
- });
17
- exports.createParsedCommandLine = create((ts, host, configFileName) => {
18
- const config = ts.readJsonConfigFile(configFileName, host.readFile);
19
- return ts.parseJsonSourceFileConfigFileContent(config, host, path_browserify_1.posix.dirname(configFileName), {}, configFileName);
20
- });
21
- function create(getParsedCommandLine) {
22
- return (ts, host, ...args) => {
13
+ function createParsedCommandLineByJson(ts, host, rootDir, json, configFileName) {
14
+ const extendedPaths = new Set();
15
+ const proxyHost = {
16
+ ...host,
17
+ readFile(fileName) {
18
+ if (!fileName.endsWith('/package.json')) {
19
+ extendedPaths.add(fileName);
20
+ }
21
+ return host.readFile(fileName);
22
+ },
23
+ readDirectory() {
24
+ return [];
25
+ },
26
+ };
27
+ const config = ts.readJsonConfigFile(rootDir, () => JSON.stringify(json));
28
+ const parsed = ts.parseJsonSourceFileConfigFileContent(config, proxyHost, rootDir, {}, configFileName);
29
+ const resolver = new CompilerOptionsResolver(host.fileExists);
30
+ for (const extendPath of [...extendedPaths].reverse()) {
23
31
  try {
24
- const extendedPaths = new Set();
25
- const proxyHost = {
26
- ...host,
27
- readFile(fileName) {
28
- if (!fileName.endsWith('/package.json')) {
29
- extendedPaths.add(fileName);
30
- }
31
- return host.readFile(fileName);
32
- },
33
- readDirectory() {
34
- return [];
35
- },
36
- };
37
- const parsed = getParsedCommandLine(ts, proxyHost, ...args);
38
- const resolver = new CompilerOptionsResolver(host.fileExists);
39
- for (const extendPath of [...extendedPaths].reverse()) {
40
- try {
41
- const configFile = ts.readJsonConfigFile(extendPath, host.readFile);
42
- const obj = ts.convertToObject(configFile, []);
43
- const rawOptions = obj?.vueCompilerOptions ?? {};
44
- resolver.addConfig(rawOptions, path_browserify_1.posix.dirname(configFile.fileName));
32
+ const configFile = ts.readJsonConfigFile(extendPath, host.readFile);
33
+ const obj = ts.convertToObject(configFile, []);
34
+ const rawOptions = obj?.vueCompilerOptions ?? {};
35
+ resolver.addConfig(rawOptions, path_browserify_1.posix.dirname(configFile.fileName));
36
+ }
37
+ catch { }
38
+ }
39
+ resolver.addConfig(json?.vueCompilerOptions ?? {}, rootDir);
40
+ return {
41
+ ...parsed,
42
+ vueOptions: resolver.build(),
43
+ };
44
+ }
45
+ function createParsedCommandLine(ts, host, configFileName) {
46
+ try {
47
+ const extendedPaths = new Set();
48
+ const proxyHost = {
49
+ ...host,
50
+ readFile(fileName) {
51
+ if (!fileName.endsWith('/package.json')) {
52
+ extendedPaths.add(fileName);
45
53
  }
46
- catch { }
54
+ return host.readFile(fileName);
55
+ },
56
+ readDirectory() {
57
+ return [];
58
+ },
59
+ };
60
+ const config = ts.readJsonConfigFile(configFileName, proxyHost.readFile);
61
+ const parsed = ts.parseJsonSourceFileConfigFileContent(config, proxyHost, path_browserify_1.posix.dirname(configFileName), {}, configFileName);
62
+ const resolver = new CompilerOptionsResolver(host.fileExists);
63
+ for (const extendPath of [...extendedPaths].reverse()) {
64
+ try {
65
+ const configFile = ts.readJsonConfigFile(extendPath, host.readFile);
66
+ const obj = ts.convertToObject(configFile, []);
67
+ const rawOptions = obj?.vueCompilerOptions ?? {};
68
+ resolver.addConfig(rawOptions, path_browserify_1.posix.dirname(configFile.fileName));
47
69
  }
48
- return {
49
- ...parsed,
50
- vueOptions: resolver.build(),
51
- };
70
+ catch { }
52
71
  }
53
- catch { }
54
72
  return {
55
- options: {},
56
- errors: [],
57
- vueOptions: getDefaultCompilerOptions(),
73
+ ...parsed,
74
+ vueOptions: resolver.build(),
58
75
  };
76
+ }
77
+ catch { }
78
+ return {
79
+ options: {},
80
+ errors: [],
81
+ vueOptions: getDefaultCompilerOptions(),
59
82
  };
60
83
  }
61
84
  class CompilerOptionsResolver {
@@ -128,7 +151,7 @@ class CompilerOptionsResolver {
128
151
  ...defaults.fallthroughComponentNames,
129
152
  ...this.options.fallthroughComponentNames ?? [],
130
153
  ].map(shared_2.hyphenateTag),
131
- // https://github.com/vuejs/vue-next/blob/master/packages/compiler-dom/src/transforms/vModel.ts#L49-L51
154
+ // https://github.com/vuejs/core/blob/master/packages/compiler-dom/src/transforms/vModel.ts#L49-L51
132
155
  // https://vuejs.org/guide/essentials/forms.html#form-input-bindings
133
156
  experimentalModelPropName: Object.fromEntries(Object.entries(this.options.experimentalModelPropName ?? defaults.experimentalModelPropName).map(([k, v]) => [(0, shared_1.camelize)(k), v])),
134
157
  };
@@ -1,6 +1,6 @@
1
1
  import { type LanguagePlugin } from '@volar/language-core';
2
2
  import type * as ts from 'typescript';
3
3
  import type { VueCompilerOptions } from './types';
4
- import { VueVirtualCode } from './virtualFile/vueFile';
4
+ import { VueVirtualCode } from './virtualCode';
5
5
  export declare function createVueLanguagePlugin<T>(ts: typeof import('typescript'), compilerOptions: ts.CompilerOptions, vueCompilerOptions: VueCompilerOptions, asFileName: (scriptId: T) => string): LanguagePlugin<T, VueVirtualCode>;
6
6
  export declare function getAllExtensions(options: VueCompilerOptions): string[];
@@ -6,7 +6,7 @@ exports.getAllExtensions = getAllExtensions;
6
6
  const language_core_1 = require("@volar/language-core");
7
7
  const CompilerDOM = require("@vue/compiler-dom");
8
8
  const plugins_1 = require("./plugins");
9
- const vueFile_1 = require("./virtualFile/vueFile");
9
+ const virtualCode_1 = require("./virtualCode");
10
10
  const fileRegistries = {};
11
11
  function getVueFileRegistry(compilerOptions, vueCompilerOptions, plugins) {
12
12
  const key = JSON.stringify([
@@ -53,7 +53,7 @@ function createVueLanguagePlugin(ts, compilerOptions, vueCompilerOptions, asFile
53
53
  return code;
54
54
  }
55
55
  else {
56
- const code = new vueFile_1.VueVirtualCode(fileName, languageId, snapshot, vueCompilerOptions, plugins, ts);
56
+ const code = new virtualCode_1.VueVirtualCode(fileName, languageId, snapshot, vueCompilerOptions, plugins, ts);
57
57
  fileRegistry.set(fileName, code);
58
58
  return code;
59
59
  }
@@ -35,12 +35,8 @@ function* generate(templateAst) {
35
35
  && prop.name === 'style'
36
36
  && prop.value) {
37
37
  yield `x { `;
38
- yield [
39
- prop.value.content,
40
- 'template',
41
- (0, shared_1.getAttributeValueOffset)(prop.value),
42
- codeFeatures,
43
- ];
38
+ const [content, offset] = (0, shared_1.normalizeAttributeValue)(prop.value);
39
+ yield [content, 'template', offset, codeFeatures];
44
40
  yield ` }\n`;
45
41
  }
46
42
  }
@@ -5,7 +5,6 @@ const elementEvents_1 = require("../codegen/template/elementEvents");
5
5
  const templateChild_1 = require("../codegen/template/templateChild");
6
6
  const vFor_1 = require("../codegen/template/vFor");
7
7
  const utils_1 = require("../codegen/utils");
8
- const computedSfc_1 = require("../virtualFile/computedSfc");
9
8
  const codeFeatures = {
10
9
  format: true,
11
10
  };
@@ -21,7 +20,7 @@ const formatBrackets = {
21
20
  event: ['() => ', ';'],
22
21
  generic: ['<', '>() => {};'],
23
22
  };
24
- const plugin = ctx => {
23
+ const plugin = ({ modules: { typescript: ts } }) => {
25
24
  const parseds = new WeakMap();
26
25
  return {
27
26
  version: 2.2,
@@ -54,15 +53,14 @@ const plugin = ctx => {
54
53
  },
55
54
  };
56
55
  function parse(sfc) {
57
- const data = new Map();
56
+ const result = new Map();
58
57
  if (!sfc.template?.ast) {
59
- return data;
58
+ return result;
60
59
  }
61
- const templateContent = sfc.template.content;
62
- const inlineTsAsts = computedSfc_1.templateInlineTsAsts.get(sfc.template.ast);
60
+ const template = sfc.template;
63
61
  let i = 0;
64
62
  sfc.template.ast.children.forEach(visit);
65
- return data;
63
+ return result;
66
64
  function visit(node) {
67
65
  if (node.type === CompilerDOM.NodeTypes.COMMENT) {
68
66
  const match = node.loc.source.match(/^<!--\s*@vue-generic\s*\{(?<content>[\s\S]*)\}\s*-->$/);
@@ -87,8 +85,8 @@ const plugin = ctx => {
87
85
  && prop.exp.constType !== CompilerDOM.ConstantTypes.CAN_STRINGIFY // style='z-index: 2' will compile to {'z-index':'2'}
88
86
  ) {
89
87
  if (prop.name === 'on' && prop.arg?.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
90
- const ast = (0, utils_1.createTsAst)(ctx.modules.typescript, inlineTsAsts, prop.exp.content);
91
- if ((0, elementEvents_1.isCompoundExpression)(ctx.modules.typescript, ast)) {
88
+ const ast = (0, utils_1.getTypeScriptAST)(ts, template, prop.exp.content);
89
+ if ((0, elementEvents_1.isCompoundExpression)(ts, ast)) {
92
90
  addFormatCodes(prop.exp.loc.source, prop.exp.loc.start.offset, formatBrackets.event);
93
91
  }
94
92
  else {
@@ -135,13 +133,13 @@ const plugin = ctx => {
135
133
  if (leftExpressionRange && leftExpressionText && source.type === CompilerDOM.NodeTypes.SIMPLE_EXPRESSION) {
136
134
  let start = leftExpressionRange.start;
137
135
  let end = source.loc.start.offset + source.content.length;
138
- while (templateContent[start - 1] === ' ' || templateContent[start - 1] === '(') {
136
+ while (template.content[start - 1] === ' ' || template.content[start - 1] === '(') {
139
137
  start--;
140
138
  }
141
- while (templateContent[end] === ' ' || templateContent[end] === ')') {
139
+ while (template.content[end] === ' ' || template.content[end] === ')') {
142
140
  end++;
143
141
  }
144
- addFormatCodes(templateContent.slice(start, end), start, formatBrackets.for);
142
+ addFormatCodes(template.content.slice(start, end), start, formatBrackets.for);
145
143
  }
146
144
  for (const child of node.children) {
147
145
  visit(child);
@@ -161,7 +159,7 @@ const plugin = ctx => {
161
159
  }
162
160
  else if (node.type === CompilerDOM.NodeTypes.INTERPOLATION) {
163
161
  // {{ ... }}
164
- const [content, start] = (0, templateChild_1.parseInterpolationNode)(node, templateContent);
162
+ const [content, start] = (0, templateChild_1.parseInterpolationNode)(node, template.content);
165
163
  const lines = content.split('\n');
166
164
  const firstLineEmpty = lines[0].trim() === '';
167
165
  const lastLineEmpty = lines[lines.length - 1].trim() === '';
@@ -188,7 +186,7 @@ const plugin = ctx => {
188
186
  }
189
187
  function addFormatCodes(code, offset, wrapper) {
190
188
  const id = 'template_inline_ts_' + i++;
191
- data.set(id, [
189
+ result.set(id, [
192
190
  wrapper[0],
193
191
  [
194
192
  code,
@@ -1,6 +1,5 @@
1
1
  import type { Sfc, VueLanguagePlugin } from '../types';
2
2
  export declare const tsCodegen: WeakMap<Sfc, {
3
- getLang: () => string;
4
3
  getScriptRanges: () => {
5
4
  exportDefault: (import("../types").TextRange & {
6
5
  expression: import("../types").TextRange;
@@ -121,14 +120,11 @@ export declare const tsCodegen: WeakMap<Sfc, {
121
120
  getSetupSlotsAssignName: () => string | undefined;
122
121
  getGeneratedScript: () => {
123
122
  codes: import("../types").Code[];
124
- generatedTemplate: boolean;
125
- generatedPropsType: boolean;
126
- bypassDefineComponent: boolean;
127
- bindingNames: Set<string>;
123
+ generatedTypes: Set<string>;
128
124
  localTypes: {
129
125
  generate: () => Generator<string, void, unknown>;
130
126
  readonly PrettifyLocal: string;
131
- readonly WithDefaultsLocal: string;
127
+ readonly WithDefaults: string;
132
128
  readonly WithSlots: string;
133
129
  readonly PropsChildren: string;
134
130
  readonly TypePropsToOption: string;
@@ -138,6 +134,7 @@ export declare const tsCodegen: WeakMap<Sfc, {
138
134
  };
139
135
  getGeneratedTemplate: () => {
140
136
  codes: import("../types").Code[];
137
+ generatedTypes: Set<string>;
141
138
  currentInfo: {
142
139
  ignoreError?: boolean;
143
140
  expectError?: {
@@ -150,7 +147,6 @@ export declare const tsCodegen: WeakMap<Sfc, {
150
147
  };
151
148
  };
152
149
  resolveCodeFeatures: (features: import("../types").VueCodeInformation) => import("../types").VueCodeInformation;
153
- inlineTsAsts: Map<string, import("typescript").SourceFile> | undefined;
154
150
  inVFor: boolean;
155
151
  slots: {
156
152
  name: string;
@@ -164,16 +160,9 @@ export declare const tsCodegen: WeakMap<Sfc, {
164
160
  propsVar: string;
165
161
  }[];
166
162
  dollarVars: Set<string>;
167
- accessExternalVariables: Map<string, Set<number>>;
163
+ componentAccessMap: Map<string, Map<string, Set<number>>>;
168
164
  blockConditions: string[];
169
- scopedClasses: {
170
- source: string;
171
- className: string;
172
- offset: number;
173
- }[];
174
- emptyClassOffsets: number[];
175
165
  inlayHints: import("../codegen/inlayHints").InlayHintInfo[];
176
- bindingAttrLocs: import("@vue/compiler-dom").SourceLocation[];
177
166
  inheritedAttrVars: Set<string>;
178
167
  templateRefs: Map<string, {
179
168
  typeExp: string;
@@ -186,18 +175,20 @@ export declare const tsCodegen: WeakMap<Sfc, {
186
175
  singleRootElTypes: Set<string>;
187
176
  singleRootNodes: Set<import("@vue/compiler-dom").ElementNode | null>;
188
177
  addTemplateRef(name: string, typeExp: string, offset: number): void;
189
- accessExternalVariable(name: string, offset?: number): void;
190
- hasLocalVariable(name: string): boolean;
191
- addLocalVariable(name: string): void;
192
- removeLocalVariable(name: string): void;
178
+ recordComponentAccess(source: string, name: string, offset?: number): void;
179
+ scopes: Set<string>[];
180
+ declare(...varNames: string[]): void;
181
+ startScope(): () => Generator<import("../types").Code, any, any>;
193
182
  getInternalVariable(): string;
194
183
  getHoistVariable(originalVar: string): string;
195
184
  generateHoistVariables(): Generator<string, void, unknown>;
196
185
  generateConditionGuards(): Generator<string, void, unknown>;
197
- generateAutoImportCompletion(): Generator<import("../types").Code>;
198
186
  enter(node: import("@vue/compiler-dom").RootNode | import("@vue/compiler-dom").TemplateChildNode | import("@vue/compiler-dom").SimpleExpressionNode): boolean;
199
187
  exit(): Generator<import("../types").Code>;
200
188
  } | undefined;
189
+ getImportComponentNames: () => Set<string>;
190
+ getSetupExposed: () => Set<string>;
191
+ getSetupConsts: () => Set<string>;
201
192
  }>;
202
193
  declare const plugin: VueLanguagePlugin;
203
194
  export default plugin;