@ngrok/app-server 0.4.0 → 0.4.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 +3 -3
- package/dist/cli.js +3 -3
- package/dist/client.js +1 -1
- package/dist/{create-server-C63luLkn.js → create-server-Bp1yILQk.js} +4 -4
- package/dist/{create-server-C63luLkn.js.map → create-server-Bp1yILQk.js.map} +1 -1
- package/dist/{create-server-DKJ0wASH.d.ts → create-server-X2GR-U6t.d.ts} +3 -3
- package/dist/{entry-BSbsQ_kq.js → entry-BoxCqc6w.js} +3 -3
- package/dist/{entry-BSbsQ_kq.js.map → entry-BoxCqc6w.js.map} +1 -1
- package/dist/{entry-C9bBcYeP.d.ts → entry-DZTCaL3d.d.ts} +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +5 -5
- package/dist/{load-entry-DgZyPtoD.js → load-entry-CCPWbsrj.js} +4 -4
- package/dist/{load-entry-DgZyPtoD.js.map → load-entry-CCPWbsrj.js.map} +1 -1
- package/dist/{log-CW_g1pWk.js → log-DQAS5gGT.js} +14 -4
- package/dist/{log-CW_g1pWk.js.map → log-DQAS5gGT.js.map} +1 -1
- package/dist/{node-DiMwdTOC.js → node-CVVdk2N6.js} +3 -3
- package/dist/{node-DiMwdTOC.js.map → node-CVVdk2N6.js.map} +1 -1
- package/dist/{node-DBwgrye_.js → node-D6m6e6EI.js} +2 -2
- package/dist/{node-DBwgrye_.js.map → node-D6m6e6EI.js.map} +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/react-router.d.ts +1 -1
- package/dist/react-router.js +1 -1
- package/dist/{request-context-BdAH1D-2.js → request-context-Bxdbk5P1.js} +2 -2
- package/dist/{request-context-BdAH1D-2.js.map → request-context-Bxdbk5P1.js.map} +1 -1
- package/dist/{response-edge-7eUl2ewl.js → response-edge-CU8ZvL_F.js} +2 -2
- package/dist/{response-edge-7eUl2ewl.js.map → response-edge-CU8ZvL_F.js.map} +1 -1
- package/dist/{response-writer-CLtCseu5.js → response-writer-D7KHfr8n.js} +2 -2
- package/dist/{response-writer-CLtCseu5.js.map → response-writer-D7KHfr8n.js.map} +1 -1
- package/dist/{serve-DCaIBTM-.js → serve-W4WacdOw.js} +2 -2
- package/dist/{serve-DCaIBTM-.js.map → serve-W4WacdOw.js.map} +1 -1
- package/dist/{start-D2IVWkow.js → start-j0VlxeiI.js} +6 -6
- package/dist/{start-D2IVWkow.js.map → start-j0VlxeiI.js.map} +1 -1
- package/dist/tanstack-start.d.ts +2 -2
- package/dist/tanstack-start.js +1 -1
- package/dist/{tcp-B8aFGQRB.js → tcp-BgDXbjOG.js} +2 -2
- package/dist/{tcp-B8aFGQRB.js.map → tcp-BgDXbjOG.js.map} +1 -1
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +4 -4
- package/dist/{trailing-slash-D_52DJaQ.d.ts → trailing-slash-D2QWKWEu.d.ts} +2 -2
- package/dist/{types-C_I3i62n.d.ts → types-MgFtkNQW.d.ts} +6 -3
- package/dist/vercel.d.ts +2 -2
- package/dist/vercel.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -762,7 +762,7 @@ createServer({
|
|
|
762
762
|
|
|
763
763
|
The default is `jsonSink()`: one JSON object per line on standard output (stdout). It writes the lines of one event-loop turn in one write, at the end of the turn. Each line still reaches stdout before the process exits, and before the vercel handler returns. `jsonSink()` writes a bigint as a string, such as `"1n"`, and a cycle as `"[Circular]"`. A line whose attributes have no JSON, such as a value whose `toJSON` throws, goes out with `log.error` in place of its attributes, so `jsonSink()` never throws for its attributes. Like `JSON.stringify`, it writes a `Map` or a `Set` as `{}`, so convert it first, such as with `Object.fromEntries(map)`.
|
|
764
764
|
|
|
765
|
-
In server code, `logger()` gives the logger of the request that runs. Its lines carry the request ID, method, and path
|
|
765
|
+
In server code, `logger()` gives the logger of the request that runs. Its lines carry the request ID, method, and path as `http.request_id`, `http.method`, and `http.url_details.path`, and these fields win over a field of the same name that you give. Outside a request, such as at module load or in a prerender pass, `logger()` writes to the sink and hooks of the last `createServer` call, else to `jsonSink()`:
|
|
766
766
|
|
|
767
767
|
```ts
|
|
768
768
|
import { logger } from "@ngrok/app-server";
|
|
@@ -772,14 +772,14 @@ export async function loader() {
|
|
|
772
772
|
}
|
|
773
773
|
```
|
|
774
774
|
|
|
775
|
-
An attribute whose value is an `Error` becomes dotted fields under its name: `kind`, `message`, `stack`, each own field
|
|
775
|
+
An attribute whose value is an `Error` becomes dotted fields under its name: `kind`, `message`, `stack`, each own field other than `kind`, such as `code`, and the `cause` chain as `<name>.cause.*`. An `AggregateError` adds its members as `<name>.errors`. An error with `toJSON` gives its own fields from it. The server's own error lines, such as `unhandled error`, use the same fields:
|
|
776
776
|
|
|
777
777
|
```ts
|
|
778
778
|
logger().error("payment failed", { error });
|
|
779
779
|
// {"message":"payment failed","error.kind":"TypeError","error.message":"…","error.stack":"…","error.cause.kind":"Error","error.cause.code":"ECONNRESET",…}
|
|
780
780
|
```
|
|
781
781
|
|
|
782
|
-
The `log` option changes each line of the server and of `logger()` before it goes to the sink. `attributes` gets the attributes after the server flattens each error. `error` gets each error, its attribute name, and its default fields, and gives the fields to write:
|
|
782
|
+
The `log` option changes each line of the server and of `logger()` before it goes to the sink. `attributes` gets the attributes after the server flattens each error. `error` gets each error, its attribute name, and its default fields, and gives the fields to write. A field that `error` gives does not replace another attribute of the line, such as `http.method`. `attributes` runs last, so it can change each field:
|
|
783
783
|
|
|
784
784
|
```ts
|
|
785
785
|
createServer({
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as parsePort } from "./tcp-
|
|
2
|
+
import { t as parsePort } from "./tcp-BgDXbjOG.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
5
|
|
|
@@ -42,12 +42,12 @@ try {
|
|
|
42
42
|
if (args?.help === true) process.stdout.write(`${USAGE}\n`);
|
|
43
43
|
else if (args?.command === "start") {
|
|
44
44
|
process.env.NODE_ENV ??= "development";
|
|
45
|
-
const { start } = await import("./start-
|
|
45
|
+
const { start } = await import("./start-j0VlxeiI.js");
|
|
46
46
|
await start();
|
|
47
47
|
} else if (args?.command === "serve") {
|
|
48
48
|
process.env.NODE_ENV ??= "production";
|
|
49
49
|
if (typeof process.setSourceMapsEnabled === "function") process.setSourceMapsEnabled(true);
|
|
50
|
-
const { serve } = await import("./serve-
|
|
50
|
+
const { serve } = await import("./serve-W4WacdOw.js");
|
|
51
51
|
await serve({ buildPath: args.buildPath });
|
|
52
52
|
} else if (args != null) fail(args.command == null ? "Give a command." : `Unknown command: ${args.command}.`);
|
|
53
53
|
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as requestContext } from "./request-context-
|
|
1
|
+
import { r as requestContext } from "./request-context-Bxdbk5P1.js";
|
|
2
2
|
import { n as staleBuildTanStack, r as documentNonce, t as staleBuildReactRouter } from "./stale-build-navigation-rg5xxmTr.js";
|
|
3
3
|
|
|
4
4
|
// src/client/csp-nonce.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as requestLogger, i as jsonSink, r as hookSink, t as asError } from "./log-
|
|
2
|
-
import { a as setProcessSink, o as withRequestContext } from "./request-context-
|
|
1
|
+
import { a as requestLogger, i as jsonSink, r as hookSink, t as asError } from "./log-DQAS5gGT.js";
|
|
2
|
+
import { a as setProcessSink, o as withRequestContext } from "./request-context-Bxdbk5P1.js";
|
|
3
3
|
import { a as replaceResponse, o as withHeaderHook, r as hookedHeaders, s as writableHeaders } from "./header-hook-Vzw9J9BY.js";
|
|
4
4
|
import { c as presenceHeaders, l as presenceHeadersOf, o as checkOptionPlugins, r as buildId, s as optionPlugin } from "./build-id-B0448vZH.js";
|
|
5
|
-
import { n as finishResponse, r as onResponseSent } from "./response-edge-
|
|
5
|
+
import { n as finishResponse, r as onResponseSent } from "./response-edge-CU8ZvL_F.js";
|
|
6
6
|
import { r as manifestKey } from "./build-manifest-DBMWe3Lx.js";
|
|
7
7
|
import { a as isCompressible, i as forbidsTransform, n as MIN_COMPRESS_BYTES, o as preferredEncoding, s as readIfQueued } from "./compression-CT2mWlKM.js";
|
|
8
8
|
import { i as isFilePath$1, n as findStaticFile, o as staticResponse, s as withVary, t as contentType } from "./static-files-C2ea8KQ6.js";
|
|
@@ -1528,4 +1528,4 @@ function serverInternals(app) {
|
|
|
1528
1528
|
}
|
|
1529
1529
|
|
|
1530
1530
|
export { assets as _, streamingCompress as a, prefersMarkdown as b, securityHeaders as c, noindex as d, health as f, accessLog as g, bodyLimit as h, withForwardedProto as i, redirects as l, shutdownSignal as m, defaultPlugins as n, requestId as o, abortShutdownSignal as p, serverInternals as r, contentSecurityPolicy as s, createServer as t, privateDocuments as u, prerendered as v, trailingSlash as y };
|
|
1531
|
-
//# sourceMappingURL=create-server-
|
|
1531
|
+
//# sourceMappingURL=create-server-Bp1yILQk.js.map
|