functionalscript 0.16.1 → 0.18.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.
- package/fs/asn.1/module.f.js +6 -0
- package/fs/ci/bun/module.f.js +6 -0
- package/fs/ci/common/module.f.d.ts +11 -5
- package/fs/ci/common/module.f.js +11 -4
- package/fs/ci/config/module.f.d.ts +11 -4
- package/fs/ci/config/module.f.js +11 -4
- package/fs/ci/deno/module.f.js +6 -0
- package/fs/ci/node/module.f.js +6 -0
- package/fs/ci/playwright/module.f.js +6 -0
- package/fs/ci/rust/module.f.js +7 -0
- package/fs/ci/test.f.js +2 -4
- package/fs/crypto/secp/module.f.d.ts +7 -0
- package/fs/dev/index/module.f.d.ts +6 -0
- package/fs/dev/index/module.f.js +6 -0
- package/fs/dev/module.f.d.ts +4 -3
- package/fs/dev/module.f.js +13 -11
- package/fs/dev/tf/module.d.ts +1 -0
- package/fs/dev/tf/module.f.d.ts +70 -22
- package/fs/dev/tf/module.f.js +134 -97
- package/fs/dev/tf/module.js +66 -16
- package/fs/dev/tf/test.f.d.ts +21 -20
- package/fs/dev/tf/test.f.js +249 -31
- package/fs/djs/module.f.d.ts +5 -2
- package/fs/djs/module.f.js +16 -21
- package/fs/djs/test.f.d.ts +11 -0
- package/fs/djs/test.f.js +74 -0
- package/fs/djs/tokenizer-new/test.f.js +126 -78
- package/fs/djs/transpiler/module.f.d.ts +3 -3
- package/fs/djs/transpiler/module.f.js +34 -29
- package/fs/djs/transpiler/test.f.js +19 -26
- package/fs/fjs/module.f.d.ts +2 -7
- package/fs/fjs/module.f.js +17 -17
- package/fs/fjs/module.js +2 -2
- package/fs/html/module.f.d.ts +6 -0
- package/fs/html/module.f.js +6 -0
- package/fs/io/module.d.ts +3 -3
- package/fs/io/module.f.d.ts +8 -2
- package/fs/io/module.f.js +25 -4
- package/fs/io/module.js +54 -15
- package/fs/js/tokenizer/module.f.js +7 -0
- package/fs/json/module.f.d.ts +7 -0
- package/fs/json/module.f.js +7 -0
- package/fs/path/module.f.d.ts +6 -0
- package/fs/path/module.f.js +6 -0
- package/fs/path/test.f.d.ts +3 -5
- package/fs/path/test.f.js +67 -49
- package/fs/text/module.f.d.ts +7 -0
- package/fs/text/module.f.js +7 -0
- package/fs/text/sgr/module.f.d.ts +9 -1
- package/fs/text/sgr/module.f.js +16 -5
- package/fs/text/utf16/module.f.d.ts +7 -0
- package/fs/text/utf16/module.f.js +7 -0
- package/fs/types/effects/node/module.f.d.ts +51 -9
- package/fs/types/effects/node/module.f.js +39 -2
- package/fs/types/effects/node/test.f.d.ts +4 -0
- package/fs/types/effects/node/test.f.js +33 -6
- package/fs/types/effects/node/virtual/module.f.d.ts +12 -3
- package/fs/types/effects/node/virtual/module.f.js +32 -9
- package/fs/types/function/compare/module.f.d.ts +12 -0
- package/fs/types/function/compare/module.f.js +33 -0
- package/fs/types/function/operator/test.f.d.ts +10 -0
- package/fs/types/function/operator/test.f.js +81 -0
- package/fs/types/monoid/module.f.d.ts +7 -0
- package/fs/types/number/module.f.d.ts +6 -0
- package/fs/types/number/module.f.js +6 -0
- package/fs/types/object/module.f.js +7 -0
- package/fs/types/prime_field/module.f.d.ts +8 -0
- package/fs/types/range_map/module.f.js +3 -18
- package/fs/types/result/module.f.d.ts +4 -0
- package/fs/types/result/module.f.js +4 -0
- package/fs/types/result/test.f.d.ts +2 -4
- package/fs/types/result/test.f.js +24 -16
- package/fs/types/rtti/common/module.f.d.ts +10 -1
- package/fs/types/rtti/common/module.f.js +7 -2
- package/fs/types/rtti/parse/module.f.js +35 -46
- package/fs/types/rtti/validate/module.f.js +9 -12
- package/fs/types/sorted_list/module.f.d.ts +1 -2
- package/fs/types/sorted_list/module.f.js +8 -21
- package/fs/types/sorted_set/module.f.d.ts +1 -3
- package/fs/types/ts/module.f.d.ts +7 -0
- package/fs/types/ts/test.f.d.ts +18 -0
- package/fs/types/ts/test.f.js +111 -0
- package/fs/types/uint8array/module.f.js +7 -1
- package/fs/types/uint8array/test.f.d.ts +1 -0
- package/fs/types/uint8array/test.f.js +5 -1
- package/package.json +3 -2
- package/fs/io/virtual/module.f.d.ts +0 -8
- package/fs/io/virtual/module.f.js +0 -43
package/fs/asn.1/module.f.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ASN.1 BER/DER encoding and decoding over bit vectors. Includes tag/class
|
|
3
|
+
* helpers, length-prefixed payloads, and OID conversion via Base-128.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
1
7
|
import { bitLength, max } from "../types/bigint/module.f.js";
|
|
2
8
|
import { empty, isVec, length, listToVec, msb, uint, unpack, vec, vec8 } from "../types/bit_vec/module.f.js";
|
|
3
9
|
import { identity } from "../types/function/module.f.js";
|
package/fs/ci/bun/module.f.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI step builder for Bun: installs the pinned Bun version (with a PowerShell
|
|
3
|
+
* fallback for Windows ARM) and runs `bun install` and `bun test`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
1
7
|
import { bun } from "../config/module.f.js";
|
|
2
8
|
import { clean, install, test } from "../common/module.f.js";
|
|
3
9
|
const installOnWindowsArm = ({ def, name, path }) => (v) => (a) => install(v === 'windows' && a === 'arm'
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CI types and helpers: GitHub Actions step/job RTTI schemas, the
|
|
3
|
+
* `MetaStep` representation used by tool-specific modules, and assemblers like
|
|
4
|
+
* `install`, `test`, `clean`, `ubuntu`, and `toSteps`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
1
8
|
import { images } from '../config/module.f.ts';
|
|
2
9
|
import { type Ts } from '../../types/rtti/ts/module.f.ts';
|
|
3
10
|
export declare const os: readonly ["ubuntu", "macos", "windows"];
|
|
@@ -5,12 +12,12 @@ export type Os = typeof os[number];
|
|
|
5
12
|
export declare const architecture: readonly ["intel", "arm"];
|
|
6
13
|
export type Architecture = typeof architecture[number];
|
|
7
14
|
export type Image = typeof images[Os][Architecture];
|
|
8
|
-
declare const stepSchema: {
|
|
15
|
+
export declare const stepSchema: {
|
|
9
16
|
readonly run: import("../../types/rtti/module.f.ts").Or<readonly [import("../../types/rtti/module.f.ts").String, undefined]>;
|
|
10
17
|
readonly uses: import("../../types/rtti/module.f.ts").Or<readonly [import("../../types/rtti/module.f.ts").String, undefined]>;
|
|
11
18
|
readonly with: import("../../types/rtti/module.f.ts").Or<readonly [import("../../types/rtti/module.f.ts").Type1<"record", import("../../types/rtti/module.f.ts").String>, undefined]>;
|
|
12
19
|
};
|
|
13
|
-
declare const jobSchema: {
|
|
20
|
+
export declare const jobSchema: {
|
|
14
21
|
readonly 'runs-on': import("../../types/rtti/module.f.ts").String;
|
|
15
22
|
readonly steps: import("../../types/rtti/module.f.ts").Type1<"array", {
|
|
16
23
|
readonly run: import("../../types/rtti/module.f.ts").Or<readonly [import("../../types/rtti/module.f.ts").String, undefined]>;
|
|
@@ -18,7 +25,7 @@ declare const jobSchema: {
|
|
|
18
25
|
readonly with: import("../../types/rtti/module.f.ts").Or<readonly [import("../../types/rtti/module.f.ts").Type1<"record", import("../../types/rtti/module.f.ts").String>, undefined]>;
|
|
19
26
|
}>;
|
|
20
27
|
};
|
|
21
|
-
declare const jobsSchema: import("../../types/rtti/module.f.ts").Type1<"record", {
|
|
28
|
+
export declare const jobsSchema: import("../../types/rtti/module.f.ts").Type1<"record", {
|
|
22
29
|
readonly 'runs-on': import("../../types/rtti/module.f.ts").String;
|
|
23
30
|
readonly steps: import("../../types/rtti/module.f.ts").Type1<"array", {
|
|
24
31
|
readonly run: import("../../types/rtti/module.f.ts").Or<readonly [import("../../types/rtti/module.f.ts").String, undefined]>;
|
|
@@ -26,7 +33,7 @@ declare const jobsSchema: import("../../types/rtti/module.f.ts").Type1<"record",
|
|
|
26
33
|
readonly with: import("../../types/rtti/module.f.ts").Or<readonly [import("../../types/rtti/module.f.ts").Type1<"record", import("../../types/rtti/module.f.ts").String>, undefined]>;
|
|
27
34
|
}>;
|
|
28
35
|
}>;
|
|
29
|
-
declare const gitHubActionSchema: {
|
|
36
|
+
export declare const gitHubActionSchema: {
|
|
30
37
|
readonly name: import("../../types/rtti/module.f.ts").String;
|
|
31
38
|
readonly on: {
|
|
32
39
|
readonly pull_request: import("../../types/rtti/module.f.ts").Or<readonly [{}, undefined]>;
|
|
@@ -75,4 +82,3 @@ export declare const clean: (steps: readonly MetaStep[]) => readonly MetaStep[];
|
|
|
75
82
|
export declare const toSteps: (m: readonly MetaStep[]) => readonly Step[];
|
|
76
83
|
export declare const ubuntu: (ms: readonly MetaStep[]) => Job;
|
|
77
84
|
export declare const findTgz: (v: Os) => "(Get-ChildItem *.tgz).FullName" | "./*.tgz";
|
|
78
|
-
export {};
|
package/fs/ci/common/module.f.js
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CI types and helpers: GitHub Actions step/job RTTI schemas, the
|
|
3
|
+
* `MetaStep` representation used by tool-specific modules, and assemblers like
|
|
4
|
+
* `install`, `test`, `clean`, `ubuntu`, and `toSteps`.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
1
8
|
import { images, rust } from "../config/module.f.js";
|
|
2
9
|
import { option, array, record, string } from "../../types/rtti/module.f.js";
|
|
3
10
|
import {} from "../../types/rtti/ts/module.f.js";
|
|
4
11
|
import { parse as rttiParse } from "../../types/rtti/parse/module.f.js";
|
|
5
12
|
export const os = ['ubuntu', 'macos', 'windows'];
|
|
6
13
|
export const architecture = ['intel', 'arm'];
|
|
7
|
-
const stepSchema = {
|
|
14
|
+
export const stepSchema = {
|
|
8
15
|
run: option(string),
|
|
9
16
|
uses: option(string),
|
|
10
17
|
with: option(record(string))
|
|
11
18
|
};
|
|
12
|
-
const jobSchema = {
|
|
19
|
+
export const jobSchema = {
|
|
13
20
|
'runs-on': string,
|
|
14
21
|
steps: array(stepSchema)
|
|
15
22
|
};
|
|
16
|
-
const jobsSchema = record(jobSchema);
|
|
17
|
-
const gitHubActionSchema = {
|
|
23
|
+
export const jobsSchema = record(jobSchema);
|
|
24
|
+
export const gitHubActionSchema = {
|
|
18
25
|
name: string,
|
|
19
26
|
on: { pull_request: option({}) },
|
|
20
27
|
jobs: jobsSchema
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized version pins and OS images used by the CI generator: runner
|
|
3
|
+
* images, tool versions (Bun, Deno, Playwright, Rust, Node, Wasmtime, Wasmer,
|
|
4
|
+
* TSGO).
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
1
8
|
export declare const images: {
|
|
2
9
|
readonly ubuntu: {
|
|
3
10
|
readonly intel: "ubuntu-24.04";
|
|
@@ -13,13 +20,13 @@ export declare const images: {
|
|
|
13
20
|
};
|
|
14
21
|
};
|
|
15
22
|
export declare const bun = "1.3.14";
|
|
16
|
-
export declare const deno = "2.
|
|
23
|
+
export declare const deno = "2.8.0";
|
|
17
24
|
export declare const playwright = "1.60.0";
|
|
18
25
|
export declare const rust = "1.95.0";
|
|
19
26
|
export declare const node: {
|
|
20
|
-
readonly default: "26.
|
|
21
|
-
readonly others: readonly ["22.22.3", "24.
|
|
27
|
+
readonly default: "26.2.0";
|
|
28
|
+
readonly others: readonly ["22.22.3", "24.16.0"];
|
|
22
29
|
};
|
|
23
30
|
export declare const wasmtime = "44.0.1";
|
|
24
31
|
export declare const wasmer = "7.1.0";
|
|
25
|
-
export declare const tsgo = "7.0.0-dev.
|
|
32
|
+
export declare const tsgo = "7.0.0-dev.20260526.1";
|
package/fs/ci/config/module.f.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized version pins and OS images used by the CI generator: runner
|
|
3
|
+
* images, tool versions (Bun, Deno, Playwright, Rust, Node, Wasmtime, Wasmer,
|
|
4
|
+
* TSGO).
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
1
8
|
// https://docs.github.com/en/actions/reference/runners/github-hosted-runners#standard-github-hosted-runners-for-public-repositories
|
|
2
9
|
export const images = {
|
|
3
10
|
ubuntu: {
|
|
@@ -16,19 +23,19 @@ export const images = {
|
|
|
16
23
|
// https://bun.sh/
|
|
17
24
|
export const bun = '1.3.14';
|
|
18
25
|
// https://deno.com/
|
|
19
|
-
export const deno = '2.
|
|
26
|
+
export const deno = '2.8.0';
|
|
20
27
|
// https://www.npmjs.com/package/playwright
|
|
21
28
|
export const playwright = '1.60.0';
|
|
22
29
|
// https://rust-lang.org/
|
|
23
30
|
export const rust = '1.95.0';
|
|
24
31
|
// https://nodejs.org/en/download
|
|
25
32
|
export const node = {
|
|
26
|
-
default: '26.
|
|
27
|
-
others: ['22.22.3', '24.
|
|
33
|
+
default: '26.2.0',
|
|
34
|
+
others: ['22.22.3', '24.16.0'],
|
|
28
35
|
};
|
|
29
36
|
// https://github.com/bytecodealliance/wasmtime/releases
|
|
30
37
|
export const wasmtime = '44.0.1';
|
|
31
38
|
// https://github.com/wasmerio/wasmer/releases
|
|
32
39
|
export const wasmer = '7.1.0';
|
|
33
40
|
// https://www.npmjs.com/package/@typescript/native-preview?activeTab=versions
|
|
34
|
-
export const tsgo = '7.0.0-dev.
|
|
41
|
+
export const tsgo = '7.0.0-dev.20260526.1';
|
package/fs/ci/deno/module.f.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI step builder for Deno: installs the pinned Deno version and runs
|
|
3
|
+
* `deno install` followed by `deno task test`.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
1
7
|
import { deno } from "../config/module.f.js";
|
|
2
8
|
import { clean, install, test } from "../common/module.f.js";
|
|
3
9
|
export const denoSteps = (extra) => clean([
|
package/fs/ci/node/module.f.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI step builders for Node.js: setup-node installation, common npm
|
|
3
|
+
* install/test sequences, per-version job matrices, and the main TSGO step.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
1
7
|
import { node, tsgo } from "../config/module.f.js";
|
|
2
8
|
import { clean, findTgz, install, test, ubuntu } from "../common/module.f.js";
|
|
3
9
|
export const major = (v) => v.split('.')[0];
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI job that installs Playwright (with a browser-cache step) and runs the
|
|
3
|
+
* test suite against Chromium, Firefox, and WebKit.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
1
7
|
import { images, node, playwright } from "../config/module.f.js";
|
|
2
8
|
import { install, test, toSteps } from "../common/module.f.js";
|
|
3
9
|
import { basicNode } from "../node/module.f.js";
|
package/fs/ci/rust/module.f.js
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI step builder for the Rust crate: `cargo fmt`, `cargo clippy`, native and
|
|
3
|
+
* `--release` test runs, plus matrix entries for WASM targets (Wasmtime,
|
|
4
|
+
* Wasmer) and the 32-bit `i686` targets.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
1
8
|
import { wasmer, wasmtime } from "../config/module.f.js";
|
|
2
9
|
import { install, test } from "../common/module.f.js";
|
|
3
10
|
const cargoTest = (target, config) => {
|
package/fs/ci/test.f.js
CHANGED
|
@@ -4,10 +4,8 @@ import { isVec } from "../types/bit_vec/module.f.js";
|
|
|
4
4
|
import { test, parseGitHubAction } from "./common/module.f.js";
|
|
5
5
|
import { assert } from "../dev/module.f.js";
|
|
6
6
|
import { emptyState, virtual } from "../types/effects/node/virtual/module.f.js";
|
|
7
|
-
import {} from "../types/rtti/ts/module.f.js";
|
|
8
7
|
import { parse as jsonParse } from "../json/module.f.js";
|
|
9
8
|
import { unwrap } from "../types/result/module.f.js";
|
|
10
|
-
// type Gha = Ts<typeof gitHubActionSchema>
|
|
11
9
|
const hasRun = (cmd) => (gha) => Object.values(gha.jobs).some(job => job.steps.some(step => step.run?.includes(cmd)));
|
|
12
10
|
const hasRunInJob = (jobId, cmd) => (gha) => gha.jobs[jobId]?.steps.some(step => step.run?.includes(cmd)) ?? false;
|
|
13
11
|
const githubState = {
|
|
@@ -18,9 +16,9 @@ const run = (rust, nodeExtra = () => []) => {
|
|
|
18
16
|
const [state, result] = virtual(githubState)(ci({ rust, nodeExtra, denoExtra: [], bunExtra: [] }));
|
|
19
17
|
assert(result === 0, result);
|
|
20
18
|
const dotGithub = state.root['.github'];
|
|
21
|
-
assert(dotGithub
|
|
19
|
+
assert(typeof dotGithub === 'object', dotGithub);
|
|
22
20
|
const workflows = dotGithub['workflows'];
|
|
23
|
-
assert(workflows
|
|
21
|
+
assert(typeof workflows === 'object', workflows);
|
|
24
22
|
const file = workflows['ci.yml'];
|
|
25
23
|
assert(isVec(file), file);
|
|
26
24
|
return unwrap(parseGitHubAction(jsonParse(utf8ToString(file))));
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Short Weierstrass elliptic-curve arithmetic over a prime field: `curve`
|
|
3
|
+
* builds point negation, addition, and scalar multiplication for any
|
|
4
|
+
* `secp`-family curve from its `(p, a, g, n)` parameters.
|
|
5
|
+
*
|
|
6
|
+
* @module
|
|
7
|
+
*/
|
|
1
8
|
import type { Equal, Fold, Reduce } from '../../types/function/operator/module.f.ts';
|
|
2
9
|
import { type PrimeField } from '../../types/prime_field/module.f.ts';
|
|
3
10
|
/**
|
package/fs/dev/index/module.f.js
CHANGED
package/fs/dev/module.f.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
import { type All, type NodeProgram, type Readdir } from '../types/effects/node/module.f.ts';
|
|
6
|
+
import type { Io } from '../io/module.f.ts';
|
|
7
|
+
import { type Access, type All, type Env, type Import, type NodeProgram, type Readdir } from '../types/effects/node/module.f.ts';
|
|
8
8
|
import { type Effect } from '../types/effects/module.f.ts';
|
|
9
9
|
export declare const todo: () => never;
|
|
10
10
|
export declare const assert: (v: boolean, msg?: unknown) => asserts v;
|
|
@@ -18,5 +18,6 @@ export type ModuleMap = {
|
|
|
18
18
|
};
|
|
19
19
|
export declare const env: (io: Io) => (v: string) => string | undefined;
|
|
20
20
|
export declare const allFiles: (s: string) => Effect<Readdir | All, readonly string[]>;
|
|
21
|
-
export
|
|
21
|
+
export type LoadModuleOperations = Access | Import | All | Readdir;
|
|
22
|
+
export declare const loadModuleMap: (env: Env) => Effect<LoadModuleOperations, ModuleMap>;
|
|
22
23
|
export declare const index4: NodeProgram;
|
package/fs/dev/module.f.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Development utilities for indexing modules and loading FunctionalScript files.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import { fromIo } from "../io/module.f.js";
|
|
7
1
|
import { updateVersion } from "./version/module.f.js";
|
|
8
2
|
import { access, all, both, import_, readdir, readFile, writeFile } from "../types/effects/node/module.f.js";
|
|
9
3
|
import { utf8, utf8ToString } from "../text/module.f.js";
|
|
@@ -12,6 +6,7 @@ import { begin, pure } from "../types/effects/module.f.js";
|
|
|
12
6
|
import { parse as jsonParse } from "../json/module.f.js";
|
|
13
7
|
import { record, unknown as rttiUnknown } from "../types/rtti/module.f.js";
|
|
14
8
|
import { parse as rttiParse } from "../types/rtti/parse/module.f.js";
|
|
9
|
+
import { relativize } from "../path/module.f.js";
|
|
15
10
|
export const todo = () => { throw 'not implemented'; };
|
|
16
11
|
export const assert = (v, msg = 'assertion failed') => {
|
|
17
12
|
if (!v)
|
|
@@ -63,14 +58,21 @@ const loadFile = (f) => {
|
|
|
63
58
|
}
|
|
64
59
|
return pure([]);
|
|
65
60
|
};
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
const { fromEntries } = Object;
|
|
62
|
+
export const loadModuleMap = (env) => {
|
|
68
63
|
const initCwd = env['INIT_CWD'];
|
|
69
64
|
const s = initCwd === undefined ? '.' : `${initCwd.replaceAll('\\', '/')}`;
|
|
70
|
-
const
|
|
65
|
+
const prefix = s === '.' ? '' : s;
|
|
66
|
+
// TODO: there are multiple `all` effects here,
|
|
67
|
+
// we should consider optimize them by ALIQ technique or something similar.
|
|
68
|
+
// For example, we should be able to write it like `allFiles(s).flatMap(loadFile)`,
|
|
69
|
+
// then an effect runner can batch all file loading operations together.
|
|
70
|
+
return allFiles(s)
|
|
71
71
|
.step(files => all(...files.map(loadFile)))
|
|
72
|
-
.step(entries => pure(
|
|
73
|
-
|
|
72
|
+
.step(entries => pure(fromEntries(entries
|
|
73
|
+
.flat()
|
|
74
|
+
.map(([k, v]) => [relativize(prefix, k), v])
|
|
75
|
+
.toSorted(cmp))));
|
|
74
76
|
};
|
|
75
77
|
const denoJson = './deno.json';
|
|
76
78
|
const parseDenoJson = rttiParse(record(rttiUnknown));
|
package/fs/dev/tf/module.d.ts
CHANGED
package/fs/dev/tf/module.f.d.ts
CHANGED
|
@@ -1,24 +1,72 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type
|
|
3
|
-
import
|
|
4
|
-
import { type ModuleMap } from '../module.f.ts';
|
|
5
|
-
type Log<T> = CsiConsole;
|
|
6
|
-
type Measure<T> = <R>(f: () => R) => (state: T) => readonly [R, number, T];
|
|
7
|
-
type Input<T> = {
|
|
8
|
-
readonly moduleMap: ModuleMap;
|
|
9
|
-
readonly log: Log<T>;
|
|
10
|
-
readonly error: Log<T>;
|
|
11
|
-
readonly measure: Measure<T>;
|
|
12
|
-
readonly state: T;
|
|
13
|
-
readonly tryCatch: <R>(f: () => R) => Result.Result<R, unknown>;
|
|
14
|
-
readonly env: (n: string) => string | undefined;
|
|
15
|
-
};
|
|
1
|
+
import { type All, type NodeProgram, type NodeProgramOptions, type Program, type Sandbox, type SandboxResult, type Write } from '../../types/effects/node/module.f.ts';
|
|
2
|
+
import { type Effect, type Operation } from '../../types/effects/module.f.ts';
|
|
3
|
+
import { type LoadModuleOperations, type ModuleMap } from '../module.f.ts';
|
|
16
4
|
export declare const isTest: (s: string) => boolean;
|
|
17
5
|
export type Test = () => unknown;
|
|
18
|
-
export type
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export
|
|
23
|
-
export declare const
|
|
24
|
-
|
|
6
|
+
export type TestEntry = {
|
|
7
|
+
readonly fn: Test;
|
|
8
|
+
readonly throws: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type TestSet = TestEntry | readonly (readonly [string, unknown])[];
|
|
11
|
+
export declare const parseTestSet: (throws: boolean, x: unknown) => TestSet;
|
|
12
|
+
/**
|
|
13
|
+
* Recursively collects all leaf tests reachable from `v` as `[path, entry]`
|
|
14
|
+
* pairs, without running anything. Return-value sub-trees are not walked
|
|
15
|
+
* (that requires execution); only the static object/array/function structure
|
|
16
|
+
* is traversed.
|
|
17
|
+
*/
|
|
18
|
+
export declare const collectTests: (path: Path, throws: boolean, v: unknown) => readonly (readonly [Path, TestEntry])[];
|
|
19
|
+
/**
|
|
20
|
+
* Receives semantic test-run events. Each method is the runner's notification
|
|
21
|
+
* of an event; the reporter decides how to render it (terminal, GitHub
|
|
22
|
+
* annotations, JSON, node `--test`, etc.). `path` is the chain of object keys
|
|
23
|
+
* leading to the current location; `null` marks a function-call boundary, e.g.
|
|
24
|
+
* `['outer', null, 'inner']` means `outer` was invoked and its return value
|
|
25
|
+
* contained `inner`.
|
|
26
|
+
*/
|
|
27
|
+
export type Reporter<O extends Operation> = {
|
|
28
|
+
readonly result: (file: string, path: Path, r: SandboxResult<unknown>) => Effect<O, void>;
|
|
29
|
+
readonly summary: (pass: number, fail: number, time: number) => Effect<O, void>;
|
|
30
|
+
readonly test: (file: string, path: Path, set: TestEntry) => Effect<O, SandboxResult<unknown>>;
|
|
31
|
+
};
|
|
32
|
+
export declare const runModuleMap: <O extends Operation>(reporter: Reporter<O>) => (moduleMap: ModuleMap) => Effect<O | All, number>;
|
|
33
|
+
export declare const test: <O extends Operation>(reporter: Reporter<O>) => Program<O | All | LoadModuleOperations>;
|
|
34
|
+
export type Path = readonly (string | null)[];
|
|
35
|
+
export declare const isInteger: (s: string) => boolean;
|
|
36
|
+
export declare const isIdentifier: (s: string) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Renders a key chain as a JS property-access expression: identifier keys use
|
|
39
|
+
* dot notation, integer keys use `[N]`, other strings use `["key"]`, and `null`
|
|
40
|
+
* emits `()` to mark a function-call boundary.
|
|
41
|
+
* E.g. `['math', 'add']` → `.math.add`, `['outer', null, 'inner']` → `.outer().inner`.
|
|
42
|
+
*/
|
|
43
|
+
export declare const fmtPath: (path: Path) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Formats a fully-qualified test identifier as a JS-like expression, e.g.
|
|
46
|
+
* `import("./math.test.f.ts").add()` or `import("./a.test.f.ts").users[3].name()`.
|
|
47
|
+
* Self-contained per line — suitable for parallel output and as a CLI filter argument.
|
|
48
|
+
*/
|
|
49
|
+
export declare const fmtImport: (file: string, path: Path) => string;
|
|
50
|
+
/**
|
|
51
|
+
* Renders a key chain for terminal output: `| ` per level of depth, followed
|
|
52
|
+
* by the last segment formatted as a bare integer, a bare identifier, or a
|
|
53
|
+
* JSON-quoted string. E.g. `['math', 'add']` → `| | add`,
|
|
54
|
+
* `['a', '0']` → `| | 0`, `['x', 'hello world']` → `| | "hello world"`.
|
|
55
|
+
*/
|
|
56
|
+
export declare const fmtTerm: (path: Path) => string;
|
|
57
|
+
/**
|
|
58
|
+
* Percent-encodes characters that GitHub workflow-command property values
|
|
59
|
+
* treat as separators (`%`, `:`, `,`) plus newlines.
|
|
60
|
+
* https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions
|
|
61
|
+
*/
|
|
62
|
+
export declare const ghEscape: (s: string) => string;
|
|
63
|
+
export declare const defaultTest: (file: string, path: Path, { fn, throws }: TestEntry) => Effect<Sandbox, SandboxResult<unknown>>;
|
|
64
|
+
/**
|
|
65
|
+
* The terminal/GitHub reporter used by `fjs t`. Output goes through
|
|
66
|
+
* `csiWrite`, so ANSI styles are stripped on non-TTY streams. When
|
|
67
|
+
* `GITHUB_ACTION` is set, failures are emitted as `::error` workflow
|
|
68
|
+
* annotations instead of colored lines. Exported as a factory so the
|
|
69
|
+
* GitHub format path can be exercised directly from tests.
|
|
70
|
+
*/
|
|
71
|
+
export declare const defaultReporter: (options: NodeProgramOptions) => Reporter<Write | Sandbox>;
|
|
72
|
+
export declare const main: NodeProgram;
|