@pipelab/plugin-electron 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/LICENSE +110 -0
- package/README.md +3 -0
- package/dist/index.cjs +2224 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2225 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +52 -0
- package/src/configure.ts +23 -0
- package/src/declarations.d.ts +1 -0
- package/src/fixtures/build/index.html +11 -0
- package/src/forge.ts +851 -0
- package/src/index.ts +94 -0
- package/src/make.spec.ts +57 -0
- package/src/make.ts +22 -0
- package/src/package-v2.ts +52 -0
- package/src/package.ts +22 -0
- package/src/preview.ts +35 -0
- package/src/public/electron.webp +0 -0
- package/src/utils.ts +35 -0
- package/tests/e2e/electron.spec.ts +64 -0
- package/tests/e2e/fixtures/folder-to-electron.json +171 -0
- package/tests/e2e/fixtures/folder-to-tauri.json +58 -0
- package/tests/e2e/vitest.config.mts +20 -0
- package/tsconfig.json +10 -0
- package/tsdown.config.ts +15 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2224 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
let _pipelab_plugin_core = require("@pipelab/plugin-core");
|
|
25
|
+
let _pipelab_constants = require("@pipelab/constants");
|
|
26
|
+
let node_path = require("node:path");
|
|
27
|
+
let node_fs_promises = require("node:fs/promises");
|
|
28
|
+
let node_os = require("node:os");
|
|
29
|
+
let esbuild = require("esbuild");
|
|
30
|
+
esbuild = __toESM(esbuild);
|
|
31
|
+
let ts_deepmerge = require("ts-deepmerge");
|
|
32
|
+
//#region ../../node_modules/change-case/dist/index.js
|
|
33
|
+
const SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
34
|
+
const SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
35
|
+
const SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
36
|
+
const DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
37
|
+
const SPLIT_REPLACE_VALUE = "$1\0$2";
|
|
38
|
+
const DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
|
|
39
|
+
/**
|
|
40
|
+
* Split any cased input strings into an array of words.
|
|
41
|
+
*/
|
|
42
|
+
function split(value) {
|
|
43
|
+
let result = value.trim();
|
|
44
|
+
result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
|
|
45
|
+
result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
|
|
46
|
+
let start = 0;
|
|
47
|
+
let end = result.length;
|
|
48
|
+
while (result.charAt(start) === "\0") start++;
|
|
49
|
+
if (start === end) return [];
|
|
50
|
+
while (result.charAt(end - 1) === "\0") end--;
|
|
51
|
+
return result.slice(start, end).split(/\0/g);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Split the input string into an array of words, separating numbers.
|
|
55
|
+
*/
|
|
56
|
+
function splitSeparateNumbers(value) {
|
|
57
|
+
const words = split(value);
|
|
58
|
+
for (let i = 0; i < words.length; i++) {
|
|
59
|
+
const word = words[i];
|
|
60
|
+
const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
|
|
61
|
+
if (match) {
|
|
62
|
+
const offset = match.index + (match[1] ?? match[2]).length;
|
|
63
|
+
words.splice(i, 1, word.slice(0, offset), word.slice(offset));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return words;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Convert a string to space separated lower case (`foo bar`).
|
|
70
|
+
*/
|
|
71
|
+
function noCase(input, options) {
|
|
72
|
+
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
|
|
73
|
+
return prefix + words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") + suffix;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Convert a string to kebab case (`foo-bar`).
|
|
77
|
+
*/
|
|
78
|
+
function kebabCase(input, options) {
|
|
79
|
+
return noCase(input, {
|
|
80
|
+
delimiter: "-",
|
|
81
|
+
...options
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function lowerFactory(locale) {
|
|
85
|
+
return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
|
|
86
|
+
}
|
|
87
|
+
function splitPrefixSuffix(input, options = {}) {
|
|
88
|
+
const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
|
|
89
|
+
const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
90
|
+
const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
91
|
+
let prefixIndex = 0;
|
|
92
|
+
let suffixIndex = input.length;
|
|
93
|
+
while (prefixIndex < input.length) {
|
|
94
|
+
const char = input.charAt(prefixIndex);
|
|
95
|
+
if (!prefixCharacters.includes(char)) break;
|
|
96
|
+
prefixIndex++;
|
|
97
|
+
}
|
|
98
|
+
while (suffixIndex > prefixIndex) {
|
|
99
|
+
const index = suffixIndex - 1;
|
|
100
|
+
const char = input.charAt(index);
|
|
101
|
+
if (!suffixCharacters.includes(char)) break;
|
|
102
|
+
suffixIndex = index;
|
|
103
|
+
}
|
|
104
|
+
return [
|
|
105
|
+
input.slice(0, prefixIndex),
|
|
106
|
+
splitFn(input.slice(prefixIndex, suffixIndex)),
|
|
107
|
+
input.slice(suffixIndex)
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region ../../node_modules/semver/internal/constants.js
|
|
112
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
113
|
+
const SEMVER_SPEC_VERSION = "2.0.0";
|
|
114
|
+
const MAX_LENGTH = 256;
|
|
115
|
+
const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
116
|
+
module.exports = {
|
|
117
|
+
MAX_LENGTH,
|
|
118
|
+
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
119
|
+
MAX_SAFE_BUILD_LENGTH: MAX_LENGTH - 6,
|
|
120
|
+
MAX_SAFE_INTEGER,
|
|
121
|
+
RELEASE_TYPES: [
|
|
122
|
+
"major",
|
|
123
|
+
"premajor",
|
|
124
|
+
"minor",
|
|
125
|
+
"preminor",
|
|
126
|
+
"patch",
|
|
127
|
+
"prepatch",
|
|
128
|
+
"prerelease"
|
|
129
|
+
],
|
|
130
|
+
SEMVER_SPEC_VERSION,
|
|
131
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
132
|
+
FLAG_LOOSE: 2
|
|
133
|
+
};
|
|
134
|
+
}));
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region ../../node_modules/semver/internal/debug.js
|
|
137
|
+
var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
138
|
+
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
139
|
+
}));
|
|
140
|
+
//#endregion
|
|
141
|
+
//#region ../../node_modules/semver/internal/re.js
|
|
142
|
+
var require_re = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
143
|
+
const { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
144
|
+
const debug = require_debug();
|
|
145
|
+
exports = module.exports = {};
|
|
146
|
+
const re = exports.re = [];
|
|
147
|
+
const safeRe = exports.safeRe = [];
|
|
148
|
+
const src = exports.src = [];
|
|
149
|
+
const safeSrc = exports.safeSrc = [];
|
|
150
|
+
const t = exports.t = {};
|
|
151
|
+
let R = 0;
|
|
152
|
+
const LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
153
|
+
const safeRegexReplacements = [
|
|
154
|
+
["\\s", 1],
|
|
155
|
+
["\\d", MAX_LENGTH],
|
|
156
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
157
|
+
];
|
|
158
|
+
const makeSafeRegex = (value) => {
|
|
159
|
+
for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
160
|
+
return value;
|
|
161
|
+
};
|
|
162
|
+
const createToken = (name, value, isGlobal) => {
|
|
163
|
+
const safe = makeSafeRegex(value);
|
|
164
|
+
const index = R++;
|
|
165
|
+
debug(name, index, value);
|
|
166
|
+
t[name] = index;
|
|
167
|
+
src[index] = value;
|
|
168
|
+
safeSrc[index] = safe;
|
|
169
|
+
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
170
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
171
|
+
};
|
|
172
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
173
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
174
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
175
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
176
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
177
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
178
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
179
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
180
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
181
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
182
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
183
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
184
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
185
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
186
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
187
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
188
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
189
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
190
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
191
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
192
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
193
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
194
|
+
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
195
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
196
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
197
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
198
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
199
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
200
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
201
|
+
exports.tildeTrimReplace = "$1~";
|
|
202
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
203
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
204
|
+
createToken("LONECARET", "(?:\\^)");
|
|
205
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
206
|
+
exports.caretTrimReplace = "$1^";
|
|
207
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
208
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
209
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
210
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
211
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
212
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
213
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
214
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
215
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
216
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
217
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
218
|
+
}));
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region ../../node_modules/semver/internal/parse-options.js
|
|
221
|
+
var require_parse_options = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
222
|
+
const looseOption = Object.freeze({ loose: true });
|
|
223
|
+
const emptyOpts = Object.freeze({});
|
|
224
|
+
const parseOptions = (options) => {
|
|
225
|
+
if (!options) return emptyOpts;
|
|
226
|
+
if (typeof options !== "object") return looseOption;
|
|
227
|
+
return options;
|
|
228
|
+
};
|
|
229
|
+
module.exports = parseOptions;
|
|
230
|
+
}));
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region ../../node_modules/semver/internal/identifiers.js
|
|
233
|
+
var require_identifiers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
234
|
+
const numeric = /^[0-9]+$/;
|
|
235
|
+
const compareIdentifiers = (a, b) => {
|
|
236
|
+
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
237
|
+
const anum = numeric.test(a);
|
|
238
|
+
const bnum = numeric.test(b);
|
|
239
|
+
if (anum && bnum) {
|
|
240
|
+
a = +a;
|
|
241
|
+
b = +b;
|
|
242
|
+
}
|
|
243
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
244
|
+
};
|
|
245
|
+
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
246
|
+
module.exports = {
|
|
247
|
+
compareIdentifiers,
|
|
248
|
+
rcompareIdentifiers
|
|
249
|
+
};
|
|
250
|
+
}));
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region ../../node_modules/semver/classes/semver.js
|
|
253
|
+
var require_semver$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
254
|
+
const debug = require_debug();
|
|
255
|
+
const { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
256
|
+
const { safeRe: re, t } = require_re();
|
|
257
|
+
const parseOptions = require_parse_options();
|
|
258
|
+
const { compareIdentifiers } = require_identifiers();
|
|
259
|
+
module.exports = class SemVer {
|
|
260
|
+
constructor(version, options) {
|
|
261
|
+
options = parseOptions(options);
|
|
262
|
+
if (version instanceof SemVer) if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
263
|
+
else version = version.version;
|
|
264
|
+
else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
265
|
+
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
266
|
+
debug("SemVer", version, options);
|
|
267
|
+
this.options = options;
|
|
268
|
+
this.loose = !!options.loose;
|
|
269
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
270
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
271
|
+
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
272
|
+
this.raw = version;
|
|
273
|
+
this.major = +m[1];
|
|
274
|
+
this.minor = +m[2];
|
|
275
|
+
this.patch = +m[3];
|
|
276
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
277
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
278
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
279
|
+
if (!m[4]) this.prerelease = [];
|
|
280
|
+
else this.prerelease = m[4].split(".").map((id) => {
|
|
281
|
+
if (/^[0-9]+$/.test(id)) {
|
|
282
|
+
const num = +id;
|
|
283
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
284
|
+
}
|
|
285
|
+
return id;
|
|
286
|
+
});
|
|
287
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
288
|
+
this.format();
|
|
289
|
+
}
|
|
290
|
+
format() {
|
|
291
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
292
|
+
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
293
|
+
return this.version;
|
|
294
|
+
}
|
|
295
|
+
toString() {
|
|
296
|
+
return this.version;
|
|
297
|
+
}
|
|
298
|
+
compare(other) {
|
|
299
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
300
|
+
if (!(other instanceof SemVer)) {
|
|
301
|
+
if (typeof other === "string" && other === this.version) return 0;
|
|
302
|
+
other = new SemVer(other, this.options);
|
|
303
|
+
}
|
|
304
|
+
if (other.version === this.version) return 0;
|
|
305
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
306
|
+
}
|
|
307
|
+
compareMain(other) {
|
|
308
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
309
|
+
if (this.major < other.major) return -1;
|
|
310
|
+
if (this.major > other.major) return 1;
|
|
311
|
+
if (this.minor < other.minor) return -1;
|
|
312
|
+
if (this.minor > other.minor) return 1;
|
|
313
|
+
if (this.patch < other.patch) return -1;
|
|
314
|
+
if (this.patch > other.patch) return 1;
|
|
315
|
+
return 0;
|
|
316
|
+
}
|
|
317
|
+
comparePre(other) {
|
|
318
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
319
|
+
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
320
|
+
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
321
|
+
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
322
|
+
let i = 0;
|
|
323
|
+
do {
|
|
324
|
+
const a = this.prerelease[i];
|
|
325
|
+
const b = other.prerelease[i];
|
|
326
|
+
debug("prerelease compare", i, a, b);
|
|
327
|
+
if (a === void 0 && b === void 0) return 0;
|
|
328
|
+
else if (b === void 0) return 1;
|
|
329
|
+
else if (a === void 0) return -1;
|
|
330
|
+
else if (a === b) continue;
|
|
331
|
+
else return compareIdentifiers(a, b);
|
|
332
|
+
} while (++i);
|
|
333
|
+
}
|
|
334
|
+
compareBuild(other) {
|
|
335
|
+
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
336
|
+
let i = 0;
|
|
337
|
+
do {
|
|
338
|
+
const a = this.build[i];
|
|
339
|
+
const b = other.build[i];
|
|
340
|
+
debug("build compare", i, a, b);
|
|
341
|
+
if (a === void 0 && b === void 0) return 0;
|
|
342
|
+
else if (b === void 0) return 1;
|
|
343
|
+
else if (a === void 0) return -1;
|
|
344
|
+
else if (a === b) continue;
|
|
345
|
+
else return compareIdentifiers(a, b);
|
|
346
|
+
} while (++i);
|
|
347
|
+
}
|
|
348
|
+
inc(release, identifier, identifierBase) {
|
|
349
|
+
if (release.startsWith("pre")) {
|
|
350
|
+
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
351
|
+
if (identifier) {
|
|
352
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
353
|
+
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
switch (release) {
|
|
357
|
+
case "premajor":
|
|
358
|
+
this.prerelease.length = 0;
|
|
359
|
+
this.patch = 0;
|
|
360
|
+
this.minor = 0;
|
|
361
|
+
this.major++;
|
|
362
|
+
this.inc("pre", identifier, identifierBase);
|
|
363
|
+
break;
|
|
364
|
+
case "preminor":
|
|
365
|
+
this.prerelease.length = 0;
|
|
366
|
+
this.patch = 0;
|
|
367
|
+
this.minor++;
|
|
368
|
+
this.inc("pre", identifier, identifierBase);
|
|
369
|
+
break;
|
|
370
|
+
case "prepatch":
|
|
371
|
+
this.prerelease.length = 0;
|
|
372
|
+
this.inc("patch", identifier, identifierBase);
|
|
373
|
+
this.inc("pre", identifier, identifierBase);
|
|
374
|
+
break;
|
|
375
|
+
case "prerelease":
|
|
376
|
+
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
377
|
+
this.inc("pre", identifier, identifierBase);
|
|
378
|
+
break;
|
|
379
|
+
case "release":
|
|
380
|
+
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
381
|
+
this.prerelease.length = 0;
|
|
382
|
+
break;
|
|
383
|
+
case "major":
|
|
384
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
385
|
+
this.minor = 0;
|
|
386
|
+
this.patch = 0;
|
|
387
|
+
this.prerelease = [];
|
|
388
|
+
break;
|
|
389
|
+
case "minor":
|
|
390
|
+
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
391
|
+
this.patch = 0;
|
|
392
|
+
this.prerelease = [];
|
|
393
|
+
break;
|
|
394
|
+
case "patch":
|
|
395
|
+
if (this.prerelease.length === 0) this.patch++;
|
|
396
|
+
this.prerelease = [];
|
|
397
|
+
break;
|
|
398
|
+
case "pre": {
|
|
399
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
400
|
+
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
401
|
+
else {
|
|
402
|
+
let i = this.prerelease.length;
|
|
403
|
+
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
404
|
+
this.prerelease[i]++;
|
|
405
|
+
i = -2;
|
|
406
|
+
}
|
|
407
|
+
if (i === -1) {
|
|
408
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
409
|
+
this.prerelease.push(base);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (identifier) {
|
|
413
|
+
let prerelease = [identifier, base];
|
|
414
|
+
if (identifierBase === false) prerelease = [identifier];
|
|
415
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
416
|
+
if (isNaN(this.prerelease[1])) this.prerelease = prerelease;
|
|
417
|
+
} else this.prerelease = prerelease;
|
|
418
|
+
}
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
default: throw new Error(`invalid increment argument: ${release}`);
|
|
422
|
+
}
|
|
423
|
+
this.raw = this.format();
|
|
424
|
+
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
425
|
+
return this;
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
}));
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region ../../node_modules/semver/functions/parse.js
|
|
431
|
+
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
432
|
+
const SemVer = require_semver$1();
|
|
433
|
+
const parse = (version, options, throwErrors = false) => {
|
|
434
|
+
if (version instanceof SemVer) return version;
|
|
435
|
+
try {
|
|
436
|
+
return new SemVer(version, options);
|
|
437
|
+
} catch (er) {
|
|
438
|
+
if (!throwErrors) return null;
|
|
439
|
+
throw er;
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
module.exports = parse;
|
|
443
|
+
}));
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region ../../node_modules/semver/functions/valid.js
|
|
446
|
+
var require_valid$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
447
|
+
const parse = require_parse();
|
|
448
|
+
const valid = (version, options) => {
|
|
449
|
+
const v = parse(version, options);
|
|
450
|
+
return v ? v.version : null;
|
|
451
|
+
};
|
|
452
|
+
module.exports = valid;
|
|
453
|
+
}));
|
|
454
|
+
//#endregion
|
|
455
|
+
//#region ../../node_modules/semver/functions/clean.js
|
|
456
|
+
var require_clean = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
457
|
+
const parse = require_parse();
|
|
458
|
+
const clean = (version, options) => {
|
|
459
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
460
|
+
return s ? s.version : null;
|
|
461
|
+
};
|
|
462
|
+
module.exports = clean;
|
|
463
|
+
}));
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region ../../node_modules/semver/functions/inc.js
|
|
466
|
+
var require_inc = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
467
|
+
const SemVer = require_semver$1();
|
|
468
|
+
const inc = (version, release, options, identifier, identifierBase) => {
|
|
469
|
+
if (typeof options === "string") {
|
|
470
|
+
identifierBase = identifier;
|
|
471
|
+
identifier = options;
|
|
472
|
+
options = void 0;
|
|
473
|
+
}
|
|
474
|
+
try {
|
|
475
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
476
|
+
} catch (er) {
|
|
477
|
+
return null;
|
|
478
|
+
}
|
|
479
|
+
};
|
|
480
|
+
module.exports = inc;
|
|
481
|
+
}));
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region ../../node_modules/semver/functions/diff.js
|
|
484
|
+
var require_diff = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
485
|
+
const parse = require_parse();
|
|
486
|
+
const diff = (version1, version2) => {
|
|
487
|
+
const v1 = parse(version1, null, true);
|
|
488
|
+
const v2 = parse(version2, null, true);
|
|
489
|
+
const comparison = v1.compare(v2);
|
|
490
|
+
if (comparison === 0) return null;
|
|
491
|
+
const v1Higher = comparison > 0;
|
|
492
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
493
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
494
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
495
|
+
if (!!lowVersion.prerelease.length && !highHasPre) {
|
|
496
|
+
if (!lowVersion.patch && !lowVersion.minor) return "major";
|
|
497
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
498
|
+
if (lowVersion.minor && !lowVersion.patch) return "minor";
|
|
499
|
+
return "patch";
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
const prefix = highHasPre ? "pre" : "";
|
|
503
|
+
if (v1.major !== v2.major) return prefix + "major";
|
|
504
|
+
if (v1.minor !== v2.minor) return prefix + "minor";
|
|
505
|
+
if (v1.patch !== v2.patch) return prefix + "patch";
|
|
506
|
+
return "prerelease";
|
|
507
|
+
};
|
|
508
|
+
module.exports = diff;
|
|
509
|
+
}));
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region ../../node_modules/semver/functions/major.js
|
|
512
|
+
var require_major = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
513
|
+
const SemVer = require_semver$1();
|
|
514
|
+
const major = (a, loose) => new SemVer(a, loose).major;
|
|
515
|
+
module.exports = major;
|
|
516
|
+
}));
|
|
517
|
+
//#endregion
|
|
518
|
+
//#region ../../node_modules/semver/functions/minor.js
|
|
519
|
+
var require_minor = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
520
|
+
const SemVer = require_semver$1();
|
|
521
|
+
const minor = (a, loose) => new SemVer(a, loose).minor;
|
|
522
|
+
module.exports = minor;
|
|
523
|
+
}));
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region ../../node_modules/semver/functions/patch.js
|
|
526
|
+
var require_patch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
527
|
+
const SemVer = require_semver$1();
|
|
528
|
+
const patch = (a, loose) => new SemVer(a, loose).patch;
|
|
529
|
+
module.exports = patch;
|
|
530
|
+
}));
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region ../../node_modules/semver/functions/prerelease.js
|
|
533
|
+
var require_prerelease = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
534
|
+
const parse = require_parse();
|
|
535
|
+
const prerelease = (version, options) => {
|
|
536
|
+
const parsed = parse(version, options);
|
|
537
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
538
|
+
};
|
|
539
|
+
module.exports = prerelease;
|
|
540
|
+
}));
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region ../../node_modules/semver/functions/compare.js
|
|
543
|
+
var require_compare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
544
|
+
const SemVer = require_semver$1();
|
|
545
|
+
const compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
546
|
+
module.exports = compare;
|
|
547
|
+
}));
|
|
548
|
+
//#endregion
|
|
549
|
+
//#region ../../node_modules/semver/functions/rcompare.js
|
|
550
|
+
var require_rcompare = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
551
|
+
const compare = require_compare();
|
|
552
|
+
const rcompare = (a, b, loose) => compare(b, a, loose);
|
|
553
|
+
module.exports = rcompare;
|
|
554
|
+
}));
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region ../../node_modules/semver/functions/compare-loose.js
|
|
557
|
+
var require_compare_loose = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
558
|
+
const compare = require_compare();
|
|
559
|
+
const compareLoose = (a, b) => compare(a, b, true);
|
|
560
|
+
module.exports = compareLoose;
|
|
561
|
+
}));
|
|
562
|
+
//#endregion
|
|
563
|
+
//#region ../../node_modules/semver/functions/compare-build.js
|
|
564
|
+
var require_compare_build = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
565
|
+
const SemVer = require_semver$1();
|
|
566
|
+
const compareBuild = (a, b, loose) => {
|
|
567
|
+
const versionA = new SemVer(a, loose);
|
|
568
|
+
const versionB = new SemVer(b, loose);
|
|
569
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
570
|
+
};
|
|
571
|
+
module.exports = compareBuild;
|
|
572
|
+
}));
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region ../../node_modules/semver/functions/sort.js
|
|
575
|
+
var require_sort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
576
|
+
const compareBuild = require_compare_build();
|
|
577
|
+
const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
578
|
+
module.exports = sort;
|
|
579
|
+
}));
|
|
580
|
+
//#endregion
|
|
581
|
+
//#region ../../node_modules/semver/functions/rsort.js
|
|
582
|
+
var require_rsort = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
583
|
+
const compareBuild = require_compare_build();
|
|
584
|
+
const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
585
|
+
module.exports = rsort;
|
|
586
|
+
}));
|
|
587
|
+
//#endregion
|
|
588
|
+
//#region ../../node_modules/semver/functions/gt.js
|
|
589
|
+
var require_gt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
590
|
+
const compare = require_compare();
|
|
591
|
+
const gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
592
|
+
module.exports = gt;
|
|
593
|
+
}));
|
|
594
|
+
//#endregion
|
|
595
|
+
//#region ../../node_modules/semver/functions/lt.js
|
|
596
|
+
var require_lt = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
597
|
+
const compare = require_compare();
|
|
598
|
+
const lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
599
|
+
module.exports = lt;
|
|
600
|
+
}));
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region ../../node_modules/semver/functions/eq.js
|
|
603
|
+
var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
604
|
+
const compare = require_compare();
|
|
605
|
+
const eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
606
|
+
module.exports = eq;
|
|
607
|
+
}));
|
|
608
|
+
//#endregion
|
|
609
|
+
//#region ../../node_modules/semver/functions/neq.js
|
|
610
|
+
var require_neq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
611
|
+
const compare = require_compare();
|
|
612
|
+
const neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
613
|
+
module.exports = neq;
|
|
614
|
+
}));
|
|
615
|
+
//#endregion
|
|
616
|
+
//#region ../../node_modules/semver/functions/gte.js
|
|
617
|
+
var require_gte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
618
|
+
const compare = require_compare();
|
|
619
|
+
const gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
620
|
+
module.exports = gte;
|
|
621
|
+
}));
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region ../../node_modules/semver/functions/lte.js
|
|
624
|
+
var require_lte = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
625
|
+
const compare = require_compare();
|
|
626
|
+
const lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
627
|
+
module.exports = lte;
|
|
628
|
+
}));
|
|
629
|
+
//#endregion
|
|
630
|
+
//#region ../../node_modules/semver/functions/cmp.js
|
|
631
|
+
var require_cmp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
632
|
+
const eq = require_eq();
|
|
633
|
+
const neq = require_neq();
|
|
634
|
+
const gt = require_gt();
|
|
635
|
+
const gte = require_gte();
|
|
636
|
+
const lt = require_lt();
|
|
637
|
+
const lte = require_lte();
|
|
638
|
+
const cmp = (a, op, b, loose) => {
|
|
639
|
+
switch (op) {
|
|
640
|
+
case "===":
|
|
641
|
+
if (typeof a === "object") a = a.version;
|
|
642
|
+
if (typeof b === "object") b = b.version;
|
|
643
|
+
return a === b;
|
|
644
|
+
case "!==":
|
|
645
|
+
if (typeof a === "object") a = a.version;
|
|
646
|
+
if (typeof b === "object") b = b.version;
|
|
647
|
+
return a !== b;
|
|
648
|
+
case "":
|
|
649
|
+
case "=":
|
|
650
|
+
case "==": return eq(a, b, loose);
|
|
651
|
+
case "!=": return neq(a, b, loose);
|
|
652
|
+
case ">": return gt(a, b, loose);
|
|
653
|
+
case ">=": return gte(a, b, loose);
|
|
654
|
+
case "<": return lt(a, b, loose);
|
|
655
|
+
case "<=": return lte(a, b, loose);
|
|
656
|
+
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
module.exports = cmp;
|
|
660
|
+
}));
|
|
661
|
+
//#endregion
|
|
662
|
+
//#region ../../node_modules/semver/functions/coerce.js
|
|
663
|
+
var require_coerce = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
664
|
+
const SemVer = require_semver$1();
|
|
665
|
+
const parse = require_parse();
|
|
666
|
+
const { safeRe: re, t } = require_re();
|
|
667
|
+
const coerce = (version, options) => {
|
|
668
|
+
if (version instanceof SemVer) return version;
|
|
669
|
+
if (typeof version === "number") version = String(version);
|
|
670
|
+
if (typeof version !== "string") return null;
|
|
671
|
+
options = options || {};
|
|
672
|
+
let match = null;
|
|
673
|
+
if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
674
|
+
else {
|
|
675
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
676
|
+
let next;
|
|
677
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
678
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
679
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
680
|
+
}
|
|
681
|
+
coerceRtlRegex.lastIndex = -1;
|
|
682
|
+
}
|
|
683
|
+
if (match === null) return null;
|
|
684
|
+
const major = match[2];
|
|
685
|
+
return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
|
|
686
|
+
};
|
|
687
|
+
module.exports = coerce;
|
|
688
|
+
}));
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region ../../node_modules/semver/internal/lrucache.js
|
|
691
|
+
var require_lrucache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
692
|
+
var LRUCache = class {
|
|
693
|
+
constructor() {
|
|
694
|
+
this.max = 1e3;
|
|
695
|
+
this.map = /* @__PURE__ */ new Map();
|
|
696
|
+
}
|
|
697
|
+
get(key) {
|
|
698
|
+
const value = this.map.get(key);
|
|
699
|
+
if (value === void 0) return;
|
|
700
|
+
else {
|
|
701
|
+
this.map.delete(key);
|
|
702
|
+
this.map.set(key, value);
|
|
703
|
+
return value;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
delete(key) {
|
|
707
|
+
return this.map.delete(key);
|
|
708
|
+
}
|
|
709
|
+
set(key, value) {
|
|
710
|
+
if (!this.delete(key) && value !== void 0) {
|
|
711
|
+
if (this.map.size >= this.max) {
|
|
712
|
+
const firstKey = this.map.keys().next().value;
|
|
713
|
+
this.delete(firstKey);
|
|
714
|
+
}
|
|
715
|
+
this.map.set(key, value);
|
|
716
|
+
}
|
|
717
|
+
return this;
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
module.exports = LRUCache;
|
|
721
|
+
}));
|
|
722
|
+
//#endregion
|
|
723
|
+
//#region ../../node_modules/semver/classes/range.js
|
|
724
|
+
var require_range = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
725
|
+
const SPACE_CHARACTERS = /\s+/g;
|
|
726
|
+
module.exports = class Range {
|
|
727
|
+
constructor(range, options) {
|
|
728
|
+
options = parseOptions(options);
|
|
729
|
+
if (range instanceof Range) if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
730
|
+
else return new Range(range.raw, options);
|
|
731
|
+
if (range instanceof Comparator) {
|
|
732
|
+
this.raw = range.value;
|
|
733
|
+
this.set = [[range]];
|
|
734
|
+
this.formatted = void 0;
|
|
735
|
+
return this;
|
|
736
|
+
}
|
|
737
|
+
this.options = options;
|
|
738
|
+
this.loose = !!options.loose;
|
|
739
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
740
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
741
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
742
|
+
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
743
|
+
if (this.set.length > 1) {
|
|
744
|
+
const first = this.set[0];
|
|
745
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
746
|
+
if (this.set.length === 0) this.set = [first];
|
|
747
|
+
else if (this.set.length > 1) {
|
|
748
|
+
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
749
|
+
this.set = [c];
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
this.formatted = void 0;
|
|
755
|
+
}
|
|
756
|
+
get range() {
|
|
757
|
+
if (this.formatted === void 0) {
|
|
758
|
+
this.formatted = "";
|
|
759
|
+
for (let i = 0; i < this.set.length; i++) {
|
|
760
|
+
if (i > 0) this.formatted += "||";
|
|
761
|
+
const comps = this.set[i];
|
|
762
|
+
for (let k = 0; k < comps.length; k++) {
|
|
763
|
+
if (k > 0) this.formatted += " ";
|
|
764
|
+
this.formatted += comps[k].toString().trim();
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
return this.formatted;
|
|
769
|
+
}
|
|
770
|
+
format() {
|
|
771
|
+
return this.range;
|
|
772
|
+
}
|
|
773
|
+
toString() {
|
|
774
|
+
return this.range;
|
|
775
|
+
}
|
|
776
|
+
parseRange(range) {
|
|
777
|
+
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
778
|
+
const cached = cache.get(memoKey);
|
|
779
|
+
if (cached) return cached;
|
|
780
|
+
const loose = this.options.loose;
|
|
781
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
782
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
783
|
+
debug("hyphen replace", range);
|
|
784
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
785
|
+
debug("comparator trim", range);
|
|
786
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
787
|
+
debug("tilde trim", range);
|
|
788
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
789
|
+
debug("caret trim", range);
|
|
790
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
791
|
+
if (loose) rangeList = rangeList.filter((comp) => {
|
|
792
|
+
debug("loose invalid filter", comp, this.options);
|
|
793
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
794
|
+
});
|
|
795
|
+
debug("range list", rangeList);
|
|
796
|
+
const rangeMap = /* @__PURE__ */ new Map();
|
|
797
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
798
|
+
for (const comp of comparators) {
|
|
799
|
+
if (isNullSet(comp)) return [comp];
|
|
800
|
+
rangeMap.set(comp.value, comp);
|
|
801
|
+
}
|
|
802
|
+
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
803
|
+
const result = [...rangeMap.values()];
|
|
804
|
+
cache.set(memoKey, result);
|
|
805
|
+
return result;
|
|
806
|
+
}
|
|
807
|
+
intersects(range, options) {
|
|
808
|
+
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
809
|
+
return this.set.some((thisComparators) => {
|
|
810
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
811
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
812
|
+
return rangeComparators.every((rangeComparator) => {
|
|
813
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
814
|
+
});
|
|
815
|
+
});
|
|
816
|
+
});
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
test(version) {
|
|
820
|
+
if (!version) return false;
|
|
821
|
+
if (typeof version === "string") try {
|
|
822
|
+
version = new SemVer(version, this.options);
|
|
823
|
+
} catch (er) {
|
|
824
|
+
return false;
|
|
825
|
+
}
|
|
826
|
+
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
827
|
+
return false;
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
const cache = new (require_lrucache())();
|
|
831
|
+
const parseOptions = require_parse_options();
|
|
832
|
+
const Comparator = require_comparator();
|
|
833
|
+
const debug = require_debug();
|
|
834
|
+
const SemVer = require_semver$1();
|
|
835
|
+
const { safeRe: re, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
836
|
+
const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
837
|
+
const isNullSet = (c) => c.value === "<0.0.0-0";
|
|
838
|
+
const isAny = (c) => c.value === "";
|
|
839
|
+
const isSatisfiable = (comparators, options) => {
|
|
840
|
+
let result = true;
|
|
841
|
+
const remainingComparators = comparators.slice();
|
|
842
|
+
let testComparator = remainingComparators.pop();
|
|
843
|
+
while (result && remainingComparators.length) {
|
|
844
|
+
result = remainingComparators.every((otherComparator) => {
|
|
845
|
+
return testComparator.intersects(otherComparator, options);
|
|
846
|
+
});
|
|
847
|
+
testComparator = remainingComparators.pop();
|
|
848
|
+
}
|
|
849
|
+
return result;
|
|
850
|
+
};
|
|
851
|
+
const parseComparator = (comp, options) => {
|
|
852
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
853
|
+
debug("comp", comp, options);
|
|
854
|
+
comp = replaceCarets(comp, options);
|
|
855
|
+
debug("caret", comp);
|
|
856
|
+
comp = replaceTildes(comp, options);
|
|
857
|
+
debug("tildes", comp);
|
|
858
|
+
comp = replaceXRanges(comp, options);
|
|
859
|
+
debug("xrange", comp);
|
|
860
|
+
comp = replaceStars(comp, options);
|
|
861
|
+
debug("stars", comp);
|
|
862
|
+
return comp;
|
|
863
|
+
};
|
|
864
|
+
const isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
865
|
+
const replaceTildes = (comp, options) => {
|
|
866
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
867
|
+
};
|
|
868
|
+
const replaceTilde = (comp, options) => {
|
|
869
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
870
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
871
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
872
|
+
let ret;
|
|
873
|
+
if (isX(M)) ret = "";
|
|
874
|
+
else if (isX(m)) ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
875
|
+
else if (isX(p)) ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
876
|
+
else if (pr) {
|
|
877
|
+
debug("replaceTilde pr", pr);
|
|
878
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
879
|
+
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
880
|
+
debug("tilde return", ret);
|
|
881
|
+
return ret;
|
|
882
|
+
});
|
|
883
|
+
};
|
|
884
|
+
const replaceCarets = (comp, options) => {
|
|
885
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
886
|
+
};
|
|
887
|
+
const replaceCaret = (comp, options) => {
|
|
888
|
+
debug("caret", comp, options);
|
|
889
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
890
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
891
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
892
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
893
|
+
let ret;
|
|
894
|
+
if (isX(M)) ret = "";
|
|
895
|
+
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
896
|
+
else if (isX(p)) if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
897
|
+
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
898
|
+
else if (pr) {
|
|
899
|
+
debug("replaceCaret pr", pr);
|
|
900
|
+
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
901
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
902
|
+
else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
903
|
+
} else {
|
|
904
|
+
debug("no pr");
|
|
905
|
+
if (M === "0") if (m === "0") ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
906
|
+
else ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
907
|
+
else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
908
|
+
}
|
|
909
|
+
debug("caret return", ret);
|
|
910
|
+
return ret;
|
|
911
|
+
});
|
|
912
|
+
};
|
|
913
|
+
const replaceXRanges = (comp, options) => {
|
|
914
|
+
debug("replaceXRanges", comp, options);
|
|
915
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
916
|
+
};
|
|
917
|
+
const replaceXRange = (comp, options) => {
|
|
918
|
+
comp = comp.trim();
|
|
919
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
920
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
921
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
922
|
+
const xM = isX(M);
|
|
923
|
+
const xm = xM || isX(m);
|
|
924
|
+
const xp = xm || isX(p);
|
|
925
|
+
const anyX = xp;
|
|
926
|
+
if (gtlt === "=" && anyX) gtlt = "";
|
|
927
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
928
|
+
if (xM) if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
929
|
+
else ret = "*";
|
|
930
|
+
else if (gtlt && anyX) {
|
|
931
|
+
if (xm) m = 0;
|
|
932
|
+
p = 0;
|
|
933
|
+
if (gtlt === ">") {
|
|
934
|
+
gtlt = ">=";
|
|
935
|
+
if (xm) {
|
|
936
|
+
M = +M + 1;
|
|
937
|
+
m = 0;
|
|
938
|
+
p = 0;
|
|
939
|
+
} else {
|
|
940
|
+
m = +m + 1;
|
|
941
|
+
p = 0;
|
|
942
|
+
}
|
|
943
|
+
} else if (gtlt === "<=") {
|
|
944
|
+
gtlt = "<";
|
|
945
|
+
if (xm) M = +M + 1;
|
|
946
|
+
else m = +m + 1;
|
|
947
|
+
}
|
|
948
|
+
if (gtlt === "<") pr = "-0";
|
|
949
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
950
|
+
} else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
951
|
+
else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
952
|
+
debug("xRange return", ret);
|
|
953
|
+
return ret;
|
|
954
|
+
});
|
|
955
|
+
};
|
|
956
|
+
const replaceStars = (comp, options) => {
|
|
957
|
+
debug("replaceStars", comp, options);
|
|
958
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
959
|
+
};
|
|
960
|
+
const replaceGTE0 = (comp, options) => {
|
|
961
|
+
debug("replaceGTE0", comp, options);
|
|
962
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
963
|
+
};
|
|
964
|
+
const hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
965
|
+
if (isX(fM)) from = "";
|
|
966
|
+
else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
967
|
+
else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
968
|
+
else if (fpr) from = `>=${from}`;
|
|
969
|
+
else from = `>=${from}${incPr ? "-0" : ""}`;
|
|
970
|
+
if (isX(tM)) to = "";
|
|
971
|
+
else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
|
|
972
|
+
else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
|
|
973
|
+
else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
974
|
+
else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
975
|
+
else to = `<=${to}`;
|
|
976
|
+
return `${from} ${to}`.trim();
|
|
977
|
+
};
|
|
978
|
+
const testSet = (set, version, options) => {
|
|
979
|
+
for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
|
|
980
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
981
|
+
for (let i = 0; i < set.length; i++) {
|
|
982
|
+
debug(set[i].semver);
|
|
983
|
+
if (set[i].semver === Comparator.ANY) continue;
|
|
984
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
985
|
+
const allowed = set[i].semver;
|
|
986
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
return false;
|
|
990
|
+
}
|
|
991
|
+
return true;
|
|
992
|
+
};
|
|
993
|
+
}));
|
|
994
|
+
//#endregion
|
|
995
|
+
//#region ../../node_modules/semver/classes/comparator.js
|
|
996
|
+
var require_comparator = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
997
|
+
const ANY = Symbol("SemVer ANY");
|
|
998
|
+
module.exports = class Comparator {
|
|
999
|
+
static get ANY() {
|
|
1000
|
+
return ANY;
|
|
1001
|
+
}
|
|
1002
|
+
constructor(comp, options) {
|
|
1003
|
+
options = parseOptions(options);
|
|
1004
|
+
if (comp instanceof Comparator) if (comp.loose === !!options.loose) return comp;
|
|
1005
|
+
else comp = comp.value;
|
|
1006
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
1007
|
+
debug("comparator", comp, options);
|
|
1008
|
+
this.options = options;
|
|
1009
|
+
this.loose = !!options.loose;
|
|
1010
|
+
this.parse(comp);
|
|
1011
|
+
if (this.semver === ANY) this.value = "";
|
|
1012
|
+
else this.value = this.operator + this.semver.version;
|
|
1013
|
+
debug("comp", this);
|
|
1014
|
+
}
|
|
1015
|
+
parse(comp) {
|
|
1016
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
1017
|
+
const m = comp.match(r);
|
|
1018
|
+
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
1019
|
+
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
1020
|
+
if (this.operator === "=") this.operator = "";
|
|
1021
|
+
if (!m[2]) this.semver = ANY;
|
|
1022
|
+
else this.semver = new SemVer(m[2], this.options.loose);
|
|
1023
|
+
}
|
|
1024
|
+
toString() {
|
|
1025
|
+
return this.value;
|
|
1026
|
+
}
|
|
1027
|
+
test(version) {
|
|
1028
|
+
debug("Comparator.test", version, this.options.loose);
|
|
1029
|
+
if (this.semver === ANY || version === ANY) return true;
|
|
1030
|
+
if (typeof version === "string") try {
|
|
1031
|
+
version = new SemVer(version, this.options);
|
|
1032
|
+
} catch (er) {
|
|
1033
|
+
return false;
|
|
1034
|
+
}
|
|
1035
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
1036
|
+
}
|
|
1037
|
+
intersects(comp, options) {
|
|
1038
|
+
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
1039
|
+
if (this.operator === "") {
|
|
1040
|
+
if (this.value === "") return true;
|
|
1041
|
+
return new Range(comp.value, options).test(this.value);
|
|
1042
|
+
} else if (comp.operator === "") {
|
|
1043
|
+
if (comp.value === "") return true;
|
|
1044
|
+
return new Range(this.value, options).test(comp.semver);
|
|
1045
|
+
}
|
|
1046
|
+
options = parseOptions(options);
|
|
1047
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
1048
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
1049
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
1050
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
1051
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
1052
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
1053
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
1054
|
+
return false;
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
const parseOptions = require_parse_options();
|
|
1058
|
+
const { safeRe: re, t } = require_re();
|
|
1059
|
+
const cmp = require_cmp();
|
|
1060
|
+
const debug = require_debug();
|
|
1061
|
+
const SemVer = require_semver$1();
|
|
1062
|
+
const Range = require_range();
|
|
1063
|
+
}));
|
|
1064
|
+
//#endregion
|
|
1065
|
+
//#region ../../node_modules/semver/functions/satisfies.js
|
|
1066
|
+
var require_satisfies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1067
|
+
const Range = require_range();
|
|
1068
|
+
const satisfies = (version, range, options) => {
|
|
1069
|
+
try {
|
|
1070
|
+
range = new Range(range, options);
|
|
1071
|
+
} catch (er) {
|
|
1072
|
+
return false;
|
|
1073
|
+
}
|
|
1074
|
+
return range.test(version);
|
|
1075
|
+
};
|
|
1076
|
+
module.exports = satisfies;
|
|
1077
|
+
}));
|
|
1078
|
+
//#endregion
|
|
1079
|
+
//#region ../../node_modules/semver/ranges/to-comparators.js
|
|
1080
|
+
var require_to_comparators = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1081
|
+
const Range = require_range();
|
|
1082
|
+
const toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
1083
|
+
module.exports = toComparators;
|
|
1084
|
+
}));
|
|
1085
|
+
//#endregion
|
|
1086
|
+
//#region ../../node_modules/semver/ranges/max-satisfying.js
|
|
1087
|
+
var require_max_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1088
|
+
const SemVer = require_semver$1();
|
|
1089
|
+
const Range = require_range();
|
|
1090
|
+
const maxSatisfying = (versions, range, options) => {
|
|
1091
|
+
let max = null;
|
|
1092
|
+
let maxSV = null;
|
|
1093
|
+
let rangeObj = null;
|
|
1094
|
+
try {
|
|
1095
|
+
rangeObj = new Range(range, options);
|
|
1096
|
+
} catch (er) {
|
|
1097
|
+
return null;
|
|
1098
|
+
}
|
|
1099
|
+
versions.forEach((v) => {
|
|
1100
|
+
if (rangeObj.test(v)) {
|
|
1101
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
1102
|
+
max = v;
|
|
1103
|
+
maxSV = new SemVer(max, options);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
});
|
|
1107
|
+
return max;
|
|
1108
|
+
};
|
|
1109
|
+
module.exports = maxSatisfying;
|
|
1110
|
+
}));
|
|
1111
|
+
//#endregion
|
|
1112
|
+
//#region ../../node_modules/semver/ranges/min-satisfying.js
|
|
1113
|
+
var require_min_satisfying = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1114
|
+
const SemVer = require_semver$1();
|
|
1115
|
+
const Range = require_range();
|
|
1116
|
+
const minSatisfying = (versions, range, options) => {
|
|
1117
|
+
let min = null;
|
|
1118
|
+
let minSV = null;
|
|
1119
|
+
let rangeObj = null;
|
|
1120
|
+
try {
|
|
1121
|
+
rangeObj = new Range(range, options);
|
|
1122
|
+
} catch (er) {
|
|
1123
|
+
return null;
|
|
1124
|
+
}
|
|
1125
|
+
versions.forEach((v) => {
|
|
1126
|
+
if (rangeObj.test(v)) {
|
|
1127
|
+
if (!min || minSV.compare(v) === 1) {
|
|
1128
|
+
min = v;
|
|
1129
|
+
minSV = new SemVer(min, options);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
return min;
|
|
1134
|
+
};
|
|
1135
|
+
module.exports = minSatisfying;
|
|
1136
|
+
}));
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region ../../node_modules/semver/ranges/min-version.js
|
|
1139
|
+
var require_min_version = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1140
|
+
const SemVer = require_semver$1();
|
|
1141
|
+
const Range = require_range();
|
|
1142
|
+
const gt = require_gt();
|
|
1143
|
+
const minVersion = (range, loose) => {
|
|
1144
|
+
range = new Range(range, loose);
|
|
1145
|
+
let minver = new SemVer("0.0.0");
|
|
1146
|
+
if (range.test(minver)) return minver;
|
|
1147
|
+
minver = new SemVer("0.0.0-0");
|
|
1148
|
+
if (range.test(minver)) return minver;
|
|
1149
|
+
minver = null;
|
|
1150
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1151
|
+
const comparators = range.set[i];
|
|
1152
|
+
let setMin = null;
|
|
1153
|
+
comparators.forEach((comparator) => {
|
|
1154
|
+
const compver = new SemVer(comparator.semver.version);
|
|
1155
|
+
switch (comparator.operator) {
|
|
1156
|
+
case ">":
|
|
1157
|
+
if (compver.prerelease.length === 0) compver.patch++;
|
|
1158
|
+
else compver.prerelease.push(0);
|
|
1159
|
+
compver.raw = compver.format();
|
|
1160
|
+
case "":
|
|
1161
|
+
case ">=":
|
|
1162
|
+
if (!setMin || gt(compver, setMin)) setMin = compver;
|
|
1163
|
+
break;
|
|
1164
|
+
case "<":
|
|
1165
|
+
case "<=": break;
|
|
1166
|
+
default: throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
1167
|
+
}
|
|
1168
|
+
});
|
|
1169
|
+
if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
|
|
1170
|
+
}
|
|
1171
|
+
if (minver && range.test(minver)) return minver;
|
|
1172
|
+
return null;
|
|
1173
|
+
};
|
|
1174
|
+
module.exports = minVersion;
|
|
1175
|
+
}));
|
|
1176
|
+
//#endregion
|
|
1177
|
+
//#region ../../node_modules/semver/ranges/valid.js
|
|
1178
|
+
var require_valid = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1179
|
+
const Range = require_range();
|
|
1180
|
+
const validRange = (range, options) => {
|
|
1181
|
+
try {
|
|
1182
|
+
return new Range(range, options).range || "*";
|
|
1183
|
+
} catch (er) {
|
|
1184
|
+
return null;
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
1187
|
+
module.exports = validRange;
|
|
1188
|
+
}));
|
|
1189
|
+
//#endregion
|
|
1190
|
+
//#region ../../node_modules/semver/ranges/outside.js
|
|
1191
|
+
var require_outside = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1192
|
+
const SemVer = require_semver$1();
|
|
1193
|
+
const Comparator = require_comparator();
|
|
1194
|
+
const { ANY } = Comparator;
|
|
1195
|
+
const Range = require_range();
|
|
1196
|
+
const satisfies = require_satisfies();
|
|
1197
|
+
const gt = require_gt();
|
|
1198
|
+
const lt = require_lt();
|
|
1199
|
+
const lte = require_lte();
|
|
1200
|
+
const gte = require_gte();
|
|
1201
|
+
const outside = (version, range, hilo, options) => {
|
|
1202
|
+
version = new SemVer(version, options);
|
|
1203
|
+
range = new Range(range, options);
|
|
1204
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
1205
|
+
switch (hilo) {
|
|
1206
|
+
case ">":
|
|
1207
|
+
gtfn = gt;
|
|
1208
|
+
ltefn = lte;
|
|
1209
|
+
ltfn = lt;
|
|
1210
|
+
comp = ">";
|
|
1211
|
+
ecomp = ">=";
|
|
1212
|
+
break;
|
|
1213
|
+
case "<":
|
|
1214
|
+
gtfn = lt;
|
|
1215
|
+
ltefn = gte;
|
|
1216
|
+
ltfn = gt;
|
|
1217
|
+
comp = "<";
|
|
1218
|
+
ecomp = "<=";
|
|
1219
|
+
break;
|
|
1220
|
+
default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
1221
|
+
}
|
|
1222
|
+
if (satisfies(version, range, options)) return false;
|
|
1223
|
+
for (let i = 0; i < range.set.length; ++i) {
|
|
1224
|
+
const comparators = range.set[i];
|
|
1225
|
+
let high = null;
|
|
1226
|
+
let low = null;
|
|
1227
|
+
comparators.forEach((comparator) => {
|
|
1228
|
+
if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
|
|
1229
|
+
high = high || comparator;
|
|
1230
|
+
low = low || comparator;
|
|
1231
|
+
if (gtfn(comparator.semver, high.semver, options)) high = comparator;
|
|
1232
|
+
else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
|
|
1233
|
+
});
|
|
1234
|
+
if (high.operator === comp || high.operator === ecomp) return false;
|
|
1235
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
|
|
1236
|
+
else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
|
|
1237
|
+
}
|
|
1238
|
+
return true;
|
|
1239
|
+
};
|
|
1240
|
+
module.exports = outside;
|
|
1241
|
+
}));
|
|
1242
|
+
//#endregion
|
|
1243
|
+
//#region ../../node_modules/semver/ranges/gtr.js
|
|
1244
|
+
var require_gtr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1245
|
+
const outside = require_outside();
|
|
1246
|
+
const gtr = (version, range, options) => outside(version, range, ">", options);
|
|
1247
|
+
module.exports = gtr;
|
|
1248
|
+
}));
|
|
1249
|
+
//#endregion
|
|
1250
|
+
//#region ../../node_modules/semver/ranges/ltr.js
|
|
1251
|
+
var require_ltr = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1252
|
+
const outside = require_outside();
|
|
1253
|
+
const ltr = (version, range, options) => outside(version, range, "<", options);
|
|
1254
|
+
module.exports = ltr;
|
|
1255
|
+
}));
|
|
1256
|
+
//#endregion
|
|
1257
|
+
//#region ../../node_modules/semver/ranges/intersects.js
|
|
1258
|
+
var require_intersects = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1259
|
+
const Range = require_range();
|
|
1260
|
+
const intersects = (r1, r2, options) => {
|
|
1261
|
+
r1 = new Range(r1, options);
|
|
1262
|
+
r2 = new Range(r2, options);
|
|
1263
|
+
return r1.intersects(r2, options);
|
|
1264
|
+
};
|
|
1265
|
+
module.exports = intersects;
|
|
1266
|
+
}));
|
|
1267
|
+
//#endregion
|
|
1268
|
+
//#region ../../node_modules/semver/ranges/simplify.js
|
|
1269
|
+
var require_simplify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1270
|
+
const satisfies = require_satisfies();
|
|
1271
|
+
const compare = require_compare();
|
|
1272
|
+
module.exports = (versions, range, options) => {
|
|
1273
|
+
const set = [];
|
|
1274
|
+
let first = null;
|
|
1275
|
+
let prev = null;
|
|
1276
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
1277
|
+
for (const version of v) if (satisfies(version, range, options)) {
|
|
1278
|
+
prev = version;
|
|
1279
|
+
if (!first) first = version;
|
|
1280
|
+
} else {
|
|
1281
|
+
if (prev) set.push([first, prev]);
|
|
1282
|
+
prev = null;
|
|
1283
|
+
first = null;
|
|
1284
|
+
}
|
|
1285
|
+
if (first) set.push([first, null]);
|
|
1286
|
+
const ranges = [];
|
|
1287
|
+
for (const [min, max] of set) if (min === max) ranges.push(min);
|
|
1288
|
+
else if (!max && min === v[0]) ranges.push("*");
|
|
1289
|
+
else if (!max) ranges.push(`>=${min}`);
|
|
1290
|
+
else if (min === v[0]) ranges.push(`<=${max}`);
|
|
1291
|
+
else ranges.push(`${min} - ${max}`);
|
|
1292
|
+
const simplified = ranges.join(" || ");
|
|
1293
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
1294
|
+
return simplified.length < original.length ? simplified : range;
|
|
1295
|
+
};
|
|
1296
|
+
}));
|
|
1297
|
+
//#endregion
|
|
1298
|
+
//#region ../../node_modules/semver/ranges/subset.js
|
|
1299
|
+
var require_subset = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1300
|
+
const Range = require_range();
|
|
1301
|
+
const Comparator = require_comparator();
|
|
1302
|
+
const { ANY } = Comparator;
|
|
1303
|
+
const satisfies = require_satisfies();
|
|
1304
|
+
const compare = require_compare();
|
|
1305
|
+
const subset = (sub, dom, options = {}) => {
|
|
1306
|
+
if (sub === dom) return true;
|
|
1307
|
+
sub = new Range(sub, options);
|
|
1308
|
+
dom = new Range(dom, options);
|
|
1309
|
+
let sawNonNull = false;
|
|
1310
|
+
OUTER: for (const simpleSub of sub.set) {
|
|
1311
|
+
for (const simpleDom of dom.set) {
|
|
1312
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
1313
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
1314
|
+
if (isSub) continue OUTER;
|
|
1315
|
+
}
|
|
1316
|
+
if (sawNonNull) return false;
|
|
1317
|
+
}
|
|
1318
|
+
return true;
|
|
1319
|
+
};
|
|
1320
|
+
const minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
1321
|
+
const minimumVersion = [new Comparator(">=0.0.0")];
|
|
1322
|
+
const simpleSubset = (sub, dom, options) => {
|
|
1323
|
+
if (sub === dom) return true;
|
|
1324
|
+
if (sub.length === 1 && sub[0].semver === ANY) if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
1325
|
+
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
1326
|
+
else sub = minimumVersion;
|
|
1327
|
+
if (dom.length === 1 && dom[0].semver === ANY) if (options.includePrerelease) return true;
|
|
1328
|
+
else dom = minimumVersion;
|
|
1329
|
+
const eqSet = /* @__PURE__ */ new Set();
|
|
1330
|
+
let gt, lt;
|
|
1331
|
+
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
1332
|
+
else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
|
|
1333
|
+
else eqSet.add(c.semver);
|
|
1334
|
+
if (eqSet.size > 1) return null;
|
|
1335
|
+
let gtltComp;
|
|
1336
|
+
if (gt && lt) {
|
|
1337
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
1338
|
+
if (gtltComp > 0) return null;
|
|
1339
|
+
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
1340
|
+
}
|
|
1341
|
+
for (const eq of eqSet) {
|
|
1342
|
+
if (gt && !satisfies(eq, String(gt), options)) return null;
|
|
1343
|
+
if (lt && !satisfies(eq, String(lt), options)) return null;
|
|
1344
|
+
for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
|
|
1345
|
+
return true;
|
|
1346
|
+
}
|
|
1347
|
+
let higher, lower;
|
|
1348
|
+
let hasDomLT, hasDomGT;
|
|
1349
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
1350
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
1351
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
|
|
1352
|
+
for (const c of dom) {
|
|
1353
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
1354
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
1355
|
+
if (gt) {
|
|
1356
|
+
if (needDomGTPre) {
|
|
1357
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
|
|
1358
|
+
}
|
|
1359
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
1360
|
+
higher = higherGT(gt, c, options);
|
|
1361
|
+
if (higher === c && higher !== gt) return false;
|
|
1362
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) return false;
|
|
1363
|
+
}
|
|
1364
|
+
if (lt) {
|
|
1365
|
+
if (needDomLTPre) {
|
|
1366
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
|
|
1367
|
+
}
|
|
1368
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
1369
|
+
lower = lowerLT(lt, c, options);
|
|
1370
|
+
if (lower === c && lower !== lt) return false;
|
|
1371
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) return false;
|
|
1372
|
+
}
|
|
1373
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
|
|
1374
|
+
}
|
|
1375
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
|
|
1376
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
|
|
1377
|
+
if (needDomGTPre || needDomLTPre) return false;
|
|
1378
|
+
return true;
|
|
1379
|
+
};
|
|
1380
|
+
const higherGT = (a, b, options) => {
|
|
1381
|
+
if (!a) return b;
|
|
1382
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1383
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
1384
|
+
};
|
|
1385
|
+
const lowerLT = (a, b, options) => {
|
|
1386
|
+
if (!a) return b;
|
|
1387
|
+
const comp = compare(a.semver, b.semver, options);
|
|
1388
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
1389
|
+
};
|
|
1390
|
+
module.exports = subset;
|
|
1391
|
+
}));
|
|
1392
|
+
//#endregion
|
|
1393
|
+
//#region src/forge.ts
|
|
1394
|
+
var import_semver = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1395
|
+
const internalRe = require_re();
|
|
1396
|
+
const constants = require_constants();
|
|
1397
|
+
const SemVer = require_semver$1();
|
|
1398
|
+
const identifiers = require_identifiers();
|
|
1399
|
+
module.exports = {
|
|
1400
|
+
parse: require_parse(),
|
|
1401
|
+
valid: require_valid$1(),
|
|
1402
|
+
clean: require_clean(),
|
|
1403
|
+
inc: require_inc(),
|
|
1404
|
+
diff: require_diff(),
|
|
1405
|
+
major: require_major(),
|
|
1406
|
+
minor: require_minor(),
|
|
1407
|
+
patch: require_patch(),
|
|
1408
|
+
prerelease: require_prerelease(),
|
|
1409
|
+
compare: require_compare(),
|
|
1410
|
+
rcompare: require_rcompare(),
|
|
1411
|
+
compareLoose: require_compare_loose(),
|
|
1412
|
+
compareBuild: require_compare_build(),
|
|
1413
|
+
sort: require_sort(),
|
|
1414
|
+
rsort: require_rsort(),
|
|
1415
|
+
gt: require_gt(),
|
|
1416
|
+
lt: require_lt(),
|
|
1417
|
+
eq: require_eq(),
|
|
1418
|
+
neq: require_neq(),
|
|
1419
|
+
gte: require_gte(),
|
|
1420
|
+
lte: require_lte(),
|
|
1421
|
+
cmp: require_cmp(),
|
|
1422
|
+
coerce: require_coerce(),
|
|
1423
|
+
Comparator: require_comparator(),
|
|
1424
|
+
Range: require_range(),
|
|
1425
|
+
satisfies: require_satisfies(),
|
|
1426
|
+
toComparators: require_to_comparators(),
|
|
1427
|
+
maxSatisfying: require_max_satisfying(),
|
|
1428
|
+
minSatisfying: require_min_satisfying(),
|
|
1429
|
+
minVersion: require_min_version(),
|
|
1430
|
+
validRange: require_valid(),
|
|
1431
|
+
outside: require_outside(),
|
|
1432
|
+
gtr: require_gtr(),
|
|
1433
|
+
ltr: require_ltr(),
|
|
1434
|
+
intersects: require_intersects(),
|
|
1435
|
+
simplifyRange: require_simplify(),
|
|
1436
|
+
subset: require_subset(),
|
|
1437
|
+
SemVer,
|
|
1438
|
+
re: internalRe.re,
|
|
1439
|
+
src: internalRe.src,
|
|
1440
|
+
tokens: internalRe.t,
|
|
1441
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
1442
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
1443
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
1444
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
1445
|
+
};
|
|
1446
|
+
})))(), 1);
|
|
1447
|
+
const IDMake = "electron:make";
|
|
1448
|
+
const IDPackage = "electron:package";
|
|
1449
|
+
const IDPackageV2 = "electron:package:v2";
|
|
1450
|
+
const IDPreview = "electron:preview";
|
|
1451
|
+
const paramsInputFolder = { "input-folder": (0, _pipelab_plugin_core.createPathParam)("", {
|
|
1452
|
+
label: "Folder to package",
|
|
1453
|
+
required: true,
|
|
1454
|
+
control: {
|
|
1455
|
+
type: "path",
|
|
1456
|
+
options: { properties: ["openDirectory"] }
|
|
1457
|
+
}
|
|
1458
|
+
}) };
|
|
1459
|
+
const paramsInputURL = { "input-url": (0, _pipelab_plugin_core.createStringParam)("", {
|
|
1460
|
+
label: "URL to preview",
|
|
1461
|
+
required: true
|
|
1462
|
+
}) };
|
|
1463
|
+
const params = {
|
|
1464
|
+
arch: {
|
|
1465
|
+
value: "",
|
|
1466
|
+
label: "Architecture",
|
|
1467
|
+
required: false,
|
|
1468
|
+
control: {
|
|
1469
|
+
type: "select",
|
|
1470
|
+
options: {
|
|
1471
|
+
placeholder: "Architecture",
|
|
1472
|
+
options: [
|
|
1473
|
+
{
|
|
1474
|
+
label: "Older PCs (ia32)",
|
|
1475
|
+
value: "ia32"
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
label: "Modern PCs (x64)",
|
|
1479
|
+
value: "x64"
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
label: "Older Mobile/Pi (armv7l)",
|
|
1483
|
+
value: "armv7l"
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
label: "New Mobile/Apple Silicon (arm64)",
|
|
1487
|
+
value: "arm64"
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
label: "Mac Universal (universal)",
|
|
1491
|
+
value: "universal"
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
label: "Special Systems (mips64el)",
|
|
1495
|
+
value: "mips64el"
|
|
1496
|
+
}
|
|
1497
|
+
]
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
},
|
|
1501
|
+
platform: {
|
|
1502
|
+
value: "",
|
|
1503
|
+
label: "Platform",
|
|
1504
|
+
required: false,
|
|
1505
|
+
control: {
|
|
1506
|
+
type: "select",
|
|
1507
|
+
options: {
|
|
1508
|
+
placeholder: "Platform",
|
|
1509
|
+
options: [
|
|
1510
|
+
{
|
|
1511
|
+
label: "Windows (win32)",
|
|
1512
|
+
value: "win32"
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
label: "macOS (darwin)",
|
|
1516
|
+
value: "darwin"
|
|
1517
|
+
},
|
|
1518
|
+
{
|
|
1519
|
+
label: "Linux (linux)",
|
|
1520
|
+
value: "linux"
|
|
1521
|
+
}
|
|
1522
|
+
]
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
},
|
|
1526
|
+
configuration: {
|
|
1527
|
+
label: "Electron configuration",
|
|
1528
|
+
value: void 0,
|
|
1529
|
+
required: true,
|
|
1530
|
+
control: { type: "json" }
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
const configureParams = {
|
|
1534
|
+
name: (0, _pipelab_plugin_core.createStringParam)("Pipelab", {
|
|
1535
|
+
label: "Application name",
|
|
1536
|
+
description: "The name of the application",
|
|
1537
|
+
required: true
|
|
1538
|
+
}),
|
|
1539
|
+
appBundleId: (0, _pipelab_plugin_core.createStringParam)("com.pipelab.app", {
|
|
1540
|
+
label: "Application bundle ID",
|
|
1541
|
+
description: "The bundle ID of the application",
|
|
1542
|
+
required: true
|
|
1543
|
+
}),
|
|
1544
|
+
appCopyright: (0, _pipelab_plugin_core.createStringParam)("Copyright © 2024 Pipelab", {
|
|
1545
|
+
label: "Application copyright",
|
|
1546
|
+
description: "The copyright of the application",
|
|
1547
|
+
required: false
|
|
1548
|
+
}),
|
|
1549
|
+
appVersion: (0, _pipelab_plugin_core.createStringParam)("1.0.0", {
|
|
1550
|
+
label: "Application version",
|
|
1551
|
+
description: "The version of the application",
|
|
1552
|
+
required: true
|
|
1553
|
+
}),
|
|
1554
|
+
icon: (0, _pipelab_plugin_core.createPathParam)("", {
|
|
1555
|
+
label: "Application icon",
|
|
1556
|
+
description: "The icon of the application. macOS: .icns. Windows: .ico",
|
|
1557
|
+
required: false,
|
|
1558
|
+
control: {
|
|
1559
|
+
type: "path",
|
|
1560
|
+
options: { filters: [{
|
|
1561
|
+
name: "Image",
|
|
1562
|
+
extensions: [
|
|
1563
|
+
"png",
|
|
1564
|
+
"jpg",
|
|
1565
|
+
"jpeg",
|
|
1566
|
+
"gif",
|
|
1567
|
+
"bmp",
|
|
1568
|
+
"ico",
|
|
1569
|
+
"icns"
|
|
1570
|
+
]
|
|
1571
|
+
}] },
|
|
1572
|
+
label: "Path to an image file"
|
|
1573
|
+
}
|
|
1574
|
+
}),
|
|
1575
|
+
author: (0, _pipelab_plugin_core.createStringParam)("Pipelab", {
|
|
1576
|
+
label: "Application author",
|
|
1577
|
+
description: "The author of the application",
|
|
1578
|
+
required: true
|
|
1579
|
+
}),
|
|
1580
|
+
description: (0, _pipelab_plugin_core.createStringParam)("A simple Electron application", {
|
|
1581
|
+
label: "Application description",
|
|
1582
|
+
description: "The description of the application",
|
|
1583
|
+
required: false
|
|
1584
|
+
}),
|
|
1585
|
+
customPackages: (0, _pipelab_plugin_core.createArray)(`[
|
|
1586
|
+
// e.g. "lodash" or "express@4.17.1"
|
|
1587
|
+
]`, {
|
|
1588
|
+
label: "Custom npm packages",
|
|
1589
|
+
description: "A list of additional npm packages to install (format: \"package\" or \"package@version\")",
|
|
1590
|
+
required: false,
|
|
1591
|
+
control: {
|
|
1592
|
+
type: "array",
|
|
1593
|
+
options: { kind: "text" }
|
|
1594
|
+
}
|
|
1595
|
+
}),
|
|
1596
|
+
appCategoryType: (0, _pipelab_plugin_core.createStringParam)("public.app-category.developer-tools", {
|
|
1597
|
+
platforms: ["darwin"],
|
|
1598
|
+
label: "Application category type",
|
|
1599
|
+
description: "The category type of the application",
|
|
1600
|
+
required: false
|
|
1601
|
+
}),
|
|
1602
|
+
width: (0, _pipelab_plugin_core.createNumberParam)(800, {
|
|
1603
|
+
label: "Window width",
|
|
1604
|
+
description: "The width of the window",
|
|
1605
|
+
required: false
|
|
1606
|
+
}),
|
|
1607
|
+
height: (0, _pipelab_plugin_core.createNumberParam)(600, {
|
|
1608
|
+
label: "Window height",
|
|
1609
|
+
description: "The height of the window",
|
|
1610
|
+
required: false
|
|
1611
|
+
}),
|
|
1612
|
+
fullscreen: {
|
|
1613
|
+
label: "Fullscreen",
|
|
1614
|
+
value: false,
|
|
1615
|
+
description: "Whether to start the application in fullscreen mode",
|
|
1616
|
+
required: false,
|
|
1617
|
+
control: { type: "boolean" }
|
|
1618
|
+
},
|
|
1619
|
+
frame: {
|
|
1620
|
+
label: "Frame",
|
|
1621
|
+
value: true,
|
|
1622
|
+
description: "Whether to show the window frame",
|
|
1623
|
+
required: false,
|
|
1624
|
+
control: { type: "boolean" }
|
|
1625
|
+
},
|
|
1626
|
+
transparent: {
|
|
1627
|
+
label: "Transparent",
|
|
1628
|
+
value: false,
|
|
1629
|
+
description: "Whether to make the window transparent",
|
|
1630
|
+
required: false,
|
|
1631
|
+
control: { type: "boolean" }
|
|
1632
|
+
},
|
|
1633
|
+
toolbar: {
|
|
1634
|
+
label: "Toolbar",
|
|
1635
|
+
value: true,
|
|
1636
|
+
description: "Whether to show the toolbar",
|
|
1637
|
+
required: false,
|
|
1638
|
+
control: { type: "boolean" }
|
|
1639
|
+
},
|
|
1640
|
+
alwaysOnTop: {
|
|
1641
|
+
label: "Always on top",
|
|
1642
|
+
value: false,
|
|
1643
|
+
description: "Whether to always keep the window on top",
|
|
1644
|
+
required: false,
|
|
1645
|
+
control: { type: "boolean" }
|
|
1646
|
+
},
|
|
1647
|
+
backgroundColor: (0, _pipelab_plugin_core.createColorPicker)("#ffffff", {
|
|
1648
|
+
label: "Background Color",
|
|
1649
|
+
description: "The background color of the window",
|
|
1650
|
+
required: false
|
|
1651
|
+
}),
|
|
1652
|
+
electronVersion: (0, _pipelab_plugin_core.createStringParam)("", {
|
|
1653
|
+
label: "Electron version",
|
|
1654
|
+
description: "The version of Electron to use. If no version specified, it will use the latest one.",
|
|
1655
|
+
required: false
|
|
1656
|
+
}),
|
|
1657
|
+
customMainCode: (0, _pipelab_plugin_core.createPathParam)("", {
|
|
1658
|
+
required: false,
|
|
1659
|
+
label: "Custom main code",
|
|
1660
|
+
control: {
|
|
1661
|
+
type: "path",
|
|
1662
|
+
options: { filters: [{
|
|
1663
|
+
name: "JavaScript",
|
|
1664
|
+
extensions: ["js"]
|
|
1665
|
+
}] },
|
|
1666
|
+
label: "Path to a file containing custom main code"
|
|
1667
|
+
}
|
|
1668
|
+
}),
|
|
1669
|
+
disableAsarPackaging: {
|
|
1670
|
+
required: false,
|
|
1671
|
+
label: "Disable ASAR packaging",
|
|
1672
|
+
value: true,
|
|
1673
|
+
control: { type: "boolean" },
|
|
1674
|
+
description: "Whether to disable packaging project files in a single binary or not"
|
|
1675
|
+
},
|
|
1676
|
+
enableExtraLogging: {
|
|
1677
|
+
required: false,
|
|
1678
|
+
label: "Enable extra logging",
|
|
1679
|
+
value: false,
|
|
1680
|
+
control: { type: "boolean" },
|
|
1681
|
+
description: "Whether to enable extra logging of internal tools while bundling"
|
|
1682
|
+
},
|
|
1683
|
+
clearServiceWorkerOnBoot: {
|
|
1684
|
+
required: false,
|
|
1685
|
+
label: "Clear service worker on boot",
|
|
1686
|
+
value: false,
|
|
1687
|
+
control: { type: "boolean" },
|
|
1688
|
+
description: "Whether to clear service worker on boot"
|
|
1689
|
+
},
|
|
1690
|
+
openDevtoolsOnStart: (0, _pipelab_plugin_core.createBooleanParam)(false, {
|
|
1691
|
+
label: "Open devtools on app start",
|
|
1692
|
+
required: false,
|
|
1693
|
+
description: "Whether to open devtools on app start"
|
|
1694
|
+
}),
|
|
1695
|
+
enableInProcessGPU: {
|
|
1696
|
+
required: false,
|
|
1697
|
+
label: "Enable in-process GPU",
|
|
1698
|
+
description: "When enabled, the GPU process runs inside the main browser process instead of a separate one. This can reduce overhead but may lead to instability or crashes if the GPU process fails.",
|
|
1699
|
+
value: false,
|
|
1700
|
+
control: { type: "boolean" }
|
|
1701
|
+
},
|
|
1702
|
+
enableDisableRendererBackgrounding: {
|
|
1703
|
+
required: false,
|
|
1704
|
+
description: "Enabling this prevents background tabs from being throttled, which can be useful for web apps that need continuous performance.",
|
|
1705
|
+
label: "Disable renderer backgrounding",
|
|
1706
|
+
value: false,
|
|
1707
|
+
control: { type: "boolean" }
|
|
1708
|
+
},
|
|
1709
|
+
forceHighPerformanceGpu: {
|
|
1710
|
+
required: false,
|
|
1711
|
+
description: "Enabling this forces the app to always use the high-performance GPU, which can improve rendering but may increase power consumption.",
|
|
1712
|
+
label: "Force high performance GPU",
|
|
1713
|
+
value: false,
|
|
1714
|
+
control: { type: "boolean" }
|
|
1715
|
+
},
|
|
1716
|
+
websocketApi: {
|
|
1717
|
+
required: false,
|
|
1718
|
+
label: "WebSocket APIs to allow (empty = all)",
|
|
1719
|
+
value: "[]",
|
|
1720
|
+
control: {
|
|
1721
|
+
type: "array",
|
|
1722
|
+
options: { kind: "text" }
|
|
1723
|
+
}
|
|
1724
|
+
},
|
|
1725
|
+
ignore: (0, _pipelab_plugin_core.createArray)(`[
|
|
1726
|
+
// use 'src/app/' as starting point
|
|
1727
|
+
]`, {
|
|
1728
|
+
required: false,
|
|
1729
|
+
label: "Folders to ignore",
|
|
1730
|
+
description: "An array of string or Regex that allow ignoring certain files or folders from being packaged",
|
|
1731
|
+
control: {
|
|
1732
|
+
type: "array",
|
|
1733
|
+
options: { kind: "text" }
|
|
1734
|
+
}
|
|
1735
|
+
}),
|
|
1736
|
+
enableSteamSupport: {
|
|
1737
|
+
required: false,
|
|
1738
|
+
label: "Enable steam support",
|
|
1739
|
+
description: "Whether to enable Steam support",
|
|
1740
|
+
value: false,
|
|
1741
|
+
control: { type: "boolean" }
|
|
1742
|
+
},
|
|
1743
|
+
steamGameId: (0, _pipelab_plugin_core.createNumberParam)(480, {
|
|
1744
|
+
required: false,
|
|
1745
|
+
label: "Steam game ID",
|
|
1746
|
+
description: "The Steam game ID"
|
|
1747
|
+
}),
|
|
1748
|
+
enableDiscordSupport: {
|
|
1749
|
+
required: false,
|
|
1750
|
+
label: "Enable Discord support",
|
|
1751
|
+
description: "Whether to enable Discord support",
|
|
1752
|
+
value: false,
|
|
1753
|
+
control: { type: "boolean" }
|
|
1754
|
+
},
|
|
1755
|
+
discordAppId: (0, _pipelab_plugin_core.createStringParam)("", {
|
|
1756
|
+
required: false,
|
|
1757
|
+
label: "Discord application ID",
|
|
1758
|
+
description: "The Discord application ID"
|
|
1759
|
+
}),
|
|
1760
|
+
enableDoctor: (0, _pipelab_plugin_core.createBooleanParam)(true, {
|
|
1761
|
+
required: false,
|
|
1762
|
+
label: "Enable doctor file",
|
|
1763
|
+
description: "Whether to include the doctor.bat file in Windows builds for prerequisite checking and app launching"
|
|
1764
|
+
}),
|
|
1765
|
+
serverMode: {
|
|
1766
|
+
value: "\"default\"",
|
|
1767
|
+
required: false,
|
|
1768
|
+
label: "Server mode",
|
|
1769
|
+
description: "The server mode to use",
|
|
1770
|
+
control: {
|
|
1771
|
+
type: "select",
|
|
1772
|
+
options: {
|
|
1773
|
+
placeholder: "Mode",
|
|
1774
|
+
options: [{
|
|
1775
|
+
value: "default",
|
|
1776
|
+
label: "Default"
|
|
1777
|
+
}, {
|
|
1778
|
+
value: "customProtocol",
|
|
1779
|
+
label: "Custom Protocol"
|
|
1780
|
+
}]
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
};
|
|
1785
|
+
const outputs = { output: {
|
|
1786
|
+
label: "Output",
|
|
1787
|
+
value: "",
|
|
1788
|
+
control: {
|
|
1789
|
+
type: "path",
|
|
1790
|
+
options: { properties: ["openDirectory"] }
|
|
1791
|
+
}
|
|
1792
|
+
} };
|
|
1793
|
+
const createMakeProps = (id, name, description, icon, displayString) => (0, _pipelab_plugin_core.createAction)({
|
|
1794
|
+
id,
|
|
1795
|
+
name,
|
|
1796
|
+
description,
|
|
1797
|
+
icon,
|
|
1798
|
+
displayString,
|
|
1799
|
+
meta: {},
|
|
1800
|
+
params: {
|
|
1801
|
+
...params,
|
|
1802
|
+
...paramsInputFolder
|
|
1803
|
+
},
|
|
1804
|
+
outputs
|
|
1805
|
+
});
|
|
1806
|
+
const createPackageProps = (id, name, description, icon, displayString, advanced, deprecated, deprecatedMessage, disabled, updateAvailable) => (0, _pipelab_plugin_core.createAction)({
|
|
1807
|
+
id,
|
|
1808
|
+
name,
|
|
1809
|
+
description,
|
|
1810
|
+
icon,
|
|
1811
|
+
displayString,
|
|
1812
|
+
meta: {},
|
|
1813
|
+
advanced,
|
|
1814
|
+
deprecated,
|
|
1815
|
+
deprecatedMessage,
|
|
1816
|
+
disabled,
|
|
1817
|
+
updateAvailable,
|
|
1818
|
+
params: {
|
|
1819
|
+
...params,
|
|
1820
|
+
...paramsInputFolder
|
|
1821
|
+
},
|
|
1822
|
+
outputs
|
|
1823
|
+
});
|
|
1824
|
+
const createPackageV2Props = (id, name, description, icon, displayString, advanced, deprecated, deprecatedMessage, disabled, updateAvailable) => {
|
|
1825
|
+
const { arch, platform } = params;
|
|
1826
|
+
return (0, _pipelab_plugin_core.createAction)({
|
|
1827
|
+
id,
|
|
1828
|
+
name,
|
|
1829
|
+
description,
|
|
1830
|
+
icon,
|
|
1831
|
+
displayString,
|
|
1832
|
+
meta: {},
|
|
1833
|
+
advanced,
|
|
1834
|
+
deprecated,
|
|
1835
|
+
deprecatedMessage,
|
|
1836
|
+
disabled,
|
|
1837
|
+
updateAvailable,
|
|
1838
|
+
params: {
|
|
1839
|
+
arch,
|
|
1840
|
+
platform,
|
|
1841
|
+
...paramsInputFolder,
|
|
1842
|
+
...configureParams
|
|
1843
|
+
},
|
|
1844
|
+
outputs
|
|
1845
|
+
});
|
|
1846
|
+
};
|
|
1847
|
+
const createPreviewProps = (id, name, description, icon, displayString) => (0, _pipelab_plugin_core.createAction)({
|
|
1848
|
+
id,
|
|
1849
|
+
name,
|
|
1850
|
+
description,
|
|
1851
|
+
icon,
|
|
1852
|
+
displayString,
|
|
1853
|
+
meta: {},
|
|
1854
|
+
params: {
|
|
1855
|
+
...params,
|
|
1856
|
+
...paramsInputURL
|
|
1857
|
+
},
|
|
1858
|
+
outputs
|
|
1859
|
+
});
|
|
1860
|
+
const forge = async (action, appFolder, { cwd, log, inputs, setOutput, paths, abortSignal, context }, completeConfiguration) => {
|
|
1861
|
+
log("Building electron");
|
|
1862
|
+
if (action !== "preview") await (0, _pipelab_plugin_core.detectRuntime)(appFolder);
|
|
1863
|
+
const { modules, node } = paths;
|
|
1864
|
+
const destinationFolder = await (0, _pipelab_plugin_core.generateTempFolder)(paths.cache);
|
|
1865
|
+
log(`Staging build in ${destinationFolder}`);
|
|
1866
|
+
try {
|
|
1867
|
+
const forge = (0, node_path.join)(destinationFolder, "node_modules", "@electron-forge", "cli", "dist", "electron-forge.js");
|
|
1868
|
+
const templateFolder = (0, node_path.join)(await (0, _pipelab_plugin_core.fetchPipelabAsset)("@pipelab/asset-electron", "^1.0.0", { context }), "template");
|
|
1869
|
+
console.log("templateFolder", templateFolder);
|
|
1870
|
+
console.log("destinationFolder", destinationFolder);
|
|
1871
|
+
await (0, node_fs_promises.cp)(templateFolder, destinationFolder, {
|
|
1872
|
+
recursive: true,
|
|
1873
|
+
filter: (src) => {
|
|
1874
|
+
return (0, node_path.basename)(src) !== "node_modules";
|
|
1875
|
+
}
|
|
1876
|
+
});
|
|
1877
|
+
console.log("copy done");
|
|
1878
|
+
const pkgJSONPath = (0, node_path.join)(destinationFolder, "package.json");
|
|
1879
|
+
const pkgJSONContent = await (0, node_fs_promises.readFile)(pkgJSONPath, "utf8");
|
|
1880
|
+
const sanitizedName = kebabCase(completeConfiguration.name);
|
|
1881
|
+
const originalIconPath = completeConfiguration.icon;
|
|
1882
|
+
const hasIcon = completeConfiguration.icon !== void 0 && completeConfiguration.icon !== "";
|
|
1883
|
+
const iconFilename = hasIcon ? (0, node_path.basename)(completeConfiguration.icon) : "";
|
|
1884
|
+
const newIconPath = hasIcon ? (0, node_path.join)(destinationFolder, iconFilename) : "";
|
|
1885
|
+
const relativeIconPath = hasIcon ? (0, node_path.join)("./", "build", iconFilename) : "";
|
|
1886
|
+
const relativeIconPath1 = hasIcon ? (0, node_path.join)("./", iconFilename) : "";
|
|
1887
|
+
log("relativeIconPath", relativeIconPath);
|
|
1888
|
+
log("relativeIconPath1", relativeIconPath1);
|
|
1889
|
+
const isCJSOnly = completeConfiguration.electronVersion !== void 0 && completeConfiguration.electronVersion !== "" && import_semver.default.lt(import_semver.default.coerce(completeConfiguration.electronVersion) || "0.0.0", "28.0.0");
|
|
1890
|
+
const pkgJSON = JSON.parse(pkgJSONContent);
|
|
1891
|
+
log("Setting name to", sanitizedName);
|
|
1892
|
+
pkgJSON.name = sanitizedName;
|
|
1893
|
+
log("Setting productName to", completeConfiguration.name);
|
|
1894
|
+
pkgJSON.productName = completeConfiguration.name;
|
|
1895
|
+
completeConfiguration.icon = relativeIconPath1;
|
|
1896
|
+
(0, node_fs_promises.writeFile)((0, node_path.join)(destinationFolder, "config.cjs"), `module.exports = ${JSON.stringify(completeConfiguration, void 0, 2)}`, "utf8");
|
|
1897
|
+
if (isCJSOnly) {
|
|
1898
|
+
log("Setting type to", "commonjs");
|
|
1899
|
+
pkgJSON.type = "commonjs";
|
|
1900
|
+
} else {
|
|
1901
|
+
log("Setting type to", "module");
|
|
1902
|
+
pkgJSON.type = "module";
|
|
1903
|
+
}
|
|
1904
|
+
await (0, node_fs_promises.writeFile)(pkgJSONPath, JSON.stringify(pkgJSON, null, 2));
|
|
1905
|
+
log("Installing packages");
|
|
1906
|
+
const { all: installAll } = await (0, _pipelab_plugin_core.runPnpm)(destinationFolder, {
|
|
1907
|
+
args: ["install", "--prefer-offline"],
|
|
1908
|
+
signal: abortSignal,
|
|
1909
|
+
context
|
|
1910
|
+
});
|
|
1911
|
+
if (installAll) log(installAll);
|
|
1912
|
+
console.log("done install");
|
|
1913
|
+
if (Array.isArray(completeConfiguration.customPackages) && completeConfiguration.customPackages.length > 0) {
|
|
1914
|
+
log(`Installing custom packages: ${completeConfiguration.customPackages.join(", ")}`);
|
|
1915
|
+
const { all: customAll } = await (0, _pipelab_plugin_core.runPnpm)(destinationFolder, {
|
|
1916
|
+
args: [
|
|
1917
|
+
"install",
|
|
1918
|
+
...completeConfiguration.customPackages,
|
|
1919
|
+
"--prefer-offline"
|
|
1920
|
+
],
|
|
1921
|
+
signal: abortSignal,
|
|
1922
|
+
context
|
|
1923
|
+
});
|
|
1924
|
+
if (customAll) log(customAll);
|
|
1925
|
+
}
|
|
1926
|
+
if (completeConfiguration.electronVersion && completeConfiguration.electronVersion !== "") {
|
|
1927
|
+
log(`Installing electron@${completeConfiguration.electronVersion}`);
|
|
1928
|
+
const { all: electronAll } = await (0, _pipelab_plugin_core.runPnpm)(destinationFolder, {
|
|
1929
|
+
args: [
|
|
1930
|
+
"install",
|
|
1931
|
+
`electron@${completeConfiguration.electronVersion}`,
|
|
1932
|
+
"--prefer-offline"
|
|
1933
|
+
],
|
|
1934
|
+
signal: abortSignal,
|
|
1935
|
+
context
|
|
1936
|
+
});
|
|
1937
|
+
if (electronAll) log(electronAll);
|
|
1938
|
+
}
|
|
1939
|
+
if (isCJSOnly) {
|
|
1940
|
+
log(`Installing execa@8`);
|
|
1941
|
+
const { all: execaAll } = await (0, _pipelab_plugin_core.runPnpm)(destinationFolder, {
|
|
1942
|
+
args: [
|
|
1943
|
+
"install",
|
|
1944
|
+
`execa@8`,
|
|
1945
|
+
"--prefer-offline"
|
|
1946
|
+
],
|
|
1947
|
+
signal: abortSignal,
|
|
1948
|
+
context
|
|
1949
|
+
});
|
|
1950
|
+
if (execaAll) log(execaAll);
|
|
1951
|
+
}
|
|
1952
|
+
console.log("completeConfiguration.icon", completeConfiguration.icon);
|
|
1953
|
+
if (hasIcon) await (0, node_fs_promises.cp)(originalIconPath, newIconPath, { recursive: true });
|
|
1954
|
+
const destinationFile = (0, node_path.join)(destinationFolder, "src", "custom-main.js");
|
|
1955
|
+
if (completeConfiguration.customMainCode) await (0, node_fs_promises.cp)(completeConfiguration.customMainCode, destinationFile, { recursive: true });
|
|
1956
|
+
else await (0, node_fs_promises.writeFile)(destinationFile, "console.log(\"No custom main code provided\")", { signal: abortSignal });
|
|
1957
|
+
if (isCJSOnly) {
|
|
1958
|
+
const external = [
|
|
1959
|
+
"electron",
|
|
1960
|
+
"@pipelab/steamworks.js",
|
|
1961
|
+
"electron",
|
|
1962
|
+
"node:*",
|
|
1963
|
+
"http",
|
|
1964
|
+
"node:stream"
|
|
1965
|
+
];
|
|
1966
|
+
await esbuild.build({
|
|
1967
|
+
entryPoints: [(0, node_path.join)(destinationFolder, "src", "index.js")],
|
|
1968
|
+
bundle: true,
|
|
1969
|
+
write: true,
|
|
1970
|
+
format: "cjs",
|
|
1971
|
+
platform: "node",
|
|
1972
|
+
external,
|
|
1973
|
+
outfile: (0, node_path.join)(destinationFolder, "dist", "index.js")
|
|
1974
|
+
});
|
|
1975
|
+
await esbuild.build({
|
|
1976
|
+
entryPoints: [(0, node_path.join)(destinationFolder, "src", "preload.js")],
|
|
1977
|
+
bundle: true,
|
|
1978
|
+
platform: "node",
|
|
1979
|
+
external,
|
|
1980
|
+
format: "cjs",
|
|
1981
|
+
write: true,
|
|
1982
|
+
outfile: (0, node_path.join)(destinationFolder, "dist", "preload.js")
|
|
1983
|
+
});
|
|
1984
|
+
await esbuild.build({
|
|
1985
|
+
entryPoints: [(0, node_path.join)(destinationFolder, "src", "custom-main.js")],
|
|
1986
|
+
bundle: true,
|
|
1987
|
+
platform: "node",
|
|
1988
|
+
external,
|
|
1989
|
+
format: "cjs",
|
|
1990
|
+
write: true,
|
|
1991
|
+
outfile: (0, node_path.join)(destinationFolder, "dist", "custom-main.js")
|
|
1992
|
+
});
|
|
1993
|
+
await (0, node_fs_promises.rm)((0, node_path.join)(destinationFolder, "src"), { recursive: true });
|
|
1994
|
+
await (0, node_fs_promises.cp)((0, node_path.join)(destinationFolder, "dist"), (0, node_path.join)(destinationFolder, "src"), { recursive: true });
|
|
1995
|
+
await (0, node_fs_promises.rm)((0, node_path.join)(destinationFolder, "dist"), { recursive: true });
|
|
1996
|
+
}
|
|
1997
|
+
const placeAppFolder = (0, node_path.join)(destinationFolder, "src", "app");
|
|
1998
|
+
if (appFolder && action !== "preview") await (0, node_fs_promises.cp)(appFolder, placeAppFolder, { recursive: true });
|
|
1999
|
+
const inputPlatform = inputs.platform === "" ? void 0 : inputs.platform;
|
|
2000
|
+
const inputArch = inputs.arch === "" ? void 0 : inputs.arch;
|
|
2001
|
+
try {
|
|
2002
|
+
log("typeof inputs.platform", typeof inputs.platform);
|
|
2003
|
+
const finalPlatform = inputPlatform ?? (0, node_os.platform)() ?? "";
|
|
2004
|
+
log("finalPlatform", finalPlatform);
|
|
2005
|
+
const finalArch = inputArch ?? (0, node_os.arch)() ?? "";
|
|
2006
|
+
await (0, _pipelab_plugin_core.runWithLiveLogs)(node, [
|
|
2007
|
+
forge,
|
|
2008
|
+
action,
|
|
2009
|
+
"--arch",
|
|
2010
|
+
finalArch,
|
|
2011
|
+
"--platform",
|
|
2012
|
+
finalPlatform
|
|
2013
|
+
], {
|
|
2014
|
+
cwd: destinationFolder,
|
|
2015
|
+
env: {
|
|
2016
|
+
DEBUG: completeConfiguration.enableExtraLogging ? "*" : "",
|
|
2017
|
+
ELECTRON_NO_ASAR: "1",
|
|
2018
|
+
PATH: `${(0, node_path.dirname)(node)}${node_path.delimiter}${process.env.PATH}`
|
|
2019
|
+
},
|
|
2020
|
+
cancelSignal: abortSignal
|
|
2021
|
+
}, log, {
|
|
2022
|
+
onStderr(data) {
|
|
2023
|
+
log(data);
|
|
2024
|
+
},
|
|
2025
|
+
onStdout(data) {
|
|
2026
|
+
log(data);
|
|
2027
|
+
}
|
|
2028
|
+
});
|
|
2029
|
+
if (action === "package") {
|
|
2030
|
+
const outName = (0, _pipelab_constants.outFolderName)(completeConfiguration.name, finalPlatform, finalArch);
|
|
2031
|
+
const binName = (0, _pipelab_constants.getBinName)(completeConfiguration.name);
|
|
2032
|
+
const output = (0, node_path.join)(cwd, "out", outName);
|
|
2033
|
+
setOutput("output", output);
|
|
2034
|
+
return {
|
|
2035
|
+
folder: output,
|
|
2036
|
+
binary: (0, node_path.join)(output, binName)
|
|
2037
|
+
};
|
|
2038
|
+
} else {
|
|
2039
|
+
const output = (0, node_path.join)(cwd, "out", "make");
|
|
2040
|
+
setOutput("output", output);
|
|
2041
|
+
return {
|
|
2042
|
+
folder: output,
|
|
2043
|
+
binary: void 0
|
|
2044
|
+
};
|
|
2045
|
+
}
|
|
2046
|
+
} catch (e) {
|
|
2047
|
+
if (e instanceof Error) {
|
|
2048
|
+
if (e.name === "RequestError") log("Request error");
|
|
2049
|
+
if (e.name === "RequestError") log("Request error");
|
|
2050
|
+
}
|
|
2051
|
+
log(e);
|
|
2052
|
+
throw e;
|
|
2053
|
+
}
|
|
2054
|
+
} finally {
|
|
2055
|
+
try {
|
|
2056
|
+
if (action !== "preview") await (0, node_fs_promises.cp)((0, node_path.join)(destinationFolder, "out"), (0, node_path.join)(cwd, "out"), { recursive: true });
|
|
2057
|
+
} catch (e) {
|
|
2058
|
+
log("Failed to copy build output back to cwd:", e);
|
|
2059
|
+
}
|
|
2060
|
+
await (0, node_fs_promises.rm)(destinationFolder, {
|
|
2061
|
+
recursive: true,
|
|
2062
|
+
force: true
|
|
2063
|
+
});
|
|
2064
|
+
}
|
|
2065
|
+
};
|
|
2066
|
+
//#endregion
|
|
2067
|
+
//#region src/utils.ts
|
|
2068
|
+
const defaultElectronConfig = {
|
|
2069
|
+
alwaysOnTop: false,
|
|
2070
|
+
appBundleId: "com.pipelab.app",
|
|
2071
|
+
appCategoryType: "",
|
|
2072
|
+
appCopyright: "Copyright © 2024 Pipelab",
|
|
2073
|
+
appVersion: "1.0.0",
|
|
2074
|
+
author: "Pipelab",
|
|
2075
|
+
customMainCode: "",
|
|
2076
|
+
description: "A simple Electron application",
|
|
2077
|
+
electronVersion: "",
|
|
2078
|
+
disableAsarPackaging: true,
|
|
2079
|
+
forceHighPerformanceGpu: false,
|
|
2080
|
+
enableExtraLogging: false,
|
|
2081
|
+
clearServiceWorkerOnBoot: false,
|
|
2082
|
+
enableDisableRendererBackgrounding: false,
|
|
2083
|
+
enableInProcessGPU: false,
|
|
2084
|
+
frame: true,
|
|
2085
|
+
fullscreen: false,
|
|
2086
|
+
icon: "",
|
|
2087
|
+
height: 600,
|
|
2088
|
+
name: "Pipelab",
|
|
2089
|
+
toolbar: true,
|
|
2090
|
+
transparent: false,
|
|
2091
|
+
width: 800,
|
|
2092
|
+
enableSteamSupport: false,
|
|
2093
|
+
steamGameId: 480,
|
|
2094
|
+
enableDiscordSupport: false,
|
|
2095
|
+
discordAppId: "",
|
|
2096
|
+
ignore: [],
|
|
2097
|
+
backgroundColor: "#FFF",
|
|
2098
|
+
openDevtoolsOnStart: false,
|
|
2099
|
+
enableDoctor: false,
|
|
2100
|
+
customPackages: [],
|
|
2101
|
+
serverMode: "default"
|
|
2102
|
+
};
|
|
2103
|
+
//#endregion
|
|
2104
|
+
//#region src/make.ts
|
|
2105
|
+
const makeRunner = (0, _pipelab_plugin_core.createActionRunner)(async (options) => {
|
|
2106
|
+
const appFolder = options.inputs["input-folder"];
|
|
2107
|
+
if (!options.inputs.configuration) throw new Error("Missing electron configuration");
|
|
2108
|
+
return await forge("make", appFolder, options, (0, ts_deepmerge.merge)(defaultElectronConfig, options.inputs.configuration));
|
|
2109
|
+
});
|
|
2110
|
+
//#endregion
|
|
2111
|
+
//#region src/package.ts
|
|
2112
|
+
const packageRunner = (0, _pipelab_plugin_core.createActionRunner)(async (options) => {
|
|
2113
|
+
const appFolder = options.inputs["input-folder"];
|
|
2114
|
+
if (!options.inputs.configuration) throw new Error("Missing electron configuration");
|
|
2115
|
+
return await forge("package", appFolder, options, (0, ts_deepmerge.merge)(defaultElectronConfig, options.inputs.configuration));
|
|
2116
|
+
});
|
|
2117
|
+
//#endregion
|
|
2118
|
+
//#region src/preview.ts
|
|
2119
|
+
const previewRunner = (0, _pipelab_plugin_core.createActionRunner)(async (options) => {
|
|
2120
|
+
const url = options.inputs["input-url"];
|
|
2121
|
+
if (url === "") throw new Error("URL can't be empty");
|
|
2122
|
+
if (!options.inputs.configuration) throw new Error("Missing electron configuration");
|
|
2123
|
+
const output = await forge("package", void 0, options, (0, ts_deepmerge.merge)(defaultElectronConfig, options.inputs.configuration));
|
|
2124
|
+
options.log("Opening preview", JSON.stringify(output));
|
|
2125
|
+
options.log("Opening url", url);
|
|
2126
|
+
await (0, _pipelab_plugin_core.runWithLiveLogs)(output.binary, ["--url", url], { cancelSignal: options.abortSignal }, options.log);
|
|
2127
|
+
});
|
|
2128
|
+
//#endregion
|
|
2129
|
+
//#region src/configure.ts
|
|
2130
|
+
const props = (0, _pipelab_plugin_core.createAction)({
|
|
2131
|
+
id: "electron:configure",
|
|
2132
|
+
description: "Configure electron",
|
|
2133
|
+
displayString: "'Configure Electron'",
|
|
2134
|
+
icon: "",
|
|
2135
|
+
meta: {},
|
|
2136
|
+
name: "Configure Electron",
|
|
2137
|
+
advanced: true,
|
|
2138
|
+
outputs: { configuration: {
|
|
2139
|
+
label: "Configuration",
|
|
2140
|
+
value: {}
|
|
2141
|
+
} },
|
|
2142
|
+
params: configureParams
|
|
2143
|
+
});
|
|
2144
|
+
const configureRunner = (0, _pipelab_plugin_core.createActionRunner)(async ({ setOutput, inputs }) => {
|
|
2145
|
+
setOutput("configuration", inputs);
|
|
2146
|
+
});
|
|
2147
|
+
//#endregion
|
|
2148
|
+
//#region src/package-v2.ts
|
|
2149
|
+
const packageV2Runner = (0, _pipelab_plugin_core.createActionRunner)(async (options) => {
|
|
2150
|
+
const appFolder = options.inputs["input-folder"];
|
|
2151
|
+
const completeConfiguration = (0, ts_deepmerge.merge)(defaultElectronConfig, {
|
|
2152
|
+
alwaysOnTop: options.inputs["alwaysOnTop"],
|
|
2153
|
+
appBundleId: options.inputs["appBundleId"],
|
|
2154
|
+
appCategoryType: options.inputs["appCategoryType"],
|
|
2155
|
+
appCopyright: options.inputs["appCopyright"],
|
|
2156
|
+
appVersion: options.inputs["appVersion"],
|
|
2157
|
+
author: options.inputs["author"],
|
|
2158
|
+
customMainCode: options.inputs["customMainCode"],
|
|
2159
|
+
description: options.inputs["description"],
|
|
2160
|
+
electronVersion: options.inputs["electronVersion"],
|
|
2161
|
+
disableAsarPackaging: options.inputs["disableAsarPackaging"],
|
|
2162
|
+
forceHighPerformanceGpu: options.inputs["forceHighPerformanceGpu"],
|
|
2163
|
+
enableExtraLogging: options.inputs["enableExtraLogging"],
|
|
2164
|
+
clearServiceWorkerOnBoot: options.inputs["clearServiceWorkerOnBoot"],
|
|
2165
|
+
enableDisableRendererBackgrounding: options.inputs["enableDisableRendererBackgrounding"],
|
|
2166
|
+
enableInProcessGPU: options.inputs["enableInProcessGPU"],
|
|
2167
|
+
frame: options.inputs["frame"],
|
|
2168
|
+
fullscreen: options.inputs["fullscreen"],
|
|
2169
|
+
icon: options.inputs["icon"],
|
|
2170
|
+
height: options.inputs["height"],
|
|
2171
|
+
name: options.inputs["name"],
|
|
2172
|
+
toolbar: options.inputs["toolbar"],
|
|
2173
|
+
transparent: options.inputs["transparent"],
|
|
2174
|
+
width: options.inputs["width"],
|
|
2175
|
+
enableSteamSupport: options.inputs["enableSteamSupport"],
|
|
2176
|
+
steamGameId: options.inputs["steamGameId"],
|
|
2177
|
+
ignore: options.inputs["ignore"],
|
|
2178
|
+
openDevtoolsOnStart: options.inputs["openDevtoolsOnStart"],
|
|
2179
|
+
enableDiscordSupport: options.inputs["enableDiscordSupport"],
|
|
2180
|
+
discordAppId: options.inputs["discordAppId"],
|
|
2181
|
+
customPackages: options.inputs["customPackages"],
|
|
2182
|
+
backgroundColor: options.inputs["backgroundColor"],
|
|
2183
|
+
enableDoctor: options.inputs["enableDoctor"],
|
|
2184
|
+
serverMode: options.inputs["serverMode"]
|
|
2185
|
+
});
|
|
2186
|
+
options.log("completeConfiguration", completeConfiguration);
|
|
2187
|
+
return await forge("package", appFolder, options, completeConfiguration);
|
|
2188
|
+
});
|
|
2189
|
+
//#endregion
|
|
2190
|
+
//#region src/index.ts
|
|
2191
|
+
const icon = new URL("./public/electron.webp", require("url").pathToFileURL(__filename).href).href;
|
|
2192
|
+
var src_default = (0, _pipelab_plugin_core.createNodeDefinition)({
|
|
2193
|
+
description: "Electron",
|
|
2194
|
+
name: "Electron",
|
|
2195
|
+
id: "electron",
|
|
2196
|
+
icon: {
|
|
2197
|
+
type: "image",
|
|
2198
|
+
image: icon
|
|
2199
|
+
},
|
|
2200
|
+
nodes: [
|
|
2201
|
+
{
|
|
2202
|
+
node: createMakeProps(IDMake, "Create Installer", "Create a distributable installer for your chosen platform", "", "`Build package for ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`"),
|
|
2203
|
+
runner: makeRunner
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
node: createPackageProps(IDPackage, "Package app", "Gather all necessary files and prepare your app for distribution, creating a platform-specific bundle.", "", "`Package app from ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`", true),
|
|
2207
|
+
runner: packageRunner
|
|
2208
|
+
},
|
|
2209
|
+
{
|
|
2210
|
+
node: createPackageV2Props(IDPackageV2, "Package app with configuration", "Gather all necessary files and prepare your app for distribution, creating a platform-specific bundle.", "", "`Package app from ${fmt.param(params['input-folder'], 'primary', 'Input folder not set')}`", false, false, void 0, false, false),
|
|
2211
|
+
runner: packageV2Runner
|
|
2212
|
+
},
|
|
2213
|
+
{
|
|
2214
|
+
node: createPreviewProps(IDPreview, "Preview app", "Package and preview your app from an URL", "", "`Preview app from ${fmt.param(params['input-url'], 'primary', 'URL not set')}`"),
|
|
2215
|
+
runner: previewRunner
|
|
2216
|
+
},
|
|
2217
|
+
{
|
|
2218
|
+
node: props,
|
|
2219
|
+
runner: configureRunner
|
|
2220
|
+
}
|
|
2221
|
+
]
|
|
2222
|
+
});
|
|
2223
|
+
//#endregion
|
|
2224
|
+
module.exports = src_default;
|