@veryfront/ext-observability-opentelemetry 0.1.1081 → 0.1.1083

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,327 +0,0 @@
1
- import * as dntShim from "../../../../_dnt.shims.js";
2
- import { getDenoRuntime, isBun as IS_BUN, isDeno as IS_DENO } from "../runtime.js";
3
- import { runtimeProcess } from "./runtime-process.js";
4
- /** Get command-line arguments (cross-runtime: Deno.args or process.argv). */
5
- export function getArgs() {
6
- const deno = IS_DENO ? getDenoRuntime() : undefined;
7
- if (deno)
8
- return deno.args;
9
- if (runtimeProcess)
10
- return runtimeProcess.argv.slice(2);
11
- return [];
12
- }
13
- /** Exit the process with an optional code (cross-runtime: Deno.exit or process.exit). */
14
- export function exit(code) {
15
- const deno = IS_DENO ? getDenoRuntime() : undefined;
16
- if (deno)
17
- deno.exit(code);
18
- if (runtimeProcess)
19
- runtimeProcess.exit(code);
20
- throw new Error("exit() is not supported in this runtime");
21
- }
22
- /** Return the current working directory. */
23
- export function cwd() {
24
- const deno = IS_DENO ? getDenoRuntime() : undefined;
25
- if (deno)
26
- return deno.cwd();
27
- if (runtimeProcess)
28
- return runtimeProcess.cwd();
29
- throw new Error("cwd() is not supported in this runtime");
30
- }
31
- export function chdir(directory) {
32
- const deno = IS_DENO ? getDenoRuntime() : undefined;
33
- if (deno) {
34
- deno.chdir(directory);
35
- return;
36
- }
37
- if (runtimeProcess) {
38
- runtimeProcess.chdir(directory);
39
- return;
40
- }
41
- throw new Error("chdir() is not supported in this runtime");
42
- }
43
- export function pid() {
44
- const deno = IS_DENO ? getDenoRuntime() : undefined;
45
- if (deno)
46
- return deno.pid;
47
- if (runtimeProcess)
48
- return runtimeProcess.pid;
49
- return 0;
50
- }
51
- export function memoryUsage() {
52
- const deno = IS_DENO ? getDenoRuntime() : undefined;
53
- if (deno) {
54
- const { rss, heapTotal, heapUsed, external } = deno.memoryUsage();
55
- return { rss, heapTotal, heapUsed, external };
56
- }
57
- if (!runtimeProcess) {
58
- throw new Error("memoryUsage() is not supported in this runtime");
59
- }
60
- const { rss, heapTotal, heapUsed, external } = runtimeProcess.memoryUsage();
61
- return { rss, heapTotal, heapUsed, external: external || 0 };
62
- }
63
- /**
64
- * Check if stdin is a TTY (terminal)
65
- */
66
- export function isInteractive() {
67
- const deno = IS_DENO ? getDenoRuntime() : undefined;
68
- if (deno)
69
- return deno.stdin.isTerminal();
70
- if (runtimeProcess)
71
- return runtimeProcess.stdin.isTTY ?? false;
72
- return false;
73
- }
74
- /**
75
- * Check if stdout is a TTY (terminal)
76
- */
77
- export function isStdoutTTY() {
78
- const deno = IS_DENO ? getDenoRuntime() : undefined;
79
- if (deno)
80
- return deno.stdout.isTerminal();
81
- if (runtimeProcess)
82
- return runtimeProcess.stdout.isTTY ?? false;
83
- return false;
84
- }
85
- /**
86
- * Get terminal size (columns and rows)
87
- * Returns default fallback values if terminal size cannot be determined
88
- */
89
- export function getTerminalSize() {
90
- const defaultSize = { columns: 80, rows: 24 };
91
- const deno = IS_DENO ? getDenoRuntime() : undefined;
92
- if (deno) {
93
- try {
94
- const { columns, rows } = deno.consoleSize();
95
- return { columns, rows };
96
- }
97
- catch (_) {
98
- /* expected: Deno.consoleSize() fails when not attached to a terminal */
99
- return defaultSize;
100
- }
101
- }
102
- if (!runtimeProcess)
103
- return defaultSize;
104
- const columns = runtimeProcess.stdout?.columns;
105
- const rows = runtimeProcess.stdout?.rows;
106
- if (columns && rows)
107
- return { columns, rows };
108
- return defaultSize;
109
- }
110
- /**
111
- * Get runtime version string
112
- */
113
- export function getRuntimeVersion() {
114
- const deno = IS_DENO ? getDenoRuntime() : undefined;
115
- if (deno)
116
- return `Deno ${deno.version.deno}`;
117
- if ("Bun" in dntShim.dntGlobalThis) {
118
- return `Bun ${dntShim.dntGlobalThis.Bun.version}`;
119
- }
120
- if (runtimeProcess)
121
- return `Node.js ${runtimeProcess.version}`;
122
- return "unknown";
123
- }
124
- /**
125
- * Get the operating system type
126
- * Returns: "darwin" (macOS), "linux", "windows", or the raw platform string
127
- */
128
- export function getOsType() {
129
- const deno = IS_DENO ? getDenoRuntime() : undefined;
130
- if (deno)
131
- return deno.build.os;
132
- if (runtimeProcess) {
133
- // Node/Bun uses process.platform which returns "win32" for Windows
134
- const platform = runtimeProcess.platform;
135
- return platform === "win32" ? "windows" : platform;
136
- }
137
- return "unknown";
138
- }
139
- /**
140
- * Register a signal handler (SIGINT, SIGTERM) for graceful shutdown
141
- */
142
- export function onSignal(signal, handler) {
143
- const deno = IS_DENO ? getDenoRuntime() : undefined;
144
- if (deno) {
145
- deno.addSignalListener(signal, handler);
146
- return;
147
- }
148
- if (runtimeProcess)
149
- runtimeProcess.on(signal, handler);
150
- }
151
- /**
152
- * Register global error handlers for uncaught exceptions and unhandled promise rejections.
153
- * These handlers prevent the process from crashing due to application code errors.
154
- *
155
- * IMPORTANT: These handlers should be registered early in the application lifecycle
156
- * to catch errors that escape try/catch blocks.
157
- *
158
- * @param onError - Callback invoked with the error. Return true to prevent process exit.
159
- */
160
- export function onGlobalError(onError) {
161
- if (IS_DENO) {
162
- // Intentionally permanent: process-level handlers must persist for the entire runtime
163
- globalThis.addEventListener("error", (event) => {
164
- const error = event.error instanceof Error ? event.error : new Error(String(event.error));
165
- if (onError(error, "uncaughtException"))
166
- event.preventDefault();
167
- });
168
- globalThis.addEventListener("unhandledrejection", (event) => {
169
- const error = event.reason instanceof Error ? event.reason : new Error(String(event.reason));
170
- if (onError(error, "unhandledRejection"))
171
- event.preventDefault();
172
- });
173
- return;
174
- }
175
- if (!runtimeProcess)
176
- return;
177
- const process = runtimeProcess;
178
- const handleNodeGlobalError = (error, type) => {
179
- let shouldPreventExit = false;
180
- try {
181
- shouldPreventExit = onError(error, type) === true;
182
- }
183
- catch (handlerError) {
184
- const handlerException = handlerError instanceof Error
185
- ? handlerError
186
- : new Error(String(handlerError));
187
- console.error("Global error handler threw while processing", type, handlerException);
188
- }
189
- if (shouldPreventExit)
190
- return;
191
- // Node/Bun suppress default fatal behavior when a listener is registered.
192
- // If the callback did not explicitly handle the error, exit to preserve
193
- // expected fatal semantics for uncaught exceptions and unhandled rejections.
194
- process.exit(1);
195
- };
196
- runtimeProcess.on("uncaughtException", (error) => {
197
- handleNodeGlobalError(error, "uncaughtException");
198
- });
199
- runtimeProcess.on("unhandledRejection", (reason) => {
200
- const error = reason instanceof Error ? reason : new Error(String(reason));
201
- handleNodeGlobalError(error, "unhandledRejection");
202
- });
203
- }
204
- /**
205
- * Unreference a timer to prevent it from keeping the process alive
206
- */
207
- export function unrefTimer(timerId) {
208
- const deno = IS_DENO ? getDenoRuntime() : undefined;
209
- if (deno && typeof deno.unrefTimer === "function" && typeof timerId === "number") {
210
- deno.unrefTimer(timerId);
211
- return;
212
- }
213
- if (timerId && typeof timerId === "object") {
214
- const unref = timerId.unref;
215
- if (typeof unref === "function") {
216
- unref.call(timerId);
217
- }
218
- }
219
- }
220
- /**
221
- * Get the executable path of the current runtime
222
- */
223
- export function execPath() {
224
- const deno = IS_DENO ? getDenoRuntime() : undefined;
225
- if (deno)
226
- return deno.execPath();
227
- if (runtimeProcess)
228
- return runtimeProcess.execPath;
229
- return "";
230
- }
231
- /**
232
- * Get process uptime in seconds
233
- * Returns OS uptime on Deno, process uptime on Node.js
234
- */
235
- export function uptime() {
236
- const deno = IS_DENO ? getDenoRuntime() : undefined;
237
- if (deno) {
238
- // Deno.osUptime() returns system uptime in seconds
239
- return deno.osUptime?.() ?? 0;
240
- }
241
- if (runtimeProcess) {
242
- // process.uptime() returns process uptime in seconds
243
- return runtimeProcess.uptime?.() ?? 0;
244
- }
245
- return 0;
246
- }
247
- /**
248
- * Get stdout stream for writing
249
- * Returns null if not available (e.g., in browser/workers)
250
- */
251
- export function getStdout() {
252
- const deno = IS_DENO ? getDenoRuntime() : undefined;
253
- if (deno) {
254
- const encoder = new TextEncoder();
255
- return { write: (data) => deno.stdout.writeSync(encoder.encode(data)) };
256
- }
257
- const stdout = runtimeProcess?.stdout;
258
- if (stdout) {
259
- return { write: (data) => stdout.write(data) };
260
- }
261
- return null;
262
- }
263
- /**
264
- * Write text directly to stdout (sync)
265
- * No-op if stdout is not available
266
- */
267
- export function writeStdout(text) {
268
- getStdout()?.write(text);
269
- }
270
- /**
271
- * Write data to stdout asynchronously
272
- * Returns a promise that resolves when the write is complete
273
- */
274
- export async function writeStdoutAsync(data) {
275
- const deno = IS_DENO ? getDenoRuntime() : undefined;
276
- if (deno)
277
- return await deno.stdout.write(data);
278
- const stdout = runtimeProcess?.stdout;
279
- if (stdout) {
280
- return await new Promise((resolve, reject) => {
281
- stdout.write(data, (error) => {
282
- if (error)
283
- reject(error);
284
- else
285
- resolve(data.length);
286
- });
287
- });
288
- }
289
- return 0;
290
- }
291
- /**
292
- * Synchronous prompt function that works across Deno and Bun.
293
- * Displays a message and reads user input from stdin.
294
- *
295
- * Note: This relies on globalThis.prompt which is available in Deno and Bun.
296
- * Returns null in environments where prompt is not available (e.g., Node.js ESM).
297
- */
298
- export function promptSync(message) {
299
- if (typeof globalThis.prompt !== "function")
300
- return null;
301
- return globalThis.prompt(message ?? "") ?? null;
302
- }
303
- /**
304
- * Read a single byte from stdin synchronously.
305
- * Requires raw mode to be enabled for character-by-character reading.
306
- * Returns null on EOF or if stdin is not available.
307
- */
308
- export function readStdinByteSync() {
309
- const buf = new Uint8Array(1);
310
- const deno = IS_DENO ? getDenoRuntime() : undefined;
311
- if (deno) {
312
- const n = deno.stdin.readSync(buf);
313
- return n ? buf[0] ?? null : null;
314
- }
315
- if (IS_BUN) {
316
- // Bun: read one byte from the file descriptor directly
317
- const BunGlobal = dntShim.dntGlobalThis
318
- .Bun;
319
- const chunk = BunGlobal?.stdin?.read?.(1);
320
- if (chunk && chunk.length > 0) {
321
- const first = chunk.at(0);
322
- return first ?? null;
323
- }
324
- return null;
325
- }
326
- return null;
327
- }
@@ -1,10 +0,0 @@
1
- export type RuntimeProcess = typeof import("node:process");
2
- /**
3
- * Detect a real Node/Bun process object.
4
- * Browser bundles may inject `window.process = { env: {} }`, which is not enough
5
- * to safely call process APIs like cwd(), exit(), or on().
6
- */
7
- export declare function testHasRuntimeProcess(processLike: unknown): processLike is RuntimeProcess;
8
- export declare const runtimeProcess: RuntimeProcess | null;
9
- export declare function isWindowsPlatform(): boolean;
10
- //# sourceMappingURL=runtime-process.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime-process.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/process/runtime-process.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,cAAc,GAAG,cAAc,cAAc,CAAC,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,OAAO,GAAG,WAAW,IAAI,cAAc,CAIzF;AAED,eAAO,MAAM,cAAc,EAAE,cAAc,GAAG,IAEtC,CAAC;AAET,wBAAgB,iBAAiB,IAAI,OAAO,CAM3C"}
@@ -1,25 +0,0 @@
1
- import * as dntShim from "../../../../_dnt.shims.js";
2
- import { getDenoRuntime, isDeno as IS_DENO } from "../runtime.js";
3
- const nodeProcess = dntShim.dntGlobalThis.process;
4
- /**
5
- * Detect a real Node/Bun process object.
6
- * Browser bundles may inject `window.process = { env: {} }`, which is not enough
7
- * to safely call process APIs like cwd(), exit(), or on().
8
- */
9
- export function testHasRuntimeProcess(processLike) {
10
- if (!processLike || typeof processLike !== "object")
11
- return false;
12
- const versions = processLike.versions;
13
- return typeof versions?.node === "string" && versions.node.length > 0;
14
- }
15
- export const runtimeProcess = testHasRuntimeProcess(nodeProcess)
16
- ? nodeProcess
17
- : null;
18
- export function isWindowsPlatform() {
19
- const deno = IS_DENO ? getDenoRuntime() : undefined;
20
- if (deno)
21
- return deno.build.os === "windows";
22
- const platform = runtimeProcess?.platform ??
23
- dntShim.dntGlobalThis.process?.platform;
24
- return platform === "win32";
25
- }
@@ -1,5 +0,0 @@
1
- export { deleteEnv, env, type EnvBooleanOptions, getEnv, getEnvBoolean, getEnvNumber, getEnvOverlayStorage, getEnvString, getHostEnv, setEnv, } from "./process/env.js";
2
- export { chdir, cwd, execPath, exit, getArgs, getOsType, getRuntimeVersion, getStdout, getTerminalSize, isInteractive, isStdoutTTY, memoryUsage, onGlobalError, onSignal, pid, promptSync, readStdinByteSync, unrefTimer, uptime, writeStdout, writeStdoutAsync, } from "./process/lifecycle.js";
3
- export { testHasRuntimeProcess } from "./process/runtime-process.js";
4
- export { type CommandOptions, type CommandResult, runCommand } from "./process/command.js";
5
- //# sourceMappingURL=process.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/process.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,GAAG,EACH,KAAK,iBAAiB,EACtB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,MAAM,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,EACL,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,WAAW,EACX,aAAa,EACb,QAAQ,EACR,GAAG,EACH,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,MAAM,EACN,WAAW,EACX,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,4 +0,0 @@
1
- export { deleteEnv, env, getEnv, getEnvBoolean, getEnvNumber, getEnvOverlayStorage, getEnvString, getHostEnv, setEnv, } from "./process/env.js";
2
- export { chdir, cwd, execPath, exit, getArgs, getOsType, getRuntimeVersion, getStdout, getTerminalSize, isInteractive, isStdoutTTY, memoryUsage, onGlobalError, onSignal, pid, promptSync, readStdinByteSync, unrefTimer, uptime, writeStdout, writeStdoutAsync, } from "./process/lifecycle.js";
3
- export { testHasRuntimeProcess } from "./process/runtime-process.js";
4
- export { runCommand } from "./process/command.js";
@@ -1,51 +0,0 @@
1
- import * as dntShim from "../../../_dnt.shims.js";
2
- export declare function getDenoRuntime(): typeof dntShim.Deno | undefined;
3
- /**
4
- * Check if an executable path is a compiled Deno binary.
5
- * Detects by binary name: "deno" or "deno.exe" = standard runtime, anything else = compiled.
6
- * @internal Exported for testing only.
7
- */
8
- export declare function testDenoCompiledDetection(execPath: string, standalone?: boolean): boolean;
9
- /** True if running in Bun runtime (check first since Bun has process.versions.node) */
10
- export declare const isBun: boolean;
11
- /** True if running in Node.js runtime (has process.versions.node, not Bun, not shimmed Deno) */
12
- export declare const isNode: boolean;
13
- /** True if running in real Deno runtime (not dnt shim) */
14
- export declare const isDeno: boolean;
15
- /**
16
- * True if running in a compiled Deno binary.
17
- * Compiled binaries cannot dynamically import HTTP URLs - they must use local file:// paths.
18
- * This is evaluated once at module load time.
19
- */
20
- export declare const isDenoCompiled: boolean;
21
- /** True if running in Cloudflare Workers runtime */
22
- export declare const isCloudflare: boolean;
23
- /**
24
- * Detect if running in Node.js (vs Deno) at call time.
25
- * Use this function instead of the constant when runtime detection needs to happen
26
- * at call time (e.g., when bundled with esbuild's __esm lazy initialization pattern).
27
- */
28
- export declare function isNodeRuntime(): boolean;
29
- /**
30
- * Detect if code is executing in a server environment (SSR).
31
- *
32
- * This function provides consistent SSR detection that works correctly even when
33
- * SSR globals stub the window/document objects. It should be used instead of
34
- * `typeof window === "undefined"` checks to avoid hydration mismatches.
35
- *
36
- * Priority:
37
- * 1. Check __VERYFRONT_SSR__ flag (set by ssr-globals/index.ts) - most reliable
38
- * 2. Check if window is undefined (fallback for non-veryfront environments)
39
- *
40
- * @returns true if executing on server, false if in browser
41
- * @see plans/architecture-audit/006.1-ssr-detection-inconsistencies.md
42
- */
43
- export declare function isServerEnvironment(): boolean;
44
- /**
45
- * Detect if code is executing in a browser environment.
46
- * Inverse of isServerEnvironment() - use this instead of `typeof window !== "undefined"`.
47
- *
48
- * @returns true if executing in browser, false if on server
49
- */
50
- export declare function isBrowserEnvironment(): boolean;
51
- //# sourceMappingURL=runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/platform/compat/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAelD,wBAAgB,cAAc,IAAI,OAAO,OAAO,CAAC,IAAI,GAAG,SAAS,CAWhE;AAMD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAQzF;AAuBD,uFAAuF;AACvF,eAAO,MAAM,KAAK,EAAE,OAAwB,CAAC;AAE7C,gGAAgG;AAChG,eAAO,MAAM,MAAM,EAAE,OAAoC,CAAC;AAE1D,0DAA0D;AAC1D,eAAO,MAAM,MAAM,EAAE,OAA4C,CAAC;AAElE;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,OAA0C,CAAC;AAExE,oDAAoD;AACpD,eAAO,MAAM,YAAY,EAAE,OAAgC,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAK7C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
@@ -1,104 +0,0 @@
1
- import * as dntShim from "../../../_dnt.shims.js";
2
- function hasNodeProcess() {
3
- const global = dntShim.dntGlobalThis;
4
- return global.process?.versions?.node != null && !global.process?.versions?.deno;
5
- }
6
- function hasBunGlobal() {
7
- return dntShim.dntGlobalThis.Bun != null;
8
- }
9
- export function getDenoRuntime() {
10
- const deno = Reflect.get(dntShim.dntGlobalThis, "Deno");
11
- if (deno &&
12
- typeof deno.version === "object" &&
13
- typeof deno.build === "object" &&
14
- typeof deno.build.os === "string") {
15
- return deno;
16
- }
17
- return undefined;
18
- }
19
- function hasRealDeno() {
20
- return getDenoRuntime() != null;
21
- }
22
- /**
23
- * Check if an executable path is a compiled Deno binary.
24
- * Detects by binary name: "deno" or "deno.exe" = standard runtime, anything else = compiled.
25
- * @internal Exported for testing only.
26
- */
27
- export function testDenoCompiledDetection(execPath, standalone) {
28
- if (standalone !== undefined)
29
- return standalone;
30
- if (!execPath)
31
- return false;
32
- const binaryName = execPath.split(/[/\\]/).pop()?.toLowerCase();
33
- if (!binaryName)
34
- return false;
35
- return binaryName !== "deno" && binaryName !== "deno.exe";
36
- }
37
- /** Compiled Deno binaries cannot dynamically import HTTP URLs at runtime. */
38
- function isDenoCompiledBinary() {
39
- const deno = getDenoRuntime();
40
- if (!deno)
41
- return false;
42
- try {
43
- const standalone = Reflect.get(deno.build, "standalone");
44
- return testDenoCompiledDetection(deno.execPath(), typeof standalone === "boolean" ? standalone : undefined);
45
- }
46
- catch (_) {
47
- /* expected: Deno.execPath() may not be available in all environments */
48
- return false;
49
- }
50
- }
51
- function hasCloudflareGlobals() {
52
- return "caches" in dntShim.dntGlobalThis && "WebSocketPair" in dntShim.dntGlobalThis;
53
- }
54
- /** True if running in Bun runtime (check first since Bun has process.versions.node) */
55
- export const isBun = hasBunGlobal();
56
- /** True if running in Node.js runtime (has process.versions.node, not Bun, not shimmed Deno) */
57
- export const isNode = !isBun && hasNodeProcess();
58
- /** True if running in real Deno runtime (not dnt shim) */
59
- export const isDeno = !isNode && !isBun && hasRealDeno();
60
- /**
61
- * True if running in a compiled Deno binary.
62
- * Compiled binaries cannot dynamically import HTTP URLs - they must use local file:// paths.
63
- * This is evaluated once at module load time.
64
- */
65
- export const isDenoCompiled = isDeno && isDenoCompiledBinary();
66
- /** True if running in Cloudflare Workers runtime */
67
- export const isCloudflare = hasCloudflareGlobals();
68
- /**
69
- * Detect if running in Node.js (vs Deno) at call time.
70
- * Use this function instead of the constant when runtime detection needs to happen
71
- * at call time (e.g., when bundled with esbuild's __esm lazy initialization pattern).
72
- */
73
- export function isNodeRuntime() {
74
- return !hasBunGlobal() && hasNodeProcess();
75
- }
76
- /**
77
- * Detect if code is executing in a server environment (SSR).
78
- *
79
- * This function provides consistent SSR detection that works correctly even when
80
- * SSR globals stub the window/document objects. It should be used instead of
81
- * `typeof window === "undefined"` checks to avoid hydration mismatches.
82
- *
83
- * Priority:
84
- * 1. Check __VERYFRONT_SSR__ flag (set by ssr-globals/index.ts) - most reliable
85
- * 2. Check if window is undefined (fallback for non-veryfront environments)
86
- *
87
- * @returns true if executing on server, false if in browser
88
- * @see plans/architecture-audit/006.1-ssr-detection-inconsistencies.md
89
- */
90
- export function isServerEnvironment() {
91
- const ssrFlag = dntShim.dntGlobalThis.__VERYFRONT_SSR__;
92
- if (ssrFlag === true)
93
- return true;
94
- return typeof dntShim.dntGlobalThis === "undefined";
95
- }
96
- /**
97
- * Detect if code is executing in a browser environment.
98
- * Inverse of isServerEnvironment() - use this instead of `typeof window !== "undefined"`.
99
- *
100
- * @returns true if executing in browser, false if on server
101
- */
102
- export function isBrowserEnvironment() {
103
- return !isServerEnvironment();
104
- }
@@ -1,70 +0,0 @@
1
- /**
2
- * Canonical URL builders for import rewriting.
3
- *
4
- * Single source of truth for all URL generation.
5
- * Ensures consistent URLs across SSR and browser for hydration parity.
6
- */
7
- /**
8
- * Default React version - used when not specified.
9
- *
10
- * MUST match the React version the build bundles (see `react/deno.json`),
11
- * because veryfront's framework React re-export is generated against that
12
- * version and references its named exports. A drift guard in
13
- * `src/utils/constants/cdn.test.ts` enforces this.
14
- */
15
- export declare const DEFAULT_REACT_VERSION = "19.2.4";
16
- /** Tailwind CSS version */
17
- export declare const TAILWIND_VERSION = "4.1.8";
18
- /** csstype version - must match deno.json for type consistency */
19
- export declare const CSSTYPE_VERSION = "3.2.3";
20
- type EsmShOptions = {
21
- external?: string[];
22
- target?: string;
23
- deps?: Record<string, string>;
24
- };
25
- /**
26
- * Build esm.sh URL with proper configuration.
27
- *
28
- * @param pkg - Package name (e.g., "react", "lodash")
29
- * @param version - Package version (optional)
30
- * @param subpath - Subpath (e.g., "/jsx-runtime")
31
- * @param options - URL options
32
- */
33
- export declare function buildEsmShUrl(pkg: string, version?: string, subpath?: string, options?: EsmShOptions): string;
34
- /**
35
- * Build React esm.sh URL.
36
- * Uses deps=csstype for type consistency.
37
- */
38
- export declare function buildReactUrl(pkg: "react" | "react-dom", version: string, subpath?: string, external?: boolean): string;
39
- /**
40
- * Get complete React import map for a specific version.
41
- */
42
- export declare function getReactImportMap(version: string): Record<string, string>;
43
- /**
44
- * Build module server URL for a path.
45
- */
46
- export declare function buildModuleServerUrl(baseUrl: string, path: string): string;
47
- /**
48
- * Build cross-project import URL.
49
- */
50
- export declare function buildCrossProjectUrl(projectSlug: string, version: string | null, path: string): string;
51
- /**
52
- * Build veryfront framework module URL.
53
- */
54
- export declare function buildVeryfrontModuleUrl(path: string): string;
55
- /**
56
- * Normalize file extension for JavaScript output.
57
- */
58
- export declare function normalizeExtension(path: string, options?: {
59
- removeExtension?: boolean;
60
- }): string;
61
- /**
62
- * Check if a URL is an esm.sh URL.
63
- */
64
- export declare function isEsmShUrl(url: string): boolean;
65
- /**
66
- * Add deps query param to esm.sh URL if not already present.
67
- */
68
- export declare function addEsmShDeps(url: string, reactVersion: string): string;
69
- export {};
70
- //# sourceMappingURL=url-builder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"url-builder.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/url-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C,2BAA2B;AAC3B,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,kEAAkE;AAClE,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,YAAY,GACrB,MAAM,CAqBR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,OAAO,GAAG,WAAW,EAC1B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,UAAQ,GACf,MAAM,CAKR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWzE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAI1E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,IAAI,EAAE,MAAM,GACX,MAAM,CAIR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAGhG;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAgDtE"}