Skip to content

Conversation

@brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Dec 15, 2025

Stacked on #10888

Adds a top level remix package that is auto-generated as an umbrella package over all @remix-run/* packages in the repo.

  • Auto-generated files are one-liner export * from '@remix-run/...'; files in packages/remix/src/lib
  • Every sub-package and it's sub-exports becomes a sub-export in remix:
    • @remix-run/file-storage -> remix/file-storage
    • @remix-run/file-storage/fs -> remix/file-storage/fs
  • pnpm generate-remix will generate the remix package based on the current state of the repo
  • A github workflow has been added that can automatically re-build on PRs and pushes to main
  • The root remix/src/index.ts file is manually authored to control the APIs exported from the top-level remix package
    • These exports are currently determined by the APIs needed for the 3 root demos/, but I'm sure we'll want to add more as we start taking a closer look at the entire API surface and building more demos
  • There is also a root index-client.ts file that exports a subset of the remix API from index.ts that can run in the browser - eliminating anything that imports from node:* under the hood
    • This is setup behind a client condition so you can build for the browser with esbuild --conditions=client without running across any node imports that would otherwise fail the build
  • All 3 root demos/ have been converted to use the top-level package and remove @remix-run/* packages from their dependencies

@MichaelDeBoey MichaelDeBoey linked an issue Dec 15, 2025 that may be closed by this pull request
Copy link
Member

@mjackson mjackson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks pretty good. The barrel files (index.ts and index-platform.ts) will still need some work to be complete, but we can continue to add things they are missing over time as we begin to use the remix package in earnest. This is a good start.

// All other APIs based on core Javascript/Web Fetch API should be exported
// from the root remix package in `index.ts`

export { asyncContext, getContext } from './lib/async-context-middleware'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note on import/export paths from files (not packages): we always use the file extension to avoid ambiguity. So this should be:

Suggested change
export { asyncContext, getContext } from './lib/async-context-middleware'
export { asyncContext, getContext } from './lib/async-context-middleware.ts'

Maybe we want to add an eslint rule that catches this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh interesting - I thought that would already fail at build time and didn't even notice the LLM left them out. I'll look into a way to catch this automatically 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a lint rule in 625b639

get,
post,
put,
resources,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have resource here as well, along with head, options, and patch. I'm thinking we should also have the longform names, createGetRoute, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import { createStorageKey } from '@remix-run/fetch-router'
import { getContext } from '@remix-run/async-context-middleware'
import { createStorageKey } from 'remix'
import { getContext } from 'remix/platform'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something feels off to me about this. I have to know that getContext relies on node:async_hooks internally so that I know to get it from remix/platform. Maybe it's better to just import directly from remix/async-context-middleware and ditch the whole idea of remix/platform entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - I think thats a good call. The sub-export is just an added layer of indirection when it's still a single dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import type { Middleware, Route } from '@remix-run/fetch-router'
import { createRedirectResponse as redirect } from '@remix-run/response/redirect'
import type { Middleware, Route } from 'remix'
import { createRedirectResponse as redirect } from 'remix'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is so common we'll probably want to have a redirect shorthand that people can import instead of renaming it every time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we should do the same for createHtmlResponse and createFileResponse? html would conflict at a global level with the html string helper so if we chose to export from the top-level we'd have to choose one, but they'd both be fine as exports from their individual sub-exports.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the html helper. I want to see how it feels once we start using components more heavily in the demos and relying less on the html-template library. I just know for now that I want to be able to import redirect directly, or I'm always going to do this rename.

@brophdawg11 brophdawg11 force-pushed the brophdawg11/docs-eslint branch from 12b0f08 to 9b91b90 Compare December 16, 2025 17:31
Base automatically changed from brophdawg11/docs-eslint to main December 16, 2025 17:33
@brophdawg11 brophdawg11 force-pushed the brophdawg11/remix-package branch from 8c79a0f to f0f2f14 Compare December 16, 2025 17:34
@brophdawg11 brophdawg11 marked this pull request as ready for review December 16, 2025 17:34
Copy link
Member

@mjackson mjackson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I'm starting to think we don't want as much stuff in the main remix export as we originally thought. I realize it feels subjective at this point, but we knew this would be a somewhat subjective exercise going into it.

import type { Middleware, Route } from '@remix-run/fetch-router'
import { createRedirectResponse as redirect } from '@remix-run/response/redirect'
import type { Middleware, Route } from 'remix'
import { createRedirectResponse as redirect } from 'remix'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the html helper. I want to see how it feels once we start using components more heavily in the demos and relying less on the html-template library. I just know for now that I want to be able to import redirect directly, or I'm always going to do this rename.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add remix package

4 participants