functionalscript 0.22.0 → 0.24.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 (82) hide show
  1. package/fs/asn.1/module.f.js +2 -1
  2. package/fs/cas/module.f.d.ts +2 -2
  3. package/fs/cas/module.f.js +2 -2
  4. package/fs/cas/proof.f.d.ts +9 -0
  5. package/fs/cas/proof.f.js +98 -4
  6. package/fs/ci/config/module.f.d.ts +2 -2
  7. package/fs/ci/config/module.f.js +2 -2
  8. package/fs/ci/module.f.d.ts +2 -2
  9. package/fs/ci/module.f.js +2 -2
  10. package/fs/ci/proof.f.js +1 -1
  11. package/fs/crypto/pow/module.f.d.ts +37 -0
  12. package/fs/crypto/pow/module.f.js +72 -0
  13. package/fs/crypto/pow/proof.f.d.ts +33 -0
  14. package/fs/crypto/pow/proof.f.js +161 -0
  15. package/fs/dev/module.f.d.ts +2 -9
  16. package/fs/dev/module.f.js +12 -11
  17. package/fs/dev/proof.f.d.ts +0 -1
  18. package/fs/dev/proof.f.js +0 -21
  19. package/fs/dev/version/module.f.d.ts +2 -2
  20. package/fs/dev/version/module.f.js +2 -2
  21. package/fs/dev/version/proof.f.js +2 -2
  22. package/fs/djs/module.f.d.ts +2 -2
  23. package/fs/djs/module.f.js +2 -2
  24. package/fs/djs/parser/module.f.d.ts +0 -2
  25. package/fs/djs/proof.f.js +1 -1
  26. package/fs/djs/transpiler/module.f.d.ts +2 -2
  27. package/fs/djs/transpiler/module.f.js +2 -2
  28. package/fs/djs/transpiler/proof.f.js +1 -1
  29. package/fs/{types/effects → effects}/module.f.d.ts +1 -1
  30. package/fs/{types/effects → effects}/module.f.js +1 -1
  31. package/fs/effects/node/module.d.ts +20 -0
  32. package/fs/{types/effects → effects}/node/module.f.d.ts +3 -3
  33. package/fs/{types/effects → effects}/node/module.f.js +1 -1
  34. package/fs/effects/node/module.js +231 -0
  35. package/fs/{types/effects → effects}/node/proof.f.js +1 -1
  36. package/fs/{types/effects → effects}/node/virtual/module.f.d.ts +1 -1
  37. package/fs/{types/effects → effects}/node/virtual/module.f.js +5 -5
  38. package/fs/emergent_testing/all.test.js +3 -2
  39. package/fs/emergent_testing/example.f.d.ts +13 -0
  40. package/fs/emergent_testing/example.f.js +31 -0
  41. package/fs/emergent_testing/module.f.d.ts +2 -2
  42. package/fs/emergent_testing/module.f.js +2 -2
  43. package/fs/emergent_testing/proof.f.js +4 -4
  44. package/fs/emergent_testing/scenarios/all.d.ts +1 -1
  45. package/fs/emergent_testing/scenarios/all.js +1 -3
  46. package/fs/fjs/module.f.d.ts +1 -1
  47. package/fs/fjs/module.f.js +1 -1
  48. package/fs/fjs/module.js +2 -2
  49. package/fs/path/module.f.d.ts +4 -0
  50. package/fs/path/module.f.js +5 -1
  51. package/fs/path/proof.f.d.ts +1 -0
  52. package/fs/path/proof.f.js +28 -2
  53. package/fs/text/sgr/module.f.d.ts +2 -17
  54. package/fs/text/sgr/module.f.js +4 -19
  55. package/fs/types/bigint/module.f.d.ts +0 -15
  56. package/fs/types/bigint/module.f.js +0 -15
  57. package/fs/types/bigint/proof.f.js +2 -1
  58. package/fs/types/bit_vec/module.f.js +2 -2
  59. package/fs/types/function/compare/module.f.d.ts +12 -0
  60. package/fs/types/function/compare/module.f.js +12 -0
  61. package/fs/types/function/compare/proof.f.js +31 -1
  62. package/fs/types/function/operator/module.f.d.ts +0 -2
  63. package/fs/types/function/operator/module.f.js +0 -2
  64. package/fs/types/function/operator/proof.f.d.ts +0 -2
  65. package/fs/types/function/operator/proof.f.js +2 -18
  66. package/fs/types/number/module.f.js +4 -4
  67. package/fs/website/module.f.d.ts +2 -2
  68. package/fs/website/module.f.js +2 -2
  69. package/package.json +1 -1
  70. package/fs/emergent_testing/module.d.ts +0 -1
  71. package/fs/emergent_testing/module.js +0 -4
  72. package/fs/io/module.d.ts +0 -9
  73. package/fs/io/module.f.d.ts +0 -134
  74. package/fs/io/module.f.js +0 -113
  75. package/fs/io/module.js +0 -132
  76. /package/fs/{types/effects → effects}/mock/module.f.d.ts +0 -0
  77. /package/fs/{types/effects → effects}/mock/module.f.js +0 -0
  78. /package/fs/{types/effects → effects}/module.d.ts +0 -0
  79. /package/fs/{types/effects → effects}/module.js +0 -0
  80. /package/fs/{types/effects → effects}/node/proof.f.d.ts +0 -0
  81. /package/fs/{types/effects → effects}/proof.f.d.ts +0 -0
  82. /package/fs/{types/effects → effects}/proof.f.js +0 -0
