@jami-studio/core 0.92.28 → 0.92.29
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/corpus/core/CHANGELOG.md +17 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/deploy/build.ts +64 -0
- package/dist/deploy/build.d.ts +21 -0
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +55 -0
- package/dist/deploy/build.js.map +1 -1
- package/package.json +1 -1
package/corpus/core/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @agent-native/core
|
|
2
2
|
|
|
3
|
+
## 0.92.29
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b9c3561: Cloudflare Pages static-shell deployments: strip `hasLoader`/`hasAction` from
|
|
8
|
+
the React Router client manifest at build time. The CF worker intentionally
|
|
9
|
+
ships no React Router request handler (static app shell keeps the merged
|
|
10
|
+
worker under the platform bundle-size limit), but templates build with
|
|
11
|
+
`ssr: true`, so the hydrated router issued single-fetch `GET <route>.data`
|
|
12
|
+
requests on every client-side navigation into a route with a server loader —
|
|
13
|
+
nothing served them, they 404'd, and React Router tripped the route
|
|
14
|
+
ErrorBoundary (`No result found for routeId "..."`), breaking in-app
|
|
15
|
+
navigation across every app of a unified workspace deployment. With the
|
|
16
|
+
server-only flags stripped, client-side navigation behaves exactly like the
|
|
17
|
+
initial static-shell load: render with client data only. `hasClientLoader`/
|
|
18
|
+
`hasClientAction` are preserved; other presets are unaffected.
|
|
19
|
+
|
|
3
20
|
## 0.92.28
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/corpus/core/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.92.
|
|
3
|
+
"version": "0.92.29",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/studio-jami/jami-studio#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -665,6 +665,7 @@ interface ReactRouterAssetManifestRoute {
|
|
|
665
665
|
imports?: string[];
|
|
666
666
|
css?: string[];
|
|
667
667
|
hasLoader?: boolean;
|
|
668
|
+
hasAction?: boolean;
|
|
668
669
|
clientActionModule?: string;
|
|
669
670
|
clientLoaderModule?: string;
|
|
670
671
|
clientMiddlewareModule?: string;
|
|
@@ -1457,6 +1458,63 @@ function findReactRouterManifest(distDir: string): ReactRouterAssetManifest {
|
|
|
1457
1458
|
return JSON.parse(match[1].replace(/;$/, "")) as ReactRouterAssetManifest;
|
|
1458
1459
|
}
|
|
1459
1460
|
|
|
1461
|
+
/**
|
|
1462
|
+
* Align the React Router CLIENT manifest with the static-shell worker.
|
|
1463
|
+
*
|
|
1464
|
+
* The Cloudflare Pages worker intentionally ships NO React Router request
|
|
1465
|
+
* handler (`includeReactRouterSsr = false` keeps the merged worker under the
|
|
1466
|
+
* platform bundle-size limit; navigations get the static app shell instead).
|
|
1467
|
+
* Templates build with `ssr: true`, so the emitted client manifest still
|
|
1468
|
+
* advertises `hasLoader`/`hasAction` for routes with server exports — and the
|
|
1469
|
+
* hydrated router then issues single-fetch `GET <route>.data` requests on
|
|
1470
|
+
* every client-side navigation into such a route. Nothing serves them: the
|
|
1471
|
+
* request 404s and React Router trips the route ErrorBoundary
|
|
1472
|
+
* (`No result found for routeId "..."`), breaking in-app navigation on every
|
|
1473
|
+
* app of a unified workspace deployment.
|
|
1474
|
+
*
|
|
1475
|
+
* Stripping the server-only flags makes client-side navigation behave exactly
|
|
1476
|
+
* like the initial static-shell load already does: render with client data
|
|
1477
|
+
* only (server loaders never run anywhere in this deployment shape).
|
|
1478
|
+
* `hasClientLoader` / `hasClientAction` are preserved untouched.
|
|
1479
|
+
*/
|
|
1480
|
+
export function stripServerDataFlagsFromClientManifest(distDir: string): void {
|
|
1481
|
+
const assetsDir = path.join(distDir, "assets");
|
|
1482
|
+
if (!fs.existsSync(assetsDir)) return;
|
|
1483
|
+
const manifestFile = fs
|
|
1484
|
+
.readdirSync(assetsDir)
|
|
1485
|
+
.find((file) => /^manifest-[\w-]+\.js$/.test(file));
|
|
1486
|
+
if (!manifestFile) return;
|
|
1487
|
+
|
|
1488
|
+
const manifestPath = path.join(assetsDir, manifestFile);
|
|
1489
|
+
const source = fs.readFileSync(manifestPath, "utf8");
|
|
1490
|
+
const match = source.match(/^window\.__reactRouterManifest=(.*);?\s*$/);
|
|
1491
|
+
if (!match) return;
|
|
1492
|
+
|
|
1493
|
+
const manifest = JSON.parse(
|
|
1494
|
+
match[1].replace(/;$/, ""),
|
|
1495
|
+
) as ReactRouterAssetManifest;
|
|
1496
|
+
let stripped = 0;
|
|
1497
|
+
for (const route of Object.values(manifest.routes ?? {})) {
|
|
1498
|
+
if (route.hasLoader) {
|
|
1499
|
+
route.hasLoader = false;
|
|
1500
|
+
stripped++;
|
|
1501
|
+
}
|
|
1502
|
+
if (route.hasAction) {
|
|
1503
|
+
route.hasAction = false;
|
|
1504
|
+
stripped++;
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
if (stripped === 0) return;
|
|
1508
|
+
|
|
1509
|
+
fs.writeFileSync(
|
|
1510
|
+
manifestPath,
|
|
1511
|
+
`window.__reactRouterManifest=${JSON.stringify(manifest)};`,
|
|
1512
|
+
);
|
|
1513
|
+
console.log(
|
|
1514
|
+
`[deploy] Stripped ${stripped} server loader/action flag(s) from ${manifestFile} — the static-shell worker has no React Router handler, so single-fetch .data requests would 404.`,
|
|
1515
|
+
);
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1460
1518
|
function collectModulePreloads(
|
|
1461
1519
|
manifest: ReactRouterAssetManifest,
|
|
1462
1520
|
route: ReactRouterAssetManifestRoute,
|
|
@@ -1673,6 +1731,12 @@ async function buildCloudflarePages() {
|
|
|
1673
1731
|
fs.mkdirSync(tmpDir, { recursive: true });
|
|
1674
1732
|
writeCloudflarePagesStaticShell({ serverDir, distDir, tmpDir });
|
|
1675
1733
|
|
|
1734
|
+
// AFTER the shell is written (its manifest fallback reads the original
|
|
1735
|
+
// hasLoader flag to pick the embedded root-loader turbo stream): align the
|
|
1736
|
+
// client manifest with the handler-less worker so client-side navigations
|
|
1737
|
+
// don't issue .data single-fetch requests that can only 404.
|
|
1738
|
+
stripServerDataFlagsFromClientManifest(distDir);
|
|
1739
|
+
|
|
1676
1740
|
// Exclude _worker.js from being served as a public asset
|
|
1677
1741
|
fs.writeFileSync(path.join(distDir, ".assetsignore"), "_worker.js\n");
|
|
1678
1742
|
|
package/dist/deploy/build.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ interface ReactRouterAssetManifestRoute {
|
|
|
70
70
|
imports?: string[];
|
|
71
71
|
css?: string[];
|
|
72
72
|
hasLoader?: boolean;
|
|
73
|
+
hasAction?: boolean;
|
|
73
74
|
clientActionModule?: string;
|
|
74
75
|
clientLoaderModule?: string;
|
|
75
76
|
clientMiddlewareModule?: string;
|
|
@@ -90,6 +91,26 @@ export declare function addImmutableAssetRouteRulesForClientBuild(routeRules: Ro
|
|
|
90
91
|
* inheritance model: app local > workspace core > framework default.
|
|
91
92
|
*/
|
|
92
93
|
export declare function generateWorkerEntry(routes: DiscoveredRoute[], pluginPaths: string[], defaultPluginStems?: string[], actions?: DiscoveredAction[], workspaceCore?: WorkspaceCoreExports | null, immutableAssetPaths?: string[], builtAppBasePath?: string, options?: GenerateWorkerEntryOptions): string;
|
|
94
|
+
/**
|
|
95
|
+
* Align the React Router CLIENT manifest with the static-shell worker.
|
|
96
|
+
*
|
|
97
|
+
* The Cloudflare Pages worker intentionally ships NO React Router request
|
|
98
|
+
* handler (`includeReactRouterSsr = false` keeps the merged worker under the
|
|
99
|
+
* platform bundle-size limit; navigations get the static app shell instead).
|
|
100
|
+
* Templates build with `ssr: true`, so the emitted client manifest still
|
|
101
|
+
* advertises `hasLoader`/`hasAction` for routes with server exports — and the
|
|
102
|
+
* hydrated router then issues single-fetch `GET <route>.data` requests on
|
|
103
|
+
* every client-side navigation into such a route. Nothing serves them: the
|
|
104
|
+
* request 404s and React Router trips the route ErrorBoundary
|
|
105
|
+
* (`No result found for routeId "..."`), breaking in-app navigation on every
|
|
106
|
+
* app of a unified workspace deployment.
|
|
107
|
+
*
|
|
108
|
+
* Stripping the server-only flags makes client-side navigation behave exactly
|
|
109
|
+
* like the initial static-shell load already does: render with client data
|
|
110
|
+
* only (server loaders never run anywhere in this deployment shape).
|
|
111
|
+
* `hasClientLoader` / `hasClientAction` are preserved untouched.
|
|
112
|
+
*/
|
|
113
|
+
export declare function stripServerDataFlagsFromClientManifest(distDir: string): void;
|
|
93
114
|
export declare function generateCloudflarePagesStaticShellFromManifest(manifest: ReactRouterAssetManifest, basePath?: string): string;
|
|
94
115
|
export declare function getNodeBuiltinNames(): string[];
|
|
95
116
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/deploy/build.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAmCH,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,6BAA6B,UAiBzC,CAAC;AAEF,eAAO,MAAM,mCAAmC,UAiB/C,CAAC;AACF,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAuIjE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,UAUnC,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAaxB;AAoCD,eAAO,MAAM,2CAA2C,EAAE,MAAM,CAC9D,MAAM,EACN,MAAM,CAmSP,CAAC;AAEF,MAAM,WAAW,0BAA0B;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AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAkBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iCAAiC,YAAI,KAAK,CAAU,CAAC;AAElE;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,MAAM,GACnB,IAAI,GAAG,SAAS,MAAM,EAAE,CAK1B"}
|
package/dist/deploy/build.js
CHANGED
|
@@ -1250,6 +1250,56 @@ function findReactRouterManifest(distDir) {
|
|
|
1250
1250
|
}
|
|
1251
1251
|
return JSON.parse(match[1].replace(/;$/, ""));
|
|
1252
1252
|
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Align the React Router CLIENT manifest with the static-shell worker.
|
|
1255
|
+
*
|
|
1256
|
+
* The Cloudflare Pages worker intentionally ships NO React Router request
|
|
1257
|
+
* handler (`includeReactRouterSsr = false` keeps the merged worker under the
|
|
1258
|
+
* platform bundle-size limit; navigations get the static app shell instead).
|
|
1259
|
+
* Templates build with `ssr: true`, so the emitted client manifest still
|
|
1260
|
+
* advertises `hasLoader`/`hasAction` for routes with server exports — and the
|
|
1261
|
+
* hydrated router then issues single-fetch `GET <route>.data` requests on
|
|
1262
|
+
* every client-side navigation into such a route. Nothing serves them: the
|
|
1263
|
+
* request 404s and React Router trips the route ErrorBoundary
|
|
1264
|
+
* (`No result found for routeId "..."`), breaking in-app navigation on every
|
|
1265
|
+
* app of a unified workspace deployment.
|
|
1266
|
+
*
|
|
1267
|
+
* Stripping the server-only flags makes client-side navigation behave exactly
|
|
1268
|
+
* like the initial static-shell load already does: render with client data
|
|
1269
|
+
* only (server loaders never run anywhere in this deployment shape).
|
|
1270
|
+
* `hasClientLoader` / `hasClientAction` are preserved untouched.
|
|
1271
|
+
*/
|
|
1272
|
+
export function stripServerDataFlagsFromClientManifest(distDir) {
|
|
1273
|
+
const assetsDir = path.join(distDir, "assets");
|
|
1274
|
+
if (!fs.existsSync(assetsDir))
|
|
1275
|
+
return;
|
|
1276
|
+
const manifestFile = fs
|
|
1277
|
+
.readdirSync(assetsDir)
|
|
1278
|
+
.find((file) => /^manifest-[\w-]+\.js$/.test(file));
|
|
1279
|
+
if (!manifestFile)
|
|
1280
|
+
return;
|
|
1281
|
+
const manifestPath = path.join(assetsDir, manifestFile);
|
|
1282
|
+
const source = fs.readFileSync(manifestPath, "utf8");
|
|
1283
|
+
const match = source.match(/^window\.__reactRouterManifest=(.*);?\s*$/);
|
|
1284
|
+
if (!match)
|
|
1285
|
+
return;
|
|
1286
|
+
const manifest = JSON.parse(match[1].replace(/;$/, ""));
|
|
1287
|
+
let stripped = 0;
|
|
1288
|
+
for (const route of Object.values(manifest.routes ?? {})) {
|
|
1289
|
+
if (route.hasLoader) {
|
|
1290
|
+
route.hasLoader = false;
|
|
1291
|
+
stripped++;
|
|
1292
|
+
}
|
|
1293
|
+
if (route.hasAction) {
|
|
1294
|
+
route.hasAction = false;
|
|
1295
|
+
stripped++;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
if (stripped === 0)
|
|
1299
|
+
return;
|
|
1300
|
+
fs.writeFileSync(manifestPath, `window.__reactRouterManifest=${JSON.stringify(manifest)};`);
|
|
1301
|
+
console.log(`[deploy] Stripped ${stripped} server loader/action flag(s) from ${manifestFile} — the static-shell worker has no React Router handler, so single-fetch .data requests would 404.`);
|
|
1302
|
+
}
|
|
1253
1303
|
function collectModulePreloads(manifest, route) {
|
|
1254
1304
|
const paths = new Set();
|
|
1255
1305
|
const add = (value) => {
|
|
@@ -1404,6 +1454,11 @@ async function buildCloudflarePages() {
|
|
|
1404
1454
|
const tmpDir = path.join(cwd, ".deploy-tmp");
|
|
1405
1455
|
fs.mkdirSync(tmpDir, { recursive: true });
|
|
1406
1456
|
writeCloudflarePagesStaticShell({ serverDir, distDir, tmpDir });
|
|
1457
|
+
// AFTER the shell is written (its manifest fallback reads the original
|
|
1458
|
+
// hasLoader flag to pick the embedded root-loader turbo stream): align the
|
|
1459
|
+
// client manifest with the handler-less worker so client-side navigations
|
|
1460
|
+
// don't issue .data single-fetch requests that can only 404.
|
|
1461
|
+
stripServerDataFlagsFromClientManifest(distDir);
|
|
1407
1462
|
// Exclude _worker.js from being served as a public asset
|
|
1408
1463
|
fs.writeFileSync(path.join(distDir, ".assetsignore"), "_worker.js\n");
|
|
1409
1464
|
// Write package metadata inside _worker.js/ for the ES module worker that
|