From e299fde75dbae30c12b20432afa753ed1d0950cc Mon Sep 17 00:00:00 2001 From: ckken Date: Sun, 9 Aug 2026 09:42:01 +0800 Subject: [PATCH] =?UTF-8?q?chore(cli):=20=E5=8D=87=E7=BA=A7=20ts-checker-r?= =?UTF-8?q?spack-plugin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/cli/package.json | 2 +- .../cli/test/rspack-config-shape.test.mjs | 31 +++++ pnpm-lock.yaml | 119 +++++++++--------- test/toolchain.rules.test.ts | 4 +- 4 files changed, 92 insertions(+), 64 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index b42d06ad..86e6f644 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -134,7 +134,7 @@ "sass-embedded": "1.93.2", "sass-loader": "17.0.0", "serve-static": "2.2.0", - "ts-checker-rspack-plugin": "^1.5.2", + "ts-checker-rspack-plugin": "^1.6.0", "typescript-plugin-css-modules": "5.2.0", "webpack-bundle-analyzer": "4.10.2" } diff --git a/packages/cli/test/rspack-config-shape.test.mjs b/packages/cli/test/rspack-config-shape.test.mjs index c570f45b..a9cf64be 100644 --- a/packages/cli/test/rspack-config-shape.test.mjs +++ b/packages/cli/test/rspack-config-shape.test.mjs @@ -26,12 +26,14 @@ const loadStoreForFixture = async (fixtureRoot) => { await store.setup('dev', {}) const plugins = store.rsConfig.plugins ?? [] const pluginNames = plugins.map(plugin => plugin?.constructor?.name ?? plugin?.name ?? '') + const tsCheckerPlugin = plugins.find(plugin => plugin?.constructor?.name === 'TsCheckerRspackPlugin') const circularCheckPlugin = plugins.find(plugin => plugin?.constructor?.name === 'CircularCheckRspackPlugin') console.log( '__EMP_JSON__' + JSON.stringify({ ...store.rsConfig, __pluginNames: pluginNames, + __tsCheckerOptions: tsCheckerPlugin?.options ?? null, __circularCheckOptions: circularCheckPlugin?._options ?? null, }), ) @@ -56,10 +58,39 @@ const loadStoreForFixture = async (fixtureRoot) => { assert.equal(config.experiments?.css, undefined) assert.ok(Object.hasOwn(config, 'incremental')) assert.ok(Object.hasOwn(config, 'lazyCompilation')) + assert.ok(!config.__pluginNames.includes('TsCheckerRspackPlugin')) assert.ok(!config.__pluginNames.includes('CircularCheckRspackPlugin')) assert.equal(config.__circularCheckOptions, null) } +{ + const config = await loadStoreForFixture( + await createFixture('rspack-ts-checker', { + appSrc: 'src', + appEntry: 'index.ts', + tsCheckerRspackPlugin: { + async: false, + devServer: false, + }, + }), + ) + + assert.ok(config.__pluginNames.includes('TsCheckerRspackPlugin')) + assert.deepEqual(config.__tsCheckerOptions, {async: false, devServer: false}) +} + +{ + const config = await loadStoreForFixture( + await createFixture('rspack-ts-checker-disabled', { + appSrc: 'src', + appEntry: 'index.ts', + tsCheckerRspackPlugin: false, + }), + ) + + assert.ok(!config.__pluginNames.includes('TsCheckerRspackPlugin')) +} + { const config = await loadStoreForFixture( await createFixture('rspack-dev-flags', { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fb6a7f35..a93e649f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -604,8 +604,8 @@ importers: specifier: 2.2.0 version: 2.2.0 ts-checker-rspack-plugin: - specifier: ^1.5.2 - version: 1.5.2(@rspack/core@2.1.8(@module-federation/runtime-tools@2.8.1)(@swc/helpers@0.5.23))(tslib@2.8.1)(typescript@7.0.2) + specifier: ^1.6.0 + version: 1.6.0(@rspack/core@2.1.8(@module-federation/runtime-tools@2.8.1)(@swc/helpers@0.5.23))(typescript@7.0.2) typescript-plugin-css-modules: specifier: 5.2.0 version: 5.2.0(typescript@7.0.2) @@ -1861,50 +1861,50 @@ packages: peerDependencies: tslib: '2' - '@jsonjoy.com/fs-core@4.57.8': - resolution: {integrity: sha512-YzVbwggV9452VCeHgo0bjsTaUt1O7JE0XpEsPar93nn/+RAwXk0mb1Y+f5EDJ3TRtRCFe+Ck5RuojdfB4jeHVw==} + '@jsonjoy.com/fs-core@4.68.0': + resolution: {integrity: sha512-OAioDU3UGV34ECVTB4pt641OfUzuyDuyUmgrlVM+Fp9g4YyavZrB4xxWuupYrU66+81+um9D0DAzYhjXto5ysQ==} engines: {node: '>=10.0'} peerDependencies: tslib: '2' - '@jsonjoy.com/fs-fsa@4.57.8': - resolution: {integrity: sha512-vmClyvCQMxgqz7uamDiGtRfp4MjzOznk3pcQjCxlIwJcw7TWeyr+bF30hI0x8NxdtNOGMg1pHM74VDIXOeyjuw==} + '@jsonjoy.com/fs-fsa@4.68.0': + resolution: {integrity: sha512-dC6VeW8uqXMF9Hkqb7qYST/t165XCHG+bNwwMzRetoNZRxJC8anr5XCJSAk5B+YLHGn6SP+noNltU6OFg/oa7A==} engines: {node: '>=10.0'} peerDependencies: tslib: '2' - '@jsonjoy.com/fs-node-builtins@4.57.8': - resolution: {integrity: sha512-mxXSXw8zZwRVakcjLqR2I/psy4gURFSASZS10kKJ2kJw05GC2nXGroGrWVHxwgkxXgQLsFQnB74QaLzsxzdL/w==} + '@jsonjoy.com/fs-node-builtins@4.68.0': + resolution: {integrity: sha512-j3bb+k4NuqpqXQzinCLeagS7LGLCUvPqA6TnpaBkBqhnPjbzETYiQFpD7pWaV8cGOhhZcAv9dmpzk5mxNb1qsg==} engines: {node: '>=10.0'} peerDependencies: tslib: '2' - '@jsonjoy.com/fs-node-to-fsa@4.57.8': - resolution: {integrity: sha512-AWZcT/4+H+iDl4XCukbXrarvwEgOrf/prFI5/7eg4ix9FxqVsZysIDJd1Kjd+AjlCeHKHJOaRqjLd5HiGSCJEw==} + '@jsonjoy.com/fs-node-to-fsa@4.68.0': + resolution: {integrity: sha512-dtLpmLQxw3IBcGxoK9tVvftwmQLl9qmQyivt8DZpeEwDUcQkxk2CLMZERXtmOlF1mWXfT9CqtjjMiswkb03rKw==} engines: {node: '>=10.0'} peerDependencies: tslib: '2' - '@jsonjoy.com/fs-node-utils@4.57.8': - resolution: {integrity: sha512-E/bJ7sQAb4pu9nbeJhbULU3WnqWrswte4N9Js/oHt7aHB746S8/XBqKlcbrqIgnD3095XluovNEZuu5ONT230g==} + '@jsonjoy.com/fs-node-utils@4.68.0': + resolution: {integrity: sha512-Q84pogSfRaz0WNrBBy+HzBmhNu4m6tWoM0po8bLwW4pKvrwrSadOgFpm1sku08sfg0QAtUubkWuZEBDpNI3toQ==} engines: {node: '>=10.0'} peerDependencies: tslib: '2' - '@jsonjoy.com/fs-node@4.57.8': - resolution: {integrity: sha512-IPEOlDYSnTDYpjQlQg2F8h+eqxKQN3sdbroI0WrteRiQZ462HzVpBo9ZZX485njz4nAacoe3fd4iDiIhk+k5Hg==} + '@jsonjoy.com/fs-node@4.68.0': + resolution: {integrity: sha512-xYDlpSk3UDHjcI0kiz6kNJ/oVTEzlS7kUzAoAsgJh2/+yOtYV/eZW7M8O9Fj+ED3BDONYKt7+8OiPlWl6xpFeA==} engines: {node: '>=10.0'} peerDependencies: tslib: '2' - '@jsonjoy.com/fs-print@4.57.8': - resolution: {integrity: sha512-DfzhOBpmvNu5P/KSe4NNQaOnvNliTdcf0qrh/4EReErF/XUQXYkd0vZl/OiJCm/qjEEo8DWRstliw2/JNS84dA==} + '@jsonjoy.com/fs-print@4.68.0': + resolution: {integrity: sha512-sdy9F6N9QEcyAcU8OxEQmB91mlgiyuMphTFeijQ+qFgigCOeT16lW3X1dCWNzD7wwKLOKXnnYqsFyeq4LWSlYQ==} engines: {node: '>=10.0'} peerDependencies: tslib: '2' - '@jsonjoy.com/fs-snapshot@4.57.8': - resolution: {integrity: sha512-L+eqKaWOHLDaiMv1dh/EWQ4hA+o6xAhWSumTo3Teg7OM18jU/KE13/e8Mfal+eAZ/pSl4wIhKHcDiwapJzC8Wg==} + '@jsonjoy.com/fs-snapshot@4.68.0': + resolution: {integrity: sha512-eV44t9KY9LH47aPR1a4Nv4xYxM1vQ+OKEw9Mx/3zkuxGOILwmtFddlh5HakdMFpFHwuFNPw1s+NGq2eVYFpQRA==} engines: {node: '>=10.0'} peerDependencies: tslib: '2' @@ -5620,10 +5620,8 @@ packages: mdn-data@2.0.4: resolution: {integrity: sha512-iV3XNKw06j5Q7mi6h+9vbx23Tv7JkjEVgKHW4pimwyDGWm0OIQntJJ+u1C6mg6mK1EaTv42XQ7w76yuzH7M2cA==} - memfs@4.57.8: - resolution: {integrity: sha512-bApYhn8BLpFAnAQmFfEl/NPN+8qx5Ar3V4Qt3ek23mVwBEElzV7c6XoPkb/PCG8ZFpowCEpHcPwMFTwHS7tSMA==} - peerDependencies: - tslib: '2' + memfs@4.68.0: + resolution: {integrity: sha512-qlU8XrIfXUuZcmXk/GODL47KXXnhSbbaWtW5z+L7cLFfIQbgAOWzL5lqUYn39kfJh+BHLaD/siaM94/UTweGow==} merge-source-map@1.1.0: resolution: {integrity: sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==} @@ -6898,8 +6896,8 @@ packages: peerDependencies: typescript: '>=4.2.0' - ts-checker-rspack-plugin@1.5.2: - resolution: {integrity: sha512-YtdNbLnJ9fU6itfQky0K9Lebb/N0TUSbSVUByyoGt27em3hiTCVnfW2MzxFUHpdMv5+7xPmoS8YBwdDyHfEaGQ==} + ts-checker-rspack-plugin@1.6.0: + resolution: {integrity: sha512-T9xp7YhbvxDP0uUAn8n5iBnzFXdPJTwiR+ePNVVRYrIsYqNkXxxfvdMFC7CWT4kPkOFXuV0N1wTIGkjxMeURYg==} peerDependencies: '@rspack/core': ^1.0.0 || ^2.0.0 '@typescript/native-preview': ^7.0.0-0 @@ -8281,58 +8279,59 @@ snapshots: dependencies: tslib: 2.8.1 - '@jsonjoy.com/fs-core@4.57.8(tslib@2.8.1)': + '@jsonjoy.com/fs-core@4.68.0(tslib@2.8.1)': dependencies: - '@jsonjoy.com/fs-node-builtins': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-utils': 4.57.8(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.68.0(tslib@2.8.1) thingies: 2.6.0(tslib@2.8.1) tslib: 2.8.1 - '@jsonjoy.com/fs-fsa@4.57.8(tslib@2.8.1)': + '@jsonjoy.com/fs-fsa@4.68.0(tslib@2.8.1)': dependencies: - '@jsonjoy.com/fs-core': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-builtins': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-utils': 4.57.8(tslib@2.8.1) + '@jsonjoy.com/fs-core': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.68.0(tslib@2.8.1) thingies: 2.6.0(tslib@2.8.1) tslib: 2.8.1 - '@jsonjoy.com/fs-node-builtins@4.57.8(tslib@2.8.1)': + '@jsonjoy.com/fs-node-builtins@4.68.0(tslib@2.8.1)': dependencies: tslib: 2.8.1 - '@jsonjoy.com/fs-node-to-fsa@4.57.8(tslib@2.8.1)': + '@jsonjoy.com/fs-node-to-fsa@4.68.0(tslib@2.8.1)': dependencies: - '@jsonjoy.com/fs-fsa': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-builtins': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-utils': 4.57.8(tslib@2.8.1) + '@jsonjoy.com/fs-fsa': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.68.0(tslib@2.8.1) tslib: 2.8.1 - '@jsonjoy.com/fs-node-utils@4.57.8(tslib@2.8.1)': + '@jsonjoy.com/fs-node-utils@4.68.0(tslib@2.8.1)': dependencies: - '@jsonjoy.com/fs-node-builtins': 4.57.8(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.68.0(tslib@2.8.1) + glob-to-regex.js: 1.2.0(tslib@2.8.1) tslib: 2.8.1 - '@jsonjoy.com/fs-node@4.57.8(tslib@2.8.1)': + '@jsonjoy.com/fs-node@4.68.0(tslib@2.8.1)': dependencies: - '@jsonjoy.com/fs-core': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-builtins': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-utils': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-print': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-snapshot': 4.57.8(tslib@2.8.1) + '@jsonjoy.com/fs-core': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-print': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-snapshot': 4.68.0(tslib@2.8.1) glob-to-regex.js: 1.2.0(tslib@2.8.1) thingies: 2.6.0(tslib@2.8.1) tslib: 2.8.1 - '@jsonjoy.com/fs-print@4.57.8(tslib@2.8.1)': + '@jsonjoy.com/fs-print@4.68.0(tslib@2.8.1)': dependencies: - '@jsonjoy.com/fs-node-utils': 4.57.8(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.68.0(tslib@2.8.1) tree-dump: 1.1.0(tslib@2.8.1) tslib: 2.8.1 - '@jsonjoy.com/fs-snapshot@4.57.8(tslib@2.8.1)': + '@jsonjoy.com/fs-snapshot@4.68.0(tslib@2.8.1)': dependencies: '@jsonjoy.com/buffers': 17.67.0(tslib@2.8.1) - '@jsonjoy.com/fs-node-utils': 4.57.8(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.68.0(tslib@2.8.1) '@jsonjoy.com/json-pack': 17.67.0(tslib@2.8.1) '@jsonjoy.com/util': 17.67.0(tslib@2.8.1) tslib: 2.8.1 @@ -12333,16 +12332,16 @@ snapshots: mdn-data@2.0.4: {} - memfs@4.57.8(tslib@2.8.1): + memfs@4.68.0: dependencies: - '@jsonjoy.com/fs-core': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-fsa': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-builtins': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-to-fsa': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-node-utils': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-print': 4.57.8(tslib@2.8.1) - '@jsonjoy.com/fs-snapshot': 4.57.8(tslib@2.8.1) + '@jsonjoy.com/fs-core': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-fsa': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-to-fsa': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-print': 4.68.0(tslib@2.8.1) + '@jsonjoy.com/fs-snapshot': 4.68.0(tslib@2.8.1) '@jsonjoy.com/json-pack': 1.21.0(tslib@2.8.1) '@jsonjoy.com/util': 1.9.0(tslib@2.8.1) glob-to-regex.js: 1.2.0(tslib@2.8.1) @@ -13587,17 +13586,15 @@ snapshots: dependencies: typescript: 7.0.2 - ts-checker-rspack-plugin@1.5.2(@rspack/core@2.1.8(@module-federation/runtime-tools@2.8.1)(@swc/helpers@0.5.23))(tslib@2.8.1)(typescript@7.0.2): + ts-checker-rspack-plugin@1.6.0(@rspack/core@2.1.8(@module-federation/runtime-tools@2.8.1)(@swc/helpers@0.5.23))(typescript@7.0.2): dependencies: '@rspack/lite-tapable': 1.1.2 chokidar: 3.6.0 - memfs: 4.57.8(tslib@2.8.1) + memfs: 4.68.0 picocolors: 1.1.1 typescript: 7.0.2 optionalDependencies: '@rspack/core': 2.1.8(@module-federation/runtime-tools@2.8.1)(@swc/helpers@0.5.23) - transitivePeerDependencies: - - tslib tsconfig-paths@4.2.0: dependencies: diff --git a/test/toolchain.rules.test.ts b/test/toolchain.rules.test.ts index 20862831..b53d77e0 100644 --- a/test/toolchain.rules.test.ts +++ b/test/toolchain.rules.test.ts @@ -237,11 +237,11 @@ describe('toolchain version contract', () => { expect(cliPkg.dependencies.cors).toBe('2.8.6') expect(cliPkg.dependencies['fs-extra']).toBe('11.3.6') expect(cliPkg.dependencies['html-webpack-plugin']).toBe('5.6.7') - expect(cliPkg.dependencies['ts-checker-rspack-plugin']).toBe('^1.5.2') + expect(cliPkg.dependencies['ts-checker-rspack-plugin']).toBe('^1.6.0') expect(cliPkg.devDependencies['@vue/tsconfig']).toBe('^0.9.1') expect(lockfile).toContain('@rsdoctor/rspack-plugin@1.5.18') expect(lockfile).toContain('@rspack/dev-server@2.2.0') - expect(lockfile).toContain('ts-checker-rspack-plugin@1.5.2') + expect(lockfile).toContain('ts-checker-rspack-plugin@1.6.0') expect(lockfile).not.toContain('@rsdoctor/rspack-plugin@1.5.17') expect(lockfile).not.toContain('ts-checker-rspack-plugin@1.5.1') expect(cliRstestConfig).toContain("pool: {type: 'forks', maxWorkers: 1, minWorkers: 1}")