@veryfront/ext-observability-opentelemetry 0.1.1081 → 0.1.1082

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 (227) hide show
  1. package/esm/{extensions/ext-observability-opentelemetry/src/index.d.ts → index.d.ts} +0 -16
  2. package/esm/index.d.ts.map +1 -0
  3. package/esm/{extensions/ext-observability-opentelemetry/src/index.js → index.js} +2 -3
  4. package/package.json +6 -6
  5. package/esm/_dnt.polyfills.d.ts +0 -7
  6. package/esm/_dnt.polyfills.d.ts.map +0 -1
  7. package/esm/_dnt.polyfills.js +0 -1
  8. package/esm/deno.d.ts +0 -443
  9. package/esm/deno.d.ts.map +0 -1
  10. package/esm/deno.js +0 -531
  11. package/esm/extensions/ext-observability-opentelemetry/src/index.d.ts.map +0 -1
  12. package/esm/src/config/defaults.d.ts +0 -39
  13. package/esm/src/config/defaults.d.ts.map +0 -1
  14. package/esm/src/config/defaults.js +0 -65
  15. package/esm/src/errors/error-registry/agent.d.ts +0 -18
  16. package/esm/src/errors/error-registry/agent.d.ts.map +0 -1
  17. package/esm/src/errors/error-registry/agent.js +0 -60
  18. package/esm/src/errors/error-registry/boundary.d.ts +0 -16
  19. package/esm/src/errors/error-registry/boundary.d.ts.map +0 -1
  20. package/esm/src/errors/error-registry/boundary.js +0 -52
  21. package/esm/src/errors/error-registry/build.d.ts +0 -20
  22. package/esm/src/errors/error-registry/build.d.ts.map +0 -1
  23. package/esm/src/errors/error-registry/build.js +0 -68
  24. package/esm/src/errors/error-registry/config.d.ts +0 -22
  25. package/esm/src/errors/error-registry/config.d.ts.map +0 -1
  26. package/esm/src/errors/error-registry/config.js +0 -70
  27. package/esm/src/errors/error-registry/deploy.d.ts +0 -12
  28. package/esm/src/errors/error-registry/deploy.d.ts.map +0 -1
  29. package/esm/src/errors/error-registry/deploy.js +0 -36
  30. package/esm/src/errors/error-registry/dev.d.ts +0 -14
  31. package/esm/src/errors/error-registry/dev.d.ts.map +0 -1
  32. package/esm/src/errors/error-registry/dev.js +0 -44
  33. package/esm/src/errors/error-registry/general.d.ts +0 -29
  34. package/esm/src/errors/error-registry/general.d.ts.map +0 -1
  35. package/esm/src/errors/error-registry/general.js +0 -92
  36. package/esm/src/errors/error-registry/module.d.ts +0 -16
  37. package/esm/src/errors/error-registry/module.d.ts.map +0 -1
  38. package/esm/src/errors/error-registry/module.js +0 -52
  39. package/esm/src/errors/error-registry/route.d.ts +0 -16
  40. package/esm/src/errors/error-registry/route.d.ts.map +0 -1
  41. package/esm/src/errors/error-registry/route.js +0 -52
  42. package/esm/src/errors/error-registry/runtime.d.ts +0 -18
  43. package/esm/src/errors/error-registry/runtime.d.ts.map +0 -1
  44. package/esm/src/errors/error-registry/runtime.js +0 -60
  45. package/esm/src/errors/error-registry/server.d.ts +0 -39
  46. package/esm/src/errors/error-registry/server.d.ts.map +0 -1
  47. package/esm/src/errors/error-registry/server.js +0 -129
  48. package/esm/src/errors/error-registry-helpers.d.ts +0 -6
  49. package/esm/src/errors/error-registry-helpers.d.ts.map +0 -1
  50. package/esm/src/errors/error-registry-helpers.js +0 -9
  51. package/esm/src/errors/error-registry.d.ts +0 -114
  52. package/esm/src/errors/error-registry.d.ts.map +0 -1
  53. package/esm/src/errors/error-registry.js +0 -60
  54. package/esm/src/errors/types.d.ts +0 -84
  55. package/esm/src/errors/types.d.ts.map +0 -1
  56. package/esm/src/errors/types.js +0 -69
  57. package/esm/src/errors/veryfront-error.d.ts +0 -149
  58. package/esm/src/errors/veryfront-error.d.ts.map +0 -1
  59. package/esm/src/errors/veryfront-error.js +0 -61
  60. package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts +0 -13
  61. package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.d.ts.map +0 -1
  62. package/esm/src/modules/react-loader/ssr-module-loader/concurrency/semaphore.js +0 -55
  63. package/esm/src/observability/tracing/api-shim.d.ts +0 -191
  64. package/esm/src/observability/tracing/api-shim.d.ts.map +0 -1
  65. package/esm/src/observability/tracing/api-shim.js +0 -281
  66. package/esm/src/observability/tracing/otlp-setup.d.ts +0 -63
  67. package/esm/src/observability/tracing/otlp-setup.d.ts.map +0 -1
  68. package/esm/src/observability/tracing/otlp-setup.js +0 -219
  69. package/esm/src/observability/tracing/telemetry-env.d.ts +0 -3
  70. package/esm/src/observability/tracing/telemetry-env.d.ts.map +0 -1
  71. package/esm/src/observability/tracing/telemetry-env.js +0 -10
  72. package/esm/src/platform/adapters/base.d.ts +0 -209
  73. package/esm/src/platform/adapters/base.d.ts.map +0 -1
  74. package/esm/src/platform/adapters/base.js +0 -15
  75. package/esm/src/platform/compat/constants.d.ts +0 -13
  76. package/esm/src/platform/compat/constants.d.ts.map +0 -1
  77. package/esm/src/platform/compat/constants.js +0 -12
  78. package/esm/src/platform/compat/dynamic-import.d.ts +0 -11
  79. package/esm/src/platform/compat/dynamic-import.d.ts.map +0 -1
  80. package/esm/src/platform/compat/dynamic-import.js +0 -10
  81. package/esm/src/platform/compat/fs.d.ts +0 -75
  82. package/esm/src/platform/compat/fs.d.ts.map +0 -1
  83. package/esm/src/platform/compat/fs.js +0 -315
  84. package/esm/src/platform/compat/path/resolution.d.ts +0 -6
  85. package/esm/src/platform/compat/path/resolution.d.ts.map +0 -1
  86. package/esm/src/platform/compat/path/resolution.js +0 -121
  87. package/esm/src/platform/compat/path/runtime.d.ts +0 -8
  88. package/esm/src/platform/compat/path/runtime.d.ts.map +0 -1
  89. package/esm/src/platform/compat/path/runtime.js +0 -20
  90. package/esm/src/platform/compat/path/types.d.ts +0 -22
  91. package/esm/src/platform/compat/path/types.d.ts.map +0 -1
  92. package/esm/src/platform/compat/path/types.js +0 -1
  93. package/esm/src/platform/compat/process/command.d.ts +0 -33
  94. package/esm/src/platform/compat/process/command.d.ts.map +0 -1
  95. package/esm/src/platform/compat/process/command.js +0 -206
  96. package/esm/src/platform/compat/process/env.d.ts +0 -35
  97. package/esm/src/platform/compat/process/env.d.ts.map +0 -1
  98. package/esm/src/platform/compat/process/env.js +0 -194
  99. package/esm/src/platform/compat/process/lifecycle.d.ts +0 -99
  100. package/esm/src/platform/compat/process/lifecycle.d.ts.map +0 -1
  101. package/esm/src/platform/compat/process/lifecycle.js +0 -327
  102. package/esm/src/platform/compat/process/runtime-process.d.ts +0 -10
  103. package/esm/src/platform/compat/process/runtime-process.d.ts.map +0 -1
  104. package/esm/src/platform/compat/process/runtime-process.js +0 -25
  105. package/esm/src/platform/compat/process.d.ts +0 -5
  106. package/esm/src/platform/compat/process.d.ts.map +0 -1
  107. package/esm/src/platform/compat/process.js +0 -4
  108. package/esm/src/platform/compat/runtime.d.ts +0 -51
  109. package/esm/src/platform/compat/runtime.d.ts.map +0 -1
  110. package/esm/src/platform/compat/runtime.js +0 -104
  111. package/esm/src/transforms/import-rewriter/url-builder.d.ts +0 -70
  112. package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +0 -1
  113. package/esm/src/transforms/import-rewriter/url-builder.js +0 -152
  114. package/esm/src/utils/base64url.d.ts +0 -6
  115. package/esm/src/utils/base64url.d.ts.map +0 -1
  116. package/esm/src/utils/base64url.js +0 -12
  117. package/esm/src/utils/bundle-manifest.d.ts +0 -63
  118. package/esm/src/utils/bundle-manifest.d.ts.map +0 -1
  119. package/esm/src/utils/bundle-manifest.js +0 -96
  120. package/esm/src/utils/constants/buffers.d.ts +0 -24
  121. package/esm/src/utils/constants/buffers.d.ts.map +0 -1
  122. package/esm/src/utils/constants/buffers.js +0 -23
  123. package/esm/src/utils/constants/build.d.ts +0 -8
  124. package/esm/src/utils/constants/build.d.ts.map +0 -1
  125. package/esm/src/utils/constants/build.js +0 -7
  126. package/esm/src/utils/constants/cache.d.ts +0 -74
  127. package/esm/src/utils/constants/cache.d.ts.map +0 -1
  128. package/esm/src/utils/constants/cache.js +0 -133
  129. package/esm/src/utils/constants/cdn.d.ts +0 -29
  130. package/esm/src/utils/constants/cdn.d.ts.map +0 -1
  131. package/esm/src/utils/constants/cdn.js +0 -58
  132. package/esm/src/utils/constants/crypto.d.ts +0 -10
  133. package/esm/src/utils/constants/crypto.d.ts.map +0 -1
  134. package/esm/src/utils/constants/crypto.js +0 -9
  135. package/esm/src/utils/constants/env.d.ts +0 -16
  136. package/esm/src/utils/constants/env.d.ts.map +0 -1
  137. package/esm/src/utils/constants/env.js +0 -20
  138. package/esm/src/utils/constants/hash.d.ts +0 -5
  139. package/esm/src/utils/constants/hash.d.ts.map +0 -1
  140. package/esm/src/utils/constants/hash.js +0 -4
  141. package/esm/src/utils/constants/hmr.d.ts +0 -24
  142. package/esm/src/utils/constants/hmr.d.ts.map +0 -1
  143. package/esm/src/utils/constants/hmr.js +0 -26
  144. package/esm/src/utils/constants/html.d.ts +0 -13
  145. package/esm/src/utils/constants/html.d.ts.map +0 -1
  146. package/esm/src/utils/constants/html.js +0 -12
  147. package/esm/src/utils/constants/http.d.ts +0 -77
  148. package/esm/src/utils/constants/http.d.ts.map +0 -1
  149. package/esm/src/utils/constants/http.js +0 -76
  150. package/esm/src/utils/constants/index.d.ts +0 -23
  151. package/esm/src/utils/constants/index.d.ts.map +0 -1
  152. package/esm/src/utils/constants/index.js +0 -22
  153. package/esm/src/utils/constants/limits.d.ts +0 -27
  154. package/esm/src/utils/constants/limits.d.ts.map +0 -1
  155. package/esm/src/utils/constants/limits.js +0 -26
  156. package/esm/src/utils/constants/metrics.d.ts +0 -10
  157. package/esm/src/utils/constants/metrics.d.ts.map +0 -1
  158. package/esm/src/utils/constants/metrics.js +0 -34
  159. package/esm/src/utils/constants/network.d.ts +0 -23
  160. package/esm/src/utils/constants/network.d.ts.map +0 -1
  161. package/esm/src/utils/constants/network.js +0 -27
  162. package/esm/src/utils/constants/priorities.d.ts +0 -31
  163. package/esm/src/utils/constants/priorities.d.ts.map +0 -1
  164. package/esm/src/utils/constants/priorities.js +0 -30
  165. package/esm/src/utils/constants/retry.d.ts +0 -14
  166. package/esm/src/utils/constants/retry.d.ts.map +0 -1
  167. package/esm/src/utils/constants/retry.js +0 -13
  168. package/esm/src/utils/constants/security.d.ts +0 -16
  169. package/esm/src/utils/constants/security.d.ts.map +0 -1
  170. package/esm/src/utils/constants/security.js +0 -15
  171. package/esm/src/utils/constants/server.d.ts +0 -107
  172. package/esm/src/utils/constants/server.d.ts.map +0 -1
  173. package/esm/src/utils/constants/server.js +0 -120
  174. package/esm/src/utils/feature-flags.d.ts +0 -7
  175. package/esm/src/utils/feature-flags.d.ts.map +0 -1
  176. package/esm/src/utils/feature-flags.js +0 -8
  177. package/esm/src/utils/hash-utils.d.ts +0 -19
  178. package/esm/src/utils/hash-utils.d.ts.map +0 -1
  179. package/esm/src/utils/hash-utils.js +0 -42
  180. package/esm/src/utils/import-lockfile.d.ts +0 -52
  181. package/esm/src/utils/import-lockfile.d.ts.map +0 -1
  182. package/esm/src/utils/import-lockfile.js +0 -187
  183. package/esm/src/utils/index.d.ts +0 -27
  184. package/esm/src/utils/index.d.ts.map +0 -1
  185. package/esm/src/utils/index.js +0 -25
  186. package/esm/src/utils/logger/components.d.ts +0 -73
  187. package/esm/src/utils/logger/components.d.ts.map +0 -1
  188. package/esm/src/utils/logger/components.js +0 -81
  189. package/esm/src/utils/logger/core.d.ts +0 -73
  190. package/esm/src/utils/logger/core.d.ts.map +0 -1
  191. package/esm/src/utils/logger/core.js +0 -143
  192. package/esm/src/utils/logger/index.d.ts +0 -10
  193. package/esm/src/utils/logger/index.d.ts.map +0 -1
  194. package/esm/src/utils/logger/index.js +0 -9
  195. package/esm/src/utils/logger/logger.d.ts +0 -179
  196. package/esm/src/utils/logger/logger.d.ts.map +0 -1
  197. package/esm/src/utils/logger/logger.js +0 -490
  198. package/esm/src/utils/logger/redact.d.ts +0 -74
  199. package/esm/src/utils/logger/redact.d.ts.map +0 -1
  200. package/esm/src/utils/logger/redact.js +0 -294
  201. package/esm/src/utils/logger/request-context.d.ts +0 -27
  202. package/esm/src/utils/logger/request-context.d.ts.map +0 -1
  203. package/esm/src/utils/logger/request-context.js +0 -28
  204. package/esm/src/utils/memoize.d.ts +0 -19
  205. package/esm/src/utils/memoize.d.ts.map +0 -1
  206. package/esm/src/utils/memoize.js +0 -72
  207. package/esm/src/utils/parallel.d.ts +0 -25
  208. package/esm/src/utils/parallel.d.ts.map +0 -1
  209. package/esm/src/utils/parallel.js +0 -91
  210. package/esm/src/utils/path-utils.d.ts +0 -34
  211. package/esm/src/utils/path-utils.d.ts.map +0 -1
  212. package/esm/src/utils/path-utils.js +0 -138
  213. package/esm/src/utils/perf-timer.d.ts +0 -11
  214. package/esm/src/utils/perf-timer.d.ts.map +0 -1
  215. package/esm/src/utils/perf-timer.js +0 -114
  216. package/esm/src/utils/platform.d.ts +0 -9
  217. package/esm/src/utils/platform.d.ts.map +0 -1
  218. package/esm/src/utils/platform.js +0 -11
  219. package/esm/src/utils/runtime-guards.d.ts +0 -29
  220. package/esm/src/utils/runtime-guards.d.ts.map +0 -1
  221. package/esm/src/utils/runtime-guards.js +0 -23
  222. package/esm/src/utils/version-constant.d.ts +0 -3
  223. package/esm/src/utils/version-constant.d.ts.map +0 -1
  224. package/esm/src/utils/version-constant.js +0 -4
  225. package/esm/src/utils/version.d.ts +0 -17
  226. package/esm/src/utils/version.d.ts.map +0 -1
  227. package/esm/src/utils/version.js +0 -36
