@reckona/mreact-router 0.0.135 → 0.0.137
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/README.md +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +19 -6
- package/dist/client.js.map +1 -1
- package/package.json +11 -11
- package/src/client.ts +21 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reckona/mreact-router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.137",
|
|
4
4
|
"description": "File-system app router, SSR, actions, and deployment adapters for mreact.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
@@ -105,20 +105,20 @@
|
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"typescript": "^6.0.3",
|
|
108
|
-
"@reckona/mreact": "0.0.
|
|
109
|
-
"@reckona/mreact-
|
|
110
|
-
"@reckona/mreact-
|
|
111
|
-
"@reckona/mreact-
|
|
112
|
-
"@reckona/mreact-reactive-
|
|
113
|
-
"@reckona/mreact-
|
|
114
|
-
"@reckona/mreact-
|
|
115
|
-
"@reckona/mreact-server": "0.0.
|
|
116
|
-
"@reckona/mreact-shared": "0.0.
|
|
108
|
+
"@reckona/mreact": "0.0.137",
|
|
109
|
+
"@reckona/mreact-compat": "0.0.137",
|
|
110
|
+
"@reckona/mreact-compiler": "0.0.137",
|
|
111
|
+
"@reckona/mreact-devtools": "0.0.137",
|
|
112
|
+
"@reckona/mreact-reactive-core": "0.0.137",
|
|
113
|
+
"@reckona/mreact-query": "0.0.137",
|
|
114
|
+
"@reckona/mreact-reactive-dom": "0.0.137",
|
|
115
|
+
"@reckona/mreact-server": "0.0.137",
|
|
116
|
+
"@reckona/mreact-shared": "0.0.137"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
119
|
"vite": ">=8 <9"
|
|
120
120
|
},
|
|
121
121
|
"optionalDependencies": {
|
|
122
|
-
"@reckona/mreact-router-native": "0.0.
|
|
122
|
+
"@reckona/mreact-router-native": "0.0.137"
|
|
123
123
|
}
|
|
124
124
|
}
|
package/src/client.ts
CHANGED
|
@@ -17,6 +17,7 @@ import type { ClientReferenceMetadata } from "@reckona/mreact-shared/compiler-co
|
|
|
17
17
|
import {
|
|
18
18
|
collectClientRouteModuleAnalysisFromContext,
|
|
19
19
|
createCompilerModuleContext,
|
|
20
|
+
hasUnguardedBrowserGlobalReference,
|
|
20
21
|
readTopLevelBooleanExport,
|
|
21
22
|
readTopLevelBooleanExportFromContext,
|
|
22
23
|
stripTypeScriptWithOxc,
|
|
@@ -850,7 +851,10 @@ async function inferClientRouteModuleSource(options: {
|
|
|
850
851
|
}
|
|
851
852
|
|
|
852
853
|
clientBoundaryImports.push(reference.source);
|
|
853
|
-
if (
|
|
854
|
+
if (
|
|
855
|
+
!imported.clientBoundaryModule &&
|
|
856
|
+
isClientBoundaryFallbackEligibleSource(source, resolved)
|
|
857
|
+
) {
|
|
854
858
|
clientBoundaryFallbackImports.push(reference.source);
|
|
855
859
|
}
|
|
856
860
|
continue;
|
|
@@ -1115,8 +1119,8 @@ function isStyleModuleSpecifier(source: string): boolean {
|
|
|
1115
1119
|
|
|
1116
1120
|
const styleModuleExtensions = new Set([".css", ".less", ".sass", ".scss", ".styl", ".stylus"]);
|
|
1117
1121
|
|
|
1118
|
-
function isClientBoundaryFallbackEligibleSource(source: string): boolean {
|
|
1119
|
-
if (hasClientBoundaryFallbackUnsafeBrowserGlobal(source)) {
|
|
1122
|
+
function isClientBoundaryFallbackEligibleSource(source: string, filename?: string): boolean {
|
|
1123
|
+
if (hasClientBoundaryFallbackUnsafeBrowserGlobal(source, filename)) {
|
|
1120
1124
|
return false;
|
|
1121
1125
|
}
|
|
1122
1126
|
|
|
@@ -1240,12 +1244,24 @@ function isClientBoundaryFallbackEligibleSource(source: string): boolean {
|
|
|
1240
1244
|
);
|
|
1241
1245
|
}
|
|
1242
1246
|
|
|
1243
|
-
function hasClientBoundaryFallbackUnsafeBrowserGlobal(source: string): boolean {
|
|
1247
|
+
function hasClientBoundaryFallbackUnsafeBrowserGlobal(source: string, filename?: string): boolean {
|
|
1244
1248
|
const sourceWithoutTypeofGuards = source.replaceAll(
|
|
1245
1249
|
/\btypeof\s+(?:window|document|localStorage)\s*(?:(?:={2,3}|!={1,2})\s*["']undefined["'])?/gu,
|
|
1246
1250
|
"",
|
|
1247
1251
|
);
|
|
1248
|
-
|
|
1252
|
+
if (!/\b(?:window|document|localStorage)\b/u.test(sourceWithoutTypeofGuards)) {
|
|
1253
|
+
return false;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
// Remaining browser-global tokens may still be typeof-guarded uses such as
|
|
1257
|
+
// `if (typeof window !== "undefined") return window.location.pathname;`.
|
|
1258
|
+
// Those never execute on the server, so the AST guard analysis decides;
|
|
1259
|
+
// an unparsable module stays conservatively ineligible.
|
|
1260
|
+
try {
|
|
1261
|
+
return hasUnguardedBrowserGlobalReference({ code: source, filename });
|
|
1262
|
+
} catch {
|
|
1263
|
+
return true;
|
|
1264
|
+
}
|
|
1249
1265
|
}
|
|
1250
1266
|
|
|
1251
1267
|
function propsCallbackAliasNames(source: string): Set<string> {
|