@pipelab/plugin-electron 0.0.1

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