@gigadrive/network-config 3.4.16 → 3.4.17
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.
|
@@ -14,18 +14,29 @@ import { fileURLToPath } from 'node:url';
|
|
|
14
14
|
// invocations cannot race on process-global state.
|
|
15
15
|
process.chdir(fileURLToPath(new URL('__GIGADRIVE_PROJECT_DIR__', import.meta.url)));
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
// The Next entrypoint must be imported lazily on the first request, not with a
|
|
18
|
+
// top-level await: some route module graphs block on facilities that only
|
|
19
|
+
// exist once the guest server is listening, and eager evaluation deadlocks the
|
|
20
|
+
// boot (observed as MicroVM boot loops in prod). The promise is shared, so the
|
|
21
|
+
// module still evaluates exactly once.
|
|
22
|
+
let handlerPromise;
|
|
23
|
+
const resolveHandler = () =>
|
|
24
|
+
(handlerPromise ??= (async () => {
|
|
25
|
+
const nextEntrypoint = await import('__GIGADRIVE_ENTRYPOINT__');
|
|
26
|
+
// Turbopack builds may export the module (or its default) as a promise.
|
|
27
|
+
const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);
|
|
28
|
+
const handler =
|
|
29
|
+
nextEntrypoint.handler ??
|
|
30
|
+
loadedEntrypoint?.handler ??
|
|
31
|
+
loadedEntrypoint?.default?.handler ??
|
|
32
|
+
loadedEntrypoint?.default ??
|
|
33
|
+
loadedEntrypoint;
|
|
34
|
+
if (typeof handler !== 'function') throw new Error('Next.js middleware handler is unavailable');
|
|
35
|
+
return handler;
|
|
36
|
+
})());
|
|
27
37
|
|
|
28
38
|
export async function fetch(request) {
|
|
39
|
+
const nextHandler = await resolveHandler();
|
|
29
40
|
const pending = [];
|
|
30
41
|
const url = new URL(request.url);
|
|
31
42
|
const response = await nextHandler(request, {
|
|
@@ -15,18 +15,29 @@ import { fileURLToPath } from 'node:url';
|
|
|
15
15
|
// invocations cannot race on process-global state.
|
|
16
16
|
process.chdir(fileURLToPath(new URL('__GIGADRIVE_PROJECT_DIR__', import.meta.url)));
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
// The Next entrypoint must be imported lazily on the first request, not with a
|
|
19
|
+
// top-level await: some route module graphs block on facilities that only
|
|
20
|
+
// exist once the guest server is listening, and eager evaluation deadlocks the
|
|
21
|
+
// boot (observed as MicroVM boot loops in prod). The promise is shared, so the
|
|
22
|
+
// module still evaluates exactly once.
|
|
23
|
+
let handlerPromise;
|
|
24
|
+
const resolveHandler = () =>
|
|
25
|
+
(handlerPromise ??= (async () => {
|
|
26
|
+
const nextEntrypoint = await import('__GIGADRIVE_ENTRYPOINT__');
|
|
27
|
+
// Turbopack builds may export the module (or its default) as a promise.
|
|
28
|
+
const loadedEntrypoint = await Promise.resolve(nextEntrypoint.default ?? nextEntrypoint);
|
|
29
|
+
const handler =
|
|
30
|
+
nextEntrypoint.handler ??
|
|
31
|
+
loadedEntrypoint?.handler ??
|
|
32
|
+
loadedEntrypoint?.default?.handler ??
|
|
33
|
+
loadedEntrypoint?.default ??
|
|
34
|
+
loadedEntrypoint;
|
|
35
|
+
if (typeof handler !== 'function') throw new Error('Next.js Node handler is unavailable');
|
|
36
|
+
return handler;
|
|
37
|
+
})());
|
|
28
38
|
|
|
29
39
|
export default async function handler(req, res) {
|
|
40
|
+
const nextHandler = await resolveHandler();
|
|
30
41
|
const pending = [];
|
|
31
42
|
const hostname = Array.isArray(req.headers.host) ? req.headers.host[0] : req.headers.host;
|
|
32
43
|
await nextHandler(req, res, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gigadrive/network-config",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.17",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/Gigadrive/sdk.git",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"minimatch": "^10.0.3",
|
|
54
54
|
"safe-regex2": "^5.0.0",
|
|
55
55
|
"yaml": "^2.8.1",
|
|
56
|
-
"@gigadrive/
|
|
57
|
-
"@gigadrive/
|
|
56
|
+
"@gigadrive/build-utils": "1.0.3",
|
|
57
|
+
"@gigadrive/commons": "2.1.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@effect/platform": "^0.96.0",
|