package/fs/io/module.js DELETED
@@ -1,132 +0,0 @@
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
- import http from 'node:http';
10
- import childProcess from 'node:child_process';
11
- import fs from 'node:fs';
12
- import process from 'node:process';
13
- import { concat } from "../path/module.f.js";
14
- import { once } from 'node:events';
15
- import { runProgram } from "./module.f.js";
16
- import { error, ok } from "../types/result/module.f.js";
17
- import { fromVec } from "../types/uint8array/module.f.js";
18
- import * as testContext from 'node:test';
19
- const isPlaywright = 'PLAYWRIGHT_TEST' in (process?.env ?? {});
20
- const pwTest = isPlaywright
21
- ? (await import('@playwright/test')).test
22
- : undefined;
23
- const inlineTest = async (name, { expectFailure }, fn) => {
24
- if (expectFailure) {
25
- try {
26
- await fn(inlineContext);
27
- }
28
- catch {
29
- return;
30
- }
31
- throw new Error(`expected to throw: ${name}`);
32
- }
33
- else {
34
- await fn(inlineContext);
35
- }
36
- };
37
- const inlineContext = { test: inlineTest };
38
- const wrapInlineTest = (register) => ({
39
- test: (name, opts, fn) => register(name, () => inlineTest(name, opts, fn))
40
- });
41
- const bunTestContext = wrapInlineTest(testContext.test);
42
- const playwrightTestContext = wrapInlineTest(pwTest);
43
- const prefix = 'file:///';
44
- const { now } = Date;
45
- /** Maps `WriteConsoles` names to the corresponding Node.js writable streams. */
46
- const streams = {
47
- stdout: process.stdout,
48
- stderr: process.stderr,
49
- };
50
- /**
51
- * Writes `data` to `stream` respecting Node.js backpressure.
52
- *
53
- * `stream.write()` returns `false` when the internal buffer is full; the data
54
- * is already buffered at that point (no retry needed) but the caller must not
55
- * issue more writes until the `'drain'` event fires. Waiting here throttles the
56
- * producer to the speed of the OS consumer, preventing unbounded memory growth
57
- * when many large messages arrive faster than they can be flushed.
58
- *
59
- * When the buffer is not full `write()` returns `true` and we return
60
- * immediately, so large computations with occasional prints never stall.
61
- *
62
- * @see {@link https://nodejs.org/api/stream.html#writablewritechunk}
63
- */
64
- const writeAll = async (stream, data) => {
65
- if (!stream.write(data)) {
66
- await once(stream, 'drain');
67
- }
68
- };
69
- export const asyncImport = (v) => import(__rewriteRelativeImportExtension(v));
70
- export const tryCatch = f => {
71
- try {
72
- return ok(f());
73
- }
74
- catch (e) {
75
- return error(e);
76
- }
77
- };
78
- const awaitPromise = async (p) => [p instanceof Promise ? await p : p];
79
- export const io = {
80
- console,
81
- fs,
82
- process,
83
- asyncImport: (v) => {
84
- const s0 = v.includes(':') || v.startsWith('/') ? v : concat(process.cwd())(v);
85
- const s1 = s0.startsWith(prefix) ? s0 : `${prefix}${s0}`;
86
- return asyncImport(s1);
87
- },
88
- performance,
89
- fetch,
90
- tryCatch,
91
- asyncTryCatch: async (f) => {
92
- try {
93
- return ok(await f());
94
- }
95
- catch (e) {
96
- return error(e);
97
- }
98
- },
99
- http,
100
- childProcess,
101
- now,
102
- sandbox: async (f) => {
103
- let result;
104
- let after;
105
- const before = performance.now();
106
- try {
107
- let p = f();
108
- after = performance.now();
109
- if (p instanceof Promise) {
110
- p = await p;
111
- after = performance.now();
112
- }
113
- result = ok(p);
114
- }
115
- catch (e) {
116
- after = performance.now();
117
- result = error(e);
118
- }
119
- return { result, duration: after - before };
120
- },
121
- write: (stream, data) => writeAll(streams[stream], fromVec(data)),
122
- await: awaitPromise,
123
- testContext,
124
- bunTestContext,
125
- playwrightTestContext,
126
- engine: isPlaywright ? 'playwright' : 'Bun' in globalThis ? 'bun' : 'node',
127
- };
128
- const effectRun = async (p) => {
129
- const code = await runProgram(io)(io.process.argv.slice(2))(p);
130
- return process.exit(code);
131
- };
132
- export default effectRun;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes