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
[router] Support platform extensions for _layout and routes #27408
Merged
Conversation
This file contains 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
marklawlor
force-pushed
the
marklawlor/router/platform-routes
branch
from
March 4, 2024 02:07
6968551
to
f3f7322
Compare
3 tasks
EvanBacon
reviewed
Mar 4, 2024
This comment was marked as outdated.
This comment was marked as outdated.
expo-bot
added
bot: passed checks
ExpoBot has nothing to complain about
and removed
bot: suggestions
ExpoBot has some suggestions
labels
Mar 6, 2024
marklawlor
force-pushed
the
marklawlor/router/platform-routes
branch
from
March 6, 2024 01:49
53499e4
to
6abf431
Compare
marklawlor
force-pushed
the
marklawlor/router/platform-routes
branch
2 times, most recently
from
March 20, 2024 22:45
acb9137
to
dedd218
Compare
EvanBacon
reviewed
Mar 25, 2024
EvanBacon
approved these changes
Mar 25, 2024
marklawlor
force-pushed
the
marklawlor/router/platform-routes
branch
from
April 8, 2024 20:03
077f3a1
to
9734cad
Compare
Add flag to disable. |
marklawlor
force-pushed
the
marklawlor/router/platform-routes
branch
from
April 22, 2024 08:37
6822c01
to
01da3f8
Compare
expo-bot
added
bot: suggestions
ExpoBot has some suggestions
bot: passed checks
ExpoBot has nothing to complain about
and removed
bot: passed checks
ExpoBot has nothing to complain about
bot: suggestions
ExpoBot has some suggestions
labels
Apr 22, 2024
marklawlor
force-pushed
the
marklawlor/router/platform-routes
branch
from
April 25, 2024 20:04
ac5551a
to
80f891a
Compare
Co-authored-by: Evan Bacon <bacon@expo.io>
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
…anifest to platform web
Co-authored-by: Evan Bacon <bacon@expo.io>
marklawlor
force-pushed
the
marklawlor/router/platform-routes
branch
from
April 25, 2024 22:19
80f891a
to
924e498
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bot: fingerprint compatible
bot: passed checks
ExpoBot has nothing to complain about
published
Changes from the PR have been published to npm
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
Revised version #26047
Blocked by #27407
How
Rules:
For example, you have have
/page.web.tsx
only if/page.tsx
also exists. This makes platform extensions an additive change and won't break concepts like universal deep linking and typed routesAPI routes do not support platform extensions as they are independent of a platform.
Implementation
getRoutes
allows multiple files to be assigned to the same route, but all files were given the same specificity.This PR adds logic to calculate the specificity of a file and to select the most specific file.
Specificity highest-to-lowest
2
: Platform extension matches platform1
:.native
platform extension0
: No platform extensions-1
: Invalid routeIf no platform is provided to
getRoutes
the current behaviour is retained and files with platform extensions will be ignored.getRoutes
checklistThese are the locations we use
getRoutes
and whether they should use platform extensions or not.renderStaticContent
getManifest()
❌getBuildTimeServerManifestAsync
❌ - I'm not 100% sure on this one. Need to understand how to test this correctlyroutes-manifest
createRoutesManifest
❌router-store
RouterStore
✅typed-routes
getTypedRoutesDeclarationFile
❌There is also an
getExactRoutes
function, but this is only used for testing purposes.**
Test Plan
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).