History log of /expo/packages/@expo/cli/src/start/server/metro/runServer-fork.ts (Results 1 – 7 of 7)
Revision Date Author Comments
# 8a424beb 11-Aug-2023 James Ide <[email protected]>

[lint] Upgrade to Prettier v3, typescript-eslint to v6 (#23544)

Why
---
Prettier 3 is out. Add support for it with this linter config.

**Note for reviewer:** the first commit is the one with th

[lint] Upgrade to Prettier v3, typescript-eslint to v6 (#23544)

Why
---
Prettier 3 is out. Add support for it with this linter config.

**Note for reviewer:** the first commit is the one with the actual
changes. The rest of this PR are changes to get the linter passing
(mostly autofix).

How
---
Update eslint-config-prettier and eslint-plugin-prettier. To address
deprecation warnings, also update typescript-eslint/parser and
typescript-eslint/eslint-plugin.
Because of an update to typescript-eslint/parser, we need to suppress
deprecation warnings (documented in a comment).

Regenerated test snapshots. Due to the upgraded dependencies, typecasts
and optional chaining are now auto-fixable by lint. This converts
warnings into autofixes.

Test Plan
---
`yarn test` in the linter config. Run `expotools check --all --fix-lint
--no-build --no-test --no-uniformity-check` to try this config on the
whole repo.

---------

Co-authored-by: Expo Bot <[email protected]>

show more ...


# c799f270 30-Jun-2023 Kudo Chien <[email protected]>

[cli] fix js inspector is broken when using web SSG (#23197)

# Why

when web SSG is enabled, pressing `j` to open js inspector is broken:
```
Opening JavaScript inspector in the browser...
Web

[cli] fix js inspector is broken when using web SSG (#23197)

# Why

when web SSG is enabled, pressing `j` to open js inspector is broken:
```
Opening JavaScript inspector in the browser...
Web Bundling complete 4499ms
Web Bundling complete 4524ms
FetchError: invalid json response body at http://192.168.50.38:8081/json/list reason: Unexpected token < in JSON at position 0
FetchError: invalid json response body at http://192.168.50.38:8081/json/list reason: Unexpected token < in JSON at position 0
```

# How

originally we have #21068 fix for the HistoryFallbackMiddleware. the new middleware for SSG unfortunately does not have the fix.
i feel like the root cause is coming from middleware disorder. digging the code in deep, i found we've chained the `connect` app. the `middleware` returned from `Metro.createConnectMiddleware` is actually a connect app, because rn-cli will set the `enhanceMiddleware` and it creates the `connect` app under the hood.

this pr tries to reuse the connect app. without the connect app chaining, those web middlewares will be placed after the inspector proxy middleware.

also removed the #21068 hack for HistoryFallbackMiddleware in this pr.


# Test Plan

```
$ yarn create expo -t tabs@sdk-49 sdk49tabs
$ cd sdk49tabs
$ npx expo start
# press `j`
```

after the fix, i've checked:
1. press `j`
2. check `http://localhost:8081/json/list` returns an array
3. check `http://localhost:8081/helloweb` returns a html content
4. disable SSG (the `"output": "static"` in **app.json**), check `http://localhost:8081/helloweb` returns a html content

show more ...


# 33bd1a45 17-Jun-2023 Cedric van Putten <[email protected]>

refactor(cli): enable inspector proxy with network support by default (#22936)

# Why

Flipping this switch to be opt-out for SDK 49.

# How

- Renamed `EXPO_USE_CUSTOM_INSPECTOR_PROXY=true` to

refactor(cli): enable inspector proxy with network support by default (#22936)

# Why

Flipping this switch to be opt-out for SDK 49.

# How

- Renamed `EXPO_USE_CUSTOM_INSPECTOR_PROXY=true` to
`EXPO_NO_INSPECTOR_PROXY=false`

> This change made more sense as you would have to set
`EXPO_USE_CUSTOM_INSPECTOR_PROXY=false` to revert back to the original
(Metro) inspector proxy.

# Test Plan

- `$ EXPO_DEBUG=true expo start` -> should mention `Expo inspector proxy
enabled` in the debug logs.

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [x] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

Co-authored-by: Expo Bot <[email protected]>

show more ...


# da5824c9 12-Jun-2023 Kudo Chien <[email protected]>

[cli] fix typecheck from react-native 0.72 upgrade (#22766)

# Why

follow up #22588 which disabled the cli typecheck

# How

using types from metro and fix typing issues

# Test Plan

cli

[cli] fix typecheck from react-native 0.72 upgrade (#22766)

# Why

follow up #22588 which disabled the cli typecheck

# How

using types from metro and fix typing issues

# Test Plan

cli ci passed

show more ...


# 03d43e7d 28-Mar-2023 Cedric van Putten <[email protected]>

feature(cli): add basic `Page.reload` support to reload the app from inspector (#21827)

# Why

This implements the `Page.reload` CDP event, to reload the app itself.

> Would be nice if there is

feature(cli): add basic `Page.reload` support to reload the app from inspector (#21827)

# Why

This implements the `Page.reload` CDP event, to reload the app itself.

> Would be nice if there is a way to send this to _JUST_ the device you
are inspecting. But not sure what socket connection that would be, don't
think it's the actual device socket in the inspector (that's inspector
messages only).

# How

- Provided the reference of `MetroBundlerDevServer` to the inspector
- Called `MetroBundlerDevServer.broadcastMessage('reload')`

# Test Plan

- Open chrome inspector (`j`)
- Anywhere in the inspector, press `cmd+r`

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `expo prebuild` & EAS Build (eg:
updated a module plugin).

---------

Co-authored-by: Expo Bot <[email protected]>

show more ...


# 5234fe38 08-Mar-2023 Cedric van Putten <[email protected]>

feature(cli): add custom inspector proxy based on `metro-inspector-proxy` (#21449)

# Why

Fixes ENG-7467

Related #21265

This is an initial draft to extend the CDP functionality of
`metro-in

feature(cli): add custom inspector proxy based on `metro-inspector-proxy` (#21449)

# Why

Fixes ENG-7467

Related #21265

This is an initial draft to extend the CDP functionality of
`metro-inspector-proxy`.

# How

The implementation is slightly wonky around the `ExpoInspectorDevice`.
We want to reuse as much as possible from `metro-inspector-proxy`, but
we need to add stateful data per device.

In order to achieve that, we generate a new class type, based on the
user's installed `metro-inspector-proxy`. This makes everything less
readable but should include future updates in these classes.

As for the `ExpoInspectorProxy`, to avoid having to do the same thing,
we just wrap the whole inspector class and reuse what we can. The device
map is "linked" within the original inspector proxy instance, making the
data available to all methods that need it.

# Test Plan

Enable this feature with `EXPO_USE_CUSTOM_INSPECTOR_PROXY=1`

- [x] See tests for the actual CDP events we handle.
- [ ] See tests on the "bootstrapping code" to create the inspector and
devices.

# Checklist

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `expo prebuild` & EAS Build (eg:
updated a module plugin).

---------

Co-authored-by: Evan Bacon <[email protected]>

show more ...


# 33643b60 04-Mar-2023 Evan Bacon <[email protected]>

feat(cli): auto setup typescript during start (#21475)

# Why

- Some users are confused about how to use the fully automated
TypeScript setup. It currently runs when you run `npx expo start` in a

feat(cli): auto setup typescript during start (#21475)

# Why

- Some users are confused about how to use the fully automated
TypeScript setup. It currently runs when you run `npx expo start` in a
project with `tsconfig.json` or any TypeScript file in the project.
- This change will run the TypeScript check continuously until
TypeScript is setup. This only applies to projects using Metro, and
currently is only run in `npx expo start`, and the run commands (when
the server is started in the current window, e.g. not headless mode).

<!--
Please describe the motivation for this PR, and link to relevant GitHub
issues, forums posts, or feature requests.
-->

# How

- Fork the `runServer` function from Metro into the CLI so we can access
the Metro bundler instance directly.
- Use Metro's native file watching to observe new TypeScript files being
added to the project (within the observable files). This is fast and
ensures we don't accidentally block a thread that otherwise could've
been used for bundling.
- The TypeScript continuous check only runs once, if you remove
TypeScript and add it back in the same process, then nothing happens.
This is a performance optimization.
- If TypeScript is enabled while the process is running, the user will
not be prompted to install, the packages will just install in the
project. Failures will be displayed in the running process, and no more
attempts will be made.
- If TypeScript is detected on start then the existing system will be
used and the continuous check will be skipped, this means projects
already using TypeScript won't have any technical performance hit.


<!--
How did you build this feature or fix this bug and why?
-->

# Test Plan

- In a project without TypeScript:
- `npx expo`
- `touch tsconfig.json` or `mv index.js index.tsx` or `touch foo.tsx`
- TypeScript is automatically installed for the project.
- `EXPO_NO_TYPESCRIPT_SETUP` voids this behavior
- Added unit tests.

<!--
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.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `expo prebuild` & EAS Build (eg:
updated a module plugin).

---------

Co-authored-by: Expo Bot <[email protected]>
Co-authored-by: Cedric van Putten <[email protected]>

show more ...