ts-checker-rspack-plugin 1.4.0 → 1.5.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/README.md +49 -30
- package/lib/index.js +110 -25
- package/lib/typescript/type-script-go-constants.d.ts +5 -3
- package/lib/typescript/type-script-go-package.d.ts +15 -0
- package/lib/typescript/type-script-go-runner.d.ts +6 -1
- package/lib/typescript/type-script-worker-config.d.ts +3 -1
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -104,45 +104,54 @@ Rspack's modules resolution**. It means that you have to setup `tsconfig.json` c
|
|
|
104
104
|
|
|
105
105
|
Options for the TypeScript checker (`typescript` option object).
|
|
106
106
|
|
|
107
|
-
| Name | Type | Default value
|
|
108
|
-
| ------------------- | ------------------------------------------------------------------------------ |
|
|
109
|
-
| `memoryLimit` | `number` | `8192`
|
|
110
|
-
| `configFile` | `string` | `'tsconfig.json'`
|
|
111
|
-
| `configOverwrite` | `object` | `{ compilerOptions: { skipLibCheck: true, sourceMap: false, inlineSourceMap: false, declarationMap: false } }`
|
|
112
|
-
| `context` | `string` | `dirname(configuration.configFile)`
|
|
113
|
-
| `build` | `boolean` | `false`
|
|
114
|
-
| `mode` | `'readonly'` or `'write-dts'` or `'write-tsbuildinfo'` or `'write-references'` | `build === true ? 'write-tsbuildinfo' ? 'readonly'`
|
|
115
|
-
| `diagnosticOptions` | `object` | `{ syntactic: false, semantic: true, declaration: false, global: false }`
|
|
116
|
-
| `profile` | `boolean` | `false`
|
|
117
|
-
| `typescriptPath` | `string` | `
|
|
118
|
-
| `tsgo` | `boolean` | `false`
|
|
107
|
+
| Name | Type | Default value | Description |
|
|
108
|
+
| ------------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
109
|
+
| `memoryLimit` | `number` | `8192` | Memory limit for the checker process in MB. If the process exits with the allocation failed error, try to increase this number. |
|
|
110
|
+
| `configFile` | `string` | `'tsconfig.json'` | Path to the `tsconfig.json` file (path relative to the `compiler.options.context` or absolute path) |
|
|
111
|
+
| `configOverwrite` | `object` | `{ compilerOptions: { skipLibCheck: true, sourceMap: false, inlineSourceMap: false, declarationMap: false } }` | This configuration will overwrite configuration from the `tsconfig.json` file. Supported fields are: `extends`, `compilerOptions`, `include`, `exclude`, `files`, and `references`. |
|
|
112
|
+
| `context` | `string` | `dirname(configuration.configFile)` | The base path for finding files specified in the `tsconfig.json`. Same as the `context` option from the [ts-loader](https://github.com/TypeStrong/ts-loader#context). Useful if you want to keep your `tsconfig.json` in an external package. Keep in mind that **not** having a `tsconfig.json` in your project root can cause different behaviour between `ts-checker-rspack-plugin` and `tsc`. When using editors like `VS Code` it is advised to add a `tsconfig.json` file to the root of the project and extend the config file referenced in option `configFile`. |
|
|
113
|
+
| `build` | `boolean` | `false` | The equivalent of the `--build` flag for the `tsc` command. |
|
|
114
|
+
| `mode` | `'readonly'` or `'write-dts'` or `'write-tsbuildinfo'` or `'write-references'` | `build === true ? 'write-tsbuildinfo' ? 'readonly'` | Use `readonly` if you don't want to write anything on the disk, `write-dts` to write only `.d.ts` files, `write-tsbuildinfo` to write only `.tsbuildinfo` files, `write-references` to write both `.js` and `.d.ts` files of project references (last 2 modes requires `build: true`). |
|
|
115
|
+
| `diagnosticOptions` | `object` | `{ syntactic: false, semantic: true, declaration: false, global: false }` | Settings to select which diagnostics do we want to perform. |
|
|
116
|
+
| `profile` | `boolean` | `false` | Measures and prints timings related to the TypeScript performance. |
|
|
117
|
+
| `typescriptPath` | `string` | `require.resolve('typescript/package.json')` for TypeScript 7+, `require.resolve('@typescript/native-preview/package.json')` when `tsgo` falls back to preview, otherwise `require.resolve('typescript')` | If supplied this is a custom path where TypeScript can be found. In `tsgo` mode, it must be an absolute path to `typescript/package.json` from TypeScript 7+ or `@typescript/native-preview/package.json`. |
|
|
118
|
+
| `tsgo` | `boolean` | `true` when TypeScript 7+ is detected, otherwise `false` | Enables experimental TypeScript Go support. The plugin runs the TypeScript Go checker binary in a child process. |
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
### TypeScript Go support
|
|
121
121
|
|
|
122
|
-
`typescript.tsgo`
|
|
122
|
+
`typescript.tsgo` can reduce type-checking time by about 5-10x, especially on large projects, by using the Go implementation of TypeScript. It enables experimental [typescript-go](https://github.com/microsoft/typescript-go) support through TypeScript 7+ or [`@typescript/native-preview`](https://www.npmjs.com/package/@typescript/native-preview).
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
When the configured or default installed `typescript` package is major version 7 or higher, the plugin enables `typescript.tsgo` automatically and runs the TypeScript Go executable from that package. When `typescript.tsgo: true` is set without a custom `typescriptPath` and TypeScript 7+ is not installed, the plugin falls back to `@typescript/native-preview`.
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
- `async`.
|
|
128
|
-
- `logger`.
|
|
129
|
-
- `tsconfig.json` compiler options used by tsgo, including `incremental` and `composite`.
|
|
126
|
+
In this mode, the plugin runs the TypeScript Go binary in a child process, parses its diagnostics, and reports them through the existing issue formatter when possible. If the output cannot be parsed safely, the raw output is printed and the build fails when it exits with errors.
|
|
130
127
|
|
|
131
|
-
|
|
128
|
+
Supported options include `typescript.configFile`, `typescript.context`, `typescript.build`, `typescript.typescriptPath`, `async`, and `logger`. It also supports `tsconfig.json` compiler options used by `tsgo`, including `incremental` and `composite`.
|
|
132
129
|
|
|
133
|
-
|
|
134
|
-
- `issue.defaultSeverity` works for matched diagnostics.
|
|
135
|
-
- Raw tsgo stdout/stderr is printed when the plugin cannot safely parse the output.
|
|
130
|
+
Install TypeScript 7.0 RC to enable `tsgo` automatically:
|
|
136
131
|
|
|
137
|
-
|
|
132
|
+
```sh
|
|
133
|
+
# with npm
|
|
134
|
+
npm install -D typescript@rc
|
|
138
135
|
|
|
139
|
-
|
|
140
|
-
-
|
|
141
|
-
- `typescript.profile`.
|
|
142
|
-
- TypeScript API based formatting or filesystem output rewrites.
|
|
143
|
-
- Plugin-controlled declaration or reference emit modes such as `write-dts` and `write-references`; tsgo is always run with `--noEmit`.
|
|
136
|
+
# with yarn
|
|
137
|
+
yarn add -D typescript@rc
|
|
144
138
|
|
|
145
|
-
|
|
139
|
+
# with pnpm
|
|
140
|
+
pnpm add -D typescript@rc
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Or install `@typescript/native-preview` and enable `tsgo` explicitly:
|
|
144
|
+
|
|
145
|
+
```sh
|
|
146
|
+
# with npm
|
|
147
|
+
npm install -D @typescript/native-preview
|
|
148
|
+
|
|
149
|
+
# with yarn
|
|
150
|
+
yarn add -D @typescript/native-preview
|
|
151
|
+
|
|
152
|
+
# with pnpm
|
|
153
|
+
pnpm add -D @typescript/native-preview
|
|
154
|
+
```
|
|
146
155
|
|
|
147
156
|
```js
|
|
148
157
|
new TsCheckerRspackPlugin({
|
|
@@ -152,6 +161,16 @@ new TsCheckerRspackPlugin({
|
|
|
152
161
|
});
|
|
153
162
|
```
|
|
154
163
|
|
|
164
|
+
> The `@typescript/native-preview` usage is deprecated and kept only for compatibility. We recommend installing `typescript@rc` to use `tsgo`.
|
|
165
|
+
|
|
166
|
+
Limitations:
|
|
167
|
+
|
|
168
|
+
- `issue.include`, `issue.exclude`, and `issue.defaultSeverity` only apply to diagnostics whose `tsgo` output can be matched by `file`, `line`, `column`, `code`, and `message`.
|
|
169
|
+
- `typescript.configOverwrite`, `typescript.diagnosticOptions`, and `typescript.profile` are not supported.
|
|
170
|
+
- TypeScript API-based formatting or filesystem output rewrites are not supported.
|
|
171
|
+
- Plugin-controlled declaration or reference emit modes such as `write-dts` and `write-references` are not supported; `tsgo` always runs with `--noEmit`.
|
|
172
|
+
- This integration may change when TypeScript provides a stable JavaScript API for `tsgo`.
|
|
173
|
+
|
|
155
174
|
### Issues options
|
|
156
175
|
|
|
157
176
|
Options for the issues filtering (`issue` option object).
|
package/lib/index.js
CHANGED
|
@@ -3717,21 +3717,39 @@ var __webpack_exports__ = {};
|
|
|
3717
3717
|
Error.captureStackTrace(this, this.constructor);
|
|
3718
3718
|
}
|
|
3719
3719
|
}
|
|
3720
|
+
const external_node_fs_namespaceObject = require("node:fs");
|
|
3721
|
+
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
3720
3722
|
const external_node_url_namespaceObject = require("node:url");
|
|
3721
|
-
const
|
|
3722
|
-
const
|
|
3723
|
+
const TYPESCRIPT_PACKAGE = "typescript";
|
|
3724
|
+
const TYPESCRIPT_PACKAGE_JSON = `${TYPESCRIPT_PACKAGE}/package.json`;
|
|
3725
|
+
const TYPESCRIPT_PREVIEW_PACKAGE = "@typescript/native-preview";
|
|
3726
|
+
const TYPESCRIPT_PREVIEW_PACKAGE_JSON = `${TYPESCRIPT_PREVIEW_PACKAGE}/package.json`;
|
|
3723
3727
|
function resolveTypeScriptGoPackageJsonPath(config) {
|
|
3724
|
-
if (!external_node_path_default().isAbsolute(config.typescriptPath) || 'package.json' !== external_node_path_default().basename(config.typescriptPath)) throw new Error(
|
|
3728
|
+
if (!external_node_path_default().isAbsolute(config.typescriptPath) || 'package.json' !== external_node_path_default().basename(config.typescriptPath)) throw new Error("The typescriptPath option must be an absolute path to a package.json file when tsgo is enabled.");
|
|
3729
|
+
if (!config.tsgoPackage) throw new Error(`The typescriptPath option must point to "${TYPESCRIPT_PREVIEW_PACKAGE_JSON}" or "${TYPESCRIPT_PACKAGE}@rc".`);
|
|
3725
3730
|
return config.typescriptPath;
|
|
3726
3731
|
}
|
|
3727
|
-
async function
|
|
3728
|
-
const
|
|
3729
|
-
const getExePathPath = external_node_path_default().resolve(external_node_path_default().dirname(tsgoPkgPath), './lib/getExePath.js');
|
|
3732
|
+
async function resolveTypeScriptGoNativeExecutablePath(packageJsonPath, packageName) {
|
|
3733
|
+
const getExePathPath = external_node_path_default().resolve(external_node_path_default().dirname(packageJsonPath), './lib/getExePath.js');
|
|
3730
3734
|
const getExePathUrl = (0, external_node_url_namespaceObject.pathToFileURL)(getExePathPath).href;
|
|
3731
3735
|
const getExePathModule = await import(getExePathUrl);
|
|
3732
3736
|
const getExePath = getExePathModule.default || getExePathModule.getExePath;
|
|
3733
|
-
if ('function' != typeof getExePath) throw new Error(`Cannot resolve the typescript-go executable from "${
|
|
3734
|
-
|
|
3737
|
+
if ('function' != typeof getExePath) throw new Error(`Cannot resolve the typescript-go executable from "${packageName}".`);
|
|
3738
|
+
const executablePath = getExePath();
|
|
3739
|
+
if ('string' != typeof executablePath || !external_node_fs_default().existsSync(executablePath)) throw new Error('Executable not found');
|
|
3740
|
+
return executablePath;
|
|
3741
|
+
}
|
|
3742
|
+
async function resolveTypeScriptGoBinPath(config) {
|
|
3743
|
+
const packageJsonPath = resolveTypeScriptGoPackageJsonPath(config);
|
|
3744
|
+
if ("typescript" === config.tsgoPackage) return resolveTypeScriptGoNativeExecutablePath(packageJsonPath, TYPESCRIPT_PACKAGE);
|
|
3745
|
+
return resolveTypeScriptGoNativeExecutablePath(packageJsonPath, TYPESCRIPT_PREVIEW_PACKAGE);
|
|
3746
|
+
}
|
|
3747
|
+
async function resolveTypeScriptGoExecutable(config) {
|
|
3748
|
+
const binPath = await resolveTypeScriptGoBinPath(config);
|
|
3749
|
+
return {
|
|
3750
|
+
command: binPath,
|
|
3751
|
+
args: []
|
|
3752
|
+
};
|
|
3735
3753
|
}
|
|
3736
3754
|
function createTypeScriptGoArgs(config) {
|
|
3737
3755
|
const args = config.build ? [
|
|
@@ -3840,12 +3858,15 @@ var __webpack_exports__ = {};
|
|
|
3840
3858
|
}
|
|
3841
3859
|
async function runTypeScriptGo(config, logger, defaultSeverity = 'auto', signal) {
|
|
3842
3860
|
AbortError.throwIfAborted(signal);
|
|
3843
|
-
const
|
|
3861
|
+
const executable = await resolveTypeScriptGoExecutable(config);
|
|
3844
3862
|
const args = createTypeScriptGoArgs(config);
|
|
3845
3863
|
return new Promise((resolve, reject)=>{
|
|
3846
3864
|
let settled = false;
|
|
3847
3865
|
let output = '';
|
|
3848
|
-
const childProcess = (0, external_node_child_process_namespaceObject.spawn)(
|
|
3866
|
+
const childProcess = (0, external_node_child_process_namespaceObject.spawn)(executable.command, [
|
|
3867
|
+
...executable.args,
|
|
3868
|
+
...args
|
|
3869
|
+
], {
|
|
3849
3870
|
cwd: config.context,
|
|
3850
3871
|
stdio: [
|
|
3851
3872
|
'inherit',
|
|
@@ -4127,23 +4148,47 @@ var __webpack_exports__ = {};
|
|
|
4127
4148
|
});
|
|
4128
4149
|
});
|
|
4129
4150
|
}
|
|
4130
|
-
|
|
4131
|
-
|
|
4151
|
+
function readTsgoPackageJson(packageJsonPath) {
|
|
4152
|
+
return require(packageJsonPath);
|
|
4153
|
+
}
|
|
4154
|
+
function getTsgoPackage(packageJson) {
|
|
4155
|
+
if (packageJson.name === TYPESCRIPT_PACKAGE) {
|
|
4156
|
+
const versionMatch = packageJson.version?.match(/^(\d+)\.(\d+)(?:\.|$|-)/);
|
|
4157
|
+
if (versionMatch && Number(versionMatch[1]) >= 7) return "typescript";
|
|
4158
|
+
}
|
|
4159
|
+
if (packageJson.name === TYPESCRIPT_PREVIEW_PACKAGE) return 'preview';
|
|
4160
|
+
}
|
|
4161
|
+
function resolveTypeScriptGoPackage(packageJsonPath) {
|
|
4162
|
+
if (!external_node_path_default().isAbsolute(packageJsonPath) || 'package.json' !== external_node_path_default().basename(packageJsonPath)) return;
|
|
4163
|
+
try {
|
|
4164
|
+
const tsgoPackage = getTsgoPackage(readTsgoPackageJson(packageJsonPath));
|
|
4165
|
+
return tsgoPackage ? {
|
|
4166
|
+
packageJsonPath,
|
|
4167
|
+
tsgoPackage
|
|
4168
|
+
} : void 0;
|
|
4169
|
+
} catch {
|
|
4170
|
+
return;
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4132
4173
|
function isDefaultTypeScriptGoPath(typescriptPath) {
|
|
4133
|
-
if (typescriptPath ===
|
|
4174
|
+
if (typescriptPath === TYPESCRIPT_PREVIEW_PACKAGE_JSON) return true;
|
|
4175
|
+
try {
|
|
4176
|
+
if (typescriptPath === require.resolve(TYPESCRIPT_PREVIEW_PACKAGE_JSON)) return true;
|
|
4177
|
+
} catch {}
|
|
4178
|
+
if (!external_node_path_default().isAbsolute(typescriptPath) || 'package.json' !== external_node_path_default().basename(typescriptPath)) return false;
|
|
4134
4179
|
try {
|
|
4135
|
-
return typescriptPath
|
|
4180
|
+
return Boolean(getTsgoPackage(readTsgoPackageJson(typescriptPath)));
|
|
4136
4181
|
} catch {
|
|
4137
4182
|
return false;
|
|
4138
4183
|
}
|
|
4139
4184
|
}
|
|
4140
4185
|
function createTypeScriptGoSupportError(config, error) {
|
|
4141
4186
|
const message = [
|
|
4142
|
-
`When you enable TsCheckerRspackPlugin with \`typescript.tsgo\`, you must install \`${
|
|
4187
|
+
`When you enable TsCheckerRspackPlugin with \`typescript.tsgo\`, you must install \`${TYPESCRIPT_PACKAGE}@rc\` or \`${TYPESCRIPT_PREVIEW_PACKAGE}\` package.`
|
|
4143
4188
|
];
|
|
4144
|
-
if (!isDefaultTypeScriptGoPath(config.typescriptPath)) message.push(`If you set \`typescript.typescriptPath\`, it must be an absolute path to \`${
|
|
4189
|
+
if (!isDefaultTypeScriptGoPath(config.typescriptPath)) message.push(`If you set \`typescript.typescriptPath\`, it must be an absolute path to \`${TYPESCRIPT_PACKAGE_JSON}\` from \`${TYPESCRIPT_PACKAGE}@rc\` or \`${TYPESCRIPT_PREVIEW_PACKAGE_JSON}\`.`);
|
|
4145
4190
|
if (error instanceof Error && error.message) message.push(`Failed to resolve the tsgo executable: ${error.message}`);
|
|
4146
|
-
message.push(`You can install it with \`npm add ${
|
|
4191
|
+
message.push(`You can install it with \`npm add ${TYPESCRIPT_PACKAGE}@rc -D\` or \`npm add ${TYPESCRIPT_PREVIEW_PACKAGE} -D\`.`);
|
|
4147
4192
|
return new Error(message.join(external_node_os_default().EOL));
|
|
4148
4193
|
}
|
|
4149
4194
|
function assertTypeScriptGoSupport(config) {
|
|
@@ -4165,6 +4210,7 @@ var __webpack_exports__ = {};
|
|
|
4165
4210
|
function assertTypeScriptSupport(config) {
|
|
4166
4211
|
if (config.tsgo) assertTypeScriptGoSupport(config);
|
|
4167
4212
|
else {
|
|
4213
|
+
if ('package.json' === external_node_path_default().basename(config.typescriptPath)) throw new Error("When you use TsCheckerRspackPlugin without `typescript.tsgo`, `typescript.typescriptPath` should point to a path like `require.resolve('typescript')`.");
|
|
4168
4214
|
let typescriptVersion;
|
|
4169
4215
|
try {
|
|
4170
4216
|
typescriptVersion = require(config.typescriptPath).version;
|
|
@@ -4398,19 +4444,58 @@ var __webpack_exports__ = {};
|
|
|
4398
4444
|
defaultSeverity
|
|
4399
4445
|
};
|
|
4400
4446
|
}
|
|
4401
|
-
function
|
|
4402
|
-
|
|
4403
|
-
|
|
4447
|
+
function resolveInstalledTypeScriptPackageForTsgo() {
|
|
4448
|
+
try {
|
|
4449
|
+
const packageJsonPath = require.resolve(TYPESCRIPT_PACKAGE_JSON);
|
|
4450
|
+
const tsgoPackage = resolveTypeScriptGoPackage(packageJsonPath);
|
|
4451
|
+
if (tsgoPackage?.tsgoPackage === "typescript") return tsgoPackage;
|
|
4452
|
+
} catch {}
|
|
4453
|
+
}
|
|
4454
|
+
function resolveDefaultPreviewPackageJsonPath() {
|
|
4455
|
+
try {
|
|
4456
|
+
return require.resolve(TYPESCRIPT_PREVIEW_PACKAGE_JSON);
|
|
4404
4457
|
} catch {
|
|
4405
|
-
return
|
|
4458
|
+
return TYPESCRIPT_PREVIEW_PACKAGE_JSON;
|
|
4406
4459
|
}
|
|
4407
|
-
|
|
4460
|
+
}
|
|
4461
|
+
function resolveTypeScriptRuntimeConfig(options) {
|
|
4462
|
+
if (options.typescriptPath) {
|
|
4463
|
+
const tsgoPackage = resolveTypeScriptGoPackage(options.typescriptPath);
|
|
4464
|
+
const tsgo = void 0 === options.tsgo && tsgoPackage?.tsgoPackage === "typescript" ? true : options.tsgo;
|
|
4465
|
+
return {
|
|
4466
|
+
typescriptPath: options.typescriptPath,
|
|
4467
|
+
...void 0 === tsgo ? {} : {
|
|
4468
|
+
tsgo
|
|
4469
|
+
},
|
|
4470
|
+
...true === tsgo && tsgoPackage ? {
|
|
4471
|
+
tsgoPackage: tsgoPackage.tsgoPackage
|
|
4472
|
+
} : {}
|
|
4473
|
+
};
|
|
4474
|
+
}
|
|
4475
|
+
if (false === options.tsgo) return {
|
|
4476
|
+
typescriptPath: require.resolve("typescript"),
|
|
4477
|
+
tsgo: false
|
|
4478
|
+
};
|
|
4479
|
+
const installedTypeScriptTsgoPackage = resolveInstalledTypeScriptPackageForTsgo();
|
|
4480
|
+
if (installedTypeScriptTsgoPackage) return {
|
|
4481
|
+
typescriptPath: installedTypeScriptTsgoPackage.packageJsonPath,
|
|
4482
|
+
tsgo: true,
|
|
4483
|
+
tsgoPackage: "typescript"
|
|
4484
|
+
};
|
|
4485
|
+
if (true === options.tsgo) return {
|
|
4486
|
+
typescriptPath: resolveDefaultPreviewPackageJsonPath(),
|
|
4487
|
+
tsgo: true,
|
|
4488
|
+
tsgoPackage: 'preview'
|
|
4489
|
+
};
|
|
4490
|
+
return {
|
|
4491
|
+
typescriptPath: require.resolve("typescript")
|
|
4492
|
+
};
|
|
4408
4493
|
}
|
|
4409
4494
|
function createTypeScriptWorkerConfig(compiler, options) {
|
|
4410
4495
|
let configFile = 'object' == typeof options ? options.configFile || 'tsconfig.json' : 'tsconfig.json';
|
|
4411
4496
|
configFile = external_node_path_default().normalize(external_node_path_default().isAbsolute(configFile) ? configFile : external_node_path_default().resolve(compiler.options.context || process.cwd(), configFile));
|
|
4412
4497
|
const optionsAsObject = 'object' == typeof options ? options : {};
|
|
4413
|
-
const
|
|
4498
|
+
const typescriptRuntimeConfig = resolveTypeScriptRuntimeConfig(optionsAsObject);
|
|
4414
4499
|
return {
|
|
4415
4500
|
enabled: Boolean(options) || void 0 === options,
|
|
4416
4501
|
memoryLimit: 8192,
|
|
@@ -4418,6 +4503,7 @@ var __webpack_exports__ = {};
|
|
|
4418
4503
|
mode: optionsAsObject.build ? 'write-tsbuildinfo' : 'readonly',
|
|
4419
4504
|
profile: false,
|
|
4420
4505
|
...optionsAsObject,
|
|
4506
|
+
...typescriptRuntimeConfig,
|
|
4421
4507
|
configFile: configFile,
|
|
4422
4508
|
configOverwrite: optionsAsObject.configOverwrite || {},
|
|
4423
4509
|
context: optionsAsObject.context || external_node_path_default().dirname(configFile),
|
|
@@ -4427,8 +4513,7 @@ var __webpack_exports__ = {};
|
|
|
4427
4513
|
declaration: false,
|
|
4428
4514
|
global: false,
|
|
4429
4515
|
...optionsAsObject.diagnosticOptions || {}
|
|
4430
|
-
}
|
|
4431
|
-
typescriptPath
|
|
4516
|
+
}
|
|
4432
4517
|
};
|
|
4433
4518
|
}
|
|
4434
4519
|
function createPluginConfig(compiler, options = {}) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
declare const
|
|
1
|
+
declare const TYPESCRIPT_PACKAGE = "typescript";
|
|
2
|
+
declare const TYPESCRIPT_PACKAGE_JSON = "typescript/package.json";
|
|
3
|
+
declare const TYPESCRIPT_PREVIEW_PACKAGE = "@typescript/native-preview";
|
|
4
|
+
declare const TYPESCRIPT_PREVIEW_PACKAGE_JSON = "@typescript/native-preview/package.json";
|
|
3
5
|
declare const TYPESCRIPT_GO_ISSUE_CODE = "TSGO";
|
|
4
|
-
export {
|
|
6
|
+
export { TYPESCRIPT_GO_ISSUE_CODE, TYPESCRIPT_PACKAGE, TYPESCRIPT_PACKAGE_JSON, TYPESCRIPT_PREVIEW_PACKAGE, TYPESCRIPT_PREVIEW_PACKAGE_JSON, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type TypeScriptGoPackage = 'typescript' | 'preview';
|
|
2
|
+
type TypeScriptGoPackageJson = {
|
|
3
|
+
name?: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
bin?: string | Record<string, string>;
|
|
6
|
+
};
|
|
7
|
+
type ResolvedTypeScriptGoPackage = {
|
|
8
|
+
packageJsonPath: string;
|
|
9
|
+
tsgoPackage: TypeScriptGoPackage;
|
|
10
|
+
};
|
|
11
|
+
declare function readTsgoPackageJson(packageJsonPath: string): TypeScriptGoPackageJson;
|
|
12
|
+
declare function getTsgoPackage(packageJson: TypeScriptGoPackageJson): TypeScriptGoPackage | undefined;
|
|
13
|
+
declare function resolveTypeScriptGoPackage(packageJsonPath: string): ResolvedTypeScriptGoPackage | undefined;
|
|
14
|
+
export { getTsgoPackage, readTsgoPackageJson, resolveTypeScriptGoPackage, };
|
|
15
|
+
export type { ResolvedTypeScriptGoPackage, TypeScriptGoPackage, TypeScriptGoPackageJson, };
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { Issue, IssueDefaultSeverity } from '../issue';
|
|
2
2
|
import type { Logger } from '../logger';
|
|
3
3
|
import type { TypeScriptWorkerConfig } from './type-script-worker-config';
|
|
4
|
+
type TypeScriptGoExecutable = {
|
|
5
|
+
command: string;
|
|
6
|
+
args: string[];
|
|
7
|
+
};
|
|
4
8
|
declare function resolveTypeScriptGoPackageJsonPath(config: TypeScriptWorkerConfig): string;
|
|
5
9
|
declare function resolveTypeScriptGoBinPath(config: TypeScriptWorkerConfig): Promise<string>;
|
|
10
|
+
declare function resolveTypeScriptGoExecutable(config: TypeScriptWorkerConfig): Promise<TypeScriptGoExecutable>;
|
|
6
11
|
declare function createTypeScriptGoArgs(config: TypeScriptWorkerConfig): string[];
|
|
7
12
|
declare function getTypeScriptGoErrorCount(output: string): number | undefined;
|
|
8
13
|
declare function parseTypeScriptGoIssues(output: string, config: TypeScriptWorkerConfig, defaultSeverity?: IssueDefaultSeverity): Issue[];
|
|
@@ -16,4 +21,4 @@ declare function getTypeScriptGoDependencies(config: TypeScriptWorkerConfig): {
|
|
|
16
21
|
excluded: string[];
|
|
17
22
|
extensions: string[];
|
|
18
23
|
};
|
|
19
|
-
export { createTypeScriptGoArgs, createTypeScriptGoExitIssues, getTypeScriptGoDependencies, getTypeScriptGoErrorCount, isTypeScriptGoIssue, isTypeScriptGoStatsError, parseTypeScriptGoIssues, resolveTypeScriptGoBinPath, resolveTypeScriptGoPackageJsonPath, runTypeScriptGo, };
|
|
24
|
+
export { createTypeScriptGoArgs, createTypeScriptGoExitIssues, getTypeScriptGoDependencies, getTypeScriptGoErrorCount, isTypeScriptGoIssue, isTypeScriptGoStatsError, parseTypeScriptGoIssues, resolveTypeScriptGoExecutable, resolveTypeScriptGoBinPath, resolveTypeScriptGoPackageJsonPath, runTypeScriptGo, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type * as rspack from '@rspack/core';
|
|
2
2
|
import type { TypeScriptConfigOverwrite } from './type-script-config-overwrite';
|
|
3
3
|
import type { TypeScriptDiagnosticsOptions } from './type-script-diagnostics-options';
|
|
4
|
+
import { type TypeScriptGoPackage } from './type-script-go-package';
|
|
4
5
|
import type { TypeScriptWorkerOptions } from './type-script-worker-options';
|
|
5
6
|
interface TypeScriptWorkerConfig {
|
|
6
7
|
enabled: boolean;
|
|
@@ -14,7 +15,8 @@ interface TypeScriptWorkerConfig {
|
|
|
14
15
|
profile: boolean;
|
|
15
16
|
typescriptPath: string;
|
|
16
17
|
tsgo?: boolean;
|
|
18
|
+
tsgoPackage?: TypeScriptGoPackage;
|
|
17
19
|
}
|
|
18
20
|
declare function createTypeScriptWorkerConfig(compiler: rspack.Compiler, options: TypeScriptWorkerOptions | undefined): TypeScriptWorkerConfig;
|
|
19
|
-
export { createTypeScriptWorkerConfig };
|
|
21
|
+
export { createTypeScriptWorkerConfig, };
|
|
20
22
|
export type { TypeScriptWorkerConfig };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-checker-rspack-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Runs typescript type checker and linter on separate process.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rspack",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "https://github.com/rstackjs/ts-checker-rspack-plugin.git"
|
|
17
17
|
},
|
|
18
|
+
"homepage": "https://github.com/rstackjs/ts-checker-rspack-plugin#readme",
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"main": "lib/index.js",
|
|
20
21
|
"types": "lib/index.d.ts",
|
|
@@ -22,28 +23,28 @@
|
|
|
22
23
|
"lib"
|
|
23
24
|
],
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@rspack/lite-tapable": "^1.1.
|
|
26
|
+
"@rspack/lite-tapable": "^1.1.2",
|
|
26
27
|
"chokidar": "^3.6.0",
|
|
27
|
-
"memfs": "^4.57.
|
|
28
|
+
"memfs": "^4.57.7",
|
|
28
29
|
"picocolors": "^1.1.1"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@babel/code-frame": "^7.29.7",
|
|
32
|
-
"@rslib/core": "^0.22.
|
|
33
|
-
"@rslint/core": "^0.
|
|
34
|
-
"@rspack/core": "^2.0.
|
|
35
|
-
"@rstest/core": "^0.10.
|
|
33
|
+
"@rslib/core": "^0.22.1",
|
|
34
|
+
"@rslint/core": "^0.6.1",
|
|
35
|
+
"@rspack/core": "^2.0.8",
|
|
36
|
+
"@rstest/core": "^0.10.4",
|
|
36
37
|
"@types/babel__code-frame": "^7.27.0",
|
|
37
38
|
"@types/is-glob": "^4.0.4",
|
|
38
39
|
"@types/mock-fs": "^4.13.4",
|
|
39
|
-
"@types/node": "^24.
|
|
40
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
40
|
+
"@types/node": "^24.13.2",
|
|
41
|
+
"@typescript/native-preview": "7.0.0-dev.20260613.1",
|
|
41
42
|
"cross-env": "^10.1.0",
|
|
42
43
|
"husky": "^9.1.7",
|
|
43
44
|
"is-glob": "^4.0.3",
|
|
44
45
|
"minimatch": "^10.2.5",
|
|
45
46
|
"mock-fs": "^5.5.0",
|
|
46
|
-
"prettier": "^3.8.
|
|
47
|
+
"prettier": "^3.8.4",
|
|
47
48
|
"strip-ansi": "^7.2.0",
|
|
48
49
|
"typescript": "^6.0.3"
|
|
49
50
|
},
|