@kumori/kdsl 0.0.14 → 0.0.16
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/dist/build/deployment_spec.d.ts +2586 -0
- package/dist/build/deployment_spec.js +293 -0
- package/dist/build/deployment_spec.js.map +1 -0
- package/dist/build/helpers/builtin.d.ts +17 -0
- package/dist/build/helpers/builtin.js +80 -0
- package/dist/build/helpers/builtin.js.map +1 -0
- package/dist/build/helpers/component.d.ts +17 -0
- package/dist/build/helpers/component.js +212 -0
- package/dist/build/helpers/component.js.map +1 -0
- package/dist/build/helpers/connector.d.ts +13 -0
- package/dist/build/helpers/connector.js +189 -0
- package/dist/build/helpers/connector.js.map +1 -0
- package/dist/build/helpers/deployment.d.ts +326 -0
- package/dist/build/helpers/deployment.js +85 -0
- package/dist/build/helpers/deployment.js.map +1 -0
- package/dist/build/helpers/resource.d.ts +97 -0
- package/dist/build/helpers/resource.js +54 -0
- package/dist/build/helpers/resource.js.map +1 -0
- package/dist/build/helpers/service.d.ts +27 -0
- package/dist/build/helpers/service.js +196 -0
- package/dist/build/helpers/service.js.map +1 -0
- package/dist/build/helpers/utils.d.ts +30 -0
- package/dist/build/helpers/utils.js +77 -0
- package/dist/build/helpers/utils.js.map +1 -0
- package/dist/build/main.d.ts +17 -0
- package/dist/build/main.js +188 -0
- package/dist/build/main.js.map +1 -0
- package/dist/build/solution.d.ts +20 -0
- package/dist/build/solution.js +71 -0
- package/dist/build/solution.js.map +1 -0
- package/dist/check/main.d.ts +21 -0
- package/dist/check/main.js +99 -0
- package/dist/check/main.js.map +1 -0
- package/dist/clean/main.d.ts +11 -0
- package/dist/clean/main.js +26 -0
- package/dist/clean/main.js.map +1 -0
- package/dist/deployment/gen/deployment-template.kumori +33 -0
- package/dist/deployment/gen/main.d.ts +15 -0
- package/dist/deployment/gen/main.js +158 -0
- package/dist/deployment/gen/main.js.map +1 -0
- package/dist/deployment/gen/types.d.ts +27 -0
- package/dist/deployment/gen/types.js +2 -0
- package/dist/deployment/gen/types.js.map +1 -0
- package/dist/deployment/main.d.ts +8 -0
- package/dist/deployment/main.js +17 -0
- package/dist/deployment/main.js.map +1 -0
- package/dist/help/main.d.ts +13 -0
- package/dist/help/main.js +49 -0
- package/dist/help/main.js.map +1 -0
- package/dist/help/topic/build.d.ts +2 -0
- package/dist/help/topic/build.js +7 -0
- package/dist/help/topic/build.js.map +1 -0
- package/dist/help/topic/mod_dep.d.ts +2 -0
- package/dist/help/topic/mod_dep.js +8 -0
- package/dist/help/topic/mod_dep.js.map +1 -0
- package/dist/help/topic/mod_dl.d.ts +2 -0
- package/dist/help/topic/mod_dl.js +25 -0
- package/dist/help/topic/mod_dl.js.map +1 -0
- package/dist/index/create/main.d.ts +14 -0
- package/dist/index/create/main.js +286 -0
- package/dist/index/create/main.js.map +1 -0
- package/dist/index/main.d.ts +8 -0
- package/dist/index/main.js +17 -0
- package/dist/index/main.js.map +1 -0
- package/dist/lib/build.d.ts +42 -0
- package/dist/lib/build.js +42 -0
- package/dist/lib/build.js.map +1 -0
- package/dist/lib/check.d.ts +41 -0
- package/dist/lib/check.js +45 -0
- package/dist/lib/check.js.map +1 -0
- package/dist/lib/clean.d.ts +31 -0
- package/dist/lib/clean.js +39 -0
- package/dist/lib/clean.js.map +1 -0
- package/dist/lib/deployment.d.ts +35 -0
- package/dist/lib/deployment.js +31 -0
- package/dist/lib/deployment.js.map +1 -0
- package/dist/lib/index-cmd.d.ts +54 -0
- package/dist/lib/index-cmd.js +60 -0
- package/dist/lib/index-cmd.js.map +1 -0
- package/dist/lib/index.d.ts +58 -0
- package/dist/lib/index.js +54 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/io/lib.kumori +5 -0
- package/dist/lib/kumori/builtin/httpinbound.h.kumori +27 -0
- package/dist/lib/kumori/builtin/tcpinbound.h.kumori +25 -0
- package/dist/lib/kumori/builtin.kumori +18 -0
- package/dist/lib/kumori/component.kumori +120 -0
- package/dist/lib/kumori/deployment.kumori +16 -0
- package/dist/lib/kumori/resource.kumori +25 -0
- package/dist/lib/kumori/service.kumori +49 -0
- package/dist/lib/kumori/shared.kumori +11 -0
- package/dist/lib/kumori/sized.kumori +25 -0
- package/dist/lib/logger.d.ts +10 -0
- package/dist/lib/logger.js +23 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/mod.d.ts +156 -0
- package/dist/lib/mod.js +144 -0
- package/dist/lib/mod.js.map +1 -0
- package/dist/lib/registry.d.ts +61 -0
- package/dist/lib/registry.js +67 -0
- package/dist/lib/registry.js.map +1 -0
- package/dist/lib/sized.kumori +8 -0
- package/dist/lib/std.kumori +8 -0
- package/dist/lib/strconv/lib.kumori +11 -0
- package/dist/lib/types.d.ts +26 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +37 -0
- package/dist/main.js.map +1 -0
- package/dist/mod/checksum/main.d.ts +11 -0
- package/dist/mod/checksum/main.js +33 -0
- package/dist/mod/checksum/main.js.map +1 -0
- package/dist/mod/dependency/main.d.ts +19 -0
- package/dist/mod/dependency/main.js +163 -0
- package/dist/mod/dependency/main.js.map +1 -0
- package/dist/mod/download/functions.d.ts +53 -0
- package/dist/mod/download/functions.js +235 -0
- package/dist/mod/download/functions.js.map +1 -0
- package/dist/mod/download/main.d.ts +26 -0
- package/dist/mod/download/main.js +99 -0
- package/dist/mod/download/main.js.map +1 -0
- package/dist/mod/init/main.d.ts +13 -0
- package/dist/mod/init/main.js +66 -0
- package/dist/mod/init/main.js.map +1 -0
- package/dist/mod/jsonschema/gen/main.d.ts +11 -0
- package/dist/mod/jsonschema/gen/main.js +288 -0
- package/dist/mod/jsonschema/gen/main.js.map +1 -0
- package/dist/mod/jsonschema/get/kdslschema.d.ts +28 -0
- package/dist/mod/jsonschema/get/kdslschema.js +3 -0
- package/dist/mod/jsonschema/get/kdslschema.js.map +1 -0
- package/dist/mod/jsonschema/get/main.d.ts +76 -0
- package/dist/mod/jsonschema/get/main.js +346 -0
- package/dist/mod/jsonschema/get/main.js.map +1 -0
- package/dist/mod/jsonschema/main.d.ts +8 -0
- package/dist/mod/jsonschema/main.js +20 -0
- package/dist/mod/jsonschema/main.js.map +1 -0
- package/dist/mod/main.d.ts +8 -0
- package/dist/mod/main.js +27 -0
- package/dist/mod/main.js.map +1 -0
- package/dist/mod/update/main.d.ts +17 -0
- package/dist/mod/update/main.js +68 -0
- package/dist/mod/update/main.js.map +1 -0
- package/dist/registry/add.d.ts +15 -0
- package/dist/registry/add.js +58 -0
- package/dist/registry/add.js.map +1 -0
- package/dist/registry/list.d.ts +15 -0
- package/dist/registry/list.js +29 -0
- package/dist/registry/list.js.map +1 -0
- package/dist/registry/main.d.ts +8 -0
- package/dist/registry/main.js +21 -0
- package/dist/registry/main.js.map +1 -0
- package/dist/registry/remove.d.ts +15 -0
- package/dist/registry/remove.js +34 -0
- package/dist/registry/remove.js.map +1 -0
- package/dist/util/err-format.d.ts +2 -0
- package/dist/util/err-format.js +10 -0
- package/dist/util/err-format.js.map +1 -0
- package/dist/util/err-handler.d.ts +3 -0
- package/dist/util/err-handler.js +11 -0
- package/dist/util/err-handler.js.map +1 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.js +2 -0
- package/dist/util.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/out/deployment/gen/deployment-template.kumori +33 -0
- package/out/deployment-template.kumori +33 -0
- package/out/main.cjs +378 -209
- package/package.json +67 -17
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { LibraryOptions, LibraryResult } from "./types.js";
|
|
2
|
+
import { KDSLSchemaV1 } from "../mod/jsonschema/get/kdslschema.js";
|
|
3
|
+
export interface ModuleInitOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Module name (e.g., kumori.systems/my-module)
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* Module version
|
|
10
|
+
*/
|
|
11
|
+
version: string;
|
|
12
|
+
/**
|
|
13
|
+
* Location to create the module under.
|
|
14
|
+
* Defaults to current directory.
|
|
15
|
+
*/
|
|
16
|
+
location?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Location to store cached modules.
|
|
19
|
+
* Defaults to .kumori/mod
|
|
20
|
+
*/
|
|
21
|
+
cacheLocation?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Working directory. Defaults to process.cwd()
|
|
24
|
+
*/
|
|
25
|
+
cwd?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Optional logger for output.
|
|
28
|
+
*/
|
|
29
|
+
logger?: LibraryOptions["logger"];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Initialize a new Kumori module.
|
|
33
|
+
* Creates a new kumori.mod.json file.
|
|
34
|
+
*
|
|
35
|
+
* @param options - Module init options
|
|
36
|
+
* @returns Result with void on success, or string[] of errors
|
|
37
|
+
*/
|
|
38
|
+
export declare function moduleInit(options: ModuleInitOptions): Promise<LibraryResult<void>>;
|
|
39
|
+
export interface ModuleDependencyOptions extends LibraryOptions {
|
|
40
|
+
/**
|
|
41
|
+
* Module URL with @<tag> (e.g. github.com/org/repo@v1.2.3)
|
|
42
|
+
*/
|
|
43
|
+
module: string;
|
|
44
|
+
/**
|
|
45
|
+
* Alias for the dependency
|
|
46
|
+
*/
|
|
47
|
+
alias?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Specify a separate location for the headers module
|
|
50
|
+
*/
|
|
51
|
+
headers?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Remove the dependency
|
|
54
|
+
*/
|
|
55
|
+
remove?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Download the dependency after adding it
|
|
58
|
+
*/
|
|
59
|
+
download?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Add, update, or remove a dependency from the module declaration.
|
|
63
|
+
*
|
|
64
|
+
* @param options - Module dependency options
|
|
65
|
+
* @returns Result with void on success, or string[] of errors
|
|
66
|
+
*/
|
|
67
|
+
export declare function moduleDependency(options: ModuleDependencyOptions): Promise<LibraryResult<void>>;
|
|
68
|
+
export interface ModuleDownloadOptions extends LibraryOptions {
|
|
69
|
+
/**
|
|
70
|
+
* Modules to download. If not specified, downloads all dependencies
|
|
71
|
+
* of the current module.
|
|
72
|
+
*/
|
|
73
|
+
modules?: string[];
|
|
74
|
+
/**
|
|
75
|
+
* Do not log warnings
|
|
76
|
+
*/
|
|
77
|
+
quiet?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Download modules to local cache.
|
|
81
|
+
* With no arguments, downloads all modules needed to build the packages
|
|
82
|
+
* in the current module.
|
|
83
|
+
*
|
|
84
|
+
* @param options - Module download options
|
|
85
|
+
* @returns Result with void on success, or string[] of errors
|
|
86
|
+
*/
|
|
87
|
+
export declare function moduleDownload(options: ModuleDownloadOptions): Promise<LibraryResult<void>>;
|
|
88
|
+
export interface ModuleUpdateOptions {
|
|
89
|
+
/**
|
|
90
|
+
* New module version
|
|
91
|
+
*/
|
|
92
|
+
version?: string;
|
|
93
|
+
/**
|
|
94
|
+
* New cache location
|
|
95
|
+
*/
|
|
96
|
+
cacheLocation?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Location where the module to update is located.
|
|
99
|
+
* Defaults to current directory.
|
|
100
|
+
*/
|
|
101
|
+
path?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Working directory. Defaults to process.cwd()
|
|
104
|
+
*/
|
|
105
|
+
cwd?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Optional logger for output.
|
|
108
|
+
*/
|
|
109
|
+
logger?: LibraryOptions["logger"];
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Update an existing Kumori module's version or cache location.
|
|
113
|
+
*
|
|
114
|
+
* @param options - Module update options
|
|
115
|
+
* @returns Result with void on success, or string[] of errors
|
|
116
|
+
*/
|
|
117
|
+
export declare function moduleUpdate(options: ModuleUpdateOptions): Promise<LibraryResult<void>>;
|
|
118
|
+
export interface ModuleChecksumOptions extends LibraryOptions {
|
|
119
|
+
/**
|
|
120
|
+
* Directory containing the module.
|
|
121
|
+
* Defaults to cwd or '.'
|
|
122
|
+
*/
|
|
123
|
+
directory?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Generate SHA-256 checksum for a module.
|
|
127
|
+
*
|
|
128
|
+
* @param options - Module checksum options
|
|
129
|
+
* @returns Result with checksum string on success, or string[] of errors
|
|
130
|
+
*/
|
|
131
|
+
export declare function moduleChecksum(options: ModuleChecksumOptions): Promise<LibraryResult<string>>;
|
|
132
|
+
export interface ModuleSchemaGetOptions extends LibraryOptions {
|
|
133
|
+
/**
|
|
134
|
+
* Unique path of the module where the artifact is defined.
|
|
135
|
+
* Accepts remote targets (e.g., "github.com/MyOrg/component@v1.2.3")
|
|
136
|
+
* or local paths (e.g. "/abs/path/to/module", "../rel/path/to/module").
|
|
137
|
+
*/
|
|
138
|
+
target: string;
|
|
139
|
+
/**
|
|
140
|
+
* Relative path to the package that contains the artifact
|
|
141
|
+
* (e.g., "internal/service"). For artifacts in the module's root package, use ".".
|
|
142
|
+
*/
|
|
143
|
+
packagePath: string;
|
|
144
|
+
/**
|
|
145
|
+
* Name of the target artifact (e.g., "ExampleService").
|
|
146
|
+
*/
|
|
147
|
+
artifactName: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Extract JSON Schema for a specified module and artifact.
|
|
151
|
+
* Generates and outputs the JSON Schema that describes a particular Kumori DSL artifact.
|
|
152
|
+
*
|
|
153
|
+
* @param options - Module schema get options
|
|
154
|
+
* @returns Result with schema object on success, or string[] of errors
|
|
155
|
+
*/
|
|
156
|
+
export declare function moduleSchemaGet(options: ModuleSchemaGetOptions): Promise<LibraryResult<KDSLSchemaV1>>;
|
package/dist/lib/mod.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { getLogger } from "./logger.js";
|
|
2
|
+
import { URI } from "langium";
|
|
3
|
+
import { Result, Err, Ok } from "@kumori/kdsl-lsp/util/result.js";
|
|
4
|
+
/**
|
|
5
|
+
* Initialize a new Kumori module.
|
|
6
|
+
* Creates a new kumori.mod.json file.
|
|
7
|
+
*
|
|
8
|
+
* @param options - Module init options
|
|
9
|
+
* @returns Result with void on success, or string[] of errors
|
|
10
|
+
*/
|
|
11
|
+
export async function moduleInit(options) {
|
|
12
|
+
const log = getLogger(options.logger);
|
|
13
|
+
const { NewModule } = await import("../mod/init/main.js");
|
|
14
|
+
try {
|
|
15
|
+
const cwd = options.cwd ?? process.cwd();
|
|
16
|
+
// NewModule uses rest parameters that include commander args, we need to cast
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
await NewModule(log, cwd, options.name, options.version, options.location, options.cacheLocation);
|
|
19
|
+
return Ok(undefined);
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
return Err([String(err)]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Add, update, or remove a dependency from the module declaration.
|
|
27
|
+
*
|
|
28
|
+
* @param options - Module dependency options
|
|
29
|
+
* @returns Result with void on success, or string[] of errors
|
|
30
|
+
*/
|
|
31
|
+
export async function moduleDependency(options) {
|
|
32
|
+
const log = getLogger(options.logger);
|
|
33
|
+
const cwd = URI.file(options.cwd ?? process.cwd());
|
|
34
|
+
const { Dependency } = await import("../mod/dependency/main.js");
|
|
35
|
+
const { RegistryManager } = await import("@kumori/kdsl-lsp/module/registry/manager.js");
|
|
36
|
+
const manager = new RegistryManager();
|
|
37
|
+
await manager.ensureIndexes();
|
|
38
|
+
try {
|
|
39
|
+
await Dependency(log, cwd, options.module, {
|
|
40
|
+
alias: options.alias,
|
|
41
|
+
headers: options.headers,
|
|
42
|
+
remove: options.remove ? true : undefined,
|
|
43
|
+
download: options.download ? true : undefined,
|
|
44
|
+
});
|
|
45
|
+
return Ok(undefined);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
return Err([String(err)]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Download modules to local cache.
|
|
53
|
+
* With no arguments, downloads all modules needed to build the packages
|
|
54
|
+
* in the current module.
|
|
55
|
+
*
|
|
56
|
+
* @param options - Module download options
|
|
57
|
+
* @returns Result with void on success, or string[] of errors
|
|
58
|
+
*/
|
|
59
|
+
export async function moduleDownload(options) {
|
|
60
|
+
const log = getLogger(options.logger);
|
|
61
|
+
const { Download } = await import("../mod/download/main.js");
|
|
62
|
+
const { RegistryManager } = await import("@kumori/kdsl-lsp/module/registry/manager.js");
|
|
63
|
+
const manager = new RegistryManager();
|
|
64
|
+
await manager.ensureIndexes();
|
|
65
|
+
return await Download(log, options.services, options.cwd ?? process.cwd(), options.modules ?? [], { quiet: options.quiet ? true : undefined });
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Update an existing Kumori module's version or cache location.
|
|
69
|
+
*
|
|
70
|
+
* @param options - Module update options
|
|
71
|
+
* @returns Result with void on success, or string[] of errors
|
|
72
|
+
*/
|
|
73
|
+
export async function moduleUpdate(options) {
|
|
74
|
+
const log = getLogger(options.logger);
|
|
75
|
+
const { NewModule } = await import("../mod/update/main.js");
|
|
76
|
+
try {
|
|
77
|
+
await NewModule(log, options.cwd ?? process.cwd(), {
|
|
78
|
+
version: options.version,
|
|
79
|
+
cacheLocation: options.cacheLocation,
|
|
80
|
+
path: options.path,
|
|
81
|
+
});
|
|
82
|
+
return Ok(undefined);
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
return Err([String(err)]);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generate SHA-256 checksum for a module.
|
|
90
|
+
*
|
|
91
|
+
* @param options - Module checksum options
|
|
92
|
+
* @returns Result with checksum string on success, or string[] of errors
|
|
93
|
+
*/
|
|
94
|
+
export async function moduleChecksum(options) {
|
|
95
|
+
const { CalculateChecksum } = await import("@kumori/kdsl-lsp/module/integrity/checksum.js");
|
|
96
|
+
const { ModuleContext } = await import("@kumori/kdsl-lsp/module/context.js");
|
|
97
|
+
const { URI } = await import("langium");
|
|
98
|
+
const path = await import("node:path");
|
|
99
|
+
const fs = options.services.shared.workspace.FileSystemProvider;
|
|
100
|
+
const target = options.directory ?? options.cwd ?? ".";
|
|
101
|
+
const ctx = await ModuleContext(fs, URI.file(path.resolve(target)));
|
|
102
|
+
if (Result.isErr(ctx)) {
|
|
103
|
+
return Err([ctx.err]);
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const checksum = await CalculateChecksum(ctx.value.Current.Root.fsPath);
|
|
107
|
+
return Ok(checksum);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
return Err([String(err)]);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Extract JSON Schema for a specified module and artifact.
|
|
115
|
+
* Generates and outputs the JSON Schema that describes a particular Kumori DSL artifact.
|
|
116
|
+
*
|
|
117
|
+
* @param options - Module schema get options
|
|
118
|
+
* @returns Result with schema object on success, or string[] of errors
|
|
119
|
+
*/
|
|
120
|
+
export async function moduleSchemaGet(options) {
|
|
121
|
+
const log = getLogger(options.logger);
|
|
122
|
+
const { LocateModule, GetSchema } = await import("../mod/jsonschema/get/main.js");
|
|
123
|
+
const { ModuleContext } = await import("@kumori/kdsl-lsp/module/context.js");
|
|
124
|
+
const { Check } = await import("../check/main.js");
|
|
125
|
+
const { URI } = await import("langium");
|
|
126
|
+
const svcs = options.services;
|
|
127
|
+
const fs = svcs.shared.workspace.FileSystemProvider;
|
|
128
|
+
const locResult = await LocateModule(options.target);
|
|
129
|
+
if (Result.isErr(locResult)) {
|
|
130
|
+
return locResult;
|
|
131
|
+
}
|
|
132
|
+
const ctx = await ModuleContext(fs, URI.file(locResult.value.fsPath));
|
|
133
|
+
if (Result.isErr(ctx)) {
|
|
134
|
+
return Err([ctx.err]);
|
|
135
|
+
}
|
|
136
|
+
// Download dependencies
|
|
137
|
+
const checkResult = await Check(log, svcs, ctx.value);
|
|
138
|
+
if (Result.isErr(checkResult)) {
|
|
139
|
+
return checkResult;
|
|
140
|
+
}
|
|
141
|
+
// Get the schema
|
|
142
|
+
return await GetSchema(svcs, ctx.value, options.packagePath, options.artifactName);
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=mod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/lib/mod.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,iCAAiC,CAAA;AAqCjE;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAA0B;IAE1B,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACrC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAA;IAEzD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;QACxC,8EAA8E;QAC9E,8DAA8D;QAC9D,MAAO,SAAiB,CACtB,GAAG,EACH,GAAG,EACH,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,aAAa,CACtB,CAAA;QACD,OAAO,EAAE,CAAO,SAAS,CAAC,CAAA;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAC3B,CAAC;AACH,CAAC;A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AC5E,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAA;IAClD,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAA;IAEvC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAA;IAC7B,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAA;IAEnD,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACpD,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;IACrE,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IACvB,CAAC;IAED,wBAAwB;IACxB,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;IACrD,IAAI,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC;QAC9B,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,iBAAiB;IACjB,OAAO,MAAM,SAAS,CACpB,IAAI,EACJ,GAAG,CAAC,KAAK,EACT,OAAO,CAAC,WAAW,EACnB,OAAO,CAAC,YAAY,CACrB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { LibraryOptions, LibraryResult } from "./types.js";
|
|
2
|
+
import { Registry } from "@kumori/kdsl-lsp/module/registry/types.js";
|
|
3
|
+
export interface RegistryAddOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Name selector for matching dependencies
|
|
6
|
+
*/
|
|
7
|
+
selector: string;
|
|
8
|
+
/**
|
|
9
|
+
* URL that contains the registry index for resolving modules
|
|
10
|
+
*/
|
|
11
|
+
url: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional token for authentication.
|
|
14
|
+
*/
|
|
15
|
+
token?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional logger for output.
|
|
18
|
+
*/
|
|
19
|
+
logger?: LibraryOptions["logger"];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Add a registry to the resolver configuration.
|
|
23
|
+
*
|
|
24
|
+
* The selector argument is used to match artifacts. For example, a registry
|
|
25
|
+
* with Index URL "https://github.com/kumori" and selector "kumori.systems"
|
|
26
|
+
* will resolve dependencies starting with "kumori.systems".
|
|
27
|
+
*
|
|
28
|
+
* @param options - Registry add options
|
|
29
|
+
* @returns Result with void on success, or string[] of errors
|
|
30
|
+
*/
|
|
31
|
+
export declare function registryAdd(options: RegistryAddOptions): Promise<LibraryResult<void>>;
|
|
32
|
+
export interface RegistryListOptions {
|
|
33
|
+
/**
|
|
34
|
+
* Optional logger for output.
|
|
35
|
+
*/
|
|
36
|
+
logger?: LibraryOptions["logger"];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* List all configured registries.
|
|
40
|
+
*
|
|
41
|
+
* @param options - Registry list options
|
|
42
|
+
* @returns Result with array of registry objects on success, or string[] of errors
|
|
43
|
+
*/
|
|
44
|
+
export declare function registryList(options?: RegistryListOptions): Promise<LibraryResult<Registry[]>>;
|
|
45
|
+
export interface RegistryRemoveOptions {
|
|
46
|
+
/**
|
|
47
|
+
* Name of the registry to remove
|
|
48
|
+
*/
|
|
49
|
+
name: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional logger for output.
|
|
52
|
+
*/
|
|
53
|
+
logger?: LibraryOptions["logger"];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Remove a configured registry by name.
|
|
57
|
+
*
|
|
58
|
+
* @param options - Registry remove options
|
|
59
|
+
* @returns Result with void on success, or string[] of errors
|
|
60
|
+
*/
|
|
61
|
+
export declare function registryRemove(options: RegistryRemoveOptions): Promise<LibraryResult<void>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { getLogger } from "./logger.js";
|
|
2
|
+
import { RegistryManager } from "@kumori/kdsl-lsp/module/registry/manager.js";
|
|
3
|
+
import { Ok, Err } from "@kumori/kdsl-lsp/util/result.js";
|
|
4
|
+
/**
|
|
5
|
+
* Add a registry to the resolver configuration.
|
|
6
|
+
*
|
|
7
|
+
* The selector argument is used to match artifacts. For example, a registry
|
|
8
|
+
* with Index URL "https://github.com/kumori" and selector "kumori.systems"
|
|
9
|
+
* will resolve dependencies starting with "kumori.systems".
|
|
10
|
+
*
|
|
11
|
+
* @param options - Registry add options
|
|
12
|
+
* @returns Result with void on success, or string[] of errors
|
|
13
|
+
*/
|
|
14
|
+
export async function registryAdd(options) {
|
|
15
|
+
const log = getLogger(options.logger);
|
|
16
|
+
const manager = new RegistryManager();
|
|
17
|
+
const registry = {
|
|
18
|
+
selector: options.selector,
|
|
19
|
+
repoUrl: options.url,
|
|
20
|
+
token: options.token,
|
|
21
|
+
};
|
|
22
|
+
try {
|
|
23
|
+
await manager.add(registry);
|
|
24
|
+
log.info(`Registry '${options.selector}' added at ${options.url}`);
|
|
25
|
+
return Ok(undefined);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return Err([`Failed to add registry: ${err}`]);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* List all configured registries.
|
|
33
|
+
*
|
|
34
|
+
* @param options - Registry list options
|
|
35
|
+
* @returns Result with array of registry objects on success, or string[] of errors
|
|
36
|
+
*/
|
|
37
|
+
export async function registryList(options = {}) {
|
|
38
|
+
const log = getLogger(options.logger);
|
|
39
|
+
const manager = new RegistryManager();
|
|
40
|
+
try {
|
|
41
|
+
const registries = manager.list();
|
|
42
|
+
log.info("Configured Registries:");
|
|
43
|
+
return Ok(registries);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
return Err([`Failed to list registries: ${err}`]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Remove a configured registry by name.
|
|
51
|
+
*
|
|
52
|
+
* @param options - Registry remove options
|
|
53
|
+
* @returns Result with void on success, or string[] of errors
|
|
54
|
+
*/
|
|
55
|
+
export async function registryRemove(options) {
|
|
56
|
+
const log = getLogger(options.logger);
|
|
57
|
+
const manager = new RegistryManager();
|
|
58
|
+
try {
|
|
59
|
+
manager.remove(options.name);
|
|
60
|
+
log.info(`Registry '${options.name}' removed`);
|
|
61
|
+
return Ok(undefined);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
return Err([`Failed to remove registry: ${err}`]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/lib/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAA;AAyBzD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAA2B;IAE3B,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACrC,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAA;IAErC,MAAM,QAAQ,GAAG;QACf,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,GAAG;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAA;IAED,IAAI,CAAC;QACH,MA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AAG,CAAC,CAAC,8BAA8B,GAAG,EAAE,CAAC,CAAC,CAAA;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ILogLayer } from "loglayer";
|
|
2
|
+
import { KumoriServices } from "@kumori/kdsl-lsp/language/kumori.js";
|
|
3
|
+
import { Result } from "@kumori/kdsl-lsp/util/result.js";
|
|
4
|
+
/**
|
|
5
|
+
* Base options for all library functions
|
|
6
|
+
*/
|
|
7
|
+
export interface LibraryOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Kumori language services instance.
|
|
10
|
+
* Create using: createKumoriServices(NodeFileSystem).Kumori
|
|
11
|
+
*/
|
|
12
|
+
services: KumoriServices;
|
|
13
|
+
/**
|
|
14
|
+
* Optional logger for output.
|
|
15
|
+
* If not provided, a silent logger is used.
|
|
16
|
+
*/
|
|
17
|
+
logger?: ILogLayer;
|
|
18
|
+
/**
|
|
19
|
+
* Working directory. Defaults to process.cwd()
|
|
20
|
+
*/
|
|
21
|
+
cwd?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Standard result type for library functions
|
|
25
|
+
*/
|
|
26
|
+
export type LibraryResult<T> = Result<T, string[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":""}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function main(): Promise<void>;
|
package/dist/main.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import build from "./build/main.js";
|
|
3
|
+
import check from "./check/main.js";
|
|
4
|
+
import clean from "./clean/main.js";
|
|
5
|
+
import help from "./help/main.js";
|
|
6
|
+
import mod from "./mod/main.js";
|
|
7
|
+
import version from "./version.js";
|
|
8
|
+
import registry from "./registry/main.js";
|
|
9
|
+
import index from "./index/main.js";
|
|
10
|
+
import deployment from "./deployment/main.js";
|
|
11
|
+
import { LogLayer } from "loglayer";
|
|
12
|
+
import { TsLogTransport } from "@loglayer/transport-tslog";
|
|
13
|
+
import { Logger } from "tslog";
|
|
14
|
+
export async function main() {
|
|
15
|
+
const logger = new Logger({
|
|
16
|
+
type: "pretty",
|
|
17
|
+
hideLogPositionForProduction: true,
|
|
18
|
+
overwrite: {
|
|
19
|
+
transportFormatted: (markup, args, errs) => console.error(markup, ...args, ...errs),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const log = new LogLayer({ transport: new TsLogTransport({ logger }) });
|
|
23
|
+
const program = new Command("kdsl").version(version);
|
|
24
|
+
build.Register(program, log);
|
|
25
|
+
check.Register(program, log);
|
|
26
|
+
clean.Register(program, log);
|
|
27
|
+
help.Register(program);
|
|
28
|
+
mod.Register(program, log);
|
|
29
|
+
registry.Register(program, log);
|
|
30
|
+
index.Register(program, log);
|
|
31
|
+
deployment.Register(program, log);
|
|
32
|
+
await new Promise((resolve) => {
|
|
33
|
+
program.hook("postAction", () => resolve());
|
|
34
|
+
program.parse();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,KAAK,MAAM,iBAAiB,CAAA;AACnC,OAAO,KAAK,MAAM,iBAAiB,CAAA;AACnC,OAAO,KAAK,MAAM,iBAAiB,CAAA;AACnC,OAAO,IAAI,MAAM,gBAAgB,CAAA;AACjC,OAAO,GAAG,MAAM,eAAe,CAAA;AAC/B,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,QAAQ,MAAM,oBAAoB,CAAA;AACzC,OAAO,KAAK,MAAM,iBAAiB,CAAA;AACnC,OAAO,UAAU,MAAM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,EAAE;QAClC,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAA;QAC3C,OAAO,CAAC,KAAK,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import { CommanderActionParams } from "../../util.js";
|
|
3
|
+
export declare const Description: string;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
Register: typeof Register;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare function Register(cmd: Command): Command<[], {}, {}>;
|
|
9
|
+
export type Exec = CommanderActionParams<ReturnType<typeof Register>>;
|
|
10
|
+
export type Params = Parameters<Exec>;
|
|
11
|
+
export declare function Action(): Exec;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createKumoriServices } from "@kumori/kdsl-lsp/language/kumori.js";
|
|
2
|
+
import { ModuleContext } from "@kumori/kdsl-lsp/module/context.js";
|
|
3
|
+
import { CalculateChecksum } from "@kumori/kdsl-lsp/module/integrity/checksum.js";
|
|
4
|
+
import { Result } from "@kumori/kdsl-lsp/util/result.js";
|
|
5
|
+
import { URI } from "langium";
|
|
6
|
+
import { NodeFileSystem } from "langium/node";
|
|
7
|
+
const Summary = `generate checksum for a module`;
|
|
8
|
+
export const Description = `
|
|
9
|
+
Generates and outputs the sha-256 checksum for the current given module.
|
|
10
|
+
`.trim();
|
|
11
|
+
export default { Register };
|
|
12
|
+
export function Register(cmd) {
|
|
13
|
+
const c = cmd
|
|
14
|
+
.command("checksum")
|
|
15
|
+
.summary(Summary)
|
|
16
|
+
.description(Description)
|
|
17
|
+
.helpOption(true)
|
|
18
|
+
.action(Action());
|
|
19
|
+
return c;
|
|
20
|
+
}
|
|
21
|
+
export function Action() {
|
|
22
|
+
return async () => {
|
|
23
|
+
const svcs = createKumoriServices(NodeFileSystem).Kumori;
|
|
24
|
+
const fs = svcs.shared.workspace.FileSystemProvider;
|
|
25
|
+
const ctx = await ModuleContext(fs, URI.file(process.cwd()));
|
|
26
|
+
if (Result.isErr(ctx)) {
|
|
27
|
+
throw new Error(ctx.err);
|
|
28
|
+
}
|
|
29
|
+
const checksum = await CalculateChecksum(ctx.value.Current.Root.fsPath);
|
|
30
|
+
console.log(checksum);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/mod/checksum/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAExD,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C,MAAM,OAAO,GAAG,gCAAgC,CAAA;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG;;CAE1B,CAAC,IAAI,EAAE,CAAA;AAER,eAAe,EAAE,QAAQ,EAAE,CAAA;AAC3B,MAAM,UAAU,QAAQ,CAAC,GAAY;IACnC,MAAM,CAAC,GAAG,GAAG;SACV,OAAO,CAAC,UAAU,CAAC;SACnB,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,WAAW,CAAC;SACxB,UAAU,CAAC,IAAI,CAAC;SAChB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;IACnB,OAAO,CAAC,CAAA;AACV,CAAC;AAID,MAAM,UAAU,MAAM;IACpB,OAAO,KAAK,IAAI,EAAE;QAChB,MAAM,IAAI,GAAG,oBAAoB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAA;QACxD,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,kBAAkB,CAAA;QAEnD,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QAC5D,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC1B,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACvE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACvB,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import { URI } from "langium";
|
|
3
|
+
import { ILogLayer } from "loglayer";
|
|
4
|
+
import { CommanderActionParams } from "../../util.js";
|
|
5
|
+
export declare const Description: string;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
Register: typeof Register;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
export declare function Register(cmd: Command, log: ILogLayer): Command<[string], {
|
|
11
|
+
alias?: string | undefined;
|
|
12
|
+
headers?: string | undefined;
|
|
13
|
+
remove?: true | undefined;
|
|
14
|
+
download?: true | undefined;
|
|
15
|
+
}, {}>;
|
|
16
|
+
export type Exec = CommanderActionParams<ReturnType<typeof Register>>;
|
|
17
|
+
export declare function Action(log: ILogLayer): Exec;
|
|
18
|
+
export type Params = Parameters<Exec>;
|
|
19
|
+
export declare const Dependency: (log: ILogLayer, cwd: URI, module: Params[0], options: Params[1]) => Promise<void>;
|