Repository navigation
Declare dependencies required by published TypeScript types #2149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,7 @@ | |||||||||||||||||||||
| "dependencies": { | ||||||||||||||||||||||
| "flow-enums-runtime": "^0.0.6", | ||||||||||||||||||||||
| "lodash.throttle": "^4.1.1", | ||||||||||||||||||||||
| "metro-file-map": "0.87.2", | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit · metro-core gains about 31 installed packages for one type-only import
Measured with npm, excluding TypeScript but including the consumer's
The edge doesn't make a Fix: consider a small structural type for Reproduced: |
||||||||||||||||||||||
| "metro-resolver": "0.87.2" | ||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit · Consumers of only metro or metro-config still get TS2307 under pnpm hoist: false The new dependencies fix the Failure case: strict consumer,
This isn't a regression, and every count is the same or lower than base. The PR description already puts these reverse edges out of scope, so a follow-up is fine. Fix: declaring them would add new cycles to otherwise low-level packages. Moving the shared types down (for example Reproduced: |
||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| "license": "MIT", | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit · Non-hoisted installs still fail on undeclared metro-* imports in metro-config and metro-core
The PR aims to stop published declarations relying on packages that are only available accidentally through transitive dependencies, but the same pattern remains for some internal packages. It isn't a regression, and npm and default pnpm installs aren't affected.
Failure case: a strict TypeScript consumer of
metroandmetro-config, installed with pnpmhoist: false, gets 4 TS2307 errors at head:metro-config/src/types.d.tscan't findmetro-file-map,metro-resolverormetro-transform-worker.metro-core/src/errors/AmbiguousModuleResolutionError.d.tscan't findmetro-file-map.Fix: add these as
dependenciesofmetro-configandmetro-core, here or in a follow-up. An import audit of the declarations also flagsmetro-coretometro,metro-file-maptometro-configandmetro-minify-tersertometro-transform-worker. Those would add new links between Metro's packages, so they may need a maintainer decision. They didn't produce errors in this consumer.Reproduced: Packed head tarballs and installed them in a fresh pnpm 12 consumer with
hoist: false.tsc -p .with TypeScript 6.0.3,strictandskipLibCheck: falseexited 2 with exactly these 4 TS2307 errors. The same head tarballs pass under default pnpm hoisting. The PR doesn't change these imports or add these dependencies; the failure wasn't run against base. · id0cfa611cThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added all four direct dependencies in faba463: metro-config now declares metro-file-map, metro-resolver, and metro-transform-worker; metro-core declares metro-file-map. Each uses the existing 0.87.2 workspace version, with no lockfile change.
Freshly built and packed head tarballs reproduce exactly the four TS2307 errors in a strict TypeScript consumer with pnpm hoisting disabled. The same consumer passes with the new manifests; the default-hoisting baseline control also passes. Comparing all 17 tarballs shows only these two package manifests changed.
The config → transform-worker edge stays within the existing config → metro → transform-worker dependency component; the complete strongly connected component partition is unchanged. Other reverse edges noted in the comment remain outside this change.
Validation: frozen Yarn and pnpm installs; full repository checks (162 suites, 3059 tests, 495 snapshots passed; 14 existing skips); and yarn typecheck-ts pass.