Conversation
… notification service docs (#38217)
# Why
Allow users to use bun easily for expo server runtime
# How
I added a Bun adapter based on the Express one
# Test Plan
Create a `serve.ts` file (according to the updated doc #bun section):
```typescript
import { createRequestHandler } from '@expo/server/adapter/bun';
import { websocket } from './websocket';
const CLIENT_BUILD_DIR = `${process.cwd()}/dist/client`;
const SERVER_BUILD_DIR = `${process.cwd()}/dist/server`;
const handleRequest = createRequestHandler({ build: SERVER_BUILD_DIR });
const port = process.env.PORT || 3000;
Bun.serve({
port: process.env.PORT || 3000,
async fetch(req) {
const url = new URL(req.url);
console.log('Request URL:', url.pathname);
const staticPath = url.pathname === '/' ? '/index.html' : url.pathname;
const file = Bun.file(CLIENT_BUILD_DIR + staticPath);
if (await file.exists()) return new Response(await file.arrayBuffer());
return handleRequest(req);
},
websocket,
});
console.log(`Bun server running at http://localhost:${port}`);
```
# Checklist
<!--
Please check the appropriate items below if they apply to your diff.
-->
- [x] I added a `changelog.md` entry and rebuilt the package sources
according to [this short
guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting)
- [x] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
- [x] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
---------
Co-authored-by: Phil Pluckthun <phil@kitten.sh>
# Why - Use `bun run` for TS file. - Move the section up higher in the doc. If this gets bigger we'll likely need to alphabetize, but for now it just aligns with the tools we use more frequently at Expo. - Use `bunx` instead of `npx` - Extends #38240
…de handling (#37930) # Why Currently static rewrites behave exactly the same as redirects; we want the behavior to match what is described [in the docs](https://docs.expo.dev/router/advanced/redirects/#rewrites). <!-- Please describe the motivation for this PR, and link to relevant GitHub issues, forums posts, or feature requests. --> # How In [`getRoutes.tsx`](https://github.com/expo/expo/blob/136b77f18e2426e885bdd619effe181214c41172/packages/expo-router/src/getRoutes.ts#L70-L78), when a route is of type `rewrite`, we use `contextModule` to lookup the corresponding component for `rewriteConfig.destinationContextKey`. <!-- How did you build this feature or fix this bug and why? --> # Test Plan <!-- Please describe how you tested this change and how a reviewer could reproduce your test, especially if this PR does not include automated tests! If possible, please also provide terminal output and/or screenshots demonstrating your test/reproduction. --> <video width=400 src="https://github.com/user-attachments/assets/aee762ce-1258-40fb-bcd7-98259e5183cb" /> Added a sample project to `apps/router-e2e`, also made an external testbed project [here](https://github.com/hassankhan/expo-static-redirects). # Checklist <!-- Please check the appropriate items below if they apply to your diff. --> - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [x] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [x] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
…abel/core` when possible (#38171) ## Summary This removes some Babel dependencies from `babel-preset-expo` and `@expo/metro-config`. Specifically, - `@babel/core` has most exports needed for `@expo/metro-config`, except `@babel/generator` and `@babel/code-frame` - `@babel/core` is all that `babel-preset-expo` needs but is also passed to plugins directly
…38202) # Why - The `isNegativeTest` check was incorrect so wasn't actually run - The directory structures were imprecise and the mocks were excessive - The `projectRoot` wasn't always set correctly Basically, the accuracy of the tests was questionable and it makes too many assumptions on the exact function calls and mocks, and the test validations were inaccurate, meaning, extending the tests in their current form to capture more expected behaviour with more edge cases wasn't feasible Part of the problem this highlights is that `expo-modules-autolinking search` (and related commands) have too many brittle options imho, but that's unrelated to this PR. # How - Replace `require` calls in `findModules` implementation path with `fs.readFile` calls - **NOTE:** This isn't only for `memfs`, although that's a crucial change for it, but forcing ourselves to add wrapping calls here makes it easier to reason about (and extend) the loaders - Replace `glob`/`require` mocks with `memfs` - Rewrite test suite as nested `memfs` folder structures - Fix `isNegativeTest` checks - Replace all `expect()` checks with `toEqual` and `expect.objectContaining` - This is more accurate than length checks with `Object.keys(result).length` which is easy to omit and fool - This is more accurate than `toMatchObject` - Add check for `realpath` mock to see how many calls it receives and capture that - Add missing `mockRestore` default # Test Plan <!-- Please describe how you tested this change and how a reviewer could reproduce your test, especially if this PR does not include automated tests! If possible, please also provide terminal output and/or screenshots demonstrating your test/reproduction. --> # Checklist <!-- Please check the appropriate items below if they apply to your diff. --> - [x] I added a `changelog.md` entry and rebuilt the package sources according to [this short guide](https://github.com/expo/expo/blob/main/CONTRIBUTING.md#-before-submitting) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
Caused by changes in #38114
# Why - same as #38219 but with both instances and changelog --------- Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.3)
Can you help keep this open source service alive? 💖 Please sponsor : )