functionalscript 0.23.0 → 0.25.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 (95) hide show
  1. package/fs/asserts/proof.f.d.ts +8 -0
  2. package/fs/asserts/proof.f.js +51 -0
  3. package/fs/bnf/data/proof.f.js +7 -17
  4. package/fs/bnf/module.f.d.ts +10 -0
  5. package/fs/bnf/module.f.js +10 -0
  6. package/fs/bnf/testlib.f.js +4 -9
  7. package/fs/cas/module.f.d.ts +2 -2
  8. package/fs/cas/module.f.js +2 -2
  9. package/fs/cas/proof.f.js +3 -3
  10. package/fs/ci/common/module.f.d.ts +2 -0
  11. package/fs/ci/common/module.f.js +4 -1
  12. package/fs/ci/config/module.f.d.ts +2 -2
  13. package/fs/ci/config/module.f.js +2 -2
  14. package/fs/ci/module.f.d.ts +3 -4
  15. package/fs/ci/module.f.js +10 -8
  16. package/fs/ci/node/module.f.js +4 -2
  17. package/fs/ci/proof.f.js +9 -6
  18. package/fs/crypto/sha2/module.f.js +32 -36
  19. package/fs/crypto/vdf/module.f.d.ts +21 -0
  20. package/fs/crypto/vdf/module.f.js +57 -0
  21. package/fs/crypto/vdf/proof.f.d.ts +32 -0
  22. package/fs/crypto/vdf/proof.f.js +135 -0
  23. package/fs/dev/module.f.d.ts +2 -9
  24. package/fs/dev/module.f.js +10 -9
  25. package/fs/dev/proof.f.d.ts +0 -1
  26. package/fs/dev/proof.f.js +0 -21
  27. package/fs/dev/version/module.f.d.ts +2 -2
  28. package/fs/dev/version/module.f.js +2 -2
  29. package/fs/dev/version/proof.f.js +2 -2
  30. package/fs/djs/module.f.d.ts +2 -2
  31. package/fs/djs/module.f.js +2 -2
  32. package/fs/djs/parser/module.f.d.ts +0 -2
  33. package/fs/djs/proof.f.js +1 -1
  34. package/fs/djs/transpiler/module.f.d.ts +2 -2
  35. package/fs/djs/transpiler/module.f.js +2 -2
  36. package/fs/djs/transpiler/proof.f.js +1 -1
  37. package/fs/{types/effects → effects}/module.f.d.ts +1 -1
  38. package/fs/{types/effects → effects}/module.f.js +1 -1
  39. package/fs/{io → effects/node}/module.d.ts +5 -12
  40. package/fs/{types/effects → effects}/node/module.f.d.ts +3 -3
  41. package/fs/{types/effects → effects}/node/module.f.js +1 -1
  42. package/fs/{io → effects/node}/module.js +96 -12
  43. package/fs/{types/effects → effects}/node/proof.f.js +1 -1
  44. package/fs/{types/effects → effects}/node/virtual/module.f.d.ts +1 -1
  45. package/fs/{types/effects → effects}/node/virtual/module.f.js +5 -5
  46. package/fs/emergent_testing/all.test.d.ts +1 -1
  47. package/fs/emergent_testing/all.test.js +3 -2
  48. package/fs/emergent_testing/module.f.d.ts +2 -2
  49. package/fs/emergent_testing/module.f.js +2 -2
  50. package/fs/emergent_testing/proof.f.js +4 -4
  51. package/fs/emergent_testing/scenarios/all.d.ts +1 -1
  52. package/fs/emergent_testing/scenarios/all.js +1 -1
  53. package/fs/fjs/module.f.d.ts +1 -1
  54. package/fs/fjs/module.f.js +1 -1
  55. package/fs/fjs/module.js +2 -2
  56. package/fs/json/module.f.d.ts +25 -9
  57. package/fs/json/module.f.js +25 -3
  58. package/fs/json/rpc/module.f.d.ts +109 -0
  59. package/fs/json/rpc/module.f.js +84 -0
  60. package/fs/json/rpc/proof.f.d.ts +35 -0
  61. package/fs/json/rpc/proof.f.js +68 -0
  62. package/fs/json/schema/module.f.d.ts +76 -0
  63. package/fs/json/schema/module.f.js +112 -0
  64. package/fs/json/schema/proof.f.d.ts +33 -0
  65. package/fs/json/schema/proof.f.js +71 -0
  66. package/fs/mcp/module.f.d.ts +88 -0
  67. package/fs/mcp/module.f.js +69 -0
  68. package/fs/sul/level/literal/proof.f.d.ts +1 -0
  69. package/fs/sul/level/literal/proof.f.js +6 -0
  70. package/fs/text/sgr/module.f.d.ts +2 -17
  71. package/fs/text/sgr/module.f.js +4 -19
  72. package/fs/types/array/module.f.d.ts +7 -0
  73. package/fs/types/array/module.f.js +7 -0
  74. package/fs/types/prime_field/module.f.d.ts +8 -0
  75. package/fs/types/prime_field/module.f.js +37 -5
  76. package/fs/types/prime_field/proof.f.d.ts +3 -0
  77. package/fs/types/prime_field/proof.f.js +27 -2
  78. package/fs/types/rtti/parse/module.f.d.ts +28 -0
  79. package/fs/types/rtti/parse/module.f.js +35 -5
  80. package/fs/types/rtti/ts/module.f.d.ts +46 -3
  81. package/fs/types/rtti/validate/module.f.js +5 -0
  82. package/fs/website/module.f.d.ts +2 -2
  83. package/fs/website/module.f.js +2 -2
  84. package/package.json +3 -3
  85. package/fs/emergent_testing/module.d.ts +0 -1
  86. package/fs/emergent_testing/module.js +0 -4
  87. package/fs/io/module.f.d.ts +0 -134
  88. package/fs/io/module.f.js +0 -113
  89. /package/fs/{types/effects → effects}/mock/module.f.d.ts +0 -0
  90. /package/fs/{types/effects → effects}/mock/module.f.js +0 -0
  91. /package/fs/{types/effects → effects}/module.d.ts +0 -0
  92. /package/fs/{types/effects → effects}/module.js +0 -0
  93. /package/fs/{types/effects → effects}/node/proof.f.d.ts +0 -0
  94. /package/fs/{types/effects → effects}/proof.f.d.ts +0 -0
  95. /package/fs/{types/effects → effects}/proof.f.js +0 -0
