@ricsam/isolate 0.0.1 → 0.1.1

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 (299) hide show
  1. package/README.md +243 -34
  2. package/dist/cjs/bridge/diagnostics.cjs +58 -0
  3. package/dist/cjs/bridge/diagnostics.cjs.map +10 -0
  4. package/dist/cjs/bridge/legacy-adapters.cjs +242 -0
  5. package/dist/cjs/bridge/legacy-adapters.cjs.map +10 -0
  6. package/dist/cjs/bridge/request-context.cjs +59 -0
  7. package/dist/cjs/bridge/request-context.cjs.map +10 -0
  8. package/dist/cjs/bridge/runtime-bindings.cjs +367 -0
  9. package/dist/cjs/bridge/runtime-bindings.cjs.map +10 -0
  10. package/dist/cjs/browser/browser-runtime.cjs +157 -0
  11. package/dist/cjs/browser/browser-runtime.cjs.map +10 -0
  12. package/dist/cjs/daemon.cjs +91 -0
  13. package/dist/cjs/daemon.cjs.map +10 -0
  14. package/dist/cjs/files/index.cjs +140 -0
  15. package/dist/cjs/files/index.cjs.map +10 -0
  16. package/dist/cjs/host/create-isolate-host.cjs +235 -0
  17. package/dist/cjs/host/create-isolate-host.cjs.map +10 -0
  18. package/dist/cjs/host/index.cjs +47 -0
  19. package/dist/cjs/host/index.cjs.map +10 -0
  20. package/dist/cjs/index.cjs +55 -0
  21. package/dist/cjs/index.cjs.map +10 -0
  22. package/dist/cjs/internal/client/connection.cjs +1919 -0
  23. package/dist/cjs/internal/client/connection.cjs.map +10 -0
  24. package/dist/cjs/internal/client/index.cjs +48 -0
  25. package/dist/cjs/internal/client/index.cjs.map +10 -0
  26. package/dist/cjs/internal/client/types.cjs +30 -0
  27. package/dist/cjs/internal/client/types.cjs.map +9 -0
  28. package/dist/cjs/internal/console/index.cjs +506 -0
  29. package/dist/cjs/internal/console/index.cjs.map +10 -0
  30. package/dist/cjs/internal/console/utils.cjs +70 -0
  31. package/dist/cjs/internal/console/utils.cjs.map +10 -0
  32. package/dist/cjs/internal/core/index.cjs +2745 -0
  33. package/dist/cjs/internal/core/index.cjs.map +10 -0
  34. package/dist/cjs/internal/crypto/index.cjs +470 -0
  35. package/dist/cjs/internal/crypto/index.cjs.map +10 -0
  36. package/dist/cjs/internal/daemon/callback-fs-handler.cjs +355 -0
  37. package/dist/cjs/internal/daemon/callback-fs-handler.cjs.map +10 -0
  38. package/dist/cjs/internal/daemon/connection.cjs +1952 -0
  39. package/dist/cjs/internal/daemon/connection.cjs.map +10 -0
  40. package/dist/cjs/internal/daemon/daemon.cjs +98 -0
  41. package/dist/cjs/internal/daemon/daemon.cjs.map +10 -0
  42. package/dist/cjs/internal/daemon/index.cjs +145 -0
  43. package/dist/cjs/internal/daemon/index.cjs.map +10 -0
  44. package/dist/cjs/internal/daemon/runtime-pool.cjs +106 -0
  45. package/dist/cjs/internal/daemon/runtime-pool.cjs.map +10 -0
  46. package/dist/cjs/internal/daemon/types.cjs +30 -0
  47. package/dist/cjs/internal/daemon/types.cjs.map +9 -0
  48. package/dist/cjs/internal/encoding/index.cjs +419 -0
  49. package/dist/cjs/internal/encoding/index.cjs.map +10 -0
  50. package/dist/cjs/internal/fetch/consistency/origins.cjs +598 -0
  51. package/dist/cjs/internal/fetch/consistency/origins.cjs.map +10 -0
  52. package/dist/cjs/internal/fetch/index.cjs +2640 -0
  53. package/dist/cjs/internal/fetch/index.cjs.map +10 -0
  54. package/dist/cjs/internal/fetch/stream-state.cjs +256 -0
  55. package/dist/cjs/internal/fetch/stream-state.cjs.map +10 -0
  56. package/dist/cjs/internal/fs/index.cjs +847 -0
  57. package/dist/cjs/internal/fs/index.cjs.map +10 -0
  58. package/dist/cjs/internal/fs/node-adapter.cjs +254 -0
  59. package/dist/cjs/internal/fs/node-adapter.cjs.map +10 -0
  60. package/dist/cjs/internal/module-loader/bundle.cjs +482 -0
  61. package/dist/cjs/internal/module-loader/bundle.cjs.map +10 -0
  62. package/dist/cjs/internal/module-loader/index.cjs +240 -0
  63. package/dist/cjs/internal/module-loader/index.cjs.map +10 -0
  64. package/dist/cjs/internal/module-loader/mappings.cjs +120 -0
  65. package/dist/cjs/internal/module-loader/mappings.cjs.map +10 -0
  66. package/dist/cjs/internal/module-loader/resolve.cjs +177 -0
  67. package/dist/cjs/internal/module-loader/resolve.cjs.map +10 -0
  68. package/dist/cjs/internal/module-loader/strip-types.cjs +236 -0
  69. package/dist/cjs/internal/module-loader/strip-types.cjs.map +10 -0
  70. package/dist/cjs/internal/path/index.cjs +503 -0
  71. package/dist/cjs/internal/path/index.cjs.map +10 -0
  72. package/dist/cjs/internal/playwright/client.cjs +49 -0
  73. package/dist/cjs/internal/playwright/client.cjs.map +10 -0
  74. package/dist/cjs/internal/playwright/handler.cjs +1416 -0
  75. package/dist/cjs/internal/playwright/handler.cjs.map +10 -0
  76. package/dist/cjs/internal/playwright/index.cjs +1289 -0
  77. package/dist/cjs/internal/playwright/index.cjs.map +10 -0
  78. package/dist/cjs/internal/playwright/types.cjs +47 -0
  79. package/dist/cjs/internal/playwright/types.cjs.map +10 -0
  80. package/dist/cjs/internal/protocol/codec.cjs +510 -0
  81. package/dist/cjs/internal/protocol/codec.cjs.map +10 -0
  82. package/dist/cjs/internal/protocol/framing.cjs +141 -0
  83. package/dist/cjs/internal/protocol/framing.cjs.map +10 -0
  84. package/dist/cjs/internal/protocol/index.cjs +110 -0
  85. package/dist/cjs/internal/protocol/index.cjs.map +10 -0
  86. package/dist/cjs/internal/protocol/marshalValue.cjs +518 -0
  87. package/dist/cjs/internal/protocol/marshalValue.cjs.map +10 -0
  88. package/dist/cjs/internal/protocol/serialization.cjs +109 -0
  89. package/dist/cjs/internal/protocol/serialization.cjs.map +10 -0
  90. package/dist/cjs/internal/protocol/types.cjs +181 -0
  91. package/dist/cjs/internal/protocol/types.cjs.map +10 -0
  92. package/dist/cjs/internal/runtime/index.cjs +1235 -0
  93. package/dist/cjs/internal/runtime/index.cjs.map +10 -0
  94. package/dist/cjs/internal/server/index.cjs +223 -0
  95. package/dist/cjs/internal/server/index.cjs.map +10 -0
  96. package/dist/cjs/internal/test-environment/index.cjs +1415 -0
  97. package/dist/cjs/internal/test-environment/index.cjs.map +10 -0
  98. package/dist/cjs/internal/timers/index.cjs +200 -0
  99. package/dist/cjs/internal/timers/index.cjs.map +10 -0
  100. package/dist/cjs/internal/transform/index.cjs +361 -0
  101. package/dist/cjs/internal/transform/index.cjs.map +10 -0
  102. package/dist/cjs/internal/typecheck/index.cjs +60 -0
  103. package/dist/cjs/internal/typecheck/index.cjs.map +10 -0
  104. package/dist/cjs/internal/typecheck/isolate-types.cjs +2614 -0
  105. package/dist/cjs/internal/typecheck/isolate-types.cjs.map +10 -0
  106. package/dist/cjs/internal/typecheck/typecheck.cjs +131 -0
  107. package/dist/cjs/internal/typecheck/typecheck.cjs.map +10 -0
  108. package/dist/cjs/modules/index.cjs +160 -0
  109. package/dist/cjs/modules/index.cjs.map +10 -0
  110. package/dist/cjs/package.json +5 -0
  111. package/dist/cjs/runtime/script-runtime.cjs +97 -0
  112. package/dist/cjs/runtime/script-runtime.cjs.map +10 -0
  113. package/dist/cjs/server/app-server.cjs +158 -0
  114. package/dist/cjs/server/app-server.cjs.map +10 -0
  115. package/dist/cjs/testing/integration-helpers.cjs +127 -0
  116. package/dist/cjs/testing/integration-helpers.cjs.map +10 -0
  117. package/dist/cjs/typecheck/index.cjs +96 -0
  118. package/dist/cjs/typecheck/index.cjs.map +10 -0
  119. package/dist/cjs/types.cjs +30 -0
  120. package/dist/cjs/types.cjs.map +9 -0
  121. package/dist/mjs/bridge/diagnostics.mjs +18 -0
  122. package/dist/mjs/bridge/diagnostics.mjs.map +10 -0
  123. package/dist/mjs/bridge/legacy-adapters.mjs +178 -0
  124. package/dist/mjs/bridge/legacy-adapters.mjs.map +10 -0
  125. package/dist/mjs/bridge/request-context.mjs +19 -0
  126. package/dist/mjs/bridge/request-context.mjs.map +10 -0
  127. package/dist/mjs/bridge/runtime-bindings.mjs +303 -0
  128. package/dist/mjs/bridge/runtime-bindings.mjs.map +10 -0
  129. package/dist/mjs/browser/browser-runtime.mjs +93 -0
  130. package/dist/mjs/browser/browser-runtime.mjs.map +10 -0
  131. package/dist/mjs/daemon.mjs +91 -0
  132. package/dist/mjs/daemon.mjs.map +10 -0
  133. package/dist/mjs/files/index.mjs +76 -0
  134. package/dist/mjs/files/index.mjs.map +10 -0
  135. package/dist/mjs/host/create-isolate-host.mjs +171 -0
  136. package/dist/mjs/host/create-isolate-host.mjs.map +10 -0
  137. package/dist/mjs/host/index.mjs +7 -0
  138. package/dist/mjs/host/index.mjs.map +10 -0
  139. package/dist/mjs/index.mjs +15 -0
  140. package/dist/mjs/index.mjs.map +10 -0
  141. package/dist/mjs/internal/client/connection.mjs +1872 -0
  142. package/dist/mjs/internal/client/connection.mjs.map +10 -0
  143. package/dist/mjs/internal/client/index.mjs +8 -0
  144. package/dist/mjs/internal/client/index.mjs.map +10 -0
  145. package/dist/mjs/internal/client/types.mjs +2 -0
  146. package/dist/mjs/internal/client/types.mjs.map +9 -0
  147. package/dist/mjs/internal/console/index.mjs +442 -0
  148. package/dist/mjs/internal/console/index.mjs.map +10 -0
  149. package/dist/mjs/internal/console/utils.mjs +30 -0
  150. package/dist/mjs/internal/console/utils.mjs.map +10 -0
  151. package/dist/mjs/internal/core/index.mjs +2681 -0
  152. package/dist/mjs/internal/core/index.mjs.map +10 -0
  153. package/dist/mjs/internal/crypto/index.mjs +406 -0
  154. package/dist/mjs/internal/crypto/index.mjs.map +10 -0
  155. package/dist/mjs/internal/daemon/callback-fs-handler.mjs +315 -0
  156. package/dist/mjs/internal/daemon/callback-fs-handler.mjs.map +10 -0
  157. package/dist/mjs/internal/daemon/connection.mjs +1931 -0
  158. package/dist/mjs/internal/daemon/connection.mjs.map +10 -0
  159. package/dist/mjs/internal/daemon/daemon.mjs +98 -0
  160. package/dist/mjs/internal/daemon/daemon.mjs.map +10 -0
  161. package/dist/mjs/internal/daemon/index.mjs +105 -0
  162. package/dist/mjs/internal/daemon/index.mjs.map +10 -0
  163. package/dist/mjs/internal/daemon/runtime-pool.mjs +66 -0
  164. package/dist/mjs/internal/daemon/runtime-pool.mjs.map +10 -0
  165. package/dist/mjs/internal/daemon/types.mjs +2 -0
  166. package/dist/mjs/internal/daemon/types.mjs.map +9 -0
  167. package/dist/mjs/internal/encoding/index.mjs +379 -0
  168. package/dist/mjs/internal/encoding/index.mjs.map +10 -0
  169. package/dist/mjs/internal/fetch/consistency/origins.mjs +558 -0
  170. package/dist/mjs/internal/fetch/consistency/origins.mjs.map +10 -0
  171. package/dist/mjs/internal/fetch/index.mjs +2580 -0
  172. package/dist/mjs/internal/fetch/index.mjs.map +10 -0
  173. package/dist/mjs/internal/fetch/stream-state.mjs +216 -0
  174. package/dist/mjs/internal/fetch/stream-state.mjs.map +10 -0
  175. package/dist/mjs/internal/fs/index.mjs +783 -0
  176. package/dist/mjs/internal/fs/index.mjs.map +10 -0
  177. package/dist/mjs/internal/fs/node-adapter.mjs +190 -0
  178. package/dist/mjs/internal/fs/node-adapter.mjs.map +10 -0
  179. package/dist/mjs/internal/module-loader/bundle.mjs +418 -0
  180. package/dist/mjs/internal/module-loader/bundle.mjs.map +10 -0
  181. package/dist/mjs/internal/module-loader/index.mjs +185 -0
  182. package/dist/mjs/internal/module-loader/index.mjs.map +10 -0
  183. package/dist/mjs/internal/module-loader/mappings.mjs +80 -0
  184. package/dist/mjs/internal/module-loader/mappings.mjs.map +10 -0
  185. package/dist/mjs/internal/module-loader/resolve.mjs +113 -0
  186. package/dist/mjs/internal/module-loader/resolve.mjs.map +10 -0
  187. package/dist/mjs/internal/module-loader/strip-types.mjs +172 -0
  188. package/dist/mjs/internal/module-loader/strip-types.mjs.map +10 -0
  189. package/dist/mjs/internal/path/index.mjs +463 -0
  190. package/dist/mjs/internal/path/index.mjs.map +10 -0
  191. package/dist/mjs/internal/playwright/client.mjs +13 -0
  192. package/dist/mjs/internal/playwright/client.mjs.map +10 -0
  193. package/dist/mjs/internal/playwright/handler.mjs +1378 -0
  194. package/dist/mjs/internal/playwright/handler.mjs.map +10 -0
  195. package/dist/mjs/internal/playwright/index.mjs +1234 -0
  196. package/dist/mjs/internal/playwright/index.mjs.map +10 -0
  197. package/dist/mjs/internal/playwright/types.mjs +7 -0
  198. package/dist/mjs/internal/playwright/types.mjs.map +10 -0
  199. package/dist/mjs/internal/protocol/codec.mjs +470 -0
  200. package/dist/mjs/internal/protocol/codec.mjs.map +10 -0
  201. package/dist/mjs/internal/protocol/framing.mjs +101 -0
  202. package/dist/mjs/internal/protocol/framing.mjs.map +10 -0
  203. package/dist/mjs/internal/protocol/index.mjs +98 -0
  204. package/dist/mjs/internal/protocol/index.mjs.map +10 -0
  205. package/dist/mjs/internal/protocol/marshalValue.mjs +494 -0
  206. package/dist/mjs/internal/protocol/marshalValue.mjs.map +10 -0
  207. package/dist/mjs/internal/protocol/serialization.mjs +69 -0
  208. package/dist/mjs/internal/protocol/serialization.mjs.map +10 -0
  209. package/dist/mjs/internal/protocol/types.mjs +141 -0
  210. package/dist/mjs/internal/protocol/types.mjs.map +10 -0
  211. package/dist/mjs/internal/runtime/index.mjs +1198 -0
  212. package/dist/mjs/internal/runtime/index.mjs.map +10 -0
  213. package/dist/mjs/internal/server/index.mjs +183 -0
  214. package/dist/mjs/internal/server/index.mjs.map +10 -0
  215. package/dist/mjs/internal/test-environment/index.mjs +1351 -0
  216. package/dist/mjs/internal/test-environment/index.mjs.map +10 -0
  217. package/dist/mjs/internal/timers/index.mjs +136 -0
  218. package/dist/mjs/internal/timers/index.mjs.map +10 -0
  219. package/dist/mjs/internal/transform/index.mjs +321 -0
  220. package/dist/mjs/internal/transform/index.mjs.map +10 -0
  221. package/dist/mjs/internal/typecheck/index.mjs +35 -0
  222. package/dist/mjs/internal/typecheck/index.mjs.map +10 -0
  223. package/dist/mjs/internal/typecheck/isolate-types.mjs +2574 -0
  224. package/dist/mjs/internal/typecheck/isolate-types.mjs.map +10 -0
  225. package/dist/mjs/internal/typecheck/typecheck.mjs +91 -0
  226. package/dist/mjs/internal/typecheck/typecheck.mjs.map +10 -0
  227. package/dist/mjs/modules/index.mjs +96 -0
  228. package/dist/mjs/modules/index.mjs.map +10 -0
  229. package/dist/mjs/package.json +5 -0
  230. package/dist/mjs/runtime/script-runtime.mjs +57 -0
  231. package/dist/mjs/runtime/script-runtime.mjs.map +10 -0
  232. package/dist/mjs/server/app-server.mjs +118 -0
  233. package/dist/mjs/server/app-server.mjs.map +10 -0
  234. package/dist/mjs/testing/integration-helpers.mjs +63 -0
  235. package/dist/mjs/testing/integration-helpers.mjs.map +10 -0
  236. package/dist/mjs/typecheck/index.mjs +56 -0
  237. package/dist/mjs/typecheck/index.mjs.map +10 -0
  238. package/dist/mjs/types.mjs +2 -0
  239. package/dist/mjs/types.mjs.map +9 -0
  240. package/dist/types/bridge/diagnostics.d.ts +12 -0
  241. package/dist/types/bridge/legacy-adapters.d.ts +14 -0
  242. package/dist/types/bridge/request-context.d.ts +10 -0
  243. package/dist/types/bridge/runtime-bindings.d.ts +14 -0
  244. package/dist/types/browser/browser-runtime.d.ts +3 -0
  245. package/dist/types/daemon.d.ts +2 -0
  246. package/dist/types/files/index.d.ts +5 -0
  247. package/dist/types/host/create-isolate-host.d.ts +2 -0
  248. package/dist/types/host/index.d.ts +1 -0
  249. package/dist/types/index.d.ts +5 -0
  250. package/dist/types/internal/client/connection.d.ts +9 -0
  251. package/dist/types/internal/client/index.d.ts +8 -0
  252. package/dist/types/internal/client/types.d.ts +198 -0
  253. package/dist/types/internal/console/index.d.ts +108 -0
  254. package/dist/types/internal/console/utils.d.ts +27 -0
  255. package/dist/types/internal/core/index.d.ts +119 -0
  256. package/dist/types/internal/crypto/index.d.ts +18 -0
  257. package/dist/types/internal/daemon/callback-fs-handler.d.ts +28 -0
  258. package/dist/types/internal/daemon/connection.d.ts +9 -0
  259. package/dist/types/internal/daemon/daemon.d.ts +2 -0
  260. package/dist/types/internal/daemon/index.d.ts +14 -0
  261. package/dist/types/internal/daemon/runtime-pool.d.ts +16 -0
  262. package/dist/types/internal/daemon/types.d.ts +211 -0
  263. package/dist/types/internal/encoding/index.d.ts +21 -0
  264. package/dist/types/internal/fetch/consistency/origins.d.ts +179 -0
  265. package/dist/types/internal/fetch/index.d.ts +93 -0
  266. package/dist/types/internal/fetch/stream-state.d.ts +65 -0
  267. package/dist/types/internal/fs/index.d.ts +70 -0
  268. package/dist/types/internal/fs/node-adapter.d.ts +24 -0
  269. package/dist/types/internal/module-loader/bundle.d.ts +33 -0
  270. package/dist/types/internal/module-loader/index.d.ts +30 -0
  271. package/dist/types/internal/module-loader/mappings.d.ts +47 -0
  272. package/dist/types/internal/module-loader/resolve.d.ts +26 -0
  273. package/dist/types/internal/module-loader/strip-types.d.ts +19 -0
  274. package/dist/types/internal/path/index.d.ts +23 -0
  275. package/dist/types/internal/playwright/client.d.ts +7 -0
  276. package/dist/types/internal/playwright/handler.d.ts +44 -0
  277. package/dist/types/internal/playwright/index.d.ts +14 -0
  278. package/dist/types/internal/playwright/types.d.ts +145 -0
  279. package/dist/types/internal/protocol/codec.d.ts +242 -0
  280. package/dist/types/internal/protocol/framing.d.ts +89 -0
  281. package/dist/types/internal/protocol/index.d.ts +10 -0
  282. package/dist/types/internal/protocol/marshalValue.d.ts +79 -0
  283. package/dist/types/internal/protocol/serialization.d.ts +23 -0
  284. package/dist/types/internal/protocol/types.d.ts +996 -0
  285. package/dist/types/internal/runtime/index.d.ts +200 -0
  286. package/dist/types/internal/server/index.d.ts +42 -0
  287. package/dist/types/internal/test-environment/index.d.ts +112 -0
  288. package/dist/types/internal/timers/index.d.ts +22 -0
  289. package/dist/types/internal/transform/index.d.ts +36 -0
  290. package/dist/types/internal/typecheck/index.d.ts +7 -0
  291. package/dist/types/internal/typecheck/isolate-types.d.ts +94 -0
  292. package/dist/types/internal/typecheck/typecheck.d.ts +148 -0
  293. package/dist/types/modules/index.d.ts +2 -0
  294. package/dist/types/runtime/script-runtime.d.ts +6 -0
  295. package/dist/types/server/app-server.d.ts +3 -0
  296. package/dist/types/testing/integration-helpers.d.ts +9 -0
  297. package/dist/types/typecheck/index.d.ts +8 -0
  298. package/dist/types/types.d.ts +233 -0
  299. package/package.json +82 -6
