functionalscript 0.14.4 → 0.14.6
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/ci/bun/module.f.d.ts +1 -1
- package/fs/ci/bun/module.f.js +2 -2
- package/fs/ci/common/module.f.d.ts +1 -0
- package/fs/ci/common/module.f.js +1 -0
- package/fs/ci/deno/module.f.d.ts +1 -1
- package/fs/ci/deno/module.f.js +2 -3
- package/fs/ci/module.f.d.ts +8 -1
- package/fs/ci/module.f.js +24 -8
- package/fs/ci/node/module.f.d.ts +2 -2
- package/fs/ci/node/module.f.js +4 -10
- package/fs/ci/test.f.d.ts +4 -0
- package/fs/ci/test.f.js +31 -21
- package/fs/dev/tf/module.js +2 -10
- package/fs/io/module.d.ts +2 -1
- package/fs/io/module.js +2 -1
- package/package.json +1 -1
package/fs/ci/bun/module.f.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type Architecture, type MetaStep, type Os } from '../common/module.f.ts';
|
|
2
|
-
export declare const bunSteps: (v: Os, a: Architecture) => readonly MetaStep[];
|
|
2
|
+
export declare const bunSteps: (extra: readonly MetaStep[]) => (v: Os, a: Architecture) => readonly MetaStep[];
|
package/fs/ci/bun/module.f.js
CHANGED
|
@@ -13,8 +13,8 @@ const installBun = installOnWindowsArm({
|
|
|
13
13
|
name: 'bun',
|
|
14
14
|
path: 'bun.sh',
|
|
15
15
|
});
|
|
16
|
-
export const bunSteps = (v, a) => clean([
|
|
16
|
+
export const bunSteps = (extra) => (v, a) => clean([
|
|
17
17
|
installBun(v)(a),
|
|
18
18
|
test({ run: 'bun test --timeout 20000' }),
|
|
19
|
-
|
|
19
|
+
...extra,
|
|
20
20
|
]);
|
|
@@ -41,3 +41,4 @@ export declare const test: (step: Step) => MetaStep;
|
|
|
41
41
|
export declare const clean: (steps: readonly MetaStep[]) => readonly MetaStep[];
|
|
42
42
|
export declare const toSteps: (m: readonly MetaStep[]) => readonly Step[];
|
|
43
43
|
export declare const ubuntu: (ms: readonly MetaStep[]) => Job;
|
|
44
|
+
export declare const findTgz: (v: Os) => "(Get-ChildItem *.tgz).FullName" | "./*.tgz";
|
package/fs/ci/common/module.f.js
CHANGED
package/fs/ci/deno/module.f.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type MetaStep } from '../common/module.f.ts';
|
|
2
|
-
export declare const denoSteps: readonly MetaStep[];
|
|
2
|
+
export declare const denoSteps: (extra: readonly MetaStep[]) => readonly MetaStep[];
|
package/fs/ci/deno/module.f.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { deno } from "../config/module.f.js";
|
|
2
2
|
import { clean, install, test } from "../common/module.f.js";
|
|
3
|
-
export const denoSteps = clean([
|
|
3
|
+
export const denoSteps = (extra) => clean([
|
|
4
4
|
install({
|
|
5
5
|
uses: 'denoland/setup-deno@v2',
|
|
6
6
|
with: { 'deno-version': deno },
|
|
7
7
|
}),
|
|
8
8
|
test({ run: 'deno install' }),
|
|
9
9
|
test({ run: 'deno task test' }),
|
|
10
|
-
|
|
11
|
-
test({ run: 'deno task fjs t' }),
|
|
10
|
+
...extra,
|
|
12
11
|
test({ run: 'deno publish --dry-run' }),
|
|
13
12
|
]);
|
package/fs/ci/module.f.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { type Effect } from '../types/effects/module.f.ts';
|
|
2
2
|
import { type NodeOp } from '../types/effects/node/module.f.ts';
|
|
3
|
-
|
|
3
|
+
import { type MetaStep, type Os } from './common/module.f.ts';
|
|
4
|
+
export type Setup = {
|
|
5
|
+
readonly rust: boolean;
|
|
6
|
+
readonly nodeExtra: (os: Os) => readonly MetaStep[];
|
|
7
|
+
readonly denoExtra: readonly MetaStep[];
|
|
8
|
+
readonly bunExtra: readonly MetaStep[];
|
|
9
|
+
};
|
|
10
|
+
export declare const ci: ({ rust, nodeExtra, denoExtra, bunExtra }: Setup) => Effect<NodeOp, number>;
|
|
4
11
|
declare const _default: () => Effect<NodeOp, number>;
|
|
5
12
|
export default _default;
|
package/fs/ci/module.f.js
CHANGED
|
@@ -7,26 +7,26 @@ import { utf8 } from "../text/module.f.js";
|
|
|
7
7
|
import { begin, pure } from "../types/effects/module.f.js";
|
|
8
8
|
import { writeFile } from "../types/effects/node/module.f.js";
|
|
9
9
|
import { images } from "./config/module.f.js";
|
|
10
|
-
import { architecture, os, toSteps } from "./common/module.f.js";
|
|
10
|
+
import { architecture, findTgz, os, test, toSteps } from "./common/module.f.js";
|
|
11
11
|
import { rustSteps } from "./rust/module.f.js";
|
|
12
12
|
import { nodeMainSteps, nodeVersions } from "./node/module.f.js";
|
|
13
13
|
import { playwrightJob } from "./playwright/module.f.js";
|
|
14
14
|
import { bunSteps } from "./bun/module.f.js";
|
|
15
15
|
import { denoSteps } from "./deno/module.f.js";
|
|
16
|
-
const job = (rust) => (o) => (a) => {
|
|
16
|
+
const job = (rust, nodeExtra, denoExtra, bunExtra) => (o) => (a) => {
|
|
17
17
|
const id = `${o}-${a}`;
|
|
18
18
|
const image = images[o][a];
|
|
19
19
|
const result = [
|
|
20
20
|
...(rust ? rustSteps(o, a) : []),
|
|
21
|
-
...nodeMainSteps(
|
|
22
|
-
...denoSteps,
|
|
23
|
-
...bunSteps(o, a),
|
|
21
|
+
...nodeMainSteps(nodeExtra),
|
|
22
|
+
...denoSteps(denoExtra),
|
|
23
|
+
...bunSteps(bunExtra)(o, a),
|
|
24
24
|
];
|
|
25
25
|
return [id, { 'runs-on': image, steps: toSteps(result) }];
|
|
26
26
|
};
|
|
27
|
-
export const ci = (rust) => {
|
|
27
|
+
export const ci = ({ rust, nodeExtra, denoExtra, bunExtra }) => {
|
|
28
28
|
const jobs = {
|
|
29
|
-
...Object.fromEntries(os.flatMap(o => architecture.map(job(rust)(o)))),
|
|
29
|
+
...Object.fromEntries(os.flatMap(o => architecture.map(job(rust, nodeExtra(o), denoExtra, bunExtra)(o)))),
|
|
30
30
|
...nodeVersions,
|
|
31
31
|
playwright: playwrightJob,
|
|
32
32
|
};
|
|
@@ -39,5 +39,21 @@ export const ci = (rust) => {
|
|
|
39
39
|
.step(() => writeFile('.github/workflows/ci.yml', utf8(JSON.stringify(gha, null, ' '))))
|
|
40
40
|
.step(() => pure(0));
|
|
41
41
|
};
|
|
42
|
-
const defaultEffect = ci(
|
|
42
|
+
const defaultEffect = ci({
|
|
43
|
+
rust: true,
|
|
44
|
+
nodeExtra: o => [
|
|
45
|
+
test({ run: 'npm pack' }),
|
|
46
|
+
test({ run: `npm install -g ${findTgz(o)}` }),
|
|
47
|
+
test({ run: 'fjs compile issues/demo/data/tree.json _tree.f.js' }),
|
|
48
|
+
test({ run: 'fjs t' }),
|
|
49
|
+
test({ run: 'npm uninstall functionalscript -g' }),
|
|
50
|
+
],
|
|
51
|
+
denoExtra: [
|
|
52
|
+
test({ run: 'deno task fjs compile issues/demo/data/tree.json _tree.f.js' }),
|
|
53
|
+
test({ run: 'deno task fjs t' }),
|
|
54
|
+
],
|
|
55
|
+
bunExtra: [
|
|
56
|
+
test({ run: 'bun ./fs/fjs/module.ts t' }),
|
|
57
|
+
]
|
|
58
|
+
});
|
|
43
59
|
export default () => defaultEffect;
|
package/fs/ci/node/module.f.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type Jobs, type MetaStep
|
|
1
|
+
import { type Jobs, type MetaStep } from '../common/module.f.ts';
|
|
2
2
|
export declare const major: (v: string) => string;
|
|
3
3
|
export declare const basicNode: (version: string) => (extra: readonly MetaStep[]) => readonly MetaStep[];
|
|
4
4
|
export declare const nodeTests: (version: string) => (extra: readonly MetaStep[]) => readonly MetaStep[];
|
|
5
5
|
export declare const nodeVersions: Jobs;
|
|
6
|
-
export declare const nodeMainSteps: (
|
|
6
|
+
export declare const nodeMainSteps: (extra: readonly MetaStep[]) => readonly MetaStep[];
|
package/fs/ci/node/module.f.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { node, tsgo } from "../config/module.f.js";
|
|
2
|
-
import { clean, install, test, ubuntu } from "../common/module.f.js";
|
|
2
|
+
import { clean, findTgz, install, test, ubuntu } from "../common/module.f.js";
|
|
3
3
|
export const major = (v) => v.split('.')[0];
|
|
4
4
|
const installNode = (version) => ({ uses: 'actions/setup-node@v6', with: { 'node-version': version } });
|
|
5
5
|
export const basicNode = (version) => (extra) => clean([
|
|
@@ -12,8 +12,6 @@ export const nodeTests = (version) => (extra) => basicNode(version)([
|
|
|
12
12
|
test({ run: 'npm run fst' }),
|
|
13
13
|
...extra,
|
|
14
14
|
]);
|
|
15
|
-
const findTgz = (v) => v === 'windows' ? '(Get-ChildItem *.tgz).FullName' : './*.tgz';
|
|
16
|
-
// const nodeTest = (v: string) => major(v) === '20' ? 'run test20' : 'test'
|
|
17
15
|
const nodeSteps = (v) => [
|
|
18
16
|
install(installNode(v)),
|
|
19
17
|
test({ run: 'npm ci' }),
|
|
@@ -23,14 +21,10 @@ export const nodeVersions = Object.fromEntries(node.others.map(v => [
|
|
|
23
21
|
`node${major(v)}`,
|
|
24
22
|
ubuntu(nodeSteps(v))
|
|
25
23
|
]));
|
|
26
|
-
export const nodeMainSteps = (
|
|
24
|
+
export const nodeMainSteps = (extra) => nodeTests(node.default)([
|
|
27
25
|
// TypeScript Preview
|
|
28
26
|
install({ run: `npm install -g @typescript/native-preview@${tsgo}` }),
|
|
29
27
|
test({ run: 'tsgo' }),
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
test({ run: `npm install -g ${findTgz(v)}` }),
|
|
33
|
-
test({ run: 'fjs compile issues/demo/data/tree.json _tree.f.js' }),
|
|
34
|
-
test({ run: 'fjs t' }),
|
|
35
|
-
test({ run: 'npm uninstall functionalscript -g' }),
|
|
28
|
+
// extra
|
|
29
|
+
...extra,
|
|
36
30
|
]);
|
package/fs/ci/test.f.d.ts
CHANGED
package/fs/ci/test.f.js
CHANGED
|
@@ -1,40 +1,50 @@
|
|
|
1
1
|
import { ci } from "./module.f.js";
|
|
2
2
|
import { utf8ToString } from "../text/module.f.js";
|
|
3
3
|
import { isVec } from "../types/bit_vec/module.f.js";
|
|
4
|
+
import { test } from "./common/module.f.js";
|
|
5
|
+
import { assert } from "../dev/module.f.js";
|
|
4
6
|
import { emptyState, virtual } from "../types/effects/node/virtual/module.f.js";
|
|
5
|
-
const
|
|
7
|
+
const hasRun = (cmd) => (gha) => Object.values(gha.jobs).some(job => job.steps.some(step => step.run?.includes(cmd)));
|
|
8
|
+
const hasRunInJob = (jobId, cmd) => (gha) => gha.jobs[jobId]?.steps.some(step => step.run?.includes(cmd)) ?? false;
|
|
6
9
|
const githubState = {
|
|
7
10
|
...emptyState,
|
|
8
11
|
root: { '.github': { workflows: {} } },
|
|
9
12
|
};
|
|
10
|
-
const run = (rust) => {
|
|
11
|
-
const [state, result] = virtual(githubState)(ci(rust));
|
|
12
|
-
|
|
13
|
-
throw result;
|
|
14
|
-
}
|
|
13
|
+
const run = (rust, nodeExtra = () => []) => {
|
|
14
|
+
const [state, result] = virtual(githubState)(ci({ rust, nodeExtra, denoExtra: [], bunExtra: [] }));
|
|
15
|
+
assert(result === 0, result);
|
|
15
16
|
const dotGithub = state.root['.github'];
|
|
16
|
-
|
|
17
|
-
throw dotGithub;
|
|
18
|
-
}
|
|
17
|
+
assert(dotGithub !== undefined && !isVec(dotGithub), dotGithub);
|
|
19
18
|
const workflows = dotGithub['workflows'];
|
|
20
|
-
|
|
21
|
-
throw workflows;
|
|
22
|
-
}
|
|
19
|
+
assert(workflows !== undefined && !isVec(workflows), workflows);
|
|
23
20
|
const file = workflows['ci.yml'];
|
|
24
|
-
|
|
25
|
-
throw file;
|
|
26
|
-
}
|
|
21
|
+
assert(isVec(file), file);
|
|
27
22
|
return JSON.parse(utf8ToString(file));
|
|
28
23
|
};
|
|
29
24
|
export default {
|
|
30
25
|
rust: () => {
|
|
31
|
-
|
|
32
|
-
throw 'expected Rust steps';
|
|
33
|
-
}
|
|
26
|
+
assert(hasRun('cargo')(run(true)), 'expected Rust steps');
|
|
34
27
|
},
|
|
35
28
|
noRust: () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
assert(!hasRun('cargo')(run(false)), 'unexpected Rust steps');
|
|
30
|
+
},
|
|
31
|
+
extra: {
|
|
32
|
+
allOs: () => {
|
|
33
|
+
const cmd = 'echo hello';
|
|
34
|
+
const gha = run(false, () => [test({ run: cmd })]);
|
|
35
|
+
for (const o of ['ubuntu', 'macos', 'windows']) {
|
|
36
|
+
for (const a of ['intel', 'arm']) {
|
|
37
|
+
assert(hasRunInJob(`${o}-${a}`, cmd)(gha), `missing extra step in ${o}-${a}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
osSpecific: () => {
|
|
42
|
+
const gha = run(false, o => o === 'ubuntu' ? [test({ run: 'echo ubuntu-only' })] : []);
|
|
43
|
+
for (const a of ['intel', 'arm']) {
|
|
44
|
+
assert(hasRunInJob(`ubuntu-${a}`, 'echo ubuntu-only')(gha), `missing step in ubuntu-${a}`);
|
|
45
|
+
assert(!hasRunInJob(`macos-${a}`, 'echo ubuntu-only')(gha), `unexpected step in macos-${a}`);
|
|
46
|
+
assert(!hasRunInJob(`windows-${a}`, 'echo ubuntu-only')(gha), `unexpected step in windows-${a}`);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
39
49
|
},
|
|
40
50
|
};
|
package/fs/dev/tf/module.js
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
2
|
-
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
3
|
-
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
4
|
-
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
5
|
-
});
|
|
6
|
-
}
|
|
7
|
-
return path;
|
|
8
|
-
};
|
|
9
1
|
import { io } from "../../io/module.js";
|
|
10
2
|
import { loadModuleMap } from "../module.f.js";
|
|
11
3
|
import { isTest, parseTestSet } from "./module.f.js";
|
|
12
4
|
import * as nodeTest from 'node:test';
|
|
13
|
-
import {
|
|
5
|
+
import { asyncImport } from "../../io/module.js";
|
|
14
6
|
const isBun = typeof Bun !== 'undefined';
|
|
15
7
|
const isPlaywright = typeof process !== 'undefined' && process?.env?.PLAYWRIGHT_TEST !== undefined;
|
|
16
8
|
const createFramework = (fw) => (prefix, f) => fw.test(prefix, t => f((name, v) => t.test(name, v)));
|
|
17
9
|
// Bun doesn't support nested tests yet.
|
|
18
10
|
const createBunFramework = (fw) => (prefix, f) => f((name, v) => fw.test(`${prefix}: ${name}`, v));
|
|
19
11
|
const createPlaywrightFramework = async () => {
|
|
20
|
-
const pwTest = (await
|
|
12
|
+
const pwTest = (await asyncImport('@playwright/test')).test;
|
|
21
13
|
return (prefix, f) => f((name, v) => pwTest(`${prefix}: ${name}`, v));
|
|
22
14
|
};
|
|
23
15
|
const framework = isPlaywright ? await createPlaywrightFramework() :
|
package/fs/io/module.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type Io, type Run } from './module.f.ts';
|
|
1
|
+
import { type Io, type Module, type Run } from './module.f.ts';
|
|
2
2
|
import type { NodeProgram } from '../types/effects/node/module.f.ts';
|
|
3
|
+
export declare const asyncImport: (v: string) => Promise<Module>;
|
|
3
4
|
export declare const io: Io;
|
|
4
5
|
export declare const legacyRun: Run;
|
|
5
6
|
export type NodeRun = (p: NodeProgram) => Promise<number>;
|
package/fs/io/module.js
CHANGED
|
@@ -14,6 +14,7 @@ import { fromIo, run } from "./module.f.js";
|
|
|
14
14
|
import { concat } from "../path/module.f.js";
|
|
15
15
|
import { error, ok } from "../types/result/module.f.js";
|
|
16
16
|
const prefix = 'file:///';
|
|
17
|
+
export const asyncImport = (v) => import(__rewriteRelativeImportExtension(v));
|
|
17
18
|
export const io = {
|
|
18
19
|
console,
|
|
19
20
|
fs,
|
|
@@ -21,7 +22,7 @@ export const io = {
|
|
|
21
22
|
asyncImport: (v) => {
|
|
22
23
|
const s0 = v.includes(':') || v.startsWith('/') ? v : concat(process.cwd())(v);
|
|
23
24
|
const s1 = s0.startsWith(prefix) ? s0 : `${prefix}${s0}`;
|
|
24
|
-
return
|
|
25
|
+
return asyncImport(s1);
|
|
25
26
|
},
|
|
26
27
|
performance,
|
|
27
28
|
fetch,
|