@rangojs/router 0.26.5 → 0.26.6
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/dist/bin/rango.js
CHANGED
|
@@ -1644,7 +1644,7 @@ var init_package = __esm({
|
|
|
1644
1644
|
"package.json"() {
|
|
1645
1645
|
package_default = {
|
|
1646
1646
|
name: "@rangojs/router",
|
|
1647
|
-
version: "0.26.
|
|
1647
|
+
version: "0.26.6",
|
|
1648
1648
|
description: "Django-inspired RSC router with composable URL patterns",
|
|
1649
1649
|
keywords: [
|
|
1650
1650
|
"react",
|
|
@@ -1852,7 +1852,7 @@ var init_package = __esm({
|
|
|
1852
1852
|
},
|
|
1853
1853
|
dependencies: {
|
|
1854
1854
|
"@types/debug": "^4.1.12",
|
|
1855
|
-
"@vitejs/plugin-rsc": "^0.5.
|
|
1855
|
+
"@vitejs/plugin-rsc": "^0.5.38",
|
|
1856
1856
|
debug: "^4.4.1",
|
|
1857
1857
|
"magic-string": "^0.30.17",
|
|
1858
1858
|
picomatch: "^4.0.4",
|
|
@@ -3,7 +3,14 @@ import type { Plugin } from "vite";
|
|
|
3
3
|
* Replace dev-style server-reference ids with their production hashes. The temp
|
|
4
4
|
* server renders Static/Prerender in a dev/serve Vite server, so plugin-rsc mints
|
|
5
5
|
* a dev-style id (e.g. "/src/urls/prerender.tsx"); rewriting only the id (group 2)
|
|
6
|
-
* leaves the hoisted function
|
|
6
|
+
* leaves the hoisted function untouched.
|
|
7
|
+
*
|
|
8
|
+
* The same id also prefixes the action id ("<id>#<name>") that plugin-rsc
|
|
9
|
+
* >= 0.5.37 passes to encryptActionBoundArgs/decryptActionBoundArgs as AES-GCM
|
|
10
|
+
* additional data. The production bundle decrypts under "<hash>#<name>", so bound
|
|
11
|
+
* args encrypted at build time under the dev-style id fail with OperationError on
|
|
12
|
+
* invocation. Rewriting every `"<id>#` literal to `"<hash>#` binds them to the
|
|
13
|
+
* runtime's id.
|
|
7
14
|
* Exported for testing; used by hashServerRefs. Returns null if nothing changed.
|
|
8
15
|
*/
|
|
9
16
|
export declare function transformServerRefs(code: string, projectRoot: string): string | null;
|
package/dist/vite/index.js
CHANGED
|
@@ -7078,7 +7078,7 @@ function resolveVersionsFrom(table, routerId2) {
|
|
|
7078
7078
|
// package.json
|
|
7079
7079
|
var package_default = {
|
|
7080
7080
|
name: "@rangojs/router",
|
|
7081
|
-
version: "0.26.
|
|
7081
|
+
version: "0.26.6",
|
|
7082
7082
|
description: "Django-inspired RSC router with composable URL patterns",
|
|
7083
7083
|
keywords: [
|
|
7084
7084
|
"react",
|
|
@@ -7286,7 +7286,7 @@ var package_default = {
|
|
|
7286
7286
|
},
|
|
7287
7287
|
dependencies: {
|
|
7288
7288
|
"@types/debug": "^4.1.12",
|
|
7289
|
-
"@vitejs/plugin-rsc": "^0.5.
|
|
7289
|
+
"@vitejs/plugin-rsc": "^0.5.38",
|
|
7290
7290
|
debug: "^4.4.1",
|
|
7291
7291
|
"magic-string": "^0.30.17",
|
|
7292
7292
|
picomatch: "^4.0.4",
|
|
@@ -10468,18 +10468,22 @@ init_client_ref_hashing();
|
|
|
10468
10468
|
var debug9 = createRangoDebugger(NS.transform);
|
|
10469
10469
|
function transformServerRefs(code, projectRoot) {
|
|
10470
10470
|
if (!code.includes("registerServerReference")) return null;
|
|
10471
|
-
|
|
10472
|
-
|
|
10471
|
+
const hashes = /* @__PURE__ */ new Map();
|
|
10472
|
+
let result = code.replace(
|
|
10473
10473
|
registerServerReferenceRegex(),
|
|
10474
10474
|
(match, _value, refKey) => {
|
|
10475
10475
|
const cleanKey = refKey.split("?")[0];
|
|
10476
10476
|
const hash = computeProductionHash(projectRoot, cleanKey);
|
|
10477
10477
|
if (hash === cleanKey) return match;
|
|
10478
|
-
|
|
10478
|
+
hashes.set(refKey, hash);
|
|
10479
10479
|
return match.replace(`"${refKey}"`, `"${hash}"`);
|
|
10480
10480
|
}
|
|
10481
10481
|
);
|
|
10482
|
-
|
|
10482
|
+
if (hashes.size === 0) return null;
|
|
10483
|
+
for (const [refKey, hash] of hashes) {
|
|
10484
|
+
result = result.replaceAll(`"${refKey}#`, `"${hash}#`);
|
|
10485
|
+
}
|
|
10486
|
+
return result;
|
|
10483
10487
|
}
|
|
10484
10488
|
function hashServerRefs(projectRoot) {
|
|
10485
10489
|
const counter = createCounter(debug9, "hash-server-refs");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rangojs/router",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.6",
|
|
4
4
|
"description": "Django-inspired RSC router with composable URL patterns",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
},
|
|
195
195
|
"dependencies": {
|
|
196
196
|
"@types/debug": "^4.1.12",
|
|
197
|
-
"@vitejs/plugin-rsc": "^0.5.
|
|
197
|
+
"@vitejs/plugin-rsc": "^0.5.38",
|
|
198
198
|
"debug": "^4.4.1",
|
|
199
199
|
"magic-string": "^0.30.17",
|
|
200
200
|
"picomatch": "^4.0.4",
|
|
@@ -9,7 +9,14 @@ const debug = createRangoDebugger(NS.transform);
|
|
|
9
9
|
* Replace dev-style server-reference ids with their production hashes. The temp
|
|
10
10
|
* server renders Static/Prerender in a dev/serve Vite server, so plugin-rsc mints
|
|
11
11
|
* a dev-style id (e.g. "/src/urls/prerender.tsx"); rewriting only the id (group 2)
|
|
12
|
-
* leaves the hoisted function
|
|
12
|
+
* leaves the hoisted function untouched.
|
|
13
|
+
*
|
|
14
|
+
* The same id also prefixes the action id ("<id>#<name>") that plugin-rsc
|
|
15
|
+
* >= 0.5.37 passes to encryptActionBoundArgs/decryptActionBoundArgs as AES-GCM
|
|
16
|
+
* additional data. The production bundle decrypts under "<hash>#<name>", so bound
|
|
17
|
+
* args encrypted at build time under the dev-style id fail with OperationError on
|
|
18
|
+
* invocation. Rewriting every `"<id>#` literal to `"<hash>#` binds them to the
|
|
19
|
+
* runtime's id.
|
|
13
20
|
* Exported for testing; used by hashServerRefs. Returns null if nothing changed.
|
|
14
21
|
*/
|
|
15
22
|
export function transformServerRefs(
|
|
@@ -18,8 +25,8 @@ export function transformServerRefs(
|
|
|
18
25
|
): string | null {
|
|
19
26
|
if (!code.includes("registerServerReference")) return null;
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
const hashes = new Map<string, string>();
|
|
29
|
+
let result = code.replace(
|
|
23
30
|
registerServerReferenceRegex(),
|
|
24
31
|
(match, _value: string, refKey: string) => {
|
|
25
32
|
// The temp server is not a long-lived HMR server, so ids are bare; strip a
|
|
@@ -27,12 +34,16 @@ export function transformServerRefs(
|
|
|
27
34
|
const cleanKey = refKey.split("?")[0]!;
|
|
28
35
|
const hash = computeProductionHash(projectRoot, cleanKey);
|
|
29
36
|
if (hash === cleanKey) return match;
|
|
30
|
-
|
|
37
|
+
hashes.set(refKey, hash);
|
|
31
38
|
return match.replace(`"${refKey}"`, `"${hash}"`);
|
|
32
39
|
},
|
|
33
40
|
);
|
|
34
41
|
|
|
35
|
-
|
|
42
|
+
if (hashes.size === 0) return null;
|
|
43
|
+
for (const [refKey, hash] of hashes) {
|
|
44
|
+
result = result.replaceAll(`"${refKey}#`, `"${hash}#`);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
36
47
|
}
|
|
37
48
|
|
|
38
49
|
/**
|