vue-component-meta 3.0.5 → 3.0.7-alpha.0
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 +0 -12
- package/lib/base.js +27 -10
- package/lib/helpers.d.ts +1 -0
- package/lib/helpers.js +3 -0
- package/package.json +8 -9
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, () =>
|
|
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, () =>
|
|
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,
|
|
34
|
-
let commandLine =
|
|
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(
|
|
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 =
|
|
134
|
-
fileNames = new Set(
|
|
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-
|
|
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
|
|
package/lib/helpers.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type * from 'vue-component-type-helpers';
|
package/lib/helpers.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-component-meta",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7-alpha.0",
|
|
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.
|
|
17
|
-
"@vue/language-core": "3.0.
|
|
18
|
-
"path-browserify": "^1.0.1"
|
|
16
|
+
"@volar/typescript": "2.4.23",
|
|
17
|
+
"@vue/language-core": "3.0.7-alpha.0",
|
|
18
|
+
"path-browserify": "^1.0.1",
|
|
19
|
+
"vue-component-type-helpers": "3.0.7-alpha.0"
|
|
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": "
|
|
28
|
+
"gitHead": "a66f2330b5aa6f811f571159245c46af0c36c534"
|
|
30
29
|
}
|