screenreader-speech-capture 0.1.0-feat-playwright-supervisor.1 → 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 (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +24 -0
  3. package/dist/cli.mjs +3728 -1248
  4. package/dist/ui/adapter-node.js +11 -0
  5. package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js +3 -0
  6. package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js.br +0 -0
  7. package/dist/ui/client/_app/immutable/chunks/BMrJcSB7.js.gz +0 -0
  8. package/dist/ui/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
  9. package/dist/ui/client/_app/immutable/chunks/Bjy-W4x2.js.br +0 -0
  10. package/dist/ui/client/_app/immutable/chunks/Bjy-W4x2.js.gz +0 -0
  11. package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js +2 -0
  12. package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js.br +0 -0
  13. package/dist/ui/client/_app/immutable/chunks/BueZJg5y.js.gz +0 -0
  14. package/dist/ui/client/_app/immutable/chunks/DclECHGd.js +1 -0
  15. package/dist/ui/client/_app/immutable/chunks/DclECHGd.js.br +0 -0
  16. package/dist/ui/client/_app/immutable/chunks/DclECHGd.js.gz +0 -0
  17. package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js +1 -0
  18. package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js.br +0 -0
  19. package/dist/ui/client/_app/immutable/chunks/ZzrMKdp0.js.gz +0 -0
  20. package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js +2 -0
  21. package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js.br +0 -0
  22. package/dist/ui/client/_app/immutable/entry/app.BGREpuCm.js.gz +0 -0
  23. package/dist/ui/client/_app/immutable/entry/payload.DSmR2FwN.js +1 -0
  24. package/dist/ui/client/_app/immutable/entry/payload.DSmR2FwN.js.br +0 -0
  25. package/dist/ui/client/_app/immutable/entry/payload.DSmR2FwN.js.gz +0 -0
  26. package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js +2 -0
  27. package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js.br +0 -0
  28. package/dist/ui/client/_app/immutable/entry/start.Bj3y6VYi.js.gz +0 -0
  29. package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js +1 -0
  30. package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js.br +0 -0
  31. package/dist/ui/client/_app/immutable/nodes/0.BdmtdjrF.js.gz +0 -0
  32. package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js +1 -0
  33. package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js.br +0 -0
  34. package/dist/ui/client/_app/immutable/nodes/1.B76I_t5U.js.gz +0 -0
  35. package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js +1 -0
  36. package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js.br +0 -0
  37. package/dist/ui/client/_app/immutable/nodes/2.CpNTEXmI.js.gz +0 -0
  38. package/dist/ui/client/_app/version.json +1 -0
  39. package/dist/ui/client/_app/version.json.br +0 -0
  40. package/dist/ui/client/_app/version.json.gz +0 -0
  41. package/dist/ui/client/robots.txt +3 -0
  42. package/dist/ui/client/robots.txt.br +0 -0
  43. package/dist/ui/client/robots.txt.gz +0 -0
  44. package/dist/ui/handler.js +1 -0
  45. package/dist/ui/index.js +1 -0
  46. package/dist/ui/server/.vite/manifest.json +186 -0
  47. package/dist/ui/server/adapter-env.js +1 -0
  48. package/dist/ui/server/adapter-index.js +73 -0
  49. package/dist/ui/server/adapter-index.js.map +1 -0
  50. package/dist/ui/server/adapter-node-env.js +63 -0
  51. package/dist/ui/server/adapter-node-env.js.map +1 -0
  52. package/dist/ui/server/adapter-node-handler.js +616 -0
  53. package/dist/ui/server/adapter-node-handler.js.map +1 -0
  54. package/dist/ui/server/chunks/config.js +9 -0
  55. package/dist/ui/server/chunks/config.js.map +1 -0
  56. package/dist/ui/server/chunks/exports.js +484 -0
  57. package/dist/ui/server/chunks/exports.js.map +1 -0
  58. package/dist/ui/server/chunks/functions.js +29 -0
  59. package/dist/ui/server/chunks/functions.js.map +1 -0
  60. package/dist/ui/server/chunks/instance.js +3568 -0
  61. package/dist/ui/server/chunks/instance.js.map +1 -0
  62. package/dist/ui/server/chunks/internal.js +2900 -0
  63. package/dist/ui/server/chunks/internal.js.map +1 -0
  64. package/dist/ui/server/chunks/server-errors.js +487 -0
  65. package/dist/ui/server/chunks/server-errors.js.map +1 -0
  66. package/dist/ui/server/chunks/server.js +8 -0
  67. package/dist/ui/server/chunks/server.js.map +1 -0
  68. package/dist/ui/server/chunks/server2.js +1368 -0
  69. package/dist/ui/server/chunks/server2.js.map +1 -0
  70. package/dist/ui/server/chunks/shared.js +85 -0
  71. package/dist/ui/server/chunks/shared.js.map +1 -0
  72. package/dist/ui/server/chunks/uneval.js +534 -0
  73. package/dist/ui/server/chunks/uneval.js.map +1 -0
  74. package/dist/ui/server/entries/fallbacks/error.svelte.js +44 -0
  75. package/dist/ui/server/entries/fallbacks/error.svelte.js.map +1 -0
  76. package/dist/ui/server/entries/pages/_layout.server.ts.js +987 -0
  77. package/dist/ui/server/entries/pages/_layout.server.ts.js.map +1 -0
  78. package/dist/ui/server/entries/pages/_layout.svelte.js +15 -0
  79. package/dist/ui/server/entries/pages/_layout.svelte.js.map +1 -0
  80. package/dist/ui/server/entries/pages/_page.svelte.js +11 -0
  81. package/dist/ui/server/entries/pages/_page.svelte.js.map +1 -0
  82. package/dist/ui/server/env.js +1 -0
  83. package/dist/ui/server/handler.js +1 -0
  84. package/dist/ui/server/index.js +67 -0
  85. package/dist/ui/server/index.js.map +1 -0
  86. package/dist/ui/server/manifest-full.js +37 -0
  87. package/dist/ui/server/manifest.js +37 -0
  88. package/dist/ui/server/nodes/0.js +10 -0
  89. package/dist/ui/server/nodes/1.js +8 -0
  90. package/dist/ui/server/nodes/2.js +8 -0
  91. package/dist/ui/server/remote-entry.js +1565 -0
  92. package/dist/ui/server/remote-entry.js.map +1 -0
  93. package/dist/ui/server/server.js +39 -0
  94. package/package.json +14 -3
@@ -0,0 +1,73 @@
1
+ import { n as format_listening_address, t as handler } from "./adapter-node-handler.js";
2
+ import { n as timeout_env, t as env } from "./adapter-node-env.js";
3
+ import http from "node:http";
4
+ import fs from "node:fs";
5
+ import process from "node:process";
6
+ import { rm } from "node:fs/promises";
7
+ // ../../node_modules/.pnpm/@sveltejs+adapter-node@6.0.2_@sveltejs+kit@3.2.0_@sveltejs+vite-plugin-svelte@7.3.1_sve_f768d943589f92fcf48d61074f12cc67/node_modules/@sveltejs/adapter-node/src/index.js
8
+ var path = env("SOCKET_PATH", false);
9
+ var host = env("HOST", "0.0.0.0");
10
+ var port = env("PORT", !path && "3000");
11
+ var shutdown_timeout = parseInt(env("SHUTDOWN_TIMEOUT", "30"));
12
+ var idle_timeout = parseInt(env("IDLE_TIMEOUT", "0"));
13
+ var listen_pid = parseInt(env("LISTEN_PID", "0"));
14
+ var listen_fds = parseInt(env("LISTEN_FDS", "0"));
15
+ var SD_LISTEN_FDS_START = 3;
16
+ if (listen_pid !== 0 && listen_pid !== process.pid) throw new Error(`received LISTEN_PID ${listen_pid} but current process id is ${process.pid}`);
17
+ if (listen_fds > 1) throw new Error(`only one socket is allowed for socket activation, but LISTEN_FDS was set to ${listen_fds}`);
18
+ var socket_activation = listen_pid === process.pid && listen_fds === 1;
19
+ var requests = 0;
20
+ /** @type {NodeJS.Timeout | void} */
21
+ var shutdown_timeout_id;
22
+ /** @type {NodeJS.Timeout | void} */
23
+ var idle_timeout_id;
24
+ var httpServer = http.createServer();
25
+ var keep_alive_timeout = timeout_env("KEEP_ALIVE_TIMEOUT");
26
+ if (keep_alive_timeout !== void 0) httpServer.keepAliveTimeout = keep_alive_timeout * 1e3;
27
+ var headers_timeout = timeout_env("HEADERS_TIMEOUT");
28
+ if (headers_timeout !== void 0) httpServer.headersTimeout = headers_timeout * 1e3;
29
+ httpServer.on("request", (req, res) => {
30
+ requests++;
31
+ if (socket_activation && idle_timeout_id) idle_timeout_id = clearTimeout(idle_timeout_id);
32
+ req.on("close", () => {
33
+ requests--;
34
+ if (shutdown_timeout_id) httpServer.closeIdleConnections();
35
+ if (requests === 0 && socket_activation && idle_timeout) idle_timeout_id = setTimeout(() => graceful_shutdown("IDLE"), idle_timeout * 1e3);
36
+ });
37
+ return handler(req, res, () => {
38
+ res.statusCode = 404;
39
+ res.end();
40
+ });
41
+ });
42
+ if (socket_activation) httpServer.listen({ fd: SD_LISTEN_FDS_START }, () => {
43
+ console.log(`Listening on file descriptor ${SD_LISTEN_FDS_START}`);
44
+ });
45
+ else {
46
+ if (path) try {
47
+ if (fs.statSync(path).size === 0) await rm(path);
48
+ } catch {}
49
+ httpServer.listen({
50
+ path,
51
+ host,
52
+ port
53
+ }, () => {
54
+ console.log(`Listening on ${format_listening_address(path, host, port, httpServer.address())}`);
55
+ });
56
+ }
57
+ /** @param {'SIGINT' | 'SIGTERM' | 'IDLE'} reason */
58
+ function graceful_shutdown(reason) {
59
+ if (shutdown_timeout_id) return;
60
+ httpServer.closeIdleConnections();
61
+ httpServer.close((error) => {
62
+ if (error) return;
63
+ if (shutdown_timeout_id) clearTimeout(shutdown_timeout_id);
64
+ if (idle_timeout_id) clearTimeout(idle_timeout_id);
65
+ process.emit("sveltekit:shutdown", reason);
66
+ });
67
+ shutdown_timeout_id = setTimeout(() => httpServer.closeAllConnections(), shutdown_timeout * 1e3);
68
+ }
69
+ process.on("SIGTERM", graceful_shutdown);
70
+ process.on("SIGINT", graceful_shutdown);
71
+ export { host, path, port, httpServer as server };
72
+
73
+ //# sourceMappingURL=adapter-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-index.js","names":[],"sources":["../../../../node_modules/.pnpm/@sveltejs+adapter-node@6.0.2_@sveltejs+kit@3.2.0_@sveltejs+vite-plugin-svelte@7.3.1_sve_f768d943589f92fcf48d61074f12cc67/node_modules/@sveltejs/adapter-node/src/index.js"],"sourcesContent":["import http from 'node:http';\nimport fs from 'node:fs';\nimport process from 'node:process';\nimport { handler } from './handler.js';\nimport { env, timeout_env } from './env.js';\nimport { rm } from 'node:fs/promises';\nimport { format_listening_address } from './utils.js';\n\nexport const path = env('SOCKET_PATH', false);\nexport const host = env('HOST', '0.0.0.0');\nexport const port = env('PORT', !path && '3000');\n\nconst shutdown_timeout = parseInt(env('SHUTDOWN_TIMEOUT', '30'));\nconst idle_timeout = parseInt(env('IDLE_TIMEOUT', '0'));\nconst listen_pid = parseInt(env('LISTEN_PID', '0'));\nconst listen_fds = parseInt(env('LISTEN_FDS', '0'));\n// https://www.freedesktop.org/software/systemd/man/latest/sd_listen_fds.html\nconst SD_LISTEN_FDS_START = 3;\n\nif (listen_pid !== 0 && listen_pid !== process.pid) {\n\tthrow new Error(`received LISTEN_PID ${listen_pid} but current process id is ${process.pid}`);\n}\nif (listen_fds > 1) {\n\tthrow new Error(\n\t\t`only one socket is allowed for socket activation, but LISTEN_FDS was set to ${listen_fds}`\n\t);\n}\n\nconst socket_activation = listen_pid === process.pid && listen_fds === 1;\n\nlet requests = 0;\n/** @type {NodeJS.Timeout | void} */\nlet shutdown_timeout_id;\n/** @type {NodeJS.Timeout | void} */\nlet idle_timeout_id;\n\nconst httpServer = http.createServer();\n\nconst keep_alive_timeout = timeout_env('KEEP_ALIVE_TIMEOUT');\nif (keep_alive_timeout !== undefined) {\n\t// Convert the keep-alive timeout from seconds to milliseconds (the unit Node.js expects).\n\thttpServer.keepAliveTimeout = keep_alive_timeout * 1000;\n}\n\nconst headers_timeout = timeout_env('HEADERS_TIMEOUT');\nif (headers_timeout !== undefined) {\n\t// Convert the headers timeout from seconds to milliseconds (the unit Node.js expects).\n\thttpServer.headersTimeout = headers_timeout * 1000;\n}\n\nhttpServer.on('request', (req, res) => {\n\trequests++;\n\n\tif (socket_activation && idle_timeout_id) {\n\t\tidle_timeout_id = clearTimeout(idle_timeout_id);\n\t}\n\n\treq.on('close', () => {\n\t\trequests--;\n\n\t\tif (shutdown_timeout_id) {\n\t\t\t// close connections as soon as they become idle, so they don't accept new requests\n\t\t\thttpServer.closeIdleConnections();\n\t\t}\n\t\tif (requests === 0 && socket_activation && idle_timeout) {\n\t\t\tidle_timeout_id = setTimeout(() => graceful_shutdown('IDLE'), idle_timeout * 1000);\n\t\t}\n\t});\n\n\treturn handler(req, res, () => {\n\t\tres.statusCode = 404;\n\t\tres.end();\n\t});\n});\n\nif (socket_activation) {\n\thttpServer.listen({ fd: SD_LISTEN_FDS_START }, () => {\n\t\tconsole.log(`Listening on file descriptor ${SD_LISTEN_FDS_START}`);\n\t});\n} else {\n\tif (path) {\n\t\ttry {\n\t\t\tif (fs.statSync(path).size === 0) {\n\t\t\t\tawait rm(path);\n\t\t\t}\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t}\n\n\thttpServer.listen({ path, host, port }, () => {\n\t\tconsole.log(`Listening on ${format_listening_address(path, host, port, httpServer.address())}`);\n\t});\n}\n\n/** @param {'SIGINT' | 'SIGTERM' | 'IDLE'} reason */\nfunction graceful_shutdown(reason) {\n\tif (shutdown_timeout_id) return;\n\n\t// If a connection was opened with a keep-alive header close() will wait for the connection to\n\t// time out rather than close it even if it is not handling any requests, so call this first\n\thttpServer.closeIdleConnections();\n\n\thttpServer.close((error) => {\n\t\t// occurs if the server is already closed\n\t\tif (error) return;\n\n\t\tif (shutdown_timeout_id) {\n\t\t\tclearTimeout(shutdown_timeout_id);\n\t\t}\n\t\tif (idle_timeout_id) {\n\t\t\tclearTimeout(idle_timeout_id);\n\t\t}\n\n\t\t// @ts-expect-error custom events cannot be typed\n\t\tprocess.emit('sveltekit:shutdown', reason);\n\t});\n\n\tshutdown_timeout_id = setTimeout(() => httpServer.closeAllConnections(), shutdown_timeout * 1000);\n}\n\nprocess.on('SIGTERM', graceful_shutdown);\nprocess.on('SIGINT', graceful_shutdown);\n\nexport { httpServer as server };\n"],"ignoreList":[0],"mappings":";;;;;;;AAQA,IAAa,OAAO,IAAI,eAAe,KAAK;AAC5C,IAAa,OAAO,IAAI,QAAQ,SAAS;AACzC,IAAa,OAAO,IAAI,QAAQ,CAAC,QAAQ,MAAM;AAE/C,IAAM,mBAAmB,SAAS,IAAI,oBAAoB,IAAI,CAAC;AAC/D,IAAM,eAAe,SAAS,IAAI,gBAAgB,GAAG,CAAC;AACtD,IAAM,aAAa,SAAS,IAAI,cAAc,GAAG,CAAC;AAClD,IAAM,aAAa,SAAS,IAAI,cAAc,GAAG,CAAC;AAElD,IAAM,sBAAsB;AAE5B,IAAI,eAAe,KAAK,eAAe,QAAQ,KAC9C,MAAM,IAAI,MAAM,uBAAuB,WAAW,6BAA6B,QAAQ,KAAK;AAE7F,IAAI,aAAa,GAChB,MAAM,IAAI,MACT,+EAA+E,YAChF;AAGD,IAAM,oBAAoB,eAAe,QAAQ,OAAO,eAAe;AAEvE,IAAI,WAAW;;AAEf,IAAI;;AAEJ,IAAI;AAEJ,IAAM,aAAa,KAAK,aAAa;AAErC,IAAM,qBAAqB,YAAY,oBAAoB;AAC3D,IAAI,uBAAuB,KAAA,GAE1B,WAAW,mBAAmB,qBAAqB;AAGpD,IAAM,kBAAkB,YAAY,iBAAiB;AACrD,IAAI,oBAAoB,KAAA,GAEvB,WAAW,iBAAiB,kBAAkB;AAG/C,WAAW,GAAG,YAAY,KAAK,QAAQ;CACtC;CAEA,IAAI,qBAAqB,iBACxB,kBAAkB,aAAa,eAAe;CAG/C,IAAI,GAAG,eAAe;EACrB;EAEA,IAAI,qBAEH,WAAW,qBAAqB;EAEjC,IAAI,aAAa,KAAK,qBAAqB,cAC1C,kBAAkB,iBAAiB,kBAAkB,MAAM,GAAG,eAAe,GAAI;CAEnF,CAAC;CAED,OAAO,QAAQ,KAAK,WAAW;EAC9B,IAAI,aAAa;EACjB,IAAI,IAAI;CACT,CAAC;AACF,CAAC;AAED,IAAI,mBACH,WAAW,OAAO,EAAE,IAAI,oBAAoB,SAAS;CACpD,QAAQ,IAAI,gCAAgC,qBAAqB;AAClE,CAAC;KACK;CACN,IAAI,MACH,IAAI;EACH,IAAI,GAAG,SAAS,IAAI,CAAC,CAAC,SAAS,GAC9B,MAAM,GAAG,IAAI;CAEf,QAAQ,CAER;CAGD,WAAW,OAAO;EAAE;EAAM;EAAM;CAAK,SAAS;EAC7C,QAAQ,IAAI,gBAAgB,yBAAyB,MAAM,MAAM,MAAM,WAAW,QAAQ,CAAC,GAAG;CAC/F,CAAC;AACF;;AAGA,SAAS,kBAAkB,QAAQ;CAClC,IAAI,qBAAqB;CAIzB,WAAW,qBAAqB;CAEhC,WAAW,OAAO,UAAU;EAE3B,IAAI,OAAO;EAEX,IAAI,qBACH,aAAa,mBAAmB;EAEjC,IAAI,iBACH,aAAa,eAAe;EAI7B,QAAQ,KAAK,sBAAsB,MAAM;CAC1C,CAAC;CAED,sBAAsB,iBAAiB,WAAW,oBAAoB,GAAG,mBAAmB,GAAI;AACjG;AAEA,QAAQ,GAAG,WAAW,iBAAiB;AACvC,QAAQ,GAAG,UAAU,iBAAiB"}
@@ -0,0 +1,63 @@
1
+ import process from "node:process";
2
+ import { env_prefix } from "../adapter-node.js";
3
+ // ../../node_modules/.pnpm/@sveltejs+adapter-node@6.0.2_@sveltejs+kit@3.2.0_@sveltejs+vite-plugin-svelte@7.3.1_sve_f768d943589f92fcf48d61074f12cc67/node_modules/@sveltejs/adapter-node/src/env.js
4
+ var expected = /* @__PURE__ */ new Set([
5
+ "SOCKET_PATH",
6
+ "HOST",
7
+ "PORT",
8
+ "ORIGIN",
9
+ "XFF_DEPTH",
10
+ "ADDRESS_HEADER",
11
+ "PROTOCOL_HEADER",
12
+ "HOST_HEADER",
13
+ "PORT_HEADER",
14
+ "BODY_SIZE_LIMIT",
15
+ "SHUTDOWN_TIMEOUT",
16
+ "IDLE_TIMEOUT",
17
+ "KEEP_ALIVE_TIMEOUT",
18
+ "HEADERS_TIMEOUT"
19
+ ]);
20
+ var expected_unprefixed = /* @__PURE__ */ new Set(["LISTEN_PID", "LISTEN_FDS"]);
21
+ if (env_prefix) {
22
+ for (const name in process.env) if (name.startsWith(env_prefix)) {
23
+ const unprefixed = name.slice(env_prefix.length);
24
+ if (!expected.has(unprefixed)) throw new Error(`You should change envPrefix (${env_prefix}) to avoid conflicts with existing environment variables — unexpectedly saw ${name}`);
25
+ }
26
+ }
27
+ /**
28
+ * @param {string} name
29
+ * @param {any} [fallback]
30
+ */
31
+ function env(name, fallback) {
32
+ const prefixed = (expected_unprefixed.has(name) ? "" : env_prefix) + name;
33
+ return prefixed in process.env ? process.env[prefixed] : fallback;
34
+ }
35
+ var integer_regexp = /^\d+$/;
36
+ /**
37
+ * Throw a consistently-structured parsing error for environment variables.
38
+ * @param {string} name
39
+ * @param {any} value
40
+ * @param {string} description
41
+ * @returns {never}
42
+ */
43
+ function parsing_error(name, value, description) {
44
+ throw new Error(`Invalid value for environment variable ${name}: ${JSON.stringify(value)} (${description})`);
45
+ }
46
+ /**
47
+ * Check the environment for a timeout value (non-negative integer) in seconds.
48
+ * @param {string} name
49
+ * @param {number} [fallback]
50
+ * @returns {number | undefined}
51
+ */
52
+ function timeout_env(name, fallback) {
53
+ const raw = env(name, fallback);
54
+ if (!raw) return fallback;
55
+ if (!integer_regexp.test(raw)) parsing_error(name, raw, "should be a non-negative integer");
56
+ const parsed = Number.parseInt(raw, 10);
57
+ if (Number.isNaN(parsed)) parsing_error(name, raw, "should be a non-negative integer");
58
+ if (parsed < 0) parsing_error(name, raw, "should be a non-negative integer");
59
+ return parsed;
60
+ }
61
+ export { timeout_env as n, env as t };
62
+
63
+ //# sourceMappingURL=adapter-node-env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-node-env.js","names":[],"sources":["../../../../node_modules/.pnpm/@sveltejs+adapter-node@6.0.2_@sveltejs+kit@3.2.0_@sveltejs+vite-plugin-svelte@7.3.1_sve_f768d943589f92fcf48d61074f12cc67/node_modules/@sveltejs/adapter-node/src/env.js"],"sourcesContent":["import process from 'node:process';\nimport { env_prefix } from '#@sveltejs/adapter-node';\n\nconst expected = new Set([\n\t'SOCKET_PATH',\n\t'HOST',\n\t'PORT',\n\t'ORIGIN',\n\t'XFF_DEPTH',\n\t'ADDRESS_HEADER',\n\t'PROTOCOL_HEADER',\n\t'HOST_HEADER',\n\t'PORT_HEADER',\n\t'BODY_SIZE_LIMIT',\n\t'SHUTDOWN_TIMEOUT',\n\t'IDLE_TIMEOUT',\n\t'KEEP_ALIVE_TIMEOUT',\n\t'HEADERS_TIMEOUT'\n]);\n\nconst expected_unprefixed = new Set(['LISTEN_PID', 'LISTEN_FDS']);\n\nif (env_prefix) {\n\tfor (const name in process.env) {\n\t\tif (name.startsWith(env_prefix)) {\n\t\t\tconst unprefixed = name.slice(env_prefix.length);\n\t\t\tif (!expected.has(unprefixed)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`You should change envPrefix (${env_prefix}) to avoid conflicts with existing environment variables — unexpectedly saw ${name}`\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * @param {string} name\n * @param {any} [fallback]\n */\nexport function env(name, fallback) {\n\tconst prefix = expected_unprefixed.has(name) ? '' : env_prefix;\n\tconst prefixed = prefix + name;\n\treturn prefixed in process.env ? process.env[prefixed] : fallback;\n}\n\nconst integer_regexp = /^\\d+$/;\n\n/**\n * Throw a consistently-structured parsing error for environment variables.\n * @param {string} name\n * @param {any} value\n * @param {string} description\n * @returns {never}\n */\nfunction parsing_error(name, value, description) {\n\tthrow new Error(\n\t\t`Invalid value for environment variable ${name}: ${JSON.stringify(value)} (${description})`\n\t);\n}\n\n/**\n * Check the environment for a timeout value (non-negative integer) in seconds.\n * @param {string} name\n * @param {number} [fallback]\n * @returns {number | undefined}\n */\nexport function timeout_env(name, fallback) {\n\tconst raw = env(name, fallback);\n\tif (!raw) {\n\t\treturn fallback;\n\t}\n\n\tif (!integer_regexp.test(raw)) {\n\t\tparsing_error(name, raw, 'should be a non-negative integer');\n\t}\n\n\tconst parsed = Number.parseInt(raw, 10);\n\n\t// We don't technically need to check `Number.isNaN` because the value already passed the regexp test.\n\t// However, just in case there's some new codepath introduced somewhere down the line, it's probably good\n\t// to stick this in here.\n\tif (Number.isNaN(parsed)) {\n\t\tparsing_error(name, raw, 'should be a non-negative integer');\n\t}\n\n\tif (parsed < 0) {\n\t\tparsing_error(name, raw, 'should be a non-negative integer');\n\t}\n\n\treturn parsed;\n}\n"],"ignoreList":[0],"mappings":";;;AAGA,IAAM,2BAAW,IAAI,IAAI;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAED,IAAM,sCAAsB,IAAI,IAAI,CAAC,cAAc,YAAY,CAAC;AAEhE,IAAI,YACE;MAAA,MAAM,QAAQ,QAAQ,KAC1B,IAAI,KAAK,WAAW,UAAU,GAAG;EAChC,MAAM,aAAa,KAAK,MAAM,WAAW,MAAM;EAC/C,IAAI,CAAC,SAAS,IAAI,UAAU,GAC3B,MAAM,IAAI,MACT,gCAAgC,WAAW,8EAA8E,MAC1H;CAEF;;;;;;AAQF,SAAgB,IAAI,MAAM,UAAU;CAEnC,MAAM,YADS,oBAAoB,IAAI,IAAI,IAAI,KAAK,cAC1B;CAC1B,OAAO,YAAY,QAAQ,MAAM,QAAQ,IAAI,YAAY;AAC1D;AAEA,IAAM,iBAAiB;;;;;;;;AASvB,SAAS,cAAc,MAAM,OAAO,aAAa;CAChD,MAAM,IAAI,MACT,0CAA0C,KAAK,IAAI,KAAK,UAAU,KAAK,EAAE,IAAI,YAAY,EAC1F;AACD;;;;;;;AAQA,SAAgB,YAAY,MAAM,UAAU;CAC3C,MAAM,MAAM,IAAI,MAAM,QAAQ;CAC9B,IAAI,CAAC,KACJ,OAAO;CAGR,IAAI,CAAC,eAAe,KAAK,GAAG,GAC3B,cAAc,MAAM,KAAK,kCAAkC;CAG5D,MAAM,SAAS,OAAO,SAAS,KAAK,EAAE;CAKtC,IAAI,OAAO,MAAM,MAAM,GACtB,cAAc,MAAM,KAAK,kCAAkC;CAG5D,IAAI,SAAS,GACZ,cAAc,MAAM,KAAK,kCAAkC;CAG5D,OAAO;AACR"}