functionalscript 0.6.5 → 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.
@@ -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
@@ -17,6 +17,7 @@ export const io = {
17
17
  process,
18
18
  asyncImport: (v) => import(__rewriteRelativeImportExtension(`${prefix}${concat(process.cwd())(v)}`)),
19
19
  performance,
20
+ fetch,
20
21
  tryCatch: f => {
21
22
  try {
22
23
  return ['ok', f()];
@@ -0,0 +1,3 @@
1
+ import type { Io } from '../module.f.ts';
2
+ import { type OrderedMap } from '../../types/ordered_map/module.f.ts';
3
+ export declare const createVirtualIo: (files: OrderedMap<string>) => Io;
@@ -1,4 +1,4 @@
1
- import { at } from "../types/ordered_map/module.f.js";
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.5",
3
+ "version": "0.6.6",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "**/*.js",
package/io/virtual.f.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import type { Io } from './module.f.ts';
2
- import { type OrderedMap } from '../types/ordered_map/module.f.ts';
3
- export declare const createVirtualIo: (files: OrderedMap<string>) => Io;