@ngrok/app-server 0.1.0 → 0.2.0

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.
Files changed (70) hide show
  1. package/README.md +77 -22
  2. package/dist/build-manifest-8NfD1wnO.js +45 -0
  3. package/dist/build-manifest-8NfD1wnO.js.map +1 -0
  4. package/dist/{bun-DCGnDEPn.js → bun-BCz6K_Xv.js} +12 -8
  5. package/dist/bun-BCz6K_Xv.js.map +1 -0
  6. package/dist/cli.js +15 -13
  7. package/dist/cli.js.map +1 -1
  8. package/dist/{deno-BnMfk2n1.js → deno-DNRgzHrk.js} +4 -4
  9. package/dist/deno-DNRgzHrk.js.map +1 -0
  10. package/dist/{entry-2XXp2Ukh.js → entry-BkdUub2S.js} +179 -334
  11. package/dist/entry-BkdUub2S.js.map +1 -0
  12. package/dist/index-oSE-tYRW.d.ts +88 -0
  13. package/dist/index.d.ts +212 -27
  14. package/dist/index.js +26 -14
  15. package/dist/index.js.map +1 -1
  16. package/dist/{listen-options-DHWmSWGi.js → listen-options-7TaXjyrk.js} +2 -2
  17. package/dist/listen-options-7TaXjyrk.js.map +1 -0
  18. package/dist/load-entry-C03qqmhr.js +33 -0
  19. package/dist/load-entry-C03qqmhr.js.map +1 -0
  20. package/dist/log-CsjaKM8U.js +59 -0
  21. package/dist/log-CsjaKM8U.js.map +1 -0
  22. package/dist/{node-79my3Uix.js → node-CG7qXuWZ.js} +4 -4
  23. package/dist/node-CG7qXuWZ.js.map +1 -0
  24. package/dist/node-YWPGmzAk.js +215 -0
  25. package/dist/node-YWPGmzAk.js.map +1 -0
  26. package/dist/node-ZMowKZDB.js +3 -0
  27. package/dist/node-vite.d.ts +10 -0
  28. package/dist/node-vite.js +18 -0
  29. package/dist/node-vite.js.map +1 -0
  30. package/dist/node.d.ts +67 -0
  31. package/dist/node.js +4 -0
  32. package/dist/react-router-vite.d.ts +9 -0
  33. package/dist/react-router-vite.js +21 -0
  34. package/dist/react-router-vite.js.map +1 -0
  35. package/dist/react-router.d.ts +11 -24
  36. package/dist/react-router.js +15 -25
  37. package/dist/react-router.js.map +1 -1
  38. package/dist/serve-Cleo8RMO.js +29 -0
  39. package/dist/serve-Cleo8RMO.js.map +1 -0
  40. package/dist/start-CINALHxy.js +230 -0
  41. package/dist/start-CINALHxy.js.map +1 -0
  42. package/dist/tanstack-start-vite.d.ts +11 -0
  43. package/dist/tanstack-start-vite.js +24 -0
  44. package/dist/tanstack-start-vite.js.map +1 -0
  45. package/dist/tanstack-start.d.ts +17 -0
  46. package/dist/tanstack-start.js +50 -0
  47. package/dist/tanstack-start.js.map +1 -0
  48. package/dist/tcp-C-9AmFuM.js +41 -0
  49. package/dist/tcp-C-9AmFuM.js.map +1 -0
  50. package/dist/types-BfCkS7kQ.d.ts +203 -0
  51. package/dist/vite-mYZ2Y69u.js +144 -0
  52. package/dist/vite-mYZ2Y69u.js.map +1 -0
  53. package/dist/vite.d.ts +2 -27
  54. package/dist/vite.js +2 -2
  55. package/package.json +28 -2
  56. package/dist/bun-DCGnDEPn.js.map +0 -1
  57. package/dist/captured-headers-ewL_t3MQ.js +0 -48
  58. package/dist/captured-headers-ewL_t3MQ.js.map +0 -1
  59. package/dist/deno-BnMfk2n1.js.map +0 -1
  60. package/dist/dev-DCytOhpM.js +0 -132
  61. package/dist/dev-DCytOhpM.js.map +0 -1
  62. package/dist/entry-2XXp2Ukh.js.map +0 -1
  63. package/dist/entry-CIpwaayZ.d.ts +0 -293
  64. package/dist/listen-options-DHWmSWGi.js.map +0 -1
  65. package/dist/node-2wWBMFeO.js +0 -3
  66. package/dist/node-79my3Uix.js.map +0 -1
  67. package/dist/start-kxw_NM4q.js +0 -16
  68. package/dist/start-kxw_NM4q.js.map +0 -1
  69. package/dist/vite-CrNqpoeK.js +0 -102
  70. package/dist/vite-CrNqpoeK.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ngrok/app-server
2
2
 
