From e6163f61c4e3bf67087fc8c4e2f6ac641f75a557 Mon Sep 17 00:00:00 2001 From: MK Date: Fri, 24 Apr 2026 22:11:41 +0800 Subject: [PATCH 1/5] fix(check): remove redundant package tsconfigs to unblock single-file lint-staged These per-package tsconfigs (packages/{cli,core,test}/tsconfig.json) only extended the root, set experimentalDecorators, and matched no files (include:[], exclude:["**/*"]). They were leftovers from when packages were built with tsc; the code now builds via oxnode ./build.ts and no source uses decorators. Their presence caused tsgolint to walk up to one of these empty-include ancestors during single-file `vp check --fix ` (lint-staged path), build a "loose" program, and miss the root tsconfig's types:["node"], producing spurious TS2591 on node:* imports. Deleting them lets tsgolint walk up to the project root tsconfig that does declare types:["node"]. Closes #1443 --- packages/cli/tsconfig.json | 9 --------- packages/core/tsconfig.json | 9 --------- packages/test/tsconfig.json | 9 --------- 3 files changed, 27 deletions(-) delete mode 100644 packages/cli/tsconfig.json delete mode 100644 packages/core/tsconfig.json delete mode 100644 packages/test/tsconfig.json diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json deleted file mode 100644 index 62406593a8..0000000000 --- a/packages/cli/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "experimentalDecorators": true - }, - "files": [], - "include": [], - "exclude": ["**/*"] -} diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json deleted file mode 100644 index 62406593a8..0000000000 --- a/packages/core/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "experimentalDecorators": true - }, - "files": [], - "include": [], - "exclude": ["**/*"] -} diff --git a/packages/test/tsconfig.json b/packages/test/tsconfig.json deleted file mode 100644 index 62406593a8..0000000000 --- a/packages/test/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "experimentalDecorators": true - }, - "files": [], - "include": [], - "exclude": ["**/*"] -} From 2d2a36633b86886e47ad06e20b71f5f177dc353f Mon Sep 17 00:00:00 2001 From: MK Date: Fri, 24 Apr 2026 22:23:33 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20restore=20packages/{core,test}/tscon?= =?UTF-8?q?fig.json=20=E2=80=94=20load-bearing=20for=20oxnode=20-C=20dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These two looked redundant (extends root, only sets experimentalDecorators, matches no files), but they are actually load-bearing for the build. Both packages/core/build.ts and packages/test/build.ts run via `oxnode -C dev ./build.ts` and statically import `rolldown`. With the dev condition, rolldown's exports resolve to its raw TS source (./src/index.ts), which transitively loads rolldown/packages/rolldown/src/types/rolldown-output-impl.ts. That file uses `@lazyProp` (experimental decorator). @oxc-node/core's transformer is constructed with `process.cwd()` (see its register.mjs) and reads compilerOptions only from the cwd's tsconfig.json — it does NOT walk up to ancestor tsconfigs (verified empirically: adding experimentalDecorators to the root tsconfig did not fix the build). Without the per-package tsconfig in cwd, oxnode strips types but leaves decorator syntax intact, and Node's parser then errors with `SyntaxError: Invalid or unexpected token` on the `@lazyProp`. packages/cli/tsconfig.json stays deleted because packages/cli/build.ts does not import rolldown (only @napi-rs/cli, oxfmt, fs/path utils), so its build never loads decorator-using code. The #1443 bug only affected packages/cli/src/** — packages/{core,test} have no src/ directory of their own (just build.ts at the root), so restoring their tsconfigs does not regress #1443. --- packages/core/tsconfig.json | 9 +++++++++ packages/test/tsconfig.json | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 packages/core/tsconfig.json create mode 100644 packages/test/tsconfig.json diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json new file mode 100644 index 0000000000..62406593a8 --- /dev/null +++ b/packages/core/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "experimentalDecorators": true + }, + "files": [], + "include": [], + "exclude": ["**/*"] +} diff --git a/packages/test/tsconfig.json b/packages/test/tsconfig.json new file mode 100644 index 0000000000..62406593a8 --- /dev/null +++ b/packages/test/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "experimentalDecorators": true + }, + "files": [], + "include": [], + "exclude": ["**/*"] +} From a4569c8f432727ff002c21d0843677fc9bd1187b Mon Sep 17 00:00:00 2001 From: MK Date: Fri, 24 Apr 2026 22:30:04 +0800 Subject: [PATCH 3/5] fix: tighten packages/{core,test}/tsconfig include so vp lint works on lintable files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The empty `include: []` / `exclude: ["**/*"]` from these per-package tsconfigs caused the same TS2591 / loose-program issue as #1443 for any TS file inside these packages — e.g. `vp lint packages/core/build-support/find-create-require.ts` spuriously failed with "Cannot find name 'node:module'". We can't simply delete these tsconfigs (oxnode -C dev needs them in cwd for experimentalDecorators when bundling rolldown source). Instead, give them an explicit `include` matching the files developers actually run lint on (build-support, __tests__) plus an `exclude` for build artifacts. Now tsgolint walks up, finds the file claimed by the program, and applies the inherited `types: ["node"]` from the root tsconfig. Top-level build scripts (build.ts, rollupLicensePlugin.ts, vite-rolldown.config.ts) stay outside this program — they're already excluded by the root tsconfig. --- packages/core/tsconfig.json | 5 ++--- packages/test/tsconfig.json | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 62406593a8..57413fecdf 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "experimentalDecorators": true }, - "files": [], - "include": [], - "exclude": ["**/*"] + "include": ["build-support/**/*", "__tests__/**/*"], + "exclude": ["dist", "node_modules"] } diff --git a/packages/test/tsconfig.json b/packages/test/tsconfig.json index 62406593a8..d64324f386 100644 --- a/packages/test/tsconfig.json +++ b/packages/test/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "experimentalDecorators": true }, - "files": [], - "include": [], - "exclude": ["**/*"] + "include": ["__tests__/**/*"], + "exclude": ["dist", "node_modules"] } From 81a14f90ff13ff851c8f5b80bb80cb0694877e2c Mon Sep 17 00:00:00 2001 From: MK Date: Fri, 24 Apr 2026 22:48:32 +0800 Subject: [PATCH 4/5] fix: delete packages/{core,test}/tsconfig.json by routing oxnode and rolldown to root tsconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @oxc-node/core's OxcTransformer reads compilerOptions only from cwd's tsconfig.json (no walk-up). Without these per-package tsconfigs in cwd, oxnode strips types but leaves decorator syntax intact, breaking the build with `SyntaxError: Invalid or unexpected token` at @lazyProp in rolldown's source (loaded via the -C dev condition). Use OXC_TSCONFIG_PATH (the only oxnode tsconfig knob — no CLI flag exists, found via strings on the native binding) to point oxnode at the root tsconfig, where experimentalDecorators is now declared. Wire it through cross-env in the build scripts so it works on Windows too. packages/core/build.ts also passed projectDir/tsconfig.json to rolldown's bundler API; repoint that to the root tsconfig as well so rolldown finds a tsconfig too. Net effect: packages/{cli,core,test}/tsconfig.json all gone. tsgolint walks up to the root tsconfig for any file under these packages and applies types:["node"] cleanly, fixing #1443 and the equivalent failures under packages/core/build-support and packages/{core,test}/__tests__. --- packages/core/build.ts | 2 +- packages/core/package.json | 3 ++- packages/core/tsconfig.json | 8 -------- packages/test/package.json | 3 ++- packages/test/tsconfig.json | 8 -------- pnpm-lock.yaml | 30 +++++++++++++++++++++++++++--- pnpm-workspace.yaml | 1 + tsconfig.json | 3 ++- 8 files changed, 35 insertions(+), 23 deletions(-) delete mode 100644 packages/core/tsconfig.json delete mode 100644 packages/test/tsconfig.json diff --git a/packages/core/build.ts b/packages/core/build.ts index 15354cd6d9..f064202a07 100644 --- a/packages/core/build.ts +++ b/packages/core/build.ts @@ -91,7 +91,7 @@ await mergePackageJson(); async function buildVite() { const newViteRolldownConfig = viteRolldownConfig.map((config) => { - config.tsconfig = join(projectDir, 'tsconfig.json'); + config.tsconfig = join(projectDir, '..', '..', 'tsconfig.json'); config.cwd = projectDir; if (Array.isArray(config.external)) { diff --git a/packages/core/package.json b/packages/core/package.json index d6df374112..cdcd7a44cc 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -100,7 +100,7 @@ "./types/internal/*": null }, "scripts": { - "build": "oxnode -C dev ./build.ts" + "build": "cross-env OXC_TSCONFIG_PATH=../../tsconfig.json oxnode -C dev ./build.ts" }, "dependencies": { "@oxc-project/runtime": "catalog:", @@ -116,6 +116,7 @@ "@oxc-node/cli": "catalog:", "@oxc-node/core": "catalog:", "@vitejs/devtools": "^0.1.15", + "cross-env": "catalog:", "es-module-lexer": "^1.7.0", "hookable": "^6.0.1", "magic-string": "^0.30.21", diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json deleted file mode 100644 index 57413fecdf..0000000000 --- a/packages/core/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "experimentalDecorators": true - }, - "include": ["build-support/**/*", "__tests__/**/*"], - "exclude": ["dist", "node_modules"] -} diff --git a/packages/test/package.json b/packages/test/package.json index bfd1f53909..f6e1d03dd4 100644 --- a/packages/test/package.json +++ b/packages/test/package.json @@ -272,7 +272,7 @@ } }, "scripts": { - "build": "oxnode -C dev ./build.ts" + "build": "cross-env OXC_TSCONFIG_PATH=../../tsconfig.json oxnode -C dev ./build.ts" }, "dependencies": { "@standard-schema/spec": "^1.1.0", @@ -306,6 +306,7 @@ "@vitest/utils": "4.1.5", "chai": "^6.2.1", "convert-source-map": "^2.0.0", + "cross-env": "catalog:", "estree-walker": "^3.0.3", "expect-type": "^1.2.2", "magic-string": "^0.30.21", diff --git a/packages/test/tsconfig.json b/packages/test/tsconfig.json deleted file mode 100644 index d64324f386..0000000000 --- a/packages/test/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "experimentalDecorators": true - }, - "include": ["__tests__/**/*"], - "exclude": ["dist", "node_modules"] -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0d97ae07f5..2a6b46e576 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -111,6 +111,9 @@ catalogs: consola: specifier: ^3.4.2 version: 3.4.2 + cross-env: + specifier: ^10.1.0 + version: 10.1.0 cross-spawn: specifier: ^7.0.5 version: 7.0.6 @@ -507,6 +510,9 @@ importers: '@vitejs/devtools': specifier: ^0.1.15 version: 0.1.15(@pnpm/logger@1001.0.1)(typescript@6.0.2)(vite@packages+core) + cross-env: + specifier: 'catalog:' + version: 10.1.0 es-module-lexer: specifier: ^1.7.0 version: 1.7.0 @@ -705,6 +711,9 @@ importers: convert-source-map: specifier: ^2.0.0 version: 2.0.0 + cross-env: + specifier: 'catalog:' + version: 10.1.0 estree-walker: specifier: ^3.0.3 version: 3.0.3 @@ -2163,6 +2172,9 @@ packages: '@emnapi/wasi-threads@1.2.1': resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==} + '@epic-web/invariant@1.0.0': + resolution: {integrity: sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==} + '@esbuild/aix-ppc64@0.27.4': resolution: {integrity: sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==} engines: {node: '>=18'} @@ -6238,6 +6250,11 @@ packages: resolution: {integrity: sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==} engines: {node: '>= 14'} + cross-env@10.1.0: + resolution: {integrity: sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==} + engines: {node: '>=20'} + hasBin: true + cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -10428,6 +10445,8 @@ snapshots: dependencies: tslib: 2.8.1 + '@epic-web/invariant@1.0.0': {} + '@esbuild/aix-ppc64@0.27.4': optional: true @@ -12487,7 +12506,7 @@ snapshots: lightningcss: 1.32.0 postcss-load-config: 6.0.1(jiti@2.6.1)(postcss@8.5.10)(tsx@4.21.0)(yaml@2.8.2) rolldown: link:rolldown/packages/rolldown - tsdown: 0.21.10(@arethetypeswrong/core@0.18.2)(@tsdown/css@0.21.10)(@tsdown/exe@0.21.10)(@typescript/native-preview@7.0.0-dev.20260122.2)(@vitejs/devtools@0.1.15(@pnpm/logger@1001.0.1)(typescript@6.0.2)(vite@packages+core))(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0))(publint@0.3.18)(typescript@6.0.2)(unplugin-unused@0.5.6) + tsdown: 0.21.10(@arethetypeswrong/core@0.18.2)(@tsdown/css@0.21.10)(@tsdown/exe@0.21.10)(@typescript/native-preview@7.0.0-dev.20260122.2)(@vitejs/devtools@0.1.15(@pnpm/logger@1001.0.1)(typescript@6.0.2)(vite@packages+core))(oxc-resolver@11.19.1(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2))(publint@0.3.18)(typescript@6.0.2)(unplugin-unused@0.5.6) optionalDependencies: postcss: 8.5.10 postcss-import: 16.1.1(postcss@8.5.10) @@ -12522,7 +12541,7 @@ snapshots: obug: 2.1.1 semver: 7.7.4 tinyexec: 1.1.1 - tsdown: 0.21.10(@arethetypeswrong/core@0.18.2)(@tsdown/css@0.21.10)(@tsdown/exe@0.21.10)(@typescript/native-preview@7.0.0-dev.20260122.2)(@vitejs/devtools@0.1.15(@pnpm/logger@1001.0.1)(typescript@6.0.2)(vite@packages+core))(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0))(publint@0.3.18)(typescript@6.0.2)(unplugin-unused@0.5.6) + tsdown: 0.21.10(@arethetypeswrong/core@0.18.2)(@tsdown/css@0.21.10)(@tsdown/exe@0.21.10)(@typescript/native-preview@7.0.0-dev.20260122.2)(@vitejs/devtools@0.1.15(@pnpm/logger@1001.0.1)(typescript@6.0.2)(vite@packages+core))(oxc-resolver@11.19.1(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2))(publint@0.3.18)(typescript@6.0.2)(unplugin-unused@0.5.6) '@tsdown/exe@0.21.4(tsdown@0.21.4)': dependencies: @@ -13942,6 +13961,11 @@ snapshots: crc-32: 1.2.2 readable-stream: 4.7.0 + cross-env@10.1.0: + dependencies: + '@epic-web/invariant': 1.0.0 + cross-spawn: 7.0.6 + cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -16329,7 +16353,7 @@ snapshots: '@babel/types': 8.0.0-rc.3 ast-kit: 3.0.0-beta.1 birpc: 4.0.0 - dts-resolver: 2.1.3(oxc-resolver@11.19.1(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)) + dts-resolver: 2.1.3(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)) get-tsconfig: 4.13.7 obug: 2.1.1 picomatch: 4.0.4 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 1e20b53d20..63a313fa94 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -56,6 +56,7 @@ catalog: change-case: ^5.4.4 connect: ^3.7.0 consola: ^3.4.2 + cross-env: ^10.1.0 cross-spawn: ^7.0.5 debug: ^4.4.3 dedent: ^1.5.3 diff --git a/tsconfig.json b/tsconfig.json index 7be7b1a51b..bd0060afe7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,8 @@ "strict": true, "target": "esnext", "types": ["node"], - "verbatimModuleSyntax": true + "verbatimModuleSyntax": true, + "experimentalDecorators": true }, "exclude": [ "ecosystem-ci", From 60cfabd2ae8c3d90f783d99d0c2fda5022ec6d92 Mon Sep 17 00:00:00 2001 From: MK Date: Fri, 24 Apr 2026 22:59:47 +0800 Subject: [PATCH 5/5] Fixup --- pnpm-lock.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2a6b46e576..b78880e670 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12506,7 +12506,7 @@ snapshots: lightningcss: 1.32.0 postcss-load-config: 6.0.1(jiti@2.6.1)(postcss@8.5.10)(tsx@4.21.0)(yaml@2.8.2) rolldown: link:rolldown/packages/rolldown - tsdown: 0.21.10(@arethetypeswrong/core@0.18.2)(@tsdown/css@0.21.10)(@tsdown/exe@0.21.10)(@typescript/native-preview@7.0.0-dev.20260122.2)(@vitejs/devtools@0.1.15(@pnpm/logger@1001.0.1)(typescript@6.0.2)(vite@packages+core))(oxc-resolver@11.19.1(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2))(publint@0.3.18)(typescript@6.0.2)(unplugin-unused@0.5.6) + tsdown: 0.21.10(@arethetypeswrong/core@0.18.2)(@tsdown/css@0.21.10)(@tsdown/exe@0.21.10)(@typescript/native-preview@7.0.0-dev.20260122.2)(@vitejs/devtools@0.1.15(@pnpm/logger@1001.0.1)(typescript@6.0.2)(vite@packages+core))(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0))(publint@0.3.18)(typescript@6.0.2)(unplugin-unused@0.5.6) optionalDependencies: postcss: 8.5.10 postcss-import: 16.1.1(postcss@8.5.10) @@ -12541,7 +12541,7 @@ snapshots: obug: 2.1.1 semver: 7.7.4 tinyexec: 1.1.1 - tsdown: 0.21.10(@arethetypeswrong/core@0.18.2)(@tsdown/css@0.21.10)(@tsdown/exe@0.21.10)(@typescript/native-preview@7.0.0-dev.20260122.2)(@vitejs/devtools@0.1.15(@pnpm/logger@1001.0.1)(typescript@6.0.2)(vite@packages+core))(oxc-resolver@11.19.1(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2))(publint@0.3.18)(typescript@6.0.2)(unplugin-unused@0.5.6) + tsdown: 0.21.10(@arethetypeswrong/core@0.18.2)(@tsdown/css@0.21.10)(@tsdown/exe@0.21.10)(@typescript/native-preview@7.0.0-dev.20260122.2)(@vitejs/devtools@0.1.15(@pnpm/logger@1001.0.1)(typescript@6.0.2)(vite@packages+core))(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0))(publint@0.3.18)(typescript@6.0.2)(unplugin-unused@0.5.6) '@tsdown/exe@0.21.4(tsdown@0.21.4)': dependencies: @@ -16353,7 +16353,7 @@ snapshots: '@babel/types': 8.0.0-rc.3 ast-kit: 3.0.0-beta.1 birpc: 4.0.0 - dts-resolver: 2.1.3(oxc-resolver@11.19.1(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)) + dts-resolver: 2.1.3(oxc-resolver@11.19.1(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)) get-tsconfig: 4.13.7 obug: 2.1.1 picomatch: 4.0.4