@vue/language-core 2.0.26-alpha.2 → 2.0.28

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 (45) hide show
  1. package/index.d.ts +1 -1
  2. package/index.js +1 -1
  3. package/lib/codegen/script/component.d.ts +2 -0
  4. package/lib/codegen/script/component.js +57 -41
  5. package/lib/codegen/script/globalTypes.js +4 -9
  6. package/lib/codegen/script/index.js +11 -1
  7. package/lib/codegen/script/scriptSetup.js +52 -32
  8. package/lib/codegen/template/element.js +25 -26
  9. package/lib/codegen/template/elementChildren.js +1 -1
  10. package/lib/codegen/template/elementEvents.js +10 -1
  11. package/lib/codegen/template/elementProps.js +1 -1
  12. package/lib/codegen/template/objectKey.d.ts +1 -0
  13. package/lib/codegen/template/objectKey.js +34 -0
  14. package/lib/languageModule.js +8 -7
  15. package/lib/languagePlugin.d.ts +8 -0
  16. package/lib/languagePlugin.js +175 -0
  17. package/lib/parsers/scriptSetupRanges.d.ts +3 -1
  18. package/lib/parsers/scriptSetupRanges.js +8 -0
  19. package/lib/plugins/file-dot-setup.d.ts +3 -0
  20. package/lib/plugins/file-dot-setup.js +34 -0
  21. package/lib/plugins/file-html.js +14 -3
  22. package/lib/plugins/file-md.js +14 -3
  23. package/lib/plugins/file-vue.js +14 -3
  24. package/lib/plugins/vue-script-js.js +1 -1
  25. package/lib/plugins/vue-sfc-customblocks.js +1 -1
  26. package/lib/plugins/vue-sfc-scripts.js +1 -1
  27. package/lib/plugins/vue-sfc-styles.js +1 -1
  28. package/lib/plugins/vue-sfc-template.js +1 -1
  29. package/lib/plugins/vue-template-html.js +1 -1
  30. package/lib/plugins/vue-template-inline-css.js +1 -1
  31. package/lib/plugins/vue-template-inline-ts.js +1 -1
  32. package/lib/plugins/vue-tsx.d.ts +3 -1
  33. package/lib/plugins/vue-tsx.js +1 -1
  34. package/lib/plugins.d.ts +2 -26
  35. package/lib/plugins.js +24 -10
  36. package/lib/types.d.ts +15 -11
  37. package/lib/types.js +2 -2
  38. package/lib/utils/ts.js +7 -20
  39. package/lib/virtualFile/computedFiles.d.ts +2 -2
  40. package/lib/virtualFile/computedSfc.d.ts +2 -2
  41. package/lib/virtualFile/computedVueSfc.d.ts +2 -2
  42. package/lib/virtualFile/computedVueSfc.js +3 -2
  43. package/lib/virtualFile/vueFile.d.ts +3 -3
  44. package/lib/virtualFile/vueFile.js +1 -1
  45. package/package.json +4 -4
@@ -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, VueLanguagePlugin } from '../types';
4
- export declare function computedSfc(ts: typeof import('typescript'), plugins: ReturnType<VueLanguagePlugin>[], fileName: string, snapshot: () => ts.IScriptSnapshot, parsed: () => SFCParseResult | undefined): Sfc;
3
+ import type { Sfc, VueLanguagePluginReturn } from '../types';
4
+ export declare function computedSfc(ts: typeof import('typescript'), plugins: VueLanguagePluginReturn[], fileName: string, snapshot: () => ts.IScriptSnapshot, parsed: () => SFCParseResult | undefined): Sfc;
@@ -1,4 +1,4 @@
1
1
  import type { SFCParseResult } from '@vue/compiler-sfc';
2
2
  import type * as ts from 'typescript';
3
- import type { VueLanguagePlugin } from '../types';
4
- export declare function computedVueSfc(plugins: ReturnType<VueLanguagePlugin>[], fileName: string, snapshot: () => ts.IScriptSnapshot): () => SFCParseResult | undefined;
3
+ import type { VueLanguagePluginReturn } from '../types';
4
+ export declare function computedVueSfc(plugins: VueLanguagePluginReturn[], fileName: string, languageId: string, snapshot: () => ts.IScriptSnapshot): () => SFCParseResult | undefined;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.computedVueSfc = computedVueSfc;
4
4
  const computeds_1 = require("computeds");
