@volter/tabnode 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/__sw__.js +259 -5
  2. package/dist/assets/{runtime-worker-DoV8lqBn.js → runtime-worker-B9buriZs.js} +4021 -2961
  3. package/dist/fetch-transport.d.ts +20 -0
  4. package/dist/guest-timers.d.ts +15 -0
  5. package/dist/http-client-transport.d.ts +19 -0
  6. package/dist/index.d.ts +11 -0
  7. package/dist/index.mjs +5204 -3057
  8. package/dist/native-stream-binding.d.ts +57 -0
  9. package/dist/native-stream-owner.d.ts +121 -0
  10. package/dist/node-lib/binding/duplex_stream.d.ts +26 -0
  11. package/dist/node-lib/binding/fds.d.ts +8 -0
  12. package/dist/node-lib/binding/fs.d.ts +311 -78
  13. package/dist/node-lib/binding/misc.d.ts +1 -0
  14. package/dist/node-lib/binding/pipe_wrap.d.ts +4 -4
  15. package/dist/node-lib/binding/process_wrap.d.ts +13 -2
  16. package/dist/node-lib/binding/stream_wrap.d.ts +27 -18
  17. package/dist/node-lib/binding/tcp_wrap.d.ts +0 -1
  18. package/dist/node-lib/binding/tty_wrap.d.ts +43 -2
  19. package/dist/node-lib/binding/util.d.ts +83 -0
  20. package/dist/node-lib/binding/uv.d.ts +4 -0
  21. package/dist/node-lib/fs-module.d.ts +1 -0
  22. package/dist/node-lib/internals/buffer-and-streams.d.ts +30 -17
  23. package/dist/node-lib/internals/index.d.ts +1 -1
  24. package/dist/node-lib/load.d.ts +17 -3
  25. package/dist/node-lib/module-hooks.d.ts +1 -0
  26. package/dist/node-lib/public-modules.d.ts +1 -1
  27. package/dist/node-lib/timers.d.ts +38 -0
  28. package/dist/node-process-host.d.ts +41 -0
  29. package/dist/process-registry.d.ts +39 -0
  30. package/dist/process-tokens.d.ts +16 -0
  31. package/dist/promise-ownership.d.ts +3 -0
  32. package/dist/runtime.d.ts +10 -9
  33. package/dist/shims/child_process.d.ts +2 -0
  34. package/dist/shims/crypto.d.ts +660 -119
  35. package/dist/shims/dns.d.ts +76 -2
  36. package/dist/shims/process.d.ts +1 -0
  37. package/dist/shims/string_decoder.d.ts +19 -3
  38. package/dist/shims/tls.d.ts +853 -31
  39. package/dist/source-edits.d.ts +7 -0
  40. package/package.json +1 -1
  41. package/src/code-transforms.ts +2 -3
  42. package/src/fetch-transport.ts +98 -0
  43. package/src/guest-timers.ts +89 -0
  44. package/src/http-client-transport.ts +169 -0
  45. package/src/index.ts +12 -0
  46. package/src/native-stream-binding.ts +393 -0
  47. package/src/native-stream-owner.ts +317 -0
  48. package/src/node-lib/binding/duplex_stream.ts +95 -0
  49. package/src/node-lib/binding/fds.ts +18 -1
  50. package/src/node-lib/binding/fs.ts +45 -17
  51. package/src/node-lib/binding/misc.ts +2 -0
  52. package/src/node-lib/binding/pipe_wrap.ts +35 -12
  53. package/src/node-lib/binding/process_wrap.ts +72 -18
  54. package/src/node-lib/binding/stream_wrap.ts +196 -72
  55. package/src/node-lib/binding/tcp_wrap.ts +43 -8
  56. package/src/node-lib/binding/tty_wrap.ts +135 -8
  57. package/src/node-lib/binding/util.ts +24 -15
  58. package/src/node-lib/binding/uv.ts +4 -0
  59. package/src/node-lib/fs-module.ts +2 -18
  60. package/src/node-lib/internal/navigator.js +149 -0
  61. package/src/node-lib/internals/buffer-and-streams.ts +50 -11
  62. package/src/node-lib/internals/events-util.ts +5 -0
  63. package/src/node-lib/internals/index.ts +12 -2
  64. package/src/node-lib/load.ts +170 -62
  65. package/src/node-lib/module-hooks.ts +5 -2
  66. package/src/node-lib/public-modules.ts +12 -48
  67. package/src/node-lib/sources.ts +4 -0
  68. package/src/node-lib/timers.ts +93 -0
  69. package/src/node-process-host.ts +124 -0
  70. package/src/process-registry.ts +144 -0
  71. package/src/process-tokens.ts +60 -6
  72. package/src/promise-ownership.ts +28 -0
  73. package/src/runtime.ts +90 -214
  74. package/src/shims/child_process.ts +313 -80
  75. package/src/shims/crypto.ts +115 -100
  76. package/src/shims/dns.ts +17 -1
  77. package/src/shims/process.ts +33 -11
  78. package/src/shims/string_decoder.ts +10 -6
  79. package/src/shims/tls.ts +49 -19
  80. package/src/source-edits.ts +20 -0
