functionalscript 0.9.3 → 0.10.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 (63) hide show
  1. package/bnf/module.f.d.ts +2 -1
  2. package/bnf/module.f.js +2 -1
  3. package/cas/module.f.d.ts +5 -0
  4. package/cas/module.f.js +5 -0
  5. package/ci/module.f.js +45 -33
  6. package/ci/module.js +3 -3
  7. package/crypto/sign/module.f.d.ts +5 -0
  8. package/dev/index/module.js +2 -2
  9. package/dev/module.f.d.ts +5 -0
  10. package/dev/module.f.js +5 -0
  11. package/dev/tf/module.f.js +5 -0
  12. package/dev/version/module.f.js +5 -0
  13. package/djs/ast/module.f.d.ts +5 -0
  14. package/djs/module.f.d.ts +5 -0
  15. package/djs/parser/module.f.d.ts +5 -0
  16. package/djs/parser/module.f.js +5 -0
  17. package/djs/parser-new/module.f.js +5 -0
  18. package/djs/serializer/module.f.d.ts +5 -0
  19. package/djs/transpiler/module.f.d.ts +5 -0
  20. package/djs/transpiler/module.f.js +5 -0
  21. package/fjs/module.f.d.ts +5 -0
  22. package/fjs/module.f.js +13 -2
  23. package/fjs/module.js +2 -2
  24. package/fsc/module.f.js +5 -0
  25. package/fsm/module.f.d.ts +5 -0
  26. package/fsm/module.f.js +5 -0
  27. package/io/module.d.ts +3 -3
  28. package/io/module.js +8 -7
  29. package/io/virtual/module.f.d.ts +5 -0
  30. package/json/parser/module.f.d.ts +5 -0
  31. package/json/parser/module.f.js +5 -0
  32. package/json/serializer/module.f.d.ts +5 -0
  33. package/json/serializer/module.f.js +5 -0
  34. package/json/tokenizer/module.f.js +5 -0
  35. package/package.json +1 -1
  36. package/path/module.f.d.ts +5 -0
  37. package/types/base128/module.f.d.ts +5 -0
  38. package/types/base128/module.f.js +5 -0
  39. package/types/bigfloat/module.f.js +5 -0
  40. package/types/btree/find/module.f.d.ts +5 -0
  41. package/types/btree/module.f.d.ts +5 -0
  42. package/types/btree/module.f.js +5 -0
  43. package/types/btree/remove/module.f.d.ts +5 -0
  44. package/types/btree/set/module.f.d.ts +5 -0
  45. package/types/btree/types/module.f.d.ts +5 -0
  46. package/types/byte_set/module.f.js +5 -0
  47. package/types/cbase32/module.f.d.ts +5 -0
  48. package/types/cbase32/module.f.js +5 -0
  49. package/types/effect/mock/module.f.d.ts +5 -0
  50. package/types/effect/module.f.d.ts +5 -0
  51. package/types/effect/node/virtual/module.f.js +5 -0
  52. package/types/function/compare/module.f.d.ts +5 -0
  53. package/types/function/operator/module.f.d.ts +5 -0
  54. package/types/list/module.f.js +5 -0
  55. package/types/map/module.f.js +5 -0
  56. package/types/nibble_set/module.f.d.ts +5 -0
  57. package/types/nominal/module.f.d.ts +5 -0
  58. package/types/nullable/module.f.d.ts +5 -0
  59. package/types/ordered_map/module.f.d.ts +5 -0
  60. package/types/range/module.f.d.ts +5 -0
  61. package/types/sorted_list/module.f.d.ts +5 -0
  62. package/website/module.f.js +5 -0
  63. package/website/module.js +3 -3
package/bnf/module.f.d.ts CHANGED
@@ -9,6 +9,8 @@ import { type Array2 } from '../types/array/module.f.ts';
9
9
  export type TerminalRange = number;
10
10
  export declare const fullRange: TerminalRange;
11
11
  export declare const unicodeRange: TerminalRange;
12
+ export declare const max: string;
13
+ export declare const unicodeMax: string;
12
14
  /** A sequence of rules. */
