From 903f47fd25997092e0a5d01b0def063661d16137 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 17 Aug 2026 02:11:44 +0000 Subject: [PATCH] fix(types): drop declarationMap and src from published files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ruled option (b) for the @object-ui/types half of the src-in-files finding: turn declarationMap off at the source instead of keeping a permanent per-package exception, or paying for inlineSources (which saves nothing and adds a third emitter shape). Order followed per the ruling: flipped declarationMap:false in packages/types/tsconfig.json first, clean-rebuilt, and confirmed dist has zero .map files / zero sourceMappingURL / zero ../src references (positive control against the pre-flip build showed 54 of each) — only then trimmed files to dist-only, matching #4847's shape. Updated the check-phantom-dependencies.mjs header paragraph: all three originally-recorded packages (data-objectstack, fields, types) have now dropped src from files. npm pack --dry-run: 203 -> 112 entries, 91 src/*.ts files leave, none arrives, dist/ (108 entries) is unchanged and now map-free. Fixes #4851 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01DbRmJD3iPhXjKr6vhd4Qkv --- .changeset/types-files-drops-src-4851.md | 21 ++++++++++++++ packages/types/package.json | 5 ++-- packages/types/tsconfig.json | 2 +- scripts/check-phantom-dependencies.mjs | 36 +++++++++++++----------- 4 files changed, 44 insertions(+), 20 deletions(-) create mode 100644 .changeset/types-files-drops-src-4851.md diff --git a/.changeset/types-files-drops-src-4851.md b/.changeset/types-files-drops-src-4851.md new file mode 100644 index 0000000000..373a16fd6c --- /dev/null +++ b/.changeset/types-files-drops-src-4851.md @@ -0,0 +1,21 @@ +--- +'@object-ui/types': patch +--- + +`@object-ui/types` stops publishing its `src/` tree + +Its manifest's `files` array listed `src` alongside `dist`, so every published tarball carried all 91 source files. Unlike the two sibling packages already fixed (`@object-ui/data-objectstack` #4847, `@object-ui/fields` #4856), this one was not a mechanical delete: `packages/types/tsconfig.json` built with a bare `tsc` and `declarationMap: true`, and its shipped `dist/*.d.ts.map` named `sources: ["../src/*.ts"]` with `sourcesContent: false` — a real, if small, consumer (editor go-to-source). Deleting `src` from `files` while that map still pointed at it would have shipped a tarball with a broken-link map. + +Maintainer ruling (2026-08-17, objectui#4851): turn `declarationMap` off at the source rather than keep a permanent per-package exception in the phantom-dependencies gate's header, or add `inlineSources` (which saves nothing and adds a third emitter shape). `types` is a pure-types package built by bare `tsc`, so its `.d.ts` is near-isomorphic to its source — go-to-source degrading to the `.d.ts` is a near-zero-pull, deliberate trade. + +Order followed: flipped `declarationMap: false` in `packages/types/tsconfig.json` first, clean-rebuilt, and confirmed the published `dist` has zero `.map` files, zero `sourceMappingURL` occurrences, and zero `../src` references (a positive control against the pre-flip build showed 54 of each, so the greps are exercised, not vacuous) — only then trimmed `files` to `["dist", "README.md", "CHANGELOG.md", "LICENSE"]`. + +`npm pack --dry-run` across the change, on the freshly rebuilt `dist`: + +| | before | after | +| --- | --- | --- | +| entries | 203 | 112 | +| unpacked | 3974143 B | 2828454 B | +| tarball | 656307 B | 414644 B | + +91 `src/*.ts` files leave, none arrives; the `dist/` entry count (108) is unchanged, and its `.d.ts` payload is now map-free. diff --git a/packages/types/package.json b/packages/types/package.json index 995ad699eb..4d8cfdfdcc 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -56,10 +56,9 @@ }, "files": [ "dist", - "src", "README.md", - "LICENSE", - "CHANGELOG.md" + "CHANGELOG.md", + "LICENSE" ], "scripts": { "build": "tsc", diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index baba4bc5cc..3d94566f93 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -4,7 +4,7 @@ "outDir": "./dist", "rootDir": "./src", "declaration": true, - "declarationMap": true, + "declarationMap": false, "composite": true, "noEmit": false, "lib": ["ES2020", "DOM"], diff --git a/scripts/check-phantom-dependencies.mjs b/scripts/check-phantom-dependencies.mjs index 161cfdb0cb..b7c60cd6a2 100644 --- a/scripts/check-phantom-dependencies.mjs +++ b/scripts/check-phantom-dependencies.mjs @@ -75,23 +75,27 @@ * measured 73 `*.test.d.ts` files landing in the published `dist/` of * `@object-ui/fields` and `@object-ui/plugin-editor`, and three packages * (`fields`, `types`, `data-objectstack`) listed `src` in `files`, so their - * tarballs carried the test SOURCES too. Two of the three no longer do: + * tarballs carried the test SOURCES too. None of the three do anymore. * objectui#4847 dropped `src` from `data-objectstack`'s `files` (43 source - * files, 38 of them tests, left that tarball) and objectui#4856 dropped it - * from `fields`' (173 source files, 97 of them tests). Only `types` still - * lists it, and there the entry is load-bearing rather than leftover, - * because it builds with a bare `tsc` under the root's `declarationMap` / - * `sourceMap` and no `inlineSources`, so its shipped `dist/*.d.ts.map` name - * `../src/*.ts` with no embedded content — dropping `src` there would leave - * published maps pointing at files the tarball no longer carries. `fields` - * was measurably NOT that shape, which is why the two were split rather than - * fixed together: its declarations come from `vite-plugin-dts`, and a clean - * rebuild emits zero `.map` files and zero `sourceMappingURL` comments, so - * nothing in its `dist` referred back to `src` at all. That is a real defect - * where it is one, and it is already filed; it is not this gate's, because - * nothing resolves those files and so no install of them can fail. Stated - * here rather than glossed, because "the build excludes tests" is the - * plausible-sounding version of this paragraph and it is not what the + * files, 38 of them tests, left that tarball); objectui#4856 dropped it + * from `fields`' (173 source files, 97 of them tests) after a clean rebuild + * measured zero `.map` files and zero `sourceMappingURL` comments in its + * `vite-plugin-dts` output, so nothing in its `dist` referred back to `src` + * at all. `types` was the holdout: it builds with a bare `tsc`, and until + * objectui#4851 its `tsconfig.json` set `declarationMap: true` with no + * `inlineSources`, so its shipped `dist/*.d.ts.map` named `../src/*.ts` + * with no embedded content — dropping `src` from `files` while that was + * still true would have left published maps pointing at files the tarball + * no longer carried. objectui#4851 closed the gap at the source instead of + * leaving the exception standing: `declarationMap` is now `false`, a clean + * rebuild confirmed zero `.map` files, zero `sourceMappingURL` comments, + * and zero `../src` references in `dist`, and only then did `src` come out + * of `files`. Go-to-source for `@object-ui/types` consumers now resolves + * to the `.d.ts`, not the original `.ts` — a deliberate, near-zero-pull + * trade for a pure-types package whose declarations are near-isomorphic to + * their source, made explicitly rather than left as a silent regression. + * Stated here rather than glossed, because "the build excludes tests" is + * the plausible-sounding version of this paragraph and it is not what the * repository measures. * * The root allowance is a decision, not an oversight, and it is worth stating