@pipelab/plugin-poki 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.cjs CHANGED
@@ -8,11 +8,11 @@ let node_os = require("node:os");
8
8
  let node_url = require("node:url");
9
9
  let node_fs = require("node:fs");
10
10
  node_fs = require_chunk.__toESM(node_fs);
11
+ let node_fs_promises = require("node:fs/promises");
12
+ node_fs_promises = require_chunk.__toESM(node_fs_promises);
11
13
  let node_http = require("node:http");
12
14
  node_http = require_chunk.__toESM(node_http);
13
15
  let node_crypto = require("node:crypto");
14
- let node_fs_promises = require("node:fs/promises");
15
- node_fs_promises = require_chunk.__toESM(node_fs_promises);
16
16
  let node_child_process = require("node:child_process");
17
17
  let node_string_decoder = require("node:string_decoder");
18
18
  let node_util = require("node:util");
@@ -26,6 +26,8 @@ let node_v8 = require("node:v8");
26
26
  let node_stream_promises = require("node:stream/promises");
27
27
  let node_stream = require("node:stream");
28
28
  let node_buffer = require("node:buffer");
29
+ let node_dns_promises = require("node:dns/promises");
30
+ node_dns_promises = require_chunk.__toESM(node_dns_promises);
29
31
  //#region ../../packages/migration/src/models/createMigration.ts
30
32
  function createMigration$1(migration) {
31
33
  return {
@@ -1604,6 +1606,56 @@ function literal(literal_, message) {
1604
1606
  }
1605
1607
  };
1606
1608
  }
1609
+ function looseObject(entries, message) {
1610
+ return {
1611
+ kind: "schema",
1612
+ type: "loose_object",
1613
+ reference: looseObject,
1614
+ expects: "Object",
1615
+ async: false,
1616
+ entries,
1617
+ message,
1618
+ _run(dataset, config2) {
1619
+ const input = dataset.value;
1620
+ if (input && typeof input === "object") {
1621
+ dataset.typed = true;
1622
+ dataset.value = {};
1623
+ for (const key in this.entries) {
1624
+ const value2 = input[key];
1625
+ const valueDataset = this.entries[key]._run({
1626
+ typed: false,
1627
+ value: value2
1628
+ }, config2);
1629
+ if (valueDataset.issues) {
1630
+ const pathItem = {
1631
+ type: "object",
1632
+ origin: "value",
1633
+ input,
1634
+ key,
1635
+ value: value2
1636
+ };
1637
+ for (const issue of valueDataset.issues) {
1638
+ if (issue.path) issue.path.unshift(pathItem);
1639
+ else issue.path = [pathItem];
1640
+ dataset.issues?.push(issue);
1641
+ }
1642
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1643
+ if (config2.abortEarly) {
1644
+ dataset.typed = false;
1645
+ break;
1646
+ }
1647
+ }
1648
+ if (!valueDataset.typed) dataset.typed = false;
1649
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1650
+ }
1651
+ if (!dataset.issues || !config2.abortEarly) {
1652
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1653
+ }
1654
+ } else _addIssue(this, "type", dataset, config2);
1655
+ return dataset;
1656
+ }
1657
+ };
1658
+ }
1607
1659
  function number(message) {
1608
1660
  return {
1609
1661
  kind: "schema",
@@ -2141,6 +2193,18 @@ settingsMigratorInternal.createMigrations({
2141
2193
  })
2142
2194
  ]
2143
2195
  });
2196
+ const connectionsMigratorInternal = createMigrator();
2197
+ const defaultConnections = connectionsMigratorInternal.createDefault({
2198
+ version: "1.0.0",
2199
+ connections: []
2200
+ });
2201
+ connectionsMigratorInternal.createMigrations({
2202
+ defaultValue: defaultConnections,
2203
+ migrations: [createMigration({
2204
+ version: "1.0.0",
2205
+ up: finalVersion
2206
+ })]
2207
+ });
2144
2208
  const fileRepoMigratorInternal = createMigrator();
