Skip to content

Commit 5db7218

Browse files
committed
refactor: remove esbuild
1 parent 1fd883d commit 5db7218

File tree

12 files changed

+43
-544
lines changed

12 files changed

+43
-544
lines changed

packages/cli/index.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import ts = require('typescript');
22
import path = require('path');
3-
import core = require('@tsslint/core');
43
import cache = require('./lib/cache.js');
54
import worker = require('./lib/worker.js');
65
import fs = require('fs');
@@ -52,7 +51,6 @@ class Project {
5251
options: ts.CompilerOptions = {};
5352
configFile: string | undefined;
5453
currentFileIndex = 0;
55-
builtConfig: string | undefined;
5654
cache: cache.CacheData = {};
5755

5856
constructor(
@@ -132,7 +130,6 @@ class Project {
132130
}
133131

134132
(async () => {
135-
const builtConfigs = new Map<string, Promise<string | undefined>>();
136133
const clack = await import('@clack/prompts');
137134
const processFiles = new Set<string>();
138135
const tsconfigAndLanguages = new Map<string, string[]>();
@@ -360,10 +357,8 @@ class Project {
360357

361358
projects = projects.filter(project => !!project.configFile);
362359
projects = projects.filter(project => !!project.fileNames.length);
363-
for (const project of projects) {
364-
project.builtConfig = await getBuiltConfig(project.configFile!);
365-
}
366-
projects = projects.filter(project => !!project.builtConfig);
360+
projects = projects.filter(project => !!project.configFile);
361+
367362
for (const project of projects) {
368363
allFilesNum += project.fileNames.length;
369364
}
@@ -437,7 +432,6 @@ class Project {
437432
project.tsconfig,
438433
project.languages,
439434
project.configFile!,
440-
project.builtConfig!,
441435
project.rawFileNames,
442436
project.options,
443437
);
@@ -544,13 +538,6 @@ class Project {
544538
await startWorker(linterWorker);
545539
}
546540

547-
async function getBuiltConfig(configFile: string) {
548-
if (!builtConfigs.has(configFile)) {
549-
builtConfigs.set(configFile, core.buildConfig(configFile, ts.sys.createHash, msg => spinner?.message(msg), (s, code) => log(gray(s), code)));
550-
}
551-
return await builtConfigs.get(configFile);
552-
}
553-
554541
function addProcessFile(fileName: string) {
555542
processFiles.add(fileName);
556543
updateSpinner();

packages/cli/lib/cache.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function loadCache(
99
configFilePath: string,
1010
createHash: (path: string) => string = btoa
1111
): CacheData {
12-
const outDir = core.getDotTsslintPath(configFilePath);
12+
const outDir = getDotTsslintPath(configFilePath);
1313
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '_' + createHash(JSON.stringify(process.argv)) + '_' + createHash(path.relative(outDir, tsconfig)) + '.cache.json';
1414
const cacheFilePath = path.join(outDir, cacheFileName);
1515
const cacheFileStat = fs.statSync(cacheFilePath, { throwIfNoEntry: false });
@@ -30,8 +30,13 @@ export function saveCache(
3030
cache: CacheData,
3131
createHash: (path: string) => string = btoa
3232
): void {
33-
const outDir = core.getDotTsslintPath(configFilePath);
33+
const outDir = getDotTsslintPath(configFilePath);
3434
const cacheFileName = createHash(path.relative(outDir, configFilePath)) + '_' + createHash(JSON.stringify(process.argv)) + '_' + createHash(path.relative(outDir, tsconfig)) + '.cache.json';
3535
const cacheFilePath = path.join(outDir, cacheFileName);
36+
fs.mkdirSync(outDir, { recursive: true });
3637
fs.writeFileSync(cacheFilePath, JSON.stringify(cache));
3738
}
39+
40+
function getDotTsslintPath(configFilePath: string): string {
41+
return path.resolve(configFilePath, '..', 'node_modules', '.tsslint');
42+
}

packages/cli/lib/worker.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,14 @@ async function setup(
137137
tsconfig: string,
138138
languages: string[],
139139
configFile: string,
140-
builtConfig: string,
141140
_fileNames: string[],
142141
_options: ts.CompilerOptions
143142
) {
144143
const clack = await import('@clack/prompts');
145144

146145
let config: config.Config | config.Config[];
147146
try {
148-
config = (await import(url.pathToFileURL(builtConfig).toString())).default;
147+
config = (await import(url.pathToFileURL(configFile).toString())).default;
149148
} catch (err) {
150149
if (err instanceof Error) {
151150
clack.log.error(err.stack ?? err.message);

packages/cli/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
"name": "@tsslint/cli",
33
"version": "2.0.7",
44
"license": "MIT",
5-
"engines": {
6-
"node": ">=22"
7-
},
85
"bin": {
96
"tsslint": "./bin/tsslint.js"
107
},

packages/core/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
export * from './lib/build';
2-
export * from './lib/watch';
3-
41
import type {
52
Config,
63
LinterContext,

packages/core/lib/build.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

packages/core/lib/watch.ts

Lines changed: 0 additions & 73 deletions
This file was deleted.

packages/core/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@tsslint/core",
33
"version": "2.0.7",
44
"license": "MIT",
5+
"engines": {
6+
"node": ">=23.6.0"
7+
},
58
"files": [
69
"**/*.js",
710
"**/*.d.ts"
@@ -13,7 +16,6 @@
1316
},
1417
"dependencies": {
1518
"@tsslint/types": "2.0.7",
16-
"esbuild": ">=0.17.0",
1719
"minimatch": "^10.0.1"
1820
},
1921
"scripts": {

0 commit comments

Comments
 (0)