@pipelab/plugin-itch 1.0.0-beta.13 → 1.0.0-beta.15

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
@@ -1604,6 +1604,56 @@ function literal(literal_, message) {
1604
1604
  }
1605
1605
  };
1606
1606
  }
1607
+ function looseObject(entries, message) {
1608
+ return {
1609
+ kind: "schema",
1610
+ type: "loose_object",
1611
+ reference: looseObject,
1612
+ expects: "Object",
1613
+ async: false,
1614
+ entries,
1615
+ message,
1616
+ _run(dataset, config2) {
1617
+ const input = dataset.value;
1618
+ if (input && typeof input === "object") {
1619
+ dataset.typed = true;
1620
+ dataset.value = {};
1621
+ for (const key in this.entries) {
1622
+ const value2 = input[key];
1623
+ const valueDataset = this.entries[key]._run({
1624
+ typed: false,
1625
+ value: value2
1626
+ }, config2);
1627
+ if (valueDataset.issues) {
1628
+ const pathItem = {
1629
+ type: "object",
1630
+ origin: "value",
1631
+ input,
1632
+ key,
1633
+ value: value2
1634
+ };
1635
+ for (const issue of valueDataset.issues) {
1636
+ if (issue.path) issue.path.unshift(pathItem);
1637
+ else issue.path = [pathItem];
1638
+ dataset.issues?.push(issue);
1639
+ }
1640
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1641
+ if (config2.abortEarly) {
1642
+ dataset.typed = false;
1643
+ break;
1644
+ }
1645
+ }
1646
+ if (!valueDataset.typed) dataset.typed = false;
1647
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1648
+ }
1649
+ if (!dataset.issues || !config2.abortEarly) {
1650
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1651
+ }
1652
+ } else _addIssue(this, "type", dataset, config2);
1653
+ return dataset;
1654
+ }
1655
+ };
1656
+ }
1607
1657
  function number(message) {
1608
1658
  return {
1609
1659
  kind: "schema",
@@ -2141,6 +2191,18 @@ settingsMigratorInternal.createMigrations({
2141
2191
  })
2142
2192
  ]
2143
2193
  });
2194
+ const connectionsMigratorInternal = createMigrator();
2195
+ const defaultConnections = connectionsMigratorInternal.createDefault({
2196
+ version: "1.0.0",
2197
+ connections: []
2198
+ });
2199
+ connectionsMigratorInternal.createMigrations({
2200
+ defaultValue: defaultConnections,
2201
+ migrations: [createMigration({
2202
+ version: "1.0.0",
2203
+ up: finalVersion
2204
+ })]
2205
+ });
2144
2206
  const fileRepoMigratorInternal = createMigrator();
