functionalscript 0.16.0 → 0.16.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.
@@ -2,10 +2,9 @@ import { images, node, playwright } from "../config/module.f.js";
2
2
  import { install, test, toSteps } from "../common/module.f.js";
3
3
  import { basicNode } from "../node/module.f.js";
4
4
  const playwrightImage = images.ubuntu.intel;
5
- // Playwright installation is stuck on Node 26 (May 7 2026) so we use Node 24.
6
5
  export const playwrightJob = {
7
6
  'runs-on': playwrightImage,
8
- steps: toSteps(basicNode(node.others.at(-1))([
7
+ steps: toSteps(basicNode(node.default)([
9
8
  install({
10
9
  uses: 'actions/cache@v4',
11
10
  with: {
package/fs/io/module.f.js CHANGED
@@ -85,7 +85,8 @@ export const fromIo = ({ console: { error, log }, fs: { promises: { mkdir, readF
85
85
  const s = asBase(server);
86
86
  s.listen(port);
87
87
  },
88
- forever: () => new Promise(() => { })
88
+ forever: () => new Promise(() => { }),
89
+ now: async () => BigInt(Date.now()) * 1000000n,
89
90
  });
90
91
  return result;
91
92
  };
@@ -82,7 +82,9 @@ export type Module = {
82
82
  };
83
83
  export type Import = ['import', (path: string) => IoResult<Module>];
84
84
  export declare const import_: Func<Import>;
85
- export type NodeOp = All | Fetch | Console | Fs | Http | Forever | Import;
85
+ export type Now = readonly ['now', () => bigint];
86
+ export declare const now: Func<Now>;
87
+ export type NodeOp = All | Fetch | Console | Fs | Http | Forever | Import | Now;
86
88
  export type NodeEffect<T> = Effect<NodeOp, T>;
87
89
  export type NodeOperationMap = ToAsyncOperationMap<NodeOp>;
88
90
  /**
@@ -23,3 +23,4 @@ export const createServer = do_('createServer');
23
23
  export const listen = do_('listen');
24
24
  export const forever = do_('forever');
25
25
  export const import_ = do_('import');
26
+ export const now = do_('now');
@@ -30,5 +30,6 @@ declare const _default: {
30
30
  noSuchFile: () => void;
31
31
  isDirectory: () => void;
32
32
  };
33
+ now: () => void;
33
34
  };
34
35
  export default _default;
@@ -1,6 +1,6 @@
1
1
  import { empty, isVec, uint, vec8 } from "../../bit_vec/module.f.js";
2
2
  import { pure } from "../module.f.js";
3
- import { fetch, mkdir, readdir, readFile, rm, writeFile } from "./module.f.js";
3
+ import { fetch, mkdir, now, readdir, readFile, rm, writeFile } from "./module.f.js";
4
4
  import { emptyState, virtual } from "./virtual/module.f.js";
5
5
  export default {
6
6
  map: () => {
@@ -326,4 +326,10 @@ export default {
326
326
  }
327
327
  },
328
328
  },
329
+ now: () => {
330
+ const [_, result] = virtual({ ...emptyState, epochNs: 1000000n })(now());
331
+ if (result !== 1000000n) {
332
+ throw result;
333
+ }
334
+ },
329
335
  };
@@ -11,6 +11,7 @@ export type State = {
11
11
  internet: {
12
12
  readonly [url: string]: Vec;
13
13
  };
14
+ epochNs: bigint;
14
15
  };
15
16
  export declare const emptyState: State;
16
17
  export declare const virtual: RunInstance<NodeOp, State>;
@@ -13,6 +13,7 @@ export const emptyState = {
13
13
  stderr: '',
14
14
  root: {},
15
15
  internet: {},
16
+ epochNs: 0n,
16
17
  };
17
18
  const operation = (op) => {
18
19
  const f = (dir, path) => {
@@ -146,5 +147,6 @@ const map = {
146
147
  createServer: todo,
147
148
  listen: todo,
148
149
  forever: todo,
150
+ now: (state) => [state, state.epochNs],
149
151
  };
150
152
  export const virtual = run(map);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "**/*.js",