@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
package/dist/sources/types.js
CHANGED
|
@@ -8,24 +8,41 @@ export const NPM_PACKAGE = /^(@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/;
|
|
|
8
8
|
export const SourceNameSchema = z
|
|
9
9
|
.string()
|
|
10
10
|
.regex(/^[a-z0-9][a-z0-9._-]*$/, "use lowercase letters, digits, `.`, `_` and `-`, starting with a letter or digit");
|
|
11
|
+
/**
|
|
12
|
+
* @brief Spec of a git source: a clone of a repository.
|
|
13
|
+
*
|
|
14
|
+
* @property kind - Always `git`.
|
|
15
|
+
* @property url - Clone URL.
|
|
16
|
+
* @property ref - Branch or tag to check out. The default branch when absent.
|
|
17
|
+
*/
|
|
11
18
|
export const GitSourceSpecSchema = z.object({
|
|
12
19
|
kind: z.literal("git"),
|
|
13
20
|
url: z.string().regex(GIT_URL, "is not a git URL (https://, ssh://, git://, file:// or git@)"),
|
|
14
|
-
/** Branch or tag to check out; the default branch when absent */
|
|
15
21
|
ref: z.string().min(1).optional(),
|
|
16
22
|
});
|
|
23
|
+
/**
|
|
24
|
+
* @brief Spec of an npm source: a published package.
|
|
25
|
+
*
|
|
26
|
+
* @property kind - Always `npm`.
|
|
27
|
+
* @property package - Package name, scoped or not.
|
|
28
|
+
* @property version - Exact version, semver range or dist-tag. When absent, any installed copy is accepted, else `latest`.
|
|
29
|
+
*/
|
|
17
30
|
export const NpmSourceSpecSchema = z.object({
|
|
18
31
|
kind: z.literal("npm"),
|
|
19
32
|
package: z.string().regex(NPM_PACKAGE, "is not an npm package name"),
|
|
20
|
-
/** Exact version, semver range or dist-tag; absent accepts any installed copy, else `latest` */
|
|
21
33
|
version: z.string().min(1).optional(),
|
|
22
34
|
});
|
|
35
|
+
/**
|
|
36
|
+
* @brief Spec of a local source: a folder on disk.
|
|
37
|
+
*
|
|
38
|
+
* @property kind - Always `local`.
|
|
39
|
+
* @property path - Folder holding the source, absolute or relative to the project root.
|
|
40
|
+
*/
|
|
23
41
|
export const LocalSourceSpecSchema = z.object({
|
|
24
42
|
kind: z.literal("local"),
|
|
25
|
-
/** Folder holding the source, absolute or relative to the project root */
|
|
26
43
|
path: z.string().min(1),
|
|
27
44
|
});
|
|
28
|
-
/** Where a source's files come from. */
|
|
45
|
+
/** Where a source's files come from: a git, npm or local spec. */
|
|
29
46
|
export const SourceSpecSchema = z.discriminatedUnion("kind", [
|
|
30
47
|
GitSourceSpecSchema,
|
|
31
48
|
NpmSourceSpecSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iHAAiH;AACjH,MAAM,CAAC,MAAM,OAAO,GAAG,qDAAqD,CAAC;AAE7E,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,oDAAoD,CAAC;AAEhF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,KAAK,CAAC,wBAAwB,EAAE,kFAAkF,CAAC,CAAC;AAEvH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACtB,GAAG,EAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,8DAA8D,CAAC;IAC/F,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iHAAiH;AACjH,MAAM,CAAC,MAAM,OAAO,GAAG,qDAAqD,CAAC;AAE7E,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,oDAAoD,CAAC;AAEhF,4DAA4D;AAC5D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,KAAK,CAAC,wBAAwB,EAAE,kFAAkF,CAAC,CAAC;AAEvH;;;;;;GAMG;AACH,MAAM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the message of a thrown value, whether or not it is an `Error`.
|
|
3
|
+
*
|
|
4
|
+
* @param error - Thrown value of any type, e.g. an `Error` or a string.
|
|
5
|
+
* @returns The `message` of an `Error`, or the value converted to a string.
|
|
6
|
+
*/
|
|
2
7
|
export declare function errorMessage(error: unknown): string;
|
|
3
8
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEnD"}
|
package/dist/utils/errors.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// packages/core/src/utils/errors.ts
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* @brief Returns the message of a thrown value, whether or not it is an `Error`.
|
|
4
|
+
*
|
|
5
|
+
* @param error - Thrown value of any type, e.g. an `Error` or a string.
|
|
6
|
+
* @returns The `message` of an `Error`, or the value converted to a string.
|
|
7
|
+
*/
|
|
3
8
|
export function errorMessage(error) {
|
|
4
9
|
return error instanceof Error ? error.message : String(error);
|
|
5
10
|
}
|
package/dist/utils/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc;IACzC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/dist/utils/merge.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Recursively merges `patch` into `base` without mutating either.
|
|
3
|
-
*
|
|
2
|
+
* @brief Recursively merges `patch` into `base` without mutating either.
|
|
3
|
+
*
|
|
4
|
+
* Plain objects merge key by key. Arrays and primitives in `patch` replace the
|
|
5
|
+
* value in `base`, and keys whose value is `undefined` are skipped.
|
|
6
|
+
*
|
|
7
|
+
* @param base - Value to merge into. Its type is the type of the result.
|
|
8
|
+
* @param patch - Overrides, usually a partial of `base`. Any type.
|
|
9
|
+
* @returns A new value with `patch` applied.
|
|
4
10
|
*/
|
|
5
11
|
export declare function deepMerge<T>(base: T, patch: unknown): T;
|
|
6
12
|
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,CAUvD"}
|
package/dist/utils/merge.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
// packages/core/src/utils/merge.ts
|
|
2
|
+
/** Tells whether a value is a non-null object that is not an array. */
|
|
2
3
|
function isPlainObject(value) {
|
|
3
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4
5
|
}
|
|
5
6
|
/**
|
|
6
|
-
* Recursively merges `patch` into `base` without mutating either.
|
|
7
|
-
*
|
|
7
|
+
* @brief Recursively merges `patch` into `base` without mutating either.
|
|
8
|
+
*
|
|
9
|
+
* Plain objects merge key by key. Arrays and primitives in `patch` replace the
|
|
10
|
+
* value in `base`, and keys whose value is `undefined` are skipped.
|
|
11
|
+
*
|
|
12
|
+
* @param base - Value to merge into. Its type is the type of the result.
|
|
13
|
+
* @param patch - Overrides, usually a partial of `base`. Any type.
|
|
14
|
+
* @returns A new value with `patch` applied.
|
|
8
15
|
*/
|
|
9
16
|
export function deepMerge(base, patch) {
|
|
10
17
|
if (!isPlainObject(base) || !isPlainObject(patch)) {
|
package/dist/utils/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/utils/merge.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,uEAAuE;AACvE,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAI,IAAO,EAAE,KAAc;IAClD,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAM,CAAC;IACnD,CAAC;IACD,MAAM,GAAG,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAC;IACjD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,KAAK,SAAS;YAAE,SAAS;QAClC,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,GAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Name, version, description and license of a package, as its `package.json` states them.
|
|
3
|
+
*
|
|
4
|
+
* Built by `readPackageMeta`. The `mods`, `skills` and `ui` CLIs read it to name themselves.
|
|
5
|
+
*
|
|
6
|
+
* @property name - Package name, e.g. `@g3nomaly/core`, or `""` when missing.
|
|
7
|
+
* @property version - Package version, e.g. `1.2.3`, or `"0.0.0"` when missing.
|
|
8
|
+
* @property description - One-line description, or `""` when missing.
|
|
9
|
+
* @property license - SPDX license id, e.g. `MIT`, or `""` when missing.
|
|
10
|
+
*/
|
|
1
11
|
export interface PackageMetadata {
|
|
2
12
|
name: string;
|
|
3
13
|
version: string;
|
|
@@ -5,8 +15,12 @@ export interface PackageMetadata {
|
|
|
5
15
|
license: string;
|
|
6
16
|
}
|
|
7
17
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
18
|
+
* @brief Reads the metadata of the package that owns `entryUrl`.
|
|
19
|
+
*
|
|
20
|
+
* Reads `package.json` on every call, so the result is never stale.
|
|
21
|
+
*
|
|
22
|
+
* @param entryUrl - File URL of a module in the package, pass `import.meta.url`.
|
|
23
|
+
* @returns Metadata of that package. Missing fields come back as empty strings, and a missing version as `"0.0.0"`.
|
|
10
24
|
*/
|
|
11
25
|
export declare function readPackageMeta(entryUrl: string): PackageMetadata;
|
|
12
26
|
//# sourceMappingURL=packageMeta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageMeta.d.ts","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAS,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;CACrB;AAED
|
|
1
|
+
{"version":3,"file":"packageMeta.d.ts","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAS,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAM,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CASjE"}
|
|
@@ -4,8 +4,12 @@ import { dirname, join } from "node:path";
|
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { findPackageRoot } from "./paths";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* @brief Reads the metadata of the package that owns `entryUrl`.
|
|
8
|
+
*
|
|
9
|
+
* Reads `package.json` on every call, so the result is never stale.
|
|
10
|
+
*
|
|
11
|
+
* @param entryUrl - File URL of a module in the package, pass `import.meta.url`.
|
|
12
|
+
* @returns Metadata of that package. Missing fields come back as empty strings, and a missing version as `"0.0.0"`.
|
|
9
13
|
*/
|
|
10
14
|
export function readPackageMeta(entryUrl) {
|
|
11
15
|
const root = findPackageRoot(dirname(fileURLToPath(entryUrl)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageMeta.js","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"packageMeta.js","sourceRoot":"","sources":["../../src/utils/packageMeta.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAmB1C;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,MAAM,IAAI,GAAG,eAAe,CAAC,OAAO,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAA4B,CAAC;IACpG,OAAO;QACL,IAAI,EAAS,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QACzD,OAAO,EAAM,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;QACpE,WAAW,EAAE,OAAO,GAAG,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;QACvE,OAAO,EAAM,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;KAChE,CAAC;AACJ,CAAC"}
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* @brief Finds the nearest directory at or above `fromDir` that holds a `package.json`.
|
|
3
|
+
*
|
|
3
4
|
* Pass `import.meta.dir` to get the root of the package the caller lives in,
|
|
4
5
|
* from `src/` and `dist/` alike.
|
|
5
6
|
*
|
|
6
|
-
* @
|
|
7
|
+
* @param fromDir - Directory to start searching from, e.g. `import.meta.dir`.
|
|
8
|
+
* @returns Path of the package root directory.
|
|
9
|
+
* @throws {Error} When no package.json exists on the way up to the filesystem root.
|
|
7
10
|
*/
|
|
8
11
|
export declare function findPackageRoot(fromDir: string): string;
|
|
9
12
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
13
|
+
* @brief Finds the nearest directory at or above `fromDir` that holds `marker` as a direct entry.
|
|
14
|
+
*
|
|
15
|
+
* @param fromDir - Directory to start searching from.
|
|
16
|
+
* @param marker - Name of a file or directory to look for, e.g. `.git`.
|
|
17
|
+
* @returns Directory that holds `marker`, or `null` when no ancestor holds it.
|
|
12
18
|
*/
|
|
13
19
|
export declare function findUp(fromDir: string, marker: string): string | null;
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Finds the root of the git repository that contains `fromDir`.
|
|
22
|
+
*
|
|
23
|
+
* @param fromDir - Directory to start searching from.
|
|
24
|
+
* @returns Root directory of the repository, or `null` outside a repo.
|
|
25
|
+
*/
|
|
15
26
|
export declare function findGitRoot(fromDir: string): string | null;
|
|
16
27
|
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAQvD;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQrE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE1D"}
|
package/dist/utils/paths.js
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* @brief Finds the nearest directory at or above `fromDir` that holds a `package.json`.
|
|
6
|
+
*
|
|
6
7
|
* Pass `import.meta.dir` to get the root of the package the caller lives in,
|
|
7
8
|
* from `src/` and `dist/` alike.
|
|
8
9
|
*
|
|
9
|
-
* @
|
|
10
|
+
* @param fromDir - Directory to start searching from, e.g. `import.meta.dir`.
|
|
11
|
+
* @returns Path of the package root directory.
|
|
12
|
+
* @throws {Error} When no package.json exists on the way up to the filesystem root.
|
|
10
13
|
*/
|
|
11
14
|
export function findPackageRoot(fromDir) {
|
|
12
15
|
let dir = fromDir;
|
|
@@ -19,8 +22,11 @@ export function findPackageRoot(fromDir) {
|
|
|
19
22
|
return dir;
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
25
|
+
* @brief Finds the nearest directory at or above `fromDir` that holds `marker` as a direct entry.
|
|
26
|
+
*
|
|
27
|
+
* @param fromDir - Directory to start searching from.
|
|
28
|
+
* @param marker - Name of a file or directory to look for, e.g. `.git`.
|
|
29
|
+
* @returns Directory that holds `marker`, or `null` when no ancestor holds it.
|
|
24
30
|
*/
|
|
25
31
|
export function findUp(fromDir, marker) {
|
|
26
32
|
let dir = fromDir;
|
|
@@ -33,7 +39,12 @@ export function findUp(fromDir, marker) {
|
|
|
33
39
|
dir = parent;
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Finds the root of the git repository that contains `fromDir`.
|
|
44
|
+
*
|
|
45
|
+
* @param fromDir - Directory to start searching from.
|
|
46
|
+
* @returns Root directory of the repository, or `null` outside a repo.
|
|
47
|
+
*/
|
|
37
48
|
export function findGitRoot(fromDir) {
|
|
38
49
|
return findUp(fromDir, ".git");
|
|
39
50
|
}
|
package/dist/utils/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,IAAI,GAAG,GAAG,OAAO,CAAC;IAClB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,OAAO,EAAE,CAAC,CAAC;QAC9E,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAC,OAAe,EAAE,MAAc;IACpD,IAAI,GAAG,GAAG,OAAO,CAAC;IAClB,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YAAE,OAAO,GAAG,CAAC;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QAChC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/utils/prompt.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Returns the value a prompt gave back, or exits the process when the user cancelled it.
|
|
3
|
+
*
|
|
4
|
+
* @param result - Value a prompt returned, or the symbol it returns on cancel.
|
|
5
|
+
* @returns The value, unchanged.
|
|
6
|
+
*/
|
|
2
7
|
export declare function guardCancel<T>(result: T | symbol): T;
|
|
3
8
|
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,CAGpD"}
|
package/dist/utils/prompt.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// packages/core/src/utils/prompt.ts
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Returns the value a prompt gave back, or exits the process when the user cancelled it.
|
|
4
|
+
*
|
|
5
|
+
* @param result - Value a prompt returned, or the symbol it returns on cancel.
|
|
6
|
+
* @returns The value, unchanged.
|
|
7
|
+
*/
|
|
3
8
|
export function guardCancel(result) {
|
|
4
9
|
if (typeof result === "symbol")
|
|
5
10
|
process.exit(0);
|
package/dist/utils/prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAEpC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAI,MAAkB;IAC/C,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC/C,OAAO,MAAW,CAAA;AACpB,CAAC"}
|
package/dist/utils/version.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Warns on stderr when a newer version of `pkgName` exists on the registry.
|
|
2
|
+
* @brief Warns on stderr when a newer version of `pkgName` exists on the registry.
|
|
3
|
+
*
|
|
3
4
|
* When the process runs from a stale `bunx <pkg>@latest` cache, that cache
|
|
4
5
|
* directory is removed on exit so the next invocation reinstalls fresh.
|
|
5
6
|
* Checks the registry at most once per hour; no-op when offline or when
|
|
6
|
-
* G3N_NO_UPDATE_CHECK is set.
|
|
7
|
+
* `G3N_NO_UPDATE_CHECK` is set.
|
|
8
|
+
*
|
|
9
|
+
* @param pkgName - npm package name, e.g. `@g3nomaly/core`.
|
|
10
|
+
* @param currentVersion - Version that is running, e.g. `1.2.3`.
|
|
11
|
+
* @param entryUrl - File URL of the running module, pass `import.meta.url`.
|
|
7
12
|
*/
|
|
8
13
|
export declare function warnIfOutdated(pkgName: string, currentVersion: string, entryUrl: string): Promise<void>;
|
|
9
14
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAsGA;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC7G"}
|
package/dist/utils/version.js
CHANGED
|
@@ -6,9 +6,21 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
const REGISTRY = "https://registry.npmjs.org";
|
|
7
7
|
const CHECK_INTERVAL_MS = 60 * 60 * 1000;
|
|
8
8
|
const FETCH_TIMEOUT_MS = 1500;
|
|
9
|
+
/**
|
|
10
|
+
* Path of the throttle file that records when `pkgName` was last checked.
|
|
11
|
+
*
|
|
12
|
+
* @param pkgName - npm package name, e.g. `@g3nomaly/core`.
|
|
13
|
+
* @returns Path under the OS temporary directory.
|
|
14
|
+
*/
|
|
9
15
|
function throttleFile(pkgName) {
|
|
10
16
|
return path.join(os.tmpdir(), `.g3n-update-${pkgName.replace(/[^a-z0-9-]/gi, "_")}.json`);
|
|
11
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Reads the throttle record from `file`.
|
|
20
|
+
*
|
|
21
|
+
* @param file - Path of the throttle file.
|
|
22
|
+
* @returns The stored record, or `null` when the file is missing or malformed.
|
|
23
|
+
*/
|
|
12
24
|
function readState(file) {
|
|
13
25
|
try {
|
|
14
26
|
const raw = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
@@ -18,6 +30,12 @@ function readState(file) {
|
|
|
18
30
|
return null;
|
|
19
31
|
}
|
|
20
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Fetches the newest published version of `pkgName` from the npm registry.
|
|
35
|
+
*
|
|
36
|
+
* @param pkgName - npm package name, e.g. `@g3nomaly/core`.
|
|
37
|
+
* @returns The version string, or `null` when offline, timed out or not found.
|
|
38
|
+
*/
|
|
21
39
|
async function fetchLatest(pkgName) {
|
|
22
40
|
try {
|
|
23
41
|
const res = await fetch(`${REGISTRY}/${pkgName}/latest`, { signal: AbortSignal.timeout(FETCH_TIMEOUT_MS) });
|
|
@@ -30,6 +48,15 @@ async function fetchLatest(pkgName) {
|
|
|
30
48
|
return null;
|
|
31
49
|
}
|
|
32
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Tells whether `latest` is a newer major.minor.patch version than `current`.
|
|
53
|
+
*
|
|
54
|
+
* Pre-release suffixes are ignored.
|
|
55
|
+
*
|
|
56
|
+
* @param current - Version that is running, e.g. `1.2.3`.
|
|
57
|
+
* @param latest - Version the registry reported, e.g. `1.3.0`.
|
|
58
|
+
* @returns `true` when `latest` is newer.
|
|
59
|
+
*/
|
|
33
60
|
function isOutdated(current, latest) {
|
|
34
61
|
const a = current.split("-")[0].split(".").map(Number);
|
|
35
62
|
const b = latest.split("-")[0].split(".").map(Number);
|
|
@@ -41,7 +68,12 @@ function isOutdated(current, latest) {
|
|
|
41
68
|
}
|
|
42
69
|
return false;
|
|
43
70
|
}
|
|
44
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Finds the root of the `bunx <pkg>@latest` cache directory that `entryUrl` runs from.
|
|
73
|
+
*
|
|
74
|
+
* @param entryUrl - File URL of the running module, pass `import.meta.url`.
|
|
75
|
+
* @returns Path of the cache root, or `null` when the module does not run from such a cache.
|
|
76
|
+
*/
|
|
45
77
|
function bunxLatestCacheRoot(entryUrl) {
|
|
46
78
|
let entryPath;
|
|
47
79
|
try {
|
|
@@ -56,11 +88,16 @@ function bunxLatestCacheRoot(entryUrl) {
|
|
|
56
88
|
return entryPath.slice(0, marker + "@latest".length);
|
|
57
89
|
}
|
|
58
90
|
/**
|
|
59
|
-
* Warns on stderr when a newer version of `pkgName` exists on the registry.
|
|
91
|
+
* @brief Warns on stderr when a newer version of `pkgName` exists on the registry.
|
|
92
|
+
*
|
|
60
93
|
* When the process runs from a stale `bunx <pkg>@latest` cache, that cache
|
|
61
94
|
* directory is removed on exit so the next invocation reinstalls fresh.
|
|
62
95
|
* Checks the registry at most once per hour; no-op when offline or when
|
|
63
|
-
* G3N_NO_UPDATE_CHECK is set.
|
|
96
|
+
* `G3N_NO_UPDATE_CHECK` is set.
|
|
97
|
+
*
|
|
98
|
+
* @param pkgName - npm package name, e.g. `@g3nomaly/core`.
|
|
99
|
+
* @param currentVersion - Version that is running, e.g. `1.2.3`.
|
|
100
|
+
* @param entryUrl - File URL of the running module, pass `import.meta.url`.
|
|
64
101
|
*/
|
|
65
102
|
export async function warnIfOutdated(pkgName, currentVersion, entryUrl) {
|
|
66
103
|
if (process.env.G3N_NO_UPDATE_CHECK !== undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAC9C,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACzC,MAAM,gBAAgB,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAC9C,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACzC,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAe9B;;;;;GAKG;AACH,SAAS,YAAY,CAAC,OAAe;IACnC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,eAAe,O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