@oxy.so/app-preset 5.3.0 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -17,7 +17,7 @@ everyone, including paying commercial licensees, and cannot be waived.
17
17
  ----------------------------------------------------------------------------
18
18
 
19
19
  metro/static-hydration/renderer.js adapts the static renderer from
20
- @expo/router-server 58.0.14–58.0.16, Copyright © 2026 650 Industries, under
20
+ @expo/router-server 58.0.14–58.0.16 and 58.0.18–58.0.21, Copyright © 2026 650 Industries, under
21
21
  the MIT license included at metro/static-hydration/EXPO-LICENSE.
22
22
  Other dependencies are resolved and installed by the package manager and
23
23
  remain governed by their own licenses.
package/README.md CHANGED
@@ -33,7 +33,8 @@ module.exports = createOxyMetroConfig(__dirname, {
33
33
  });
34
34
  ```
35
35
 
36
- Expo Router's renderer in `@expo/router-server` 58.0.14–58.0.16 renders the app
36
+ Expo Router's renderer in `@expo/router-server` 58.0.14–58.0.16 and 58.0.18–58.0.21
37
+ (Expo 58.0.23, expo-router 58.0.30) renders the app
37
38
  inside `+html`, but the browser hydrates only `#root`. Document siblings then
38
39
  change React `useId` paths. An ID in text (for example Bloom's scoped stylesheet)
39
40
  causes React to replace the workspace during hydration.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Adapted from @expo/router-server 58.0.14 / 58.0.16 renderStreamingContent.
2
+ * Adapted from @expo/router-server 58.0.14–58.0.16 and 58.0.18–58.0.21 renderStreamingContent.
3
3
  * Copyright © 2026 650 Industries. MIT license: ./EXPO-LICENSE.
4
4
  * Static output only. Keep Expo's live streaming renderer unchanged.
5
5
  */
@@ -9,11 +9,7 @@ const { ExpoRoot } = require('expo-router');
9
9
  const { ctx } = require('expo-router/_ctx');
10
10
  const Head = require('expo-router/head').default;
11
11
  const { ServerDocument } = require('expo-router/internal/server');
12
- const {
13
- InnerRoot,
14
- getRouteInfoForLocation,
15
- registerStaticRootComponent,
16
- } = require('expo-router/internal/static');
12
+ const routerStatic = require('expo-router/internal/static');
17
13
  const { normalizeCssAssets } = require('expo-server/private');
18
14
  const { getRootComponent } = require('@expo/router-server/build/static/getRootComponent');
19
15
  const assets = require('@expo/router-server/build/utils/react');
@@ -23,6 +19,32 @@ const { renderHydratableDocument } = require('./render-document');
23
19
 
24
20
  const h = React.createElement;
25
21
 
22
+ const { InnerRoot, registerStaticRootComponent } = routerStatic;
23
+
24
+ // The page's route and its loader key, as the installed Expo renderer derives
25
+ // them. Through router-server 58.0.16 (expo-router ≤ 58.0.25) the route comes
26
+ // from the location and the loader key appends `location.search`. From 58.0.18
27
+ // (expo-router 58.0.30 removed `getRouteInfoForLocation`) the CLI passes the
28
+ // route it matched and its params, and the loader key appends the route's own
29
+ // search params.
30
+ function routeInfo(location, options) {
31
+ if (typeof routerStatic.getRouteInfoForMatchedRoute === 'function') {
32
+ if (!options.route) {
33
+ throw new Error(
34
+ '[@oxy.so/app-preset] staticHydrationBoundary: Expo called the renderer without the matched route.',
35
+ );
36
+ }
37
+ const { pathname, params, searchParams } = routerStatic.getRouteInfoForMatchedRoute(
38
+ options.route,
39
+ options.params ?? {},
40
+ location,
41
+ );
42
+ const search = searchParams.toString();
43
+ return { route: { pathname, params }, search: search ? `?${search}` : '' };
44
+ }
45
+ return { route: routerStatic.getRouteInfoForLocation(ctx, location), search: location.search };
46
+ }
47
+
26
48
  function StaticApp({ headContext, loadedData, element }) {
27
49
  return h(Head.Provider, { context: headContext }, h(InnerRoot, { loadedData }, element));
28
50
  }
@@ -40,7 +62,7 @@ function getStreamingContent(location, options) {
40
62
  return fonts.withServerContext(async () => {
41
63
  const headContext = {};
42
64
  const Document = getRootComponent();
43
- const route = getRouteInfoForLocation(ctx, location);
65
+ const { route, search } = routeInfo(location, options);
44
66
  // No document wrapper here: this is exactly the boundary hydrated in #root.
45
67
  const { element, getStyleElement } = registerStaticRootComponent(ExpoRoot, {
46
68
  location,
@@ -48,7 +70,7 @@ function getStreamingContent(location, options) {
48
70
  });
49
71
  // Match Expo's per-page reset; React Navigation caches named contexts globally.
50
72
  globalThis.__react_navigation__elements_contexts = new Map();
51
- const loaderKey = options.loader ? options.loader.key + location.search : null;
73
+ const loaderKey = options.loader ? options.loader.key + search : null;
52
74
  const loadedData = loaderKey ? { [loaderKey]: options.loader.data ?? null } : null;
53
75
  const app = h(StaticAppRoot, { headContext, loadedData, element });
54
76
 
@@ -4,9 +4,11 @@ const { requireFromProject } = require('../../plugin/requireFromProject');
4
4
  /** Opt-in compatibility adapter for Expo's static document/app render boundary. */
5
5
  function withStaticHydrationBoundary(config, projectRoot) {
6
6
  const { version } = requireFromProject('@expo/router-server/package.json', projectRoot);
7
- if (!/^58\.0\.(14|15|16)$/.test(version)) {
7
+ // 58.0.17 stays out: its renderer is a halfway step (the matched route with
8
+ // the old loader key) that was not reviewed.
9
+ if (!/^58\.0\.(14|15|16|18|19|20|21)$/.test(version)) {
8
10
  throw new Error(
9
- `[@oxy.so/app-preset] staticHydrationBoundary supports @expo/router-server 58.0.14–58.0.16; found ${version}. Review the upstream renderer before extending this range.`,
11
+ `[@oxy.so/app-preset] staticHydrationBoundary supports @expo/router-server 58.0.14–58.0.16 and 58.0.18–58.0.21; found ${version}. Review the upstream renderer before extending this range.`,
10
12
  );
11
13
  }
12
14
  const adapter = path.join(__dirname, 'renderer.js');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/app-preset",
3
- "version": "5.3.0",
3
+ "version": "5.3.1",
4
4
  "description": "The Oxy distro of Expo — centralized Expo config plugin, Metro/Babel/ESLint factories, Tailwind base CSS and TypeScript bases shared by every Oxy app (Mention, Homiio, Allo, accounts, …). A zero-build package: apps replace copy-pasted config with a single dependency bump.",
5
5
  "main": "./app.plugin.js",
6
6
  "publishConfig": {