veryfront 0.1.215 → 0.1.217

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 (305) hide show
  1. package/README.md +1 -1
  2. package/esm/cli/commands/extension/command-help.d.ts +3 -0
  3. package/esm/cli/commands/extension/command-help.d.ts.map +1 -0
  4. package/esm/cli/commands/extension/command-help.js +16 -0
  5. package/esm/cli/commands/extension/handler.d.ts +3 -0
  6. package/esm/cli/commands/extension/handler.d.ts.map +1 -0
  7. package/esm/cli/commands/extension/handler.js +36 -0
  8. package/esm/cli/commands/extension/init-command.d.ts +19 -0
  9. package/esm/cli/commands/extension/init-command.d.ts.map +1 -0
  10. package/esm/cli/commands/extension/init-command.js +122 -0
  11. package/esm/cli/commands/extension/validate-command.d.ts +13 -0
  12. package/esm/cli/commands/extension/validate-command.d.ts.map +1 -0
  13. package/esm/cli/commands/extension/validate-command.js +62 -0
  14. package/esm/cli/commands/generate/integration-generator-helpers.d.ts +35 -0
  15. package/esm/cli/commands/generate/integration-generator-helpers.d.ts.map +1 -0
  16. package/esm/cli/commands/generate/integration-generator-helpers.js +123 -0
  17. package/esm/cli/commands/generate/integration-generator.d.ts +1 -2
  18. package/esm/cli/commands/generate/integration-generator.d.ts.map +1 -1
  19. package/esm/cli/commands/generate/integration-generator.js +1 -123
  20. package/esm/cli/commands/knowledge/command-helpers.d.ts +48 -0
  21. package/esm/cli/commands/knowledge/command-helpers.d.ts.map +1 -0
  22. package/esm/cli/commands/knowledge/command-helpers.js +216 -0
  23. package/esm/cli/commands/knowledge/command.d.ts +12 -17
  24. package/esm/cli/commands/knowledge/command.d.ts.map +1 -1
  25. package/esm/cli/commands/knowledge/command.js +26 -214
  26. package/esm/cli/help/command-definitions.d.ts.map +1 -1
  27. package/esm/cli/help/command-definitions.js +2 -0
  28. package/esm/cli/mcp/remote-file-tool-helpers.d.ts +5 -0
  29. package/esm/cli/mcp/remote-file-tool-helpers.d.ts.map +1 -0
  30. package/esm/cli/mcp/remote-file-tool-helpers.js +22 -0
  31. package/esm/cli/mcp/remote-file-tools.d.ts.map +1 -1
  32. package/esm/cli/mcp/remote-file-tools.js +1 -22
  33. package/esm/cli/router.d.ts.map +1 -1
  34. package/esm/cli/router.js +2 -0
  35. package/esm/cli/templates/integration-loader-helpers.d.ts +8 -0
  36. package/esm/cli/templates/integration-loader-helpers.d.ts.map +1 -0
  37. package/esm/cli/templates/integration-loader-helpers.js +29 -0
  38. package/esm/cli/templates/integration-loader.d.ts.map +1 -1
  39. package/esm/cli/templates/integration-loader.js +5 -21
  40. package/esm/cli/templates/manifest.d.ts +1 -0
  41. package/esm/cli/templates/manifest.js +2 -1
  42. package/esm/deno.d.ts +3 -0
  43. package/esm/deno.js +5 -2
  44. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  45. package/esm/src/agent/runtime/index.js +48 -90
  46. package/esm/src/chat/ag-ui-helpers.d.ts +17 -0
  47. package/esm/src/chat/ag-ui-helpers.d.ts.map +1 -0
  48. package/esm/src/chat/ag-ui-helpers.js +111 -0
  49. package/esm/src/chat/ag-ui.d.ts.map +1 -1
  50. package/esm/src/chat/ag-ui.js +1 -111
  51. package/esm/src/config/schemas/config.schema.d.ts +1 -0
  52. package/esm/src/config/schemas/config.schema.d.ts.map +1 -1
  53. package/esm/src/config/schemas/config.schema.js +11 -0
  54. package/esm/src/config/schemas/index.d.ts +11 -1
  55. package/esm/src/config/schemas/index.d.ts.map +1 -1
  56. package/esm/src/errors/error-registry-helpers.d.ts +6 -0
  57. package/esm/src/errors/error-registry-helpers.d.ts.map +1 -0
  58. package/esm/src/errors/error-registry-helpers.js +9 -0
  59. package/esm/src/errors/error-registry.d.ts.map +1 -1
  60. package/esm/src/errors/error-registry.js +4 -3
  61. package/esm/src/extensions/capabilities.d.ts +20 -0
  62. package/esm/src/extensions/capabilities.d.ts.map +1 -0
  63. package/esm/src/extensions/capabilities.js +77 -0
  64. package/esm/src/extensions/contracts.d.ts +10 -0
  65. package/esm/src/extensions/contracts.d.ts.map +1 -0
  66. package/esm/src/extensions/contracts.js +28 -0
  67. package/esm/src/extensions/discovery.d.ts +48 -0
  68. package/esm/src/extensions/discovery.d.ts.map +1 -0
  69. package/esm/src/extensions/discovery.js +179 -0
  70. package/esm/src/extensions/errors.d.ts +10 -0
  71. package/esm/src/extensions/errors.d.ts.map +1 -0
  72. package/esm/src/extensions/errors.js +34 -0
  73. package/esm/src/extensions/factory-loader.d.ts +29 -0
  74. package/esm/src/extensions/factory-loader.d.ts.map +1 -0
  75. package/esm/src/extensions/factory-loader.js +63 -0
  76. package/esm/src/extensions/index.d.ts +37 -0
  77. package/esm/src/extensions/index.d.ts.map +1 -0
  78. package/esm/src/extensions/index.js +41 -0
  79. package/esm/src/extensions/interfaces/ai-model-provider.d.ts +94 -0
  80. package/esm/src/extensions/interfaces/ai-model-provider.d.ts.map +1 -0
  81. package/esm/src/extensions/interfaces/ai-model-provider.js +8 -0
  82. package/esm/src/extensions/interfaces/auth-provider.d.ts +49 -0
  83. package/esm/src/extensions/interfaces/auth-provider.d.ts.map +1 -0
  84. package/esm/src/extensions/interfaces/auth-provider.js +8 -0
  85. package/esm/src/extensions/interfaces/bundler.d.ts +118 -0
  86. package/esm/src/extensions/interfaces/bundler.d.ts.map +1 -0
  87. package/esm/src/extensions/interfaces/bundler.js +8 -0
  88. package/esm/src/extensions/interfaces/cache-store.d.ts +27 -0
  89. package/esm/src/extensions/interfaces/cache-store.d.ts.map +1 -0
  90. package/esm/src/extensions/interfaces/cache-store.js +8 -0
  91. package/esm/src/extensions/interfaces/code-parser.d.ts +76 -0
  92. package/esm/src/extensions/interfaces/code-parser.d.ts.map +1 -0
  93. package/esm/src/extensions/interfaces/code-parser.js +8 -0
  94. package/esm/src/extensions/interfaces/content-transformer.d.ts +40 -0
  95. package/esm/src/extensions/interfaces/content-transformer.d.ts.map +1 -0
  96. package/esm/src/extensions/interfaces/content-transformer.js +8 -0
  97. package/esm/src/extensions/interfaces/css-processor.d.ts +38 -0
  98. package/esm/src/extensions/interfaces/css-processor.d.ts.map +1 -0
  99. package/esm/src/extensions/interfaces/css-processor.js +8 -0
  100. package/esm/src/extensions/interfaces/database-client.d.ts +31 -0
  101. package/esm/src/extensions/interfaces/database-client.d.ts.map +1 -0
  102. package/esm/src/extensions/interfaces/database-client.js +8 -0
  103. package/esm/src/extensions/interfaces/embedding-provider.d.ts +37 -0
  104. package/esm/src/extensions/interfaces/embedding-provider.d.ts.map +1 -0
  105. package/esm/src/extensions/interfaces/embedding-provider.js +8 -0
  106. package/esm/src/extensions/interfaces/index.d.ts +21 -0
  107. package/esm/src/extensions/interfaces/index.d.ts.map +1 -0
  108. package/esm/src/extensions/interfaces/index.js +9 -0
  109. package/esm/src/extensions/interfaces/node-compat.d.ts +25 -0
  110. package/esm/src/extensions/interfaces/node-compat.d.ts.map +1 -0
  111. package/esm/src/extensions/interfaces/node-compat.js +8 -0
  112. package/esm/src/extensions/interfaces/schema-validator.d.ts +46 -0
  113. package/esm/src/extensions/interfaces/schema-validator.d.ts.map +1 -0
  114. package/esm/src/extensions/interfaces/schema-validator.js +8 -0
  115. package/esm/src/extensions/interfaces/tracing-exporter.d.ts +44 -0
  116. package/esm/src/extensions/interfaces/tracing-exporter.d.ts.map +1 -0
  117. package/esm/src/extensions/interfaces/tracing-exporter.js +8 -0
  118. package/esm/src/extensions/loader.d.ts +33 -0
  119. package/esm/src/extensions/loader.d.ts.map +1 -0
  120. package/esm/src/extensions/loader.js +209 -0
  121. package/esm/src/extensions/orchestrate.d.ts +54 -0
  122. package/esm/src/extensions/orchestrate.d.ts.map +1 -0
  123. package/esm/src/extensions/orchestrate.js +116 -0
  124. package/esm/src/extensions/recommendations.d.ts +7 -0
  125. package/esm/src/extensions/recommendations.d.ts.map +1 -0
  126. package/esm/src/extensions/recommendations.js +22 -0
  127. package/esm/src/extensions/types.d.ts +47 -0
  128. package/esm/src/extensions/types.d.ts.map +1 -0
  129. package/esm/src/extensions/types.js +6 -0
  130. package/esm/src/extensions/validation.d.ts +44 -0
  131. package/esm/src/extensions/validation.d.ts.map +1 -0
  132. package/esm/src/extensions/validation.js +115 -0
  133. package/esm/src/html/styles-builder/plugin-loader.d.ts.map +1 -1
  134. package/esm/src/html/styles-builder/plugin-loader.js +23 -0
  135. package/esm/src/html/styles-builder/tailwind-plugin-allowlist.d.ts +29 -0
  136. package/esm/src/html/styles-builder/tailwind-plugin-allowlist.d.ts.map +1 -0
  137. package/esm/src/html/styles-builder/tailwind-plugin-allowlist.js +48 -0
  138. package/esm/src/modules/react-loader/ssr-module-loader/loader-helpers.d.ts +15 -0
  139. package/esm/src/modules/react-loader/ssr-module-loader/loader-helpers.d.ts.map +1 -0
  140. package/esm/src/modules/react-loader/ssr-module-loader/loader-helpers.js +22 -0
  141. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts +0 -2
  142. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  143. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +4 -24
  144. package/esm/src/platform/adapters/fs/veryfront/adapter-helpers.d.ts +19 -0
  145. package/esm/src/platform/adapters/fs/veryfront/adapter-helpers.d.ts.map +1 -0
  146. package/esm/src/platform/adapters/fs/veryfront/adapter-helpers.js +26 -0
  147. package/esm/src/platform/adapters/fs/veryfront/adapter.d.ts.map +1 -1
  148. package/esm/src/platform/adapters/fs/veryfront/adapter.js +4 -20
  149. package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.d.ts +1 -0
  150. package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.d.ts.map +1 -1
  151. package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.js +3 -0
  152. package/esm/src/platform/adapters/fs/veryfront/read-operations.d.ts.map +1 -1
  153. package/esm/src/platform/adapters/fs/veryfront/read-operations.js +4 -7
  154. package/esm/src/platform/adapters/fs/veryfront/websocket-manager-helpers.d.ts +28 -0
  155. package/esm/src/platform/adapters/fs/veryfront/websocket-manager-helpers.d.ts.map +1 -0
  156. package/esm/src/platform/adapters/fs/veryfront/websocket-manager-helpers.js +41 -0
  157. package/esm/src/platform/adapters/fs/veryfront/websocket-manager.d.ts +1 -4
  158. package/esm/src/platform/adapters/fs/veryfront/websocket-manager.d.ts.map +1 -1
  159. package/esm/src/platform/adapters/fs/veryfront/websocket-manager.js +7 -40
  160. package/esm/src/platform/compat/process/command.d.ts +31 -0
  161. package/esm/src/platform/compat/process/command.d.ts.map +1 -0
  162. package/esm/src/platform/compat/process/command.js +193 -0
  163. package/esm/src/platform/compat/process/env.d.ts +31 -0
  164. package/esm/src/platform/compat/process/env.d.ts.map +1 -0
  165. package/esm/src/platform/compat/process/env.js +175 -0
  166. package/esm/src/platform/compat/process/lifecycle.d.ts +98 -0
  167. package/esm/src/platform/compat/process/lifecycle.d.ts.map +1 -0
  168. package/esm/src/platform/compat/process/lifecycle.js +305 -0
  169. package/esm/src/platform/compat/process/runtime-process.d.ts +10 -0
  170. package/esm/src/platform/compat/process/runtime-process.d.ts.map +1 -0
  171. package/esm/src/platform/compat/process/runtime-process.js +24 -0
  172. package/esm/src/platform/compat/process.d.ts +4 -165
  173. package/esm/src/platform/compat/process.d.ts.map +1 -1
  174. package/esm/src/platform/compat/process.js +4 -682
  175. package/esm/src/platform/index.d.ts +1 -1
  176. package/esm/src/platform/index.d.ts.map +1 -1
  177. package/esm/src/provider/runtime-loader/provider-endpoints.d.ts +8 -0
  178. package/esm/src/provider/runtime-loader/provider-endpoints.d.ts.map +1 -0
  179. package/esm/src/provider/runtime-loader/provider-endpoints.js +27 -0
  180. package/esm/src/provider/runtime-loader/provider-request-init.d.ts +32 -0
  181. package/esm/src/provider/runtime-loader/provider-request-init.d.ts.map +1 -0
  182. package/esm/src/provider/runtime-loader/provider-request-init.js +67 -0
  183. package/esm/src/provider/runtime-loader/tool-input-status.d.ts +17 -0
  184. package/esm/src/provider/runtime-loader/tool-input-status.d.ts.map +1 -0
  185. package/esm/src/provider/runtime-loader/tool-input-status.js +155 -0
  186. package/esm/src/provider/runtime-loader.d.ts +2 -3
  187. package/esm/src/provider/runtime-loader.d.ts.map +1 -1
  188. package/esm/src/provider/runtime-loader.js +92 -291
  189. package/esm/src/proxy/handler.d.ts.map +1 -1
  190. package/esm/src/proxy/handler.js +14 -0
  191. package/esm/src/rendering/orchestrator/pipeline-helpers.d.ts +8 -0
  192. package/esm/src/rendering/orchestrator/pipeline-helpers.d.ts.map +1 -0
  193. package/esm/src/rendering/orchestrator/pipeline-helpers.js +20 -0
  194. package/esm/src/rendering/orchestrator/pipeline.d.ts +0 -3
  195. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  196. package/esm/src/rendering/orchestrator/pipeline.js +4 -22
  197. package/esm/src/routing/api/module-loader/loader-helpers.d.ts +10 -0
  198. package/esm/src/routing/api/module-loader/loader-helpers.d.ts.map +1 -0
  199. package/esm/src/routing/api/module-loader/loader-helpers.js +62 -0
  200. package/esm/src/routing/api/module-loader/loader.d.ts +1 -1
  201. package/esm/src/routing/api/module-loader/loader.d.ts.map +1 -1
  202. package/esm/src/routing/api/module-loader/loader.js +2 -60
  203. package/esm/src/server/bootstrap.d.ts +22 -2
  204. package/esm/src/server/bootstrap.d.ts.map +1 -1
  205. package/esm/src/server/bootstrap.js +67 -5
  206. package/esm/src/server/dev-ui/manifest.d.ts +2 -0
  207. package/esm/src/server/dev-ui/manifest.js +3 -1
  208. package/esm/src/server/handlers/request/api/project-discovery.d.ts.map +1 -1
  209. package/esm/src/server/handlers/request/api/project-discovery.js +14 -8
  210. package/esm/src/server/production-server.js +1 -1
  211. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
  212. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +2 -2
  213. package/esm/src/server/utils/domain-parser.d.ts.map +1 -1
  214. package/esm/src/server/utils/domain-parser.js +4 -0
  215. package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
  216. package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
  217. package/esm/src/tool/index.d.ts +1 -1
  218. package/esm/src/tool/index.d.ts.map +1 -1
  219. package/esm/src/tool/types.d.ts +20 -0
  220. package/esm/src/tool/types.d.ts.map +1 -1
  221. package/esm/src/utils/version-constant.d.ts +1 -1
  222. package/esm/src/utils/version-constant.js +1 -1
  223. package/package.json +7 -1
  224. package/src/cli/commands/extension/command-help.ts +18 -0
  225. package/src/cli/commands/extension/handler.ts +41 -0
  226. package/src/cli/commands/extension/init-command.ts +140 -0
  227. package/src/cli/commands/extension/validate-command.ts +78 -0
  228. package/src/cli/commands/generate/integration-generator-helpers.ts +185 -0
  229. package/src/cli/commands/generate/integration-generator.ts +12 -168
  230. package/src/cli/commands/knowledge/command-helpers.ts +295 -0
  231. package/src/cli/commands/knowledge/command.ts +34 -261
  232. package/src/cli/help/command-definitions.ts +2 -0
  233. package/src/cli/mcp/remote-file-tool-helpers.ts +27 -0
  234. package/src/cli/mcp/remote-file-tools.ts +6 -28
  235. package/src/cli/router.ts +2 -0
  236. package/src/cli/templates/integration-loader-helpers.ts +49 -0
  237. package/src/cli/templates/integration-loader.ts +10 -28
  238. package/src/cli/templates/manifest.js +2 -1
  239. package/src/deno.js +5 -2
  240. package/src/src/agent/runtime/index.ts +77 -94
  241. package/src/src/chat/ag-ui-helpers.ts +139 -0
  242. package/src/src/chat/ag-ui.ts +11 -139
  243. package/src/src/config/schemas/config.schema.ts +11 -0
  244. package/src/src/config/schemas/index.ts +15 -1
  245. package/src/src/errors/error-registry-helpers.ts +23 -0
  246. package/src/src/errors/error-registry.ts +8 -3
  247. package/src/src/extensions/capabilities.ts +97 -0
  248. package/src/src/extensions/contracts.ts +36 -0
  249. package/src/src/extensions/discovery.ts +221 -0
  250. package/src/src/extensions/errors.ts +39 -0
  251. package/src/src/extensions/factory-loader.ts +76 -0
  252. package/src/src/extensions/index.ts +79 -0
  253. package/src/src/extensions/interfaces/ai-model-provider.ts +100 -0
  254. package/src/src/extensions/interfaces/auth-provider.ts +52 -0
  255. package/src/src/extensions/interfaces/bundler.ts +116 -0
  256. package/src/src/extensions/interfaces/cache-store.ts +27 -0
  257. package/src/src/extensions/interfaces/code-parser.ts +84 -0
  258. package/src/src/extensions/interfaces/content-transformer.ts +38 -0
  259. package/src/src/extensions/interfaces/css-processor.ts +40 -0
  260. package/src/src/extensions/interfaces/database-client.ts +35 -0
  261. package/src/src/extensions/interfaces/embedding-provider.ts +39 -0
  262. package/src/src/extensions/interfaces/index.ts +81 -0
  263. package/src/src/extensions/interfaces/node-compat.ts +25 -0
  264. package/src/src/extensions/interfaces/schema-validator.ts +51 -0
  265. package/src/src/extensions/interfaces/tracing-exporter.ts +42 -0
  266. package/src/src/extensions/loader.ts +245 -0
  267. package/src/src/extensions/orchestrate.ts +184 -0
  268. package/src/src/extensions/recommendations.ts +24 -0
  269. package/src/src/extensions/types.ts +57 -0
  270. package/src/src/extensions/validation.ts +147 -0
  271. package/src/src/html/styles-builder/plugin-loader.ts +32 -0
  272. package/src/src/html/styles-builder/tailwind-plugin-allowlist.ts +51 -0
  273. package/src/src/modules/react-loader/ssr-module-loader/loader-helpers.ts +37 -0
  274. package/src/src/modules/react-loader/ssr-module-loader/loader.ts +8 -39
  275. package/src/src/platform/adapters/fs/veryfront/adapter-helpers.ts +43 -0
  276. package/src/src/platform/adapters/fs/veryfront/adapter.ts +8 -22
  277. package/src/src/platform/adapters/fs/veryfront/read-operations-helpers.ts +4 -0
  278. package/src/src/platform/adapters/fs/veryfront/read-operations.ts +4 -7
  279. package/src/src/platform/adapters/fs/veryfront/websocket-manager-helpers.ts +73 -0
  280. package/src/src/platform/adapters/fs/veryfront/websocket-manager.ts +29 -44
  281. package/src/src/platform/compat/process/command.ts +297 -0
  282. package/src/src/platform/compat/process/env.ts +227 -0
  283. package/src/src/platform/compat/process/lifecycle.ts +330 -0
  284. package/src/src/platform/compat/process/runtime-process.ts +27 -0
  285. package/src/src/platform/compat/process.ts +37 -870
  286. package/src/src/platform/index.ts +1 -0
  287. package/src/src/provider/runtime-loader/provider-endpoints.ts +50 -0
  288. package/src/src/provider/runtime-loader/provider-request-init.ts +101 -0
  289. package/src/src/provider/runtime-loader/tool-input-status.ts +210 -0
  290. package/src/src/provider/runtime-loader.ts +113 -368
  291. package/src/src/proxy/handler.ts +16 -0
  292. package/src/src/rendering/orchestrator/pipeline-helpers.ts +35 -0
  293. package/src/src/rendering/orchestrator/pipeline.ts +8 -35
  294. package/src/src/routing/api/module-loader/loader-helpers.ts +68 -0
  295. package/src/src/routing/api/module-loader/loader.ts +8 -65
  296. package/src/src/server/bootstrap.ts +88 -7
  297. package/src/src/server/dev-ui/manifest.js +3 -1
  298. package/src/src/server/handlers/request/api/project-discovery.ts +19 -8
  299. package/src/src/server/production-server.ts +1 -1
  300. package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +2 -2
  301. package/src/src/server/utils/domain-parser.ts +4 -0
  302. package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
  303. package/src/src/tool/index.ts +1 -0
  304. package/src/src/tool/types.ts +21 -0
  305. package/src/src/utils/version-constant.ts +1 -1
