@pipelab/plugin-electron 1.0.0-beta.14 → 1.0.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -4,11 +4,11 @@ import { normalize } from "path";
4
4
  import { formatWithOptions, types } from "util";
5
5
  import path, { basename, delimiter, dirname, join } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
- import { arch, constants, platform, tmpdir } from "node:os";
7
+ import { arch, constants, platform } from "node:os";
8
8
  import { appendFileSync, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
9
+ import { access, chmod, cp, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
9
10
  import http from "node:http";
10
11
  import { webcrypto } from "node:crypto";
11
- import { access, chmod, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
12
12
  import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
13
13
  import { StringDecoder } from "node:string_decoder";
14
14
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
@@ -20,6 +20,7 @@ import { serialize } from "node:v8";
20
20
  import { finished, pipeline } from "node:stream/promises";
21
21
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
22
22
  import { Buffer as Buffer$1 } from "node:buffer";
23
+ import dns from "node:dns/promises";
23
24
  //#region ../../packages/migration/src/models/createMigration.ts
24
25
  function createMigration$1(migration) {
25
26
  return {
@@ -1595,6 +1596,56 @@ function literal(literal_, message) {
1595
1596
  }
1596
1597
  };
1597
1598
  }
1599
+ function looseObject(entries, message) {
1600
+ return {
1601
+ kind: "schema",
1602
+ type: "loose_object",
1603
+ reference: looseObject,
1604
+ expects: "Object",
1605
+ async: false,
1606
+ entries,
1607
+ message,
1608
+ _run(dataset, config2) {
1609
+ const input = dataset.value;
1610
+ if (input && typeof input === "object") {
1611
+ dataset.typed = true;
1612
+ dataset.value = {};
1613
+ for (const key in this.entries) {
1614
+ const value2 = input[key];
1615
+ const valueDataset = this.entries[key]._run({
1616
+ typed: false,
1617
+ value: value2
1618
+ }, config2);
1619
+ if (valueDataset.issues) {
1620
+ const pathItem = {
1621
+ type: "object",
1622
+ origin: "value",
1623
+ input,
1624
+ key,
1625
+ value: value2
1626
+ };
1627
+ for (const issue of valueDataset.issues) {
1628
+ if (issue.path) issue.path.unshift(pathItem);
1629
+ else issue.path = [pathItem];
1630
+ dataset.issues?.push(issue);
1631
+ }
1632
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1633
+ if (config2.abortEarly) {
1634
+ dataset.typed = false;
1635
+ break;
1636
+ }
1637
+ }
1638
+ if (!valueDataset.typed) dataset.typed = false;
1639
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1640
+ }
1641
+ if (!dataset.issues || !config2.abortEarly) {
1642
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1643
+ }
1644
+ } else _addIssue(this, "type", dataset, config2);
1645
+ return dataset;
1646
+ }
1647
+ };
1648
+ }
1598
1649
  function number(message) {
1599
1650
  return {
1600
1651
  kind: "schema",
@@ -2132,6 +2183,18 @@ settingsMigratorInternal.createMigrations({
2132
2183
  })
2133
2184
  ]
2134
2185
  });
2186
+ const connectionsMigratorInternal = createMigrator();
2187
+ const defaultConnections = connectionsMigratorInternal.createDefault({
2188
+ version: "1.0.0",
2189
+ connections: []
2190
+ });
2191
+ connectionsMigratorInternal.createMigrations({
2192
+ defaultValue: defaultConnections,
2193
+ migrations: [createMigration({
2194
+ version: "1.0.0",
2195
+ up: finalVersion
2196
+ })]
2197
+ });
2135
2198
  const fileRepoMigratorInternal = createMigrator();
2136
2199
  const defaultFileRepo = fileRepoMigratorInternal.createDefault({
2137
2200
  version: "2.0.0",
@@ -2293,11 +2356,51 @@ const LEGACY_ID_MAP = {
2293
2356
  };
2294
2357
  const getStrictPluginId = (pluginId) => {
2295
2358
  if (!pluginId) return pluginId;
2296
- if (LEGACY_ID_MAP[pluginId]) return LEGACY_ID_MAP[pluginId];
2297
- if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
2298
- const prefixed = `@pipelab/plugin-${pluginId}`;
2299
- return LEGACY_ID_MAP[prefixed] || prefixed;
2359
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2300
2360
  };
2361
+ //#endregion
2362
+ //#region ../../packages/shared/src/save-location.ts
2363
+ const SaveLocationInternalValidator = object({
2364
+ id: string(),
2365
+ project: string(),
2366
+ lastModified: string(),
2367
+ type: literal("internal"),
2368
+ configName: string()
2369
+ });
2370
+ const SaveLocationValidator = union([
2371
+ object({
2372
+ id: string(),
2373
+ project: string(),
2374
+ path: string(),
2375
+ lastModified: string(),
2376
+ type: literal("external"),
2377
+ summary: object({
2378
+ plugins: array(string()),
2379
+ name: string(),
2380
+ description: string()
2381
+ })
2382
+ }),
2383
+ SaveLocationInternalValidator,
2384
+ object({
2385
+ id: string(),
2386
+ project: string(),
2387
+ type: literal("pipelab-cloud")
2388
+ })
2389
+ ]);
2390
+ object({
2391
+ version: literal("1.0.0"),
2392
+ data: optional(record(string(), SaveLocationValidator), {})
2393
+ });
2394
+ const FileRepoProjectValidatorV2$1 = object({
2395
+ id: string(),
2396
+ name: string(),
2397
+ description: string()
2398
+ });
2399
+ object({
2400
+ version: literal("2.0.0"),
2401
+ projects: array(FileRepoProjectValidatorV2$1),
2402
+ pipelines: optional(array(SaveLocationValidator), [])
2403
+ });
2301
2404
  object({
2302
2405
  cacheFolder: string(),
2303
2406
  theme: union([literal("light"), literal("dark")]),
@@ -2449,6 +2552,17 @@ object({
2449
2552
  })),
2450
2553
  isInternalMigrationBannerClosed: optional(boolean(), false)
2451
2554
  });
2555
+ const ConnectionValidator = looseObject({
2556
+ id: string(),
2557
+ pluginName: string(),
2558
+ name: string(),
2559
+ createdAt: string(),
2560
+ isDefault: boolean()
2561
+ });
2562
+ object({
2563
+ version: literal("1.0.0"),
2564
+ connections: array(ConnectionValidator)
2565
+ });
2452
2566
  //#endregion
2453
2567
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
2454
2568
  const prettyLogStyles = {
@@ -2969,7 +3083,7 @@ const useLogger = () => {
2969
3083
  const OriginValidator = object({
2970
3084
  pluginId: string(),
2971
3085
  nodeId: string(),
2972
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
3086
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
2973
3087
  });
2974
3088
  const BlockActionValidatorV1 = object({
2975
3089
  type: literal("action"),
@@ -2982,7 +3096,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
2982
3096
  const BlockActionValidatorV3 = object({
2983
3097
  type: literal("action"),
2984
3098
  uid: string(),
2985
- name: pipe(optional(string()), description("A custom name provided by the user")),
3099
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
2986
3100
  disabled: optional(boolean()),
2987
3101
  params: record(string(), object({
2988
3102
  editor: EditorParamValidatorV3,
@@ -45312,35 +45426,6 @@ const createBooleanParam = (value, definition) => {
45312
45426
  };
45313
45427
  };
45314
45428
  //#endregion
45315
- //#region ../../packages/shared/src/save-location.ts
45316
- const SaveLocationInternalValidator = object({
45317
- id: string(),
45318
- project: string(),
45319
- lastModified: string(),
45320
- type: literal("internal"),
45321
- configName: string()
45322
- });
45323
- const SaveLocationValidator = union([
45324
- object({
45325
- id: string(),
45326
- project: string(),
45327
- path: string(),
45328
- lastModified: string(),
45329
- type: literal("external"),
45330
- summary: object({
45331
- plugins: array(string()),
45332
- name: string(),
45333
- description: string()
45334
- })
45335
- }),
45336
- SaveLocationInternalValidator,
45337
- object({
45338
- id: string(),
45339
- project: string(),
45340
- type: literal("pipelab-cloud")
45341
- })
45342
- ]);
45343
- //#endregion
45344
45429
  //#region ../../packages/shared/src/websocket.types.ts
45345
45430
  var WebSocketError = class extends Error {
45346
45431
  constructor(message, code, requestId) {
@@ -45357,20 +45442,6 @@ object({
45357
45442
  version: literal("1.0.0"),
45358
45443
  data: optional(record(string(), SaveLocationValidator), {})
45359
45444
  });
45360
- const FileRepoProjectValidatorV2$1 = object({
45361
- id: string(),
45362
- name: string(),
45363
- description: string()
45364
- });
45365
- object({
45366
- version: literal("2.0.0"),
45367
- projects: array(FileRepoProjectValidatorV2$1),
45368
- pipelines: optional(array(SaveLocationValidator), [])
45369
- });
45370
- object({
45371
- version: literal("1.0.0"),
45372
- data: optional(record(string(), SaveLocationValidator), {})
45373
- });
45374
45445
  const FileRepoProjectValidatorV2 = object({
45375
45446
  id: string(),
45376
45447
  name: string(),
@@ -45390,9 +45461,42 @@ var init_esm_shims = __esmMin((() => {
45390
45461
  __dirname = /* @__PURE__ */ getDirname();
45391
45462
  }));
45392
45463
  //#endregion
45393
- //#region ../../packages/core-node/src/context.ts
45464
+ //#region ../../packages/constants/src/index.ts
45394
45465
  init_esm_shims();
45395
- const _dirname = typeof __dirname !== "undefined" ? __dirname : typeof import.meta !== "undefined" && import.meta.url ? dirname(fileURLToPath(import.meta.url)) : process.cwd();
45466
+ const outFolderName = (binName, platform, arch) => {
45467
+ let platformName = "";
45468
+ let archName = "";
45469
+ console.log("platform", platform);
45470
+ if (platform === "linux") platformName = "linux";
45471
+ else if (platform === "win32") platformName = "win32";
45472
+ else if (platform === "darwin") platformName = "darwin";
45473
+ else throw new Error("Unsupported platform");
45474
+ if (arch === "x64") archName = "x64";
45475
+ else if (arch === "arm") archName = "arm";
45476
+ else if (arch === "arm64") archName = "arm64";
45477
+ else if (arch === "ia32") archName = "ia32";
45478
+ else throw new Error("Unsupported architecture");
45479
+ return `${binName}-${platformName}-${archName}`;
45480
+ };
45481
+ /**
45482
+ * Get the binary name for a given platform
45483
+ * @param name
45484
+ * @param platform If not provided, it will try to use process.platform (Node.js only)
45485
+ * @returns
45486
+ */
45487
+ const getBinName = (name, platform) => {
45488
+ const p = platform || (typeof process !== "undefined" ? process.platform : "unknown");
45489
+ if (p === "win32") return `${name}.exe`;
45490
+ if (p === "darwin") return `${name}.app/Contents/MacOS/${name}`;
45491
+ return name;
45492
+ };
45493
+ const websocketPort = 33753;
45494
+ const DEFAULT_NODE_VERSION = "24.14.1";
45495
+ const DEFAULT_PNPM_VERSION = "10.12.0";
45496
+ //#endregion
45497
+ //#region ../../packages/core-node/src/context.ts
45498
+ const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
45499
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
45396
45500
  const isDev = process.env.NODE_ENV === "development";
45397
45501
  /**
45398
45502
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
@@ -48964,36 +49068,6 @@ const useAPI = () => {
48964
49068
  };
48965
49069
  };
48966
49070
  //#endregion
48967
- //#region ../../packages/constants/src/index.ts
48968
- const outFolderName = (binName, platform, arch) => {
48969
- let platformName = "";
48970
- let archName = "";
48971
- console.log("platform", platform);
48972
- if (platform === "linux") platformName = "linux";
48973
- else if (platform === "win32") platformName = "win32";
48974
- else if (platform === "darwin") platformName = "darwin";
48975
- else throw new Error("Unsupported platform");
48976
- if (arch === "x64") archName = "x64";
48977
- else if (arch === "arm") archName = "arm";
48978
- else if (arch === "arm64") archName = "arm64";
48979
- else if (arch === "ia32") archName = "ia32";
48980
- else throw new Error("Unsupported architecture");
48981
- return `${binName}-${platformName}-${archName}`;
48982
- };
48983
- /**
48984
- * Get the binary name for a given platform
48985
- * @param name
48986
- * @param platform If not provided, it will try to use process.platform (Node.js only)
48987
- * @returns
48988
- */
48989
- const getBinName = (name, platform) => {
48990
- const p = platform || (typeof process !== "undefined" ? process.platform : "unknown");
48991
- if (p === "win32") return `${name}.exe`;
48992
- if (p === "darwin") return `${name}.app/Contents/MacOS/${name}`;
48993
- return name;
48994
- };
48995
- const websocketPort = 33753;
48996
- //#endregion
48997
49071
  //#region ../../packages/core-node/src/websocket-server.ts
48998
49072
  var WebSocketServer = class {
48999
49073
  wss = null;
@@ -89398,14 +89472,6 @@ var import_tar = /* @__PURE__ */ __toESM(require_tar$1(), 1);
89398
89472
  var import_yauzl = /* @__PURE__ */ __toESM(require_yauzl(), 1);
89399
89473
  require_archiver();
89400
89474
  /**
89401
- * Generates a unique temporary folder.
89402
- */
89403
- const generateTempFolder$1 = async (base) => {
89404
- const targetBase = base || tmpdir();
89405
- await mkdir(targetBase, { recursive: true });
89406
- return await mkdtemp(join(await realpath(targetBase), "pipelab-"));
89407
- };
89408
- /**
89409
89475
  * Extracts a .tar.gz archive.
89410
89476
  */
89411
89477
  async function extractTarGz(archivePath, destinationDir) {
@@ -100986,11 +101052,11 @@ var require_cp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100986
101052
  var require_with_temp_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100987
101053
  const { join: join$5, sep: sep$1 } = __require("path");
100988
101054
  const getOptions = require_get_options();
100989
- const { mkdir: mkdir$4, mkdtemp: mkdtemp$1, rm: rm$5 } = __require("fs/promises");
101055
+ const { mkdir: mkdir$4, mkdtemp, rm: rm$5 } = __require("fs/promises");
100990
101056
  const withTempDir = async (root, fn, opts) => {
100991
101057
  const options = getOptions(opts, { copy: ["tmpPrefix"] });
100992
101058
  await mkdir$4(root, { recursive: true });
100993
- const target = await mkdtemp$1(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
101059
+ const target = await mkdtemp(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
100994
101060
  let err;
100995
101061
  let result;
100996
101062
  try {
@@ -110589,9 +110655,9 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110589
110655
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110590
110656
  var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110591
110657
  const { resolve: resolve$6 } = __require("node:path");
110592
- const { tmpdir: tmpdir$1, homedir } = __require("node:os");
110658
+ const { tmpdir, homedir } = __require("node:os");
110593
110659
  module.exports = (fakePlatform = false) => {
110594
- const temp = tmpdir$1();
110660
+ const temp = tmpdir();
110595
110661
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110596
110662
  const home = homedir() || resolve$6(temp, "npm-" + uidOrPid);
110597
110663
  const platform = fakePlatform || process.platform;
@@ -123842,7 +123908,7 @@ var require_auth = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123842
123908
  //#endregion
123843
123909
  //#region ../../node_modules/make-fetch-happen/lib/options.js
123844
123910
  var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123845
- const dns$2 = __require("dns");
123911
+ const dns$3 = __require("dns");
123846
123912
  const conditionalHeaders = [
123847
123913
  "if-modified-since",
123848
123914
  "if-none-match",
@@ -123867,7 +123933,7 @@ var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123867
123933
  };
123868
123934
  options.dns = {
123869
123935
  ttl: 300 * 1e3,
123870
- lookup: dns$2.lookup,
123936
+ lookup: dns$3.lookup,
123871
123937
  ...options.dns
123872
123938
  };
123873
123939
  options.cache = options.cache || "default";
@@ -125284,9 +125350,9 @@ var require_key$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
125284
125350
  //#region ../../node_modules/@npmcli/agent/lib/dns.js
125285
125351
  var require_dns = /* @__PURE__ */ __commonJSMin(((exports, module) => {
125286
125352
  const { LRUCache } = require_index_min$5();
125287
- const dns$1 = __require("dns");
125353
+ const dns$2 = __require("dns");
125288
125354
  const cache = new LRUCache({ max: 50 });
125289
- const getOptions = ({ family = 0, hints = dns$1.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$1.lookup }) => ({
125355
+ const getOptions = ({ family = 0, hints = dns$2.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$2.lookup }) => ({
125290
125356
  hints,
125291
125357
  lookup: (hostname, ...args) => {
125292
125358
  const callback = args.pop();
@@ -130325,7 +130391,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
130325
130391
  const socks_1 = require_build$1();
130326
130392
  const agent_base_1 = require_dist$12();
130327
130393
  const debug_1 = __importDefault(require_src$1());
130328
- const dns = __importStar(__require("dns"));
130394
+ const dns$1 = __importStar(__require("dns"));
130329
130395
  const net$1 = __importStar(__require("net"));
130330
130396
  const tls$1 = __importStar(__require("tls"));
130331
130397
  const url_1$1 = __require("url");
@@ -130397,7 +130463,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
130397
130463
  const { shouldLookup, proxy, timeout } = this;
130398
130464
  if (!opts.host) throw new Error("No `host` defined!");
130399
130465
  let { host } = opts;
130400
- const { port, lookup: lookupFn = dns.lookup } = opts;
130466
+ const { port, lookup: lookupFn = dns$1.lookup } = opts;
130401
130467
  if (shouldLookup) host = await new Promise((resolve, reject) => {
130402
130468
  lookupFn(host, {}, (err, res) => {
130403
130469
  if (err) reject(err);
@@ -150664,7 +150730,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150664
150730
  const { promisify: promisify$1 } = __require("util");
150665
150731
  const path$1 = __require("path");
150666
150732
  const { createHash } = __require("crypto");
150667
- const { realpath: realpath$1, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150733
+ const { realpath, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150668
150734
  const url = __require("url");
150669
150735
  const slasher = require_glob_slash();
150670
150736
  const minimatch = require_minimatch();
@@ -150987,7 +151053,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150987
151053
  };
150988
151054
  const getHandlers = (methods) => Object.assign({
150989
151055
  lstat: promisify$1(lstat),
150990
- realpath: promisify$1(realpath$1),
151056
+ realpath: promisify$1(realpath),
150991
151057
  createReadStream: createReadStream$1,
150992
151058
  readdir: promisify$1(readdir$1),
150993
151059
  sendError
@@ -151126,8 +151192,6 @@ const sendStartupProgress = (message) => {
151126
151192
  };
151127
151193
  //#endregion
151128
151194
  //#region ../../packages/core-node/src/utils/remote.ts
151129
- const DEFAULT_NODE_VERSION = "24.14.1";
151130
- const DEFAULT_PNPM_VERSION = "10.12.0";
151131
151195
  function isPackageComplete(packageDir) {
151132
151196
  return existsSync(join(packageDir, "package.json"));
151133
151197
  }
@@ -151168,6 +151232,20 @@ async function withLock(key, fn) {
151168
151232
  activeOperations.set(key, promise);
151169
151233
  return promise;
151170
151234
  }
151235
+ let isOnlineCached = null;
151236
+ let lastCheckTime = 0;
151237
+ async function isOnline() {
151238
+ const now = Date.now();
151239
+ if (isOnlineCached !== null && now - lastCheckTime < 1e4) return isOnlineCached;
151240
+ try {
151241
+ await Promise.race([dns.lookup("registry.npmjs.org"), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("timeout")), 1500))]);
151242
+ isOnlineCached = true;
151243
+ } catch {
151244
+ isOnlineCached = false;
151245
+ }
151246
+ lastCheckTime = now;
151247
+ return isOnlineCached;
151248
+ }
151171
151249
  /**
151172
151250
  * Robust utility to fetch, cache, and resolve an NPM package.
151173
151251
  * Centralized in core-node to avoid circular dependencies.
@@ -151194,7 +151272,15 @@ async function fetchPackage(packageName, versionOrRange, options) {
151194
151272
  if (resolvedVersionOrRange === "local") resolvedVersionOrRange = "latest";
151195
151273
  console.log(`[Fetcher] Resolving ${packageName}@${resolvedVersionOrRange || "latest"}...`);
151196
151274
  const resolveStart = Date.now();
151197
- try {
151275
+ if (!await isOnline()) {
151276
+ console.warn(`[Fetcher] ${packageName}: offline mode detected (${Date.now() - resolveStart}ms), trying local fallback...`);
151277
+ const fallbackStart = Date.now();
151278
+ const fallbackVersion = await tryLocalFallback(resolvedVersionOrRange, /* @__PURE__ */ new Error("Offline"), baseDir, packageName);
151279
+ if (fallbackVersion) {
151280
+ resolvedVersion = fallbackVersion;
151281
+ console.log(`[Fetcher] ${packageName}: Resolved to local fallback ${resolvedVersion} (${Date.now() - fallbackStart}ms)`);
151282
+ } else throw new Error(`Offline and no local fallback version available for ${packageName}`);
151283
+ } else try {
151198
151284
  const cachePath = join(ctx.userDataPath, "cache", "pacote");
151199
151285
  let packumentPromise = packumentRequests.get(packageName);
151200
151286
  if (!packumentPromise) {
@@ -151204,7 +151290,16 @@ async function fetchPackage(packageName, versionOrRange, options) {
151204
151290
  const packument = await packumentPromise;
151205
151291
  const versions = Object.keys(packument.versions);
151206
151292
  const range = resolvedVersionOrRange || "latest";
151207
- const foundVersion = packument["dist-tags"]?.[range] || import_semver$1.default.maxSatisfying(versions, range);
151293
+ let foundVersion = packument["dist-tags"]?.[range] || import_semver$1.default.maxSatisfying(versions, range);
151294
+ if (range === "latest" && ctx.releaseTag && ctx.releaseTag !== "latest") {
151295
+ const releaseTagVersion = packument["dist-tags"]?.[ctx.releaseTag];
151296
+ if (releaseTagVersion && import_semver$1.default.valid(releaseTagVersion)) {
151297
+ if (!foundVersion || import_semver$1.default.valid(foundVersion) && import_semver$1.default.gte(releaseTagVersion, foundVersion)) {
151298
+ console.log(`[Fetcher] Using release tag "${ctx.releaseTag}" (${releaseTagVersion}) instead of "latest" (${foundVersion || "none"}) for ${packageName}`);
151299
+ foundVersion = releaseTagVersion;
151300
+ } else if (foundVersion) console.warn(`[Fetcher] Tag "${ctx.releaseTag}" (${releaseTagVersion}) is older than "latest" (${foundVersion}) for ${packageName}, keeping "latest"`);
151301
+ }
151302
+ }
151208
151303
  if (!foundVersion) throw new Error(`Package ${packageName}@${range} not found on npm (available tags: ${Object.keys(packument["dist-tags"] || {}).join(", ")})`);
151209
151304
  resolvedVersion = foundVersion;
151210
151305
  console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm (${Date.now() - resolveStart}ms)`);
@@ -151319,7 +151414,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
151319
151414
  const extension = isWindows ? "zip" : "tar.gz";
151320
151415
  const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
151321
151416
  const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
151322
- const tempDir = await generateTempFolder$1(tmpdir());
151417
+ const tempDir = await context.createTempFolder("node-download-");
151323
151418
  const archivePath = join(tempDir, fileName);
151324
151419
  sendStartupProgress(`Downloading Node.js v${version}...`);
151325
151420
  console.log(`Downloading Node.js from ${downloadUrl}...`);
@@ -151554,15 +151649,6 @@ if (isDev && projectRoot) {
151554
151649
  //#region ../plugin-core/src/pipelab.ts
151555
151650
  const createActionRunner = (runner) => runner;
151556
151651
  //#endregion
151557
- //#region ../plugin-core/src/fs-utils.ts
151558
- const generateTempFolder = async (base) => {
151559
- const targetBase = base || tmpdir();
151560
- await mkdir(targetBase, { recursive: true });
151561
- const realPath = await realpath(targetBase);
151562
- console.log("join", join(realPath, "pipelab-"));
151563
- return await mkdtemp(join(realPath, "pipelab-"));
151564
- };
151565
- //#endregion
151566
151652
  //#region ../plugin-core/src/node-utils.ts
151567
151653
  const fileExists = async (path) => {
151568
151654
  try {
@@ -152090,7 +152176,7 @@ const forge = async (action, appFolder, { cwd, log, inputs, setOutput, paths, ab
152090
152176
  log("Building electron");
152091
152177
  if (action !== "preview") await detectRuntime(appFolder);
152092
152178
  const { modules, node } = paths;
152093
- const destinationFolder = await generateTempFolder(paths.cache);
152179
+ const destinationFolder = await context.createTempFolder("electron-forge-");
152094
152180
  log(`Staging build in ${destinationFolder}`);
152095
152181
  try {
152096
152182
  const forge = join(destinationFolder, "node_modules", "@electron-forge", "cli", "dist", "electron-forge.js");