@monkeyplus/flow 6.0.3 → 6.0.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/package.json +1 -1
- package/server/renderer.mjs +24 -11
package/package.json
CHANGED
package/server/renderer.mjs
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { pathToFileURL } from "node:url";
|
|
1
3
|
let prerenderFetchHandlerPromise;
|
|
4
|
+
function resolvePrerenderServiceUrls() {
|
|
5
|
+
const cwd = process.cwd();
|
|
6
|
+
return [
|
|
7
|
+
pathToFileURL(resolve(cwd, "node_modules/.nitro/vite/services/ssr/index.js")).href,
|
|
8
|
+
pathToFileURL(resolve(cwd, ".nitro/vite/services/ssr/index.js")).href,
|
|
9
|
+
new URL("../../vite/services/ssr/index.js", import.meta.url).href
|
|
10
|
+
];
|
|
11
|
+
}
|
|
2
12
|
function resolveRequest(input) {
|
|
3
13
|
if (input instanceof Request) {
|
|
4
14
|
return input;
|
|
@@ -7,18 +17,21 @@ function resolveRequest(input) {
|
|
|
7
17
|
}
|
|
8
18
|
async function resolvePrerenderFetchHandler() {
|
|
9
19
|
prerenderFetchHandlerPromise ||= (async () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
for (const ssrServiceUrl of resolvePrerenderServiceUrls()) {
|
|
21
|
+
try {
|
|
22
|
+
const ssrService = await import(
|
|
23
|
+
/* @vite-ignore */
|
|
24
|
+
ssrServiceUrl
|
|
25
|
+
);
|
|
26
|
+
const defaultService = ssrService.default;
|
|
27
|
+
const fetchHandler = defaultService?.fetch;
|
|
28
|
+
if (typeof fetchHandler === "function") {
|
|
29
|
+
return fetchHandler.bind(defaultService);
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
21
33
|
}
|
|
34
|
+
return void 0;
|
|
22
35
|
})();
|
|
23
36
|
return await prerenderFetchHandlerPromise;
|
|
24
37
|
}
|