3
- A composable [Hono](https://hono.dev) app server for [React Router](https://reactrouter.com) framework apps. It replaces `@react-router/serve`, and it runs the same request pipeline in development and production, on Node, Bun, and Deno.
3
+ A composable [Hono](https://hono.dev) app server for [React Router](https://reactrouter.com) and [TanStack Start](https://tanstack.com/start) apps. It replaces `@react-router/serve`, and it runs the same request pipeline in development and production, on Node, Bun, and Deno.
4
4
 
5
5
  What it fixes in `@react-router/serve`:
6
6
 
@@ -13,7 +13,9 @@ What it fixes in `@react-router/serve`:
13
13
  ## Requirements
14
14
 
15
15
  - Node.js 24+, Bun 1.3+, or Deno 2.9+
16
- - React Router 8.5+ and Vite 8.3+
16
+ - Vite 8.3+
17
+ - React Router 8.5+, or TanStack Start 1.169+
18
+ - An ES module app and server build. The package has no CommonJS build, and the Vite plugin refuses a CommonJS server build.
17
19
 
18
20
  ## Install
19
21
 
@@ -23,16 +25,49 @@ pnpm add -E @ngrok/app-server hono
23
25
 
24
26
  ## Set up
25
27
 
26
- Add the Vite plugin next to `reactRouter()`:
28
+ The server has three layers:
29
+
30
+ - The core: the request pipeline, the plugins, and `createServer`. It imports Hono and nothing else.
31
+ - A framework adapter: how the framework renders a request. `react-router` and `tanstack-start` come with the package.
32
+ - A host adapter: where the server runs. `node` comes with the package. It runs one long-lived process on Node, Bun, or Deno, such as in a Docker image.
33
+
34
+ Each adapter has a build side, which the Vite config imports, and a run side, which the server build imports.
35
+
36
+ Add the Vite plugin next to the framework's plugin. For React Router:
27
37
 
28
38
  ```ts
29
39
  // vite.config.ts
30
- import { serverEntry } from "@ngrok/app-server/vite";
40
+ import { appServer } from "@ngrok/app-server/vite";
41
+ import { node } from "@ngrok/app-server/node/vite";
42
+ import { reactRouterAdapter } from "@ngrok/app-server/react-router/vite";
31
43
  import { reactRouter } from "@react-router/dev/vite";
32
44
  import { defineConfig } from "vite";
33
45
 
34
46
  export default defineConfig({
35
- plugins: [reactRouter(), serverEntry("./server.ts")],
47
+ plugins: [
48
+ reactRouter(),
49
+ appServer({ framework: reactRouterAdapter(), host: node(), app: "./server.ts" }),
50
+ ],
51
+ });
52
+ ```
53
+
54
+ For TanStack Start:
55
+
56
+ ```ts
57
+ // vite.config.ts
58
+ import { appServer } from "@ngrok/app-server/vite";
59
+ import { node } from "@ngrok/app-server/node/vite";
60
+ import { tanstackStartAdapter } from "@ngrok/app-server/tanstack-start/vite";
61
+ import { tanstackStart } from "@tanstack/react-start/plugin/vite";
62
+ import viteReact from "@vitejs/plugin-react";
63
+ import { defineConfig } from "vite";
64
+
65
+ export default defineConfig({
66
+ plugins: [
67
+ tanstackStart(),
68
+ viteReact(),
69
+ appServer({ framework: tanstackStartAdapter(), host: node(), app: "./server.ts" }),
70
+ ],
36
71
  });
37
72
  ```
38
73
 
@@ -52,35 +87,35 @@ Run it:
52
87
  ```json
53
88
  {
54
89
  "scripts": {
55
- "start": "app-server dev",
56
- "serve": "app-server start"
90
+ "start": "app-server start",
91
+ "serve": "app-server serve"
57
92
  }
58
93
  }
59
94
  ```
60
95
 
61
- `serverEntry` bundles `server.ts` into `build/server/index.js` with the rest of the app, so the server gets its path aliases and the app's one copy of `react-router`. The file stays a valid React Router server build. `serverEntry()` with no argument uses the default plugins.
96
+ `appServer` adds `server/app-server.js` to the server build, next to the framework's own entry, which does not change. The file bundles `server.ts` with the framework's server module, so the server gets the app's path aliases and its one copy of the framework. With no `app`, the server uses the default plugins.
62
97
 
63
98
  The build exports `appServer`, and the CLI calls it. So the copy of this package in the build runs the server, and the CLI's copy runs nothing. The CLI refuses a build from a version of this package with another entry protocol.
64
99
 
65
- An app with no `serverEntry` also works: `app-server start` reads a plain React Router build and runs it with the CLI's copy and the default plugins. In that build, a route that calls `shutdownSignal()` or `eventStream()` must import the CLI's copy, so do not bundle `@ngrok/app-server` into it.
100
+ A React Router app with no Vite plugin also works: `app-server serve build/server/index.js` reads a plain React Router build and runs it with the CLI's copy, the node host, and the default plugins. In that build, a route that calls `shutdownSignal()`, `eventStream()`, or `requestContext()` must import the CLI's copy, so do not bundle `@ngrok/app-server` into it.
66
101
 
67
102
  ## Commands
68
103
 
69
- - `app-server dev`: Vite in middleware mode inside the pipeline, with HMR on the same port. Each request loads the latest server build, so an edit to a route or to `server.ts` applies at once. The port is `PORT`, else Vite's `server.port`. The host is `HOST`, else Vite's `server.host`.
70
- - `app-server start [build/server/index.js]`: production. Reads `PORT` (default 3000) and `HOST` (default every interface). Stops on `SIGTERM` or `SIGINT`.
104
+ - `app-server start`: development. Vite in middleware mode inside the pipeline, with HMR on the same port. It needs the `appServer` plugin. Each request loads the latest server entry, so an edit to a route or to `server.ts` applies at once. The port is `--port`, else `PORT`, else Vite's `server.port`. When that port is in use, `start` tries each next port, unless Vite's `server.strictPort` is true. The host is `HOST`, else Vite's `server.host`. On `SIGTERM` or `SIGINT`, it stops Vite and the server, then exits.
105
+ - `app-server serve [path]`: production. With no path, it runs the first of `build/server/app-server.js` (React Router), `dist/server/app-server.js` (TanStack Start), and `build/server/index.js` (a plain React Router build). The port is `--port`, else `PORT`, else 3000. The host is `HOST`, else every interface. A port in use stops startup at once. On `SIGTERM` or `SIGINT`, it drains, then exits, even when the app left a timer.
71
106
 
72
- On Bun, run `bun node_modules/@ngrok/app-server/dist/cli.js start`. On Deno, run `deno run --allow-net --allow-env --allow-read --allow-sys node_modules/@ngrok/app-server/dist/cli.js start`.
107
+ On Bun, run `bun node_modules/@ngrok/app-server/dist/cli.js serve`. On Deno, run `deno run --allow-net --allow-env --allow-read --allow-sys node_modules/@ngrok/app-server/dist/cli.js serve`. For `start` on Deno, also give `--allow-ffi --allow-write --ignore-read=/proc/sys/fs/binfmt_misc/WSLInterop`. Vite loads its native bundler and writes its cache. On Linux, Vite also reads a WSL file that Deno gives only to `--allow-all`.
73
108
 
74
109
  ## The pipeline
75
110
 
76
- `createServer` runs the plugins in list order, then the app's own Hono routes, then React Router. `defaultPlugins()` returns this order:
111
+ `createServer` runs the plugins in list order, then the app's own Hono routes, then the framework. `defaultPlugins()` returns this order:
77
112
 
78
113
  1. `requestId()`: reuses a valid incoming `X-Request-Id`, else makes a UUID, and echoes it.
79
114
  2. `accessLog({ redactQuery })`: one line per request when the body ends, with Datadog standard attributes (`http.status_code`, `network.bytes_written`, `duration` in nanoseconds). Query values are `REDACTED` by default.
80
- 3. `streamingCompress()`: gzip that flushes after each chunk. It skips encoded, partial, and `no-transform` responses.
115
+ 3. `streamingCompress()`: gzip that flushes after each chunk. It skips encoded, partial, and `no-transform` responses. The host gives the gzip stream. On a host with none, the plugin does nothing.
81
116
  4. The `beforeStatic` plugins: they see every response, prerendered pages included. `runtimeEnv` and `buildId` go here.
82
117
  5. `assets()`: `/assets/*` with a one-year immutable cache. A missing asset gets a plain 404. In development, Vite serves here.
83
- 6. `prerendered({ headers, rewrite })`: every file in `build/client`, with an ETag and a 304 for a matching `If-None-Match`. A directory answers with its `index.html`. Each file has one URL: `/a//b`, `/a/index.html`, and `/a%2Fb` go on to React Router. Dotfiles stay private, except `/.well-known/`. A path with no file goes on to React Router.
118
+ 6. `prerendered({ headers, rewrite })`: every file in the client build, with an ETag and a 304 for a matching `If-None-Match`. A directory answers with its `index.html`. Each file has one URL: `/a//b`, `/a/index.html`, and `/a%2Fb` go on to the framework. Dotfiles stay private, except `/.well-known/`. A path with no file goes on to the framework.
84
119
 
85
120
  `defaultPlugins()` is a plain array, so you can filter it or splice into it. A plugin is Hono middleware plus optional hooks:
86
121
 
@@ -153,9 +188,9 @@ Parse the `Accept` quality values when a client can send `text/markdown;q=0`.
153
188
 
154
189
  ## Prerendered headers
155
190
 
156
- During React Router's prerender pass, `serverEntry` records the response headers of each prerendered file that is not an HTML document into `build/client/.headers.json`, and `prerendered()` replays them. It leaves out `Set-Cookie`, `Vary`, and the headers of one transfer, such as `Content-Length`.
191
+ During the framework's prerender pass, `appServer` records each prerendered path and the response headers of each prerendered file that is not an HTML document into `.app-server.json` in the client build. `prerendered()` replays the headers. It leaves out `Set-Cookie`, `Vary`, and the headers of one transfer, such as `Content-Length`. When the framework does not list its prerendered paths, as with TanStack Start, the server reads them from this file.
157
192
 
158
- A document's headers are not recorded, because `entry.server` sets them for each request (a CSP nonce, the host). Set the headers of a prerendered page with the `headers` option or a plugin. For its CSP, use a `script-src` with the hash of each inline script, not a nonce. The prerender writes one nonce into the file, and every visitor can read it, so it protects nothing.
193
+ A document's headers are not recorded, because the framework sets them for each request (a CSP nonce, the host). Set the headers of a prerendered page with the `headers` option or a plugin. For its CSP, use a `script-src` with the hash of each inline script, not a nonce. The prerender writes one nonce into the file, and every visitor can read it, so it protects nothing.
159
194
 
160
195
  ## Logs
161
196
 
@@ -171,7 +206,17 @@ createServer({
171
206
 
172
207
  The default is `jsonSink()`: one JSON object per line on stdout.
173
208
 
174
- In a loader, read the request ID and a logger whose lines carry it:
209
+ In server code, read the request ID and a logger whose lines carry it. `requestContext()` works with each framework. It gives `undefined` outside a server request, such as in a prerender pass:
210
+
211
+ ```ts
212
+ import { requestContext } from "@ngrok/app-server";
213
+
214
+ export async function loader() {
215
+ requestContext()?.logger.info("loading");
216
+ }
217
+ ```
218
+
219
+ React Router also gets the values in its context, and TanStack Start gets them as `context.appServer` in its request context:
175
220
 
176
221
  ```ts
177
222
  import { appServerContext } from "@ngrok/app-server/react-router";
@@ -220,18 +265,28 @@ export async function loader({ request }: Route.LoaderArgs) {
220
265
 
221
266
  For other long work, stop on `shutdownSignal()`.
222
267
 
268
+ ## Adapters
269
+
270
+ A framework adapter or a host adapter is two small objects. A third-party adapter uses the same contract.
271
+
272
+ - `FrameworkBuild` (from `@ngrok/app-server/vite`): the framework's server module, the module of the run side, how to detect the prerender pass, and a check of the Vite config.
273
+ - `FrameworkRuntime` (from `@ngrok/app-server`): `fetch(request, context)`, plus, when the framework has them, its client build, its prerendered paths, its data requests, and the content types that `mime` lacks. The run-side module exports `runtime(serverModule, { mode })`.
274
+ - `HostBuild` (from `@ngrok/app-server/vite`): the module of the run side and the file name of the server entry.
275
+ - `HostRuntime` (from `@ngrok/app-server`): the client build's files, the default listeners, request storage for `requestContext()`, a gzip stream, and a lifecycle for a long-lived process. The run-side module exports `host`.
276
+
223
277
  ## Options
224
278
 
225
279
  `createServer` takes:
226
280
 
227
281
  - `plugins`: default `defaultPlugins()`.
228
282
  - `logger`: default `jsonSink()`.
229
- - `listeners`: default `[tcp()]`. A listener decides how connections arrive. `tcp()` uses `node:http`, `Bun.serve`, or `Deno.serve`.
230
- - `trustForwardedProto`: read the scheme from `X-Forwarded-Proto`. Set it only behind a proxy that overwrites the header. Default `false`. For a build with no `server.ts`, set `TRUST_FORWARDED_PROTO=1`.
283
+ - `listeners`: default the host's listeners. A listener decides how connections arrive. On the node host, the default is `[tcp()]` from `@ngrok/app-server/node`. `tcp()` uses `node:http`, `Bun.serve`, or `Deno.serve`.
284
+ - `trustForwardedProto`: read the scheme from `X-Forwarded-Proto`. Set it only behind a proxy that overwrites the header. Default `false`. For a build with no `server.ts`, set `TRUST_FORWARDED_PROTO=1`. TanStack Start compares a server function call's `Origin` with the request URL when the browser sends no `Sec-Fetch-Site`, so set this option behind a proxy that ends TLS.
231
285
  - `shutdownDeadlineMs`: default `10000`.
232
286
 
233
287
  ## Limits
234
288
 
235
- - The build must serve at `/` (React Router `publicPath`).
236
- - `serverEntry` does not support React Router `serverBundles`.
289
+ - The build must serve at `/` (Vite `base`). The Vite plugin fails the build for another base.
290
+ - `appServer` does not support React Router `serverBundles`.
291
+ - The package has one host adapter, `node`. A serverless host, such as Cloudflare Workers or Vercel, needs its own adapter. See `HostRuntime` and `HostBuild`.
237
292
  - On Deno, `Deno.serve` logs a notice about its legacy `request.signal` behavior.
@@ -0,0 +1,45 @@
1
+ // src/core/build-manifest.ts
2
+ /**
3
+ * The file under the client build that the Vite plugin writes during the
4
+ * prerender pass. It is a dotfile, so the static stages never serve it.
5
+ */
6
+ const BUILD_MANIFEST_FILE = ".app-server.json";
7
+ /**
8
+ * The key for a URL path in {@link BuildManifest}: the path with no trailing
9
+ * slash, so `/a/` and `/a` share headers. The root stays `/`.
10
+ *
11
+ * @example
12
+ * manifestKey("/components/button/"); // => "/components/button"
13
+ */
14
+ function manifestKey(pathname) {
15
+ const trimmed = pathname.replace(/\/+$/u, "");
16
+ return trimmed === "" ? "/" : trimmed;
17
+ }
18
+ function isStringRecord(value) {
19
+ return typeof value === "object" && value != null && !Array.isArray(value) && Object.values(value).every((entry) => typeof entry === "string");
20
+ }
21
+ /**
22
+ * Reads the build manifest of a client build. A build with no file has an
23
+ * empty one. A file in any other shape throws, so a bad build stops startup.
24
+ */
25
+ async function readBuildManifest(files) {
26
+ const path = `/${BUILD_MANIFEST_FILE}`;
27
+ if ((await files.stat(path))?.kind !== "file") return {
28
+ prerendered: [],
29
+ headers: {}
30
+ };
31
+ const parsed = await new Response(await files.open(path)).json();
32
+ if (typeof parsed !== "object" || parsed == null || !("prerendered" in parsed) || !Array.isArray(parsed.prerendered) || !parsed.prerendered.every((entry) => typeof entry === "string") || !("headers" in parsed) || typeof parsed.headers !== "object" || parsed.headers == null) throw new Error(`${BUILD_MANIFEST_FILE} must hold a "prerendered" list and a "headers" object.`);
33
+ const headers = {};
34
+ for (const [key, value] of Object.entries(parsed.headers)) {
35
+ if (!isStringRecord(value)) throw new Error(`${BUILD_MANIFEST_FILE}: the headers for ${key} must be strings.`);
36
+ headers[key] = value;
37
+ }
38
+ return {
39
+ prerendered: parsed.prerendered,
40
+ headers
41
+ };
42
+ }
43
+
44
+ export { manifestKey as n, readBuildManifest as r, BUILD_MANIFEST_FILE as t };
45
+ //# sourceMappingURL=build-manifest-8NfD1wnO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-manifest-8NfD1wnO.js","names":[],"sources":["../src/core/build-manifest.ts"],"sourcesContent":["import type { StaticFiles } from \"./types.js\";\n\n/**\n * The file under the client build that the Vite plugin writes during the\n * prerender pass. It is a dotfile, so the static stages never serve it.\n */\nexport const BUILD_MANIFEST_FILE = \".app-server.json\";\n\n/** What the Vite plugin records during the prerender pass. */\nexport type BuildManifest = {\n\t/** The URL paths that answered with a 2xx, sorted. */\n\tprerendered: string[];\n\t/** The headers of each prerendered file that is not an HTML document, by URL path. */\n\theaders: Record<string, Record<string, string>>;\n};\n\n/**\n * The key for a URL path in {@link BuildManifest}: the path with no trailing\n * slash, so `/a/` and `/a` share headers. The root stays `/`.\n *\n * @example\n * manifestKey(\"/components/button/\"); // => \"/components/button\"\n */\nexport function manifestKey(pathname: string): string {\n\tconst trimmed = pathname.replace(/\\/+$/u, \"\");\n\treturn trimmed === \"\" ? \"/\" : trimmed;\n}\n\nfunction isStringRecord(value: unknown): value is Record<string, string> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue != null &&\n\t\t!Array.isArray(value) &&\n\t\tObject.values(value).every((entry) => typeof entry === \"string\")\n\t);\n}\n\n/**\n * Reads the build manifest of a client build. A build with no file has an\n * empty one. A file in any other shape throws, so a bad build stops startup.\n */\nexport async function readBuildManifest(files: StaticFiles): Promise<BuildManifest> {\n\tconst path = `/${BUILD_MANIFEST_FILE}`;\n\tif ((await files.stat(path))?.kind !== \"file\") {\n\t\treturn { prerendered: [], headers: {} };\n\t}\n\tconst parsed: unknown = await new Response(await files.open(path)).json();\n\tif (\n\t\ttypeof parsed !== \"object\" ||\n\t\tparsed == null ||\n\t\t!(\"prerendered\" in parsed) ||\n\t\t!Array.isArray(parsed.prerendered) ||\n\t\t!parsed.prerendered.every((entry) => typeof entry === \"string\") ||\n\t\t!(\"headers\" in parsed) ||\n\t\ttypeof parsed.headers !== \"object\" ||\n\t\tparsed.headers == null\n\t) {\n\t\tthrow new Error(\n\t\t\t`${BUILD_MANIFEST_FILE} must hold a \"prerendered\" list and a \"headers\" object.`,\n\t\t);\n\t}\n\tconst headers: Record<string, Record<string, string>> = {};\n\tfor (const [key, value] of Object.entries(parsed.headers)) {\n\t\tif (!isStringRecord(value)) {\n\t\t\tthrow new Error(`${BUILD_MANIFEST_FILE}: the headers for ${key} must be strings.`);\n\t\t}\n\t\theaders[key] = value;\n\t}\n\treturn { prerendered: parsed.prerendered, headers };\n}\n"],"mappings":";;;;;AAMA,MAAa,sBAAsB;;;;;;;;AAiBnC,SAAgB,YAAY,UAA0B;CACrD,MAAM,UAAU,SAAS,QAAQ,SAAS,EAAE;CAC5C,OAAO,YAAY,KAAK,MAAM;AAC/B;AAEA,SAAS,eAAe,OAAiD;CACxE,OACC,OAAO,UAAU,YACjB,SAAS,QACT,CAAC,MAAM,QAAQ,KAAK,KACpB,OAAO,OAAO,KAAK,CAAC,CAAC,OAAO,UAAU,OAAO,UAAU,QAAQ;AAEjE;;;;;AAMA,eAAsB,kBAAkB,OAA4C;CACnF,MAAM,OAAO,IAAI;CACjB,KAAK,MAAM,MAAM,KAAK,IAAI,EAAC,EAAG,SAAS,QACtC,OAAO;EAAE,aAAa,CAAC;EAAG,SAAS,CAAC;CAAE;CAEvC,MAAM,SAAkB,MAAM,IAAI,SAAS,MAAM,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK;CACxE,IACC,OAAO,WAAW,YAClB,UAAU,QACV,EAAE,iBAAiB,WACnB,CAAC,MAAM,QAAQ,OAAO,WAAW,KACjC,CAAC,OAAO,YAAY,OAAO,UAAU,OAAO,UAAU,QAAQ,KAC9D,EAAE,aAAa,WACf,OAAO,OAAO,YAAY,YAC1B,OAAO,WAAW,MAElB,MAAM,IAAI,MACT,GAAG,oBAAoB,wDACxB;CAED,MAAM,UAAkD,CAAC;CACzD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,OAAO,GAAG;EAC1D,IAAI,CAAC,eAAe,KAAK,GACxB,MAAM,IAAI,MAAM,GAAG,oBAAoB,oBAAoB,IAAI,kBAAkB;EAElF,QAAQ,OAAO;CAChB;CACA,OAAO;EAAE,aAAa,OAAO;EAAa;CAAQ;AACnD"}
@@ -1,6 +1,6 @@
1
- import { t as listenerUrl } from "./listen-options-DHWmSWGi.js";
1
+ import { t as listenerUrl } from "./listen-options-7TaXjyrk.js";
2
2
 
3
- // src/runtimes/bun.ts
3
+ // src/node/runtimes/bun.ts
4
4
  /** Bun's largest `idleTimeout`, in seconds. */
5
5
  const BUN_MAX_IDLE_TIMEOUT_S = 255;
6
6
  /** Listens with `Bun.serve`. */
@@ -9,19 +9,23 @@ async function listen(fetch, options) {
9
9
  port: options.port,
10
10
  ...options.hostname == null ? {} : { hostname: options.hostname },
11
11
  idleTimeout: Math.min(BUN_MAX_IDLE_TIMEOUT_S, Math.ceil(options.idleTimeoutMs / 1e3)),
12
- fetch: (request, bunServer) => fetch(request, { remoteAddress: bunServer.requestIP(request)?.address })
12
+ fetch: async (request, bunServer) => fetch(request, { remoteAddress: bunServer.requestIP(request)?.address })
13
13
  });
14
14
  return {
15
15
  url: listenerUrl(options.hostname, server.port),
16
16
  stop: async ({ deadlineMs }) => {
17
- const deadline = setTimeout(() => {
18
- server.stop(true);
19
- }, deadlineMs);
20
- await server.stop();
17
+ let deadline;
18
+ const deadlinePassed = new Promise((resolve) => {
19
+ deadline = setTimeout(() => {
20
+ server.stop(true);
21
+ resolve();
22
+ }, deadlineMs);
23
+ });
24
+ await Promise.race([server.stop(), deadlinePassed]);
21
25
  clearTimeout(deadline);
22
26
  }
23
27
  };
24
28
  }
