@vue/language-core 2.1.6-patch.1 → 2.1.8

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 (43) hide show
  1. package/lib/codegen/globalTypes.js +9 -4
  2. package/lib/codegen/inlayHints.d.ts +11 -0
  3. package/lib/codegen/inlayHints.js +17 -0
  4. package/lib/codegen/script/component.d.ts +1 -1
  5. package/lib/codegen/script/component.js +5 -5
  6. package/lib/codegen/script/componentSelf.js +1 -1
  7. package/lib/codegen/script/context.d.ts +1 -1
  8. package/lib/codegen/script/index.d.ts +1 -0
  9. package/lib/codegen/script/index.js +23 -10
  10. package/lib/codegen/script/scriptSetup.js +103 -112
  11. package/lib/codegen/script/styleModulesType.js +3 -5
  12. package/lib/codegen/script/template.d.ts +1 -1
  13. package/lib/codegen/script/template.js +4 -9
  14. package/lib/codegen/template/context.d.ts +1 -1
  15. package/lib/codegen/template/element.d.ts +1 -1
  16. package/lib/codegen/template/element.js +19 -8
  17. package/lib/codegen/template/elementDirectives.js +63 -31
  18. package/lib/codegen/template/elementProps.js +6 -16
  19. package/lib/codegen/template/interpolation.js +0 -6
  20. package/lib/codegen/template/slotOutlet.js +5 -0
  21. package/lib/codegen/template/templateChild.d.ts +1 -1
  22. package/lib/codegen/template/templateChild.js +2 -2
  23. package/lib/codegen/template/vFor.js +1 -1
  24. package/lib/parsers/scriptSetupRanges.d.ts +12 -3
  25. package/lib/parsers/scriptSetupRanges.js +28 -25
  26. package/lib/plugins/vue-tsx.d.ts +23 -14
  27. package/lib/plugins/vue-tsx.js +35 -35
  28. package/lib/types.d.ts +3 -1
  29. package/lib/utils/parseCssClassNames.d.ts +1 -1
  30. package/lib/utils/parseCssClassNames.js +5 -4
  31. package/lib/utils/parseCssVars.d.ts +3 -2
  32. package/lib/utils/parseCssVars.js +12 -11
  33. package/lib/utils/ts.d.ts +1 -1
  34. package/lib/utils/ts.js +3 -5
  35. package/lib/virtualFile/computedEmbeddedCodes.d.ts +2 -1
  36. package/lib/virtualFile/computedEmbeddedCodes.js +11 -11
  37. package/lib/virtualFile/computedSfc.d.ts +2 -1
  38. package/lib/virtualFile/computedSfc.js +77 -76
  39. package/lib/virtualFile/computedVueSfc.d.ts +2 -1
  40. package/lib/virtualFile/computedVueSfc.js +8 -8
  41. package/lib/virtualFile/vueFile.d.ts +6 -7
  42. package/lib/virtualFile/vueFile.js +13 -12
  43. package/package.json +10 -8
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.computedVueSfc = computedVueSfc;
4
- const computeds_1 = require("computeds");
4
+ const alien_signals_1 = require("alien-signals");
5
5
  function computedVueSfc(plugins, fileName, languageId, snapshot) {
6
6
  let cache;
7
- return (0, computeds_1.computed)(() => {
7
+ return (0, alien_signals_1.computed)(() => {
8
8
  // incremental update
9
9
  if (cache?.plugin.updateSFC) {
10
- const change = snapshot().getChangeRange(cache.snapshot);
10
+ const change = snapshot.get().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().getText(change.span.start, change.span.start + change.newLength),
15
+ newText: snapshot.get().getText(change.span.start, change.span.start + change.newLength),
16
16
  });
17
17
  if (newSfc) {
18
- cache.snapshot = snapshot();
18
+ cache.snapshot = snapshot.get();
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().getText(0, snapshot().getLength()))
27
- ?? plugin.parseSFC2?.(fileName, languageId, snapshot().getText(0, snapshot().getLength()));
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()));
28
28
  if (sfc) {
29
29
  if (!sfc.errors.length) {
30
30
  cache = {
31
- snapshot: snapshot(),
31
+ snapshot: snapshot.get(),
32
32
  sfc,
33
33
  plugin,
34
34
  };
@@ -1,5 +1,4 @@
1
1
  import type { VirtualCode } from '@volar/language-core';
2
- import { Signal } from 'computeds';
3
2
  import type * as ts from 'typescript';
4
3
  import type { VueCompilerOptions, VueLanguagePluginReturn } from '../types';
5
4
  export declare class VueVirtualCode implements VirtualCode {
@@ -10,16 +9,16 @@ export declare class VueVirtualCode implements VirtualCode {
10
9
  plugins: VueLanguagePluginReturn[];
11
10
  ts: typeof import('typescript');
12
11
  id: string;
13
- getSnapshot: Signal<ts.IScriptSnapshot>;
14
- getVueSfc: () => import("@vue/compiler-sfc").SFCParseResult | undefined;
15
- sfc: import("../types").Sfc;
16
- getMappings: () => {
12
+ _snapshot: import("alien-signals").Signal<ts.IScriptSnapshot>;
13
+ _vueSfc: import("alien-signals").ISignal<import("@vue/compiler-sfc").SFCParseResult | undefined>;
14
+ _sfc: import("../types").Sfc;
15
+ _mappings: import("alien-signals").ISignal<{
17
16
  sourceOffsets: number[];
18
17
  generatedOffsets: number[];
19
18
  lengths: number[];
20
19
  data: import("@volar/language-core").CodeInformation;
21
- }[];
22
- getEmbeddedCodes: () => VirtualCode[];
20
+ }[]>;
21
+ _embeddedCodes: import("alien-signals").ISignal<VirtualCode[]>;
23
22
  get embeddedCodes(): VirtualCode[];
24
23
  get snapshot(): ts.IScriptSnapshot;
25
24
  get mappings(): {
@@ -1,21 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VueVirtualCode = void 0;
4
- const computeds_1 = require("computeds");
4
+ const alien_signals_1 = require("alien-signals");
5
+ const plugins_1 = require("../plugins");
5
6
  const computedEmbeddedCodes_1 = require("./computedEmbeddedCodes");
6
7
  const computedSfc_1 = require("./computedSfc");
7
8
  const computedVueSfc_1 = require("./computedVueSfc");
8
- const plugins_1 = require("../plugins");
9
9
  class VueVirtualCode {
10
10
  // others
11
11
  get embeddedCodes() {
12
- return this.getEmbeddedCodes();
12
+ return this._embeddedCodes.get();
13
13
  }
14
14
  get snapshot() {
15
- return this.getSnapshot();
15
+ return this._snapshot.get();
16
16
  }
17
17
  get mappings() {
18
- return this.getMappings();
18
+ return this._mappings.get();
19
19
  }
20
20
  constructor(fileName, languageId, initSnapshot, vueCompilerOptions, plugins, ts) {
21
21
  this.fileName = fileName;
@@ -26,11 +26,12 @@ class VueVirtualCode {
26
26
  this.ts = ts;
27
27
  // sources
28
28
  this.id = 'main';
29
+ this._snapshot = (0, alien_signals_1.signal)(undefined);
29
30
  // computeds
30
- this.getVueSfc = (0, computedVueSfc_1.computedVueSfc)(this.plugins, this.fileName, this.languageId, () => this.getSnapshot());
31
- this.sfc = (0, computedSfc_1.computedSfc)(this.ts, this.plugins, this.fileName, () => this.getSnapshot(), this.getVueSfc);
32
- this.getMappings = (0, computeds_1.computed)(() => {
33
- const snapshot = this.getSnapshot();
31
+ this._vueSfc = (0, computedVueSfc_1.computedVueSfc)(this.plugins, this.fileName, this.languageId, this._snapshot);
32
+ this._sfc = (0, computedSfc_1.computedSfc)(this.ts, this.plugins, this.fileName, this._snapshot, this._vueSfc);
33
+ this._mappings = (0, alien_signals_1.computed)(() => {
34
+ const snapshot = this._snapshot.get();
34
35
  return [{
35
36
  sourceOffsets: [0],
36
37
  generatedOffsets: [0],
@@ -38,11 +39,11 @@ class VueVirtualCode {
38
39
  data: plugins_1.allCodeFeatures,
39
40
  }];
40
41
  });
41
- this.getEmbeddedCodes = (0, computedEmbeddedCodes_1.computedEmbeddedCodes)(this.plugins, this.fileName, this.sfc);
42
- this.getSnapshot = (0, computeds_1.signal)(initSnapshot);
42
+ this._embeddedCodes = (0, computedEmbeddedCodes_1.computedEmbeddedCodes)(this.plugins, this.fileName, this._sfc);
43
+ this._snapshot.set(initSnapshot);
43
44
  }
44
45
  update(newSnapshot) {
45
- this.getSnapshot.set(newSnapshot);
46
+ this._snapshot.set(newSnapshot);
46
47
  }
47
48
  }
48
49
  exports.VueVirtualCode = VueVirtualCode;
package/package.json CHANGED
@@ -1,22 +1,23 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "2.1.6-patch.1",
3
+ "version": "2.1.8",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
7
7
  "**/*.d.ts"
8
8
  ],
9
+ "sideEffects": false,
9
10
  "repository": {
10
11
  "type": "git",
11
12
  "url": "https://github.com/vuejs/language-tools.git",
12
13
  "directory": "packages/language-core"
13
14
  },
14
15
  "dependencies": {
15
- "@volar/language-core": "~2.4.1",
16
- "@vue/compiler-dom": "^3.5.2",
16
+ "@volar/language-core": "~2.4.8",
17
+ "@vue/compiler-dom": "^3.5.0",
17
18
  "@vue/compiler-vue2": "^2.7.16",
18
- "@vue/shared": "^3.5.2",
19
- "computeds": "^0.0.1",
19
+ "@vue/shared": "^3.5.0",
20
+ "alien-signals": "^0.2.0",
20
21
  "minimatch": "^9.0.3",
21
22
  "muggle-string": "^0.4.1",
22
23
  "path-browserify": "^1.0.1"
@@ -25,8 +26,8 @@
25
26
  "@types/minimatch": "^5.1.2",
26
27
  "@types/node": "latest",
27
28
  "@types/path-browserify": "^1.0.1",
28
- "@volar/typescript": "~2.4.1",
29
- "@vue/compiler-sfc": "^3.5.2"
29
+ "@volar/typescript": "~2.4.8",
30
+ "@vue/compiler-sfc": "^3.5.0"
30
31
  },
31
32
  "peerDependencies": {
32
33
  "typescript": "*"
@@ -35,5 +36,6 @@
35
36
  "typescript": {
36
37
  "optional": true
37
38
  }
38
- }
39
+ },
40
+ "gitHead": "25cccedc53e7361ed4e34296d6ecd43d7de2a095"
39
41
  }