diff --git a/docs/README.md b/docs/README.md index e9816cec..e095f33f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -615,6 +615,7 @@ When you use legacy TypeScript decorator by enabling `emitDecoratorMetadata` in decorators. In this case, you can give extra swc configuration in the `tsup.config.ts` file. For example, if you have to define `useDefineForClassFields`, you can do that as follows: + ```ts import { defineConfig } from 'tsup' @@ -626,10 +627,10 @@ export default defineConfig({ swc: { jsc: { transform: { - useDefineForClassFields: true - } - } - } + useDefineForClassFields: true, + }, + }, + }, }) ``` @@ -648,9 +649,9 @@ Note: some SWC options cannot be configured: "keepClassNames": true, "target": "es2022" } - ``` +``` -You can also define a custom `.swcrc` configuration file. Just set `swcrc` to `true` +You can also define a custom `.swcrc` configuration file. Just set `swcrc` to `true` in `tsup.config.ts` to allow SWC plugin to discover automatically your custom swc config file. ```ts @@ -662,8 +663,8 @@ export default defineConfig({ sourcemap: true, clean: true, swc: { - swcrc: true - } + swcrc: true, + }, }) ``` diff --git a/package.json b/package.json index b42b8c75..4c66e255 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "@rollup/plugin-json": "6.1.0", "@swc/core": "1.10.18", "@types/debug": "4.1.12", - "@types/node": "22.13.4", + "@types/node": "24.9.2", "@types/resolve": "1.20.6", "bumpp": "^10.0.3", "flat": "6.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 73a76744..a979162a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -62,7 +62,7 @@ importers: devDependencies: '@microsoft/api-extractor': specifier: ^7.50.0 - version: 7.50.0(@types/node@22.13.4) + version: 7.50.0(@types/node@24.9.2) '@rollup/plugin-json': specifier: 6.1.0 version: 6.1.0(rollup@4.34.8) @@ -73,8 +73,8 @@ importers: specifier: 4.1.12 version: 4.1.12 '@types/node': - specifier: 22.13.4 - version: 22.13.4 + specifier: 24.9.2 + version: 24.9.2 '@types/resolve': specifier: 1.20.6 version: 1.20.6 @@ -119,13 +119,13 @@ importers: version: 10.0.4(typescript@5.7.3) tsup: specifier: 8.3.6 - version: 8.3.6(@microsoft/api-extractor@7.50.0(@types/node@22.13.4))(@swc/core@1.10.18)(jiti@2.4.2)(postcss@8.5.2)(typescript@5.7.3)(yaml@2.5.1) + version: 8.3.6(@microsoft/api-extractor@7.50.0(@types/node@24.9.2))(@swc/core@1.10.18)(jiti@2.4.2)(postcss@8.5.2)(typescript@5.7.3)(yaml@2.5.1) typescript: specifier: 5.7.3 version: 5.7.3 vitest: specifier: 3.0.6 - version: 3.0.6(@types/debug@4.1.12)(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) + version: 3.0.6(@types/debug@4.1.12)(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) wait-for-expect: specifier: 3.0.2 version: 3.0.2 @@ -790,8 +790,8 @@ packages: '@types/ms@2.1.0': resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} - '@types/node@22.13.4': - resolution: {integrity: sha512-ywP2X0DYtX3y08eFVx5fNIw7/uIv8hYUKgXoK8oayJlLnKcRfEYCxWMVE1XagUdVtCJlZT1AU4LXEABW+L1Peg==} + '@types/node@24.9.2': + resolution: {integrity: sha512-uWN8YqxXxqFMX2RqGOrumsKeti4LlmIMIyV0lgut4jx7KQBcBiW6vkDtIBvHnHIquwNfJhk8v2OtmO8zXWHfPA==} '@types/resolve@1.20.6': resolution: {integrity: sha512-A4STmOXPhMUtHH+S6ymgE2GiBSMqf4oTvcQZMcHzokuTLVYzXTB8ttjcgxOVaAp2lGwEdzZ0J+cRbbeevQj1UQ==} @@ -830,11 +830,6 @@ packages: peerDependencies: acorn: '>=8.9.0' - acorn@8.12.1: - resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} - engines: {node: '>=0.4.0'} - hasBin: true - acorn@8.14.0: resolution: {integrity: sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==} engines: {node: '>=0.4.0'} @@ -1457,6 +1452,7 @@ packages: source-map@0.8.0-beta.0: resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} engines: {node: '>= 8'} + deprecated: The work that was done in this beta branch won't be included in future versions sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} @@ -1641,8 +1637,8 @@ packages: ufo@1.5.4: resolution: {integrity: sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==} - undici-types@6.20.0: - resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==} + undici-types@7.16.0: + resolution: {integrity: sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==} universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} @@ -1960,23 +1956,23 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@microsoft/api-extractor-model@7.30.3(@types/node@22.13.4)': + '@microsoft/api-extractor-model@7.30.3(@types/node@24.9.2)': dependencies: '@microsoft/tsdoc': 0.15.1 '@microsoft/tsdoc-config': 0.17.1 - '@rushstack/node-core-library': 5.11.0(@types/node@22.13.4) + '@rushstack/node-core-library': 5.11.0(@types/node@24.9.2) transitivePeerDependencies: - '@types/node' - '@microsoft/api-extractor@7.50.0(@types/node@22.13.4)': + '@microsoft/api-extractor@7.50.0(@types/node@24.9.2)': dependencies: - '@microsoft/api-extractor-model': 7.30.3(@types/node@22.13.4) + '@microsoft/api-extractor-model': 7.30.3(@types/node@24.9.2) '@microsoft/tsdoc': 0.15.1 '@microsoft/tsdoc-config': 0.17.1 - '@rushstack/node-core-library': 5.11.0(@types/node@22.13.4) + '@rushstack/node-core-library': 5.11.0(@types/node@24.9.2) '@rushstack/rig-package': 0.5.3 - '@rushstack/terminal': 0.15.0(@types/node@22.13.4) - '@rushstack/ts-command-line': 4.23.5(@types/node@22.13.4) + '@rushstack/terminal': 0.15.0(@types/node@24.9.2) + '@rushstack/ts-command-line': 4.23.5(@types/node@24.9.2) lodash: 4.17.21 minimatch: 3.0.8 resolve: 1.22.10 @@ -2130,7 +2126,7 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.34.8': optional: true - '@rushstack/node-core-library@5.11.0(@types/node@22.13.4)': + '@rushstack/node-core-library@5.11.0(@types/node@24.9.2)': dependencies: ajv: 8.13.0 ajv-draft-04: 1.0.0(ajv@8.13.0) @@ -2141,23 +2137,23 @@ snapshots: resolve: 1.22.10 semver: 7.5.4 optionalDependencies: - '@types/node': 22.13.4 + '@types/node': 24.9.2 '@rushstack/rig-package@0.5.3': dependencies: resolve: 1.22.10 strip-json-comments: 3.1.1 - '@rushstack/terminal@0.15.0(@types/node@22.13.4)': + '@rushstack/terminal@0.15.0(@types/node@24.9.2)': dependencies: - '@rushstack/node-core-library': 5.11.0(@types/node@22.13.4) + '@rushstack/node-core-library': 5.11.0(@types/node@24.9.2) supports-color: 8.1.1 optionalDependencies: - '@types/node': 22.13.4 + '@types/node': 24.9.2 - '@rushstack/ts-command-line@4.23.5(@types/node@22.13.4)': + '@rushstack/ts-command-line@4.23.5(@types/node@24.9.2)': dependencies: - '@rushstack/terminal': 0.15.0(@types/node@22.13.4) + '@rushstack/terminal': 0.15.0(@types/node@24.9.2) '@types/argparse': 1.0.38 argparse: 1.0.10 string-argv: 0.3.2 @@ -2226,9 +2222,9 @@ snapshots: '@types/ms@2.1.0': {} - '@types/node@22.13.4': + '@types/node@24.9.2': dependencies: - undici-types: 6.20.0 + undici-types: 7.16.0 '@types/resolve@1.20.6': {} @@ -2239,13 +2235,13 @@ snapshots: chai: 5.2.0 tinyrainbow: 2.0.0 - '@vitest/mocker@3.0.6(vite@6.2.0(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1))': + '@vitest/mocker@3.0.6(vite@6.2.0(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1))': dependencies: '@vitest/spy': 3.0.6 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - vite: 6.2.0(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) + vite: 6.2.0(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) '@vitest/pretty-format@3.0.6': dependencies: @@ -2272,11 +2268,9 @@ snapshots: loupe: 3.1.3 tinyrainbow: 2.0.0 - acorn-typescript@1.4.13(acorn@8.12.1): + acorn-typescript@1.4.13(acorn@8.14.0): dependencies: - acorn: 8.12.1 - - acorn@8.12.1: {} + acorn: 8.14.0 acorn@8.14.0: {} @@ -2959,8 +2953,8 @@ snapshots: '@ampproject/remapping': 2.3.0 '@jridgewell/sourcemap-codec': 1.5.0 '@types/estree': 1.0.6 - acorn: 8.12.1 - acorn-typescript: 1.4.13(acorn@8.12.1) + acorn: 8.14.0 + acorn-typescript: 1.4.13(acorn@8.14.0) aria-query: 5.3.2 axobject-query: 4.1.0 clsx: 2.1.1 @@ -3027,7 +3021,7 @@ snapshots: ts-interface-checker@0.1.13: {} - tsup@8.3.6(@microsoft/api-extractor@7.50.0(@types/node@22.13.4))(@swc/core@1.10.18)(jiti@2.4.2)(postcss@8.5.2)(typescript@5.7.3)(yaml@2.5.1): + tsup@8.3.6(@microsoft/api-extractor@7.50.0(@types/node@24.9.2))(@swc/core@1.10.18)(jiti@2.4.2)(postcss@8.5.2)(typescript@5.7.3)(yaml@2.5.1): dependencies: bundle-require: 5.1.0(esbuild@0.24.2) cac: 6.7.14 @@ -3046,7 +3040,7 @@ snapshots: tinyglobby: 0.2.11 tree-kill: 1.2.2 optionalDependencies: - '@microsoft/api-extractor': 7.50.0(@types/node@22.13.4) + '@microsoft/api-extractor': 7.50.0(@types/node@24.9.2) '@swc/core': 1.10.18 postcss: 8.5.2 typescript: 5.7.3 @@ -3062,7 +3056,7 @@ snapshots: ufo@1.5.4: {} - undici-types@6.20.0: {} + undici-types@7.16.0: {} universalify@2.0.1: {} @@ -3070,13 +3064,13 @@ snapshots: dependencies: punycode: 2.3.1 - vite-node@3.0.6(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1): + vite-node@3.0.6(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1): dependencies: cac: 6.7.14 debug: 4.4.0 es-module-lexer: 1.6.0 pathe: 2.0.3 - vite: 6.2.0(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) + vite: 6.2.0(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) transitivePeerDependencies: - '@types/node' - jiti @@ -3091,23 +3085,23 @@ snapshots: - tsx - yaml - vite@6.2.0(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1): + vite@6.2.0(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1): dependencies: esbuild: 0.25.0 postcss: 8.5.3 rollup: 4.34.8 optionalDependencies: - '@types/node': 22.13.4 + '@types/node': 24.9.2 fsevents: 2.3.3 jiti: 2.4.2 sass: 1.85.0 terser: 5.39.0 yaml: 2.5.1 - vitest@3.0.6(@types/debug@4.1.12)(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1): + vitest@3.0.6(@types/debug@4.1.12)(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1): dependencies: '@vitest/expect': 3.0.6 - '@vitest/mocker': 3.0.6(vite@6.2.0(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1)) + '@vitest/mocker': 3.0.6(vite@6.2.0(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1)) '@vitest/pretty-format': 3.0.6 '@vitest/runner': 3.0.6 '@vitest/snapshot': 3.0.6 @@ -3123,12 +3117,12 @@ snapshots: tinyexec: 0.3.2 tinypool: 1.0.2 tinyrainbow: 2.0.0 - vite: 6.2.0(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) - vite-node: 3.0.6(@types/node@22.13.4)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) + vite: 6.2.0(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) + vite-node: 3.0.6(@types/node@24.9.2)(jiti@2.4.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.5.1) why-is-node-running: 2.3.0 optionalDependencies: '@types/debug': 4.1.12 - '@types/node': 22.13.4 + '@types/node': 24.9.2 transitivePeerDependencies: - jiti - less diff --git a/src/esbuild/swc.ts b/src/esbuild/swc.ts index 755009d3..ee12c1dc 100644 --- a/src/esbuild/swc.ts +++ b/src/esbuild/swc.ts @@ -9,7 +9,10 @@ import type { Logger } from '../log' export type SwcPluginConfig = { logger: Logger } & Options -export const swcPlugin = ({ logger, ...swcOptions }: SwcPluginConfig): Plugin => { +export const swcPlugin = ({ + logger, + ...swcOptions +}: SwcPluginConfig): Plugin => { return { name: 'swc', diff --git a/src/options.ts b/src/options.ts index 6bbee23b..7f68bd8c 100644 --- a/src/options.ts +++ b/src/options.ts @@ -257,8 +257,8 @@ export type Options = { * @default true */ removeNodeProtocol?: boolean - - swc?: SwcPluginConfig; + + swc?: SwcPluginConfig } export interface NormalizedExperimentalDtsConfig { diff --git a/vitest.config.mts b/vitest.config.mts index 8f6d3ac6..7e032eda 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -4,6 +4,6 @@ export default defineConfig({ test: { testTimeout: 50000, globalSetup: 'vitest-global.ts', - include: ["test/*.test.ts", "src/**/*.test.ts"] + include: ['test/*.test.ts', 'src/**/*.test.ts'], }, })