vue-component-meta 3.0.5 → 3.0.6

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.
package/lib/base.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import * as vue from '@vue/language-core';
2
1
  import type * as ts from 'typescript';
3
2
  import type { ComponentMeta, MetaCheckerOptions } from './types';
4
3
  export * from './types';
@@ -24,14 +23,3 @@ export declare function createCheckerBase(ts: typeof import('typescript'), tscon
24
23
  tsLs: ts.LanguageService;
25
24
  };
26
25
  };
27
- export declare function baseCreate(ts: typeof import('typescript'), getCommandLine: () => vue.ParsedCommandLine, checkerOptions: MetaCheckerOptions, rootPath: string, globalComponentName: string): {
28
- getExportNames: (componentPath: string) => string[];
29
- getComponentMeta: (componentPath: string, exportName?: string) => ComponentMeta;
30
- updateFile(fileName: string, text: string): void;
31
- deleteFile(fileName: string): void;
32
- reload(): void;
33
- clearCache(): void;
34
- __internal__: {
35
- tsLs: ts.LanguageService;
36
- };
37
- };
package/lib/base.js CHANGED
@@ -16,7 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.createCheckerByJsonConfigBase = createCheckerByJsonConfigBase;
18
18
  exports.createCheckerBase = createCheckerBase;
19
- exports.baseCreate = baseCreate;
20
19
  const typescript_1 = require("@volar/typescript");
21
20
  const vue = require("@vue/language-core");
22
21
  const path_browserify_1 = require("path-browserify");
@@ -24,18 +23,36 @@ __exportStar(require("./types"), exports);
24
23
  const windowsPathReg = /\\/g;
25
24
  function createCheckerByJsonConfigBase(ts, rootDir, json, checkerOptions = {}) {
26
25
  rootDir = rootDir.replace(windowsPathReg, '/');
27
- return baseCreate(ts, () => vue.createParsedCommandLineByJson(ts, ts.sys, rootDir, json), checkerOptions, rootDir, path_browserify_1.posix.join(rootDir, 'jsconfig.json.global.vue'));
26
+ return baseCreate(ts, () => {
27
+ const commandLine = vue.createParsedCommandLineByJson(ts, ts.sys, rootDir, json);
28
+ const { fileNames } = ts.parseJsonConfigFileContent(json, ts.sys, rootDir, {}, undefined, undefined, vue.getAllExtensions(commandLine.vueOptions)
29
+ .map(extension => ({
30
+ extension: extension.slice(1),
31
+ isMixedContent: true,
32
+ scriptKind: ts.ScriptKind.Deferred,
33
+ })));
34
+ return [commandLine, fileNames];
35
+ }, checkerOptions, rootDir, path_browserify_1.posix.join(rootDir, 'jsconfig.json.global.vue'));
28
36
  }
29
37
  function createCheckerBase(ts, tsconfig, checkerOptions = {}) {
30
38
  tsconfig = tsconfig.replace(windowsPathReg, '/');
31
- return baseCreate(ts, () => vue.createParsedCommandLine(ts, ts.sys, tsconfig), checkerOptions, path_browserify_1.posix.dirname(tsconfig), tsconfig + '.global.vue');
39
+ return baseCreate(ts, () => {
40
+ const commandLine = vue.createParsedCommandLine(ts, ts.sys, tsconfig);
41
+ const { fileNames } = ts.parseJsonSourceFileConfigFileContent(ts.readJsonConfigFile(tsconfig, ts.sys.readFile), ts.sys, path_browserify_1.posix.dirname(tsconfig), {}, tsconfig, undefined, vue.getAllExtensions(commandLine.vueOptions)
42
+ .map(extension => ({
43
+ extension: extension.slice(1),
44
+ isMixedContent: true,
45
+ scriptKind: ts.ScriptKind.Deferred,
46
+ })));
47
+ return [commandLine, fileNames];
48
+ }, checkerOptions, path_browserify_1.posix.dirname(tsconfig), tsconfig + '.global.vue');
32
49
  }
33
- function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponentName) {
34
- let commandLine = getCommandLine();
50
+ function baseCreate(ts, getConfigAndFiles, checkerOptions, rootPath, globalComponentName) {
51
+ let [commandLine, _fileNames] = getConfigAndFiles();
35
52
  /**
36
53
  * Used to lookup if a file is referenced.
37
54
  */
38
- let fileNames = new Set(commandLine.fileNames.map(path => path.replace(windowsPathReg, '/')));
55
+ let fileNames = new Set(_fileNames.map(path => path.replace(windowsPathReg, '/')));
39
56
  let projectVersion = 0;
40
57
  vue.writeGlobalTypes(commandLine.vueOptions, ts.sys.writeFile);
41
58
  const projectHost = {
@@ -130,8 +147,8 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
130
147
  projectVersion++;
131
148
  },
132
149
  reload() {
133
- commandLine = getCommandLine();
134
- fileNames = new Set(commandLine.fileNames.map(path => path.replace(windowsPathReg, '/')));
150
+ [commandLine, _fileNames] = getConfigAndFiles();
151
+ fileNames = new Set(_fileNames.map(path => path.replace(windowsPathReg, '/')));
135
152
  this.clearCache();
136
153
  },
137
154
  clearCache() {
@@ -152,8 +169,8 @@ function baseCreate(ts, getCommandLine, checkerOptions, rootPath, globalComponen
152
169
  }
153
170
  function getMetaScriptContent(fileName) {
154
171
  let code = `
155
- import type { ComponentType, ComponentProps, ComponentEmit, ComponentSlots, ComponentExposed } from 'vue-component-type-helpers';
156
- import * as Components from '${fileName.slice(0, -'.meta.ts'.length)}';
172
+ import type { ComponentType, ComponentProps, ComponentEmit, ComponentSlots, ComponentExposed } from 'vue-component-meta/lib/helpers';
173
+ import type * as Components from '${fileName.slice(0, -'.meta.ts'.length)}';
157
174
 
158
175
  export default {} as { [K in keyof typeof Components]: ComponentMeta<typeof Components[K]>; };
159
176
 
@@ -0,0 +1 @@
1
+ export type * from 'vue-component-type-helpers';
package/lib/helpers.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=helpers.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-component-meta",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -13,18 +13,17 @@
13
13
  "directory": "packages/component-meta"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/typescript": "2.4.22",
17
- "@vue/language-core": "3.0.5",
18
- "path-browserify": "^1.0.1"
16
+ "@volar/typescript": "2.4.23",
17
+ "@vue/language-core": "3.0.6",
18
+ "path-browserify": "^1.0.1",
19
+ "vue-component-type-helpers": "3.0.6"
19
20
  },
20
21
  "peerDependencies": {
21
- "typescript": "*",
22
- "vue-component-type-helpers": "3.0.1"
22
+ "typescript": "*"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/node": "^22.10.4",
26
- "@types/path-browserify": "^1.0.1",
27
- "vue-component-type-helpers": "3.0.2"
26
+ "@types/path-browserify": "^1.0.1"
28
27
  },
29
- "gitHead": "036b6b1882179d35586e16f2a5cba5150e5d18e6"
28
+ "gitHead": "59f8cde8a5148e54294868104312b2b0f4c30d1e"
30
29
  }