@@ -1,8 +1,28 @@
1
- import type { Unknown as DjsUnknown } from '../../../djs/module.f.ts';
2
1
  import type { Tag0, Tag1, Struct, Tuple, Type } from '../module.f.ts';
3
2
  import type { ReadonlyRecord } from '../../object/module.f.ts';
3
+ /**
4
+ * The set of primitive literal types representable as rtti `Const` values.
5
+ * Defined here rather than imported from `djs` to keep rtti free of djs dependencies
6
+ * (djs depends on rtti, not the other way around — see [i665-rtti-defines-types]).
7
+ */
8
+ export type Primitive = null | boolean | number | string | undefined | bigint;
9
+ /**
10
+ * The TypeScript type that rtti's `unknown` schema validates — any value that
11
+ * an rtti schema can represent: a primitive, an array, or an object.
12
+ *
13
+ * Currently equivalent to `djs.Unknown`, but defined here to keep `rtti` free
14
+ * of `djs` dependencies. May be extended to include functions or other
15
+ * non-JSON-primitives in the future.
16
+ */
17
+ export type Unknown = Primitive | Array | Object;
18
+ /** A read-only array of {@link Unknown} values. */
19
+ export type Array = readonly Unknown[];
20
+ /** A read-only record of {@link Unknown} values. */
21
+ export type Object = {
22
+ readonly [k in string]: Unknown;
23
+ };
4
24
  /** Maps a `Tag0` to its TypeScript type. */
5
- export type Info0Ts<T extends Tag0> = T extends 'boolean' ? boolean : T extends 'number' ? number : T extends 'string' ? string : T extends 'bigint' ? bigint : T extends 'unknown' ? DjsUnknown : never;
25
+ export type Info0Ts<T extends Tag0> = T extends 'boolean' ? boolean : T extends 'number' ? number : T extends 'string' ? string : T extends 'bigint' ? bigint : T extends 'unknown' ? Unknown : never;
6
26
  /** Maps a `Const` schema to its TypeScript type. */