5
- function computedVueSfc(plugins, fileName, snapshot) {
5
+ function computedVueSfc(plugins, fileName, languageId, snapshot) {
6
6
  let cache;
7
7
  return (0, computeds_1.computed)(() => {
8
8
  // incremental update
@@ -23,7 +23,8 @@ function computedVueSfc(plugins, fileName, snapshot) {
23
23
  }
24
24
  }
25
25
  for (const plugin of plugins) {
26
- const sfc = plugin.parseSFC?.(fileName, snapshot().getText(0, snapshot().getLength()));
26
+ const sfc = plugin.parseSFC?.(fileName, snapshot().getText(0, snapshot().getLength()))
27
+ ?? plugin.parseSFC2?.(fileName, languageId, snapshot().getText(0, snapshot().getLength()));
27
28
  if (sfc) {
28
29
  if (!sfc.errors.length) {
29
30
  cache = {
@@ -1,13 +1,13 @@
1
1
  import type { VirtualCode } from '@volar/language-core';
2
2
  import { Signal } from 'computeds';
3
3
  import type * as ts from 'typescript';
4
- import type { VueCompilerOptions, VueLanguagePlugin } from '../types';
4
+ import type { VueCompilerOptions, VueLanguagePluginReturn } from '../types';
5
5
  export declare class VueVirtualCode implements VirtualCode {
6
6
  fileName: string;
7
7
  languageId: string;
8
8
  initSnapshot: ts.IScriptSnapshot;
9
9
  vueCompilerOptions: VueCompilerOptions;
10
- plugins: ReturnType<VueLanguagePlugin>[];
10
+ plugins: VueLanguagePluginReturn[];
11
11
  ts: typeof import('typescript');
12
12
  id: string;
13
13
  _snapshot: Signal<ts.IScriptSnapshot>;
@@ -18,6 +18,6 @@ export declare class VueVirtualCode implements VirtualCode {
18
18
  get embeddedCodes(): VirtualCode[];
19
19
  get snapshot(): ts.IScriptSnapshot;
20
20
  get mappings(): import("@volar/language-core").CodeMapping[];
21
- constructor(fileName: string, languageId: string, initSnapshot: ts.IScriptSnapshot, vueCompilerOptions: VueCompilerOptions, plugins: ReturnType<VueLanguagePlugin>[], ts: typeof import('typescript'));
21
+ constructor(fileName: string, languageId: string, initSnapshot: ts.IScriptSnapshot, vueCompilerOptions: VueCompilerOptions, plugins: VueLanguagePluginReturn[], ts: typeof import('typescript'));
22
22
  update(newSnapshot: ts.IScriptSnapshot): void;
23
23
  }
@@ -27,7 +27,7 @@ class VueVirtualCode {
27
27
  // sources
28
28
  this.id = 'main';
29
29
  // computeds
30
- this.getVueSfc = (0, computedVueSfc_1.computedVueSfc)(this.plugins, this.fileName, () => this._snapshot());
30
+ this.getVueSfc = (0, computedVueSfc_1.computedVueSfc)(this.plugins, this.fileName, this.languageId, () => this._snapshot());
31
31
  this.sfc = (0, computedSfc_1.computedSfc)(this.ts, this.plugins, this.fileName, () => this._snapshot(), this.getVueSfc);
32
32
  this.getMappings = (0, computedMappings_1.computedMappings)(() => this._snapshot(), this.sfc);
33
33
  this.getEmbeddedCodes = (0, computedFiles_1.computedFiles)(this.plugins, this.fileName, this.sfc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "2.0.26-alpha.2",
3
+ "version": "2.0.28",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/language-core"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/language-core": "~2.4.0-alpha.12",
15
+ "@volar/language-core": "~2.4.0-alpha.18",
16
16
  "@vue/compiler-dom": "^3.4.0",
17
17
  "@vue/shared": "^3.4.0",
18
18
  "computeds": "^0.0.1",
@@ -25,7 +25,7 @@
25
25
  "@types/minimatch": "^5.1.2",
26
26
  "@types/node": "latest",
27
27
  "@types/path-browserify": "^1.0.1",
28
- "@volar/typescript": "~2.4.0-alpha.12",
28
+ "@volar/typescript": "~2.4.0-alpha.18",
29
29
  "@vue/compiler-sfc": "^3.4.0"
30
30
  },
31
31
  "peerDependencies": {
@@ -36,5 +36,5 @@
36
36
  "optional": true
37
37
  }
38
38
  },
39
- "gitHead": "e4e8c8ca14dc564bf9043a625dd704b32bdc69d0"
39
+ "gitHead": "0cdbd70996f4fc7ac8d511b0d9fdbe20b7a4f6a3"
40
40
  }