@vue/language-core 1.8.8 → 1.8.11

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 (49) hide show
  1. package/out/generators/script.d.ts +3 -3
  2. package/out/generators/script.js +45 -9
  3. package/out/generators/template.d.ts +3 -2
  4. package/out/generators/template.js +72 -20
  5. package/out/index.d.ts +3 -0
  6. package/out/index.js +15 -2
  7. package/out/languageModule.d.ts +2 -1
  8. package/out/languageModule.js +25 -2
  9. package/out/parsers/scriptRanges.d.ts +1 -0
  10. package/out/parsers/scriptSetupRanges.d.ts +1 -0
  11. package/out/parsers/scriptSetupRanges.js +1 -1
  12. package/out/plugins/file-html.d.ts +2 -1
  13. package/out/plugins/file-html.js +2 -1
  14. package/out/plugins/file-md.d.ts +2 -1
  15. package/out/plugins/file-md.js +2 -1
  16. package/out/plugins/file-vue.d.ts +2 -1
  17. package/out/plugins/file-vue.js +2 -1
  18. package/out/plugins/vue-sfc-customblocks.d.ts +2 -1
  19. package/out/plugins/vue-sfc-customblocks.js +2 -1
  20. package/out/plugins/vue-sfc-scripts.d.ts +2 -1
  21. package/out/plugins/vue-sfc-scripts.js +2 -1
  22. package/out/plugins/vue-sfc-styles.d.ts +2 -1
  23. package/out/plugins/vue-sfc-styles.js +2 -1
  24. package/out/plugins/vue-sfc-template.d.ts +2 -1
  25. package/out/plugins/vue-sfc-template.js +2 -1
  26. package/out/plugins/vue-template-html.d.ts +2 -1
  27. package/out/plugins/vue-template-html.js +2 -1
  28. package/out/plugins/vue-tsx.d.ts +1 -0
  29. package/out/plugins/vue-tsx.js +25 -2
  30. package/out/plugins.d.ts +1 -0
  31. package/out/plugins.js +51 -20
  32. package/out/sourceFile.d.ts +9 -8
  33. package/out/sourceFile.js +24 -1
  34. package/out/types.d.ts +10 -7
  35. package/out/utils/globalTypes.d.ts +1 -0
  36. package/out/utils/parseCssClassNames.d.ts +1 -0
  37. package/out/utils/parseCssVars.d.ts +1 -0
  38. package/out/utils/parseSfc.d.ts +1 -0
  39. package/out/utils/parseSfc.js +24 -1
  40. package/out/utils/shared.d.ts +3 -0
  41. package/out/utils/shared.js +13 -1
  42. package/out/utils/transform.d.ts +1 -0
  43. package/out/utils/ts.d.ts +2 -1
  44. package/out/utils/ts.js +37 -7
  45. package/out/utils/vue2TemplateCompiler.d.ts +3 -3
  46. package/out/utils/vue2TemplateCompiler.js +23 -15
  47. package/package.json +2 -2
  48. package/out/utils/directorySharedTypes.d.ts +0 -4
  49. package/out/utils/directorySharedTypes.js +0 -150
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const plugin = ({ modules }) => {
3
4
  return {
4
5
  version: 1,
@@ -164,5 +165,5 @@ const plugin = ({ modules }) => {
164
165
  },
165
166
  };
166
167
  };
167
- module.exports = plugin;
168
+ exports.default = plugin;
168
169
  //# sourceMappingURL=vue-template-html.js.map
@@ -55,3 +55,4 @@ export declare const tsCodegen: WeakMap<Sfc, {
55
55
  }>;
56
56
  declare const plugin: VueLanguagePlugin;
57
57
  export default plugin;
58
+ //# sourceMappingURL=vue-tsx.d.ts.map
@@ -1,13 +1,36 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.tsCodegen = void 0;
4
27
  const reactivity_1 = require("@vue/reactivity");
5
28
  const script_1 = require("../generators/script");
6
- const templateGen = require("../generators/template");
29
+ const templateGen = __importStar(require("../generators/template"));
7
30
  const scriptRanges_1 = require("../parsers/scriptRanges");
