@tsslint/cli 2.0.7 → 3.0.0-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/index.js +2 -13
- package/lib/cache.js +6 -3
- package/lib/worker.d.ts +3 -3
- package/lib/worker.js +2 -2
- package/package.json +4 -11
package/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const ts = require("typescript");
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const core = require("@tsslint/core");
|
|
6
5
|
const cache = require("./lib/cache.js");
|
|
7
6
|
const worker = require("./lib/worker.js");
|
|
8
7
|
const fs = require("fs");
|
|
@@ -107,7 +106,6 @@ class Project {
|
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
(async () => {
|
|
110
|
-
const builtConfigs = new Map();
|
|
111
109
|
const clack = await import('@clack/prompts');
|
|
112
110
|
const processFiles = new Set();
|
|
113
111
|
const tsconfigAndLanguages = new Map();
|
|
@@ -311,10 +309,7 @@ class Project {
|
|
|
311
309
|
spinner?.start();
|
|
312
310
|
projects = projects.filter(project => !!project.configFile);
|
|
313
311
|
projects = projects.filter(project => !!project.fileNames.length);
|
|
314
|
-
|
|
315
|
-
project.builtConfig = await getBuiltConfig(project.configFile);
|
|
316
|
-
}
|
|
317
|
-
projects = projects.filter(project => !!project.builtConfig);
|
|
312
|
+
projects = projects.filter(project => !!project.configFile);
|
|
318
313
|
for (const project of projects) {
|
|
319
314
|
allFilesNum += project.fileNames.length;
|
|
320
315
|
}
|
|
@@ -372,7 +367,7 @@ class Project {
|
|
|
372
367
|
return;
|
|
373
368
|
}
|
|
374
369
|
project.worker = linterWorker;
|
|
375
|
-
const setupSuccess = await linterWorker.setup(project.tsconfig, project.languages, project.configFile, project.
|
|
370
|
+
const setupSuccess = await linterWorker.setup(project.tsconfig, project.languages, project.configFile, project.rawFileNames, project.options);
|
|
376
371
|
if (!setupSuccess) {
|
|
377
372
|
projects = projects.filter(p => p !== project);
|
|
378
373
|
startWorker(linterWorker);
|
|
@@ -457,12 +452,6 @@ class Project {
|
|
|
457
452
|
cache.saveCache(project.tsconfig, project.configFile, project.cache, ts.sys.createHash);
|
|
458
453
|
await startWorker(linterWorker);
|
|
459
454
|
}
|
|
460
|
-
async function getBuiltConfig(configFile) {
|
|
461
|
-
if (!builtConfigs.has(configFile)) {
|
|
462
|
-
builtConfigs.set(configFile, core.buildConfig(configFile, ts.sys.createHash, spinner, (s, code) => log(gray(s), code)));
|
|
463
|
-
}
|
|
464
|
-
return await builtConfigs.get(configFile);
|
|
465
|
-
}
|
|
466
455
|
function addProcessFile(fileName) {
|
|
467
456
|
processFiles.add(fileName);
|
|
468
457
|
updateSpinner();
|
package/lib/cache.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadCache = loadCache;
|
|
4
4
|
exports.saveCache = saveCache;
|
|
5
|
-
const core = require("@tsslint/core");
|
|
6
5
|
const path = require("path");
|
|
7
6
|
const fs = require("fs");
|
|
8
7
|
function loadCache(tsconfig, configFilePath, createHash = btoa) {
|
|
9
|
-
const outDir =
|
|
8
|
+
const outDir = getDotTsslintPath(configFilePath);
|
|
10
9
|
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '_' + createHash(JSON.stringify(process.argv)) + '_' + createHash(path.relative(outDir, tsconfig)) + '.cache.json';
|
|
11
10
|
const cacheFilePath = path.join(outDir, cacheFileName);
|
|
12
11
|
const cacheFileStat = fs.statSync(cacheFilePath, { throwIfNoEntry: false });
|
|
@@ -22,9 +21,13 @@ function loadCache(tsconfig, configFilePath, createHash = btoa) {
|
|
|
22
21
|
return {};
|
|
23
22
|
}
|
|
24
23
|
function saveCache(tsconfig, configFilePath, cache, createHash = btoa) {
|
|
25
|
-
const outDir =
|
|
24
|
+
const outDir = getDotTsslintPath(configFilePath);
|
|
26
25
|
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '_' + createHash(JSON.stringify(process.argv)) + '_' + createHash(path.relative(outDir, tsconfig)) + '.cache.json';
|
|
27
26
|
const cacheFilePath = path.join(outDir, cacheFileName);
|
|
27
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
28
28
|
fs.writeFileSync(cacheFilePath, JSON.stringify(cache));
|
|
29
29
|
}
|
|
30
|
+
function getDotTsslintPath(configFilePath) {
|
|
31
|
+
return path.resolve(configFilePath, '..', 'node_modules', '.tsslint');
|
|
32
|
+
}
|
|
30
33
|
//# sourceMappingURL=cache.js.map
|
package/lib/worker.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import ts = require('typescript');
|
|
2
2
|
import core = require('@tsslint/core');
|
|
3
3
|
export declare function createLocal(): {
|
|
4
|
-
setup(tsconfig: string, languages: string[], configFile: string,
|
|
4
|
+
setup(tsconfig: string, languages: string[], configFile: string, _fileNames: string[], _options: ts.CompilerOptions): Promise<boolean>;
|
|
5
5
|
lint(fileName: string, fix: boolean, fileCache: core.FileLintCache): ts.DiagnosticWithLocation[];
|
|
6
6
|
hasCodeFixes(fileName: string): boolean;
|
|
7
7
|
hasRules(fileName: string, minimatchCache: Record<string, boolean>): boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare function create(): {
|
|
10
|
-
setup(tsconfig: string, languages: string[], configFile: string,
|
|
10
|
+
setup(tsconfig: string, languages: string[], configFile: string, _fileNames: string[], _options: ts.CompilerOptions): Promise<boolean>;
|
|
11
11
|
lint(fileName: string, fix: boolean, fileCache: core.FileLintCache): Promise<ts.DiagnosticWithLocation[]>;
|
|
12
12
|
hasCodeFixes(fileName: string): Promise<boolean>;
|
|
13
13
|
hasRules(fileName: string, minimatchCache: Record<string, boolean>): Promise<boolean>;
|
|
14
14
|
};
|
|
15
|
-
declare function setup(tsconfig: string, languages: string[], configFile: string,
|
|
15
|
+
declare function setup(tsconfig: string, languages: string[], configFile: string, _fileNames: string[], _options: ts.CompilerOptions): Promise<boolean>;
|
|
16
16
|
declare function lint(fileName: string, fix: boolean, fileCache: core.FileLintCache): readonly [ts.DiagnosticWithLocation[], core.FileLintCache];
|
|
17
17
|
declare function hasCodeFixes(fileName: string): boolean;
|
|
18
18
|
declare function hasRules(fileName: string, minimatchCache: core.FileLintCache[2]): readonly [boolean, Record<string, boolean>];
|
package/lib/worker.js
CHANGED
|
@@ -127,11 +127,11 @@ const handlers = {
|
|
|
127
127
|
hasCodeFixes,
|
|
128
128
|
hasRules,
|
|
129
129
|
};
|
|
130
|
-
async function setup(tsconfig, languages, configFile,
|
|
130
|
+
async function setup(tsconfig, languages, configFile, _fileNames, _options) {
|
|
131
131
|
const clack = await import('@clack/prompts');
|
|
132
132
|
let config;
|
|
133
133
|
try {
|
|
134
|
-
config = (await import(url.pathToFileURL(
|
|
134
|
+
config = (await import(url.pathToFileURL(configFile).toString())).default;
|
|
135
135
|
}
|
|
136
136
|
catch (err) {
|
|
137
137
|
if (err instanceof Error) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsslint/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"engines": {
|
|
6
|
-
"node": ">=22"
|
|
7
|
-
},
|
|
8
5
|
"bin": {
|
|
9
6
|
"tsslint": "./bin/tsslint.js"
|
|
10
7
|
},
|
|
@@ -19,8 +16,8 @@
|
|
|
19
16
|
},
|
|
20
17
|
"dependencies": {
|
|
21
18
|
"@clack/prompts": "^0.8.2",
|
|
22
|
-
"@tsslint/config": "
|
|
23
|
-
"@tsslint/core": "
|
|
19
|
+
"@tsslint/config": "3.0.0-alpha.0",
|
|
20
|
+
"@tsslint/core": "3.0.0-alpha.0",
|
|
24
21
|
"@volar/language-core": "~2.4.0",
|
|
25
22
|
"@volar/language-hub": "0.0.1",
|
|
26
23
|
"@volar/typescript": "~2.4.0",
|
|
@@ -29,9 +26,5 @@
|
|
|
29
26
|
"peerDependencies": {
|
|
30
27
|
"typescript": "*"
|
|
31
28
|
},
|
|
32
|
-
"
|
|
33
|
-
"@vue-vine/language-service": "latest",
|
|
34
|
-
"@vue/language-core": "latest"
|
|
35
|
-
},
|
|
36
|
-
"gitHead": "db83a7c7526c3245d2ffa6fe1c9fb04e77387959"
|
|
29
|
+
"gitHead": "ec683ca05f4360fac720bd8c567f4d9460d255e1"
|
|
37
30
|
}
|