@vue/language-core 2.1.10 → 2.2.2

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 (109) hide show
  1. package/index.d.ts +0 -1
  2. package/index.js +1 -2
  3. package/lib/codeFeatures.d.ts +1 -0
  4. package/lib/codeFeatures.js +3 -0
  5. package/lib/codegen/codeFeatures.d.ts +83 -0
  6. package/lib/codegen/codeFeatures.js +71 -0
  7. package/lib/codegen/globalTypes.d.ts +3 -1
  8. package/lib/codegen/globalTypes.js +39 -14
  9. package/lib/codegen/localTypes.d.ts +1 -1
  10. package/lib/codegen/localTypes.js +7 -7
  11. package/lib/codegen/script/binding.d.ts +4 -0
  12. package/lib/codegen/script/binding.js +41 -0
  13. package/lib/codegen/script/component.d.ts +1 -1
  14. package/lib/codegen/script/component.js +44 -44
  15. package/lib/codegen/script/componentSelf.d.ts +1 -1
  16. package/lib/codegen/script/componentSelf.js +14 -14
  17. package/lib/codegen/script/context.d.ts +1 -1
  18. package/lib/codegen/script/context.js +2 -2
  19. package/lib/codegen/script/index.d.ts +6 -11
  20. package/lib/codegen/script/index.js +21 -63
  21. package/lib/codegen/script/scriptSetup.d.ts +1 -1
  22. package/lib/codegen/script/scriptSetup.js +236 -205
  23. package/lib/codegen/script/src.js +8 -8
  24. package/lib/codegen/script/styleModulesType.d.ts +1 -1
  25. package/lib/codegen/script/styleModulesType.js +7 -7
  26. package/lib/codegen/script/template.d.ts +2 -2
  27. package/lib/codegen/script/template.js +81 -114
  28. package/lib/codegen/template/context.d.ts +29 -15
  29. package/lib/codegen/template/context.js +51 -96
  30. package/lib/codegen/template/element.d.ts +2 -4
  31. package/lib/codegen/template/element.js +124 -317
  32. package/lib/codegen/template/elementChildren.d.ts +1 -1
  33. package/lib/codegen/template/elementChildren.js +10 -11
  34. package/lib/codegen/template/elementDirectives.d.ts +1 -0
  35. package/lib/codegen/template/elementDirectives.js +43 -30
  36. package/lib/codegen/template/elementEvents.d.ts +2 -2
  37. package/lib/codegen/template/elementEvents.js +32 -65
  38. package/lib/codegen/template/elementProps.d.ts +5 -3
  39. package/lib/codegen/template/elementProps.js +116 -123
  40. package/lib/codegen/template/index.d.ts +1 -0
  41. package/lib/codegen/template/index.js +67 -69
  42. package/lib/codegen/template/interpolation.d.ts +5 -3
  43. package/lib/codegen/template/interpolation.js +30 -27
  44. package/lib/codegen/template/objectProperty.js +8 -8
  45. package/lib/codegen/template/propertyAccess.js +4 -4
  46. package/lib/codegen/template/slotOutlet.d.ts +1 -1
  47. package/lib/codegen/template/slotOutlet.js +47 -25
  48. package/lib/codegen/template/styleScopedClasses.d.ts +4 -1
  49. package/lib/codegen/template/styleScopedClasses.js +152 -8
  50. package/lib/codegen/template/templateChild.d.ts +1 -1
  51. package/lib/codegen/template/templateChild.js +39 -20
  52. package/lib/codegen/template/vFor.d.ts +1 -1
  53. package/lib/codegen/template/vFor.js +11 -11
  54. package/lib/codegen/template/vIf.d.ts +1 -1
  55. package/lib/codegen/template/vIf.js +6 -6
  56. package/lib/codegen/template/vSlot.d.ts +5 -0
  57. package/lib/codegen/template/vSlot.js +80 -0
  58. package/lib/codegen/utils/camelized.d.ts +2 -0
  59. package/lib/codegen/utils/camelized.js +31 -0
  60. package/lib/codegen/utils/index.d.ts +21 -0
  61. package/lib/codegen/utils/index.js +79 -0
  62. package/lib/codegen/utils/src.d.ts +2 -0
  63. package/lib/codegen/utils/src.js +19 -0
  64. package/lib/codegen/{template → utils}/stringLiteralKey.js +3 -3
  65. package/lib/codegen/utils/unicode.d.ts +2 -0
  66. package/lib/codegen/utils/unicode.js +25 -0
  67. package/lib/languagePlugin.js +1 -1
  68. package/lib/parsers/scriptRanges.d.ts +7 -2
  69. package/lib/parsers/scriptSetupRanges.d.ts +69 -83
  70. package/lib/parsers/scriptSetupRanges.js +194 -171
  71. package/lib/parsers/vueCompilerOptions.d.ts +2 -0
  72. package/lib/parsers/vueCompilerOptions.js +23 -0
  73. package/lib/plugins/file-html.js +4 -3
  74. package/lib/plugins/file-md.js +1 -1
  75. package/lib/plugins/file-vue.js +4 -4
  76. package/lib/plugins/vue-root-tags.js +2 -2
  77. package/lib/plugins/vue-style-class-names.d.ts +5 -0
  78. package/lib/plugins/vue-style-class-names.js +32 -0
  79. package/lib/plugins/vue-style-reference-link.d.ts +1 -0
  80. package/lib/plugins/vue-style-reference-link.js +3 -0
  81. package/lib/plugins/vue-style-reference-links.d.ts +3 -0
  82. package/lib/plugins/vue-style-reference-links.js +26 -0
  83. package/lib/plugins/vue-template-html.js +6 -2
  84. package/lib/plugins/vue-template-inline-css.js +1 -1
  85. package/lib/plugins/vue-template-inline-ts.js +66 -17
  86. package/lib/plugins/vue-tsx.d.ts +126 -92
  87. package/lib/plugins/vue-tsx.js +114 -97
  88. package/lib/plugins/vue-vine.d.ts +3 -0
  89. package/lib/plugins/vue-vine.js +35 -0
  90. package/lib/types.d.ts +25 -12
  91. package/lib/utils/buildMappings.d.ts +1 -1
  92. package/lib/utils/parseCssImports.d.ts +4 -0
  93. package/lib/utils/parseCssImports.js +19 -0
  94. package/lib/utils/parseSfc.d.ts +5 -0
  95. package/lib/utils/parseSfc.js +11 -5
  96. package/lib/utils/signals.d.ts +2 -0
  97. package/lib/utils/signals.js +54 -0
  98. package/lib/utils/ts.d.ts +14 -2
  99. package/lib/utils/ts.js +134 -91
  100. package/lib/virtualFile/computedEmbeddedCodes.d.ts +1 -2
  101. package/lib/virtualFile/computedEmbeddedCodes.js +11 -11
  102. package/lib/virtualFile/computedSfc.d.ts +1 -2
  103. package/lib/virtualFile/computedSfc.js +87 -79
  104. package/lib/virtualFile/computedVueSfc.d.ts +1 -2
  105. package/lib/virtualFile/computedVueSfc.js +7 -7
  106. package/lib/virtualFile/vueFile.d.ts +5 -5
  107. package/lib/virtualFile/vueFile.js +6 -6
  108. package/package.json +6 -6
  109. /package/lib/codegen/{template → utils}/stringLiteralKey.d.ts +0 -0
@@ -1,5 +1,4 @@
1
1
  import type { SFCParseResult } from '@vue/compiler-sfc';
2
- import { Signal } from 'alien-signals';
3
2
  import type * as ts from 'typescript';
4
3
  import type { VueLanguagePluginReturn } from '../types';
5
- export declare function computedVueSfc(plugins: VueLanguagePluginReturn[], fileName: string, languageId: string, snapshot: Signal<ts.IScriptSnapshot>): import("alien-signals").ISignal<SFCParseResult | undefined>;
4
+ export declare function computedVueSfc(plugins: VueLanguagePluginReturn[], fileName: string, languageId: string, getSnapshot: () => ts.IScriptSnapshot): () => SFCParseResult | undefined;
@@ -2,20 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.computedVueSfc = computedVueSfc;
4
4
  const alien_signals_1 = require("alien-signals");
5
- function computedVueSfc(plugins, fileName, languageId, snapshot) {
5
+ function computedVueSfc(plugins, fileName, languageId, getSnapshot) {
6
6
  let cache;
7
7
  return (0, alien_signals_1.computed)(() => {
8
8
  // incremental update
9
9
  if (cache?.plugin.updateSFC) {
10
- const change = snapshot.get().getChangeRange(cache.snapshot);
10
+ const change = getSnapshot().getChangeRange(cache.snapshot);
11
11
  if (change) {
12
12
  const newSfc = cache.plugin.updateSFC(cache.sfc, {
13
13
  start: change.span.start,
14
14
  end: change.span.start + change.span.length,
15
- newText: snapshot.get().getText(change.span.start, change.span.start + change.newLength),
15
+ newText: getSnapshot().getText(change.span.start, change.span.start + change.newLength),
16
16
  });
17
17
  if (newSfc) {
18
- cache.snapshot = snapshot.get();
18
+ cache.snapshot = getSnapshot();
19
19
  // force dirty
20
20
  cache.sfc = JSON.parse(JSON.stringify(newSfc));
21
21
  return cache.sfc;
@@ -23,12 +23,12 @@ function computedVueSfc(plugins, fileName, languageId, snapshot) {
23
23
  }
24
24
  }
25
25
  for (const plugin of plugins) {
26
- const sfc = plugin.parseSFC?.(fileName, snapshot.get().getText(0, snapshot.get().getLength()))
27
- ?? plugin.parseSFC2?.(fileName, languageId, snapshot.get().getText(0, snapshot.get().getLength()));
26
+ const sfc = plugin.parseSFC?.(fileName, getSnapshot().getText(0, getSnapshot().getLength()))
27
+ ?? plugin.parseSFC2?.(fileName, languageId, getSnapshot().getText(0, getSnapshot().getLength()));
28
28
  if (sfc) {
29
29
  if (!sfc.errors.length) {
30
30
  cache = {
31
- snapshot: snapshot.get(),
31
+ snapshot: getSnapshot(),
32
32
  sfc,
33
33
  plugin,
34
34
  };
@@ -9,16 +9,16 @@ export declare class VueVirtualCode implements VirtualCode {
9
9
  plugins: VueLanguagePluginReturn[];
10
10
  ts: typeof import('typescript');
11
11
  id: string;
12
- _snapshot: import("alien-signals").Signal<ts.IScriptSnapshot>;
13
- _vueSfc: import("alien-signals").ISignal<import("@vue/compiler-sfc").SFCParseResult | undefined>;
12
+ private _snapshot;
13
+ _vueSfc: () => import("@vue/compiler-sfc").SFCParseResult | undefined;
14
14
  _sfc: import("../types").Sfc;
15
- _mappings: import("alien-signals").ISignal<{
15
+ _mappings: () => {
16
16
  sourceOffsets: number[];
17
17
  generatedOffsets: number[];
18
18
  lengths: number[];
19
19
  data: import("@volar/language-core").CodeInformation;
20
- }[]>;
21
- _embeddedCodes: import("alien-signals").ISignal<VirtualCode[]>;
20
+ }[];
21
+ _embeddedCodes: () => VirtualCode[];
22
22
  get embeddedCodes(): VirtualCode[];
23
23
  get snapshot(): ts.IScriptSnapshot;
24
24
  get mappings(): {
@@ -9,13 +9,13 @@ const computedVueSfc_1 = require("./computedVueSfc");
9
9
  class VueVirtualCode {
10
10
  // others
11
11
  get embeddedCodes() {
12
- return this._embeddedCodes.get();
12
+ return this._embeddedCodes();
13
13
  }
14
14
  get snapshot() {
15
- return this._snapshot.get();
15
+ return this._snapshot();
16
16
  }
17
17
  get mappings() {
18
- return this._mappings.get();
18
+ return this._mappings();
19
19
  }
20
20
  constructor(fileName, languageId, initSnapshot, vueCompilerOptions, plugins, ts) {
21
21
  this.fileName = fileName;
@@ -31,7 +31,7 @@ class VueVirtualCode {
31
31
  this._vueSfc = (0, computedVueSfc_1.computedVueSfc)(this.plugins, this.fileName, this.languageId, this._snapshot);
32
32
  this._sfc = (0, computedSfc_1.computedSfc)(this.ts, this.plugins, this.fileName, this._snapshot, this._vueSfc);
33
33
  this._mappings = (0, alien_signals_1.computed)(() => {
34
- const snapshot = this._snapshot.get();
34
+ const snapshot = this._snapshot();
35
35
  return [{
36
36
  sourceOffsets: [0],
37
37
  generatedOffsets: [0],
@@ -40,10 +40,10 @@ class VueVirtualCode {
40
40
  }];
41
41
  });
42
42
  this._embeddedCodes = (0, computedEmbeddedCodes_1.computedEmbeddedCodes)(this.plugins, this.fileName, this._sfc);
43
- this._snapshot.set(initSnapshot);
43
+ this._snapshot(initSnapshot);
44
44
  }
45
45
  update(newSnapshot) {
46
- this._snapshot.set(newSnapshot);
46
+ this._snapshot(newSnapshot);
47
47
  }
48
48
  }
49
49
  exports.VueVirtualCode = VueVirtualCode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "2.1.10",
3
+ "version": "2.2.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -13,20 +13,20 @@
13
13
  "directory": "packages/language-core"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/language-core": "~2.4.8",
16
+ "@volar/language-core": "~2.4.11",
17
17
  "@vue/compiler-dom": "^3.5.0",
18
18
  "@vue/compiler-vue2": "^2.7.16",
19
19
  "@vue/shared": "^3.5.0",
20
- "alien-signals": "^0.2.0",
20
+ "alien-signals": "^1.0.3",
21
21
  "minimatch": "^9.0.3",
22
22
  "muggle-string": "^0.4.1",
23
23
  "path-browserify": "^1.0.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/minimatch": "^5.1.2",
27
- "@types/node": "latest",
27
+ "@types/node": "^22.10.4",
28
28
  "@types/path-browserify": "^1.0.1",
29
- "@volar/typescript": "~2.4.8",
29
+ "@volar/typescript": "~2.4.11",
30
30
  "@vue/compiler-sfc": "^3.5.0"
31
31
  },
32
32
  "peerDependencies": {
@@ -37,5 +37,5 @@
37
37
  "optional": true
38
38
  }
39
39
  },
40
- "gitHead": "b0af30caee2f8dfb1a8393c1b400f38e31fa4883"
40
+ "gitHead": "30757908b67f40f779c36795665163634fb81868"
41
41
  }