@vue/language-core 3.2.9 → 3.3.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 (42) hide show
  1. package/README.md +1 -0
  2. package/lib/codegen/names.d.ts +1 -0
  3. package/lib/codegen/names.js +1 -0
  4. package/lib/codegen/script/component.d.ts +2 -2
  5. package/lib/codegen/script/component.js +64 -58
  6. package/lib/codegen/script/index.d.ts +3 -3
  7. package/lib/codegen/script/scriptSetup.d.ts +4 -4
  8. package/lib/codegen/script/template.js +9 -9
  9. package/lib/codegen/style/common.d.ts +2 -2
  10. package/lib/codegen/style/index.d.ts +2 -2
  11. package/lib/codegen/template/element.js +29 -24
  12. package/lib/codegen/template/elementProps.d.ts +2 -2
  13. package/lib/codegen/template/elementProps.js +11 -10
  14. package/lib/codegen/template/index.d.ts +2 -2
  15. package/lib/codegen/template/index.js +6 -3
  16. package/lib/codegen/template/interpolation.d.ts +2 -2
  17. package/lib/codegen/template/styleScopedClasses.d.ts +3 -3
  18. package/lib/codegen/template/templateChild.d.ts +1 -1
  19. package/lib/codegen/template/templateChild.js +8 -4
  20. package/lib/codegen/utils/index.d.ts +3 -3
  21. package/lib/codegen/utils/merge.d.ts +2 -2
  22. package/lib/codegen/utils/merge.js +9 -9
  23. package/lib/compilerOptions.js +1 -0
  24. package/lib/plugins/vue-root-tags.js +9 -9
  25. package/lib/plugins/vue-sfc-customblocks.js +4 -4
  26. package/lib/plugins/vue-sfc-scripts.js +8 -8
  27. package/lib/plugins/vue-sfc-styles.js +5 -5
  28. package/lib/plugins/vue-sfc-template.js +7 -7
  29. package/lib/plugins/vue-template-inline-css.js +6 -6
  30. package/lib/plugins/vue-template-inline-ts.js +12 -12
  31. package/lib/plugins/vue-tsx.d.ts +2 -2
  32. package/lib/plugins/vue-tsx.js +35 -35
  33. package/lib/types.d.ts +54 -48
  34. package/lib/utils/parseSfc.js +0 -1
  35. package/lib/utils/shared.d.ts +2 -2
  36. package/lib/virtualCode/embeddedCodes.d.ts +2 -2
  37. package/lib/virtualCode/embeddedCodes.js +11 -11
  38. package/lib/virtualCode/index.d.ts +4 -2
  39. package/lib/virtualCode/index.js +4 -0
  40. package/lib/virtualCode/ir.d.ts +2 -2
  41. package/package.json +2 -2
  42. package/types/template-helpers.d.ts +1 -0
@@ -15,22 +15,22 @@ class VueEmbeddedCode {
15
15
  }
16
16
  }
17
17
  exports.VueEmbeddedCode = VueEmbeddedCode;
