@zoralabs/protocol-sdk 0.7.3-SPARKS.0 → 0.7.4
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/.turbo/turbo-build.log +18 -0
- package/CHANGELOG.md +17 -4
- package/LICENSE +21 -0
- package/dist/anvil.d.ts +2 -2
- package/dist/anvil.d.ts.map +1 -1
- package/dist/apis/http-api-base.d.ts.map +1 -1
- package/dist/index.cjs +2265 -319
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2289 -320
- package/dist/index.js.map +1 -1
- package/dist/ipfs/token-metadata.d.ts.map +1 -1
- package/dist/mint/mint-client.d.ts +1 -1
- package/dist/mint/mint-queries.d.ts +1 -1
- package/dist/mint/types.d.ts.map +1 -1
- package/dist/mints/mints-contracts.d.ts +1 -1
- package/dist/mints/mints-contracts.d.ts.map +1 -1
- package/dist/mints/mints-eth-unwrapper-and-caller.d.ts.map +1 -1
- package/dist/mints/mints-queries.d.ts.map +1 -1
- package/dist/mints/mints-relay-example.d.ts +7 -7
- package/dist/mints/mints-relay-example.d.ts.map +1 -1
- package/dist/premint/conversions.d.ts +5 -5
- package/dist/premint/conversions.d.ts.map +1 -1
- package/dist/premint/premint-api-client.d.ts +1 -1
- package/dist/premint/premint-api-client.d.ts.map +1 -1
- package/dist/premint/premint-client.d.ts +4 -4
- package/dist/premint/premint-client.d.ts.map +1 -1
- package/dist/premint/preminter.d.ts +3 -3
- package/dist/premint/preminter.d.ts.map +1 -1
- package/dist/preminter.d.ts +2 -2
- package/dist/preminter.d.ts.map +1 -1
- package/dist/test-utils.d.ts.map +1 -1
- package/package.json +21 -16
- package/src/create/1155-create-helper.test.ts +325 -0
- package/src/mint/mint-client.test.ts +263 -0
- package/src/mints/mints-contracts.test.ts +529 -0
- package/src/mints/mints-eth-unwrapper-and-caller.test.ts +467 -0
- package/src/mints/mints-eth-unwrapper-and-caller.ts +2 -2
- package/src/mints/mints-queries.test.ts +105 -0
- package/src/mints/mints-relay-example.ts +22 -13
- package/src/premint/premint-client.test.ts +290 -0
- package/src/premint/preminter.test.ts +866 -0
- package/test-integration/setup-test-contracts.ts +96 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +1 -1
- package/tsup.config.ts +12 -0
- package/yarn-error.log +0 -8602
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
+
};
|
|
8
12
|
var __export = (target, all) => {
|
|
9
13
|
for (var name in all)
|
|
10
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -26,6 +30,1898 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
30
|
mod
|
|
27
31
|
));
|
|
28
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
33
|
+
var __publicField = (obj, key, value) => {
|
|
34
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
35
|
+
return value;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js
|
|
39
|
+
var require_constants = __commonJS({
|
|
40
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/constants.js"(exports2, module2) {
|
|
41
|
+
"use strict";
|
|
42
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
43
|
+
var MAX_LENGTH = 256;
|
|
44
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
45
|
+
9007199254740991;
|
|
46
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
47
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
48
|
+
var RELEASE_TYPES = [
|
|
49
|
+
"major",
|
|
50
|
+
"premajor",
|
|
51
|
+
"minor",
|
|
52
|
+
"preminor",
|
|
53
|
+
"patch",
|
|
54
|
+
"prepatch",
|
|
55
|
+
"prerelease"
|
|
56
|
+
];
|
|
57
|
+
module2.exports = {
|
|
58
|
+
MAX_LENGTH,
|
|
59
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
60
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
61
|
+
MAX_SAFE_INTEGER,
|
|
62
|
+
RELEASE_TYPES,
|
|
63
|
+
SEMVER_SPEC_VERSION,
|
|
64
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
65
|
+
FLAG_LOOSE: 2
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js
|
|
71
|
+
var require_debug = __commonJS({
|
|
72
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/debug.js"(exports2, module2) {
|
|
73
|
+
"use strict";
|
|
74
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
|
75
|
+
};
|
|
76
|
+
module2.exports = debug;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js
|
|
81
|
+
var require_re = __commonJS({
|
|
82
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/re.js"(exports2, module2) {
|
|
83
|
+
"use strict";
|
|
84
|
+
var {
|
|
85
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
86
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
87
|
+
MAX_LENGTH
|
|
88
|
+
} = require_constants();
|
|
89
|
+
var debug = require_debug();
|
|
90
|
+
exports2 = module2.exports = {};
|
|
91
|
+
var re = exports2.re = [];
|
|
92
|
+
var safeRe = exports2.safeRe = [];
|
|
93
|
+
var src2 = exports2.src = [];
|
|
94
|
+
var t = exports2.t = {};
|
|
95
|
+
var R = 0;
|
|
96
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
97
|
+
var safeRegexReplacements = [
|
|
98
|
+
["\\s", 1],
|
|
99
|
+
["\\d", MAX_LENGTH],
|
|
100
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
101
|
+
];
|
|
102
|
+
var makeSafeRegex = (value) => {
|
|
103
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
104
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
105
|
+
}
|
|
106
|
+
return value;
|
|
107
|
+
};
|
|
108
|
+
var createToken = (name, value, isGlobal) => {
|
|
109
|
+
const safe = makeSafeRegex(value);
|
|
110
|
+
const index = R++;
|
|
111
|
+
debug(name, index, value);
|
|
112
|
+
t[name] = index;
|
|
113
|
+
src2[index] = value;
|
|
114
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
115
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
116
|
+
};
|
|
117
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
118
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
119
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
120
|
+
createToken("MAINVERSION", `(${src2[t.NUMERICIDENTIFIER]})\\.(${src2[t.NUMERICIDENTIFIER]})\\.(${src2[t.NUMERICIDENTIFIER]})`);
|
|
121
|
+
createToken("MAINVERSIONLOOSE", `(${src2[t.NUMERICIDENTIFIERLOOSE]})\\.(${src2[t.NUMERICIDENTIFIERLOOSE]})\\.(${src2[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
122
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src2[t.NUMERICIDENTIFIER]}|${src2[t.NONNUMERICIDENTIFIER]})`);
|
|
123
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src2[t.NUMERICIDENTIFIERLOOSE]}|${src2[t.NONNUMERICIDENTIFIER]})`);
|
|
124
|
+
createToken("PRERELEASE", `(?:-(${src2[t.PRERELEASEIDENTIFIER]}(?:\\.${src2[t.PRERELEASEIDENTIFIER]})*))`);
|
|
125
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src2[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src2[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
126
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
127
|
+
createToken("BUILD", `(?:\\+(${src2[t.BUILDIDENTIFIER]}(?:\\.${src2[t.BUILDIDENTIFIER]})*))`);
|
|
128
|
+
createToken("FULLPLAIN", `v?${src2[t.MAINVERSION]}${src2[t.PRERELEASE]}?${src2[t.BUILD]}?`);
|
|
129
|
+
createToken("FULL", `^${src2[t.FULLPLAIN]}$`);
|
|
130
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src2[t.MAINVERSIONLOOSE]}${src2[t.PRERELEASELOOSE]}?${src2[t.BUILD]}?`);
|
|
131
|
+
createToken("LOOSE", `^${src2[t.LOOSEPLAIN]}$`);
|
|
132
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
133
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src2[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
134
|
+
createToken("XRANGEIDENTIFIER", `${src2[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
135
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src2[t.XRANGEIDENTIFIER]})(?:\\.(${src2[t.XRANGEIDENTIFIER]})(?:\\.(${src2[t.XRANGEIDENTIFIER]})(?:${src2[t.PRERELEASE]})?${src2[t.BUILD]}?)?)?`);
|
|
136
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src2[t.XRANGEIDENTIFIERLOOSE]})(?:${src2[t.PRERELEASELOOSE]})?${src2[t.BUILD]}?)?)?`);
|
|
137
|
+
createToken("XRANGE", `^${src2[t.GTLT]}\\s*${src2[t.XRANGEPLAIN]}$`);
|
|
138
|
+
createToken("XRANGELOOSE", `^${src2[t.GTLT]}\\s*${src2[t.XRANGEPLAINLOOSE]}$`);
|
|
139
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
140
|
+
createToken("COERCE", `${src2[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
141
|
+
createToken("COERCEFULL", src2[t.COERCEPLAIN] + `(?:${src2[t.PRERELEASE]})?(?:${src2[t.BUILD]})?(?:$|[^\\d])`);
|
|
142
|
+
createToken("COERCERTL", src2[t.COERCE], true);
|
|
143
|
+
createToken("COERCERTLFULL", src2[t.COERCEFULL], true);
|
|
144
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
145
|
+
createToken("TILDETRIM", `(\\s*)${src2[t.LONETILDE]}\\s+`, true);
|
|
146
|
+
exports2.tildeTrimReplace = "$1~";
|
|
147
|
+
createToken("TILDE", `^${src2[t.LONETILDE]}${src2[t.XRANGEPLAIN]}$`);
|
|
148
|
+
createToken("TILDELOOSE", `^${src2[t.LONETILDE]}${src2[t.XRANGEPLAINLOOSE]}$`);
|
|
149
|
+
createToken("LONECARET", "(?:\\^)");
|
|
150
|
+
createToken("CARETTRIM", `(\\s*)${src2[t.LONECARET]}\\s+`, true);
|
|
151
|
+
exports2.caretTrimReplace = "$1^";
|
|
152
|
+
createToken("CARET", `^${src2[t.LONECARET]}${src2[t.XRANGEPLAIN]}$`);
|
|
153
|
+
createToken("CARETLOOSE", `^${src2[t.LONECARET]}${src2[t.XRANGEPLAINLOOSE]}$`);
|
|
154
|
+
createToken("COMPARATORLOOSE", `^${src2[t.GTLT]}\\s*(${src2[t.LOOSEPLAIN]})$|^$`);
|
|
155
|
+
createToken("COMPARATOR", `^${src2[t.GTLT]}\\s*(${src2[t.FULLPLAIN]})$|^$`);
|
|
156
|
+
createToken("COMPARATORTRIM", `(\\s*)${src2[t.GTLT]}\\s*(${src2[t.LOOSEPLAIN]}|${src2[t.XRANGEPLAIN]})`, true);
|
|
157
|
+
exports2.comparatorTrimReplace = "$1$2$3";
|
|
158
|
+
createToken("HYPHENRANGE", `^\\s*(${src2[t.XRANGEPLAIN]})\\s+-\\s+(${src2[t.XRANGEPLAIN]})\\s*$`);
|
|
159
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src2[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src2[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
160
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
161
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
162
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/parse-options.js
|
|
167
|
+
var require_parse_options = __commonJS({
|
|
168
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/parse-options.js"(exports2, module2) {
|
|
169
|
+
"use strict";
|
|
170
|
+
var looseOption = Object.freeze({ loose: true });
|
|
171
|
+
var emptyOpts = Object.freeze({});
|
|
172
|
+
var parseOptions = (options) => {
|
|
173
|
+
if (!options) {
|
|
174
|
+
return emptyOpts;
|
|
175
|
+
}
|
|
176
|
+
if (typeof options !== "object") {
|
|
177
|
+
return looseOption;
|
|
178
|
+
}
|
|
179
|
+
return options;
|
|
180
|
+
};
|
|
181
|
+
module2.exports = parseOptions;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/identifiers.js
|
|
186
|
+
var require_identifiers = __commonJS({
|
|
187
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/identifiers.js"(exports2, module2) {
|
|
188
|
+
"use strict";
|
|
189
|
+
var numeric = /^[0-9]+$/;
|
|
190
|
+
var compareIdentifiers = (a, b) => {
|
|
191
|
+
const anum = numeric.test(a);
|
|
192
|
+
const bnum = numeric.test(b);
|
|
193
|
+
if (anum && bnum) {
|
|
194
|
+
a = +a;
|
|
195
|
+
b = +b;
|
|
196
|
+
}
|
|
197
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
198
|
+
};
|
|
199
|
+
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
200
|
+
module2.exports = {
|
|
201
|
+
compareIdentifiers,
|
|
202
|
+
rcompareIdentifiers
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js
|
|
208
|
+
var require_semver = __commonJS({
|
|
209
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/semver.js"(exports2, module2) {
|
|
210
|
+
"use strict";
|
|
211
|
+
var debug = require_debug();
|
|
212
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
213
|
+
var { safeRe: re, t } = require_re();
|
|
214
|
+
var parseOptions = require_parse_options();
|
|
215
|
+
var { compareIdentifiers } = require_identifiers();
|
|
216
|
+
var SemVer = class _SemVer {
|
|
217
|
+
constructor(version, options) {
|
|
218
|
+
options = parseOptions(options);
|
|
219
|
+
if (version instanceof _SemVer) {
|
|
220
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
221
|
+
return version;
|
|
222
|
+
} else {
|
|
223
|
+
version = version.version;
|
|
224
|
+
}
|
|
225
|
+
} else if (typeof version !== "string") {
|
|
226
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
227
|
+
}
|
|
228
|
+
if (version.length > MAX_LENGTH) {
|
|
229
|
+
throw new TypeError(
|
|
230
|
+
`version is longer than ${MAX_LENGTH} characters`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
debug("SemVer", version, options);
|
|
234
|
+
this.options = options;
|
|
235
|
+
this.loose = !!options.loose;
|
|
236
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
237
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
238
|
+
if (!m) {
|
|
239
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
240
|
+
}
|
|
241
|
+
this.raw = version;
|
|
242
|
+
this.major = +m[1];
|
|
243
|
+
this.minor = +m[2];
|
|
244
|
+
this.patch = +m[3];
|
|
245
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
246
|
+
throw new TypeError("Invalid major version");
|
|
247
|
+
}
|
|
248
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
249
|
+
throw new TypeError("Invalid minor version");
|
|
250
|
+
}
|
|
251
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
252
|
+
throw new TypeError("Invalid patch version");
|
|
253
|
+
}
|
|
254
|
+
if (!m[4]) {
|
|
255
|
+
this.prerelease = [];
|
|
256
|
+
} else {
|
|
257
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
258
|
+
if (/^[0-9]+$/.test(id)) {
|
|
259
|
+
const num = +id;
|
|
260
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
261
|
+
return num;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return id;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
268
|
+
this.format();
|
|
269
|
+
}
|
|
270
|
+
format() {
|
|
271
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
272
|
+
if (this.prerelease.length) {
|
|
273
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
274
|
+
}
|
|
275
|
+
return this.version;
|
|
276
|
+
}
|
|
277
|
+
toString() {
|
|
278
|
+
return this.version;
|
|
279
|
+
}
|
|
280
|
+
compare(other) {
|
|
281
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
282
|
+
if (!(other instanceof _SemVer)) {
|
|
283
|
+
if (typeof other === "string" && other === this.version) {
|
|
284
|
+
return 0;
|
|
285
|
+
}
|
|
286
|
+
other = new _SemVer(other, this.options);
|
|
287
|
+
}
|
|
288
|
+
if (other.version === this.version) {
|
|
289
|
+
return 0;
|
|
290
|
+
}
|
|
291
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
292
|
+
}
|
|
293
|
+
compareMain(other) {
|
|
294
|
+
if (!(other instanceof _SemVer)) {
|
|
295
|
+
other = new _SemVer(other, this.options);
|
|
296
|
+
}
|
|
297
|
+
return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
|
298
|
+
}
|
|
299
|
+
comparePre(other) {
|
|
300
|
+
if (!(other instanceof _SemVer)) {
|
|
301
|
+
other = new _SemVer(other, this.options);
|
|
302
|
+
}
|
|
303
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
304
|
+
return -1;
|
|
305
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
306
|
+
return 1;
|
|
307
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
308
|
+
return 0;
|
|
309
|
+
}
|
|
310
|
+
let i = 0;
|
|
311
|
+
do {
|
|
312
|
+
const a = this.prerelease[i];
|
|
313
|
+
const b = other.prerelease[i];
|
|
314
|
+
debug("prerelease compare", i, a, b);
|
|
315
|
+
if (a === void 0 && b === void 0) {
|
|
316
|
+
return 0;
|
|
317
|
+
} else if (b === void 0) {
|
|
318
|
+
return 1;
|
|
319
|
+
} else if (a === void 0) {
|
|
320
|
+
return -1;
|
|
321
|
+
} else if (a === b) {
|
|
322
|
+
continue;
|
|
323
|
+
} else {
|
|
324
|
+
return compareIdentifiers(a, b);
|
|
325
|
+
}
|
|
326
|
+
} while (++i);
|
|
327
|
+
}
|
|
328
|
+
compareBuild(other) {
|
|
329
|
+
if (!(other instanceof _SemVer)) {
|
|
330
|
+
other = new _SemVer(other, this.options);
|
|
331
|
+
}
|
|
332
|
+
let i = 0;
|
|
333
|
+
do {
|
|
334
|
+
const a = this.build[i];
|
|
335
|
+
const b = other.build[i];
|
|
336
|
+
debug("build compare", i, a, b);
|
|
337
|
+
if (a === void 0 && b === void 0) {
|
|
338
|
+
return 0;
|
|
339
|
+
} else if (b === void 0) {
|
|
340
|
+
return 1;
|
|
341
|
+
} else if (a === void 0) {
|
|
342
|
+
return -1;
|
|
343
|
+
} else if (a === b) {
|
|
344
|
+
continue;
|
|
345
|
+
} else {
|
|
346
|
+
return compareIdentifiers(a, b);
|
|
347
|
+
}
|
|
348
|
+
} while (++i);
|
|
349
|
+
}
|
|
350
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
351
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
352
|
+
inc(release, identifier, identifierBase) {
|
|
353
|
+
switch (release) {
|
|
354
|
+
case "premajor":
|
|
355
|
+
this.prerelease.length = 0;
|
|
356
|
+
this.patch = 0;
|
|
357
|
+
this.minor = 0;
|
|
358
|
+
this.major++;
|
|
359
|
+
this.inc("pre", identifier, identifierBase);
|
|
360
|
+
break;
|
|
361
|
+
case "preminor":
|
|
362
|
+
this.prerelease.length = 0;
|
|
363
|
+
this.patch = 0;
|
|
364
|
+
this.minor++;
|
|
365
|
+
this.inc("pre", identifier, identifierBase);
|
|
366
|
+
break;
|
|
367
|
+
case "prepatch":
|
|
368
|
+
this.prerelease.length = 0;
|
|
369
|
+
this.inc("patch", identifier, identifierBase);
|
|
370
|
+
this.inc("pre", identifier, identifierBase);
|
|
371
|
+
break;
|
|
372
|
+
case "prerelease":
|
|
373
|
+
if (this.prerelease.length === 0) {
|
|
374
|
+
this.inc("patch", identifier, identifierBase);
|
|
375
|
+
}
|
|
376
|
+
this.inc("pre", identifier, identifierBase);
|
|
377
|
+
break;
|
|
378
|
+
case "major":
|
|
379
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
380
|
+
this.major++;
|
|
381
|
+
}
|
|
382
|
+
this.minor = 0;
|
|
383
|
+
this.patch = 0;
|
|
384
|
+
this.prerelease = [];
|
|
385
|
+
break;
|
|
386
|
+
case "minor":
|
|
387
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
388
|
+
this.minor++;
|
|
389
|
+
}
|
|
390
|
+
this.patch = 0;
|
|
391
|
+
this.prerelease = [];
|
|
392
|
+
break;
|
|
393
|
+
case "patch":
|
|
394
|
+
if (this.prerelease.length === 0) {
|
|
395
|
+
this.patch++;
|
|
396
|
+
}
|
|
397
|
+
this.prerelease = [];
|
|
398
|
+
break;
|
|
399
|
+
case "pre": {
|
|
400
|
+
const base3 = Number(identifierBase) ? 1 : 0;
|
|
401
|
+
if (!identifier && identifierBase === false) {
|
|
402
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
403
|
+
}
|
|
404
|
+
if (this.prerelease.length === 0) {
|
|
405
|
+
this.prerelease = [base3];
|
|
406
|
+
} else {
|
|
407
|
+
let i = this.prerelease.length;
|
|
408
|
+
while (--i >= 0) {
|
|
409
|
+
if (typeof this.prerelease[i] === "number") {
|
|
410
|
+
this.prerelease[i]++;
|
|
411
|
+
i = -2;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
if (i === -1) {
|
|
415
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
416
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
417
|
+
}
|
|
418
|
+
this.prerelease.push(base3);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (identifier) {
|
|
422
|
+
let prerelease = [identifier, base3];
|
|
423
|
+
if (identifierBase === false) {
|
|
424
|
+
prerelease = [identifier];
|
|
425
|
+
}
|
|
426
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
427
|
+
if (isNaN(this.prerelease[1])) {
|
|
428
|
+
this.prerelease = prerelease;
|
|
429
|
+
}
|
|
430
|
+
} else {
|
|
431
|
+
this.prerelease = prerelease;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
default:
|
|
437
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
438
|
+
}
|
|
439
|
+
this.raw = this.format();
|
|
440
|
+
if (this.build.length) {
|
|
441
|
+
this.raw += `+${this.build.join(".")}`;
|
|
442
|
+
}
|
|
443
|
+
return this;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
module2.exports = SemVer;
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js
|
|
451
|
+
var require_parse = __commonJS({
|
|
452
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/parse.js"(exports2, module2) {
|
|
453
|
+
"use strict";
|
|
454
|
+
var SemVer = require_semver();
|
|
455
|
+
var parse = (version, options, throwErrors = false) => {
|
|
456
|
+
if (version instanceof SemVer) {
|
|
457
|
+
return version;
|
|
458
|
+
}
|
|
459
|
+
try {
|
|
460
|
+
return new SemVer(version, options);
|
|
461
|
+
} catch (er) {
|
|
462
|
+
if (!throwErrors) {
|
|
463
|
+
return null;
|
|
464
|
+
}
|
|
465
|
+
throw er;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
module2.exports = parse;
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
|
|
472
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/valid.js
|
|
473
|
+
var require_valid = __commonJS({
|
|
474
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/valid.js"(exports2, module2) {
|
|
475
|
+
"use strict";
|
|
476
|
+
var parse = require_parse();
|
|
477
|
+
var valid = (version, options) => {
|
|
478
|
+
const v = parse(version, options);
|
|
479
|
+
return v ? v.version : null;
|
|
480
|
+
};
|
|
481
|
+
module2.exports = valid;
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/clean.js
|
|
486
|
+
var require_clean = __commonJS({
|
|
487
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/clean.js"(exports2, module2) {
|
|
488
|
+
"use strict";
|
|
489
|
+
var parse = require_parse();
|
|
490
|
+
var clean = (version, options) => {
|
|
491
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
492
|
+
return s ? s.version : null;
|
|
493
|
+
};
|
|
494
|
+
module2.exports = clean;
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/inc.js
|
|
499
|
+
var require_inc = __commonJS({
|
|
500
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/inc.js"(exports2, module2) {
|
|
501
|
+
"use strict";
|
|
502
|
+
var SemVer = require_semver();
|
|
503
|
+
var inc = (version, release, options, identifier, identifierBase) => {
|
|
504
|
+
if (typeof options === "string") {
|
|
505
|
+
identifierBase = identifier;
|
|
506
|
+
identifier = options;
|
|
507
|
+
options = void 0;
|
|
508
|
+
}
|
|
509
|
+
try {
|
|
510
|
+
return new SemVer(
|
|
511
|
+
version instanceof SemVer ? version.version : version,
|
|
512
|
+
options
|
|
513
|
+
).inc(release, identifier, identifierBase).version;
|
|
514
|
+
} catch (er) {
|
|
515
|
+
return null;
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
module2.exports = inc;
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/diff.js
|
|
523
|
+
var require_diff = __commonJS({
|
|
524
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/diff.js"(exports2, module2) {
|
|
525
|
+
"use strict";
|
|
526
|
+
var parse = require_parse();
|
|
527
|
+
var diff = (version1, version2) => {
|
|
528
|
+
const v1 = parse(version1, null, true);
|
|
529
|
+
const v2 = parse(version2, null, true);
|
|
530
|
+
const comparison = v1.compare(v2);
|
|
531
|
+
if (comparison === 0) {
|
|
532
|
+
return null;
|
|
533
|
+
}
|
|
534
|
+
const v1Higher = comparison > 0;
|
|
535
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
536
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
537
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
538
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
539
|
+
if (lowHasPre && !highHasPre) {
|
|
540
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
541
|
+
return "major";
|
|
542
|
+
}
|
|
543
|
+
if (highVersion.patch) {
|
|
544
|
+
return "patch";
|
|
545
|
+
}
|
|
546
|
+
if (highVersion.minor) {
|
|
547
|
+
return "minor";
|
|
548
|
+
}
|
|
549
|
+
return "major";
|
|
550
|
+
}
|
|
551
|
+
const prefix = highHasPre ? "pre" : "";
|
|
552
|
+
if (v1.major !== v2.major) {
|
|
553
|
+
return prefix + "major";
|
|
554
|
+
}
|
|
555
|
+
if (v1.minor !== v2.minor) {
|
|
556
|
+
return prefix + "minor";
|
|
557
|
+
}
|
|
558
|
+
if (v1.patch !== v2.patch) {
|
|
559
|
+
return prefix + "patch";
|
|
560
|
+
}
|
|
561
|
+
return "prerelease";
|
|
562
|
+
};
|
|
563
|
+
module2.exports = diff;
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/major.js
|
|
568
|
+
var require_major = __commonJS({
|
|
569
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/major.js"(exports2, module2) {
|
|
570
|
+
"use strict";
|
|
571
|
+
var SemVer = require_semver();
|
|
572
|
+
var major = (a, loose) => new SemVer(a, loose).major;
|
|
573
|
+
module2.exports = major;
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
|
|
577
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/minor.js
|
|
578
|
+
var require_minor = __commonJS({
|
|
579
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/minor.js"(exports2, module2) {
|
|
580
|
+
"use strict";
|
|
581
|
+
var SemVer = require_semver();
|
|
582
|
+
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
583
|
+
module2.exports = minor;
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/patch.js
|
|
588
|
+
var require_patch = __commonJS({
|
|
589
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/patch.js"(exports2, module2) {
|
|
590
|
+
"use strict";
|
|
591
|
+
var SemVer = require_semver();
|
|
592
|
+
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
593
|
+
module2.exports = patch;
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/prerelease.js
|
|
598
|
+
var require_prerelease = __commonJS({
|
|
599
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/prerelease.js"(exports2, module2) {
|
|
600
|
+
"use strict";
|
|
601
|
+
var parse = require_parse();
|
|
602
|
+
var prerelease = (version, options) => {
|
|
603
|
+
const parsed = parse(version, options);
|
|
604
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
605
|
+
};
|
|
606
|
+
module2.exports = prerelease;
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js
|
|
611
|
+
var require_compare = __commonJS({
|
|
612
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare.js"(exports2, module2) {
|
|
613
|
+
"use strict";
|
|
614
|
+
var SemVer = require_semver();
|
|
615
|
+
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
616
|
+
module2.exports = compare;
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rcompare.js
|
|
621
|
+
var require_rcompare = __commonJS({
|
|
622
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rcompare.js"(exports2, module2) {
|
|
623
|
+
"use strict";
|
|
624
|
+
var compare = require_compare();
|
|
625
|
+
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
626
|
+
module2.exports = rcompare;
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-loose.js
|
|
631
|
+
var require_compare_loose = __commonJS({
|
|
632
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-loose.js"(exports2, module2) {
|
|
633
|
+
"use strict";
|
|
634
|
+
var compare = require_compare();
|
|
635
|
+
var compareLoose = (a, b) => compare(a, b, true);
|
|
636
|
+
module2.exports = compareLoose;
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-build.js
|
|
641
|
+
var require_compare_build = __commonJS({
|
|
642
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/compare-build.js"(exports2, module2) {
|
|
643
|
+
"use strict";
|
|
644
|
+
var SemVer = require_semver();
|
|
645
|
+
var compareBuild = (a, b, loose) => {
|
|
646
|
+
const versionA = new SemVer(a, loose);
|
|
647
|
+
const versionB = new SemVer(b, loose);
|
|
648
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
649
|
+
};
|
|
650
|
+
module2.exports = compareBuild;
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/sort.js
|
|
655
|
+
var require_sort = __commonJS({
|
|
656
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/sort.js"(exports2, module2) {
|
|
657
|
+
"use strict";
|
|
658
|
+
var compareBuild = require_compare_build();
|
|
659
|
+
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
660
|
+
module2.exports = sort;
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rsort.js
|
|
665
|
+
var require_rsort = __commonJS({
|
|
666
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/rsort.js"(exports2, module2) {
|
|
667
|
+
"use strict";
|
|
668
|
+
var compareBuild = require_compare_build();
|
|
669
|
+
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
670
|
+
module2.exports = rsort;
|
|
671
|
+
}
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gt.js
|
|
675
|
+
var require_gt = __commonJS({
|
|
676
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gt.js"(exports2, module2) {
|
|
677
|
+
"use strict";
|
|
678
|
+
var compare = require_compare();
|
|
679
|
+
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
680
|
+
module2.exports = gt;
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lt.js
|
|
685
|
+
var require_lt = __commonJS({
|
|
686
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lt.js"(exports2, module2) {
|
|
687
|
+
"use strict";
|
|
688
|
+
var compare = require_compare();
|
|
689
|
+
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
690
|
+
module2.exports = lt;
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/eq.js
|
|
695
|
+
var require_eq = __commonJS({
|
|
696
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/eq.js"(exports2, module2) {
|
|
697
|
+
"use strict";
|
|
698
|
+
var compare = require_compare();
|
|
699
|
+
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
700
|
+
module2.exports = eq;
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/neq.js
|
|
705
|
+
var require_neq = __commonJS({
|
|
706
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/neq.js"(exports2, module2) {
|
|
707
|
+
"use strict";
|
|
708
|
+
var compare = require_compare();
|
|
709
|
+
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
710
|
+
module2.exports = neq;
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gte.js
|
|
715
|
+
var require_gte = __commonJS({
|
|
716
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/gte.js"(exports2, module2) {
|
|
717
|
+
"use strict";
|
|
718
|
+
var compare = require_compare();
|
|
719
|
+
var gte4 = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
720
|
+
module2.exports = gte4;
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lte.js
|
|
725
|
+
var require_lte = __commonJS({
|
|
726
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/lte.js"(exports2, module2) {
|
|
727
|
+
"use strict";
|
|
728
|
+
var compare = require_compare();
|
|
729
|
+
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
730
|
+
module2.exports = lte;
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/cmp.js
|
|
735
|
+
var require_cmp = __commonJS({
|
|
736
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/cmp.js"(exports2, module2) {
|
|
737
|
+
"use strict";
|
|
738
|
+
var eq = require_eq();
|
|
739
|
+
var neq = require_neq();
|
|
740
|
+
var gt = require_gt();
|
|
741
|
+
var gte4 = require_gte();
|
|
742
|
+
var lt = require_lt();
|
|
743
|
+
var lte = require_lte();
|
|
744
|
+
var cmp = (a, op, b, loose) => {
|
|
745
|
+
switch (op) {
|
|
746
|
+
case "===":
|
|
747
|
+
if (typeof a === "object") {
|
|
748
|
+
a = a.version;
|
|
749
|
+
}
|
|
750
|
+
if (typeof b === "object") {
|
|
751
|
+
b = b.version;
|
|
752
|
+
}
|
|
753
|
+
return a === b;
|
|
754
|
+
case "!==":
|
|
755
|
+
if (typeof a === "object") {
|
|
756
|
+
a = a.version;
|
|
757
|
+
}
|
|
758
|
+
if (typeof b === "object") {
|
|
759
|
+
b = b.version;
|
|
760
|
+
}
|
|
761
|
+
return a !== b;
|
|
762
|
+
case "":
|
|
763
|
+
case "=":
|
|
764
|
+
case "==":
|
|
765
|
+
return eq(a, b, loose);
|
|
766
|
+
case "!=":
|
|
767
|
+
return neq(a, b, loose);
|
|
768
|
+
case ">":
|
|
769
|
+
return gt(a, b, loose);
|
|
770
|
+
case ">=":
|
|
771
|
+
return gte4(a, b, loose);
|
|
772
|
+
case "<":
|
|
773
|
+
return lt(a, b, loose);
|
|
774
|
+
case "<=":
|
|
775
|
+
return lte(a, b, loose);
|
|
776
|
+
default:
|
|
777
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
module2.exports = cmp;
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
|
|
784
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/coerce.js
|
|
785
|
+
var require_coerce = __commonJS({
|
|
786
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/coerce.js"(exports2, module2) {
|
|
787
|
+
"use strict";
|
|
788
|
+
var SemVer = require_semver();
|
|
789
|
+
var parse = require_parse();
|
|
790
|
+
var { safeRe: re, t } = require_re();
|
|
791
|
+
var coerce5 = (version, options) => {
|
|
792
|
+
if (version instanceof SemVer) {
|
|
793
|
+
return version;
|
|
794
|
+
}
|
|
795
|
+
if (typeof version === "number") {
|
|
796
|
+
version = String(version);
|
|
797
|
+
}
|
|
798
|
+
if (typeof version !== "string") {
|
|
799
|
+
return null;
|
|
800
|
+
}
|
|
801
|
+
options = options || {};
|
|
802
|
+
let match = null;
|
|
803
|
+
if (!options.rtl) {
|
|
804
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
805
|
+
} else {
|
|
806
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
807
|
+
let next;
|
|
808
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
809
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
810
|
+
match = next;
|
|
811
|
+
}
|
|
812
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
813
|
+
}
|
|
814
|
+
coerceRtlRegex.lastIndex = -1;
|
|
815
|
+
}
|
|
816
|
+
if (match === null) {
|
|
817
|
+
return null;
|
|
818
|
+
}
|
|
819
|
+
const major = match[2];
|
|
820
|
+
const minor = match[3] || "0";
|
|
821
|
+
const patch = match[4] || "0";
|
|
822
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
823
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
824
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
825
|
+
};
|
|
826
|
+
module2.exports = coerce5;
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/lrucache.js
|
|
831
|
+
var require_lrucache = __commonJS({
|
|
832
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/internal/lrucache.js"(exports2, module2) {
|
|
833
|
+
"use strict";
|
|
834
|
+
var LRUCache = class {
|
|
835
|
+
constructor() {
|
|
836
|
+
this.max = 1e3;
|
|
837
|
+
this.map = /* @__PURE__ */ new Map();
|
|
838
|
+
}
|
|
839
|
+
get(key) {
|
|
840
|
+
const value = this.map.get(key);
|
|
841
|
+
if (value === void 0) {
|
|
842
|
+
return void 0;
|
|
843
|
+
} else {
|
|
844
|
+
this.map.delete(key);
|
|
845
|
+
this.map.set(key, value);
|
|
846
|
+
return value;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
delete(key) {
|
|
850
|
+
return this.map.delete(key);
|
|
851
|
+
}
|
|
852
|
+
set(key, value) {
|
|
853
|
+
const deleted = this.delete(key);
|
|
854
|
+
if (!deleted && value !== void 0) {
|
|
855
|
+
if (this.map.size >= this.max) {
|
|
856
|
+
const firstKey = this.map.keys().next().value;
|
|
857
|
+
this.delete(firstKey);
|
|
858
|
+
}
|
|
859
|
+
this.map.set(key, value);
|
|
860
|
+
}
|
|
861
|
+
return this;
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
module2.exports = LRUCache;
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
|
|
868
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js
|
|
869
|
+
var require_range = __commonJS({
|
|
870
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/range.js"(exports2, module2) {
|
|
871
|
+
"use strict";
|
|
872
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
873
|
+
var Range = class _Range {
|
|
874
|
+
constructor(range, options) {
|
|
875
|
+
options = parseOptions(options);
|
|
876
|
+
if (range instanceof _Range) {
|
|
877
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
878
|
+
return range;
|
|
879
|
+
} else {
|
|
880
|
+
return new _Range(range.raw, options);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
if (range instanceof Comparator) {
|
|
884
|
+
this.raw = range.value;
|
|
885
|
+
this.set = [[range]];
|
|
886
|
+
this.formatted = void 0;
|
|
887
|
+
return this;
|
|
888
|
+
}
|
|
889
|
+
this.options = options;
|
|
890
|
+
this.loose = !!options.loose;
|
|
891
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
892
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
893
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
894
|
+
if (!this.set.length) {
|
|
895
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
896
|
+
}
|
|
897
|
+
if (this.set.length > 1) {
|
|
898
|
+
const first = this.set[0];
|
|
899
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
900
|
+
if (this.set.length === 0) {
|
|
901
|
+
this.set = [first];
|
|
902
|
+
} else if (this.set.length > 1) {
|
|
903
|
+
for (const c of this.set) {
|
|
904
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
905
|
+
this.set = [c];
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
this.formatted = void 0;
|
|
912
|
+
}
|
|
913
|
+
get range() {
|
|
914
|
+
if (this.formatted === void 0) {
|
|
915
|
+
this.formatted = "";
|
|
916
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
917
|
+
if (i > 0) {
|
|
918
|
+
this.formatted += "||";
|
|
919
|
+
}
|
|
920
|
+
const comps = this.set[i];
|
|
921
|
+
for (let k = 0; k < comps.length; k++) {
|
|
922
|
+
if (k > 0) {
|
|
923
|
+
this.formatted += " ";
|
|
924
|
+
}
|
|
925
|
+
this.formatted += comps[k].toString().trim();
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
return this.formatted;
|
|
930
|
+
}
|
|
931
|
+
format() {
|
|
932
|
+
return this.range;
|
|
933
|
+
}
|
|
934
|
+
toString() {
|
|
935
|
+
return this.range;
|
|
936
|
+
}
|
|
937
|
+
parseRange(range) {
|
|
938
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
939
|
+
const memoKey = memoOpts + ":" + range;
|
|
940
|
+
const cached = cache2.get(memoKey);
|
|
941
|
+
if (cached) {
|
|
942
|
+
return cached;
|
|
943
|
+
}
|
|
944
|
+
const loose = this.options.loose;
|
|
945
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
946
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
947
|
+
debug("hyphen replace", range);
|
|
948
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
949
|
+
debug("comparator trim", range);
|
|
950
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
951
|
+
debug("tilde trim", range);
|
|
952
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
953
|
+
debug("caret trim", range);
|
|
954
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
955
|
+
if (loose) {
|
|
956
|
+
rangeList = rangeList.filter((comp) => {
|
|
957
|
+
debug("loose invalid filter", comp, this.options);
|
|
958
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
debug("range list", rangeList);
|
|
962
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
963
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
964
|
+
for (const comp of comparators) {
|
|
965
|
+
if (isNullSet(comp)) {
|
|
966
|
+
return [comp];
|
|
967
|
+
}
|
|
968
|
+
rangeMap.set(comp.value, comp);
|
|
969
|
+
}
|
|
970
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
971
|
+
rangeMap.delete("");
|
|
972
|
+
}
|
|
973
|
+
const result = [...rangeMap.values()];
|
|
974
|
+
cache2.set(memoKey, result);
|
|
975
|
+
return result;
|
|
976
|
+
}
|
|
977
|
+
intersects(range, options) {
|
|
978
|
+
if (!(range instanceof _Range)) {
|
|
979
|
+
throw new TypeError("a Range is required");
|
|
980
|
+
}
|
|
981
|
+
return this.set.some((thisComparators) => {
|
|
982
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
983
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
984
|
+
return rangeComparators.every((rangeComparator) => {
|
|
985
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
986
|
+
});
|
|
987
|
+
});
|
|
988
|
+
});
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
992
|
+
test(version) {
|
|
993
|
+
if (!version) {
|
|
994
|
+
return false;
|
|
995
|
+
}
|
|
996
|
+
if (typeof version === "string") {
|
|
997
|
+
try {
|
|
998
|
+
version = new SemVer(version, this.options);
|
|
999
|
+
} catch (er) {
|
|
1000
|
+
return false;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
1004
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
1005
|
+
return true;
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
return false;
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
module2.exports = Range;
|
|
1012
|
+
var LRU = require_lrucache();
|
|
1013
|
+
var cache2 = new LRU();
|
|
1014
|
+
var parseOptions = require_parse_options();
|
|
1015
|
+
var Comparator = require_comparator();
|
|
1016
|
+
var debug = require_debug();
|
|
1017
|
+
var SemVer = require_semver();
|
|
1018
|
+
var {
|
|
1019
|
+
safeRe: re,
|
|
1020
|
+
t,
|
|
1021
|
+
comparatorTrimReplace,
|
|
1022
|
+
tildeTrimReplace,
|
|
1023
|
+
caretTrimReplace
|
|
1024
|
+
} = require_re();
|
|
1025
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
1026
|
+
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
1027
|
+
var isAny = (c) => c.value === "";
|
|
1028
|
+
var isSatisfiable = (comparators, options) => {
|
|
1029
|
+
let result = true;
|
|
1030
|
+
const remainingComparators = comparators.slice();
|
|
1031
|
+
let testComparator = remainingComparators.pop();
|
|
1032
|
+
while (result && remainingComparators.length) {
|
|
1033
|
+
result = remainingComparators.every((otherComparator) => {
|
|
1034
|
+
return testComparator.intersects(otherComparator, options);
|
|
1035
|
+
});
|
|
1036
|
+
testComparator = remainingComparators.pop();
|
|
1037
|
+
}
|
|
1038
|
+
return result;
|
|
1039
|
+
};
|
|
1040
|
+
var parseComparator = (comp, options) => {
|
|
1041
|
+
debug("comp", comp, options);
|
|
1042
|
+
comp = replaceCarets(comp, options);
|
|
1043
|
+
debug("caret", comp);
|
|
1044
|
+
comp = replaceTildes(comp, options);
|
|
1045
|
+
debug("tildes", comp);
|
|
1046
|
+
comp = replaceXRanges(comp, options);
|
|
1047
|
+
debug("xrange", comp);
|
|
1048
|
+
comp = replaceStars(comp, options);
|
|
1049
|
+
debug("stars", comp);
|
|
1050
|
+
return comp;
|
|
1051
|
+
};
|
|
1052
|
+
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
1053
|
+
var replaceTildes = (comp, options) => {
|
|
1054
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
1055
|
+
};
|
|
1056
|
+
var replaceTilde = (comp, options) => {
|
|
1057
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
1058
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1059
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
1060
|
+
let ret;
|
|
1061
|
+
if (isX(M)) {
|
|
1062
|
+
ret = "";
|
|
1063
|
+
} else if (isX(m)) {
|
|
1064
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
1065
|
+
} else if (isX(p)) {
|
|
1066
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
1067
|
+
} else if (pr) {
|
|
1068
|
+
debug("replaceTilde pr", pr);
|
|
1069
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1070
|
+
} else {
|
|
1071
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
1072
|
+
}
|
|
1073
|
+
debug("tilde return", ret);
|
|
1074
|
+
return ret;
|
|
1075
|
+
});
|
|
1076
|
+
};
|
|
1077
|
+
var replaceCarets = (comp, options) => {
|
|
1078
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
1079
|
+
};
|
|
1080
|
+
var replaceCaret = (comp, options) => {
|
|
1081
|
+
debug("caret", comp, options);
|
|
1082
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
1083
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
1084
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
1085
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
1086
|
+
let ret;
|
|
1087
|
+
if (isX(M)) {
|
|
1088
|
+
ret = "";
|
|
1089
|
+
} else if (isX(m)) {
|
|
1090
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
1091
|
+
} else if (isX(p)) {
|
|
1092
|
+
if (M === "0") {
|
|
1093
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
1094
|
+
} else {
|
|
1095
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
1096
|
+
}
|
|
1097
|
+
} else if (pr) {
|
|
1098
|
+
debug("replaceCaret pr", pr);
|
|
1099
|
+
if (M === "0") {
|
|
1100
|
+
if (m === "0") {
|
|
1101
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
1102
|
+
} else {
|
|
1103
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
1104
|
+
}
|
|
1105
|
+
} else {
|
|
1106
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
1107
|
+
}
|
|
1108
|
+
} else {
|
|
1109
|
+
debug("no pr");
|
|
1110
|
+
if (M === "0") {
|
|
1111
|
+
if (m === "0") {
|
|
1112
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
1113
|
+
} else {
|
|
1114
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
1115
|
+
}
|
|
1116
|
+
} else {
|
|
1117
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
debug("caret return", ret);
|
|
1121
|
+
return ret;
|
|
1122
|
+
});
|
|
1123
|
+
};
|
|
1124
|
+
var replaceXRanges = (comp, options) => {
|
|
1125
|
+
debug("replaceXRanges", comp, options);
|
|
1126
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
1127
|
+
};
|
|
1128
|
+
var replaceXRange = (comp, options) => {
|
|
1129
|
+
comp = comp.trim();
|
|
1130
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
1131
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
1132
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
1133
|
+
const xM = isX(M);
|
|
1134
|
+
const xm = xM || isX(m);
|
|
1135
|
+
const xp = xm || isX(p);
|
|
1136
|
+
const anyX = xp;
|
|
1137
|
+
if (gtlt === "=" && anyX) {
|
|
1138
|
+
gtlt = "";
|
|
1139
|
+
}
|
|
1140
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
1141
|
+
if (xM) {
|
|
1142
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
1143
|
+
ret = "<0.0.0-0";
|
|
1144
|
+
} else {
|
|
1145
|
+
ret = "*";
|
|
1146
|
+
}
|
|
1147
|
+
} else if (gtlt && anyX) {
|
|
1148
|
+
if (xm) {
|
|
1149
|
+
m = 0;
|
|
1150
|
+
}
|
|
1151
|
+
p = 0;
|
|
1152
|
+
if (gtlt === ">") {
|
|
1153
|
+
gtlt = ">=";
|
|
1154
|
+
if (xm) {
|
|
1155
|
+
M = +M + 1;
|
|
1156
|
+
m = 0;
|
|
1157
|
+
p = 0;
|
|
1158
|
+
} else {
|
|
1159
|
+
m = +m + 1;
|
|
1160
|
+
p = 0;
|
|
1161
|
+
}
|
|
1162
|
+
} else if (gtlt === "<=") {
|
|
1163
|
+
gtlt = "<";
|
|
1164
|
+
if (xm) {
|
|
1165
|
+
M = +M + 1;
|
|
1166
|
+
} else {
|
|
1167
|
+
m = +m + 1;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
if (gtlt === "<") {
|
|
1171
|
+
pr = "-0";
|
|
1172
|
+
}
|
|
1173
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
1174
|
+
} else if (xm) {
|
|
1175
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
1176
|
+
} else if (xp) {
|
|
1177
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
1178
|
+
}
|
|
1179
|
+
debug("xRange return", ret);
|
|
1180
|
+
return ret;
|
|
1181
|
+
});
|
|
1182
|
+
};
|
|
1183
|
+
var replaceStars = (comp, options) => {
|
|
1184
|
+
debug("replaceStars", comp, options);
|
|
1185
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
1186
|
+
};
|
|
1187
|
+
var replaceGTE0 = (comp, options) => {
|
|
1188
|
+
debug("replaceGTE0", comp, options);
|
|
1189
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
1190
|
+
};
|
|
1191
|
+
var hyphenReplace = (incPr) => ($0, from2, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
1192
|
+
if (isX(fM)) {
|
|
1193
|
+
from2 = "";
|
|
1194
|
+
} else if (isX(fm)) {
|
|
1195
|
+
from2 = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
1196
|
+
} else if (isX(fp)) {
|
|
1197
|
+
from2 = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
1198
|
+
} else if (fpr) {
|
|
1199
|
+
from2 = `>=${from2}`;
|
|
1200
|
+
} else {
|
|
1201
|
+
from2 = `>=${from2}${incPr ? "-0" : ""}`;
|
|
1202
|
+
}
|
|
1203
|
+
if (isX(tM)) {
|
|
1204
|
+
to = "";
|
|
1205
|
+
} else if (isX(tm)) {
|
|
1206
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
1207
|
+
} else if (isX(tp)) {
|
|
1208
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
1209
|
+
} else if (tpr) {
|
|
1210
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
1211
|
+
} else if (incPr) {
|
|
1212
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
1213
|
+
} else {
|
|
1214
|
+
to = `<=${to}`;
|
|
1215
|
+
}
|
|
1216
|
+
return `${from2} ${to}`.trim();
|
|
1217
|
+
};
|
|
1218
|
+
var testSet = (set, version, options) => {
|
|
1219
|
+
for (let i = 0; i < set.length; i++) {
|
|
1220
|
+
if (!set[i].test(version)) {
|
|
1221
|
+
return false;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
1225
|
+
for (let i = 0; i < set.length; i++) {
|
|
1226
|
+
debug(set[i].semver);
|
|
1227
|
+
if (set[i].semver === Comparator.ANY) {
|
|
1228
|
+
continue;
|
|
1229
|
+
}
|
|
1230
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
1231
|
+
const allowed = set[i].semver;
|
|
1232
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
1233
|
+
return true;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
return false;
|
|
1238
|
+
}
|
|
1239
|
+
return true;
|
|
1240
|
+
};
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/comparator.js
|
|
1245
|
+
var require_comparator = __commonJS({
|
|
1246
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/classes/comparator.js"(exports2, module2) {
|
|
1247
|
+
"use strict";
|
|
1248
|
+
var ANY = Symbol("SemVer ANY");
|
|
1249
|
+
var Comparator = class _Comparator {
|
|
1250
|
+
static get ANY() {
|
|
1251
|
+
return ANY;
|
|
1252
|
+
}
|
|
1253
|
+
constructor(comp, options) {
|
|
1254
|
+
options = parseOptions(options);
|
|
1255
|
+
if (comp instanceof _Comparator) {
|
|
1256
|
+
if (comp.loose === !!options.loose) {
|
|
1257
|
+
return comp;
|
|
1258
|
+
} else {
|
|
1259
|
+
comp = comp.value;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
1263
|
+
debug("comparator", comp, options);
|
|
1264
|
+
this.options = options;
|
|
1265
|
+
this.loose = !!options.loose;
|
|
1266
|
+
this.parse(comp);
|
|
1267
|
+
if (this.semver === ANY) {
|
|
1268
|
+
this.value = "";
|
|
1269
|
+
} else {
|
|
1270
|
+
this.value = this.operator + this.semver.version;
|
|
1271
|
+
}
|
|
1272
|
+
debug("comp", this);
|
|
1273
|
+
}
|
|
1274
|
+
parse(comp) {
|
|
1275
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
1276
|
+
const m = comp.match(r);
|
|
1277
|
+
if (!m) {
|
|
1278
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
1279
|
+
}
|
|
1280
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
1281
|
+
if (this.operator === "=") {
|
|
1282
|
+
this.operator = "";
|
|
1283
|
+
}
|
|
1284
|
+
if (!m[2]) {
|
|
1285
|
+
this.semver = ANY;
|
|
1286
|
+
} else {
|
|
1287
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
toString() {
|
|
1291
|
+
return this.value;
|
|
1292
|
+
}
|
|
1293
|
+
test(version) {
|
|
1294
|
+
debug("Comparator.test", version, this.options.loose);
|
|
1295
|
+
if (this.semver === ANY || version === ANY) {
|
|
1296
|
+
return true;
|
|
1297
|
+
}
|
|
1298
|
+
if (typeof version === "string") {
|
|
1299
|
+
try {
|
|
1300
|
+
version = new SemVer(version, this.options);
|
|
1301
|
+
} catch (er) {
|
|
1302
|
+
return false;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
1306
|
+
}
|
|
1307
|
+
intersects(comp, options) {
|
|
1308
|
+
if (!(comp instanceof _Comparator)) {
|
|
1309
|
+
throw new TypeError("a Comparator is required");
|
|
1310
|
+
}
|
|
1311
|
+
if (this.operator === "") {
|
|
1312
|
+
if (this.value === "") {
|
|
1313
|
+
return true;
|
|
1314
|
+
}
|
|
1315
|
+
return new Range(comp.value, options).test(this.value);
|
|
1316
|
+
} else if (comp.operator === "") {
|
|
1317
|
+
if (comp.value === "") {
|
|
1318
|
+
return true;
|
|
1319
|
+
}
|
|
1320
|
+
return new Range(this.value, options).test(comp.semver);
|
|
1321
|
+
}
|
|
1322
|
+
options = parseOptions(options);
|
|
1323
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
1324
|
+
return false;
|
|
1325
|
+
}
|
|
1326
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
1327
|
+
return false;
|
|
1328
|
+
}
|
|
1329
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
1330
|
+
return true;
|
|
1331
|
+
}
|
|
1332
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
1333
|
+
return true;
|
|
1334
|
+
}
|
|
1335
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
1336
|
+
return true;
|
|
1337
|
+
}
|
|
1338
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
1339
|
+
return true;
|
|
1340
|
+
}
|
|
1341
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
1342
|
+
return true;
|
|
1343
|
+
}
|
|
1344
|
+
return false;
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
module2.exports = Comparator;
|
|
1348
|
+
var parseOptions = require_parse_options();
|
|
1349
|
+
var { safeRe: re, t } = require_re();
|
|
1350
|
+
var cmp = require_cmp();
|
|
1351
|
+
var debug = require_debug();
|
|
1352
|
+
var SemVer = require_semver();
|
|
1353
|
+
var Range = require_range();
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1356
|
+
|
|
1357
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/satisfies.js
|
|
1358
|
+
var require_satisfies = __commonJS({
|
|
1359
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/functions/satisfies.js"(exports2, module2) {
|
|
1360
|
+
"use strict";
|
|
1361
|
+
var Range = require_range();
|
|
1362
|
+
var satisfies = (version, range, options) => {
|
|
1363
|
+
try {
|
|
1364
|
+
range = new Range(range, options);
|
|
1365
|
+
} catch (er) {
|
|
1366
|
+
return false;
|
|
1367
|
+
}
|
|
1368
|
+
return range.test(version);
|
|
1369
|
+
};
|
|
1370
|
+
module2.exports = satisfies;
|
|
1371
|
+
}
|
|
1372
|
+
});
|
|
1373
|
+
|
|
1374
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/to-comparators.js
|
|
1375
|
+
var require_to_comparators = __commonJS({
|
|
1376
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/to-comparators.js"(exports2, module2) {
|
|
1377
|
+
"use strict";
|
|
1378
|
+
var Range = require_range();
|
|
1379
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
1380
|
+
module2.exports = toComparators;
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1383
|
+
|
|
1384
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/max-satisfying.js
|
|
1385
|
+
var require_max_satisfying = __commonJS({
|
|
1386
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
|
|
1387
|
+
"use strict";
|
|
1388
|
+
var SemVer = require_semver();
|
|
1389
|
+
var Range = require_range();
|
|
1390
|
+
var maxSatisfying = (versions, range, options) => {
|
|
1391
|
+
let max = null;
|
|
1392
|
+
let maxSV = null;
|
|
1393
|
+
let rangeObj = null;
|
|
1394
|
+
try {
|
|
1395
|
+
rangeObj = new Range(range, options);
|
|
1396
|
+
} catch (er) {
|
|
1397
|
+
return null;
|
|
1398
|
+
}
|
|
1399
|
+
versions.forEach((v) => {
|
|
1400
|
+
if (rangeObj.test(v)) {
|
|
1401
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
1402
|
+
max = v;
|
|
1403
|
+
maxSV = new SemVer(max, options);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
return max;
|
|
1408
|
+
};
|
|
1409
|
+
module2.exports = maxSatisfying;
|
|
1410
|
+
}
|
|
1411
|
+
});
|
|
1412
|
+
|
|
1413
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-satisfying.js
|
|
1414
|
+
var require_min_satisfying = __commonJS({
|
|
1415
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
|
|
1416
|
+
"use strict";
|
|
1417
|
+
var SemVer = require_semver();
|
|
1418
|
+
var Range = require_range();
|
|
1419
|
+
var minSatisfying = (versions, range, options) => {
|
|
1420
|
+
let min = null;
|
|
1421
|
+
let minSV = null;
|
|
1422
|
+
let rangeObj = null;
|
|
1423
|
+
try {
|
|
1424
|
+
rangeObj = new Range(range, options);
|
|
1425
|
+
} catch (er) {
|
|
1426
|
+
return null;
|
|
1427
|
+
}
|
|
1428
|
+
versions.forEach((v) => {
|
|
1429
|
+
if (rangeObj.test(v)) {
|
|
1430
|
+
if (!min || minSV.compare(v) === 1) {
|
|
1431
|
+
min = v;
|
|
1432
|
+
minSV = new SemVer(min, options);
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
return min;
|
|
1437
|
+
};
|
|
1438
|
+
module2.exports = minSatisfying;
|
|
1439
|
+
}
|
|
1440
|
+
});
|
|
1441
|
+
|
|
1442
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-version.js
|
|
1443
|
+
var require_min_version = __commonJS({
|
|
1444
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/min-version.js"(exports2, module2) {
|
|
1445
|
+
"use strict";
|
|
1446
|
+
var SemVer = require_semver();
|
|
1447
|
+
var Range = require_range();
|
|
1448
|
+
var gt = require_gt();
|
|
1449
|
+
var minVersion = (range, loose) => {
|
|
1450
|
+
range = new Range(range, loose);
|
|
1451
|
+
let minver = new SemVer("0.0.0");
|
|
1452
|
+
if (range.test(minver)) {
|
|
1453
|
+
return minver;
|
|
1454
|
+
}
|
|
1455
|
+
minver = new SemVer("0.0.0-0");
|
|
1456
|
+
if (range.test(minver)) {
|
|
1457
|
+
return minver;
|
|
1458
|
+
}
|
|
1459
|
+
minver = null;
|
|
1460
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1461
|
+
const comparators = range.set[i];
|
|
1462
|
+
let setMin = null;
|
|
1463
|
+
comparators.forEach((comparator) => {
|
|
1464
|
+
const compver = new SemVer(comparator.semver.version);
|
|
1465
|
+
switch (comparator.operator) {
|
|
1466
|
+
case ">":
|
|
1467
|
+
if (compver.prerelease.length === 0) {
|
|
1468
|
+
compver.patch++;
|
|
1469
|
+
} else {
|
|
1470
|
+
compver.prerelease.push(0);
|
|
1471
|
+
}
|
|
1472
|
+
compver.raw = compver.format();
|
|
1473
|
+
case "":
|
|
1474
|
+
case ">=":
|
|
1475
|
+
if (!setMin || gt(compver, setMin)) {
|
|
1476
|
+
setMin = compver;
|
|
1477
|
+
}
|
|
1478
|
+
break;
|
|
1479
|
+
case "<":
|
|
1480
|
+
case "<=":
|
|
1481
|
+
break;
|
|
1482
|
+
default:
|
|
1483
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1484
|
+
}
|
|
1485
|
+
});
|
|
1486
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
1487
|
+
minver = setMin;
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
if (minver && range.test(minver)) {
|
|
1491
|
+
return minver;
|
|
1492
|
+
}
|
|
1493
|
+
return null;
|
|
1494
|
+
};
|
|
1495
|
+
module2.exports = minVersion;
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
|
|
1499
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/valid.js
|
|
1500
|
+
var require_valid2 = __commonJS({
|
|
1501
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/valid.js"(exports2, module2) {
|
|
1502
|
+
"use strict";
|
|
1503
|
+
var Range = require_range();
|
|
1504
|
+
var validRange = (range, options) => {
|
|
1505
|
+
try {
|
|
1506
|
+
return new Range(range, options).range || "*";
|
|
1507
|
+
} catch (er) {
|
|
1508
|
+
return null;
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
module2.exports = validRange;
|
|
1512
|
+
}
|
|
1513
|
+
});
|
|
1514
|
+
|
|
1515
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/outside.js
|
|
1516
|
+
var require_outside = __commonJS({
|
|
1517
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/outside.js"(exports2, module2) {
|
|
1518
|
+
"use strict";
|
|
1519
|
+
var SemVer = require_semver();
|
|
1520
|
+
var Comparator = require_comparator();
|
|
1521
|
+
var { ANY } = Comparator;
|
|
1522
|
+
var Range = require_range();
|
|
1523
|
+
var satisfies = require_satisfies();
|
|
1524
|
+
var gt = require_gt();
|
|
1525
|
+
var lt = require_lt();
|
|
1526
|
+
var lte = require_lte();
|
|
1527
|
+
var gte4 = require_gte();
|
|
1528
|
+
var outside = (version, range, hilo, options) => {
|
|
1529
|
+
version = new SemVer(version, options);
|
|
1530
|
+
range = new Range(range, options);
|
|
1531
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
1532
|
+
switch (hilo) {
|
|
1533
|
+
case ">":
|
|
1534
|
+
gtfn = gt;
|
|
1535
|
+
ltefn = lte;
|
|
1536
|
+
ltfn = lt;
|
|
1537
|
+
comp = ">";
|
|
1538
|
+
ecomp = ">=";
|
|
1539
|
+
break;
|
|
1540
|
+
case "<":
|
|
1541
|
+
gtfn = lt;
|
|
1542
|
+
ltefn = gte4;
|
|
1543
|
+
ltfn = gt;
|
|
1544
|
+
comp = "<";
|
|
1545
|
+
ecomp = "<=";
|
|
1546
|
+
break;
|
|
1547
|
+
default:
|
|
1548
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
1549
|
+
}
|
|
1550
|
+
if (satisfies(version, range, options)) {
|
|
1551
|
+
return false;
|
|
1552
|
+
}
|
|
1553
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1554
|
+
const comparators = range.set[i];
|
|
1555
|
+
let high = null;
|
|
1556
|
+
let low = null;
|
|
1557
|
+
comparators.forEach((comparator) => {
|
|
1558
|
+
if (comparator.semver === ANY) {
|
|
1559
|
+
comparator = new Comparator(">=0.0.0");
|
|
1560
|
+
}
|
|
1561
|
+
high = high || comparator;
|
|
1562
|
+
low = low || comparator;
|
|
1563
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
1564
|
+
high = comparator;
|
|
1565
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
1566
|
+
low = comparator;
|
|
1567
|
+
}
|
|
1568
|
+
});
|
|
1569
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
1570
|
+
return false;
|
|
1571
|
+
}
|
|
1572
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
1573
|
+
return false;
|
|
1574
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
1575
|
+
return false;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
return true;
|
|
1579
|
+
};
|
|
1580
|
+
module2.exports = outside;
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
|
|
1584
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/gtr.js
|
|
1585
|
+
var require_gtr = __commonJS({
|
|
1586
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/gtr.js"(exports2, module2) {
|
|
1587
|
+
"use strict";
|
|
1588
|
+
var outside = require_outside();
|
|
1589
|
+
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
1590
|
+
module2.exports = gtr;
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
|
|
1594
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/ltr.js
|
|
1595
|
+
var require_ltr = __commonJS({
|
|
1596
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/ltr.js"(exports2, module2) {
|
|
1597
|
+
"use strict";
|
|
1598
|
+
var outside = require_outside();
|
|
1599
|
+
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
1600
|
+
module2.exports = ltr;
|
|
1601
|
+
}
|
|
1602
|
+
});
|
|
1603
|
+
|
|
1604
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/intersects.js
|
|
1605
|
+
var require_intersects = __commonJS({
|
|
1606
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/intersects.js"(exports2, module2) {
|
|
1607
|
+
"use strict";
|
|
1608
|
+
var Range = require_range();
|
|
1609
|
+
var intersects = (r1, r2, options) => {
|
|
1610
|
+
r1 = new Range(r1, options);
|
|
1611
|
+
r2 = new Range(r2, options);
|
|
1612
|
+
return r1.intersects(r2, options);
|
|
1613
|
+
};
|
|
1614
|
+
module2.exports = intersects;
|
|
1615
|
+
}
|
|
1616
|
+
});
|
|
1617
|
+
|
|
1618
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/simplify.js
|
|
1619
|
+
var require_simplify = __commonJS({
|
|
1620
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/simplify.js"(exports2, module2) {
|
|
1621
|
+
"use strict";
|
|
1622
|
+
var satisfies = require_satisfies();
|
|
1623
|
+
var compare = require_compare();
|
|
1624
|
+
module2.exports = (versions, range, options) => {
|
|
1625
|
+
const set = [];
|
|
1626
|
+
let first = null;
|
|
1627
|
+
let prev = null;
|
|
1628
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
1629
|
+
for (const version of v) {
|
|
1630
|
+
const included = satisfies(version, range, options);
|
|
1631
|
+
if (included) {
|
|
1632
|
+
prev = version;
|
|
1633
|
+
if (!first) {
|
|
1634
|
+
first = version;
|
|
1635
|
+
}
|
|
1636
|
+
} else {
|
|
1637
|
+
if (prev) {
|
|
1638
|
+
set.push([first, prev]);
|
|
1639
|
+
}
|
|
1640
|
+
prev = null;
|
|
1641
|
+
first = null;
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
if (first) {
|
|
1645
|
+
set.push([first, null]);
|
|
1646
|
+
}
|
|
1647
|
+
const ranges = [];
|
|
1648
|
+
for (const [min, max] of set) {
|
|
1649
|
+
if (min === max) {
|
|
1650
|
+
ranges.push(min);
|
|
1651
|
+
} else if (!max && min === v[0]) {
|
|
1652
|
+
ranges.push("*");
|
|
1653
|
+
} else if (!max) {
|
|
1654
|
+
ranges.push(`>=${min}`);
|
|
1655
|
+
} else if (min === v[0]) {
|
|
1656
|
+
ranges.push(`<=${max}`);
|
|
1657
|
+
} else {
|
|
1658
|
+
ranges.push(`${min} - ${max}`);
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
const simplified = ranges.join(" || ");
|
|
1662
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
1663
|
+
return simplified.length < original.length ? simplified : range;
|
|
1664
|
+
};
|
|
1665
|
+
}
|
|
1666
|
+
});
|
|
1667
|
+
|
|
1668
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/subset.js
|
|
1669
|
+
var require_subset = __commonJS({
|
|
1670
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/ranges/subset.js"(exports2, module2) {
|
|
1671
|
+
"use strict";
|
|
1672
|
+
var Range = require_range();
|
|
1673
|
+
var Comparator = require_comparator();
|
|
1674
|
+
var { ANY } = Comparator;
|
|
1675
|
+
var satisfies = require_satisfies();
|
|
1676
|
+
var compare = require_compare();
|
|
1677
|
+
var subset = (sub, dom, options = {}) => {
|
|
1678
|
+
if (sub === dom) {
|
|
1679
|
+
return true;
|
|
1680
|
+
}
|
|
1681
|
+
sub = new Range(sub, options);
|
|
1682
|
+
dom = new Range(dom, options);
|
|
1683
|
+
let sawNonNull = false;
|
|
1684
|
+
OUTER:
|
|
1685
|
+
for (const simpleSub of sub.set) {
|
|
1686
|
+
for (const simpleDom of dom.set) {
|
|
1687
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
1688
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
1689
|
+
if (isSub) {
|
|
1690
|
+
continue OUTER;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
if (sawNonNull) {
|
|
1694
|
+
return false;
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
return true;
|
|
1698
|
+
};
|
|
1699
|
+
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
1700
|
+
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
1701
|
+
var simpleSubset = (sub, dom, options) => {
|
|
1702
|
+
if (sub === dom) {
|
|
1703
|
+
return true;
|
|
1704
|
+
}
|
|
1705
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
1706
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
1707
|
+
return true;
|
|
1708
|
+
} else if (options.includePrerelease) {
|
|
1709
|
+
sub = minimumVersionWithPreRelease;
|
|
1710
|
+
} else {
|
|
1711
|
+
sub = minimumVersion;
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
1715
|
+
if (options.includePrerelease) {
|
|
1716
|
+
return true;
|
|
1717
|
+
} else {
|
|
1718
|
+
dom = minimumVersion;
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
1722
|
+
let gt, lt;
|
|
1723
|
+
for (const c of sub) {
|
|
1724
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
1725
|
+
gt = higherGT(gt, c, options);
|
|
1726
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
1727
|
+
lt = lowerLT(lt, c, options);
|
|
1728
|
+
} else {
|
|
1729
|
+
eqSet.add(c.semver);
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
if (eqSet.size > 1) {
|
|
1733
|
+
return null;
|
|
1734
|
+
}
|
|
1735
|
+
let gtltComp;
|
|
1736
|
+
if (gt && lt) {
|
|
1737
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
1738
|
+
if (gtltComp > 0) {
|
|
1739
|
+
return null;
|
|
1740
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
1741
|
+
return null;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
for (const eq of eqSet) {
|
|
1745
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
1746
|
+
return null;
|
|
1747
|
+
}
|
|
1748
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
1749
|
+
return null;
|
|
1750
|
+
}
|
|
1751
|
+
for (const c of dom) {
|
|
1752
|
+
if (!satisfies(eq, String(c), options)) {
|
|
1753
|
+
return false;
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
return true;
|
|
1757
|
+
}
|
|
1758
|
+
let higher, lower;
|
|
1759
|
+
let hasDomLT, hasDomGT;
|
|
1760
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
1761
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
1762
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
1763
|
+
needDomLTPre = false;
|
|
1764
|
+
}
|
|
1765
|
+
for (const c of dom) {
|
|
1766
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
1767
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
1768
|
+
if (gt) {
|
|
1769
|
+
if (needDomGTPre) {
|
|
1770
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
1771
|
+
needDomGTPre = false;
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
1775
|
+
higher = higherGT(gt, c, options);
|
|
1776
|
+
if (higher === c && higher !== gt) {
|
|
1777
|
+
return false;
|
|
1778
|
+
}
|
|
1779
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
|
|
1780
|
+
return false;
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
if (lt) {
|
|
1784
|
+
if (needDomLTPre) {
|
|
1785
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
1786
|
+
needDomLTPre = false;
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
1790
|
+
lower = lowerLT(lt, c, options);
|
|
1791
|
+
if (lower === c && lower !== lt) {
|
|
1792
|
+
return false;
|
|
1793
|
+
}
|
|
1794
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
|
|
1795
|
+
return false;
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
1799
|
+
return false;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
1803
|
+
return false;
|
|
1804
|
+
}
|
|
1805
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
1806
|
+
return false;
|
|
1807
|
+
}
|
|
1808
|
+
if (needDomGTPre || needDomLTPre) {
|
|
1809
|
+
return false;
|
|
1810
|
+
}
|
|
1811
|
+
return true;
|
|
1812
|
+
};
|
|
1813
|
+
var higherGT = (a, b, options) => {
|
|
1814
|
+
if (!a) {
|
|
1815
|
+
return b;
|
|
1816
|
+
}
|
|
1817
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1818
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
1819
|
+
};
|
|
1820
|
+
var lowerLT = (a, b, options) => {
|
|
1821
|
+
if (!a) {
|
|
1822
|
+
return b;
|
|
1823
|
+
}
|
|
1824
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1825
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
1826
|
+
};
|
|
1827
|
+
module2.exports = subset;
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
|
|
1831
|
+
// ../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/index.js
|
|
1832
|
+
var require_semver2 = __commonJS({
|
|
1833
|
+
"../../node_modules/.pnpm/semver@7.6.3/node_modules/semver/index.js"(exports2, module2) {
|
|
1834
|
+
"use strict";
|
|
1835
|
+
var internalRe = require_re();
|
|
1836
|
+
var constants = require_constants();
|
|
1837
|
+
var SemVer = require_semver();
|
|
1838
|
+
var identifiers = require_identifiers();
|
|
1839
|
+
var parse = require_parse();
|
|
1840
|
+
var valid = require_valid();
|
|
1841
|
+
var clean = require_clean();
|
|
1842
|
+
var inc = require_inc();
|
|
1843
|
+
var diff = require_diff();
|
|
1844
|
+
var major = require_major();
|
|
1845
|
+
var minor = require_minor();
|
|
1846
|
+
var patch = require_patch();
|
|
1847
|
+
var prerelease = require_prerelease();
|
|
1848
|
+
var compare = require_compare();
|
|
1849
|
+
var rcompare = require_rcompare();
|
|
1850
|
+
var compareLoose = require_compare_loose();
|
|
1851
|
+
var compareBuild = require_compare_build();
|
|
1852
|
+
var sort = require_sort();
|
|
1853
|
+
var rsort = require_rsort();
|
|
1854
|
+
var gt = require_gt();
|
|
1855
|
+
var lt = require_lt();
|
|
1856
|
+
var eq = require_eq();
|
|
1857
|
+
var neq = require_neq();
|
|
1858
|
+
var gte4 = require_gte();
|
|
1859
|
+
var lte = require_lte();
|
|
1860
|
+
var cmp = require_cmp();
|
|
1861
|
+
var coerce5 = require_coerce();
|
|
1862
|
+
var Comparator = require_comparator();
|
|
1863
|
+
var Range = require_range();
|
|
1864
|
+
var satisfies = require_satisfies();
|
|
1865
|
+
var toComparators = require_to_comparators();
|
|
1866
|
+
var maxSatisfying = require_max_satisfying();
|
|
1867
|
+
var minSatisfying = require_min_satisfying();
|
|
1868
|
+
var minVersion = require_min_version();
|
|
1869
|
+
var validRange = require_valid2();
|
|
1870
|
+
var outside = require_outside();
|
|
1871
|
+
var gtr = require_gtr();
|
|
1872
|
+
var ltr = require_ltr();
|
|
1873
|
+
var intersects = require_intersects();
|
|
1874
|
+
var simplifyRange = require_simplify();
|
|
1875
|
+
var subset = require_subset();
|
|
1876
|
+
module2.exports = {
|
|
1877
|
+
parse,
|
|
1878
|
+
valid,
|
|
1879
|
+
clean,
|
|
1880
|
+
inc,
|
|
1881
|
+
diff,
|
|
1882
|
+
major,
|
|
1883
|
+
minor,
|
|
1884
|
+
patch,
|
|
1885
|
+
prerelease,
|
|
1886
|
+
compare,
|
|
1887
|
+
rcompare,
|
|
1888
|
+
compareLoose,
|
|
1889
|
+
compareBuild,
|
|
1890
|
+
sort,
|
|
1891
|
+
rsort,
|
|
1892
|
+
gt,
|
|
1893
|
+
lt,
|
|
1894
|
+
eq,
|
|
1895
|
+
neq,
|
|
1896
|
+
gte: gte4,
|
|
1897
|
+
lte,
|
|
1898
|
+
cmp,
|
|
1899
|
+
coerce: coerce5,
|
|
1900
|
+
Comparator,
|
|
1901
|
+
Range,
|
|
1902
|
+
satisfies,
|
|
1903
|
+
toComparators,
|
|
1904
|
+
maxSatisfying,
|
|
1905
|
+
minSatisfying,
|
|
1906
|
+
minVersion,
|
|
1907
|
+
validRange,
|
|
1908
|
+
outside,
|
|
1909
|
+
gtr,
|
|
1910
|
+
ltr,
|
|
1911
|
+
intersects,
|
|
1912
|
+
simplifyRange,
|
|
1913
|
+
subset,
|
|
1914
|
+
SemVer,
|
|
1915
|
+
re: internalRe.re,
|
|
1916
|
+
src: internalRe.src,
|
|
1917
|
+
tokens: internalRe.t,
|
|
1918
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
1919
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
1920
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
1921
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
1922
|
+
};
|
|
1923
|
+
}
|
|
1924
|
+
});
|
|
29
1925
|
|
|
30
1926
|
// src/index.ts
|
|
31
1927
|
var src_exports = {};
|
|
@@ -118,8 +2014,8 @@ var import_viem = require("viem");
|
|
|
118
2014
|
var ZORA_API_BASE = "https://api.zora.co/";
|
|
119
2015
|
var OPEN_EDITION_MINT_SIZE = BigInt("18446744073709551615");
|
|
120
2016
|
var SUBGRAPH_CONFIG_BASE = "https://api.goldsky.com/api/public/project_clhk16b61ay9t49vm6ntn4mkz/subgraphs";
|
|
121
|
-
function getSubgraph(name,
|
|
122
|
-
return `${SUBGRAPH_CONFIG_BASE}/${name}/${
|
|
2017
|
+
function getSubgraph(name, version) {
|
|
2018
|
+
return `${SUBGRAPH_CONFIG_BASE}/${name}/${version}/gn`;
|
|
123
2019
|
}
|
|
124
2020
|
var zora721Abi = (0, import_viem.parseAbi)([
|
|
125
2021
|
"function mintWithRewards(address recipient, uint256 quantity, string calldata comment, address mintReferral) external payable",
|
|
@@ -455,7 +2351,7 @@ function migratePremintConfigToV2({
|
|
|
455
2351
|
};
|
|
456
2352
|
}
|
|
457
2353
|
var recoverCreatorFromCreatorAttribution = async ({
|
|
458
|
-
creatorAttribution: { version
|
|
2354
|
+
creatorAttribution: { version, domainName, structHash, signature },
|
|
459
2355
|
chainId,
|
|
460
2356
|
tokenContract
|
|
461
2357
|
}) => {
|
|
@@ -464,7 +2360,7 @@ var recoverCreatorFromCreatorAttribution = async ({
|
|
|
464
2360
|
chainId,
|
|
465
2361
|
name: domainName,
|
|
466
2362
|
verifyingContract: tokenContract,
|
|
467
|
-
version
|
|
2363
|
+
version
|
|
468
2364
|
},
|
|
469
2365
|
types: {
|
|
470
2366
|
EIP712Domain: [
|
|
@@ -500,11 +2396,11 @@ var supportedPremintVersions = async ({
|
|
|
500
2396
|
});
|
|
501
2397
|
};
|
|
502
2398
|
var supportsPremintVersion = async ({
|
|
503
|
-
version
|
|
2399
|
+
version,
|
|
504
2400
|
tokenContract,
|
|
505
2401
|
publicClient
|
|
506
2402
|
}) => {
|
|
507
|
-
return (await supportedPremintVersions({ tokenContract, publicClient })).includes(
|
|
2403
|
+
return (await supportedPremintVersions({ tokenContract, publicClient })).includes(version);
|
|
508
2404
|
};
|
|
509
2405
|
async function getPremintCollectionAddress({
|
|
510
2406
|
publicClient,
|
|
@@ -528,7 +2424,7 @@ async function getPremintCollectionAddress({
|
|
|
528
2424
|
}
|
|
529
2425
|
function applyUpdateToPremint({
|
|
530
2426
|
uid,
|
|
531
|
-
version
|
|
2427
|
+
version,
|
|
532
2428
|
tokenConfig,
|
|
533
2429
|
tokenConfigUpdates
|
|
534
2430
|
}) {
|
|
@@ -539,7 +2435,7 @@ function applyUpdateToPremint({
|
|
|
539
2435
|
const result = {
|
|
540
2436
|
deleted: false,
|
|
541
2437
|
uid,
|
|
542
|
-
version:
|
|
2438
|
+
version: version + 1,
|
|
543
2439
|
tokenConfig: updatedTokenConfig
|
|
544
2440
|
};
|
|
545
2441
|
return result;
|
|
@@ -881,7 +2777,7 @@ function buildPremintsOfContractQuery({
|
|
|
881
2777
|
}
|
|
882
2778
|
|
|
883
2779
|
// src/mint/subgraph-mint-getter.ts
|
|
884
|
-
var semver = __toESM(
|
|
2780
|
+
var semver = __toESM(require_semver2(), 1);
|
|
885
2781
|
var getApiNetworkConfigForChain = (chainId) => {
|
|
886
2782
|
if (!networkConfigByChain[chainId]) {
|
|
887
2783
|
throw new Error(`chain id ${chainId} network not configured `);
|
|
@@ -1726,7 +3622,7 @@ var import_viem5 = require("viem");
|
|
|
1726
3622
|
var import_protocol_deployments6 = require("@zoralabs/protocol-deployments");
|
|
1727
3623
|
|
|
1728
3624
|
// src/mint/utils.ts
|
|
1729
|
-
var semver2 = __toESM(
|
|
3625
|
+
var semver2 = __toESM(require_semver2(), 1);
|
|
1730
3626
|
var contractSupportsNewMintFunction = (contractVersion) => {
|
|
1731
3627
|
if (!contractVersion) {
|
|
1732
3628
|
return false;
|
|
@@ -2283,7 +4179,7 @@ async function getContractInfo({
|
|
|
2283
4179
|
// src/create/token-setup.ts
|
|
2284
4180
|
var import_protocol_deployments8 = require("@zoralabs/protocol-deployments");
|
|
2285
4181
|
var import_viem7 = require("viem");
|
|
2286
|
-
var semver3 = __toESM(
|
|
4182
|
+
var semver3 = __toESM(require_semver2(), 1);
|
|
2287
4183
|
var PERMISSION_BITS = {
|
|
2288
4184
|
MINTER: 2n ** 2n
|
|
2289
4185
|
};
|
|
@@ -2988,7 +4884,7 @@ var unwrapAndForwardEthPermitAndTypedDataDefinition = ({
|
|
|
2988
4884
|
tokenIds,
|
|
2989
4885
|
quantities,
|
|
2990
4886
|
safeTransferData: safeTransferData || makeCallWithEthSafeTransferData(callWithEth),
|
|
2991
|
-
to: import_protocol_deployments11.
|
|
4887
|
+
to: import_protocol_deployments11.mintsEthUnwrapperAndCallerAddress[chainId],
|
|
2992
4888
|
nonce
|
|
2993
4889
|
});
|
|
2994
4890
|
|
|
@@ -3029,91 +4925,16 @@ function createCollectorClient(params) {
|
|
|
3029
4925
|
mint: (p) => mintClient.mint(p),
|
|
3030
4926
|
getMintCosts: (p) => mintClient.getMintCosts(p)
|
|
3031
4927
|
};
|
|
3032
|
-
}
|
|
3033
|
-
|
|
3034
|
-
// src/ipfs/arweave.ts
|
|
3035
|
-
function isArweaveURL(url) {
|
|
3036
|
-
return url && typeof url === "string" ? url.startsWith("ar://") : false;
|
|
3037
|
-
}
|
|
3038
|
-
|
|
3039
|
-
// ../../node_modules/multiformats/esm/vendor/varint.js
|
|
3040
|
-
var encode_1 = encode;
|
|
3041
|
-
var MSB = 128;
|
|
3042
|
-
var REST = 127;
|
|
3043
|
-
var MSBALL = ~REST;
|
|
3044
|
-
var INT = Math.pow(2, 31);
|
|
3045
|
-
function encode(num, out, offset) {
|
|
3046
|
-
out = out || [];
|
|
3047
|
-
offset = offset || 0;
|
|
3048
|
-
var oldOffset = offset;
|
|
3049
|
-
while (num >= INT) {
|
|
3050
|
-
out[offset++] = num & 255 | MSB;
|
|
3051
|
-
num /= 128;
|
|
3052
|
-
}
|
|
3053
|
-
while (num & MSBALL) {
|
|
3054
|
-
out[offset++] = num & 255 | MSB;
|
|
3055
|
-
num >>>= 7;
|
|
3056
|
-
}
|
|
3057
|
-
out[offset] = num | 0;
|
|
3058
|
-
encode.bytes = offset - oldOffset + 1;
|
|
3059
|
-
return out;
|
|
3060
|
-
}
|
|
3061
|
-
var decode = read;
|
|
3062
|
-
var MSB$1 = 128;
|
|
3063
|
-
var REST$1 = 127;
|
|
3064
|
-
function read(buf, offset) {
|
|
3065
|
-
var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;
|
|
3066
|
-
do {
|
|
3067
|
-
if (counter >= l) {
|
|
3068
|
-
read.bytes = 0;
|
|
3069
|
-
throw new RangeError("Could not decode varint");
|
|
3070
|
-
}
|
|
3071
|
-
b = buf[counter++];
|
|
3072
|
-
res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);
|
|
3073
|
-
shift += 7;
|
|
3074
|
-
} while (b >= MSB$1);
|
|
3075
|
-
read.bytes = counter - offset;
|
|
3076
|
-
return res;
|
|
3077
|
-
}
|
|
3078
|
-
var N1 = Math.pow(2, 7);
|
|
3079
|
-
var N2 = Math.pow(2, 14);
|
|
3080
|
-
var N3 = Math.pow(2, 21);
|
|
3081
|
-
var N4 = Math.pow(2, 28);
|
|
3082
|
-
var N5 = Math.pow(2, 35);
|
|
3083
|
-
var N6 = Math.pow(2, 42);
|
|
3084
|
-
var N7 = Math.pow(2, 49);
|
|
3085
|
-
var N8 = Math.pow(2, 56);
|
|
3086
|
-
var N9 = Math.pow(2, 63);
|
|
3087
|
-
var length = function(value) {
|
|
3088
|
-
return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
|
|
3089
|
-
};
|
|
3090
|
-
var varint = {
|
|
3091
|
-
encode: encode_1,
|
|
3092
|
-
decode,
|
|
3093
|
-
encodingLength: length
|
|
3094
|
-
};
|
|
3095
|
-
var _brrp_varint = varint;
|
|
3096
|
-
var varint_default = _brrp_varint;
|
|
4928
|
+
}
|
|
3097
4929
|
|
|
3098
|
-
//
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
code,
|
|
3103
|
-
varint_default.decode.bytes
|
|
3104
|
-
];
|
|
3105
|
-
};
|
|
3106
|
-
var encodeTo = (int, target, offset = 0) => {
|
|
3107
|
-
varint_default.encode(int, target, offset);
|
|
3108
|
-
return target;
|
|
3109
|
-
};
|
|
3110
|
-
var encodingLength = (int) => {
|
|
3111
|
-
return varint_default.encodingLength(int);
|
|
3112
|
-
};
|
|
4930
|
+
// src/ipfs/arweave.ts
|
|
4931
|
+
function isArweaveURL(url) {
|
|
4932
|
+
return url && typeof url === "string" ? url.startsWith("ar://") : false;
|
|
4933
|
+
}
|
|
3113
4934
|
|
|
3114
|
-
// ../../node_modules/multiformats/
|
|
4935
|
+
// ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/bytes.js
|
|
3115
4936
|
var empty = new Uint8Array(0);
|
|
3116
|
-
|
|
4937
|
+
function equals(aa, bb) {
|
|
3117
4938
|
if (aa === bb)
|
|
3118
4939
|
return true;
|
|
3119
4940
|
if (aa.byteLength !== bb.byteLength) {
|
|
@@ -3125,8 +4946,8 @@ var equals = (aa, bb) => {
|
|
|
3125
4946
|
}
|
|
3126
4947
|
}
|
|
3127
4948
|
return true;
|
|
3128
|
-
}
|
|
3129
|
-
|
|
4949
|
+
}
|
|
4950
|
+
function coerce4(o) {
|
|
3130
4951
|
if (o instanceof Uint8Array && o.constructor.name === "Uint8Array")
|
|
3131
4952
|
return o;
|
|
3132
4953
|
if (o instanceof ArrayBuffer)
|
|
@@ -3135,46 +4956,9 @@ var coerce4 = (o) => {
|
|
|
3135
4956
|
return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
|
|
3136
4957
|
}
|
|
3137
4958
|
throw new Error("Unknown type, must be binary type");
|
|
3138
|
-
}
|
|
3139
|
-
|
|
3140
|
-
// ../../node_modules/multiformats/esm/src/hashes/digest.js
|
|
3141
|
-
var create = (code, digest) => {
|
|
3142
|
-
const size = digest.byteLength;
|
|
3143
|
-
const sizeOffset = encodingLength(code);
|
|
3144
|
-
const digestOffset = sizeOffset + encodingLength(size);
|
|
3145
|
-
const bytes = new Uint8Array(digestOffset + size);
|
|
3146
|
-
encodeTo(code, bytes, 0);
|
|
3147
|
-
encodeTo(size, bytes, sizeOffset);
|
|
3148
|
-
bytes.set(digest, digestOffset);
|
|
3149
|
-
return new Digest(code, size, digest, bytes);
|
|
3150
|
-
};
|
|
3151
|
-
var decode3 = (multihash) => {
|
|
3152
|
-
const bytes = coerce4(multihash);
|
|
3153
|
-
const [code, sizeOffset] = decode2(bytes);
|
|
3154
|
-
const [size, digestOffset] = decode2(bytes.subarray(sizeOffset));
|
|
3155
|
-
const digest = bytes.subarray(sizeOffset + digestOffset);
|
|
3156
|
-
if (digest.byteLength !== size) {
|
|
3157
|
-
throw new Error("Incorrect length");
|
|
3158
|
-
}
|
|
3159
|
-
return new Digest(code, size, digest, bytes);
|
|
3160
|
-
};
|
|
3161
|
-
var equals2 = (a, b) => {
|
|
3162
|
-
if (a === b) {
|
|
3163
|
-
return true;
|
|
3164
|
-
} else {
|
|
3165
|
-
return a.code === b.code && a.size === b.size && equals(a.bytes, b.bytes);
|
|
3166
|
-
}
|
|
3167
|
-
};
|
|
3168
|
-
var Digest = class {
|
|
3169
|
-
constructor(code, size, digest, bytes) {
|
|
3170
|
-
this.code = code;
|
|
3171
|
-
this.size = size;
|
|
3172
|
-
this.digest = digest;
|
|
3173
|
-
this.bytes = bytes;
|
|
3174
|
-
}
|
|
3175
|
-
};
|
|
4959
|
+
}
|
|
3176
4960
|
|
|
3177
|
-
// ../../node_modules/multiformats/
|
|
4961
|
+
// ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/vendor/base-x.js
|
|
3178
4962
|
function base2(ALPHABET, name) {
|
|
3179
4963
|
if (ALPHABET.length >= 255) {
|
|
3180
4964
|
throw new TypeError("Alphabet too long");
|
|
@@ -3310,9 +5094,12 @@ var src = base2;
|
|
|
3310
5094
|
var _brrp__multiformats_scope_baseX = src;
|
|
3311
5095
|
var base_x_default = _brrp__multiformats_scope_baseX;
|
|
3312
5096
|
|
|
3313
|
-
// ../../node_modules/multiformats/
|
|
5097
|
+
// ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/bases/base.js
|
|
3314
5098
|
var Encoder = class {
|
|
3315
5099
|
constructor(name, prefix, baseEncode) {
|
|
5100
|
+
__publicField(this, "name");
|
|
5101
|
+
__publicField(this, "prefix");
|
|
5102
|
+
__publicField(this, "baseEncode");
|
|
3316
5103
|
this.name = name;
|
|
3317
5104
|
this.prefix = prefix;
|
|
3318
5105
|
this.baseEncode = baseEncode;
|
|
@@ -3327,6 +5114,10 @@ var Encoder = class {
|
|
|
3327
5114
|
};
|
|
3328
5115
|
var Decoder = class {
|
|
3329
5116
|
constructor(name, prefix, baseDecode) {
|
|
5117
|
+
__publicField(this, "name");
|
|
5118
|
+
__publicField(this, "prefix");
|
|
5119
|
+
__publicField(this, "baseDecode");
|
|
5120
|
+
__publicField(this, "prefixCodePoint");
|
|
3330
5121
|
this.name = name;
|
|
3331
5122
|
this.prefix = prefix;
|
|
3332
5123
|
if (prefix.codePointAt(0) === void 0) {
|
|
@@ -3351,6 +5142,7 @@ var Decoder = class {
|
|
|
3351
5142
|
};
|
|
3352
5143
|
var ComposedDecoder = class {
|
|
3353
5144
|
constructor(decoders) {
|
|
5145
|
+
__publicField(this, "decoders");
|
|
3354
5146
|
this.decoders = decoders;
|
|
3355
5147
|
}
|
|
3356
5148
|
or(decoder) {
|
|
@@ -3359,19 +5151,27 @@ var ComposedDecoder = class {
|
|
|
3359
5151
|
decode(input) {
|
|
3360
5152
|
const prefix = input[0];
|
|
3361
5153
|
const decoder = this.decoders[prefix];
|
|
3362
|
-
if (decoder) {
|
|
5154
|
+
if (decoder != null) {
|
|
3363
5155
|
return decoder.decode(input);
|
|
3364
5156
|
} else {
|
|
3365
5157
|
throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
|
|
3366
5158
|
}
|
|
3367
5159
|
}
|
|
3368
5160
|
};
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
}
|
|
5161
|
+
function or(left, right) {
|
|
5162
|
+
return new ComposedDecoder({
|
|
5163
|
+
...left.decoders ?? { [left.prefix]: left },
|
|
5164
|
+
...right.decoders ?? { [right.prefix]: right }
|
|
5165
|
+
});
|
|
5166
|
+
}
|
|
3373
5167
|
var Codec = class {
|
|
3374
5168
|
constructor(name, prefix, baseEncode, baseDecode) {
|
|
5169
|
+
__publicField(this, "name");
|
|
5170
|
+
__publicField(this, "prefix");
|
|
5171
|
+
__publicField(this, "baseEncode");
|
|
5172
|
+
__publicField(this, "baseDecode");
|
|
5173
|
+
__publicField(this, "encoder");
|
|
5174
|
+
__publicField(this, "decoder");
|
|
3375
5175
|
this.name = name;
|
|
3376
5176
|
this.prefix = prefix;
|
|
3377
5177
|
this.baseEncode = baseEncode;
|
|
@@ -3386,8 +5186,10 @@ var Codec = class {
|
|
|
3386
5186
|
return this.decoder.decode(input);
|
|
3387
5187
|
}
|
|
3388
5188
|
};
|
|
3389
|
-
|
|
3390
|
-
|
|
5189
|
+
function from({ name, prefix, encode: encode3, decode: decode5 }) {
|
|
5190
|
+
return new Codec(name, prefix, encode3, decode5);
|
|
5191
|
+
}
|
|
5192
|
+
function baseX({ name, prefix, alphabet }) {
|
|
3391
5193
|
const { encode: encode3, decode: decode5 } = base_x_default(alphabet, name);
|
|
3392
5194
|
return from({
|
|
3393
5195
|
prefix,
|
|
@@ -3395,8 +5197,8 @@ var baseX = ({ prefix, name, alphabet }) => {
|
|
|
3395
5197
|
encode: encode3,
|
|
3396
5198
|
decode: (text) => coerce4(decode5(text))
|
|
3397
5199
|
});
|
|
3398
|
-
}
|
|
3399
|
-
|
|
5200
|
+
}
|
|
5201
|
+
function decode(string, alphabet, bitsPerChar, name) {
|
|
3400
5202
|
const codes = {};
|
|
3401
5203
|
for (let i = 0; i < alphabet.length; ++i) {
|
|
3402
5204
|
codes[alphabet[i]] = i;
|
|
@@ -3421,12 +5223,12 @@ var decode4 = (string, alphabet, bitsPerChar, name) => {
|
|
|
3421
5223
|
out[written++] = 255 & buffer >> bits;
|
|
3422
5224
|
}
|
|
3423
5225
|
}
|
|
3424
|
-
if (bits >= bitsPerChar || 255 & buffer << 8 - bits) {
|
|
5226
|
+
if (bits >= bitsPerChar || (255 & buffer << 8 - bits) !== 0) {
|
|
3425
5227
|
throw new SyntaxError("Unexpected end of data");
|
|
3426
5228
|
}
|
|
3427
5229
|
return out;
|
|
3428
|
-
}
|
|
3429
|
-
|
|
5230
|
+
}
|
|
5231
|
+
function encode(data, alphabet, bitsPerChar) {
|
|
3430
5232
|
const pad = alphabet[alphabet.length - 1] === "=";
|
|
3431
5233
|
const mask = (1 << bitsPerChar) - 1;
|
|
3432
5234
|
let out = "";
|
|
@@ -3440,42 +5242,30 @@ var encode2 = (data, alphabet, bitsPerChar) => {
|
|
|
3440
5242
|
out += alphabet[mask & buffer >> bits];
|
|
3441
5243
|
}
|
|
3442
5244
|
}
|
|
3443
|
-
if (bits) {
|
|
5245
|
+
if (bits !== 0) {
|
|
3444
5246
|
out += alphabet[mask & buffer << bitsPerChar - bits];
|
|
3445
5247
|
}
|
|
3446
5248
|
if (pad) {
|
|
3447
|
-
while (out.length * bitsPerChar & 7) {
|
|
5249
|
+
while ((out.length * bitsPerChar & 7) !== 0) {
|
|
3448
5250
|
out += "=";
|
|
3449
5251
|
}
|
|
3450
5252
|
}
|
|
3451
5253
|
return out;
|
|
3452
|
-
}
|
|
3453
|
-
|
|
5254
|
+
}
|
|
5255
|
+
function rfc4648({ name, prefix, bitsPerChar, alphabet }) {
|
|
3454
5256
|
return from({
|
|
3455
5257
|
prefix,
|
|
3456
5258
|
name,
|
|
3457
5259
|
encode(input) {
|
|
3458
|
-
return
|
|
5260
|
+
return encode(input, alphabet, bitsPerChar);
|
|
3459
5261
|
},
|
|
3460
5262
|
decode(input) {
|
|
3461
|
-
return
|
|
5263
|
+
return decode(input, alphabet, bitsPerChar, name);
|
|
3462
5264
|
}
|
|
3463
5265
|
});
|
|
3464
|
-
}
|
|
3465
|
-
|
|
3466
|
-
// ../../node_modules/multiformats/esm/src/bases/base58.js
|
|
3467
|
-
var base58btc = baseX({
|
|
3468
|
-
name: "base58btc",
|
|
3469
|
-
prefix: "z",
|
|
3470
|
-
alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
|
3471
|
-
});
|
|
3472
|
-
var base58flickr = baseX({
|
|
3473
|
-
name: "base58flickr",
|
|
3474
|
-
prefix: "Z",
|
|
3475
|
-
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
3476
|
-
});
|
|
5266
|
+
}
|
|
3477
5267
|
|
|
3478
|
-
// ../../node_modules/multiformats/
|
|
5268
|
+
// ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/bases/base32.js
|
|
3479
5269
|
var base32 = rfc4648({
|
|
3480
5270
|
prefix: "b",
|
|
3481
5271
|
name: "base32",
|
|
@@ -3531,34 +5321,198 @@ var base32z = rfc4648({
|
|
|
3531
5321
|
bitsPerChar: 5
|
|
3532
5322
|
});
|
|
3533
5323
|
|
|
3534
|
-
// ../../node_modules/multiformats/
|
|
5324
|
+
// ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/bases/base58.js
|
|
5325
|
+
var base58btc = baseX({
|
|
5326
|
+
name: "base58btc",
|
|
5327
|
+
prefix: "z",
|
|
5328
|
+
alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
|
5329
|
+
});
|
|
5330
|
+
var base58flickr = baseX({
|
|
5331
|
+
name: "base58flickr",
|
|
5332
|
+
prefix: "Z",
|
|
5333
|
+
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
5334
|
+
});
|
|
5335
|
+
|
|
5336
|
+
// ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/vendor/varint.js
|
|
5337
|
+
var encode_1 = encode2;
|
|
5338
|
+
var MSB = 128;
|
|
5339
|
+
var REST = 127;
|
|
5340
|
+
var MSBALL = ~REST;
|
|
5341
|
+
var INT = Math.pow(2, 31);
|
|
5342
|
+
function encode2(num, out, offset) {
|
|
5343
|
+
out = out || [];
|
|
5344
|
+
offset = offset || 0;
|
|
5345
|
+
var oldOffset = offset;
|
|
5346
|
+
while (num >= INT) {
|
|
5347
|
+
out[offset++] = num & 255 | MSB;
|
|
5348
|
+
num /= 128;
|
|
5349
|
+
}
|
|
5350
|
+
while (num & MSBALL) {
|
|
5351
|
+
out[offset++] = num & 255 | MSB;
|
|
5352
|
+
num >>>= 7;
|
|
5353
|
+
}
|
|
5354
|
+
out[offset] = num | 0;
|
|
5355
|
+
encode2.bytes = offset - oldOffset + 1;
|
|
5356
|
+
return out;
|
|
5357
|
+
}
|
|
5358
|
+
var decode2 = read;
|
|
5359
|
+
var MSB$1 = 128;
|
|
5360
|
+
var REST$1 = 127;
|
|
5361
|
+
function read(buf, offset) {
|
|
5362
|
+
var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;
|
|
5363
|
+
do {
|
|
5364
|
+
if (counter >= l) {
|
|
5365
|
+
read.bytes = 0;
|
|
5366
|
+
throw new RangeError("Could not decode varint");
|
|
5367
|
+
}
|
|
5368
|
+
b = buf[counter++];
|
|
5369
|
+
res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);
|
|
5370
|
+
shift += 7;
|
|
5371
|
+
} while (b >= MSB$1);
|
|
5372
|
+
read.bytes = counter - offset;
|
|
5373
|
+
return res;
|
|
5374
|
+
}
|
|
5375
|
+
var N1 = Math.pow(2, 7);
|
|
5376
|
+
var N2 = Math.pow(2, 14);
|
|
5377
|
+
var N3 = Math.pow(2, 21);
|
|
5378
|
+
var N4 = Math.pow(2, 28);
|
|
5379
|
+
var N5 = Math.pow(2, 35);
|
|
5380
|
+
var N6 = Math.pow(2, 42);
|
|
5381
|
+
var N7 = Math.pow(2, 49);
|
|
5382
|
+
var N8 = Math.pow(2, 56);
|
|
5383
|
+
var N9 = Math.pow(2, 63);
|
|
5384
|
+
var length = function(value) {
|
|
5385
|
+
return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
|
|
5386
|
+
};
|
|
5387
|
+
var varint = {
|
|
5388
|
+
encode: encode_1,
|
|
5389
|
+
decode: decode2,
|
|
5390
|
+
encodingLength: length
|
|
5391
|
+
};
|
|
5392
|
+
var _brrp_varint = varint;
|
|
5393
|
+
var varint_default = _brrp_varint;
|
|
5394
|
+
|
|
5395
|
+
// ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/varint.js
|
|
5396
|
+
function decode3(data, offset = 0) {
|
|
5397
|
+
const code = varint_default.decode(data, offset);
|
|
5398
|
+
return [code, varint_default.decode.bytes];
|
|
5399
|
+
}
|
|
5400
|
+
function encodeTo(int, target, offset = 0) {
|
|
5401
|
+
varint_default.encode(int, target, offset);
|
|
5402
|
+
return target;
|
|
5403
|
+
}
|
|
5404
|
+
function encodingLength(int) {
|
|
5405
|
+
return varint_default.encodingLength(int);
|
|
5406
|
+
}
|
|
5407
|
+
|
|
5408
|
+
// ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/hashes/digest.js
|
|
5409
|
+
function create(code, digest) {
|
|
5410
|
+
const size = digest.byteLength;
|
|
5411
|
+
const sizeOffset = encodingLength(code);
|
|
5412
|
+
const digestOffset = sizeOffset + encodingLength(size);
|
|
5413
|
+
const bytes = new Uint8Array(digestOffset + size);
|
|
5414
|
+
encodeTo(code, bytes, 0);
|
|
5415
|
+
encodeTo(size, bytes, sizeOffset);
|
|
5416
|
+
bytes.set(digest, digestOffset);
|
|
5417
|
+
return new Digest(code, size, digest, bytes);
|
|
5418
|
+
}
|
|
5419
|
+
function decode4(multihash) {
|
|
5420
|
+
const bytes = coerce4(multihash);
|
|
5421
|
+
const [code, sizeOffset] = decode3(bytes);
|
|
5422
|
+
const [size, digestOffset] = decode3(bytes.subarray(sizeOffset));
|
|
5423
|
+
const digest = bytes.subarray(sizeOffset + digestOffset);
|
|
5424
|
+
if (digest.byteLength !== size) {
|
|
5425
|
+
throw new Error("Incorrect length");
|
|
5426
|
+
}
|
|
5427
|
+
return new Digest(code, size, digest, bytes);
|
|
5428
|
+
}
|
|
5429
|
+
function equals2(a, b) {
|
|
5430
|
+
if (a === b) {
|
|
5431
|
+
return true;
|
|
5432
|
+
} else {
|
|
5433
|
+
const data = b;
|
|
5434
|
+
return a.code === data.code && a.size === data.size && data.bytes instanceof Uint8Array && equals(a.bytes, data.bytes);
|
|
5435
|
+
}
|
|
5436
|
+
}
|
|
5437
|
+
var Digest = class {
|
|
5438
|
+
/**
|
|
5439
|
+
* Creates a multihash digest.
|
|
5440
|
+
*/
|
|
5441
|
+
constructor(code, size, digest, bytes) {
|
|
5442
|
+
__publicField(this, "code");
|
|
5443
|
+
__publicField(this, "size");
|
|
5444
|
+
__publicField(this, "digest");
|
|
5445
|
+
__publicField(this, "bytes");
|
|
5446
|
+
this.code = code;
|
|
5447
|
+
this.size = size;
|
|
5448
|
+
this.digest = digest;
|
|
5449
|
+
this.bytes = bytes;
|
|
5450
|
+
}
|
|
5451
|
+
};
|
|
5452
|
+
|
|
5453
|
+
// ../../node_modules/.pnpm/multiformats@13.2.0/node_modules/multiformats/dist/src/cid.js
|
|
5454
|
+
function format(link, base3) {
|
|
5455
|
+
const { bytes, version } = link;
|
|
5456
|
+
switch (version) {
|
|
5457
|
+
case 0:
|
|
5458
|
+
return toStringV0(bytes, baseCache(link), base3 ?? base58btc.encoder);
|
|
5459
|
+
default:
|
|
5460
|
+
return toStringV1(bytes, baseCache(link), base3 ?? base32.encoder);
|
|
5461
|
+
}
|
|
5462
|
+
}
|
|
5463
|
+
var cache = /* @__PURE__ */ new WeakMap();
|
|
5464
|
+
function baseCache(cid) {
|
|
5465
|
+
const baseCache2 = cache.get(cid);
|
|
5466
|
+
if (baseCache2 == null) {
|
|
5467
|
+
const baseCache3 = /* @__PURE__ */ new Map();
|
|
5468
|
+
cache.set(cid, baseCache3);
|
|
5469
|
+
return baseCache3;
|
|
5470
|
+
}
|
|
5471
|
+
return baseCache2;
|
|
5472
|
+
}
|
|
5473
|
+
var _a;
|
|
3535
5474
|
var CID = class _CID {
|
|
3536
|
-
|
|
5475
|
+
/**
|
|
5476
|
+
* @param version - Version of the CID
|
|
5477
|
+
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
|
5478
|
+
* @param multihash - (Multi)hash of the of the content.
|
|
5479
|
+
*/
|
|
5480
|
+
constructor(version, code, multihash, bytes) {
|
|
5481
|
+
__publicField(this, "code");
|
|
5482
|
+
__publicField(this, "version");
|
|
5483
|
+
__publicField(this, "multihash");
|
|
5484
|
+
__publicField(this, "bytes");
|
|
5485
|
+
__publicField(this, "/");
|
|
5486
|
+
__publicField(this, _a, "CID");
|
|
3537
5487
|
this.code = code;
|
|
3538
|
-
this.version =
|
|
5488
|
+
this.version = version;
|
|
3539
5489
|
this.multihash = multihash;
|
|
3540
5490
|
this.bytes = bytes;
|
|
3541
|
-
this
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
5491
|
+
this["/"] = bytes;
|
|
5492
|
+
}
|
|
5493
|
+
/**
|
|
5494
|
+
* Signalling `cid.asCID === cid` has been replaced with `cid['/'] === cid.bytes`
|
|
5495
|
+
* please either use `CID.asCID(cid)` or switch to new signalling mechanism
|
|
5496
|
+
*
|
|
5497
|
+
* @deprecated
|
|
5498
|
+
*/
|
|
5499
|
+
get asCID() {
|
|
5500
|
+
return this;
|
|
5501
|
+
}
|
|
5502
|
+
// ArrayBufferView
|
|
5503
|
+
get byteOffset() {
|
|
5504
|
+
return this.bytes.byteOffset;
|
|
5505
|
+
}
|
|
5506
|
+
// ArrayBufferView
|
|
5507
|
+
get byteLength() {
|
|
5508
|
+
return this.bytes.byteLength;
|
|
3555
5509
|
}
|
|
3556
5510
|
toV0() {
|
|
3557
5511
|
switch (this.version) {
|
|
3558
5512
|
case 0: {
|
|
3559
5513
|
return this;
|
|
3560
5514
|
}
|
|
3561
|
-
|
|
5515
|
+
case 1: {
|
|
3562
5516
|
const { code, multihash } = this;
|
|
3563
5517
|
if (code !== DAG_PB_CODE) {
|
|
3564
5518
|
throw new Error("Cannot convert a non dag-pb CID to CIDv0");
|
|
@@ -3568,6 +5522,9 @@ var CID = class _CID {
|
|
|
3568
5522
|
}
|
|
3569
5523
|
return _CID.createV0(multihash);
|
|
3570
5524
|
}
|
|
5525
|
+
default: {
|
|
5526
|
+
throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);
|
|
5527
|
+
}
|
|
3571
5528
|
}
|
|
3572
5529
|
}
|
|
3573
5530
|
toV1() {
|
|
@@ -3581,102 +5538,125 @@ var CID = class _CID {
|
|
|
3581
5538
|
return this;
|
|
3582
5539
|
}
|
|
3583
5540
|
default: {
|
|
3584
|
-
throw Error(`Can not convert CID version ${this.version} to version
|
|
5541
|
+
throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`);
|
|
3585
5542
|
}
|
|
3586
5543
|
}
|
|
3587
5544
|
}
|
|
3588
5545
|
equals(other) {
|
|
3589
|
-
return
|
|
5546
|
+
return _CID.equals(this, other);
|
|
5547
|
+
}
|
|
5548
|
+
static equals(self, other) {
|
|
5549
|
+
const unknown = other;
|
|
5550
|
+
return unknown != null && self.code === unknown.code && self.version === unknown.version && equals2(self.multihash, unknown.multihash);
|
|
3590
5551
|
}
|
|
3591
5552
|
toString(base3) {
|
|
3592
|
-
|
|
3593
|
-
switch (version2) {
|
|
3594
|
-
case 0:
|
|
3595
|
-
return toStringV0(bytes, _baseCache, base3 || base58btc.encoder);
|
|
3596
|
-
default:
|
|
3597
|
-
return toStringV1(bytes, _baseCache, base3 || base32.encoder);
|
|
3598
|
-
}
|
|
5553
|
+
return format(this, base3);
|
|
3599
5554
|
}
|
|
3600
5555
|
toJSON() {
|
|
3601
|
-
return {
|
|
3602
|
-
code: this.code,
|
|
3603
|
-
version: this.version,
|
|
3604
|
-
hash: this.multihash.bytes
|
|
3605
|
-
};
|
|
3606
|
-
}
|
|
3607
|
-
get [Symbol.toStringTag]() {
|
|
3608
|
-
return "CID";
|
|
3609
|
-
}
|
|
3610
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
3611
|
-
return "CID(" + this.toString() + ")";
|
|
3612
|
-
}
|
|
3613
|
-
static isCID(value) {
|
|
3614
|
-
deprecate(/^0\.0/, IS_CID_DEPRECATION);
|
|
3615
|
-
return !!(value && (value[cidSymbol] || value.asCID === value));
|
|
3616
|
-
}
|
|
3617
|
-
get toBaseEncodedString() {
|
|
3618
|
-
throw new Error("Deprecated, use .toString()");
|
|
3619
|
-
}
|
|
3620
|
-
get codec() {
|
|
3621
|
-
throw new Error('"codec" property is deprecated, use integer "code" property instead');
|
|
5556
|
+
return { "/": format(this) };
|
|
3622
5557
|
}
|
|
3623
|
-
|
|
3624
|
-
|
|
5558
|
+
link() {
|
|
5559
|
+
return this;
|
|
3625
5560
|
}
|
|
3626
|
-
|
|
3627
|
-
|
|
5561
|
+
// Legacy
|
|
5562
|
+
[(_a = Symbol.toStringTag, Symbol.for("nodejs.util.inspect.custom"))]() {
|
|
5563
|
+
return `CID(${this.toString()})`;
|
|
3628
5564
|
}
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
5565
|
+
/**
|
|
5566
|
+
* Takes any input `value` and returns a `CID` instance if it was
|
|
5567
|
+
* a `CID` otherwise returns `null`. If `value` is instanceof `CID`
|
|
5568
|
+
* it will return value back. If `value` is not instance of this CID
|
|
5569
|
+
* class, but is compatible CID it will return new instance of this
|
|
5570
|
+
* `CID` class. Otherwise returns null.
|
|
5571
|
+
*
|
|
5572
|
+
* This allows two different incompatible versions of CID library to
|
|
5573
|
+
* co-exist and interop as long as binary interface is compatible.
|
|
5574
|
+
*/
|
|
5575
|
+
static asCID(input) {
|
|
5576
|
+
if (input == null) {
|
|
5577
|
+
return null;
|
|
5578
|
+
}
|
|
5579
|
+
const value = input;
|
|
3633
5580
|
if (value instanceof _CID) {
|
|
3634
5581
|
return value;
|
|
3635
|
-
} else if (value != null && value.asCID === value) {
|
|
3636
|
-
const { version
|
|
3637
|
-
return new _CID(
|
|
3638
|
-
} else if (value
|
|
3639
|
-
const { version
|
|
3640
|
-
const digest =
|
|
3641
|
-
return _CID.create(
|
|
5582
|
+
} else if (value["/"] != null && value["/"] === value.bytes || value.asCID === value) {
|
|
5583
|
+
const { version, code, multihash, bytes } = value;
|
|
5584
|
+
return new _CID(version, code, multihash, bytes ?? encodeCID(version, code, multihash.bytes));
|
|
5585
|
+
} else if (value[cidSymbol] === true) {
|
|
5586
|
+
const { version, multihash, code } = value;
|
|
5587
|
+
const digest = decode4(multihash);
|
|
5588
|
+
return _CID.create(version, code, digest);
|
|
3642
5589
|
} else {
|
|
3643
5590
|
return null;
|
|
3644
5591
|
}
|
|
3645
5592
|
}
|
|
3646
|
-
|
|
5593
|
+
/**
|
|
5594
|
+
* @param version - Version of the CID
|
|
5595
|
+
* @param code - Code of the codec content is encoded in, see https://github.com/multiformats/multicodec/blob/master/table.csv
|
|
5596
|
+
* @param digest - (Multi)hash of the of the content.
|
|
5597
|
+
*/
|
|
5598
|
+
static create(version, code, digest) {
|
|
3647
5599
|
if (typeof code !== "number") {
|
|
3648
5600
|
throw new Error("String codecs are no longer supported");
|
|
3649
5601
|
}
|
|
3650
|
-
|
|
5602
|
+
if (!(digest.bytes instanceof Uint8Array)) {
|
|
5603
|
+
throw new Error("Invalid digest");
|
|
5604
|
+
}
|
|
5605
|
+
switch (version) {
|
|
3651
5606
|
case 0: {
|
|
3652
5607
|
if (code !== DAG_PB_CODE) {
|
|
3653
5608
|
throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
|
|
3654
5609
|
} else {
|
|
3655
|
-
return new _CID(
|
|
5610
|
+
return new _CID(version, code, digest, digest.bytes);
|
|
3656
5611
|
}
|
|
3657
5612
|
}
|
|
3658
5613
|
case 1: {
|
|
3659
|
-
const bytes = encodeCID(
|
|
3660
|
-
return new _CID(
|
|
5614
|
+
const bytes = encodeCID(version, code, digest.bytes);
|
|
5615
|
+
return new _CID(version, code, digest, bytes);
|
|
3661
5616
|
}
|
|
3662
5617
|
default: {
|
|
3663
5618
|
throw new Error("Invalid version");
|
|
3664
5619
|
}
|
|
3665
5620
|
}
|
|
3666
5621
|
}
|
|
5622
|
+
/**
|
|
5623
|
+
* Simplified version of `create` for CIDv0.
|
|
5624
|
+
*/
|
|
3667
5625
|
static createV0(digest) {
|
|
3668
5626
|
return _CID.create(0, DAG_PB_CODE, digest);
|
|
3669
5627
|
}
|
|
5628
|
+
/**
|
|
5629
|
+
* Simplified version of `create` for CIDv1.
|
|
5630
|
+
*
|
|
5631
|
+
* @param code - Content encoding format code.
|
|
5632
|
+
* @param digest - Multihash of the content.
|
|
5633
|
+
*/
|
|
3670
5634
|
static createV1(code, digest) {
|
|
3671
5635
|
return _CID.create(1, code, digest);
|
|
3672
5636
|
}
|
|
5637
|
+
/**
|
|
5638
|
+
* Decoded a CID from its binary representation. The byte array must contain
|
|
5639
|
+
* only the CID with no additional bytes.
|
|
5640
|
+
*
|
|
5641
|
+
* An error will be thrown if the bytes provided do not contain a valid
|
|
5642
|
+
* binary representation of a CID.
|
|
5643
|
+
*/
|
|
3673
5644
|
static decode(bytes) {
|
|
3674
5645
|
const [cid, remainder] = _CID.decodeFirst(bytes);
|
|
3675
|
-
if (remainder.length) {
|
|
5646
|
+
if (remainder.length !== 0) {
|
|
3676
5647
|
throw new Error("Incorrect length");
|
|
3677
5648
|
}
|
|
3678
5649
|
return cid;
|
|
3679
5650
|
}
|
|
5651
|
+
/**
|
|
5652
|
+
* Decoded a CID from its binary representation at the beginning of a byte
|
|
5653
|
+
* array.
|
|
5654
|
+
*
|
|
5655
|
+
* Returns an array with the first element containing the CID and the second
|
|
5656
|
+
* element containing the remainder of the original byte array. The remainder
|
|
5657
|
+
* will be a zero-length byte array if the provided bytes only contained a
|
|
5658
|
+
* binary CID representation.
|
|
5659
|
+
*/
|
|
3680
5660
|
static decodeFirst(bytes) {
|
|
3681
5661
|
const specs = _CID.inspectBytes(bytes);
|
|
3682
5662
|
const prefixSize = specs.size - specs.multihashSize;
|
|
@@ -3687,154 +5667,120 @@ var CID = class _CID {
|
|
|
3687
5667
|
const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
|
|
3688
5668
|
const digest = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
|
|
3689
5669
|
const cid = specs.version === 0 ? _CID.createV0(digest) : _CID.createV1(specs.codec, digest);
|
|
3690
|
-
return [
|
|
3691
|
-
cid,
|
|
3692
|
-
bytes.subarray(specs.size)
|
|
3693
|
-
];
|
|
5670
|
+
return [cid, bytes.subarray(specs.size)];
|
|
3694
5671
|
}
|
|
5672
|
+
/**
|
|
5673
|
+
* Inspect the initial bytes of a CID to determine its properties.
|
|
5674
|
+
*
|
|
5675
|
+
* Involves decoding up to 4 varints. Typically this will require only 4 to 6
|
|
5676
|
+
* bytes but for larger multicodec code values and larger multihash digest
|
|
5677
|
+
* lengths these varints can be quite large. It is recommended that at least
|
|
5678
|
+
* 10 bytes be made available in the `initialBytes` argument for a complete
|
|
5679
|
+
* inspection.
|
|
5680
|
+
*/
|
|
3695
5681
|
static inspectBytes(initialBytes) {
|
|
3696
5682
|
let offset = 0;
|
|
3697
5683
|
const next = () => {
|
|
3698
|
-
const [i, length2] =
|
|
5684
|
+
const [i, length2] = decode3(initialBytes.subarray(offset));
|
|
3699
5685
|
offset += length2;
|
|
3700
5686
|
return i;
|
|
3701
5687
|
};
|
|
3702
|
-
let
|
|
5688
|
+
let version = next();
|
|
3703
5689
|
let codec = DAG_PB_CODE;
|
|
3704
|
-
if (
|
|
3705
|
-
|
|
5690
|
+
if (version === 18) {
|
|
5691
|
+
version = 0;
|
|
3706
5692
|
offset = 0;
|
|
3707
|
-
} else
|
|
5693
|
+
} else {
|
|
3708
5694
|
codec = next();
|
|
3709
5695
|
}
|
|
3710
|
-
if (
|
|
3711
|
-
throw new RangeError(`Invalid CID version ${
|
|
5696
|
+
if (version !== 0 && version !== 1) {
|
|
5697
|
+
throw new RangeError(`Invalid CID version ${version}`);
|
|
3712
5698
|
}
|
|
3713
5699
|
const prefixSize = offset;
|
|
3714
5700
|
const multihashCode = next();
|
|
3715
5701
|
const digestSize = next();
|
|
3716
5702
|
const size = offset + digestSize;
|
|
3717
5703
|
const multihashSize = size - prefixSize;
|
|
3718
|
-
return {
|
|
3719
|
-
version: version2,
|
|
3720
|
-
codec,
|
|
3721
|
-
multihashCode,
|
|
3722
|
-
digestSize,
|
|
3723
|
-
multihashSize,
|
|
3724
|
-
size
|
|
3725
|
-
};
|
|
5704
|
+
return { version, codec, multihashCode, digestSize, multihashSize, size };
|
|
3726
5705
|
}
|
|
5706
|
+
/**
|
|
5707
|
+
* Takes cid in a string representation and creates an instance. If `base`
|
|
5708
|
+
* decoder is not provided will use a default from the configuration. It will
|
|
5709
|
+
* throw an error if encoding of the CID is not compatible with supplied (or
|
|
5710
|
+
* a default decoder).
|
|
5711
|
+
*/
|
|
3727
5712
|
static parse(source, base3) {
|
|
3728
5713
|
const [prefix, bytes] = parseCIDtoBytes(source, base3);
|
|
3729
5714
|
const cid = _CID.decode(bytes);
|
|
3730
|
-
cid.
|
|
5715
|
+
if (cid.version === 0 && source[0] !== "Q") {
|
|
5716
|
+
throw Error("Version 0 CID string must not include multibase prefix");
|
|
5717
|
+
}
|
|
5718
|
+
baseCache(cid).set(prefix, source);
|
|
3731
5719
|
return cid;
|
|
3732
5720
|
}
|
|
3733
5721
|
};
|
|
3734
|
-
|
|
5722
|
+
function parseCIDtoBytes(source, base3) {
|
|
3735
5723
|
switch (source[0]) {
|
|
3736
5724
|
case "Q": {
|
|
3737
|
-
const decoder = base3
|
|
5725
|
+
const decoder = base3 ?? base58btc;
|
|
3738
5726
|
return [
|
|
3739
5727
|
base58btc.prefix,
|
|
3740
5728
|
decoder.decode(`${base58btc.prefix}${source}`)
|
|
3741
5729
|
];
|
|
3742
5730
|
}
|
|
3743
5731
|
case base58btc.prefix: {
|
|
3744
|
-
const decoder = base3
|
|
3745
|
-
return [
|
|
3746
|
-
base58btc.prefix,
|
|
3747
|
-
decoder.decode(source)
|
|
3748
|
-
];
|
|
5732
|
+
const decoder = base3 ?? base58btc;
|
|
5733
|
+
return [base58btc.prefix, decoder.decode(source)];
|
|
3749
5734
|
}
|
|
3750
5735
|
case base32.prefix: {
|
|
3751
|
-
const decoder = base3
|
|
3752
|
-
return [
|
|
3753
|
-
base32.prefix,
|
|
3754
|
-
decoder.decode(source)
|
|
3755
|
-
];
|
|
5736
|
+
const decoder = base3 ?? base32;
|
|
5737
|
+
return [base32.prefix, decoder.decode(source)];
|
|
3756
5738
|
}
|
|
3757
5739
|
default: {
|
|
3758
5740
|
if (base3 == null) {
|
|
3759
5741
|
throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");
|
|
3760
5742
|
}
|
|
3761
|
-
return [
|
|
3762
|
-
source[0],
|
|
3763
|
-
base3.decode(source)
|
|
3764
|
-
];
|
|
5743
|
+
return [source[0], base3.decode(source)];
|
|
3765
5744
|
}
|
|
3766
5745
|
}
|
|
3767
|
-
}
|
|
3768
|
-
|
|
5746
|
+
}
|
|
5747
|
+
function toStringV0(bytes, cache2, base3) {
|
|
3769
5748
|
const { prefix } = base3;
|
|
3770
5749
|
if (prefix !== base58btc.prefix) {
|
|
3771
5750
|
throw Error(`Cannot string encode V0 in ${base3.name} encoding`);
|
|
3772
5751
|
}
|
|
3773
|
-
const cid =
|
|
5752
|
+
const cid = cache2.get(prefix);
|
|
3774
5753
|
if (cid == null) {
|
|
3775
5754
|
const cid2 = base3.encode(bytes).slice(1);
|
|
3776
|
-
|
|
5755
|
+
cache2.set(prefix, cid2);
|
|
3777
5756
|
return cid2;
|
|
3778
5757
|
} else {
|
|
3779
5758
|
return cid;
|
|
3780
5759
|
}
|
|
3781
|
-
}
|
|
3782
|
-
|
|
5760
|
+
}
|
|
5761
|
+
function toStringV1(bytes, cache2, base3) {
|
|
3783
5762
|
const { prefix } = base3;
|
|
3784
|
-
const cid =
|
|
5763
|
+
const cid = cache2.get(prefix);
|
|
3785
5764
|
if (cid == null) {
|
|
3786
5765
|
const cid2 = base3.encode(bytes);
|
|
3787
|
-
|
|
5766
|
+
cache2.set(prefix, cid2);
|
|
3788
5767
|
return cid2;
|
|
3789
5768
|
} else {
|
|
3790
5769
|
return cid;
|
|
3791
5770
|
}
|
|
3792
|
-
}
|
|
5771
|
+
}
|
|
3793
5772
|
var DAG_PB_CODE = 112;
|
|
3794
5773
|
var SHA_256_CODE = 18;
|
|
3795
|
-
|
|
3796
|
-
const codeOffset = encodingLength(
|
|
5774
|
+
function encodeCID(version, code, multihash) {
|
|
5775
|
+
const codeOffset = encodingLength(version);
|
|
3797
5776
|
const hashOffset = codeOffset + encodingLength(code);
|
|
3798
5777
|
const bytes = new Uint8Array(hashOffset + multihash.byteLength);
|
|
3799
|
-
encodeTo(
|
|
5778
|
+
encodeTo(version, bytes, 0);
|
|
3800
5779
|
encodeTo(code, bytes, codeOffset);
|
|
3801
5780
|
bytes.set(multihash, hashOffset);
|
|
3802
5781
|
return bytes;
|
|
3803
|
-
};
|
|
3804
|
-
var cidSymbol = Symbol.for("@ipld/js-cid/CID");
|
|
3805
|
-
var readonly = {
|
|
3806
|
-
writable: false,
|
|
3807
|
-
configurable: false,
|
|
3808
|
-
enumerable: true
|
|
3809
|
-
};
|
|
3810
|
-
var hidden = {
|
|
3811
|
-
writable: false,
|
|
3812
|
-
enumerable: false,
|
|
3813
|
-
configurable: false
|
|
3814
|
-
};
|
|
3815
|
-
var version = "0.0.0-dev";
|
|
3816
|
-
var deprecate = (range, message) => {
|
|
3817
|
-
if (range.test(version)) {
|
|
3818
|
-
console.warn(message);
|
|
3819
|
-
} else {
|
|
3820
|
-
throw new Error(message);
|
|
3821
|
-
}
|
|
3822
|
-
};
|
|
3823
|
-
var IS_CID_DEPRECATION = `CID.isCID(v) is deprecated and will be removed in the next major release.
|
|
3824
|
-
Following code pattern:
|
|
3825
|
-
|
|
3826
|
-
if (CID.isCID(value)) {
|
|
3827
|
-
doSomethingWithCID(value)
|
|
3828
|
-
}
|
|
3829
|
-
|
|
3830
|
-
Is replaced with:
|
|
3831
|
-
|
|
3832
|
-
const cid = CID.asCID(value)
|
|
3833
|
-
if (cid) {
|
|
3834
|
-
// Make sure to use cid instead of value
|
|
3835
|
-
doSomethingWithCID(cid)
|
|
3836
5782
|
}
|
|
3837
|
-
|
|
5783
|
+
var cidSymbol = Symbol.for("@ipld/js-cid/CID");
|
|
3838
5784
|
|
|
3839
5785
|
// src/ipfs/ipfs.ts
|
|
3840
5786
|
function isCID(str) {
|