@g3nomaly/core 0.3.0 → 0.3.2
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/LICENSE +95 -0
- package/dist/cli/commands/add.d.ts +37 -0
- package/dist/cli/commands/add.d.ts.map +1 -0
- package/dist/cli/commands/add.js +99 -0
- package/dist/cli/commands/add.js.map +1 -0
- 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 +78 -0
- package/dist/cli/commands/installFromSources.d.ts.map +1 -0
- package/dist/cli/commands/installFromSources.js +187 -0
- package/dist/cli/commands/installFromSources.js.map +1 -0
- package/dist/cli/commands/ls.d.ts +26 -0
- package/dist/cli/commands/ls.d.ts.map +1 -0
- package/dist/cli/commands/ls.js +85 -0
- package/dist/cli/commands/ls.js.map +1 -0
- package/dist/cli/commands/remove.d.ts +19 -0
- package/dist/cli/commands/remove.d.ts.map +1 -0
- package/dist/cli/commands/remove.js +123 -0
- package/dist/cli/commands/remove.js.map +1 -0
- package/dist/cli/commands/sources.d.ts +69 -0
- package/dist/cli/commands/sources.d.ts.map +1 -0
- package/dist/cli/commands/sources.js +103 -0
- package/dist/cli/commands/sources.js.map +1 -0
- package/dist/cli/commands/update.d.ts +17 -0
- package/dist/cli/commands/update.d.ts.map +1 -0
- package/dist/cli/commands/update.js +110 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/dialogue.d.ts +126 -0
- package/dist/cli/dialogue.d.ts.map +1 -0
- package/dist/cli/dialogue.js +156 -0
- package/dist/cli/dialogue.js.map +1 -0
- package/dist/cli/index.d.ts +19 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +16 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/installDialogues.d.ts +23 -0
- package/dist/cli/installDialogues.d.ts.map +1 -0
- package/dist/cli/installDialogues.js +89 -0
- package/dist/cli/installDialogues.js.map +1 -0
- package/dist/cli/pick.d.ts +23 -0
- package/dist/cli/pick.d.ts.map +1 -0
- package/dist/cli/pick.js +44 -0
- package/dist/cli/pick.js.map +1 -0
- package/dist/cli/report.d.ts +58 -0
- package/dist/cli/report.d.ts.map +1 -0
- package/dist/cli/report.js +92 -0
- package/dist/cli/report.js.map +1 -0
- package/dist/cli/theme.d.ts +27 -0
- package/dist/cli/theme.d.ts.map +1 -0
- package/dist/cli/theme.js +29 -0
- package/dist/cli/theme.js.map +1 -0
- package/dist/cli/types.d.ts +96 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +2 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/config/config.d.ts +55 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +107 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +182 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +51 -0
- package/dist/config/types.js.map +1 -0
- package/dist/hash/hash.d.ts +23 -0
- package/dist/hash/hash.d.ts.map +1 -0
- package/dist/hash/hash.js +43 -0
- package/dist/hash/hash.js.map +1 -0
- package/dist/hash/index.d.ts +2 -0
- package/dist/hash/index.d.ts.map +1 -0
- package/dist/hash/index.js +3 -0
- package/dist/hash/index.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/installer/classify.d.ts +33 -0
- package/dist/installer/classify.d.ts.map +1 -0
- package/dist/installer/classify.js +82 -0
- package/dist/installer/classify.js.map +1 -0
- package/dist/installer/files.d.ts +19 -0
- package/dist/installer/files.d.ts.map +1 -0
- package/dist/installer/files.js +23 -0
- package/dist/installer/files.js.map +1 -0
- package/dist/installer/index.d.ts +19 -0
- package/dist/installer/index.d.ts.map +1 -0
- package/dist/installer/index.js +14 -0
- package/dist/installer/index.js.map +1 -0
- package/dist/installer/install.d.ts +25 -0
- package/dist/installer/install.d.ts.map +1 -0
- package/dist/installer/install.js +74 -0
- package/dist/installer/install.js.map +1 -0
- package/dist/installer/io.d.ts +9 -0
- package/dist/installer/io.d.ts.map +1 -0
- package/dist/installer/io.js +23 -0
- package/dist/installer/io.js.map +1 -0
- package/dist/installer/manifest.d.ts +69 -0
- package/dist/installer/manifest.d.ts.map +1 -0
- package/dist/installer/manifest.js +70 -0
- package/dist/installer/manifest.js.map +1 -0
- package/dist/installer/manifestSources.d.ts +32 -0
- package/dist/installer/manifestSources.d.ts.map +1 -0
- package/dist/installer/manifestSources.js +50 -0
- package/dist/installer/manifestSources.js.map +1 -0
- package/dist/installer/marketplace.d.ts +46 -0
- package/dist/installer/marketplace.d.ts.map +1 -0
- package/dist/installer/marketplace.js +72 -0
- package/dist/installer/marketplace.js.map +1 -0
- package/dist/installer/origin.d.ts +59 -0
- package/dist/installer/origin.d.ts.map +1 -0
- package/dist/installer/origin.js +29 -0
- package/dist/installer/origin.js.map +1 -0
- package/dist/installer/remove.d.ts +26 -0
- package/dist/installer/remove.d.ts.map +1 -0
- package/dist/installer/remove.js +49 -0
- package/dist/installer/remove.js.map +1 -0
- package/dist/installer/resolve.d.ts +127 -0
- package/dist/installer/resolve.d.ts.map +1 -0
- package/dist/installer/resolve.js +251 -0
- package/dist/installer/resolve.js.map +1 -0
- package/dist/installer/sourceRegistry.d.ts +96 -0
- package/dist/installer/sourceRegistry.d.ts.map +1 -0
- package/dist/installer/sourceRegistry.js +86 -0
- package/dist/installer/sourceRegistry.js.map +1 -0
- package/dist/installer/types.d.ts +133 -0
- package/dist/installer/types.d.ts.map +1 -0
- package/dist/installer/types.js +31 -0
- package/dist/installer/types.js.map +1 -0
- package/dist/registry/index.d.ts +8 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +9 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/registry.handlers.d.ts +16 -0
- package/dist/registry/registry.handlers.d.ts.map +1 -0
- package/dist/registry/registry.handlers.js +13 -0
- package/dist/registry/registry.handlers.js.map +1 -0
- package/dist/registry/registry.io.d.ts +38 -0
- package/dist/registry/registry.io.d.ts.map +1 -0
- package/dist/registry/registry.io.js +101 -0
- package/dist/registry/registry.io.js.map +1 -0
- package/dist/registry/registry.mutations.d.ts +19 -0
- package/dist/registry/registry.mutations.d.ts.map +1 -0
- package/dist/registry/registry.mutations.js +29 -0
- package/dist/registry/registry.mutations.js.map +1 -0
- package/dist/registry/registry.selectors.d.ts +68 -0
- package/dist/registry/registry.selectors.d.ts.map +1 -0
- package/dist/registry/registry.selectors.js +91 -0
- package/dist/registry/registry.selectors.js.map +1 -0
- package/dist/registry/registry.store.d.ts +47 -0
- package/dist/registry/registry.store.d.ts.map +1 -0
- package/dist/registry/registry.store.js +36 -0
- package/dist/registry/registry.store.js.map +1 -0
- package/dist/registry/registry.template.d.ts +29 -0
- package/dist/registry/registry.template.d.ts.map +1 -0
- package/dist/registry/registry.template.js +70 -0
- package/dist/registry/registry.template.js.map +1 -0
- package/dist/registry/types.d.ts +47 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +35 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +3 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/securityParser.d.ts +15 -0
- package/dist/security/securityParser.d.ts.map +1 -0
- package/dist/security/securityParser.js +79 -0
- package/dist/security/securityParser.js.map +1 -0
- package/dist/security/securityWorker.d.ts +19 -0
- package/dist/security/securityWorker.d.ts.map +1 -0
- package/dist/security/securityWorker.js +137 -0
- package/dist/security/securityWorker.js.map +1 -0
- package/dist/sources/checkout.d.ts +20 -0
- package/dist/sources/checkout.d.ts.map +1 -0
- package/dist/sources/checkout.js +33 -0
- package/dist/sources/checkout.js.map +1 -0
- package/dist/sources/git.d.ts +11 -0
- package/dist/sources/git.d.ts.map +1 -0
- package/dist/sources/git.js +24 -0
- package/dist/sources/git.js.map +1 -0
- package/dist/sources/index.d.ts +5 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +6 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/local.d.ts +12 -0
- package/dist/sources/local.d.ts.map +1 -0
- package/dist/sources/local.js +22 -0
- package/dist/sources/local.js.map +1 -0
- package/dist/sources/npm.d.ts +16 -0
- package/dist/sources/npm.d.ts.map +1 -0
- package/dist/sources/npm.js +162 -0
- package/dist/sources/npm.js.map +1 -0
- package/dist/sources/packageJson.d.ts +3 -0
- package/dist/sources/packageJson.d.ts.map +1 -0
- package/dist/sources/packageJson.js +13 -0
- package/dist/sources/packageJson.js.map +1 -0
- package/dist/sources/parse.d.ts +42 -0
- package/dist/sources/parse.d.ts.map +1 -0
- package/dist/sources/parse.js +114 -0
- package/dist/sources/parse.js.map +1 -0
- package/dist/sources/process.d.ts +21 -0
- package/dist/sources/process.d.ts.map +1 -0
- package/dist/sources/process.js +46 -0
- package/dist/sources/process.js.map +1 -0
- package/dist/sources/register.d.ts +31 -0
- package/dist/sources/register.d.ts.map +1 -0
- package/dist/sources/register.js +52 -0
- package/dist/sources/register.js.map +1 -0
- package/dist/sources/types.d.ts +108 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +53 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/utils/errors.d.ts +8 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +11 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/merge.d.ts +12 -0
- package/dist/utils/merge.d.ts.map +1 -0
- package/dist/utils/merge.js +28 -0
- package/dist/utils/merge.js.map +1 -0
- package/dist/utils/packageMeta.d.ts +26 -0
- package/dist/utils/packageMeta.d.ts.map +1 -0
- package/dist/utils/packageMeta.js +24 -0
- package/dist/utils/packageMeta.js.map +1 -0
- package/dist/utils/paths.d.ts +27 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +51 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/prompt.d.ts +8 -0
- package/dist/utils/prompt.d.ts.map +1 -0
- package/dist/utils/prompt.js +13 -0
- package/dist/utils/prompt.js.map +1 -0
- package/dist/utils/version.d.ts +14 -0
- package/dist/utils/version.d.ts.map +1 -0
- package/dist/utils/version.js +140 -0
- package/dist/utils/version.js.map +1 -0
- package/package.json +64 -3
- package/README.md +0 -3
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* @brief Where an entry came from: the registered source, the folder its file paths resolve against, and the revision read.
|
|
4
|
+
*
|
|
5
|
+
* @property source - Name of the registered source, e.g. `g3n-skills`.
|
|
6
|
+
* @property dir - Source-relative folder that `files[].path` resolves against, e.g. `skills/speech` or `dist/components`.
|
|
7
|
+
* @property commit - Commit a git source resolved to.
|
|
8
|
+
* @property version - Version an npm source resolved to, or the version in a local source's package.json.
|
|
9
|
+
*/
|
|
10
|
+
export declare const EntryOriginSchema: z.ZodObject<{
|
|
11
|
+
source: z.ZodString;
|
|
12
|
+
dir: z.ZodString;
|
|
13
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
14
|
+
version: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
/** Origin of one entry, inferred from `EntryOriginSchema`. */
|
|
17
|
+
export type EntryOrigin = z.infer<typeof EntryOriginSchema>;
|
|
18
|
+
/**
|
|
19
|
+
* @brief A registry entry read from a source: the base fields plus its origin.
|
|
20
|
+
*
|
|
21
|
+
* @property origin - Where the entry came from.
|
|
22
|
+
* @property forkedFrom - Key of the entry this one was forked from, after local changes. A fork keeps the original's files and
|
|
23
|
+
* `origin`, is never updated, and stands in for that key as a dependency.
|
|
24
|
+
*/
|
|
25
|
+
export declare const OriginEntrySchema: z.ZodObject<{
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
description: z.ZodOptional<z.ZodString>;
|
|
28
|
+
version: z.ZodOptional<z.ZodString>;
|
|
29
|
+
group: z.ZodOptional<z.ZodString>;
|
|
30
|
+
registryDependencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
31
|
+
files: z.ZodArray<z.ZodObject<{
|
|
32
|
+
path: z.ZodString;
|
|
33
|
+
type: z.ZodString;
|
|
34
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
35
|
+
version: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
origin: z.ZodObject<{
|
|
38
|
+
source: z.ZodString;
|
|
39
|
+
dir: z.ZodString;
|
|
40
|
+
commit: z.ZodOptional<z.ZodString>;
|
|
41
|
+
version: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
forkedFrom: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
/** Registry entry with its origin, inferred from `OriginEntrySchema`. */
|
|
46
|
+
export type OriginEntry = z.infer<typeof OriginEntrySchema>;
|
|
47
|
+
/**
|
|
48
|
+
* @brief What a source's reader passes to the function that reads one entry folder.
|
|
49
|
+
*
|
|
50
|
+
* @property origin - Origin recorded on the entry.
|
|
51
|
+
* @property group - Group the entry is listed under, e.g. the plugin it ships in.
|
|
52
|
+
* @property version - Version to record when the entry's own manifest has none.
|
|
53
|
+
*/
|
|
54
|
+
export interface ReadContext {
|
|
55
|
+
origin: EntryOrigin;
|
|
56
|
+
group: string;
|
|
57
|
+
version?: string;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=origin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../src/installer/origin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;;;iBAK5B,CAAA;AAEF,8DAA8D;AAC9D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;iBAG5B,CAAA;AAEF,yEAAyE;AACzE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAI,WAAW,CAAA;IACrB,KAAK,EAAK,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// packages/core/src/installer/origin.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { BaseRegistryEntrySchema } from "../registry/types";
|
|
4
|
+
/**
|
|
5
|
+
* @brief Where an entry came from: the registered source, the folder its file paths resolve against, and the revision read.
|
|
6
|
+
*
|
|
7
|
+
* @property source - Name of the registered source, e.g. `g3n-skills`.
|
|
8
|
+
* @property dir - Source-relative folder that `files[].path` resolves against, e.g. `skills/speech` or `dist/components`.
|
|
9
|
+
* @property commit - Commit a git source resolved to.
|
|
10
|
+
* @property version - Version an npm source resolved to, or the version in a local source's package.json.
|
|
11
|
+
*/
|
|
12
|
+
export const EntryOriginSchema = z.object({
|
|
13
|
+
source: z.string().min(1),
|
|
14
|
+
dir: z.string(),
|
|
15
|
+
commit: z.string().min(1).optional(),
|
|
16
|
+
version: z.string().min(1).optional(),
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* @brief A registry entry read from a source: the base fields plus its origin.
|
|
20
|
+
*
|
|
21
|
+
* @property origin - Where the entry came from.
|
|
22
|
+
* @property forkedFrom - Key of the entry this one was forked from, after local changes. A fork keeps the original's files and
|
|
23
|
+
* `origin`, is never updated, and stands in for that key as a dependency.
|
|
24
|
+
*/
|
|
25
|
+
export const OriginEntrySchema = BaseRegistryEntrySchema.extend({
|
|
26
|
+
origin: EntryOriginSchema,
|
|
27
|
+
forkedFrom: z.string().min(1).optional(),
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=origin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"origin.js","sourceRoot":"","sources":["../../src/installer/origin.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,MAAM,EAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,GAAG,EAAM,CAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAA;AAKF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,uBAAuB,CAAC,MAAM,CAAC;IAC9D,MAAM,EAAM,iBAAiB;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BaseFileEntry } from "../registry/types";
|
|
2
|
+
import type { InstallerIO, RemoveResult } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* @brief Removes a manifest entry's files from `installDir`.
|
|
5
|
+
*
|
|
6
|
+
* A file whose on-disk hash differs from the hash recorded at install time is kept unless `opts.force`
|
|
7
|
+
* is set. Directories left empty by the removals are pruned up to `installDir`.
|
|
8
|
+
*
|
|
9
|
+
* @param files - Manifest entries to remove, with their install-time hashes.
|
|
10
|
+
* @param installDir - Absolute folder the package is installed into.
|
|
11
|
+
* @param opts - `force` removes changed files too.
|
|
12
|
+
* @param io - Filesystem boundary used to test, hash and delete files.
|
|
13
|
+
* @returns Removed, kept and missing relative paths.
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeInstalledFiles(files: readonly BaseFileEntry[], installDir: string, opts: {
|
|
16
|
+
force?: boolean;
|
|
17
|
+
}, io: InstallerIO): Promise<RemoveResult>;
|
|
18
|
+
/**
|
|
19
|
+
* @brief Removes `dir` and its parents while they exist and are empty.
|
|
20
|
+
*
|
|
21
|
+
* @param dir - Absolute folder to start from.
|
|
22
|
+
* @param stopAt - Absolute folder never removed, such as the install root.
|
|
23
|
+
* @param io - Filesystem boundary used to test and delete folders.
|
|
24
|
+
*/
|
|
25
|
+
export declare function pruneEmptyDirs(dir: string, stopAt: string, io: InstallerIO): void;
|
|
26
|
+
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/installer/remove.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAExD;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EACzB,EAAE,EAAE,WAAW,GACd,OAAO,CAAC,YAAY,CAAC,CAsBvB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAMjF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// packages/core/src/installer/remove.ts
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* @brief Removes a manifest entry's files from `installDir`.
|
|
5
|
+
*
|
|
6
|
+
* A file whose on-disk hash differs from the hash recorded at install time is kept unless `opts.force`
|
|
7
|
+
* is set. Directories left empty by the removals are pruned up to `installDir`.
|
|
8
|
+
*
|
|
9
|
+
* @param files - Manifest entries to remove, with their install-time hashes.
|
|
10
|
+
* @param installDir - Absolute folder the package is installed into.
|
|
11
|
+
* @param opts - `force` removes changed files too.
|
|
12
|
+
* @param io - Filesystem boundary used to test, hash and delete files.
|
|
13
|
+
* @returns Removed, kept and missing relative paths.
|
|
14
|
+
*/
|
|
15
|
+
export async function removeInstalledFiles(files, installDir, opts, io) {
|
|
16
|
+
const result = { removed: [], kept: [], missing: [] };
|
|
17
|
+
for (const file of files) {
|
|
18
|
+
const destPath = path.join(installDir, file.path);
|
|
19
|
+
if (!io.exists(destPath)) {
|
|
20
|
+
result.missing.push(file.path);
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (file.hash && opts.force !== true && (await io.hashFile(destPath)) !== file.hash) {
|
|
24
|
+
result.kept.push(file.path);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
io.removeFile(destPath);
|
|
28
|
+
result.removed.push(file.path);
|
|
29
|
+
}
|
|
30
|
+
for (const relPath of result.removed) {
|
|
31
|
+
pruneEmptyDirs(path.dirname(path.join(installDir, relPath)), installDir, io);
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @brief Removes `dir` and its parents while they exist and are empty.
|
|
37
|
+
*
|
|
38
|
+
* @param dir - Absolute folder to start from.
|
|
39
|
+
* @param stopAt - Absolute folder never removed, such as the install root.
|
|
40
|
+
* @param io - Filesystem boundary used to test and delete folders.
|
|
41
|
+
*/
|
|
42
|
+
export function pruneEmptyDirs(dir, stopAt, io) {
|
|
43
|
+
let current = dir;
|
|
44
|
+
while (current !== stopAt && io.exists(current) && io.listDir(current).length === 0) {
|
|
45
|
+
io.removeDir(current);
|
|
46
|
+
current = path.dirname(current);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/installer/remove.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAA;AAI5B;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAA+B,EAC/B,UAAkB,EAClB,IAAyB,EACzB,EAAe;IAEf,MAAM,MAAM,GAAiB,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;IAEnE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QACjD,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC9B,SAAQ;QACV,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACpF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC3B,SAAQ;QACV,CAAC;QACD,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;QACvB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACrC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;IAC9E,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,MAAc,EAAE,EAAe;IACzE,IAAI,OAAO,GAAG,GAAG,CAAA;IACjB,OAAO,OAAO,KAAK,MAAM,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpF,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QACrB,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { OriginEntry } from "./origin";
|
|
2
|
+
import type { SourceOffer } from "./sourceRegistry";
|
|
3
|
+
/**
|
|
4
|
+
* @brief An entry or group as named on the command line or in `registryDependencies`.
|
|
5
|
+
*
|
|
6
|
+
* @property name - Entry key or group name, lowercased, e.g. `emphasise`.
|
|
7
|
+
* @property source - Registered source the name must come from, e.g. `g3n-skills`, when given as `<name>@<source>`. Absent when not given.
|
|
8
|
+
*/
|
|
9
|
+
export interface EntryRequest {
|
|
10
|
+
name: string;
|
|
11
|
+
source?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @brief Entries a set of requests resolved to, and what could not be resolved.
|
|
15
|
+
*
|
|
16
|
+
* @property entries - Resolved entries by key, `registryDependencies` rewritten to the resolved keys.
|
|
17
|
+
* @property unknown - Requests and dependencies no source offers, e.g. `ghost` or `ghost@mine`.
|
|
18
|
+
* @property ambiguous - One message per name more than one source offers, naming the qualified forms to pick from.
|
|
19
|
+
* @property notes - Why an entry nobody named is in the set, e.g. `{ vocabulary: "dep of plan" }`.
|
|
20
|
+
*/
|
|
21
|
+
export interface Resolution<T extends OriginEntry> {
|
|
22
|
+
entries: Map<string, SourceOffer<T>>;
|
|
23
|
+
unknown: string[];
|
|
24
|
+
ambiguous: string[];
|
|
25
|
+
notes: Record<string, string>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @brief One entry with its dependencies resolved across sources.
|
|
29
|
+
*
|
|
30
|
+
* @property offer - The entry with `registryDependencies` rewritten to the resolved keys.
|
|
31
|
+
* @property dependencies - Offers of the dependencies found, in the order declared.
|
|
32
|
+
* @property unknown - Dependencies no source offers, e.g. `ghost (dep of plan)`.
|
|
33
|
+
* @property ambiguous - One message per dependency more than one source offers.
|
|
34
|
+
*/
|
|
35
|
+
export interface ResolvedDependencies<T extends OriginEntry> {
|
|
36
|
+
offer: SourceOffer<T>;
|
|
37
|
+
dependencies: SourceOffer<T>[];
|
|
38
|
+
unknown: string[];
|
|
39
|
+
ambiguous: string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* @brief Parses a typed request such as `emphasise` or `emphasise@g3n-skills`.
|
|
43
|
+
*
|
|
44
|
+
* Names are matched in lowercase. A leading `@` belongs to the name, as in
|
|
45
|
+
* `@shadcn/button@shadcn`, so the source starts at the first `@` after the first character.
|
|
46
|
+
*
|
|
47
|
+
* @param token - Word as typed on the command line, e.g. `emphasise@g3n-skills`.
|
|
48
|
+
* @returns Request with the lowercased name, and the source when one is given.
|
|
49
|
+
*/
|
|
50
|
+
export declare function parseRequest(token: string): EntryRequest;
|
|
51
|
+
/**
|
|
52
|
+
* @brief Formats a request as it is typed, e.g. `emphasise@g3n-skills`.
|
|
53
|
+
*
|
|
54
|
+
* @param request - Parsed request, e.g. `{ name: "emphasise", source: "g3n-skills" }`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function formatRequest(request: EntryRequest): string;
|
|
57
|
+
/**
|
|
58
|
+
* @brief Resolves the `registryDependencies` of one entry against every offer.
|
|
59
|
+
*
|
|
60
|
+
* A dependency that cannot be resolved keeps its bare name in the rewritten
|
|
61
|
+
* list and is reported in `unknown` or `ambiguous`.
|
|
62
|
+
*
|
|
63
|
+
* @param offer - Offer whose dependencies are resolved.
|
|
64
|
+
* @param offers - Every offer to resolve against, across all sources.
|
|
65
|
+
* @param preferred - Source to take a key from when several offer it: where it is installed, or where the request named it.
|
|
66
|
+
* @returns The offer with rewritten dependencies, the dependency offers found, and the ones that did not resolve.
|
|
67
|
+
*/
|
|
68
|
+
export declare function resolveDependencies<T extends OriginEntry>(offer: SourceOffer<T>, offers: readonly SourceOffer<T>[], preferred?: Record<string, string>): ResolvedDependencies<T>;
|
|
69
|
+
/**
|
|
70
|
+
* @brief Resolves entry and group names against every offer, with the dependency closure of each across sources.
|
|
71
|
+
*
|
|
72
|
+
* An entry named in the request settles which source its key comes from for
|
|
73
|
+
* every dependency. Two different entries wanted under one key are reported as
|
|
74
|
+
* ambiguous, since a target holds one folder per key.
|
|
75
|
+
*
|
|
76
|
+
* @param tokens - Names as typed on the command line, e.g. `["emphasise", "ui@g3n-skills"]`.
|
|
77
|
+
* @param offers - Every offer to resolve against, across all sources.
|
|
78
|
+
* @param installed - Source each installed key came from.
|
|
79
|
+
* @returns The entries to install, and what could not be resolved or was ambiguous.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveRequests<T extends OriginEntry>(tokens: readonly string[], offers: readonly SourceOffer<T>[], installed?: Record<string, string>): Resolution<T>;
|
|
82
|
+
/**
|
|
83
|
+
* @brief Resolves entry and group names against what a target has installed.
|
|
84
|
+
*
|
|
85
|
+
* `<name>@<source>` keeps only entries installed from that source. Works from
|
|
86
|
+
* the install manifest alone, so no source needs to be reachable.
|
|
87
|
+
*
|
|
88
|
+
* @param tokens - Names as typed, e.g. `["emphasise@g3n-skills"]`.
|
|
89
|
+
* @param installed - Installed entries by key, from one target's manifest.
|
|
90
|
+
* @returns Installed keys in the order named, and the names that match nothing installed.
|
|
91
|
+
*/
|
|
92
|
+
export declare function resolveInstalled<T extends OriginEntry>(tokens: readonly string[], installed: Record<string, T>): {
|
|
93
|
+
keys: string[];
|
|
94
|
+
unknown: string[];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @brief Maps each installed key to the source it came from, across manifests.
|
|
98
|
+
*
|
|
99
|
+
* The first manifest wins on a clash.
|
|
100
|
+
*
|
|
101
|
+
* @param installed - Installed entries by key, one record per target manifest.
|
|
102
|
+
* @returns Source name by installed key, e.g. `{ emphasise: "g3n-skills" }`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function installedOrigins<T extends OriginEntry>(installed: readonly Record<string, T>[]): Record<string, string>;
|
|
105
|
+
/**
|
|
106
|
+
* @brief Maps each forked key to the installed fork that stands in for it, across manifests.
|
|
107
|
+
*
|
|
108
|
+
* The first manifest wins on a clash.
|
|
109
|
+
*
|
|
110
|
+
* @param installed - Installed entries by key, one record per target manifest.
|
|
111
|
+
* @returns Installed fork key by forked key, e.g. `{ emphasise: "my-emphasise" }`.
|
|
112
|
+
*/
|
|
113
|
+
export declare function installedForks<T extends OriginEntry>(installed: readonly Record<string, T>[]): Record<string, string>;
|
|
114
|
+
/**
|
|
115
|
+
* @brief Finds the fresh offer for each installed key, from the source it was installed from and never another, with its dependencies resolved.
|
|
116
|
+
*
|
|
117
|
+
* @param keys - Installed keys to update.
|
|
118
|
+
* @param installed - Installed entries by key, from one target's manifest.
|
|
119
|
+
* @param offers - Every offer to search, across all sources.
|
|
120
|
+
* @param preferred - Source each installed key came from, across targets.
|
|
121
|
+
* @returns The offers found, and the keys whose source is gone or no longer offers them.
|
|
122
|
+
*/
|
|
123
|
+
export declare function resolveUpdates<T extends OriginEntry>(keys: readonly string[], installed: Record<string, T>, offers: readonly SourceOffer<T>[], preferred?: Record<string, string>): {
|
|
124
|
+
offers: SourceOffer<T>[];
|
|
125
|
+
missing: string[];
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/installer/resolve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAK,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,WAAW;IAC/C,OAAO,EAAI,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;IACtC,OAAO,EAAI,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,KAAK,EAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,WAAW;IACzD,KAAK,EAAS,WAAW,CAAC,CAAC,CAAC,CAAA;IAC5B,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9B,OAAO,EAAO,MAAM,EAAE,CAAA;IACtB,SAAS,EAAK,MAAM,EAAE,CAAA;CACvB;AAKD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,Y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B,cAAc,CAAC,CAAC,SAAS,WAAW,EAClD,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAC5B,MAAM,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EACjC,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACrC;IAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CASjD"}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @brief Parses a typed request such as `emphasise` or `emphasise@g3n-skills`.
|
|
3
|
+
*
|
|
4
|
+
* Names are matched in lowercase. A leading `@` belongs to the name, as in
|
|
5
|
+
* `@shadcn/button@shadcn`, so the source starts at the first `@` after the first character.
|
|
6
|
+
*
|
|
7
|
+
* @param token - Word as typed on the command line, e.g. `emphasise@g3n-skills`.
|
|
8
|
+
* @returns Request with the lowercased name, and the source when one is given.
|
|
9
|
+
*/
|
|
10
|
+
export function parseRequest(token) {
|
|
11
|
+
const at = token.indexOf("@", 1);
|
|
12
|
+
return at > 0
|
|
13
|
+
? { name: token.slice(0, at).toLowerCase(), source: token.slice(at + 1) }
|
|
14
|
+
: { name: token.toLowerCase() };
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @brief Formats a request as it is typed, e.g. `emphasise@g3n-skills`.
|
|
18
|
+
*
|
|
19
|
+
* @param request - Parsed request, e.g. `{ name: "emphasise", source: "g3n-skills" }`.
|
|
20
|
+
*/
|
|
21
|
+
export function formatRequest(request) {
|
|
22
|
+
return request.source === undefined ? request.name : `${request.name}@${request.source}`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @brief Gets the name of the source an offer comes from.
|
|
26
|
+
*
|
|
27
|
+
* @param offer - Offer whose entry's origin names the source, e.g. `{ key: "emphasise", entry }`.
|
|
28
|
+
*/
|
|
29
|
+
function sourceOf(offer) {
|
|
30
|
+
return offer.entry.origin.source;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @brief Gets the names of the sources the offers come from, each once, sorted.
|
|
34
|
+
*
|
|
35
|
+
* @param offers - Offers to read the sources of, e.g. the matches of one request.
|
|
36
|
+
*/
|
|
37
|
+
function uniqueSources(offers) {
|
|
38
|
+
return [...new Set(offers.map(sourceOf))].sort();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @brief Finds the entries one request names.
|
|
42
|
+
*
|
|
43
|
+
* A group name expands to every entry in it and wins over an entry with the
|
|
44
|
+
* same key. A name offered by several sources is settled by the preferred
|
|
45
|
+
* source for it, and is ambiguous otherwise.
|
|
46
|
+
*
|
|
47
|
+
* @param request - Request being matched, e.g. `{ name: "emphasise" }`.
|
|
48
|
+
* @param offers - Every offer to search, across all sources.
|
|
49
|
+
* @param preferred - Source to pick for a key several sources offer, by key, e.g. `{ emphasise: "g3n-skills" }`.
|
|
50
|
+
* @returns The matching offers, an `{ ambiguous }` message when several sources offer the name, or `null` when none does.
|
|
51
|
+
*/
|
|
52
|
+
function matchRequest(request, offers, preferred) {
|
|
53
|
+
const pool = request.source === undefined ? offers : offers.filter((o) => sourceOf(o) === request.source);
|
|
54
|
+
const group = pool.filter((o) => o.entry.group === request.name);
|
|
55
|
+
const matches = group.length > 0 ? group : pool.filter((o) => o.key === request.name);
|
|
56
|
+
if (matches.length === 0)
|
|
57
|
+
return null;
|
|
58
|
+
const sources = uniqueSources(matches);
|
|
59
|
+
if (sources.length === 1)
|
|
60
|
+
return matches;
|
|
61
|
+
const pinned = preferred[request.name];
|
|
62
|
+
if (pinned !== undefined && sources.includes(pinned))
|
|
63
|
+
return matches.filter((o) => sourceOf(o) === pinned);
|
|
64
|
+
return { ambiguous: `${request.name} is offered by ${sources.length} sources, name one: ${sources.map((s) => `${request.name}@${s}`).join(", ")}` };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @brief Finds the entry one dependency token points at.
|
|
68
|
+
*
|
|
69
|
+
* The named source when the dependency is qualified, else the dependent's own
|
|
70
|
+
* source, else the source preferred for the key, else the only source offering it.
|
|
71
|
+
*
|
|
72
|
+
* @param token - Dependency as written in `registryDependencies`, e.g. `ghost@mine`.
|
|
73
|
+
* @param dependent - Offer that declares the dependency.
|
|
74
|
+
* @param offers - Every offer to search, across all sources.
|
|
75
|
+
* @param preferred - Source to pick for a key several sources offer, by key.
|
|
76
|
+
* @returns The matched offer, an `{ ambiguous }` message, or `null` when no source offers it.
|
|
77
|
+
*/
|
|
78
|
+
function matchDependency(token, dependent, offers, preferred) {
|
|
79
|
+
const request = parseRequest(token);
|
|
80
|
+
const named = offers.filter((o) => o.key === request.name);
|
|
81
|
+
const from = (source) => named.find((o) => sourceOf(o) === source);
|
|
82
|
+
if (request.source !== undefined)
|
|
83
|
+
return from(request.source) ?? null;
|
|
84
|
+
const settled = from(sourceOf(dependent)) ?? from(preferred[request.name]);
|
|
85
|
+
if (settled !== undefined)
|
|
86
|
+
return settled;
|
|
87
|
+
if (named.length <= 1)
|
|
88
|
+
return named[0] ?? null;
|
|
89
|
+
return { ambiguous: `${dependent.key} depends on ${request.name}, offered by ${uniqueSources(named).join(", ")}; qualify it as ${request.name}@<source>` };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @brief Resolves the `registryDependencies` of one entry against every offer.
|
|
93
|
+
*
|
|
94
|
+
* A dependency that cannot be resolved keeps its bare name in the rewritten
|
|
95
|
+
* list and is reported in `unknown` or `ambiguous`.
|
|
96
|
+
*
|
|
97
|
+
* @param offer - Offer whose dependencies are resolved.
|
|
98
|
+
* @param offers - Every offer to resolve against, across all sources.
|
|
99
|
+
* @param preferred - Source to take a key from when several offer it: where it is installed, or where the request named it.
|
|
100
|
+
* @returns The offer with rewritten dependencies, the dependency offers found, and the ones that did not resolve.
|
|
101
|
+
*/
|
|
102
|
+
export function resolveDependencies(offer, offers, preferred = {}) {
|
|
103
|
+
const result = { offer, dependencies: [], unknown: [], ambiguous: [] };
|
|
104
|
+
const keys = (offer.entry.registryDependencies ?? []).map((token) => {
|
|
105
|
+
const match = matchDependency(token, offer, offers, preferred);
|
|
106
|
+
if (match === null) {
|
|
107
|
+
result.unknown.push(`${token} (dep of ${offer.key})`);
|
|
108
|
+
return parseRequest(token).name;
|
|
109
|
+
}
|
|
110
|
+
if ("ambiguous" in match) {
|
|
111
|
+
result.ambiguous.push(match.ambiguous);
|
|
112
|
+
return parseRequest(token).name;
|
|
113
|
+
}
|
|
114
|
+
result.dependencies.push(match);
|
|
115
|
+
return match.key;
|
|
116
|
+
});
|
|
117
|
+
result.offer = { ...offer, entry: { ...offer.entry, registryDependencies: keys.length > 0 ? keys : undefined } };
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* @brief Resolves entry and group names against every offer, with the dependency closure of each across sources.
|
|
122
|
+
*
|
|
123
|
+
* An entry named in the request settles which source its key comes from for
|
|
124
|
+
* every dependency. Two different entries wanted under one key are reported as
|
|
125
|
+
* ambiguous, since a target holds one folder per key.
|
|
126
|
+
*
|
|
127
|
+
* @param tokens - Names as typed on the command line, e.g. `["emphasise", "ui@g3n-skills"]`.
|
|
128
|
+
* @param offers - Every offer to resolve against, across all sources.
|
|
129
|
+
* @param installed - Source each installed key came from.
|
|
130
|
+
* @returns The entries to install, and what could not be resolved or was ambiguous.
|
|
131
|
+
*/
|
|
132
|
+
export function resolveRequests(tokens, offers, installed = {}) {
|
|
133
|
+
const preferred = { ...installed };
|
|
134
|
+
const result = { entries: new Map(), unknown: [], ambiguous: [], notes: {} };
|
|
135
|
+
const named = new Set();
|
|
136
|
+
const add = (offer, note) => {
|
|
137
|
+
const existing = result.entries.get(offer.key);
|
|
138
|
+
if (existing !== undefined) {
|
|
139
|
+
if (sourceOf(existing) !== sourceOf(offer)) {
|
|
140
|
+
result.ambiguous.push(`${offer.key} is wanted from both ${sourceOf(existing)} and ${sourceOf(offer)}`);
|
|
141
|
+
}
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const resolved = resolveDependencies(offer, offers, preferred);
|
|
145
|
+
result.entries.set(offer.key, resolved.offer);
|
|
146
|
+
result.unknown.push(...resolved.unknown);
|
|
147
|
+
result.ambiguous.push(...resolved.ambiguous);
|
|
148
|
+
if (note !== undefined && !named.has(offer.key))
|
|
149
|
+
result.notes[offer.key] = note;
|
|
150
|
+
for (const dependency of resolved.dependencies)
|
|
151
|
+
add(dependency, `dep of ${offer.key}`);
|
|
152
|
+
};
|
|
153
|
+
const requested = [];
|
|
154
|
+
for (const token of tokens) {
|
|
155
|
+
const request = parseRequest(token);
|
|
156
|
+
const match = matchRequest(request, offers, preferred);
|
|
157
|
+
if (match === null)
|
|
158
|
+
result.unknown.push(formatRequest(request));
|
|
159
|
+
else if ("ambiguous" in match)
|
|
160
|
+
result.ambiguous.push(match.ambiguous);
|
|
161
|
+
else
|
|
162
|
+
requested.push(...match);
|
|
163
|
+
}
|
|
164
|
+
for (const offer of requested) {
|
|
165
|
+
named.add(offer.key);
|
|
166
|
+
preferred[offer.key] = sourceOf(offer);
|
|
167
|
+
}
|
|
168
|
+
for (const offer of requested)
|
|
169
|
+
add(offer);
|
|
170
|
+
result.unknown = [...new Set(result.unknown)];
|
|
171
|
+
result.ambiguous = [...new Set(result.ambiguous)];
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @brief Resolves entry and group names against what a target has installed.
|
|
176
|
+
*
|
|
177
|
+
* `<name>@<source>` keeps only entries installed from that source. Works from
|
|
178
|
+
* the install manifest alone, so no source needs to be reachable.
|
|
179
|
+
*
|
|
180
|
+
* @param tokens - Names as typed, e.g. `["emphasise@g3n-skills"]`.
|
|
181
|
+
* @param installed - Installed entries by key, from one target's manifest.
|
|
182
|
+
* @returns Installed keys in the order named, and the names that match nothing installed.
|
|
183
|
+
*/
|
|
184
|
+
export function resolveInstalled(tokens, installed) {
|
|
185
|
+
const keys = [];
|
|
186
|
+
const unknown = [];
|
|
187
|
+
for (const token of tokens) {
|
|
188
|
+
const request = parseRequest(token);
|
|
189
|
+
const pool = Object.entries(installed).filter(([, entry]) => request.source === undefined || entry.origin.source === request.source);
|
|
190
|
+
const group = pool.filter(([, entry]) => entry.group === request.name).map(([key]) => key);
|
|
191
|
+
const matches = group.length > 0 ? group : pool.filter(([key]) => key === request.name).map(([key]) => key);
|
|
192
|
+
if (matches.length === 0)
|
|
193
|
+
unknown.push(formatRequest(request));
|
|
194
|
+
keys.push(...matches);
|
|
195
|
+
}
|
|
196
|
+
return { keys: [...new Set(keys)], unknown };
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* @brief Maps each installed key to the source it came from, across manifests.
|
|
200
|
+
*
|
|
201
|
+
* The first manifest wins on a clash.
|
|
202
|
+
*
|
|
203
|
+
* @param installed - Installed entries by key, one record per target manifest.
|
|
204
|
+
* @returns Source name by installed key, e.g. `{ emphasise: "g3n-skills" }`.
|
|
205
|
+
*/
|
|
206
|
+
export function installedOrigins(installed) {
|
|
207
|
+
const origins = {};
|
|
208
|
+
for (const record of installed)
|
|
209
|
+
for (const [key, entry] of Object.entries(record))
|
|
210
|
+
origins[key] ??= entry.origin.source;
|
|
211
|
+
return origins;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* @brief Maps each forked key to the installed fork that stands in for it, across manifests.
|
|
215
|
+
*
|
|
216
|
+
* The first manifest wins on a clash.
|
|
217
|
+
*
|
|
218
|
+
* @param installed - Installed entries by key, one record per target manifest.
|
|
219
|
+
* @returns Installed fork key by forked key, e.g. `{ emphasise: "my-emphasise" }`.
|
|
220
|
+
*/
|
|
221
|
+
export function installedForks(installed) {
|
|
222
|
+
const forks = {};
|
|
223
|
+
for (const record of installed) {
|
|
224
|
+
for (const [key, entry] of Object.entries(record))
|
|
225
|
+
if (entry.forkedFrom !== undefined)
|
|
226
|
+
forks[entry.forkedFrom] ??= key;
|
|
227
|
+
}
|
|
228
|
+
return forks;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* @brief Finds the fresh offer for each installed key, from the source it was installed from and never another, with its dependencies resolved.
|
|
232
|
+
*
|
|
233
|
+
* @param keys - Installed keys to update.
|
|
234
|
+
* @param installed - Installed entries by key, from one target's manifest.
|
|
235
|
+
* @param offers - Every offer to search, across all sources.
|
|
236
|
+
* @param preferred - Source each installed key came from, across targets.
|
|
237
|
+
* @returns The offers found, and the keys whose source is gone or no longer offers them.
|
|
238
|
+
*/
|
|
239
|
+
export function resolveUpdates(keys, installed, offers, preferred = {}) {
|
|
240
|
+
const found = [];
|
|
241
|
+
const missing = [];
|
|
242
|
+
for (const key of keys) {
|
|
243
|
+
const fresh = offers.find((o) => o.key === key && sourceOf(o) === installed[key]?.origin.source);
|
|
244
|
+
if (fresh === undefined)
|
|
245
|
+
missing.push(key);
|
|
246
|
+
else
|
|
247
|
+
found.push(resolveDependencies(fresh, offers, preferred).offer);
|
|
248
|
+
}
|
|
249
|
+
return { offers: found, missing };
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/installer/resolve.ts"],"names":[],"mappings":"AAgDA;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;IAChC,OAAO,EAAE,GAAG,CAAC;QACX,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE;QACzE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,EAAE,CAAA;AACnC,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