@reckona/mreact-router 0.0.82 → 0.0.84
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/adapters/aws-lambda.d.ts.map +1 -1
- package/dist/adapters/aws-lambda.js +17 -22
- package/dist/adapters/aws-lambda.js.map +1 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +3 -1
- package/dist/build.js.map +1 -1
- package/dist/client-route-inference.d.ts +2 -0
- package/dist/client-route-inference.d.ts.map +1 -0
- package/dist/client-route-inference.js +2 -0
- package/dist/client-route-inference.js.map +1 -0
- package/dist/client.d.ts +2 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +25 -19
- package/dist/client.js.map +1 -1
- package/dist/layout-composer.d.ts +24 -0
- package/dist/layout-composer.d.ts.map +1 -0
- package/dist/layout-composer.js +83 -0
- package/dist/layout-composer.js.map +1 -0
- package/dist/metadata.d.ts +9 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +419 -0
- package/dist/metadata.js.map +1 -0
- package/dist/middleware.d.ts +22 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +94 -0
- package/dist/middleware.js.map +1 -0
- package/dist/module-runner.d.ts +2 -2
- package/dist/module-runner.d.ts.map +1 -1
- package/dist/module-runner.js +1 -1
- package/dist/module-runner.js.map +1 -1
- package/dist/navigation-runtime.d.ts +2 -0
- package/dist/navigation-runtime.d.ts.map +1 -0
- package/dist/navigation-runtime.js +2 -0
- package/dist/navigation-runtime.js.map +1 -0
- package/dist/preload-policy.d.ts +24 -0
- package/dist/preload-policy.d.ts.map +1 -0
- package/dist/preload-policy.js +45 -0
- package/dist/preload-policy.js.map +1 -0
- package/dist/render.d.ts +1 -3
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +32 -676
- package/dist/render.js.map +1 -1
- package/dist/route-hydration-contract.d.ts +11 -0
- package/dist/route-hydration-contract.d.ts.map +1 -0
- package/dist/route-hydration-contract.js +21 -0
- package/dist/route-hydration-contract.js.map +1 -0
- package/dist/route-module-loader.d.ts +10 -0
- package/dist/route-module-loader.d.ts.map +1 -0
- package/dist/route-module-loader.js +61 -0
- package/dist/route-module-loader.js.map +1 -0
- package/dist/route-source.d.ts.map +1 -1
- package/dist/route-source.js +7 -5
- package/dist/route-source.js.map +1 -1
- package/dist/routes.js +6 -0
- package/dist/routes.js.map +1 -1
- package/dist/serve.d.ts +13 -0
- package/dist/serve.d.ts.map +1 -1
- package/dist/serve.js +63 -28
- package/dist/serve.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +2 -1
- package/dist/vite.js.map +1 -1
- package/package.json +11 -11
- package/src/adapters/aws-lambda.ts +21 -28
- package/src/build.ts +9 -6
- package/src/client-route-inference.ts +18 -0
- package/src/client.ts +32 -20
- package/src/layout-composer.ts +142 -0
- package/src/metadata.ts +578 -0
- package/src/middleware.ts +153 -0
- package/src/module-runner.ts +3 -2
- package/src/navigation-runtime.ts +16 -0
- package/src/preload-policy.ts +89 -0
- package/src/render.ts +75 -986
- package/src/route-hydration-contract.ts +22 -0
- package/src/route-module-loader.ts +95 -0
- package/src/route-source.ts +9 -4
- package/src/routes.ts +8 -0
- package/src/serve.ts +110 -29
- package/src/vite.ts +6 -4
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { collectClientRouteReferences, compilerModuleContextForSource, createClientRouteInferenceCache, detectClientNavigationHint, detectNavigationRuntimeHint, formatClientRouteInferenceDiagnostic, inferClientRouteModule, isClientRouteModule, isClientRouteSource, routeToClientManifestEntry, type ClientReferenceImport, type ClientRouteInferenceCache, type ClientRouteInferenceDiagnostic, type ClientRouteInferenceResult, type ClientRouteManifestEntry, type ClientRouteReferenceResult, } from "./client.js";
|
|
2
|
+
//# sourceMappingURL=client-route-inference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-route-inference.d.ts","sourceRoot":"","sources":["../src/client-route-inference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,oCAAoC,EACpC,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { collectClientRouteReferences, compilerModuleContextForSource, createClientRouteInferenceCache, detectClientNavigationHint, detectNavigationRuntimeHint, formatClientRouteInferenceDiagnostic, inferClientRouteModule, isClientRouteModule, isClientRouteSource, routeToClientManifestEntry, } from "./client.js";
|
|
2
|
+
//# sourceMappingURL=client-route-inference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-route-inference.js","sourceRoot":"","sources":["../src/client-route-inference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,0BAA0B,EAC1B,2BAA2B,EAC3B,oCAAoC,EACpC,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,GAO3B,MAAM,aAAa,CAAC","sourcesContent":["export {\n collectClientRouteReferences,\n compilerModuleContextForSource,\n createClientRouteInferenceCache,\n detectClientNavigationHint,\n detectNavigationRuntimeHint,\n formatClientRouteInferenceDiagnostic,\n inferClientRouteModule,\n isClientRouteModule,\n isClientRouteSource,\n routeToClientManifestEntry,\n type ClientReferenceImport,\n type ClientRouteInferenceCache,\n type ClientRouteInferenceDiagnostic,\n type ClientRouteInferenceResult,\n type ClientRouteManifestEntry,\n type ClientRouteReferenceResult,\n} from \"./client.js\";\n"]}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type ClientRouteModuleAnalysis
|
|
1
|
+
import { type ClientRouteModuleAnalysis } from "@reckona/mreact-compiler";
|
|
2
|
+
import type { ClientReferenceMetadata } from "@reckona/mreact-shared/compiler-contract";
|
|
2
3
|
import { type CompilerModuleContext } from "@reckona/mreact-compiler/internal";
|
|
3
4
|
import { type RouterBundleAssetOutput, type RouterBundleChunkOutput } from "./bundle-pipeline.js";
|
|
4
5
|
import type { AppRoute } from "./routes.js";
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,yBAAyB,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,yBAAyB,EAI/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACxF,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAIL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAY5C,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,MAAM,CAAC;AAIjD,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CA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|
@@ -7,6 +7,7 @@ import { collectClientRouteModuleAnalysisFromContext, createCompilerModuleContex
|
|
|
7
7
|
import { assetPath } from "./assets.js";
|
|
8
8
|
import { bundleRouterModule, bundleRouterModules, } from "./bundle-pipeline.js";
|
|
9
9
|
import { existingRouteShellCandidates } from "./route-shells.js";
|
|
10
|
+
import { routeDataScriptIds, routeDataScriptSelector, routeHydrationContract, } from "./route-hydration-contract.js";
|
|
10
11
|
import { stripRouteClientSource } from "./route-source.js";
|
|
11
12
|
import { hasJsxSyntax } from "./source-jsx.js";
|
|
12
13
|
import { sourceModuleCandidates } from "./source-modules.js";
|
|
@@ -887,11 +888,12 @@ export function withHydrationMarkers(options) {
|
|
|
887
888
|
}
|
|
888
889
|
export function withRouteMarkers(options) {
|
|
889
890
|
const routeId = routeIdForPath(options.routePath);
|
|
890
|
-
return `<div
|
|
891
|
+
return `<div ${routeHydrationContract.routeMarkerAttribute}="${escapeHtmlAttribute(routeId)}">${options.html}</div>`;
|
|
891
892
|
}
|
|
892
893
|
export function hydrationMarkerParts(options) {
|
|
893
894
|
const routeId = routeIdForPath(options.routePath);
|
|
894
895
|
const escapedRouteId = escapeHtmlAttribute(routeId);
|
|
896
|
+
const [propsScriptId, clientReferencesScriptId] = routeDataScriptIds(routeId).map((id) => escapeHtmlAttribute(id));
|
|
895
897
|
const propsJson = escapeScriptJson(JSON.stringify(options.props));
|
|
896
898
|
const script = options.script ?? clientScriptForPath(options.routePath);
|
|
897
899
|
const scriptSrc = assetPath(script, options.assetBaseUrl ?? "/_mreact/client/");
|
|
@@ -899,13 +901,13 @@ export function hydrationMarkerParts(options) {
|
|
|
899
901
|
? undefined
|
|
900
902
|
: escapeScriptJson(JSON.stringify(options.clientReferenceManifest));
|
|
901
903
|
return {
|
|
902
|
-
prefix: `<div
|
|
904
|
+
prefix: `<div ${routeHydrationContract.routeMarkerAttribute}="${escapedRouteId}">`,
|
|
903
905
|
suffix: [
|
|
904
906
|
"</div>",
|
|
905
|
-
`<script type="application/json" id="
|
|
907
|
+
`<script type="application/json" id="${propsScriptId}">${propsJson}</script>`,
|
|
906
908
|
clientReferencesJson === undefined
|
|
907
909
|
? undefined
|
|
908
|
-
: `<script type="application/json" id="
|
|
910
|
+
: `<script type="application/json" id="${clientReferencesScriptId}">${clientReferencesJson}</script>`,
|
|
909
911
|
`<script type="module" src="${escapeHtmlAttribute(scriptSrc)}"></script>`,
|
|
910
912
|
]
|
|
911
913
|
.filter((part) => part !== undefined)
|
|
@@ -1204,7 +1206,7 @@ function __mreactResolveRouteNode(value) {
|
|
|
1204
1206
|
const boundaryOnlyHydrationBlock = routeRequiresFullHydration
|
|
1205
1207
|
? ""
|
|
1206
1208
|
: `${routeCellHydrationIndent}if (!__mreactHasNonSerializableClientBoundaries(__mreactMarker) && __mreactHydrateClientBoundaries(document, __mreactClientReferences, __mreactClientReferenceComponents)) {
|
|
1207
|
-
${routeCellHydrationIndent} __mreactMarker.setAttribute(
|
|
1209
|
+
${routeCellHydrationIndent} __mreactMarker.setAttribute(${JSON.stringify(routeHydrationContract.hydratedAttribute)}, "true");
|
|
1208
1210
|
${routeCellHydrationIndent} return;
|
|
1209
1211
|
${routeCellHydrationIndent}}
|
|
1210
1212
|
`;
|
|
@@ -1215,8 +1217,12 @@ ${routeCellHydrationIndent}}
|
|
|
1215
1217
|
const entry = `${routeCellEffectImport}${routeCleanupScopeImport}${emitCompatClientReferenceImportBlock(compatClientReferenceNames)}${clientReferenceImportBlock}${routeHydrationCode}
|
|
1216
1218
|
|
|
1217
1219
|
const __mreactRouteId = ${JSON.stringify(routeId)};
|
|
1218
|
-
const __mreactRouteStateSignature = ${JSON.stringify(routeStateSignature)};
|
|
1219
|
-
const
|
|
1220
|
+
const __mreactRouteStateSignature = ${JSON.stringify(routeStateSignature)};
|
|
1221
|
+
const __mreactRouteMarkerAttribute = ${JSON.stringify(routeHydrationContract.routeMarkerAttribute)};
|
|
1222
|
+
const __mreactRouteHydratedAttribute = ${JSON.stringify(routeHydrationContract.hydratedAttribute)};
|
|
1223
|
+
const __mreactPropsScriptPrefix = ${JSON.stringify(routeHydrationContract.propsScriptPrefix)};
|
|
1224
|
+
const __mreactClientReferencesScriptPrefix = ${JSON.stringify(routeHydrationContract.clientReferencesScriptPrefix)};
|
|
1225
|
+
const __mreactGlobal = globalThis;
|
|
1220
1226
|
${navigationStateDeclaration}
|
|
1221
1227
|
${routeCellStateDeclaration}
|
|
1222
1228
|
${routeCleanupStateDeclaration}
|
|
@@ -1226,9 +1232,9 @@ ${routeNodeResolver}
|
|
|
1226
1232
|
|
|
1227
1233
|
export function __mreactHydrateRoute() {
|
|
1228
1234
|
__mreactApplyOutOfOrderFragments(document);
|
|
1229
|
-
const __mreactMarker = document.querySelector(\`[
|
|
1230
|
-
const __mreactPropsElement = document.getElementById(
|
|
1231
|
-
const __mreactClientReferencesElement = document.getElementById(
|
|
1235
|
+
const __mreactMarker = document.querySelector(\`[\${__mreactRouteMarkerAttribute}="\${__mreactRouteId}"]\`);
|
|
1236
|
+
const __mreactPropsElement = document.getElementById(\`\${__mreactPropsScriptPrefix}\${__mreactRouteId}\`);
|
|
1237
|
+
const __mreactClientReferencesElement = document.getElementById(\`\${__mreactClientReferencesScriptPrefix}\${__mreactRouteId}\`);
|
|
1232
1238
|
const __mreactProps = __mreactPropsElement?.textContent === undefined
|
|
1233
1239
|
? {}
|
|
1234
1240
|
: JSON.parse(__mreactPropsElement.textContent);
|
|
@@ -1245,7 +1251,7 @@ export function __mreactHydrateRoute() {
|
|
|
1245
1251
|
${routeCellHydrationStart}${routeCleanupHydrationStart}${boundaryOnlyHydrationBlock}${routeComponentGuard}${routeCellHydrationIndent}const __mreactNode = ${routeNodeExpression};
|
|
1246
1252
|
${routeCellHydrationIndent}__mreactResumeRoute(__mreactMarker, __mreactNode);
|
|
1247
1253
|
${routeCellHydrationIndent}__mreactHydrateClientBoundaries(document, __mreactClientReferences, __mreactClientReferenceComponents);
|
|
1248
|
-
${routeCellHydrationIndent}__mreactMarker.setAttribute(
|
|
1254
|
+
${routeCellHydrationIndent}__mreactMarker.setAttribute(__mreactRouteHydratedAttribute, "true");
|
|
1249
1255
|
${routeCellHydrationEnd}}
|
|
1250
1256
|
${routeCellDropFunction}
|
|
1251
1257
|
${routeCleanupFunction}
|
|
@@ -1631,15 +1637,15 @@ function __mreactApplyNavigationHtml(html, url) {
|
|
|
1631
1637
|
const template = document.createElement("template");
|
|
1632
1638
|
template.innerHTML = html.replace(/^\\s*<!doctype html>/i, "");
|
|
1633
1639
|
__mreactApplyOutOfOrderFragments(template.content);
|
|
1634
|
-
const nextMarker = template.content.querySelector("[
|
|
1635
|
-
const currentMarker = document.querySelector("[
|
|
1640
|
+
const nextMarker = template.content.querySelector("[${routeHydrationContract.routeMarkerAttribute}]");
|
|
1641
|
+
const currentMarker = document.querySelector("[${routeHydrationContract.routeMarkerAttribute}]");
|
|
1636
1642
|
|
|
1637
1643
|
if (nextMarker === null || currentMarker === null) {
|
|
1638
1644
|
return false;
|
|
1639
1645
|
}
|
|
1640
1646
|
|
|
1641
|
-
const currentRouteId = currentMarker.getAttribute("
|
|
1642
|
-
const nextRouteId = nextMarker.getAttribute("
|
|
1647
|
+
const currentRouteId = currentMarker.getAttribute("${routeHydrationContract.routeMarkerAttribute}");
|
|
1648
|
+
const nextRouteId = nextMarker.getAttribute("${routeHydrationContract.routeMarkerAttribute}");
|
|
1643
1649
|
|
|
1644
1650
|
__mreactSyncHeadMetadata(template.content, html);
|
|
1645
1651
|
__mreactResumeNode(currentMarker, nextMarker);
|
|
@@ -1647,7 +1653,7 @@ ${routeCleanupNavigationDispose} __mreactSyncRouteDataScripts(template.content,
|
|
|
1647
1653
|
|
|
1648
1654
|
const script = template.content.querySelector('script[type="module"][src]')?.getAttribute("src");
|
|
1649
1655
|
if (script !== null && script !== undefined) {
|
|
1650
|
-
void import(/* @vite-ignore */ script).then((module) => module.
|
|
1656
|
+
void import(/* @vite-ignore */ script).then((module) => module.${routeHydrationContract.routeHydrateExport}?.());
|
|
1651
1657
|
}
|
|
1652
1658
|
|
|
1653
1659
|
__mreactApplyOutOfOrderFragments(document);
|
|
@@ -1740,15 +1746,15 @@ function __mreactRouteDataScriptIds(...routeIds) {
|
|
|
1740
1746
|
continue;
|
|
1741
1747
|
}
|
|
1742
1748
|
|
|
1743
|
-
ids.add(
|
|
1744
|
-
ids.add(
|
|
1749
|
+
ids.add(\`${routeHydrationContract.propsScriptPrefix}\${routeId}\`);
|
|
1750
|
+
ids.add(\`${routeHydrationContract.clientReferencesScriptPrefix}\${routeId}\`);
|
|
1745
1751
|
}
|
|
1746
1752
|
|
|
1747
1753
|
return ids;
|
|
1748
1754
|
}
|
|
1749
1755
|
|
|
1750
1756
|
function __mreactRouteDataScriptSelector() {
|
|
1751
|
-
return
|
|
1757
|
+
return ${JSON.stringify(routeDataScriptSelector())};
|
|
1752
1758
|
}
|
|
1753
1759
|
|
|
1754
1760
|
function __mreactCurrentHistoryState(url) {
|