Skip to content

Commit 78cbf5d

Browse files
committed
build: patch tsup's bundled rollup-plugin-dts so one ts.Program covers every DTS entry
tsup 8.5.1 bundles rollup-plugin-dts 6.1.1. Its createPrograms keys each entry by a directory, and on the tsconfig-override path tsup always takes, a config-cache hit kept the entry's own directory. So every DTS entry got its own ts.Program. That affects 12 packages here; spec's 18 entries built 18 programs. The patch keys every entry by the tsconfig's directory. Written with pnpm patch-commit; patchedDependencies lives in pnpm-workspace.yaml; the lockfile was regenerated by pnpm install. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014EJ1ED8X4MMrT18BhVx4tx
1 parent 8113763 commit 78cbf5d

3 files changed

Lines changed: 50 additions & 11 deletions

File tree

‎patches/tsup@8.5.1.patch‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff --git a/dist/rollup.js b/dist/rollup.js
2+
index e128b61b9558318b9f86dc11d72c31f09a8eb7db..35f85e39c2af6c645fb2d3da115742df445d2343 100644
3+
--- a/dist/rollup.js
4+
+++ b/dist/rollup.js
5+
@@ -4915,6 +4915,11 @@ var require_rollup_plugin_dts = _chunkTWFEYLU4js.__commonJS.call(void 0, {
6+
} else {
7+
logCache("HIT", cacheKey);
8+
}
9+
+ if (overrideConfigPath) {
10+
+ // objectstack patch: a cache HIT kept dirname(input), so each entry
11+
+ // got its own ts.Program. One tsconfig for all entries => one key.
12+
+ dirName = path__namespace.dirname(path__namespace.resolve(process.cwd(), overrideConfigPath));
13+
+ }
14+
const { fileNames, options, errors } = configByPath.get(cacheKey);
15+
dtsFiles = fileNames.filter((name) => DTS_EXTENSIONS.test(name));
16+
if (errors.length) {

‎pnpm-lock.yaml‎

Lines changed: 16 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@ onlyBuiltDependencies:
1818
- msw
1919
- sharp
2020

21+
# Patched dependencies. Written with `pnpm patch` / `pnpm patch-commit`, never
22+
# by hand. `patch-commit` writes this key into package.json's `pnpm` field;
23+
# move it here, the file that holds every other pnpm setting, then run
24+
# `pnpm install`.
25+
# - tsup@8.5.1: its bundled rollup-plugin-dts gave every DTS entry its own
26+
# ts.Program. tsup always passes the tsconfig path, and on that path a
27+
# config-cache hit keyed each later entry by its own directory. The patch
28+
# keys every entry by the tsconfig's directory, so all entries share one
29+
# program. The same code is in rollup-plugin-dts 6.5.1. Measured on
30+
# @objectstack/spec's 18 entries: live heap 4997 → 1405 MB. The emitted
31+
# declarations are the same types in every affected package.
32+
# The key names the exact version. A tsup that resolves to anything else
33+
# leaves the patch unused, and `pnpm install` then fails
34+
# (ERR_PNPM_UNUSED_PATCH), so an upgrade cannot drop the patch silently.
35+
# Re-derive the patch, or retire it, on every tsup bump.
36+
patchedDependencies:
37+
tsup@8.5.1: patches/tsup@8.5.1.patch
38+
2139
# Transitive-dependency version pins. pnpm v10 reads `overrides` from THIS file
2240
# — the `pnpm.overrides` block in package.json is silently ignored — so all
2341
# pins must live here (previously orphaned in package.json: minimatch, tar).

0 commit comments

Comments
 (0)