25
29
 
26
30
  export { listen };
27
- //# sourceMappingURL=bun-DCGnDEPn.js.map
31
+ //# sourceMappingURL=bun-BCz6K_Xv.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bun-BCz6K_Xv.js","names":[],"sources":["../src/node/runtimes/bun.ts"],"sourcesContent":["import type { FetchHandler, StartedListener } from \"../../core/types.js\";\nimport { listenerUrl } from \"./listen-options.js\";\nimport type { ListenOptions } from \"./listen-options.js\";\n\n/** The part of Bun's server that the listener uses. */\ntype BunServer = {\n\tport: number;\n\trequestIP: (request: Request) => { address: string } | null;\n\tstop: (closeActiveConnections?: boolean) => Promise<void>;\n};\n\n/** The part of the `Bun` global that the listener uses. */\ntype BunGlobal = {\n\tserve: (options: {\n\t\tport: number;\n\t\thostname?: string;\n\t\tidleTimeout: number;\n\t\tfetch: (request: Request, server: BunServer) => Response | Promise<Response>;\n\t}) => BunServer;\n};\n\n/** Bun's largest `idleTimeout`, in seconds. */\nconst BUN_MAX_IDLE_TIMEOUT_S = 255;\n\n/** Listens with `Bun.serve`. */\nexport async function listen(\n\tfetch: FetchHandler,\n\toptions: ListenOptions,\n): Promise<StartedListener> {\n\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- `Bun` is a runtime global with no types in this package.\n\tconst bun = Reflect.get(globalThis, \"Bun\") as BunGlobal;\n\tconst server = bun.serve({\n\t\tport: options.port,\n\t\t...(options.hostname == null ? {} : { hostname: options.hostname }),\n\t\t// Why: Bun's 10 s default also closes a quiet event stream.\n\t\tidleTimeout: Math.min(BUN_MAX_IDLE_TIMEOUT_S, Math.ceil(options.idleTimeoutMs / 1_000)),\n\t\tfetch: async (request, bunServer) =>\n\t\t\tfetch(request, { remoteAddress: bunServer.requestIP(request)?.address }),\n\t});\n\treturn {\n\t\turl: listenerUrl(options.hostname, server.port),\n\t\tstop: async ({ deadlineMs }) => {\n\t\t\tlet deadline: ReturnType<typeof setTimeout> | undefined;\n\t\t\tconst deadlinePassed = new Promise<void>((resolve) => {\n\t\t\t\tdeadline = setTimeout(() => {\n\t\t\t\t\tvoid server.stop(true);\n\t\t\t\t\tresolve();\n\t\t\t\t}, deadlineMs);\n\t\t\t});\n\t\t\t// Why a race: on Bun 1.3, a response body that stays open keeps both stop promises\n\t\t\t// pending, and `stop(true)` leaves its connection open. The exit after shutdown closes it.\n\t\t\tawait Promise.race([server.stop(), deadlinePassed]);\n\t\t\tclearTimeout(deadline);\n\t\t},\n\t};\n}\n"],"mappings":";;;;AAsBA,MAAM,yBAAyB;;AAG/B,eAAsB,OACrB,OACA,SAC2B;CAG3B,MAAM,SADM,QAAQ,IAAI,YAAY,KACnB,CAAC,CAAC,MAAM;EACxB,MAAM,QAAQ;EACd,GAAI,QAAQ,YAAY,OAAO,CAAC,IAAI,EAAE,UAAU,QAAQ,SAAS;EAEjE,aAAa,KAAK,IAAI,wBAAwB,KAAK,KAAK,QAAQ,gBAAgB,GAAK,CAAC;EACtF,OAAO,OAAO,SAAS,cACtB,MAAM,SAAS,EAAE,eAAe,UAAU,UAAU,OAAO,CAAC,EAAE,QAAQ,CAAC;CACzE,CAAC;CACD,OAAO;EACN,KAAK,YAAY,QAAQ,UAAU,OAAO,IAAI;EAC9C,MAAM,OAAO,EAAE,iBAAiB;GAC/B,IAAI;GACJ,MAAM,iBAAiB,IAAI,SAAe,YAAY;IACrD,WAAW,iBAAiB;KAC3B,AAAK,OAAO,KAAK,IAAI;KACrB,QAAQ;IACT,GAAG,UAAU;GACd,CAAC;GAGD,MAAM,QAAQ,KAAK,CAAC,OAAO,KAAK,GAAG,cAAc,CAAC;GAClD,aAAa,QAAQ;EACtB;CACD;AACD"}
package/dist/cli.js CHANGED
@@ -1,27 +1,29 @@
1
1
  #!/usr/bin/env node
