@bleedingdev/modern-js-runtime-utils 3.9.0-ultramodern.9 → 3.9.3-ultramodern.1
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/browser/nestedRoutes.js +3 -1
- package/dist/cjs/node/fileReader.js +3 -2
- package/dist/cjs/node/loaderContext/createRequestCtx.js +1 -1
- package/dist/cjs/router.js +1 -1
- package/dist/cjs/universal/async_storage.js +14 -13
- package/dist/esm/browser/nestedRoutes.mjs +3 -1
- package/dist/esm/node/fileReader.mjs +3 -2
- package/dist/esm/node/loaderContext/createRequestCtx.mjs +1 -1
- package/dist/esm/router.mjs +1 -1
- package/dist/esm/universal/async_storage.mjs +4 -2
- package/dist/esm-node/browser/nestedRoutes.mjs +3 -1
- package/dist/esm-node/node/fileReader.mjs +3 -2
- package/dist/esm-node/node/loaderContext/createRequestCtx.mjs +1 -1
- package/dist/esm-node/router.mjs +1 -1
- package/dist/esm-node/universal/async_storage.mjs +14 -13
- package/dist/types/universal/async_storage.server.d.ts +2 -0
- package/package.json +23 -17
|
@@ -57,6 +57,7 @@ const renderNestedRoute = (nestedRoute, options = {})=>{
|
|
|
57
57
|
id: nestedRoute.id,
|
|
58
58
|
loader: createLoader(nestedRoute),
|
|
59
59
|
action: nestedRoute.action,
|
|
60
|
+
hasErrorBoundary: nestedRoute.hasErrorBoundary,
|
|
60
61
|
shouldRevalidate: nestedRoute.shouldRevalidate,
|
|
61
62
|
handle: {
|
|
62
63
|
...handle,
|
|
@@ -90,6 +91,7 @@ const renderNestedRoute = (nestedRoute, options = {})=>{
|
|
|
90
91
|
routeProps.element = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_namespaceObject.Outlet, {});
|
|
91
92
|
}
|
|
92
93
|
if (element) routeProps.element = element;
|
|
94
|
+
if (nestedRoute.loading) routeProps.hydrateFallbackElement = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(nestedRoute.loading, {});
|
|
93
95
|
const childElements = children?.map((childRoute)=>renderNestedRoute(childRoute, {
|
|
94
96
|
parent: nestedRoute
|
|
95
97
|
}));
|
|
@@ -125,7 +127,7 @@ function createLoader(route) {
|
|
|
125
127
|
}
|
|
126
128
|
return res;
|
|
127
129
|
};
|
|
128
|
-
return ()=>{
|
|
130
|
+
else return ()=>{
|
|
129
131
|
if ('function' == typeof route.lazyImport) route.lazyImport();
|
|
130
132
|
return null;
|
|
131
133
|
};
|
|
@@ -68,9 +68,10 @@ class FileReader {
|
|
|
68
68
|
const content = await fs.promises.readFile(path);
|
|
69
69
|
this.storage.set(path, content);
|
|
70
70
|
return this.encodingContent(content, encoding);
|
|
71
|
+
} else {
|
|
72
|
+
this.storage.set(path, null);
|
|
73
|
+
return null;
|
|
71
74
|
}
|
|
72
|
-
this.storage.set(path, null);
|
|
73
|
-
return null;
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
reset(fs) {
|
|
@@ -31,7 +31,7 @@ function createRequestContext(context) {
|
|
|
31
31
|
const _context = context || new Map();
|
|
32
32
|
function get(key) {
|
|
33
33
|
if ('string' == typeof key) return _context.get(key);
|
|
34
|
-
return _context.get(key.symbol) || key.getDefaultValue();
|
|
34
|
+
else return _context.get(key.symbol) || key.getDefaultValue();
|
|
35
35
|
}
|
|
36
36
|
function set(key, value) {
|
|
37
37
|
if ('string' == typeof key) _context.set(key, value);
|
package/dist/cjs/router.js
CHANGED
|
@@ -33,22 +33,23 @@ const getAsyncLocalStorage = async ()=>{
|
|
|
33
33
|
if (isBrowser) {
|
|
34
34
|
console.error('You should not get async storage in browser');
|
|
35
35
|
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return serverStorage.getAsyncLocalStorage();
|
|
40
|
-
} catch (extensionError) {
|
|
41
|
-
try {
|
|
42
|
-
const serverStorage = await import("./async_storage.server");
|
|
36
|
+
} else {
|
|
37
|
+
if (!IS_WEB_FALLBACK) try {
|
|
38
|
+
const serverStorage = await import("./async_storage.server.js");
|
|
43
39
|
return serverStorage.getAsyncLocalStorage();
|
|
44
|
-
} catch (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
40
|
+
} catch (extensionError) {
|
|
41
|
+
try {
|
|
42
|
+
const serverStorage = await import("./async_storage.server");
|
|
43
|
+
return serverStorage.getAsyncLocalStorage();
|
|
44
|
+
} catch (fallbackError) {
|
|
45
|
+
console.error('Failed to load server async storage', {
|
|
46
|
+
extensionError: extensionError instanceof Error ? extensionError.message : extensionError,
|
|
47
|
+
fallbackError: fallbackError instanceof Error ? fallbackError.message : fallbackError
|
|
48
|
+
});
|
|
49
|
+
}
|
|
49
50
|
}
|
|
51
|
+
return null;
|
|
50
52
|
}
|
|
51
|
-
return null;
|
|
52
53
|
};
|
|
53
54
|
__webpack_require__.d(__webpack_exports__, {}, {
|
|
54
55
|
getAsyncLocalStorage: getAsyncLocalStorage
|
|
@@ -24,6 +24,7 @@ const renderNestedRoute = (nestedRoute, options = {})=>{
|
|
|
24
24
|
id: nestedRoute.id,
|
|
25
25
|
loader: createLoader(nestedRoute),
|
|
26
26
|
action: nestedRoute.action,
|
|
27
|
+
hasErrorBoundary: nestedRoute.hasErrorBoundary,
|
|
27
28
|
shouldRevalidate: nestedRoute.shouldRevalidate,
|
|
28
29
|
handle: {
|
|
29
30
|
...handle,
|
|
@@ -57,6 +58,7 @@ const renderNestedRoute = (nestedRoute, options = {})=>{
|
|
|
57
58
|
routeProps.element = /*#__PURE__*/ jsx(Outlet, {});
|
|
58
59
|
}
|
|
59
60
|
if (element) routeProps.element = element;
|
|
61
|
+
if (nestedRoute.loading) routeProps.hydrateFallbackElement = /*#__PURE__*/ jsx(nestedRoute.loading, {});
|
|
60
62
|
const childElements = children?.map((childRoute)=>renderNestedRoute(childRoute, {
|
|
61
63
|
parent: nestedRoute
|
|
62
64
|
}));
|
|
@@ -92,7 +94,7 @@ function createLoader(route) {
|
|
|
92
94
|
}
|
|
93
95
|
return res;
|
|
94
96
|
};
|
|
95
|
-
return ()=>{
|
|
97
|
+
else return ()=>{
|
|
96
98
|
if ('function' == typeof route.lazyImport) route.lazyImport();
|
|
97
99
|
return null;
|
|
98
100
|
};
|
|
@@ -25,9 +25,10 @@ class FileReader {
|
|
|
25
25
|
const content = await fs.promises.readFile(path);
|
|
26
26
|
this.storage.set(path, content);
|
|
27
27
|
return this.encodingContent(content, encoding);
|
|
28
|
+
} else {
|
|
29
|
+
this.storage.set(path, null);
|
|
30
|
+
return null;
|
|
28
31
|
}
|
|
29
|
-
this.storage.set(path, null);
|
|
30
|
-
return null;
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
reset(fs) {
|
|
@@ -2,7 +2,7 @@ function createRequestContext(context) {
|
|
|
2
2
|
const _context = context || new Map();
|
|
3
3
|
function get(key) {
|
|
4
4
|
if ('string' == typeof key) return _context.get(key);
|
|
5
|
-
return _context.get(key.symbol) || key.getDefaultValue();
|
|
5
|
+
else return _context.get(key.symbol) || key.getDefaultValue();
|
|
6
6
|
}
|
|
7
7
|
function set(key, value) {
|
|
8
8
|
if ('string' == typeof key) _context.set(key, value);
|
package/dist/esm/router.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const isBrowser = "u" > typeof window && void 0 !== window.document;
|
|
2
2
|
const getAsyncLocalStorage = async ()=>{
|
|
3
3
|
if (!isBrowser) return null;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
else {
|
|
5
|
+
console.error('You should not get async storage in browser');
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
6
8
|
};
|
|
7
9
|
export { getAsyncLocalStorage };
|
|
@@ -25,6 +25,7 @@ const renderNestedRoute = (nestedRoute, options = {})=>{
|
|
|
25
25
|
id: nestedRoute.id,
|
|
26
26
|
loader: createLoader(nestedRoute),
|
|
27
27
|
action: nestedRoute.action,
|
|
28
|
+
hasErrorBoundary: nestedRoute.hasErrorBoundary,
|
|
28
29
|
shouldRevalidate: nestedRoute.shouldRevalidate,
|
|
29
30
|
handle: {
|
|
30
31
|
...handle,
|
|
@@ -58,6 +59,7 @@ const renderNestedRoute = (nestedRoute, options = {})=>{
|
|
|
58
59
|
routeProps.element = /*#__PURE__*/ jsx(Outlet, {});
|
|
59
60
|
}
|
|
60
61
|
if (element) routeProps.element = element;
|
|
62
|
+
if (nestedRoute.loading) routeProps.hydrateFallbackElement = /*#__PURE__*/ jsx(nestedRoute.loading, {});
|
|
61
63
|
const childElements = children?.map((childRoute)=>renderNestedRoute(childRoute, {
|
|
62
64
|
parent: nestedRoute
|
|
63
65
|
}));
|
|
@@ -93,7 +95,7 @@ function createLoader(route) {
|
|
|
93
95
|
}
|
|
94
96
|
return res;
|
|
95
97
|
};
|
|
96
|
-
return ()=>{
|
|
98
|
+
else return ()=>{
|
|
97
99
|
if ('function' == typeof route.lazyImport) route.lazyImport();
|
|
98
100
|
return null;
|
|
99
101
|
};
|
|
@@ -26,9 +26,10 @@ class FileReader {
|
|
|
26
26
|
const content = await fs.promises.readFile(path);
|
|
27
27
|
this.storage.set(path, content);
|
|
28
28
|
return this.encodingContent(content, encoding);
|
|
29
|
+
} else {
|
|
30
|
+
this.storage.set(path, null);
|
|
31
|
+
return null;
|
|
29
32
|
}
|
|
30
|
-
this.storage.set(path, null);
|
|
31
|
-
return null;
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
reset(fs) {
|
|
@@ -3,7 +3,7 @@ function createRequestContext(context) {
|
|
|
3
3
|
const _context = context || new Map();
|
|
4
4
|
function get(key) {
|
|
5
5
|
if ('string' == typeof key) return _context.get(key);
|
|
6
|
-
return _context.get(key.symbol) || key.getDefaultValue();
|
|
6
|
+
else return _context.get(key.symbol) || key.getDefaultValue();
|
|
7
7
|
}
|
|
8
8
|
function set(key, value) {
|
|
9
9
|
if ('string' == typeof key) _context.set(key, value);
|
package/dist/esm-node/router.mjs
CHANGED
|
@@ -5,21 +5,22 @@ const getAsyncLocalStorage = async ()=>{
|
|
|
5
5
|
if (isBrowser) {
|
|
6
6
|
console.error('You should not get async storage in browser');
|
|
7
7
|
return null;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return serverStorage.getAsyncLocalStorage();
|
|
12
|
-
} catch (extensionError) {
|
|
13
|
-
try {
|
|
14
|
-
const serverStorage = await import("./async_storage.server");
|
|
8
|
+
} else {
|
|
9
|
+
if (!IS_WEB_FALLBACK) try {
|
|
10
|
+
const serverStorage = await import("./async_storage.server.mjs");
|
|
15
11
|
return serverStorage.getAsyncLocalStorage();
|
|
16
|
-
} catch (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})
|
|
12
|
+
} catch (extensionError) {
|
|
13
|
+
try {
|
|
14
|
+
const serverStorage = await import("./async_storage.server");
|
|
15
|
+
return serverStorage.getAsyncLocalStorage();
|
|
16
|
+
} catch (fallbackError) {
|
|
17
|
+
console.error('Failed to load server async storage', {
|
|
18
|
+
extensionError: extensionError instanceof Error ? extensionError.message : extensionError,
|
|
19
|
+
fallbackError: fallbackError instanceof Error ? fallbackError.message : fallbackError
|
|
20
|
+
});
|
|
21
|
+
}
|
|
21
22
|
}
|
|
23
|
+
return null;
|
|
22
24
|
}
|
|
23
|
-
return null;
|
|
24
25
|
};
|
|
25
26
|
export { getAsyncLocalStorage };
|
|
@@ -10,6 +10,7 @@ declare const storage: {
|
|
|
10
10
|
status: number;
|
|
11
11
|
};
|
|
12
12
|
activeDeferreds?: Map<string, unknown>;
|
|
13
|
+
deferredScriptKeys?: Map<string, string[]>;
|
|
13
14
|
serverPayload?: unknown;
|
|
14
15
|
}, cb: () => O | Promise<O>) => Promise<O>;
|
|
15
16
|
useContext: () => {
|
|
@@ -21,6 +22,7 @@ declare const storage: {
|
|
|
21
22
|
status: number;
|
|
22
23
|
};
|
|
23
24
|
activeDeferreds?: Map<string, unknown>;
|
|
25
|
+
deferredScriptKeys?: Map<string, string[]>;
|
|
24
26
|
serverPayload?: unknown;
|
|
25
27
|
};
|
|
26
28
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bleedingdev/modern-js-runtime-utils",
|
|
3
3
|
"description": "A Progressive React Framework for modern web development.",
|
|
4
|
-
"homepage": "https://github.com/
|
|
4
|
+
"homepage": "https://github.com/ultramodernjs/ultramodern.js#readme",
|
|
5
5
|
"bugs": {
|
|
6
|
-
"url": "https://github.com/
|
|
6
|
+
"url": "https://github.com/ultramodernjs/ultramodern.js/issues"
|
|
7
7
|
},
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
10
|
+
"url": "git+https://github.com/ultramodernjs/ultramodern.js.git",
|
|
11
11
|
"directory": "packages/toolkit/utils"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.9.
|
|
20
|
+
"version": "3.9.3-ultramodern.1",
|
|
21
21
|
"_comment": "Provide ESM and CJS exports, ESM is used by runtime package, for treeshaking",
|
|
22
22
|
"exports": {
|
|
23
23
|
"./router": {
|
|
@@ -147,15 +147,15 @@
|
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
149
|
"dependencies": {
|
|
150
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.
|
|
151
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.
|
|
150
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.3-ultramodern.1",
|
|
151
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.3-ultramodern.1",
|
|
152
152
|
"@swc/helpers": "^0.5.23",
|
|
153
|
-
"lru-cache": "^11.5.
|
|
154
|
-
"react-router": "7.18.2"
|
|
153
|
+
"lru-cache": "^11.5.3"
|
|
155
154
|
},
|
|
156
155
|
"peerDependencies": {
|
|
157
156
|
"react": "^19.2.8",
|
|
158
|
-
"react-dom": "^19.2.8"
|
|
157
|
+
"react-dom": "^19.2.8",
|
|
158
|
+
"react-router": "^7.18.4"
|
|
159
159
|
},
|
|
160
160
|
"peerDependenciesMeta": {
|
|
161
161
|
"react": {
|
|
@@ -163,25 +163,31 @@
|
|
|
163
163
|
},
|
|
164
164
|
"react-dom": {
|
|
165
165
|
"optional": true
|
|
166
|
+
},
|
|
167
|
+
"react-router": {
|
|
168
|
+
"optional": true
|
|
166
169
|
}
|
|
167
170
|
},
|
|
168
171
|
"devDependencies": {
|
|
169
|
-
"@rslib/core": "1.0.
|
|
172
|
+
"@rslib/core": "1.0.3",
|
|
170
173
|
"@scripts/rstest-config": "2.66.0",
|
|
171
174
|
"@types/ioredis-mock": "^8.2.8",
|
|
172
|
-
"@types/node": "^26.
|
|
173
|
-
"
|
|
174
|
-
"happy-dom": "^20.14.0",
|
|
175
|
+
"@types/node": "^26.6.3",
|
|
176
|
+
"happy-dom": "^20.14.5",
|
|
175
177
|
"ioredis": "^5.11.1",
|
|
176
178
|
"ioredis-mock": "^8.13.1",
|
|
177
|
-
"react": "^19.
|
|
178
|
-
"react-dom": "^19.
|
|
179
|
-
"
|
|
179
|
+
"react": "^19.3.0",
|
|
180
|
+
"react-dom": "^19.3.0",
|
|
181
|
+
"react-router": "7.18.4",
|
|
182
|
+
"typescript": "7.0.2"
|
|
180
183
|
},
|
|
181
184
|
"sideEffects": false,
|
|
182
185
|
"scripts": {
|
|
183
186
|
"dev": "rslib build --watch",
|
|
184
187
|
"build": "rslib build",
|
|
185
|
-
"test": "rstest
|
|
188
|
+
"test": "rstest"
|
|
189
|
+
},
|
|
190
|
+
"ultramodern": {
|
|
191
|
+
"sourceName": "@modern-js/runtime-utils"
|
|
186
192
|
}
|
|
187
193
|
}
|