13
15
  export type Sequence = readonly Rule[];
14
16
  /** A variant */
@@ -18,7 +20,6 @@ export type Variant = {
18
20
  export type DataRule = Variant | Sequence | TerminalRange | string;
19
21
  export type LazyRule = () => DataRule;
20
22
  export type Rule = DataRule | LazyRule;
21
- export declare const max: string;
22
23
  export declare const rangeEncode: (a: number, b: number) => TerminalRange;
23
24
  export declare const oneEncode: (a: number) => TerminalRange;
24
25
  export declare const eof: TerminalRange;
package/bnf/module.f.js CHANGED
@@ -3,6 +3,8 @@ import { isArray2 } from "../types/array/module.f.js";
3
3
  import { map, toArray, repeat as listRepeat } from "../types/list/module.f.js";
4
4
  export const fullRange = 0x000000_FFFFFF;
5
5
  export const unicodeRange = 0x000000_10FFFF;
6
+ export const max = codePointListToString([0xFFFFFF]);
7
+ export const unicodeMax = codePointListToString([0x10FFFF]);
6
8
  // Internals:
7
9
  const { fromEntries, values } = Object;
8
10
  const { fromCodePoint } = String;
@@ -12,7 +14,6 @@ const { fromCodePoint } = String;
12
14
  const offset = 24;
13
15
  const mask = (1 << offset) - 1;
14
16
  const isValid = (r) => r >= 0 && r <= mask;
15
- export const max = codePointListToString([0x10FFFF]);
16
17
  export const rangeEncode = (a, b) => {
17
18
  if (!isValid(a) || !isValid(b) || a > b) {
18
19
  throw `Invalid range ${a} ${b}.`;
package/cas/module.f.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Content-addressable storage utilities for hashing, addressing, and path parsing.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type Sha2 } from "../crypto/sha2/module.f.ts";
2
7
  import type { Vec } from "../types/bit_vec/module.f.ts";
3
8
  import { type Effect, type Operations } from "../types/effect/module.f.ts";
package/cas/module.f.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Content-addressable storage utilities for hashing, addressing, and path parsing.
3
+ *
4
+ * @module
5
+ */
1
6
  import { computeSync, sha256 } from "../crypto/sha2/module.f.js";
2
7
  import { parse } from "../path/module.f.js";
3
8
  import { cBase32ToVec, vecToCBase32 } from "../types/cbase32/module.f.js";
package/ci/module.f.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Continuous integration helper commands for repository automation tasks.
3
+ *
4
+ * @module
5
+ */
1
6
  import { utf8 } from "../text/module.f.js";
2
7
  import { writeFile } from "../types/effect/node/module.f.js";
3
8
  const os = ['ubuntu', 'macos', 'windows'];
@@ -5,15 +10,15 @@ const architecture = ['intel', 'arm'];
5
10
  // https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories
6
11
  const images = {
7
12
  ubuntu: {
8
- intel: 'ubuntu-latest',
13
+ intel: 'ubuntu-24.04',
9
14
  arm: 'ubuntu-24.04-arm'
10
15
  },
11
16
  macos: {
12
- intel: 'macos-15-intel',
13
- arm: 'macos-latest'
17
+ intel: 'macos-26-intel',
18
+ arm: 'macos-26'
14
19
  },
15
20
  windows: {
16
- intel: 'windows-latest',
21
+ intel: 'windows-2025',
17
22
  arm: 'windows-11-arm',
18
23
  }
19
24
  };
@@ -27,11 +32,7 @@ const installBun = installOnWindowsArm({
27
32
  name: 'bun',
28
33
  path: 'bun.sh'
29
34
  });
30
- const installDeno = installOnWindowsArm({
31
- def: { uses: 'denoland/setup-deno@v2', with: { 'deno-version': '2' } },
32
- name: 'deno',
33
- path: 'deno.land'
34
- });
35
+ const installDeno = install({ uses: 'denoland/setup-deno@v2', with: { 'deno-version': '2' } });
35
36
  const cargoTest = (target, config) => {
36
37
  const to = target ? ` --target ${target}` : '';
37
38
  const co = config ? ` --config ${config}` : '';
@@ -65,6 +66,9 @@ const node = (version) => (extra) => basicNode(version)([
65
66
  ...extra,
66
67
  ]);
67
68
  const findTgz = (v) => v === 'windows' ? '(Get-ChildItem *.tgz).FullName' : './*.tgz';
69
+ const playwrightVersion = '1.58.2';
70
+ const playwrightAndVersion = `playwright@${playwrightVersion}`;
71
+ const rustToolchain = '1.93.1';
68
72
  const toSteps = (m) => {
69
73
  const filter = (st) => m.flatMap((mt) => mt.type === st ? [mt.step] : []);
70
74
  const aptGet = m.flatMap(v => v.type === 'apt-get' ? [v.package] : []).join(' ');
@@ -73,7 +77,7 @@ const toSteps = (m) => {
73
77
  return [
74
78
  ...(aptGet !== '' ? [{ run: `sudo apt-get update && sudo apt-get install -y ${aptGet}` }] : []),
75
79
  ...(rust ? [{
76
- uses: 'dtolnay/rust-toolchain@1.93.1',
80
+ uses: `dtolnay/rust-toolchain@${rustToolchain}`,
77
81
  with: {
78
82
  components: 'rustfmt,clippy',
79
83
  targets
@@ -92,11 +96,34 @@ const nodeSteps = (v) => [
92
96
  test({ run: `npm ${nodeTest(v)}` }),
93
97
  ];
94
98
  const ubuntu = (ms) => ({
95
- 'runs-on': 'ubuntu-latest',
99
+ 'runs-on': 'ubuntu-24.04',
96
100
  steps: toSteps(ms)
97
101
  });
98
102
  const nodeVersions = Object.fromEntries(nodes.map(v => [`node${v}`, ubuntu(nodeSteps(v))]));
99
- const steps = (v) => (a) => {
103
+ const defaultNodeVersion = '24';
104
+ const playwright = ubuntu(basicNode(defaultNodeVersion)([
105
+ //install({ uses: 'actions/cache@v4', with: { path: '~/.cache/ms-playwright', key: `${images.ubuntu.intel}-${playwrightAndVersion}` } }),
106
+ install({ run: `npm install -g ${playwrightAndVersion}` }),
107
+ install({ run: 'playwright install --with-deps' }),
108
+ // we have to use `npx` to make sure that we respect `@playwright/test` version from
109
+ // the `package.json`.
110
+ ...['chromium', 'firefox', 'webkit'].map(browser => test({ run: `npx playwright test --browser=${browser}` })),
111
+ ]));
112
+ const i686 = (a, v) => {
113
+ if (a === 'intel') {
114
+ switch (v) {
115
+ case 'windows': return customTarget('i686-pc-windows-msvc');
116
+ case 'ubuntu': return [
117
+ { type: 'apt-get', package: 'libc6-dev-i386' },
118
+ ...customTarget('i686-unknown-linux-gnu'),
119
+ ];
120
+ }
121
+ }
122
+ return [];
123
+ };
124
+ const job = (v) => (a) => {
125
+ const id = `${v}-${a}`;
126
+ const image = images[v][a];
100
127
  const result = [
101
128
  // Rust
102
129
  test({ run: 'cargo fmt -- --check' }),
@@ -108,23 +135,12 @@ const steps = (v) => (a) => {
108
135
  ...wasmTarget('wasm32-wasip2'),
109
136
  ...wasmTarget('wasm32-unknown-unknown'),
110
137
  ...wasmTarget('wasm32-wasip1-threads'),
111
- ...(a !== 'intel' ? [] :
112
- v === 'windows' ?
113
- customTarget('i686-pc-windows-msvc') :
114
- v === 'ubuntu' ? [
115
- { type: 'apt-get', package: 'libc6-dev-i386' },
116
- ...customTarget('i686-unknown-linux-gnu'),
117
- ] :
118
- []),
138
+ ...i686(a, v),
119
139
  // Node.js
120
- ...node('24')([
140
+ ...node(defaultNodeVersion)([
121
141
  // TypeScript Preview
122
142
  install({ run: 'npm install -g @typescript/native-preview' }),
123
143
  test({ run: 'tsgo' }),
124
- // Playwright
125
- install({ run: 'npm install -g playwright' }),
126
- install({ run: 'playwright install --with-deps' }),
127
- ...['chromium', 'firefox', 'webkit'].map(browser => (test({ run: `npx playwright test --browser=${browser}` }))),
128
144
  // publishing
129
145
  test({ run: 'npm pack' }),
130
146
  test({ run: `npm install -g ${findTgz(v)}` }),
@@ -134,7 +150,7 @@ const steps = (v) => (a) => {
134
150
  ]),
135
151
  // Deno
136
152
  ...clean([
137
- installDeno(v)(a),
153
+ installDeno,
138
154
  test({ run: 'deno install' }),
139
155
  test({ run: 'deno task test' }),
140
156
  test({ run: 'deno task fjs compile issues/demo/data/tree.json _tree.f.js' }),
@@ -148,16 +164,12 @@ const steps = (v) => (a) => {
148
164
  test({ run: 'bun ./fjs/module.ts t' }),
149
165
  ]),
150
166
  ];
151
- return toSteps(result);
167
+ return [id, { 'runs-on': image, steps: toSteps(result) }];
152
168
  };
153
169
  const jobs = {
154
- ...Object.fromEntries([
155
- ...os.flatMap(v => architecture.map(a => [`${v}-${a}`, {
156
- 'runs-on': images[v][a],
157
- steps: steps(v)(a),
158
- }]))
159
- ]),
170
+ ...Object.fromEntries(os.flatMap(v => architecture.map(job(v)))),
160
171
  ...nodeVersions,
172
+ playwright,
161
173
  };
162
174
  const gha = {
163
175
  name: 'CI',
package/ci/module.js CHANGED
@@ -1,3 +1,3 @@
1
- import { nodeRun } from "../io/module.js";
2
- import run from "./module.f.js";
3
- await nodeRun(run);
1
+ import run from "../io/module.js";
2
+ import app from "./module.f.js";
3
+ run(app);
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Signing helpers built on secp256k1 and SHA-256 primitives.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Array2 } from '../../types/array/module.f.ts';
2
7
  import { type Vec } from '../../types/bit_vec/module.f.ts';
3
8
  import type { Curve } from '../secp/module.f.ts';
@@ -1,3 +1,3 @@
1
1
  import { index } from "../module.f.js";
2
- import node from "../../io/module.js";
3
- await node(index);
2
+ import { legacyRun } from "../../io/module.js";
3
+ legacyRun(index);
package/dev/module.f.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Development utilities for indexing modules and loading FunctionalScript files.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type Io } from '../io/module.f.ts';
2
7
  export declare const todo: () => never;
3
8
  export type Module = {
package/dev/module.f.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Development utilities for indexing modules and loading FunctionalScript files.
3
+ *
4
+ * @module
5
+ */
1
6
  import { fromIo } from "../io/module.f.js";
2
7
  import { updateVersion } from "./version/module.f.js";
3
8
  import { decodeUtf8, encodeUtf8 } from "../types/uint8array/module.f.js";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Test-framework helpers for running and reporting FunctionalScript tests.
3
+ *
4
+ * @module
5
+ */
1
6
  import { fold } from "../../types/list/module.f.js";
2
7
  import { reset, fgGreen, fgRed, bold, stdio, stderr } from "../../text/sgr/module.f.js";
3
8
  import { env, loadModuleMap } from "../module.f.js";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Version management helpers for updating project package versions.
3
+ *
4
+ * @module
5
+ */
1
6
  import { utf8, utf8ToString } from "../../text/module.f.js";
2
7
  import { all } from "../../types/effect/module.f.js";
3
8
  import { readFile, writeFile } from "../../types/effect/node/module.f.js";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * AST types and helpers for the DJS representation.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Primitive, Array, Unknown } from '../module.f.ts';
2
7
  export type AstModule = [readonly string[], AstBody];
3
8
  export type AstConst = Primitive | AstModuleRef | AstArray | AstObject;
package/djs/module.f.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * High-level DJS API for parsing, transpiling, and serializing modules.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Io } from '../io/module.f.ts';
2
7
  import type { Primitive as JsonPrimitive } from '../json/module.f.ts';
3
8
  export type Object = {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * DJS parser that builds structured trees from DJS tokens.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type Result } from '../../types/result/module.f.ts';
2
7
  import { type List } from '../../types/list/module.f.ts';
3
8
  import type { DjsTokenWithMetadata } from '../tokenizer/module.f.ts';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * DJS parser that builds structured trees from DJS tokens.
3
+ *
4
+ * @module
5
+ */
1
6
  import { error, ok } from "../../types/result/module.f.js";
2
7
  import { fold, first, drop, toArray, length, concat } from "../../types/list/module.f.js";
3
8
  import { setReplace, at } from "../../types/ordered_map/module.f.js";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Experimental DJS parser implementation.
3
+ *
4
+ * @module
5
+ */
1
6
  import { descentParser } from "../../bnf/data/module.f.js";
2
7
  import { eof, join0Plus, max, none, not, notSet, oneEncode, option, range, remove, repeat, repeat0Plus, repeat1Plus, set, unicodeRange } from "../../bnf/module.f.js";
3
8
  import { todo } from "../../dev/module.f.js";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * DJS serializer for formatting AST values back to source text.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Unknown } from '../module.f.ts';
2
7
  import type { Entry as ObjectEntry } from '../../types/object/module.f.ts';
3
8
  import { type List } from '../../types/list/module.f.ts';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * DJS transpiler for transforming parsed trees into JavaScript output.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type Unknown } from '../module.f.ts';
2
7
  import { type Result } from '../../types/result/module.f.ts';
3
8
  import { type List } from '../../types/list/module.f.ts';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * DJS transpiler for transforming parsed trees into JavaScript output.
3
+ *
4
+ * @module
5
+ */
1
6
  import {} from "../module.f.js";
2
7
  import { error, ok } from "../../types/result/module.f.js";
3
8
  import { fold, drop, map as listMap, toArray, includes } from "../../types/list/module.f.js";
package/fjs/module.f.d.ts CHANGED
@@ -1,2 +1,7 @@
1
+ /**
2
+ * FunctionalScript compiler entry points and command handlers.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type Io } from '../io/module.f.ts';
2
7
  export declare const main: (io: Io) => Promise<number>;
package/fjs/module.f.js CHANGED
@@ -1,10 +1,16 @@
1
+ /**
2
+ * FunctionalScript compiler entry points and command handlers.
3
+ *
4
+ * @module
5
+ */
1
6
  import { fromIo } from "../io/module.f.js";
2
7
  import { compile } from "../djs/module.f.js";
3
8
  import { main as testMain } from "../dev/tf/module.f.js";
4
9
  import { main as casMain } from "../cas/module.f.js";
5
- export const main = (io) => {
10
+ export const main = async (io) => {
6
11
  const { error } = io.console;
7
12
  const [command, ...rest] = io.process.argv.slice(2);
13
+ const eRun = fromIo(io);
8
14
  switch (command) {
9
15
  case 'test':
10
16
  case 't':
@@ -14,7 +20,12 @@ export const main = (io) => {
14
20
  return compile(io)(rest);
15
21
  case 'cas':
16
22
  case 's':
17
- return fromIo(io)(casMain(rest));
23
+ return eRun(casMain(rest));
24
+ case 'run':
25
+ case 'r':
26
+ const [file, ...args] = rest;
27
+ const m = await io.asyncImport(file);
28
+ return eRun(m.default(args));
18
29
  case undefined:
19
30
  error('Error: command is required');
20
31
  return Promise.resolve(1);
package/fjs/module.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { main } from "./module.f.js";
3
- import node from "../io/module.js";
4
- await node(main);
3
+ import { legacyRun } from "../io/module.js";
4
+ legacyRun(main);
package/fsc/module.f.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * FunctionalScript command utilities for compile workflows.
3
+ *
4
+ * @module
5
+ */
1
6
  import { strictEqual } from "../types/function/operator/module.f.js";
2
7
  import { merge as rangeMapMerge, fromRange, get, } from "../types/range_map/module.f.js";
3
8
  import { reduce as listReduce, toArray, map } from "../types/list/module.f.js";
package/fsm/module.f.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Finite state machine helpers used by parser and tokenizer logic.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type List } from '../types/list/module.f.ts';
2
7
  import { type ByteSet } from '../types/byte_set/module.f.ts';
3
8
  import { type RangeMapArray } from '../types/range_map/module.f.ts';
package/fsm/module.f.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Finite state machine helpers used by parser and tokenizer logic.
3
+ *
4
+ * @module
5
+ */
1
6
  import { equal, isEmpty, fold, toArray, scan, foldScan, empty as emptyList } from "../types/list/module.f.js";
2
7
  import { toRangeMap, union as byteSetUnion, one, empty, range } from "../types/byte_set/module.f.js";
3
8
  import { intersect, union as sortedSetUnion } from "../types/sorted_set/module.f.js";
package/io/module.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { type Io, type Run } from './module.f.ts';
2
2
  import type { NodeProgram } from '../types/effect/node/module.f.ts';
3
3
  export declare const io: Io;
4
- declare const runDefault: Run;
5
- export default runDefault;
4
+ export declare const legacyRun: Run;
6
5
  export type NodeRun = (p: NodeProgram) => Promise<number>;
7
6
  export declare const ioRun: (io: Io) => NodeRun;
8
- export declare const nodeRun: NodeRun;
7
+ declare const effectRun: NodeRun;
8
+ export default effectRun;
package/io/module.js CHANGED
@@ -10,6 +10,7 @@ import { fromIo, run } from "./module.f.js";
10
10
  import fs from 'node:fs';
11
11
  import process from "node:process";
12
12
  import { concat } from "../path/module.f.js";
13
+ import { error, ok } from "../types/result/module.f.js";
13
14
  const prefix = 'file:///';
14
15
  export const io = {
15
16
  console,
@@ -24,26 +25,26 @@ export const io = {
24
25
  fetch,
25
26
  tryCatch: f => {
26
27
  try {
27
- return ['ok', f()];
28
+ return ok(f());
28
29
  }
29
30
  catch (e) {
30
- return ['error', e];
31
+ return error(e);
31
32
  }
32
33
  },
33
34
  asyncTryCatch: async (f) => {
34
35
  try {
35
- return ['ok', await f()];
36
+ return ok(await f());
36
37
  }
37
38
  catch (e) {
38
- return ['error', e];
39
+ return error(e);
39
40
  }
40
41
  },
41
42
  };
42
- const runDefault = run(io);
43
- export default runDefault;
43
+ export const legacyRun = run(io);
44
44
  export const ioRun = (io) => {
45
45
  const r = fromIo(io);
46
46
  const { argv } = io.process;
47
47
  return p => r(p(argv));
48
48
  };
49
- export const nodeRun = ioRun(io);
49
+ const effectRun = ioRun(io);
50
+ export default effectRun;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Virtual I/O adapter implementations for deterministic testing.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Io } from '../module.f.ts';
2
7
  import { type OrderedMap } from '../../types/ordered_map/module.f.ts';
3
8
  export declare const createVirtualIo: (files: OrderedMap<Uint8Array>) => Io;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * JSON parser that consumes tokenizer output into JSON values.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type Result } from '../../types/result/module.f.ts';
2
7
  import { type List } from '../../types/list/module.f.ts';
3
8
  import { type JsonToken } from '../tokenizer/module.f.ts';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * JSON parser that consumes tokenizer output into JSON values.
3
+ *
4
+ * @module
5
+ */
1
6
  import { error, ok } from "../../types/result/module.f.js";
2
7
  import { fold, first, drop, toArray, concat } from "../../types/list/module.f.js";
3
8
  import {} from "../../types/function/operator/module.f.js";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * JSON serializer for deterministic string output.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type List } from '../../types/list/module.f.ts';
2
7
  export declare const stringSerialize: (_: string) => List<string>;
3
8
  export declare const numberSerialize: (_: number) => List<string>;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * JSON serializer for deterministic string output.
3
+ *
4
+ * @module
5
+ */
1
6
  import { flat, reduce, empty } from "../../types/list/module.f.js";
2
7
  import {} from "../../types/object/module.f.js";
3
8
  import {} from "../../types/function/operator/module.f.js";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Tokenizer for JSON lexical analysis.
3
+ *
4
+ * @module
5
+ */
1
6
  import {} from "../../types/function/operator/module.f.js";
2
7
  import { concat, empty, flat, stateScan } from "../../types/list/module.f.js";
3
8
  import { multiply } from "../../types/bigfloat/module.f.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.9.3",
3
+ "version": "0.10.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "**/*.js",
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Path parsing and normalization helpers for portable module paths.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Reduce, Unary } from "../types/function/operator/module.f.ts";
2
7
  export declare const parse: (path: string) => readonly string[];
3
8
  export declare const normalize: Unary<string, string>;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Base-128 encoding and decoding utilities over bit vectors.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type Vec } from '../bit_vec/module.f.ts';
2
7
  /**
3
8
  * Encodes a bigint into an MSB Base128 vector.
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Base-128 encoding and decoding utilities over bit vectors.
3
+ *
4
+ * @module
5
+ */
1
6
  import { vec8, msb, empty } from "../bit_vec/module.f.js";
2
7
  const { concat, popFront } = msb;
3
8
  const pop8 = popFront(8n);
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Big-float helpers built from bigint mantissa and exponent parts.
3
+ *
4
+ * @module
5
+ */
1
6
  import { abs, sign } from "../bigint/module.f.js";
2
7
  const twoPow53 = 9007199254740992n;
3
8
  const twoPow54 = 18014398509481984n;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Lookup operations for persistent B-tree structures.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Leaf1, Leaf2, Branch3, Branch5, TNode } from '../types/module.f.ts';
2
7
  import type { List } from '../../list/module.f.ts';
3
8
  import { type Compare } from '../../function/compare/module.f.ts';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Core persistent B-tree construction and traversal helpers.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type List } from '../list/module.f.ts';
2
7
  import type { Tree } from './types/module.f.ts';
3
8
  export declare const empty: null;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Core persistent B-tree construction and traversal helpers.
3
+ *
4
+ * @module
5
+ */
1
6
  import { flat } from "../list/module.f.js";
2
7
  import { map } from "../nullable/module.f.js";
3
8
  const nodeValues = node => () => {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Removal operations for persistent B-tree structures.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { TNode, Tree } from '../types/module.f.ts';
2
7
  import type { Compare } from '../../function/compare/module.f.ts';
3
8
  export declare const nodeRemove: <T>(c: Compare<T>) => (node: TNode<T>) => Tree<T>;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Insertion and update operations for persistent B-tree structures.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { TNode, Tree } from '../types/module.f.ts';
2
7
  import type { Compare } from '../../function/compare/module.f.ts';
3
8
  export declare const set: <T>(c: Compare<T>) => (f: (value: T | null) => T) => (tree: Tree<T>) => TNode<T>;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Shared type definitions for persistent B-tree modules.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Array1, Array2 } from '../../array/module.f.ts';
2
7
  export type Leaf1<T> = Array1<T>;
3
8
  export type Leaf2<T> = Array2<T>;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Compact byte-set operations and predicates.
3
+ *
4
+ * @module
5
+ */
1
6
  import { compose } from "../function/module.f.js";
2
7
  import { reverse, countdown, flat, map } from "../list/module.f.js";
3
8
  export const has = n => s => ((s >> BigInt(n)) & 1n) === 1n;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Content-addressable Base32 encoding and decoding helpers.
3
+ *
4
+ * @module
5
+ */
1
6
  import { type Vec } from "../bit_vec/module.f.ts";
2
7
  import type { Nullable } from "../nullable/module.f.ts";
3
8
  export declare const vec5xToCBase32: (v: Vec) => string;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Content-addressable Base32 encoding and decoding helpers.
3
+ *
4
+ * @module
5
+ */
1
6
  import { msb, lsb, length, vec, empty } from "../bit_vec/module.f.js";
2
7
  // 0123456789abcdef
3
8
  const m = '0123456789abcdefghjkmnpqrstvwxyz';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Mock effect runtimes for testing effectful programs.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Effect, Operations } from "../module.f.ts";
2
7
  export type MemOperationMap<O extends Operations, S> = {
3
8
  readonly [K in keyof O]: (state: S, payload: O[K][0]) => readonly [S, O[K][1]];
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Core effect type constructors and combinators.
3
+ *
4
+ * @module
5
+ */
1
6
  export type Operations = {
2
7
  readonly [command in string]: readonly [input: unknown, output: unknown];
3
8
  };
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Virtual Node-effect operations for filesystem and process tests.
3
+ *
4
+ * @module
5
+ */
1
6
  import { parse } from "../../../../path/module.f.js";
2
7
  import { isVec } from "../../../bit_vec/module.f.js";
3
8
  import { error, ok } from "../../../result/module.f.js";
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Comparison function types and helpers.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Index3, Index5, Array2 } from '../../array/module.f.ts';
2
7
  export type Sign = -1 | 0 | 1;
3
8
  export type Compare<T> = (_: T) => Sign;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Common higher-order operator type aliases.
3
+ *
4
+ * @module
5
+ */
1
6
  export type Binary<A, B, R> = (a: A) => (b: B) => R;
2
7
  export type Fold<I, O> = Binary<I, O, O>;
3
8
  export declare const join: (separator: string) => Reduce<string>;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Immutable list data structure utilities and combinators.
3
+ *
4
+ * @module
5
+ */
1
6
  import { identity, fn, compose } from "../function/module.f.js";
2
7
  import { addition, logicalNot, strictEqual, stateScanToScan, foldToScan, reduceToScan, } from "../function/operator/module.f.js";
3
8
  export const fromArrayLike = (array) => {
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Persistent map operations built on ordered collections.
3
+ *
4
+ * @module
5
+ */
1
6
  const concat = (x, y) => ({
2
7
  *[Symbol.iterator]() {
3
8
  yield* x;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Nibble-set operations for compact 4-bit membership tracking.
3
+ *
4
+ * @module
5
+ */
1
6
  export type NibbleSet = number;
2
7
  export type Nibble = number;
3
8
  export declare const empty = 0;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Nominal typing helpers for branded TypeScript types.
3
+ *
4
+ * @module
5
+ */
1
6
  export type Nominal<N extends string, R extends string, B> = symbol & {
2
7
  [k in N]: readonly [R, B];
3
8
  };
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Utilities for nullable (`null`/`undefined`) value handling.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Option } from '../option/module.f.ts';
2
7
  export type Nullable<T> = T | null;
3
8
  export declare const map: <T, R>(f: (value: T) => R) => (value: Nullable<T>) => Nullable<R>;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Ordered map operations with deterministic key traversal.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Tree } from '../btree/types/module.f.ts';
2
7
  import { type List } from '../list/module.f.ts';
3
8
  import type { Reduce } from '../function/operator/module.f.ts';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Range and interval utilities for numeric boundaries.
3
+ *
4
+ * @module
5
+ */
1
6
  export type Range = readonly [number, number];
2
7
  export declare const contains: (range: Range) => (i: number) => boolean;
3
8
  export declare const one: (i: number) => Range;
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Sorted immutable list helpers and merge operations.
3
+ *
4
+ * @module
5
+ */
1
6
  import type { Sign } from '../function/compare/module.f.ts';
2
7
  import { type List } from '../list/module.f.ts';
3
8
  import type { Nullable } from '../nullable/module.f.ts';
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Static website generation program for project landing content.
3
+ *
4
+ * @module
5
+ */
1
6
  import { htmlToString } from "../html/module.f.js";
2
7
  import { writeFile } from "../types/effect/node/module.f.js";
3
8
  import { utf8 } from "../text/module.f.js";
package/website/module.js CHANGED
@@ -1,3 +1,3 @@
1
- import { nodeRun } from "../io/module.js";
2
- import run from "./module.f.js";
3
- await nodeRun(run);
1
+ import run from "../io/module.js";
2
+ import app from "./module.f.js";
3
+ run(app);