@g3nomaly/core 0.3.1 → 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/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":"types.js","sourceRoot":"","sources":["../../src/installer/types.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/installer/types.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,QAAQ,EAAI,CAAC;IACb,UAAU,EAAE,CAAC;IACb,QAAQ,EAAI,CAAC;IACb,QAAQ,EAAI,CAAC;CACL,CAAA;AAIV;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAO,CAAC;IACZ,SAAS,EAAE,CAAC;IACZ,IAAI,EAAO,CAAC;CACJ,CAAA"}
|
package/dist/registry/index.d.ts
CHANGED
|
@@ -5,8 +5,4 @@ export * from "./registry.mutations";
|
|
|
5
5
|
export * from "./registry.selectors";
|
|
6
6
|
export * from "./registry.template";
|
|
7
7
|
export * from "./registry.io";
|
|
8
|
-
/**
|
|
9
|
-
* Purposfully a custom registry store. To reduce dependencies. Still follows the same pattern as the tanstack store design skill. Though it could still be improved since it is still missing a lot of default operators.
|
|
10
|
-
* Nevertheless, this stores doesn't need reactive updates. Hence, once more the, part of why it is a custom store.
|
|
11
|
-
*/
|
|
12
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
|
package/dist/registry/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/core/src/registry/index.ts
|
|
1
2
|
export * from "./types";
|
|
2
3
|
export * from "./registry.handlers";
|
|
3
4
|
export * from "./registry.store";
|
|
@@ -5,8 +6,4 @@ export * from "./registry.mutations";
|
|
|
5
6
|
export * from "./registry.selectors";
|
|
6
7
|
export * from "./registry.template";
|
|
7
8
|
export * from "./registry.io";
|
|
8
|
-
/**
|
|
9
|
-
* Purposfully a custom registry store. To reduce dependencies. Still follows the same pattern as the tanstack store design skill. Though it could still be improved since it is still missing a lot of default operators.
|
|
10
|
-
* Nevertheless, this stores doesn't need reactive updates. Hence, once more the, part of why it is a custom store.
|
|
11
|
-
*/
|
|
12
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { BaseRegistry, BaseRegistryEntry } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* @brief Converts a registry map to and from the text of a manifest file.
|
|
4
|
+
*
|
|
5
|
+
* @property extensions - File extensions this handler reads and writes, without the dot, e.g. `json`.
|
|
6
|
+
* @property serialize - Turns the registry map into file text.
|
|
7
|
+
* @property deserialize - Parses file text back into a registry map.
|
|
8
|
+
*/
|
|
2
9
|
export interface RegistryHandler<T extends BaseRegistryEntry = BaseRegistryEntry> {
|
|
3
10
|
extensions: string[];
|
|
4
11
|
serialize: (data: BaseRegistry<T>) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.handlers.d.ts","sourceRoot":"","sources":["../../src/registry/registry.handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.handlers.d.ts","sourceRoot":"","sources":["../../src/registry/registry.handlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE9D;;;;;;GAMG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IAC9E,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,MAAM,CAAA;IAC5C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,CAAA;CAC9C;AAED,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,GAAG,CAO1C,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,GAAG,CAI5C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.handlers.js","sourceRoot":"","sources":["../../src/registry/registry.handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.handlers.js","sourceRoot":"","sources":["../../src/registry/registry.handlers.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,SAAS,GAAyB;IAC7C,UAAU,EAAE,CAAC,IAAI,CAAC;IAClB,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAClB,2BAA2B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa;IACvE,WAAW,EAAE,GAAG,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAA;IAC5E,CAAC;CACF,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAyB;IAC/C,UAAU,EAAE,CAAC,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;CACtC,CAAA"}
|
|
@@ -2,21 +2,37 @@ import type { BaseRegistryEntry } from "./types";
|
|
|
2
2
|
import type { RegistryStore } from "./registry.store";
|
|
3
3
|
import type { RegistryHandler } from "./registry.handlers";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* @brief Alias of `load()` that takes an explicit file path. Behaves the same.
|
|
6
|
+
*
|
|
7
|
+
* @param registry - Store to hydrate.
|
|
8
|
+
* @param filePath - Absolute path to read from.
|
|
6
9
|
*/
|
|
7
10
|
export declare function loadFrom<T extends BaseRegistryEntry>(registry: RegistryStore<T>, filePath: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* @brief Hydrates the store from a file.
|
|
13
|
+
*
|
|
14
|
+
* A `.ts` file is read by dynamic import, which skips the handler, since such a file exports a `registry`
|
|
15
|
+
* object directly at runtime. Any other file is read with `readFileSync` and `handler.deserialize`.
|
|
16
|
+
* Does nothing when there is no file path or the file does not exist yet.
|
|
17
|
+
*
|
|
18
|
+
* @param registry - Store to hydrate.
|
|
19
|
+
* @param filePath - File to read. Defaults to the store's bound `filePath`.
|
|
20
|
+
*/
|
|
8
21
|
export declare function load<T extends BaseRegistryEntry>(registry: RegistryStore<T>, filePath?: string): Promise<void>;
|
|
9
22
|
/**
|
|
10
|
-
*
|
|
11
|
-
* Sorts entries alphabetically for deterministic output.
|
|
23
|
+
* @brief Writes the store to its bound `filePath`, entries sorted by key.
|
|
12
24
|
*
|
|
13
|
-
* @
|
|
25
|
+
* @param registry - Store to write.
|
|
26
|
+
* @param handler - Serialization handler. Defaults to the store's handler, then `tsHandler`.
|
|
27
|
+
* @throws {Error} When the store has no bound `filePath`.
|
|
14
28
|
*/
|
|
15
29
|
export declare function flush<T extends BaseRegistryEntry>(registry: RegistryStore<T>, handler?: RegistryHandler<T>): void;
|
|
16
30
|
/**
|
|
17
|
-
* Writes the store to an explicit path.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
31
|
+
* @brief Writes the store to an explicit path, entries sorted by key. The store's bound `filePath` is not changed.
|
|
32
|
+
*
|
|
33
|
+
* @param registry - Store to write.
|
|
34
|
+
* @param filePath - Absolute path to write to.
|
|
35
|
+
* @param handler - Serialization handler. Defaults to the store's handler, then `tsHandler`.
|
|
20
36
|
*/
|
|
21
37
|
export declare function writeTo<T extends BaseRegistryEntry>(registry: RegistryStore<T>, filePath: string, handler?: RegistryHandler<T>): void;
|
|
22
38
|
//# sourceMappingURL=registry.io.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.io.d.ts","sourceRoot":"","sources":["../../src/registry/registry.io.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.io.d.ts","sourceRoot":"","sources":["../../src/registry/registry.io.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAqC1D;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,CAAC,SAAS,iBAAiB,EACxD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAEf;AAMD;;;;;;;;;GASG;AACH,wBAAsB,IAAI,CAAC,CAAC,SAAS,iBAAiB,EACpD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAgBf;AAMD;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,iBAAiB,EAC/C,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAC3B,IAAI,CASN;AAMD;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,iBAAiB,EACjD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,GAC3B,IAAI,CAGN"}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
// packages/core/src/registry/registry.io.ts
|
|
1
2
|
import { writeFileSync, readFileSync } from "node:fs";
|
|
2
3
|
import { tsHandler } from "./registry.handlers";
|
|
3
4
|
// ---------------------------------------------------------------------------
|
|
4
5
|
// Helpers
|
|
5
6
|
// ---------------------------------------------------------------------------
|
|
7
|
+
/**
|
|
8
|
+
* @brief Picks the handler for a read or write: the override, then the store's handler, then `tsHandler`.
|
|
9
|
+
*
|
|
10
|
+
* @param registry - Store whose handler is the fallback.
|
|
11
|
+
* @param override - Handler passed by the caller, if any.
|
|
12
|
+
* @returns The handler to use.
|
|
13
|
+
*/
|
|
6
14
|
function resolveHandler(registry, override) {
|
|
7
15
|
return override ?? registry.handler ?? tsHandler;
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @brief Returns the store's entries sorted by key, for deterministic output.
|
|
19
|
+
*
|
|
20
|
+
* @param registry - Store to read from.
|
|
21
|
+
* @returns Entries by key, in alphabetical key order.
|
|
22
|
+
*/
|
|
9
23
|
function sortedEntries(registry) {
|
|
10
24
|
return Object.fromEntries(Object.entries(registry.store.state).sort(([a], [b]) => a.localeCompare(b)));
|
|
11
25
|
}
|
|
@@ -13,21 +27,27 @@ function sortedEntries(registry) {
|
|
|
13
27
|
// loadFrom (file → store)
|
|
14
28
|
// ---------------------------------------------------------------------------
|
|
15
29
|
/**
|
|
16
|
-
*
|
|
30
|
+
* @brief Alias of `load()` that takes an explicit file path. Behaves the same.
|
|
31
|
+
*
|
|
32
|
+
* @param registry - Store to hydrate.
|
|
33
|
+
* @param filePath - Absolute path to read from.
|
|
17
34
|
*/
|
|
18
35
|
export async function loadFrom(registry, filePath) {
|
|
19
36
|
return load(registry, filePath);
|
|
20
37
|
}
|
|
21
38
|
// ---------------------------------------------------------------------------
|
|
22
39
|
// load (file → store)
|
|
23
|
-
//
|
|
24
|
-
// Hydrates the store from its bound filePath.
|
|
25
|
-
// - .ts files: uses dynamic import (handler is not called — TS files export
|
|
26
|
-
// a `registry` object directly at runtime via Bun/tsx)
|
|
27
|
-
// - other files: uses readFileSync + handler.deserialize
|
|
28
|
-
//
|
|
29
|
-
// No-op if the store has no filePath or the file does not exist yet.
|
|
30
40
|
// ---------------------------------------------------------------------------
|
|
41
|
+
/**
|
|
42
|
+
* @brief Hydrates the store from a file.
|
|
43
|
+
*
|
|
44
|
+
* A `.ts` file is read by dynamic import, which skips the handler, since such a file exports a `registry`
|
|
45
|
+
* object directly at runtime. Any other file is read with `readFileSync` and `handler.deserialize`.
|
|
46
|
+
* Does nothing when there is no file path or the file does not exist yet.
|
|
47
|
+
*
|
|
48
|
+
* @param registry - Store to hydrate.
|
|
49
|
+
* @param filePath - File to read. Defaults to the store's bound `filePath`.
|
|
50
|
+
*/
|
|
31
51
|
export async function load(registry, filePath) {
|
|
32
52
|
const target = filePath ?? registry.filePath;
|
|
33
53
|
if (!target)
|
|
@@ -51,10 +71,11 @@ export async function load(registry, filePath) {
|
|
|
51
71
|
// flush (store → bound filePath)
|
|
52
72
|
// ---------------------------------------------------------------------------
|
|
53
73
|
/**
|
|
54
|
-
*
|
|
55
|
-
* Sorts entries alphabetically for deterministic output.
|
|
74
|
+
* @brief Writes the store to its bound `filePath`, entries sorted by key.
|
|
56
75
|
*
|
|
57
|
-
* @
|
|
76
|
+
* @param registry - Store to write.
|
|
77
|
+
* @param handler - Serialization handler. Defaults to the store's handler, then `tsHandler`.
|
|
78
|
+
* @throws {Error} When the store has no bound `filePath`.
|
|
58
79
|
*/
|
|
59
80
|
export function flush(registry, handler) {
|
|
60
81
|
if (!registry.filePath) {
|
|
@@ -67,9 +88,11 @@ export function flush(registry, handler) {
|
|
|
67
88
|
// writeTo (store → explicit path)
|
|
68
89
|
// ---------------------------------------------------------------------------
|
|
69
90
|
/**
|
|
70
|
-
* Writes the store to an explicit path.
|
|
71
|
-
*
|
|
72
|
-
*
|
|
91
|
+
* @brief Writes the store to an explicit path, entries sorted by key. The store's bound `filePath` is not changed.
|
|
92
|
+
*
|
|
93
|
+
* @param registry - Store to write.
|
|
94
|
+
* @param filePath - Absolute path to write to.
|
|
95
|
+
* @param handler - Serialization handler. Defaults to the store's handler, then `tsHandler`.
|
|
73
96
|
*/
|
|
74
97
|
export function writeTo(registry, filePath, handler) {
|
|
75
98
|
const h = resolveHandler(registry, handler);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.io.js","sourceRoot":"","sources":["../../src/registry/registry.io.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAIrD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E,SAAS,cAAc,CACrB,QAA0B,EAC1B,QAA6B;IAE7B,OAAO,QAAQ,IAAI,QAAQ,CAAC,OAAO,IAAI,SAAS,CAAA;AAClD,CAAC;AAED,SAAS,aAAa,CAA8B,QAA0B;IAC5E,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,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,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC3C,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;AACxE,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import type { BaseRegistryEntry } from "./types";
|
|
2
2
|
import type { RegistryStore } from "./registry.store";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* @brief Registers an entry in the store, overwriting any entry under the same key.
|
|
5
|
+
*
|
|
6
|
+
* @param registry - Store to write to.
|
|
7
|
+
* @param key - Key the entry is stored under.
|
|
8
|
+
* @param entry - Entry to store.
|
|
5
9
|
*/
|
|
6
10
|
export declare function register<T extends BaseRegistryEntry>(registry: RegistryStore<T>, key: string, entry: T): void;
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
12
|
+
* @brief Removes an entry from the store.
|
|
13
|
+
*
|
|
14
|
+
* @param registry - Store to remove from.
|
|
15
|
+
* @param key - Key of the entry to remove.
|
|
16
|
+
* @returns `true` if the entry existed, `false` if it was already absent.
|
|
10
17
|
*/
|
|
11
18
|
export declare function unregister<T extends BaseRegistryEntry>(registry: RegistryStore<T>, key: string): boolean;
|
|
12
19
|
//# sourceMappingURL=registry.mutations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.mutations.d.ts","sourceRoot":"","sources":["../../src/registry/registry.mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.mutations.d.ts","sourceRoot":"","sources":["../../src/registry/registry.mutations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,iBAAiB,EAClD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,CAAC,GACP,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,iBAAiB,EACpD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,MAAM,GACV,OAAO,CAYT"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @brief Registers an entry in the store, overwriting any entry under the same key.
|
|
3
|
+
*
|
|
4
|
+
* @param registry - Store to write to.
|
|
5
|
+
* @param key - Key the entry is stored under.
|
|
6
|
+
* @param entry - Entry to store.
|
|
3
7
|
*/
|
|
4
8
|
export function register(registry, key, entry) {
|
|
5
9
|
registry.store.setState((s) => ({ ...s, [key]: entry }));
|
|
6
10
|
}
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
12
|
+
* @brief Removes an entry from the store.
|
|
13
|
+
*
|
|
14
|
+
* @param registry - Store to remove from.
|
|
15
|
+
* @param key - Key of the entry to remove.
|
|
16
|
+
* @returns `true` if the entry existed, `false` if it was already absent.
|
|
10
17
|
*/
|
|
11
18
|
export function unregister(registry, key) {
|
|
12
19
|
const existed = key in registry.store.state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.mutations.js","sourceRoot":"","sources":["../../src/registry/registry.mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.mutations.js","sourceRoot":"","sources":["../../src/registry/registry.mutations.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CACtB,QAA0B,EAC1B,GAAW,EACX,KAAQ;IAER,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,QAA0B,EAC1B,GAAW;IAEX,MAAM,OAAO,GAAG,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAA;IAE3C,IAAI,OAAO,EAAE,CAAC;QACZ,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE;YAC5B,MAAM,IAAI,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;YACrB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;YAChB,OAAO,IAAI,CAAA;QACb,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -1,38 +1,68 @@
|
|
|
1
1
|
import type { BaseRegistry, BaseRegistryEntry } from "./types";
|
|
2
2
|
import type { RegistryStore } from "./registry.store";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* @brief Gets a single entry by key.
|
|
5
|
+
*
|
|
6
|
+
* @param registry - Store to read from.
|
|
7
|
+
* @param key - Key of the entry.
|
|
8
|
+
* @returns The entry, or `undefined` when not found.
|
|
5
9
|
*/
|
|
6
10
|
export declare function get<T extends BaseRegistryEntry>(registry: RegistryStore<T>, key: string): T | undefined;
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
12
|
+
* @brief Checks whether a key exists in the store.
|
|
13
|
+
*
|
|
14
|
+
* @param registry - Store to read from.
|
|
15
|
+
* @param key - Key to look for.
|
|
16
|
+
* @returns `true` when the key is present.
|
|
9
17
|
*/
|
|
10
18
|
export declare function has<T extends BaseRegistryEntry>(registry: RegistryStore<T>, key: string): boolean;
|
|
11
19
|
/**
|
|
12
|
-
*
|
|
20
|
+
* @brief Returns all entries as a plain record.
|
|
21
|
+
*
|
|
22
|
+
* @param registry - Store to read from.
|
|
23
|
+
* @returns Entries by key. This is the store's own state, not a copy.
|
|
13
24
|
*/
|
|
14
25
|
export declare function entries<T extends BaseRegistryEntry>(registry: RegistryStore<T>): BaseRegistry<T>;
|
|
15
26
|
/**
|
|
16
|
-
*
|
|
27
|
+
* @brief Returns all registered keys.
|
|
28
|
+
*
|
|
29
|
+
* @param registry - Store to read from.
|
|
30
|
+
* @returns Keys of the store's state.
|
|
17
31
|
*/
|
|
18
32
|
export declare function keys<T extends BaseRegistryEntry>(registry: RegistryStore<T>): string[];
|
|
19
33
|
/**
|
|
20
|
-
*
|
|
34
|
+
* @brief Returns all entries whose `version` equals the given string.
|
|
35
|
+
*
|
|
36
|
+
* @param registry - Store to read from.
|
|
37
|
+
* @param version - Version to match exactly.
|
|
38
|
+
* @returns Matching entries by key.
|
|
21
39
|
*/
|
|
22
40
|
export declare function getByVersion<T extends BaseRegistryEntry>(registry: RegistryStore<T>, version: string): BaseRegistry<T>;
|
|
23
41
|
/**
|
|
24
|
-
*
|
|
42
|
+
* @brief Returns the count of registered entries.
|
|
43
|
+
*
|
|
44
|
+
* @param registry - Store to read from.
|
|
45
|
+
* @returns Number of entries.
|
|
25
46
|
*/
|
|
26
47
|
export declare function size<T extends BaseRegistryEntry>(registry: RegistryStore<T>): number;
|
|
27
48
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `unknown` and not walked further.
|
|
49
|
+
* @brief Walks `registryDependencies` depth-first, starting at `key`.
|
|
50
|
+
*
|
|
51
|
+
* Every entry reached is added to `seen`. Keys without a registry entry are pushed to `unknown` and not walked further.
|
|
52
|
+
*
|
|
53
|
+
* @param key - Key to start from.
|
|
54
|
+
* @param entries - Registry to walk, by key.
|
|
55
|
+
* @param seen - Keys already reached. Filled in place.
|
|
56
|
+
* @param unknown - Keys with no registry entry. Filled in place.
|
|
31
57
|
*/
|
|
32
58
|
export declare function collectDependencies(key: string, entries: BaseRegistry, seen: Set<string>, unknown: string[]): void;
|
|
33
59
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
60
|
+
* @brief Finds the candidates that depend on `key`, the entries that would break if it were removed.
|
|
61
|
+
*
|
|
62
|
+
* @param key - Key that may be needed.
|
|
63
|
+
* @param entries - Registry to read `registryDependencies` from, by key.
|
|
64
|
+
* @param candidates - Keys to check.
|
|
65
|
+
* @returns The candidates whose `registryDependencies` include `key`.
|
|
36
66
|
*/
|
|
37
67
|
export declare function entryDependencies(key: string, entries: BaseRegistry, candidates: string[]): string[];
|
|
38
68
|
//# sourceMappingURL=registry.selectors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.selectors.d.ts","sourceRoot":"","sources":["../../src/registry/registry.selectors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD
|
|
1
|
+
{"version":3,"file":"registry.selectors.d.ts","sourceRoot":"","sources":["../../src/registry/registry.selectors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,iBAAiB,EAC7C,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,MAAM,GACV,CAAC,GAAG,SAAS,CAEf;AAED;;;;;;GAMG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,iBAAiB,EAC7C,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,GAAG,EAAE,MAAM,GACV,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,iBAAiB,EACjD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GACzB,YAAY,CAAC,CAAC,CAAC,CAEjB;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,iBAAiB,EAC9C,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GACzB,MAAM,EAAE,CAEV;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,iBAAiB,EACtD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,OAAO,EAAE,MAAM,GACd,YAAY,CAAC,CAAC,CAAC,CAIjB;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,iBAAiB,EAC9C,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GACzB,MAAM,CAER;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EACjB,OAAO,EAAE,MAAM,EAAE,GAChB,IAAI,CASN;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,MAAM,EAAE,GACnB,MAAM,EAAE,CAEV"}
|
|
@@ -1,43 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @brief Gets a single entry by key.
|
|
3
|
+
*
|
|
4
|
+
* @param registry - Store to read from.
|
|
5
|
+
* @param key - Key of the entry.
|
|
6
|
+
* @returns The entry, or `undefined` when not found.
|
|
3
7
|
*/
|
|
4
8
|
export function get(registry, key) {
|
|
5
9
|
return registry.store.state[key];
|
|
6
10
|
}
|
|
7
11
|
/**
|
|
8
|
-
*
|
|
12
|
+
* @brief Checks whether a key exists in the store.
|
|
13
|
+
*
|
|
14
|
+
* @param registry - Store to read from.
|
|
15
|
+
* @param key - Key to look for.
|
|
16
|
+
* @returns `true` when the key is present.
|
|
9
17
|
*/
|
|
10
18
|
export function has(registry, key) {
|
|
11
19
|
return key in registry.store.state;
|
|
12
20
|
}
|
|
13
21
|
/**
|
|
14
|
-
*
|
|
22
|
+
* @brief Returns all entries as a plain record.
|
|
23
|
+
*
|
|
24
|
+
* @param registry - Store to read from.
|
|
25
|
+
* @returns Entries by key. This is the store's own state, not a copy.
|
|
15
26
|
*/
|
|
16
27
|
export function entries(registry) {
|
|
17
28
|
return registry.store.state;
|
|
18
29
|
}
|
|
19
30
|
/**
|
|
20
|
-
*
|
|
31
|
+
* @brief Returns all registered keys.
|
|
32
|
+
*
|
|
33
|
+
* @param registry - Store to read from.
|
|
34
|
+
* @returns Keys of the store's state.
|
|
21
35
|
*/
|
|
22
36
|
export function keys(registry) {
|
|
23
37
|
return Object.keys(registry.store.state);
|
|
24
38
|
}
|
|
25
39
|
/**
|
|
26
|
-
*
|
|
40
|
+
* @brief Returns all entries whose `version` equals the given string.
|
|
41
|
+
*
|
|
42
|
+
* @param registry - Store to read from.
|
|
43
|
+
* @param version - Version to match exactly.
|
|
44
|
+
* @returns Matching entries by key.
|
|
27
45
|
*/
|
|
28
46
|
export function getByVersion(registry, version) {
|
|
29
47
|
return Object.fromEntries(Object.entries(registry.store.state).filter(([, entry]) => entry.version === version));
|
|
30
48
|
}
|
|
31
49
|
/**
|
|
32
|
-
*
|
|
50
|
+
* @brief Returns the count of registered entries.
|
|
51
|
+
*
|
|
52
|
+
* @param registry - Store to read from.
|
|
53
|
+
* @returns Number of entries.
|
|
33
54
|
*/
|
|
34
55
|
export function size(registry) {
|
|
35
56
|
return Object.keys(registry.store.state).length;
|
|
36
57
|
}
|
|
37
58
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* `unknown` and not walked further.
|
|
59
|
+
* @brief Walks `registryDependencies` depth-first, starting at `key`.
|
|
60
|
+
*
|
|
61
|
+
* Every entry reached is added to `seen`. Keys without a registry entry are pushed to `unknown` and not walked further.
|
|
62
|
+
*
|
|
63
|
+
* @param key - Key to start from.
|
|
64
|
+
* @param entries - Registry to walk, by key.
|
|
65
|
+
* @param seen - Keys already reached. Filled in place.
|
|
66
|
+
* @param unknown - Keys with no registry entry. Filled in place.
|
|
41
67
|
*/
|
|
42
68
|
export function collectDependencies(key, entries, seen, unknown) {
|
|
43
69
|
if (seen.has(key))
|
|
@@ -52,8 +78,12 @@ export function collectDependencies(key, entries, seen, unknown) {
|
|
|
52
78
|
collectDependencies(dep, entries, seen, unknown);
|
|
53
79
|
}
|
|
54
80
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
81
|
+
* @brief Finds the candidates that depend on `key`, the entries that would break if it were removed.
|
|
82
|
+
*
|
|
83
|
+
* @param key - Key that may be needed.
|
|
84
|
+
* @param entries - Registry to read `registryDependencies` from, by key.
|
|
85
|
+
* @param candidates - Keys to check.
|
|
86
|
+
* @returns The candidates whose `registryDependencies` include `key`.
|
|
57
87
|
*/
|
|
58
88
|
export function entryDependencies(key, entries, candidates) {
|
|
59
89
|
return candidates.filter((k) => entries[k]?.registryDependencies?.includes(key) ?? false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.selectors.js","sourceRoot":"","sources":["../../src/registry/registry.selectors.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"registry.selectors.js","sourceRoot":"","sources":["../../src/registry/registry.selectors.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,CACjB,QAA0B,EAC1B,GAAW;IAEX,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AAClC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,GAAG,CACjB,QAA0B,EAC1B,GAAW;IAEX,OAAO,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAA;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CACrB,QAA0B;IAE1B,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAA;AAC7B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAClB,QAA0B;IAE1B,OAA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AE,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAA;AAC3F,CAAC"}
|
|
@@ -1,34 +1,47 @@
|
|
|
1
1
|
import { Store } from "@tanstack/store";
|
|
2
2
|
import type { BaseRegistry, BaseRegistryEntry } from "./types";
|
|
3
3
|
import type { RegistryHandler } from "./registry.handlers";
|
|
4
|
+
/**
|
|
5
|
+
* @brief Options for `createRegistryStore`.
|
|
6
|
+
*
|
|
7
|
+
* @property filePath - Absolute path to the manifest file. Used by `load()` and `flush()`.
|
|
8
|
+
* @property handler - Serialization handler. Defaults to `tsHandler`.
|
|
9
|
+
*/
|
|
4
10
|
export interface RegistryStoreOptions<T extends BaseRegistryEntry = BaseRegistryEntry> {
|
|
5
|
-
/** Absolute path to the manifest file. Used by load() and flush(). */
|
|
6
11
|
filePath?: string;
|
|
7
|
-
/** Default handler for serialization/deserialization. Defaults to tsHandler. */
|
|
8
12
|
handler?: RegistryHandler<T>;
|
|
9
13
|
}
|
|
10
14
|
/**
|
|
11
|
-
*
|
|
15
|
+
* @brief A registry store, passed to mutations, selectors and io helpers.
|
|
16
|
+
*
|
|
17
|
+
* @property store - The underlying TanStack Store. Subscribe, derive, or read `.state` directly.
|
|
18
|
+
* @property filePath - Absolute path this store is bound to, if any.
|
|
19
|
+
* @property handler - Serialization handler used when `load()` and `flush()` are not given one.
|
|
12
20
|
*/
|
|
13
21
|
export interface RegistryStore<T extends BaseRegistryEntry = BaseRegistryEntry> {
|
|
14
|
-
/** The underlying TanStack Store. Subscribe, derive, or read .state directly. */
|
|
15
22
|
store: Store<BaseRegistry<T>>;
|
|
16
|
-
/** Absolute path this store is bound to (if any). */
|
|
17
23
|
filePath?: string;
|
|
18
|
-
/** Default handler for serialization/deserialization. */
|
|
19
24
|
handler?: RegistryHandler<T>;
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
22
|
-
* Creates a RegistryStore backed by TanStack Store.
|
|
23
|
-
*
|
|
27
|
+
* @brief Creates a `RegistryStore` backed by TanStack Store, starting empty.
|
|
28
|
+
*
|
|
29
|
+
* Call `load()` to hydrate it from disk.
|
|
24
30
|
*
|
|
25
31
|
* @example
|
|
26
32
|
* const registry = createRegistryStore<MyEntry>({ filePath: "/abs/.g3nerate-manifest.ts" })
|
|
27
33
|
* await load(registry)
|
|
34
|
+
*
|
|
35
|
+
* @param options - Bound file path and handler. Both optional.
|
|
36
|
+
* @returns A new store with no entries.
|
|
28
37
|
*/
|
|
29
38
|
export declare function createRegistryStore<T extends BaseRegistryEntry = BaseRegistryEntry>(options?: RegistryStoreOptions<T>): RegistryStore<T>;
|
|
30
39
|
/**
|
|
31
|
-
* Sets the default handler on
|
|
40
|
+
* @brief Sets the default handler on a store.
|
|
41
|
+
*
|
|
42
|
+
* @param registry - Store to update.
|
|
43
|
+
* @param handler - Handler used for serialization and deserialization.
|
|
44
|
+
* @returns The same store, for chaining.
|
|
32
45
|
*/
|
|
33
46
|
export declare function useHandler<T extends BaseRegistryEntry>(registry: RegistryStore<T>, handler: RegistryHandler<T>): RegistryStore<T>;
|
|
34
47
|
//# sourceMappingURL=registry.store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.store.d.ts","sourceRoot":"","sources":["../../src/registry/registry.store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.store.d.ts","sourceRoot":"","sources":["../../src/registry/registry.store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAM1D;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB;IAC5E,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;CAC7B;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,EACjF,OAAO,GAAE,oBAAoB,CAAC,CAAC,CAAM,GACpC,aAAa,CAAC,CAAC,CAAC,CAMlB;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,iBAAiB,EACpD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,EAC1B,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,GAC1B,aAAa,CAAC,CAAC,CAAC,CAGlB"}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
// packages/core/src/registry/registry.store.ts
|
|
1
2
|
import { Store } from "@tanstack/store";
|
|
2
3
|
// ---------------------------------------------------------------------------
|
|
3
4
|
// Factory
|
|
4
5
|
// ---------------------------------------------------------------------------
|
|
5
6
|
/**
|
|
6
|
-
* Creates a RegistryStore backed by TanStack Store.
|
|
7
|
-
*
|
|
7
|
+
* @brief Creates a `RegistryStore` backed by TanStack Store, starting empty.
|
|
8
|
+
*
|
|
9
|
+
* Call `load()` to hydrate it from disk.
|
|
8
10
|
*
|
|
9
11
|
* @example
|
|
10
12
|
* const registry = createRegistryStore<MyEntry>({ filePath: "/abs/.g3nerate-manifest.ts" })
|
|
11
13
|
* await load(registry)
|
|
14
|
+
*
|
|
15
|
+
* @param options - Bound file path and handler. Both optional.
|
|
16
|
+
* @returns A new store with no entries.
|
|
12
17
|
*/
|
|
13
18
|
export function createRegistryStore(options = {}) {
|
|
14
19
|
return {
|
|
@@ -18,7 +23,11 @@ export function createRegistryStore(options = {}) {
|
|
|
18
23
|
};
|
|
19
24
|
}
|
|
20
25
|
/**
|
|
21
|
-
* Sets the default handler on
|
|
26
|
+
* @brief Sets the default handler on a store.
|
|
27
|
+
*
|
|
28
|
+
* @param registry - Store to update.
|
|
29
|
+
* @param handler - Handler used for serialization and deserialization.
|
|
30
|
+
* @returns The same store, for chaining.
|
|
22
31
|
*/
|
|
23
32
|
export function useHandler(registry, handler) {
|
|
24
33
|
registry.handler = handler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.store.js","sourceRoot":"","sources":["../../src/registry/registry.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.store.js","sourceRoot":"","sources":["../../src/registry/registry.store.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAgCvC,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAO,GAA4B,EAAE;IAErC,OAAO;QACL,KAAK,EAAE,IAAI,KAAK,CAAkB,EAAE,CAAC;QACrC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,QAA0B,EAC1B,OAA2B;IAE3B,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAA;IAC1B,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Recursively serializes a value to a TypeScript object literal string.
|
|
3
|
-
*
|
|
2
|
+
* @brief Recursively serializes a value to a TypeScript object literal string.
|
|
3
|
+
*
|
|
4
|
+
* Used by `generateRegistryFile` to produce human-readable `.ts` output.
|
|
5
|
+
*
|
|
6
|
+
* @param value - Value to serialize. Objects, arrays, strings, numbers, booleans and null are written as literals.
|
|
7
|
+
* @param depth - Nesting level of `value`, used for indentation.
|
|
8
|
+
* @returns Source text of the literal.
|
|
4
9
|
*/
|
|
5
10
|
export declare function stringifyValue(value: unknown, depth?: number): string;
|
|
6
11
|
/**
|
|
7
|
-
* Generates the full content of a typed
|
|
12
|
+
* @brief Generates the full content of a typed `.ts` registry manifest file.
|
|
8
13
|
*
|
|
9
|
-
* @param entries
|
|
10
|
-
* @param typeName
|
|
11
|
-
* @param importFrom - Package
|
|
14
|
+
* @param entries - Registry entries to serialize, by key.
|
|
15
|
+
* @param typeName - TypeScript type name for the `satisfies` clause, e.g. `G3nerateRegistry`.
|
|
16
|
+
* @param importFrom - Package the type is imported from, e.g. `@g3nomaly/g3nerate`.
|
|
17
|
+
* @returns Source text of the file, ending with a newline.
|
|
12
18
|
*
|
|
13
19
|
* @example
|
|
14
20
|
* generateRegistryFile(entries, "G3nerateRegistry", "@g3nomaly/g3nerate")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.template.d.ts","sourceRoot":"","sources":["../../src/registry/registry.template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.template.d.ts","sourceRoot":"","sources":["../../src/registry/registry.template.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,MAAM,CA2BhE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAeR"}
|