18
- function useEmbeddedCodes(plugins, fileName, sfc) {
18
+ function useEmbeddedCodes(plugins, fileName, ir) {
19
19
  const getNameToBlockMap = (0, alien_signals_1.computed)(() => {
20
20
  const blocks = {};
21
- if (sfc.template) {
22
- blocks[sfc.template.name] = sfc.template;
21
+ if (ir.template) {
22
+ blocks[ir.template.name] = ir.template;
23
23
  }
24
- if (sfc.script) {
25
- blocks[sfc.script.name] = sfc.script;
24
+ if (ir.script) {
25
+ blocks[ir.script.name] = ir.script;
26
26
  }
27
- if (sfc.scriptSetup) {
28
- blocks[sfc.scriptSetup.name] = sfc.scriptSetup;
27
+ if (ir.scriptSetup) {
28
+ blocks[ir.scriptSetup.name] = ir.scriptSetup;
29
29
  }
30
- for (const block of sfc.styles) {
30
+ for (const block of ir.styles) {
31
31
  blocks[block.name] = block;
32
32
  }
33
- for (const block of sfc.customBlocks) {
33
+ for (const block of ir.customBlocks) {
34
34
  blocks[block.name] = block;
35
35
  }
36
36
  return blocks;
@@ -75,7 +75,7 @@ function useEmbeddedCodes(plugins, fileName, sfc) {
75
75
  if (!plugin.getEmbeddedCodes) {
76
76
  return new Map();
77
77
  }
78
- const newCodeList = plugin.getEmbeddedCodes(fileName, sfc);
78
+ const newCodeList = plugin.getEmbeddedCodes(fileName, ir);
79
79
  const map = new Map();
80
80
  for (const { id, lang } of newCodeList) {
81
81
  const key = id + '__' + lang;
@@ -110,7 +110,7 @@ function useEmbeddedCodes(plugins, fileName, sfc) {
110
110
  continue;
111
111
  }
112
112
  try {
113
- plugin.resolveEmbeddedCode(fileName, sfc, code);
113
+ plugin.resolveEmbeddedCode(fileName, ir, code);
114
114
  }
115
115
  catch (e) {
116
116
  console.error(e);
@@ -1,7 +1,7 @@
1
1
  import type { CodeMapping, VirtualCode } from '@volar/language-core';
2
2
  import type { SFCParseResult } from '@vue/compiler-sfc';
3
3
  import type * as ts from 'typescript';
4
- import type { Sfc, VueCompilerOptions, VueLanguagePluginReturn } from '../types';
4
+ import type { IR, VueCompilerOptions, VueLanguagePluginReturn } from '../types';
5
5
  export declare class VueVirtualCode implements VirtualCode {
6
6
  fileName: string;
7
7
  languageId: string;
@@ -15,7 +15,9 @@ export declare class VueVirtualCode implements VirtualCode {
15
15
  private _mappings;
16
16
  get snapshot(): ts.IScriptSnapshot;
17
17
  get vueSfc(): SFCParseResult | undefined;
18
- get sfc(): Sfc;
18
+ get ir(): IR;
19
+ /** @deprecated use `ir` instead */
20
+ get sfc(): IR;
19
21
  get embeddedCodes(): VirtualCode[];
20
22
  get mappings(): CodeMapping[];
21
23
  constructor(fileName: string, languageId: string, initSnapshot: ts.IScriptSnapshot, vueCompilerOptions: VueCompilerOptions, plugins: VueLanguagePluginReturn[], ts: typeof import('typescript'));
@@ -12,6 +12,10 @@ class VueVirtualCode {
12
12
  get vueSfc() {
13
13
  return this._parsedSfcResult()?.result;
14
14
  }
15
+ get ir() {
16
+ return this._ir;
17
+ }
18
+ /** @deprecated use `ir` instead */
15
19
  get sfc() {
16
20
  return this._ir;
17
21
  }
@@ -1,4 +1,4 @@
1
1
  import type { SFCParseResult } from '@vue/compiler-sfc';
2
2
  import type * as ts from 'typescript';
3
- import type { Sfc, VueLanguagePluginReturn } from '../types';
4
- export declare function useIR(ts: typeof import('typescript'), plugins: VueLanguagePluginReturn[], fileName: string, getSnapshot: () => ts.IScriptSnapshot, getParseSfcResult: () => SFCParseResult | undefined): Sfc;
3
+ import type { IR, VueLanguagePluginReturn } from '../types';
4
+ export declare function useIR(ts: typeof import('typescript'), plugins: VueLanguagePluginReturn[], fileName: string, getSnapshot: () => ts.IScriptSnapshot, getParseSfcResult: () => SFCParseResult | undefined): IR;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "3.2.9",
3
+ "version": "3.3.0",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "index.d.ts",
@@ -34,5 +34,5 @@
34
34
  "@volar/typescript": "2.4.28",
35
35
  "@vue/compiler-sfc": "^3.5.0"
36
36
  },
37
- "gitHead": "9c1fd47ffe25e86394232dfc76453a5f76cb4fe0"
37
+ "gitHead": "1088dce8ae6b937f7525fae4982e3b3ea99d3c64"
38
38
  }
@@ -143,6 +143,7 @@ declare global {
143
143
  function __VLS_asFunctionalElement0<T>(tag: T, endTag?: T): (attrs: T) => void;
144
144
  function __VLS_asFunctionalElement1<T>(tag: T, endTag?: T): (attrs: T & Record<string, unknown>) => void;
145
145
  function __VLS_asFunctionalSlot<S>(slot: S): S extends () => infer R ? (props: {}) => R : NonNullable<S>;
146
+ function __VLS_omit<T, K>(target: T, props: K): Omit<T, keyof K>;
146
147
  function __VLS_tryAsConstant<const T>(t: T): T;
147
148
  }
148
149