History log of /expo/packages/@expo/cli/src/export/exportStaticAsync.ts (Results 1 – 19 of 19)
Revision Date Author Comments
# 34a1b52d 21-Sep-2023 Mark Lawlor <[email protected]>

fix(router): correctly clone hoisted groups (#24218)

# Motivation

Fixes: https://github.com/expo/router/issues/805

Hoisted routes inside array groups were not being correctly cloned. The
matc

fix(router): correctly clone hoisted groups (#24218)

# Motivation

Fixes: https://github.com/expo/router/issues/805

Hoisted routes inside array groups were not being correctly cloned. The
matcher was not detecting the hoisted route and the cloning logic
assumed one set of groups, but a hoisted route may have many.

# Execution

* Updated `matchGroupName` regex to allow for leading/trailing folder
names.
* Updated `fileNodeToRouteNode` logic to extrapolate multiple array
groups

# Test Plan

Modified the example in https://github.com/expo/router/issues/805 to
include a set of nested groups as well.

File tree is

```
events/_layout // <Slot />
events/(manage,preview)/_layout // <Slot />
events/(manage,preview)/[eventId]
events/(manage,preview)/(a,b)/_layout // <Slot />
events/(manage,preview)/(a,b)/test
```

Current (2.0.4) Sitemap:

![localhost_8081__sitemap
(1)](https://github.com/expo/router/assets/3946701/e32d867f-055f-40f5-a25f-94113e39c40b)

After:


![localhost_8081__sitemap](https://github.com/expo/router/assets/3946701/2ed2c4ce-f63d-4df0-aca1-97443c4a329e)

---------

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

show more ...


# e015d41c 20-Sep-2023 Evan Bacon <[email protected]>

feat(cli): reduce static group routes (#24529)

# Why

- In server mode, we don't need to export every group variation because
the server can automatically delegate all matchable paths to the sing

feat(cli): reduce static group routes (#24529)

# Why

- In server mode, we don't need to export every group variation because
the server can automatically delegate all matchable paths to the single
group file.
- This change only exports one static HTML file for a given group route
when server mode is used in export, this can drastically reduce the
amount of output files.


# Test Plan

- Added an e2e test to ensure the path variation is served as expected.

<!--
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 `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

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

show more ...


# 46f023fa 15-Sep-2023 Evan Bacon <[email protected]>

[RFC] API Routes in Expo Router (#24429)

# Why

Servers are an important part of developing many different types of
apps, but they're much harder to configure than they need to be.

API Routes

[RFC] API Routes in Expo Router (#24429)

# Why

Servers are an important part of developing many different types of
apps, but they're much harder to configure than they need to be.

API Routes will enable users to express some abstract JavaScript code
that runs in a server by simply creating a file in the app directory,
and adding the `+api.js` suffix. For example, to securely interact with
OpenAI, simply:

```ts
// app/generate+api.ts
import { ExpoRequest, ExpoResponse } from 'expo-router/server';

export async function POST(req: ExpoRequest): Promise<ExpoResponse> {
const { prompt } = await req.json();

const json = await fetch('https://api.openai.com/v1/engines/text-davinci-003/completions', {
headers: {
'Content-Type': 'application/json',
// `OPENAI_API_KEY` is pulled from the .env file when running in Expo CLI.
Authorization: `Bearer ${process.env.OPENAI_API_KEY ?? ''}`,
},
method: 'POST',
body: JSON.stringify({
prompt,
max_tokens: 100,
}),
}).then(res => res.json());

// Return as JSON
return ExpoResponse.json(json);
}
```

This will be served at `http://localhost:8081/generate` with `npx expo`
and can be used by making a request:

```sh
$ curl -X POST -H "Content-Type: application/json" -d \'{"prompt":"Hello, my name is"}\' http://localhost:8081/generate
```

Expo Router polyfills the URL and `window.location` object on native to
allow for universally requesting with a relative URL:

```js
// Expo prepends the host and port to the URL automatically in development.
const json = await fetch('/generate').then(res => res.json());
```

# How

- API Routes are bundled with Metro, leveraging all the same
functionality as the rest of the app and website.
- The project babel config is used to transpile the API routes.
Indication is passed to the Babel caller via the `isServer` boolean.
This can be used to change the preset based on the environment.
- Each API route is bundled into a standalone file in the `dist/_expo`
directory. This is akin to ncc, the tool we use to make Create Expo App
download in ~1 second.
- Create a new package `@expo/server` which includes the requisite
middleware and runtime polyfills for the Expo server environment.
- Add a new routes manifest which will be used by `@expo/server` to
serve up the three types of routes: HTML routes, API routes, and not
found routes (404s).
- Add a new export `expo-router/server` (potentially will be moved to
`expo/server`) which contains the `ExpoRequest` and `ExpoResponse`
objects. These are all based on the WinterCG specification, and include
some additional properties for interop with the Expo Router filesystem
convention. These are inspired by Remix, SvelteKit, and Next.js for
simplicity.
- Add a new export mode `web.output: "server"` which can be used to
export a dynamic server. Note: I may drop this for now and make server
the default since there's no expo-specific hosting code that must be
exported.
- This PR adds the ability to host the app with an express server,
different production adapters to follow.

# Test Plan

In addition to all the E2E Metro tests, I've added a new E2E runner
which starts a server and pings different requests to ensure expected
behavior. These run in the CLI as opposed to the `@expo/server` package.

- resolve ENG-10057 ENG-8243 ENG-8082 ENG-8079 ENG-8242 ENG-8081
ENG-8080 ENG-9625

---------

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

show more ...


# 7c98c357 14-Sep-2023 Evan Bacon <[email protected]>

feat(cli, router, metro, asset): add basePath support (#23911)

# Why

- Add the ability to export websites for hosting from a custom path.
This is required for GitHub pages.
- Resolve ENG-9193

feat(cli, router, metro, asset): add basePath support (#23911)

# Why

- Add the ability to export websites for hosting from a custom path.
This is required for GitHub pages.
- Resolve ENG-9193
- Resolve https://github.com/expo/expo/issues/20562
- Resolve https://github.com/expo/router/issues/165

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

# How

- Add `expo.experiments.basePath` which can be used during `npx expo
export` to modify how assets are referenced.
- Set the `publicPath` in Metro to output as expected.
- Add custom asset writing for web to support stripping the unused
prefix.

- It's unclear if this should also apply to native, and if we should
have platform-specific variations.
- Update Expo Router to support automatically adjusting paths to support
basePath in production builds.
<!--
How did you build this feature or fix this bug and why?
-->

# Test Plan

- [ ] New `expo export` test.

<!--
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 `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

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

show more ...


# 573b0ea7 01-Sep-2023 Evan Bacon <[email protected]>

feat(metro, cli, router): production static web source maps support (#24213)

# Why

- Add support for exporting (or skipping) optimally formatted source
maps on web with static rendering enabled.

feat(metro, cli, router): production static web source maps support (#24213)

# Why

- Add support for exporting (or skipping) optimally formatted source
maps on web with static rendering enabled.
- Improved version of https://github.com/expo/expo/pull/22334

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

# How

- Pass a new setting to the custom serializer when exporting for usage
outside of the dev server. This setting will ensure a source map is
created with paths relative to the server root.
- The resources will be adjusted after exporting to reflect the hashed
js filename location.
- When no sourcemap exporting is enabled, the references will be
stripped to prevent getting a chrome warning.


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

# Test Plan

- I added an e2e bundling test for both exporting with and without
sourcemaps.

<!--
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 `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

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

show more ...


# 429dc7fc 26-Aug-2023 Evan Bacon <[email protected]>

fix(expo, asset, cli)!: unify asset hashing (#24090)

# Why

Convert the `../` segments of the server URL to `_` to support
monorepos. This same transformation takes place in
`AssetSourceResolver

fix(expo, asset, cli)!: unify asset hashing (#24090)

# Why

Convert the `../` segments of the server URL to `_` to support
monorepos. This same transformation takes place in
`AssetSourceResolver.web` (expo-assets, expo-image) and
`persistMetroAssets` of Expo CLI, this originally came from the [Metro
opinion](https://github.com/react-native-community/cli/blob/2204d357379e2067cebe2791e90388f7e97fc5f5/packages/cli-plugin-metro/src/commands/bundle/getAssetDestPathIOS.ts#L19C5-L19C10).

The purpose is to ensure no URL like `/foo/../bar.png` is requested, as
the result would be `/bar.png` which wouldn't work. The of how to handle
this didn't come from us, but we do need to ensure it's unified. At a
high-level, this does prevent the usage of certain files, as
`/foo/../bar.png` will be `/foo/_bar.png`, meaning a file named
`/foo/_bar.png` cannot also exist. This logic, while applied at runtime,
is actually only valid for production exports as we don't move or alias
files in development. The only way to have valid development files is to
ensure `../` never appears in the URL, i.e. by using
`unstable_serverRoot`.

- Drop legacy `expo/tools/hashAssetFiles.js` in favor of `expo-asset`
version.
- Unify runtime logic of asset file loading for monorepos.
- Split out of https://github.com/expo/expo/pull/23911

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

# How

<!--
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.
-->

# 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 `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

show more ...


# 7179edea 16-Aug-2023 Evan Bacon <[email protected]>

feat(cli): pull in metro improvements from #23963 (#23987)

# Why

- Add server tag to logging.
- Reduce server invocations.

# Test Plan

- Unit tests

# Checklist

<!--
Please check the

feat(cli): pull in metro improvements from #23963 (#23987)

# Why

- Add server tag to logging.
- Reduce server invocations.

# Test Plan

- Unit tests

# 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 `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

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

show more ...


# 5b5e713e 15-Aug-2023 Evan Bacon <[email protected]>

chore: improve expo router testing (#23795)

# Why

- Ensure the various aspects of `npx expo export` continue to work with
the latest Expo Router/Metro depdencies.
- We had a bundling testing fo

chore: improve expo router testing (#23795)

# Why

- Ensure the various aspects of `npx expo export` continue to work with
the latest Expo Router/Metro depdencies.
- We had a bundling testing for Expo Router but it wasn't linked to the
monorepo so the dependencies weren't in sync.

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

# How

- Create a new app in `apps/` which is synchronized with the monorepo.
- This app contains multiple expo-router directories and various dynamic
settings.
- Fold the `expo-router` e2e tests into `@expo/cli`.
- Test static rendering, single-page application exporting, and the
native url polyfill (api).

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

# Test Plan

- The CLI E2E tests should pass.

---------

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

show more ...


# 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 ...


# 9a348a4e 10-Aug-2023 Evan Bacon <[email protected]>

chore(router): pull in stable changes from #23795 (#23890)

# Why

- #23795 is blocked on some difficult issues. This PR pulls in the safe
changes from that PR so they don't get lost.

---------

chore(router): pull in stable changes from #23795 (#23890)

# Why

- #23795 is blocked on some difficult issues. This PR pulls in the safe
changes from that PR so they don't get lost.

---------

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

show more ...


# 42637653 28-Jun-2023 Evan Bacon <[email protected]>

feat(cli): Add metro favicon middleware (#23072)

# Why

- Expo Webpack had support and this was a nice feature.

<!--
Please describe the motivation for this PR, and link to relevant GitHub
is

feat(cli): Add metro favicon middleware (#23072)

# Why

- Expo Webpack had support and this was a nice feature.

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

# How

- Add middleware in development for `/favicon.ico` which generates a
favicon based on the config in `app.json` `web.favicon`

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

# Test Plan

- Added tests. They're not fully exhaustive and don't cover the `single`
export case.


<!--
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 `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

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

show more ...


# 1a3d836e 22-May-2023 Evan Bacon <[email protected]>

feat(cli): Add `--no-minify` flag to `npx expo export` to prevent minifying output JavaScript. (#22544)

# Why

Nice feature to have for debugging.

# How

- Add the `--no-minify` flag to `npx

feat(cli): Add `--no-minify` flag to `npx expo export` to prevent minifying output JavaScript. (#22544)

# Why

Nice feature to have for debugging.

# How

- Add the `--no-minify` flag to `npx expo export`.
- Forward the flag to all Metro invocations.
- Also noticed that in some places, we were minifying Node.js code which
doesn't matter, so now we always skip minification when creating static
functions.

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

# Test Plan

- `npx expo export --no-minify` -> JS and CSS is not minified.

---------

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

show more ...


# 85531d53 17-May-2023 Evan Bacon <[email protected]>

feat(cli): add pretty errors for static exports. (#22142)

# Why

### Before

<img width="915" alt="Screenshot 2023-04-15 at 10 58 58 AM"
src="https://user-images.githubusercontent.com/9664363/2

feat(cli): add pretty errors for static exports. (#22142)

# Why

### Before

<img width="915" alt="Screenshot 2023-04-15 at 10 58 58 AM"
src="https://user-images.githubusercontent.com/9664363/232235707-fb445add-9e41-4e36-8543-aa8055d9918b.png">

### After

<img width="721" alt="Screenshot 2023-04-15 at 10 58 25 AM"
src="https://user-images.githubusercontent.com/9664363/232235688-f7663e7d-9c02-4c95-8674-636ca757137e.png">

---------

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

show more ...


# 164fcb32 16-May-2023 Evan Bacon <[email protected]>

fix(cli): Fix static export for consecutive groups. (#22504)

# Why

While porting bluesky to expo-router I found a bug in the group
variation logic. We aren't collecting variations where consecut

fix(cli): Fix static export for consecutive groups. (#22504)

# Why

While porting bluesky to expo-router I found a bug in the group
variation logic. We aren't collecting variations where consecutive
groups are used, e.g. `(a)/(b)/c` -> `c`.

---------

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

show more ...


# 8be9689f 08-May-2023 evanbacon <[email protected]>

Revert "feat(metro-config): add web sourcemap support (#22334)"

This reverts commit d8e77756248549b2932cdc8911688f7ef09fb177.


# d8e77756 08-May-2023 Evan Bacon <[email protected]>

feat(metro-config): add web sourcemap support (#22334)

# Why

- ensure exporting sourcemaps on web strips out the sourcemap tags when
sourcemaps aren't generated.
- ensure sourcemaps are relativ

feat(metro-config): add web sourcemap support (#22334)

# Why

- ensure exporting sourcemaps on web strips out the sourcemap tags when
sourcemaps aren't generated.
- ensure sourcemaps are relative on web in production when produced (may
revert).
- ensure web sources don't use `.bundle` in map URLs.
- ensure web source maps are placed in the new generated folder
`dist/_expo`.


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

# How

<!--
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.
-->

# 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 `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

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

show more ...


# 9580591f 30-Apr-2023 Evan Bacon <[email protected]>

feat(metro-config, cli): CSS serializer (#22325)

# Why

In order to support static CSS in development mode, we need to update
the metro serializer to support returning the JS and CSS assets. We n

feat(metro-config, cli): CSS serializer (#22325)

# Why

In order to support static CSS in development mode, we need to update
the metro serializer to support returning the JS and CSS assets. We now
inline the CSS in the HTML before sending to the client, this allows for
testing how the website works with JS disabled. We use the same style
tag id to continue to support HMR for styles during subsequent updates.

This change also refactors how exports work to serialize JS and CSS at
the same time (i.e. after the native transformations).

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

# How

<!--
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.
-->

# 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 `npx expo prebuild` & EAS Build
(eg: updated a module plugin).

---------

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

show more ...


# 9b2597ba 06-Apr-2023 Evan Bacon <[email protected]>

feat(metro-config, cli): CSS support for Metro web (#21941)

# Why

This PR moves the CSS support from Expo Router over to
`expo/metro-config` behind a beta flag. This is because we need deeper
i

feat(metro-config, cli): CSS support for Metro web (#21941)

# Why

This PR moves the CSS support from Expo Router over to
`expo/metro-config` behind a beta flag. This is because we need deeper
integration with Expo CLI and Metro in order to emit static CSS files in
production bundles. CSS is required for media queries -> rehydration.

- Related: https://github.com/expo/router/pull/397
https://github.com/expo/router/pull/223

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

# How

Instead of a babel transformer, we now use a custom "transformer" which
gives us the ability to add extra metadata to a Metro module on export.
This means we can pass the raw and processed CSS for writing to disk.

The development version of CSS still uses script injection via
JavaScript, meaning static rendering cannot currently be tested in
development.

CSS Modules are implemented (web-only currently) using lightningcss. The
export is generated to work with React Native for web. Consider the
following block:

```js
export default { ...StyleSheet.create({ container: { $$css: true, _: 'hashed-container-id' } }) }
```

CSS Variables are not currently hashed, enabling the user to define
variables in a global CSS file and access them in CSS Modules (subject
to change in order to support native). CSS variables are accessible from
the default export as strings: `styles['--color'] === '--color'`.


## Docs

I've chosen to document in the versioned metro doc instead of the
unversioned guide, this seems like a reasonable spot given the highly
experimental nature of this feature.


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

# Test Plan

- Unit tests for conversion.
- [x] Test in/out for transformer.
- [ ] Test static export.
- TBD for E2E


<!--
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).

show more ...


# 0a6ddb20 13-Mar-2023 Evan Bacon <[email protected]>

feat(cli): add basic static rendering for router projects (#21572)

# Why

- Implement an experimental static rendering system for Metro websites
using Expo Router.
- Behavior is undocumented and

feat(cli): add basic static rendering for router projects (#21572)

# Why

- Implement an experimental static rendering system for Metro websites
using Expo Router.
- Behavior is undocumented and highly experimental.

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

# How

- Add support to `start` and `export` which pre-renders static web pages
to HTML to improve SEO support on web.
- The system implements [React Navigation's
SSR](https://reactnavigation.org/docs/server-rendering) support.
- Head elements can be used with `import { Head } from
'expo-router/head'`.
- The root HTML is not exposed to the user.
- There are no data fetching mechanisms.
- There's no ability to provide a 404 page or other server features.


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

# Test Plan

- e2e test for exporting a router project statically.
- `EXPO_USE_STATIC=1 yarn expo` -> websites are pre-rendered before
being served.
- `EXPO_USE_STATIC=1 yarn expo export -p web` -> static routes are
rendered to static HTML files by the same name (dynamic routes are not
supported).


<!--
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]>

show more ...