@pipelab/plugin-poki 1.0.0-beta.23 → 1.0.0-beta.26

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,17 +2,17 @@ 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, { delimiter, dirname, join } from "node:path";
5
+ import path, { delimiter, dirname, join, resolve } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
- import { constants } from "node:os";
7
+ import { constants, homedir, platform } from "node:os";
8
8
  import { appendFileSync, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
9
- import { chmod, cp, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
9
+ import { access, chmod, cp, mkdir, readFile, readdir, rename, rm, writeFile } from "node:fs/promises";
10
10
  import http from "node:http";
11
11
  import { webcrypto } from "node:crypto";
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";
15
- import process$1, { execArgv, execPath, hrtime, platform } from "node:process";
15
+ import process$1, { execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
16
16
  import tty from "node:tty";
17
17
  import { scheduler, setImmediate as setImmediate$1, setTimeout as setTimeout$1 } from "node:timers/promises";
18
18
  import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
@@ -45393,6 +45393,17 @@ const DEFAULT_PNPM_VERSION = "10.12.0";
45393
45393
  const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
45394
45394
  const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
45395
45395
  const isDev = process.env.NODE_ENV === "development";
45396
+ const getDefaultUserDataPath = (env) => {
45397
+ const base = (() => {
45398
+ switch (platform()) {
45399
+ case "win32": return process.env.APPDATA || join(homedir(), "AppData", "Roaming");
45400
+ case "darwin": return join(homedir(), "Library", "Application Support");
45401
+ default: return process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
45402
+ }
45403
+ })();
45404
+ const mode = env ?? (isDev ? "dev" : "prod");
45405
+ return join(base, "@pipelab", mode === "dev" ? "app-dev" : mode === "beta" ? "app-beta" : "app");
45406
+ };
45396
45407
  /**
45397
45408
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
45398
45409
  */
@@ -49159,6 +49170,71 @@ var WebSocketServer = class {
49159
49170
  };
49160
49171
  const webSocketServer = new WebSocketServer();
49161
49172
  //#endregion
49173
+ //#region ../../packages/core-node/src/fs-utils.ts
49174
+ var import_slash = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
49175
+ module.exports = (path) => {
49176
+ const isExtendedLengthPath = /^\\\\\?\\/.test(path);
49177
+ const hasNonAscii = /[^\u0000-\u0080]+/.test(path);
49178
+ if (isExtendedLengthPath || hasNonAscii) return path;
49179
+ return path.replace(/\\/g, "/");
49180
+ };
49181
+ })))(), 1);
49182
+ function removeTrailingSlash(path) {
49183
+ return path.replace(/[\\/]+$/, "");
49184
+ }
49185
+ removeTrailingSlash((0, import_slash.default)(resolve(homedir()))).toLowerCase();
49186
+ const additionalProtectedPaths = [
49187
+ getDefaultUserDataPath("dev"),
49188
+ getDefaultUserDataPath("beta"),
49189
+ getDefaultUserDataPath("prod"),
49190
+ projectRoot,
49191
+ process.cwd(),
49192
+ "/tmp",
49193
+ "/var/tmp",
49194
+ process.env.TEMP,
49195
+ process.env.TMP,
49196
+ join(homedir(), "AppData"),
49197
+ join(homedir(), "AppData", "Local"),
49198
+ join(homedir(), "AppData", "Roaming"),
49199
+ join(homedir(), "Library"),
49200
+ join(homedir(), "Library", "Application Support"),
49201
+ join(homedir(), ".config"),
49202
+ join(homedir(), ".local"),
49203
+ join(homedir(), ".local", "share"),
49204
+ join(homedir(), ".cache"),
49205
+ join(homedir(), "OneDrive"),
49206
+ join(homedir(), "Dropbox"),
49207
+ join(homedir(), ".ssh"),
49208
+ join(homedir(), ".gnupg"),
49209
+ join(homedir(), ".aws"),
49210
+ join(homedir(), ".docker"),
49211
+ join(homedir(), ".kube"),
49212
+ join(homedir(), ".vscode"),
49213
+ join(homedir(), ".vscode-insiders"),
49214
+ join(homedir(), ".cursor"),
49215
+ join(homedir(), ".npm"),
49216
+ join(homedir(), ".pnpm-state"),
49217
+ join(homedir(), ".yarn"),
49218
+ join(homedir(), ".cargo"),
49219
+ join(homedir(), ".rustup"),
49220
+ join(homedir(), ".m2"),
49221
+ join(homedir(), ".gradle")
49222
+ ].filter((p) => typeof p === "string" && p.length > 0);
49223
+ new Set([
49224
+ join(homedir(), "Downloads"),
49225
+ join(homedir(), "Documents"),
49226
+ join(homedir(), "Desktop"),
49227
+ join(homedir(), "Pictures"),
49228
+ join(homedir(), "Music"),
49229
+ join(homedir(), "Videos"),
49230
+ join(homedir(), "Saved Games"),
49231
+ join(homedir(), "Contacts"),
49232
+ join(homedir(), "Searches"),
49233
+ join(homedir(), "Links"),
49234
+ join(homedir(), "3D Objects"),
49235
+ ...additionalProtectedPaths
49236
+ ].map((p) => removeTrailingSlash((0, import_slash.default)(resolve(p))).toLowerCase()));
49237
+ //#endregion
49162
49238
  //#region ../../node_modules/is-plain-obj/index.js
