@pipelab/plugin-electron 1.0.0-beta.23 → 1.0.0-beta.27

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
@@ -2,9 +2,9 @@ import { a as __require, i as __reExport, n as __esmMin, o as __toESM, r as __ex
2
2
  import { hostname } from "os";
3
3
  import { normalize } from "path";
4
4
  import { formatWithOptions, types } from "util";
5
- import path, { basename, delimiter, dirname, join } from "node:path";
5
+ import path, { basename, delimiter, dirname, join, resolve } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
- import { arch, constants, platform } from "node:os";
7
+ import { arch, constants, homedir, platform } from "node:os";
8
8
  import { appendFileSync, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
9
9
  import { access, chmod, cp, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
10
10
  import http from "node:http";
@@ -45450,6 +45450,17 @@ const DEFAULT_PNPM_VERSION = "10.12.0";
45450
45450
  const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
45451
45451
  const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
45452
45452
  const isDev = process.env.NODE_ENV === "development";
45453
+ const getDefaultUserDataPath = (env) => {
45454
+ const base = (() => {
45455
+ switch (platform()) {
45456
+ case "win32": return process.env.APPDATA || join(homedir(), "AppData", "Roaming");
45457
+ case "darwin": return join(homedir(), "Library", "Application Support");
45458
+ default: return process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
45459
+ }
45460
+ })();
45461
+ const mode = env ?? (isDev ? "dev" : "prod");
45462
+ return join(base, "@pipelab", mode === "dev" ? "app-dev" : mode === "beta" ? "app-beta" : "app");
45463
+ };
45453
45464
  /**
45454
45465
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
45455
45466
  */
@@ -49216,6 +49227,71 @@ var WebSocketServer = class {
49216
49227
  };
49217
49228
  const webSocketServer = new WebSocketServer();
49218
49229
  //#endregion
49230
+ //#region ../../packages/core-node/src/fs-utils.ts
49231
+ var import_slash = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
49232
+ module.exports = (path) => {
49233
+ const isExtendedLengthPath = /^\\\\\?\\/.test(path);
49234
+ const hasNonAscii = /[^\u0000-\u0080]+/.test(path);
49235
+ if (isExtendedLengthPath || hasNonAscii) return path;
49236
+ return path.replace(/\\/g, "/");
49237
+ };
49238
+ })))(), 1);
49239
+ function removeTrailingSlash(path) {
49240
+ return path.replace(/[\\/]+$/, "");
49241
+ }
49242
+ removeTrailingSlash((0, import_slash.default)(resolve(homedir()))).toLowerCase();
49243
+ const additionalProtectedPaths = [
49244
+ getDefaultUserDataPath("dev"),
49245
+ getDefaultUserDataPath("beta"),
49246
+ getDefaultUserDataPath("prod"),
49247
+ projectRoot,
49248
+ process.cwd(),
49249
+ "/tmp",
49250
+ "/var/tmp",
49251
+ process.env.TEMP,
49252
+ process.env.TMP,
49253
+ join(homedir(), "AppData"),
49254
+ join(homedir(), "AppData", "Local"),
49255
+ join(homedir(), "AppData", "Roaming"),
49256
+ join(homedir(), "Library"),
49257
+ join(homedir(), "Library", "Application Support"),
49258
+ join(homedir(), ".config"),
49259
+ join(homedir(), ".local"),
49260
+ join(homedir(), ".local", "share"),
49261
+ join(homedir(), ".cache"),
49262
+ join(homedir(), "OneDrive"),
49263
+ join(homedir(), "Dropbox"),
49264
+ join(homedir(), ".ssh"),
49265
+ join(homedir(), ".gnupg"),
49266
+ join(homedir(), ".aws"),
49267
+ join(homedir(), ".docker"),
49268
+ join(homedir(), ".kube"),
49269
+ join(homedir(), ".vscode"),
49270
+ join(homedir(), ".vscode-insiders"),
49271
+ join(homedir(), ".cursor"),
49272
+ join(homedir(), ".npm"),
49273
+ join(homedir(), ".pnpm-state"),
49274
+ join(homedir(), ".yarn"),
49275
+ join(homedir(), ".cargo"),
49276
+ join(homedir(), ".rustup"),
49277
+ join(homedir(), ".m2"),
49278
+ join(homedir(), ".gradle")
49279
+ ].filter((p) => typeof p === "string" && p.length > 0);
49280
+ new Set([
49281
+ join(homedir(), "Downloads"),
49282
+ join(homedir(), "Documents"),
49283
+ join(homedir(), "Desktop"),
49284
+ join(homedir(), "Pictures"),
49285
+ join(homedir(), "Music"),
49286
+ join(homedir(), "Videos"),
49287
+ join(homedir(), "Saved Games"),
49288
+ join(homedir(), "Contacts"),
49289
+ join(homedir(), "Searches"),
49290
+ join(homedir(), "Links"),
49291
+ join(homedir(), "3D Objects"),
49292
+ ...additionalProtectedPaths
49293
+ ].map((p) => removeTrailingSlash((0, import_slash.default)(resolve(p))).toLowerCase()));
49294
+ //#endregion
49219
49295
  //#region ../../node_modules/is-plain-obj/index.js