@@ -0,0 +1,20 @@
1
+ /** Host Fetch I/O uses the same process-owned liveness registry as sockets. */
2
+ import type { Process } from './shims/process';
3
+ export interface FetchActivity {
4
+ /** One pending transport operation; the returned release is idempotent. */
5
+ hold(): () => void;
6
+ /** EOF/error/cancellation ends ownership, without cancelling completed I/O. */
7
+ release(): void;
8
+ }
9
+ export interface FetchTransportContext {
10
+ /** Retain cancellation ownership while idle, but do not keep the run alive. */
11
+ begin(cancel: () => void): FetchActivity;
12
+ }
13
+ export type FetchTransport = (input: RequestInfo | URL, init: RequestInit | undefined, context: FetchTransportContext) => Promise<Response>;
14
+ export declare function rememberRequestBodySource(request: Request, input: RequestInfo | URL, init?: RequestInit): void;
15
+ /** Host transport metadata; it carries no network permission. */
16
+ export declare function requestHasStaticBody(request: Request): boolean;
17
+ /** Host-only seam: the adapter reports pending headers/pulls and final cleanup. */
18
+ export declare function installFetchTransport(adapter: FetchTransport): () => void;
19
+ /** Each process may replace its own fetch; the host adapter remains private. */
20
+ export declare function guestFetch(process: Process, fallback: typeof globalThis.fetch): typeof globalThis.fetch;
@@ -0,0 +1,15 @@
1
+ export declare function pendingGuestTimers(process: object): number;
2
+ /**
3
+ * Clear every timer a guest still holds, as ending a Node process clears the
4
+ * ones its loop was waiting on. The ids were made by the host's own
5
+ * `setTimeout`/`setInterval` through the guest's global view, so the host's
6
+ * own clears end them; a `Timeout` is cleared by either in Node, and either
7
+ * refusing an id of the other kind is not an error here.
8
+ */
9
+ export declare function stopGuestTimers(process: object): void;
10
+ export declare function guestTimerFunctions(process: object, host: Record<string, unknown>): {
11
+ setTimeout(fn: (...a: unknown[]) => void, ms?: number, ...rest: unknown[]): unknown;
12
+ setInterval(fn: (...a: unknown[]) => void, ms?: number, ...rest: unknown[]): unknown;
13
+ clearTimeout(id: unknown): void;
14
+ clearInterval(id: unknown): void;
15
+ };
@@ -0,0 +1,19 @@
1
+ export interface HttpClientExchangeRequest {
2
+ url: string;
3
+ method: string;
4
+ headers: Array<[string, string]>;
5
+ body?: ReadableStream<Uint8Array>;
6
+ signal: AbortSignal;
7
+ profile: 'server-http';
8
+ }
9
+ export interface HttpClientExchangeResponse {
10
+ status: number;
11
+ statusText: string;
12
+ headers: Array<[string, string]>;
13
+ body: ReadableStream<Uint8Array> | null;
14
+ }
15
+ export type HttpClientExchange = (request: HttpClientExchangeRequest) => Promise<HttpClientExchangeResponse>;
16
+ /** Capture process attribution synchronously when the connection is requested. */
17
+ export type HttpClientTransportFactory = () => HttpClientExchange;
18
+ /** Host-only installation; guest modules receive Node's normal exports. */
19
+ export declare function installHttpClientTransport(factory: HttpClientTransportFactory): () => void;
package/dist/index.d.ts CHANGED
@@ -20,6 +20,8 @@ export { createProcess } from './shims/process';
20
20
  export type { Process, ProcessEnv } from './shims/process';
21
21
  export * as path from './shims/path';
22
22
  export { httpModule as http, httpsModule as https } from './node-lib/http-module';
23
+ export { installHttpClientTransport } from './http-client-transport';
24
+ export type { HttpClientExchange, HttpClientExchangeRequest, HttpClientExchangeResponse, HttpClientTransportFactory } from './http-client-transport';
23
25
  export { netModule as net } from './node-lib/net-module';
24
26
  export { eventsModule as events } from './node-lib/events-module';
25
27
  export { streamModule as stream } from './node-lib/stream-module';
@@ -44,6 +46,13 @@ import { ServerBridge } from './server-bridge';
44
46
  import { type Socket as NetSocket } from './node-lib/net-module';
45
47
  import { runPid, processByPid } from './process-tokens';
46
48
  export { runPid, processByPid };
49
+ export { createProcessRegistryScope, installProcessRegistry, ownerProcessRegistryScope } from './process-tokens';
50
+ export { installNodeProcessHost, nodeProcessHostInstalled } from './node-process-host';
51
+ export type { NodeProcessLaunch, NodeProcessHost } from './node-process-host';
52
+ export type { ProcessIdentity, ProcessRegistry, ProcessRegistryScope, InitialProcessRegistration } from './process-registry';
53
+ export { NativeStreamScope } from './native-stream-owner';
54
+ export { installNativeStreamTransport, nativeStreamDescriptor } from './native-stream-binding';
55
+ export type { NativeStreamDescriptor, NativeStreamLimits, NativeStreamEvent, NativeStreamOperation, NativeStreamReply, NativeStreamTransport } from './native-stream-owner';
47
56
  export interface RunResult {
48
57
  stdout: string;
49
58
  stderr: string;
@@ -128,5 +137,7 @@ export declare function createContainer(options?: ContainerOptions): {
128
137
  on: (event: string, listener: (...args: unknown[]) => void) => void;
129
138
  };
130
139
  export default createContainer;
140
+ export { installFetchTransport, requestHasStaticBody } from './fetch-transport';
141
+ export type { FetchActivity, FetchTransport, FetchTransportContext } from './fetch-transport';
131
142
  export { createNodeResolver } from './node-resolution';
132
143
  export type { ResolutionFs, ExportsResolver, NodeResolverOptions, NodeResolver } from './node-resolution';