Repository navigation
Import the Fable runtime through a version-free bridge - #65
Merged
Merged
Conversation
Handwritten TypeScript imported Fable's runtime through paths such as src/generated/fable_modules/fable-library-ts.5.1.0/List, so every Fable upgrade broke those imports with TS2307 (as in Dependabot's #61). After each Fable compilation, the new GenerateFableLibraryBridge.fsx script writes one re-exporting module per runtime module to src/generated/fable-library/. It reads the runtime version from Fable's own first-party output and fails clearly when no version, several versions, or a missing runtime directory is found, rather than picking the newest directory, which may be stale. Re-exporting the same runtime copy keeps a single identity for runtime classes. The bridge directory is recreated on each run so modules removed by an upgrade do not linger. Handwritten imports now use the bridge, an ESLint rule rejects versioned runtime paths, and the Fable target, its build self-test, AGENTS.md, the typescript-style skill and docs/build.md describe the new step. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69277274-81a0-4daf-a296-338ec77f649f
bitsforthought
commented
Oct 10, 2026
Separate command parsing, pure bridge logic, file-system operations and self-tests into internal modules so the generator is easier to review. Use raw interpolated literals for generated imports while preserving their exact contents and trailing newlines. Clarify the regex word boundary and pin its rejection of identifiers beginning with default in a self-test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69277274-81a0-4daf-a296-338ec77f649f
bitsforthought
commented
Oct 10, 2026
Detect default exports with the installed TypeScript compiler rather than matching source text, so commented-out exports cannot create invalid bridge imports. Batch runtime sources through one Node process and validate the returned classifications with explicit errors and regression assertions. Clarify the read-only plan and plural writer names, defer enumeration until the parser batch requires a snapshot, and simplify record construction and fixture paths. Name recursive deletion explicitly. Preserve the generated bridge contents and existing command and runtime-resolution contracts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69277274-81a0-4daf-a296-338ec77f649f
Use a conditional expression inside the raw interpolated bridge template rather than concatenating templates. Keep the default-export literal in a named binding because F# rejects triple-quoted literals inside interpolation expressions. Preserve the generated contents and trailing newlines. Open the relevant dependencies at internal module boundaries so record construction uses inferred types rather than qualified field names. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69277274-81a0-4daf-a296-338ec77f649f
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.
Why
Handwritten TypeScript imported the Fable runtime through versioned paths (
fable-library-ts.5.1.0/...), so every Fable upgrade broke them with TS2307. This is one of the failures in #61.What
scripts/GenerateFableLibraryBridge.fsxruns after each Fable compilation and writes one re-exporting module per runtime module tosrc/generated/fable-library/.generated/fable-library/<Module>.no-restricted-importsrule rejectsfable_modules/fable-library-ts.*paths.BuildSelfTest, AGENTS.md, thetypescript-styleskill anddocs/build.mdare updated.Validation
npm run validate "--" --cipasses.Follow-up
After this PR merges, comment
@dependabot rebaseon #61. That PR will still fail because Fable 5.20.0's own runtime hasTemporaland number/bigint type errors; those need a separate fix.