@wtf/platform 2.0.0 → 2.1.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.
package/README.md CHANGED
@@ -29,6 +29,7 @@ from `@wtf/platform-browser`, one in memory from `@wtf/platform-memory`, and a t
29
29
  | `./dirs` | `Dirs`, `PlatformFacts` (`cwd` too), `AppDirs` | `dirsOf({ facts, env })`; `testDirs(facts)` |
30
30
  | `./terminal` | `Terminal` | `colorDepthOf(stream, env)`; `testTerminal({ input })` |
31
31
  | `./open` | `Open` | `printOpen({ console })`; `memoryOpen()` |
32
+ | `./module` | `LoadModule` | types only |
32
33
  | `./process` | `Spawn`, `ChildProcess`, `ProcessStatus`, `ProcessSignal`, … | `exec(spawn, command, args, { cwd, env, input, signal })` |
33
34
  | `./runtime` | `Program`, `Interrupts`, `Exit`, `ExitCode` | `runMain(program, { platform, interrupts, exit })`; `manualInterrupts()` |
34
35
  | `./errors` | `PlatformError` | `BadArgument`, `SystemError` with a `reason`, `isPlatformError` |
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Loading a module a program is told of as it runs: {@link LoadModule}, what loads the module a
3
+ * name or a path names, and gives the object of its exports, as a configuration names a plugin of
4
+ * a tool. JavaScript's `import()` loads a module of a specifier, but no web standard says where a
5
+ * name is looked for, of which folder, nor what a path is relative to, so the loader is our own.
6
+ * Node's is `nodeLoadModule` of `@wtf/platform-node/module`, which looks from the root of a
7
+ * project. Types only, with no code.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ /**
12
+ * Loads the module `module` names, a path or the name of a package, as the loader that was made
13
+ * resolves it, and gives the object of its exports, as `import()` does. A module that cannot be
14
+ * found or loaded rejects: a test passes a function of its own, of the modules it means.
15
+ */
16
+ export type LoadModule = (module: string) => Promise<unknown>;
package/dist/module.js ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Loading a module a program is told of as it runs: {@link LoadModule}, what loads the module a
3
+ * name or a path names, and gives the object of its exports, as a configuration names a plugin of
4
+ * a tool. JavaScript's `import()` loads a module of a specifier, but no web standard says where a
5
+ * name is looked for, of which folder, nor what a path is relative to, so the loader is our own.
6
+ * Node's is `nodeLoadModule` of `@wtf/platform-node/module`, which looks from the root of a
7
+ * project. Types only, with no code.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG","sourcesContent":["/**\n * Loading a module a program is told of as it runs: {@link LoadModule}, what loads the module a\n * name or a path names, and gives the object of its exports, as a configuration names a plugin of\n * a tool. JavaScript's `import()` loads a module of a specifier, but no web standard says where a\n * name is looked for, of which folder, nor what a path is relative to, so the loader is our own.\n * Node's is `nodeLoadModule` of `@wtf/platform-node/module`, which looks from the root of a\n * project. Types only, with no code.\n *\n * @packageDocumentation\n */\n\n/**\n * Loads the module `module` names, a path or the name of a package, as the loader that was made\n * resolves it, and gives the object of its exports, as `import()` does. A module that cannot be\n * found or loaded rejects: a test passes a function of its own, of the modules it means.\n */\nexport type LoadModule = (module: string) => Promise<unknown>\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wtf/platform",
3
- "version": "2.0.0",
4
- "description": "The Platform type your code takes instead of globals, with helpers such as sleep and randomId, and a test double for each member. Web standards first: timers, crypto, console, locks, storage, channels, workers and fetch keep the standards' names; env, path, dirs, terminal, open and spawn are added where no standard exists.",
3
+ "version": "2.1.0",
4
+ "description": "The Platform type your code takes instead of globals, with helpers such as sleep and randomId, and a test double for each member. Web standards first: timers, crypto, console, locks, storage, channels, workers and fetch keep the standards' names; env, path, dirs, terminal, open, spawn and LoadModule, the loader of a module by its name, are added where no standard exists.",
5
5
  "homepage": "https://gitlab.com/wetryfun/platform/platform/-/tree/main/packages/platform",
6
6
  "bugs": {
7
7
  "url": "https://gitlab.com/wetryfun/platform/platform/-/issues"
@@ -74,6 +74,10 @@
74
74
  "types": "./dist/open.d.ts",
75
75
  "default": "./dist/open.js"
76
76
  },
77
+ "./module": {
78
+ "types": "./dist/module.d.ts",
79
+ "default": "./dist/module.js"
80
+ },
77
81
  "./process": {
78
82
  "types": "./dist/process.d.ts",
79
83
  "default": "./dist/process.js"