You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: add Remix source API compatibility facades - #160
add opt-in remixCompat exact aliases for @remix-run/react, @remix-run/node, and react-router-dom6
publish typed ESM/CJS compat/remix-react and compat/remix-node facades backed by the application single React Router runtime
provide json as a real JSON Response, and map defer to React Router data so RR single-fetch owns promise streaming
preserve useLoaderData<typeof loader>/useActionData<typeof action> inference for the compatibility return types
map RemixBrowser to HydratedRouter and RemixServer to ServerRouter, with an explicit warning that abortDelay must be implemented by aborting the entry-server render stream
Supported boundary
This is source-level compatibility for supported root exports, not a legacy Remix runtime. It intentionally does not support package deep imports, private __remixContext/deferred protocol APIs, installGlobals, legacy upload APIs, Remix config/build conventions, RSC mode, or simultaneous router runtimes. TypeScript consumers use the documented exact paths entries because bundler aliases do not affect tsc.
Verification
pnpm build
pnpm typecheck
pnpm exec rstest run tests/index.test.ts tests/remix-compat.test.ts (54 passed)
The complete pnpm test run reaches 841 passing tests but reproduces 13 pre-existing tests/route-imports.test.ts resolver failures plus a benchmark fixture intentional missing dist/index.js error; these reproduce without this change and are unrelated to the compatibility surface.
System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.
Follow-up fix pushed in f4db610: SerializeFrom now unwraps mixed response unions distributively, JSON responses model JSON serialization (Date, toJSON, omitted/optional undefined, array nulls), while defer/plain values retain React Router turbo-stream serialization. Compat mode now aliases both react-router-dom and react-router-dom6 to the app RR runtime. The documented TypeScript path setup now uses runtime-safe local re-export modules instead of .d.ts targets, and the framework integration test builds with those actual tsconfig mappings.
Closing: the Remix 2 / React Router 6 support for TTArk will live as a TTArk-owned package in its monorepo instead of in this plugin. Keeping the branch for reference.
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
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
remixCompatexact aliases for@remix-run/react,@remix-run/node, andreact-router-dom6compat/remix-reactandcompat/remix-nodefacades backed by the application single React Router runtimejsonas a real JSONResponse, and mapdeferto React Routerdataso RR single-fetch owns promise streaminguseLoaderData<typeof loader>/useActionData<typeof action>inference for the compatibility return typesRemixBrowsertoHydratedRouterandRemixServertoServerRouter, with an explicit warning thatabortDelaymust be implemented by aborting the entry-server render streamSupported boundary
This is source-level compatibility for supported root exports, not a legacy Remix runtime. It intentionally does not support package deep imports, private
__remixContext/deferred protocol APIs,installGlobals, legacy upload APIs, Remix config/build conventions, RSC mode, or simultaneous router runtimes. TypeScript consumers use the documented exactpathsentries because bundler aliases do not affecttsc.Verification
pnpm buildpnpm typecheckpnpm exec rstest run tests/index.test.ts tests/remix-compat.test.ts(54 passed)pnpm test:package-interoppnpm exec playwright test --config tests/react-router-framework/integration/playwright.config.ts tests/react-router-framework/integration/remix-compat-test.ts --workers=1 --retries=0 --reporter=line(real build, SSR,RemixServer/RemixBrowser, hydration, JSON action, document/navigation deferred streaming, resolved/rejected promises, status/headers)npm pack --dry-run --json(ESM/CJS/types compatibility artifacts included)pnpm format:checkThe complete
pnpm testrun reaches 841 passing tests but reproduces 13 pre-existingtests/route-imports.test.tsresolver failures plus a benchmark fixture intentional missingdist/index.jserror; these reproduce without this change and are unrelated to the compatibility surface.