8
31
  const scriptSetupRanges_1 = require("../parsers/scriptSetupRanges");
9
32
  const language_core_1 = require("@volar/language-core");
10
- const muggle = require("muggle-string");
33
+ const muggle = __importStar(require("muggle-string"));
11
34
  const templateFormatReg = /^\.template_format\.ts$/;
12
35
  const templateStyleCssReg = /^\.template_style\.css$/;
13
36
  exports.tsCodegen = new WeakMap();
package/out/plugins.d.ts CHANGED
@@ -22,3 +22,4 @@ export declare function getDefaultVueLanguagePlugins(ts: typeof import('typescri
22
22
  getEmbeddedFileNames?(fileName: string, sfc: import("./types").Sfc): string[];
23
23
  resolveEmbeddedFile?(fileName: string, sfc: import("./types").Sfc, embeddedFile: import("./sourceFile").VueEmbeddedFile): void;
24
24
  }[];
25
+ //# sourceMappingURL=plugins.d.ts.map
package/out/plugins.js CHANGED
@@ -1,33 +1,64 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
2
28
  Object.defineProperty(exports, "__esModule", { value: true });
3
29
  exports.getDefaultVueLanguagePlugins = void 0;
4
- const useHtmlFilePlugin = require("./plugins/file-html");
5
- const useMdFilePlugin = require("./plugins/file-md");
6
- const useVueFilePlugin = require("./plugins/file-vue");
7
- const useVueSfcCustomBlocks = require("./plugins/vue-sfc-customblocks");
8
- const useVueSfcScriptsFormat = require("./plugins/vue-sfc-scripts");
9
- const useVueSfcStyles = require("./plugins/vue-sfc-styles");
10
- const useVueSfcTemplate = require("./plugins/vue-sfc-template");
11
- const useHtmlTemplatePlugin = require("./plugins/vue-template-html");
12
- const vue_tsx_1 = require("./plugins/vue-tsx");
13
- const CompilerDOM = require("@vue/compiler-dom");
14
- const CompilerVue2 = require("./utils/vue2TemplateCompiler");
30
+ const file_html_1 = __importDefault(require("./plugins/file-html"));
31
+ const file_md_1 = __importDefault(require("./plugins/file-md"));
32
+ const file_vue_1 = __importDefault(require("./plugins/file-vue"));
33
+ const vue_sfc_customblocks_1 = __importDefault(require("./plugins/vue-sfc-customblocks"));
34
+ const vue_sfc_scripts_1 = __importDefault(require("./plugins/vue-sfc-scripts"));
35
+ const vue_sfc_styles_1 = __importDefault(require("./plugins/vue-sfc-styles"));
36
+ const vue_sfc_template_1 = __importDefault(require("./plugins/vue-sfc-template"));
37
+ const vue_template_html_1 = __importDefault(require("./plugins/vue-template-html"));
38
+ const vue_tsx_1 = __importDefault(require("./plugins/vue-tsx"));
39
+ const CompilerDOM = __importStar(require("@vue/compiler-dom"));
40
+ const CompilerVue2 = __importStar(require("./utils/vue2TemplateCompiler"));
15
41
  function getDefaultVueLanguagePlugins(ts, compilerOptions, vueCompilerOptions, codegenStack) {
16
42
  const plugins = [
17
- useMdFilePlugin,
18
- useHtmlFilePlugin,
19
- useVueFilePlugin,
20
- useHtmlTemplatePlugin,
21
- useVueSfcStyles,
22
- useVueSfcCustomBlocks,
23
- useVueSfcScriptsFormat,
24
- useVueSfcTemplate,
43
+ file_md_1.default,
44
+ file_html_1.default,
45
+ file_vue_1.default,
46
+ vue_template_html_1.default,
47
+ vue_sfc_styles_1.default,
48
+ vue_sfc_customblocks_1.default,
49
+ vue_sfc_scripts_1.default,
50
+ vue_sfc_template_1.default,
25
51
  vue_tsx_1.default,
26
52
  ...vueCompilerOptions.plugins,
27
53
  ];
28
54
  const pluginCtx = {
29
55
  modules: {
30
- '@vue/compiler-dom': vueCompilerOptions.target < 3 ? CompilerVue2 : CompilerDOM,
56
+ '@vue/compiler-dom': vueCompilerOptions.target < 3
57
+ ? {
58
+ ...CompilerDOM,
59
+ compile: CompilerVue2.compile,
60
+ }
61
+ : CompilerDOM,
31
62
  typescript: ts,
32
63
  },
33
64
  compilerOptions,
@@ -1,6 +1,6 @@
1
1
  import { FileCapabilities, VirtualFile, FileKind, FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core';
2
2
  import { Mapping, Segment, StackNode, Stack } from '@volar/source-map';
3
- import * as CompilerDom from '@vue/compiler-dom';
3
+ import type * as CompilerDOM from '@vue/compiler-dom';
4
4
  import type { SFCBlock, SFCParseResult, SFCScriptBlock, SFCStyleBlock, SFCTemplateBlock } from '@vue/compiler-sfc';
5
5
  import { ComputedRef } from '@vue/reactivity';
6
6
  import type * as ts from 'typescript/lib/tsserverlibrary';
@@ -31,7 +31,7 @@ export declare class VueFile implements VirtualFile {
31
31
  compiledSFCTemplateCache: {
32
32
  template: string;
33
33
  snapshot: ts.IScriptSnapshot;
34
- result: CompilerDom.CodegenResult;
34
+ result: CompilerDOM.CodegenResult;
35
35
  plugin: ReturnType<VueLanguagePlugin>;
36
36
  } | undefined;
37
37
  capabilities: FileCapabilities;
@@ -39,18 +39,18 @@ export declare class VueFile implements VirtualFile {
39
39
  mappings: Mapping<FileRangeCapabilities>[];
40
40
  codegenStacks: Stack[];
41
41
  get compiledSFCTemplate(): {
42
- errors: CompilerDom.CompilerError[];
43
- warnings: CompilerDom.CompilerError[];
44
- ast: CompilerDom.RootNode | undefined;
42
+ errors: CompilerDOM.CompilerError[];
43
+ warnings: CompilerDOM.CompilerError[];
44
+ ast: CompilerDOM.RootNode | undefined;
45
45
  } | undefined;
46
46
  get mainScriptName(): string;
47
47
  get embeddedFiles(): VirtualFile[];
48
48
  sfc: Sfc;
49
49
  _sfcBlocks: ComputedRef<Record<string, SfcBlock>>;
50
50
  _compiledSfcTemplate: ComputedRef<{
51
- errors: CompilerDom.CompilerError[];
52
- warnings: CompilerDom.CompilerError[];
53
- ast: CompilerDom.RootNode | undefined;
51
+ errors: CompilerDOM.CompilerError[];
52
+ warnings: CompilerDOM.CompilerError[];
53
+ ast: CompilerDOM.RootNode | undefined;
54
54
  } | undefined>;
55
55
  _pluginEmbeddedFiles: ComputedRef<{
56
56
  file: VueEmbeddedFile;
@@ -76,3 +76,4 @@ export declare class VueFile implements VirtualFile {
76
76
  parseCustomBlock(block: SFCBlock, i: number): Sfc['customBlocks'][number];
77
77
  parseBlock(block: SFCBlock): Omit<SfcBlock, 'name' | 'lang'>;
78
78
  }
79
+ //# sourceMappingURL=sourceFile.d.ts.map
package/out/sourceFile.js CHANGED
@@ -1,10 +1,33 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.VueFile = exports.VueEmbeddedFile = void 0;
4
27
  const language_core_1 = require("@volar/language-core");
5
28
  const source_map_1 = require("@volar/source-map");
6
29
  const reactivity_1 = require("@vue/reactivity");
7
- const muggle = require("muggle-string");
30
+ const muggle = __importStar(require("muggle-string"));
8
31
  const parseCssVars_1 = require("./utils/parseCssVars");
9
32
  const parseCssClassNames_1 = require("./utils/parseCssClassNames");
10
33
  const jsxReg = /^\.(js|ts)x?$/;
package/out/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
+ import type * as CompilerDOM from '@vue/compiler-dom';
1
2
  import type { SFCParseResult } from '@vue/compiler-sfc';
2
- import * as CompilerDom from '@vue/compiler-dom';
3
3
  import type * as ts from 'typescript/lib/tsserverlibrary';
4
- import { VueEmbeddedFile } from './sourceFile';
4
+ import type { VueEmbeddedFile } from './sourceFile';
5
5
  export type { SFCParseResult } from '@vue/compiler-sfc';
6
6
  export type RawVueCompilerOptions = Partial<Omit<VueCompilerOptions, 'target' | 'plugins'>> & {
7
7
  target?: 'auto' | 2 | 2.7 | 3 | 3.3;
@@ -23,6 +23,8 @@ export interface VueCompilerOptions {
23
23
  defineSlots: string[];
24
24
  defineEmits: string[];
25
25
  defineExpose: string[];
26
+ defineModel: string[];
27
+ defineOptions: string[];
26
28
  withDefaults: string[];
27
29
  };
28
30
  plugins: VueLanguagePlugin[];
@@ -52,13 +54,13 @@ export type VueLanguagePlugin = (ctx: {
52
54
  end: number;
53
55
  newText: string;
54
56
  }): SFCParseResult | undefined;
55
- resolveTemplateCompilerOptions?(options: CompilerDom.CompilerOptions): CompilerDom.CompilerOptions;
56
- compileSFCTemplate?(lang: string, template: string, options: CompilerDom.CompilerOptions): CompilerDom.CodegenResult | undefined;
57
- updateSFCTemplate?(oldResult: CompilerDom.CodegenResult, textChange: {
57
+ resolveTemplateCompilerOptions?(options: CompilerDOM.CompilerOptions): CompilerDOM.CompilerOptions;
58
+ compileSFCTemplate?(lang: string, template: string, options: CompilerDOM.CompilerOptions): CompilerDOM.CodegenResult | undefined;
59
+ updateSFCTemplate?(oldResult: CompilerDOM.CodegenResult, textChange: {
58
60
  start: number;
59
61
  end: number;
60
62
  newText: string;
61
- }): CompilerDom.CodegenResult | undefined;
63
+ }): CompilerDOM.CodegenResult | undefined;
62
64
  getEmbeddedFileNames?(fileName: string, sfc: Sfc): string[];
63
65
  resolveEmbeddedFile?(fileName: string, sfc: Sfc, embeddedFile: VueEmbeddedFile): void;
64
66
  };
@@ -97,7 +99,7 @@ export interface Sfc {
97
99
  customBlocks: (SfcBlock & {
98
100
  type: string;
99
101
  })[];
100
- templateAst: CompilerDom.RootNode | undefined;
102
+ templateAst: CompilerDOM.RootNode | undefined;
101
103
  scriptAst: ts.SourceFile | undefined;
102
104
  scriptSetupAst: ts.SourceFile | undefined;
103
105
  }
@@ -105,3 +107,4 @@ export interface TextRange {
105
107
  start: number;
106
108
  end: number;
107
109
  }
110
+ //# sourceMappingURL=types.d.ts.map
@@ -2,3 +2,4 @@ import { VueCompilerOptions } from '../types';
2
2
  export declare const baseName = "__VLS_types.d.ts";
3
3
  export declare function getTypesCode(vueCompilerOptions: VueCompilerOptions): string;
4
4
  export declare function genConstructorOverloads(name?: string, nums?: number): string;
5
+ //# sourceMappingURL=globalTypes.d.ts.map
@@ -2,3 +2,4 @@ export declare function parseCssClassNames(styleContent: string): Generator<{
2
2
  offset: number;
3
3
  text: string;
4
4
  }, void, unknown>;
5
+ //# sourceMappingURL=parseCssClassNames.d.ts.map
@@ -3,3 +3,4 @@ export declare function parseCssVars(styleContent: string): Generator<{
3
3
  text: string;
4
4
  }, void, unknown>;
5
5
  export declare function clearComments(css: string): string;
6
+ //# sourceMappingURL=parseCssVars.d.ts.map
@@ -1,2 +1,3 @@
1
1
  import type { SFCParseResult } from '@vue/compiler-sfc';
2
2
  export declare function parse(source: string): SFCParseResult;
3
+ //# sourceMappingURL=parseSfc.d.ts.map
@@ -1,7 +1,30 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.parse = void 0;
4
- const compiler = require("@vue/compiler-dom");
27
+ const compiler = __importStar(require("@vue/compiler-dom"));
5
28
  function parse(source) {
6
29
  const errors = [];
7
30
  const ast = compiler.parse(source, {
@@ -1 +1,4 @@
1
1
  export declare function getSlotsPropertyName(vueVersion: number): "$scopedSlots" | "$slots";
2
+ export { hyphenate as hyphenateTag } from '@vue/shared';
3
+ export declare function hyphenateAttr(str: string): string;
4
+ //# sourceMappingURL=shared.d.ts.map
@@ -1,8 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSlotsPropertyName = void 0;
3
+ exports.hyphenateAttr = exports.hyphenateTag = exports.getSlotsPropertyName = void 0;
4
+ const shared_1 = require("@vue/shared");
4
5
  function getSlotsPropertyName(vueVersion) {
5
6
  return vueVersion < 3 ? '$scopedSlots' : '$slots';
6
7
  }
7
8
  exports.getSlotsPropertyName = getSlotsPropertyName;
9
+ var shared_2 = require("@vue/shared");
10
+ Object.defineProperty(exports, "hyphenateTag", { enumerable: true, get: function () { return shared_2.hyphenate; } });
11
+ function hyphenateAttr(str) {
12
+ let hyphencase = (0, shared_1.hyphenate)(str);
13
+ // fix https://github.com/vuejs/core/issues/8811
14
+ if (str.length && str[0] !== str[0].toLowerCase()) {
15
+ hyphencase = '-' + hyphencase;
16
+ }
17
+ return hyphencase;
18
+ }
19
+ exports.hyphenateAttr = hyphenateAttr;
8
20
  //# sourceMappingURL=shared.js.map
@@ -6,3 +6,4 @@ export declare function walkInterpolationFragment(ts: typeof import('typescript/
6
6
  offset: number;
7
7
  }[];
8
8
  export declare function colletVars(ts: typeof import('typescript/lib/tsserverlibrary'), node: ts.Node, result: string[]): void;
9
+ //# sourceMappingURL=transform.d.ts.map
package/out/utils/ts.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { VueCompilerOptions } from '../types';
3
3
  export type ParsedCommandLine = ts.ParsedCommandLine & {
4
4
  vueOptions: Partial<VueCompilerOptions>;
5
5
  };
6
- export declare function createParsedCommandLineByJson(ts: typeof import('typescript/lib/tsserverlibrary'), parseConfigHost: ts.ParseConfigHost, rootDir: string, json: any): ParsedCommandLine;
6
+ export declare function createParsedCommandLineByJson(ts: typeof import('typescript/lib/tsserverlibrary'), parseConfigHost: ts.ParseConfigHost, rootDir: string, json: any, configFileName?: string): ParsedCommandLine;
7
7
  export declare function createParsedCommandLine(ts: typeof import('typescript/lib/tsserverlibrary'), parseConfigHost: ts.ParseConfigHost, tsConfigPath: string): ParsedCommandLine;
8
8
  export declare function resolveVueCompilerOptions(vueOptions: Partial<VueCompilerOptions>): VueCompilerOptions;
9
+ //# sourceMappingURL=ts.d.ts.map
package/out/utils/ts.js CHANGED
@@ -1,10 +1,33 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.resolveVueCompilerOptions = exports.createParsedCommandLine = exports.createParsedCommandLineByJson = void 0;
4
- const path = require("path");
5
- function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json) {
27
+ const path = __importStar(require("path"));
28
+ function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json, configFileName = rootDir + '/jsconfig.json') {
6
29
  const proxyHost = proxyParseConfigHostForExtendConfigPaths(parseConfigHost);
7
- ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, rootDir + '/jsconfig.json');
30
+ ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName);
8
31
  let vueOptions = {};
9
32
  for (const extendPath of proxyHost.extendConfigPaths.reverse()) {
10
33
  try {
@@ -15,7 +38,7 @@ function createParsedCommandLineByJson(ts, parseConfigHost, rootDir, json) {
15
38
  }
16
39
  catch (err) { }
17
40
  }
18
- const parsed = ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, rootDir + '/jsconfig.json', undefined, (vueOptions.extensions ?? ['.vue']).map(extension => ({
41
+ const parsed = ts.parseJsonConfigFileContent(json, proxyHost.host, rootDir, {}, configFileName, undefined, (vueOptions.extensions ?? ['.vue']).map(extension => ({
19
42
  extension: extension.slice(1),
20
43
  isMixedContent: true,
21
44
  scriptKind: ts.ScriptKind.Deferred,
@@ -120,12 +143,16 @@ function getPartialVueCompilerOptions(ts, tsConfigSourceFile) {
120
143
  if (resolvedPath) {
121
144
  return require(resolvedPath);
122
145
  }
146
+ else {
147
+ console.warn('Load plugin failed:', pluginPath);
148
+ }
123
149
  }
124
150
  catch (error) {
125
- console.warn('Load plugin failed', pluginPath, error);
151
+ console.warn('Load plugin failed:', pluginPath, error);
126
152
  }
153
+ return [];
127
154
  })
128
- .filter((plugin) => !!plugin);
155
+ .flat(Infinity);
129
156
  result.plugins = plugins;
130
157
  }
131
158
  if (rawOptions.hooks) {
@@ -198,12 +225,15 @@ function resolveVueCompilerOptions(vueOptions) {
198
225
  optionsWrapper: vueOptions.optionsWrapper ?? (target >= 2.7
199
226
  ? [`(await import('${lib}')).defineComponent(`, `)`]
200
227
  : [`(await import('vue')).default.extend(`, `)`]),
201
- macros: vueOptions.macros ?? {
228
+ macros: {
202
229
  defineProps: ['defineProps'],
203
230
  defineSlots: ['defineSlots'],
204
231
  defineEmits: ['defineEmits'],
205
232
  defineExpose: ['defineExpose'],
233
+ defineModel: ['defineModel'],
234
+ defineOptions: ['defineOptions'],
206
235
  withDefaults: ['withDefaults'],
236
+ ...vueOptions.macros,
207
237
  },
208
238
  plugins: vueOptions.plugins ?? [],
209
239
  hooks: vueOptions.hooks ?? [],
@@ -1,3 +1,3 @@
1
- import * as CompilerDom from '@vue/compiler-dom';
2
- export * from '@vue/compiler-dom';
3
- export declare function compile(template: string, options?: CompilerDom.CompilerOptions): CompilerDom.CodegenResult;
1
+ import * as CompilerDOM from '@vue/compiler-dom';
2
+ export declare function compile(template: string, options?: CompilerDOM.CompilerOptions): CompilerDOM.CodegenResult;
3
+ //# sourceMappingURL=vue2TemplateCompiler.d.ts.map
@@ -10,20 +10,28 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
15
24
  };
16
25
  Object.defineProperty(exports, "__esModule", { value: true });
17
26
  exports.compile = void 0;
18
- const CompilerDom = require("@vue/compiler-dom");
27
+ const CompilerDOM = __importStar(require("@vue/compiler-dom"));
19
28
  const Vue2TemplateCompiler = require('vue-template-compiler/build');
20
- __exportStar(require("@vue/compiler-dom"), exports);
21
29
  function compile(template, options = {}) {
22
30
  const onError = options.onError;
23
31
  const onWarn = options.onWarn;
24
32
  options.onError = (error) => {
25
- if (error.code === 33 /* CompilerDom.ErrorCodes.X_V_FOR_TEMPLATE_KEY_PLACEMENT */ // :key binding allowed in v-for template child in vue 2
26
- || error.code === 29 /* CompilerDom.ErrorCodes.X_V_IF_SAME_KEY */ // fix https://github.com/vuejs/language-tools/issues/1638
33
+ if (error.code === 33 // :key binding allowed in v-for template child in vue 2
34
+ || error.code === 29 // fix https://github.com/vuejs/language-tools/issues/1638
27
35
  ) {
28
36
  return;
29
37
  }
@@ -59,12 +67,12 @@ function compile(template, options = {}) {
59
67
  },
60
68
  });
61
69
  }
62
- return baseCompile(template, Object.assign({}, CompilerDom.parserOptions, options, {
70
+ return baseCompile(template, Object.assign({}, CompilerDOM.parserOptions, options, {
63
71
  nodeTransforms: [
64
- ...CompilerDom.DOMNodeTransforms,
72
+ ...CompilerDOM.DOMNodeTransforms,
65
73
  ...(options.nodeTransforms || [])
66
74
  ],
67
- directiveTransforms: Object.assign({}, CompilerDom.DOMDirectiveTransforms, options.directiveTransforms || {}),
75
+ directiveTransforms: Object.assign({}, CompilerDOM.DOMDirectiveTransforms, options.directiveTransforms || {}),
68
76
  }));
69
77
  }
70
78
  exports.compile = compile;
@@ -73,19 +81,19 @@ function baseCompile(template, options = {}) {
73
81
  const isModuleMode = options.mode === 'module';
74
82
  const prefixIdentifiers = options.prefixIdentifiers === true || isModuleMode;
75
83
  if (!prefixIdentifiers && options.cacheHandlers) {
76
- onError(CompilerDom.createCompilerError(49 /* CompilerDom.ErrorCodes.X_CACHE_HANDLER_NOT_SUPPORTED */));
84
+ onError(CompilerDOM.createCompilerError(49));
77
85
  }
78
86
  if (options.scopeId && !isModuleMode) {
79
- onError(CompilerDom.createCompilerError(50 /* CompilerDom.ErrorCodes.X_SCOPE_ID_NOT_SUPPORTED */));
87
+ onError(CompilerDOM.createCompilerError(50));
80
88
  }
81
- const ast = CompilerDom.baseParse(template, options);
82
- const [nodeTransforms, directiveTransforms] = CompilerDom.getBaseTransformPreset(prefixIdentifiers);
89
+ const ast = CompilerDOM.baseParse(template, options);
90
+ const [nodeTransforms, directiveTransforms] = CompilerDOM.getBaseTransformPreset(prefixIdentifiers);
83
91
  // v-for > v-if in vue 2
84
92
  const transformIf = nodeTransforms[1];
85
93
  const transformFor = nodeTransforms[3];
86
94
  nodeTransforms[1] = transformFor;
87
95
  nodeTransforms[3] = transformIf;
88
- CompilerDom.transform(ast, Object.assign({}, options, {
96
+ CompilerDOM.transform(ast, Object.assign({}, options, {
89
97
  prefixIdentifiers,
90
98
  nodeTransforms: [
91
99
  ...nodeTransforms,
@@ -94,7 +102,7 @@ function baseCompile(template, options = {}) {
94
102
  directiveTransforms: Object.assign({}, directiveTransforms, options.directiveTransforms || {} // user transforms
95
103
  )
96
104
  }));
97
- return CompilerDom.generate(ast, Object.assign({}, options, {
105
+ return CompilerDOM.generate(ast, Object.assign({}, options, {
98
106
  prefixIdentifiers
99
107
  }));
100
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/language-core",
3
- "version": "1.8.8",
3
+ "version": "1.8.11",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -34,5 +34,5 @@
34
34
  "optional": true
35
35
  }
36
36
  },
37
- "gitHead": "62a08c35722319bcca90ea3ebd3236fbd986a6a6"
37
+ "gitHead": "cce193dcc182aad5d02f630fa3ae8a793d443680"
38
38
  }
@@ -1,4 +0,0 @@
1
- import { VueCompilerOptions } from '../types';
2
- export declare const baseName = "__VLS_types.d.ts";
3
- export declare function getTypesCode(vueCompilerOptions: VueCompilerOptions): string;
4
- export declare function genConstructorOverloads(name?: string, nums?: number): string;