@ricsam/isolate-runtime 0.1.9 → 0.1.11

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.
@@ -1,50 +1,22 @@
1
1
  import type { DispatchRequestOptions, UpgradeRequest, WebSocketCommand } from "@ricsam/isolate-fetch";
2
2
  import type { FsOptions } from "@ricsam/isolate-fs";
3
- import type { RunResults, TestEnvironmentOptions } from "@ricsam/isolate-test-environment";
4
- import type { NetworkRequestInfo, NetworkResponseInfo, BrowserConsoleLogEntry, PlaywrightEvent } from "@ricsam/isolate-playwright";
5
- import type { ConsoleCallbacks, FetchCallback, ModuleLoaderCallback, CustomFunctions } from "@ricsam/isolate-protocol";
3
+ import type { RunResults } from "@ricsam/isolate-test-environment";
4
+ import type { NetworkRequestInfo, NetworkResponseInfo, BrowserConsoleLogEntry } from "@ricsam/isolate-playwright";
5
+ import type { EvalOptions as ProtocolEvalOptions, PlaywrightOptions as ProtocolPlaywrightOptions, BaseRuntimeOptions } from "@ricsam/isolate-protocol";
6
6
  export type { ConsoleCallbacks, ConsoleEntry, FetchCallback, ModuleLoaderCallback, CustomFunction, CustomFunctionDefinition, CustomFunctions, DispatchOptions, } from "@ricsam/isolate-protocol";
7
+ export type EvalOptions = ProtocolEvalOptions;
8
+ export type PlaywrightOptions = ProtocolPlaywrightOptions;
7
9
  /**
8
10
  * Options for creating a runtime.
11
+ * Extends BaseRuntimeOptions and adds runtime-specific fs type.
9
12
  */
10
- export interface RuntimeOptions {
11
- /** Memory limit in megabytes (optional) */
12
- memoryLimitMB?: number;
13
- /** Console callback handlers */
14
- console?: ConsoleCallbacks;
15
- /** Fetch callback handler */
16
- fetch?: FetchCallback;
13
+ export interface RuntimeOptions<T extends Record<string, any[]> = Record<string, unknown[]>> extends BaseRuntimeOptions<T> {
17
14
  /**
18
15
  * File system options.
19
16
  * Note: For local runtime, this uses FsOptions with getDirectory returning a FileSystemHandler.
20
17
  * For remote runtime (isolate-client), use FileSystemCallbacks instead.
21
18
  */
22
19
  fs?: FsOptions;
23
- /** Module loader callback for resolving dynamic imports */
24
- moduleLoader?: ModuleLoaderCallback;
25
- /** Custom functions callable from within the isolate */
26
- customFunctions?: CustomFunctions;
27
- /** Current working directory for path.resolve(). Defaults to "/" */
28
- cwd?: string;
29
- /** Enable test environment (describe, it, expect, etc.) */
30
- testEnvironment?: boolean | TestEnvironmentOptions;
31
- /** Playwright options - user provides page object */
32
- playwright?: PlaywrightOptions;
33
- }
34
- /**
35
- * Options for playwright in local runtime.
36
- */
37
- export interface PlaywrightOptions {
38
- /** Playwright Page object - user launches browser and creates page */
39
- page: import("playwright").Page;
40
- /** Default timeout for operations (default: 30000ms) */
41
- timeout?: number;
42
- /** Base URL for relative navigation */
43
- baseUrl?: string;
44
- /** If true, browser console logs are routed through console handler (or printed to stdout if no handler) */
45
- console?: boolean;
46
- /** Unified event callback for all playwright events */
47
- onEvent?: (event: PlaywrightEvent) => void;
48
20
  }
49
21
  /**
50
22
  * Runtime fetch handle - provides access to fetch/serve operations.
@@ -121,15 +93,6 @@ export interface CollectedData {
121
93
  networkRequests: NetworkRequestInfo[];
122
94
  networkResponses: NetworkResponseInfo[];
123
95
  }
124
- /**
125
- * Options for eval() method.
126
- */
127
- export interface EvalOptions {
128
- /** Filename for stack traces */
129
- filename?: string;
130
- /** Maximum execution time in milliseconds. If exceeded, throws a timeout error. */
131
- maxExecutionMs?: number;
132
- }
133
96
  /**
134
97
  * Runtime handle - the main interface for interacting with the isolate.
135
98
  */
@@ -169,7 +132,7 @@ export interface RuntimeHandle {
169
132
  *
170
133
  * await runtime.dispose();
171
134
  */
172
- export declare function createRuntime(options?: RuntimeOptions): Promise<RuntimeHandle>;
135
+ export declare function createRuntime<T extends Record<string, any[]> = Record<string, unknown[]>>(options?: RuntimeOptions<T>): Promise<RuntimeHandle>;
173
136
  export { setupCore } from "@ricsam/isolate-core";
174
137
  export type { CoreHandle, SetupCoreOptions } from "@ricsam/isolate-core";
175
138
  export { setupConsole } from "@ricsam/isolate-console";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/isolate-runtime",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "main": "./dist/cjs/index.cjs",
5
5
  "types": "./dist/types/index.d.ts",
6
6
  "exports": {