2
+ import { t as parsePort } from "./tcp-C-9AmFuM.js";
2
3
  import process from "node:process";
3
4
  import { parseArgs } from "node:util";
4
5
 
5
- // src/cli.ts
6
- const USAGE = "Usage: app-server dev | app-server start [build/server/index.js]";
7
- const { positionals } = parseArgs({
6
+ // src/cli/cli.ts
7
+ const USAGE = "Usage: app-server start [--port <port>] | app-server serve [--port <port>] [build/server/app-server.js]";
8
+ const { positionals, values } = parseArgs({
8
9
  allowPositionals: true,
9
10
  strict: true,
10
- options: {}
11
+ options: { port: { type: "string" } }
11
12
  });
12
- const [command, buildPath = "build/server/index.js"] = positionals;
13
+ const [command, buildPath] = positionals;
14
+ if (values.port != null) process.env.PORT = String(parsePort(values.port));
13
15
  switch (command) {
14
16
  case "start": {
15
- process.env.NODE_ENV ??= "production";
16
- if (typeof process.setSourceMapsEnabled === "function") process.setSourceMapsEnabled(true);
17
- const { start } = await import("./start-kxw_NM4q.js");
18
- await start({ buildPath });
17
+ process.env.NODE_ENV ??= "development";
18
+ const { start } = await import("./start-CINALHxy.js");
19
+ await start();
19
20
  break;
20
21
  }
21
- case "dev": {
22
- process.env.NODE_ENV ??= "development";
23
- const { dev } = await import("./dev-DCytOhpM.js");
24
- await dev();
22
+ case "serve": {
23
+ process.env.NODE_ENV ??= "production";
24
+ if (typeof process.setSourceMapsEnabled === "function") process.setSourceMapsEnabled(true);
25
+ const { serve } = await import("./serve-Cleo8RMO.js");
26
+ await serve({ buildPath });
25
27
  break;
26
28
  }
27
29
  default:
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n// The `app-server` command: `app-server dev` or `app-server start [build/server/index.js]`.\nimport process from \"node:process\";\nimport { parseArgs } from \"node:util\";\n\nconst USAGE = \"Usage: app-server dev | app-server start [build/server/index.js]\";\n\nconst { positionals } = parseArgs({ allowPositionals: true, strict: true, options: {} });\nconst [command, buildPath = \"build/server/index.js\"] = positionals;\n\n// Why dynamic imports: React reads `NODE_ENV` when it loads, and a static import runs first.\nswitch (command) {\n\tcase \"start\": {\n\t\tprocess.env.NODE_ENV ??= \"production\";\n\t\tif (typeof process.setSourceMapsEnabled === \"function\") {\n\t\t\tprocess.setSourceMapsEnabled(true);\n\t\t}\n\t\tconst { start } = await import(\"./start.js\");\n\t\tawait start({ buildPath });\n\t\tbreak;\n\t}\n\tcase \"dev\": {\n\t\tprocess.env.NODE_ENV ??= \"development\";\n\t\tconst { dev } = await import(\"./dev.js\");\n\t\tawait dev();\n\t\tbreak;\n\t}\n\tdefault: {\n\t\tprocess.stderr.write(`${USAGE}\\n`);\n\t\tprocess.exitCode = 1;\n\t}\n}\n"],"mappings":";;;;;AAKA,MAAM,QAAQ;AAEd,MAAM,EAAE,gBAAgB,UAAU;CAAE,kBAAkB;CAAM,QAAQ;CAAM,SAAS,CAAC;AAAE,CAAC;AACvF,MAAM,CAAC,SAAS,YAAY,2BAA2B;AAGvD,QAAQ,SAAR;CACC,KAAK,SAAS;EACb,QAAQ,IAAI,aAAa;EACzB,IAAI,OAAO,QAAQ,yBAAyB,YAC3C,QAAQ,qBAAqB,IAAI;EAElC,MAAM,EAAE,UAAU,MAAM,OAAO;EAC/B,MAAM,MAAM,EAAE,UAAU,CAAC;EACzB;CACD;CACA,KAAK,OAAO;EACX,QAAQ,IAAI,aAAa;EACzB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAC7B,MAAM,IAAI;EACV;CACD;CACA;EACC,QAAQ,OAAO,MAAM,GAAG,MAAM,GAAG;EACjC,QAAQ,WAAW;AAErB"}
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli/cli.ts"],"sourcesContent":["#!/usr/bin/env node\n// The `app-server` command: `app-server start` or `app-server serve [build/server/app-server.js]`,\n// each with an optional `--port`.\nimport process from \"node:process\";\nimport { parseArgs } from \"node:util\";\nimport { parsePort } from \"../node/tcp.js\";\n\nconst USAGE =\n\t\"Usage: app-server start [--port <port>] | app-server serve [--port <port>] [build/server/app-server.js]\";\n\nconst { positionals, values } = parseArgs({\n\tallowPositionals: true,\n\tstrict: true,\n\toptions: { port: { type: \"string\" } },\n});\nconst [command, buildPath] = positionals;\n\n// Why set `PORT`: the copy of this package in the build reads it, so the flag needs no change to\n// the entry protocol.\nif (values.port != null) {\n\tprocess.env.PORT = String(parsePort(values.port));\n}\n\n// Why dynamic imports: React reads `NODE_ENV` when it loads, and a static import runs first.\nswitch (command) {\n\tcase \"start\": {\n\t\tprocess.env.NODE_ENV ??= \"development\";\n\t\tconst { start } = await import(\"./start.js\");\n\t\tawait start();\n\t\tbreak;\n\t}\n\tcase \"serve\": {\n\t\tprocess.env.NODE_ENV ??= \"production\";\n\t\tif (typeof process.setSourceMapsEnabled === \"function\") {\n\t\t\tprocess.setSourceMapsEnabled(true);\n\t\t}\n\t\tconst { serve } = await import(\"./serve.js\");\n\t\tawait serve({ buildPath });\n\t\tbreak;\n\t}\n\tdefault: {\n\t\tprocess.stderr.write(`${USAGE}\\n`);\n\t\tprocess.exitCode = 1;\n\t}\n}\n"],"mappings":";;;;;;AAOA,MAAM,QACL;AAED,MAAM,EAAE,aAAa,WAAW,UAAU;CACzC,kBAAkB;CAClB,QAAQ;CACR,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,EAAE;AACrC,CAAC;AACD,MAAM,CAAC,SAAS,aAAa;AAI7B,IAAI,OAAO,QAAQ,MAClB,QAAQ,IAAI,OAAO,OAAO,UAAU,OAAO,IAAI,CAAC;AAIjD,QAAQ,SAAR;CACC,KAAK,SAAS;EACb,QAAQ,IAAI,aAAa;EACzB,MAAM,EAAE,UAAU,MAAM,OAAO;EAC/B,MAAM,MAAM;EACZ;CACD;CACA,KAAK,SAAS;EACb,QAAQ,IAAI,aAAa;EACzB,IAAI,OAAO,QAAQ,yBAAyB,YAC3C,QAAQ,qBAAqB,IAAI;EAElC,MAAM,EAAE,UAAU,MAAM,OAAO;EAC/B,MAAM,MAAM,EAAE,UAAU,CAAC;EACzB;CACD;CACA;EACC,QAAQ,OAAO,MAAM,GAAG,MAAM,GAAG;EACjC,QAAQ,WAAW;AAErB"}
@@ -1,6 +1,6 @@
1
- import { t as listenerUrl } from "./listen-options-DHWmSWGi.js";
1
+ import { t as listenerUrl } from "./listen-options-7TaXjyrk.js";
2
2
 
3
- // src/runtimes/deno.ts
3
+ // src/node/runtimes/deno.ts
4
4
  /** Wraps a response body so the listener can end it at the deadline. `open` holds its closer while the body is open. */
5
5
  function closableResponse(response, open) {
6
6
  if (response.body == null) return response;
@@ -27,7 +27,7 @@ function closableResponse(response, open) {
27
27
  throw error;
28
28
  }
29
29
  },
30
- cancel(reason) {
30
+ async cancel(reason) {
31
31
  open.delete(force);
32
32
  return reader.cancel(reason);
33
33
  }
@@ -71,4 +71,4 @@ async function listen(fetch, options) {
71
71
  }
72
72
 
73
73
  export { listen };
74
- //# sourceMappingURL=deno-BnMfk2n1.js.map
74
+ //# sourceMappingURL=deno-DNRgzHrk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deno-DNRgzHrk.js","names":[],"sources":["../src/node/runtimes/deno.ts"],"sourcesContent":["import type { FetchHandler, StartedListener } from \"../../core/types.js\";\nimport { listenerUrl } from \"./listen-options.js\";\nimport type { ListenOptions } from \"./listen-options.js\";\n\n/** The part of Deno's server that the listener uses. */\ntype DenoServer = {\n\taddr: { port: number };\n\tshutdown: () => Promise<void>;\n};\n\n/** The part of the `Deno` global that the listener uses. */\ntype DenoGlobal = {\n\tserve: (\n\t\toptions: { port: number; hostname?: string; onListen: () => void },\n\t\thandler: (\n\t\t\trequest: Request,\n\t\t\tinfo: { remoteAddr: { hostname: string } },\n\t\t) => Response | Promise<Response>,\n\t) => DenoServer;\n};\n\n/** Wraps a response body so the listener can end it at the deadline. `open` holds its closer while the body is open. */\nfunction closableResponse(response: Response, open: Set<() => void>): Response {\n\tif (response.body == null) {\n\t\treturn response;\n\t}\n\tconst reader = response.body.getReader();\n\tlet force: () => void;\n\tconst body = new ReadableStream<Uint8Array>({\n\t\tstart(controller) {\n\t\t\tforce = () => {\n\t\t\t\topen.delete(force);\n\t\t\t\tcontroller.error(new Error(\"The shutdown deadline passed.\"));\n\t\t\t\tvoid reader.cancel();\n\t\t\t};\n\t\t\topen.add(force);\n\t\t},\n\t\tasync pull(controller) {\n\t\t\ttry {\n\t\t\t\tconst { done, value } = await reader.read();\n\t\t\t\tif (done) {\n\t\t\t\t\topen.delete(force);\n\t\t\t\t\tcontroller.close();\n\t\t\t\t} else {\n\t\t\t\t\tcontroller.enqueue(value);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\topen.delete(force);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t},\n\t\tasync cancel(reason) {\n\t\t\topen.delete(force);\n\t\t\treturn reader.cancel(reason);\n\t\t},\n\t});\n\treturn new Response(body, response);\n}\n\n/** Listens with `Deno.serve`. */\nexport async function listen(\n\tfetch: FetchHandler,\n\toptions: ListenOptions,\n): Promise<StartedListener> {\n\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- `Deno` is a runtime global with no types in this package.\n\tconst deno = Reflect.get(globalThis, \"Deno\") as DenoGlobal;\n\t// Why: Deno has no forced close, and `shutdown()` waits for each open request. At the\n\t// deadline, the listener answers each pending request with a 503 and ends each open body.\n\tconst open = new Set<() => void>();\n\tconst server = deno.serve(\n\t\t{\n\t\t\tport: options.port,\n\t\t\t...(options.hostname == null ? {} : { hostname: options.hostname }),\n\t\t\t// Why a no-op: the server logs its own startup line.\n\t\t\tonListen: () => {},\n\t\t},\n\t\tasync (request, info) => {\n\t\t\tconst forced = Promise.withResolvers<Response>();\n\t\t\tconst force = () => {\n\t\t\t\topen.delete(force);\n\t\t\t\tforced.resolve(new Response(null, { status: 503 }));\n\t\t\t};\n\t\t\topen.add(force);\n\t\t\tconst answer = (async () => {\n\t\t\t\ttry {\n\t\t\t\t\treturn closableResponse(\n\t\t\t\t\t\tawait fetch(request, { remoteAddress: info.remoteAddr.hostname }),\n\t\t\t\t\t\topen,\n\t\t\t\t\t);\n\t\t\t\t} finally {\n\t\t\t\t\topen.delete(force);\n\t\t\t\t}\n\t\t\t})();\n\t\t\treturn Promise.race([answer, forced.promise]);\n\t\t},\n\t);\n\treturn {\n\t\turl: listenerUrl(options.hostname, server.addr.port),\n\t\tstop: async ({ deadlineMs }) => {\n\t\t\tconst deadline = setTimeout(() => {\n\t\t\t\tfor (const force of open) {\n\t\t\t\t\tforce();\n\t\t\t\t}\n\t\t\t}, deadlineMs);\n\t\t\tawait server.shutdown();\n\t\t\tclearTimeout(deadline);\n\t\t},\n\t};\n}\n"],"mappings":";;;;AAsBA,SAAS,iBAAiB,UAAoB,MAAiC;CAC9E,IAAI,SAAS,QAAQ,MACpB,OAAO;CAER,MAAM,SAAS,SAAS,KAAK,UAAU;CACvC,IAAI;CACJ,MAAM,OAAO,IAAI,eAA2B;EAC3C,MAAM,YAAY;GACjB,cAAc;IACb,KAAK,OAAO,KAAK;IACjB,WAAW,sBAAM,IAAI,MAAM,+BAA+B,CAAC;IAC3D,AAAK,OAAO,OAAO;GACpB;GACA,KAAK,IAAI,KAAK;EACf;EACA,MAAM,KAAK,YAAY;GACtB,IAAI;IACH,MAAM,EAAE,MAAM,UAAU,MAAM,OAAO,KAAK;IAC1C,IAAI,MAAM;KACT,KAAK,OAAO,KAAK;KACjB,WAAW,MAAM;IAClB,OACC,WAAW,QAAQ,KAAK;GAE1B,SAAS,OAAO;IACf,KAAK,OAAO,KAAK;IACjB,MAAM;GACP;EACD;EACA,MAAM,OAAO,QAAQ;GACpB,KAAK,OAAO,KAAK;GACjB,OAAO,OAAO,OAAO,MAAM;EAC5B;CACD,CAAC;CACD,OAAO,IAAI,SAAS,MAAM,QAAQ;AACnC;;AAGA,eAAsB,OACrB,OACA,SAC2B;CAE3B,MAAM,OAAO,QAAQ,IAAI,YAAY,MAAM;CAG3C,MAAM,uBAAO,IAAI,IAAgB;CACjC,MAAM,SAAS,KAAK,MACnB;EACC,MAAM,QAAQ;EACd,GAAI,QAAQ,YAAY,OAAO,CAAC,IAAI,EAAE,UAAU,QAAQ,SAAS;EAEjE,gBAAgB,CAAC;CAClB,GACA,OAAO,SAAS,SAAS;EACxB,MAAM,SAAS,QAAQ,cAAwB;EAC/C,MAAM,cAAc;GACnB,KAAK,OAAO,KAAK;GACjB,OAAO,QAAQ,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC;EACnD;EACA,KAAK,IAAI,KAAK;EACd,MAAM,UAAU,YAAY;GAC3B,IAAI;IACH,OAAO,iBACN,MAAM,MAAM,SAAS,EAAE,eAAe,KAAK,WAAW,SAAS,CAAC,GAChE,IACD;GACD,UAAU;IACT,KAAK,OAAO,KAAK;GAClB;EACD,EAAC,CAAE;EACH,OAAO,QAAQ,KAAK,CAAC,QAAQ,OAAO,OAAO,CAAC;CAC7C,CACD;CACA,OAAO;EACN,KAAK,YAAY,QAAQ,UAAU,OAAO,KAAK,IAAI;EACnD,MAAM,OAAO,EAAE,iBAAiB;GAC/B,MAAM,WAAW,iBAAiB;IACjC,KAAK,MAAM,SAAS,MACnB,MAAM;GAER,GAAG,UAAU;GACb,MAAM,OAAO,SAAS;GACtB,aAAa,QAAQ;EACtB;CACD;AACD"}