49163
49239
  function isPlainObject(value) {
49164
49240
  if (typeof value !== "object" || value === null) return false;
@@ -49440,7 +49516,7 @@ const COMMON_ESCAPES = {
49440
49516
  const ASTRAL_START = 65535;
49441
49517
  const quoteString = (escapedArgument) => {
49442
49518
  if (NO_ESCAPE_REGEXP.test(escapedArgument)) return escapedArgument;
49443
- return platform === "win32" ? `"${escapedArgument.replaceAll("\"", "\"\"")}"` : `'${escapedArgument.replaceAll("'", "'\\''")}'`;
49519
+ return platform$1 === "win32" ? `"${escapedArgument.replaceAll("\"", "\"\"")}"` : `'${escapedArgument.replaceAll("'", "'\\''")}'`;
49444
49520
  };
49445
49521
  const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
49446
49522
  //#endregion
@@ -59549,13 +59625,13 @@ var require_opts_arg = /* @__PURE__ */ __commonJSMin(((exports, module) => {
59549
59625
  //#region ../../node_modules/mkdirp/lib/path-arg.js
59550
59626
  var require_path_arg = /* @__PURE__ */ __commonJSMin(((exports, module) => {
59551
59627
  const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform;
59552
- const { resolve: resolve$12, parse: parse$2 } = __require("path");
59628
+ const { resolve: resolve$13, parse: parse$2 } = __require("path");
59553
59629
  const pathArg = (path) => {
59554
59630
  if (/\0/.test(path)) throw Object.assign(/* @__PURE__ */ new TypeError("path must be a string without null bytes"), {
59555
59631
  path,
59556
59632
  code: "ERR_INVALID_ARG_VALUE"
59557
59633
  });
59558
- path = resolve$12(path);
59634
+ path = resolve$13(path);
59559
59635
  if (platform === "win32") {
59560
59636
  const badWinChars = /[*|"<>?:]/;
59561
59637
  const { root } = parse$2(path);
@@ -62600,7 +62676,7 @@ var require_readdir_glob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
62600
62676
  const fs$19 = __require("fs");
62601
62677
  const { EventEmitter: EventEmitter$1 } = __require("events");
62602
62678
  const { Minimatch } = require_minimatch$1();
62603
- const { resolve: resolve$11 } = __require("path");
62679
+ const { resolve: resolve$12 } = __require("path");
62604
62680
  function readdir(dir, strict) {
62605
62681
  return new Promise((resolve, reject) => {
62606
62682
  fs$19.readdir(dir, { withFileTypes: true }, (err, files) => {
@@ -62709,7 +62785,7 @@ var require_readdir_glob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
62709
62785
  if (this.options.ignore) this.ignoreMatchers = (Array.isArray(this.options.ignore) ? this.options.ignore : [this.options.ignore]).map((ignore) => new Minimatch(ignore, { dot: true }));
62710
62786
  this.skipMatchers = [];
62711
62787
  if (this.options.skip) this.skipMatchers = (Array.isArray(this.options.skip) ? this.options.skip : [this.options.skip]).map((skip) => new Minimatch(skip, { dot: true }));
62712
- this.iterator = explore(resolve$11(cwd || "."), this.options.follow, this.options.stat, this._shouldSkipDirectory.bind(this));
62788
+ this.iterator = explore(resolve$12(cwd || "."), this.options.follow, this.options.stat, this._shouldSkipDirectory.bind(this));
62713
62789
  this.paused = false;
62714
62790
  this.inactive = false;
62715
62791
  this.aborted = false;
@@ -98053,7 +98129,7 @@ var require_npa = /* @__PURE__ */ __commonJSMin(((exports, module) => {
98053
98129
  const isWindows = process.platform === "win32";
98054
98130
  const { URL: URL$6 } = __require("node:url");
98055
98131
  const path$17 = isWindows ? __require("node:path/win32") : __require("node:path");
98056
- const { homedir: homedir$1 } = __require("node:os");
98132
+ const { homedir: homedir$2 } = __require("node:os");
98057
98133
  const HostedGit = require_lib$28();
98058
98134
  const semver = require_semver$2();
98059
98135
  const validatePackageName = require_lib$23();
@@ -98258,7 +98334,7 @@ var require_npa = /* @__PURE__ */ __commonJSMin(((exports, module) => {
98258
98334
  }
98259
98335
  if (/^\/~(\/|$)/.test(specPath)) {
98260
98336
  res.saveSpec = `file:${specPath.substr(1)}`;
98261
- resolvedPath = path$17.resolve(homedir$1(), specPath.substr(3));
98337
+ resolvedPath = path$17.resolve(homedir$2(), specPath.substr(3));
98262
98338
  } else if (!path$17.isAbsolute(rawSpec.slice(5))) res.saveSpec = `file:${path$17.relative(where, resolvedPath)}`;
98263
98339
  else res.saveSpec = `file:${path$17.resolve(resolvedPath)}`;
98264
98340
  res.fetchSpec = path$17.resolve(where, resolvedPath);
@@ -99405,7 +99481,7 @@ var require_sort$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99405
99481
  //#region ../../node_modules/@npmcli/package-json/lib/index.js
99406
99482
  var require_lib$18 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99407
99483
  const { readFile: readFile$5, writeFile: writeFile$3 } = __require("node:fs/promises");
99408
- const { resolve: resolve$10 } = __require("node:path");
99484
+ const { resolve: resolve$11 } = __require("node:path");
99409
99485
  const parseJSON = require_lib$30();
99410
99486
  const updateDeps = require_update_dependencies();
99411
99487
  const updateScripts = require_update_scripts();
@@ -99508,7 +99584,7 @@ var require_lib$18 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99508
99584
  parseErr = err;
99509
99585
  }
99510
99586
  if (parseErr) {
99511
- const indexFile = resolve$10(this.path, "index.js");
99587
+ const indexFile = resolve$11(this.path, "index.js");
99512
99588
  let indexFileContent;
99513
99589
  try {
99514
99590
  indexFileContent = await readFile$5(indexFile, "utf8");
@@ -99553,7 +99629,7 @@ var require_lib$18 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
99553
99629
  return this.#path;
99554
99630
  }
99555
99631
  get filename() {
99556
- if (this.path) return resolve$10(this.path, "package.json");
99632
+ if (this.path) return resolve$11(this.path, "package.json");
99557
99633
  }
99558
99634
  create(path) {
99559
99635
  this.#path = path;
@@ -100676,7 +100752,7 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100676
100752
  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();
100677
100753
  const { constants: { errno: { EEXIST, EISDIR, EINVAL, ENOTDIR } } } = __require("os");
100678
100754
  const { chmod: chmod$2, copyFile, lstat: lstat$2, mkdir: mkdir$5, readdir: readdir$5, readlink, stat: stat$4, symlink, unlink, utimes } = __require("fs/promises");
100679
- const { dirname: dirname$6, isAbsolute: isAbsolute$1, join: join$6, parse, resolve: resolve$9, sep: sep$2, toNamespacedPath } = __require("path");
100755
+ const { dirname: dirname$6, isAbsolute: isAbsolute$1, join: join$6, parse, resolve: resolve$10, sep: sep$2, toNamespacedPath } = __require("path");
100680
100756
  const { fileURLToPath: fileURLToPath$1 } = __require("url");
100681
100757
  const defaultOptions = {
100682
100758
  dereference: false,
@@ -100763,8 +100839,8 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100763
100839
  );
100764
100840
  }
100765
100841
  async function checkParentPaths(src, srcStat, dest) {
100766
- const srcParent = resolve$9(dirname$6(src));
100767
- const destParent = resolve$9(dirname$6(dest));
100842
+ const srcParent = resolve$10(dirname$6(src));
100843
+ const destParent = resolve$10(dirname$6(dest));
100768
100844
  if (destParent === srcParent || destParent === parse(destParent).root) return;
100769
100845
  let destStat;
100770
100846
  try {
@@ -100783,7 +100859,7 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100783
100859
  });
100784
100860
  return checkParentPaths(src, srcStat, destParent);
100785
100861
  }
100786
- const normalizePathToArray = (path) => resolve$9(path).split(sep$2).filter(Boolean);
100862
+ const normalizePathToArray = (path) => resolve$10(path).split(sep$2).filter(Boolean);
100787
100863
  function isSrcSubdir(src, dest) {
100788
100864
  const srcArr = normalizePathToArray(src);
100789
100865
  const destArr = normalizePathToArray(dest);
@@ -100893,7 +100969,7 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100893
100969
  }
100894
100970
  async function onLink(destStat, src, dest) {
100895
100971
  let resolvedSrc = await readlink(src);
100896
- if (!isAbsolute$1(resolvedSrc)) resolvedSrc = resolve$9(dirname$6(src), resolvedSrc);
100972
+ if (!isAbsolute$1(resolvedSrc)) resolvedSrc = resolve$10(dirname$6(src), resolvedSrc);
100897
100973
  if (!destStat) return symlink(resolvedSrc, dest);
100898
100974
  let resolvedDest;
100899
100975
  try {
@@ -100904,7 +100980,7 @@ var require_polyfill = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100904
100980
  // istanbul ignore next: should not be possible
100905
100981
  throw err;
100906
100982
  }
100907
- if (!isAbsolute$1(resolvedDest)) resolvedDest = resolve$9(dirname$6(dest), resolvedDest);
100983
+ if (!isAbsolute$1(resolvedDest)) resolvedDest = resolve$10(dirname$6(dest), resolvedDest);
100908
100984
  if (isSrcSubdir(resolvedSrc, resolvedDest)) throw new ERR_FS_CP_EINVAL({
100909
100985
  message: `cannot copy ${resolvedSrc} to a subdirectory of self ${resolvedDest}`,
100910
100986
  path: dest,
@@ -100991,7 +101067,7 @@ var require_readdir_scoped = /* @__PURE__ */ __commonJSMin(((exports, module) =>
100991
101067
  //#endregion
100992
101068
  //#region ../../node_modules/cacache/node_modules/@npmcli/fs/lib/move-file.js
100993
101069
  var require_move_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100994
- const { dirname: dirname$5, join: join$3, resolve: resolve$8, relative: relative$1, isAbsolute } = __require("path");
101070
+ const { dirname: dirname$5, join: join$3, resolve: resolve$9, relative: relative$1, isAbsolute } = __require("path");
100995
101071
  const fs$11 = __require("fs/promises");
100996
101072
  const pathExists = async (path) => {
100997
101073
  try {
@@ -101027,10 +101103,10 @@ var require_move_file = /* @__PURE__ */ __commonJSMin(((exports, module) => {
101027
101103
  if (root) {
101028
101104
  await Promise.all(symlinks.map(async ({ source: symSource, destination: symDestination }) => {
101029
101105
  let target = await fs$11.readlink(symSource);
101030
- if (isAbsolute(target)) target = resolve$8(symDestination, relative$1(symSource, target));
101106
+ if (isAbsolute(target)) target = resolve$9(symDestination, relative$1(symSource, target));
101031
101107
  let targetStat = "file";
101032
101108
  try {
101033
- targetStat = await fs$11.stat(resolve$8(dirname$5(symSource), target));
101109
+ targetStat = await fs$11.stat(resolve$9(dirname$5(symSource), target));
101034
101110
  if (targetStat.isDirectory()) targetStat = "junction";
101035
101111
  } catch {}
101036
101112
  await fs$11.symlink(target, symDestination, targetStat);
@@ -106847,7 +106923,7 @@ var require_lib$12 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106847
106923
  var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106848
106924
  const bundled = require_lib$12();
106849
106925
  const { readFile: readFile$2, readdir: readdir$2, stat: stat$2 } = __require("fs/promises");
106850
- const { resolve: resolve$7, basename: basename$3, dirname: dirname$4 } = __require("path");
106926
+ const { resolve: resolve$8, basename: basename$3, dirname: dirname$4 } = __require("path");
106851
106927
  const normalizePackageBin = require_lib$21();
106852
106928
  const readPackage = ({ path, packageJsonCache }) => packageJsonCache.has(path) ? Promise.resolve(packageJsonCache.get(path)) : readFile$2(path).then((json) => {
106853
106929
  const pkg = normalizePackageBin(JSON.parse(json));
@@ -106891,7 +106967,7 @@ var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106891
106967
  const nm = /^@.+/.test(scope) ? dirname$4(dir) : dir;
106892
106968
  const binFiles = [];
106893
106969
  Object.keys(pkg.bin).forEach((b) => {
106894
- const base = resolve$7(nm, ".bin", b);
106970
+ const base = resolve$8(nm, ".bin", b);
106895
106971
  binFiles.push(base, base + ".cmd", base + ".ps1");
106896
106972
  });
106897
106973
  (await Promise.all(binFiles.map((b) => stat$2(b).then(() => b).catch(() => null)))).filter((b) => b).forEach((b) => result.add(b));
@@ -106912,7 +106988,7 @@ var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106912
106988
  }
106913
106989
  const recursePromises = [];
106914
106990
  for (const entry of dirEntries) {
106915
- const p = resolve$7(path, entry.name);
106991
+ const p = resolve$8(path, entry.name);
106916
106992
  if (entry.isDirectory() === false) {
106917
106993
  result.add(p);
106918
106994
  continue;
@@ -106931,7 +107007,7 @@ var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106931
107007
  }
106932
107008
  if (bundleDeps) recursePromises.push(...bundleDeps.map((dep) => {
106933
107009
  return pkgContents({
106934
- path: resolve$7(path, "node_modules", dep),
107010
+ path: resolve$8(path, "node_modules", dep),
106935
107011
  packageJsonCache,
106936
107012
  pkg: true,
106937
107013
  depth,
@@ -106943,7 +107019,7 @@ var require_lib$11 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
106943
107019
  return result;
106944
107020
  };
106945
107021
  module.exports = ({ path, ...opts }) => pkgContents({
106946
- path: resolve$7(path),
107022
+ path: resolve$8(path),
106947
107023
  ...opts,
106948
107024
  pkg: true
106949
107025
  }).then((results) => [...results]);
@@ -110554,18 +110630,18 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110554
110630
  //#endregion
110555
110631
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110556
110632
  var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110557
- const { resolve: resolve$6 } = __require("node:path");
110558
- const { tmpdir, homedir } = __require("node:os");
110633
+ const { resolve: resolve$7 } = __require("node:path");
110634
+ const { tmpdir, homedir: homedir$1 } = __require("node:os");
110559
110635
  module.exports = (fakePlatform = false) => {
110560
110636
  const temp = tmpdir();
110561
110637
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110562
- const home = homedir() || resolve$6(temp, "npm-" + uidOrPid);
110638
+ const home = homedir$1() || resolve$7(temp, "npm-" + uidOrPid);
110563
110639
  const platform = fakePlatform || process.platform;
110564
110640
  const cacheExtra = platform === "win32" ? "npm-cache" : ".npm";
110565
110641
  const cacheRoot = platform === "win32" && process.env.LOCALAPPDATA || home;
110566
110642
  return {
110567
- cacache: resolve$6(cacheRoot, cacheExtra, "_cacache"),
110568
- tufcache: resolve$6(cacheRoot, cacheExtra, "_tuf")
110643
+ cacache: resolve$7(cacheRoot, cacheExtra, "_cacache"),
110644
+ tufcache: resolve$7(cacheRoot, cacheExtra, "_tuf")
110569
110645
  };
110570
110646
  };
110571
110647
  }));
@@ -112379,7 +112455,7 @@ var require_lib$10 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112379
112455
  var require_lib$9 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112380
112456
  const { Walker: IgnoreWalker } = require_lib$10();
112381
112457
  const { lstatSync: lstat$1, readFileSync: readFile$1 } = __require("fs");
112382
- const { basename: basename$2, dirname: dirname$3, extname: extname$1, join: join$2, relative, resolve: resolve$5, sep } = __require("path");
112458
+ const { basename: basename$2, dirname: dirname$3, extname: extname$1, join: join$2, relative, resolve: resolve$6, sep } = __require("path");
112383
112459
  const { log } = require_lib$29();
112384
112460
  const defaultRules = Symbol("npm-packlist.rules.default");
112385
112461
  const strictRules = Symbol("npm-packlist.rules.strict");
@@ -112430,7 +112506,7 @@ var require_lib$9 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112430
112506
  ...opts,
112431
112507
  includeEmpty: false,
112432
112508
  follow: false,
112433
- path: resolve$5(opts?.path || tree.path).replace(/\\/g, "/"),
112509
+ path: resolve$6(opts?.path || tree.path).replace(/\\/g, "/"),
112434
112510
  ignoreFiles: opts?.ignoreFiles || [
112435
112511
  defaultRules,
112436
112512
  "package.json",
@@ -112631,8 +112707,8 @@ var require_lib$9 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112631
112707
  var require_set_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112632
112708
  init_esm_shims();
112633
112709
  const { log } = require_lib$29();
112634
- const { resolve: resolve$4, dirname: dirname$2, delimiter: delimiter$1 } = __require("path");
112635
- const nodeGypPath = resolve$4(__dirname, "../lib/node-gyp-bin");
112710
+ const { resolve: resolve$5, dirname: dirname$2, delimiter: delimiter$1 } = __require("path");
112711
+ const nodeGypPath = resolve$5(__dirname, "../lib/node-gyp-bin");
112636
112712
  const setPATH = (projectPath, binPaths, env) => {
112637
112713
  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);
112638
112714
  const pathArr = [];
@@ -112647,7 +112723,7 @@ var require_set_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112647
112723
  let p = projectPath;
112648
112724
  let pp;
112649
112725
  do {
112650
- pathArr.push(resolve$4(p, "node_modules", ".bin"));
112726
+ pathArr.push(resolve$5(p, "node_modules", ".bin"));
112651
112727
  pp = p;
112652
112728
  p = dirname$2(p);
112653
112729
  } while (p !== pp);
@@ -112662,7 +112738,7 @@ var require_set_path = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112662
112738
  //#region ../../node_modules/@npmcli/run-script/lib/make-spawn-args.js
112663
112739
  var require_make_spawn_args = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112664
112740
  const setPATH = require_set_path();
112665
- const { resolve: resolve$3 } = __require("path");
112741
+ const { resolve: resolve$4 } = __require("path");
112666
112742
  let npm_config_node_gyp;
112667
112743
  const makeSpawnArgs = (options) => {
112668
112744
  const { args, binPaths, cmd, env, event, nodeGyp, path, scriptShell = true, stdio, stdioString } = options;
@@ -112676,7 +112752,7 @@ var require_make_spawn_args = /* @__PURE__ */ __commonJSMin(((exports, module) =
112676
112752
  env: setPATH(path, binPaths, {
112677
112753
  ...process.env,
112678
112754
  ...env,
112679
- npm_package_json: resolve$3(path, "package.json"),
112755
+ npm_package_json: resolve$4(path, "package.json"),
112680
112756
  npm_lifecycle_event: event,
112681
112757
  npm_lifecycle_script: cmd,
112682
112758
  npm_config_node_gyp
@@ -112764,10 +112840,10 @@ var require_signal_manager = /* @__PURE__ */ __commonJSMin(((exports, module) =>
112764
112840
  //#region ../../node_modules/@npmcli/run-script/lib/is-server-package.js
112765
112841
  var require_is_server_package = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112766
112842
  const { stat: stat$1 } = __require("node:fs/promises");
112767
- const { resolve: resolve$2 } = __require("node:path");
112843
+ const { resolve: resolve$3 } = __require("node:path");
112768
112844
  module.exports = async (path) => {
112769
112845
  try {
112770
- return (await stat$1(resolve$2(path, "server.js"))).isFile();
112846
+ return (await stat$1(resolve$3(path, "server.js"))).isFile();
112771
112847
  } catch (er) {
112772
112848
  return false;
112773
112849
  }
@@ -112877,7 +112953,7 @@ var require_run_script = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112877
112953
  //#endregion
112878
112954
  //#region ../../node_modules/pacote/lib/file.js
112879
112955
  var require_file$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112880
- const { resolve: resolve$1 } = __require("node:path");
112956
+ const { resolve: resolve$2 } = __require("node:path");
112881
112957
  const { stat, chmod: chmod$1 } = __require("node:fs/promises");
112882
112958
  const cacache = require_lib$14();
112883
112959
  const fsm = require_lib$13();
@@ -112903,7 +112979,7 @@ var require_file$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112903
112979
  #exeBins(pkg, dest) {
112904
112980
  if (!pkg.bin) return Promise.resolve();
112905
112981
  return Promise.all(Object.keys(pkg.bin).map(async (k) => {
112906
- const script = resolve$1(dest, pkg.bin[k]);
112982
+ const script = resolve$2(dest, pkg.bin[k]);
112907
112983
  try {
112908
112984
  const st = await stat(script);
112909
112985
  const mode = st.mode | 73;
@@ -112954,7 +113030,7 @@ var require_tar_create_options = /* @__PURE__ */ __commonJSMin(((exports, module
112954
113030
  //#endregion
112955
113031
  //#region ../../node_modules/pacote/lib/dir.js
112956
113032
  var require_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112957
- const { resolve } = __require("node:path");
113033
+ const { resolve: resolve$1 } = __require("node:path");
112958
113034
  const packlist = require_lib$9();
112959
113035
  const runScript = require_run_script();
112960
113036
  const tar = require_index_min();
@@ -112990,7 +113066,7 @@ var require_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
112990
113066
  env: {
112991
113067
  npm_package_resolved: this.resolved,
112992
113068
  npm_package_integrity: this.integrity,
112993
- npm_package_json: resolve(this.resolved, "package.json")
113069
+ npm_package_json: resolve$1(this.resolved, "package.json")
112994
113070
  }
112995
113071
  });
112996
113072
  });
@@ -151587,29 +151663,62 @@ var src_default = createNodeDefinition({
151587
151663
  }),
151588
151664
  runner: createActionRunner(async ({ log, inputs, paths, abortSignal, cwd, context }) => {
151589
151665
  const { node, thirdparty, pnpm, userData } = paths;
151666
+ const absoluteInputFolder = resolve(inputs["input-folder"]);
151667
+ log("Starting Poki upload action...");
151668
+ log(`- Game ID: ${inputs.project}`);
151669
+ log(`- Version name: ${inputs.name}`);
151670
+ log(`- Version notes: ${inputs.notes}`);
151671
+ log(`- Input folder: ${absoluteInputFolder}`);
151672
+ log(`Fetching @poki/cli version ${POKI_CLI_VERSION}...`);
151590
151673
  const { packageDir: pokiDir } = await fetchPackage("@poki/cli", POKI_CLI_VERSION, {
151591
151674
  context,
151592
151675
  installDeps: true
151593
151676
  });
151594
151677
  const poki = join(pokiDir, "bin", "index.js");
151595
- const dist = join(cwd, "dist");
151596
- await mkdir(dist, { recursive: true });
151597
- await cp(inputs["input-folder"], dist, { recursive: true });
151598
- const pokiJsonPath = join(cwd, "poki.json");
151599
- console.log("pokiJsonPath", pokiJsonPath);
151600
- await writeFile(pokiJsonPath, JSON.stringify({
151678
+ log(`Successfully resolved @poki/cli. Executable: ${poki}`);
151679
+ const tempUploadFolder = await context.createTempFolder("poki-upload-");
151680
+ log(`Created temporary upload root directory: ${tempUploadFolder}`);
151681
+ const tempDistFolder = join(tempUploadFolder, "dist");
151682
+ log(`Copying build files from "${absoluteInputFolder}" to "${tempDistFolder}"...`);
151683
+ await cp(absoluteInputFolder, tempDistFolder, { recursive: true });
151684
+ const pokiJsonPath = join(tempUploadFolder, "poki.json");
151685
+ log(`Writing temporary poki.json configuration at: ${pokiJsonPath}`);
151686
+ const pokiConfig = {
151601
151687
  game_id: inputs.project,
151602
151688
  build_dir: "dist"
151603
- }, void 0, 2), "utf-8");
151604
- log("process.env.MSW_BRIDGE_PORT", process.env.MSW_BRIDGE_PORT);
151605
- log("process.env.NODE_OPTIONS", process.env.NODE_OPTIONS);
151689
+ };
151690
+ log(`poki.json configuration content:\n${JSON.stringify(pokiConfig, null, 2)}`);
151691
+ await writeFile(pokiJsonPath, JSON.stringify(pokiConfig, void 0, 2), "utf-8");
151606
151692
  const sandboxConfigDir = thirdparty;
151693
+ log("Checking for sandboxed authentication credentials...");
151694
+ const possibleAuthPaths = [join(sandboxConfigDir, "poki", "auth.json"), join(sandboxConfigDir, "Poki", "auth.json")];
151695
+ let authFileFound = false;
151696
+ let foundPath = "";
151697
+ for (const p of possibleAuthPaths) try {
151698
+ await access(p);
151699
+ authFileFound = true;
151700
+ foundPath = p;
151701
+ break;
151702
+ } catch {}
151703
+ if (authFileFound) log(`[Poki] Authentication file found at: ${foundPath}`);
151704
+ else {
151705
+ log("[Poki] [WARNING] No authentication file (auth.json) found in the sandboxed config directory.");
151706
+ log("[Poki] [WARNING] Poki CLI might try to open a browser for interactive login, which could hang/fail in headless environments.");
151707
+ log(`[Poki] Expected location: ${join(sandboxConfigDir, "poki", "auth.json")} or ${join(sandboxConfigDir, "Poki", "auth.json")}`);
151708
+ }
151709
+ log("Configuring environment variables:");
151710
+ log(` - XDG_CONFIG_HOME: ${sandboxConfigDir}`);
151711
+ log(` - LOCALAPPDATA: ${sandboxConfigDir}`);
151712
+ log(` - PATH: ${dirname(node)}${delimiter}${process.env.PATH}`);
151713
+ log(` - MSW_BRIDGE_PORT: ${process.env.MSW_BRIDGE_PORT || "not set"}`);
151714
+ log(` - NODE_OPTIONS: ${process.env.NODE_OPTIONS || "not set"}`);
151607
151715
  const env = {
151608
151716
  ...process.env,
151609
151717
  XDG_CONFIG_HOME: sandboxConfigDir,
151610
151718
  LOCALAPPDATA: sandboxConfigDir,
151611
151719
  PATH: `${dirname(node)}${delimiter}${process.env.PATH}`
151612
151720
  };
151721
+ log(`Running Poki CLI upload command: node ${poki} upload --name "${inputs.name}" --notes "${inputs.notes}"`);
151613
151722
  await runWithLiveLogs(node, [
151614
151723
  poki,
151615
151724
  "upload",
@@ -151618,7 +151727,7 @@ var src_default = createNodeDefinition({
151618
151727
  "--notes",
151619
151728
  inputs.notes
151620
151729
  ], {
151621
- cwd,
151730
+ cwd: tempUploadFolder,
151622
151731
  env,
151623
151732
  cancelSignal: abortSignal
151624
151733
  }, log, {