@bleedingdev/modern-js-runtime-extensions 3.9.0-ultramodern.2 → 3.9.0-ultramodern.4
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/cjs/buildIdentity.js +73 -0
- package/dist/cjs/localisedLoaderIdentity.js +51 -0
- package/dist/cjs/reactContext.js +45 -0
- package/dist/cjs/rsc-disabled/rscDisabledClientBrowserRuntime.js +69 -0
- package/dist/cjs/rsc-disabled/rscDisabledClientEdgeRuntime.js +61 -0
- package/dist/cjs/rsc-disabled/rscDisabledClientNodeRuntime.js +65 -0
- package/dist/cjs/rsc-disabled/rscDisabledRuntimeError.js +42 -0
- package/dist/cjs/rsc-disabled/rscDisabledServerEdgeRuntime.js +93 -0
- package/dist/cjs/rsc-disabled/rscDisabledServerNodeRuntime.js +101 -0
- package/dist/esm/buildIdentity.mjs +35 -0
- package/dist/esm/localisedLoaderIdentity.mjs +13 -0
- package/dist/esm/reactContext.mjs +7 -0
- package/dist/esm/rsc-disabled/rscDisabledClientBrowserRuntime.mjs +10 -0
- package/dist/esm/rsc-disabled/rscDisabledClientEdgeRuntime.mjs +8 -0
- package/dist/esm/rsc-disabled/rscDisabledClientNodeRuntime.mjs +9 -0
- package/dist/esm/rsc-disabled/rscDisabledRuntimeError.mjs +4 -0
- package/dist/esm/rsc-disabled/rscDisabledServerEdgeRuntime.mjs +16 -0
- package/dist/esm/rsc-disabled/rscDisabledServerNodeRuntime.mjs +18 -0
- package/dist/esm-node/buildIdentity.mjs +36 -0
- package/dist/esm-node/localisedLoaderIdentity.mjs +14 -0
- package/dist/esm-node/reactContext.mjs +8 -0
- package/dist/esm-node/rsc-disabled/rscDisabledClientBrowserRuntime.mjs +11 -0
- package/dist/esm-node/rsc-disabled/rscDisabledClientEdgeRuntime.mjs +9 -0
- package/dist/esm-node/rsc-disabled/rscDisabledClientNodeRuntime.mjs +10 -0
- package/dist/esm-node/rsc-disabled/rscDisabledRuntimeError.mjs +5 -0
- package/dist/esm-node/rsc-disabled/rscDisabledServerEdgeRuntime.mjs +17 -0
- package/dist/esm-node/rsc-disabled/rscDisabledServerNodeRuntime.mjs +19 -0
- package/dist/types/buildIdentity.d.ts +37 -0
- package/dist/types/localisedLoaderIdentity.d.ts +10 -0
- package/dist/types/reactContext.d.ts +6 -0
- package/dist/types/rsc-disabled/rscDisabledClientBrowserRuntime.d.ts +9 -0
- package/dist/types/rsc-disabled/rscDisabledClientEdgeRuntime.d.ts +7 -0
- package/dist/types/rsc-disabled/rscDisabledClientNodeRuntime.d.ts +8 -0
- package/dist/types/rsc-disabled/rscDisabledRuntimeError.d.ts +1 -0
- package/dist/types/rsc-disabled/rscDisabledServerEdgeRuntime.d.ts +15 -0
- package/dist/types/rsc-disabled/rscDisabledServerNodeRuntime.d.ts +17 -0
- package/package.json +41 -1
- package/src/buildIdentity.ts +61 -0
- package/src/localisedLoaderIdentity.ts +30 -0
- package/src/reactContext.ts +16 -0
- package/src/rsc-disabled/rscDisabledClientBrowserRuntime.ts +10 -0
- package/src/rsc-disabled/rscDisabledClientEdgeRuntime.ts +8 -0
- package/src/rsc-disabled/rscDisabledClientNodeRuntime.ts +9 -0
- package/src/rsc-disabled/rscDisabledRuntimeError.ts +3 -0
- package/src/rsc-disabled/rscDisabledServerEdgeRuntime.ts +16 -0
- package/src/rsc-disabled/rscDisabledServerNodeRuntime.ts +18 -0
- package/tests/buildIdentity.test.ts +72 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
2
|
+
const createFromFetch = disabledRscRuntime;
|
|
3
|
+
const createFromReadableStream = disabledRscRuntime;
|
|
4
|
+
const createServerReference = disabledRscRuntime;
|
|
5
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
6
|
+
const encodeReply = disabledRscRuntime;
|
|
7
|
+
const registerServerReference = disabledRscRuntime;
|
|
8
|
+
const setFindSourceMapURLCallback = disabledRscRuntime;
|
|
9
|
+
const setServerCallback = disabledRscRuntime;
|
|
10
|
+
export { createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, registerServerReference, setFindSourceMapURLCallback, setServerCallback };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
2
|
+
const createFromFetch = disabledRscRuntime;
|
|
3
|
+
const createFromReadableStream = disabledRscRuntime;
|
|
4
|
+
const createServerReference = disabledRscRuntime;
|
|
5
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
6
|
+
const encodeReply = disabledRscRuntime;
|
|
7
|
+
const registerServerReference = disabledRscRuntime;
|
|
8
|
+
export { createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, registerServerReference };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
2
|
+
const createFromFetch = disabledRscRuntime;
|
|
3
|
+
const createFromNodeStream = disabledRscRuntime;
|
|
4
|
+
const createFromReadableStream = disabledRscRuntime;
|
|
5
|
+
const createServerReference = disabledRscRuntime;
|
|
6
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
7
|
+
const encodeReply = disabledRscRuntime;
|
|
8
|
+
const registerServerReference = disabledRscRuntime;
|
|
9
|
+
export { createFromFetch, createFromNodeStream, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, registerServerReference };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
2
|
+
const createServerEntry = disabledRscRuntime;
|
|
3
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
4
|
+
const decodeAction = disabledRscRuntime;
|
|
5
|
+
const decodeFormState = disabledRscRuntime;
|
|
6
|
+
const decodeReply = disabledRscRuntime;
|
|
7
|
+
const decodeReplyFromAsyncIterable = disabledRscRuntime;
|
|
8
|
+
const decryptServerActionBoundArgs = disabledRscRuntime;
|
|
9
|
+
const encryptServerActionBoundArgs = disabledRscRuntime;
|
|
10
|
+
const ensureServerActions = disabledRscRuntime;
|
|
11
|
+
const loadServerAction = disabledRscRuntime;
|
|
12
|
+
const registerClientReference = disabledRscRuntime;
|
|
13
|
+
const registerServerReference = disabledRscRuntime;
|
|
14
|
+
const renderToReadableStream = disabledRscRuntime;
|
|
15
|
+
const setServerActionBoundArgsEncryption = disabledRscRuntime;
|
|
16
|
+
export { createServerEntry, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, decodeReplyFromAsyncIterable, decryptServerActionBoundArgs, encryptServerActionBoundArgs, ensureServerActions, loadServerAction, registerClientReference, registerServerReference, renderToReadableStream, setServerActionBoundArgsEncryption };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
2
|
+
const createServerEntry = disabledRscRuntime;
|
|
3
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
4
|
+
const decodeAction = disabledRscRuntime;
|
|
5
|
+
const decodeFormState = disabledRscRuntime;
|
|
6
|
+
const decodeReply = disabledRscRuntime;
|
|
7
|
+
const decodeReplyFromAsyncIterable = disabledRscRuntime;
|
|
8
|
+
const decodeReplyFromBusboy = disabledRscRuntime;
|
|
9
|
+
const decryptServerActionBoundArgs = disabledRscRuntime;
|
|
10
|
+
const encryptServerActionBoundArgs = disabledRscRuntime;
|
|
11
|
+
const ensureServerActions = disabledRscRuntime;
|
|
12
|
+
const loadServerAction = disabledRscRuntime;
|
|
13
|
+
const registerClientReference = disabledRscRuntime;
|
|
14
|
+
const registerServerReference = disabledRscRuntime;
|
|
15
|
+
const renderToPipeableStream = disabledRscRuntime;
|
|
16
|
+
const renderToReadableStream = disabledRscRuntime;
|
|
17
|
+
const setServerActionBoundArgsEncryption = disabledRscRuntime;
|
|
18
|
+
export { createServerEntry, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, decodeReplyFromAsyncIterable, decodeReplyFromBusboy, decryptServerActionBoundArgs, encryptServerActionBoundArgs, ensureServerActions, loadServerAction, registerClientReference, registerServerReference, renderToPipeableStream, renderToReadableStream, setServerActionBoundArgsEncryption };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
function readBuildValue(read, fallback) {
|
|
3
|
+
try {
|
|
4
|
+
return read();
|
|
5
|
+
} catch (error) {
|
|
6
|
+
if (null !== error && 'object' == typeof error && 'name' in error && 'ReferenceError' === error.name) return fallback;
|
|
7
|
+
throw error;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function resolveUltramodernBuildArtifact(artifact, readers) {
|
|
11
|
+
const buildMarker = readers ? readBuildValue(readers.buildMarker, artifact.deliveryUnit.buildMarker) : artifact.deliveryUnit.buildMarker;
|
|
12
|
+
const sourceRevision = readers ? readBuildValue(readers.sourceRevision, artifact.deliveryUnit.sourceRevision) : artifact.deliveryUnit.sourceRevision;
|
|
13
|
+
const identity = {
|
|
14
|
+
build: buildMarker,
|
|
15
|
+
buildMarker,
|
|
16
|
+
sourceRevision
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
...artifact,
|
|
20
|
+
deliveryUnit: {
|
|
21
|
+
...artifact.deliveryUnit,
|
|
22
|
+
...identity
|
|
23
|
+
},
|
|
24
|
+
surfaces: {
|
|
25
|
+
api: {
|
|
26
|
+
...artifact.surfaces.api,
|
|
27
|
+
...identity
|
|
28
|
+
},
|
|
29
|
+
ui: {
|
|
30
|
+
...artifact.surfaces.ui,
|
|
31
|
+
...identity
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export { resolveUltramodernBuildArtifact };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
function resolveLocalisedLoaderRouteId(routes, requestedId, matchedIds = []) {
|
|
3
|
+
if (matchedIds.includes(requestedId)) return requestedId;
|
|
4
|
+
const matched = new Set(matchedIds);
|
|
5
|
+
const visit = (nodes)=>{
|
|
6
|
+
for (const route of nodes){
|
|
7
|
+
if (route.id && matched.has(route.id) && route.modernLocalisedRoute?.id === requestedId) return route.id;
|
|
8
|
+
const child = route.children && visit(route.children);
|
|
9
|
+
if (child) return child;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
return visit(routes) ?? requestedId;
|
|
13
|
+
}
|
|
14
|
+
export { resolveLocalisedLoaderRouteId };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
function getRuntimeReactContext(kind, create) {
|
|
3
|
+
const key = Symbol.for(`@modern-js/runtime:react-context:v1:${kind}`);
|
|
4
|
+
const contexts = globalThis;
|
|
5
|
+
contexts[key] ??= create();
|
|
6
|
+
return contexts[key];
|
|
7
|
+
}
|
|
8
|
+
export { getRuntimeReactContext };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
3
|
+
const createFromFetch = disabledRscRuntime;
|
|
4
|
+
const createFromReadableStream = disabledRscRuntime;
|
|
5
|
+
const createServerReference = disabledRscRuntime;
|
|
6
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
7
|
+
const encodeReply = disabledRscRuntime;
|
|
8
|
+
const registerServerReference = disabledRscRuntime;
|
|
9
|
+
const setFindSourceMapURLCallback = disabledRscRuntime;
|
|
10
|
+
const setServerCallback = disabledRscRuntime;
|
|
11
|
+
export { createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, registerServerReference, setFindSourceMapURLCallback, setServerCallback };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
3
|
+
const createFromFetch = disabledRscRuntime;
|
|
4
|
+
const createFromReadableStream = disabledRscRuntime;
|
|
5
|
+
const createServerReference = disabledRscRuntime;
|
|
6
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
7
|
+
const encodeReply = disabledRscRuntime;
|
|
8
|
+
const registerServerReference = disabledRscRuntime;
|
|
9
|
+
export { createFromFetch, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, registerServerReference };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
3
|
+
const createFromFetch = disabledRscRuntime;
|
|
4
|
+
const createFromNodeStream = disabledRscRuntime;
|
|
5
|
+
const createFromReadableStream = disabledRscRuntime;
|
|
6
|
+
const createServerReference = disabledRscRuntime;
|
|
7
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
8
|
+
const encodeReply = disabledRscRuntime;
|
|
9
|
+
const registerServerReference = disabledRscRuntime;
|
|
10
|
+
export { createFromFetch, createFromNodeStream, createFromReadableStream, createServerReference, createTemporaryReferenceSet, encodeReply, registerServerReference };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
3
|
+
const createServerEntry = disabledRscRuntime;
|
|
4
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
5
|
+
const decodeAction = disabledRscRuntime;
|
|
6
|
+
const decodeFormState = disabledRscRuntime;
|
|
7
|
+
const decodeReply = disabledRscRuntime;
|
|
8
|
+
const decodeReplyFromAsyncIterable = disabledRscRuntime;
|
|
9
|
+
const decryptServerActionBoundArgs = disabledRscRuntime;
|
|
10
|
+
const encryptServerActionBoundArgs = disabledRscRuntime;
|
|
11
|
+
const ensureServerActions = disabledRscRuntime;
|
|
12
|
+
const loadServerAction = disabledRscRuntime;
|
|
13
|
+
const registerClientReference = disabledRscRuntime;
|
|
14
|
+
const registerServerReference = disabledRscRuntime;
|
|
15
|
+
const renderToReadableStream = disabledRscRuntime;
|
|
16
|
+
const setServerActionBoundArgsEncryption = disabledRscRuntime;
|
|
17
|
+
export { createServerEntry, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, decodeReplyFromAsyncIterable, decryptServerActionBoundArgs, encryptServerActionBoundArgs, ensureServerActions, loadServerAction, registerClientReference, registerServerReference, renderToReadableStream, setServerActionBoundArgsEncryption };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { disabledRscRuntime } from "./rscDisabledRuntimeError.mjs";
|
|
3
|
+
const createServerEntry = disabledRscRuntime;
|
|
4
|
+
const createTemporaryReferenceSet = disabledRscRuntime;
|
|
5
|
+
const decodeAction = disabledRscRuntime;
|
|
6
|
+
const decodeFormState = disabledRscRuntime;
|
|
7
|
+
const decodeReply = disabledRscRuntime;
|
|
8
|
+
const decodeReplyFromAsyncIterable = disabledRscRuntime;
|
|
9
|
+
const decodeReplyFromBusboy = disabledRscRuntime;
|
|
10
|
+
const decryptServerActionBoundArgs = disabledRscRuntime;
|
|
11
|
+
const encryptServerActionBoundArgs = disabledRscRuntime;
|
|
12
|
+
const ensureServerActions = disabledRscRuntime;
|
|
13
|
+
const loadServerAction = disabledRscRuntime;
|
|
14
|
+
const registerClientReference = disabledRscRuntime;
|
|
15
|
+
const registerServerReference = disabledRscRuntime;
|
|
16
|
+
const renderToPipeableStream = disabledRscRuntime;
|
|
17
|
+
const renderToReadableStream = disabledRscRuntime;
|
|
18
|
+
const setServerActionBoundArgsEncryption = disabledRscRuntime;
|
|
19
|
+
export { createServerEntry, createTemporaryReferenceSet, decodeAction, decodeFormState, decodeReply, decodeReplyFromAsyncIterable, decodeReplyFromBusboy, decryptServerActionBoundArgs, encryptServerActionBoundArgs, ensureServerActions, loadServerAction, registerClientReference, registerServerReference, renderToPipeableStream, renderToReadableStream, setServerActionBoundArgsEncryption };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface BuildIdentity {
|
|
2
|
+
readonly build: string;
|
|
3
|
+
readonly buildMarker: string;
|
|
4
|
+
readonly sourceRevision: string;
|
|
5
|
+
}
|
|
6
|
+
interface BuildArtifact {
|
|
7
|
+
readonly deliveryUnit: BuildIdentity;
|
|
8
|
+
readonly surfaces: {
|
|
9
|
+
readonly api: BuildIdentity;
|
|
10
|
+
readonly ui: BuildIdentity;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface BuildIdentityReaders {
|
|
14
|
+
readonly buildMarker: () => string;
|
|
15
|
+
readonly sourceRevision: () => string;
|
|
16
|
+
}
|
|
17
|
+
/** Read compiler constants in the caller, even when this package is external. */
|
|
18
|
+
export declare function resolveUltramodernBuildArtifact<Artifact extends BuildArtifact>(artifact: Artifact, readers?: BuildIdentityReaders): Artifact & {
|
|
19
|
+
deliveryUnit: {
|
|
20
|
+
build: string;
|
|
21
|
+
buildMarker: string;
|
|
22
|
+
sourceRevision: string;
|
|
23
|
+
};
|
|
24
|
+
surfaces: {
|
|
25
|
+
api: {
|
|
26
|
+
build: string;
|
|
27
|
+
buildMarker: string;
|
|
28
|
+
sourceRevision: string;
|
|
29
|
+
};
|
|
30
|
+
ui: {
|
|
31
|
+
build: string;
|
|
32
|
+
buildMarker: string;
|
|
33
|
+
sourceRevision: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface RouteNode {
|
|
2
|
+
id?: string;
|
|
3
|
+
children?: RouteNode[];
|
|
4
|
+
modernLocalisedRoute?: {
|
|
5
|
+
id?: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
/** Map a source loader ID only to its own alias already matched by the router. */
|
|
9
|
+
export declare function resolveLocalisedLoaderRouteId(routes: RouteNode[], requestedId: string, matchedIds?: (string | undefined)[]): string;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Federation can bundle a runtime subpath separately from its shared root.
|
|
3
|
+
* Share React context identity across those copies, leaving request values to
|
|
4
|
+
* React's providers. Public and internal contexts retain separate identities.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getRuntimeReactContext<T>(kind: 'public' | 'internal', create: () => T): T;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createFromFetch: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createFromReadableStream: typeof disabledRscRuntime;
|
|
4
|
+
export declare const createServerReference: typeof disabledRscRuntime;
|
|
5
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
6
|
+
export declare const encodeReply: typeof disabledRscRuntime;
|
|
7
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
8
|
+
export declare const setFindSourceMapURLCallback: typeof disabledRscRuntime;
|
|
9
|
+
export declare const setServerCallback: typeof disabledRscRuntime;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createFromFetch: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createFromReadableStream: typeof disabledRscRuntime;
|
|
4
|
+
export declare const createServerReference: typeof disabledRscRuntime;
|
|
5
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
6
|
+
export declare const encodeReply: typeof disabledRscRuntime;
|
|
7
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createFromFetch: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createFromNodeStream: typeof disabledRscRuntime;
|
|
4
|
+
export declare const createFromReadableStream: typeof disabledRscRuntime;
|
|
5
|
+
export declare const createServerReference: typeof disabledRscRuntime;
|
|
6
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
7
|
+
export declare const encodeReply: typeof disabledRscRuntime;
|
|
8
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function disabledRscRuntime(): never;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createServerEntry: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
4
|
+
export declare const decodeAction: typeof disabledRscRuntime;
|
|
5
|
+
export declare const decodeFormState: typeof disabledRscRuntime;
|
|
6
|
+
export declare const decodeReply: typeof disabledRscRuntime;
|
|
7
|
+
export declare const decodeReplyFromAsyncIterable: typeof disabledRscRuntime;
|
|
8
|
+
export declare const decryptServerActionBoundArgs: typeof disabledRscRuntime;
|
|
9
|
+
export declare const encryptServerActionBoundArgs: typeof disabledRscRuntime;
|
|
10
|
+
export declare const ensureServerActions: typeof disabledRscRuntime;
|
|
11
|
+
export declare const loadServerAction: typeof disabledRscRuntime;
|
|
12
|
+
export declare const registerClientReference: typeof disabledRscRuntime;
|
|
13
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
14
|
+
export declare const renderToReadableStream: typeof disabledRscRuntime;
|
|
15
|
+
export declare const setServerActionBoundArgsEncryption: typeof disabledRscRuntime;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError.js';
|
|
2
|
+
export declare const createServerEntry: typeof disabledRscRuntime;
|
|
3
|
+
export declare const createTemporaryReferenceSet: typeof disabledRscRuntime;
|
|
4
|
+
export declare const decodeAction: typeof disabledRscRuntime;
|
|
5
|
+
export declare const decodeFormState: typeof disabledRscRuntime;
|
|
6
|
+
export declare const decodeReply: typeof disabledRscRuntime;
|
|
7
|
+
export declare const decodeReplyFromAsyncIterable: typeof disabledRscRuntime;
|
|
8
|
+
export declare const decodeReplyFromBusboy: typeof disabledRscRuntime;
|
|
9
|
+
export declare const decryptServerActionBoundArgs: typeof disabledRscRuntime;
|
|
10
|
+
export declare const encryptServerActionBoundArgs: typeof disabledRscRuntime;
|
|
11
|
+
export declare const ensureServerActions: typeof disabledRscRuntime;
|
|
12
|
+
export declare const loadServerAction: typeof disabledRscRuntime;
|
|
13
|
+
export declare const registerClientReference: typeof disabledRscRuntime;
|
|
14
|
+
export declare const registerServerReference: typeof disabledRscRuntime;
|
|
15
|
+
export declare const renderToPipeableStream: typeof disabledRscRuntime;
|
|
16
|
+
export declare const renderToReadableStream: typeof disabledRscRuntime;
|
|
17
|
+
export declare const setServerActionBoundArgsEncryption: typeof disabledRscRuntime;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/runtime/runtime-extensions"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"version": "3.9.0-ultramodern.
|
|
14
|
+
"version": "3.9.0-ultramodern.4",
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=26.7.0"
|
|
17
17
|
},
|
|
@@ -49,6 +49,34 @@
|
|
|
49
49
|
"require": "./dist/cjs/safeFailure.js"
|
|
50
50
|
},
|
|
51
51
|
"default": "./dist/esm/safeFailure.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./build-identity": {
|
|
54
|
+
"types": "./dist/types/buildIdentity.d.ts",
|
|
55
|
+
"node": {
|
|
56
|
+
"import": "./dist/esm-node/buildIdentity.mjs",
|
|
57
|
+
"require": "./dist/cjs/buildIdentity.js"
|
|
58
|
+
},
|
|
59
|
+
"default": "./dist/esm/buildIdentity.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./rsc-disabled/*": {
|
|
62
|
+
"types": "./dist/types/rsc-disabled/*.d.ts",
|
|
63
|
+
"default": "./dist/esm/rsc-disabled/*.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./localised-loader-identity": {
|
|
66
|
+
"types": "./dist/types/localisedLoaderIdentity.d.ts",
|
|
67
|
+
"node": {
|
|
68
|
+
"import": "./dist/esm-node/localisedLoaderIdentity.mjs",
|
|
69
|
+
"require": "./dist/cjs/localisedLoaderIdentity.js"
|
|
70
|
+
},
|
|
71
|
+
"default": "./dist/esm/localisedLoaderIdentity.mjs"
|
|
72
|
+
},
|
|
73
|
+
"./react-context": {
|
|
74
|
+
"types": "./dist/types/reactContext.d.ts",
|
|
75
|
+
"node": {
|
|
76
|
+
"import": "./dist/esm-node/reactContext.mjs",
|
|
77
|
+
"require": "./dist/cjs/reactContext.js"
|
|
78
|
+
},
|
|
79
|
+
"default": "./dist/esm/reactContext.mjs"
|
|
52
80
|
}
|
|
53
81
|
},
|
|
54
82
|
"typesVersions": {
|
|
@@ -68,6 +96,18 @@
|
|
|
68
96
|
"safe-failure": [
|
|
69
97
|
"./dist/types/safeFailure.d.ts",
|
|
70
98
|
"./src/safeFailure.ts"
|
|
99
|
+
],
|
|
100
|
+
"build-identity": [
|
|
101
|
+
"./dist/types/buildIdentity.d.ts",
|
|
102
|
+
"./src/buildIdentity.ts"
|
|
103
|
+
],
|
|
104
|
+
"localised-loader-identity": [
|
|
105
|
+
"./dist/types/localisedLoaderIdentity.d.ts",
|
|
106
|
+
"./src/localisedLoaderIdentity.ts"
|
|
107
|
+
],
|
|
108
|
+
"react-context": [
|
|
109
|
+
"./dist/types/reactContext.d.ts",
|
|
110
|
+
"./src/reactContext.ts"
|
|
71
111
|
]
|
|
72
112
|
}
|
|
73
113
|
},
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
interface BuildIdentity {
|
|
2
|
+
readonly build: string;
|
|
3
|
+
readonly buildMarker: string;
|
|
4
|
+
readonly sourceRevision: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface BuildArtifact {
|
|
8
|
+
readonly deliveryUnit: BuildIdentity;
|
|
9
|
+
readonly surfaces: {
|
|
10
|
+
readonly api: BuildIdentity;
|
|
11
|
+
readonly ui: BuildIdentity;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface BuildIdentityReaders {
|
|
16
|
+
readonly buildMarker: () => string;
|
|
17
|
+
readonly sourceRevision: () => string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function readBuildValue(read: () => string, fallback: string): string {
|
|
21
|
+
try {
|
|
22
|
+
return read();
|
|
23
|
+
} catch (error) {
|
|
24
|
+
// An uncompiled generated module has no injected constants. Check the
|
|
25
|
+
// error tag across realms, since source validators may evaluate in a VM.
|
|
26
|
+
if (
|
|
27
|
+
error !== null &&
|
|
28
|
+
typeof error === 'object' &&
|
|
29
|
+
'name' in error &&
|
|
30
|
+
error.name === 'ReferenceError'
|
|
31
|
+
) {
|
|
32
|
+
return fallback;
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Read compiler constants in the caller, even when this package is external. */
|
|
39
|
+
export function resolveUltramodernBuildArtifact<Artifact extends BuildArtifact>(
|
|
40
|
+
artifact: Artifact,
|
|
41
|
+
readers?: BuildIdentityReaders,
|
|
42
|
+
) {
|
|
43
|
+
const buildMarker = readers
|
|
44
|
+
? readBuildValue(readers.buildMarker, artifact.deliveryUnit.buildMarker)
|
|
45
|
+
: artifact.deliveryUnit.buildMarker;
|
|
46
|
+
const sourceRevision = readers
|
|
47
|
+
? readBuildValue(
|
|
48
|
+
readers.sourceRevision,
|
|
49
|
+
artifact.deliveryUnit.sourceRevision,
|
|
50
|
+
)
|
|
51
|
+
: artifact.deliveryUnit.sourceRevision;
|
|
52
|
+
const identity = { build: buildMarker, buildMarker, sourceRevision };
|
|
53
|
+
return {
|
|
54
|
+
...artifact,
|
|
55
|
+
deliveryUnit: { ...artifact.deliveryUnit, ...identity },
|
|
56
|
+
surfaces: {
|
|
57
|
+
api: { ...artifact.surfaces.api, ...identity },
|
|
58
|
+
ui: { ...artifact.surfaces.ui, ...identity },
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
interface RouteNode {
|
|
2
|
+
id?: string;
|
|
3
|
+
children?: RouteNode[];
|
|
4
|
+
modernLocalisedRoute?: { id?: string };
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/** Map a source loader ID only to its own alias already matched by the router. */
|
|
8
|
+
export function resolveLocalisedLoaderRouteId(
|
|
9
|
+
routes: RouteNode[],
|
|
10
|
+
requestedId: string,
|
|
11
|
+
matchedIds: (string | undefined)[] = [],
|
|
12
|
+
): string {
|
|
13
|
+
if (matchedIds.includes(requestedId)) return requestedId;
|
|
14
|
+
const matched = new Set(matchedIds);
|
|
15
|
+
const visit = (nodes: RouteNode[]): string | undefined => {
|
|
16
|
+
for (const route of nodes) {
|
|
17
|
+
if (
|
|
18
|
+
route.id &&
|
|
19
|
+
matched.has(route.id) &&
|
|
20
|
+
route.modernLocalisedRoute?.id === requestedId
|
|
21
|
+
) {
|
|
22
|
+
return route.id;
|
|
23
|
+
}
|
|
24
|
+
const child = route.children && visit(route.children);
|
|
25
|
+
if (child) return child;
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
};
|
|
29
|
+
return visit(routes) ?? requestedId;
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Federation can bundle a runtime subpath separately from its shared root.
|
|
3
|
+
* Share React context identity across those copies, leaving request values to
|
|
4
|
+
* React's providers. Public and internal contexts retain separate identities.
|
|
5
|
+
*/
|
|
6
|
+
export function getRuntimeReactContext<T>(
|
|
7
|
+
kind: 'public' | 'internal',
|
|
8
|
+
create: () => T,
|
|
9
|
+
): T {
|
|
10
|
+
const key = Symbol.for(`@modern-js/runtime:react-context:v1:${kind}`);
|
|
11
|
+
const contexts = globalThis as typeof globalThis & {
|
|
12
|
+
[key: symbol]: unknown;
|
|
13
|
+
};
|
|
14
|
+
contexts[key] ??= create();
|
|
15
|
+
return contexts[key] as T;
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError';
|
|
2
|
+
|
|
3
|
+
export const createFromFetch = disabledRscRuntime;
|
|
4
|
+
export const createFromReadableStream = disabledRscRuntime;
|
|
5
|
+
export const createServerReference = disabledRscRuntime;
|
|
6
|
+
export const createTemporaryReferenceSet = disabledRscRuntime;
|
|
7
|
+
export const encodeReply = disabledRscRuntime;
|
|
8
|
+
export const registerServerReference = disabledRscRuntime;
|
|
9
|
+
export const setFindSourceMapURLCallback = disabledRscRuntime;
|
|
10
|
+
export const setServerCallback = disabledRscRuntime;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError';
|
|
2
|
+
|
|
3
|
+
export const createFromFetch = disabledRscRuntime;
|
|
4
|
+
export const createFromReadableStream = disabledRscRuntime;
|
|
5
|
+
export const createServerReference = disabledRscRuntime;
|
|
6
|
+
export const createTemporaryReferenceSet = disabledRscRuntime;
|
|
7
|
+
export const encodeReply = disabledRscRuntime;
|
|
8
|
+
export const registerServerReference = disabledRscRuntime;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError';
|
|
2
|
+
|
|
3
|
+
export const createFromFetch = disabledRscRuntime;
|
|
4
|
+
export const createFromNodeStream = disabledRscRuntime;
|
|
5
|
+
export const createFromReadableStream = disabledRscRuntime;
|
|
6
|
+
export const createServerReference = disabledRscRuntime;
|
|
7
|
+
export const createTemporaryReferenceSet = disabledRscRuntime;
|
|
8
|
+
export const encodeReply = disabledRscRuntime;
|
|
9
|
+
export const registerServerReference = disabledRscRuntime;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError';
|
|
2
|
+
|
|
3
|
+
export const createServerEntry = disabledRscRuntime;
|
|
4
|
+
export const createTemporaryReferenceSet = disabledRscRuntime;
|
|
5
|
+
export const decodeAction = disabledRscRuntime;
|
|
6
|
+
export const decodeFormState = disabledRscRuntime;
|
|
7
|
+
export const decodeReply = disabledRscRuntime;
|
|
8
|
+
export const decodeReplyFromAsyncIterable = disabledRscRuntime;
|
|
9
|
+
export const decryptServerActionBoundArgs = disabledRscRuntime;
|
|
10
|
+
export const encryptServerActionBoundArgs = disabledRscRuntime;
|
|
11
|
+
export const ensureServerActions = disabledRscRuntime;
|
|
12
|
+
export const loadServerAction = disabledRscRuntime;
|
|
13
|
+
export const registerClientReference = disabledRscRuntime;
|
|
14
|
+
export const registerServerReference = disabledRscRuntime;
|
|
15
|
+
export const renderToReadableStream = disabledRscRuntime;
|
|
16
|
+
export const setServerActionBoundArgsEncryption = disabledRscRuntime;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { disabledRscRuntime } from './rscDisabledRuntimeError';
|
|
2
|
+
|
|
3
|
+
export const createServerEntry = disabledRscRuntime;
|
|
4
|
+
export const createTemporaryReferenceSet = disabledRscRuntime;
|
|
5
|
+
export const decodeAction = disabledRscRuntime;
|
|
6
|
+
export const decodeFormState = disabledRscRuntime;
|
|
7
|
+
export const decodeReply = disabledRscRuntime;
|
|
8
|
+
export const decodeReplyFromAsyncIterable = disabledRscRuntime;
|
|
9
|
+
export const decodeReplyFromBusboy = disabledRscRuntime;
|
|
10
|
+
export const decryptServerActionBoundArgs = disabledRscRuntime;
|
|
11
|
+
export const encryptServerActionBoundArgs = disabledRscRuntime;
|
|
12
|
+
export const ensureServerActions = disabledRscRuntime;
|
|
13
|
+
export const loadServerAction = disabledRscRuntime;
|
|
14
|
+
export const registerClientReference = disabledRscRuntime;
|
|
15
|
+
export const registerServerReference = disabledRscRuntime;
|
|
16
|
+
export const renderToPipeableStream = disabledRscRuntime;
|
|
17
|
+
export const renderToReadableStream = disabledRscRuntime;
|
|
18
|
+
export const setServerActionBoundArgsEncryption = disabledRscRuntime;
|