7
27
  export type ConstTs<T> = T extends readonly Type[] ? TupleTs<T> : T extends {
8
28
  readonly [k in string]: Type;
@@ -25,6 +45,27 @@ type RequiredFields<T extends Struct> = {
25
45
  };
26
46
  /** Maps a struct schema to a readonly object of resolved types, with optional fields for schemas that include `undefined`. */
27
47
  export type StructTs<T extends Struct> = (keyof OptionalFields<T> extends never ? unknown : OptionalFields<T>) & (keyof RequiredFields<T> extends never ? unknown : RequiredFields<T>);
48
+ /**
49
+ * Private unique symbol used as the phantom key in WithOut.
50
+ * A symbol key is excluded from string index signatures ({ readonly [K in string]: Type }),
51
+ * so WithOut<Struct, Out> is valid for any Out regardless of whether Out extends Type.
52
+ */
53
+ declare const withOutKey: unique symbol;
54
+ /**
55
+ * Attaches a phantom output type `Out` to a schema `S`.
56
+ *
57
+ * `Ts<WithOut<S, Out>>` short-circuits to `Out` via the `withOutKey` branch without
58
+ * recursing through the schema body — solving TS2589 for recursive struct schemas
59
+ * where `StructTs` would otherwise expand infinitely.
60
+ *
61
+ * The `withOutKey` field is phantom: it is `undefined` at runtime and only exists in the
62
+ * type system. Using a unique symbol as the key means it cannot conflict with struct
63
+ * schemas' string index signature (`{ readonly [K in string]: Type }`), so `WithOut`
64
+ * is valid for any schema `S`, not just thunks.
65
+ */
66
+ export type WithOut<S, Out> = S & {
67
+ readonly [withOutKey]?: Out;
68
+ };
28
69
  /**
29
70
  * Converts a schema `Type` to its corresponding TypeScript type.
30
71
  *
@@ -39,7 +80,9 @@ export type StructTs<T extends Struct> = (keyof OptionalFields<T> extends never
39
80
  * type D = Ts<{ x: typeof boolean }> // { readonly x: boolean }
40
81
  * ```
41
82
  */
42
- export type Ts<T extends Type> = T extends () => infer I ? (I extends readonly ['const', infer C] ? ConstTs<C> : I extends readonly ['boolean'] ? boolean : I extends readonly ['number'] ? number : I extends readonly ['string'] ? string : I extends readonly ['bigint'] ? bigint : I extends readonly ['unknown'] ? DjsUnknown : I extends readonly ['array', infer E extends Type] ? readonly Ts<E>[] : I extends readonly ['record', infer E extends Type] ? {
83
+ export type Ts<T extends Type> = unknown extends T ? Unknown : T extends {
84
+ readonly [withOutKey]?: infer O;
85
+ } ? Exclude<O, undefined> : T extends () => infer I ? (I extends readonly ['const', infer C] ? ConstTs<C> : I extends readonly ['boolean'] ? boolean : I extends readonly ['number'] ? number : I extends readonly ['string'] ? string : I extends readonly ['bigint'] ? bigint : I extends readonly ['unknown'] ? Unknown : I extends readonly ['array', infer E extends Type] ? readonly Ts<E>[] : I extends readonly ['record', infer E extends Type] ? {
43
86
  readonly [K in string]: Ts<E>;
44
87
  } : I extends readonly ['or', ...infer A extends readonly Type[]] ? Ts<A[number]> : never) : ConstTs<T>;
45
88
  /**
@@ -26,6 +26,8 @@ const containerValidate = (isContainer) => (item) => value => {
26
26
  return prependPath(k, r);
27
27
  }
28
28
  }
29
+ // `value` is Container<K>, but Ts<Info1<K,I>> = readonly Ts<I>[] | Record<string,Ts<I>>.
30
+ // TypeScript can't narrow the container's element types through the validation loop.
29
31
  return ok(value);
30
32
  };
31
33
  const arrayValidate = containerValidate(isArray);
@@ -46,6 +48,8 @@ const constContainerValidate = (isContainer, getItem) => (rtti) => value => {
46
48
  return prependPath(k, r);
47
49
  }
48
50
  }
51
+ // `value` is C (Unknown container), but Ts<T> for T extends Tuple|Struct is not
52
+ // structurally equivalent to C — TypeScript can't narrow element types through the loop.
49
53
  return ok(value);
50
54
  };
51
55
  const tupleValidate = constContainerValidate(isArray, (value, k) => value[Number(k)]);
@@ -54,6 +58,7 @@ const orValidate = (rtti) => {
54
58
  const all = rtti.map(r => validate(r));
55
59
  return value => {
56
60
  for (const i of all) {
61
+ // `i` is Validate<Type>; calling without cast forces Ts<Type> evaluation → TS2589.
57
62
  const r = i(value);
58
63
  if (r[0] === 'ok') {
59
64
  return r;
@@ -1,4 +1,4 @@
1
- import { type WriteFile } from '../types/effects/node/module.f.ts';
2
- import { type Effect } from '../types/effects/module.f.ts';
1
+ import { type WriteFile } from '../effects/node/module.f.ts';
2
+ import { type Effect } from '../effects/module.f.ts';
3
3
  declare const _default: () => Effect<WriteFile, number>;
4
4
  export default _default;
@@ -4,8 +4,8 @@
4
4
  * @module
5
5
  */
6
6
  import { htmlUtf8 } from "../html/module.f.js";
7
- import { writeFile } from "../types/effects/node/module.f.js";
8
- import { pure } from "../types/effects/module.f.js";
7
+ import { writeFile } from "../effects/node/module.f.js";
8
+ import { pure } from "../effects/module.f.js";
9
9
  const html = htmlUtf8()(['a',
10
10
  { href: 'https://github.com/functionalscript/functionalscript' },
11
11
  'GitHub Repository'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "**/*.js",
@@ -9,9 +9,9 @@
9
9
  "description": "FunctionalScript is a purely functional subset of JavaScript",
10
10
  "scripts": {
11
11
  "prepack": "tsc --NoEmit false",
12
- "test": "tsc && node --test --experimental-test-coverage --test-coverage-include=**/module.f.ts",
12
+ "test": "tsc && node ./fs/fjs/module.ts t",
13
+ "cov": "node --test --experimental-test-coverage --test-coverage-include=**/module.f.ts",
13
14
  "index": "node ./fs/fjs/module.ts r ./fs/dev/index/module.f.ts",
14
- "fst": "node ./fs/fjs/module.ts t",
15
15
  "start": "node ./fs/fjs/module.ts",
16
16
  "ci-update": "node ./fs/fjs/module.ts r ./fs/ci/module.f.ts",
17
17
  "update": "npm install && npm run index && npm run ci-update",
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import { runEffect } from "../io/module.js";
2
- import { register } from "./module.f.js";
3
- // we need `await` for Playwright.
4
- await runEffect(register);
@@ -1,134 +0,0 @@
1
- import { type Effect } from '../types/effects/module.f.ts';
2
- import { type Headers, type Module, type NodeOp, type Env, type SandboxResult, type NodeProgram, type WriteConsoles, type TestContext, type Engine } from '../types/effects/node/module.f.ts';
3
- import type { Vec } from '../types/bit_vec/module.f.ts';
4
- import { type Result } from '../types/result/module.f.ts';
5
- /**
6
- * Represents a directory entry (file or directory) in the filesystem
7
- * @see https://nodejs.org/api/fs.html#class-fsdirent
8
- */
9
- export type Dirent = {
10
- readonly name: string;
11
- readonly parentPath: string;
12
- readonly isDirectory: () => boolean;
13
- readonly isFile: () => boolean;
14
- };
15
- export type RmOptions = {
16
- readonly force?: boolean;
17
- readonly recursive?: boolean;
18
- };
19
- export type MakeDirectoryOptions = {
20
- readonly recursive?: boolean;
21
- };
22
- export type ReadDir = ((path: string, options: {
23
- withFileTypes: true;
24
- }) => Promise<Dirent[]>) & ((path: string, options: {
25
- recursive?: true;
26
- }) => Promise<readonly string[]>);
27
- /**
28
- * File system operations interface
29
- * @see https://nodejs.org/api/fs.html
30
- */
31
- export type Fs = {
32
- readonly writeSync: (fd: number, s: string) => void;
33
- readonly writeFileSync: (file: string, data: Uint8Array) => void;
34
- readonly readFileSync: (path: string) => Uint8Array | null;
35
- readonly promises: {
36
- readonly readFile: (path: string) => Promise<Uint8Array>;
37
- readonly writeFile: (path: string, data: Uint8Array) => Promise<void>;
38
- readonly readdir: ReadDir;
39
- readonly rm: (path: string, options?: RmOptions) => Promise<void>;
40
- readonly mkdir: (path: string, options?: MakeDirectoryOptions) => Promise<string | undefined>;
41
- readonly copyFile: (src: string, dest: string) => Promise<void>;
42
- readonly access: (path: string) => Promise<void>;
43
- };
44
- };
45
- /**
46
- * Console operations interface
47
- * @see https://nodejs.org/api/console.html
48
- */
49
- export type Console = {
50
- readonly log: (...d: unknown[]) => void;
51
- readonly error: (...d: unknown[]) => void;
52
- };
53
- /**
54
- * High-resolution time measurement interface
55
- * @see https://nodejs.org/api/perf_hooks.html#performance-now
56
- */
57
- export type Performance = {
58
- readonly now: () => number;
59
- };
60
- export type Writable = {
61
- readonly fd: number;
62
- readonly isTTY: boolean;
63
- };
64
- /**
65
- * Node.js Process interface
66
- * @see https://nodejs.org/api/process.html
67
- */
68
- export type Process = {
69
- readonly argv: string[];
70
- readonly env: Env;
71
- readonly exit: (code: number) => never;
72
- readonly cwd: () => string;
73
- readonly stdout: Writable;
74
- readonly stderr: Writable;
75
- };
76
- export type TryCatch = <T>(f: () => T) => Result<T, unknown>;
77
- export type Sandbox = <T>(f: () => T) => Promise<SandboxResult<T>>;
78
- export type Server = {
79
- readonly listen: (port: number) => void;
80
- };
81
- export type Readable = AsyncIterable<Uint8Array>;
82
- export type IncomingMessage = Readable & {
83
- readonly method: string;
84
- readonly url: string;
85
- readonly headers: Headers;
86
- };
87
- export type ServerResponse = {
88
- readonly writeHead: (status: number, headers: Record<string, string>) => ServerResponse;
89
- readonly end: (body: Uint8Array) => void;
90
- };
91
- export type RequestListener = (req: IncomingMessage, res: ServerResponse) => Promise<void>;
92
- export type Http = {
93
- readonly createServer: (_: RequestListener) => Server;
94
- };
95
- export type ChildProcess = {
96
- readonly exec: (command: string, callback: (error: unknown, stdout: string, stderr: string) => void) => {
97
- readonly stdin: null | {
98
- readonly end: (data?: string) => void;
99
- };
100
- };
101
- };
102
- /**
103
- * Core IO operations interface providing access to system resources
104
- */
105
- export type Io = {
106
- readonly console: Console;
107
- readonly fs: Fs;
108
- readonly process: Process;
109
- readonly asyncImport: (s: string) => Promise<Module>;
110
- readonly performance: Performance;
111
- readonly fetch: (url: string) => Promise<Response>;
112
- readonly tryCatch: TryCatch;
113
- readonly asyncTryCatch: <T>(f: () => Promise<T>) => Promise<Result<T, unknown>>;
114
- readonly http: Http;
115
- readonly childProcess: ChildProcess;
116
- readonly now: () => number;
117
- readonly sandbox: Sandbox;
118
- readonly write: (stream: WriteConsoles, data: Vec) => Promise<void>;
119
- readonly testContext: TestContext;
120
- readonly bunTestContext: TestContext;
121
- readonly playwrightTestContext: TestContext;
122
- readonly engine: Engine;
123
- readonly await: (p: unknown) => Promise<readonly [unknown]>;
124
- };
125
- export type App = (io: Io) => Promise<number>;
126
- export type Run = (f: App) => Promise<never>;
127
- /**
128
- * Runs a function and exits the process with the returned code
129
- * Handles errors by exiting with code 1
130
- */
131
- export declare const run: (io: Io) => Run;
132
- export type EffectToPromise = <T>(effect: Effect<NodeOp, T>) => Promise<T>;
133
- export declare const fromIo: ({ fs: { promises: { mkdir, readFile, readdir, writeFile, rm, access } }, fetch, http: { createServer }, childProcess, asyncImport, now: ioNow, sandbox, write, await: awaitPromise, }: Io) => EffectToPromise;
134
- export declare const runProgram: (io: Io) => (args: readonly string[]) => (program: NodeProgram) => Promise<number>;
package/fs/io/module.f.js DELETED
@@ -1,113 +0,0 @@
1
- /**
2
- * Legacy `Io` interface and adapter (`fromIo`) bridging the old IO API to the
3
- * effect runner.
4
- *
5
- * @deprecated Use `fs/types/effects/node` (see issue
6
- * [i139](../../issues/README.md)).
7
- *
8
- * @module
9
- */
10
- import { normalize } from "../path/module.f.js";
11
- import {} from "../types/effects/module.f.js";
12
- import { asyncRun } from "../types/effects/module.js";
13
- import {} from "../types/effects/node/module.f.js";
14
- import { asBase, asNominal } from "../types/nominal/module.f.js";
15
- import { error, ok } from "../types/result/module.f.js";
16
- import { fromVec, listToVec, toVec } from "../types/uint8array/module.f.js";
17
- /**
18
- * Runs a function and exits the process with the returned code
19
- * Handles errors by exiting with code 1
20
- */
21
- export const run = (io) => {
22
- const exitCode = ([x, b]) => {
23
- if (x === 'error') {
24
- io.console.error(b);
25
- return 1;
26
- }
27
- else {
28
- return b;
29
- }
30
- };
31
- return async (f) => io.process.exit(exitCode(await io.asyncTryCatch(() => f(io))));
32
- };
33
- const tc = async (f) => {
34
- try {
35
- return ok(await f());
36
- }
37
- catch (e) {
38
- return error(e);
39
- }
40
- };
41
- const collect = async (v) => {
42
- let result = [];
43
- for await (const a of v) {
44
- result = [...result, a];
45
- }
46
- return result;
47
- };
48
- export const fromIo = ({ fs: { promises: { mkdir, readFile, readdir, writeFile, rm, access } }, fetch, http: { createServer }, childProcess, asyncImport, now: ioNow, sandbox, write, await: awaitPromise, }) => {
49
- const result = asyncRun({
50
- all: async (...effects) => await Promise.all(effects.map(result)),
51
- fetch: async (url) => tc(async () => {
52
- const response = await fetch(url);
53
- if (!response.ok) {
54
- throw new Error(`Fetch error: ${response.status} ${response.statusText}`);
55
- }
56
- return toVec(new Uint8Array(await response.arrayBuffer()));
57
- }),
58
- mkdir: (...p) => tc(async () => { await mkdir(...p); }),
59
- readFile: path => tc(async () => toVec(await readFile(path))),
60
- readdir: (path, r) => tc(async () => (await readdir(path, { ...r, withFileTypes: true }))
61
- .map(v => ({
62
- name: v.name,
63
- parentPath: normalize(v.parentPath),
64
- isFile: v.isFile()
65
- }))),
66
- writeFile: (path, data) => tc(() => writeFile(path, fromVec(data))),
67
- rm: path => tc(() => rm(path)),
68
- access: path => tc(() => access(path)),
69
- import: path => tc(() => asyncImport(path)),
70
- exec: (command, stdin) => new Promise(resolve => {
71
- const child = childProcess.exec(command, (e, stdout, stderr) => resolve(e !== null ? ['error', e] : ok({ stdout, stderr })));
72
- child.stdin?.end(stdin);
73
- }),
74
- createServer: async (requestListener) => {
75
- const erl = requestListener;
76
- const nodeRl = async (req, res) => {
77
- const reqBody = await collect(req);
78
- const { method, url, headers } = req;
79
- const { status, headers: outHeaders, body: outBody } = await result(erl({
80
- method,
81
- url,
82
- headers,
83
- body: listToVec(reqBody)
84
- }));
85
- res
86
- .writeHead(status, outHeaders)
87
- .end(fromVec(outBody));
88
- };
89
- const server = asNominal(createServer(nodeRl));
90
- return server;
91
- },
92
- listen: async (server, port) => {
93
- const s = asBase(server);
94
- s.listen(port);
95
- },
96
- forever: () => new Promise(() => { }),
97
- now: async () => ioNow(),
98
- sandbox,
99
- await: awaitPromise,
100
- write,
101
- test: async (ctx, name, expectFailure, test) => ctx.test(name, { expectFailure }, async (t) => result(test(t))),
102
- });
103
- return result;
104
- };
105
- export const runProgram = (io) => {
106
- const { process: { env, stdout, stderr }, testContext, bunTestContext, playwrightTestContext, engine } = io;
107
- const std = { stdout, stderr };
108
- const f = fromIo(io);
109
- return args => {
110
- const options = { args, env, std, testContext, bunTestContext, playwrightTestContext, engine };
111
- return program => f(program(options));
112
- };
113
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes