@vue/language-core 2.2.0 → 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 (84) 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/common.d.ts +12 -0
  8. package/lib/codegen/common.js +79 -0
  9. package/lib/codegen/globalTypes.d.ts +3 -1
  10. package/lib/codegen/globalTypes.js +30 -14
  11. package/lib/codegen/localTypes.d.ts +1 -1
  12. package/lib/codegen/localTypes.js +4 -4
  13. package/lib/codegen/script/binding.d.ts +4 -0
  14. package/lib/codegen/script/binding.js +41 -0
  15. package/lib/codegen/script/component.d.ts +1 -1
  16. package/lib/codegen/script/component.js +7 -7
  17. package/lib/codegen/script/componentSelf.d.ts +1 -1
  18. package/lib/codegen/script/componentSelf.js +2 -2
  19. package/lib/codegen/script/context.d.ts +1 -1
  20. package/lib/codegen/script/index.d.ts +1 -8
  21. package/lib/codegen/script/index.js +15 -39
  22. package/lib/codegen/script/scriptSetup.d.ts +1 -1
  23. package/lib/codegen/script/scriptSetup.js +46 -58
  24. package/lib/codegen/script/src.js +2 -2
  25. package/lib/codegen/script/styleModulesType.d.ts +1 -1
  26. package/lib/codegen/script/styleModulesType.js +2 -2
  27. package/lib/codegen/script/template.d.ts +1 -1
  28. package/lib/codegen/script/template.js +11 -32
  29. package/lib/codegen/template/camelized.d.ts +2 -0
  30. package/lib/codegen/template/camelized.js +31 -0
  31. package/lib/codegen/template/context.d.ts +17 -13
  32. package/lib/codegen/template/context.js +35 -89
  33. package/lib/codegen/template/element.js +32 -252
  34. package/lib/codegen/template/elementChildren.d.ts +1 -1
  35. package/lib/codegen/template/elementChildren.js +3 -4
  36. package/lib/codegen/template/elementDirectives.js +18 -11
  37. package/lib/codegen/template/elementProps.d.ts +2 -1
  38. package/lib/codegen/template/elementProps.js +22 -26
  39. package/lib/codegen/template/index.d.ts +1 -0
  40. package/lib/codegen/template/index.js +39 -33
  41. package/lib/codegen/template/interpolation.js +13 -9
  42. package/lib/codegen/template/slotOutlet.js +39 -17
  43. package/lib/codegen/template/styleScopedClasses.d.ts +3 -0
  44. package/lib/codegen/template/styleScopedClasses.js +141 -0
  45. package/lib/codegen/template/templateChild.js +9 -2
  46. package/lib/codegen/template/vSlot.d.ts +5 -0
  47. package/lib/codegen/template/vSlot.js +80 -0
  48. package/lib/codegen/utils/index.d.ts +11 -1
  49. package/lib/codegen/utils/index.js +15 -4
  50. package/lib/codegen/utils/src.d.ts +2 -0
  51. package/lib/codegen/utils/src.js +19 -0
  52. package/lib/parsers/scriptSetupRanges.d.ts +5 -3
  53. package/lib/parsers/scriptSetupRanges.js +8 -11
  54. package/lib/parsers/vueCompilerOptions.d.ts +2 -2
  55. package/lib/plugins/vue-style-class-names.d.ts +5 -0
  56. package/lib/plugins/vue-style-class-names.js +32 -0
  57. package/lib/plugins/vue-style-reference-link.d.ts +1 -0
  58. package/lib/plugins/vue-style-reference-link.js +3 -0
  59. package/lib/plugins/vue-style-reference-links.d.ts +3 -0
  60. package/lib/plugins/vue-style-reference-links.js +26 -0
  61. package/lib/plugins/vue-template-inline-ts.js +53 -12
  62. package/lib/plugins/vue-tsx.d.ts +35 -28
  63. package/lib/plugins/vue-tsx.js +75 -55
  64. package/lib/plugins/vue-vine.d.ts +3 -0
  65. package/lib/plugins/vue-vine.js +35 -0
  66. package/lib/types.d.ts +6 -2
  67. package/lib/utils/findDestructuredProps.d.ts +1 -0
  68. package/lib/utils/findDestructuredProps.js +3 -0
  69. package/lib/utils/parseCssImports.d.ts +4 -0
  70. package/lib/utils/parseCssImports.js +19 -0
  71. package/lib/utils/parseSfc.js +4 -3
  72. package/lib/utils/signals.d.ts +2 -0
  73. package/lib/utils/signals.js +54 -0
  74. package/lib/utils/ts.d.ts +14 -2
  75. package/lib/utils/ts.js +117 -88
  76. package/lib/virtualFile/computedEmbeddedCodes.d.ts +1 -1
  77. package/lib/virtualFile/computedEmbeddedCodes.js +11 -11
  78. package/lib/virtualFile/computedSfc.d.ts +1 -2
  79. package/lib/virtualFile/computedSfc.js +79 -82
  80. package/lib/virtualFile/computedVueSfc.d.ts +1 -2
  81. package/lib/virtualFile/computedVueSfc.js +7 -7
  82. package/lib/virtualFile/vueFile.d.ts +5 -5
  83. package/lib/virtualFile/vueFile.js +6 -6
  84. package/package.json +4 -4
@@ -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").Computed<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").Computed<{
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").Computed<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.2.0",
3
+ "version": "2.2.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -17,14 +17,14 @@
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.4.9",
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
29
  "@volar/typescript": "~2.4.11",
30
30
  "@vue/compiler-sfc": "^3.5.0"
@@ -37,5 +37,5 @@
37
37
  "optional": true
38
38
  }
39
39
  },
40
- "gitHead": "5babca774658d4b9afbe877ac7c8cafdaecf2c3e"
40
+ "gitHead": "30757908b67f40f779c36795665163634fb81868"
41
41
  }