functionalscript 0.6.4 → 0.6.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/dev/module.f.js +11 -7
- package/dev/test/module.d.ts +1 -0
- package/dev/test/module.js +1 -0
- package/djs/transpiler/test.f.js +1 -1
- package/io/module.f.d.ts +11 -10
- package/io/module.js +1 -0
- package/io/virtual/module.f.d.ts +3 -0
- package/io/{virtual.f.js → virtual/module.f.js} +2 -1
- package/package.json +2 -2
- package/io/virtual.f.d.ts +0 -3
package/dev/module.f.js
CHANGED
|
@@ -12,15 +12,19 @@ export const allFiles = ({ fs: { promises: { readdir } } }) => {
|
|
|
12
12
|
let result = [];
|
|
13
13
|
for (const i of await readdir(p, { withFileTypes: true })) {
|
|
14
14
|
const { name } = i;
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
if (name.startsWith('.')) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const file = `${p}/${name}`;
|
|
19
|
+
if (i.isDirectory()) {
|
|
20
|
+
if (name === 'node_modules') {
|
|
19
21
|
continue;
|
|
20
22
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
result = [...result, ...await load(file)];
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (name.endsWith('.js') || name.endsWith('.ts')) {
|
|
27
|
+
result = [...result, file];
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
return result;
|
package/dev/test/module.d.ts
CHANGED
package/dev/test/module.js
CHANGED
package/djs/transpiler/test.f.js
CHANGED
|
@@ -2,7 +2,7 @@ import { sort } from "../../types/object/module.f.js";
|
|
|
2
2
|
import { setReplace } from "../../types/ordered_map/module.f.js";
|
|
3
3
|
import { transpile } from "./module.f.js";
|
|
4
4
|
import { stringify } from "../serializer/module.f.js";
|
|
5
|
-
import { createVirtualIo } from "../../io/virtual.f.js";
|
|
5
|
+
import { createVirtualIo } from "../../io/virtual/module.f.js";
|
|
6
6
|
const virtualFs = map => {
|
|
7
7
|
return createVirtualIo(map).fs;
|
|
8
8
|
};
|
package/io/module.f.d.ts
CHANGED
|
@@ -60,6 +60,16 @@ export type Module = {
|
|
|
60
60
|
export type Performance = {
|
|
61
61
|
readonly now: () => number;
|
|
62
62
|
};
|
|
63
|
+
/**
|
|
64
|
+
* Node.js Process interface
|
|
65
|
+
* @see https://nodejs.org/api/process.html
|
|
66
|
+
*/
|
|
67
|
+
export type Process = {
|
|
68
|
+
readonly argv: string[];
|
|
69
|
+
readonly env: Env;
|
|
70
|
+
readonly exit: (code: number) => never;
|
|
71
|
+
readonly cwd: () => string;
|
|
72
|
+
};
|
|
63
73
|
/**
|
|
64
74
|
* Core IO operations interface providing access to system resources
|
|
65
75
|
*/
|
|
@@ -69,19 +79,10 @@ export type Io = {
|
|
|
69
79
|
readonly process: Process;
|
|
70
80
|
readonly asyncImport: (s: string) => Promise<Module>;
|
|
71
81
|
readonly performance: Performance;
|
|
82
|
+
readonly fetch: (url: string) => Promise<Response>;
|
|
72
83
|
readonly tryCatch: <T>(f: () => T) => Result<T, unknown>;
|
|
73
84
|
readonly asyncTryCatch: <T>(f: () => Promise<T>) => Promise<Result<T, unknown>>;
|
|
74
85
|
};
|
|
75
|
-
/**
|
|
76
|
-
* Node.js Process interface
|
|
77
|
-
* @see https://nodejs.org/api/process.html
|
|
78
|
-
*/
|
|
79
|
-
export type Process = {
|
|
80
|
-
readonly argv: string[];
|
|
81
|
-
readonly env: Env;
|
|
82
|
-
readonly exit: (code: number) => never;
|
|
83
|
-
readonly cwd: () => string;
|
|
84
|
-
};
|
|
85
86
|
/**
|
|
86
87
|
* The environment variables.
|
|
87
88
|
*/
|
package/io/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { at } from "
|
|
1
|
+
import { at } from "../../types/ordered_map/module.f.js";
|
|
2
2
|
export const createVirtualIo = (files) => ({
|
|
3
3
|
console: {
|
|
4
4
|
log: (..._d) => { },
|
|
@@ -27,6 +27,7 @@ export const createVirtualIo = (files) => ({
|
|
|
27
27
|
performance: {
|
|
28
28
|
now: () => 0,
|
|
29
29
|
},
|
|
30
|
+
fetch: () => Promise.reject(),
|
|
30
31
|
tryCatch: f => ['ok', f()],
|
|
31
32
|
asyncTryCatch: async (f) => ['ok', await f()],
|
|
32
33
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "functionalscript",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"**/*.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/functionalscript/functionalscript#readme",
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/node": "^22.14",
|
|
49
|
+
"@types/node": "^22.14.1",
|
|
50
50
|
"typescript": "^5.8.3"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/io/virtual.f.d.ts
DELETED