@everystack/server 0.4.21 → 0.4.22
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/package.json +3 -3
- package/src/ssr.ts +15 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everystack/server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.22",
|
|
4
4
|
"description": "Server runtime primitives for Lambda — event adapters, routing, SSR, image processing",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"author": "Scalable Technology, Inc. <licensing@scalable.technology>",
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"sst": "4.13.1",
|
|
164
164
|
"ts-jest": "29.4.9",
|
|
165
165
|
"typescript": "5.9.3",
|
|
166
|
-
"@everystack/
|
|
167
|
-
"@everystack/
|
|
166
|
+
"@everystack/cli": "0.4.61",
|
|
167
|
+
"@everystack/auth": "0.4.3"
|
|
168
168
|
},
|
|
169
169
|
"scripts": {
|
|
170
170
|
"test": "jest",
|
package/src/ssr.ts
CHANGED
|
@@ -161,7 +161,7 @@ export function deharvestLoaderData(html: string): string {
|
|
|
161
161
|
*
|
|
162
162
|
* @param innerHandler - The expo-server request handler
|
|
163
163
|
* @param options - SSR processing options
|
|
164
|
-
* @param metadata - Release metadata
|
|
164
|
+
* @param metadata - Release metadata emitted as x-everystack-{release,runtime,created} headers
|
|
165
165
|
*/
|
|
166
166
|
export function wrapSsrHandler(
|
|
167
167
|
innerHandler: (request: Request) => Promise<Response>,
|
|
@@ -193,9 +193,11 @@ export function wrapSsrHandler(
|
|
|
193
193
|
// Delegate to inner handler
|
|
194
194
|
const response = await innerHandler(cleanRequest);
|
|
195
195
|
|
|
196
|
-
//
|
|
196
|
+
// Release identity headers — observable by probes, cache:purge, and update --verify
|
|
197
197
|
const headers = new Headers(response.headers);
|
|
198
|
-
if (metadata?.
|
|
198
|
+
if (metadata?.updateId) headers.set('x-everystack-release', metadata.updateId);
|
|
199
|
+
if (metadata?.runtimeVersion) headers.set('x-everystack-runtime', metadata.runtimeVersion);
|
|
200
|
+
if (metadata?.createdAt) headers.set('x-everystack-created', metadata.createdAt);
|
|
199
201
|
|
|
200
202
|
// Non-HTML responses pass through untouched
|
|
201
203
|
const ct = headers.get('content-type') || '';
|
|
@@ -460,6 +462,16 @@ export async function getWebHandler(
|
|
|
460
462
|
// across many releases on a long-lived warm container.
|
|
461
463
|
await pruneOldReleaseDirs(channelBase, buildDir);
|
|
462
464
|
|
|
465
|
+
// Clear Metro's in-memory module registry so the new bundle's modules load
|
|
466
|
+
// fresh. Metro stores registered modules in a globalThis Map keyed by numeric
|
|
467
|
+
// ID; IDs can collide across exports (e.g. drizzle-orm appears in both
|
|
468
|
+
// render.js and loaders/index.js with the same ID). Without a clear, the old
|
|
469
|
+
// bundle's factories stay resident and the new bundle's __d silently skips
|
|
470
|
+
// any ID it has already seen, serving stale or incompatible code.
|
|
471
|
+
if (typeof (globalThis as any).__c === 'function') {
|
|
472
|
+
(globalThis as any).__c();
|
|
473
|
+
}
|
|
474
|
+
|
|
463
475
|
if (options?.afterExtract) {
|
|
464
476
|
await options.afterExtract(buildDir);
|
|
465
477
|
}
|