@@ -0,0 +1,2614 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ function __accessProp(key) {
6
+ return this[key];
7
+ }
8
+ var __toCommonJS = (from) => {
9
+ var entry = (__moduleCache ??= new WeakMap).get(from), desc;
10
+ if (entry)
11
+ return entry;
12
+ entry = __defProp({}, "__esModule", { value: true });
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (var key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(entry, key))
16
+ __defProp(entry, key, {
17
+ get: __accessProp.bind(from, key),
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ __moduleCache.set(from, entry);
22
+ return entry;
23
+ };
24
+ var __moduleCache;
25
+ var __returnValue = (v) => v;
26
+ function __exportSetter(name, newValue) {
27
+ this[name] = __returnValue.bind(null, newValue);
28
+ }
29
+ var __export = (target, all) => {
30
+ for (var name in all)
31
+ __defProp(target, name, {
32
+ get: all[name],
33
+ enumerable: true,
34
+ configurable: true,
35
+ set: __exportSetter.bind(all, name)
36
+ });
37
+ };
38
+
39
+ // src/internal/typecheck/isolate-types.ts
40
+ var exports_isolate_types = {};
41
+ __export(exports_isolate_types, {
42
+ TYPE_DEFINITIONS: () => TYPE_DEFINITIONS,
43
+ TIMERS_TYPES: () => TIMERS_TYPES,
44
+ TEST_ENV_TYPES: () => TEST_ENV_TYPES,
45
+ PLAYWRIGHT_TYPES: () => PLAYWRIGHT_TYPES,
46
+ PATH_TYPES: () => PATH_TYPES,
47
+ FS_TYPES: () => FS_TYPES,
48
+ FETCH_TYPES: () => FETCH_TYPES,
49
+ ENCODING_TYPES: () => ENCODING_TYPES,
50
+ CRYPTO_TYPES: () => CRYPTO_TYPES,
51
+ CORE_TYPES: () => CORE_TYPES,
52
+ CONSOLE_TYPES: () => CONSOLE_TYPES
53
+ });
54
+ module.exports = __toCommonJS(exports_isolate_types);
55
+ var CORE_TYPES = `/**
56
+ * Global Type Definitions for ../core/index.ts
57
+ *
58
+ * These types define the globals injected by setupCore() into an isolated-vm context.
59
+ * Use these types to typecheck user code that will run inside the V8 isolate.
60
+ *
61
+ * @example
62
+ * // In your tsconfig.isolate.json
63
+ * {
64
+ * "compilerOptions": {
65
+ * "lib": ["ESNext", "DOM"]
66
+ * }
67
+ * }
68
+ *
69
+ * // Then reference this file or use ts-morph for code strings
70
+ */
71
+
72
+ export {};
73
+
74
+ declare global {
75
+ // ============================================
76
+ // Web Streams API
77
+ // ============================================
78
+
79
+ /**
80
+ * A readable stream of data.
81
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream
82
+ */
83
+ const ReadableStream: typeof globalThis.ReadableStream;
84
+
85
+ /**
86
+ * A writable stream of data.
87
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStream
88
+ */
89
+ const WritableStream: typeof globalThis.WritableStream;
90
+
91
+ /**
92
+ * A transform stream that can be used to pipe data through a transformer.
93
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/TransformStream
94
+ */
95
+ const TransformStream: typeof globalThis.TransformStream;
96
+
97
+ /**
98
+ * Default reader for ReadableStream
99
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader
100
+ */
101
+ const ReadableStreamDefaultReader: typeof globalThis.ReadableStreamDefaultReader;
102
+
103
+ /**
104
+ * Default writer for WritableStream
105
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WritableStreamDefaultWriter
106
+ */
107
+ const WritableStreamDefaultWriter: typeof globalThis.WritableStreamDefaultWriter;
108
+
109
+ // ============================================
110
+ // Blob and File APIs
111
+ // ============================================
112
+
113
+ /**
114
+ * A file-like object of immutable, raw data.
115
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Blob
116
+ */
117
+ const Blob: typeof globalThis.Blob;
118
+
119
+ /**
120
+ * A file object representing a file.
121
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/File
122
+ */
123
+ const File: typeof globalThis.File;
124
+
125
+ // ============================================
126
+ // URL APIs
127
+ // ============================================
128
+
129
+ /**
130
+ * Interface for URL manipulation.
131
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/URL
132
+ */
133
+ const URL: typeof globalThis.URL;
134
+
135
+ /**
136
+ * Utility for working with URL query strings.
137
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
138
+ */
139
+ const URLSearchParams: typeof globalThis.URLSearchParams;
140
+
141
+ // ============================================
142
+ // DOM Parsing and Constructors
143
+ // ============================================
144
+
145
+ /**
146
+ * Parses HTML/XML strings into Document objects.
147
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser
148
+ */
149
+ const DOMParser: typeof globalThis.DOMParser;
150
+
151
+ /**
152
+ * Base DOM node constructor.
153
+ */
154
+ const Node: typeof globalThis.Node;
155
+
156
+ /**
157
+ * DOM document constructor.
158
+ */
159
+ const Document: typeof globalThis.Document;
160
+
161
+ /**
162
+ * DOM document fragment constructor.
163
+ */
164
+ const DocumentFragment: typeof globalThis.DocumentFragment;
165
+
166
+ /**
167
+ * DOM document type constructor.
168
+ */
169
+ const DocumentType: typeof globalThis.DocumentType;
170
+
171
+ /**
172
+ * DOM element constructor.
173
+ */
174
+ const Element: typeof globalThis.Element;
175
+
176
+ /**
177
+ * DOM attribute constructor.
178
+ */
179
+ const Attr: typeof globalThis.Attr;
180
+
181
+ /**
182
+ * DOM text node constructor.
183
+ */
184
+ const Text: typeof globalThis.Text;
185
+
186
+ /**
187
+ * DOM comment node constructor.
188
+ */
189
+ const Comment: typeof globalThis.Comment;
190
+
191
+ /**
192
+ * DOM event constructor.
193
+ */
194
+ const Event: typeof globalThis.Event;
195
+
196
+ /**
197
+ * Base event target constructor.
198
+ */
199
+ const EventTarget: typeof globalThis.EventTarget;
200
+
201
+ /**
202
+ * Custom event constructor.
203
+ */
204
+ const CustomEvent: typeof globalThis.CustomEvent;
205
+
206
+ // ============================================
207
+ // Error Handling
208
+ // ============================================
209
+
210
+ /**
211
+ * Exception type for DOM operations.
212
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMException
213
+ */
214
+ const DOMException: typeof globalThis.DOMException;
215
+ }
216
+ `;
217
+ var FETCH_TYPES = `/**
218
+ * Global Type Definitions for ../fetch/index.ts
219
+ *
220
+ * These types define the globals injected by setupFetch() into an isolated-vm context.
221
+ * Use these types to typecheck user code that will run inside the V8 isolate.
222
+ *
223
+ * @example
224
+ * // Typecheck isolate code with serve()
225
+ * type WebSocketData = { id: number; connectedAt: number };
226
+ *
227
+ * serve({
228
+ * fetch(request, server) {
229
+ * if (request.url.includes("/ws")) {
230
+ * // server.upgrade knows data should be WebSocketData
231
+ * server.upgrade(request, { data: { id: 123, connectedAt: Date.now() } });
232
+ * return new Response(null, { status: 101 });
233
+ * }
234
+ * return new Response("Hello!");
235
+ * },
236
+ * websocket: {
237
+ * // Type hint - specifies the type of ws.data
238
+ * data: {} as WebSocketData,
239
+ * message(ws, message) {
240
+ * // ws.data is typed as WebSocketData
241
+ * console.log("User", ws.data.id, "says:", message);
242
+ * ws.send("Echo: " + message);
243
+ * }
244
+ * }
245
+ * });
246
+ */
247
+
248
+ export {};
249
+
250
+ declare global {
251
+ // ============================================
252
+ // Standard Fetch API (from lib.dom)
253
+ // ============================================
254
+
255
+ /**
256
+ * Headers class for HTTP headers manipulation.
257
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Headers
258
+ */
259
+ const Headers: typeof globalThis.Headers;
260
+
261
+ /**
262
+ * Request class for HTTP requests.
263
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Request
264
+ */
265
+ const Request: typeof globalThis.Request;
266
+
267
+ /**
268
+ * Response class for HTTP responses.
269
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Response
270
+ */
271
+ const Response: typeof globalThis.Response;
272
+
273
+ /**
274
+ * AbortController for cancelling fetch requests.
275
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortController
276
+ */
277
+ const AbortController: typeof globalThis.AbortController;
278
+
279
+ /**
280
+ * AbortSignal for listening to abort events.
281
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
282
+ */
283
+ const AbortSignal: typeof globalThis.AbortSignal;
284
+
285
+ /**
286
+ * FormData for constructing form data.
287
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/FormData
288
+ */
289
+ const FormData: typeof globalThis.FormData;
290
+
291
+ /**
292
+ * Fetch function for making HTTP requests.
293
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/fetch
294
+ */
295
+ function fetch(
296
+ input: RequestInfo | URL,
297
+ init?: RequestInit
298
+ ): Promise<Response>;
299
+
300
+ // ============================================
301
+ // Isolate-specific: serve() API
302
+ // ============================================
303
+
304
+ /**
305
+ * Server interface for handling WebSocket upgrades within serve() handlers.
306
+ *
307
+ * @typeParam T - The type of data associated with WebSocket connections
308
+ */
309
+ interface Server<T = unknown> {
310
+ /**
311
+ * Upgrade an HTTP request to a WebSocket connection.
312
+ *
313
+ * @param request - The incoming HTTP request to upgrade
314
+ * @param options - Optional data to associate with the WebSocket connection
315
+ * @returns true if upgrade will proceed, false otherwise
316
+ *
317
+ * @example
318
+ * serve({
319
+ * fetch(request, server) {
320
+ * if (server.upgrade(request, { data: { userId: 123 } })) {
321
+ * return new Response(null, { status: 101 });
322
+ * }
323
+ * return new Response("Upgrade failed", { status: 400 });
324
+ * }
325
+ * });
326
+ */
327
+ upgrade(request: Request, options?: { data?: T }): boolean;
328
+ }
329
+
330
+ /**
331
+ * ServerWebSocket interface for WebSocket connections within serve() handlers.
332
+ *
333
+ * @typeParam T - The type of data associated with this WebSocket connection
334
+ */
335
+ interface ServerWebSocket<T = unknown> {
336
+ /**
337
+ * User data associated with this connection.
338
+ * Set via \`server.upgrade(request, { data: ... })\`.
339
+ */
340
+ readonly data: T;
341
+
342
+ /**
343
+ * Send a message to the client.
344
+ *
345
+ * @param message - The message to send (string, ArrayBuffer, or Uint8Array)
346
+ */
347
+ send(message: string | ArrayBuffer | Uint8Array): void;
348
+
349
+ /**
350
+ * Close the WebSocket connection.
351
+ *
352
+ * @param code - Optional close code (default: 1000)
353
+ * @param reason - Optional close reason
354
+ */
355
+ close(code?: number, reason?: string): void;
356
+
357
+ /**
358
+ * WebSocket ready state.
359
+ * - 0: CONNECTING
360
+ * - 1: OPEN
361
+ * - 2: CLOSING
362
+ * - 3: CLOSED
363
+ */
364
+ readonly readyState: number;
365
+ }
366
+
367
+ /**
368
+ * Options for the serve() function.
369
+ *
370
+ * @typeParam T - The type of data associated with WebSocket connections
371
+ */
372
+ interface ServeOptions<T = unknown> {
373
+ /**
374
+ * Handler for HTTP requests.
375
+ *
376
+ * @param request - The incoming HTTP request
377
+ * @param server - Server interface for WebSocket upgrades
378
+ * @returns Response or Promise resolving to Response
379
+ */
380
+ fetch(request: Request, server: Server<T>): Response | Promise<Response>;
381
+
382
+ /**
383
+ * WebSocket event handlers.
384
+ */
385
+ websocket?: {
386
+ /**
387
+ * Type hint for WebSocket data. The value is not used at runtime.
388
+ * Specifies the type of \`ws.data\` for all handlers and \`server.upgrade()\`.
389
+ *
390
+ * @example
391
+ * websocket: {
392
+ * data: {} as { userId: string },
393
+ * message(ws, message) {
394
+ * // ws.data.userId is typed as string
395
+ * }
396
+ * }
397
+ */
398
+ data?: T;
399
+
400
+ /**
401
+ * Called when a WebSocket connection is opened.
402
+ *
403
+ * @param ws - The WebSocket connection
404
+ */
405
+ open?(ws: ServerWebSocket<T>): void | Promise<void>;
406
+
407
+ /**
408
+ * Called when a message is received.
409
+ *
410
+ * @param ws - The WebSocket connection
411
+ * @param message - The received message (string or ArrayBuffer)
412
+ */
413
+ message?(
414
+ ws: ServerWebSocket<T>,
415
+ message: string | ArrayBuffer
416
+ ): void | Promise<void>;
417
+
418
+ /**
419
+ * Called when the connection is closed.
420
+ *
421
+ * @param ws - The WebSocket connection
422
+ * @param code - The close code
423
+ * @param reason - The close reason
424
+ */
425
+ close?(
426
+ ws: ServerWebSocket<T>,
427
+ code: number,
428
+ reason: string
429
+ ): void | Promise<void>;
430
+
431
+ /**
432
+ * Called when an error occurs.
433
+ *
434
+ * @param ws - The WebSocket connection
435
+ * @param error - The error that occurred
436
+ */
437
+ error?(ws: ServerWebSocket<T>, error: Error): void | Promise<void>;
438
+ };
439
+ }
440
+
441
+ /**
442
+ * Register an HTTP server handler in the isolate.
443
+ *
444
+ * Only one serve() handler can be active at a time.
445
+ * Calling serve() again replaces the previous handler.
446
+ *
447
+ * @param options - Server configuration including fetch handler and optional WebSocket handlers
448
+ *
449
+ * @example
450
+ * type WsData = { connectedAt: number };
451
+ *
452
+ * serve({
453
+ * fetch(request, server) {
454
+ * const url = new URL(request.url);
455
+ *
456
+ * if (url.pathname === "/ws") {
457
+ * if (server.upgrade(request, { data: { connectedAt: Date.now() } })) {
458
+ * return new Response(null, { status: 101 });
459
+ * }
460
+ * }
461
+ *
462
+ * if (url.pathname === "/api/hello") {
463
+ * return Response.json({ message: "Hello!" });
464
+ * }
465
+ *
466
+ * return new Response("Not Found", { status: 404 });
467
+ * },
468
+ * websocket: {
469
+ * data: {} as WsData,
470
+ * open(ws) {
471
+ * console.log("Connected at:", ws.data.connectedAt);
472
+ * },
473
+ * message(ws, message) {
474
+ * ws.send("Echo: " + message);
475
+ * },
476
+ * close(ws, code, reason) {
477
+ * console.log("Closed:", code, reason);
478
+ * }
479
+ * }
480
+ * });
481
+ */
482
+ function serve<T = unknown>(options: ServeOptions<T>): void;
483
+
484
+ // ============================================
485
+ // Client WebSocket API (outbound connections)
486
+ // ============================================
487
+
488
+ /**
489
+ * The type for WebSocket binary data handling.
490
+ */
491
+ type BinaryType = "blob" | "arraybuffer";
492
+
493
+ /**
494
+ * Event fired when a WebSocket connection is closed.
495
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent
496
+ */
497
+ interface CloseEvent extends Event {
498
+ /**
499
+ * The close code sent by the server.
500
+ */
501
+ readonly code: number;
502
+
503
+ /**
504
+ * The close reason sent by the server.
505
+ */
506
+ readonly reason: string;
507
+
508
+ /**
509
+ * Whether the connection was closed cleanly.
510
+ */
511
+ readonly wasClean: boolean;
512
+ }
513
+
514
+ /**
515
+ * Event fired when a WebSocket receives a message.
516
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent
517
+ */
518
+ interface MessageEvent<T = any> extends Event {
519
+ /**
520
+ * The data sent by the message emitter.
521
+ */
522
+ readonly data: T;
523
+
524
+ /**
525
+ * The origin of the message emitter.
526
+ */
527
+ readonly origin: string;
528
+
529
+ /**
530
+ * The last event ID (for Server-Sent Events).
531
+ */
532
+ readonly lastEventId: string;
533
+
534
+ /**
535
+ * The MessagePort array sent with the message (if any).
536
+ */
537
+ readonly ports: ReadonlyArray<MessagePort>;
538
+
539
+ /**
540
+ * The source of the message (if applicable).
541
+ */
542
+ readonly source: MessageEventSource | null;
543
+ }
544
+
545
+ /**
546
+ * WHATWG WebSocket client for making outbound WebSocket connections.
547
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
548
+ *
549
+ * @example
550
+ * const ws = new WebSocket("wss://echo.websocket.org");
551
+ *
552
+ * ws.onopen = () => {
553
+ * console.log("Connected!");
554
+ * ws.send("Hello, server!");
555
+ * };
556
+ *
557
+ * ws.onmessage = (event) => {
558
+ * console.log("Received:", event.data);
559
+ * };
560
+ *
561
+ * ws.onclose = (event) => {
562
+ * console.log("Closed:", event.code, event.reason);
563
+ * };
564
+ *
565
+ * ws.onerror = () => {
566
+ * console.log("Error occurred");
567
+ * };
568
+ */
569
+ interface WebSocket extends EventTarget {
570
+ /**
571
+ * The URL of the WebSocket connection.
572
+ */
573
+ readonly url: string;
574
+
575
+ /**
576
+ * The current state of the connection.
577
+ * - 0: CONNECTING
578
+ * - 1: OPEN
579
+ * - 2: CLOSING
580
+ * - 3: CLOSED
581
+ */
582
+ readonly readyState: number;
583
+
584
+ /**
585
+ * The number of bytes of data that have been queued but not yet transmitted.
586
+ */
587
+ readonly bufferedAmount: number;
588
+
589
+ /**
590
+ * The extensions selected by the server.
591
+ */
592
+ readonly extensions: string;
593
+
594
+ /**
595
+ * The subprotocol selected by the server.
596
+ */
597
+ readonly protocol: string;
598
+
599
+ /**
600
+ * The type of binary data being transmitted.
601
+ * Can be "blob" or "arraybuffer".
602
+ */
603
+ binaryType: BinaryType;
604
+
605
+ /**
606
+ * Send data through the WebSocket connection.
607
+ *
608
+ * @param data - The data to send
609
+ * @throws InvalidStateError if the connection is not open
610
+ *
611
+ * @example
612
+ * ws.send("Hello!");
613
+ * ws.send(new Uint8Array([1, 2, 3]));
614
+ */
615
+ send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
616
+
617
+ /**
618
+ * Close the WebSocket connection.
619
+ *
620
+ * @param code - The close code (default: 1000)
621
+ * @param reason - The close reason (max 123 bytes UTF-8)
622
+ *
623
+ * @example
624
+ * ws.close();
625
+ * ws.close(1000, "Normal closure");
626
+ */
627
+ close(code?: number, reason?: string): void;
628
+
629
+ /**
630
+ * Event handler for when the connection is established.
631
+ */
632
+ onopen: ((this: WebSocket, ev: Event) => any) | null;
633
+
634
+ /**
635
+ * Event handler for when a message is received.
636
+ */
637
+ onmessage: ((this: WebSocket, ev: MessageEvent) => any) | null;
638
+
639
+ /**
640
+ * Event handler for when an error occurs.
641
+ */
642
+ onerror: ((this: WebSocket, ev: Event) => any) | null;
643
+
644
+ /**
645
+ * Event handler for when the connection is closed.
646
+ */
647
+ onclose: ((this: WebSocket, ev: CloseEvent) => any) | null;
648
+
649
+ /**
650
+ * Connection is being established.
651
+ */
652
+ readonly CONNECTING: 0;
653
+
654
+ /**
655
+ * Connection is open and ready to communicate.
656
+ */
657
+ readonly OPEN: 1;
658
+
659
+ /**
660
+ * Connection is in the process of closing.
661
+ */
662
+ readonly CLOSING: 2;
663
+
664
+ /**
665
+ * Connection is closed or couldn't be opened.
666
+ */
667
+ readonly CLOSED: 3;
668
+ }
669
+
670
+ /**
671
+ * WebSocket constructor.
672
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/WebSocket
673
+ */
674
+ interface WebSocketConstructor {
675
+ /**
676
+ * Create a new WebSocket connection.
677
+ *
678
+ * @param url - The URL to connect to (must be ws:// or wss://)
679
+ * @param protocols - Optional subprotocol(s) to request
680
+ * @throws SyntaxError if the URL is invalid
681
+ *
682
+ * @example
683
+ * const ws = new WebSocket("wss://example.com/socket");
684
+ * const ws = new WebSocket("wss://example.com/socket", "graphql-ws");
685
+ * const ws = new WebSocket("wss://example.com/socket", ["protocol1", "protocol2"]);
686
+ */
687
+ new (url: string | URL, protocols?: string | string[]): WebSocket;
688
+
689
+ readonly prototype: WebSocket;
690
+
691
+ /**
692
+ * Connection is being established.
693
+ */
694
+ readonly CONNECTING: 0;
695
+
696
+ /**
697
+ * Connection is open and ready to communicate.
698
+ */
699
+ readonly OPEN: 1;
700
+
701
+ /**
702
+ * Connection is in the process of closing.
703
+ */
704
+ readonly CLOSING: 2;
705
+
706
+ /**
707
+ * Connection is closed or couldn't be opened.
708
+ */
709
+ readonly CLOSED: 3;
710
+ }
711
+
712
+ /**
713
+ * WHATWG WebSocket client for making outbound WebSocket connections.
714
+ */
715
+ const WebSocket: WebSocketConstructor;
716
+ }
717
+ `;
718
+ var FS_TYPES = `/**
719
+ * Global Type Definitions for ../fs/index.ts
720
+ *
721
+ * These types define the globals injected by setupFs() into an isolated-vm context.
722
+ * Use these types to typecheck user code that will run inside the V8 isolate.
723
+ *
724
+ * @example
725
+ * // Typecheck isolate code with file system access
726
+ * const root = await getDirectory("/data");
727
+ * const fileHandle = await root.getFileHandle("config.json");
728
+ * const file = await fileHandle.getFile();
729
+ * const content = await file.text();
730
+ */
731
+
732
+ export {};
733
+
734
+ declare global {
735
+ // ============================================
736
+ // getDirectory - Isolate-specific entry point
737
+ // ============================================
738
+
739
+ /**
740
+ * Get a directory handle for the given path.
741
+ *
742
+ * The host controls which paths are accessible. Invalid or unauthorized
743
+ * paths will throw an error.
744
+ *
745
+ * @param path - The path to request from the host
746
+ * @returns A promise resolving to a directory handle
747
+ * @throws If the path is not allowed or doesn't exist
748
+ *
749
+ * @example
750
+ * const root = await getDirectory("/");
751
+ * const dataDir = await getDirectory("/data");
752
+ */
753
+ function getDirectory(path: string): Promise<FileSystemDirectoryHandle>;
754
+
755
+ // ============================================
756
+ // File System Access API
757
+ // ============================================
758
+
759
+ /**
760
+ * Base interface for file system handles.
761
+ */
762
+ interface FileSystemHandle {
763
+ /**
764
+ * The kind of handle: "file" or "directory".
765
+ */
766
+ readonly kind: "file" | "directory";
767
+
768
+ /**
769
+ * The name of the file or directory.
770
+ */
771
+ readonly name: string;
772
+
773
+ /**
774
+ * Compare two handles to check if they reference the same entry.
775
+ *
776
+ * @param other - Another FileSystemHandle to compare against
777
+ * @returns true if both handles reference the same entry
778
+ */
779
+ isSameEntry(other: FileSystemHandle): Promise<boolean>;
780
+ }
781
+
782
+ /**
783
+ * Handle for a file in the file system.
784
+ */
785
+ interface FileSystemFileHandle extends FileSystemHandle {
786
+ /**
787
+ * Always "file" for file handles.
788
+ */
789
+ readonly kind: "file";
790
+
791
+ /**
792
+ * Get the file contents as a File object.
793
+ *
794
+ * @returns A promise resolving to a File object
795
+ *
796
+ * @example
797
+ * const file = await fileHandle.getFile();
798
+ * const text = await file.text();
799
+ */
800
+ getFile(): Promise<File>;
801
+
802
+ /**
803
+ * Create a writable stream for writing to the file.
804
+ *
805
+ * @param options - Options for the writable stream
806
+ * @returns A promise resolving to a writable stream
807
+ *
808
+ * @example
809
+ * const writable = await fileHandle.createWritable();
810
+ * await writable.write("Hello, World!");
811
+ * await writable.close();
812
+ */
813
+ createWritable(options?: {
814
+ /**
815
+ * If true, keeps existing file data. Otherwise, truncates the file.
816
+ */
817
+ keepExistingData?: boolean;
818
+ }): Promise<FileSystemWritableFileStream>;
819
+ }
820
+
821
+ /**
822
+ * Handle for a directory in the file system.
823
+ */
824
+ interface FileSystemDirectoryHandle extends FileSystemHandle {
825
+ /**
826
+ * Always "directory" for directory handles.
827
+ */
828
+ readonly kind: "directory";
829
+
830
+ /**
831
+ * Get a file handle within this directory.
832
+ *
833
+ * @param name - The name of the file
834
+ * @param options - Options for getting the file handle
835
+ * @returns A promise resolving to a file handle
836
+ * @throws If the file doesn't exist and create is not true
837
+ *
838
+ * @example
839
+ * const file = await dir.getFileHandle("data.json");
840
+ * const newFile = await dir.getFileHandle("output.txt", { create: true });
841
+ */
842
+ getFileHandle(
843
+ name: string,
844
+ options?: {
845
+ /**
846
+ * If true, creates the file if it doesn't exist.
847
+ */
848
+ create?: boolean;
849
+ }
850
+ ): Promise<FileSystemFileHandle>;
851
+
852
+ /**
853
+ * Get a subdirectory handle within this directory.
854
+ *
855
+ * @param name - The name of the subdirectory
856
+ * @param options - Options for getting the directory handle
857
+ * @returns A promise resolving to a directory handle
858
+ * @throws If the directory doesn't exist and create is not true
859
+ *
860
+ * @example
861
+ * const subdir = await dir.getDirectoryHandle("logs");
862
+ * const newDir = await dir.getDirectoryHandle("cache", { create: true });
863
+ */
864
+ getDirectoryHandle(
865
+ name: string,
866
+ options?: {
867
+ /**
868
+ * If true, creates the directory if it doesn't exist.
869
+ */
870
+ create?: boolean;
871
+ }
872
+ ): Promise<FileSystemDirectoryHandle>;
873
+
874
+ /**
875
+ * Remove a file or directory within this directory.
876
+ *
877
+ * @param name - The name of the entry to remove
878
+ * @param options - Options for removal
879
+ * @throws If the entry doesn't exist or cannot be removed
880
+ *
881
+ * @example
882
+ * await dir.removeEntry("old-file.txt");
883
+ * await dir.removeEntry("old-dir", { recursive: true });
884
+ */
885
+ removeEntry(
886
+ name: string,
887
+ options?: {
888
+ /**
889
+ * If true, removes directories recursively.
890
+ */
891
+ recursive?: boolean;
892
+ }
893
+ ): Promise<void>;
894
+
895
+ /**
896
+ * Resolve the path from this directory to a descendant handle.
897
+ *
898
+ * @param possibleDescendant - A handle that may be a descendant
899
+ * @returns An array of path segments, or null if not a descendant
900
+ *
901
+ * @example
902
+ * const path = await root.resolve(nestedFile);
903
+ * // ["subdir", "file.txt"]
904
+ */
905
+ resolve(possibleDescendant: FileSystemHandle): Promise<string[] | null>;
906
+
907
+ /**
908
+ * Iterate over entries in this directory.
909
+ *
910
+ * @returns An async iterator of [name, handle] pairs
911
+ *
912
+ * @example
913
+ * for await (const [name, handle] of dir.entries()) {
914
+ * console.log(name, handle.kind);
915
+ * }
916
+ */
917
+ entries(): AsyncIterableIterator<[string, FileSystemHandle]>;
918
+
919
+ /**
920
+ * Iterate over entry names in this directory.
921
+ *
922
+ * @returns An async iterator of names
923
+ *
924
+ * @example
925
+ * for await (const name of dir.keys()) {
926
+ * console.log(name);
927
+ * }
928
+ */
929
+ keys(): AsyncIterableIterator<string>;
930
+
931
+ /**
932
+ * Iterate over handles in this directory.
933
+ *
934
+ * @returns An async iterator of handles
935
+ *
936
+ * @example
937
+ * for await (const handle of dir.values()) {
938
+ * console.log(handle.name, handle.kind);
939
+ * }
940
+ */
941
+ values(): AsyncIterableIterator<FileSystemHandle>;
942
+
943
+ /**
944
+ * Async iterator support for directory entries.
945
+ *
946
+ * @example
947
+ * for await (const [name, handle] of dir) {
948
+ * console.log(name, handle.kind);
949
+ * }
950
+ */
951
+ [Symbol.asyncIterator](): AsyncIterableIterator<[string, FileSystemHandle]>;
952
+ }
953
+
954
+ /**
955
+ * Parameters for write operations on FileSystemWritableFileStream.
956
+ */
957
+ interface WriteParams {
958
+ /**
959
+ * The type of write operation.
960
+ * - "write": Write data at the current position or specified position
961
+ * - "seek": Move the file position
962
+ * - "truncate": Truncate the file to a specific size
963
+ */
964
+ type: "write" | "seek" | "truncate";
965
+
966
+ /**
967
+ * The data to write (for "write" type).
968
+ */
969
+ data?: string | ArrayBuffer | Uint8Array | Blob;
970
+
971
+ /**
972
+ * The position to write at or seek to.
973
+ */
974
+ position?: number;
975
+
976
+ /**
977
+ * The size to truncate to (for "truncate" type).
978
+ */
979
+ size?: number;
980
+ }
981
+
982
+ /**
983
+ * Writable stream for writing to a file.
984
+ * Extends WritableStream with file-specific operations.
985
+ */
986
+ interface FileSystemWritableFileStream extends WritableStream<Uint8Array> {
987
+ /**
988
+ * Write data to the file.
989
+ *
990
+ * @param data - The data to write
991
+ * @returns A promise that resolves when the write completes
992
+ *
993
+ * @example
994
+ * await writable.write("Hello, World!");
995
+ * await writable.write(new Uint8Array([1, 2, 3]));
996
+ * await writable.write({ type: "write", data: "text", position: 0 });
997
+ */
998
+ write(
999
+ data: string | ArrayBuffer | Uint8Array | Blob | WriteParams
1000
+ ): Promise<void>;
1001
+
1002
+ /**
1003
+ * Seek to a position in the file.
1004
+ *
1005
+ * @param position - The byte position to seek to
1006
+ * @returns A promise that resolves when the seek completes
1007
+ *
1008
+ * @example
1009
+ * await writable.seek(0); // Seek to beginning
1010
+ * await writable.write("Overwrite");
1011
+ */
1012
+ seek(position: number): Promise<void>;
1013
+
1014
+ /**
1015
+ * Truncate the file to a specific size.
1016
+ *
1017
+ * @param size - The size to truncate to
1018
+ * @returns A promise that resolves when the truncation completes
1019
+ *
1020
+ * @example
1021
+ * await writable.truncate(100); // Keep only first 100 bytes
1022
+ */
1023
+ truncate(size: number): Promise<void>;
1024
+ }
1025
+ }
1026
+ `;
1027
+ var TEST_ENV_TYPES = `/**
1028
+ * Global Type Definitions for ../test-environment/index.ts
1029
+ *
1030
+ * These types define the globals injected by setupTestEnvironment() into an isolated-vm context.
1031
+ * Use these types to typecheck user code that will run inside the V8 isolate.
1032
+ *
1033
+ * @example
1034
+ * describe("Math operations", () => {
1035
+ * it("should add numbers", () => {
1036
+ * expect(1 + 1).toBe(2);
1037
+ * });
1038
+ * });
1039
+ */
1040
+
1041
+ export {};
1042
+
1043
+ declare global {
1044
+ // ============================================
1045
+ // Test Structure
1046
+ // ============================================
1047
+
1048
+ /**
1049
+ * Define a test suite.
1050
+ *
1051
+ * @param name - The name of the test suite
1052
+ * @param fn - Function containing tests and nested suites
1053
+ *
1054
+ * @example
1055
+ * describe("Calculator", () => {
1056
+ * it("adds numbers", () => {
1057
+ * expect(1 + 1).toBe(2);
1058
+ * });
1059
+ * });
1060
+ */
1061
+ function describe(name: string, fn: () => void): void;
1062
+
1063
+ namespace describe {
1064
+ /**
1065
+ * Skip this suite and all its tests.
1066
+ */
1067
+ function skip(name: string, fn: () => void): void;
1068
+
1069
+ /**
1070
+ * Only run this suite (and other .only suites).
1071
+ */
1072
+ function only(name: string, fn: () => void): void;
1073
+
1074
+ /**
1075
+ * Mark suite as todo (skipped with different status).
1076
+ */
1077
+ function todo(name: string, fn?: () => void): void;
1078
+ }
1079
+
1080
+ /**
1081
+ * Define a test case.
1082
+ *
1083
+ * @param name - The name of the test
1084
+ * @param fn - The test function (can be async)
1085
+ *
1086
+ * @example
1087
+ * it("should work", () => {
1088
+ * expect(true).toBe(true);
1089
+ * });
1090
+ *
1091
+ * it("should work async", async () => {
1092
+ * const result = await Promise.resolve(42);
1093
+ * expect(result).toBe(42);
1094
+ * });
1095
+ */
1096
+ function it(name: string, fn: () => void | Promise<void>): void;
1097
+
1098
+ namespace it {
1099
+ /**
1100
+ * Skip this test.
1101
+ */
1102
+ function skip(name: string, fn?: () => void | Promise<void>): void;
1103
+
1104
+ /**
1105
+ * Only run this test (and other .only tests).
1106
+ */
1107
+ function only(name: string, fn: () => void | Promise<void>): void;
1108
+
1109
+ /**
1110
+ * Mark test as todo.
1111
+ */
1112
+ function todo(name: string, fn?: () => void | Promise<void>): void;
1113
+ }
1114
+
1115
+ /**
1116
+ * Alias for it().
1117
+ */
1118
+ function test(name: string, fn: () => void | Promise<void>): void;
1119
+
1120
+ namespace test {
1121
+ /**
1122
+ * Skip this test.
1123
+ */
1124
+ function skip(name: string, fn?: () => void | Promise<void>): void;
1125
+
1126
+ /**
1127
+ * Only run this test (and other .only tests).
1128
+ */
1129
+ function only(name: string, fn: () => void | Promise<void>): void;
1130
+
1131
+ /**
1132
+ * Mark test as todo.
1133
+ */
1134
+ function todo(name: string, fn?: () => void | Promise<void>): void;
1135
+ }
1136
+
1137
+ // ============================================
1138
+ // Lifecycle Hooks
1139
+ // ============================================
1140
+
1141
+ /**
1142
+ * Run once before all tests in the current suite.
1143
+ *
1144
+ * @param fn - Setup function (can be async)
1145
+ */
1146
+ function beforeAll(fn: () => void | Promise<void>): void;
1147
+
1148
+ /**
1149
+ * Run once after all tests in the current suite.
1150
+ *
1151
+ * @param fn - Teardown function (can be async)
1152
+ */
1153
+ function afterAll(fn: () => void | Promise<void>): void;
1154
+
1155
+ /**
1156
+ * Run before each test in the current suite (and nested suites).
1157
+ *
1158
+ * @param fn - Setup function (can be async)
1159
+ */
1160
+ function beforeEach(fn: () => void | Promise<void>): void;
1161
+
1162
+ /**
1163
+ * Run after each test in the current suite (and nested suites).
1164
+ *
1165
+ * @param fn - Teardown function (can be async)
1166
+ */
1167
+ function afterEach(fn: () => void | Promise<void>): void;
1168
+
1169
+ // ============================================
1170
+ // Assertions
1171
+ // ============================================
1172
+
1173
+ /**
1174
+ * Matchers for assertions.
1175
+ */
1176
+ interface Matchers<T> {
1177
+ /**
1178
+ * Strict equality (===).
1179
+ */
1180
+ toBe(expected: T): void;
1181
+
1182
+ /**
1183
+ * Deep equality.
1184
+ */
1185
+ toEqual(expected: unknown): void;
1186
+
1187
+ /**
1188
+ * Deep equality with type checking.
1189
+ */
1190
+ toStrictEqual(expected: unknown): void;
1191
+
1192
+ /**
1193
+ * Check if value is truthy.
1194
+ */
1195
+ toBeTruthy(): void;
1196
+
1197
+ /**
1198
+ * Check if value is falsy.
1199
+ */
1200
+ toBeFalsy(): void;
1201
+
1202
+ /**
1203
+ * Check if value is null.
1204
+ */
1205
+ toBeNull(): void;
1206
+
1207
+ /**
1208
+ * Check if value is undefined.
1209
+ */
1210
+ toBeUndefined(): void;
1211
+
1212
+ /**
1213
+ * Check if value is defined (not undefined).
1214
+ */
1215
+ toBeDefined(): void;
1216
+
1217
+ /**
1218
+ * Check if value is NaN.
1219
+ */
1220
+ toBeNaN(): void;
1221
+
1222
+ /**
1223
+ * Check if number is greater than expected.
1224
+ */
1225
+ toBeGreaterThan(n: number): void;
1226
+
1227
+ /**
1228
+ * Check if number is greater than or equal to expected.
1229
+ */
1230
+ toBeGreaterThanOrEqual(n: number): void;
1231
+
1232
+ /**
1233
+ * Check if number is less than expected.
1234
+ */
1235
+ toBeLessThan(n: number): void;
1236
+
1237
+ /**
1238
+ * Check if number is less than or equal to expected.
1239
+ */
1240
+ toBeLessThanOrEqual(n: number): void;
1241
+
1242
+ /**
1243
+ * Check if array/string contains item/substring.
1244
+ */
1245
+ toContain(item: unknown): void;
1246
+
1247
+ /**
1248
+ * Check length of array/string.
1249
+ */
1250
+ toHaveLength(length: number): void;
1251
+
1252
+ /**
1253
+ * Check if object has property (optionally with value).
1254
+ */
1255
+ toHaveProperty(key: string, value?: unknown): void;
1256
+
1257
+ /**
1258
+ * Check if function throws.
1259
+ */
1260
+ toThrow(expected?: string | RegExp | Error): void;
1261
+
1262
+ /**
1263
+ * Check if string matches pattern.
1264
+ */
1265
+ toMatch(pattern: string | RegExp): void;
1266
+
1267
+ /**
1268
+ * Check if object matches subset of properties.
1269
+ */
1270
+ toMatchObject(object: object): void;
1271
+
1272
+ /**
1273
+ * Check if value is instance of class.
1274
+ */
1275
+ toBeInstanceOf(constructor: Function): void;
1276
+
1277
+ /**
1278
+ * Negate the matcher.
1279
+ */
1280
+ not: Matchers<T>;
1281
+
1282
+ /**
1283
+ * Await promise and check resolved value.
1284
+ */
1285
+ resolves: Matchers<Awaited<T>>;
1286
+
1287
+ /**
1288
+ * Await promise and check rejection.
1289
+ */
1290
+ rejects: Matchers<unknown>;
1291
+ }
1292
+
1293
+ /**
1294
+ * Create an expectation for a value.
1295
+ *
1296
+ * @param actual - The value to test
1297
+ * @returns Matchers for the value
1298
+ *
1299
+ * @example
1300
+ * expect(1 + 1).toBe(2);
1301
+ * expect({ a: 1 }).toEqual({ a: 1 });
1302
+ * expect(() => { throw new Error(); }).toThrow();
1303
+ * expect(promise).resolves.toBe(42);
1304
+ */
1305
+ function expect<T>(actual: T): Matchers<T>;
1306
+ }
1307
+ `;
1308
+ var CONSOLE_TYPES = `/**
1309
+ * Global Type Definitions for ../console/index.ts
1310
+ *
1311
+ * These types define the globals injected by setupConsole() into an isolated-vm context.
1312
+ * Use these types to typecheck user code that will run inside the V8 isolate.
1313
+ */
1314
+
1315
+ export {};
1316
+
1317
+ declare global {
1318
+ /**
1319
+ * Console interface for logging and debugging.
1320
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Console
1321
+ */
1322
+ interface Console {
1323
+ /**
1324
+ * Log a message to the console.
1325
+ * @param data - Values to log
1326
+ */
1327
+ log(...data: unknown[]): void;
1328
+
1329
+ /**
1330
+ * Log a warning message.
1331
+ * @param data - Values to log
1332
+ */
1333
+ warn(...data: unknown[]): void;
1334
+
1335
+ /**
1336
+ * Log an error message.
1337
+ * @param data - Values to log
1338
+ */
1339
+ error(...data: unknown[]): void;
1340
+
1341
+ /**
1342
+ * Log a debug message.
1343
+ * @param data - Values to log
1344
+ */
1345
+ debug(...data: unknown[]): void;
1346
+
1347
+ /**
1348
+ * Log an info message.
1349
+ * @param data - Values to log
1350
+ */
1351
+ info(...data: unknown[]): void;
1352
+
1353
+ /**
1354
+ * Log a stack trace.
1355
+ * @param data - Values to log with the trace
1356
+ */
1357
+ trace(...data: unknown[]): void;
1358
+
1359
+ /**
1360
+ * Display an object in a formatted way.
1361
+ * @param item - Object to display
1362
+ * @param options - Display options
1363
+ */
1364
+ dir(item: unknown, options?: object): void;
1365
+
1366
+ /**
1367
+ * Display tabular data.
1368
+ * @param tabularData - Data to display as a table
1369
+ * @param properties - Optional array of property names to include
1370
+ */
1371
+ table(tabularData: unknown, properties?: string[]): void;
1372
+
1373
+ /**
1374
+ * Start a timer.
1375
+ * @param label - Timer label (default: "default")
1376
+ */
1377
+ time(label?: string): void;
1378
+
1379
+ /**
1380
+ * End a timer and log the elapsed time.
1381
+ * @param label - Timer label (default: "default")
1382
+ */
1383
+ timeEnd(label?: string): void;
1384
+
1385
+ /**
1386
+ * Log the elapsed time of a timer without ending it.
1387
+ * @param label - Timer label (default: "default")
1388
+ * @param data - Additional values to log
1389
+ */
1390
+ timeLog(label?: string, ...data: unknown[]): void;
1391
+
1392
+ /**
1393
+ * Log an error if the assertion is false.
1394
+ * @param condition - Condition to test
1395
+ * @param data - Values to log if assertion fails
1396
+ */
1397
+ assert(condition?: boolean, ...data: unknown[]): void;
1398
+
1399
+ /**
1400
+ * Increment and log a counter.
1401
+ * @param label - Counter label (default: "default")
1402
+ */
1403
+ count(label?: string): void;
1404
+
1405
+ /**
1406
+ * Reset a counter.
1407
+ * @param label - Counter label (default: "default")
1408
+ */
1409
+ countReset(label?: string): void;
1410
+
1411
+ /**
1412
+ * Clear the console.
1413
+ */
1414
+ clear(): void;
1415
+
1416
+ /**
1417
+ * Start an inline group.
1418
+ * @param data - Group label
1419
+ */
1420
+ group(...data: unknown[]): void;
1421
+
1422
+ /**
1423
+ * Start a collapsed inline group.
1424
+ * @param data - Group label
1425
+ */
1426
+ groupCollapsed(...data: unknown[]): void;
1427
+
1428
+ /**
1429
+ * End the current inline group.
1430
+ */
1431
+ groupEnd(): void;
1432
+ }
1433
+
1434
+ /**
1435
+ * Console object for logging and debugging.
1436
+ */
1437
+ const console: Console;
1438
+ }
1439
+ `;
1440
+ var ENCODING_TYPES = `/**
1441
+ * Global Type Definitions for ../encoding/index.ts
1442
+ *
1443
+ * These types define the globals injected by setupEncoding() into an isolated-vm context.
1444
+ * Use these types to typecheck user code that will run inside the V8 isolate.
1445
+ */
1446
+
1447
+ export {};
1448
+
1449
+ declare global {
1450
+ /**
1451
+ * Decodes a Base64-encoded string.
1452
+ *
1453
+ * @param encodedData - The Base64 string to decode
1454
+ * @returns The decoded string
1455
+ * @throws DOMException if the input is not valid Base64
1456
+ *
1457
+ * @example
1458
+ * atob("SGVsbG8="); // "Hello"
1459
+ */
1460
+ function atob(encodedData: string): string;
1461
+
1462
+ /**
1463
+ * Encodes a string to Base64.
1464
+ *
1465
+ * @param stringToEncode - The string to encode (must contain only Latin1 characters)
1466
+ * @returns The Base64 encoded string
1467
+ * @throws DOMException if the string contains characters outside Latin1 range (0-255)
1468
+ *
1469
+ * @example
1470
+ * btoa("Hello"); // "SGVsbG8="
1471
+ */
1472
+ function btoa(stringToEncode: string): string;
1473
+
1474
+ // ============================================
1475
+ // Buffer
1476
+ // ============================================
1477
+
1478
+ /**
1479
+ * Buffer encoding types supported by the isolate Buffer implementation.
1480
+ */
1481
+ type BufferEncoding = "utf8" | "utf-8" | "base64" | "hex";
1482
+
1483
+ /**
1484
+ * Buffer class for working with binary data.
1485
+ * Extends Uint8Array for compatibility.
1486
+ * @see https://nodejs.org/api/buffer.html
1487
+ */
1488
+ interface Buffer extends Uint8Array {
1489
+ /**
1490
+ * Convert the buffer to a string.
1491
+ *
1492
+ * @param encoding - The encoding to use (default: "utf8")
1493
+ * @returns The string representation
1494
+ *
1495
+ * @example
1496
+ * const buf = Buffer.from("hello");
1497
+ * buf.toString(); // "hello"
1498
+ * buf.toString("hex"); // "68656c6c6f"
1499
+ * buf.toString("base64"); // "aGVsbG8="
1500
+ */
1501
+ toString(encoding?: BufferEncoding): string;
1502
+
1503
+ /**
1504
+ * Returns a new Buffer that references the same memory as the original,
1505
+ * but offset and cropped by the start and end indices.
1506
+ *
1507
+ * @param start - Start index (default: 0)
1508
+ * @param end - End index (default: buffer.length)
1509
+ * @returns A new Buffer instance
1510
+ *
1511
+ * @example
1512
+ * const buf = Buffer.from("hello");
1513
+ * buf.slice(1, 4).toString(); // "ell"
1514
+ */
1515
+ slice(start?: number, end?: number): Buffer;
1516
+
1517
+ /**
1518
+ * Returns a new Buffer that references the same memory as the original,
1519
+ * but offset and cropped by the start and end indices.
1520
+ *
1521
+ * @param start - Start index (default: 0)
1522
+ * @param end - End index (default: buffer.length)
1523
+ * @returns A new Buffer instance
1524
+ */
1525
+ subarray(start?: number, end?: number): Buffer;
1526
+ }
1527
+
1528
+ /**
1529
+ * Buffer constructor interface.
1530
+ */
1531
+ interface BufferConstructor {
1532
+ /**
1533
+ * Creates a new Buffer from a string, array, ArrayBuffer, or another Buffer.
1534
+ *
1535
+ * @param value - The value to create a buffer from
1536
+ * @param encodingOrOffset - Encoding for strings, or byte offset for ArrayBuffer
1537
+ * @param length - Length for ArrayBuffer (when offset is provided)
1538
+ * @returns A new Buffer instance
1539
+ *
1540
+ * @example
1541
+ * Buffer.from("hello"); // UTF-8 encoded
1542
+ * Buffer.from("aGVsbG8=", "base64"); // base64 decoded
1543
+ * Buffer.from("68656c6c6f", "hex"); // hex decoded
1544
+ * Buffer.from([104, 101, 108, 108, 111]); // from array
1545
+ */
1546
+ from(value: string, encoding?: BufferEncoding): Buffer;
1547
+ from(value: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
1548
+ from(value: Uint8Array | ReadonlyArray<number>): Buffer;
1549
+ from(value: Iterable<number>): Buffer;
1550
+
1551
+ /**
1552
+ * Allocates a new Buffer of the specified size, filled with zeros or the specified fill value.
1553
+ *
1554
+ * @param size - The size of the buffer in bytes
1555
+ * @param fill - Value to fill the buffer with (default: 0)
1556
+ * @param encoding - Encoding for string fill values
1557
+ * @returns A new Buffer instance
1558
+ *
1559
+ * @example
1560
+ * Buffer.alloc(5); // <Buffer 00 00 00 00 00>
1561
+ * Buffer.alloc(5, 1); // <Buffer 01 01 01 01 01>
1562
+ * Buffer.alloc(5, "ab"); // <Buffer 61 62 61 62 61>
1563
+ */
1564
+ alloc(size: number, fill?: number | string | Buffer, encoding?: BufferEncoding): Buffer;
1565
+
1566
+ /**
1567
+ * Allocates a new Buffer of the specified size without initializing the memory.
1568
+ * The contents are unknown and may contain sensitive data.
1569
+ *
1570
+ * @param size - The size of the buffer in bytes
1571
+ * @returns A new Buffer instance
1572
+ */
1573
+ allocUnsafe(size: number): Buffer;
1574
+
1575
+ /**
1576
+ * Concatenates a list of Buffers.
1577
+ *
1578
+ * @param list - Array of Buffer instances to concatenate
1579
+ * @param totalLength - Total length of the buffers (optional)
1580
+ * @returns A new Buffer instance
1581
+ *
1582
+ * @example
1583
+ * const buf1 = Buffer.from("hel");
1584
+ * const buf2 = Buffer.from("lo");
1585
+ * Buffer.concat([buf1, buf2]).toString(); // "hello"
1586
+ */
1587
+ concat(list: ReadonlyArray<Uint8Array>, totalLength?: number): Buffer;
1588
+
1589
+ /**
1590
+ * Returns true if the given object is a Buffer.
1591
+ *
1592
+ * @param obj - Object to test
1593
+ * @returns true if obj is a Buffer
1594
+ *
1595
+ * @example
1596
+ * Buffer.isBuffer(Buffer.from("test")); // true
1597
+ * Buffer.isBuffer(new Uint8Array(5)); // false
1598
+ */
1599
+ isBuffer(obj: unknown): obj is Buffer;
1600
+
1601
+ /**
1602
+ * Returns the byte length of a string when encoded.
1603
+ *
1604
+ * @param string - The string to measure
1605
+ * @param encoding - The encoding (default: "utf8")
1606
+ * @returns The byte length
1607
+ *
1608
+ * @example
1609
+ * Buffer.byteLength("hello"); // 5
1610
+ * Buffer.byteLength("aGVsbG8=", "base64"); // 5 (decoded length)
1611
+ */
1612
+ byteLength(string: string, encoding?: BufferEncoding): number;
1613
+ byteLength(buffer: ArrayBufferView | ArrayBuffer): number;
1614
+
1615
+ /**
1616
+ * Returns true if the encoding is a valid buffer encoding.
1617
+ *
1618
+ * @param encoding - The encoding to check
1619
+ * @returns true if the encoding is supported
1620
+ */
1621
+ isEncoding(encoding: string): encoding is BufferEncoding;
1622
+
1623
+ readonly prototype: Buffer;
1624
+ }
1625
+
1626
+ /**
1627
+ * Buffer class for working with binary data.
1628
+ * @see https://nodejs.org/api/buffer.html
1629
+ */
1630
+ const Buffer: BufferConstructor;
1631
+ }
1632
+ `;
1633
+ var CRYPTO_TYPES = `/**
1634
+ * Global Type Definitions for ../crypto/index.ts
1635
+ *
1636
+ * These types define the globals injected by setupCrypto() into an isolated-vm context.
1637
+ * Use these types to typecheck user code that will run inside the V8 isolate.
1638
+ *
1639
+ * @example
1640
+ * // Generate random bytes
1641
+ * const arr = new Uint8Array(16);
1642
+ * crypto.getRandomValues(arr);
1643
+ *
1644
+ * // Generate UUID
1645
+ * const uuid = crypto.randomUUID();
1646
+ *
1647
+ * // Use SubtleCrypto
1648
+ * const key = await crypto.subtle.generateKey(
1649
+ * { name: "AES-GCM", length: 256 },
1650
+ * true,
1651
+ * ["encrypt", "decrypt"]
1652
+ * );
1653
+ */
1654
+
1655
+ export {};
1656
+
1657
+ declare global {
1658
+ /**
1659
+ * CryptoKey represents a cryptographic key.
1660
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey
1661
+ */
1662
+ interface CryptoKey {
1663
+ /**
1664
+ * The type of key: "public", "private", or "secret".
1665
+ */
1666
+ readonly type: "public" | "private" | "secret";
1667
+
1668
+ /**
1669
+ * Whether the key can be exported.
1670
+ */
1671
+ readonly extractable: boolean;
1672
+
1673
+ /**
1674
+ * The algorithm used by this key.
1675
+ */
1676
+ readonly algorithm: KeyAlgorithm;
1677
+
1678
+ /**
1679
+ * The usages allowed for this key.
1680
+ */
1681
+ readonly usages: ReadonlyArray<KeyUsage>;
1682
+ }
1683
+
1684
+ /**
1685
+ * CryptoKey constructor (keys cannot be constructed directly).
1686
+ */
1687
+ const CryptoKey: {
1688
+ prototype: CryptoKey;
1689
+ };
1690
+
1691
+ /**
1692
+ * SubtleCrypto interface for cryptographic operations.
1693
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto
1694
+ */
1695
+ interface SubtleCrypto {
1696
+ /**
1697
+ * Generate a digest (hash) of the given data.
1698
+ *
1699
+ * @param algorithm - Hash algorithm (e.g., "SHA-256", "SHA-384", "SHA-512")
1700
+ * @param data - Data to hash
1701
+ * @returns Promise resolving to the hash as ArrayBuffer
1702
+ */
1703
+ digest(
1704
+ algorithm: AlgorithmIdentifier,
1705
+ data: BufferSource
1706
+ ): Promise<ArrayBuffer>;
1707
+
1708
+ /**
1709
+ * Generate a new cryptographic key or key pair.
1710
+ *
1711
+ * @param algorithm - Key generation algorithm
1712
+ * @param extractable - Whether the key can be exported
1713
+ * @param keyUsages - Allowed key usages
1714
+ * @returns Promise resolving to a CryptoKey or CryptoKeyPair
1715
+ */
1716
+ generateKey(
1717
+ algorithm: RsaHashedKeyGenParams | EcKeyGenParams | AesKeyGenParams | HmacKeyGenParams,
1718
+ extractable: boolean,
1719
+ keyUsages: KeyUsage[]
1720
+ ): Promise<CryptoKey | CryptoKeyPair>;
1721
+
1722
+ /**
1723
+ * Sign data using a private key.
1724
+ *
1725
+ * @param algorithm - Signing algorithm
1726
+ * @param key - Private key to sign with
1727
+ * @param data - Data to sign
1728
+ * @returns Promise resolving to the signature as ArrayBuffer
1729
+ */
1730
+ sign(
1731
+ algorithm: AlgorithmIdentifier,
1732
+ key: CryptoKey,
1733
+ data: BufferSource
1734
+ ): Promise<ArrayBuffer>;
1735
+
1736
+ /**
1737
+ * Verify a signature.
1738
+ *
1739
+ * @param algorithm - Signing algorithm
1740
+ * @param key - Public key to verify with
1741
+ * @param signature - Signature to verify
1742
+ * @param data - Data that was signed
1743
+ * @returns Promise resolving to true if valid, false otherwise
1744
+ */
1745
+ verify(
1746
+ algorithm: AlgorithmIdentifier,
1747
+ key: CryptoKey,
1748
+ signature: BufferSource,
1749
+ data: BufferSource
1750
+ ): Promise<boolean>;
1751
+
1752
+ /**
1753
+ * Encrypt data.
1754
+ *
1755
+ * @param algorithm - Encryption algorithm
1756
+ * @param key - Encryption key
1757
+ * @param data - Data to encrypt
1758
+ * @returns Promise resolving to encrypted data as ArrayBuffer
1759
+ */
1760
+ encrypt(
1761
+ algorithm: AlgorithmIdentifier,
1762
+ key: CryptoKey,
1763
+ data: BufferSource
1764
+ ): Promise<ArrayBuffer>;
1765
+
1766
+ /**
1767
+ * Decrypt data.
1768
+ *
1769
+ * @param algorithm - Decryption algorithm
1770
+ * @param key - Decryption key
1771
+ * @param data - Data to decrypt
1772
+ * @returns Promise resolving to decrypted data as ArrayBuffer
1773
+ */
1774
+ decrypt(
1775
+ algorithm: AlgorithmIdentifier,
1776
+ key: CryptoKey,
1777
+ data: BufferSource
1778
+ ): Promise<ArrayBuffer>;
1779
+
1780
+ /**
1781
+ * Import a key from external data.
1782
+ *
1783
+ * @param format - Key format ("raw", "pkcs8", "spki", "jwk")
1784
+ * @param keyData - Key data
1785
+ * @param algorithm - Key algorithm
1786
+ * @param extractable - Whether the key can be exported
1787
+ * @param keyUsages - Allowed key usages
1788
+ * @returns Promise resolving to a CryptoKey
1789
+ */
1790
+ importKey(
1791
+ format: "raw" | "pkcs8" | "spki" | "jwk",
1792
+ keyData: BufferSource | JsonWebKey,
1793
+ algorithm: AlgorithmIdentifier,
1794
+ extractable: boolean,
1795
+ keyUsages: KeyUsage[]
1796
+ ): Promise<CryptoKey>;
1797
+
1798
+ /**
1799
+ * Export a key.
1800
+ *
1801
+ * @param format - Export format ("raw", "pkcs8", "spki", "jwk")
1802
+ * @param key - Key to export
1803
+ * @returns Promise resolving to ArrayBuffer or JsonWebKey
1804
+ */
1805
+ exportKey(
1806
+ format: "raw" | "pkcs8" | "spki" | "jwk",
1807
+ key: CryptoKey
1808
+ ): Promise<ArrayBuffer | JsonWebKey>;
1809
+
1810
+ /**
1811
+ * Derive bits from a key.
1812
+ *
1813
+ * @param algorithm - Derivation algorithm
1814
+ * @param baseKey - Base key for derivation
1815
+ * @param length - Number of bits to derive
1816
+ * @returns Promise resolving to derived bits as ArrayBuffer
1817
+ */
1818
+ deriveBits(
1819
+ algorithm: AlgorithmIdentifier,
1820
+ baseKey: CryptoKey,
1821
+ length: number
1822
+ ): Promise<ArrayBuffer>;
1823
+
1824
+ /**
1825
+ * Derive a new key from a base key.
1826
+ *
1827
+ * @param algorithm - Derivation algorithm
1828
+ * @param baseKey - Base key for derivation
1829
+ * @param derivedKeyType - Type of key to derive
1830
+ * @param extractable - Whether the derived key can be exported
1831
+ * @param keyUsages - Allowed usages for derived key
1832
+ * @returns Promise resolving to a CryptoKey
1833
+ */
1834
+ deriveKey(
1835
+ algorithm: AlgorithmIdentifier,
1836
+ baseKey: CryptoKey,
1837
+ derivedKeyType: AlgorithmIdentifier,
1838
+ extractable: boolean,
1839
+ keyUsages: KeyUsage[]
1840
+ ): Promise<CryptoKey>;
1841
+
1842
+ /**
1843
+ * Wrap a key for secure export.
1844
+ *
1845
+ * @param format - Key format
1846
+ * @param key - Key to wrap
1847
+ * @param wrappingKey - Key to wrap with
1848
+ * @param wrapAlgorithm - Wrapping algorithm
1849
+ * @returns Promise resolving to wrapped key as ArrayBuffer
1850
+ */
1851
+ wrapKey(
1852
+ format: "raw" | "pkcs8" | "spki" | "jwk",
1853
+ key: CryptoKey,
1854
+ wrappingKey: CryptoKey,
1855
+ wrapAlgorithm: AlgorithmIdentifier
1856
+ ): Promise<ArrayBuffer>;
1857
+
1858
+ /**
1859
+ * Unwrap a wrapped key.
1860
+ *
1861
+ * @param format - Key format
1862
+ * @param wrappedKey - Wrapped key data
1863
+ * @param unwrappingKey - Key to unwrap with
1864
+ * @param unwrapAlgorithm - Unwrapping algorithm
1865
+ * @param unwrappedKeyAlgorithm - Algorithm for the unwrapped key
1866
+ * @param extractable - Whether the unwrapped key can be exported
1867
+ * @param keyUsages - Allowed usages for unwrapped key
1868
+ * @returns Promise resolving to a CryptoKey
1869
+ */
1870
+ unwrapKey(
1871
+ format: "raw" | "pkcs8" | "spki" | "jwk",
1872
+ wrappedKey: BufferSource,
1873
+ unwrappingKey: CryptoKey,
1874
+ unwrapAlgorithm: AlgorithmIdentifier,
1875
+ unwrappedKeyAlgorithm: AlgorithmIdentifier,
1876
+ extractable: boolean,
1877
+ keyUsages: KeyUsage[]
1878
+ ): Promise<CryptoKey>;
1879
+ }
1880
+
1881
+ /**
1882
+ * Crypto interface providing cryptographic functionality.
1883
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Crypto
1884
+ */
1885
+ interface Crypto {
1886
+ /**
1887
+ * SubtleCrypto interface for cryptographic operations.
1888
+ */
1889
+ readonly subtle: SubtleCrypto;
1890
+
1891
+ /**
1892
+ * Fill a TypedArray with cryptographically random values.
1893
+ *
1894
+ * @param array - TypedArray to fill (max 65536 bytes)
1895
+ * @returns The same array, filled with random values
1896
+ *
1897
+ * @example
1898
+ * const arr = new Uint8Array(16);
1899
+ * crypto.getRandomValues(arr);
1900
+ */
1901
+ getRandomValues<T extends ArrayBufferView | null>(array: T): T;
1902
+
1903
+ /**
1904
+ * Generate a random UUID v4.
1905
+ *
1906
+ * @returns A random UUID string
1907
+ *
1908
+ * @example
1909
+ * const uuid = crypto.randomUUID();
1910
+ * // "550e8400-e29b-41d4-a716-446655440000"
1911
+ */
1912
+ randomUUID(): string;
1913
+ }
1914
+
1915
+ /**
1916
+ * Crypto object providing cryptographic functionality.
1917
+ */
1918
+ const crypto: Crypto;
1919
+ }
1920
+ `;
1921
+ var PATH_TYPES = `/**
1922
+ * Global Type Definitions for ../path/index.ts
1923
+ *
1924
+ * These types define the globals injected by setupPath() into an isolated-vm context.
1925
+ * Use these types to typecheck user code that will run inside the V8 isolate.
1926
+ *
1927
+ * @example
1928
+ * // Typecheck isolate code with path operations
1929
+ * const joined = path.join('/foo', 'bar', 'baz');
1930
+ * const resolved = path.resolve('relative/path');
1931
+ * const cwd = path.cwd();
1932
+ */
1933
+
1934
+ export {};
1935
+
1936
+ declare global {
1937
+ /**
1938
+ * Parsed path object returned by path.parse().
1939
+ */
1940
+ interface ParsedPath {
1941
+ /** The root of the path (e.g., "/" for absolute paths, "" for relative) */
1942
+ root: string;
1943
+ /** The directory portion of the path */
1944
+ dir: string;
1945
+ /** The file name including extension */
1946
+ base: string;
1947
+ /** The file extension (e.g., ".txt") */
1948
+ ext: string;
1949
+ /** The file name without extension */
1950
+ name: string;
1951
+ }
1952
+
1953
+ /**
1954
+ * Input object for path.format().
1955
+ */
1956
+ interface FormatInputPathObject {
1957
+ root?: string;
1958
+ dir?: string;
1959
+ base?: string;
1960
+ ext?: string;
1961
+ name?: string;
1962
+ }
1963
+
1964
+ /**
1965
+ * Path utilities for POSIX paths.
1966
+ * @see https://nodejs.org/api/path.html
1967
+ */
1968
+ namespace path {
1969
+ /**
1970
+ * Join path segments with the platform-specific separator.
1971
+ *
1972
+ * @param paths - Path segments to join
1973
+ * @returns The joined path, normalized
1974
+ *
1975
+ * @example
1976
+ * path.join('/foo', 'bar', 'baz'); // "/foo/bar/baz"
1977
+ * path.join('foo', 'bar', '..', 'baz'); // "foo/baz"
1978
+ */
1979
+ function join(...paths: string[]): string;
1980
+
1981
+ /**
1982
+ * Normalize a path, resolving '..' and '.' segments.
1983
+ *
1984
+ * @param p - The path to normalize
1985
+ * @returns The normalized path
1986
+ *
1987
+ * @example
1988
+ * path.normalize('/foo/bar/../baz'); // "/foo/baz"
1989
+ * path.normalize('/foo//bar'); // "/foo/bar"
1990
+ */
1991
+ function normalize(p: string): string;
1992
+
1993
+ /**
1994
+ * Get the last portion of a path (the file name).
1995
+ *
1996
+ * @param p - The path
1997
+ * @param ext - Optional extension to remove from the result
1998
+ * @returns The base name of the path
1999
+ *
2000
+ * @example
2001
+ * path.basename('/foo/bar/baz.txt'); // "baz.txt"
2002
+ * path.basename('/foo/bar/baz.txt', '.txt'); // "baz"
2003
+ */
2004
+ function basename(p: string, ext?: string): string;
2005
+
2006
+ /**
2007
+ * Get the directory name of a path.
2008
+ *
2009
+ * @param p - The path
2010
+ * @returns The directory portion of the path
2011
+ *
2012
+ * @example
2013
+ * path.dirname('/foo/bar/baz.txt'); // "/foo/bar"
2014
+ * path.dirname('/foo'); // "/"
2015
+ */
2016
+ function dirname(p: string): string;
2017
+
2018
+ /**
2019
+ * Get the extension of a path.
2020
+ *
2021
+ * @param p - The path
2022
+ * @returns The extension including the dot, or empty string
2023
+ *
2024
+ * @example
2025
+ * path.extname('file.txt'); // ".txt"
2026
+ * path.extname('file.tar.gz'); // ".gz"
2027
+ * path.extname('.bashrc'); // ""
2028
+ */
2029
+ function extname(p: string): string;
2030
+
2031
+ /**
2032
+ * Check if a path is absolute.
2033
+ *
2034
+ * @param p - The path to check
2035
+ * @returns True if the path is absolute
2036
+ *
2037
+ * @example
2038
+ * path.isAbsolute('/foo/bar'); // true
2039
+ * path.isAbsolute('foo/bar'); // false
2040
+ */
2041
+ function isAbsolute(p: string): boolean;
2042
+
2043
+ /**
2044
+ * Parse a path into its components.
2045
+ *
2046
+ * @param p - The path to parse
2047
+ * @returns An object with root, dir, base, ext, and name properties
2048
+ *
2049
+ * @example
2050
+ * path.parse('/foo/bar/baz.txt');
2051
+ * // { root: "/", dir: "/foo/bar", base: "baz.txt", ext: ".txt", name: "baz" }
2052
+ */
2053
+ function parse(p: string): ParsedPath;
2054
+
2055
+ /**
2056
+ * Build a path from an object.
2057
+ *
2058
+ * @param pathObject - Object with path components
2059
+ * @returns The formatted path string
2060
+ *
2061
+ * @example
2062
+ * path.format({ dir: '/foo/bar', base: 'baz.txt' }); // "/foo/bar/baz.txt"
2063
+ * path.format({ root: '/', name: 'file', ext: '.txt' }); // "/file.txt"
2064
+ */
2065
+ function format(pathObject: FormatInputPathObject): string;
2066
+
2067
+ /**
2068
+ * Resolve a sequence of paths to an absolute path.
2069
+ * Processes paths from right to left, prepending each until an absolute path is formed.
2070
+ * Uses the configured working directory for relative paths.
2071
+ *
2072
+ * @param paths - Path segments to resolve
2073
+ * @returns The resolved absolute path
2074
+ *
2075
+ * @example
2076
+ * // With cwd set to "/home/user"
2077
+ * path.resolve('foo/bar'); // "/home/user/foo/bar"
2078
+ * path.resolve('/foo', 'bar'); // "/foo/bar"
2079
+ * path.resolve('/foo', '/bar', 'baz'); // "/bar/baz"
2080
+ */
2081
+ function resolve(...paths: string[]): string;
2082
+
2083
+ /**
2084
+ * Compute the relative path from one path to another.
2085
+ *
2086
+ * @param from - The source path
2087
+ * @param to - The destination path
2088
+ * @returns The relative path from 'from' to 'to'
2089
+ *
2090
+ * @example
2091
+ * path.relative('/foo/bar', '/foo/baz'); // "../baz"
2092
+ * path.relative('/foo', '/foo/bar/baz'); // "bar/baz"
2093
+ */
2094
+ function relative(from: string, to: string): string;
2095
+
2096
+ /**
2097
+ * Get the configured working directory.
2098
+ *
2099
+ * @returns The current working directory
2100
+ *
2101
+ * @example
2102
+ * path.cwd(); // "/home/user" (or whatever was configured)
2103
+ */
2104
+ function cwd(): string;
2105
+
2106
+ /**
2107
+ * The platform-specific path segment separator.
2108
+ * Always "/" for POSIX paths.
2109
+ */
2110
+ const sep: string;
2111
+
2112
+ /**
2113
+ * The platform-specific path delimiter.
2114
+ * Always ":" for POSIX paths.
2115
+ */
2116
+ const delimiter: string;
2117
+ }
2118
+ }
2119
+ `;
2120
+ var TIMERS_TYPES = `/**
2121
+ * Global Type Definitions for ../timers/index.ts
2122
+ *
2123
+ * These types define the globals injected by setupTimers() into an isolated-vm context.
2124
+ * Use these types to typecheck user code that will run inside the V8 isolate.
2125
+ *
2126
+ * @example
2127
+ * const timeoutId = setTimeout(() => {
2128
+ * console.log("fired!");
2129
+ * }, 1000);
2130
+ *
2131
+ * clearTimeout(timeoutId);
2132
+ *
2133
+ * const intervalId = setInterval(() => {
2134
+ * console.log("tick");
2135
+ * }, 100);
2136
+ *
2137
+ * clearInterval(intervalId);
2138
+ */
2139
+
2140
+ export {};
2141
+
2142
+ declare global {
2143
+ /**
2144
+ * Schedule a callback to execute after a delay.
2145
+ *
2146
+ * @param callback - The function to call after the delay
2147
+ * @param ms - The delay in milliseconds (default: 0)
2148
+ * @param args - Additional arguments to pass to the callback
2149
+ * @returns A timer ID that can be passed to clearTimeout
2150
+ *
2151
+ * @example
2152
+ * const id = setTimeout(() => console.log("done"), 1000);
2153
+ * setTimeout((a, b) => console.log(a, b), 100, "hello", "world");
2154
+ */
2155
+ function setTimeout(
2156
+ callback: (...args: unknown[]) => void,
2157
+ ms?: number,
2158
+ ...args: unknown[]
2159
+ ): number;
2160
+
2161
+ /**
2162
+ * Schedule a callback to execute repeatedly at a fixed interval.
2163
+ *
2164
+ * @param callback - The function to call at each interval
2165
+ * @param ms - The interval in milliseconds (minimum: 4ms)
2166
+ * @param args - Additional arguments to pass to the callback
2167
+ * @returns A timer ID that can be passed to clearInterval
2168
+ *
2169
+ * @example
2170
+ * const id = setInterval(() => console.log("tick"), 1000);
2171
+ */
2172
+ function setInterval(
2173
+ callback: (...args: unknown[]) => void,
2174
+ ms?: number,
2175
+ ...args: unknown[]
2176
+ ): number;
2177
+
2178
+ /**
2179
+ * Cancel a timeout previously scheduled with setTimeout.
2180
+ *
2181
+ * @param id - The timer ID returned by setTimeout
2182
+ *
2183
+ * @example
2184
+ * const id = setTimeout(() => {}, 1000);
2185
+ * clearTimeout(id);
2186
+ */
2187
+ function clearTimeout(id: number | undefined): void;
2188
+
2189
+ /**
2190
+ * Cancel an interval previously scheduled with setInterval.
2191
+ *
2192
+ * @param id - The timer ID returned by setInterval
2193
+ *
2194
+ * @example
2195
+ * const id = setInterval(() => {}, 1000);
2196
+ * clearInterval(id);
2197
+ */
2198
+ function clearInterval(id: number | undefined): void;
2199
+ }
2200
+ `;
2201
+ var PLAYWRIGHT_TYPES = `
2202
+ /**
2203
+ * Locator represents an element or group of elements in the page.
2204
+ */
2205
+ declare class Locator {
2206
+ /** Click the element */
2207
+ click(): Promise<void>;
2208
+ /** Double-click the element */
2209
+ dblclick(): Promise<void>;
2210
+ /** Fill an input element with text */
2211
+ fill(text: string): Promise<void>;
2212
+ /** Type text into an element (key by key) */
2213
+ type(text: string): Promise<void>;
2214
+ /** Check a checkbox or radio */
2215
+ check(): Promise<void>;
2216
+ /** Uncheck a checkbox */
2217
+ uncheck(): Promise<void>;
2218
+ /** Select an option in a dropdown */
2219
+ selectOption(value: string | string[]): Promise<void>;
2220
+ /** Clear an input element */
2221
+ clear(): Promise<void>;
2222
+ /** Press a key */
2223
+ press(key: string): Promise<void>;
2224
+ /** Hover over the element */
2225
+ hover(): Promise<void>;
2226
+ /** Focus the element */
2227
+ focus(): Promise<void>;
2228
+ /** Get text content of the element */
2229
+ textContent(): Promise<string | null>;
2230
+ /** Get the value of an input element */
2231
+ inputValue(): Promise<string>;
2232
+ /** Check if the element is visible */
2233
+ isVisible(): Promise<boolean>;
2234
+ /** Check if the element is enabled */
2235
+ isEnabled(): Promise<boolean>;
2236
+ /** Check if the element is checked */
2237
+ isChecked(): Promise<boolean>;
2238
+ /** Check if the element is disabled */
2239
+ isDisabled(): Promise<boolean>;
2240
+ /** Check if the element is hidden */
2241
+ isHidden(): Promise<boolean>;
2242
+ /** Get the count of matching elements */
2243
+ count(): Promise<number>;
2244
+ /** Get an attribute value */
2245
+ getAttribute(name: string): Promise<string | null>;
2246
+ /** Get innerHTML */
2247
+ innerHTML(): Promise<string>;
2248
+ /** Get innerText */
2249
+ innerText(): Promise<string>;
2250
+ /** Get all text contents */
2251
+ allTextContents(): Promise<string[]>;
2252
+ /** Get all inner texts */
2253
+ allInnerTexts(): Promise<string[]>;
2254
+ /** Wait for the element to match a state */
2255
+ waitFor(options?: { state?: "attached" | "detached" | "visible" | "hidden"; timeout?: number }): Promise<void>;
2256
+ /** Get bounding box */
2257
+ boundingBox(): Promise<{ x: number; y: number; width: number; height: number } | null>;
2258
+ /** Set input files for a file input */
2259
+ setInputFiles(files: string | string[] | { name: string; mimeType: string; buffer: ArrayBuffer | Uint8Array | string }[]): Promise<void>;
2260
+ /** Take a screenshot of the element */
2261
+ screenshot(options?: { path?: string; type?: "png" | "jpeg"; quality?: number }): Promise<string>;
2262
+ /** Drag to another element */
2263
+ dragTo(target: Locator): Promise<void>;
2264
+ /** Scroll element into view */
2265
+ scrollIntoViewIfNeeded(): Promise<void>;
2266
+ /** Highlight the element for debugging */
2267
+ highlight(): Promise<void>;
2268
+ /** Evaluate a function in the context of the element */
2269
+ evaluate<R>(fn: (el: Element, arg?: unknown) => R, arg?: unknown): Promise<R>;
2270
+ /** Evaluate a function for all matching elements */
2271
+ evaluateAll<R>(fn: (els: Element[], arg?: unknown) => R, arg?: unknown): Promise<R>;
2272
+
2273
+ // Chaining methods
2274
+ /** Chain with another CSS selector */
2275
+ locator(selector: string): Locator;
2276
+ /** Chain with getByRole */
2277
+ getByRole(role: string, options?: { name?: string | RegExp; exact?: boolean }): Locator;
2278
+ /** Chain with getByText */
2279
+ getByText(text: string | RegExp): Locator;
2280
+ /** Chain with getByLabel */
2281
+ getByLabel(label: string | RegExp): Locator;
2282
+ /** Chain with getByPlaceholder */
2283
+ getByPlaceholder(placeholder: string | RegExp): Locator;
2284
+ /** Chain with getByTestId */
2285
+ getByTestId(testId: string): Locator;
2286
+ /** Chain with getByAltText */
2287
+ getByAltText(alt: string | RegExp): Locator;
2288
+ /** Chain with getByTitle */
2289
+ getByTitle(title: string | RegExp): Locator;
2290
+
2291
+ // Subset selection
2292
+ /** Get all matching locators as an array */
2293
+ all(): Promise<Locator[]>;
2294
+ /** Get the nth matching element */
2295
+ nth(index: number): Locator;
2296
+ /** Get the first matching element */
2297
+ first(): Locator;
2298
+ /** Get the last matching element */
2299
+ last(): Locator;
2300
+
2301
+ // Filtering
2302
+ /** Filter locators by additional criteria */
2303
+ filter(options: { hasText?: string | RegExp; hasNotText?: string | RegExp; has?: Locator; hasNot?: Locator }): Locator;
2304
+ /** Create a locator matching either this or the other locator */
2305
+ or(other: Locator): Locator;
2306
+ /** Create a locator matching both this and the other locator */
2307
+ and(other: Locator): Locator;
2308
+ }
2309
+
2310
+ /**
2311
+ * FrameLocator for interacting with elements inside iframes.
2312
+ */
2313
+ interface FrameLocator {
2314
+ locator(selector: string): Locator;
2315
+ getByRole(role: string, options?: { name?: string | RegExp; exact?: boolean }): Locator;
2316
+ getByText(text: string | RegExp): Locator;
2317
+ getByLabel(label: string | RegExp): Locator;
2318
+ getByPlaceholder(placeholder: string | RegExp): Locator;
2319
+ getByTestId(testId: string): Locator;
2320
+ getByAltText(alt: string | RegExp): Locator;
2321
+ getByTitle(title: string | RegExp): Locator;
2322
+ }
2323
+
2324
+ /**
2325
+ * Keyboard API for simulating keyboard input.
2326
+ */
2327
+ interface Keyboard {
2328
+ type(text: string, options?: { delay?: number }): Promise<void>;
2329
+ press(key: string, options?: { delay?: number }): Promise<void>;
2330
+ down(key: string): Promise<void>;
2331
+ up(key: string): Promise<void>;
2332
+ insertText(text: string): Promise<void>;
2333
+ }
2334
+
2335
+ /**
2336
+ * Mouse API for simulating mouse input.
2337
+ */
2338
+ interface Mouse {
2339
+ move(x: number, y: number, options?: { steps?: number }): Promise<void>;
2340
+ click(x: number, y: number, options?: { button?: "left" | "right" | "middle"; clickCount?: number; delay?: number }): Promise<void>;
2341
+ down(options?: { button?: "left" | "right" | "middle"; clickCount?: number }): Promise<void>;
2342
+ up(options?: { button?: "left" | "right" | "middle"; clickCount?: number }): Promise<void>;
2343
+ wheel(deltaX: number, deltaY: number): Promise<void>;
2344
+ }
2345
+
2346
+ /**
2347
+ * API Response from page.request methods.
2348
+ */
2349
+ interface APIResponse {
2350
+ status(): number;
2351
+ ok(): boolean;
2352
+ headers(): Record<string, string>;
2353
+ json(): Promise<unknown>;
2354
+ text(): Promise<string>;
2355
+ body(): Promise<ArrayBuffer>;
2356
+ }
2357
+
2358
+ /**
2359
+ * Request API for making HTTP requests with page cookies.
2360
+ */
2361
+ interface APIRequestContext {
2362
+ fetch(url: string, options?: { method?: string; data?: unknown; headers?: Record<string, string> }): Promise<APIResponse>;
2363
+ get(url: string, options?: { headers?: Record<string, string> }): Promise<APIResponse>;
2364
+ post(url: string, options?: { data?: unknown; headers?: Record<string, string> }): Promise<APIResponse>;
2365
+ put(url: string, options?: { data?: unknown; headers?: Record<string, string> }): Promise<APIResponse>;
2366
+ delete(url: string, options?: { headers?: Record<string, string> }): Promise<APIResponse>;
2367
+ }
2368
+
2369
+ /**
2370
+ * Frame information.
2371
+ */
2372
+ interface FrameInfo {
2373
+ name: string;
2374
+ url: string;
2375
+ }
2376
+
2377
+ /**
2378
+ * Cookie data.
2379
+ */
2380
+ interface Cookie {
2381
+ name: string;
2382
+ value: string;
2383
+ domain?: string;
2384
+ path?: string;
2385
+ expires?: number;
2386
+ httpOnly?: boolean;
2387
+ secure?: boolean;
2388
+ sameSite?: "Strict" | "Lax" | "None";
2389
+ }
2390
+
2391
+ /**
2392
+ * IsolatePage - represents a browser page in the isolate.
2393
+ */
2394
+ declare class IsolatePage {
2395
+ /** Navigate to a URL */
2396
+ goto(url: string, options?: { waitUntil?: "load" | "domcontentloaded" | "networkidle" }): Promise<void>;
2397
+ /** Reload the page */
2398
+ reload(): Promise<void>;
2399
+ /** Get the current URL */
2400
+ url(): Promise<string>;
2401
+ /** Get the page title */
2402
+ title(): Promise<string>;
2403
+ /** Get the page HTML content */
2404
+ content(): Promise<string>;
2405
+ /** Wait for a selector to appear */
2406
+ waitForSelector(selector: string, options?: { state?: "attached" | "detached" | "visible" | "hidden"; timeout?: number }): Promise<void>;
2407
+ /** Wait for a specified time */
2408
+ waitForTimeout(ms: number): Promise<void>;
2409
+ /** Wait for a load state */
2410
+ waitForLoadState(state?: "load" | "domcontentloaded" | "networkidle"): Promise<void>;
2411
+ /** Wait for the URL to match */
2412
+ waitForURL(url: string | RegExp, options?: { timeout?: number; waitUntil?: "load" | "domcontentloaded" | "networkidle" }): Promise<void>;
2413
+ /** Evaluate JavaScript in the browser context */
2414
+ evaluate<R>(script: string | (() => R) | ((arg: unknown) => R), arg?: unknown): Promise<R>;
2415
+ /** Create a locator by CSS selector */
2416
+ locator(selector: string): Locator;
2417
+ /** Create a locator by ARIA role */
2418
+ getByRole(role: string, options?: { name?: string | RegExp; exact?: boolean }): Locator;
2419
+ /** Create a locator by text content */
2420
+ getByText(text: string | RegExp): Locator;
2421
+ /** Create a locator by label */
2422
+ getByLabel(label: string | RegExp): Locator;
2423
+ /** Create a locator by placeholder */
2424
+ getByPlaceholder(placeholder: string | RegExp): Locator;
2425
+ /** Create a locator by test ID */
2426
+ getByTestId(testId: string): Locator;
2427
+ /** Create a locator by alt text */
2428
+ getByAltText(alt: string | RegExp): Locator;
2429
+ /** Create a locator by title */
2430
+ getByTitle(title: string | RegExp): Locator;
2431
+ /** Create a frame locator */
2432
+ frameLocator(selector: string): FrameLocator;
2433
+ /** Navigate back */
2434
+ goBack(options?: { waitUntil?: "load" | "domcontentloaded" | "networkidle" }): Promise<void>;
2435
+ /** Navigate forward */
2436
+ goForward(options?: { waitUntil?: "load" | "domcontentloaded" | "networkidle" }): Promise<void>;
2437
+ /** Click an element (shorthand) */
2438
+ click(selector: string): Promise<void>;
2439
+ /** Fill an input (shorthand) */
2440
+ fill(selector: string, value: string): Promise<void>;
2441
+ /** Take a screenshot */
2442
+ screenshot(options?: { path?: string; fullPage?: boolean; type?: "png" | "jpeg"; quality?: number }): Promise<string>;
2443
+ /** Generate a PDF (Chromium only) */
2444
+ pdf(options?: { path?: string; format?: string; landscape?: boolean; margin?: { top?: string; bottom?: string; left?: string; right?: string } }): Promise<string>;
2445
+ /** Set the viewport size */
2446
+ setViewportSize(size: { width: number; height: number }): Promise<void>;
2447
+ /** Get the viewport size */
2448
+ viewportSize(): Promise<{ width: number; height: number } | null>;
2449
+ /** Emulate media type or color scheme */
2450
+ emulateMedia(options: { media?: "screen" | "print" | null; colorScheme?: "light" | "dark" | "no-preference" | null }): Promise<void>;
2451
+ /** Set extra HTTP headers */
2452
+ setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
2453
+ /** Bring the page to front */
2454
+ bringToFront(): Promise<void>;
2455
+ /** Close the page */
2456
+ close(): Promise<void>;
2457
+ /** Check if the page is closed */
2458
+ isClosed(): Promise<boolean>;
2459
+ /** Pause execution (for debugging) */
2460
+ pause(): Promise<void>;
2461
+ /** Get all frames */
2462
+ frames(): Promise<FrameInfo[]>;
2463
+ /** Get the main frame */
2464
+ mainFrame(): Promise<FrameInfo>;
2465
+ /** Get the browser context for this page */
2466
+ context(): IsolateContext;
2467
+ /** Keyboard API */
2468
+ readonly keyboard: Keyboard;
2469
+ /** Mouse API */
2470
+ readonly mouse: Mouse;
2471
+ /** Request API for making HTTP requests */
2472
+ readonly request: APIRequestContext;
2473
+ }
2474
+
2475
+ /**
2476
+ * IsolateContext - represents a browser context in the isolate.
2477
+ */
2478
+ declare class IsolateContext {
2479
+ /** Create a new page in this context (requires createPage callback) */
2480
+ newPage(): Promise<IsolatePage>;
2481
+ /** Close this context and all its pages */
2482
+ close(): Promise<void>;
2483
+ /** Clear all cookies */
2484
+ clearCookies(): Promise<void>;
2485
+ /** Add cookies */
2486
+ addCookies(cookies: Cookie[]): Promise<void>;
2487
+ /** Get cookies */
2488
+ cookies(urls?: string | string[]): Promise<Cookie[]>;
2489
+ }
2490
+
2491
+ /**
2492
+ * Browser object for creating new contexts.
2493
+ */
2494
+ interface IsolateBrowser {
2495
+ /** Create a new browser context (requires createContext callback) */
2496
+ newContext(options?: {
2497
+ viewport?: { width: number; height: number } | null;
2498
+ userAgent?: string;
2499
+ locale?: string;
2500
+ timezoneId?: string;
2501
+ geolocation?: { latitude: number; longitude: number; accuracy?: number };
2502
+ permissions?: string[];
2503
+ colorScheme?: "light" | "dark" | "no-preference";
2504
+ }): Promise<IsolateContext>;
2505
+ }
2506
+
2507
+ /**
2508
+ * The default page object.
2509
+ */
2510
+ declare const page: IsolatePage;
2511
+
2512
+ /**
2513
+ * The default browser context.
2514
+ */
2515
+ declare const context: IsolateContext;
2516
+
2517
+ /**
2518
+ * Browser object for creating new contexts.
2519
+ */
2520
+ declare const browser: IsolateBrowser;
2521
+
2522
+ // ============================================================================
2523
+ // Playwright Expect Matchers (extends test-environment expect)
2524
+ // ============================================================================
2525
+
2526
+ /**
2527
+ * Options for locator assertion timeouts.
2528
+ */
2529
+ interface LocatorAssertionOptions {
2530
+ timeout?: number;
2531
+ }
2532
+
2533
+ /**
2534
+ * Locator-specific assertion matchers (added to expect when using Playwright).
2535
+ * These are available when calling expect(locator).
2536
+ */
2537
+ interface PlaywrightLocatorMatchers {
2538
+ /** Assert element is visible */
2539
+ toBeVisible(options?: LocatorAssertionOptions): Promise<void>;
2540
+ /** Assert element is hidden */
2541
+ toBeHidden(options?: LocatorAssertionOptions): Promise<void>;
2542
+ /** Assert element is enabled */
2543
+ toBeEnabled(options?: LocatorAssertionOptions): Promise<void>;
2544
+ /** Assert element is disabled */
2545
+ toBeDisabled(options?: LocatorAssertionOptions): Promise<void>;
2546
+ /** Assert element is checked */
2547
+ toBeChecked(options?: LocatorAssertionOptions): Promise<void>;
2548
+ /** Assert element is focused */
2549
+ toBeFocused(options?: LocatorAssertionOptions): Promise<void>;
2550
+ /** Assert element is empty */
2551
+ toBeEmpty(options?: LocatorAssertionOptions): Promise<void>;
2552
+ /** Assert element is attached to DOM */
2553
+ toBeAttached(options?: LocatorAssertionOptions): Promise<void>;
2554
+ /** Assert element is editable */
2555
+ toBeEditable(options?: LocatorAssertionOptions): Promise<void>;
2556
+ /** Assert element is in viewport */
2557
+ toBeInViewport(options?: LocatorAssertionOptions): Promise<void>;
2558
+ /** Assert element contains text */
2559
+ toContainText(expected: string | RegExp, options?: LocatorAssertionOptions): Promise<void>;
2560
+ /** Assert element has exact text */
2561
+ toHaveText(expected: string | RegExp, options?: LocatorAssertionOptions): Promise<void>;
2562
+ /** Assert element has value (for inputs) */
2563
+ toHaveValue(expected: string, options?: LocatorAssertionOptions): Promise<void>;
2564
+ /** Assert element has attribute */
2565
+ toHaveAttribute(name: string, value?: string | RegExp, options?: LocatorAssertionOptions): Promise<void>;
2566
+ /** Assert element count */
2567
+ toHaveCount(count: number, options?: LocatorAssertionOptions): Promise<void>;
2568
+ /** Assert element has class */
2569
+ toHaveClass(expected: string | RegExp, options?: LocatorAssertionOptions): Promise<void>;
2570
+ /** Assert element contains class */
2571
+ toContainClass(expected: string, options?: LocatorAssertionOptions): Promise<void>;
2572
+ /** Assert element has id */
2573
+ toHaveId(expected: string, options?: LocatorAssertionOptions): Promise<void>;
2574
+ /** Assert element has CSS property */
2575
+ toHaveCSS(name: string, value: string | RegExp, options?: LocatorAssertionOptions): Promise<void>;
2576
+ /** Assert element has JavaScript property */
2577
+ toHaveJSProperty(name: string, value: unknown, options?: LocatorAssertionOptions): Promise<void>;
2578
+ /** Assert element has accessible name */
2579
+ toHaveAccessibleName(expected: string | RegExp, options?: LocatorAssertionOptions): Promise<void>;
2580
+ /** Assert element has accessible description */
2581
+ toHaveAccessibleDescription(expected: string | RegExp, options?: LocatorAssertionOptions): Promise<void>;
2582
+ /** Assert element has ARIA role */
2583
+ toHaveRole(expected: string, options?: LocatorAssertionOptions): Promise<void>;
2584
+ /** Negated matchers */
2585
+ not: PlaywrightLocatorMatchers;
2586
+ }
2587
+
2588
+ /**
2589
+ * Page-specific assertion matchers (added to expect when using Playwright).
2590
+ * These are available when calling expect(page).
2591
+ */
2592
+ interface PlaywrightPageMatchers {
2593
+ /** Assert page has URL */
2594
+ toHaveURL(expected: string | RegExp, options?: LocatorAssertionOptions): Promise<void>;
2595
+ /** Assert page has title */
2596
+ toHaveTitle(expected: string | RegExp, options?: LocatorAssertionOptions): Promise<void>;
2597
+ /** Negated matchers */
2598
+ not: PlaywrightPageMatchers;
2599
+ }
2600
+ `;
2601
+ var TYPE_DEFINITIONS = {
2602
+ core: CORE_TYPES,
2603
+ console: CONSOLE_TYPES,
2604
+ crypto: CRYPTO_TYPES,
2605
+ encoding: ENCODING_TYPES,
2606
+ fetch: FETCH_TYPES,
2607
+ fs: FS_TYPES,
2608
+ path: PATH_TYPES,
2609
+ testEnvironment: TEST_ENV_TYPES,
2610
+ timers: TIMERS_TYPES,
2611
+ playwright: PLAYWRIGHT_TYPES
2612
+ };
2613
+
2614
+ //# debugId=40102DE3B6889F0C64756E2164756E21