hot-updater 0.35.11 → 0.36.0
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/index.mjs +822 -1431
- package/package.json +16 -17
package/dist/index.mjs
CHANGED
|
@@ -29,11 +29,12 @@ import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWater
|
|
|
29
29
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
30
30
|
import { pipeline } from "stream/promises";
|
|
31
31
|
import { constants as constants$2, createBrotliCompress } from "zlib";
|
|
32
|
-
import { assertNodeStoragePlugin, getContentAddressedAssetStoragePath } from "@hot-updater/plugin-core";
|
|
32
|
+
import { BUNDLE_STORAGE_PREFIX, assertNodeStoragePlugin, createBundleStorageKey, createStorageRootUriWithPath, getContentAddressedAssetStoragePath, getManifestAssetDownloadPath, isContentAddressedAssetBaseStorageUri, resolveManifestAssetStorageUri } from "@hot-updater/plugin-core";
|
|
33
33
|
import { createBundleDiff, createMigrator, generateSchema } from "@hot-updater/server/db";
|
|
34
34
|
import net from "node:net";
|
|
35
35
|
import { setTimeout as setTimeout$1 } from "timers/promises";
|
|
36
36
|
import { createJiti } from "jiti";
|
|
37
|
+
import { getAssetBaseStorageUri, getBundlePatches, getManifestStorageUri, getPatchStorageUri } from "@hot-updater/core";
|
|
37
38
|
//#region ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/error.js
|
|
38
39
|
var require_error = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
39
40
|
/**
|
|
@@ -3065,807 +3066,435 @@ const { program: program$1, createCommand, createArgument, createOption, Command
|
|
|
3065
3066
|
exports.createArgument = (name, description) => new commander.Argument(name, description);
|
|
3066
3067
|
})))(), 1)).default;
|
|
3067
3068
|
//#endregion
|
|
3068
|
-
//#region ../../node_modules/.pnpm/
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
module.exports = LRUCache;
|
|
3099
|
-
}));
|
|
3100
|
-
//#endregion
|
|
3101
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/parse-options.js
|
|
3102
|
-
var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3103
|
-
const looseOption = Object.freeze({ loose: true });
|
|
3104
|
-
const emptyOpts = Object.freeze({});
|
|
3105
|
-
const parseOptions = (options) => {
|
|
3106
|
-
if (!options) return emptyOpts;
|
|
3107
|
-
if (typeof options !== "object") return looseOption;
|
|
3108
|
-
return options;
|
|
3109
|
-
};
|
|
3110
|
-
module.exports = parseOptions;
|
|
3111
|
-
}));
|
|
3112
|
-
//#endregion
|
|
3113
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/constants.js
|
|
3114
|
-
var require_constants$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3115
|
-
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
3116
|
-
const MAX_LENGTH = 256;
|
|
3117
|
-
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
3118
|
-
module.exports = {
|
|
3119
|
-
MAX_LENGTH,
|
|
3120
|
-
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
3121
|
-
MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
|
|
3122
|
-
MAX_SAFE_INTEGER,
|
|
3123
|
-
RELEASE_TYPES: [
|
|
3124
|
-
"major",
|
|
3125
|
-
"premajor",
|
|
3126
|
-
"minor",
|
|
3127
|
-
"preminor",
|
|
3128
|
-
"patch",
|
|
3129
|
-
"prepatch",
|
|
3130
|
-
"prerelease"
|
|
3131
|
-
],
|
|
3132
|
-
SEMVER_SPEC_VERSION,
|
|
3133
|
-
FLAG_INCLUDE_PRERELEASE: 1,
|
|
3134
|
-
FLAG_LOOSE: 2
|
|
3135
|
-
};
|
|
3136
|
-
}));
|
|
3137
|
-
//#endregion
|
|
3138
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/debug.js
|
|
3139
|
-
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3140
|
-
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
3141
|
-
}));
|
|
3142
|
-
//#endregion
|
|
3143
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/re.js
|
|
3144
|
-
var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3145
|
-
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants$1();
|
|
3146
|
-
const debug = require_debug();
|
|
3147
|
-
exports = module.exports = {};
|
|
3148
|
-
const re = exports.re = [];
|
|
3149
|
-
const safeRe = exports.safeRe = [];
|
|
3150
|
-
const src = exports.src = [];
|
|
3151
|
-
const safeSrc = exports.safeSrc = [];
|
|
3152
|
-
const t = exports.t = {};
|
|
3153
|
-
let R = 0;
|
|
3154
|
-
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
3155
|
-
const safeRegexReplacements = [
|
|
3156
|
-
["\\s", 1],
|
|
3157
|
-
["\\d", MAX_LENGTH],
|
|
3158
|
-
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
3069
|
+
//#region ../../node_modules/.pnpm/verkit@0.3.2/node_modules/verkit/dist/index.js
|
|
3070
|
+
const LETTER_DASH_NUMBER = "[a-zA-Z0-9-]";
|
|
3071
|
+
const NUMERIC_IDENTIFIER = String.raw`0|[1-9]\d*`;
|
|
3072
|
+
const NUMERIC_IDENTIFIER_LOOSE = String.raw`\d+`;
|
|
3073
|
+
const NON_NUMERIC_IDENTIFIER = String.raw`\d*[a-zA-Z-]${LETTER_DASH_NUMBER}*`;
|
|
3074
|
+
const MAIN_VERSION = String.raw`(${NUMERIC_IDENTIFIER})\.(${NUMERIC_IDENTIFIER})\.(${NUMERIC_IDENTIFIER})`;
|
|
3075
|
+
const MAIN_VERSION_LOOSE = String.raw`(${NUMERIC_IDENTIFIER_LOOSE})\.(${NUMERIC_IDENTIFIER_LOOSE})\.(${NUMERIC_IDENTIFIER_LOOSE})`;
|
|
3076
|
+
const PRERELEASE_IDENTIFIER = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER})`;
|
|
3077
|
+
const PRERELEASE_IDENTIFIER_LOOSE = `(?:${NON_NUMERIC_IDENTIFIER}|${NUMERIC_IDENTIFIER_LOOSE})`;
|
|
3078
|
+
const PRERELEASE = String.raw`(?:-(${PRERELEASE_IDENTIFIER}(?:\.${PRERELEASE_IDENTIFIER})*))`;
|
|
3079
|
+
const PRERELEASE_LOOSE = String.raw`(?:-?(${PRERELEASE_IDENTIFIER_LOOSE}(?:\.${PRERELEASE_IDENTIFIER_LOOSE})*))`;
|
|
3080
|
+
const BUILD_IDENTIFIER = `${LETTER_DASH_NUMBER}+`;
|
|
3081
|
+
const BUILD = String.raw`(?:\+(${BUILD_IDENTIFIER}(?:\.${BUILD_IDENTIFIER})*))`;
|
|
3082
|
+
const FULL_PLAIN = `v?${MAIN_VERSION}${PRERELEASE}?${BUILD}?`;
|
|
3083
|
+
const LOOSE_PLAIN = String.raw`[v=\s]*${MAIN_VERSION_LOOSE}${PRERELEASE_LOOSE}?${BUILD}?`;
|
|
3084
|
+
const GREATER_LESS_THAN = "((?:<|>)?=?)";
|
|
3085
|
+
const XRANGE_IDENTIFIER = String.raw`${NUMERIC_IDENTIFIER}|x|X|\*`;
|
|
3086
|
+
const XRANGE_IDENTIFIER_LOOSE = String.raw`${NUMERIC_IDENTIFIER_LOOSE}|x|X|\*`;
|
|
3087
|
+
const XRANGE_PLAIN = String.raw`[v=\s]*(${XRANGE_IDENTIFIER})(?:\.(${XRANGE_IDENTIFIER})(?:\.(${XRANGE_IDENTIFIER})(?:${PRERELEASE})?${BUILD}?)?)?`;
|
|
3088
|
+
const XRANGE_PLAIN_LOOSE = String.raw`[v=\s]*(${XRANGE_IDENTIFIER_LOOSE})(?:\.(${XRANGE_IDENTIFIER_LOOSE})(?:\.(${XRANGE_IDENTIFIER_LOOSE})(?:${PRERELEASE_LOOSE})?${BUILD}?)?)?`;
|
|
3089
|
+
const LONE_TILDE = "(?:~>?)";
|
|
3090
|
+
const LONE_CARET = String.raw`(?:\^)`;
|
|
3091
|
+
const COERCE_PLAIN = String.raw`(^|[^\d])(\d{1,${16}})(?:\.(\d{1,${16}}))?(?:\.(\d{1,${16}}))?`;
|
|
3092
|
+
const COERCE = String.raw`${COERCE_PLAIN}(?:$|[^\d])`;
|
|
3093
|
+
const COERCE_FULL = String.raw`${COERCE_PLAIN}(?:${PRERELEASE})?(?:${BUILD})?(?:$|[^\d])`;
|
|
3094
|
+
function makeSafeRegexSource(source) {
|
|
3095
|
+
const replacements = [
|
|
3096
|
+
[String.raw`\s`, 1],
|
|
3097
|
+
[String.raw`\d`, 256],
|
|
3098
|
+
[LETTER_DASH_NUMBER, 250]
|
|
3159
3099
|
];
|
|
3160
|
-
const
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
exports.comparatorTrimReplace = "$1$2$3";
|
|
3215
|
-
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
3216
|
-
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
3217
|
-
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
3218
|
-
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
3219
|
-
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
3220
|
-
}));
|
|
3221
|
-
//#endregion
|
|
3222
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/internal/identifiers.js
|
|
3223
|
-
var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3224
|
-
const numeric = /^[0-9]+$/;
|
|
3225
|
-
const compareIdentifiers = (a, b) => {
|
|
3226
|
-
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
3227
|
-
const anum = numeric.test(a);
|
|
3228
|
-
const bnum = numeric.test(b);
|
|
3229
|
-
if (anum && bnum) {
|
|
3230
|
-
a = +a;
|
|
3231
|
-
b = +b;
|
|
3232
|
-
}
|
|
3233
|
-
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
3234
|
-
};
|
|
3235
|
-
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
3236
|
-
module.exports = {
|
|
3237
|
-
compareIdentifiers,
|
|
3238
|
-
rcompareIdentifiers
|
|
3239
|
-
};
|
|
3240
|
-
}));
|
|
3241
|
-
//#endregion
|
|
3242
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/semver.js
|
|
3243
|
-
var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3244
|
-
const debug = require_debug();
|
|
3245
|
-
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants$1();
|
|
3246
|
-
const { safeRe: re, t } = require_re();
|
|
3247
|
-
const parseOptions = require_parse_options();
|
|
3248
|
-
const { compareIdentifiers } = require_identifiers();
|
|
3249
|
-
const isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
3250
|
-
const identifiers = identifier.split(".");
|
|
3251
|
-
if (identifiers.length > prerelease.length) return false;
|
|
3252
|
-
for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
|
|
3253
|
-
return true;
|
|
3254
|
-
};
|
|
3255
|
-
module.exports = class SemVer {
|
|
3256
|
-
constructor(version, options) {
|
|
3257
|
-
options = parseOptions(options);
|
|
3258
|
-
if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
3259
|
-
else version = version.version;
|
|
3260
|
-
else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
3261
|
-
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
3262
|
-
debug("SemVer", version, options);
|
|
3263
|
-
this.options = options;
|
|
3264
|
-
this.loose = !!options.loose;
|
|
3265
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
3266
|
-
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
3267
|
-
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
3268
|
-
this.raw = version;
|
|
3269
|
-
this.major = +m[1];
|
|
3270
|
-
this.minor = +m[2];
|
|
3271
|
-
this.patch = +m[3];
|
|
3272
|
-
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
3273
|
-
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
3274
|
-
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
3275
|
-
if (!m[4]) this.prerelease = [];
|
|
3276
|
-
else this.prerelease = m[4].split(".").map((id) => {
|
|
3277
|
-
if (/^[0-9]+$/.test(id)) {
|
|
3278
|
-
const num = +id;
|
|
3279
|
-
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
3280
|
-
}
|
|
3281
|
-
return id;
|
|
3282
|
-
});
|
|
3283
|
-
this.build = m[5] ? m[5].split(".") : [];
|
|
3284
|
-
this.format();
|
|
3285
|
-
}
|
|
3286
|
-
format() {
|
|
3287
|
-
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
3288
|
-
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
3289
|
-
return this.version;
|
|
3290
|
-
}
|
|
3291
|
-
toString() {
|
|
3292
|
-
return this.version;
|
|
3293
|
-
}
|
|
3294
|
-
compare(other) {
|
|
3295
|
-
debug("SemVer.compare", this.version, this.options, other);
|
|
3296
|
-
if (!(other instanceof SemVer)) {
|
|
3297
|
-
if (typeof other === "string" && other === this.version) return 0;
|
|
3298
|
-
other = new SemVer(other, this.options);
|
|
3299
|
-
}
|
|
3300
|
-
if (other.version === this.version) return 0;
|
|
3301
|
-
return this.compareMain(other) || this.comparePre(other);
|
|
3302
|
-
}
|
|
3303
|
-
compareMain(other) {
|
|
3304
|
-
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
3305
|
-
if (this.major < other.major) return -1;
|
|
3306
|
-
if (this.major > other.major) return 1;
|
|
3307
|
-
if (this.minor < other.minor) return -1;
|
|
3308
|
-
if (this.minor > other.minor) return 1;
|
|
3309
|
-
if (this.patch < other.patch) return -1;
|
|
3310
|
-
if (this.patch > other.patch) return 1;
|
|
3311
|
-
return 0;
|
|
3312
|
-
}
|
|
3313
|
-
comparePre(other) {
|
|
3314
|
-
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
3315
|
-
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
3316
|
-
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
3317
|
-
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
3318
|
-
let i = 0;
|
|
3319
|
-
do {
|
|
3320
|
-
const a = this.prerelease[i];
|
|
3321
|
-
const b = other.prerelease[i];
|
|
3322
|
-
debug("prerelease compare", i, a, b);
|
|
3323
|
-
if (a === void 0 && b === void 0) return 0;
|
|
3324
|
-
else if (b === void 0) return 1;
|
|
3325
|
-
else if (a === void 0) return -1;
|
|
3326
|
-
else if (a === b) continue;
|
|
3327
|
-
else return compareIdentifiers(a, b);
|
|
3328
|
-
} while (++i);
|
|
3329
|
-
}
|
|
3330
|
-
compareBuild(other) {
|
|
3331
|
-
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
3332
|
-
let i = 0;
|
|
3333
|
-
do {
|
|
3334
|
-
const a = this.build[i];
|
|
3335
|
-
const b = other.build[i];
|
|
3336
|
-
debug("build compare", i, a, b);
|
|
3337
|
-
if (a === void 0 && b === void 0) return 0;
|
|
3338
|
-
else if (b === void 0) return 1;
|
|
3339
|
-
else if (a === void 0) return -1;
|
|
3340
|
-
else if (a === b) continue;
|
|
3341
|
-
else return compareIdentifiers(a, b);
|
|
3342
|
-
} while (++i);
|
|
3343
|
-
}
|
|
3344
|
-
inc(release, identifier, identifierBase) {
|
|
3345
|
-
if (release.startsWith("pre")) {
|
|
3346
|
-
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
3347
|
-
if (identifier) {
|
|
3348
|
-
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
3349
|
-
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
3350
|
-
}
|
|
3351
|
-
}
|
|
3352
|
-
switch (release) {
|
|
3353
|
-
case "premajor":
|
|
3354
|
-
this.prerelease.length = 0;
|
|
3355
|
-
this.patch = 0;
|
|
3356
|
-
this.minor = 0;
|
|
3357
|
-
this.major++;
|
|
3358
|
-
this.inc("pre", identifier, identifierBase);
|
|
3359
|
-
break;
|
|
3360
|
-
case "preminor":
|
|
3361
|
-
this.prerelease.length = 0;
|
|
3362
|
-
this.patch = 0;
|
|
3363
|
-
this.minor++;
|
|
3364
|
-
this.inc("pre", identifier, identifierBase);
|
|
3365
|
-
break;
|
|
3366
|
-
case "prepatch":
|
|
3367
|
-
this.prerelease.length = 0;
|
|
3368
|
-
this.inc("patch", identifier, identifierBase);
|
|
3369
|
-
this.inc("pre", identifier, identifierBase);
|
|
3370
|
-
break;
|
|
3371
|
-
case "prerelease":
|
|
3372
|
-
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
3373
|
-
this.inc("pre", identifier, identifierBase);
|
|
3374
|
-
break;
|
|
3375
|
-
case "release":
|
|
3376
|
-
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
3377
|
-
this.prerelease.length = 0;
|
|
3378
|
-
break;
|
|
3379
|
-
case "major":
|
|
3380
|
-
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
3381
|
-
this.minor = 0;
|
|
3382
|
-
this.patch = 0;
|
|
3383
|
-
this.prerelease = [];
|
|
3384
|
-
break;
|
|
3385
|
-
case "minor":
|
|
3386
|
-
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
3387
|
-
this.patch = 0;
|
|
3388
|
-
this.prerelease = [];
|
|
3389
|
-
break;
|
|
3390
|
-
case "patch":
|
|
3391
|
-
if (this.prerelease.length === 0) this.patch++;
|
|
3392
|
-
this.prerelease = [];
|
|
3393
|
-
break;
|
|
3394
|
-
case "pre": {
|
|
3395
|
-
const base = Number(identifierBase) ? 1 : 0;
|
|
3396
|
-
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
3397
|
-
else {
|
|
3398
|
-
let i = this.prerelease.length;
|
|
3399
|
-
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
3400
|
-
this.prerelease[i]++;
|
|
3401
|
-
i = -2;
|
|
3402
|
-
}
|
|
3403
|
-
if (i === -1) {
|
|
3404
|
-
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
3405
|
-
this.prerelease.push(base);
|
|
3406
|
-
}
|
|
3407
|
-
}
|
|
3408
|
-
if (identifier) {
|
|
3409
|
-
let prerelease = [identifier, base];
|
|
3410
|
-
if (identifierBase === false) prerelease = [identifier];
|
|
3411
|
-
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
3412
|
-
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
3413
|
-
if (isNaN(prereleaseBase)) this.prerelease = prerelease;
|
|
3414
|
-
} else this.prerelease = prerelease;
|
|
3415
|
-
}
|
|
3416
|
-
break;
|
|
3417
|
-
}
|
|
3418
|
-
default: throw new Error(`invalid increment argument: ${release}`);
|
|
3419
|
-
}
|
|
3420
|
-
this.raw = this.format();
|
|
3421
|
-
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
3422
|
-
return this;
|
|
3423
|
-
}
|
|
3424
|
-
};
|
|
3425
|
-
}));
|
|
3426
|
-
//#endregion
|
|
3427
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare.js
|
|
3428
|
-
var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3429
|
-
const SemVer = require_semver$1();
|
|
3430
|
-
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
3431
|
-
module.exports = compare;
|
|
3432
|
-
}));
|
|
3433
|
-
//#endregion
|
|
3434
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/eq.js
|
|
3435
|
-
var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3436
|
-
const compare = require_compare();
|
|
3437
|
-
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
3438
|
-
module.exports = eq;
|
|
3439
|
-
}));
|
|
3440
|
-
//#endregion
|
|
3441
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/neq.js
|
|
3442
|
-
var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3443
|
-
const compare = require_compare();
|
|
3444
|
-
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
3445
|
-
module.exports = neq;
|
|
3446
|
-
}));
|
|
3447
|
-
//#endregion
|
|
3448
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/gt.js
|
|
3449
|
-
var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3450
|
-
const compare = require_compare();
|
|
3451
|
-
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
3452
|
-
module.exports = gt;
|
|
3453
|
-
}));
|
|
3454
|
-
//#endregion
|
|
3455
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/gte.js
|
|
3456
|
-
var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3457
|
-
const compare = require_compare();
|
|
3458
|
-
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
3459
|
-
module.exports = gte;
|
|
3460
|
-
}));
|
|
3461
|
-
//#endregion
|
|
3462
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/lt.js
|
|
3463
|
-
var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3464
|
-
const compare = require_compare();
|
|
3465
|
-
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
3466
|
-
module.exports = lt;
|
|
3467
|
-
}));
|
|
3468
|
-
//#endregion
|
|
3469
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/lte.js
|
|
3470
|
-
var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3471
|
-
const compare = require_compare();
|
|
3472
|
-
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
3473
|
-
module.exports = lte;
|
|
3474
|
-
}));
|
|
3475
|
-
//#endregion
|
|
3476
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/cmp.js
|
|
3477
|
-
var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3478
|
-
const eq = require_eq();
|
|
3479
|
-
const neq = require_neq();
|
|
3480
|
-
const gt = require_gt();
|
|
3481
|
-
const gte = require_gte();
|
|
3482
|
-
const lt = require_lt();
|
|
3483
|
-
const lte = require_lte();
|
|
3484
|
-
const cmp = (a, op, b, loose) => {
|
|
3485
|
-
switch (op) {
|
|
3486
|
-
case "===":
|
|
3487
|
-
if (typeof a === "object") a = a.version;
|
|
3488
|
-
if (typeof b === "object") b = b.version;
|
|
3489
|
-
return a === b;
|
|
3490
|
-
case "!==":
|
|
3491
|
-
if (typeof a === "object") a = a.version;
|
|
3492
|
-
if (typeof b === "object") b = b.version;
|
|
3493
|
-
return a !== b;
|
|
3494
|
-
case "":
|
|
3495
|
-
case "=":
|
|
3496
|
-
case "==": return eq(a, b, loose);
|
|
3497
|
-
case "!=": return neq(a, b, loose);
|
|
3498
|
-
case ">": return gt(a, b, loose);
|
|
3499
|
-
case ">=": return gte(a, b, loose);
|
|
3500
|
-
case "<": return lt(a, b, loose);
|
|
3501
|
-
case "<=": return lte(a, b, loose);
|
|
3502
|
-
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
3503
|
-
}
|
|
3504
|
-
};
|
|
3505
|
-
module.exports = cmp;
|
|
3506
|
-
}));
|
|
3507
|
-
//#endregion
|
|
3508
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/comparator.js
|
|
3509
|
-
var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3510
|
-
const ANY = Symbol("SemVer ANY");
|
|
3511
|
-
module.exports = class Comparator {
|
|
3512
|
-
static get ANY() {
|
|
3513
|
-
return ANY;
|
|
3514
|
-
}
|
|
3515
|
-
constructor(comp, options) {
|
|
3516
|
-
options = parseOptions(options);
|
|
3517
|
-
if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
|
|
3518
|
-
else comp = comp.value;
|
|
3519
|
-
comp = comp.trim().split(/\s+/).join(" ");
|
|
3520
|
-
debug("comparator", comp, options);
|
|
3521
|
-
this.options = options;
|
|
3522
|
-
this.loose = !!options.loose;
|
|
3523
|
-
this.parse(comp);
|
|
3524
|
-
if (this.semver === ANY) this.value = "";
|
|
3525
|
-
else this.value = this.operator + this.semver.version;
|
|
3526
|
-
debug("comp", this);
|
|
3527
|
-
}
|
|
3528
|
-
parse(comp) {
|
|
3529
|
-
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
3530
|
-
const m = comp.match(r);
|
|
3531
|
-
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
3532
|
-
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
3533
|
-
if (this.operator === "=") this.operator = "";
|
|
3534
|
-
if (!m[2]) this.semver = ANY;
|
|
3535
|
-
else this.semver = new SemVer(m[2], this.options.loose);
|
|
3536
|
-
}
|
|
3537
|
-
toString() {
|
|
3538
|
-
return this.value;
|
|
3539
|
-
}
|
|
3540
|
-
test(version) {
|
|
3541
|
-
debug("Comparator.test", version, this.options.loose);
|
|
3542
|
-
if (this.semver === ANY || version === ANY) return true;
|
|
3543
|
-
if (typeof version === "string") try {
|
|
3544
|
-
version = new SemVer(version, this.options);
|
|
3545
|
-
} catch (er) {
|
|
3546
|
-
return false;
|
|
3547
|
-
}
|
|
3548
|
-
return cmp(version, this.operator, this.semver, this.options);
|
|
3549
|
-
}
|
|
3550
|
-
intersects(comp, options) {
|
|
3551
|
-
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
3552
|
-
if (this.operator === "") {
|
|
3553
|
-
if (this.value === "") return true;
|
|
3554
|
-
return new Range(comp.value, options).test(this.value);
|
|
3555
|
-
} else if (comp.operator === "") {
|
|
3556
|
-
if (comp.value === "") return true;
|
|
3557
|
-
return new Range(this.value, options).test(comp.semver);
|
|
3558
|
-
}
|
|
3559
|
-
options = parseOptions(options);
|
|
3560
|
-
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
3561
|
-
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
3562
|
-
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
3563
|
-
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
3564
|
-
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
3565
|
-
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
3566
|
-
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
3567
|
-
return false;
|
|
3568
|
-
}
|
|
3569
|
-
};
|
|
3570
|
-
const parseOptions = require_parse_options();
|
|
3571
|
-
const { safeRe: re, t } = require_re();
|
|
3572
|
-
const cmp = require_cmp();
|
|
3573
|
-
const debug = require_debug();
|
|
3574
|
-
const SemVer = require_semver$1();
|
|
3575
|
-
const Range = require_range();
|
|
3576
|
-
}));
|
|
3577
|
-
//#endregion
|
|
3578
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/classes/range.js
|
|
3579
|
-
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3580
|
-
const SPACE_CHARACTERS = /\s+/g;
|
|
3581
|
-
module.exports = class Range {
|
|
3582
|
-
constructor(range, options) {
|
|
3583
|
-
options = parseOptions(options);
|
|
3584
|
-
if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
3585
|
-
else return new Range(range.raw, options);
|
|
3586
|
-
if (range instanceof Comparator) {
|
|
3587
|
-
this.raw = range.value;
|
|
3588
|
-
this.set = [[range]];
|
|
3589
|
-
this.formatted = void 0;
|
|
3590
|
-
return this;
|
|
3591
|
-
}
|
|
3592
|
-
this.options = options;
|
|
3593
|
-
this.loose = !!options.loose;
|
|
3594
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
3595
|
-
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
3596
|
-
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
3597
|
-
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
3598
|
-
if (this.set.length > 1) {
|
|
3599
|
-
const first = this.set[0];
|
|
3600
|
-
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
3601
|
-
if (this.set.length === 0) this.set = [first];
|
|
3602
|
-
else if (this.set.length > 1) {
|
|
3603
|
-
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
3604
|
-
this.set = [c];
|
|
3605
|
-
break;
|
|
3606
|
-
}
|
|
3607
|
-
}
|
|
3608
|
-
}
|
|
3609
|
-
this.formatted = void 0;
|
|
3610
|
-
}
|
|
3611
|
-
get range() {
|
|
3612
|
-
if (this.formatted === void 0) {
|
|
3613
|
-
this.formatted = "";
|
|
3614
|
-
for (let i = 0; i < this.set.length; i++) {
|
|
3615
|
-
if (i > 0) this.formatted += "||";
|
|
3616
|
-
const comps = this.set[i];
|
|
3617
|
-
for (let k = 0; k < comps.length; k++) {
|
|
3618
|
-
if (k > 0) this.formatted += " ";
|
|
3619
|
-
this.formatted += comps[k].toString().trim();
|
|
3620
|
-
}
|
|
3621
|
-
}
|
|
3622
|
-
}
|
|
3623
|
-
return this.formatted;
|
|
3624
|
-
}
|
|
3625
|
-
format() {
|
|
3626
|
-
return this.range;
|
|
3627
|
-
}
|
|
3628
|
-
toString() {
|
|
3629
|
-
return this.range;
|
|
3630
|
-
}
|
|
3631
|
-
parseRange(range) {
|
|
3632
|
-
range = range.replace(BUILDSTRIPRE, "");
|
|
3633
|
-
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
3634
|
-
const cached = cache.get(memoKey);
|
|
3635
|
-
if (cached) return cached;
|
|
3636
|
-
const loose = this.options.loose;
|
|
3637
|
-
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
3638
|
-
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
3639
|
-
debug("hyphen replace", range);
|
|
3640
|
-
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
3641
|
-
debug("comparator trim", range);
|
|
3642
|
-
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
3643
|
-
debug("tilde trim", range);
|
|
3644
|
-
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
3645
|
-
debug("caret trim", range);
|
|
3646
|
-
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
3647
|
-
if (loose) rangeList = rangeList.filter((comp) => {
|
|
3648
|
-
debug("loose invalid filter", comp, this.options);
|
|
3649
|
-
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
3650
|
-
});
|
|
3651
|
-
debug("range list", rangeList);
|
|
3652
|
-
const rangeMap = /* @__PURE__ */ new Map();
|
|
3653
|
-
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
3654
|
-
for (const comp of comparators) {
|
|
3655
|
-
if (isNullSet(comp)) return [comp];
|
|
3656
|
-
rangeMap.set(comp.value, comp);
|
|
3657
|
-
}
|
|
3658
|
-
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
3659
|
-
const result = [...rangeMap.values()];
|
|
3660
|
-
cache.set(memoKey, result);
|
|
3661
|
-
return result;
|
|
3662
|
-
}
|
|
3663
|
-
intersects(range, options) {
|
|
3664
|
-
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
3665
|
-
return this.set.some((thisComparators) => {
|
|
3666
|
-
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
3667
|
-
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
3668
|
-
return rangeComparators.every((rangeComparator) => {
|
|
3669
|
-
return thisComparator.intersects(rangeComparator, options);
|
|
3670
|
-
});
|
|
3671
|
-
});
|
|
3672
|
-
});
|
|
3673
|
-
});
|
|
3674
|
-
}
|
|
3675
|
-
test(version) {
|
|
3676
|
-
if (!version) return false;
|
|
3677
|
-
if (typeof version === "string") try {
|
|
3678
|
-
version = new SemVer(version, this.options);
|
|
3679
|
-
} catch (er) {
|
|
3680
|
-
return false;
|
|
3681
|
-
}
|
|
3682
|
-
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
3683
|
-
return false;
|
|
3684
|
-
}
|
|
3685
|
-
};
|
|
3686
|
-
const cache = new (require_lrucache())();
|
|
3687
|
-
const parseOptions = require_parse_options();
|
|
3688
|
-
const Comparator = require_comparator();
|
|
3689
|
-
const debug = require_debug();
|
|
3690
|
-
const SemVer = require_semver$1();
|
|
3691
|
-
const { safeRe: re, src, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
3692
|
-
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants$1();
|
|
3693
|
-
const BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
3694
|
-
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
3695
|
-
const isAny = (c) => c.value === "";
|
|
3696
|
-
const isSatisfiable = (comparators, options) => {
|
|
3697
|
-
let result = true;
|
|
3698
|
-
const remainingComparators = comparators.slice();
|
|
3699
|
-
let testComparator = remainingComparators.pop();
|
|
3700
|
-
while (result && remainingComparators.length) {
|
|
3701
|
-
result = remainingComparators.every((otherComparator) => {
|
|
3702
|
-
return testComparator.intersects(otherComparator, options);
|
|
3703
|
-
});
|
|
3704
|
-
testComparator = remainingComparators.pop();
|
|
3705
|
-
}
|
|
3706
|
-
return result;
|
|
3707
|
-
};
|
|
3708
|
-
const parseComparator = (comp, options) => {
|
|
3709
|
-
comp = comp.replace(re[t.BUILD], "");
|
|
3710
|
-
debug("comp", comp, options);
|
|
3711
|
-
comp = replaceCarets(comp, options);
|
|
3712
|
-
debug("caret", comp);
|
|
3713
|
-
comp = replaceTildes(comp, options);
|
|
3714
|
-
debug("tildes", comp);
|
|
3715
|
-
comp = replaceXRanges(comp, options);
|
|
3716
|
-
debug("xrange", comp);
|
|
3717
|
-
comp = replaceStars(comp, options);
|
|
3718
|
-
debug("stars", comp);
|
|
3719
|
-
return comp;
|
|
3720
|
-
};
|
|
3721
|
-
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
3722
|
-
const invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
3723
|
-
const replaceTildes = (comp, options) => {
|
|
3724
|
-
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
3725
|
-
};
|
|
3726
|
-
const replaceTilde = (comp, options) => {
|
|
3727
|
-
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
3728
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
3729
|
-
debug("tilde", comp, _, M, m, p, pr);
|
|
3730
|
-
let ret;
|
|
3731
|
-
if (isX(M)) ret = "";
|
|
3732
|
-
else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
3733
|
-
else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
3734
|
-
else if (pr) {
|
|
3735
|
-
debug("replaceTilde pr", pr);
|
|
3736
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
3737
|
-
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
3738
|
-
debug("tilde return", ret);
|
|
3739
|
-
return ret;
|
|
3740
|
-
});
|
|
3741
|
-
};
|
|
3742
|
-
const replaceCarets = (comp, options) => {
|
|
3743
|
-
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
3744
|
-
};
|
|
3745
|
-
const replaceCaret = (comp, options) => {
|
|
3746
|
-
debug("caret", comp, options);
|
|
3747
|
-
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
3748
|
-
const z = options.includePrerelease ? "-0" : "";
|
|
3749
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
3750
|
-
debug("caret", comp, _, M, m, p, pr);
|
|
3751
|
-
let ret;
|
|
3752
|
-
if (isX(M)) ret = "";
|
|
3753
|
-
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
3754
|
-
else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
3755
|
-
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
3756
|
-
else if (pr) {
|
|
3757
|
-
debug("replaceCaret pr", pr);
|
|
3758
|
-
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
3759
|
-
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
3760
|
-
else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
3761
|
-
} else {
|
|
3762
|
-
debug("no pr");
|
|
3763
|
-
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
3764
|
-
else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
3765
|
-
else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
3766
|
-
}
|
|
3767
|
-
debug("caret return", ret);
|
|
3768
|
-
return ret;
|
|
3769
|
-
});
|
|
3100
|
+
for (const [token, maximum] of replacements) source = source.split(`${token}*`).join(`${token}{0,${maximum}}`).split(`${token}+`).join(`${token}{1,${maximum}}`);
|
|
3101
|
+
return source;
|
|
3102
|
+
}
|
|
3103
|
+
function safeRegex(source, flags) {
|
|
3104
|
+
return new RegExp(makeSafeRegexSource(source), flags);
|
|
3105
|
+
}
|
|
3106
|
+
const NUMERIC$1 = /^\d+$/;
|
|
3107
|
+
function compareIdentifiers(left, right) {
|
|
3108
|
+
if (typeof left === "number" && typeof right === "number") return left === right ? 0 : left < right ? -1 : 1;
|
|
3109
|
+
const leftNumeric = NUMERIC$1.test(String(left));
|
|
3110
|
+
const rightNumeric = NUMERIC$1.test(String(right));
|
|
3111
|
+
const normalizedLeft = leftNumeric ? Number(left) : left;
|
|
3112
|
+
const normalizedRight = rightNumeric ? Number(right) : right;
|
|
3113
|
+
return normalizedLeft === normalizedRight ? 0 : leftNumeric && !rightNumeric ? -1 : rightNumeric && !leftNumeric ? 1 : normalizedLeft < normalizedRight ? -1 : 1;
|
|
3114
|
+
}
|
|
3115
|
+
const FULL = safeRegex(`^${FULL_PLAIN}$`);
|
|
3116
|
+
const LOOSE = safeRegex(`^${LOOSE_PLAIN}$`);
|
|
3117
|
+
safeRegex(`^${PRERELEASE}$`);
|
|
3118
|
+
safeRegex(`^${PRERELEASE_LOOSE}$`);
|
|
3119
|
+
const COERCE_EXACT = safeRegex(COERCE);
|
|
3120
|
+
const COERCE_FULL_EXACT = safeRegex(COERCE_FULL);
|
|
3121
|
+
const NUMERIC = /^\d+$/;
|
|
3122
|
+
function formatComparableVersion(version) {
|
|
3123
|
+
const base = `${version.major}.${version.minor}.${version.patch}`;
|
|
3124
|
+
return version.prerelease?.length ? `${base}-${version.prerelease.join(".")}` : base;
|
|
3125
|
+
}
|
|
3126
|
+
function formatFullVersion(version) {
|
|
3127
|
+
const comparable = formatComparableVersion(version);
|
|
3128
|
+
return version.build?.length ? `${comparable}+${version.build.join(".")}` : comparable;
|
|
3129
|
+
}
|
|
3130
|
+
function parse(version, options = {}) {
|
|
3131
|
+
if (typeof version !== "string") return version;
|
|
3132
|
+
if (version.length > 256) throw new TypeError(`Version exceeds the maximum length of 256 characters`);
|
|
3133
|
+
const match = version.trim().match(options.loose ? LOOSE : FULL);
|
|
3134
|
+
if (!match) throw new TypeError(`Invalid version syntax: ${version}`);
|
|
3135
|
+
const major = Number(match[1]);
|
|
3136
|
+
const minor = Number(match[2]);
|
|
3137
|
+
const patch = Number(match[3]);
|
|
3138
|
+
if (major > Number.MAX_SAFE_INTEGER || major < 0) throw new TypeError(`Invalid major version: ${match[1]}`);
|
|
3139
|
+
if (minor > Number.MAX_SAFE_INTEGER || minor < 0) throw new TypeError(`Invalid minor version: ${match[2]}`);
|
|
3140
|
+
if (patch > Number.MAX_SAFE_INTEGER || patch < 0) throw new TypeError(`Invalid patch version: ${match[3]}`);
|
|
3141
|
+
const prerelease = match[4] ? match[4].split(".").map((identifier) => {
|
|
3142
|
+
if (NUMERIC.test(identifier)) {
|
|
3143
|
+
const numeric = Number(identifier);
|
|
3144
|
+
if (numeric >= 0 && numeric < Number.MAX_SAFE_INTEGER) return numeric;
|
|
3145
|
+
}
|
|
3146
|
+
return identifier;
|
|
3147
|
+
}) : void 0;
|
|
3148
|
+
return {
|
|
3149
|
+
build: match[5]?.split("."),
|
|
3150
|
+
major,
|
|
3151
|
+
minor,
|
|
3152
|
+
patch,
|
|
3153
|
+
prerelease
|
|
3770
3154
|
};
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3155
|
+
}
|
|
3156
|
+
function tryParse(version, options = {}) {
|
|
3157
|
+
try {
|
|
3158
|
+
return parse(version, options);
|
|
3159
|
+
} catch {
|
|
3160
|
+
return null;
|
|
3161
|
+
}
|
|
3162
|
+
}
|
|
3163
|
+
function compareMainParsed(left, right) {
|
|
3164
|
+
return left.major === right.major ? left.minor === right.minor ? left.patch === right.patch ? 0 : left.patch < right.patch ? -1 : 1 : left.minor < right.minor ? -1 : 1 : left.major < right.major ? -1 : 1;
|
|
3165
|
+
}
|
|
3166
|
+
function comparePrereleaseParsed(left, right) {
|
|
3167
|
+
const leftPrerelease = left.prerelease;
|
|
3168
|
+
const rightPrerelease = right.prerelease;
|
|
3169
|
+
if (leftPrerelease?.length && !rightPrerelease?.length) return -1;
|
|
3170
|
+
if (!leftPrerelease?.length && rightPrerelease?.length) return 1;
|
|
3171
|
+
if (!leftPrerelease?.length && !rightPrerelease?.length) return 0;
|
|
3172
|
+
for (let index = 0;; index++) {
|
|
3173
|
+
const leftIdentifier = leftPrerelease?.[index];
|
|
3174
|
+
const rightIdentifier = rightPrerelease?.[index];
|
|
3175
|
+
if (leftIdentifier === void 0 && rightIdentifier === void 0) return 0;
|
|
3176
|
+
if (rightIdentifier === void 0) return 1;
|
|
3177
|
+
if (leftIdentifier === void 0) return -1;
|
|
3178
|
+
if (leftIdentifier !== rightIdentifier) return compareIdentifiers(leftIdentifier, rightIdentifier);
|
|
3179
|
+
}
|
|
3180
|
+
}
|
|
3181
|
+
function compareParsed(left, right) {
|
|
3182
|
+
return compareMainParsed(left, right) || comparePrereleaseParsed(left, right);
|
|
3183
|
+
}
|
|
3184
|
+
function coerceParsedVersion(value, options = {}) {
|
|
3185
|
+
if (typeof value === "object") return value;
|
|
3186
|
+
const input = typeof value === "number" ? String(value) : value;
|
|
3187
|
+
if (typeof input !== "string") return null;
|
|
3188
|
+
let match = null;
|
|
3189
|
+
if (options.rtl) {
|
|
3190
|
+
const expression = safeRegex(options.includePrerelease ? COERCE_FULL : COERCE, "g");
|
|
3191
|
+
let next;
|
|
3192
|
+
while ((next = expression.exec(input)) && (!match || match.index + match[0].length !== input.length)) {
|
|
3193
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
3194
|
+
expression.lastIndex = next.index + next[1].length + next[2].length;
|
|
3195
|
+
}
|
|
3196
|
+
} else match = (options.includePrerelease ? COERCE_FULL_EXACT : COERCE_EXACT).exec(input);
|
|
3197
|
+
if (!match) return null;
|
|
3198
|
+
const major = match[2];
|
|
3199
|
+
return tryParse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
|
|
3200
|
+
}
|
|
3201
|
+
const STRICT_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*(${FULL_PLAIN})$|^$`);
|
|
3202
|
+
const LOOSE_COMPARATOR$1 = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*(${LOOSE_PLAIN})$|^$`);
|
|
3203
|
+
function parseComparator(comparator, options = {}) {
|
|
3204
|
+
const normalized = comparator.trim().replaceAll(/\s+/g, " ");
|
|
3205
|
+
const match = normalized.match(options.loose ? LOOSE_COMPARATOR$1 : STRICT_COMPARATOR);
|
|
3206
|
+
if (!match) throw new TypeError(`Invalid comparator: ${normalized}`);
|
|
3207
|
+
const operator = match[1] === "=" ? "" : match[1] || "";
|
|
3208
|
+
const version = match[2] ? parse(match[2], options) : null;
|
|
3209
|
+
return {
|
|
3210
|
+
operator,
|
|
3211
|
+
options,
|
|
3212
|
+
value: version ? `${operator}${formatComparableVersion(version)}` : "",
|
|
3213
|
+
version
|
|
3814
3214
|
};
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3215
|
+
}
|
|
3216
|
+
function testParsedComparator(comparator, version) {
|
|
3217
|
+
if (!comparator.version) return true;
|
|
3218
|
+
const comparison = compareParsed(version, comparator.version);
|
|
3219
|
+
switch (comparator.operator) {
|
|
3220
|
+
case "": return comparison === 0;
|
|
3221
|
+
case ">": return comparison > 0;
|
|
3222
|
+
case ">=": return comparison >= 0;
|
|
3223
|
+
case "<": return comparison < 0;
|
|
3224
|
+
case "<=": return comparison <= 0;
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
function comparatorAllowsPrerelease(comparator, version) {
|
|
3228
|
+
const allowed = comparator.version;
|
|
3229
|
+
return allowed !== null && !!allowed.prerelease?.length && allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch;
|
|
3230
|
+
}
|
|
3231
|
+
function testComparatorSet(set, version, options) {
|
|
3232
|
+
if (set.some((comparator) => !testParsedComparator(comparator, version))) return false;
|
|
3233
|
+
return !version.prerelease?.length || !!options.includePrerelease || set.some((comparator) => comparatorAllowsPrerelease(comparator, version));
|
|
3234
|
+
}
|
|
3235
|
+
function parsedComparatorsIntersect(left, right, options = {}) {
|
|
3236
|
+
if (!left.version || !right.version) return true;
|
|
3237
|
+
if (left.operator === "") return testComparatorSet([right], left.version, options);
|
|
3238
|
+
if (right.operator === "") return testComparatorSet([left], right.version, options);
|
|
3239
|
+
if (options.includePrerelease && (left.value === "<0.0.0-0" || right.value === "<0.0.0-0")) return false;
|
|
3240
|
+
if (!options.includePrerelease && (left.value.startsWith("<0.0.0") || right.value.startsWith("<0.0.0"))) return false;
|
|
3241
|
+
if (left.operator.startsWith(">") && right.operator.startsWith(">")) return true;
|
|
3242
|
+
if (left.operator.startsWith("<") && right.operator.startsWith("<")) return true;
|
|
3243
|
+
const comparison = compareParsed(left.version, right.version);
|
|
3244
|
+
if (comparison === 0 && left.operator.includes("=") && right.operator.includes("=")) return true;
|
|
3245
|
+
if (comparison < 0 && left.operator.startsWith(">") && right.operator.startsWith("<")) return true;
|
|
3246
|
+
return comparison > 0 && left.operator.startsWith("<") && right.operator.startsWith(">");
|
|
3247
|
+
}
|
|
3248
|
+
function compare(left, right, options = {}) {
|
|
3249
|
+
return compareParsed(parse(left, options), parse(right, options));
|
|
3250
|
+
}
|
|
3251
|
+
function isLess(left, right, options = {}) {
|
|
3252
|
+
return compare(left, right, options) < 0;
|
|
3253
|
+
}
|
|
3254
|
+
function isLessOrEqual(left, right, options = {}) {
|
|
3255
|
+
return compare(left, right, options) <= 0;
|
|
3256
|
+
}
|
|
3257
|
+
const BUILD_STRIP = new RegExp(BUILD, "g");
|
|
3258
|
+
const BUILD_SAFE = safeRegex(BUILD);
|
|
3259
|
+
const STRICT_HYPHEN = safeRegex(String.raw`^\s*(${XRANGE_PLAIN})\s+-\s+(${XRANGE_PLAIN})\s*$`);
|
|
3260
|
+
const LOOSE_HYPHEN = safeRegex(String.raw`^\s*(${XRANGE_PLAIN_LOOSE})\s+-\s+(${XRANGE_PLAIN_LOOSE})\s*$`);
|
|
3261
|
+
const COMPARATOR_TRIM = safeRegex(String.raw`(\s*)${GREATER_LESS_THAN}\s*(${LOOSE_PLAIN}|${XRANGE_PLAIN})`, "g");
|
|
3262
|
+
const TILDE_TRIM = safeRegex(String.raw`(\s*)${LONE_TILDE}\s+`, "g");
|
|
3263
|
+
const CARET_TRIM = safeRegex(String.raw`(\s*)${LONE_CARET}\s+`, "g");
|
|
3264
|
+
const STRICT_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN}$`);
|
|
3265
|
+
const LOOSE_TILDE = safeRegex(`^${LONE_TILDE}${XRANGE_PLAIN_LOOSE}$`);
|
|
3266
|
+
const STRICT_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN}$`);
|
|
3267
|
+
const LOOSE_CARET = safeRegex(`^${LONE_CARET}${XRANGE_PLAIN_LOOSE}$`);
|
|
3268
|
+
const STRICT_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*${XRANGE_PLAIN}$`);
|
|
3269
|
+
const LOOSE_XRANGE = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*${XRANGE_PLAIN_LOOSE}$`);
|
|
3270
|
+
const STAR = safeRegex(String.raw`(<|>)?=?\s*\*`);
|
|
3271
|
+
const GTE_ZERO = /^\s*>=\s*0\.0\.0\s*$/;
|
|
3272
|
+
const GTE_ZERO_PRERELEASE = /^\s*>=\s*0\.0\.0-0\s*$/;
|
|
3273
|
+
const LOOSE_COMPARATOR = safeRegex(String.raw`^${GREATER_LESS_THAN}\s*(${LOOSE_PLAIN})$|^$`);
|
|
3274
|
+
function isWildcard(value) {
|
|
3275
|
+
return !value || String(value).toLowerCase() === "x" || String(value) === "*";
|
|
3276
|
+
}
|
|
3277
|
+
function hasInvalidWildcardOrder(major, minor, patch) {
|
|
3278
|
+
return isWildcard(major) && !isWildcard(minor) || isWildcard(minor) && Boolean(patch) && !isWildcard(patch);
|
|
3279
|
+
}
|
|
3280
|
+
function replaceTilde(comparator, options) {
|
|
3281
|
+
const expression = options.loose ? LOOSE_TILDE : STRICT_TILDE;
|
|
3282
|
+
const lowerPrerelease = options.includePrerelease ? "-0" : "";
|
|
3283
|
+
return comparator.replace(expression, (_match, major, minor, patch, prerelease) => {
|
|
3284
|
+
if (isWildcard(major)) return "";
|
|
3285
|
+
if (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;
|
|
3286
|
+
if (isWildcard(patch)) return `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0`;
|
|
3287
|
+
return prerelease ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0`;
|
|
3288
|
+
});
|
|
3289
|
+
}
|
|
3290
|
+
function replaceTildes(comparator, options) {
|
|
3291
|
+
return comparator.trim().split(/\s+/).map((part) => replaceTilde(part, options)).join(" ");
|
|
3292
|
+
}
|
|
3293
|
+
function replaceCaret(comparator, options) {
|
|
3294
|
+
const expression = options.loose ? LOOSE_CARET : STRICT_CARET;
|
|
3295
|
+
const lowerPrerelease = options.includePrerelease ? "-0" : "";
|
|
3296
|
+
return comparator.replace(expression, (_match, major, minor, patch, prerelease) => {
|
|
3297
|
+
if (isWildcard(major)) return "";
|
|
3298
|
+
if (isWildcard(minor)) return `>=${major}.0.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;
|
|
3299
|
+
if (isWildcard(patch)) return major === "0" ? `>=${major}.${minor}.0${lowerPrerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.0${lowerPrerelease} <${Number(major) + 1}.0.0-0`;
|
|
3300
|
+
if (prerelease) return major === "0" ? minor === "0" ? `>=${major}.${minor}.${patch}-${prerelease} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch}-${prerelease} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch}-${prerelease} <${Number(major) + 1}.0.0-0`;
|
|
3301
|
+
return major === "0" ? minor === "0" ? `>=${major}.${minor}.${patch} <${major}.${minor}.${Number(patch) + 1}-0` : `>=${major}.${minor}.${patch} <${major}.${Number(minor) + 1}.0-0` : `>=${major}.${minor}.${patch} <${Number(major) + 1}.0.0-0`;
|
|
3302
|
+
});
|
|
3303
|
+
}
|
|
3304
|
+
function replaceCarets(comparator, options) {
|
|
3305
|
+
return comparator.trim().split(/\s+/).map((part) => replaceCaret(part, options)).join(" ");
|
|
3306
|
+
}
|
|
3307
|
+
function replaceXRange(comparator, options) {
|
|
3308
|
+
const expression = options.loose ? LOOSE_XRANGE : STRICT_XRANGE;
|
|
3309
|
+
return comparator.trim().replace(expression, (match, rawOperator, rawMajor, rawMinor, rawPatch) => {
|
|
3310
|
+
let operator = rawOperator;
|
|
3311
|
+
let major = rawMajor;
|
|
3312
|
+
let minor = rawMinor;
|
|
3313
|
+
let patch = rawPatch;
|
|
3314
|
+
if (hasInvalidWildcardOrder(String(major), minor === void 0 ? void 0 : String(minor), patch === void 0 ? void 0 : String(patch))) return comparator;
|
|
3315
|
+
const wildcardMajor = isWildcard(major);
|
|
3316
|
+
const wildcardMinor = wildcardMajor || isWildcard(minor);
|
|
3317
|
+
const wildcardPatch = wildcardMinor || isWildcard(patch);
|
|
3318
|
+
if (operator === "=" && wildcardPatch) operator = "";
|
|
3319
|
+
if (wildcardMajor) return operator === ">" || operator === "<" ? "<0.0.0-0" : "*";
|
|
3320
|
+
let prerelease = options.includePrerelease ? "-0" : "";
|
|
3321
|
+
if (operator && wildcardPatch) {
|
|
3322
|
+
if (wildcardMinor) minor = 0;
|
|
3323
|
+
patch = 0;
|
|
3324
|
+
if (operator === ">") {
|
|
3325
|
+
operator = ">=";
|
|
3326
|
+
if (wildcardMinor) {
|
|
3327
|
+
major = Number(major) + 1;
|
|
3328
|
+
minor = 0;
|
|
3329
|
+
} else minor = Number(minor) + 1;
|
|
3330
|
+
} else if (operator === "<=") {
|
|
3331
|
+
operator = "<";
|
|
3332
|
+
if (wildcardMinor) major = Number(major) + 1;
|
|
3333
|
+
else minor = Number(minor) + 1;
|
|
3334
|
+
}
|
|
3335
|
+
if (operator === "<") prerelease = "-0";
|
|
3336
|
+
return `${operator}${major}.${minor}.${patch}${prerelease}`;
|
|
3337
|
+
}
|
|
3338
|
+
if (wildcardMinor) return `>=${major}.0.0${prerelease} <${Number(major) + 1}.0.0-0`;
|
|
3339
|
+
if (wildcardPatch) return `>=${major}.${minor}.0${prerelease} <${major}.${Number(minor) + 1}.0-0`;
|
|
3340
|
+
return match;
|
|
3341
|
+
});
|
|
3342
|
+
}
|
|
3343
|
+
function replaceXRanges(comparator, options) {
|
|
3344
|
+
return comparator.split(/\s+/).map((part) => replaceXRange(part, options)).join(" ");
|
|
3345
|
+
}
|
|
3346
|
+
function replaceHyphenRange(range, options) {
|
|
3347
|
+
const expression = options.loose ? LOOSE_HYPHEN : STRICT_HYPHEN;
|
|
3348
|
+
return range.replace(expression, (_match, rawFrom, fromMajor, fromMinor, fromPatch, fromPrerelease, _fromBuild, rawTo, toMajor, toMinor, toPatch, toPrerelease) => {
|
|
3349
|
+
let from = rawFrom;
|
|
3350
|
+
let to = rawTo;
|
|
3351
|
+
if (isWildcard(fromMajor)) from = "";
|
|
3352
|
+
else if (isWildcard(fromMinor)) from = `>=${fromMajor}.0.0${options.includePrerelease ? "-0" : ""}`;
|
|
3353
|
+
else if (isWildcard(fromPatch)) from = `>=${fromMajor}.${fromMinor}.0${options.includePrerelease ? "-0" : ""}`;
|
|
3354
|
+
else if (fromPrerelease) from = `>=${from}`;
|
|
3355
|
+
else from = `>=${from}${options.includePrerelease ? "-0" : ""}`;
|
|
3356
|
+
if (isWildcard(toMajor)) to = "";
|
|
3357
|
+
else if (isWildcard(toMinor)) to = `<${Number(toMajor) + 1}.0.0-0`;
|
|
3358
|
+
else if (isWildcard(toPatch)) to = `<${toMajor}.${Number(toMinor) + 1}.0-0`;
|
|
3359
|
+
else if (toPrerelease) to = `<=${toMajor}.${toMinor}.${toPatch}-${toPrerelease}`;
|
|
3360
|
+
else if (options.includePrerelease) to = `<${toMajor}.${toMinor}.${Number(toPatch) + 1}-0`;
|
|
3834
3361
|
else to = `<=${to}`;
|
|
3835
3362
|
return `${from} ${to}`.trim();
|
|
3836
|
-
};
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
})
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3363
|
+
});
|
|
3364
|
+
}
|
|
3365
|
+
function expandComparator(comparator, options) {
|
|
3366
|
+
return replaceXRanges(replaceTildes(replaceCarets(comparator.replace(BUILD_SAFE, ""), options), options), options).trim().replace(STAR, "");
|
|
3367
|
+
}
|
|
3368
|
+
function parseSimpleRange(input, options) {
|
|
3369
|
+
let parts = replaceHyphenRange(input.replace(BUILD_STRIP, ""), options).replace(COMPARATOR_TRIM, "$1$2$3").replace(TILDE_TRIM, "$1~").replace(CARET_TRIM, "$1^").split(" ").map((part) => expandComparator(part, options)).join(" ").split(/\s+/).map((part) => part.trim().replace(options.includePrerelease ? GTE_ZERO_PRERELEASE : GTE_ZERO, ""));
|
|
3370
|
+
if (options.loose) parts = parts.filter((part) => LOOSE_COMPARATOR.test(part));
|
|
3371
|
+
const unique = /* @__PURE__ */ new Map();
|
|
3372
|
+
for (const comparator of parts.map((part) => parseComparator(part, options))) {
|
|
3373
|
+
if (comparator.value === "<0.0.0-0") return [comparator];
|
|
3374
|
+
unique.set(comparator.value, comparator);
|
|
3375
|
+
}
|
|
3376
|
+
if (unique.size > 1) unique.delete("");
|
|
3377
|
+
return [...unique.values()];
|
|
3378
|
+
}
|
|
3379
|
+
function parseRange(range, options = {}) {
|
|
3380
|
+
if (typeof range !== "string") return range;
|
|
3381
|
+
const parsedOptions = { ...options };
|
|
3382
|
+
const raw = range.trim().replaceAll(/\s+/g, " ");
|
|
3383
|
+
let sets = raw.split("||").map((part) => parseSimpleRange(part.trim(), parsedOptions)).filter((set) => set.length);
|
|
3384
|
+
if (!sets.length) throw new TypeError(`Range contains no valid comparator sets: ${raw}`);
|
|
3385
|
+
if (sets.length > 1) {
|
|
3386
|
+
const first = sets[0];
|
|
3387
|
+
sets = sets.filter((set) => set[0]?.value !== "<0.0.0-0");
|
|
3388
|
+
if (!sets.length) sets = [first];
|
|
3389
|
+
else if (sets.length > 1) {
|
|
3390
|
+
const any = sets.find((set) => set.length === 1 && set[0]?.value === "");
|
|
3391
|
+
if (any) sets = [any];
|
|
3862
3392
|
}
|
|
3393
|
+
}
|
|
3394
|
+
return {
|
|
3395
|
+
normalized: sets.map((set) => set.map((comparator) => comparator.value).join(" ")).join("||"),
|
|
3396
|
+
options: parsedOptions,
|
|
3397
|
+
raw,
|
|
3398
|
+
sets
|
|
3863
3399
|
};
|
|
3864
|
-
|
|
3865
|
-
})
|
|
3400
|
+
}
|
|
3401
|
+
function tryParseRange(range, options = {}) {
|
|
3402
|
+
try {
|
|
3403
|
+
return parseRange(range, options);
|
|
3404
|
+
} catch {
|
|
3405
|
+
return null;
|
|
3406
|
+
}
|
|
3407
|
+
}
|
|
3408
|
+
function testParsedRange(range, version) {
|
|
3409
|
+
return range.sets.some((set) => testComparatorSet(set, version, range.options));
|
|
3410
|
+
}
|
|
3411
|
+
function testRangeVersion(range, version) {
|
|
3412
|
+
const parsed = tryParse(version, range.options);
|
|
3413
|
+
return parsed ? testParsedRange(range, parsed) : false;
|
|
3414
|
+
}
|
|
3415
|
+
function exactVersion(set) {
|
|
3416
|
+
for (const comparator of set) if (comparator.operator === "" && comparator.version) return comparator.version;
|
|
3417
|
+
return null;
|
|
3418
|
+
}
|
|
3419
|
+
function isSatisfiable(comparators, options) {
|
|
3420
|
+
const exact = exactVersion(comparators);
|
|
3421
|
+
if (exact) return testComparatorSet(comparators, exact, options);
|
|
3422
|
+
const remaining = [...comparators];
|
|
3423
|
+
let current = remaining.pop();
|
|
3424
|
+
while (current && remaining.length) {
|
|
3425
|
+
if (remaining.some((other) => !parsedComparatorsIntersect(current, other, options))) return false;
|
|
3426
|
+
current = remaining.pop();
|
|
3427
|
+
}
|
|
3428
|
+
return true;
|
|
3429
|
+
}
|
|
3430
|
+
function setsIntersect(left, right, options) {
|
|
3431
|
+
const leftExact = exactVersion(left);
|
|
3432
|
+
if (leftExact) return testComparatorSet(right, leftExact, options);
|
|
3433
|
+
const rightExact = exactVersion(right);
|
|
3434
|
+
if (rightExact) return testComparatorSet(left, rightExact, options);
|
|
3435
|
+
return left.every((leftComparator) => right.every((rightComparator) => parsedComparatorsIntersect(leftComparator, rightComparator, options)));
|
|
3436
|
+
}
|
|
3437
|
+
function parsedRangesIntersect(left, right, options = {}) {
|
|
3438
|
+
return left.sets.some((leftSet) => isSatisfiable(leftSet, options) && right.sets.some((rightSet) => isSatisfiable(rightSet, options) && setsIntersect(leftSet, rightSet, options)));
|
|
3439
|
+
}
|
|
3440
|
+
function normalizeRange(range, options = {}) {
|
|
3441
|
+
const parsed = tryParseRange(range, options);
|
|
3442
|
+
return parsed ? parsed.normalized || "*" : null;
|
|
3443
|
+
}
|
|
3444
|
+
function satisfies(version, range, options = {}) {
|
|
3445
|
+
const parsed = tryParseRange(range, options);
|
|
3446
|
+
return parsed ? testRangeVersion(parsed, version) : false;
|
|
3447
|
+
}
|
|
3448
|
+
function nextVersionAfter(version) {
|
|
3449
|
+
const { prerelease } = version;
|
|
3450
|
+
return parse(formatComparableVersion(prerelease?.length ? {
|
|
3451
|
+
major: version.major,
|
|
3452
|
+
minor: version.minor,
|
|
3453
|
+
patch: version.patch,
|
|
3454
|
+
prerelease: [...prerelease, 0]
|
|
3455
|
+
} : {
|
|
3456
|
+
major: version.major,
|
|
3457
|
+
minor: version.minor,
|
|
3458
|
+
patch: version.patch + 1
|
|
3459
|
+
}));
|
|
3460
|
+
}
|
|
3461
|
+
function findMinimumForRange(range, options = {}) {
|
|
3462
|
+
const parsedRange = parseRange(range, options);
|
|
3463
|
+
const zero = parse("0.0.0");
|
|
3464
|
+
if (testParsedRange(parsedRange, zero)) return formatComparableVersion(zero);
|
|
3465
|
+
const zeroPrerelease = parse("0.0.0-0");
|
|
3466
|
+
if (testParsedRange(parsedRange, zeroPrerelease)) return formatComparableVersion(zeroPrerelease);
|
|
3467
|
+
let minimum = null;
|
|
3468
|
+
for (const set of parsedRange.sets) {
|
|
3469
|
+
let setMinimum = null;
|
|
3470
|
+
for (const comparator of set) {
|
|
3471
|
+
if (!comparator.version) continue;
|
|
3472
|
+
const candidate = comparator.operator === ">" ? nextVersionAfter(comparator.version) : comparator.operator === "" || comparator.operator === ">=" ? comparator.version : null;
|
|
3473
|
+
if (candidate && (!setMinimum || compareParsed(candidate, setMinimum) > 0)) setMinimum = candidate;
|
|
3474
|
+
}
|
|
3475
|
+
if (setMinimum && (!minimum || compareParsed(minimum, setMinimum) > 0)) minimum = setMinimum;
|
|
3476
|
+
}
|
|
3477
|
+
return minimum && testParsedRange(parsedRange, minimum) ? formatComparableVersion(minimum) : null;
|
|
3478
|
+
}
|
|
3479
|
+
function rangesIntersect(left, right, options = {}) {
|
|
3480
|
+
const parsedLeft = parseRange(left, options);
|
|
3481
|
+
const parsedRight = parseRange(right, options);
|
|
3482
|
+
return parsedRangesIntersect(parsedLeft, parsedRight, {
|
|
3483
|
+
...parsedLeft.options,
|
|
3484
|
+
...parsedRight.options,
|
|
3485
|
+
...options
|
|
3486
|
+
});
|
|
3487
|
+
}
|
|
3488
|
+
function normalize(version, options = {}) {
|
|
3489
|
+
const parsed = tryParse(version, options);
|
|
3490
|
+
return parsed ? formatComparableVersion(parsed) : null;
|
|
3491
|
+
}
|
|
3492
|
+
function coerce(value, options = {}) {
|
|
3493
|
+
const parsed = coerceParsedVersion(value, options);
|
|
3494
|
+
return parsed ? formatFullVersion(parsed) : null;
|
|
3495
|
+
}
|
|
3866
3496
|
//#endregion
|
|
3867
3497
|
//#region src/commandOptions/index.ts
|
|
3868
|
-
var import_valid = /* @__PURE__ */ __toESM(require_valid$1(), 1);
|
|
3869
3498
|
const PLATFORMS = ["ios", "android"];
|
|
3870
3499
|
const platformCommandOption = new Option("-p, --platform <platform>", "specify the platform").choices(["ios", "android"]);
|
|
3871
3500
|
const interactiveCommandOption = new Option("-i, --interactive", "interactive mode").default(false);
|
|
@@ -3939,7 +3568,7 @@ const getAndroidVersion = async ({ parser, validateWithSemver = false }) => {
|
|
|
3939
3568
|
for (const parserKey of parsers) {
|
|
3940
3569
|
const parsedVersion = await AndroidVersionParsers[parserKey]();
|
|
3941
3570
|
if (!parsedVersion) continue;
|
|
3942
|
-
if (validateWithSemver && !(
|
|
3571
|
+
if (validateWithSemver && !normalizeRange(parsedVersion)) continue;
|
|
3943
3572
|
return parsedVersion;
|
|
3944
3573
|
}
|
|
3945
3574
|
return null;
|
|
@@ -13296,7 +12925,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13296
12925
|
}));
|
|
13297
12926
|
//#endregion
|
|
13298
12927
|
//#region ../../node_modules/.pnpm/@expo+plist@0.0.18/node_modules/@expo/plist/build/parse.js
|
|
13299
|
-
var require_parse$
|
|
12928
|
+
var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
13300
12929
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
13301
12930
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
13302
12931
|
};
|
|
@@ -13424,7 +13053,7 @@ var require_build$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
13424
13053
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13425
13054
|
const build_1 = require_build$2();
|
|
13426
13055
|
exports.default = {
|
|
13427
|
-
parse: require_parse$
|
|
13056
|
+
parse: require_parse$1().parse,
|
|
13428
13057
|
build: build_1.build
|
|
13429
13058
|
};
|
|
13430
13059
|
}));
|
|
@@ -19298,7 +18927,7 @@ const getIOSVersion = async ({ parser, validateWithSemver = false }) => {
|
|
|
19298
18927
|
for (const parserKey of parsers) {
|
|
19299
18928
|
const parsedVersion = await IOSVersionParsers[parserKey]();
|
|
19300
18929
|
if (!parsedVersion) continue;
|
|
19301
|
-
if (validateWithSemver && !(
|
|
18930
|
+
if (validateWithSemver && !normalizeRange(parsedVersion)) continue;
|
|
19302
18931
|
return parsedVersion;
|
|
19303
18932
|
}
|
|
19304
18933
|
return null;
|
|
@@ -20369,7 +19998,7 @@ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20369
19998
|
}));
|
|
20370
19999
|
//#endregion
|
|
20371
20000
|
//#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
|
|
20372
|
-
var require_parse
|
|
20001
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20373
20002
|
const path$2 = __require("path");
|
|
20374
20003
|
const resolveCommand = require_resolveCommand();
|
|
20375
20004
|
const escape = require_escape();
|
|
@@ -20471,7 +20100,7 @@ var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
20471
20100
|
//#region ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
|
20472
20101
|
var import_cross_spawn = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
20473
20102
|
const cp = __require("child_process");
|
|
20474
|
-
const parse = require_parse
|
|
20103
|
+
const parse = require_parse();
|
|
20475
20104
|
const enoent = require_enoent();
|
|
20476
20105
|
function spawn(command, args, options) {
|
|
20477
20106
|
const parsed = parse(command, args, options);
|
|
@@ -26216,19 +25845,7 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
|
|
|
26216
25845
|
defineLazyProperty(apps, "browser", () => "browser");
|
|
26217
25846
|
defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
|
|
26218
25847
|
//#endregion
|
|
26219
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/intersects.js
|
|
26220
|
-
var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
26221
|
-
const Range = require_range();
|
|
26222
|
-
const intersects = (r1, r2, options) => {
|
|
26223
|
-
r1 = new Range(r1, options);
|
|
26224
|
-
r2 = new Range(r2, options);
|
|
26225
|
-
return r1.intersects(r2, options);
|
|
26226
|
-
};
|
|
26227
|
-
module.exports = intersects;
|
|
26228
|
-
}));
|
|
26229
|
-
//#endregion
|
|
26230
25848
|
//#region src/prompts/getPlatform.ts
|
|
26231
|
-
var import_intersects = /* @__PURE__ */ __toESM(require_intersects(), 1);
|
|
26232
25849
|
const getPlatform = async (message) => {
|
|
26233
25850
|
return await p.select({
|
|
26234
25851
|
message,
|
|
@@ -26553,7 +26170,7 @@ const getDefaultTargetAppVersion = async (platform) => {
|
|
|
26553
26170
|
break;
|
|
26554
26171
|
}
|
|
26555
26172
|
if (!version) return null;
|
|
26556
|
-
if (!(/^\d+\.\d+$/.test(version) || (
|
|
26173
|
+
if (!(/^\d+\.\d+$/.test(version) || normalizeRange(version))) return null;
|
|
26557
26174
|
if (version.split(".").length - 1 === 1) version = `${version}.x`;
|
|
26558
26175
|
return version;
|
|
26559
26176
|
};
|
|
@@ -26589,10 +26206,10 @@ const formatUploadProgress = (completed, total, skipped = 0) => {
|
|
|
26589
26206
|
return `Uploading ${total === 0 ? 100 : Math.round(completed / total * 100)}% (${completed}/${total}${skipped > 0 ? `, skipped ${skipped}` : ""})`;
|
|
26590
26207
|
};
|
|
26591
26208
|
const areTargetAppVersionsPatchCompatible = (a, b) => {
|
|
26592
|
-
const aRange = (
|
|
26593
|
-
const bRange = (
|
|
26209
|
+
const aRange = normalizeRange(a);
|
|
26210
|
+
const bRange = normalizeRange(b);
|
|
26594
26211
|
if (!aRange || !bRange) return false;
|
|
26595
|
-
return (
|
|
26212
|
+
return rangesIntersect(aRange, bRange);
|
|
26596
26213
|
};
|
|
26597
26214
|
const getPatchBaseBundles = async ({ bundleId, channel, databasePlugin, maxBaseBundles, platform, target }) => {
|
|
26598
26215
|
const baseWhere = {
|
|
@@ -26686,22 +26303,13 @@ const getRelativeStorageDir = (relativePath) => {
|
|
|
26686
26303
|
const dirname = path.posix.dirname(normalized);
|
|
26687
26304
|
return dirname === "." ? "" : dirname;
|
|
26688
26305
|
};
|
|
26689
|
-
const isBrotliManifestBundleAsset = (relativePath) => /(^|\/)index\.[^/]+\.bundle$/.test(relativePath.replace(/\\/g, "/"));
|
|
26690
|
-
const getManifestAssetUploadName = (relativePath) => isBrotliManifestBundleAsset(relativePath) ? `${relativePath}.br` : relativePath;
|
|
26691
|
-
const replaceBundleStorageUriPath = (storageUri, bundleId, nextPath) => {
|
|
26692
|
-
const storageUrl = new URL(storageUri);
|
|
26693
|
-
const segments = storageUrl.pathname.split("/").filter(Boolean);
|
|
26694
|
-
const bundleIndex = segments.lastIndexOf(bundleId);
|
|
26695
|
-
storageUrl.pathname = `/${[...bundleIndex >= 0 ? segments.slice(0, bundleIndex) : segments.slice(0, -2), nextPath].filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
26696
|
-
return storageUrl.toString();
|
|
26697
|
-
};
|
|
26698
26306
|
const createStorageUriWithRelativePath = (baseStorageUri, relativePath) => {
|
|
26699
26307
|
const storageUrl = new URL(baseStorageUri);
|
|
26700
26308
|
storageUrl.pathname = `${storageUrl.pathname.replace(/\/+$/, "")}/${relativePath.replace(/\\/g, "/").split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
26701
26309
|
return storageUrl.toString();
|
|
26702
26310
|
};
|
|
26703
26311
|
const ensureUploadSourcePath = async ({ outputPath, targetFile, uploadFilename }) => {
|
|
26704
|
-
const uploadName =
|
|
26312
|
+
const uploadName = getManifestAssetDownloadPath(targetFile.name);
|
|
26705
26313
|
const expectedFilename = uploadFilename ?? path.posix.basename(uploadName);
|
|
26706
26314
|
const actualFilename = path.basename(targetFile.path);
|
|
26707
26315
|
if (uploadName === targetFile.name && expectedFilename === actualFilename) return targetFile.path;
|
|
@@ -26718,7 +26326,7 @@ const getUniqueContentAddressedAssetUploadTargets = ({ manifest, targetFiles })
|
|
|
26718
26326
|
const manifestAsset = manifest.assets[targetFile.name];
|
|
26719
26327
|
if (!manifestAsset?.fileHash) throw new Error(`Manifest file hash not found for ${targetFile.name}`);
|
|
26720
26328
|
const storagePath = getContentAddressedAssetStoragePath({
|
|
26721
|
-
assetPath:
|
|
26329
|
+
assetPath: getManifestAssetDownloadPath(targetFile.name),
|
|
26722
26330
|
fileHash: manifestAsset.fileHash
|
|
26723
26331
|
});
|
|
26724
26332
|
if (!targets.has(storagePath)) targets.set(storagePath, {
|
|
@@ -26756,7 +26364,7 @@ const getMultiPlatformDeploymentContext = async ({ channel, options, platforms,
|
|
|
26756
26364
|
`Rollout: ${rolloutPercentage}%`
|
|
26757
26365
|
];
|
|
26758
26366
|
if (config.updateStrategy === "fingerprint") lines.push("Fingerprint: per-platform");
|
|
26759
|
-
else if (options.targetAppVersion) lines.push(`Target app version: ${(
|
|
26367
|
+
else if (options.targetAppVersion) lines.push(`Target app version: ${normalizeRange(options.targetAppVersion)}`);
|
|
26760
26368
|
return lines.join("\n");
|
|
26761
26369
|
};
|
|
26762
26370
|
const deployPlatform = async ({ options, platform, platformIndex, platformCount }) => {
|
|
@@ -26838,7 +26446,7 @@ const deployPlatform = async ({ options, platform, platformIndex, platformCount
|
|
|
26838
26446
|
placeholder: defaultTargetAppVersion ?? "1.0.0",
|
|
26839
26447
|
initialValue: defaultTargetAppVersion ?? "1.0.0",
|
|
26840
26448
|
validate: (value) => {
|
|
26841
|
-
if (!
|
|
26449
|
+
if (!value || !normalizeRange(value)) return "Invalid semver format (e.g. 1.0.0, 1.x.x)";
|
|
26842
26450
|
}
|
|
26843
26451
|
}) : defaultTargetAppVersion);
|
|
26844
26452
|
if (p.isCancel(targetAppVersion)) return null;
|
|
@@ -26872,7 +26480,7 @@ const deployPlatform = async ({ options, platform, platformIndex, platformCount
|
|
|
26872
26480
|
`Platform: ${platformName}`,
|
|
26873
26481
|
`Channel: ${channel}`,
|
|
26874
26482
|
`Rollout: ${rolloutPercentage}%`,
|
|
26875
|
-
config.updateStrategy === "fingerprint" ? `Fingerprint: ${target.fingerprintHash}` : `Target app version: ${
|
|
26483
|
+
config.updateStrategy === "fingerprint" ? `Fingerprint: ${target.fingerprintHash}` : `Target app version: ${target.appVersion && normalizeRange(target.appVersion)}`
|
|
26876
26484
|
].join("\n");
|
|
26877
26485
|
const deploymentTitle = multiPlatform ? `Deployment (${platformName} ${platformIndex + 1}/${platformCount})` : "Deployment";
|
|
26878
26486
|
if (multiPlatform) p.log.step(`${deploymentTitle} • ${channel}`);
|
|
@@ -26976,11 +26584,11 @@ const deployPlatform = async ({ options, platform, platformIndex, platformCount
|
|
|
26976
26584
|
message(formatUploadProgress(uploadedStepCount, uploadStepCount, skippedUploadCount));
|
|
26977
26585
|
};
|
|
26978
26586
|
updateUploadProgress();
|
|
26979
|
-
const { storageUri } = await storagePlugin.profiles.node.upload(bundleId, bundlePath);
|
|
26587
|
+
const { storageUri } = await storagePlugin.profiles.node.upload(createBundleStorageKey(bundleId), bundlePath);
|
|
26980
26588
|
taskRef.storageUri = storageUri;
|
|
26981
26589
|
uploadedStepCount += 1;
|
|
26982
26590
|
updateUploadProgress();
|
|
26983
|
-
taskRef.assetBaseStorageUri =
|
|
26591
|
+
taskRef.assetBaseStorageUri = createStorageRootUriWithPath(storageUri, bundleId, "assets");
|
|
26984
26592
|
await runWithConcurrency(assetUploadTargets, MANIFEST_ASSET_UPLOAD_CONCURRENCY, async ({ storagePath, targetFile }) => {
|
|
26985
26593
|
const storageUri = createStorageUriWithRelativePath(taskRef.assetBaseStorageUri, storagePath);
|
|
26986
26594
|
const uploadKey = ["assets", getRelativeStorageDir(storagePath)].filter(Boolean).join("/");
|
|
@@ -26994,7 +26602,7 @@ const deployPlatform = async ({ options, platform, platformIndex, platformCount
|
|
|
26994
26602
|
uploadedStepCount += 1;
|
|
26995
26603
|
updateUploadProgress();
|
|
26996
26604
|
});
|
|
26997
|
-
taskRef.manifestStorageUri = (await storagePlugin.profiles.node.upload(bundleId, taskRef.manifestPath)).storageUri;
|
|
26605
|
+
taskRef.manifestStorageUri = (await storagePlugin.profiles.node.upload(createBundleStorageKey(bundleId), taskRef.manifestPath)).storageUri;
|
|
26998
26606
|
uploadedStepCount += 1;
|
|
26999
26607
|
updateUploadProgress();
|
|
27000
26608
|
} catch (e) {
|
|
@@ -27906,6 +27514,8 @@ const LIST_COLUMNS = [
|
|
|
27906
27514
|
const DEFAULT_LIMIT = 20;
|
|
27907
27515
|
const DELETE_VERIFY_ATTEMPTS = 12;
|
|
27908
27516
|
const DELETE_VERIFY_DELAY_MS = 1e3;
|
|
27517
|
+
const STANDALONE_DATABASE_NAME$1 = "standalone-repository";
|
|
27518
|
+
const STANDALONE_DELETE_LOOKUP_LIMIT = 100;
|
|
27909
27519
|
const formatRow = (bundle) => {
|
|
27910
27520
|
const out = {};
|
|
27911
27521
|
for (const field of LIST_FIELDS) {
|
|
@@ -27941,7 +27551,7 @@ const refuseNonInteractiveMutation = (action) => {
|
|
|
27941
27551
|
p.log.error(`Cannot ${action} a bundle without confirmation in a non-interactive shell. Re-run with -y, or use a TTY.`);
|
|
27942
27552
|
process.exit(1);
|
|
27943
27553
|
};
|
|
27944
|
-
const safeOnUnmount$
|
|
27554
|
+
const safeOnUnmount$3 = async (databasePlugin) => {
|
|
27945
27555
|
try {
|
|
27946
27556
|
await databasePlugin.onUnmount?.();
|
|
27947
27557
|
} catch (err) {
|
|
@@ -27956,13 +27566,14 @@ const handleBundleList = async (options = {}) => {
|
|
|
27956
27566
|
const result = await databasePlugin.getBundles({
|
|
27957
27567
|
where: {
|
|
27958
27568
|
channel: options.channel,
|
|
27959
|
-
platform: options.platform
|
|
27569
|
+
platform: options.platform,
|
|
27570
|
+
targetAppVersion: options.targetAppVersion
|
|
27960
27571
|
},
|
|
27961
27572
|
limit
|
|
27962
27573
|
});
|
|
27963
27574
|
console.log(options.json ? JSON.stringify(result, null, 2) : tabulate(result.data));
|
|
27964
27575
|
} finally {
|
|
27965
|
-
await safeOnUnmount$
|
|
27576
|
+
await safeOnUnmount$3(databasePlugin);
|
|
27966
27577
|
}
|
|
27967
27578
|
};
|
|
27968
27579
|
const handleBundleShow = async (bundleId, options = {}) => {
|
|
@@ -27980,7 +27591,7 @@ const handleBundleShow = async (bundleId, options = {}) => {
|
|
|
27980
27591
|
}
|
|
27981
27592
|
p.log.message(formatBundleSummary(bundle));
|
|
27982
27593
|
} finally {
|
|
27983
|
-
await safeOnUnmount$
|
|
27594
|
+
await safeOnUnmount$3(databasePlugin);
|
|
27984
27595
|
}
|
|
27985
27596
|
};
|
|
27986
27597
|
const handleBundleSetEnabled = async (bundleId, nextEnabled, options = {}) => {
|
|
@@ -28021,7 +27632,7 @@ const handleBundleSetEnabled = async (bundleId, nextEnabled, options = {}) => {
|
|
|
28021
27632
|
p.log.info(` ${ui.id(bundleId)}`);
|
|
28022
27633
|
}
|
|
28023
27634
|
} finally {
|
|
28024
|
-
await safeOnUnmount$
|
|
27635
|
+
await safeOnUnmount$3(databasePlugin);
|
|
28025
27636
|
}
|
|
28026
27637
|
};
|
|
28027
27638
|
const handleBundleUpdate = async (bundleId, options = {}) => {
|
|
@@ -28069,23 +27680,35 @@ const handleBundleUpdate = async (bundleId, options = {}) => {
|
|
|
28069
27680
|
p.log.success("Updated bundle.");
|
|
28070
27681
|
p.log.info(` ${ui.id(bundleId)}`);
|
|
28071
27682
|
} finally {
|
|
28072
|
-
await safeOnUnmount$
|
|
27683
|
+
await safeOnUnmount$3(databasePlugin);
|
|
28073
27684
|
}
|
|
28074
27685
|
};
|
|
28075
27686
|
const handleBundleDelete = async (bundleIds, options = {}) => {
|
|
28076
27687
|
printBanner$1();
|
|
28077
|
-
const ids = bundleIds ?? [];
|
|
27688
|
+
const ids = [...new Set(bundleIds ?? [])];
|
|
28078
27689
|
if (ids.length === 0) {
|
|
28079
27690
|
p.log.error("Provide at least one bundle id.");
|
|
28080
27691
|
process.exit(1);
|
|
28081
27692
|
}
|
|
28082
27693
|
const databasePlugin = await (await loadConfig(null)).database();
|
|
28083
27694
|
try {
|
|
28084
|
-
const
|
|
28085
|
-
const
|
|
28086
|
-
|
|
28087
|
-
|
|
28088
|
-
|
|
27695
|
+
const lookupBatches = databasePlugin.name === STANDALONE_DATABASE_NAME$1 ? Array.from({ length: Math.ceil(ids.length / STANDALONE_DELETE_LOOKUP_LIMIT) }, (_, index) => ids.slice(index * STANDALONE_DELETE_LOOKUP_LIMIT, (index + 1) * STANDALONE_DELETE_LOOKUP_LIMIT)) : [ids];
|
|
27696
|
+
const matchedBundles = [];
|
|
27697
|
+
for (const batch of lookupBatches) {
|
|
27698
|
+
const { data } = await databasePlugin.getBundles({
|
|
27699
|
+
where: { id: { in: batch } },
|
|
27700
|
+
limit: batch.length
|
|
27701
|
+
});
|
|
27702
|
+
matchedBundles.push(...data);
|
|
27703
|
+
}
|
|
27704
|
+
const matchedById = new Map(matchedBundles.map((bundle) => [bundle.id, bundle]));
|
|
27705
|
+
const targets = ids.flatMap((id) => {
|
|
27706
|
+
const bundle = matchedById.get(id);
|
|
27707
|
+
if (!bundle) {
|
|
27708
|
+
p.log.info(`No bundle with id ${id}. Skipping.`);
|
|
27709
|
+
return [];
|
|
27710
|
+
}
|
|
27711
|
+
return [bundle];
|
|
28089
27712
|
});
|
|
28090
27713
|
if (targets.length === 0) {
|
|
28091
27714
|
p.log.info("No matching bundle records. No changes.");
|
|
@@ -28118,7 +27741,7 @@ const handleBundleDelete = async (bundleIds, options = {}) => {
|
|
|
28118
27741
|
p.log.info(` ${ui.id(firstTarget.id)}`);
|
|
28119
27742
|
} else p.log.success(`Deleted ${targets.length} bundle records.`);
|
|
28120
27743
|
} finally {
|
|
28121
|
-
await safeOnUnmount$
|
|
27744
|
+
await safeOnUnmount$3(databasePlugin);
|
|
28122
27745
|
}
|
|
28123
27746
|
};
|
|
28124
27747
|
async function waitForDeletedBundle(databasePlugin, bundleId) {
|
|
@@ -28318,577 +27941,7 @@ const handleSetChannel = async (channel) => {
|
|
|
28318
27941
|
p.log.warn("Rebuild native app after changing channel.");
|
|
28319
27942
|
};
|
|
28320
27943
|
//#endregion
|
|
28321
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/parse.js
|
|
28322
|
-
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28323
|
-
const SemVer = require_semver$1();
|
|
28324
|
-
const parse = (version, options, throwErrors = false) => {
|
|
28325
|
-
if (version instanceof SemVer) return version;
|
|
28326
|
-
try {
|
|
28327
|
-
return new SemVer(version, options);
|
|
28328
|
-
} catch (er) {
|
|
28329
|
-
if (!throwErrors) return null;
|
|
28330
|
-
throw er;
|
|
28331
|
-
}
|
|
28332
|
-
};
|
|
28333
|
-
module.exports = parse;
|
|
28334
|
-
}));
|
|
28335
|
-
//#endregion
|
|
28336
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/valid.js
|
|
28337
|
-
var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28338
|
-
const parse = require_parse();
|
|
28339
|
-
const valid = (version, options) => {
|
|
28340
|
-
const v = parse(version, options);
|
|
28341
|
-
return v ? v.version : null;
|
|
28342
|
-
};
|
|
28343
|
-
module.exports = valid;
|
|
28344
|
-
}));
|
|
28345
|
-
//#endregion
|
|
28346
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/clean.js
|
|
28347
|
-
var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28348
|
-
const parse = require_parse();
|
|
28349
|
-
const clean = (version, options) => {
|
|
28350
|
-
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
28351
|
-
return s ? s.version : null;
|
|
28352
|
-
};
|
|
28353
|
-
module.exports = clean;
|
|
28354
|
-
}));
|
|
28355
|
-
//#endregion
|
|
28356
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/inc.js
|
|
28357
|
-
var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28358
|
-
const SemVer = require_semver$1();
|
|
28359
|
-
const inc = (version, release, options, identifier, identifierBase) => {
|
|
28360
|
-
if (typeof options === "string") {
|
|
28361
|
-
identifierBase = identifier;
|
|
28362
|
-
identifier = options;
|
|
28363
|
-
options = void 0;
|
|
28364
|
-
}
|
|
28365
|
-
try {
|
|
28366
|
-
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
28367
|
-
} catch (er) {
|
|
28368
|
-
return null;
|
|
28369
|
-
}
|
|
28370
|
-
};
|
|
28371
|
-
module.exports = inc;
|
|
28372
|
-
}));
|
|
28373
|
-
//#endregion
|
|
28374
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/diff.js
|
|
28375
|
-
var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28376
|
-
const parse = require_parse();
|
|
28377
|
-
const diff = (version1, version2) => {
|
|
28378
|
-
const v1 = parse(version1, null, true);
|
|
28379
|
-
const v2 = parse(version2, null, true);
|
|
28380
|
-
const comparison = v1.compare(v2);
|
|
28381
|
-
if (comparison === 0) return null;
|
|
28382
|
-
const v1Higher = comparison > 0;
|
|
28383
|
-
const highVersion = v1Higher ? v1 : v2;
|
|
28384
|
-
const lowVersion = v1Higher ? v2 : v1;
|
|
28385
|
-
const highHasPre = !!highVersion.prerelease.length;
|
|
28386
|
-
if (!!lowVersion.prerelease.length && !highHasPre) {
|
|
28387
|
-
if (!lowVersion.patch && !lowVersion.minor) return "major";
|
|
28388
|
-
if (lowVersion.compareMain(highVersion) === 0) {
|
|
28389
|
-
if (lowVersion.minor && !lowVersion.patch) return "minor";
|
|
28390
|
-
return "patch";
|
|
28391
|
-
}
|
|
28392
|
-
}
|
|
28393
|
-
const prefix = highHasPre ? "pre" : "";
|
|
28394
|
-
if (v1.major !== v2.major) return prefix + "major";
|
|
28395
|
-
if (v1.minor !== v2.minor) return prefix + "minor";
|
|
28396
|
-
if (v1.patch !== v2.patch) return prefix + "patch";
|
|
28397
|
-
return "prerelease";
|
|
28398
|
-
};
|
|
28399
|
-
module.exports = diff;
|
|
28400
|
-
}));
|
|
28401
|
-
//#endregion
|
|
28402
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/major.js
|
|
28403
|
-
var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28404
|
-
const SemVer = require_semver$1();
|
|
28405
|
-
const major = (a, loose) => new SemVer(a, loose).major;
|
|
28406
|
-
module.exports = major;
|
|
28407
|
-
}));
|
|
28408
|
-
//#endregion
|
|
28409
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/minor.js
|
|
28410
|
-
var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28411
|
-
const SemVer = require_semver$1();
|
|
28412
|
-
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
28413
|
-
module.exports = minor;
|
|
28414
|
-
}));
|
|
28415
|
-
//#endregion
|
|
28416
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/patch.js
|
|
28417
|
-
var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28418
|
-
const SemVer = require_semver$1();
|
|
28419
|
-
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
28420
|
-
module.exports = patch;
|
|
28421
|
-
}));
|
|
28422
|
-
//#endregion
|
|
28423
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/prerelease.js
|
|
28424
|
-
var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28425
|
-
const parse = require_parse();
|
|
28426
|
-
const prerelease = (version, options) => {
|
|
28427
|
-
const parsed = parse(version, options);
|
|
28428
|
-
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
28429
|
-
};
|
|
28430
|
-
module.exports = prerelease;
|
|
28431
|
-
}));
|
|
28432
|
-
//#endregion
|
|
28433
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/rcompare.js
|
|
28434
|
-
var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28435
|
-
const compare = require_compare();
|
|
28436
|
-
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
28437
|
-
module.exports = rcompare;
|
|
28438
|
-
}));
|
|
28439
|
-
//#endregion
|
|
28440
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare-loose.js
|
|
28441
|
-
var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28442
|
-
const compare = require_compare();
|
|
28443
|
-
const compareLoose = (a, b) => compare(a, b, true);
|
|
28444
|
-
module.exports = compareLoose;
|
|
28445
|
-
}));
|
|
28446
|
-
//#endregion
|
|
28447
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/compare-build.js
|
|
28448
|
-
var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28449
|
-
const SemVer = require_semver$1();
|
|
28450
|
-
const compareBuild = (a, b, loose) => {
|
|
28451
|
-
const versionA = new SemVer(a, loose);
|
|
28452
|
-
const versionB = new SemVer(b, loose);
|
|
28453
|
-
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
28454
|
-
};
|
|
28455
|
-
module.exports = compareBuild;
|
|
28456
|
-
}));
|
|
28457
|
-
//#endregion
|
|
28458
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/sort.js
|
|
28459
|
-
var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28460
|
-
const compareBuild = require_compare_build();
|
|
28461
|
-
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
28462
|
-
module.exports = sort;
|
|
28463
|
-
}));
|
|
28464
|
-
//#endregion
|
|
28465
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/rsort.js
|
|
28466
|
-
var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28467
|
-
const compareBuild = require_compare_build();
|
|
28468
|
-
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
28469
|
-
module.exports = rsort;
|
|
28470
|
-
}));
|
|
28471
|
-
//#endregion
|
|
28472
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/coerce.js
|
|
28473
|
-
var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28474
|
-
const SemVer = require_semver$1();
|
|
28475
|
-
const parse = require_parse();
|
|
28476
|
-
const { safeRe: re, t } = require_re();
|
|
28477
|
-
const coerce = (version, options) => {
|
|
28478
|
-
if (version instanceof SemVer) return version;
|
|
28479
|
-
if (typeof version === "number") version = String(version);
|
|
28480
|
-
if (typeof version !== "string") return null;
|
|
28481
|
-
options = options || {};
|
|
28482
|
-
let match = null;
|
|
28483
|
-
if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
28484
|
-
else {
|
|
28485
|
-
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
28486
|
-
let next;
|
|
28487
|
-
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
28488
|
-
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
28489
|
-
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
28490
|
-
}
|
|
28491
|
-
coerceRtlRegex.lastIndex = -1;
|
|
28492
|
-
}
|
|
28493
|
-
if (match === null) return null;
|
|
28494
|
-
const major = match[2];
|
|
28495
|
-
return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
|
|
28496
|
-
};
|
|
28497
|
-
module.exports = coerce;
|
|
28498
|
-
}));
|
|
28499
|
-
//#endregion
|
|
28500
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/truncate.js
|
|
28501
|
-
var require_truncate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28502
|
-
const parse = require_parse();
|
|
28503
|
-
const constants = require_constants$1();
|
|
28504
|
-
const SemVer = require_semver$1();
|
|
28505
|
-
const truncate = (version, truncation, options) => {
|
|
28506
|
-
if (!constants.RELEASE_TYPES.includes(truncation)) return null;
|
|
28507
|
-
const clonedVersion = cloneInputVersion(version, options);
|
|
28508
|
-
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
28509
|
-
};
|
|
28510
|
-
const cloneInputVersion = (version, options) => {
|
|
28511
|
-
return parse(version instanceof SemVer ? version.version : version, options);
|
|
28512
|
-
};
|
|
28513
|
-
const doTruncation = (version, truncation) => {
|
|
28514
|
-
if (isPrerelease(truncation)) return version.version;
|
|
28515
|
-
version.prerelease = [];
|
|
28516
|
-
switch (truncation) {
|
|
28517
|
-
case "major":
|
|
28518
|
-
version.minor = 0;
|
|
28519
|
-
version.patch = 0;
|
|
28520
|
-
break;
|
|
28521
|
-
case "minor":
|
|
28522
|
-
version.patch = 0;
|
|
28523
|
-
break;
|
|
28524
|
-
}
|
|
28525
|
-
return version.format();
|
|
28526
|
-
};
|
|
28527
|
-
const isPrerelease = (type) => {
|
|
28528
|
-
return type.startsWith("pre");
|
|
28529
|
-
};
|
|
28530
|
-
module.exports = truncate;
|
|
28531
|
-
}));
|
|
28532
|
-
//#endregion
|
|
28533
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/functions/satisfies.js
|
|
28534
|
-
var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28535
|
-
const Range = require_range();
|
|
28536
|
-
const satisfies = (version, range, options) => {
|
|
28537
|
-
try {
|
|
28538
|
-
range = new Range(range, options);
|
|
28539
|
-
} catch (er) {
|
|
28540
|
-
return false;
|
|
28541
|
-
}
|
|
28542
|
-
return range.test(version);
|
|
28543
|
-
};
|
|
28544
|
-
module.exports = satisfies;
|
|
28545
|
-
}));
|
|
28546
|
-
//#endregion
|
|
28547
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/to-comparators.js
|
|
28548
|
-
var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28549
|
-
const Range = require_range();
|
|
28550
|
-
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
28551
|
-
module.exports = toComparators;
|
|
28552
|
-
}));
|
|
28553
|
-
//#endregion
|
|
28554
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/max-satisfying.js
|
|
28555
|
-
var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28556
|
-
const SemVer = require_semver$1();
|
|
28557
|
-
const Range = require_range();
|
|
28558
|
-
const maxSatisfying = (versions, range, options) => {
|
|
28559
|
-
let max = null;
|
|
28560
|
-
let maxSV = null;
|
|
28561
|
-
let rangeObj = null;
|
|
28562
|
-
try {
|
|
28563
|
-
rangeObj = new Range(range, options);
|
|
28564
|
-
} catch (er) {
|
|
28565
|
-
return null;
|
|
28566
|
-
}
|
|
28567
|
-
versions.forEach((v) => {
|
|
28568
|
-
if (rangeObj.test(v)) {
|
|
28569
|
-
if (!max || maxSV.compare(v) === -1) {
|
|
28570
|
-
max = v;
|
|
28571
|
-
maxSV = new SemVer(max, options);
|
|
28572
|
-
}
|
|
28573
|
-
}
|
|
28574
|
-
});
|
|
28575
|
-
return max;
|
|
28576
|
-
};
|
|
28577
|
-
module.exports = maxSatisfying;
|
|
28578
|
-
}));
|
|
28579
|
-
//#endregion
|
|
28580
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/min-satisfying.js
|
|
28581
|
-
var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28582
|
-
const SemVer = require_semver$1();
|
|
28583
|
-
const Range = require_range();
|
|
28584
|
-
const minSatisfying = (versions, range, options) => {
|
|
28585
|
-
let min = null;
|
|
28586
|
-
let minSV = null;
|
|
28587
|
-
let rangeObj = null;
|
|
28588
|
-
try {
|
|
28589
|
-
rangeObj = new Range(range, options);
|
|
28590
|
-
} catch (er) {
|
|
28591
|
-
return null;
|
|
28592
|
-
}
|
|
28593
|
-
versions.forEach((v) => {
|
|
28594
|
-
if (rangeObj.test(v)) {
|
|
28595
|
-
if (!min || minSV.compare(v) === 1) {
|
|
28596
|
-
min = v;
|
|
28597
|
-
minSV = new SemVer(min, options);
|
|
28598
|
-
}
|
|
28599
|
-
}
|
|
28600
|
-
});
|
|
28601
|
-
return min;
|
|
28602
|
-
};
|
|
28603
|
-
module.exports = minSatisfying;
|
|
28604
|
-
}));
|
|
28605
|
-
//#endregion
|
|
28606
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/min-version.js
|
|
28607
|
-
var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28608
|
-
const SemVer = require_semver$1();
|
|
28609
|
-
const Range = require_range();
|
|
28610
|
-
const gt = require_gt();
|
|
28611
|
-
const minVersion = (range, loose) => {
|
|
28612
|
-
range = new Range(range, loose);
|
|
28613
|
-
let minver = new SemVer("0.0.0");
|
|
28614
|
-
if (range.test(minver)) return minver;
|
|
28615
|
-
minver = new SemVer("0.0.0-0");
|
|
28616
|
-
if (range.test(minver)) return minver;
|
|
28617
|
-
minver = null;
|
|
28618
|
-
for (let i = 0; i < range.set.length; ++i) {
|
|
28619
|
-
const comparators = range.set[i];
|
|
28620
|
-
let setMin = null;
|
|
28621
|
-
comparators.forEach((comparator) => {
|
|
28622
|
-
const compver = new SemVer(comparator.semver.version);
|
|
28623
|
-
switch (comparator.operator) {
|
|
28624
|
-
case ">":
|
|
28625
|
-
if (compver.prerelease.length === 0) compver.patch++;
|
|
28626
|
-
else compver.prerelease.push(0);
|
|
28627
|
-
compver.raw = compver.format();
|
|
28628
|
-
case "":
|
|
28629
|
-
case ">=":
|
|
28630
|
-
if (!setMin || gt(compver, setMin)) setMin = compver;
|
|
28631
|
-
break;
|
|
28632
|
-
case "<":
|
|
28633
|
-
case "<=": break;
|
|
28634
|
-
default: throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
28635
|
-
}
|
|
28636
|
-
});
|
|
28637
|
-
if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
|
|
28638
|
-
}
|
|
28639
|
-
if (minver && range.test(minver)) return minver;
|
|
28640
|
-
return null;
|
|
28641
|
-
};
|
|
28642
|
-
module.exports = minVersion;
|
|
28643
|
-
}));
|
|
28644
|
-
//#endregion
|
|
28645
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/outside.js
|
|
28646
|
-
var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28647
|
-
const SemVer = require_semver$1();
|
|
28648
|
-
const Comparator = require_comparator();
|
|
28649
|
-
const { ANY } = Comparator;
|
|
28650
|
-
const Range = require_range();
|
|
28651
|
-
const satisfies = require_satisfies();
|
|
28652
|
-
const gt = require_gt();
|
|
28653
|
-
const lt = require_lt();
|
|
28654
|
-
const lte = require_lte();
|
|
28655
|
-
const gte = require_gte();
|
|
28656
|
-
const outside = (version, range, hilo, options) => {
|
|
28657
|
-
version = new SemVer(version, options);
|
|
28658
|
-
range = new Range(range, options);
|
|
28659
|
-
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
28660
|
-
switch (hilo) {
|
|
28661
|
-
case ">":
|
|
28662
|
-
gtfn = gt;
|
|
28663
|
-
ltefn = lte;
|
|
28664
|
-
ltfn = lt;
|
|
28665
|
-
comp = ">";
|
|
28666
|
-
ecomp = ">=";
|
|
28667
|
-
break;
|
|
28668
|
-
case "<":
|
|
28669
|
-
gtfn = lt;
|
|
28670
|
-
ltefn = gte;
|
|
28671
|
-
ltfn = gt;
|
|
28672
|
-
comp = "<";
|
|
28673
|
-
ecomp = "<=";
|
|
28674
|
-
break;
|
|
28675
|
-
default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
28676
|
-
}
|
|
28677
|
-
if (satisfies(version, range, options)) return false;
|
|
28678
|
-
for (let i = 0; i < range.set.length; ++i) {
|
|
28679
|
-
const comparators = range.set[i];
|
|
28680
|
-
let high = null;
|
|
28681
|
-
let low = null;
|
|
28682
|
-
comparators.forEach((comparator) => {
|
|
28683
|
-
if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
|
|
28684
|
-
high = high || comparator;
|
|
28685
|
-
low = low || comparator;
|
|
28686
|
-
if (gtfn(comparator.semver, high.semver, options)) high = comparator;
|
|
28687
|
-
else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
|
|
28688
|
-
});
|
|
28689
|
-
if (high.operator === comp || high.operator === ecomp) return false;
|
|
28690
|
-
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
|
|
28691
|
-
else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
|
|
28692
|
-
}
|
|
28693
|
-
return true;
|
|
28694
|
-
};
|
|
28695
|
-
module.exports = outside;
|
|
28696
|
-
}));
|
|
28697
|
-
//#endregion
|
|
28698
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/gtr.js
|
|
28699
|
-
var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28700
|
-
const outside = require_outside();
|
|
28701
|
-
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
28702
|
-
module.exports = gtr;
|
|
28703
|
-
}));
|
|
28704
|
-
//#endregion
|
|
28705
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/ltr.js
|
|
28706
|
-
var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28707
|
-
const outside = require_outside();
|
|
28708
|
-
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
28709
|
-
module.exports = ltr;
|
|
28710
|
-
}));
|
|
28711
|
-
//#endregion
|
|
28712
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/simplify.js
|
|
28713
|
-
var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28714
|
-
const satisfies = require_satisfies();
|
|
28715
|
-
const compare = require_compare();
|
|
28716
|
-
module.exports = (versions, range, options) => {
|
|
28717
|
-
const set = [];
|
|
28718
|
-
let first = null;
|
|
28719
|
-
let prev = null;
|
|
28720
|
-
const v = versions.sort((a, b) => compare(a, b, options));
|
|
28721
|
-
for (const version of v) if (satisfies(version, range, options)) {
|
|
28722
|
-
prev = version;
|
|
28723
|
-
if (!first) first = version;
|
|
28724
|
-
} else {
|
|
28725
|
-
if (prev) set.push([first, prev]);
|
|
28726
|
-
prev = null;
|
|
28727
|
-
first = null;
|
|
28728
|
-
}
|
|
28729
|
-
if (first) set.push([first, null]);
|
|
28730
|
-
const ranges = [];
|
|
28731
|
-
for (const [min, max] of set) if (min === max) ranges.push(min);
|
|
28732
|
-
else if (!max && min === v[0]) ranges.push("*");
|
|
28733
|
-
else if (!max) ranges.push(`>=${min}`);
|
|
28734
|
-
else if (min === v[0]) ranges.push(`<=${max}`);
|
|
28735
|
-
else ranges.push(`${min} - ${max}`);
|
|
28736
|
-
const simplified = ranges.join(" || ");
|
|
28737
|
-
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
28738
|
-
return simplified.length < original.length ? simplified : range;
|
|
28739
|
-
};
|
|
28740
|
-
}));
|
|
28741
|
-
//#endregion
|
|
28742
|
-
//#region ../../node_modules/.pnpm/semver@7.8.4/node_modules/semver/ranges/subset.js
|
|
28743
|
-
var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28744
|
-
const Range = require_range();
|
|
28745
|
-
const Comparator = require_comparator();
|
|
28746
|
-
const { ANY } = Comparator;
|
|
28747
|
-
const satisfies = require_satisfies();
|
|
28748
|
-
const compare = require_compare();
|
|
28749
|
-
const subset = (sub, dom, options = {}) => {
|
|
28750
|
-
if (sub === dom) return true;
|
|
28751
|
-
sub = new Range(sub, options);
|
|
28752
|
-
dom = new Range(dom, options);
|
|
28753
|
-
let sawNonNull = false;
|
|
28754
|
-
OUTER: for (const simpleSub of sub.set) {
|
|
28755
|
-
for (const simpleDom of dom.set) {
|
|
28756
|
-
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
28757
|
-
sawNonNull = sawNonNull || isSub !== null;
|
|
28758
|
-
if (isSub) continue OUTER;
|
|
28759
|
-
}
|
|
28760
|
-
if (sawNonNull) return false;
|
|
28761
|
-
}
|
|
28762
|
-
return true;
|
|
28763
|
-
};
|
|
28764
|
-
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
28765
|
-
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
28766
|
-
const simpleSubset = (sub, dom, options) => {
|
|
28767
|
-
if (sub === dom) return true;
|
|
28768
|
-
if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
28769
|
-
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
28770
|
-
else sub = minimumVersion;
|
|
28771
|
-
if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
|
|
28772
|
-
else dom = minimumVersion;
|
|
28773
|
-
const eqSet = /* @__PURE__ */ new Set();
|
|
28774
|
-
let gt, lt;
|
|
28775
|
-
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
28776
|
-
else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
|
|
28777
|
-
else eqSet.add(c.semver);
|
|
28778
|
-
if (eqSet.size > 1) return null;
|
|
28779
|
-
let gtltComp;
|
|
28780
|
-
if (gt && lt) {
|
|
28781
|
-
gtltComp = compare(gt.semver, lt.semver, options);
|
|
28782
|
-
if (gtltComp > 0) return null;
|
|
28783
|
-
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
28784
|
-
}
|
|
28785
|
-
for (const eq of eqSet) {
|
|
28786
|
-
if (gt && !satisfies(eq, String(gt), options)) return null;
|
|
28787
|
-
if (lt && !satisfies(eq, String(lt), options)) return null;
|
|
28788
|
-
for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
|
|
28789
|
-
return true;
|
|
28790
|
-
}
|
|
28791
|
-
let higher, lower;
|
|
28792
|
-
let hasDomLT, hasDomGT;
|
|
28793
|
-
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
28794
|
-
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
28795
|
-
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
|
|
28796
|
-
for (const c of dom) {
|
|
28797
|
-
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
28798
|
-
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
28799
|
-
if (gt) {
|
|
28800
|
-
if (needDomGTPre) {
|
|
28801
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
|
|
28802
|
-
}
|
|
28803
|
-
if (c.operator === ">" || c.operator === ">=") {
|
|
28804
|
-
higher = higherGT(gt, c, options);
|
|
28805
|
-
if (higher === c && higher !== gt) return false;
|
|
28806
|
-
} else if (gt.operator === ">=" && !c.test(gt.semver)) return false;
|
|
28807
|
-
}
|
|
28808
|
-
if (lt) {
|
|
28809
|
-
if (needDomLTPre) {
|
|
28810
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
|
|
28811
|
-
}
|
|
28812
|
-
if (c.operator === "<" || c.operator === "<=") {
|
|
28813
|
-
lower = lowerLT(lt, c, options);
|
|
28814
|
-
if (lower === c && lower !== lt) return false;
|
|
28815
|
-
} else if (lt.operator === "<=" && !c.test(lt.semver)) return false;
|
|
28816
|
-
}
|
|
28817
|
-
if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
|
|
28818
|
-
}
|
|
28819
|
-
if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
|
|
28820
|
-
if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
|
|
28821
|
-
if (needDomGTPre || needDomLTPre) return false;
|
|
28822
|
-
return true;
|
|
28823
|
-
};
|
|
28824
|
-
const higherGT = (a, b, options) => {
|
|
28825
|
-
if (!a) return b;
|
|
28826
|
-
const comp = compare(a.semver, b.semver, options);
|
|
28827
|
-
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
28828
|
-
};
|
|
28829
|
-
const lowerLT = (a, b, options) => {
|
|
28830
|
-
if (!a) return b;
|
|
28831
|
-
const comp = compare(a.semver, b.semver, options);
|
|
28832
|
-
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
28833
|
-
};
|
|
28834
|
-
module.exports = subset;
|
|
28835
|
-
}));
|
|
28836
|
-
//#endregion
|
|
28837
27944
|
//#region src/commands/doctorInfrastructureTargets.ts
|
|
28838
|
-
var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28839
|
-
const internalRe = require_re();
|
|
28840
|
-
const constants = require_constants$1();
|
|
28841
|
-
const SemVer = require_semver$1();
|
|
28842
|
-
const identifiers = require_identifiers();
|
|
28843
|
-
module.exports = {
|
|
28844
|
-
parse: require_parse(),
|
|
28845
|
-
valid: require_valid(),
|
|
28846
|
-
clean: require_clean(),
|
|
28847
|
-
inc: require_inc(),
|
|
28848
|
-
diff: require_diff(),
|
|
28849
|
-
major: require_major(),
|
|
28850
|
-
minor: require_minor(),
|
|
28851
|
-
patch: require_patch(),
|
|
28852
|
-
prerelease: require_prerelease(),
|
|
28853
|
-
compare: require_compare(),
|
|
28854
|
-
rcompare: require_rcompare(),
|
|
28855
|
-
compareLoose: require_compare_loose(),
|
|
28856
|
-
compareBuild: require_compare_build(),
|
|
28857
|
-
sort: require_sort(),
|
|
28858
|
-
rsort: require_rsort(),
|
|
28859
|
-
gt: require_gt(),
|
|
28860
|
-
lt: require_lt(),
|
|
28861
|
-
eq: require_eq(),
|
|
28862
|
-
neq: require_neq(),
|
|
28863
|
-
gte: require_gte(),
|
|
28864
|
-
lte: require_lte(),
|
|
28865
|
-
cmp: require_cmp(),
|
|
28866
|
-
coerce: require_coerce(),
|
|
28867
|
-
truncate: require_truncate(),
|
|
28868
|
-
Comparator: require_comparator(),
|
|
28869
|
-
Range: require_range(),
|
|
28870
|
-
satisfies: require_satisfies(),
|
|
28871
|
-
toComparators: require_to_comparators(),
|
|
28872
|
-
maxSatisfying: require_max_satisfying(),
|
|
28873
|
-
minSatisfying: require_min_satisfying(),
|
|
28874
|
-
minVersion: require_min_version(),
|
|
28875
|
-
validRange: require_valid$1(),
|
|
28876
|
-
outside: require_outside(),
|
|
28877
|
-
gtr: require_gtr(),
|
|
28878
|
-
ltr: require_ltr(),
|
|
28879
|
-
intersects: require_intersects(),
|
|
28880
|
-
simplifyRange: require_simplify(),
|
|
28881
|
-
subset: require_subset(),
|
|
28882
|
-
SemVer,
|
|
28883
|
-
re: internalRe.re,
|
|
28884
|
-
src: internalRe.src,
|
|
28885
|
-
tokens: internalRe.t,
|
|
28886
|
-
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
28887
|
-
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
28888
|
-
compareIdentifiers: identifiers.compareIdentifiers,
|
|
28889
|
-
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
28890
|
-
};
|
|
28891
|
-
})))(), 1);
|
|
28892
27945
|
const UPDATE_TARGETS = [
|
|
28893
27946
|
{
|
|
28894
27947
|
version: "0.13.0",
|
|
@@ -28936,10 +27989,10 @@ const getLatestKnownTargetVersion = () => {
|
|
|
28936
27989
|
}).version;
|
|
28937
27990
|
};
|
|
28938
27991
|
const getRequiredTarget = ({ hotUpdaterVersion, targets }) => {
|
|
28939
|
-
const current =
|
|
27992
|
+
const current = coerce(hotUpdaterVersion);
|
|
28940
27993
|
if (!current) return null;
|
|
28941
27994
|
let requiredTarget = null;
|
|
28942
|
-
for (const target of targets) if (
|
|
27995
|
+
for (const target of targets) if (isLessOrEqual(target.version, current)) requiredTarget = target;
|
|
28943
27996
|
return requiredTarget ?? getTargetAt({
|
|
28944
27997
|
index: 0,
|
|
28945
27998
|
label: "UPDATE_TARGETS",
|
|
@@ -28964,10 +28017,10 @@ function getRequiredUpdateTarget(hotUpdaterVersion = getLatestKnownTargetVersion
|
|
|
28964
28017
|
});
|
|
28965
28018
|
}
|
|
28966
28019
|
function isInfrastructureUpdateRequired({ serverVersion, requiredVersion = getRequiredInfrastructureVersion() }) {
|
|
28967
|
-
const normalizedServerVersion =
|
|
28968
|
-
const normalizedRequiredVersion =
|
|
28020
|
+
const normalizedServerVersion = normalize(serverVersion);
|
|
28021
|
+
const normalizedRequiredVersion = normalize(requiredVersion);
|
|
28969
28022
|
if (!normalizedServerVersion || !normalizedRequiredVersion) throw new Error("Invalid infrastructure version");
|
|
28970
|
-
return
|
|
28023
|
+
return isLess(normalizedServerVersion, normalizedRequiredVersion);
|
|
28971
28024
|
}
|
|
28972
28025
|
//#endregion
|
|
28973
28026
|
//#region src/commands/doctorInfrastructure.ts
|
|
@@ -29053,12 +28106,16 @@ const REMOVE_PUBLIC_KEY_COMMANDS = ["npx hot-updater keys remove"];
|
|
|
29053
28106
|
*/
|
|
29054
28107
|
function areVersionsCompatible(versionA, versionB) {
|
|
29055
28108
|
if (versionA === versionB) return true;
|
|
29056
|
-
const
|
|
29057
|
-
const
|
|
29058
|
-
|
|
28109
|
+
const normalizedRangeA = normalizeRange(versionA);
|
|
28110
|
+
const normalizedRangeB = normalizeRange(versionB);
|
|
28111
|
+
const comparableVersionA = normalizedRangeA ? findMinimumForRange(normalizedRangeA) : null;
|
|
28112
|
+
const comparableVersionB = normalizedRangeB ? findMinimumForRange(normalizedRangeB) : null;
|
|
28113
|
+
const parsedVersionA = comparableVersionA ? parse(comparableVersionA) : null;
|
|
28114
|
+
const parsedVersionB = comparableVersionB ? parse(comparableVersionB) : null;
|
|
28115
|
+
if (parsedVersionA && parsedVersionB && (parsedVersionA.prerelease?.length ?? 0) === 0 && (parsedVersionB.prerelease?.length ?? 0) === 0 && parsedVersionA.major === parsedVersionB.major && parsedVersionA.minor === parsedVersionB.minor) return true;
|
|
29059
28116
|
const options = { includePrerelease: true };
|
|
29060
|
-
if (
|
|
29061
|
-
if (
|
|
28117
|
+
if (normalize(versionA) && normalizedRangeB && satisfies(versionA, normalizedRangeB, options)) return true;
|
|
28118
|
+
if (normalize(versionB) && normalizedRangeA && satisfies(versionB, normalizedRangeA, options)) return true;
|
|
29062
28119
|
return false;
|
|
29063
28120
|
}
|
|
29064
28121
|
const toRelativePath = (cwd, filePath) => path.relative(cwd, filePath);
|
|
@@ -51248,7 +50305,7 @@ async function migrateWithMigrator(hotUpdater, skipConfirm, s) {
|
|
|
51248
50305
|
}
|
|
51249
50306
|
//#endregion
|
|
51250
50307
|
//#region src/commands/promote.ts
|
|
51251
|
-
const safeOnUnmount$
|
|
50308
|
+
const safeOnUnmount$2 = async (databasePlugin) => {
|
|
51252
50309
|
try {
|
|
51253
50310
|
await databasePlugin.onUnmount?.();
|
|
51254
50311
|
} catch (err) {
|
|
@@ -51326,14 +50383,14 @@ const handlePromote = async (bundleId, options) => {
|
|
|
51326
50383
|
p.log.info(` ${ui.id(promoted.id)}`);
|
|
51327
50384
|
}
|
|
51328
50385
|
} finally {
|
|
51329
|
-
await safeOnUnmount$
|
|
50386
|
+
await safeOnUnmount$2(databasePlugin);
|
|
51330
50387
|
}
|
|
51331
50388
|
};
|
|
51332
50389
|
//#endregion
|
|
51333
50390
|
//#region src/commands/rollback.ts
|
|
51334
50391
|
const summarizeTarget = (target) => ui.block(`${target.platform}`, [ui.kv("Disable", ui.id(target.bundle.id)), target.fallbackId ? ui.kv("Fallback", ui.id(target.fallbackId)) : ui.kv("Fallback", ui.warning("binary-shipped JS"))]);
|
|
51335
50392
|
const formatRetryHint = (channel, target) => `Re-run with: hot-updater rollback ${channel} -p ${target.platform} --target ${target.bundle.id}`;
|
|
51336
|
-
const safeOnUnmount = async (databasePlugin) => {
|
|
50393
|
+
const safeOnUnmount$1 = async (databasePlugin) => {
|
|
51337
50394
|
try {
|
|
51338
50395
|
await databasePlugin.onUnmount?.();
|
|
51339
50396
|
} catch (err) {
|
|
@@ -51447,10 +50504,329 @@ const handleRollback = async (channel, options = {}) => {
|
|
|
51447
50504
|
process.exit(1);
|
|
51448
50505
|
}
|
|
51449
50506
|
} finally {
|
|
51450
|
-
await safeOnUnmount(databasePlugin);
|
|
50507
|
+
await safeOnUnmount$1(databasePlugin);
|
|
51451
50508
|
}
|
|
51452
50509
|
};
|
|
51453
50510
|
//#endregion
|
|
50511
|
+
//#region src/commands/storage.ts
|
|
50512
|
+
const BUNDLE_PAGE_SIZE = 1e4;
|
|
50513
|
+
const STANDALONE_BUNDLE_PAGE_SIZE = 100;
|
|
50514
|
+
const STANDALONE_DATABASE_NAME = "standalone-repository";
|
|
50515
|
+
const MANIFEST_READ_CONCURRENCY = 4;
|
|
50516
|
+
const UUID_V7_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
50517
|
+
const CONTENT_ADDRESSED_ASSET_KEY_RE = /^assets\/sha256\/[0-9a-f]{2}\/[0-9a-f]{64}(?:\.[^/]+)?$/i;
|
|
50518
|
+
const DEFAULT_STORAGE_PRUNE_PROTECTION_MS = 1440 * 60 * 1e3;
|
|
50519
|
+
function parseStoragePruneProtection(value) {
|
|
50520
|
+
const match = value.trim().match(/^(\d+)(m|h|d|w)$/i);
|
|
50521
|
+
if (!match) throw new Error("must use a duration such as 30m, 24h, or 7d");
|
|
50522
|
+
const amount = Number.parseInt(match[1], 10);
|
|
50523
|
+
const unit = match[2].toLowerCase();
|
|
50524
|
+
return amount * (unit === "m" ? 60 * 1e3 : unit === "h" ? 3600 * 1e3 : unit === "d" ? 1440 * 60 * 1e3 : 10080 * 60 * 1e3);
|
|
50525
|
+
}
|
|
50526
|
+
function formatBytes(value) {
|
|
50527
|
+
if (value < 1024) return `${value} B`;
|
|
50528
|
+
const units = [
|
|
50529
|
+
"KB",
|
|
50530
|
+
"MB",
|
|
50531
|
+
"GB",
|
|
50532
|
+
"TB"
|
|
50533
|
+
];
|
|
50534
|
+
let size = value / 1024;
|
|
50535
|
+
let unitIndex = 0;
|
|
50536
|
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
50537
|
+
size /= 1024;
|
|
50538
|
+
unitIndex += 1;
|
|
50539
|
+
}
|
|
50540
|
+
return `${size.toFixed(size >= 10 ? 1 : 2)} ${units[unitIndex]}`;
|
|
50541
|
+
}
|
|
50542
|
+
function formatDuration(value) {
|
|
50543
|
+
const hour = 3600 * 1e3;
|
|
50544
|
+
const day = 24 * hour;
|
|
50545
|
+
if (value % day === 0) return `${value / day}d`;
|
|
50546
|
+
if (value % hour === 0) return `${value / hour}h`;
|
|
50547
|
+
return `${value / (60 * 1e3)}m`;
|
|
50548
|
+
}
|
|
50549
|
+
const PRUNE_CANDIDATE_COLUMNS = [
|
|
50550
|
+
{
|
|
50551
|
+
key: "type",
|
|
50552
|
+
label: "Type"
|
|
50553
|
+
},
|
|
50554
|
+
{
|
|
50555
|
+
key: "size",
|
|
50556
|
+
label: "Size"
|
|
50557
|
+
},
|
|
50558
|
+
{
|
|
50559
|
+
key: "modified",
|
|
50560
|
+
label: "Modified",
|
|
50561
|
+
format: ui.muted
|
|
50562
|
+
},
|
|
50563
|
+
{
|
|
50564
|
+
key: "key",
|
|
50565
|
+
label: "Key",
|
|
50566
|
+
format: ui.path
|
|
50567
|
+
}
|
|
50568
|
+
];
|
|
50569
|
+
function formatPruneCandidateTable(candidates) {
|
|
50570
|
+
const rows = candidates.map((candidate) => ({
|
|
50571
|
+
key: candidate.key,
|
|
50572
|
+
modified: candidate.lastModifiedAt?.toISOString() ?? "-",
|
|
50573
|
+
size: formatBytes(candidate.size),
|
|
50574
|
+
type: candidate.reason === "asset" ? "shared asset" : "bundle data"
|
|
50575
|
+
}));
|
|
50576
|
+
return ui.table(PRUNE_CANDIDATE_COLUMNS, rows);
|
|
50577
|
+
}
|
|
50578
|
+
function normalizeStorageUri(storageUri) {
|
|
50579
|
+
return new URL(storageUri).toString();
|
|
50580
|
+
}
|
|
50581
|
+
function isLegacyBundleArtifactPath(segments) {
|
|
50582
|
+
const [firstSegment] = segments;
|
|
50583
|
+
return firstSegment === "manifest.json" || firstSegment === "files" || firstSegment === "patches" || firstSegment !== void 0 && /^bundle(?:\..+)?$/.test(firstSegment);
|
|
50584
|
+
}
|
|
50585
|
+
function getBundleIdFromStorageKey(key) {
|
|
50586
|
+
const segments = key.split("/").filter(Boolean);
|
|
50587
|
+
if (segments[0] === BUNDLE_STORAGE_PREFIX) {
|
|
50588
|
+
const bundleId = segments[1];
|
|
50589
|
+
return bundleId && UUID_V7_RE.test(bundleId) ? bundleId.toLowerCase() : null;
|
|
50590
|
+
}
|
|
50591
|
+
const bundleId = segments[0];
|
|
50592
|
+
return bundleId && UUID_V7_RE.test(bundleId) && isLegacyBundleArtifactPath(segments.slice(1)) ? bundleId.toLowerCase() : null;
|
|
50593
|
+
}
|
|
50594
|
+
function isBundleManifest(value, bundleId) {
|
|
50595
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
50596
|
+
const candidate = value;
|
|
50597
|
+
if (candidate.bundleId !== bundleId) return false;
|
|
50598
|
+
const assets = candidate.assets;
|
|
50599
|
+
if (!assets || typeof assets !== "object" || Array.isArray(assets)) return false;
|
|
50600
|
+
return Object.values(assets).every((asset) => {
|
|
50601
|
+
return asset !== null && typeof asset === "object" && !Array.isArray(asset) && typeof asset.fileHash === "string" && /^[0-9a-f]{64}$/i.test(asset.fileHash);
|
|
50602
|
+
});
|
|
50603
|
+
}
|
|
50604
|
+
async function forEachWithConcurrency(values, concurrency, callback) {
|
|
50605
|
+
let nextIndex = 0;
|
|
50606
|
+
const workers = Array.from({ length: Math.min(concurrency, values.length) }, async () => {
|
|
50607
|
+
while (nextIndex < values.length) {
|
|
50608
|
+
const index = nextIndex;
|
|
50609
|
+
nextIndex += 1;
|
|
50610
|
+
const value = values[index];
|
|
50611
|
+
if (value === void 0) return;
|
|
50612
|
+
await callback(value, index);
|
|
50613
|
+
}
|
|
50614
|
+
});
|
|
50615
|
+
const failure = (await Promise.allSettled(workers)).find((result) => result.status === "rejected");
|
|
50616
|
+
if (failure) throw failure.reason;
|
|
50617
|
+
}
|
|
50618
|
+
async function loadAllBundles(databasePlugin) {
|
|
50619
|
+
const bundles = [];
|
|
50620
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
50621
|
+
const pageSize = databasePlugin.name === STANDALONE_DATABASE_NAME ? STANDALONE_BUNDLE_PAGE_SIZE : BUNDLE_PAGE_SIZE;
|
|
50622
|
+
let after;
|
|
50623
|
+
while (true) {
|
|
50624
|
+
const { data, pagination } = await databasePlugin.getBundles({
|
|
50625
|
+
cursor: after ? { after } : void 0,
|
|
50626
|
+
limit: pageSize,
|
|
50627
|
+
orderBy: {
|
|
50628
|
+
direction: "desc",
|
|
50629
|
+
field: "id"
|
|
50630
|
+
}
|
|
50631
|
+
});
|
|
50632
|
+
bundles.push(...data);
|
|
50633
|
+
const nextCursor = pagination.nextCursor ?? void 0;
|
|
50634
|
+
if (pagination.hasNextPage && !nextCursor) throw new Error("Database cannot provide safe cursor pagination for storage prune.");
|
|
50635
|
+
if (!nextCursor) return bundles;
|
|
50636
|
+
if (seenCursors.has(nextCursor)) throw new Error(`Database returned a repeated cursor: ${nextCursor}`);
|
|
50637
|
+
seenCursors.add(nextCursor);
|
|
50638
|
+
after = nextCursor;
|
|
50639
|
+
}
|
|
50640
|
+
}
|
|
50641
|
+
async function readManifest(bundle, storagePlugin, workDir, index) {
|
|
50642
|
+
const manifestStorageUri = getManifestStorageUri(bundle);
|
|
50643
|
+
if (!manifestStorageUri) throw new Error(`Cannot prune shared assets: bundle ${bundle.id} has no manifest URI.`);
|
|
50644
|
+
const protocol = new URL(manifestStorageUri).protocol.replace(":", "");
|
|
50645
|
+
let manifestText;
|
|
50646
|
+
if (protocol === "http" || protocol === "https") {
|
|
50647
|
+
const response = await fetch(manifestStorageUri);
|
|
50648
|
+
if (!response.ok) throw new Error(`Cannot prune shared assets: failed to read manifest for bundle ${bundle.id}.`);
|
|
50649
|
+
manifestText = await response.text();
|
|
50650
|
+
} else {
|
|
50651
|
+
if (protocol !== storagePlugin.supportedProtocol) throw new Error(`No storage plugin for protocol: ${protocol}`);
|
|
50652
|
+
const manifestPath = path$1.join(workDir, `${index}.json`);
|
|
50653
|
+
try {
|
|
50654
|
+
await storagePlugin.profiles.node.downloadFile(manifestStorageUri, manifestPath);
|
|
50655
|
+
manifestText = await fs$1.readFile(manifestPath, "utf8");
|
|
50656
|
+
} catch (error) {
|
|
50657
|
+
throw new Error(`Cannot prune shared assets: failed to read manifest for bundle ${bundle.id}.`, { cause: error });
|
|
50658
|
+
}
|
|
50659
|
+
}
|
|
50660
|
+
let manifest;
|
|
50661
|
+
try {
|
|
50662
|
+
manifest = JSON.parse(manifestText);
|
|
50663
|
+
} catch (error) {
|
|
50664
|
+
throw new Error(`Cannot prune shared assets: invalid manifest for bundle ${bundle.id}.`, { cause: error });
|
|
50665
|
+
}
|
|
50666
|
+
if (!isBundleManifest(manifest, bundle.id)) throw new Error(`Cannot prune shared assets: invalid manifest for bundle ${bundle.id}.`);
|
|
50667
|
+
return manifest;
|
|
50668
|
+
}
|
|
50669
|
+
async function collectReferencedAssetUris(bundles, storagePlugin) {
|
|
50670
|
+
const bundlesWithSharedAssets = bundles.filter((bundle) => {
|
|
50671
|
+
const assetBaseStorageUri = getAssetBaseStorageUri(bundle);
|
|
50672
|
+
if (assetBaseStorageUri === null || !isContentAddressedAssetBaseStorageUri(assetBaseStorageUri)) return false;
|
|
50673
|
+
const protocol = new URL(assetBaseStorageUri).protocol.replace(":", "");
|
|
50674
|
+
if (protocol !== storagePlugin.supportedProtocol) throw new Error(`Cannot prune shared assets: bundle ${bundle.id} uses ${protocol} asset storage, but the configured storage plugin uses ${storagePlugin.supportedProtocol}.`);
|
|
50675
|
+
return true;
|
|
50676
|
+
});
|
|
50677
|
+
const referencedUris = /* @__PURE__ */ new Set();
|
|
50678
|
+
if (bundlesWithSharedAssets.length === 0) return {
|
|
50679
|
+
manifestCount: 0,
|
|
50680
|
+
referencedUris
|
|
50681
|
+
};
|
|
50682
|
+
const workDir = await fs$1.mkdtemp(path$1.join(os.tmpdir(), "hot-updater-storage-prune-"));
|
|
50683
|
+
try {
|
|
50684
|
+
await forEachWithConcurrency(bundlesWithSharedAssets, MANIFEST_READ_CONCURRENCY, async (bundle, index) => {
|
|
50685
|
+
const assetBaseStorageUri = getAssetBaseStorageUri(bundle);
|
|
50686
|
+
const manifest = await readManifest(bundle, storagePlugin, workDir, index);
|
|
50687
|
+
for (const [assetPath, asset] of Object.entries(manifest.assets)) {
|
|
50688
|
+
const downloadPath = getManifestAssetDownloadPath(assetPath);
|
|
50689
|
+
referencedUris.add(normalizeStorageUri(resolveManifestAssetStorageUri({
|
|
50690
|
+
assetBaseStorageUri,
|
|
50691
|
+
assetPath: downloadPath,
|
|
50692
|
+
fileHash: asset.fileHash
|
|
50693
|
+
})));
|
|
50694
|
+
}
|
|
50695
|
+
});
|
|
50696
|
+
} finally {
|
|
50697
|
+
await fs$1.rm(workDir, {
|
|
50698
|
+
force: true,
|
|
50699
|
+
recursive: true
|
|
50700
|
+
});
|
|
50701
|
+
}
|
|
50702
|
+
return {
|
|
50703
|
+
manifestCount: bundlesWithSharedAssets.length,
|
|
50704
|
+
referencedUris
|
|
50705
|
+
};
|
|
50706
|
+
}
|
|
50707
|
+
function collectBundleStorageReferences(bundles) {
|
|
50708
|
+
const exactUris = /* @__PURE__ */ new Set();
|
|
50709
|
+
const prefixUris = /* @__PURE__ */ new Set();
|
|
50710
|
+
const addExactUri = (storageUri) => {
|
|
50711
|
+
if (storageUri) exactUris.add(normalizeStorageUri(storageUri));
|
|
50712
|
+
};
|
|
50713
|
+
for (const bundle of bundles) {
|
|
50714
|
+
addExactUri(bundle.storageUri);
|
|
50715
|
+
addExactUri(getManifestStorageUri(bundle));
|
|
50716
|
+
addExactUri(getPatchStorageUri(bundle));
|
|
50717
|
+
for (const patch of getBundlePatches(bundle)) addExactUri(patch.patchStorageUri);
|
|
50718
|
+
const assetBaseStorageUri = getAssetBaseStorageUri(bundle);
|
|
50719
|
+
if (assetBaseStorageUri && !isContentAddressedAssetBaseStorageUri(assetBaseStorageUri)) prefixUris.add(`${normalizeStorageUri(assetBaseStorageUri).replace(/\/+$/, "")}/`);
|
|
50720
|
+
}
|
|
50721
|
+
return {
|
|
50722
|
+
exactUris,
|
|
50723
|
+
prefixUris: [...prefixUris]
|
|
50724
|
+
};
|
|
50725
|
+
}
|
|
50726
|
+
function getPruneCandidates({ bundleStorageReferences, objects, liveBundleIds, referencedAssetUris }) {
|
|
50727
|
+
const candidates = [];
|
|
50728
|
+
for (const object of objects) {
|
|
50729
|
+
const normalizedStorageUri = normalizeStorageUri(object.storageUri);
|
|
50730
|
+
if (bundleStorageReferences.exactUris.has(normalizedStorageUri) || bundleStorageReferences.prefixUris.some((prefix) => normalizedStorageUri.startsWith(prefix))) continue;
|
|
50731
|
+
const bundleId = getBundleIdFromStorageKey(object.key);
|
|
50732
|
+
if (bundleId && !liveBundleIds.has(bundleId)) {
|
|
50733
|
+
candidates.push({
|
|
50734
|
+
...object,
|
|
50735
|
+
reason: "bundle"
|
|
50736
|
+
});
|
|
50737
|
+
continue;
|
|
50738
|
+
}
|
|
50739
|
+
if (CONTENT_ADDRESSED_ASSET_KEY_RE.test(object.key) && !referencedAssetUris.has(normalizedStorageUri)) candidates.push({
|
|
50740
|
+
...object,
|
|
50741
|
+
reason: "asset"
|
|
50742
|
+
});
|
|
50743
|
+
}
|
|
50744
|
+
return candidates;
|
|
50745
|
+
}
|
|
50746
|
+
async function safeOnUnmount(databasePlugin) {
|
|
50747
|
+
try {
|
|
50748
|
+
await databasePlugin.onUnmount?.();
|
|
50749
|
+
} catch (error) {
|
|
50750
|
+
p.log.warn(`Database plugin onUnmount failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
50751
|
+
}
|
|
50752
|
+
}
|
|
50753
|
+
async function handleStoragePrune(options = {}) {
|
|
50754
|
+
printBanner$1();
|
|
50755
|
+
if (options.dryRun && options.yes) throw new Error("Storage prune --dry-run cannot be used with --yes.");
|
|
50756
|
+
const protectNewerThan = options.protectNewerThan ?? 864e5;
|
|
50757
|
+
if (!Number.isFinite(protectNewerThan) || protectNewerThan < 0) throw new Error("Storage prune protection must be a non-negative duration.");
|
|
50758
|
+
const config = await loadConfig(null);
|
|
50759
|
+
const [databasePlugin, loadedStoragePlugin] = await Promise.all([config.database(), config.storage()]);
|
|
50760
|
+
assertNodeStoragePlugin(loadedStoragePlugin);
|
|
50761
|
+
const storagePlugin = loadedStoragePlugin;
|
|
50762
|
+
try {
|
|
50763
|
+
const listObjects = storagePlugin.profiles.node.listObjects;
|
|
50764
|
+
if (!listObjects) throw new Error(`Storage plugin "${storagePlugin.name}" does not support storage prune.`);
|
|
50765
|
+
const deleteObjects = storagePlugin.profiles.node.deleteObjects;
|
|
50766
|
+
if (options.yes && !deleteObjects) throw new Error(`Storage plugin "${storagePlugin.name}" does not support exact object deletion.`);
|
|
50767
|
+
if (options.yes) {
|
|
50768
|
+
p.log.warn("Storage prune requires exclusive access. Stop deploy and promote operations first.");
|
|
50769
|
+
p.log.warn("The current database must own every object under this storage prefix. Use a separate storage basePath for each database or environment.");
|
|
50770
|
+
}
|
|
50771
|
+
const bundles = await loadAllBundles(databasePlugin);
|
|
50772
|
+
const liveBundleIds = new Set(bundles.map((bundle) => bundle.id.toLowerCase()));
|
|
50773
|
+
const bundleStorageReferences = collectBundleStorageReferences(bundles);
|
|
50774
|
+
const { manifestCount, referencedUris } = await collectReferencedAssetUris(bundles, storagePlugin);
|
|
50775
|
+
const objects = await listObjects();
|
|
50776
|
+
const unreferenced = getPruneCandidates({
|
|
50777
|
+
bundleStorageReferences,
|
|
50778
|
+
liveBundleIds,
|
|
50779
|
+
objects,
|
|
50780
|
+
referencedAssetUris: referencedUris
|
|
50781
|
+
});
|
|
50782
|
+
const cutoff = Date.now() - protectNewerThan;
|
|
50783
|
+
let candidates = unreferenced.filter((object) => {
|
|
50784
|
+
const modifiedAt = object.lastModifiedAt?.getTime();
|
|
50785
|
+
return modifiedAt !== void 0 && modifiedAt <= cutoff;
|
|
50786
|
+
});
|
|
50787
|
+
if (options.yes && candidates.length > 0) {
|
|
50788
|
+
const refreshedBundles = await loadAllBundles(databasePlugin);
|
|
50789
|
+
const refreshedBundleIds = new Set(refreshedBundles.map((bundle) => bundle.id.toLowerCase()));
|
|
50790
|
+
const refreshedBundleStorageReferences = collectBundleStorageReferences(refreshedBundles);
|
|
50791
|
+
const { referencedUris: refreshedReferencedUris } = await collectReferencedAssetUris(refreshedBundles, storagePlugin);
|
|
50792
|
+
candidates = getPruneCandidates({
|
|
50793
|
+
bundleStorageReferences: refreshedBundleStorageReferences,
|
|
50794
|
+
liveBundleIds: refreshedBundleIds,
|
|
50795
|
+
objects: candidates,
|
|
50796
|
+
referencedAssetUris: refreshedReferencedUris
|
|
50797
|
+
});
|
|
50798
|
+
}
|
|
50799
|
+
const protectedCount = unreferenced.length - candidates.length;
|
|
50800
|
+
const bundleObjects = candidates.filter((candidate) => candidate.reason === "bundle");
|
|
50801
|
+
const assetObjects = candidates.filter((candidate) => candidate.reason === "asset");
|
|
50802
|
+
const candidateBytes = candidates.reduce((total, candidate) => total + candidate.size, 0);
|
|
50803
|
+
p.log.message(ui.block("Storage prune", [
|
|
50804
|
+
ui.kv("Storage", storagePlugin.name),
|
|
50805
|
+
ui.kv("Bundles", bundles.length),
|
|
50806
|
+
ui.kv("Manifests", manifestCount),
|
|
50807
|
+
ui.kv("Objects", objects.length),
|
|
50808
|
+
ui.kv("Protect newer", formatDuration(protectNewerThan)),
|
|
50809
|
+
ui.kv("Bundle data", bundleObjects.length),
|
|
50810
|
+
ui.kv("Shared assets", assetObjects.length),
|
|
50811
|
+
ui.kv("Reclaimable", formatBytes(candidateBytes)),
|
|
50812
|
+
protectedCount > 0 ? ui.kv("Protected", `${protectedCount} newer/undated objects`) : null
|
|
50813
|
+
].filter((line) => line !== null)));
|
|
50814
|
+
if (candidates.length === 0) {
|
|
50815
|
+
p.log.success("No objects are eligible for pruning.");
|
|
50816
|
+
return;
|
|
50817
|
+
}
|
|
50818
|
+
if (!options.yes) {
|
|
50819
|
+
p.log.message(ui.block("Eligible objects", [formatPruneCandidateTable(candidates)]));
|
|
50820
|
+
p.log.info(`Dry run only. Delete with ${ui.command(`hot-updater storage prune --protect-newer-than ${formatDuration(protectNewerThan)} --yes`)}.`);
|
|
50821
|
+
return;
|
|
50822
|
+
}
|
|
50823
|
+
await deleteObjects(candidates.map((candidate) => candidate.key));
|
|
50824
|
+
p.log.success(`Pruned ${candidates.length} objects (${formatBytes(candidateBytes)}).`);
|
|
50825
|
+
} finally {
|
|
50826
|
+
await safeOnUnmount(databasePlugin);
|
|
50827
|
+
}
|
|
50828
|
+
}
|
|
50829
|
+
//#endregion
|
|
51454
50830
|
//#region src/index.ts
|
|
51455
50831
|
const DEFAULT_CHANNEL = "production";
|
|
51456
50832
|
const parseBooleanOption = (value) => {
|
|
@@ -51478,7 +50854,7 @@ const channelCommand = program.command("channel").description("Manage channels")
|
|
|
51478
50854
|
channelCommand.action(handleChannel);
|
|
51479
50855
|
channelCommand.command("set").description("Set the channel for Android (BuildConfig) and iOS (Info.plist)").argument("<channel>", "the channel to set").action(handleSetChannel);
|
|
51480
50856
|
const bundleCommand = program.command("bundle").description("Manage bundles");
|
|
51481
|
-
bundleCommand.command("list").description("List bundles, most recent first").option("-c, --channel <channel>", "filter by channel").option("--json", "output raw bundle data as JSON").addOption(platformCommandOption).option("--limit <n>", "limit the number of results", (value) => {
|
|
50857
|
+
bundleCommand.command("list").description("List bundles, most recent first").option("-c, --channel <channel>", "filter by channel").option("--target-app-version <targetAppVersion>", "filter by exact target app version").option("--json", "output raw bundle data as JSON").addOption(platformCommandOption).option("--limit <n>", "limit the number of results", (value) => {
|
|
51482
50858
|
const n = Number.parseInt(value, 10);
|
|
51483
50859
|
if (!Number.isInteger(n) || n <= 0) throw new InvalidArgumentError("must be a positive integer");
|
|
51484
50860
|
return n;
|
|
@@ -51489,6 +50865,21 @@ bundleCommand.command("enable").description("Re-enable a previously disabled bun
|
|
|
51489
50865
|
bundleCommand.command("update").description("Update bundle rollout and targeting metadata").argument("<bundle-id>", "the bundle id to update").option("--rollout-cohort-count <count>", "rollout cohort count from 0 to 1000", parseRolloutCohortCount).option("--force-update <value>", "set force update flag (true or false)", parseBooleanOption).option("--target-cohorts <cohorts>", "comma-separated target cohorts").option("--clear-target-cohorts", "clear target cohorts").option("--json", "output the updated bundle as JSON").option("-y, --yes", "skip confirmation prompt").action(handleBundleUpdate);
|
|
51490
50866
|
bundleCommand.command("delete").description("Delete one or more bundle records by id").argument("<bundle-ids...>", "the bundle id(s) to delete").option("-y, --yes", "skip confirmation prompt").action((bundleIds, options) => handleBundleDelete(bundleIds, options));
|
|
51491
50867
|
bundleCommand.command("promote").description("Move or copy a bundle to a different channel").argument("<bundle-id>", "the id of the bundle to promote").requiredOption("-t, --target <channel>", "channel to promote the bundle to").addOption(new Option("-a, --action <action>", "promote action (copy creates a new bundle id; move keeps the id)").choices(["copy", "move"]).default("copy")).option("-y, --yes", "skip confirmation prompt").action((bundleId, options) => handlePromote(bundleId, options));
|
|
50868
|
+
program.command("storage").description("Manage stored bundle artifacts").command("prune").description("Find or delete unreferenced bundle objects and shared assets").addOption(new Option("--protect-newer-than <duration>", "protect unreferenced objects modified within this duration").argParser((value) => {
|
|
50869
|
+
try {
|
|
50870
|
+
return parseStoragePruneProtection(value);
|
|
50871
|
+
} catch (error) {
|
|
50872
|
+
throw new InvalidArgumentError(error instanceof Error ? error.message : String(error));
|
|
50873
|
+
}
|
|
50874
|
+
}).default(DEFAULT_STORAGE_PRUNE_PROTECTION_MS, "24h")).addOption(new Option("--dry-run", "list eligible objects without deleting them (default)").conflicts("yes")).addOption(new Option("-y, --yes", "delete eligible objects after reference validation").conflicts("dryRun")).addHelpText("after", `
|
|
50875
|
+
Examples:
|
|
50876
|
+
$ hot-updater storage prune --dry-run
|
|
50877
|
+
$ hot-updater storage prune --protect-newer-than 24h --yes
|
|
50878
|
+
|
|
50879
|
+
Only unreferenced bundle objects and shared assets are eligible.
|
|
50880
|
+
Protection uses object modification time, not time since bundle deletion.
|
|
50881
|
+
Deletion requires exclusive storage access; stop deploy and promote first.
|
|
50882
|
+
`).action((options) => handleStoragePrune(options));
|
|
51492
50883
|
const keysCommand = program.command("keys").description("Code signing key management");
|
|
51493
50884
|
keysCommand.command("generate").description("Generate RSA key pair for code signing").option("-o, --output <dir>", "output directory for keys", "./keys").option("-k, --key-size <size>", "key size (2048 or 4096)", (value) => {
|
|
51494
50885
|
const size = Number.parseInt(value, 10);
|
|
@@ -51501,7 +50892,7 @@ keysCommand.command("generate").description("Generate RSA key pair for code sign
|
|
|
51501
50892
|
keysCommand.command("export-public").description("Export public key for native configuration").option("-i, --input <path>", "path to private key file (default: from config signing.privateKeyPath in hot-updater.config.ts)").option("-p, --print-only", "only print the public key without writing to native files").option("-y, --yes", "skip confirmation prompt when writing to native files").action(keysExportPublic);
|
|
51502
50893
|
keysCommand.command("remove").description("Remove public keys from native configuration files").option("-y, --yes", "skip confirmation prompt").action(keysRemove);
|
|
51503
50894
|
program.command("deploy").description("deploy a new version").addOption(platformCommandOption).addOption(new Option("-t, --target-app-version <targetAppVersion>", "specify the target app version (semver format e.g. 1.0.0, 1.x.x)").argParser((value) => {
|
|
51504
|
-
if (!(
|
|
50895
|
+
if (!normalizeRange(value)) {
|
|
51505
50896
|
p.log.error("Invalid semver format (e.g. 1.0.0, 1.x.x)");
|
|
51506
50897
|
process.exit(1);
|
|
51507
50898
|
}
|