functionalscript 0.6.0 → 0.6.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.
@@ -0,0 +1,3 @@
1
+ import { index } from "../module.f.js";
2
+ import node from "../../io/module.js";
3
+ await node(index);
package/io/module.f.d.ts CHANGED
@@ -13,6 +13,13 @@ export type Dirent = {
13
13
  readonly isDirectory: () => boolean;
14
14
  readonly isFile: () => boolean;
15
15
  };
16
+ export type RmOptions = {
17
+ readonly force?: boolean;
18
+ readonly recursive?: boolean;
19
+ };
20
+ export type MakeDirectoryOptions = {
21
+ readonly recursive?: boolean;
22
+ };
16
23
  /**
17
24
  * File system operations interface
18
25
  * @see https://nodejs.org/api/fs.html
@@ -27,6 +34,9 @@ export type Fs = {
27
34
  readonly readdir: (path: string, options: {
28
35
  withFileTypes: true;
29
36
  }) => Promise<Dirent[]>;
37
+ readonly rm: (path: string, options?: RmOptions) => Promise<void>;
38
+ readonly mkdir: (path: string, options?: MakeDirectoryOptions) => Promise<string | undefined>;
39
+ readonly copyFile: (src: string, dest: string) => Promise<void>;
30
40
  };
31
41
  };
32
42
  /**
@@ -77,7 +87,8 @@ export type Process = {
77
87
  export type Env = {
78
88
  readonly [k: string]: string | undefined;
79
89
  };
80
- export type Run = (f: (io: Io) => Promise<number>) => Promise<never>;
90
+ export type App = (io: Io) => Promise<number>;
91
+ export type Run = (f: App) => Promise<never>;
81
92
  /**
82
93
  * Runs a function and exits the process with the returned code
83
94
  * Handles errors by exiting with code 1
package/io/virtual.f.js CHANGED
@@ -12,6 +12,9 @@ export const createVirtualIo = (files) => ({
12
12
  readdir: (_path) => Promise.resolve([]),
13
13
  readFile: (_path, _options) => Promise.resolve(''),
14
14
  writeFile: (_path, _data, _options) => Promise.resolve(),
15
+ rm: (_path, _options) => Promise.resolve(),
16
+ mkdir: (_path, _options) => Promise.resolve(undefined),
17
+ copyFile: (_src, _dest) => Promise.resolve(),
15
18
  }
16
19
  },
17
20
  process: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "functionalscript",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "**/*.js",
@@ -15,12 +15,12 @@
15
15
  "test20": "npm run tsc-emit && npm run n ./dev/test/module.js",
16
16
  "test22": "tsc && npm run n -- --experimental-strip-types ./dev/test/module.ts",
17
17
  "test": "tsc && npm run n ./dev/test/module.ts",
18
- "index": "npm run n ./dev/index.ts",
18
+ "index": "npm run n ./dev/index/module.ts",
19
19
  "fsc": "npm run n ./fsc/module.ts",
20
20
  "update": "npm run index && npm install"
21
21
  },
22
22
  "engines": {
23
- "node": ">=16"
23
+ "node": ">=20"
24
24
  },
25
25
  "bin": {
26
26
  "fsc": "fsc/module.js"
package/dev/index.js DELETED
@@ -1,3 +0,0 @@
1
- import { index } from "./module.f.js";
2
- import node from "../io/module.js";
3
- await node(index);
File without changes