@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
|
@@ -6,7 +6,12 @@ import { createRegistryStore } from "../registry/registry.store";
|
|
|
6
6
|
import { entries } from "../registry/registry.selectors";
|
|
7
7
|
import { SourceRecordSchema } from "../sources/types";
|
|
8
8
|
import { errorMessage } from "../utils/errors";
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* @brief Builds the zod schema of a manifest file whose entries match `entrySchema`.
|
|
11
|
+
*
|
|
12
|
+
* @param entrySchema - Schema each value of `entries` must match.
|
|
13
|
+
* @returns Strict object schema with `sources` and `entries`, both defaulting to empty.
|
|
14
|
+
*/
|
|
10
15
|
export function installManifestSchema(entrySchema) {
|
|
11
16
|
return z.strictObject({
|
|
12
17
|
sources: SourceRecordSchema.default({}),
|
|
@@ -14,11 +19,12 @@ export function installManifestSchema(entrySchema) {
|
|
|
14
19
|
});
|
|
15
20
|
}
|
|
16
21
|
/**
|
|
17
|
-
* Reads a manifest file and checks every entry against `entrySchema
|
|
18
|
-
* missing file reads as no sources and no entries.
|
|
22
|
+
* @brief Reads a manifest file and checks every entry against `entrySchema`. A missing file reads as no sources and no entries.
|
|
19
23
|
*
|
|
20
|
-
* @param filePath - Absolute path of the manifest
|
|
21
|
-
* @
|
|
24
|
+
* @param filePath - Absolute path of the manifest, e.g. `/home/me/app/.claude/skills.json`.
|
|
25
|
+
* @param entrySchema - Schema each installed entry must match.
|
|
26
|
+
* @returns The manifest, with its entries loaded into `store`.
|
|
27
|
+
* @throws {Error} Naming the file when it is not JSON or does not match the schema.
|
|
22
28
|
*/
|
|
23
29
|
export function loadInstallManifest(filePath, entrySchema) {
|
|
24
30
|
const store = createRegistryStore();
|
|
@@ -38,18 +44,22 @@ export function loadInstallManifest(filePath, entrySchema) {
|
|
|
38
44
|
return { filePath, sources: parsed.data.sources, store };
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
41
|
-
*
|
|
47
|
+
* @brief Reads the installed entries of a manifest, each checked against `entrySchema`.
|
|
42
48
|
*
|
|
43
|
-
* @
|
|
49
|
+
* @param manifest - Manifest whose `store` is read.
|
|
50
|
+
* @param entrySchema - Schema each entry must match.
|
|
51
|
+
* @returns Entries by key.
|
|
52
|
+
* @throws {ZodError} When an entry the install commands wrote does not match the schema.
|
|
44
53
|
*/
|
|
45
54
|
export function installedEntries(manifest, entrySchema) {
|
|
46
55
|
return z.record(z.string(), entrySchema).parse(entries(manifest.store));
|
|
47
56
|
}
|
|
48
57
|
/**
|
|
49
|
-
* Writes sources and entries back
|
|
50
|
-
* entry against `entrySchema`.
|
|
58
|
+
* @brief Writes sources and entries back to `manifest.filePath`, each sorted by name, after checking every entry against `entrySchema`.
|
|
51
59
|
*
|
|
52
|
-
* @
|
|
60
|
+
* @param manifest - Manifest to write.
|
|
61
|
+
* @param entrySchema - Schema each entry must match.
|
|
62
|
+
* @throws {ZodError} When an entry does not match the schema. Nothing is written then.
|
|
53
63
|
*/
|
|
54
64
|
export function saveInstallManifest(manifest, entrySchema) {
|
|
55
65
|
const sorted = (record) => Object.fromEntries(Object.entries(record).sort(([a], [b]) => a.localeCompare(b)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/installer/manifest.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,mBAAmB,EAAsB,MAAM,4BAA4B,CAAA;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAqB,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAoB9C
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/installer/manifest.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,E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,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;AAC9E,CAAC"}
|
|
@@ -1,21 +1,32 @@
|
|
|
1
1
|
import type { RegisteredSource, SourceRecord, SourceSpec } from "../sources/types";
|
|
2
2
|
import type { InstallManifest } from "./manifest";
|
|
3
3
|
/**
|
|
4
|
-
* Sources of one or more manifests plus the built-in ones, each name once
|
|
5
|
-
*
|
|
6
|
-
* places, the first manifest's spec is used.
|
|
4
|
+
* @brief Sources of one or more manifests plus the built-in ones, each name once, built-in sources first.
|
|
5
|
+
*
|
|
6
|
+
* When two manifests register one name for different places, the first manifest's spec is used.
|
|
7
|
+
*
|
|
8
|
+
* @param manifests - Manifests to read sources from, in priority order.
|
|
9
|
+
* @param builtins - Sources shipped with the installer.
|
|
10
|
+
* @returns Every source once, by name.
|
|
7
11
|
*/
|
|
8
12
|
export declare function manifestSources(manifests: readonly InstallManifest[], builtins: SourceRecord): RegisteredSource[];
|
|
9
13
|
/**
|
|
10
|
-
* Registers a source in every manifest. Nothing changes unless every manifest accepts it.
|
|
14
|
+
* @brief Registers a source in every manifest. Nothing changes unless every manifest accepts it.
|
|
11
15
|
*
|
|
12
|
-
* @
|
|
16
|
+
* @param manifests - Manifests to register the source in.
|
|
17
|
+
* @param name - Name the source is registered under.
|
|
18
|
+
* @param spec - Where the source is read from.
|
|
19
|
+
* @param builtins - Sources shipped with the installer, which names cannot shadow.
|
|
20
|
+
* @throws {Error} When the name is built in, invalid, or already registered in any manifest.
|
|
13
21
|
*/
|
|
14
22
|
export declare function registerSource(manifests: readonly InstallManifest[], name: string, spec: SourceSpec, builtins: SourceRecord): void;
|
|
15
23
|
/**
|
|
16
|
-
* Unregisters a source from every manifest that has it.
|
|
24
|
+
* @brief Unregisters a source from every manifest that has it.
|
|
17
25
|
*
|
|
18
|
-
* @
|
|
26
|
+
* @param manifests - Manifests to remove the source from.
|
|
27
|
+
* @param name - Name of the source to remove.
|
|
28
|
+
* @param builtins - Sources shipped with the installer, which cannot be removed.
|
|
29
|
+
* @throws {Error} When the name is built in or no manifest registers it.
|
|
19
30
|
*/
|
|
20
31
|
export declare function unregisterSource(manifests: readonly InstallManifest[], name: string, builtins: SourceRecord): void;
|
|
21
32
|
//# sourceMappingURL=manifestSources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifestSources.d.ts","sourceRoot":"","sources":["../../src/installer/manifestSources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD
|
|
1
|
+
{"version":3,"file":"manifestSources.d.ts","sourceRoot":"","sources":["../../src/installer/manifestSources.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAClF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,EAAE,QAAQ,EAAE,YAAY,GAAG,gBAAgB,EAAE,CAMjH;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAGlI;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,eAAe,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAKlH"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// packages/core/src/installer/manifestSources.ts
|
|
2
2
|
import { addSource, listSources, removeSource } from "../sources/register";
|
|
3
3
|
/**
|
|
4
|
-
* Sources of one or more manifests plus the built-in ones, each name once
|
|
5
|
-
*
|
|
6
|
-
* places, the first manifest's spec is used.
|
|
4
|
+
* @brief Sources of one or more manifests plus the built-in ones, each name once, built-in sources first.
|
|
5
|
+
*
|
|
6
|
+
* When two manifests register one name for different places, the first manifest's spec is used.
|
|
7
|
+
*
|
|
8
|
+
* @param manifests - Manifests to read sources from, in priority order.
|
|
9
|
+
* @param builtins - Sources shipped with the installer.
|
|
10
|
+
* @returns Every source once, by name.
|
|
7
11
|
*/
|
|
8
12
|
export function manifestSources(manifests, builtins) {
|
|
9
13
|
const byName = new Map();
|
|
@@ -15,18 +19,25 @@ export function manifestSources(manifests, builtins) {
|
|
|
15
19
|
return [...byName.values()];
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
|
-
* Registers a source in every manifest. Nothing changes unless every manifest accepts it.
|
|
22
|
+
* @brief Registers a source in every manifest. Nothing changes unless every manifest accepts it.
|
|
19
23
|
*
|
|
20
|
-
* @
|
|
24
|
+
* @param manifests - Manifests to register the source in.
|
|
25
|
+
* @param name - Name the source is registered under.
|
|
26
|
+
* @param spec - Where the source is read from.
|
|
27
|
+
* @param builtins - Sources shipped with the installer, which names cannot shadow.
|
|
28
|
+
* @throws {Error} When the name is built in, invalid, or already registered in any manifest.
|
|
21
29
|
*/
|
|
22
30
|
export function registerSource(manifests, name, spec, builtins) {
|
|
23
31
|
const updated = manifests.map((manifest) => addSource(manifest.sources, name, spec, builtins));
|
|
24
32
|
manifests.forEach((manifest, index) => { manifest.sources = updated[index] ?? manifest.sources; });
|
|
25
33
|
}
|
|
26
34
|
/**
|
|
27
|
-
* Unregisters a source from every manifest that has it.
|
|
35
|
+
* @brief Unregisters a source from every manifest that has it.
|
|
28
36
|
*
|
|
29
|
-
* @
|
|
37
|
+
* @param manifests - Manifests to remove the source from.
|
|
38
|
+
* @param name - Name of the source to remove.
|
|
39
|
+
* @param builtins - Sources shipped with the installer, which cannot be removed.
|
|
40
|
+
* @throws {Error} When the name is built in or no manifest registers it.
|
|
30
41
|
*/
|
|
31
42
|
export function unregisterSource(manifests, name, builtins) {
|
|
32
43
|
const holding = manifests.filter((manifest) => manifest.sources[name] !== undefined);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifestSources.js","sourceRoot":"","sources":["../../src/installer/manifestSources.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAI1E
|
|
1
|
+
{"version":3,"file":"manifestSources.js","sourceRoot":"","sources":["../../src/installer/manifestSources.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAI1E;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,SAAqC,EAAE,QAAsB;IAC3F,MAAM,MAAM,GAAG,IAAI,GAAG,EAA4B,CAAA;IAClD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,KAAK,MAAM,MAAM,IAAI,WAAW,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;gBAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAC7H,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;AAC7B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,SAAqC,EAAE,IAAY,EAAE,IAAgB,EAAE,QAAsB;IAC1H,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC9F,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,GAAG,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAA,CAAC,CAAC,CAAC,CAAA;AACnG,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAqC,EAAE,IAAY,EAAE,QAAsB;IAC1G,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS,CAAC,CAAA;IACpF,8FAA8F;IAC9F,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,YAAY,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;IAC1D,KAAK,MAAM,QAAQ,IAAI,OAAO;QAAE,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAA;AACnG,CAAC"}
|
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
/** Folders a plugin or marketplace manifest may sit in, in the order they are tried. */
|
|
2
2
|
export declare const MANIFEST_DIRS: string[];
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @brief One plugin a marketplace lists, located by its folder inside the source.
|
|
5
|
+
*
|
|
6
|
+
* @property name - Plugin name from the marketplace.
|
|
7
|
+
* @property dir - Absolute plugin folder.
|
|
8
|
+
*/
|
|
4
9
|
export interface MarketplacePlugin {
|
|
5
10
|
name: string;
|
|
6
|
-
/** Absolute plugin folder */
|
|
7
11
|
dir: string;
|
|
8
12
|
}
|
|
9
13
|
/**
|
|
10
|
-
*
|
|
14
|
+
* @brief Finds a manifest file in the first manifest folder that holds it.
|
|
11
15
|
*
|
|
12
|
-
*
|
|
16
|
+
* Looks for `<dir>/.claude-plugin/<file>`, then `<dir>/.cursor-plugin/<file>`.
|
|
17
|
+
*
|
|
18
|
+
* @param dir - Absolute folder of the plugin or source.
|
|
19
|
+
* @param file - Manifest file name, e.g. `marketplace.json`.
|
|
20
|
+
* @returns Absolute path of the first existing file, or `null` when neither exists.
|
|
13
21
|
*/
|
|
14
22
|
export declare function manifestFile(dir: string, file: string): string | null;
|
|
15
23
|
/**
|
|
16
|
-
* Resolves
|
|
24
|
+
* @brief Resolves a relative path against a base folder and rejects a result outside `root`.
|
|
17
25
|
*
|
|
18
|
-
* @param root - Absolute folder nothing may leave, e.g. a source checkout
|
|
19
|
-
* @
|
|
26
|
+
* @param root - Absolute folder nothing may leave, e.g. a source checkout.
|
|
27
|
+
* @param base - Absolute folder `rel` is resolved against.
|
|
28
|
+
* @param rel - Path to resolve, as written in a manifest.
|
|
29
|
+
* @returns Absolute resolved path, which is `root` or lies below it.
|
|
30
|
+
* @throws {Error} When the path points outside `root`.
|
|
20
31
|
*/
|
|
21
32
|
export declare function resolveInside(root: string, base: string, rel: string): string;
|
|
22
33
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
34
|
+
* @brief Reads the plugins a source's `marketplace.json` lists.
|
|
35
|
+
*
|
|
36
|
+
* Plugins whose `source` is not a relative path (a git or npm reference) are skipped with a warning.
|
|
25
37
|
*
|
|
26
|
-
* @param root - Absolute root of the source
|
|
27
|
-
* @returns `null` when the source has no marketplace
|
|
28
|
-
* @throws
|
|
38
|
+
* @param root - Absolute root of the source.
|
|
39
|
+
* @returns Plugins and skip warnings, or `null` when the source has no marketplace.
|
|
40
|
+
* @throws {Error} When the marketplace is not valid JSON, or a plugin path leaves the source.
|
|
29
41
|
*/
|
|
30
42
|
export declare function readMarketplace(root: string): {
|
|
31
43
|
plugins: MarketplacePlugin[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../../src/installer/marketplace.ts"],"names":[],"mappings":"AAKA,wFAAwF;AACxF,eAAO,MAAM,aAAa,UAAuC,CAAA;AAWjE
|
|
1
|
+
{"version":3,"file":"marketplace.d.ts","sourceRoot":"","sources":["../../src/installer/marketplace.ts"],"names":[],"mappings":"AAKA,wFAAwF;AACxF,eAAO,MAAM,aAAa,UAAuC,CAAA;AAWjE;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAG,MAAM,CAAA;CACb;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMrE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAM7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAezG"}
|
|
@@ -12,9 +12,13 @@ const MarketplaceSchema = z.object({
|
|
|
12
12
|
})).default([]),
|
|
13
13
|
});
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* @brief Finds a manifest file in the first manifest folder that holds it.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* Looks for `<dir>/.claude-plugin/<file>`, then `<dir>/.cursor-plugin/<file>`.
|
|
18
|
+
*
|
|
19
|
+
* @param dir - Absolute folder of the plugin or source.
|
|
20
|
+
* @param file - Manifest file name, e.g. `marketplace.json`.
|
|
21
|
+
* @returns Absolute path of the first existing file, or `null` when neither exists.
|
|
18
22
|
*/
|
|
19
23
|
export function manifestFile(dir, file) {
|
|
20
24
|
for (const manifestDir of MANIFEST_DIRS) {
|
|
@@ -25,10 +29,13 @@ export function manifestFile(dir, file) {
|
|
|
25
29
|
return null;
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
|
-
* Resolves
|
|
32
|
+
* @brief Resolves a relative path against a base folder and rejects a result outside `root`.
|
|
29
33
|
*
|
|
30
|
-
* @param root - Absolute folder nothing may leave, e.g. a source checkout
|
|
31
|
-
* @
|
|
34
|
+
* @param root - Absolute folder nothing may leave, e.g. a source checkout.
|
|
35
|
+
* @param base - Absolute folder `rel` is resolved against.
|
|
36
|
+
* @param rel - Path to resolve, as written in a manifest.
|
|
37
|
+
* @returns Absolute resolved path, which is `root` or lies below it.
|
|
38
|
+
* @throws {Error} When the path points outside `root`.
|
|
32
39
|
*/
|
|
33
40
|
export function resolveInside(root, base, rel) {
|
|
34
41
|
const resolved = path.resolve(base, rel);
|
|
@@ -38,12 +45,13 @@ export function resolveInside(root, base, rel) {
|
|
|
38
45
|
return resolved;
|
|
39
46
|
}
|
|
40
47
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
48
|
+
* @brief Reads the plugins a source's `marketplace.json` lists.
|
|
49
|
+
*
|
|
50
|
+
* Plugins whose `source` is not a relative path (a git or npm reference) are skipped with a warning.
|
|
43
51
|
*
|
|
44
|
-
* @param root - Absolute root of the source
|
|
45
|
-
* @returns `null` when the source has no marketplace
|
|
46
|
-
* @throws
|
|
52
|
+
* @param root - Absolute root of the source.
|
|
53
|
+
* @returns Plugins and skip warnings, or `null` when the source has no marketplace.
|
|
54
|
+
* @throws {Error} When the marketplace is not valid JSON, or a plugin path leaves the source.
|
|
47
55
|
*/
|
|
48
56
|
export function readMarketplace(root) {
|
|
49
57
|
const file = manifestFile(root, MARKETPLACE_FILE);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketplace.js","sourceRoot":"","sources":["../../src/installer/marketplace.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,wFAAwF;AACxF,M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AAG,EAAE,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IACpF,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AAC9B,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
|
-
* Where an entry came from: the registered source, the folder its file paths
|
|
4
|
-
*
|
|
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.
|
|
5
9
|
*/
|
|
6
10
|
export declare const EntryOriginSchema: z.ZodObject<{
|
|
7
11
|
source: z.ZodString;
|
|
@@ -9,8 +13,15 @@ export declare const EntryOriginSchema: z.ZodObject<{
|
|
|
9
13
|
commit: z.ZodOptional<z.ZodString>;
|
|
10
14
|
version: z.ZodOptional<z.ZodString>;
|
|
11
15
|
}, z.core.$strip>;
|
|
16
|
+
/** Origin of one entry, inferred from `EntryOriginSchema`. */
|
|
12
17
|
export type EntryOrigin = z.infer<typeof EntryOriginSchema>;
|
|
13
|
-
/**
|
|
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
|
+
*/
|
|
14
25
|
export declare const OriginEntrySchema: z.ZodObject<{
|
|
15
26
|
name: z.ZodString;
|
|
16
27
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -29,15 +40,20 @@ export declare const OriginEntrySchema: z.ZodObject<{
|
|
|
29
40
|
commit: z.ZodOptional<z.ZodString>;
|
|
30
41
|
version: z.ZodOptional<z.ZodString>;
|
|
31
42
|
}, z.core.$strip>;
|
|
43
|
+
forkedFrom: z.ZodOptional<z.ZodString>;
|
|
32
44
|
}, z.core.$strip>;
|
|
45
|
+
/** Registry entry with its origin, inferred from `OriginEntrySchema`. */
|
|
33
46
|
export type OriginEntry = z.infer<typeof OriginEntrySchema>;
|
|
34
|
-
/**
|
|
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
|
+
*/
|
|
35
54
|
export interface ReadContext {
|
|
36
|
-
/** Origin recorded on the entry */
|
|
37
55
|
origin: EntryOrigin;
|
|
38
|
-
/** Group the entry is listed under, e.g. the plugin it ships in */
|
|
39
56
|
group: string;
|
|
40
|
-
/** Version to record when the entry's own manifest has none */
|
|
41
57
|
version?: string;
|
|
42
58
|
}
|
|
43
59
|
//# sourceMappingURL=origin.d.ts.map
|
|
@@ -1 +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
|
|
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"}
|
package/dist/installer/origin.js
CHANGED
|
@@ -2,21 +2,28 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { BaseRegistryEntrySchema } from "../registry/types";
|
|
4
4
|
/**
|
|
5
|
-
* Where an entry came from: the registered source, the folder its file paths
|
|
6
|
-
*
|
|
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.
|
|
7
11
|
*/
|
|
8
12
|
export const EntryOriginSchema = z.object({
|
|
9
|
-
/** Name of the registered source, e.g. `g3n-skills` */
|
|
10
13
|
source: z.string().min(1),
|
|
11
|
-
/** Source-relative folder that `files[].path` resolves against, e.g. `skills/speech` or `dist/components` */
|
|
12
14
|
dir: z.string(),
|
|
13
|
-
/** Commit a git source resolved to */
|
|
14
15
|
commit: z.string().min(1).optional(),
|
|
15
|
-
/** Version an npm source resolved to, or the version in a local source's package.json */
|
|
16
16
|
version: z.string().min(1).optional(),
|
|
17
17
|
});
|
|
18
|
-
/**
|
|
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
|
+
*/
|
|
19
25
|
export const OriginEntrySchema = BaseRegistryEntrySchema.extend({
|
|
20
26
|
origin: EntryOriginSchema,
|
|
27
|
+
forkedFrom: z.string().min(1).optional(),
|
|
21
28
|
});
|
|
22
29
|
//# sourceMappingURL=origin.js.map
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import type { BaseFileEntry } from "../registry/types";
|
|
2
2
|
import type { InstallerIO, RemoveResult } from "./types";
|
|
3
3
|
/**
|
|
4
|
-
* Removes a manifest entry's files from `installDir`.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `installDir`.
|
|
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.
|
|
8
14
|
*/
|
|
9
15
|
export declare function removeInstalledFiles(files: readonly BaseFileEntry[], installDir: string, opts: {
|
|
10
16
|
force?: boolean;
|
|
11
17
|
}, io: InstallerIO): Promise<RemoveResult>;
|
|
12
|
-
/**
|
|
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
|
+
*/
|
|
13
25
|
export declare function pruneEmptyDirs(dir: string, stopAt: string, io: InstallerIO): void;
|
|
14
26
|
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -1 +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
|
|
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"}
|
package/dist/installer/remove.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
// packages/core/src/installer/remove.ts
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
/**
|
|
4
|
-
* Removes a manifest entry's files from `installDir`.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* `installDir`.
|
|
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.
|
|
8
14
|
*/
|
|
9
15
|
export async function removeInstalledFiles(files, installDir, opts, io) {
|
|
10
16
|
const result = { removed: [], kept: [], missing: [] };
|
|
@@ -26,7 +32,13 @@ export async function removeInstalledFiles(files, installDir, opts, io) {
|
|
|
26
32
|
}
|
|
27
33
|
return result;
|
|
28
34
|
}
|
|
29
|
-
/**
|
|
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
|
+
*/
|
|
30
42
|
export function pruneEmptyDirs(dir, stopAt, io) {
|
|
31
43
|
let current = dir;
|
|
32
44
|
while (current !== stopAt && io.exists(current) && io.listDir(current).length === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/installer/remove.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAA;AAI5B
|
|
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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