49220
49296
  function isPlainObject(value) {
49221
49297
  if (typeof value !== "object" || value === null) return false;
@@ -59606,13 +59682,13 @@ var require_opts_arg = /* @__PURE__ */ __commonJSMin(((exports, module) => {
59606
59682
  //#region ../../node_modules/mkdirp/lib/path-arg.js
59607
59683
  var require_path_arg = /* @__PURE__ */ __commonJSMin(((exports, module) => {
59608
59684
  const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform;
59609
- const { resolve: resolve$12, parse: parse$2 } = __require("path");
59685
+ const { resolve: resolve$13, parse: parse$2 } = __require("path");
59610
59686
  const pathArg = (path) => {
59611
59687
  if (/\0/.test(path)) throw Object.assign(/* @__PURE__ */ new TypeError("path must be a string without null bytes"), {
59612
59688
  path,
59613
59689
  code: "ERR_INVALID_ARG_VALUE"
59614
59690
  });
59615
- path = resolve$12(path);
59691
+ path = resolve$13(path);
59616
59692
  if (platform === "win32") {
59617
59693
  const badWinChars = /[*|"<>?:]/;
59618
59694
  const { root } = parse$2(path);
@@ -62657,7 +62733,7 @@ var require_readdir_glob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
62657
62733
  const fs$19 = __require("fs");
62658
62734
  const { EventEmitter: EventEmitter$1 } = __require("events");
62659
62735
  const { Minimatch } = require_minimatch$1();
62660
- const { resolve: resolve$11 } = __require("path");
62736
+ const { resolve: resolve$12 } = __require("path");
62661
62737
  function readdir(dir, strict) {
62662
62738
  return new Promise((resolve, reject) => {
62663
62739
  fs$19.readdir(dir, { withFileTypes: true }, (err, files) => {
@@ -62766,7 +62842,7 @@ var require_readdir_glob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
62766
62842
  if (this.options.ignore) this.ignoreMatchers = (Array.isArray(this.options.ignore) ? this.options.ignore : [this.options.ignore]).map((ignore) => new Minimatch(ignore, { dot: true }));
62767
62843
  this.skipMatchers = [];
62768
62844
  if (this.options.skip) this.skipMatchers = (Array.isArray(this.options.skip) ? this.options.skip : [this.options.skip]).map((skip) => new Minimatch(skip, { dot: true }));
62769
- this.iterator = explore(resolve$11(cwd || "."), this.options.follow, this.options.stat, this._shouldSkipDirectory.bind(this));
62845
+ this.iterator = explore(resolve$12(cwd || "."), this.options.follow, this.options.stat, this._shouldSkipDirectory.bind(this));
62770
62846
  this.paused = false;
62771
62847
  this.inactive = false;
62772
62848
  this.aborted = false;
@@ -98110,7 +98186,7 @@ var require_npa = /* @__PURE__ */ __commonJSMin(((exports, module) => {
98110
98186
  const isWindows = process.platform === "win32";
98111
98187
  const { URL: URL$6 } = __require("node:url");
98112
98188
  const path$17 = isWindows ? __require("node:path/win32") : __require("node:path");
98113
- const { homedir: homedir$1 } = __require("node:os");
98189
+ const { homedir: homedir$2 } = __require("node:os");
98114
98190
  const HostedGit = require_lib$28();
98115
98191
  const semver = require_semver$2();
98116
98192
  const validatePackageName = require_lib$23();
@@ -98315,7 +98391,7 @@ var require_npa = /* @__PURE__ */ __commonJSMin(((exports, module) => {
98315
98391
  }
98316
98392
  if (/^\/~(\/|$)/.test(specPath)) {
98317
98393
  res.saveSpec = `file:${specPath.substr(1)}`;
98318
- resolvedPath = path$17.resolve(homedir$1(), specPath.substr(3));
98394
+ resolvedPath = path$17.resolve(homedir$2(), specPath.substr(3));
98319
98395
  } else if (!path$17.isAbsolute(rawSpec.slice(5))) res.saveSpec = `file:${path$17.relative(where, resolvedPath)}`;
98320
98396
  else res.saveSpec = `file:${path$17.resolve(resolvedPath)}`;
98321
98397
  res.fetchSpec = path$17.resolve(where, resolvedPath);
@@ -99462,7 +99538,7 @@ var require_sort$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99462
99538
  //#region ../../node_modules/@npmcli/package-json/lib/index.js
99463
99539
  var require_lib$18 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99464
99540
  const { readFile: readFile$5, writeFile: writeFile$3 } = __require("node:fs/promises");
99465
- const { resolve: resolve$10 } = __require("node:path");
99541
+ const { resolve: resolve$11 } = __require("node:path");
99466
99542
  const parseJSON = require_lib$30();
99467
99543
  const updateDeps = require_update_dependencies();
99468
99544
  const updateScripts = require_update_scripts();
@@ -99565,7 +99641,7 @@ var require_lib$18 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99565
99641
  parseErr = err;
99566
99642
  }
99567
99643
  if (parseErr) {
99568
- const indexFile = resolve$10(this.path, "index.js");
99644
+ const indexFile = resolve$11(this.path, "index.js");
99569
99645
  let indexFileContent;
99570
99646
  try {
99571
99647
  indexFileContent = await readFile$5(indexFile, "utf8");
@@ -99610,7 +99686,7 @@ var require_lib$18 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99610
99686
  return this.#path;
99611
99687
  }
99612
99688
  get filename() {
99613
- if (this.path) return resolve$10(this.path, "package.json");
99689
+ if (this.path) return resolve$11(this.path, "package.json");
99614
99690
  }
99615
99691
  create(path) {
99616
99692
  this.#path = path;
@@ -100733,7 +100809,7 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100733
100809
  const { ERR_FS_CP_DIR_TO_NON_DIR, ERR_FS_CP_EEXIST, ERR_FS_CP_EINVAL, ERR_FS_CP_FIFO_PIPE, ERR_FS_CP_NON_DIR_TO_DIR, ERR_FS_CP_SOCKET, ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY, ERR_FS_CP_UNKNOWN, ERR_FS_EISDIR, ERR_INVALID_ARG_TYPE } = require_errors$3();
100734
100810
  const { constants: { errno: { EEXIST, EISDIR, EINVAL, ENOTDIR } } } = __require("os");
100735
100811
  const { chmod: chmod$2, copyFile, lstat: lstat$2, mkdir: mkdir$5, readdir: readdir$5, readlink, stat: stat$4, symlink, unlink, utimes } = __require("fs/promises");
100736
- const { dirname: dirname$6, isAbsolute: isAbsolute$1, join: join$6, parse, resolve: resolve$9, sep: sep$2, toNamespacedPath } = __require("path");
100812
+ const { dirname: dirname$6, isAbsolute: isAbsolute$1, join: join$6, parse, resolve: resolve$10, sep: sep$2, toNamespacedPath } = __require("path");
100737
100813
  const { fileURLToPath: fileURLToPath$1 } = __require("url");
100738
100814
  const defaultOptions = {
100739
100815
  dereference: false,
@@ -100820,8 +100896,8 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100820
100896
  );
100821
100897
  }
100822
100898
  async function checkParentPaths(src, srcStat, dest) {
100823
- const srcParent = resolve$9(dirname$6(src));
100824
- const destParent = resolve$9(dirname$6(dest));
100899
+ const srcParent = resolve$10(dirname$6(src));
100900
+ const destParent = resolve$10(dirname$6(dest));
100825
100901
  if (destParent === srcParent || destParent === parse(destParent).root) return;
100826
100902
  let destStat;
100827
100903
  try {
@@ -100840,7 +100916,7 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100840
100916
  });
100841
100917
  return checkParentPaths(src, srcStat, destParent);
100842
100918
  }
100843
- const normalizePathToArray = (path) => resolve$9(path).split(sep$2).filter(Boolean);
100919
+ const normalizePathToArray = (path) => resolve$10(path).split(sep$2).filter(Boolean);
100844
100920
  function isSrcSubdir(src, dest) {
100845
100921
  const srcArr = normalizePathToArray(src);
100846
100922
  const destArr = normalizePathToArray(dest);
@@ -100950,7 +101026,7 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100950
101026
  }
100951
101027
  async function onLink(destStat, src, dest) {
100952
101028
  let resolvedSrc = await readlink(src);
100953
- if (!isAbsolute$1(resolvedSrc)) resolvedSrc = resolve$9(dirname$6(src), resolvedSrc);
101029
+ if (!isAbsolute$1(resolvedSrc)) resolvedSrc = resolve$10(dirname$6(src), resolvedSrc);
100954
101030
  if (!destStat) return symlink(resolvedSrc, dest);
100955
101031
  let resolvedDest;
100956
101032
  try {
@@ -100961,7 +101037,7 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100961
101037
  // istanbul ignore next: should not be possible
100962
101038
  throw err;
100963
101039
  }
100964
- if (!isAbsolute$1(resolvedDest)) resolvedDest = resolve$9(dirname$6(dest), resolvedDest);
101040
+ if (!isAbsolute$1(resolvedDest)) resolvedDest = resolve$10(dirname$6(dest), resolvedDest);
100965
101041
  if (isSrcSubdir(resolvedSrc, resolvedDest)) throw new ERR_FS_CP_EINVAL({
100966
101042
  message: `cannot copy ${resolvedSrc} to a subdirectory of self ${resolvedDest}`,
100967
101043
  path: dest,
@@ -101048,7 +101124,7 @@ var require_readdir_scoped = /* @__PURE__ */ __commonJSMin(((exports, module) =>
101048
101124
  //#endregion
101049
101125
  //#region ../../node_modules/cacache/node_modules/@npmcli/fs/lib/move-file.js
101050
101126
  var require_move_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101051
- const { dirname: dirname$5, join: join$3, resolve: resolve$8, relative: relative$1, isAbsolute } = __require("path");
101127
+ const { dirname: dirname$5, join: join$3, resolve: resolve$9, relative: relative$1, isAbsolute } = __require("path");
101052
101128
  const fs$11 = __require("fs/promises");
101053
101129
  const pathExists = async (path) => {
101054
101130
  try {
@@ -101084,10 +101160,10 @@ var require_move_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101084
101160
  if (root) {
101085
101161
  await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => {
101086
101162
  let target = await fs$11.readlink(symSource);
101087
- if (isAbsolute(target)) target = resolve$8(symDestination, relative$1(symSource, target));
101163
+ if (isAbsolute(target)) target = resolve$9(symDestination, relative$1(symSource, target));
101088
101164
  let targetStat = "file";
101089
101165
  try {
101090
- targetStat = await fs$11.stat(resolve$8(dirname$5(symSource), target));
101166
+ targetStat = await fs$11.stat(resolve$9(dirname$5(symSource), target));
101091
101167
  if (targetStat.isDirectory()) targetStat = "junction";
101092
101168
  } catch {}
101093
101169
  await fs$11.symlink(target, symDestination, targetStat);
@@ -106904,7 +106980,7 @@ var require_lib$12 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106904
106980
  var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106905
106981
  const bundled = require_lib$12();
106906
106982
  const { readFile: readFile$2, readdir: readdir$2, stat: stat$2 } = __require("fs/promises");
106907
- const { resolve: resolve$7, basename: basename$4, dirname: dirname$4 } = __require("path");
106983
+ const { resolve: resolve$8, basename: basename$4, dirname: dirname$4 } = __require("path");
106908
106984
  const normalizePackageBin = require_lib$21();
106909
106985
  const readPackage = ({ path, packageJsonCache }) => packageJsonCache.has(path) ? Promise.resolve(packageJsonCache.get(path)) : readFile$2(path).then((json) => {
106910
106986
  const pkg = normalizePackageBin(JSON.parse(json));
@@ -106948,7 +107024,7 @@ var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106948
107024
  const nm = /^@.+/.test(scope) ? dirname$4(dir) : dir;
106949
107025
  const binFiles = [];
106950
107026
  Object.keys(pkg.bin).forEach((b) => {
106951
- const base = resolve$7(nm, ".bin", b);
107027
+ const base = resolve$8(nm, ".bin", b);
106952
107028
  binFiles.push(base, base + ".cmd", base + ".ps1");
106953
107029
  });
106954
107030
  (await Promise.all(binFiles.map((b) => stat$2(b).then(() => b).catch(() => null)))).filter((b) => b).forEach((b) => result.add(b));
@@ -106969,7 +107045,7 @@ var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106969
107045
  }
106970
107046
  const recursePromises = [];
106971
107047
  for (const entry of dirEntries) {
106972
- const p = resolve$7(path, entry.name);
107048
+ const p = resolve$8(path, entry.name);
106973
107049
  if (entry.isDirectory() === false) {
106974
107050
  result.add(p);
106975
107051
  continue;
@@ -106988,7 +107064,7 @@ var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106988
107064
  }
106989
107065
  if (bundleDeps) recursePromises.push(...bundleDeps.map((dep) => {
106990
107066
  return pkgContents({
106991
- path: resolve$7(path, "node_modules", dep),
107067
+ path: resolve$8(path, "node_modules", dep),
106992
107068
  packageJsonCache,
106993
107069
  pkg: true,
106994
107070
  depth,
@@ -107000,7 +107076,7 @@ var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
107000
107076
  return result;
107001
107077
  };
107002
107078
  module.exports = ({ path, ...opts }) => pkgContents({
107003
- path: resolve$7(path),
107079
+ path: resolve$8(path),
107004
107080
  ...opts,
107005
107081
  pkg: true
107006
107082
  }).then((results) => [...results]);
@@ -110611,18 +110687,18 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110611
110687
  //#endregion
110612
110688
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110613
110689
  var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110614
- const { resolve: resolve$6 } = __require("node:path");
110615
- const { tmpdir, homedir } = __require("node:os");
110690
+ const { resolve: resolve$7 } = __require("node:path");
110691
+ const { tmpdir, homedir: homedir$1 } = __require("node:os");
110616
110692
  module.exports = (fakePlatform = false) => {
110617
110693
  const temp = tmpdir();
110618
110694
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110619
- const home = homedir() || resolve$6(temp, "npm-" + uidOrPid);
110695
+ const home = homedir$1() || resolve$7(temp, "npm-" + uidOrPid);
110620
110696
  const platform = fakePlatform || process.platform;
110621
110697
  const cacheExtra = platform === "win32" ? "npm-cache" : ".npm";
110622
110698
  const cacheRoot = platform === "win32" && process.env.LOCALAPPDATA || home;
110623
110699
  return {
110624
- cacache: resolve$6(cacheRoot, cacheExtra, "_cacache"),
110625
- tufcache: resolve$6(cacheRoot, cacheExtra, "_tuf")
110700
+ cacache: resolve$7(cacheRoot, cacheExtra, "_cacache"),
110701
+ tufcache: resolve$7(cacheRoot, cacheExtra, "_tuf")
110626
110702
  };
110627
110703
  };
110628
110704
  }));
@@ -112436,7 +112512,7 @@ var require_lib$10 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112436
112512
  var require_lib$9 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112437
112513
  const { Walker: IgnoreWalker } = require_lib$10();
112438
112514
  const { lstatSync: lstat$1, readFileSync: readFile$1 } = __require("fs");
112439
- const { basename: basename$3, dirname: dirname$3, extname: extname$1, join: join$2, relative, resolve: resolve$5, sep } = __require("path");
112515
+ const { basename: basename$3, dirname: dirname$3, extname: extname$1, join: join$2, relative, resolve: resolve$6, sep } = __require("path");
112440
112516
  const { log } = require_lib$29();
112441
112517
  const defaultRules = Symbol("npm-packlist.rules.default");
112442
112518
  const strictRules = Symbol("npm-packlist.rules.strict");
@@ -112487,7 +112563,7 @@ var require_lib$9 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112487
112563
  ...opts,
112488
112564
  includeEmpty: false,
112489
112565
  follow: false,
112490
- path: resolve$5(opts?.path || tree.path).replace(/\\/g, "/"),
112566
+ path: resolve$6(opts?.path || tree.path).replace(/\\/g, "/"),
112491
112567
  ignoreFiles: opts?.ignoreFiles || [
112492
112568
  defaultRules,
112493
112569
  "package.json",
@@ -112688,8 +112764,8 @@ var require_lib$9 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112688
112764
  var require_set_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112689
112765
  init_esm_shims();
112690
112766
  const { log } = require_lib$29();
112691
- const { resolve: resolve$4, dirname: dirname$2, delimiter: delimiter$1 } = __require("path");
112692
- const nodeGypPath = resolve$4(__dirname, "../lib/node-gyp-bin");
112767
+ const { resolve: resolve$5, dirname: dirname$2, delimiter: delimiter$1 } = __require("path");
112768
+ const nodeGypPath = resolve$5(__dirname, "../lib/node-gyp-bin");
112693
112769
  const setPATH = (projectPath, binPaths, env) => {
112694
112770
  const PATH = Object.keys(env).filter((p) => /^path$/i.test(p) && env[p]).map((p) => env[p].split(delimiter$1)).reduce((set, p) => set.concat(p.filter((concatted) => !set.includes(concatted))), []).join(delimiter$1);
112695
112771
  const pathArr = [];
@@ -112704,7 +112780,7 @@ var require_set_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112704
112780
  let p = projectPath;
112705
112781
  let pp;
112706
112782
  do {
112707
- pathArr.push(resolve$4(p, "node_modules", ".bin"));
112783
+ pathArr.push(resolve$5(p, "node_modules", ".bin"));
112708
112784
  pp = p;
112709
112785
  p = dirname$2(p);
112710
112786
  } while (p !== pp);
@@ -112719,7 +112795,7 @@ var require_set_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112719
112795
  //#region ../../node_modules/@npmcli/run-script/lib/make-spawn-args.js
112720
112796
  var require_make_spawn_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112721
112797
  const setPATH = require_set_path();
112722
- const { resolve: resolve$3 } = __require("path");
112798
+ const { resolve: resolve$4 } = __require("path");
112723
112799
  let npm_config_node_gyp;
112724
112800
  const makeSpawnArgs = (options) => {
112725
112801
  const { args, binPaths, cmd, env, event, nodeGyp, path, scriptShell = true, stdio, stdioString } = options;
@@ -112733,7 +112809,7 @@ var require_make_spawn_args = /* @__PURE__ */ __commonJSMin(((exports, module) =
112733
112809
  env: setPATH(path, binPaths, {
112734
112810
  ...process.env,
112735
112811
  ...env,
112736
- npm_package_json: resolve$3(path, "package.json"),
112812
+ npm_package_json: resolve$4(path, "package.json"),
112737
112813
  npm_lifecycle_event: event,
112738
112814
  npm_lifecycle_script: cmd,
112739
112815
  npm_config_node_gyp
@@ -112821,10 +112897,10 @@ var require_signal_manager = /* @__PURE__ */ __commonJSMin(((exports, module) =>
112821
112897
  //#region ../../node_modules/@npmcli/run-script/lib/is-server-package.js
112822
112898
  var require_is_server_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112823
112899
  const { stat: stat$1 } = __require("node:fs/promises");
112824
- const { resolve: resolve$2 } = __require("node:path");
112900
+ const { resolve: resolve$3 } = __require("node:path");
112825
112901
  module.exports = async (path) => {
112826
112902
  try {
112827
- return (await stat$1(resolve$2(path, "server.js"))).isFile();
112903
+ return (await stat$1(resolve$3(path, "server.js"))).isFile();
112828
112904
  } catch (er) {
112829
112905
  return false;
112830
112906
  }
@@ -112934,7 +113010,7 @@ var require_run_script = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112934
113010
  //#endregion
112935
113011
  //#region ../../node_modules/pacote/lib/file.js
112936
113012
  var require_file$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112937
- const { resolve: resolve$1 } = __require("node:path");
113013
+ const { resolve: resolve$2 } = __require("node:path");
112938
113014
  const { stat, chmod: chmod$1 } = __require("node:fs/promises");
112939
113015
  const cacache = require_lib$14();
112940
113016
  const fsm = require_lib$13();
@@ -112960,7 +113036,7 @@ var require_file$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112960
113036
  #exeBins(pkg, dest) {
112961
113037
  if (!pkg.bin) return Promise.resolve();
112962
113038
  return Promise.all(Object.keys(pkg.bin).map(async (k) => {
112963
- const script = resolve$1(dest, pkg.bin[k]);
113039
+ const script = resolve$2(dest, pkg.bin[k]);
112964
113040
  try {
112965
113041
  const st = await stat(script);
112966
113042
  const mode = st.mode | 73;
@@ -113011,7 +113087,7 @@ var require_tar_create_options = /* @__PURE__ */ __commonJSMin(((exports, module
113011
113087
  //#endregion
113012
113088
  //#region ../../node_modules/pacote/lib/dir.js
113013
113089
  var require_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
113014
- const { resolve } = __require("node:path");
113090
+ const { resolve: resolve$1 } = __require("node:path");
113015
113091
  const packlist = require_lib$9();
113016
113092
  const runScript = require_run_script();
113017
113093
  const tar = require_index_min();
@@ -113047,7 +113123,7 @@ var require_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
113047
113123
  env: {
113048
113124
  npm_package_resolved: this.resolved,
113049
113125
  npm_package_integrity: this.integrity,
113050
- npm_package_json: resolve(this.resolved, "package.json")
113126
+ npm_package_json: resolve$1(this.resolved, "package.json")
113051
113127
  }
113052
113128
  });
113053
113129
  });
@@ -152336,14 +152412,19 @@ const forge = async (action, appFolder, { cwd, log, inputs, setOutput, paths, ab
152336
152412
  if (e.name === "RequestError") log("Request error");
152337
152413
  if (e.name === "RequestError") log("Request error");
152338
152414
  }
152339
- log(e);
152415
+ log(e instanceof Error ? `${e.message}\n${e.stack}` : String(e));
152340
152416
  throw e;
152341
152417
  }
152342
152418
  } finally {
152343
152419
  try {
152344
- if (action !== "preview") await cp(join(destinationFolder, "out"), join(cwd, "out"), { recursive: true });
152420
+ if (action !== "preview") {
152421
+ const outDir = join(destinationFolder, "out");
152422
+ const finalOutDir = join(cwd, "out");
152423
+ if (existsSync(outDir)) await cp(outDir, finalOutDir, { recursive: true });
152424
+ else log("Warning: Build output directory 'out' was not found in staging folder.");
152425
+ }
152345
152426
  } catch (e) {
152346
- log("Failed to copy build output back to cwd:", e);
152427
+ log("Failed to copy build output back to cwd:", e instanceof Error ? `${e.message}\n${e.stack}` : String(e));
152347
152428
  }
152348
152429
  await rm(destinationFolder, {
152349
152430
  recursive: true,