@@ -1,206 +0,0 @@
1
- import * as dntShim from "../../../../_dnt.shims.js";
2
- import { dynamicImport } from "../dynamic-import.js";
3
- import { getDenoRuntime, isBun as IS_BUN, isDeno as IS_DENO } from "../runtime.js";
4
- import { isWindowsPlatform, runtimeProcess } from "./runtime-process.js";
5
- const COMMAND_TIMEOUT_EXIT_CODE = 124;
6
- const FORCE_KILL_GRACE_MS = 250;
7
- function createTimeoutResult(timeoutMs, stdout, stderr) {
8
- return {
9
- success: false,
10
- code: COMMAND_TIMEOUT_EXIT_CODE,
11
- stdout,
12
- stderr: `${stderr ?? ""}\nCommand timed out after ${timeoutMs}ms`.trim(),
13
- };
14
- }
15
- function createProcessTimeout(timeoutMs, terminate, forceTerminate) {
16
- let timedOut = false;
17
- let timeoutId;
18
- let forceKillId;
19
- if (timeoutMs && timeoutMs > 0) {
20
- timeoutId = dntShim.setTimeout(() => {
21
- timedOut = true;
22
- try {
23
- terminate();
24
- }
25
- catch (_) {
26
- /* expected: best-effort terminate may fail if process already exited */
27
- }
28
- forceKillId = dntShim.setTimeout(() => {
29
- try {
30
- forceTerminate();
31
- }
32
- catch (_) {
33
- /* expected: best-effort force terminate may fail if process already exited */
34
- }
35
- }, FORCE_KILL_GRACE_MS);
36
- }, timeoutMs);
37
- }
38
- return {
39
- hasTimedOut: () => timedOut,
40
- clear: () => {
41
- if (timeoutId)
42
- clearTimeout(timeoutId);
43
- if (forceKillId)
44
- clearTimeout(forceKillId);
45
- },
46
- };
47
- }
48
- async function readStreamToString(stream) {
49
- const reader = stream.getReader();
50
- const chunks = [];
51
- while (true) {
52
- const { done, value } = await reader.read();
53
- if (done)
54
- break;
55
- if (value)
56
- chunks.push(value);
57
- }
58
- const total = chunks.reduce((acc, c) => acc + c.length, 0);
59
- const merged = new Uint8Array(total);
60
- let offset = 0;
61
- for (const chunk of chunks) {
62
- merged.set(chunk, offset);
63
- offset += chunk.length;
64
- }
65
- return new TextDecoder().decode(merged);
66
- }
67
- /**
68
- * Run a command and return the result.
69
- * Works across Deno, Node.js, and Bun.
70
- *
71
- * @param cmd - Command to run
72
- * @param options - Command options
73
- * @param options.capture - Capture stdout/stderr to return in result
74
- * @param options.inherit - Inherit stdio from parent (shows output in terminal)
75
- * @param options.shell - Use shell to run command (needed for .cmd on Windows)
76
- */
77
- export async function runCommand(cmd, options = {}) {
78
- const { args = [], cwd: cmdCwd, env: cmdEnv, clearEnv = false, capture = false, inherit = false, shell = false, timeoutMs, } = options;
79
- const effectiveTimeoutMs = timeoutMs && timeoutMs > 0 ? Math.floor(timeoutMs) : undefined;
80
- // Determine stdio mode: inherit > capture > null
81
- const stdioMode = inherit ? "inherit" : capture ? "piped" : "null";
82
- const deno = IS_DENO ? getDenoRuntime() : undefined;
83
- if (deno) {
84
- const command = new deno.Command(cmd, {
85
- args,
86
- cwd: cmdCwd,
87
- env: cmdEnv,
88
- clearEnv,
89
- stdin: inherit ? "inherit" : "null",
90
- stdout: stdioMode,
91
- stderr: stdioMode,
92
- });
93
- const child = command.spawn();
94
- const timeout = createProcessTimeout(effectiveTimeoutMs, () => child.kill("SIGTERM"), () => child.kill("SIGKILL"));
95
- try {
96
- const [status, stdout, stderr] = await Promise.all([
97
- child.status,
98
- capture && child.stdout ? readStreamToString(child.stdout) : Promise.resolve(undefined),
99
- capture && child.stderr ? readStreamToString(child.stderr) : Promise.resolve(undefined),
100
- ]);
101
- if (timeout.hasTimedOut()) {
102
- return createTimeoutResult(effectiveTimeoutMs ?? 0, stdout, stderr);
103
- }
104
- return {
105
- success: status.success,
106
- code: status.code,
107
- stdout,
108
- stderr,
109
- };
110
- }
111
- finally {
112
- timeout.clear();
113
- }
114
- }
115
- if (IS_BUN) {
116
- const bunGlobal = dntShim.dntGlobalThis;
117
- const bunStdio = inherit ? "inherit" : capture ? "pipe" : "ignore";
118
- const isWindows = isWindowsPlatform();
119
- const bunCmd = shell
120
- ? args.length === 0
121
- ? isWindows ? ["cmd", "/c", cmd] : ["sh", "-c", cmd]
122
- : isWindows
123
- ? ["cmd", "/c", cmd, ...args]
124
- : ["sh", "-c", 'exec "$@"', "sh", cmd, ...args]
125
- : [cmd, ...args];
126
- const proc = bunGlobal.Bun.spawn({
127
- cmd: bunCmd,
128
- cwd: cmdCwd,
129
- env: clearEnv ? cmdEnv ?? {} : cmdEnv,
130
- stdout: bunStdio,
131
- stderr: bunStdio,
132
- });
133
- const timeout = createProcessTimeout(effectiveTimeoutMs, () => proc.kill?.("SIGTERM"), () => proc.kill?.("SIGKILL"));
134
- try {
135
- const [code, stdout, stderr] = await Promise.all([
136
- proc.exited,
137
- capture && proc.stdout ? readStreamToString(proc.stdout) : Promise.resolve(undefined),
138
- capture && proc.stderr ? readStreamToString(proc.stderr) : Promise.resolve(undefined),
139
- ]);
140
- if (timeout.hasTimedOut()) {
141
- return createTimeoutResult(effectiveTimeoutMs ?? 0, stdout, stderr);
142
- }
143
- return { success: code === 0, code, stdout, stderr };
144
- }
145
- finally {
146
- timeout.clear();
147
- }
148
- }
149
- if (!runtimeProcess)
150
- return { success: false, code: 1 };
151
- const process = runtimeProcess;
152
- const { spawn } = await dynamicImport("node:child_process");
153
- const nodeStdio = inherit
154
- ? ["inherit", "inherit", "inherit"]
155
- : capture
156
- ? ["ignore", "pipe", "pipe"]
157
- : ["ignore", "ignore", "ignore"];
158
- return await new Promise((resolve) => {
159
- const child = spawn(cmd, args, {
160
- cwd: cmdCwd,
161
- env: clearEnv ? cmdEnv ?? {} : cmdEnv ? { ...process.env, ...cmdEnv } : undefined,
162
- stdio: nodeStdio,
163
- shell,
164
- });
165
- let stdout = "";
166
- let stderr = "";
167
- const decoder = new TextDecoder();
168
- const timeout = createProcessTimeout(effectiveTimeoutMs, () => child.kill("SIGTERM"), () => child.kill("SIGKILL"));
169
- if (capture) {
170
- child.stdout?.on("data", (data) => {
171
- stdout += decoder.decode(data);
172
- });
173
- child.stderr?.on("data", (data) => {
174
- stderr += decoder.decode(data);
175
- });
176
- }
177
- child.on("close", (code) => {
178
- timeout.clear();
179
- if (timeout.hasTimedOut()) {
180
- resolve(createTimeoutResult(effectiveTimeoutMs ?? 0, capture ? stdout : undefined, capture ? stderr : undefined));
181
- return;
182
- }
183
- resolve({
184
- success: code === 0,
185
- code: code ?? 1,
186
- stdout: capture ? stdout : undefined,
187
- stderr: capture ? stderr : undefined,
188
- });
189
- });
190
- child.on("error", (spawnError) => {
191
- timeout.clear();
192
- // Include the spawn error message so callers can distinguish ENOENT
193
- // ("command not found"), EACCES ("permission denied"), etc.
194
- resolve({
195
- success: false,
196
- code: 1,
197
- stdout: capture ? stdout : undefined,
198
- stderr: capture
199
- ? (stderr
200
- ? `${stderr}\nSpawn error: ${spawnError.message}`
201
- : `Spawn error: ${spawnError.message}`)
202
- : undefined,
203
- });
204
- });
205
- });
206
- }
@@ -1,35 +0,0 @@
1
- export type EnvOverlayStorage = {
2
- getStore: () => unknown;
3
- run?: <T>(store: unknown, fn: () => T) => T;
4
- enterWith?: (store: unknown) => void;
5
- };
6
- /** Read and write process environment variables. */
7
- export declare function env(): Record<string, string>;
8
- /**
9
- * Read a host-level environment variable without consulting any project env overlay.
10
- * Use this for framework-owned runtime configuration that should not be shadowed by tenant env.
11
- */
12
- export declare function getHostEnv(key: string): string | undefined;
13
- /** Read an environment variable from the active project scope. */
14
- export declare function getEnv(key: string): string | undefined;
15
- export interface EnvBooleanOptions {
16
- trueValues?: readonly string[];
17
- falseValues?: readonly string[];
18
- trim?: boolean;
19
- caseSensitive?: boolean;
20
- }
21
- export declare function getEnvString(key: string): string | undefined;
22
- export declare function getEnvString(key: string, fallback: string): string;
23
- export declare function getEnvNumber(key: string): number | undefined;
24
- export declare function getEnvNumber(key: string, fallback: number): number;
25
- export declare function getEnvBoolean(key: string, fallback?: boolean, options?: EnvBooleanOptions): boolean;
26
- /** Sets env. */
27
- export declare function setEnv(key: string, value: string): void;
28
- /** Delete a process environment variable. */
29
- export declare function deleteEnv(key: string): void;
30
- /**
31
- * Get an AsyncLocalStorage-based env overlay storage if installed.
32
- * This enables per-async-context env isolation (e.g., in tests).
33
- */
34
- export declare function getEnvOverlayStorage(): EnvOverlayStorage | null;
35
- //# sourceMappingURL=env.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/env.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC,CAAC;AAoBF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S_DENO } from "../runtime.js";
3
- import { runtimeProcess } from "./runtime-process.js";
4
- function getEnvOverlayStore() {
5
- const storage = getEnvOverlayStorage();
6
- const store = storage?.getStore();
7
- return store instanceof Map ? store : null;
8
- }
9
- function getOverlayEnvValue(store, key) {
10
- if (!store?.has(key)) {
11
- return { hasValue: false, value: undefined };
12
- }
13
- const value = store.get(key);
14
- return { hasValue: true, value: value ?? undefined };
15
- }
16
- /** Read and write process environment variables. */
17
- export function env() {
18
- const deno = IS_DENO ? getDenoRuntime() : undefined;
19
- const base = deno
20
- ? deno.env.toObject()
21
- : runtimeProcess
22
- ? { ...runtimeProcess.env }
23
- : {};
24
- const overlay = getEnvOverlayStore();
25
- if (!overlay)
26
- return base;
27
- for (const [key, value] of overlay.entries()) {
28
- if (value === null) {
29
- delete base[key];
30
- continue;
31
- }
32
- base[key] = value;
33
- }
34
- return base;
35
- }
36
- /**
37
- * Read a host-level environment variable without consulting any project env overlay.
38
- * Use this for framework-owned runtime configuration that should not be shadowed by tenant env.
39
- */
40
- export function getHostEnv(key) {
41
- const overlayResult = getOverlayEnvValue(getEnvOverlayStore(), key);
42
- if (overlayResult.hasValue) {
43
- return overlayResult.value;
44
- }
45
- const deno = IS_DENO ? getDenoRuntime() : undefined;
46
- if (deno) {
47
- try {
48
- return deno.env.get(key);
49
- }
50
- catch {
51
- // Under a tightened env permission allowlist (project isolation workers),
52
- // reading a non-allowlisted variable throws NotCapable. Treat it as absent
53
- // to match the prior `env: true` behavior where reads never threw, so
54
- // optional-variable lookups degrade to undefined instead of crashing the
55
- // request.
56
- return undefined;
57
- }
58
- }
59
- if (runtimeProcess)
60
- return runtimeProcess.env[key];
61
- return undefined;
62
- }
63
- // Lazy-loaded references to project-env/storage.ts functions.
64
- // Uses globalThis to avoid circular imports (process compat is low-level, project-env is high-level).
65
- // IMPORTANT: Only cache when the real getter is found. If storage.ts hasn't loaded yet,
66
- // re-check globalThis on every call to avoid permanently caching the fallback.
67
- let _getProjectEnv = null;
68
- let _isProjectEnvActive = null;
69
- function getProjectEnvSafe(key) {
70
- if (_getProjectEnv === null) {
71
- const mod = dntShim.dntGlobalThis.__vfProjectEnvGetter;
72
- if (mod) {
73
- _getProjectEnv = mod;
74
- }
75
- else {
76
- return undefined;
77
- }
78
- }
79
- return _getProjectEnv(key);
80
- }
81
- function isProjectEnvActiveSafe() {
82
- if (_isProjectEnvActive === null) {
83
- const mod = dntShim.dntGlobalThis.__vfProjectEnvActiveChecker;
84
- if (mod) {
85
- _isProjectEnvActive = mod;
86
- }
87
- else {
88
- return false;
89
- }
90
- }
91
- return _isProjectEnvActive();
92
- }
93
- /** Read an environment variable from the active project scope. */
94
- export function getEnv(key) {
95
- // Check per-request project env overlay first (AsyncLocalStorage)
96
- const projectValue = getProjectEnvSafe(key);
97
- if (projectValue !== undefined)
98
- return projectValue;
99
- // When a project env overlay is active (remote project request), do NOT
100
- // fall through to host process env. This prevents remote projects from
101
- // reading host-level secrets like AWS_SECRET_ACCESS_KEY, DATABASE_URL, etc.
102
- if (isProjectEnvActiveSafe())
103
- return undefined;
104
- return getHostEnv(key);
105
- }
106
- const DEFAULT_ENV_TRUE_VALUES = ["1", "true", "yes"];
107
- const DEFAULT_ENV_FALSE_VALUES = ["0", "false", "no"];
108
- function normalizeEnvToken(value, options) {
109
- const normalized = options.trim ? value.trim() : value;
110
- return options.caseSensitive ? normalized : normalized.toLowerCase();
111
- }
112
- export function getEnvString(key, fallback) {
113
- const value = getEnv(key);
114
- if (value === undefined)
115
- return fallback;
116
- return value;
117
- }
118
- export function getEnvNumber(key, fallback) {
119
- const value = getEnvString(key);
120
- if (value === undefined)
121
- return fallback;
122
- const parsed = Number.parseInt(value, 10);
123
- if (Number.isNaN(parsed))
124
- return fallback ?? Number.NaN;
125
- return parsed;
126
- }
127
- export function getEnvBoolean(key, fallback = false, options = {}) {
128
- const value = getEnvString(key);
129
- if (value === undefined)
130
- return fallback;
131
- const trim = options.trim ?? true;
132
- const caseSensitive = options.caseSensitive ?? false;
133
- const normalized = normalizeEnvToken(value, { trim, caseSensitive });
134
- const trueValues = options.trueValues ?? DEFAULT_ENV_TRUE_VALUES;
135
- for (const trueValue of trueValues) {
136
- if (normalized === normalizeEnvToken(trueValue, { trim, caseSensitive }))
137
- return true;
138
- }
139
- const falseValues = options.falseValues ?? DEFAULT_ENV_FALSE_VALUES;
140
- for (const falseValue of falseValues) {
141
- if (normalized === normalizeEnvToken(falseValue, { trim, caseSensitive }))
142
- return false;
143
- }
144
- return fallback;
145
- }
146
- /** Sets env. */
147
- export function setEnv(key, value) {
148
- const overlay = getEnvOverlayStore();
149
- if (overlay) {
150
- overlay.set(key, value);
151
- return;
152
- }
153
- const deno = IS_DENO ? getDenoRuntime() : undefined;
154
- if (deno) {
155
- deno.env.set(key, value);
156
- return;
157
- }
158
- if (runtimeProcess) {
159
- runtimeProcess.env[key] = value;
160
- return;
161
- }
162
- throw new Error("setEnv() is not supported in this runtime");
163
- }
164
- /** Delete a process environment variable. */
165
- export function deleteEnv(key) {
166
- const overlay = getEnvOverlayStore();
167
- if (overlay) {
168
- overlay.set(key, null);
169
- return;
170
- }
171
- const deno = IS_DENO ? getDenoRuntime() : undefined;
172
- if (deno) {
173
- deno.env.delete(key);
174
- return;
175
- }
176
- if (runtimeProcess) {
177
- delete runtimeProcess.env[key];
178
- return;
179
- }
180
- throw new Error("deleteEnv() is not supported in this runtime");
181
- }
182
- /**
183
- * Get an AsyncLocalStorage-based env overlay storage if installed.
184
- * This enables per-async-context env isolation (e.g., in tests).
185
- */
186
- export function getEnvOverlayStorage() {
187
- const globalAny = dntShim.dntGlobalThis;
188
- const overlay = globalAny["__vfTestDenoEnvOverlay"] ??
189
- globalAny["__vfTestEnvOverlay"];
190
- const storage = overlay?.storage;
191
- if (!storage || typeof storage.getStore !== "function")
192
- return null;
193
- return storage;
194
- }
@@ -1,99 +0,0 @@
1
- import * as dntShim from "../../../../_dnt.shims.js";
2
- /** Get command-line arguments (cross-runtime: Deno.args or process.argv). */
3
- export declare function getArgs(): string[];
4
- /** Exit the process with an optional code (cross-runtime: Deno.exit or process.exit). */
5
- export declare function exit(code?: number): never;
6
- /** Return the current working directory. */
7
- export declare function cwd(): string;
8
- export declare function chdir(directory: string): void;
9
- export declare function pid(): number;
10
- export declare function memoryUsage(): {
11
- rss: number;
12
- heapTotal: number;
13
- heapUsed: number;
14
- external: number;
15
- };
16
- /**
17
- * Check if stdin is a TTY (terminal)
18
- */
19
- export declare function isInteractive(): boolean;
20
- /**
21
- * Check if stdout is a TTY (terminal)
22
- */
23
- export declare function isStdoutTTY(): boolean;
24
- /**
25
- * Get terminal size (columns and rows)
26
- * Returns default fallback values if terminal size cannot be determined
27
- */
28
- export declare function getTerminalSize(): {
29
- columns: number;
30
- rows: number;
31
- };
32
- /**
33
- * Get runtime version string
34
- */
35
- export declare function getRuntimeVersion(): string;
36
- /**
37
- * Get the operating system type
38
- * Returns: "darwin" (macOS), "linux", "windows", or the raw platform string
39
- */
40
- export declare function getOsType(): string;
41
- /**
42
- * Register a signal handler (SIGINT, SIGTERM) for graceful shutdown
43
- */
44
- export declare function onSignal(signal: "SIGINT" | "SIGTERM", handler: () => void): void;
45
- /**
46
- * Register global error handlers for uncaught exceptions and unhandled promise rejections.
47
- * These handlers prevent the process from crashing due to application code errors.
48
- *
49
- * IMPORTANT: These handlers should be registered early in the application lifecycle
50
- * to catch errors that escape try/catch blocks.
51
- *
52
- * @param onError - Callback invoked with the error. Return true to prevent process exit.
53
- */
54
- export declare function onGlobalError(onError: (error: Error, type: "uncaughtException" | "unhandledRejection") => boolean | void): void;
55
- /**
56
- * Unreference a timer to prevent it from keeping the process alive
57
- */
58
- export declare function unrefTimer(timerId: ReturnType<typeof dntShim.setInterval>): void;
59
- /**
60
- * Get the executable path of the current runtime
61
- */
62
- export declare function execPath(): string;
63
- /**
64
- * Get process uptime in seconds
65
- * Returns OS uptime on Deno, process uptime on Node.js
66
- */
67
- export declare function uptime(): number;
68
- /**
69
- * Get stdout stream for writing
70
- * Returns null if not available (e.g., in browser/workers)
71
- */
72
- export declare function getStdout(): {
73
- write: (data: string) => void;
74
- } | null;
75
- /**
76
- * Write text directly to stdout (sync)
77
- * No-op if stdout is not available
78
- */
79
- export declare function writeStdout(text: string): void;
80
- /**
81
- * Write data to stdout asynchronously
82
- * Returns a promise that resolves when the write is complete
83
- */
84
- export declare function writeStdoutAsync(data: Uint8Array): Promise<number>;
85
- /**
86
- * Synchronous prompt function that works across Deno and Bun.
87
- * Displays a message and reads user input from stdin.
88
- *
89
- * Note: This relies on globalThis.prompt which is available in Deno and Bun.
90
- * Returns null in environments where prompt is not available (e.g., Node.js ESM).
91
- */
92
- export declare function promptSync(message?: string): string | null;
93
- /**
94
- * Read a single byte from stdin synchronously.
95
- * Requires raw mode to be enabled for character-by-character reading.
96
- * Returns null on EOF or if stdin is not available.
97
- */
98
- export declare function readStdinByteSync(): number | null;
99
- //# sourceMappingURL=lifecycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAIrD,6EAA6E;AAC7E,wBAAgB,OAAO,IAAI,MAAM,EAAE,CAKlC;AAED,yFAAyF;AACzF,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAKzC;AAED,4CAA4C;AAC5C,wBAAgB,GAAG,IAAI,MAAM,CAK5B;AAED,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAW7C;AAED,wBAAgB,GAAG,IAAI,MAAM,CAK5B;AAED,wBAAgB,WAAW,IAAI;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAaA;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAA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