@ngrok/app-server 0.4.1 → 0.5.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/README.md +223 -64
- package/dist/brotli-only-BVAagKt3.js +63 -0
- package/dist/build-id-CwMbED1n.js +245 -0
- package/dist/{build-manifest-DBMWe3Lx.js → build-manifest-CoBztw_6.js} +13 -4
- package/dist/bun-BCz6K_Xv.js +1 -2
- package/dist/check-count-DQl5z_qe.js +17 -0
- package/dist/cli.js +9 -6
- package/dist/client-browser.d.ts +2 -3
- package/dist/client-browser.js +1 -1
- package/dist/client.d.ts +5 -4
- package/dist/client.js +9 -6
- package/dist/{compress-Cp5NfXCC.js → compress-2w3jqBh7.js} +2 -3
- package/dist/{compression-CT2mWlKM.js → compression-uJxu0JVb.js} +32 -5
- package/dist/content-types-Le-5BNEC.js +10 -0
- package/dist/{create-server-Bp1yILQk.js → create-server-DVTZun6D.js} +617 -306
- package/dist/create-server-PA0qniaK.js +3 -0
- package/dist/{create-server-X2GR-U6t.d.ts → create-server-UVsHFQyK.d.ts} +116 -54
- package/dist/deno-aqhikNMG.js +1 -2
- package/dist/{entry-BoxCqc6w.js → entry-CMhX3yf8.js} +85 -65
- package/dist/entry-CvZ4U0ia.js +3 -0
- package/dist/{entry-DZTCaL3d.d.ts → entry-DBq_3s8X.d.ts} +10 -36
- package/dist/entry-protocol-C30UPXzy.js +14 -0
- package/dist/entry-source-DSE5NAJu.js +70 -0
- package/dist/entry-source-SHoE-DUP.js +3 -0
- package/dist/exit-Hh-O3gp4.js +83 -0
- package/dist/{header-hook-Vzw9J9BY.js → header-hook-JfqaTt34.js} +69 -23
- package/dist/{index-B8LsM6Mh.d.ts → index-gzGs53Ue.d.ts} +43 -38
- package/dist/index.d.ts +88 -44
- package/dist/index.js +216 -84
- package/dist/listen-options-7TaXjyrk.js +1 -2
- package/dist/{load-entry-CCPWbsrj.js → load-entry-Bgq1_HDV.js} +11 -12
- package/dist/{log-DQAS5gGT.js → log-DfC9D5_T.js} +70 -49
- package/dist/{node-D6m6e6EI.js → node-DQPrMFyc.js} +20 -8
- package/dist/node-DyKDFII0.js +263 -0
- package/dist/node-vite.d.ts +2 -3
- package/dist/node-vite.js +1 -1
- package/dist/node.d.ts +41 -64
- package/dist/node.js +3 -3
- package/dist/react-router-vite.d.ts +2 -3
- package/dist/react-router-vite.js +1 -1
- package/dist/react-router.d.ts +6 -17
- package/dist/react-router.js +9 -14
- package/dist/request-context-Cslbrscf.js +163 -0
- package/dist/{response-edge-CU8ZvL_F.js → response-edge-Ow5Pi5qF.js} +13 -10
- package/dist/{response-writer-D7KHfr8n.js → response-writer-Dd4Ey99f.js} +57 -21
- package/dist/{script-hashes-CU7P9oZU.js → script-hashes-BdvJ0QI_.js} +2 -3
- package/dist/serve-AatMo9k6.js +26 -0
- package/dist/{stale-build-navigation-rg5xxmTr.js → stale-build-navigation-Qf_Lem39.js} +4 -5
- package/dist/{stale-build-navigation-ypV7Ow4o.d.ts → stale-build-navigation-WjhD8zHi.d.ts} +4 -4
- package/dist/start-DYFyGKsM.js +470 -0
- package/dist/static-files-BdTPam5b.js +438 -0
- package/dist/static-pages-6IBHdYQc.d.ts +30 -0
- package/dist/tanstack-start-vite.d.ts +2 -3
- package/dist/tanstack-start-vite.js +1 -1
- package/dist/tanstack-start.d.ts +3 -4
- package/dist/tanstack-start.js +2 -3
- package/dist/tcp-3v4pmnYU.js +58 -0
- package/dist/testing.d.ts +8 -6
- package/dist/testing.js +19 -17
- package/dist/{trailing-slash-D2QWKWEu.d.ts → trailing-slash-C-yBKCib.d.ts} +2 -3
- package/dist/{types-MgFtkNQW.d.ts → types-KsKRDwAv.d.ts} +97 -46
- package/dist/vercel-pages.d.ts +3 -16
- package/dist/vercel-pages.js +1 -2
- package/dist/vercel-vite.d.ts +4 -5
- package/dist/vercel-vite.js +48 -44
- package/dist/vercel.d.ts +13 -10
- package/dist/vercel.js +48 -35
- package/dist/{vite-D4hfj3ph.js → vite-Brb8YR9I.js} +2 -7
- package/dist/{vite-B-GfswoH.js → vite-CHppJWp_.js} +5 -7
- package/dist/{vite-DyrhyKEr.js → vite-DjlHdyTM.js} +2 -7
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +885 -2
- package/package.json +13 -12
- package/dist/brotli-only-DrA29Ecw.js +0 -97
- package/dist/brotli-only-DrA29Ecw.js.map +0 -1
- package/dist/build-id-B0448vZH.js +0 -151
- package/dist/build-id-B0448vZH.js.map +0 -1
- package/dist/build-manifest-DBMWe3Lx.js.map +0 -1
- package/dist/bun-BCz6K_Xv.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/compress-Cp5NfXCC.js.map +0 -1
- package/dist/compression-CT2mWlKM.js.map +0 -1
- package/dist/create-server-Bp1yILQk.js.map +0 -1
- package/dist/deno-aqhikNMG.js.map +0 -1
- package/dist/entry-BoxCqc6w.js.map +0 -1
- package/dist/header-hook-Vzw9J9BY.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/listen-options-7TaXjyrk.js.map +0 -1
- package/dist/load-entry-CCPWbsrj.js.map +0 -1
- package/dist/log-DQAS5gGT.js.map +0 -1
- package/dist/node-CVVdk2N6.js +0 -334
- package/dist/node-CVVdk2N6.js.map +0 -1
- package/dist/node-D6m6e6EI.js.map +0 -1
- package/dist/react-router.js.map +0 -1
- package/dist/request-context-Bxdbk5P1.js +0 -80
- package/dist/request-context-Bxdbk5P1.js.map +0 -1
- package/dist/response-edge-CU8ZvL_F.js.map +0 -1
- package/dist/response-writer-D7KHfr8n.js.map +0 -1
- package/dist/script-hashes-CU7P9oZU.js.map +0 -1
- package/dist/serve-W4WacdOw.js +0 -29
- package/dist/serve-W4WacdOw.js.map +0 -1
- package/dist/stale-build-navigation-rg5xxmTr.js.map +0 -1
- package/dist/start-j0VlxeiI.js +0 -324
- package/dist/start-j0VlxeiI.js.map +0 -1
- package/dist/static-files-C2ea8KQ6.js +0 -310
- package/dist/static-files-C2ea8KQ6.js.map +0 -1
- package/dist/tanstack-start.js.map +0 -1
- package/dist/tcp-BgDXbjOG.js +0 -42
- package/dist/tcp-BgDXbjOG.js.map +0 -1
- package/dist/testing.js.map +0 -1
- package/dist/vercel-pages.js.map +0 -1
- package/dist/vercel-vite.js.map +0 -1
- package/dist/vercel.js.map +0 -1
- package/dist/vite-B-GfswoH.js.map +0 -1
- package/dist/vite-D4hfj3ph.js.map +0 -1
- package/dist/vite-DPiSKHDn.js +0 -870
- package/dist/vite-DPiSKHDn.js.map +0 -1
- package/dist/vite-DyrhyKEr.js.map +0 -1
package/dist/vercel.js
CHANGED
|
@@ -1,37 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
5
|
-
import { n as
|
|
1
|
+
import { i as withForwardedProto } from "./create-server-DVTZun6D.js";
|
|
2
|
+
import { n as listedFiles, r as nodeFiles, t as host$1 } from "./node-DyKDFII0.js";
|
|
3
|
+
import { t as requestListener } from "./response-writer-Dd4Ey99f.js";
|
|
4
|
+
import { n as flushLogs, r as logWriter } from "./exit-Hh-O3gp4.js";
|
|
5
|
+
import { n as brotliOnlyOpen, t as FILE_LIST } from "./brotli-only-BVAagKt3.js";
|
|
6
6
|
|
|
7
7
|
// src/vercel/index.ts
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* The files that {@link FILE_LIST} names in the client build `disk`, with no
|
|
10
|
+
* other read of the file system: each file with the size from the list and
|
|
11
|
+
* the time of the build, and each directory above a file. Gives `undefined`
|
|
12
|
+
* for a client build with no list.
|
|
13
13
|
*/
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
async function listedBuild(disk) {
|
|
15
|
+
if ((await disk.stat("/.app-server-files.json"))?.kind !== "file") return;
|
|
16
|
+
const text = await new Response(await disk.open(FILE_LIST)).text();
|
|
17
|
+
const { builtAt, files, brotliOnly } = JSON.parse(text);
|
|
18
|
+
const entries = /* @__PURE__ */ new Map();
|
|
19
|
+
const directory = { kind: "directory" };
|
|
20
|
+
for (const sizes of [files, brotliOnly]) for (const [path, size] of Object.entries(sizes)) {
|
|
21
|
+
entries.set(path, {
|
|
22
|
+
kind: "file",
|
|
23
|
+
size,
|
|
24
|
+
mtimeMs: builtAt
|
|
25
|
+
});
|
|
26
|
+
for (let parent = path.slice(0, path.lastIndexOf("/")) || "/"; !entries.has(parent); parent = parent.slice(0, parent.lastIndexOf("/")) || "/") entries.set(parent, directory);
|
|
27
|
+
}
|
|
28
|
+
return listedFiles(entries, brotliOnlyOpen(disk.open, new Set(Object.keys(brotliOnly))));
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
|
-
* The vercel host: one Vercel Function on Node.js. It
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* The vercel host: one Vercel Function on Node.js. It keeps
|
|
32
|
+
* `requestContext()` in `AsyncLocalStorage`, as the node host does. It has no
|
|
33
|
+
* listeners and no lifecycle: Vercel starts and stops the function, and
|
|
34
|
+
* {@link handler} calls the entry's `fetch`.
|
|
35
|
+
*
|
|
36
|
+
* It serves the files of the client build that the list of `vercel()` names
|
|
37
|
+
* ({@link FILE_LIST}), so a cold start reads one file, not each directory. It
|
|
38
|
+
* reads a file that the function keeps only as a brotli copy through that
|
|
39
|
+
* copy. A client build with no list, such as in development, comes from the
|
|
40
|
+
* file system, as on the node host.
|
|
35
41
|
*
|
|
36
42
|
* Why no gzip: Vercel's CDN compresses each response, with Brotli when the
|
|
37
43
|
* client accepts it.
|
|
@@ -40,13 +46,21 @@ function withModifiedTime(files, mtimeMs) {
|
|
|
40
46
|
* export const appServer = createEntry({ app, host, framework: (mode) => runtime(build, { mode }) });
|
|
41
47
|
*/
|
|
42
48
|
const host = {
|
|
43
|
-
name: "vercel",
|
|
44
49
|
files: (clientDirectory) => {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
const disk = nodeFiles(clientDirectory);
|
|
51
|
+
let listed;
|
|
52
|
+
const list = async () => {
|
|
53
|
+
listed ??= listedBuild(disk);
|
|
54
|
+
return listed;
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
stat: async (path) => (await list() ?? disk).stat(path),
|
|
58
|
+
open: async (path, options) => (await list() ?? disk).open(path, options),
|
|
59
|
+
snapshot: async () => await list() ?? await disk.snapshot?.() ?? disk
|
|
60
|
+
};
|
|
48
61
|
},
|
|
49
|
-
...host$1.storage == null ? {} : { storage: host$1.storage }
|
|
62
|
+
...host$1.storage == null ? {} : { storage: host$1.storage },
|
|
63
|
+
logWriter
|
|
50
64
|
};
|
|
51
65
|
/**
|
|
52
66
|
* The function handler for the entry of a server build. The function file
|
|
@@ -87,5 +101,4 @@ function handler(entry) {
|
|
|
87
101
|
};
|
|
88
102
|
}
|
|
89
103
|
|
|
90
|
-
export { handler, host };
|
|
91
|
-
//# sourceMappingURL=vercel.js.map
|
|
104
|
+
export { handler, host };
|
|
@@ -8,12 +8,7 @@
|
|
|
8
8
|
* appServer({ host: node() });
|
|
9
9
|
*/
|
|
10
10
|
function node() {
|
|
11
|
-
return {
|
|
12
|
-
name: "node",
|
|
13
|
-
runtimeModule: "@ngrok/app-server/node",
|
|
14
|
-
entryFileName: "app-server.js"
|
|
15
|
-
};
|
|
11
|
+
return { runtimeModule: "@ngrok/app-server/node" };
|
|
16
12
|
}
|
|
17
13
|
|
|
18
|
-
export { node as t };
|
|
19
|
-
//# sourceMappingURL=vite-D4hfj3ph.js.map
|
|
14
|
+
export { node as t };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { t as CONTENT_TYPES } from "./content-types-Le-5BNEC.js";
|
|
2
|
+
|
|
1
3
|
// src/react-router/vite.ts
|
|
2
4
|
/**
|
|
3
5
|
* The build side of the React Router adapter. `appServer` uses it when the
|
|
@@ -8,15 +10,11 @@
|
|
|
8
10
|
*/
|
|
9
11
|
function reactRouterAdapter() {
|
|
10
12
|
return {
|
|
11
|
-
name: "react-router",
|
|
12
13
|
serverModule: "virtual:react-router/server-build",
|
|
13
14
|
runtimeModule: "@ngrok/app-server/react-router",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (config.base !== "/") throw new Error(`@ngrok/app-server serves a build at "/" only, and this config has the base "${config.base}".`);
|
|
17
|
-
}
|
|
15
|
+
contentTypes: CONTENT_TYPES,
|
|
16
|
+
isPrerenderPass: () => process.env.IS_RR_BUILD_REQUEST === "yes"
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
export { reactRouterAdapter as t };
|
|
22
|
-
//# sourceMappingURL=vite-B-GfswoH.js.map
|
|
20
|
+
export { reactRouterAdapter as t };
|
|
@@ -10,16 +10,11 @@
|
|
|
10
10
|
*/
|
|
11
11
|
function tanstackStartAdapter() {
|
|
12
12
|
return {
|
|
13
|
-
name: "tanstack-start",
|
|
14
13
|
serverModule: "virtual:tanstack-start-server-entry",
|
|
15
14
|
runtimeModule: "@ngrok/app-server/tanstack-start",
|
|
16
15
|
runtimeOptions: "{ serverFnBase: process.env.TSS_SERVER_FN_BASE }",
|
|
17
|
-
isPrerenderPass: () => process.env.TSS_PRERENDERING === "true"
|
|
18
|
-
validate: (config) => {
|
|
19
|
-
if (config.base !== "/") throw new Error(`@ngrok/app-server serves a build at "/" only, and this config has the base "${config.base}".`);
|
|
20
|
-
}
|
|
16
|
+
isPrerenderPass: () => process.env.TSS_PRERENDERING === "true"
|
|
21
17
|
};
|
|
22
18
|
}
|
|
23
19
|
|
|
24
|
-
export { tanstackStartAdapter as t };
|
|
25
|
-
//# sourceMappingURL=vite-DyrhyKEr.js.map
|
|
20
|
+
export { tanstackStartAdapter as t };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { AppServerOptions, FrameworkBuild, HostBuild, HostOutput,
|
|
1
|
+
import { a as appServer, i as HostOutput, n as FrameworkBuild, r as HostBuild, t as AppServerOptions } from "./index-gzGs53Ue.js";
|
|
2
|
+
export { AppServerOptions, FrameworkBuild, HostBuild, HostOutput, appServer };
|