Fix package .js.flow type discovery#307
Open
landeqiming666 wants to merge 1 commit into
Open
Conversation
Author
|
Hi, a brief follow-up on this PR. It remains clean and mergeable. The focused tests cover package-root node_modules//index.js.flow discovery and implicit module registration. Happy to adjust the resolution behavior or fixtures. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.js.flowfiles over stripped JavaScript siblings when discovering Flow definition files.node_modules/<package>/index.js.flowexports as an implicit module when the file does not already declare one.index.jsplusindex.js.flow.Why
Fixes #27. Flow resolves
index.js.flowbeforeindex.jsfor packages that ship copied Flow sources, but the flow-runtime definition output path did not model that package entrypoint. This meant imported package types could be missing even though Flow itself could see them.This differs from #288, which only discovers
.js.flowfiles and tests an already explicitdeclare modulefixture. The new regression creates a temporary package with stripped JS plus typed.js.flow, then verifiesimport type {ExternalUser} from "fixture-package"emits at.module("fixture-package", ...)definition. It also differs from #297, which focuses onmodule.name_mapper.extensionremapping rather than package.js.flowentrypoint resolution.Validation
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=url.https://github.com/.insteadOf GIT_CONFIG_VALUE_0=git://github.com/ npx yarn@1 install --frozen-lockfile --ignore-engines --ignore-scriptsnpx yarn@1 workspace flow-runtime build-cjsnpx yarn@1 workspace flow-config-parser buildnpx yarn@1 workspace babel-plugin-flow-runtime buildnpx yarn@1 workspace flow-runtime-cli test -- src/__tests__/jsFlowPackageDefinitions.test.jsnpx yarn@1 workspace flow-runtime-cli test -- src/__tests__/generateDefinitions.test.jsnpx yarn@1 workspace flow-runtime-cli testnpx yarn@1 workspace flow-runtime-cli buildgit diff --checkNote: a full install without
--ignore-scriptsis blocked locally by the oldnode-sass/node-gyp@3.8.0toolchain requiringpython/python2on Node v25.8.1. The package-level CLI tests and build above pass after building the required workspaces.IssueHunt Summary
Referenced issues
This pull request has been submitted to:
.js.flowfiles