2145
2207
  const defaultFileRepo = fileRepoMigratorInternal.createDefault({
2146
2208
  version: "2.0.0",
@@ -2302,11 +2364,51 @@ const LEGACY_ID_MAP = {
2302
2364
  };
2303
2365
  const getStrictPluginId = (pluginId) => {
2304
2366
  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;
2367
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2309
2368
  };
2369
+ //#endregion
2370
+ //#region ../../packages/shared/src/save-location.ts
2371
+ const SaveLocationInternalValidator = object({
2372
+ id: string(),
2373
+ project: string(),
2374
+ lastModified: string(),
2375
+ type: literal("internal"),
2376
+ configName: string()
2377
+ });
2378
+ const SaveLocationValidator = union([
2379
+ object({
2380
+ id: string(),
2381
+ project: string(),
2382
+ path: string(),
2383
+ lastModified: string(),
2384
+ type: literal("external"),
2385
+ summary: object({
2386
+ plugins: array(string()),
2387
+ name: string(),
2388
+ description: string()
2389
+ })
2390
+ }),
2391
+ SaveLocationInternalValidator,
2392
+ object({
2393
+ id: string(),
2394
+ project: string(),
2395
+ type: literal("pipelab-cloud")
2396
+ })
2397
+ ]);
2398
+ object({
2399
+ version: literal("1.0.0"),
2400
+ data: optional(record(string(), SaveLocationValidator), {})
2401
+ });
2402
+ const FileRepoProjectValidatorV2$1 = object({
2403
+ id: string(),
2404
+ name: string(),
2405
+ description: string()
2406
+ });
2407
+ object({
2408
+ version: literal("2.0.0"),
2409
+ projects: array(FileRepoProjectValidatorV2$1),
2410
+ pipelines: optional(array(SaveLocationValidator), [])
2411
+ });
2310
2412
  object({
2311
2413
  cacheFolder: string(),
2312
2414
  theme: union([literal("light"), literal("dark")]),
@@ -2458,6 +2560,17 @@ object({
2458
2560
  })),
2459
2561
  isInternalMigrationBannerClosed: optional(boolean(), false)
2460
2562
  });
2563
+ const ConnectionValidator = looseObject({
2564
+ id: string(),
2565
+ pluginName: string(),
2566
+ name: string(),
2567
+ createdAt: string(),
2568
+ isDefault: boolean()
2569
+ });
2570
+ object({
2571
+ version: literal("1.0.0"),
2572
+ connections: array(ConnectionValidator)
2573
+ });
2461
2574
  //#endregion
2462
2575
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
2463
2576
  const prettyLogStyles = {
@@ -2978,7 +3091,7 @@ const useLogger = () => {
2978
3091
  const OriginValidator = object({
2979
3092
  pluginId: string(),
2980
3093
  nodeId: string(),
2981
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
3094
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
2982
3095
  });
2983
3096
  const BlockActionValidatorV1 = object({
2984
3097
  type: literal("action"),
@@ -2991,7 +3104,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
2991
3104
  const BlockActionValidatorV3 = object({
2992
3105
  type: literal("action"),
2993
3106
  uid: string(),
2994
- name: pipe(optional(string()), description("A custom name provided by the user")),
3107
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
2995
3108
  disabled: optional(boolean()),
2996
3109
  params: record(string(), object({
2997
3110
  editor: EditorParamValidatorV3,
@@ -45291,35 +45404,6 @@ const createPathParam = (value, definition) => {
45291
45404
  };
45292
45405
  };
45293
45406
  //#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
45407
  //#region ../../packages/shared/src/websocket.types.ts
45324
45408
  var WebSocketError = class extends Error {
45325
45409
  constructor(message, code, requestId) {
@@ -45336,20 +45420,6 @@ object({
45336
45420
  version: literal("1.0.0"),
45337
45421
  data: optional(record(string(), SaveLocationValidator), {})
45338
45422
  });
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
45423
  const FileRepoProjectValidatorV2 = object({
45354
45424
  id: string(),
45355
45425
  name: string(),
@@ -45361,8 +45431,12 @@ object({
45361
45431
  pipelines: optional(array(SaveLocationValidator), [])
45362
45432
  });
45363
45433
  //#endregion
45434
+ //#region ../../packages/constants/src/index.ts
45435
+ const websocketPort = 33753;
45436
+ //#endregion
45364
45437
  //#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();
45438
+ const metaUrl = require("url").pathToFileURL(__filename).href;
45439
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? (0, node_path.dirname)((0, node_url.fileURLToPath)(metaUrl)) : process.cwd();
45366
45440
  const isDev = process.env.NODE_ENV === "development";
45367
45441
  /**
45368
45442
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
@@ -48934,9 +49008,6 @@ const useAPI = () => {
48934
49008
  };
48935
49009
  };
48936
49010
  //#endregion
48937
- //#region ../../packages/constants/src/index.ts
48938
- const websocketPort = 33753;
48939
- //#endregion
48940
49011
  //#region ../../packages/core-node/src/websocket-server.ts
48941
49012
  var WebSocketServer = class {
48942
49013
  wss = null;
@@ -59543,17 +59614,17 @@ var require_path_arg = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
59543
59614
  //#endregion
59544
59615
  //#region ../../node_modules/mkdirp/lib/find-made.js
59545
59616
  var require_find_made = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
59546
- const { dirname: dirname$15 } = require("path");
59617
+ const { dirname: dirname$14 } = require("path");
59547
59618
  const findMade = (opts, parent, path$83 = void 0) => {
59548
59619
  if (path$83 === parent) return Promise.resolve();
59549
- return opts.statAsync(parent).then((st) => st.isDirectory() ? path$83 : void 0, (er) => er.code === "ENOENT" ? findMade(opts, dirname$15(parent), parent) : void 0);
59620
+ return opts.statAsync(parent).then((st) => st.isDirectory() ? path$83 : void 0, (er) => er.code === "ENOENT" ? findMade(opts, dirname$14(parent), parent) : void 0);
59550
59621
  };
59551
59622
  const findMadeSync = (opts, parent, path$84 = void 0) => {
59552
59623
  if (path$84 === parent) return void 0;
59553
59624
  try {
59554
59625
  return opts.statSync(parent).isDirectory() ? path$84 : void 0;
59555
59626
  } catch (er) {
59556
- return er.code === "ENOENT" ? findMadeSync(opts, dirname$15(parent), parent) : void 0;
59627
+ return er.code === "ENOENT" ? findMadeSync(opts, dirname$14(parent), parent) : void 0;
59557
59628
  }
59558
59629
  };
59559
59630
  module.exports = {
@@ -59564,10 +59635,10 @@ var require_find_made = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
59564
59635
  //#endregion
59565
59636
  //#region ../../node_modules/mkdirp/lib/mkdirp-manual.js
59566
59637
  var require_mkdirp_manual = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
59567
- const { dirname: dirname$14 } = require("path");
59638
+ const { dirname: dirname$13 } = require("path");
59568
59639
  const mkdirpManual = (path$81, opts, made) => {
59569
59640
  opts.recursive = false;
59570
- const parent = dirname$14(path$81);
59641
+ const parent = dirname$13(path$81);
59571
59642
  if (parent === path$81) return opts.mkdirAsync(path$81, opts).catch((er) => {
59572
59643
  if (er.code !== "EISDIR") throw er;
59573
59644
  });
@@ -59583,7 +59654,7 @@ var require_mkdirp_manual = /* @__PURE__ */ require_chunk.__commonJSMin(((export
59583
59654
  });
59584
59655
  };
59585
59656
  const mkdirpManualSync = (path$82, opts, made) => {
59586
- const parent = dirname$14(path$82);
59657
+ const parent = dirname$13(path$82);
59587
59658
  opts.recursive = false;
59588
59659
  if (parent === path$82) try {
59589
59660
  return opts.mkdirSync(path$82, opts);
@@ -59612,12 +59683,12 @@ var require_mkdirp_manual = /* @__PURE__ */ require_chunk.__commonJSMin(((export
59612
59683
  //#endregion
59613
59684
  //#region ../../node_modules/mkdirp/lib/mkdirp-native.js
59614
59685
  var require_mkdirp_native = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
59615
- const { dirname: dirname$13 } = require("path");
59686
+ const { dirname: dirname$12 } = require("path");
59616
59687
  const { findMade, findMadeSync } = require_find_made();
59617
59688
  const { mkdirpManual, mkdirpManualSync } = require_mkdirp_manual();
59618
59689
  const mkdirpNative = (path$79, opts) => {
59619
59690
  opts.recursive = true;
59620
- if (dirname$13(path$79) === path$79) return opts.mkdirAsync(path$79, opts);
59691
+ if (dirname$12(path$79) === path$79) return opts.mkdirAsync(path$79, opts);
59621
59692
  return findMade(opts, path$79).then((made) => opts.mkdirAsync(path$79, opts).then(() => made).catch((er) => {
59622
59693
  if (er.code === "ENOENT") return mkdirpManual(path$79, opts);
59623
59694
  else throw er;
@@ -59625,7 +59696,7 @@ var require_mkdirp_native = /* @__PURE__ */ require_chunk.__commonJSMin(((export
59625
59696
  };
59626
59697
  const mkdirpNativeSync = (path$80, opts) => {
59627
59698
  opts.recursive = true;
59628
- if (dirname$13(path$80) === path$80) return opts.mkdirSync(path$80, opts);
59699
+ if (dirname$12(path$80) === path$80) return opts.mkdirSync(path$80, opts);
59629
59700
  const made = findMadeSync(opts, path$80);
59630
59701
  try {
59631
59702
  opts.mkdirSync(path$80, opts);
@@ -98808,11 +98879,11 @@ var require_is = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module)
98808
98879
  //#region ../../node_modules/@npmcli/git/lib/find.js
98809
98880
  var require_find = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
98810
98881
  const is = require_is();
98811
- const { dirname: dirname$11 } = require("path");
98882
+ const { dirname: dirname$10 } = require("path");
98812
98883
  module.exports = async ({ cwd = process.cwd(), root } = {}) => {
98813
98884
  while (true) {
98814
98885
  if (await is({ cwd })) return cwd;
98815
- const next = dirname$11(cwd);
98886
+ const next = dirname$10(cwd);
98816
98887
  if (cwd === root || cwd === next) return null;
98817
98888
  cwd = next;
98818
98889
  }
@@ -99336,7 +99407,7 @@ var require_sort$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
99336
99407
  //#endregion
99337
99408
  //#region ../../node_modules/@npmcli/package-json/lib/index.js
99338
99409
  var require_lib$18 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
99339
- const { readFile: readFile$8, writeFile: writeFile$4 } = require("node:fs/promises");
99410
+ const { readFile: readFile$8, writeFile: writeFile$3 } = require("node:fs/promises");
99340
99411
  const { resolve: resolve$11 } = require("node:path");
99341
99412
  const parseJSON = require_lib$30();
99342
99413
  const updateDeps = require_update_dependencies();
@@ -99509,7 +99580,7 @@ var require_lib$18 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
99509
99580
  const content = sort ? packageSort(rest) : rest;
99510
99581
  const fileContent = `${JSON.stringify(content, null, format)}\n`.replace(/\n/g, eol);
99511
99582
  if (fileContent.trim() !== this.#readFileContent.trim()) {
99512
- const written = await writeFile$4(this.filename, fileContent);
99583
+ const written = await writeFile$3(this.filename, fileContent);
99513
99584
  this.#readFileContent = fileContent;
99514
99585
  return written;
99515
99586
  }
@@ -100607,8 +100678,8 @@ var require_errors$3 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100607
100678
  var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
100608
100679
  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();
100609
100680
  const { constants: { errno: { EEXIST, EISDIR, EINVAL, ENOTDIR } } } = require("os");
100610
- const { chmod: chmod$3, copyFile, lstat: lstat$2, mkdir: mkdir$9, readdir: readdir$6, readlink, stat: stat$5, symlink, unlink, utimes } = require("fs/promises");
100611
- const { dirname: dirname$10, isAbsolute: isAbsolute$2, join: join$12, parse, resolve: resolve$10, sep: sep$2, toNamespacedPath } = require("path");
100681
+ const { chmod: chmod$3, copyFile, lstat: lstat$2, mkdir: mkdir$8, readdir: readdir$6, readlink, stat: stat$5, symlink, unlink, utimes } = require("fs/promises");
100682
+ const { dirname: dirname$9, isAbsolute: isAbsolute$2, join: join$12, parse, resolve: resolve$10, sep: sep$2, toNamespacedPath } = require("path");
100612
100683
  const { fileURLToPath } = require("url");
100613
100684
  const defaultOptions = {
100614
100685
  dereference: false,
@@ -100682,9 +100753,9 @@ var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100682
100753
  })]);
100683
100754
  }
100684
100755
  async function checkParentDir(destStat, src, dest, opts) {
100685
- const destParent = dirname$10(dest);
100756
+ const destParent = dirname$9(dest);
100686
100757
  if (await pathExists(destParent)) return getStatsForCopy(destStat, src, dest, opts);
100687
- await mkdir$9(destParent, { recursive: true });
100758
+ await mkdir$8(destParent, { recursive: true });
100688
100759
  return getStatsForCopy(destStat, src, dest, opts);
100689
100760
  }
100690
100761
  function pathExists(dest) {
@@ -100695,8 +100766,8 @@ var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100695
100766
  );
100696
100767
  }
100697
100768
  async function checkParentPaths(src, srcStat, dest) {
100698
- const srcParent = resolve$10(dirname$10(src));
100699
- const destParent = resolve$10(dirname$10(dest));
100769
+ const srcParent = resolve$10(dirname$9(src));
100770
+ const destParent = resolve$10(dirname$9(dest));
100700
100771
  if (destParent === srcParent || destParent === parse(destParent).root) return;
100701
100772
  let destStat;
100702
100773
  try {
@@ -100809,7 +100880,7 @@ var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100809
100880
  return copyDir(src, dest, opts);
100810
100881
  }
100811
100882
  async function mkDirAndCopy(srcMode, src, dest, opts) {
100812
- await mkdir$9(dest);
100883
+ await mkdir$8(dest);
100813
100884
  await copyDir(src, dest, opts);
100814
100885
  return setDestMode(dest, srcMode);
100815
100886
  }
@@ -100825,7 +100896,7 @@ var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100825
100896
  }
100826
100897
  async function onLink(destStat, src, dest) {
100827
100898
  let resolvedSrc = await readlink(src);
100828
- if (!isAbsolute$2(resolvedSrc)) resolvedSrc = resolve$10(dirname$10(src), resolvedSrc);
100899
+ if (!isAbsolute$2(resolvedSrc)) resolvedSrc = resolve$10(dirname$9(src), resolvedSrc);
100829
100900
  if (!destStat) return symlink(resolvedSrc, dest);
100830
100901
  let resolvedDest;
100831
100902
  try {
@@ -100836,7 +100907,7 @@ var require_polyfill = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
100836
100907
  // istanbul ignore next: should not be possible
100837
100908
  throw err;
100838
100909
  }
100839
- if (!isAbsolute$2(resolvedDest)) resolvedDest = resolve$10(dirname$10(dest), resolvedDest);
100910
+ if (!isAbsolute$2(resolvedDest)) resolvedDest = resolve$10(dirname$9(dest), resolvedDest);
100840
100911
  if (isSrcSubdir(resolvedSrc, resolvedDest)) throw new ERR_FS_CP_EINVAL({
100841
100912
  message: `cannot copy ${resolvedSrc} to a subdirectory of self ${resolvedDest}`,
100842
100913
  path: dest,
@@ -100884,11 +100955,11 @@ var require_cp = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module)
100884
100955
  var require_with_temp_dir = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
100885
100956
  const { join: join$11, sep: sep$1 } = require("path");
100886
100957
  const getOptions = require_get_options();
100887
- const { mkdir: mkdir$8, mkdtemp: mkdtemp$1, rm: rm$8 } = require("fs/promises");
100958
+ const { mkdir: mkdir$7, mkdtemp, rm: rm$8 } = require("fs/promises");
100888
100959
  const withTempDir = async (root, fn, opts) => {
100889
100960
  const options = getOptions(opts, { copy: ["tmpPrefix"] });
100890
- await mkdir$8(root, { recursive: true });
100891
- const target = await mkdtemp$1(join$11(`${root}${sep$1}`, options.tmpPrefix || ""));
100961
+ await mkdir$7(root, { recursive: true });
100962
+ const target = await mkdtemp(join$11(`${root}${sep$1}`, options.tmpPrefix || ""));
100892
100963
  let err;
100893
100964
  let result;
100894
100965
  try {
@@ -100923,7 +100994,7 @@ var require_readdir_scoped = /* @__PURE__ */ require_chunk.__commonJSMin(((expor
100923
100994
  //#endregion
100924
100995
  //#region ../../node_modules/cacache/node_modules/@npmcli/fs/lib/move-file.js
100925
100996
  var require_move_file = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
100926
- const { dirname: dirname$9, join: join$9, resolve: resolve$9, relative: relative$1, isAbsolute: isAbsolute$1 } = require("path");
100997
+ const { dirname: dirname$8, join: join$9, resolve: resolve$9, relative: relative$1, isAbsolute: isAbsolute$1 } = require("path");
100927
100998
  const fs$12 = require("fs/promises");
100928
100999
  const pathExists = async (path$54) => {
100929
101000
  try {
@@ -100940,7 +101011,7 @@ var require_move_file = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
100940
101011
  ...options
100941
101012
  };
100942
101013
  if (!options.overwrite && await pathExists(destination)) throw new Error(`The destination file exists: ${destination}`);
100943
- await fs$12.mkdir(dirname$9(destination), { recursive: true });
101014
+ await fs$12.mkdir(dirname$8(destination), { recursive: true });
100944
101015
  try {
100945
101016
  await fs$12.rename(source, destination);
100946
101017
  } catch (error) {
@@ -100962,7 +101033,7 @@ var require_move_file = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
100962
101033
  if (isAbsolute$1(target)) target = resolve$9(symDestination, relative$1(symSource, target));
100963
101034
  let targetStat = "file";
100964
101035
  try {
100965
- targetStat = await fs$12.stat(resolve$9(dirname$9(symSource), target));
101036
+ targetStat = await fs$12.stat(resolve$9(dirname$8(symSource), target));
100966
101037
  if (targetStat.isDirectory()) targetStat = "junction";
100967
101038
  } catch {}
100968
101039
  await fs$12.symlink(target, symDestination, targetStat);
@@ -101124,7 +101195,7 @@ var require_path = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module
101124
101195
  //#region ../../node_modules/cacache/lib/entry-index.js
101125
101196
  var require_entry_index = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
101126
101197
  const crypto$1 = require("crypto");
101127
- const { appendFile, mkdir: mkdir$7, readFile: readFile$7, readdir: readdir$4, rm: rm$7, writeFile: writeFile$3 } = require("fs/promises");
101198
+ const { appendFile, mkdir: mkdir$6, readFile: readFile$7, readdir: readdir$4, rm: rm$7, writeFile: writeFile$2 } = require("fs/promises");
101128
101199
  const { Minipass } = require_commonjs$10();
101129
101200
  const path$14 = require("path");
101130
101201
  const ssri = require_lib$17();
@@ -101158,7 +101229,7 @@ var require_entry_index = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
101158
101229
  }).join("\n");
101159
101230
  const setup = async () => {
101160
101231
  const target = tmpName(cache, opts.tmpPrefix);
101161
- await mkdir$7(path$14.dirname(target), { recursive: true });
101232
+ await mkdir$6(path$14.dirname(target), { recursive: true });
101162
101233
  return {
101163
101234
  target,
101164
101235
  moved: false
@@ -101171,8 +101242,8 @@ var require_entry_index = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
101171
101242
  });
101172
101243
  };
101173
101244
  const write = async (tmp) => {
101174
- await writeFile$3(tmp.target, newIndex, { flag: "wx" });
101175
- await mkdir$7(path$14.dirname(bucket), { recursive: true });
101245
+ await writeFile$2(tmp.target, newIndex, { flag: "wx" });
101246
+ await mkdir$6(path$14.dirname(bucket), { recursive: true });
101176
101247
  await moveFile(tmp.target, bucket);
101177
101248
  tmp.moved = true;
101178
101249
  };
@@ -101196,7 +101267,7 @@ var require_entry_index = /* @__PURE__ */ require_chunk.__commonJSMin(((exports,
101196
101267
  metadata
101197
101268
  };
101198
101269
  try {
101199
- await mkdir$7(path$14.dirname(bucket), { recursive: true });
101270
+ await mkdir$6(path$14.dirname(bucket), { recursive: true });
101200
101271
  const stringified = JSON.stringify(entry);
101201
101272
  await appendFile(bucket, `\n${hashEntry(stringified)}\t${stringified}`);
101202
101273
  } catch (err) {
@@ -106039,7 +106110,7 @@ var require_rm = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module)
106039
106110
  //#endregion
106040
106111
  //#region ../../node_modules/cacache/lib/verify.js
106041
106112
  var require_verify$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
106042
- const { mkdir: mkdir$6, readFile: readFile$6, rm: rm$5, stat: stat$4, truncate, writeFile: writeFile$2 } = require("fs/promises");
106113
+ const { mkdir: mkdir$5, readFile: readFile$6, rm: rm$5, stat: stat$4, truncate, writeFile: writeFile$1 } = require("fs/promises");
106043
106114
  const contentPath = require_path();
106044
106115
  const fsm = require_lib$15();
106045
106116
  const glob = require_glob();
@@ -106089,7 +106160,7 @@ var require_verify$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
106089
106160
  }
106090
106161
  async function fixPerms(cache, opts) {
106091
106162
  opts.log.silly("verify", "fixing cache permissions");
106092
- await mkdir$6(cache, { recursive: true });
106163
+ await mkdir$5(cache, { recursive: true });
106093
106164
  return null;
106094
106165
  }
106095
106166
  async function garbageCollect(cache, opts) {
@@ -106228,7 +106299,7 @@ var require_verify$1 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
106228
106299
  async function writeVerifile(cache, opts) {
106229
106300
  const verifile = path$10.join(cache, "_lastverified");
106230
106301
  opts.log.silly("verify", "writing verifile to " + verifile);
106231
- return writeFile$2(verifile, `${Date.now()}`);
106302
+ return writeFile$1(verifile, `${Date.now()}`);
106232
106303
  }
106233
106304
  module.exports.lastRun = lastRun;
106234
106305
  async function lastRun(cache) {
@@ -106779,7 +106850,7 @@ var require_lib$12 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
106779
106850
  var require_lib$11 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
106780
106851
  const bundled = require_lib$12();
106781
106852
  const { readFile: readFile$5, readdir: readdir$3, stat: stat$3 } = require("fs/promises");
106782
- const { resolve: resolve$8, basename: basename$3, dirname: dirname$8 } = require("path");
106853
+ const { resolve: resolve$8, basename: basename$3, dirname: dirname$7 } = require("path");
106783
106854
  const normalizePackageBin = require_lib$21();
106784
106855
  const readPackage = ({ path: path$49, packageJsonCache }) => packageJsonCache.has(path$49) ? Promise.resolve(packageJsonCache.get(path$49)) : readFile$5(path$49).then((json) => {
106785
106856
  const pkg = normalizePackageBin(JSON.parse(json));
@@ -106818,9 +106889,9 @@ var require_lib$11 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
106818
106889
  }));
106819
106890
  if (pkg) {
106820
106891
  if (pkg.bin) {
106821
- const dir = dirname$8(path$51);
106892
+ const dir = dirname$7(path$51);
106822
106893
  const scope = basename$3(dir);
106823
- const nm = /^@.+/.test(scope) ? dirname$8(dir) : dir;
106894
+ const nm = /^@.+/.test(scope) ? dirname$7(dir) : dir;
106824
106895
  const binFiles = [];
106825
106896
  Object.keys(pkg.bin).forEach((b) => {
106826
106897
  const base = resolve$8(nm, ".bin", b);
@@ -110487,9 +110558,9 @@ var require_protected = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, m
110487
110558
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110488
110559
  var require_cache_dir = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
110489
110560
  const { resolve: resolve$7 } = require("node:path");
110490
- const { tmpdir: tmpdir$3, homedir } = require("node:os");
110561
+ const { tmpdir, homedir } = require("node:os");
110491
110562
  module.exports = (fakePlatform = false) => {
110492
- const temp = tmpdir$3();
110563
+ const temp = tmpdir();
110493
110564
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110494
110565
  const home = homedir() || resolve$7(temp, "npm-" + uidOrPid);
110495
110566
  const platform = fakePlatform || process.platform;
@@ -112311,7 +112382,7 @@ var require_lib$10 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modu
112311
112382
  var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
112312
112383
  const { Walker: IgnoreWalker } = require_lib$10();
112313
112384
  const { lstatSync: lstat$1, readFileSync: readFile$4 } = require("fs");
112314
- const { basename: basename$2, dirname: dirname$7, extname: extname$1, join: join$8, relative, resolve: resolve$6, sep } = require("path");
112385
+ const { basename: basename$2, dirname: dirname$6, extname: extname$1, join: join$8, relative, resolve: resolve$6, sep } = require("path");
112315
112386
  const { log } = require_lib$29();
112316
112387
  const defaultRules = Symbol("npm-packlist.rules.default");
112317
112388
  const strictRules = Symbol("npm-packlist.rules.strict");
@@ -112383,7 +112454,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112383
112454
  const workspaces = options.workspaces.map((ws) => normalizePath(ws));
112384
112455
  // istanbul ignore else - this does nothing unless we need it to
112385
112456
  if (path$47 !== prefix && workspaces.includes(path$47)) {
112386
- const relpath = relative(options.prefix, dirname$7(options.path));
112457
+ const relpath = relative(options.prefix, dirname$6(options.path));
112387
112458
  additionalDefaults.push(...readOutOfTreeIgnoreFiles(options.prefix, relpath));
112388
112459
  } else if (path$47 === prefix) additionalDefaults.push(...workspaces.map((w) => normalizePath(relative(options.path, w))));
112389
112460
  }
@@ -112562,7 +112633,7 @@ var require_lib$9 = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
112562
112633
  //#region ../../node_modules/@npmcli/run-script/lib/set-path.js
112563
112634
  var require_set_path = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
112564
112635
  const { log } = require_lib$29();
112565
- const { resolve: resolve$5, dirname: dirname$6, delimiter: delimiter$2 } = require("path");
112636
+ const { resolve: resolve$5, dirname: dirname$5, delimiter: delimiter$2 } = require("path");
112566
112637
  const nodeGypPath = resolve$5(__dirname, "../lib/node-gyp-bin");
112567
112638
  const setPATH = (projectPath, binPaths, env) => {
112568
112639
  const PATH = Object.keys(env).filter((p) => /^path$/i.test(p) && env[p]).map((p) => env[p].split(delimiter$2)).reduce((set, p) => set.concat(p.filter((concatted) => !set.includes(concatted))), []).join(delimiter$2);
@@ -112580,7 +112651,7 @@ var require_set_path = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
112580
112651
  do {
112581
112652
  pathArr.push(resolve$5(p, "node_modules", ".bin"));
112582
112653
  pp = p;
112583
- p = dirname$6(p);
112654
+ p = dirname$5(p);
112584
112655
  } while (p !== pp);
112585
112656
  pathArr.push(nodeGypPath, PATH);
112586
112657
  const pathVal = pathArr.join(delimiter$2);
@@ -141931,8 +142002,8 @@ var require_registry = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mo
141931
142002
  //#endregion
141932
142003
  //#region ../../node_modules/pacote/lib/fetcher.js
141933
142004
  var require_fetcher = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {
141934
- const { basename: basename$1, dirname: dirname$5 } = require("node:path");
141935
- const { rm: rm$4, mkdir: mkdir$5 } = require("node:fs/promises");
142005
+ const { basename: basename$1, dirname: dirname$4 } = require("node:path");
142006
+ const { rm: rm$4, mkdir: mkdir$4 } = require("node:fs/promises");
141936
142007
  const PackageJson = require_lib$18();
141937
142008
  const cacache = require_lib$14();
141938
142009
  const fsm = require_lib$13();
@@ -141980,7 +142051,7 @@ var require_fetcher = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
141980
142051
  this.npmBin = opts.npmBin || "npm";
141981
142052
  this.npmInstallCmd = opts.npmInstallCmd || ["install", "--force"];
141982
142053
  this.npmCliConfig = opts.npmCliConfig || [
141983
- `--cache=${dirname$5(this.cache)}`,
142054
+ `--cache=${dirname$4(this.cache)}`,
141984
142055
  `--prefer-offline=${!!this.preferOffline}`,
141985
142056
  `--prefer-online=${!!this.preferOnline}`,
141986
142057
  `--offline=${!!this.offline}`,
@@ -142116,7 +142187,7 @@ var require_fetcher = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
142116
142187
  }
142117
142188
  async #mkdir(dest) {
142118
142189
  await this.#empty(dest);
142119
- return await mkdir$5(dest, { recursive: true });
142190
+ return await mkdir$4(dest, { recursive: true });
142120
142191
  }
142121
142192
  async extract(dest) {
142122
142193
  await this.#mkdir(dest);
@@ -142136,7 +142207,7 @@ var require_fetcher = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, mod
142136
142207
  }));
142137
142208
  }
142138
142209
  async tarballFile(dest) {
142139
- await mkdir$5(dirname$5(dest), { recursive: true });
142210
+ await mkdir$4(dirname$4(dest), { recursive: true });
142140
142211
  return this.#toFile(dest);
142141
142212
  }
142142
142213
  #extract(dest, tarball) {
@@ -150561,7 +150632,7 @@ var require_error = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
150561
150632
  const { promisify } = require("util");
150562
150633
  const path$3 = require("path");
150563
150634
  const { createHash } = require("crypto");
150564
- const { realpath: realpath$1, lstat, createReadStream, readdir: readdir$2 } = require("fs");
150635
+ const { realpath, lstat, createReadStream, readdir: readdir$2 } = require("fs");
150565
150636
  const url = require("url");
150566
150637
  const slasher = require_glob_slash();
150567
150638
  const minimatch = require_minimatch();
@@ -150884,7 +150955,7 @@ var require_error = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, modul
150884
150955
  };
150885
150956
  const getHandlers = (methods) => Object.assign({
150886
150957
  lstat: promisify(lstat),
150887
- realpath: promisify(realpath$1),
150958
+ realpath: promisify(realpath),
150888
150959
  createReadStream,
150889
150960
  readdir: promisify(readdir$2),
150890
150961
  sendError
@@ -151039,15 +151110,6 @@ if (isDev && projectRoot) {
151039
151110
  //#region ../plugin-core/src/pipelab.ts
151040
151111
  const createActionRunner = (runner) => runner;
151041
151112
  //#endregion
151042
- //#region ../plugin-core/src/fs-utils.ts
151043
- const generateTempFolder = async (base) => {
151044
- const targetBase = base || (0, node_os.tmpdir)();
151045
- await (0, node_fs_promises.mkdir)(targetBase, { recursive: true });
151046
- const realPath = await (0, node_fs_promises.realpath)(targetBase);
151047
- console.log("join", (0, node_path.join)(realPath, "pipelab-"));
151048
- return await (0, node_fs_promises.mkdtemp)((0, node_path.join)(realPath, "pipelab-"));
151049
- };
151050
- //#endregion
151051
151113
  //#region ../plugin-core/src/archive-utils.ts
151052
151114
  /**
151053
151115
  * Extracts a .zip archive.
@@ -151090,12 +151152,12 @@ async function extractZip(archivePath, destinationDir) {
151090
151152
  //#region src/ensure.ts
151091
151153
  /**
151092
151154
  * Installs itch.io butler CLI if not already present.
151093
- * @param thirdpartyDir The directory where third-party tools are stored.
151155
+ * @param context The PipelabContext instance.
151094
151156
  * @param version The version of butler to install.
151095
151157
  * @returns A Promise that resolves to the path of the butler executable.
151096
151158
  */
151097
- const ensureButler = async (thirdpartyDir, version = "LATEST") => {
151098
- const butlerDir = (0, node_path.join)(thirdpartyDir, "butler", version);
151159
+ const ensureButler = async (context, version = "LATEST") => {
151160
+ const butlerDir = (0, node_path.join)(context.getThirdPartyPath(), "butler", version);
151099
151161
  const isWindows = process.platform === "win32";
151100
151162
  const finalButlerPath = (0, node_path.join)(butlerDir, isWindows ? "butler.exe" : "butler");
151101
151163
  try {
@@ -151114,7 +151176,7 @@ const ensureButler = async (thirdpartyDir, version = "LATEST") => {
151114
151176
  if (localArch === "x64" || localArch === "arm64") butlerName += "amd64";
151115
151177
  else throw new Error(`Unsupported architecture for butler: ${localArch}`);
151116
151178
  const downloadUrl = `https://broth.itch.zone/butler/${butlerName}/${version}/archive/default`;
151117
- const tempDir = await generateTempFolder((0, node_path.join)(thirdpartyDir, ".tmp"));
151179
+ const tempDir = await context.createTempFolder("butler-setup-");
151118
151180
  const archivePath = (0, node_path.join)(tempDir, "butler.zip");
151119
151181
  console.log(`Downloading butler from ${downloadUrl}...`);
151120
151182
  await downloadFile(downloadUrl, archivePath);
@@ -151130,74 +151192,85 @@ const ensureButler = async (thirdpartyDir, version = "LATEST") => {
151130
151192
  };
151131
151193
  //#endregion
151132
151194
  //#region src/index.ts
151133
- var src_default = createNodeDefinition({ nodes: [{
151134
- node: createAction({
151135
- id: "itch-upload",
151136
- name: "Upload to Itch.io",
151137
- description: "",
151138
- icon: "",
151139
- displayString: "`Upload ${fmt.param(params['input-folder'], 'primary', 'No path selected')} to ${fmt.param(params['user'], 'primary', 'No project')}/${fmt.param(params['project'], 'primary', 'No project')}:${fmt.param(params['channel'], 'primary', 'No channel')}`",
151140
- meta: {},
151141
- params: {
151142
- "input-folder": createPathParam("", {
151143
- required: true,
151144
- label: "Folder to Upload",
151145
- control: {
151146
- type: "path",
151147
- options: { properties: ["openDirectory"] }
151148
- }
151149
- }),
151150
- user: createStringParam("", {
151151
- required: true,
151152
- label: "User"
151153
- }),
151154
- project: createStringParam("", {
151155
- required: true,
151156
- label: "Project"
151157
- }),
151158
- channel: createStringParam("", {
151159
- required: true,
151160
- label: "Channel"
151161
- }),
151162
- "api-key": createStringParam("", {
151163
- required: true,
151164
- label: "API key"
151165
- })
151166
- },
151167
- outputs: {}
151168
- }),
151169
- runner: createActionRunner(async ({ log, inputs, cwd, abortSignal, paths }) => {
151170
- const { node, thirdparty } = paths;
151171
- const butlerPath = await ensureButler(thirdparty);
151172
- log("Uploading to itch");
151173
- await runWithLiveLogs(butlerPath, [
151174
- "push",
151175
- inputs["input-folder"],
151176
- `${inputs.user}/${inputs.project}:${inputs.channel}`,
151177
- "--json"
151178
- ], {
151179
- env: {
151180
- ...process.env,
151181
- PATH: `${(0, node_path.dirname)(node)}${node_path.delimiter}${process.env.PATH}`,
151182
- BUTLER_API_KEY: inputs["api-key"]
151195
+ var src_default = createNodeDefinition({
151196
+ nodes: [{
151197
+ node: createAction({
151198
+ id: "itch-upload",
151199
+ name: "Upload to Itch.io",
151200
+ description: "",
151201
+ icon: "",
151202
+ displayString: "`Upload ${fmt.param(params['input-folder'], 'primary', 'No path selected')} to ${fmt.param(params['user'], 'primary', 'No project')}/${fmt.param(params['project'], 'primary', 'No project')}:${fmt.param(params['channel'], 'primary', 'No channel')}`",
151203
+ meta: {},
151204
+ params: {
151205
+ "input-folder": createPathParam("", {
151206
+ required: true,
151207
+ label: "Folder to Upload",
151208
+ control: {
151209
+ type: "path",
151210
+ options: { properties: ["openDirectory"] }
151211
+ }
151212
+ }),
151213
+ user: createStringParam("", {
151214
+ required: true,
151215
+ label: "User"
151216
+ }),
151217
+ project: createStringParam("", {
151218
+ required: true,
151219
+ label: "Project"
151220
+ }),
151221
+ channel: createStringParam("", {
151222
+ required: true,
151223
+ label: "Channel"
151224
+ }),
151225
+ "api-key": createStringParam("", {
151226
+ required: true,
151227
+ label: "API key"
151228
+ })
151183
151229
  },
151184
- cancelSignal: abortSignal
151185
- }, log, { onStdout(data, subprocess) {
151186
- const jsons = data.trim().split("\n");
151187
- for (const jsonData of jsons) {
151188
- const json = JSON.parse(jsonData);
151189
- switch (json.type) {
151190
- case "log":
151191
- log(json.message);
151192
- break;
151193
- case "progress":
151194
- log(`${json.progress}% - ETA: ${json.eta}s`);
151195
- break;
151230
+ outputs: {}
151231
+ }),
151232
+ runner: createActionRunner(async ({ log, inputs, cwd, abortSignal, context }) => {
151233
+ const node = context.getNodePath();
151234
+ const butlerPath = await ensureButler(context);
151235
+ log("Uploading to itch");
151236
+ await runWithLiveLogs(butlerPath, [
151237
+ "push",
151238
+ inputs["input-folder"],
151239
+ `${inputs.user}/${inputs.project}:${inputs.channel}`,
151240
+ "--json"
151241
+ ], {
151242
+ env: {
151243
+ ...process.env,
151244
+ PATH: `${(0, node_path.dirname)(node)}${node_path.delimiter}${process.env.PATH}`,
151245
+ BUTLER_API_KEY: inputs["api-key"]
151246
+ },
151247
+ cancelSignal: abortSignal
151248
+ }, log, { onStdout(data, subprocess) {
151249
+ const jsons = data.trim().split("\n");
151250
+ for (const jsonData of jsons) {
151251
+ const json = JSON.parse(jsonData);
151252
+ switch (json.type) {
151253
+ case "log":
151254
+ log(json.message);
151255
+ break;
151256
+ case "progress":
151257
+ log(`${json.progress}% - ETA: ${json.eta}s`);
151258
+ break;
151259
+ }
151196
151260
  }
151197
- }
151198
- } });
151199
- log("Uploaded to itch");
151200
- })
151201
- }] });
151261
+ } });
151262
+ log("Uploaded to itch");
151263
+ })
151264
+ }],
151265
+ integrations: [{
151266
+ name: "Itch Butler Account",
151267
+ fields: [{
151268
+ key: "apiKey",
151269
+ label: "Butler API Key",
151270
+ type: "password",
151271
+ placeholder: "butler API key"
151272
+ }]
151273
+ }]
151274
+ });
151202
151275
  //#endregion
151203
151276
  module.exports = src_default;