ReviewOS

stacks/dtsx

fix(generator): emit portable package-local tsconfig alias edges

#3134
Closed chris opened this 5 hours ago ·
5 hours ago

Delivery blocker: https://github.com/stacksjs/bun-query-builder/issues/1201. Related relative-only graph repair: #3090. Source-first framework gate: https://github.com/stacksjs/stacks/issues/2958 and application adoption https://github.com/stacksjs/the-settlers-iii-remake/issues/25.

Real public strict-consumer failure exposes a reusable dtsx boundary gap. bun-query-builder@0.3.34 source 6b7d73439f38676ba579f04cf1d65fe5e6d5d176 emits seven actual public type imports from private @/types, @/migrations, @/seeder. A normal isolated installation with empty consumer paths, strict:true and skipLibCheck:false fails with exactly seven TS2307 diagnostics. All89 installed files match the original accepted public tar; no lifecycle trust override or runtime SDK execution was used. Public0.3.35/sourcef1c16d4c0c48ebae2a34efd3289210e9a9423072 still contains the same imports.

The package caller uses the public bun-plugin-dtsx dts plugin with root/src entrypoints from its package directory. Its package tsconfig extends the repository config, whose @/* mapping points into package-local src. dtsx documents this supported contract in docs/MIGRATION.md (Handling Path Aliases) and docs/TROUBLESHOOTING.md (Path Aliases Not Resolving), with tsconfigPath defaulting to ./tsconfig.json. No caller-side rewrite/suppression is an acceptable replacement.

Current owning source at0fcc75dc4d097d3eaacdd4b721d5b79d6f5ad2f9:

  • packages/bun-plugin/src/index.ts delegates to @stacksjs/dtsx/generator.
  • packages/dtsx/src/generator.ts rewriteRelativeDeclarationSpecifiers only matches relative specifiers.
  • packages/dtsx/src/module-graph.ts skips non-relative specifiers during declaration reachability.
  • tsconfigPath currently informs isolated-declarations detection; the shared generation path does not resolve local path mappings into portable emitted declaration edges.

Acceptance:

  • At the owning shared generator boundary, honor actual effective tsconfig/baseUrl/extends and resolve only aliases to package-local authored sources. Reuse established parser/resolver APIs where available; do not invent an @/ special case or a parallel scanner.
  • Include eligible local alias targets in the same declaration reachability graph, and emit portable relative declaration specifiers through the existing output mapping. Cover aliases in import/export/type-import positions and transitive local edges.
  • Preserve legitimate public bare names such as @stacksjs/foo, declared external dependencies, builtins, self exports and package imports, even when a monorepo tsconfig maps public names into sibling source. Never emit outside-package private paths or copy other workspaces into a package. An unresolvable configured local alias must produce an actionable owning build error where required, not a false portable artifact.
  • Maintain real public plugin/packed strict-consumer regressions with no consumer paths and skipLibCheck:false. Include inherited config/custom tsconfig, package-local transitive alias, sibling-workspace/public-package negatives, unchanged external/builtin/self/package-import specifiers, and unresolved/private-target failure.
  • Preserve no-TypeScript-5 generation compatibility. The existing optional checker uses TS5 APIs, but the current TS7 toolchain exposes no compiler API. Resolve API reuse intentionally before adding dependencies; do not silently add a second compiler or host-only import.
  • Review both axes, run all owning gates, release the emitter/plugin normally, verify exact source/gates/actual public payloads, then rebuild/release the owning query-builder package and repeat the original strict public consumer before Stacks adoption.

Read-only evidence/proposal is retained under /tmp/bun-query-builder-0.3.34-verification. Implementation is not authorized until the frozen ownership proposal is reviewed. No emitter/package/runtime source edits have been made.

1 hour ago

Completed in owning source f9c34c2144136308e7ccb3b870491e638db03e4e, delivered by the normal 0.11.24 release at 8577ac44426cbebed524315424dafdf3aad12c79.

The shared generator resolves effective package-local tsconfig aliases into its existing declaration graph/output mapping. Public externals, builtins, self/package imports and sibling workspaces retain their contracts. Unresolvable or ineligible private targets fail in the owner before publication. Inherited/custom/package-preset configuration, transitive edges, lexical controls and packed public plugin consumers are maintained regressions. No second compiler, TypeScript compiler API, caller rewrite or consumer paths were introduced.

Both review axes and all owning source gates passed. Exact-source CI passed all eight jobs, and the canonical Releaser succeeded. Five original npm archives, six Pantry archives and twelve native archives were verified. Ordinary registry-only core and Bun-plugin consumers passed normal/frozen installs, original payload identity, public exports and strict emitted-library positive/TS2322 negative checks with no overrides.

The final downstream acceptance is now complete: bun-query-builder 0.3.36 normally consumes the verified generator, rebuilt and released its package, and passed all four strict public entrypoint graphs with empty paths and skipLibCheck:false. Its exact source CI/Releaser, configured PostgreSQL/MySQL rows and public accepted archive/installed-byte checks passed. See /stacks/bun-query-builder/issues/1201 for the complete delivery evidence.

DTSX receipt: /tmp/dtsx-0.11.24-verification/publication-proof.json, SHA256 04d0b803141b849704cd6e677871449df49186f92aa12c8e03aa1e471ae90a70. Downstream receipt: /tmp/bun-query-builder-0.3.36-verification/publication-proof.json, SHA256 419afc07c81641ab171151a5189b48744cbd1b43e77e46c5b1ddbac4b938755c. Esbuild/tsup signing failures remain explicit: their exact original publisher SHA512 binds the public bytes under Pantry's documented best-effort policy, with no SLSA claim for those two. /pantry-pm/pantry/issues/277 tracks the separate policy clarification.

Class-member issue #3135, native CLI metadata issue #3136 and query-builder browser factory /stacks/bun-query-builder/issues/1202 remain separate. This closure does not claim their completion or Stacks/application adoption.

Sign in to comment on this issue.