@g3nomaly/core 0.3.1 → 0.3.3
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 +122 -0
- package/dist/cli/commands/add.d.ts +24 -4
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/add.js +37 -14
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/conflict.d.ts +52 -0
- package/dist/cli/commands/conflict.d.ts.map +1 -0
- package/dist/cli/commands/conflict.js +88 -0
- package/dist/cli/commands/conflict.js.map +1 -0
- package/dist/cli/commands/installFromSources.d.ts +42 -13
- package/dist/cli/commands/installFromSources.d.ts.map +1 -1
- package/dist/cli/commands/installFromSources.js +68 -19
- package/dist/cli/commands/installFromSources.js.map +1 -1
- package/dist/cli/commands/ls.d.ts +13 -3
- package/dist/cli/commands/ls.d.ts.map +1 -1
- package/dist/cli/commands/ls.js +26 -6
- package/dist/cli/commands/ls.js.map +1 -1
- package/dist/cli/commands/remove.d.ts +7 -1
- package/dist/cli/commands/remove.d.ts.map +1 -1
- package/dist/cli/commands/remove.js +15 -1
- package/dist/cli/commands/remove.js.map +1 -1
- package/dist/cli/commands/sources.d.ts +34 -10
- package/dist/cli/commands/sources.d.ts.map +1 -1
- package/dist/cli/commands/sources.js +17 -3
- package/dist/cli/commands/sources.js.map +1 -1
- package/dist/cli/commands/update.d.ts +11 -4
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +32 -14
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/dialogue.d.ts +65 -13
- package/dist/cli/dialogue.d.ts.map +1 -1
- package/dist/cli/dialogue.js +46 -7
- package/dist/cli/dialogue.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/installDialogues.d.ts +11 -3
- package/dist/cli/installDialogues.d.ts.map +1 -1
- package/dist/cli/installDialogues.js +22 -5
- package/dist/cli/installDialogues.js.map +1 -1
- package/dist/cli/pick.d.ts +11 -2
- package/dist/cli/pick.d.ts.map +1 -1
- package/dist/cli/pick.js +11 -2
- package/dist/cli/pick.js.map +1 -1
- package/dist/cli/report.d.ts +32 -8
- package/dist/cli/report.d.ts.map +1 -1
- package/dist/cli/report.js +26 -5
- package/dist/cli/report.js.map +1 -1
- package/dist/cli/theme.d.ts +4 -0
- package/dist/cli/theme.d.ts.map +1 -1
- package/dist/cli/theme.js +4 -0
- package/dist/cli/theme.js.map +1 -1
- package/dist/cli/types.d.ts +56 -5
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/config/config.d.ts +32 -7
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +37 -7
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +58 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +0 -10
- package/dist/config/types.js.map +1 -1
- package/dist/hash/hash.d.ts +6 -8
- package/dist/hash/hash.d.ts.map +1 -1
- package/dist/hash/hash.js +7 -8
- package/dist/hash/hash.js.map +1 -1
- package/dist/hash/index.d.ts.map +1 -1
- package/dist/hash/index.js +1 -0
- package/dist/hash/index.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/installer/classify.d.ts +27 -1
- package/dist/installer/classify.d.ts.map +1 -1
- package/dist/installer/classify.js +36 -1
- package/dist/installer/classify.js.map +1 -1
- package/dist/installer/files.d.ts +10 -6
- package/dist/installer/files.d.ts.map +1 -1
- package/dist/installer/files.js +4 -3
- package/dist/installer/files.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +1 -1
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/install.d.ts +18 -6
- package/dist/installer/install.d.ts.map +1 -1
- package/dist/installer/install.js +20 -7
- package/dist/installer/install.js.map +1 -1
- package/dist/installer/io.d.ts +6 -1
- package/dist/installer/io.d.ts.map +1 -1
- package/dist/installer/io.js +6 -1
- package/dist/installer/io.js.map +1 -1
- package/dist/installer/manifest.d.ts +29 -19
- package/dist/installer/manifest.d.ts.map +1 -1
- package/dist/installer/manifest.js +20 -10
- package/dist/installer/manifest.js.map +1 -1
- package/dist/installer/manifestSources.d.ts +18 -7
- package/dist/installer/manifestSources.d.ts.map +1 -1
- package/dist/installer/manifestSources.js +18 -7
- package/dist/installer/manifestSources.js.map +1 -1
- package/dist/installer/marketplace.d.ts +24 -12
- package/dist/installer/marketplace.d.ts.map +1 -1
- package/dist/installer/marketplace.js +18 -10
- package/dist/installer/marketplace.js.map +1 -1
- package/dist/installer/origin.d.ts +23 -7
- package/dist/installer/origin.d.ts.map +1 -1
- package/dist/installer/origin.js +14 -7
- package/dist/installer/origin.js.map +1 -1
- package/dist/installer/remove.d.ts +17 -5
- package/dist/installer/remove.d.ts.map +1 -1
- package/dist/installer/remove.js +17 -5
- package/dist/installer/remove.js.map +1 -1
- package/dist/installer/resolve.d.ts +80 -31
- package/dist/installer/resolve.d.ts.map +1 -1
- package/dist/installer/resolve.js +96 -29
- package/dist/installer/resolve.js.map +1 -1
- package/dist/installer/sourceRegistry.d.ts +59 -22
- package/dist/installer/sourceRegistry.d.ts.map +1 -1
- package/dist/installer/sourceRegistry.js +25 -10
- package/dist/installer/sourceRegistry.js.map +1 -1
- package/dist/installer/types.d.ts +72 -19
- package/dist/installer/types.d.ts.map +1 -1
- package/dist/installer/types.js +18 -8
- package/dist/installer/types.js.map +1 -1
- package/dist/registry/index.d.ts +0 -4
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -4
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/registry.handlers.d.ts +7 -0
- package/dist/registry/registry.handlers.d.ts.map +1 -1
- package/dist/registry/registry.handlers.js.map +1 -1
- package/dist/registry/registry.io.d.ts +23 -7
- package/dist/registry/registry.io.d.ts.map +1 -1
- package/dist/registry/registry.io.js +37 -14
- package/dist/registry/registry.io.js.map +1 -1
- package/dist/registry/registry.mutations.d.ts +10 -3
- package/dist/registry/registry.mutations.d.ts.map +1 -1
- package/dist/registry/registry.mutations.js +10 -3
- package/dist/registry/registry.mutations.js.map +1 -1
- package/dist/registry/registry.selectors.d.ts +41 -11
- package/dist/registry/registry.selectors.d.ts.map +1 -1
- package/dist/registry/registry.selectors.js +41 -11
- package/dist/registry/registry.selectors.js.map +1 -1
- package/dist/registry/registry.store.d.ts +22 -9
- package/dist/registry/registry.store.d.ts.map +1 -1
- package/dist/registry/registry.store.js +12 -3
- package/dist/registry/registry.store.js.map +1 -1
- package/dist/registry/registry.template.d.ts +12 -6
- package/dist/registry/registry.template.d.ts.map +1 -1
- package/dist/registry/registry.template.js +13 -6
- package/dist/registry/registry.template.js.map +1 -1
- package/dist/registry/types.d.ts +17 -3
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/types.js +16 -6
- package/dist/registry/types.js.map +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -0
- package/dist/security/index.js.map +1 -1
- package/dist/security/securityParser.d.ts +9 -8
- package/dist/security/securityParser.d.ts.map +1 -1
- package/dist/security/securityParser.js +12 -22
- package/dist/security/securityParser.js.map +1 -1
- package/dist/security/securityWorker.d.ts +11 -0
- package/dist/security/securityWorker.d.ts.map +1 -1
- package/dist/security/securityWorker.js +17 -38
- package/dist/security/securityWorker.js.map +1 -1
- package/dist/sources/checkout.d.ts +10 -4
- package/dist/sources/checkout.d.ts.map +1 -1
- package/dist/sources/checkout.js +10 -4
- package/dist/sources/checkout.js.map +1 -1
- package/dist/sources/git.d.ts +5 -3
- package/dist/sources/git.d.ts.map +1 -1
- package/dist/sources/git.js +5 -3
- package/dist/sources/git.js.map +1 -1
- package/dist/sources/local.d.ts +6 -4
- package/dist/sources/local.d.ts.map +1 -1
- package/dist/sources/local.js +6 -4
- package/dist/sources/local.js.map +1 -1
- package/dist/sources/npm.d.ts +10 -7
- package/dist/sources/npm.d.ts.map +1 -1
- package/dist/sources/npm.js +49 -15
- package/dist/sources/npm.js.map +1 -1
- package/dist/sources/parse.d.ts +24 -16
- package/dist/sources/parse.d.ts.map +1 -1
- package/dist/sources/parse.js +40 -18
- package/dist/sources/parse.js.map +1 -1
- package/dist/sources/process.d.ts +10 -7
- package/dist/sources/process.d.ts.map +1 -1
- package/dist/sources/process.js +10 -7
- package/dist/sources/process.js.map +1 -1
- package/dist/sources/register.d.ts +20 -5
- package/dist/sources/register.d.ts.map +1 -1
- package/dist/sources/register.js +20 -5
- package/dist/sources/register.js.map +1 -1
- package/dist/sources/types.d.ts +43 -8
- package/dist/sources/types.d.ts.map +1 -1
- package/dist/sources/types.js +21 -4
- package/dist/sources/types.js.map +1 -1
- package/dist/utils/errors.d.ts +6 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +6 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/merge.d.ts +8 -2
- package/dist/utils/merge.d.ts.map +1 -1
- package/dist/utils/merge.js +9 -2
- package/dist/utils/merge.js.map +1 -1
- package/dist/utils/packageMeta.d.ts +16 -2
- package/dist/utils/packageMeta.d.ts.map +1 -1
- package/dist/utils/packageMeta.js +6 -2
- package/dist/utils/packageMeta.js.map +1 -1
- package/dist/utils/paths.d.ts +16 -5
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +16 -5
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/prompt.d.ts +6 -1
- package/dist/utils/prompt.d.ts.map +1 -1
- package/dist/utils/prompt.js +6 -1
- package/dist/utils/prompt.js.map +1 -1
- package/dist/utils/version.d.ts +7 -2
- package/dist/utils/version.d.ts.map +1 -1
- package/dist/utils/version.js +40 -3
- package/dist/utils/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/sources/parse.ts"],"names":[],"mappings":"AAAA,q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a command to completion and returns its trimmed stdout.
|
|
3
|
-
* switched off for git, so a private repository fails instead of hanging.
|
|
2
|
+
* @brief Runs a command to completion and returns its trimmed stdout.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
4
|
+
* Prompts are switched off for git, so a private repository fails instead of hanging.
|
|
5
|
+
*
|
|
6
|
+
* @param argv - Command and its arguments.
|
|
7
|
+
* @param cwd - Folder to run in. The current folder when absent.
|
|
8
|
+
* @returns Trimmed stdout.
|
|
9
|
+
* @throws {Error} With the command's stderr when it exits non-zero.
|
|
6
10
|
*/
|
|
7
11
|
export declare function runCommand(argv: string[], cwd?: string): Promise<string>;
|
|
8
12
|
/**
|
|
9
|
-
* Creates an empty temporary folder that is also removed at process exit, so
|
|
10
|
-
* a command that bails out early leaves nothing behind.
|
|
13
|
+
* @brief Creates an empty temporary folder that is also removed at process exit, so a command that bails out early leaves nothing behind.
|
|
11
14
|
*
|
|
12
|
-
* @param label - Part of the folder name, e.g. `git` gives `/tmp/g3n-source-git-XXXXXX
|
|
13
|
-
* @returns
|
|
15
|
+
* @param label - Part of the folder name, e.g. `git` gives `/tmp/g3n-source-git-XXXXXX`.
|
|
16
|
+
* @returns Absolute path of the folder.
|
|
14
17
|
*/
|
|
15
18
|
export declare function createTempDir(label: string): string;
|
|
16
19
|
/** Deletes a folder and everything in it; a missing folder is not an error. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/sources/process.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/sources/process.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAc9E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAInD;AAED,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE3C"}
|
package/dist/sources/process.js
CHANGED
|
@@ -3,10 +3,14 @@ import fs from "node:fs";
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
/**
|
|
6
|
-
* Runs a command to completion and returns its trimmed stdout.
|
|
7
|
-
* switched off for git, so a private repository fails instead of hanging.
|
|
6
|
+
* @brief Runs a command to completion and returns its trimmed stdout.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
8
|
+
* Prompts are switched off for git, so a private repository fails instead of hanging.
|
|
9
|
+
*
|
|
10
|
+
* @param argv - Command and its arguments.
|
|
11
|
+
* @param cwd - Folder to run in. The current folder when absent.
|
|
12
|
+
* @returns Trimmed stdout.
|
|
13
|
+
* @throws {Error} With the command's stderr when it exits non-zero.
|
|
10
14
|
*/
|
|
11
15
|
export async function runCommand(argv, cwd) {
|
|
12
16
|
const proc = Bun.spawn(argv, {
|
|
@@ -25,11 +29,10 @@ export async function runCommand(argv, cwd) {
|
|
|
25
29
|
return stdout.trim();
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
|
-
* Creates an empty temporary folder that is also removed at process exit, so
|
|
29
|
-
* a command that bails out early leaves nothing behind.
|
|
32
|
+
* @brief Creates an empty temporary folder that is also removed at process exit, so a command that bails out early leaves nothing behind.
|
|
30
33
|
*
|
|
31
|
-
* @param label - Part of the folder name, e.g. `git` gives `/tmp/g3n-source-git-XXXXXX
|
|
32
|
-
* @returns
|
|
34
|
+
* @param label - Part of the folder name, e.g. `git` gives `/tmp/g3n-source-git-XXXXXX`.
|
|
35
|
+
* @returns Absolute path of the folder.
|
|
33
36
|
*/
|
|
34
37
|
export function createTempDir(label) {
|
|
35
38
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), `g3n-source-${label}-`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/sources/process.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/sources/process.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAc,EAAE,GAAY;IAC3D,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE;QAC3B,GAAG;QACH,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE;KAClD,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACnD,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;QAChC,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;QAChC,IAAI,CAAC,MAAM;KACZ,CAAC,CAAC;IACH,IAAI,QAAQ,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,QAAQ,EAAE,CAAC,CAAC;IACpI,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,MAAM,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,cAAc,KAAK,GAAG,CAAC,CAAC,CAAC;IAC3E,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import type { RegisteredSource, SourceRecord, SourceSpec } from "./types";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* @brief Lists built-in sources first, then the registered ones, each group sorted by name.
|
|
4
|
+
*
|
|
5
|
+
* @param record - Registered sources of one manifest.
|
|
6
|
+
* @param builtins - Sources shipped with the installer.
|
|
7
|
+
* @returns Every source, flagged `builtin` when it ships with the installer.
|
|
8
|
+
*/
|
|
3
9
|
export declare function listSources(record: SourceRecord, builtins: SourceRecord): RegisteredSource[];
|
|
4
10
|
/**
|
|
5
|
-
*
|
|
11
|
+
* @brief Registers a source under a name.
|
|
6
12
|
*
|
|
7
|
-
* @
|
|
13
|
+
* @param record - Registered sources to add to. Not changed.
|
|
14
|
+
* @param name - Name to register under. Must match `SourceNameSchema`.
|
|
15
|
+
* @param spec - Where the source is read from.
|
|
16
|
+
* @param builtins - Sources shipped with the installer. Their names cannot be registered.
|
|
17
|
+
* @returns A new record with the source added.
|
|
18
|
+
* @throws {Error} When the name is invalid, belongs to a built-in source, or is already registered.
|
|
8
19
|
*/
|
|
9
20
|
export declare function addSource(record: SourceRecord, name: string, spec: SourceSpec, builtins: SourceRecord): SourceRecord;
|
|
10
21
|
/**
|
|
11
|
-
*
|
|
22
|
+
* @brief Removes a registered source.
|
|
12
23
|
*
|
|
13
|
-
* @
|
|
24
|
+
* @param record - Registered sources to remove from. Not changed.
|
|
25
|
+
* @param name - Name of the source to remove.
|
|
26
|
+
* @param builtins - Sources shipped with the installer. They cannot be removed.
|
|
27
|
+
* @returns A new record without the source.
|
|
28
|
+
* @throws {Error} When `name` is a built-in source or is not registered.
|
|
14
29
|
*/
|
|
15
30
|
export declare function removeSource(record: SourceRecord, name: string, builtins: SourceRecord): SourceRecord;
|
|
16
31
|
//# sourceMappingURL=register.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/sources/register.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/sources/register.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,GAAG,gBAAgB,EAAE,CAM5F;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,GAAG,YAAY,CAKpH;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,YAAY,CAKrG"}
|
package/dist/sources/register.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// packages/core/src/sources/register.ts
|
|
2
2
|
import { SourceNameSchema, SourceSpecSchema } from "./types";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @brief Lists built-in sources first, then the registered ones, each group sorted by name.
|
|
5
|
+
*
|
|
6
|
+
* @param record - Registered sources of one manifest.
|
|
7
|
+
* @param builtins - Sources shipped with the installer.
|
|
8
|
+
* @returns Every source, flagged `builtin` when it ships with the installer.
|
|
9
|
+
*/
|
|
4
10
|
export function listSources(record, builtins) {
|
|
5
11
|
const sorted = (r) => Object.entries(r).sort(([a], [b]) => a.localeCompare(b));
|
|
6
12
|
return [
|
|
@@ -9,9 +15,14 @@ export function listSources(record, builtins) {
|
|
|
9
15
|
];
|
|
10
16
|
}
|
|
11
17
|
/**
|
|
12
|
-
*
|
|
18
|
+
* @brief Registers a source under a name.
|
|
13
19
|
*
|
|
14
|
-
* @
|
|
20
|
+
* @param record - Registered sources to add to. Not changed.
|
|
21
|
+
* @param name - Name to register under. Must match `SourceNameSchema`.
|
|
22
|
+
* @param spec - Where the source is read from.
|
|
23
|
+
* @param builtins - Sources shipped with the installer. Their names cannot be registered.
|
|
24
|
+
* @returns A new record with the source added.
|
|
25
|
+
* @throws {Error} When the name is invalid, belongs to a built-in source, or is already registered.
|
|
15
26
|
*/
|
|
16
27
|
export function addSource(record, name, spec, builtins) {
|
|
17
28
|
const valid = SourceNameSchema.parse(name);
|
|
@@ -22,9 +33,13 @@ export function addSource(record, name, spec, builtins) {
|
|
|
22
33
|
return { ...record, [valid]: SourceSpecSchema.parse(spec) };
|
|
23
34
|
}
|
|
24
35
|
/**
|
|
25
|
-
*
|
|
36
|
+
* @brief Removes a registered source.
|
|
26
37
|
*
|
|
27
|
-
* @
|
|
38
|
+
* @param record - Registered sources to remove from. Not changed.
|
|
39
|
+
* @param name - Name of the source to remove.
|
|
40
|
+
* @param builtins - Sources shipped with the installer. They cannot be removed.
|
|
41
|
+
* @returns A new record without the source.
|
|
42
|
+
* @throws {Error} When `name` is a built-in source or is not registered.
|
|
28
43
|
*/
|
|
29
44
|
export function removeSource(record, name, builtins) {
|
|
30
45
|
if (builtins[name] !== undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/sources/register.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG7D
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/sources/register.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG7D;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAoB,EAAE,QAAsB;IACtE,MAAM,MAAM,GAAG,CAAC,CAAe,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,OAAO;QACL,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1E,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;KAC3H,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,MAAoB,EAAE,IAAY,EAAE,IAAgB,EAAE,QAAsB;IACpG,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,iDAAiD,CAAC,CAAC;IAC/G,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,yBAAyB,CAAC,CAAC;IACpG,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;AAC9D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,MAAoB,EAAE,IAAY,EAAE,QAAsB;IACrF,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,8CAA8C,CAAC,CAAC;IAC1G,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,iBAAiB,CAAC,CAAC;IAC3F,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAC7C,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/sources/types.d.ts
CHANGED
|
@@ -5,21 +5,41 @@ export declare const GIT_URL: RegExp;
|
|
|
5
5
|
export declare const NPM_PACKAGE: RegExp;
|
|
6
6
|
/** Name a source is registered under, e.g. `g3n-skills`. */
|
|
7
7
|
export declare const SourceNameSchema: z.ZodString;
|
|
8
|
+
/**
|
|
9
|
+
* @brief Spec of a git source: a clone of a repository.
|
|
10
|
+
*
|
|
11
|
+
* @property kind - Always `git`.
|
|
12
|
+
* @property url - Clone URL.
|
|
13
|
+
* @property ref - Branch or tag to check out. The default branch when absent.
|
|
14
|
+
*/
|
|
8
15
|
export declare const GitSourceSpecSchema: z.ZodObject<{
|
|
9
16
|
kind: z.ZodLiteral<"git">;
|
|
10
17
|
url: z.ZodString;
|
|
11
18
|
ref: z.ZodOptional<z.ZodString>;
|
|
12
19
|
}, z.core.$strip>;
|
|
20
|
+
/**
|
|
21
|
+
* @brief Spec of an npm source: a published package.
|
|
22
|
+
*
|
|
23
|
+
* @property kind - Always `npm`.
|
|
24
|
+
* @property package - Package name, scoped or not.
|
|
25
|
+
* @property version - Exact version, semver range or dist-tag. When absent, any installed copy is accepted, else `latest`.
|
|
26
|
+
*/
|
|
13
27
|
export declare const NpmSourceSpecSchema: z.ZodObject<{
|
|
14
28
|
kind: z.ZodLiteral<"npm">;
|
|
15
29
|
package: z.ZodString;
|
|
16
30
|
version: z.ZodOptional<z.ZodString>;
|
|
17
31
|
}, z.core.$strip>;
|
|
32
|
+
/**
|
|
33
|
+
* @brief Spec of a local source: a folder on disk.
|
|
34
|
+
*
|
|
35
|
+
* @property kind - Always `local`.
|
|
36
|
+
* @property path - Folder holding the source, absolute or relative to the project root.
|
|
37
|
+
*/
|
|
18
38
|
export declare const LocalSourceSpecSchema: z.ZodObject<{
|
|
19
39
|
kind: z.ZodLiteral<"local">;
|
|
20
40
|
path: z.ZodString;
|
|
21
41
|
}, z.core.$strip>;
|
|
22
|
-
/** Where a source's files come from. */
|
|
42
|
+
/** Where a source's files come from: a git, npm or local spec. */
|
|
23
43
|
export declare const SourceSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
24
44
|
kind: z.ZodLiteral<"git">;
|
|
25
45
|
url: z.ZodString;
|
|
@@ -45,29 +65,44 @@ export declare const SourceRecordSchema: z.ZodRecord<z.ZodString, z.ZodDiscrimin
|
|
|
45
65
|
kind: z.ZodLiteral<"local">;
|
|
46
66
|
path: z.ZodString;
|
|
47
67
|
}, z.core.$strip>], "kind">>;
|
|
68
|
+
/** Git source spec, inferred from `GitSourceSpecSchema`. */
|
|
48
69
|
export type GitSourceSpec = z.infer<typeof GitSourceSpecSchema>;
|
|
70
|
+
/** npm source spec, inferred from `NpmSourceSpecSchema`. */
|
|
49
71
|
export type NpmSourceSpec = z.infer<typeof NpmSourceSpecSchema>;
|
|
72
|
+
/** Local source spec, inferred from `LocalSourceSpecSchema`. */
|
|
50
73
|
export type LocalSourceSpec = z.infer<typeof LocalSourceSpecSchema>;
|
|
74
|
+
/** Any source spec, inferred from `SourceSpecSchema`. */
|
|
51
75
|
export type SourceSpec = z.infer<typeof SourceSpecSchema>;
|
|
76
|
+
/** Registered sources by name, inferred from `SourceRecordSchema`. */
|
|
52
77
|
export type SourceRecord = z.infer<typeof SourceRecordSchema>;
|
|
53
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* @brief One source an installer can read from, either built into its code or registered by the user.
|
|
80
|
+
*
|
|
81
|
+
* @property name - Name the source is listed under.
|
|
82
|
+
* @property spec - Where the source's files come from.
|
|
83
|
+
* @property builtin - Built into the installer. Always listed and never removable.
|
|
84
|
+
*/
|
|
54
85
|
export interface RegisteredSource {
|
|
55
86
|
name: string;
|
|
56
87
|
spec: SourceSpec;
|
|
57
|
-
/** Built into the installer: always listed, never removable */
|
|
58
88
|
builtin: boolean;
|
|
59
89
|
}
|
|
60
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* @brief A source resolved to a folder on disk. Call `dispose` once its files have been read.
|
|
92
|
+
*
|
|
93
|
+
* @property name - Name of the source.
|
|
94
|
+
* @property spec - Spec the checkout was made from.
|
|
95
|
+
* @property dir - Absolute root of the source's files.
|
|
96
|
+
* @property commit - Commit the git clone resolved to. Absent for npm and local sources.
|
|
97
|
+
* @property version - Package version for npm sources, or the `version` in a local source's package.json.
|
|
98
|
+
* @property dispose - Removes a temporary checkout. A no-op for folders the checkout did not create.
|
|
99
|
+
*/
|
|
61
100
|
export interface SourceCheckout {
|
|
62
101
|
name: string;
|
|
63
102
|
spec: SourceSpec;
|
|
64
|
-
/** Absolute root of the source's files */
|
|
65
103
|
dir: string;
|
|
66
|
-
/** Commit the git clone resolved to; absent for npm and local sources */
|
|
67
104
|
commit?: string;
|
|
68
|
-
/** Package version for npm sources, or the `version` in a local source's package.json */
|
|
69
105
|
version?: string;
|
|
70
|
-
/** Removes a temporary checkout; a no-op for folders the checkout did not create */
|
|
71
106
|
dispose: () => void;
|
|
72
107
|
}
|
|
73
108
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iHAAiH;AACjH,eAAO,MAAM,OAAO,QAAwD,CAAC;AAE7E,qEAAqE;AACrE,eAAO,MAAM,WAAW,QAAuD,CAAC;AAEhF,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,aAEyF,CAAC;AAEvH,eAAO,MAAM,mBAAmB;;;;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iHAAiH;AACjH,eAAO,MAAM,OAAO,QAAwD,CAAC;AAE7E,qEAAqE;AACrE,eAAO,MAAM,WAAW,QAAuD,CAAC;AAEhF,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,aAEyF,CAAC;AAEvH;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AAEH,kEAAkE;AAClE,eAAO,MAAM,gBAAgB;;;;;;;;;;;2BAI3B,CAAC;AAEH,gGAAgG;AAChG,eAAO,MAAM,kBAAkB;;;;;;;;;;;4BAA+C,CAAC;AAE/E,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAK,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,4DAA4D;AAC5D,MAAM,MAAM,aAAa,GAAK,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC/D,sEAAsE;AACtE,MAAM,MAAM,YAAY,GAAM,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAK,MAAM,CAAC;IAChB,IAAI,EAAK,UAAU,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAM,MAAM,CAAC;IACjB,IAAI,EAAM,UAAU,CAAC;IACrB,GAAG,EAAO,MAAM,CAAC;IACjB,MAAM,CAAC,EAAG,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAG,MAAM,IAAI,CAAC;CACtB"}
|
package/dist/sources/types.js
CHANGED
|
@@ -8,24 +8,41 @@ export const NPM_PACKAGE = /^(@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/;
|
|
|
8
8
|
export const SourceNameSchema = z
|
|
9
9
|
.string()
|
|
10
10
|
.regex(/^[a-z0-9][a-z0-9._-]*$/, "use lowercase letters, digits, `.`, `_` and `-`, starting with a letter or digit");
|
|
11
|
+
/**
|
|
12
|
+
* @brief Spec of a git source: a clone of a repository.
|
|
13
|
+
*
|
|
14
|
+
* @property kind - Always `git`.
|
|
15
|
+
* @property url - Clone URL.
|
|
16
|
+
* @property ref - Branch or tag to check out. The default branch when absent.
|
|
17
|
+
*/
|
|
11
18
|
export const GitSourceSpecSchema = z.object({
|
|
12
19
|
kind: z.literal("git"),
|
|
13
20
|
url: z.string().regex(GIT_URL, "is not a git URL (https://, ssh://, git://, file:// or git@)"),
|
|
14
|
-
/** Branch or tag to check out; the default branch when absent */
|
|
15
21
|
ref: z.string().min(1).optional(),
|
|
16
22
|
});
|
|
23
|
+
/**
|
|
24
|
+
* @brief Spec of an npm source: a published package.
|
|
25
|
+
*
|
|
26
|
+
* @property kind - Always `npm`.
|
|
27
|
+
* @property package - Package name, scoped or not.
|
|
28
|
+
* @property version - Exact version, semver range or dist-tag. When absent, any installed copy is accepted, else `latest`.
|
|
29
|
+
*/
|
|
17
30
|
export const NpmSourceSpecSchema = z.object({
|
|
18
31
|
kind: z.literal("npm"),
|
|
19
32
|
package: z.string().regex(NPM_PACKAGE, "is not an npm package name"),
|
|
20
|
-
/** Exact version, semver range or dist-tag; absent accepts any installed copy, else `latest` */
|
|
21
33
|
version: z.string().min(1).optional(),
|
|
22
34
|
});
|
|
35
|
+
/**
|
|
36
|
+
* @brief Spec of a local source: a folder on disk.
|
|
37
|
+
*
|
|
38
|
+
* @property kind - Always `local`.
|
|
39
|
+
* @property path - Folder holding the source, absolute or relative to the project root.
|
|
40
|
+
*/
|
|
23
41
|
export const LocalSourceSpecSchema = z.object({
|
|
24
42
|
kind: z.literal("local"),
|
|
25
|
-
/** Folder holding the source, absolute or relative to the project root */
|
|
26
43
|
path: z.string().min(1),
|
|
27
44
|
});
|
|
28
|
-
/** Where a source's files come from. */
|
|
45
|
+
/** Where a source's files come from: a git, npm or local spec. */
|
|
29
46
|
export const SourceSpecSchema = z.discriminatedUnion("kind", [
|
|
30
47
|
GitSourceSpecSchema,
|
|
31
48
|
NpmSourceSpecSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iHAAiH;AACjH,MAAM,CAAC,MAAM,OAAO,GAAG,qDAAqD,CAAC;AAE7E,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,oDAAoD,CAAC;AAEhF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,KAAK,CAAC,wBAAwB,EAAE,kFAAkF,CAAC,CAAC;AAEvH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACtB,GAAG,EAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,8DAA8D,CAAC;IAC/F,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iHAAiH;AACjH,MAAM,CAAC,MAAM,OAAO,GAAG,qDAAqD,CAAC;AAE7E,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,oDAAoD,CAAC;AAEhF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,KAAK,CAAC,wBAAwB,EAAE,kFAAkF,CAAC,CAAC;AAEvH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACtB,GAAG,EAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,8DAA8D,CAAC;IAC/F,GAAG,EAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACzB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,4BAA4B,CAAC;IACpE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACxB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxB,CAAC,CAAC;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC3D,mBAAmB;IACnB,mBAAmB;IACnB,qBAAqB;CACtB,CAAC,CAAC;AAEH,gGAAgG;AAChG,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC"}
|
package/dist/utils/errors.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* @brief Returns the message of a thrown value, whether or not it is an `Error`.
|
|
3
|
+
*
|
|
4
|
+
* @param error - Thrown value of any type, e.g. an `Error` or a string.
|
|
5
|
+
* @returns The `message` of an `Error`, or the value converted to a string.
|
|
6
|
+
*/
|
|
2
7
|
export declare function errorMessage(error: unknown): string;
|
|
3
8
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD"}
|
package/dist/utils/errors.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// packages/core/src/utils/errors.ts
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* @brief Returns the message of a thrown value, whether or not it is an `Error`.
|
|
4
|
+
*
|
|
5
|
+
* @param error - Thrown value of any type, e.g. an `Error` or a string.
|
|
6
|
+
* @returns The `message` of an `Error`, or the value converted to a string.
|
|
7
|
+
*/
|
|
3
8
|
export function errorMessage(error) {
|
|
4
9
|
return error instanceof Error ? error.message : String(error);
|
|
5
10
|
}
|
package/dist/utils/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/utils/merge.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Recursively merges `patch` into `base` without mutating either.
|
|
3
|
-
*
|
|
2
|
+
* @brief Recursively merges `patch` into `base` without mutating either.
|
|
3
|
+
*
|
|
4
|
+
* Plain objects merge key by key. Arrays and primitives in `patch` replace the
|
|
5
|
+
* value in `base`, and keys whose value is `undefined` are skipped.
|
|
6
|
+
*
|
|
7
|
+
* @param base - Value to merge into. Its type is the type of the result.
|
|
8
|
+
* @param patch - Overrides, usually a partial of `base`. Any type.
|
|
9
|
+
* @returns A new value with `patch` applied.
|
|
4
10
|
*/
|
|
5
11
|
export declare function deepMerge<T>(base: T, patch: unknown): T;
|
|
6
12
|
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAUvD"}
|
package/dist/utils/merge.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
// packages/core/src/utils/merge.ts
|
|
2
|
+
/** Tells whether a value is a non-null object that is not an array. */
|
|
2
3
|
function isPlainObject(value) {
|
|
3
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
6
|
-
* Recursively merges `patch` into `base` without mutating either.
|
|
7
|
-
*
|
|
7
|
+
* @brief Recursively merges `patch` into `base` without mutating either.
|
|
8
|
+
*
|
|
9
|
+
* Plain objects merge key by key. Arrays and primitives in `patch` replace the
|
|
10
|
+
* value in `base`, and keys whose value is `undefined` are skipped.
|
|
11
|
+
*
|
|
12
|
+
* @param base - Value to merge into. Its type is the type of the result.
|
|
13
|
+
* @param patch - Overrides, usually a partial of `base`. Any type.
|
|
14
|
+
* @returns A new value with `patch` applied.
|
|
8
15
|
*/
|
|
9
16
|
export function deepMerge(base, patch) {
|
|
10
17
|
if (!isPlainObject(base) || !isPlainObject(patch)) {
|
package/dist/utils/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,uEAAuE;AACvE,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAI,IAAO,EAAE,KAAc;IAClD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAM,CAAC;IACnD,CAAC;IACD,MAAM,GAAG,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAC;IACjD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,GAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Name, version, description and license of a package, as its `package.json` states them.
|
|
3
|
+
*
|
|
4
|
+
* Built by `readPackageMeta`. The `mods`, `skills` and `ui` CLIs read it to name themselves.
|
|
5
|
+
*
|
|
6
|
+
* @property name - Package name, e.g. `@g3nomaly/core`, or `""` when missing.
|
|
7
|
+
* @property version - Package version, e.g. `1.2.3`, or `"0.0.0"` when missing.
|
|
8
|
+
* @property description - One-line description, or `""` when missing.
|
|
9
|
+
* @property license - SPDX license id, e.g. `MIT`, or `""` when missing.
|
|
10
|
+
*/
|
|
1
11
|
export interface PackageMetadata {
|
|
2
12
|
name: string;
|
|
3
13
|
version: string;
|
|
@@ -5,8 +15,12 @@ export interface PackageMetadata {
|
|
|
5
15
|
license: string;
|
|
6
16
|
}
|
|
7
17
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
18
|
+
* @brief Reads the metadata of the package that owns `entryUrl`.
|
|
19
|
+
*
|
|
20
|
+
* Reads `package.json` on every call, so the result is never stale.
|
|
21
|
+
*
|
|
22
|
+
* @param entryUrl - File URL of a module in the package, pass `import.meta.url`.
|
|
23
|
+
* @returns Metadata of that package. Missing fields come back as empty strings, and a missing version as `"0.0.0"`.
|
|
10
24
|
*/
|
|
11
25
|
export declare function readPackageMeta(entryUrl: string): PackageMetadata;
|
|
12
26
|
//# sourceMappingURL=packageMeta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageMeta.d.ts","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAS,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;CACrB;AAED
|
|
1
|
+
{"version":3,"file":"packageMeta.d.ts","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAS,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CASjE"}
|
|
@@ -4,8 +4,12 @@ import { dirname, join } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { findPackageRoot } from "./paths";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* @brief Reads the metadata of the package that owns `entryUrl`.
|
|
8
|
+
*
|
|
9
|
+
* Reads `package.json` on every call, so the result is never stale.
|
|
10
|
+
*
|
|
11
|
+
* @param entryUrl - File URL of a module in the package, pass `import.meta.url`.
|
|
12
|
+
* @returns Metadata of that package. Missing fields come back as empty strings, and a missing version as `"0.0.0"`.
|
|
9
13
|
*/
|
|
10
14
|
export function readPackageMeta(entryUrl) {
|
|
11
15
|
const root = findPackageRoot(dirname(fileURLToPath(entryUrl)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageMeta.js","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"packageMeta.js","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAmB1C;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAA4B,CAAC;IACpG,OAAO;QACL,IAAI,EAAS,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QACzD,OAAO,EAAM,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;QACpE,WAAW,EAAE,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;QACvE,OAAO,EAAM,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;KAChE,CAAC;AACJ,CAAC"}
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @brief Finds the nearest directory at or above `fromDir` that holds a `package.json`.
|
|
3
|
+
*
|
|
3
4
|
* Pass `import.meta.dir` to get the root of the package the caller lives in,
|
|
4
5
|
* from `src/` and `dist/` alike.
|
|
5
6
|
*
|
|
6
|
-
* @
|
|
7
|
+
* @param fromDir - Directory to start searching from, e.g. `import.meta.dir`.
|
|
8
|
+
* @returns Path of the package root directory.
|
|
9
|
+
* @throws {Error} When no package.json exists on the way up to the filesystem root.
|
|
7
10
|
*/
|
|
8
11
|
export declare function findPackageRoot(fromDir: string): string;
|
|
9
12
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
13
|
+
* @brief Finds the nearest directory at or above `fromDir` that holds `marker` as a direct entry.
|
|
14
|
+
*
|
|
15
|
+
* @param fromDir - Directory to start searching from.
|
|
16
|
+
* @param marker - Name of a file or directory to look for, e.g. `.git`.
|
|
17
|
+
* @returns Directory that holds `marker`, or `null` when no ancestor holds it.
|
|
12
18
|
*/
|
|
13
19
|
export declare function findUp(fromDir: string, marker: string): string | null;
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Finds the root of the git repository that contains `fromDir`.
|
|
22
|
+
*
|
|
23
|
+
* @param fromDir - Directory to start searching from.
|
|
24
|
+
* @returns Root directory of the repository, or `null` outside a repo.
|
|
25
|
+
*/
|
|
15
26
|
export declare function findGitRoot(fromDir: string): string | null;
|
|
16
27
|
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQvD;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQrE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE1D"}
|
package/dist/utils/paths.js
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* @brief Finds the nearest directory at or above `fromDir` that holds a `package.json`.
|
|
6
|
+
*
|
|
6
7
|
* Pass `import.meta.dir` to get the root of the package the caller lives in,
|
|
7
8
|
* from `src/` and `dist/` alike.
|
|
8
9
|
*
|
|
9
|
-
* @
|
|
10
|
+
* @param fromDir - Directory to start searching from, e.g. `import.meta.dir`.
|
|
11
|
+
* @returns Path of the package root directory.
|
|
12
|
+
* @throws {Error} When no package.json exists on the way up to the filesystem root.
|
|
10
13
|
*/
|
|
11
14
|
export function findPackageRoot(fromDir) {
|
|
12
15
|
let dir = fromDir;
|
|
@@ -19,8 +22,11 @@ export function findPackageRoot(fromDir) {
|
|
|
19
22
|
return dir;
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
25
|
+
* @brief Finds the nearest directory at or above `fromDir` that holds `marker` as a direct entry.
|
|
26
|
+
*
|
|
27
|
+
* @param fromDir - Directory to start searching from.
|
|
28
|
+
* @param marker - Name of a file or directory to look for, e.g. `.git`.
|
|
29
|
+
* @returns Directory that holds `marker`, or `null` when no ancestor holds it.
|
|
24
30
|
*/
|
|
25
31
|
export function findUp(fromDir, marker) {
|
|
26
32
|
let dir = fromDir;
|
|
@@ -33,7 +39,12 @@ export function findUp(fromDir, marker) {
|
|
|
33
39
|
dir = parent;
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Finds the root of the git repository that contains `fromDir`.
|
|
44
|
+
*
|
|
45
|
+
* @param fromDir - Directory to start searching from.
|
|
46
|
+
* @returns Root directory of the repository, or `null` outside a repo.
|
|
47
|
+
*/
|
|
37
48
|
export function findGitRoot(fromDir) {
|
|
38
49
|
return findUp(fromDir, ".git");
|
|
39
50
|
}
|
package/dist/utils/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":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MAAM,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/utils/prompt.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value a prompt gave back, or exits the process when the user cancelled it.
|
|
3
|
+
*
|
|
4
|
+
* @param result - Value a prompt returned, or the symbol it returns on cancel.
|
|
5
|
+
* @returns The value, unchanged.
|
|
6
|
+
*/
|
|
2
7
|
export declare function guardCancel<T>(result: T | symbol): T;
|
|
3
8
|
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,CAGpD"}
|