@kumori/kdsl 0.0.13 → 0.0.15
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 +21095 -0
- package/dist/build/deployment_spec.js +292 -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 +82 -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 +190 -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 +86 -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 +199 -0
- package/dist/build/helpers/service.js.map +1 -0
- package/dist/build/helpers/utils.d.ts +22 -0
- package/dist/build/helpers/utils.js +55 -0
- package/dist/build/helpers/utils.js.map +1 -0
- package/dist/build/main.d.ts +17 -0
- package/dist/build/main.js +139 -0
- package/dist/build/main.js.map +1 -0
- package/dist/build/solution.d.ts +20 -0
- package/dist/build/solution.js +72 -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/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 +264 -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 +28 -0
- package/dist/lib/build.js.map +1 -0
- package/dist/lib/check.d.ts +41 -0
- package/dist/lib/check.js +15 -0
- package/dist/lib/check.js.map +1 -0
- package/dist/lib/clean.d.ts +31 -0
- package/dist/lib/clean.js +1 -0
- package/dist/lib/clean.js.map +1 -0
- package/dist/lib/index-cmd.d.ts +54 -0
- package/dist/lib/index-cmd.js +57 -0
- package/dist/lib/index-cmd.js.map +1 -0
- package/dist/lib/index.d.ts +56 -0
- package/dist/lib/index.js +117 -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 +70 -0
- package/dist/lib/mod.js.map +1 -0
- package/dist/lib/registry.d.ts +61 -0
- package/dist/lib/registry.js +1 -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 +35 -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 +156 -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 +89 -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 +281 -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 +338 -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 +69 -0
- package/dist/mod/update/main.js.map +1 -0
- package/dist/registry/add.d.ts +15 -0
- package/dist/registry/add.js +53 -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 +11 -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 +6 -0
- package/dist/version.js.map +1 -0
- package/out/lib/build.cjs +29 -0
- package/out/lib/check.cjs +16 -0
- package/out/lib/clean.cjs +2 -0
- package/out/lib/index-cmd.cjs +58 -0
- package/out/lib/index.cjs +118 -0
- package/out/lib/mod.cjs +71 -0
- package/out/lib/registry.cjs +2 -0
- package/out/main.cjs +172 -172
- package/package.json +50 -6
|
@@ -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,35 @@
|
|
|
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 { LogLayer } from "loglayer";
|
|
11
|
+
import { TsLogTransport } from "@loglayer/transport-tslog";
|
|
12
|
+
import { Logger } from "tslog";
|
|
13
|
+
export async function main() {
|
|
14
|
+
const logger = new Logger({
|
|
15
|
+
type: "pretty",
|
|
16
|
+
hideLogPositionForProduction: true,
|
|
17
|
+
overwrite: {
|
|
18
|
+
transportFormatted: (markup, args, errs) => console.error(markup, ...args, ...errs),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const log = new LogLayer({ transport: new TsLogTransport({ logger }) });
|
|
22
|
+
const program = new Command("kdsl").version(version);
|
|
23
|
+
build.Register(program, log);
|
|
24
|
+
check.Register(program, log);
|
|
25
|
+
clean.Register(program, log);
|
|
26
|
+
help.Register(program);
|
|
27
|
+
mod.Register(program, log);
|
|
28
|
+
registry.Register(program, log);
|
|
29
|
+
index.Register(program, log);
|
|
30
|
+
await new Promise((resolve) => {
|
|
31
|
+
program.hook("postAction", () => resolve());
|
|
32
|
+
program.parse();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# 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,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,MAAM,EA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{ 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>;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { URI, UriUtils } from "langium";
|
|
2
|
+
import { createKumoriServices } from "@kumori/kdsl-lsp/language/kumori.js";
|
|
3
|
+
import { NodeFileSystem } from "langium/node";
|
|
4
|
+
import { Result } from "@kumori/kdsl-lsp/util/result.js";
|
|
5
|
+
import { ModuleContext } from "@kumori/kdsl-lsp/module/context.js";
|
|
6
|
+
import { writeFile } from "fs/promises";
|
|
7
|
+
import { MOD_FILE } from "@kumori/kdsl-lsp/module/locator.js";
|
|
8
|
+
import { ParseQuery } from "@kumori/kdsl-lsp/module/query.js";
|
|
9
|
+
import { Download } from "../download/main.js";
|
|
10
|
+
import { RegistryManager } from "@kumori/kdsl-lsp/module/registry/manager.js";
|
|
11
|
+
const Summary = `Add, update, or remove a dependency from the module declaration`;
|
|
12
|
+
export const Description = `
|
|
13
|
+
Manage dependencies within the current module. It can add, update
|
|
14
|
+
or remove dependencies. Optionally, it can attempt to download the dependency after adding it.
|
|
15
|
+
Dependencies should resolve to a git repository.
|
|
16
|
+
|
|
17
|
+
To add a dependency:
|
|
18
|
+
kdsl mod dep github.com/org/repo@v1.0.0
|
|
19
|
+
|
|
20
|
+
To add a dependency with an alias:
|
|
21
|
+
kdsl mod dep github.com/org/repo@v1.0.0 --alias mydep
|
|
22
|
+
|
|
23
|
+
To update a dependency to a new version:
|
|
24
|
+
kdsl mod dep github.com/org/repo@v1.2.0
|
|
25
|
+
|
|
26
|
+
To remove a dependency:
|
|
27
|
+
kdsl mod dep github.com/org/repo --remove
|
|
28
|
+
|
|
29
|
+
To add a dependency and download it immediately:
|
|
30
|
+
kdsl mod dep github.com/org/repo@v1.0.0 --download
|
|
31
|
+
`.trim();
|
|
32
|
+
export default { Register };
|
|
33
|
+
export function Register(cmd, log) {
|
|
34
|
+
const c = cmd
|
|
35
|
+
.command("dependency")
|
|
36
|
+
.alias("dep")
|
|
37
|
+
.argument("<module>", "Module URL with @<tag> (e.g. https://github.com/org/repo@v1.2.3)")
|
|
38
|
+
.option("--alias <alias>", "Alias for the dependency")
|
|
39
|
+
.option("--headers <module>", "Specify a separate location for the headers module")
|
|
40
|
+
.option("--remove", "Remove the dependency")
|
|
41
|
+
.option("--download", "Download the dependency after adding it")
|
|
42
|
+
.summary(Summary)
|
|
43
|
+
.description(Description)
|
|
44
|
+
.helpOption(true)
|
|
45
|
+
.showHelpAfterError(true)
|
|
46
|
+
.action(Action(log));
|
|
47
|
+
return c;
|
|
48
|
+
}
|
|
49
|
+
export function Action(log) {
|
|
50
|
+
return async (module, options) => {
|
|
51
|
+
const manager = new RegistryManager();
|
|
52
|
+
await manager.ensureIndexes();
|
|
53
|
+
try {
|
|
54
|
+
await Dependency(log, URI.file(process.cwd()), module, options);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
log.error(`Failed to manage dependency: ${err}`);
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export const Dependency = async (log, cwd, module, options) => {
|
|
63
|
+
const svcs = createKumoriServices(NodeFileSystem).Kumori;
|
|
64
|
+
const fs = svcs.shared.workspace.FileSystemProvider;
|
|
65
|
+
const ctx = await ModuleContext(fs, cwd);
|
|
66
|
+
if (Result.isErr(ctx)) {
|
|
67
|
+
throw new Error(ctx.err);
|
|
68
|
+
}
|
|
69
|
+
const manifest = ctx.value.Current.Manifest;
|
|
70
|
+
// Parse the query for the given module
|
|
71
|
+
const moduleQuery = ParseQuery(module);
|
|
72
|
+
if (Result.isErr(moduleQuery)) {
|
|
73
|
+
throw new Error(`invalid query '${module}': invalid format`);
|
|
74
|
+
}
|
|
75
|
+
// Parse the query for the headers module, if provided
|
|
76
|
+
let headersQuery = null;
|
|
77
|
+
if (options.headers) {
|
|
78
|
+
headersQuery = ParseQuery(options.headers);
|
|
79
|
+
if (Result.isErr(headersQuery)) {
|
|
80
|
+
throw new Error(`invalid query '${options.headers}': invalid format`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const headers = headersQuery ? headersQuery.value : null;
|
|
84
|
+
// Set the destination URL and remove trailing slash from Location if present
|
|
85
|
+
const url = moduleQuery.value;
|
|
86
|
+
if (url.Location.endsWith("/")) {
|
|
87
|
+
url.Location = url.Location.replace(/\/+$/, "");
|
|
88
|
+
}
|
|
89
|
+
// Options shortcuts
|
|
90
|
+
const alias = options.alias;
|
|
91
|
+
const remove = options.remove;
|
|
92
|
+
if (remove) {
|
|
93
|
+
// Find the dependency in the module requires list and remove it
|
|
94
|
+
const idx = manifest.requires.findIndex((dep) => dep.target === url.Location && dep.version === url.Version);
|
|
95
|
+
if (idx === -1) {
|
|
96
|
+
throw new Error(`Dependency ${url} not found`);
|
|
97
|
+
}
|
|
98
|
+
manifest.requires.splice(idx, 1);
|
|
99
|
+
await writeFile(UriUtils.joinPath(ctx.value.Current.Root, MOD_FILE).fsPath, JSON.stringify(manifest, undefined, 4));
|
|
100
|
+
log.info(`Removed dependency ${url.toString()}`);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
// Check for duplicate aliases in dependencies
|
|
104
|
+
if (alias &&
|
|
105
|
+
manifest.requires.some((dep) => dep.alias === alias && dep.target !== url.Location)) {
|
|
106
|
+
throw new Error(`Alias '${alias}' is already used by another dependency`);
|
|
107
|
+
}
|
|
108
|
+
const dep = manifest.requires.find((dep) => dep.target === url.Location);
|
|
109
|
+
if (dep) {
|
|
110
|
+
if (alias)
|
|
111
|
+
dep.alias = alias;
|
|
112
|
+
else
|
|
113
|
+
delete dep.alias;
|
|
114
|
+
if (headers) {
|
|
115
|
+
dep.headers = {
|
|
116
|
+
target: headers.Location,
|
|
117
|
+
version: headers.Version,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
await writeFile(UriUtils.joinPath(ctx.value.Current.Root, MOD_FILE).fsPath, JSON.stringify(manifest, undefined, 4));
|
|
121
|
+
if (options.download) {
|
|
122
|
+
const dl = await Download(log, svcs, cwd.fsPath, [], { quiet: true });
|
|
123
|
+
if (Result.isErr(dl)) {
|
|
124
|
+
throw new Error(`Failed to download dependency: ${dl.err.join(", ")}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
log.info(`Updated dependency ${url.Location} to version ${url.Version}` +
|
|
128
|
+
(alias ? ` (alias: ${alias})` : "") +
|
|
129
|
+
(headers ? ` (headers: ${headers})` : ""));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// Not found? Then build a new dependency object and add it to the manifest
|
|
133
|
+
const version = url.Version;
|
|
134
|
+
const depObj = Object.assign(Object.assign({ target: url.Location, version }, (alias ? { alias } : {})), (headers
|
|
135
|
+
? {
|
|
136
|
+
headers: {
|
|
137
|
+
target: headers.Location,
|
|
138
|
+
version: headers.Version,
|
|
139
|
+
},
|
|
140
|
+
}
|
|
141
|
+
: {}));
|
|
142
|
+
manifest.requires.push(depObj);
|
|
143
|
+
await writeFile(UriUtils.joinPath(ctx.value.Current.Root, MOD_FILE).fsPath, JSON.stringify(manifest, undefined, 4));
|
|
144
|
+
if (options.download) {
|
|
145
|
+
const check = await Download(log, svcs, cwd.fsPath, [], { quiet: true });
|
|
146
|
+
if (Result.isErr(check)) {
|
|
147
|
+
throw new Error(`Failed to download dependency: ${check.err.join(", ")}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
log.info(`Added dependency ${url.toString()}` +
|
|
151
|
+
(alias ? ` (alias: ${alias})` : "") +
|
|
152
|
+
(headers ? ` (headers: ${headers})` : "") +
|
|
153
|
+
` to module manifest`);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/mod/dependency/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAA;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;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EAAE,CACzD,CAAA;YACH,CAAC;QACH,CAAC;QAED,GAAG,CAAC,IAAI,CACN,oBAAoB,GAAG,CAAC,QAAQ,EAAE,EAAE;YAClC,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACnC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACzC,qBAAqB,CACxB,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { DownloadContext } from "./main.js";
|
|
2
|
+
import { Maybe } from "@kumori/kdsl-lsp/util/maybe.js";
|
|
3
|
+
import { Result } from "@kumori/kdsl-lsp/util/result.js";
|
|
4
|
+
import { RemoteFetcherFactory } from "@kumori/kdsl-lsp/module/remote/factory.js";
|
|
5
|
+
import { SemVer } from "@kumori/kdsl-lsp/util/semver.js";
|
|
6
|
+
/**
|
|
7
|
+
* DownloadStatus = Result<Ok, Err> where:
|
|
8
|
+
*
|
|
9
|
+
* Ok = Maybe<string> where Some(string) represents it was downloaded, and None
|
|
10
|
+
* represents it was skipped.
|
|
11
|
+
*
|
|
12
|
+
* Err = string that describes the download error.
|
|
13
|
+
*/
|
|
14
|
+
export type DownloadStatus = Result<Maybe<string>, string> & {
|
|
15
|
+
required: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Downloads the dependencies specified in the current module manifest
|
|
19
|
+
* @param ctx Download context
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare function DownloadDependencies(ctx: DownloadContext): Promise<Map<string, DownloadStatus>>;
|
|
23
|
+
/**
|
|
24
|
+
* Given a list of modules, download them and add them as dependencies to the current module
|
|
25
|
+
* @param ctx Download context
|
|
26
|
+
* @param queries List of modules
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export declare function DownloadQueries(ctx: DownloadContext, queries: string[]): Promise<Map<string, DownloadStatus>>;
|
|
30
|
+
/**
|
|
31
|
+
* Downloads all modules specified in the manifest by resolving their dependencies recursively.
|
|
32
|
+
*
|
|
33
|
+
* Iterates through the dependencies listed in the current context, downloading each module and its dependencies.
|
|
34
|
+
* Updates the download status map to mark modules as required if any dependency is declared without an interface.
|
|
35
|
+
*
|
|
36
|
+
* @param ctx The download context containing the current manifest and configuration.
|
|
37
|
+
* @param status A map tracking the download status of each module.
|
|
38
|
+
* @returns A promise that resolves when all dependencies have been processed and downloaded.
|
|
39
|
+
*/
|
|
40
|
+
export declare function DownloadFromManifest(ctx: DownloadContext, status: Map<string, DownloadStatus>): Promise<void>;
|
|
41
|
+
export declare function DownloadModuleRecursive(ctx: DownloadContext, target: string, version: string, status: Map<string, DownloadStatus>): Promise<void>;
|
|
42
|
+
export declare function DownloadModule(ctx: DownloadContext, target: string, version: string): Promise<Result<Maybe<string>, string>>;
|
|
43
|
+
/**
|
|
44
|
+
* Downloads a module into a directory
|
|
45
|
+
* @param ctx
|
|
46
|
+
* @param target Module
|
|
47
|
+
* @param version Module version
|
|
48
|
+
* @param dir Target directory
|
|
49
|
+
* @returns Result
|
|
50
|
+
*/
|
|
51
|
+
export declare function DownloadModuleToDir(ctx: {
|
|
52
|
+
Remotes: RemoteFetcherFactory;
|
|
53
|
+
}, target: string, version: string, dir: string): Promise<Result<SemVer, string>>;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
2
|
+
if (value !== null && value !== void 0) {
|
|
3
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
4
|
+
var dispose, inner;
|
|
5
|
+
if (async) {
|
|
6
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
7
|
+
dispose = value[Symbol.asyncDispose];
|
|
8
|
+
}
|
|
9
|
+
if (dispose === void 0) {
|
|
10
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
11
|
+
dispose = value[Symbol.dispose];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
15
|
+
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
16
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
17
|
+
}
|
|
18
|
+
else if (async) {
|
|
19
|
+
env.stack.push({ async: true });
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
24
|
+
return function (env) {
|
|
25
|
+
function fail(e) {
|
|
26
|
+
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
27
|
+
env.hasError = true;
|
|
28
|
+
}
|
|
29
|
+
var r, s = 0;
|
|
30
|
+
function next() {
|
|
31
|
+
while (r = env.stack.pop()) {
|
|
32
|
+
try {
|
|
33
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
34
|
+
if (r.dispose) {
|
|
35
|
+
var result = r.dispose.call(r.value);
|
|
36
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
37
|
+
}
|
|
38
|
+
else s |= 1;
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
41
|
+
fail(e);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
45
|
+
if (env.hasError) throw env.error;
|
|
46
|
+
}
|
|
47
|
+
return next();
|
|
48
|
+
};
|
|
49
|
+
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
50
|
+
var e = new Error(message);
|
|
51
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
52
|
+
});
|
|
53
|
+
import { ParseQuery } from "@kumori/kdsl-lsp/module/query.js";
|
|
54
|
+
import { Maybe, None, Some } from "@kumori/kdsl-lsp/util/maybe.js";
|
|
55
|
+
import { Err, Ok, Result } from "@kumori/kdsl-lsp/util/result.js";
|
|
56
|
+
import { Version } from "@kumori/kdsl-lsp/module/version.js";
|
|
57
|
+
import { ListDependencies } from "@kumori/kdsl-lsp/module/dependency/list.js";
|
|
58
|
+
import assert from "assert";
|
|
59
|
+
import { LocateDependency } from "@kumori/kdsl-lsp/module/dependency/locate.js";
|
|
60
|
+
import { ModuleContext } from "@kumori/kdsl-lsp/module/context.js";
|
|
61
|
+
import { MkdirTemp } from "@kumori/kdsl-lsp/util/tmp.js";
|
|
62
|
+
import { ValidateChecksum } from "@kumori/kdsl-lsp/module/integrity/validate.js";
|
|
63
|
+
import { URI, UriUtils } from "langium";
|
|
64
|
+
import { mkdir, rename, rm } from "fs/promises";
|
|
65
|
+
import { ForURL, } from "@kumori/kdsl-lsp/module/remote/factory.js";
|
|
66
|
+
import { SemVer } from "@kumori/kdsl-lsp/util/semver.js";
|
|
67
|
+
import { URL } from "@kumori/kdsl-lsp/util/url.js";
|
|
68
|
+
import { DependencyId } from "@kumori/kdsl-lsp/module/dependency/id.js";
|
|
69
|
+
/**
|
|
70
|
+
* Downloads the dependencies specified in the current module manifest
|
|
71
|
+
* @param ctx Download context
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
export async function DownloadDependencies(ctx) {
|
|
75
|
+
const result = new Map();
|
|
76
|
+
await DownloadFromManifest(ctx, result);
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Given a list of modules, download them and add them as dependencies to the current module
|
|
81
|
+
* @param ctx Download context
|
|
82
|
+
* @param queries List of modules
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
export async function DownloadQueries(ctx, queries) {
|
|
86
|
+
const result = new Map();
|
|
87
|
+
console.log(queries);
|
|
88
|
+
for (const query of queries) {
|
|
89
|
+
const q = ParseQuery(query);
|
|
90
|
+
if (Maybe.isNone(q)) {
|
|
91
|
+
const msg = `invalid download query '${query}': failed to parse`;
|
|
92
|
+
result.set(query, Object.assign(Object.assign({}, Err(msg)), { required: true }));
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
const v = Version(q.value.Version);
|
|
96
|
+
if (Maybe.isNone(v)) {
|
|
97
|
+
const msg = `invalid download query '${query}': invalid version specifier '${q.value.Version}': failed to parse`;
|
|
98
|
+
result.set(query, Object.assign(Object.assign({}, Err(msg)), { required: true }));
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (!Version.isSemVer(v.value)) {
|
|
102
|
+
// TODO: Try to find a matching version in ctx.Current.Manifest
|
|
103
|
+
const msg = `invalid download query '${query}': invalid version specifier '${q.value.Version}': invalid semver`;
|
|
104
|
+
result.set(query, Object.assign(Object.assign({}, Err(msg)), { required: true }));
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const target = `${q.value.Scheme}://${q.value.Location}`;
|
|
108
|
+
const version = q.value.Version;
|
|
109
|
+
await DownloadModuleRecursive(ctx, target, version, result);
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Downloads all modules specified in the manifest by resolving their dependencies recursively.
|
|
115
|
+
*
|
|
116
|
+
* Iterates through the dependencies listed in the current context, downloading each module and its dependencies.
|
|
117
|
+
* Updates the download status map to mark modules as required if any dependency is declared without an interface.
|
|
118
|
+
*
|
|
119
|
+
* @param ctx The download context containing the current manifest and configuration.
|
|
120
|
+
* @param status A map tracking the download status of each module.
|
|
121
|
+
* @returns A promise that resolves when all dependencies have been processed and downloaded.
|
|
122
|
+
*/
|
|
123
|
+
export async function DownloadFromManifest(ctx, status) {
|
|
124
|
+
var _a;
|
|
125
|
+
const deps = ListDependencies(ctx.Current);
|
|
126
|
+
// Iterate through each dependency
|
|
127
|
+
for (const dep of deps.keys()) {
|
|
128
|
+
const listings = deps.get(dep);
|
|
129
|
+
if (listings.length < 1) {
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const { target, version } = listings[0]; // all listings will have the same {target, version}
|
|
133
|
+
await DownloadModuleRecursive(ctx, target, version, status);
|
|
134
|
+
// a dependency is required if it is declared without an interface
|
|
135
|
+
const required = listings.reduce((prev, curr) => prev || curr.interface === undefined, false);
|
|
136
|
+
const key = DependencyId(target, version);
|
|
137
|
+
assert(status.has(key));
|
|
138
|
+
(_a = status.get(key)).required || (_a.required = required); // use ||= to accumulate results from other dependencies
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export async function DownloadModuleRecursive(ctx, target, version, status) {
|
|
142
|
+
const dependencyId = DependencyId(target, version);
|
|
143
|
+
if (status.has(dependencyId)) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const result = await DownloadModule(ctx, target, version);
|
|
147
|
+
status.set(dependencyId, Object.assign(Object.assign({}, result), { required: false }));
|
|
148
|
+
if (Result.isErr(result)) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const existing = await LocateDependency(ctx, target, version);
|
|
152
|
+
assert(Maybe.isSome(existing));
|
|
153
|
+
const location = await ModuleContext.Move(ctx, ctx.FS, existing.value.Root);
|
|
154
|
+
assert(Result.isOk(location));
|
|
155
|
+
ctx = Object.assign(Object.assign({}, ctx), location.value);
|
|
156
|
+
await DownloadFromManifest(ctx, status); // download all dependencies in its manifest
|
|
157
|
+
}
|
|
158
|
+
export async function DownloadModule(ctx, target, version) {
|
|
159
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
160
|
+
try {
|
|
161
|
+
const existing = await LocateDependency(ctx, target, version);
|
|
162
|
+
if (Result.isOk(existing)) {
|
|
163
|
+
return Ok(None);
|
|
164
|
+
}
|
|
165
|
+
// Copy the remote module into a temp dir
|
|
166
|
+
const tmp = __addDisposableResource(env_1, await MkdirTemp(), true);
|
|
167
|
+
const dlResult = await DownloadModuleToDir(ctx, target, version, tmp.Path);
|
|
168
|
+
if (Result.isErr(dlResult)) {
|
|
169
|
+
return Err(`failed to fetch ${target}@${version}: ${dlResult.err}`);
|
|
170
|
+
}
|
|
171
|
+
// Validate the checksum
|
|
172
|
+
const validation = await ValidateChecksum(ctx.SumDB, URI.file(tmp.Path), ctx, target, dlResult.value);
|
|
173
|
+
if (Result.isErr(validation)) {
|
|
174
|
+
return validation;
|
|
175
|
+
}
|
|
176
|
+
// Move into the module cache
|
|
177
|
+
const modname = `${target}@${version}`;
|
|
178
|
+
const ModLocation = UriUtils.joinPath(ctx.Locations.Cache(), modname);
|
|
179
|
+
await mkdir(ModLocation.fsPath, { recursive: true });
|
|
180
|
+
await rm(ModLocation.fsPath, { recursive: true, force: true });
|
|
181
|
+
await rename(tmp.Path, ModLocation.fsPath);
|
|
182
|
+
return Ok(Some(modname));
|
|
183
|
+
}
|
|
184
|
+
catch (e_1) {
|
|
185
|
+
env_1.error = e_1;
|
|
186
|
+
env_1.hasError = true;
|
|
187
|
+
}
|
|
188
|
+
finally {
|
|
189
|
+
const result_1 = __disposeResources(env_1);
|
|
190
|
+
if (result_1)
|
|
191
|
+
await result_1;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Downloads a module into a directory
|
|
196
|
+
* @param ctx
|
|
197
|
+
* @param target Module
|
|
198
|
+
* @param version Module version
|
|
199
|
+
* @param dir Target directory
|
|
200
|
+
* @returns Result
|
|
201
|
+
*/
|
|
202
|
+
export async function DownloadModuleToDir(ctx, target, version, dir) {
|
|
203
|
+
const modname = `${target}@${version}`;
|
|
204
|
+
const q = ParseQuery(modname);
|
|
205
|
+
if (Maybe.isNone(q)) {
|
|
206
|
+
return Err(`failed to resolve ${modname}: invalid download query`);
|
|
207
|
+
}
|
|
208
|
+
const ver = SemVer(q.value.Version);
|
|
209
|
+
const location = new URL(`${q.value.Scheme}://${q.value.Location}`);
|
|
210
|
+
const remote = ForURL(ctx.Remotes, location);
|
|
211
|
+
if (Result.isErr(remote)) {
|
|
212
|
+
return Err(`failed to resolve ${modname}': invalid remote ${location}: ${remote.err}`);
|
|
213
|
+
}
|
|
214
|
+
const remoteVersions = await remote.value.Versions(location);
|
|
215
|
+
if (Result.isErr(remoteVersions)) {
|
|
216
|
+
return Err(`failed to read ${location}: ${remoteVersions.err}`);
|
|
217
|
+
}
|
|
218
|
+
const targetSemVer = ver;
|
|
219
|
+
const remoteMatches = remoteVersions.value.filter((candidate) => SemVer.Compare(candidate, targetSemVer) === 0);
|
|
220
|
+
if (remoteMatches.length === 0) {
|
|
221
|
+
return Err(`no remote matches for ${location}@v${ver}`);
|
|
222
|
+
}
|
|
223
|
+
if (remoteMatches.length > 1) {
|
|
224
|
+
const matches = `[${remoteMatches.map(String).join(", ")}]`;
|
|
225
|
+
return Err(`ambiguous match for ${location}@v${ver}: found ${matches}`);
|
|
226
|
+
}
|
|
227
|
+
const remoteMatch = remoteMatches[0];
|
|
228
|
+
// Copy the remote module into a temp dir
|
|
229
|
+
const dlResult = await remote.value.Get(location, remoteMatch.toString(), dir);
|
|
230
|
+
if (Result.isErr(dlResult)) {
|
|
231
|
+
return Err(`failed to fetch ${location}@${ver.toString()}: ${dlResult.err}`);
|
|
232
|
+
}
|
|
233
|
+
return Ok(remoteMatch);
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../../src/mod/download/functions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAE7D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,iCAAiC,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AAG,CAAA;QAC3D,OAAO,GAAG,CAAC,uBAAuB,QAAQ,KAAK,GAAG,WAAW,OAAO,EAAE,CAAC,CAAA;IACzE,CAAC;IAED,MAAM,WAAW,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;IAEpC,yCAAyC;IACzC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,CAAA;IAC9E,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC3B,OAAO,GAAG,CAAC,mBAAmB,QAAQ,IAAI,GAAG,CAAC,QAAQ,EAAE,KAAK,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAA;IAC9E,CAAC;IAED,OAAO,EAAE,CAAC,WAAW,CAAC,CAAA;AACxB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import { ModuleContext } from "@kumori/kdsl-lsp/module/context.js";
|
|
3
|
+
import { SumDB } from "@kumori/kdsl-lsp/module/integrity/sumdb.js";
|
|
4
|
+
import { RemoteFetcherFactory } from "@kumori/kdsl-lsp/module/remote/factory.js";
|
|
5
|
+
import { Result } from "@kumori/kdsl-lsp/util/result.js";
|
|
6
|
+
import { FileSystemProvider } from "langium";
|
|
7
|
+
import { CommanderActionParams } from "../../util.js";
|
|
8
|
+
import { ILogLayer } from "loglayer";
|
|
9
|
+
import { KumoriServices } from "@kumori/kdsl-lsp/language/kumori.js";
|
|
10
|
+
declare const _default: {
|
|
11
|
+
Register: typeof Register;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
export declare function Register(cmd: Command, log: ILogLayer): Command<[string[]], {
|
|
15
|
+
quiet?: true | undefined;
|
|
16
|
+
}, {}>;
|
|
17
|
+
export declare const Description: string;
|
|
18
|
+
export type Exec = CommanderActionParams<ReturnType<typeof Register>>;
|
|
19
|
+
export declare function Action(log: ILogLayer): Exec;
|
|
20
|
+
export type Params = Parameters<Exec>;
|
|
21
|
+
export declare const Download: (log: ILogLayer, svcs: KumoriServices, cwd: string, modules: Params[0], options: Params[1]) => Promise<Result<void, string[]>>;
|
|
22
|
+
export type DownloadContext = ModuleContext & {
|
|
23
|
+
SumDB: SumDB;
|
|
24
|
+
Remotes: RemoteFetcherFactory;
|
|
25
|
+
FS: FileSystemProvider;
|
|
26
|
+
};
|