2145
2209
  const defaultFileRepo = fileRepoMigratorInternal.createDefault({
2146
2210
  version: "2.0.0",
@@ -2302,11 +2366,51 @@ const LEGACY_ID_MAP = {
2302
2366
  };
2303
2367
  const getStrictPluginId = (pluginId) => {
2304
2368
  if (!pluginId) return pluginId;
2305
- if (LEGACY_ID_MAP[pluginId]) return LEGACY_ID_MAP[pluginId];
2306
- if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
2307
- const prefixed = `@pipelab/plugin-${pluginId}`;
2308
- return LEGACY_ID_MAP[prefixed] || prefixed;
2369
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2309
2370
  };
2371
+ //#endregion
2372
+ //#region ../../packages/shared/src/save-location.ts
2373
+ const SaveLocationInternalValidator = object({
2374
+ id: string(),
2375
+ project: string(),
2376
+ lastModified: string(),
2377
+ type: literal("internal"),
2378
+ configName: string()
2379
+ });
2380
+ const SaveLocationValidator = union([
2381
+ object({
2382
+ id: string(),
2383
+ project: string(),
2384
+ path: string(),
2385
+ lastModified: string(),
2386
+ type: literal("external"),
2387
+ summary: object({
2388
+ plugins: array(string()),
2389
+ name: string(),
2390
+ description: string()
2391
+ })
2392
+ }),
2393
+ SaveLocationInternalValidator,
2394
+ object({
2395
+ id: string(),
2396
+ project: string(),
2397
+ type: literal("pipelab-cloud")
2398
+ })
2399
+ ]);
2400
+ object({
2401
+ version: literal("1.0.0"),
2402
+ data: optional(record(string(), SaveLocationValidator), {})
2403
+ });
2404
+ const FileRepoProjectValidatorV2$1 = object({
2405
+ id: string(),
2406
+ name: string(),
2407
+ description: string()
2408
+ });
2409
+ object({
2410
+ version: literal("2.0.0"),
2411
+ projects: array(FileRepoProjectValidatorV2$1),
2412
+ pipelines: optional(array(SaveLocationValidator), [])
2413
+ });
2310
2414
  object({
2311
2415
  cacheFolder: string(),
2312
2416
  theme: union([literal("light"), literal("dark")]),
@@ -2458,6 +2562,17 @@ object({
2458
2562
  })),
2459
2563
  isInternalMigrationBannerClosed: optional(boolean(), false)
2460
2564
  });
2565
+ const ConnectionValidator = looseObject({
2566
+ id: string(),
2567
+ pluginName: string(),
2568
+ name: string(),
2569
+ createdAt: string(),
2570
+ isDefault: boolean()
2571
+ });
2572
+ object({
2573
+ version: literal("1.0.0"),
2574
+ connections: array(ConnectionValidator)
2575
+ });
2461
2576
  //#endregion
2462
2577
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
2463
2578
  const prettyLogStyles = {
@@ -2978,7 +3093,7 @@ const useLogger = () => {
2978
3093
  const OriginValidator = object({
2979
3094
  pluginId: string(),
2980
3095
  nodeId: string(),
2981
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
3096
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
2982
3097
  });
2983
3098
  const BlockActionValidatorV1 = object({
2984
3099
  type: literal("action"),
@@ -2991,7 +3106,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
2991
3106
  const BlockActionValidatorV3 = object({
2992
3107
  type: literal("action"),
2993
3108
  uid: string(),
2994
- name: pipe(optional(string()), description("A custom name provided by the user")),
3109
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
2995
3110
  disabled: optional(boolean()),
2996
3111
  params: record(string(), object({
2997
3112
  editor: EditorParamValidatorV3,
@@ -45291,35 +45406,6 @@ const createPathParam = (value, definition) => {
45291
45406
  };
45292
45407
  };
45293
45408
  //#endregion
45294
- //#region ../../packages/shared/src/save-location.ts
45295
- const SaveLocationInternalValidator = object({
45296
- id: string(),
45297
- project: string(),
45298
- lastModified: string(),
45299
- type: literal("internal"),
45300
- configName: string()
45301
- });
45302
- const SaveLocationValidator = union([
45303
- object({
45304
- id: string(),
45305
- project: string(),
45306
- path: string(),
45307
- lastModified: string(),
45308
- type: literal("external"),
45309
- summary: object({
45310
- plugins: array(string()),
45311
- name: string(),
45312
- description: string()
45313
- })
45314
- }),
45315
- SaveLocationInternalValidator,
45316
- object({
45317
- id: string(),
45318
- project: string(),
45319
- type: literal("pipelab-cloud")
45320
- })
45321
- ]);
45322
- //#endregion
45323
45409
  //#region ../../packages/shared/src/websocket.types.ts
45324
45410
  var WebSocketError = class extends Error {
45325
45411
  constructor(message, code, requestId) {
@@ -45336,20 +45422,6 @@ object({
45336
45422
  version: literal("1.0.0"),
45337
45423
  data: optional(record(string(), SaveLocationValidator), {})
45338
45424
  });
45339
- const FileRepoProjectValidatorV2$1 = object({
45340
- id: string(),
45341
- name: string(),
45342
- description: string()
45343
- });
45344
- object({
45345
- version: literal("2.0.0"),
45346
- projects: array(FileRepoProjectValidatorV2$1),
45347
- pipelines: optional(array(SaveLocationValidator), [])
45348
- });
45349
- object({
45350
- version: literal("1.0.0"),
45351
- data: optional(record(string(), SaveLocationValidator), {})
45352
- });
45353
45425
  const FileRepoProjectValidatorV2 = object({
45354
45426
  id: string(),
45355
45427
  name: string(),
@@ -45361,8 +45433,14 @@ object({
45361
45433
  pipelines: optional(array(SaveLocationValidator), [])
45362
45434
  });
45363
45435
  //#endregion
45436
+ //#region ../../packages/constants/src/index.ts
45437
+ const websocketPort = 33753;
45438
+ const DEFAULT_NODE_VERSION = "24.14.1";
45439
+ const DEFAULT_PNPM_VERSION = "10.12.0";
45440
+ //#endregion
45364
45441
  //#region ../../packages/core-node/src/context.ts
45365
- const _dirname = typeof __dirname !== "undefined" ? __dirname : require("url").pathToFileURL(__filename).href ? (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href)) : process.cwd();
45442
+ const metaUrl = require("url").pathToFileURL(__filename).href;
45443
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? (0, node_path.dirname)((0, node_url.fileURLToPath)(metaUrl)) : process.cwd();
45366
45444
  const isDev = process.env.NODE_ENV === "development";
45367
45445
  /**
45368
45446
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
@@ -48934,9 +49012,6 @@ const useAPI = () => {
48934
49012
  };
48935
49013
  };
48936
49014
  //#endregion
48937
- //#region ../../packages/constants/src/index.ts
48938
- const websocketPort = 33753;
48939
- //#endregion
48940
49015
  //#region ../../packages/core-node/src/websocket-server.ts
48941
49016
  var WebSocketServer = class {
48942
49017
  wss = null;
@@ -59945,14 +60020,14 @@ var require_path_reservations = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
59945
60020
  const assert$1 = require("assert");
59946
60021
  const normalize = require_normalize_unicode();
59947
60022
  const stripSlashes = require_strip_trailing_slashes();
59948
- const { join: join$17 } = require("path");
60023
+ const { join: join$18 } = require("path");
59949
60024
  const isWindows = (process.env.TESTING_TAR_FAKE_PLATFORM || process.platform) === "win32";
59950
60025
  module.exports = () => {
59951
60026
  const queues = /* @__PURE__ */ new Map();
59952
60027
  const reservations = /* @__PURE__ */ new Map();
59953
60028
  const getDirs = (path$62) => {
59954
60029
  return path$62.split("/").slice(0, -1).reduce((set, path$63) => {
59955
- if (set.length) path$63 = join$17(set[set.length - 1], path$63);
60030
+ if (set.length) path$63 = join$18(set[set.length - 1], path$63);
59956
60031
  set.push(path$63 || "/");
59957
60032
  return set;
59958
60033
  }, []);
@@ -60006,7 +60081,7 @@ var require_path_reservations = /* @__PURE__ */ require_chunk.__commonJSMin(((ex
60006
60081
  };
60007
60082
  const reserve = (paths, fn) => {
60008
60083
  paths = isWindows ? ["win32 parallelization disabled"] : paths.map((p) => {
60009
- return stripSlashes(join$17(normalize(p))).toLowerCase();
60084
+ return stripSlashes(join$18(normalize(p))).toLowerCase();
60010
60085
  });
60011
60086
  const dirs = new Set(paths.map((path$67) => getDirs(path$67)).reduce((a, b) => a.concat(b)));
60012
60087
  reservations.set(fn, {
@@ -89344,14 +89419,6 @@ var import_tar = /* @__PURE__ */ require_chunk.__toESM(require_tar$1(), 1);
89344
89419
  var import_yauzl = /* @__PURE__ */ require_chunk.__toESM(require_yauzl(), 1);
89345
89420
  require_archiver();
89346
89421
  /**
89347
- * Generates a unique temporary folder.
89348
- */
89349
- const generateTempFolder = async (base) => {
89350
- const targetBase = base || (0, node_os.tmpdir)();
89351
- await (0, node_fs_promises.mkdir)(targetBase, { recursive: true });
89352
- return await (0, node_fs_promises.mkdtemp)((0, node_path.join)(await (0, node_fs_promises.realpath)(targetBase), "pipelab-"));
89353
- };
89354
- /**
89355
89422
  * Extracts a .tar.gz archive.
89356
89423
  */
89357
89424
  async function extractTarGz(archivePath, destinationDir) {
@@ -95851,7 +95918,7 @@ var require_index_min$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
95851
95918
  //#region ../../node_modules/@npmcli/promise-spawn/node_modules/which/lib/index.js
95852
95919
  var require_lib$27 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
95853
95920
  const { isexe, sync: isexeSync } = require_index_min$3();
95854
- const { join: join$14, delimiter: delimiter$4, sep: sep$4, posix: posix$1 } = require("path");
95921
+ const { join: join$15, delimiter: delimiter$4, sep: sep$4, posix: posix$1 } = require("path");
95855
95922
  const isWindows = process.platform === "win32";
95856
95923
  /* istanbul ignore next */
95857
95924
  const rSlash = new RegExp(`[${posix$1.sep}${sep$4 === posix$1.sep ? "" : sep$4}]`.replace(/(\\)/g, "\\$1"));
@@ -95881,7 +95948,7 @@ var require_lib$27 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
95881
95948
  };
95882
95949
  const getPathPart = (raw, cmd) => {
95883
95950
  const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
95884
- return (!pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "") + join$14(pathPart, cmd);
95951
+ return (!pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "") + join$15(pathPart, cmd);
95885
95952
  };
95886
95953
  const which = async (cmd, opt = {}) => {
95887
95954
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
@@ -96630,7 +96697,7 @@ var require_index_min$2 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports)
96630
96697
  //#region ../../node_modules/@npmcli/git/node_modules/which/lib/index.js
96631
96698
  var require_lib$24 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
96632
96699
  const { isexe, sync: isexeSync } = require_index_min$2();
96633
- const { join: join$13, delimiter: delimiter$3, sep: sep$3, posix } = require("path");
96700
+ const { join: join$14, delimiter: delimiter$3, sep: sep$3, posix } = require("path");
96634
96701
  const isWindows = process.platform === "win32";
96635
96702
  /* istanbul ignore next */
96636
96703
  const rSlash = new RegExp(`[${posix.sep}${sep$3 === posix.sep ? "" : sep$3}]`.replace(/(\\)/g, "\\$1"));
@@ -96660,7 +96727,7 @@ var require_lib$24 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
96660
96727
  };
96661
96728
  const getPathPart = (raw, cmd) => {
96662
96729
  const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
96663
- return (!pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "") + join$13(pathPart, cmd);
96730
+ return (!pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "") + join$14(pathPart, cmd);
96664
96731
  };
96665
96732
  const which = async (cmd, opt = {}) => {
96666
96733
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
@@ -98558,7 +98625,7 @@ var require_lib$22 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
98558
98625
  //#endregion
98559
98626
  //#region ../../node_modules/npm-normalize-package-bin/lib/index.js
98560
98627
  var require_lib$21 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
98561
- const { join: join$12, basename: basename$4 } = require("path");
98628
+ const { join: join$13, basename: basename$4 } = require("path");
98562
98629
  const normalize = (pkg) => !pkg.bin ? removeBin(pkg) : typeof pkg.bin === "string" ? normalizeString(pkg) : Array.isArray(pkg.bin) ? normalizeArray(pkg) : typeof pkg.bin === "object" ? normalizeObject(pkg) : removeBin(pkg);
98563
98630
  const normalizeString = (pkg) => {
98564
98631
  if (!pkg.name) return removeBin(pkg);
@@ -98581,9 +98648,9 @@ var require_lib$21 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
98581
98648
  const clean = {};
98582
98649
  let hasBins = false;
98583
98650
  Object.keys(orig).forEach((binKey) => {
98584
- const base = join$12("/", basename$4(binKey.replace(/\\|:/g, "/"))).slice(1);
98651
+ const base = join$13("/", basename$4(binKey.replace(/\\|:/g, "/"))).slice(1);
98585
98652
  if (typeof orig[binKey] !== "string" || !base) return;
98586
- const binTarget = join$12("/", orig[binKey].replace(/\\/g, "/")).replace(/\\/g, "/").slice(1);
98653
+ const binTarget = join$13("/", orig[binKey].replace(/\\/g, "/")).replace(/\\/g, "/").slice(1);
98587
98654
  if (!binTarget) return;
98588
98655
  clean[base] = binTarget;
98589
98656
  hasBins = true;
@@ -100656,7 +100723,7 @@ var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100656
100723
  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();
100657
100724
  const { constants: { errno: { EEXIST, EISDIR, EINVAL, ENOTDIR } } } = require("os");
100658
100725
  const { chmod: chmod$2, copyFile, lstat: lstat$2, mkdir: mkdir$8, readdir: readdir$6, readlink, stat: stat$5, symlink, unlink, utimes } = require("fs/promises");
100659
- const { dirname: dirname$9, isAbsolute: isAbsolute$2, join: join$11, parse, resolve: resolve$10, sep: sep$2, toNamespacedPath } = require("path");
100726
+ const { dirname: dirname$9, isAbsolute: isAbsolute$2, join: join$12, parse, resolve: resolve$10, sep: sep$2, toNamespacedPath } = require("path");
100660
100727
  const { fileURLToPath } = require("url");
100661
100728
  const defaultOptions = {
100662
100729
  dereference: false,
@@ -100865,8 +100932,8 @@ var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100865
100932
  const dir = await readdir$6(src);
100866
100933
  for (let i = 0; i < dir.length; i++) {
100867
100934
  const item = dir[i];
100868
- const srcItem = join$11(src, item);
100869
- const destItem = join$11(dest, item);
100935
+ const srcItem = join$12(src, item);
100936
+ const destItem = join$12(dest, item);
100870
100937
  const { destStat } = await checkPaths(srcItem, destItem, opts);
100871
100938
  await startCopy(destStat, srcItem, destItem, opts);
100872
100939
  }
@@ -100930,13 +100997,13 @@ var require_cp = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module)
100930
100997
  //#endregion
100931
100998
  //#region ../../node_modules/cacache/node_modules/@npmcli/fs/lib/with-temp-dir.js
100932
100999
  var require_with_temp_dir = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
100933
- const { join: join$10, sep: sep$1 } = require("path");
101000
+ const { join: join$11, sep: sep$1 } = require("path");
100934
101001
  const getOptions = require_get_options();
100935
101002
  const { mkdir: mkdir$7, mkdtemp, rm: rm$7 } = require("fs/promises");
100936
101003
  const withTempDir = async (root, fn, opts) => {
100937
101004
  const options = getOptions(opts, { copy: ["tmpPrefix"] });
100938
101005
  await mkdir$7(root, { recursive: true });
100939
- const target = await mkdtemp(join$10(`${root}${sep$1}`, options.tmpPrefix || ""));
101006
+ const target = await mkdtemp(join$11(`${root}${sep$1}`, options.tmpPrefix || ""));
100940
101007
  let err;
100941
101008
  let result;
100942
101009
  try {
@@ -100959,10 +101026,10 @@ var require_with_temp_dir = /* @__PURE__ */ require_chunk.__commonJSMin(((export
100959
101026
  //#region ../../node_modules/cacache/node_modules/@npmcli/fs/lib/readdir-scoped.js
100960
101027
  var require_readdir_scoped = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
100961
101028
  const { readdir: readdir$5 } = require("fs/promises");
100962
- const { join: join$9 } = require("path");
101029
+ const { join: join$10 } = require("path");
100963
101030
  const readdirScoped = async (dir) => {
100964
101031
  const results = [];
100965
- for (const item of await readdir$5(dir)) if (item.startsWith("@")) for (const scopedItem of await readdir$5(join$9(dir, item))) results.push(join$9(item, scopedItem));
101032
+ for (const item of await readdir$5(dir)) if (item.startsWith("@")) for (const scopedItem of await readdir$5(join$10(dir, item))) results.push(join$10(item, scopedItem));
100966
101033
  else results.push(item);
100967
101034
  return results;
100968
101035
  };
@@ -100971,7 +101038,7 @@ var require_readdir_scoped = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
100971
101038
  //#endregion
100972
101039
  //#region ../../node_modules/cacache/node_modules/@npmcli/fs/lib/move-file.js
100973
101040
  var require_move_file = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
100974
- const { dirname: dirname$8, join: join$8, resolve: resolve$9, relative: relative$1, isAbsolute: isAbsolute$1 } = require("path");
101041
+ const { dirname: dirname$8, join: join$9, resolve: resolve$9, relative: relative$1, isAbsolute: isAbsolute$1 } = require("path");
100975
101042
  const fs$12 = require("fs/promises");
100976
101043
  const pathExists = async (path$54) => {
100977
101044
  try {
@@ -100996,7 +101063,7 @@ var require_move_file = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
100996
101063
  const sourceStat = await fs$12.lstat(source);
100997
101064
  if (sourceStat.isDirectory()) {
100998
101065
  const files = await fs$12.readdir(source);
100999
- await Promise.all(files.map((file) => moveFile(join$8(source, file), join$8(destination, file), options, false, symlinks)));
101066
+ await Promise.all(files.map((file) => moveFile(join$9(source, file), join$9(destination, file), options, false, symlinks)));
101000
101067
  } else if (sourceStat.isSymbolicLink()) symlinks.push({
101001
101068
  source,
101002
101069
  destination
@@ -110535,9 +110602,9 @@ var require_protected = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
110535
110602
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110536
110603
  var require_cache_dir = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
110537
110604
  const { resolve: resolve$7 } = require("node:path");
110538
- const { tmpdir: tmpdir$2, homedir } = require("node:os");
110605
+ const { tmpdir, homedir } = require("node:os");
110539
110606
  module.exports = (fakePlatform = false) => {
110540
- const temp = tmpdir$2();
110607
+ const temp = tmpdir();
110541
110608
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110542
110609
  const home = homedir() || resolve$7(temp, "npm-" + uidOrPid);
110543
110610
  const platform = fakePlatform || process.platform;
@@ -112359,7 +112426,7 @@ var require_lib$10 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
112359
112426
  var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
112360
112427
  const { Walker: IgnoreWalker } = require_lib$10();
112361
112428
  const { lstatSync: lstat$1, readFileSync: readFile$4 } = require("fs");
112362
- const { basename: basename$2, dirname: dirname$6, extname: extname$1, join: join$7, relative, resolve: resolve$6, sep } = require("path");
112429
+ const { basename: basename$2, dirname: dirname$6, extname: extname$1, join: join$8, relative, resolve: resolve$6, sep } = require("path");
112363
112430
  const { log } = require_lib$29();
112364
112431
  const defaultRules = Symbol("npm-packlist.rules.default");
112365
112432
  const strictRules = Symbol("npm-packlist.rules.strict");
@@ -112392,7 +112459,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112392
112459
  const normalizePath = (path$46) => path$46.split("\\").join("/");
112393
112460
  const readOutOfTreeIgnoreFiles = (root, rel, result = []) => {
112394
112461
  for (const file of [".npmignore", ".gitignore"]) try {
112395
- const ignoreContent = readFile$4(join$7(root, file), { encoding: "utf8" });
112462
+ const ignoreContent = readFile$4(join$8(root, file), { encoding: "utf8" });
112396
112463
  result.push(ignoreContent);
112397
112464
  break;
112398
112465
  } catch (err) {
@@ -112401,8 +112468,8 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112401
112468
  }
112402
112469
  if (!rel) return result;
112403
112470
  const firstRel = rel.split(sep, 1)[0];
112404
- const newRoot = join$7(root, firstRel);
112405
- return readOutOfTreeIgnoreFiles(newRoot, relative(newRoot, join$7(root, rel)), result);
112471
+ const newRoot = join$8(root, firstRel);
112472
+ return readOutOfTreeIgnoreFiles(newRoot, relative(newRoot, join$8(root, rel)), result);
112406
112473
  };
112407
112474
  var PackWalker = class PackWalker extends IgnoreWalker {
112408
112475
  constructor(tree, opts) {
@@ -112469,7 +112536,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112469
112536
  let ignoreFiles = null;
112470
112537
  if (this.tree.workspaces) {
112471
112538
  const workspaceDirs = [...this.tree.workspaces.values()].map((dir) => dir.replace(/\\/g, "/"));
112472
- const entryPath = join$7(this.path, entry).replace(/\\/g, "/");
112539
+ const entryPath = join$8(this.path, entry).replace(/\\/g, "/");
112473
112540
  if (workspaceDirs.includes(entryPath)) ignoreFiles = [
112474
112541
  defaultRules,
112475
112542
  "package.json",
@@ -112529,7 +112596,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112529
112596
  if (file.endsWith("/*")) file += "*";
112530
112597
  const inverse = `!${file}`;
112531
112598
  try {
112532
- const stat = lstat$1(join$7(this.path, file.replace(/^!+/, "")).replace(/\\/g, "/"));
112599
+ const stat = lstat$1(join$8(this.path, file.replace(/^!+/, "")).replace(/\\/g, "/"));
112533
112600
  if (stat.isFile()) {
112534
112601
  strict.unshift(inverse);
112535
112602
  this.requiredFiles.push(file.startsWith("/") ? file.slice(1) : file);
@@ -112586,7 +112653,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112586
112653
  walker.start();
112587
112654
  });
112588
112655
  const relativeFrom = relative(this.root, walker.path);
112589
- for (const file of bundled) this.result.add(join$7(relativeFrom, file).replace(/\\/g, "/"));
112656
+ for (const file of bundled) this.result.add(join$8(relativeFrom, file).replace(/\\/g, "/"));
112590
112657
  }
112591
112658
  }
112592
112659
  };
@@ -123787,7 +123854,7 @@ var require_auth = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
123787
123854
  //#endregion
123788
123855
  //#region ../../node_modules/make-fetch-happen/lib/options.js
123789
123856
  var require_options$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
123790
- const dns$2 = require("dns");
123857
+ const dns$3 = require("dns");
123791
123858
  const conditionalHeaders = [
123792
123859
  "if-modified-since",
123793
123860
  "if-none-match",
@@ -123812,7 +123879,7 @@ var require_options$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
123812
123879
  };
123813
123880
  options.dns = {
123814
123881
  ttl: 300 * 1e3,
123815
- lookup: dns$2.lookup,
123882
+ lookup: dns$3.lookup,
123816
123883
  ...options.dns
123817
123884
  };
123818
123885
  options.cache = options.cache || "default";
@@ -125229,9 +125296,9 @@ var require_key$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
125229
125296
  //#region ../../node_modules/@npmcli/agent/lib/dns.js
125230
125297
  var require_dns = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
125231
125298
  const { LRUCache } = require_index_min$5();
125232
- const dns$1 = require("dns");
125299
+ const dns$2 = require("dns");
125233
125300
  const cache = new LRUCache({ max: 50 });
125234
- const getOptions = ({ family = 0, hints = dns$1.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$1.lookup }) => ({
125301
+ const getOptions = ({ family = 0, hints = dns$2.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$2.lookup }) => ({
125235
125302
  hints,
125236
125303
  lookup: (hostname, ...args) => {
125237
125304
  const callback = args.pop();
@@ -130270,7 +130337,7 @@ var require_dist$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
130270
130337
  const socks_1 = require_build$1();
130271
130338
  const agent_base_1 = require_dist$12();
130272
130339
  const debug_1 = __importDefault(require_src$1());
130273
- const dns = __importStar(require("dns"));
130340
+ const dns$1 = __importStar(require("dns"));
130274
130341
  const net$1 = __importStar(require("net"));
130275
130342
  const tls$1 = __importStar(require("tls"));
130276
130343
  const url_1$1 = require("url");
@@ -130342,7 +130409,7 @@ var require_dist$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports) => {
130342
130409
  const { shouldLookup, proxy, timeout } = this;
130343
130410
  if (!opts.host) throw new Error("No `host` defined!");
130344
130411
  let { host } = opts;
130345
- const { port, lookup: lookupFn = dns.lookup } = opts;
130412
+ const { port, lookup: lookupFn = dns$1.lookup } = opts;
130346
130413
  if (shouldLookup) host = await new Promise((resolve, reject) => {
130347
130414
  lookupFn(host, {}, (err, res) => {
130348
130415
  if (err) reject(err);
@@ -151071,8 +151138,6 @@ const sendStartupProgress = (message) => {
151071
151138
  };
151072
151139
  //#endregion
151073
151140
  //#region ../../packages/core-node/src/utils/remote.ts
151074
- const DEFAULT_NODE_VERSION = "24.14.1";
151075
- const DEFAULT_PNPM_VERSION = "10.12.0";
151076
151141
  function isPackageComplete(packageDir) {
151077
151142
  return (0, node_fs.existsSync)((0, node_path.join)(packageDir, "package.json"));
151078
151143
  }
@@ -151113,6 +151178,20 @@ async function withLock(key, fn) {
151113
151178
  activeOperations.set(key, promise);
151114
151179
  return promise;
151115
151180
  }
151181
+ let isOnlineCached = null;
151182
+ let lastCheckTime = 0;
151183
+ async function isOnline() {
151184
+ const now = Date.now();
151185
+ if (isOnlineCached !== null && now - lastCheckTime < 1e4) return isOnlineCached;
151186
+ try {
151187
+ await Promise.race([node_dns_promises.default.lookup("registry.npmjs.org"), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("timeout")), 1500))]);
151188
+ isOnlineCached = true;
151189
+ } catch {
151190
+ isOnlineCached = false;
151191
+ }
151192
+ lastCheckTime = now;
151193
+ return isOnlineCached;
151194
+ }
151116
151195
  /**
151117
151196
  * Robust utility to fetch, cache, and resolve an NPM package.
151118
151197
  * Centralized in core-node to avoid circular dependencies.
@@ -151139,7 +151218,15 @@ async function fetchPackage(packageName, versionOrRange, options) {
151139
151218
  if (resolvedVersionOrRange === "local") resolvedVersionOrRange = "latest";
151140
151219
  console.log(`[Fetcher] Resolving ${packageName}@${resolvedVersionOrRange || "latest"}...`);
151141
151220
  const resolveStart = Date.now();
151142
- try {
151221
+ if (!await isOnline()) {
151222
+ console.warn(`[Fetcher] ${packageName}: offline mode detected (${Date.now() - resolveStart}ms), trying local fallback...`);
151223
+ const fallbackStart = Date.now();
151224
+ const fallbackVersion = await tryLocalFallback(resolvedVersionOrRange, /* @__PURE__ */ new Error("Offline"), baseDir, packageName);
151225
+ if (fallbackVersion) {
151226
+ resolvedVersion = fallbackVersion;
151227
+ console.log(`[Fetcher] ${packageName}: Resolved to local fallback ${resolvedVersion} (${Date.now() - fallbackStart}ms)`);
151228
+ } else throw new Error(`Offline and no local fallback version available for ${packageName}`);
151229
+ } else try {
151143
151230
  const cachePath = (0, node_path.join)(ctx.userDataPath, "cache", "pacote");
151144
151231
  let packumentPromise = packumentRequests.get(packageName);
151145
151232
  if (!packumentPromise) {
@@ -151149,7 +151236,16 @@ async function fetchPackage(packageName, versionOrRange, options) {
151149
151236
  const packument = await packumentPromise;
151150
151237
  const versions = Object.keys(packument.versions);
151151
151238
  const range = resolvedVersionOrRange || "latest";
151152
- const foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
151239
+ let foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
151240
+ if (range === "latest" && ctx.releaseTag && ctx.releaseTag !== "latest") {
151241
+ const releaseTagVersion = packument["dist-tags"]?.[ctx.releaseTag];
151242
+ if (releaseTagVersion && import_semver.default.valid(releaseTagVersion)) {
151243
+ if (!foundVersion || import_semver.default.valid(foundVersion) && import_semver.default.gte(releaseTagVersion, foundVersion)) {
151244
+ console.log(`[Fetcher] Using release tag "${ctx.releaseTag}" (${releaseTagVersion}) instead of "latest" (${foundVersion || "none"}) for ${packageName}`);
151245
+ foundVersion = releaseTagVersion;
151246
+ } else if (foundVersion) console.warn(`[Fetcher] Tag "${ctx.releaseTag}" (${releaseTagVersion}) is older than "latest" (${foundVersion}) for ${packageName}, keeping "latest"`);
151247
+ }
151248
+ }
151153
151249
  if (!foundVersion) throw new Error(`Package ${packageName}@${range} not found on npm (available tags: ${Object.keys(packument["dist-tags"] || {}).join(", ")})`);
151154
151250
  resolvedVersion = foundVersion;
151155
151251
  console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm (${Date.now() - resolveStart}ms)`);
@@ -151264,7 +151360,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
151264
151360
  const extension = isWindows ? "zip" : "tar.gz";
151265
151361
  const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
151266
151362
  const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
151267
- const tempDir = await generateTempFolder((0, node_os.tmpdir)());
151363
+ const tempDir = await context.createTempFolder("node-download-");
151268
151364
  const archivePath = (0, node_path.join)(tempDir, fileName);
151269
151365
  sendStartupProgress(`Downloading Node.js v${version}...`);
151270
151366
  console.log(`Downloading Node.js from ${downloadUrl}...`);
@@ -151466,7 +151562,7 @@ async function resolveEntryPoint(packageDir, packageName) {
151466
151562
  }
151467
151563
  //#endregion
151468
151564
  //#region ../../packages/core-node/src/handler-func.ts
151469
- const { join: join$5 } = node_path.default;
151565
+ const { join: join$6 } = node_path.default;
151470
151566
  //#endregion
151471
151567
  //#region ../../packages/core-node/src/handlers/plugins.ts
151472
151568
  const localPluginsMap = /* @__PURE__ */ new Map();
@@ -151492,83 +151588,99 @@ if (isDev && projectRoot) {
151492
151588
  const createActionRunner = (runner) => runner;
151493
151589
  //#endregion
151494
151590
  //#region src/index.ts
151495
- var src_default = createNodeDefinition({ nodes: [{
151496
- node: createAction({
151497
- id: "poki-upload",
151498
- name: "Upload to Poki.io",
151499
- description: "",
151500
- icon: "",
151501
- displayString: "`Upload ${fmt.param(params['input-folder'], 'primary', 'No path selected')} to ${fmt.param(params['project'], 'primary', 'No project')} poki game (${fmt.param(params['name'], 'primary', 'No version name')})`",
151502
- meta: {},
151503
- params: {
151504
- "input-folder": createPathParam("", {
151505
- required: true,
151506
- label: "Folder to Upload",
151507
- control: {
151508
- type: "path",
151509
- options: { properties: ["openDirectory"] }
151510
- }
151511
- }),
151512
- project: createStringParam("", {
151513
- required: true,
151514
- label: "Project",
151515
- description: "This is you Poki game id"
151516
- }),
151517
- name: createStringParam("", {
151518
- required: true,
151519
- label: "Version name",
151520
- description: "This is the name of the version"
151521
- }),
151522
- notes: createStringParam("", {
151523
- required: true,
151524
- label: "Version notes",
151525
- description: "These are notes you want to specify with your version"
151526
- })
151527
- },
151528
- outputs: {}
151529
- }),
151530
- runner: createActionRunner(async ({ log, inputs, paths, abortSignal, cwd, context }) => {
151531
- const { node, thirdparty, pnpm } = paths;
151532
- const { packageDir: pokiDir } = await fetchPackage("@poki/cli", "0.1.19", {
151533
- context,
151534
- installDeps: true
151535
- });
151536
- const poki = (0, node_path.join)(pokiDir, "bin", "index.js");
151537
- const dist = (0, node_path.join)(cwd, "dist");
151538
- await (0, node_fs_promises.mkdir)(dist, { recursive: true });
151539
- await (0, node_fs_promises.cp)(inputs["input-folder"], dist, { recursive: true });
151540
- const pokiJsonPath = (0, node_path.join)(cwd, "poki.json");
151541
- console.log("pokiJsonPath", pokiJsonPath);
151542
- await (0, node_fs_promises.writeFile)(pokiJsonPath, JSON.stringify({
151543
- game_id: inputs.project,
151544
- build_dir: "dist"
151545
- }, void 0, 2), "utf-8");
151546
- log("process.env.MSW_BRIDGE_PORT", process.env.MSW_BRIDGE_PORT);
151547
- log("process.env.NODE_OPTIONS", process.env.NODE_OPTIONS);
151548
- await runWithLiveLogs(node, [
151549
- poki,
151550
- "upload",
151551
- "--name",
151552
- inputs.name,
151553
- "--notes",
151554
- inputs.notes
151555
- ], {
151556
- cwd,
151557
- env: {
151558
- ...process.env,
151559
- PATH: `${(0, node_path.dirname)(node)}${node_path.delimiter}${process.env.PATH}`
151560
- },
151561
- cancelSignal: abortSignal
151562
- }, log, {
151563
- onStderr(data, subprocess) {
151564
- log(data);
151591
+ var src_default = createNodeDefinition({
151592
+ nodes: [{
151593
+ node: createAction({
151594
+ id: "poki-upload",
151595
+ name: "Upload to Poki.io",
151596
+ description: "",
151597
+ icon: "",
151598
+ displayString: "`Upload ${fmt.param(params['input-folder'], 'primary', 'No path selected')} to ${fmt.param(params['project'], 'primary', 'No project')} poki game (${fmt.param(params['name'], 'primary', 'No version name')})`",
151599
+ meta: {},
151600
+ params: {
151601
+ "input-folder": createPathParam("", {
151602
+ required: true,
151603
+ label: "Folder to Upload",
151604
+ control: {
151605
+ type: "path",
151606
+ options: { properties: ["openDirectory"] }
151607
+ }
151608
+ }),
151609
+ project: createStringParam("", {
151610
+ required: true,
151611
+ label: "Project",
151612
+ description: "This is you Poki game id"
151613
+ }),
151614
+ name: createStringParam("", {
151615
+ required: true,
151616
+ label: "Version name",
151617
+ description: "This is the name of the version"
151618
+ }),
151619
+ notes: createStringParam("", {
151620
+ required: true,
151621
+ label: "Version notes",
151622
+ description: "These are notes you want to specify with your version"
151623
+ })
151565
151624
  },
151566
- onStdout(data, subprocess) {
151567
- log(data);
151568
- }
151569
- });
151570
- log("Uploaded to poki");
151571
- })
151572
- }] });
151625
+ outputs: {}
151626
+ }),
151627
+ runner: createActionRunner(async ({ log, inputs, paths, abortSignal, cwd, context }) => {
151628
+ const { node, thirdparty, pnpm } = paths;
151629
+ const { packageDir: pokiDir } = await fetchPackage("@poki/cli", "0.1.19", {
151630
+ context,
151631
+ installDeps: true
151632
+ });
151633
+ const poki = (0, node_path.join)(pokiDir, "bin", "index.js");
151634
+ const dist = (0, node_path.join)(cwd, "dist");
151635
+ await (0, node_fs_promises.mkdir)(dist, { recursive: true });
151636
+ await (0, node_fs_promises.cp)(inputs["input-folder"], dist, { recursive: true });
151637
+ const pokiJsonPath = (0, node_path.join)(cwd, "poki.json");
151638
+ console.log("pokiJsonPath", pokiJsonPath);
151639
+ await (0, node_fs_promises.writeFile)(pokiJsonPath, JSON.stringify({
151640
+ game_id: inputs.project,
151641
+ build_dir: "dist"
151642
+ }, void 0, 2), "utf-8");
151643
+ log("process.env.MSW_BRIDGE_PORT", process.env.MSW_BRIDGE_PORT);
151644
+ log("process.env.NODE_OPTIONS", process.env.NODE_OPTIONS);
151645
+ await runWithLiveLogs(node, [
151646
+ poki,
151647
+ "upload",
151648
+ "--name",
151649
+ inputs.name,
151650
+ "--notes",
151651
+ inputs.notes
151652
+ ], {
151653
+ cwd,
151654
+ env: {
151655
+ ...process.env,
151656
+ PATH: `${(0, node_path.dirname)(node)}${node_path.delimiter}${process.env.PATH}`
151657
+ },
151658
+ cancelSignal: abortSignal
151659
+ }, log, {
151660
+ onStderr(data, subprocess) {
151661
+ log(data);
151662
+ },
151663
+ onStdout(data, subprocess) {
151664
+ log(data);
151665
+ }
151666
+ });
151667
+ log("Uploaded to poki");
151668
+ })
151669
+ }],
151670
+ integrations: [{
151671
+ name: "Poki Developer Profile",
151672
+ fields: [{
151673
+ key: "gameId",
151674
+ label: "Game ID",
151675
+ type: "text",
151676
+ placeholder: "e.g., poki-game-id"
151677
+ }, {
151678
+ key: "apiKey",
151679
+ label: "Developer Token",
151680
+ type: "password",
151681
+ placeholder: "Poki Developer Token"
151682
+ }]
151683
+ }]
151684
+ });
151573
151685
  //#endregion
151574
151686
  module.exports = src_default;