@tsslint/cli 1.5.16 → 1.5.18
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/index.js +0 -6
- package/lib/languagePlugins.d.ts +1 -1
- package/lib/languagePlugins.js +6 -113
- package/package.json +5 -4
package/index.js
CHANGED
|
@@ -290,12 +290,6 @@ class Project {
|
|
|
290
290
|
(spinner?.stop ?? clack.log.message)(cached
|
|
291
291
|
? darkGray(`Processed ${processed} files with cache. (Use `) + cyan(`--force`) + darkGray(` to ignore cache.)`)
|
|
292
292
|
: darkGray(`Processed ${processed} files.`));
|
|
293
|
-
if (process.argv.includes('--fix') && !formattingSettings) {
|
|
294
|
-
const vscodeSettings = ts.findConfigFile(process.cwd(), ts.sys.fileExists, '.vscode/settings.json');
|
|
295
|
-
if (vscodeSettings) {
|
|
296
|
-
clack.log.message(darkGray(`Found available editor settings, you can use `) + cyan(`--vscode-settings ${path.relative(process.cwd(), vscodeSettings)}`) + darkGray(` to enable code format.`));
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
293
|
const projectsFlag = process.argv.find(arg => arg.endsWith('-projects'));
|
|
300
294
|
if (projectsFlag) {
|
|
301
295
|
clack.log.warn(darkGray(`Please use `)
|
package/lib/languagePlugins.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LanguagePlugin } from '@volar/language-core';
|
|
1
|
+
import type { LanguagePlugin } from '@volar/language-core';
|
|
2
2
|
export declare function load(tsconfig: string, languages: string[]): Promise<LanguagePlugin<string, import("@volar/language-core").VirtualCode>[]>;
|
package/lib/languagePlugins.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.load = load;
|
|
4
|
-
const
|
|
4
|
+
const language_hub_1 = require("@volar/language-hub");
|
|
5
5
|
const ts = require("typescript");
|
|
6
6
|
const cache = new Map();
|
|
7
7
|
async function load(tsconfig, languages) {
|
|
@@ -10,128 +10,21 @@ async function load(tsconfig, languages) {
|
|
|
10
10
|
}
|
|
11
11
|
const plugins = [];
|
|
12
12
|
if (languages.includes('vue')) {
|
|
13
|
-
|
|
14
|
-
let vueTscPkgPath;
|
|
15
|
-
if (findPackageJson('@vue/language-core')) {
|
|
16
|
-
vue = require('@vue/language-core');
|
|
17
|
-
}
|
|
18
|
-
else if (vueTscPkgPath = findPackageJson('vue-tsc')) {
|
|
19
|
-
const vueTscPath = path.dirname(vueTscPkgPath);
|
|
20
|
-
vue = require(require.resolve('@vue/language-core', { paths: [vueTscPath] }));
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
const pkg = ts.findConfigFile(path.dirname(tsconfig), ts.sys.fileExists, 'package.json');
|
|
24
|
-
if (pkg) {
|
|
25
|
-
throw new Error('Please install @vue/language-core or vue-tsc to ' + path.relative(process.cwd(), pkg));
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
throw new Error('Please install @vue/language-core or vue-tsc for ' + path.relative(process.cwd(), tsconfig));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const commonLine = vue.createParsedCommandLine(ts, ts.sys, tsconfig);
|
|
32
|
-
const vueLanguagePlugin = vue.createVueLanguagePlugin(ts, commonLine.options, commonLine.vueOptions, fileName => fileName);
|
|
33
|
-
plugins.push(vueLanguagePlugin);
|
|
13
|
+
plugins.push((0, language_hub_1.createVuePlugin)(ts, tsconfig));
|
|
34
14
|
}
|
|
35
15
|
if (languages.includes('vue-vine')) {
|
|
36
|
-
|
|
37
|
-
let vueVine;
|
|
38
|
-
let pkgPath;
|
|
39
|
-
if (pkgPath = findPackageJson('@vue-vine/language-service')) {
|
|
40
|
-
const pkgDir = path.dirname(pkgPath);
|
|
41
|
-
vueVine = require('@vue-vine/language-service');
|
|
42
|
-
vue = require(require.resolve('@vue/language-core', { paths: [pkgDir] }));
|
|
43
|
-
}
|
|
44
|
-
else if (pkgPath = findPackageJson('vue-vine-tsc')) {
|
|
45
|
-
const pkgDir = path.dirname(pkgPath);
|
|
46
|
-
vue = require(require.resolve('@vue/language-core', { paths: [pkgDir] }));
|
|
47
|
-
vueVine = require(require.resolve('@vue/language-core', { paths: [pkgDir] }));
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
const pkg = ts.findConfigFile(path.dirname(tsconfig), ts.sys.fileExists, 'package.json');
|
|
51
|
-
if (pkg) {
|
|
52
|
-
throw new Error('Please install @vue-vine/language-service or vue-vine-tsc to ' + path.relative(process.cwd(), pkg));
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
throw new Error('Please install @vue-vine/language-service or vue-vine-tsc for ' + path.relative(process.cwd(), tsconfig));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const commonLine = vue.createParsedCommandLine(ts, ts.sys, tsconfig, true);
|
|
59
|
-
const globalTypesFilePath = vueVine.setupGlobalTypes(path.dirname(tsconfig), commonLine.vueOptions, ts.sys);
|
|
60
|
-
if (globalTypesFilePath) {
|
|
61
|
-
commonLine.vueOptions.__setupedGlobalTypes = {
|
|
62
|
-
absolutePath: globalTypesFilePath,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
plugins.push(vue.createVueLanguagePlugin(ts, commonLine.options, commonLine.vueOptions, id => id));
|
|
66
|
-
plugins.push(vueVine.createVueVineLanguagePlugin(ts, {
|
|
67
|
-
compilerOptions: commonLine.options,
|
|
68
|
-
vueCompilerOptions: commonLine.vueOptions,
|
|
69
|
-
target: 'tsc',
|
|
70
|
-
}));
|
|
16
|
+
plugins.push(...(0, language_hub_1.createVueVinePlugins)(ts, tsconfig));
|
|
71
17
|
}
|
|
72
18
|
if (languages.includes('mdx')) {
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
mdx = await import(require.resolve('@mdx-js/language-service', { paths: [path.dirname(tsconfig)] }));
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
const pkg = ts.findConfigFile(path.dirname(tsconfig), ts.sys.fileExists, 'package.json');
|
|
79
|
-
if (pkg) {
|
|
80
|
-
throw new Error('Please install @mdx-js/language-service to ' + path.relative(process.cwd(), pkg));
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
throw new Error('Please install @mdx-js/language-service for ' + path.relative(process.cwd(), tsconfig));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const mdxLanguagePlugin = mdx.createMdxLanguagePlugin();
|
|
87
|
-
plugins.push(mdxLanguagePlugin);
|
|
19
|
+
plugins.push(await (0, language_hub_1.createMdxPlugin)(ts, tsconfig));
|
|
88
20
|
}
|
|
89
21
|
if (languages.includes('astro')) {
|
|
90
|
-
|
|
91
|
-
try {
|
|
92
|
-
astro = require(require.resolve('@astrojs/ts-plugin/dist/language.js', { paths: [path.dirname(tsconfig)] }));
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
const pkg = ts.findConfigFile(path.dirname(tsconfig), ts.sys.fileExists, 'package.json');
|
|
96
|
-
if (pkg) {
|
|
97
|
-
throw new Error('Please install @astrojs/ts-plugin to ' + path.relative(process.cwd(), pkg));
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
throw new Error('Please install @astrojs/ts-plugin for ' + path.relative(process.cwd(), tsconfig));
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
const astroLanguagePlugin = astro.getLanguagePlugin();
|
|
104
|
-
plugins.push(astroLanguagePlugin);
|
|
22
|
+
plugins.push((0, language_hub_1.createAstroPlugin)(ts, tsconfig));
|
|
105
23
|
}
|
|
106
24
|
if (languages.includes('ts-macro')) {
|
|
107
|
-
|
|
108
|
-
let tsMacroOptions;
|
|
109
|
-
let tsmcPkgPath;
|
|
110
|
-
if (tsmcPkgPath = findPackageJson('@ts-macro/language-plugin')) {
|
|
111
|
-
tsMacro = await import(require.resolve('@ts-macro/language-plugin', { paths: [path.dirname(tsconfig)] }));
|
|
112
|
-
tsMacroOptions = require(require.resolve('@ts-macro/language-plugin/options', { paths: [path.dirname(tsconfig)] }));
|
|
113
|
-
}
|
|
114
|
-
else if (tsmcPkgPath = findPackageJson('@ts-macro/tsc')) {
|
|
115
|
-
const tsmcPath = path.dirname(tsmcPkgPath);
|
|
116
|
-
tsMacro = require(require.resolve('@ts-macro/language-plugin', { paths: [tsmcPath] }));
|
|
117
|
-
tsMacroOptions = require(require.resolve('@ts-macro/language-plugin/options', { paths: [tsmcPath] }));
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
const pkg = ts.findConfigFile(path.dirname(tsconfig), ts.sys.fileExists, 'package.json');
|
|
121
|
-
if (pkg) {
|
|
122
|
-
throw new Error('Please install @ts-macro/language-plugin or @ts-macro/tsc to ' + path.relative(process.cwd(), pkg));
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
throw new Error('Please install @ts-macro/language-plugin or @ts-macro/tsc for ' + path.relative(process.cwd(), tsconfig));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
const compilerOptions = ts.readConfigFile(tsconfig, ts.sys.readFile).config.compilerOptions;
|
|
129
|
-
plugins.push(...tsMacro.getLanguagePlugins(ts, compilerOptions, tsMacroOptions.getOptions(ts)));
|
|
25
|
+
plugins.push(...await (0, language_hub_1.createTsMacroPlugins)(ts, tsconfig));
|
|
130
26
|
}
|
|
131
27
|
cache.set(tsconfig, plugins);
|
|
132
28
|
return plugins;
|
|
133
|
-
function findPackageJson(pkgName) {
|
|
134
|
-
return ts.findConfigFile(path.dirname(tsconfig), ts.sys.fileExists, `node_modules/${pkgName}/package.json`);
|
|
135
|
-
}
|
|
136
29
|
}
|
|
137
30
|
//# sourceMappingURL=languagePlugins.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.18",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tsslint": "./bin/tsslint.js"
|
|
@@ -16,9 +16,10 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@clack/prompts": "^0.8.2",
|
|
19
|
-
"@tsslint/config": "1.5.
|
|
20
|
-
"@tsslint/core": "1.5.
|
|
19
|
+
"@tsslint/config": "1.5.18",
|
|
20
|
+
"@tsslint/core": "1.5.18",
|
|
21
21
|
"@volar/language-core": "~2.4.0",
|
|
22
|
+
"@volar/language-hub": "0.0.1",
|
|
22
23
|
"@volar/typescript": "~2.4.0",
|
|
23
24
|
"glob": "^10.4.1",
|
|
24
25
|
"json5": "^2.2.3"
|
|
@@ -30,5 +31,5 @@
|
|
|
30
31
|
"@vue-vine/language-service": "latest",
|
|
31
32
|
"@vue/language-core": "latest"
|
|
32
33
|
},
|
|
33
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "037ab1b5d72098fcf01c750420a98db8d8f28ba6"
|
|
34
35
|
}
|