@@ -0,0 +1,175 @@
1
+ import * as dntShim from "../../../../_dnt.shims.js";
2
+ import { isDeno as IS_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
+ export function env() {
17
+ const base = IS_DENO
18
+ ? dntShim.Deno.env.toObject()
19
+ : runtimeProcess
20
+ ? { ...runtimeProcess.env }
21
+ : {};
22
+ const overlay = getEnvOverlayStore();
23
+ if (!overlay)
24
+ return base;
25
+ for (const [key, value] of overlay.entries()) {
26
+ if (value === null) {
27
+ delete base[key];
28
+ continue;
29
+ }
30
+ base[key] = value;
31
+ }
32
+ return base;
33
+ }
34
+ /**
35
+ * Read a host-level environment variable without consulting any project env overlay.
36
+ * Use this for framework-owned runtime configuration that should not be shadowed by tenant env.
37
+ */
38
+ export function getHostEnv(key) {
39
+ const overlayResult = getOverlayEnvValue(getEnvOverlayStore(), key);
40
+ if (overlayResult.hasValue) {
41
+ return overlayResult.value;
42
+ }
43
+ if (IS_DENO)
44
+ return dntShim.Deno.env.get(key);
45
+ if (runtimeProcess)
46
+ return runtimeProcess.env[key];
47
+ return undefined;
48
+ }
49
+ // Lazy-loaded references to project-env/storage.ts functions.
50
+ // Uses globalThis to avoid circular imports (process compat is low-level, project-env is high-level).
51
+ // IMPORTANT: Only cache when the real getter is found. If storage.ts hasn't loaded yet,
52
+ // re-check globalThis on every call to avoid permanently caching the fallback.
53
+ let _getProjectEnv = null;
54
+ let _isProjectEnvActive = null;
55
+ function getProjectEnvSafe(key) {
56
+ if (_getProjectEnv === null) {
57
+ const mod = dntShim.dntGlobalThis.__vfProjectEnvGetter;
58
+ if (mod) {
59
+ _getProjectEnv = mod;
60
+ }
61
+ else {
62
+ return undefined;
63
+ }
64
+ }
65
+ return _getProjectEnv(key);
66
+ }
67
+ function isProjectEnvActiveSafe() {
68
+ if (_isProjectEnvActive === null) {
69
+ const mod = dntShim.dntGlobalThis.__vfProjectEnvActiveChecker;
70
+ if (mod) {
71
+ _isProjectEnvActive = mod;
72
+ }
73
+ else {
74
+ return false;
75
+ }
76
+ }
77
+ return _isProjectEnvActive();
78
+ }
79
+ export function getEnv(key) {
80
+ // Check per-request project env overlay first (AsyncLocalStorage)
81
+ const projectValue = getProjectEnvSafe(key);
82
+ if (projectValue !== undefined)
83
+ return projectValue;
84
+ // When a project env overlay is active (remote project request), do NOT
85
+ // fall through to host process env. This prevents remote projects from
86
+ // reading host-level secrets like AWS_SECRET_ACCESS_KEY, DATABASE_URL, etc.
87
+ if (isProjectEnvActiveSafe())
88
+ return undefined;
89
+ return getHostEnv(key);
90
+ }
91
+ const DEFAULT_ENV_TRUE_VALUES = ["1", "true", "yes"];
92
+ const DEFAULT_ENV_FALSE_VALUES = ["0", "false", "no"];
93
+ function normalizeEnvToken(value, options) {
94
+ const normalized = options.trim ? value.trim() : value;
95
+ return options.caseSensitive ? normalized : normalized.toLowerCase();
96
+ }
97
+ export function getEnvString(key, fallback) {
98
+ const value = getEnv(key);
99
+ if (value === undefined)
100
+ return fallback;
101
+ return value;
102
+ }
103
+ export function getEnvNumber(key, fallback) {
104
+ const value = getEnvString(key);
105
+ if (value === undefined)
106
+ return fallback;
107
+ const parsed = Number.parseInt(value, 10);
108
+ if (Number.isNaN(parsed))
109
+ return fallback ?? Number.NaN;
110
+ return parsed;
111
+ }
112
+ export function getEnvBoolean(key, fallback = false, options = {}) {
113
+ const value = getEnvString(key);
114
+ if (value === undefined)
115
+ return fallback;
116
+ const trim = options.trim ?? true;
117
+ const caseSensitive = options.caseSensitive ?? false;
118
+ const normalized = normalizeEnvToken(value, { trim, caseSensitive });
119
+ const trueValues = options.trueValues ?? DEFAULT_ENV_TRUE_VALUES;
120
+ for (const trueValue of trueValues) {
121
+ if (normalized === normalizeEnvToken(trueValue, { trim, caseSensitive }))
122
+ return true;
123
+ }
124
+ const falseValues = options.falseValues ?? DEFAULT_ENV_FALSE_VALUES;
125
+ for (const falseValue of falseValues) {
126
+ if (normalized === normalizeEnvToken(falseValue, { trim, caseSensitive }))
127
+ return false;
128
+ }
129
+ return fallback;
130
+ }
131
+ export function setEnv(key, value) {
132
+ const overlay = getEnvOverlayStore();
133
+ if (overlay) {
134
+ overlay.set(key, value);
135
+ return;
136
+ }
137
+ if (IS_DENO) {
138
+ dntShim.Deno.env.set(key, value);
139
+ return;
140
+ }
141
+ if (runtimeProcess) {
142
+ runtimeProcess.env[key] = value;
143
+ return;
144
+ }
145
+ throw new Error("setEnv() is not supported in this runtime");
146
+ }
147
+ export function deleteEnv(key) {
148
+ const overlay = getEnvOverlayStore();
149
+ if (overlay) {
150
+ overlay.set(key, null);
151
+ return;
152
+ }
153
+ if (IS_DENO) {
154
+ dntShim.Deno.env.delete(key);
155
+ return;
156
+ }
157
+ if (runtimeProcess) {
158
+ delete runtimeProcess.env[key];
159
+ return;
160
+ }
161
+ throw new Error("deleteEnv() is not supported in this runtime");
162
+ }
163
+ /**
164
+ * Get an AsyncLocalStorage-based env overlay storage if installed.
165
+ * This enables per-async-context env isolation (e.g., in tests).
166
+ */
167
+ export function getEnvOverlayStorage() {
168
+ const globalAny = dntShim.dntGlobalThis;
169
+ const overlay = globalAny["__vfTestDenoEnvOverlay"] ??
170
+ globalAny["__vfTestEnvOverlay"];
171
+ const storage = overlay?.storage;
172
+ if (!storage || typeof storage.getStore !== "function")
173
+ return null;
174
+ return storage;
175
+ }
@@ -0,0 +1,98 @@
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
+ export declare function cwd(): string;
7
+ export declare function chdir(directory: string): void;
8
+ export declare function pid(): number;
9
+ export declare function memoryUsage(): {
10
+ rss: number;
11
+ heapTotal: number;
12
+ heapUsed: number;
13
+ external: number;
14
+ };
15
+ /**
16
+ * Check if stdin is a TTY (terminal)
17
+ */
18
+ export declare function isInteractive(): boolean;
19
+ /**
20
+ * Check if stdout is a TTY (terminal)
21
+ */
22
+ export declare function isStdoutTTY(): boolean;
23
+ /**
24
+ * Get terminal size (columns and rows)
25
+ * Returns default fallback values if terminal size cannot be determined
26
+ */
27
+ export declare function getTerminalSize(): {
28
+ columns: number;
29
+ rows: number;
30
+ };
31
+ /**
32
+ * Get runtime version string
33
+ */
34
+ export declare function getRuntimeVersion(): string;
35
+ /**
36
+ * Get the operating system type
37
+ * Returns: "darwin" (macOS), "linux", "windows", or the raw platform string
38
+ */
39
+ export declare function getOsType(): string;
40
+ /**
41
+ * Register a signal handler (SIGINT, SIGTERM) for graceful shutdown
42
+ */
43
+ export declare function onSignal(signal: "SIGINT" | "SIGTERM", handler: () => void): void;
44
+ /**
45
+ * Register global error handlers for uncaught exceptions and unhandled promise rejections.
46
+ * These handlers prevent the process from crashing due to application code errors.
47
+ *
48
+ * IMPORTANT: These handlers should be registered early in the application lifecycle
49
+ * to catch errors that escape try/catch blocks.
50
+ *
51
+ * @param onError - Callback invoked with the error. Return true to prevent process exit.
52
+ */
53
+ export declare function onGlobalError(onError: (error: Error, type: "uncaughtException" | "unhandledRejection") => boolean | void): void;
54
+ /**
55
+ * Unreference a timer to prevent it from keeping the process alive
56
+ */
57
+ export declare function unrefTimer(timerId: ReturnType<typeof dntShim.setInterval>): void;
58
+ /**
59
+ * Get the executable path of the current runtime
60
+ */
61
+ export declare function execPath(): string;
62
+ /**
63
+ * Get process uptime in seconds
64
+ * Returns OS uptime on Deno, process uptime on Node.js
65
+ */
66
+ export declare function uptime(): number;
67
+ /**
68
+ * Get stdout stream for writing
69
+ * Returns null if not available (e.g., in browser/workers)
70
+ */
71
+ export declare function getStdout(): {
72
+ write: (data: string) => void;
73
+ } | null;
74
+ /**
75
+ * Write text directly to stdout (sync)
76
+ * No-op if stdout is not available
77
+ */
78
+ export declare function writeStdout(text: string): void;
79
+ /**
80
+ * Write data to stdout asynchronously
81
+ * Returns a promise that resolves when the write is complete
82
+ */
83
+ export declare function writeStdoutAsync(data: Uint8Array): Promise<number>;
84
+ /**
85
+ * Synchronous prompt function that works across Deno and Bun.
86
+ * Displays a message and reads user input from stdin.
87
+ *
88
+ * Note: This relies on globalThis.prompt which is available in Deno and Bun.
89
+ * Returns null in environments where prompt is not available (e.g., Node.js ESM).
90
+ */
91
+ export declare function promptSync(message?: string): string | null;
92
+ /**
93
+ * Read a single byte from stdin synchronously.
94
+ * Requires raw mode to be enabled for character-by-character reading.
95
+ * Returns null on EOF or if stdin is not available.
96
+ */
97
+ export declare function readStdinByteSync(): number | null;
98
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1 @@
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,CAIlC;AAED,yFAAyF;AACzF,wBAAgB,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAIzC;AAED,wBAAgB,GAAG,IAAI,MAAM,CAI5B;AAED,wBAAgB,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAU7C;AAED,wBAAgB,GAAG,IAAI,MAAM,CAI5B;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,CAYA;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAIvC;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAIrC;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAoBnE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAO1C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAQlC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,QAAQ,GAAG,SAAS,EAC5B,OAAO,EAAE,MAAM,IAAI,GAClB,IAAI,CAMN;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,mBAAmB,GAAG,oBAAoB,KAAK,OAAO,GAAG,IAAI,GAC1F,IAAI,CAiDN;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI,CAShF;AAED;;GAEG;AACH,wBAAgB,QAAQ,IAAI,MAAM,CAIjC;AAED;;;GAGG;AACH,wBAAgB,MAAM,IAAI,MAAM,CAU/B;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI;IAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAAG,IAAI,CAUpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE9C;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAcxE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG1D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAsBjD"}
@@ -0,0 +1,305 @@
1
+ import * as dntShim from "../../../../_dnt.shims.js";
2
+ import { 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
+ if (IS_DENO)
7
+ return dntShim.Deno.args;
8
+ if (runtimeProcess)
9
+ return runtimeProcess.argv.slice(2);
10
+ return [];
11
+ }
12
+ /** Exit the process with an optional code (cross-runtime: Deno.exit or process.exit). */
13
+ export function exit(code) {
14
+ if (IS_DENO)
15
+ dntShim.Deno.exit(code);
16
+ if (runtimeProcess)
17
+ runtimeProcess.exit(code);
18
+ throw new Error("exit() is not supported in this runtime");
19
+ }
20
+ export function cwd() {
21
+ if (IS_DENO)
22
+ return dntShim.Deno.cwd();
23
+ if (runtimeProcess)
24
+ return runtimeProcess.cwd();
25
+ throw new Error("cwd() is not supported in this runtime");
26
+ }
27
+ export function chdir(directory) {
28
+ if (IS_DENO) {
29
+ dntShim.Deno.chdir(directory);
30
+ return;
31
+ }
32
+ if (runtimeProcess) {
33
+ runtimeProcess.chdir(directory);
34
+ return;
35
+ }
36
+ throw new Error("chdir() is not supported in this runtime");
37
+ }
38
+ export function pid() {
39
+ if (IS_DENO)
40
+ return dntShim.Deno.pid;
41
+ if (runtimeProcess)
42
+ return runtimeProcess.pid;
43
+ return 0;
44
+ }
45
+ export function memoryUsage() {
46
+ if (IS_DENO) {
47
+ const { rss, heapTotal, heapUsed, external } = dntShim.Deno.memoryUsage();
48
+ return { rss, heapTotal, heapUsed, external };
49
+ }
50
+ if (!runtimeProcess) {
51
+ throw new Error("memoryUsage() is not supported in this runtime");
52
+ }
53
+ const { rss, heapTotal, heapUsed, external } = runtimeProcess.memoryUsage();
54
+ return { rss, heapTotal, heapUsed, external: external || 0 };
55
+ }
56
+ /**
57
+ * Check if stdin is a TTY (terminal)
58
+ */
59
+ export function isInteractive() {
60
+ if (IS_DENO)
61
+ return dntShim.Deno.stdin.isTerminal();
62
+ if (runtimeProcess)
63
+ return runtimeProcess.stdin.isTTY ?? false;
64
+ return false;
65
+ }
66
+ /**
67
+ * Check if stdout is a TTY (terminal)
68
+ */
69
+ export function isStdoutTTY() {
70
+ if (IS_DENO)
71
+ return dntShim.Deno.stdout.isTerminal();
72
+ if (runtimeProcess)
73
+ return runtimeProcess.stdout.isTTY ?? false;
74
+ return false;
75
+ }
76
+ /**
77
+ * Get terminal size (columns and rows)
78
+ * Returns default fallback values if terminal size cannot be determined
79
+ */
80
+ export function getTerminalSize() {
81
+ const defaultSize = { columns: 80, rows: 24 };
82
+ if (IS_DENO) {
83
+ try {
84
+ const { columns, rows } = dntShim.Deno.consoleSize();
85
+ return { columns, rows };
86
+ }
87
+ catch (_) {
88
+ /* expected: Deno.consoleSize() fails when not attached to a terminal */
89
+ return defaultSize;
90
+ }
91
+ }
92
+ if (!runtimeProcess)
93
+ return defaultSize;
94
+ const columns = runtimeProcess.stdout?.columns;
95
+ const rows = runtimeProcess.stdout?.rows;
96
+ if (columns && rows)
97
+ return { columns, rows };
98
+ return defaultSize;
99
+ }
100
+ /**
101
+ * Get runtime version string
102
+ */
103
+ export function getRuntimeVersion() {
104
+ if (IS_DENO)
105
+ return `Deno ${dntShim.Deno.version.deno}`;
106
+ if ("Bun" in dntShim.dntGlobalThis) {
107
+ return `Bun ${dntShim.dntGlobalThis.Bun.version}`;
108
+ }
109
+ if (runtimeProcess)
110
+ return `Node.js ${runtimeProcess.version}`;
111
+ return "unknown";
112
+ }
113
+ /**
114
+ * Get the operating system type
115
+ * Returns: "darwin" (macOS), "linux", "windows", or the raw platform string
116
+ */
117
+ export function getOsType() {
118
+ if (IS_DENO)
119
+ return dntShim.Deno.build.os;
120
+ if (runtimeProcess) {
121
+ // Node/Bun uses process.platform which returns "win32" for Windows
122
+ const platform = runtimeProcess.platform;
123
+ return platform === "win32" ? "windows" : platform;
124
+ }
125
+ return "unknown";
126
+ }
127
+ /**
128
+ * Register a signal handler (SIGINT, SIGTERM) for graceful shutdown
129
+ */
130
+ export function onSignal(signal, handler) {
131
+ if (IS_DENO) {
132
+ dntShim.Deno.addSignalListener(signal, handler);
133
+ return;
134
+ }
135
+ if (runtimeProcess)
136
+ runtimeProcess.on(signal, handler);
137
+ }
138
+ /**
139
+ * Register global error handlers for uncaught exceptions and unhandled promise rejections.
140
+ * These handlers prevent the process from crashing due to application code errors.
141
+ *
142
+ * IMPORTANT: These handlers should be registered early in the application lifecycle
143
+ * to catch errors that escape try/catch blocks.
144
+ *
145
+ * @param onError - Callback invoked with the error. Return true to prevent process exit.
146
+ */
147
+ export function onGlobalError(onError) {
148
+ if (IS_DENO) {
149
+ // Intentionally permanent: process-level handlers must persist for the entire runtime
150
+ globalThis.addEventListener("error", (event) => {
151
+ const error = event.error instanceof Error ? event.error : new Error(String(event.error));
152
+ if (onError(error, "uncaughtException"))
153
+ event.preventDefault();
154
+ });
155
+ globalThis.addEventListener("unhandledrejection", (event) => {
156
+ const error = event.reason instanceof Error ? event.reason : new Error(String(event.reason));
157
+ if (onError(error, "unhandledRejection"))
158
+ event.preventDefault();
159
+ });
160
+ return;
161
+ }
162
+ if (!runtimeProcess)
163
+ return;
164
+ const process = runtimeProcess;
165
+ const handleNodeGlobalError = (error, type) => {
166
+ let shouldPreventExit = false;
167
+ try {
168
+ shouldPreventExit = onError(error, type) === true;
169
+ }
170
+ catch (handlerError) {
171
+ const handlerException = handlerError instanceof Error
172
+ ? handlerError
173
+ : new Error(String(handlerError));
174
+ console.error("Global error handler threw while processing", type, handlerException);
175
+ }
176
+ if (shouldPreventExit)
177
+ return;
178
+ // Node/Bun suppress default fatal behavior when a listener is registered.
179
+ // If the callback did not explicitly handle the error, exit to preserve
180
+ // expected fatal semantics for uncaught exceptions and unhandled rejections.
181
+ process.exit(1);
182
+ };
183
+ runtimeProcess.on("uncaughtException", (error) => {
184
+ handleNodeGlobalError(error, "uncaughtException");
185
+ });
186
+ runtimeProcess.on("unhandledRejection", (reason) => {
187
+ const error = reason instanceof Error ? reason : new Error(String(reason));
188
+ handleNodeGlobalError(error, "unhandledRejection");
189
+ });
190
+ }
191
+ /**
192
+ * Unreference a timer to prevent it from keeping the process alive
193
+ */
194
+ export function unrefTimer(timerId) {
195
+ if (IS_DENO && typeof dntShim.Deno.unrefTimer === "function") {
196
+ dntShim.Deno.unrefTimer(timerId);
197
+ return;
198
+ }
199
+ if (timerId && typeof timerId === "object" && "unref" in timerId) {
200
+ timerId.unref();
201
+ }
202
+ }
203
+ /**
204
+ * Get the executable path of the current runtime
205
+ */
206
+ export function execPath() {
207
+ if (IS_DENO)
208
+ return dntShim.Deno.execPath();
209
+ if (runtimeProcess)
210
+ return runtimeProcess.execPath;
211
+ return "";
212
+ }
213
+ /**
214
+ * Get process uptime in seconds
215
+ * Returns OS uptime on Deno, process uptime on Node.js
216
+ */
217
+ export function uptime() {
218
+ if (IS_DENO) {
219
+ // Deno.osUptime() returns system uptime in seconds
220
+ return dntShim.Deno.osUptime?.() ?? 0;
221
+ }
222
+ if (runtimeProcess) {
223
+ // process.uptime() returns process uptime in seconds
224
+ return runtimeProcess.uptime?.() ?? 0;
225
+ }
226
+ return 0;
227
+ }
228
+ /**
229
+ * Get stdout stream for writing
230
+ * Returns null if not available (e.g., in browser/workers)
231
+ */
232
+ export function getStdout() {
233
+ if (IS_DENO) {
234
+ const encoder = new TextEncoder();
235
+ return { write: (data) => dntShim.Deno.stdout.writeSync(encoder.encode(data)) };
236
+ }
237
+ const stdout = runtimeProcess?.stdout;
238
+ if (stdout) {
239
+ return { write: (data) => stdout.write(data) };
240
+ }
241
+ return null;
242
+ }
243
+ /**
244
+ * Write text directly to stdout (sync)
245
+ * No-op if stdout is not available
246
+ */
247
+ export function writeStdout(text) {
248
+ getStdout()?.write(text);
249
+ }
250
+ /**
251
+ * Write data to stdout asynchronously
252
+ * Returns a promise that resolves when the write is complete
253
+ */
254
+ export async function writeStdoutAsync(data) {
255
+ if (IS_DENO)
256
+ return await dntShim.Deno.stdout.write(data);
257
+ const stdout = runtimeProcess?.stdout;
258
+ if (stdout) {
259
+ return await new Promise((resolve, reject) => {
260
+ stdout.write(data, (error) => {
261
+ if (error)
262
+ reject(error);
263
+ else
264
+ resolve(data.length);
265
+ });
266
+ });
267
+ }
268
+ return 0;
269
+ }
270
+ /**
271
+ * Synchronous prompt function that works across Deno and Bun.
272
+ * Displays a message and reads user input from stdin.
273
+ *
274
+ * Note: This relies on globalThis.prompt which is available in Deno and Bun.
275
+ * Returns null in environments where prompt is not available (e.g., Node.js ESM).
276
+ */
277
+ export function promptSync(message) {
278
+ if (typeof globalThis.prompt !== "function")
279
+ return null;
280
+ return globalThis.prompt(message ?? "") ?? null;
281
+ }
282
+ /**
283
+ * Read a single byte from stdin synchronously.
284
+ * Requires raw mode to be enabled for character-by-character reading.
285
+ * Returns null on EOF or if stdin is not available.
286
+ */
287
+ export function readStdinByteSync() {
288
+ const buf = new Uint8Array(1);
289
+ if (IS_DENO) {
290
+ const n = dntShim.Deno.stdin.readSync(buf);
291
+ return n ? buf[0] ?? null : null;
292
+ }
293
+ if (IS_BUN) {
294
+ // Bun: read one byte from the file descriptor directly
295
+ const BunGlobal = dntShim.dntGlobalThis
296
+ .Bun;
297
+ const chunk = BunGlobal?.stdin?.read?.(1);
298
+ if (chunk && chunk.length > 0) {
299
+ const first = chunk.at(0);
300
+ return first ?? null;
301
+ }
302
+ return null;
303
+ }
304
+ return null;
305
+ }
@@ -0,0 +1,10 @@
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
@@ -0,0 +1 @@
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,CAK3C"}
@@ -0,0 +1,24 @@
1
+ import * as dntShim from "../../../../_dnt.shims.js";
2
+ import { 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
+ if (IS_DENO)
20
+ return dntShim.Deno.build.os === "windows";
21
+ const platform = runtimeProcess?.platform ??
22
+ dntShim.dntGlobalThis.process?.platform;
23
+ return platform === "win32";
24
+ }