@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.mjs CHANGED
@@ -4,11 +4,11 @@ import { normalize } from "path";
4
4
  import { formatWithOptions, types } from "util";
5
5
  import path, { delimiter, dirname, join } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
- import { constants, tmpdir } from "node:os";
7
+ import { constants } 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
10
  import http from "node:http";
10
11
  import { webcrypto } from "node:crypto";
11
- import { chmod, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
12
12
  import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
13
13
  import { StringDecoder } from "node:string_decoder";
14
14
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
@@ -20,6 +20,7 @@ import { serialize } from "node:v8";
20
20
  import { finished, pipeline } from "node:stream/promises";
21
21
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
22
22
  import { Buffer as Buffer$1 } from "node:buffer";
23
+ import dns from "node:dns/promises";
23
24
  //#region ../../packages/migration/src/models/createMigration.ts
24
25
  function createMigration$1(migration) {
25
26
  return {
@@ -1595,6 +1596,56 @@ function literal(literal_, message) {
1595
1596
  }
1596
1597
  };
1597
1598
  }
1599
+ function looseObject(entries, message) {
1600
+ return {
1601
+ kind: "schema",
1602
+ type: "loose_object",
1603
+ reference: looseObject,
1604
+ expects: "Object",
1605
+ async: false,
1606
+ entries,
1607
+ message,
1608
+ _run(dataset, config2) {
1609
+ const input = dataset.value;
1610
+ if (input && typeof input === "object") {
1611
+ dataset.typed = true;
1612
+ dataset.value = {};
1613
+ for (const key in this.entries) {
1614
+ const value2 = input[key];
1615
+ const valueDataset = this.entries[key]._run({
1616
+ typed: false,
1617
+ value: value2
1618
+ }, config2);
1619
+ if (valueDataset.issues) {
1620
+ const pathItem = {
1621
+ type: "object",
1622
+ origin: "value",
1623
+ input,
1624
+ key,
1625
+ value: value2
1626
+ };
1627
+ for (const issue of valueDataset.issues) {
1628
+ if (issue.path) issue.path.unshift(pathItem);
1629
+ else issue.path = [pathItem];
1630
+ dataset.issues?.push(issue);
1631
+ }
1632
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1633
+ if (config2.abortEarly) {
1634
+ dataset.typed = false;
1635
+ break;
1636
+ }
1637
+ }
1638
+ if (!valueDataset.typed) dataset.typed = false;
1639
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1640
+ }
1641
+ if (!dataset.issues || !config2.abortEarly) {
1642
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1643
+ }
1644
+ } else _addIssue(this, "type", dataset, config2);
1645
+ return dataset;
1646
+ }
1647
+ };
1648
+ }
1598
1649
  function number(message) {
1599
1650
  return {
1600
1651
  kind: "schema",
@@ -2132,6 +2183,18 @@ settingsMigratorInternal.createMigrations({
2132
2183
  })
2133
2184
  ]
2134
2185
  });
2186
+ const connectionsMigratorInternal = createMigrator();
2187
+ const defaultConnections = connectionsMigratorInternal.createDefault({
2188
+ version: "1.0.0",
2189
+ connections: []
2190
+ });
2191
+ connectionsMigratorInternal.createMigrations({
2192
+ defaultValue: defaultConnections,
2193
+ migrations: [createMigration({
2194
+ version: "1.0.0",
2195
+ up: finalVersion
2196
+ })]
2197
+ });
2135
2198
  const fileRepoMigratorInternal = createMigrator();
2136
2199
  const defaultFileRepo = fileRepoMigratorInternal.createDefault({
2137
2200
  version: "2.0.0",
@@ -2293,11 +2356,51 @@ const LEGACY_ID_MAP = {
2293
2356
  };
2294
2357
  const getStrictPluginId = (pluginId) => {
2295
2358
  if (!pluginId) return pluginId;
2296
- if (LEGACY_ID_MAP[pluginId]) return LEGACY_ID_MAP[pluginId];
2297
- if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
2298
- const prefixed = `@pipelab/plugin-${pluginId}`;
2299
- return LEGACY_ID_MAP[prefixed] || prefixed;
2359
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2300
2360
  };
2361
+ //#endregion
2362
+ //#region ../../packages/shared/src/save-location.ts
2363
+ const SaveLocationInternalValidator = object({
2364
+ id: string(),
2365
+ project: string(),
2366
+ lastModified: string(),
2367
+ type: literal("internal"),
2368
+ configName: string()
2369
+ });
2370
+ const SaveLocationValidator = union([
2371
+ object({
2372
+ id: string(),
2373
+ project: string(),
2374
+ path: string(),
2375
+ lastModified: string(),
2376
+ type: literal("external"),
2377
+ summary: object({
2378
+ plugins: array(string()),
2379
+ name: string(),
2380
+ description: string()
2381
+ })
2382
+ }),
2383
+ SaveLocationInternalValidator,
2384
+ object({
2385
+ id: string(),
2386
+ project: string(),
2387
+ type: literal("pipelab-cloud")
2388
+ })
2389
+ ]);
2390
+ object({
2391
+ version: literal("1.0.0"),
2392
+ data: optional(record(string(), SaveLocationValidator), {})
2393
+ });
2394
+ const FileRepoProjectValidatorV2$1 = object({
2395
+ id: string(),
2396
+ name: string(),
2397
+ description: string()
2398
+ });
2399
+ object({
2400
+ version: literal("2.0.0"),
2401
+ projects: array(FileRepoProjectValidatorV2$1),
2402
+ pipelines: optional(array(SaveLocationValidator), [])
2403
+ });
2301
2404
  object({
2302
2405
  cacheFolder: string(),
2303
2406
  theme: union([literal("light"), literal("dark")]),
@@ -2449,6 +2552,17 @@ object({
2449
2552
  })),
2450
2553
  isInternalMigrationBannerClosed: optional(boolean(), false)
2451
2554
  });
2555
+ const ConnectionValidator = looseObject({
2556
+ id: string(),
2557
+ pluginName: string(),
2558
+ name: string(),
2559
+ createdAt: string(),
2560
+ isDefault: boolean()
2561
+ });
2562
+ object({
2563
+ version: literal("1.0.0"),
2564
+ connections: array(ConnectionValidator)
2565
+ });
2452
2566
  //#endregion
2453
2567
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
2454
2568
  const prettyLogStyles = {
@@ -2969,7 +3083,7 @@ const useLogger = () => {
2969
3083
  const OriginValidator = object({
2970
3084
  pluginId: string(),
2971
3085
  nodeId: string(),
2972
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
3086
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
2973
3087
  });
2974
3088
  const BlockActionValidatorV1 = object({
2975
3089
  type: literal("action"),
@@ -2982,7 +3096,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
2982
3096
  const BlockActionValidatorV3 = object({
2983
3097
  type: literal("action"),
2984
3098
  uid: string(),
2985
- name: pipe(optional(string()), description("A custom name provided by the user")),
3099
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
2986
3100
  disabled: optional(boolean()),
2987
3101
  params: record(string(), object({
2988
3102
  editor: EditorParamValidatorV3,
@@ -45282,35 +45396,6 @@ const createPathParam = (value, definition) => {
45282
45396
  };
45283
45397
  };
45284
45398
  //#endregion
45285
- //#region ../../packages/shared/src/save-location.ts
45286
- const SaveLocationInternalValidator = object({
45287
- id: string(),
45288
- project: string(),
45289
- lastModified: string(),
45290
- type: literal("internal"),
45291
- configName: string()
45292
- });
45293
- const SaveLocationValidator = union([
45294
- object({
45295
- id: string(),
45296
- project: string(),
45297
- path: string(),
45298
- lastModified: string(),
45299
- type: literal("external"),
45300
- summary: object({
45301
- plugins: array(string()),
45302
- name: string(),
45303
- description: string()
45304
- })
45305
- }),
45306
- SaveLocationInternalValidator,
45307
- object({
45308
- id: string(),
45309
- project: string(),
45310
- type: literal("pipelab-cloud")
45311
- })
45312
- ]);
45313
- //#endregion
45314
45399
  //#region ../../packages/shared/src/websocket.types.ts
45315
45400
  var WebSocketError = class extends Error {
45316
45401
  constructor(message, code, requestId) {
@@ -45327,20 +45412,6 @@ object({
45327
45412
  version: literal("1.0.0"),
45328
45413
  data: optional(record(string(), SaveLocationValidator), {})
45329
45414
  });
45330
- const FileRepoProjectValidatorV2$1 = object({
45331
- id: string(),
45332
- name: string(),
45333
- description: string()
45334
- });
45335
- object({
45336
- version: literal("2.0.0"),
45337
- projects: array(FileRepoProjectValidatorV2$1),
45338
- pipelines: optional(array(SaveLocationValidator), [])
45339
- });
45340
- object({
45341
- version: literal("1.0.0"),
45342
- data: optional(record(string(), SaveLocationValidator), {})
45343
- });
45344
45415
  const FileRepoProjectValidatorV2 = object({
45345
45416
  id: string(),
45346
45417
  name: string(),
@@ -45360,9 +45431,15 @@ var init_esm_shims = __esmMin((() => {
45360
45431
  __dirname = /* @__PURE__ */ getDirname();
45361
45432
  }));
45362
45433
  //#endregion
45363
- //#region ../../packages/core-node/src/context.ts
45434
+ //#region ../../packages/constants/src/index.ts
45364
45435
  init_esm_shims();
45365
- const _dirname = typeof __dirname !== "undefined" ? __dirname : typeof import.meta !== "undefined" && import.meta.url ? dirname(fileURLToPath(import.meta.url)) : process.cwd();
45436
+ const websocketPort = 33753;
45437
+ const DEFAULT_NODE_VERSION = "24.14.1";
45438
+ const DEFAULT_PNPM_VERSION = "10.12.0";
45439
+ //#endregion
45440
+ //#region ../../packages/core-node/src/context.ts
45441
+ const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
45442
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
45366
45443
  const isDev = process.env.NODE_ENV === "development";
45367
45444
  /**
45368
45445
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
@@ -48934,9 +49011,6 @@ const useAPI = () => {
48934
49011
  };
48935
49012
  };
48936
49013
  //#endregion
48937
- //#region ../../packages/constants/src/index.ts
48938
- const websocketPort = 33753;
48939
- //#endregion
48940
49014
  //#region ../../packages/core-node/src/websocket-server.ts
48941
49015
  var WebSocketServer = class {
48942
49016
  wss = null;
@@ -89341,14 +89415,6 @@ var import_tar = /* @__PURE__ */ __toESM(require_tar$1(), 1);
89341
89415
  var import_yauzl = /* @__PURE__ */ __toESM(require_yauzl(), 1);
89342
89416
  require_archiver();
89343
89417
  /**
89344
- * Generates a unique temporary folder.
89345
- */
89346
- const generateTempFolder = async (base) => {
89347
- const targetBase = base || tmpdir();
89348
- await mkdir(targetBase, { recursive: true });
89349
- return await mkdtemp(join(await realpath(targetBase), "pipelab-"));
89350
- };
89351
- /**
89352
89418
  * Extracts a .tar.gz archive.
89353
89419
  */
89354
89420
  async function extractTarGz(archivePath, destinationDir) {
@@ -100929,11 +100995,11 @@ var require_cp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100929
100995
  var require_with_temp_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100930
100996
  const { join: join$5, sep: sep$1 } = __require("path");
100931
100997
  const getOptions = require_get_options();
100932
- const { mkdir: mkdir$4, mkdtemp: mkdtemp$1, rm: rm$5 } = __require("fs/promises");
100998
+ const { mkdir: mkdir$4, mkdtemp, rm: rm$5 } = __require("fs/promises");
100933
100999
  const withTempDir = async (root, fn, opts) => {
100934
101000
  const options = getOptions(opts, { copy: ["tmpPrefix"] });
100935
101001
  await mkdir$4(root, { recursive: true });
100936
- const target = await mkdtemp$1(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
101002
+ const target = await mkdtemp(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
100937
101003
  let err;
100938
101004
  let result;
100939
101005
  try {
@@ -110532,9 +110598,9 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110532
110598
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110533
110599
  var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110534
110600
  const { resolve: resolve$6 } = __require("node:path");
110535
- const { tmpdir: tmpdir$1, homedir } = __require("node:os");
110601
+ const { tmpdir, homedir } = __require("node:os");
110536
110602
  module.exports = (fakePlatform = false) => {
110537
- const temp = tmpdir$1();
110603
+ const temp = tmpdir();
110538
110604
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110539
110605
  const home = homedir() || resolve$6(temp, "npm-" + uidOrPid);
110540
110606
  const platform = fakePlatform || process.platform;
@@ -123785,7 +123851,7 @@ var require_auth = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123785
123851
  //#endregion
123786
123852
  //#region ../../node_modules/make-fetch-happen/lib/options.js
123787
123853
  var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123788
- const dns$2 = __require("dns");
123854
+ const dns$3 = __require("dns");
123789
123855
  const conditionalHeaders = [
123790
123856
  "if-modified-since",
123791
123857
  "if-none-match",
@@ -123810,7 +123876,7 @@ var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
123810
123876
  };
123811
123877
  options.dns = {
123812
123878
  ttl: 300 * 1e3,
123813
- lookup: dns$2.lookup,
123879
+ lookup: dns$3.lookup,
123814
123880
  ...options.dns
123815
123881
  };
123816
123882
  options.cache = options.cache || "default";
@@ -125227,9 +125293,9 @@ var require_key$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
125227
125293
  //#region ../../node_modules/@npmcli/agent/lib/dns.js
125228
125294
  var require_dns = /* @__PURE__ */ __commonJSMin(((exports, module) => {
125229
125295
  const { LRUCache } = require_index_min$5();
125230
- const dns$1 = __require("dns");
125296
+ const dns$2 = __require("dns");
125231
125297
  const cache = new LRUCache({ max: 50 });
125232
- const getOptions = ({ family = 0, hints = dns$1.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$1.lookup }) => ({
125298
+ const getOptions = ({ family = 0, hints = dns$2.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$2.lookup }) => ({
125233
125299
  hints,
125234
125300
  lookup: (hostname, ...args) => {
125235
125301
  const callback = args.pop();
@@ -130268,7 +130334,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
130268
130334
  const socks_1 = require_build$1();
130269
130335
  const agent_base_1 = require_dist$12();
130270
130336
  const debug_1 = __importDefault(require_src$1());
130271
- const dns = __importStar(__require("dns"));
130337
+ const dns$1 = __importStar(__require("dns"));
130272
130338
  const net$1 = __importStar(__require("net"));
130273
130339
  const tls$1 = __importStar(__require("tls"));
130274
130340
  const url_1$1 = __require("url");
@@ -130340,7 +130406,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
130340
130406
  const { shouldLookup, proxy, timeout } = this;
130341
130407
  if (!opts.host) throw new Error("No `host` defined!");
130342
130408
  let { host } = opts;
130343
- const { port, lookup: lookupFn = dns.lookup } = opts;
130409
+ const { port, lookup: lookupFn = dns$1.lookup } = opts;
130344
130410
  if (shouldLookup) host = await new Promise((resolve, reject) => {
130345
130411
  lookupFn(host, {}, (err, res) => {
130346
130412
  if (err) reject(err);
@@ -150607,7 +150673,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150607
150673
  const { promisify: promisify$1 } = __require("util");
150608
150674
  const path$1 = __require("path");
150609
150675
  const { createHash } = __require("crypto");
150610
- const { realpath: realpath$1, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150676
+ const { realpath, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150611
150677
  const url = __require("url");
150612
150678
  const slasher = require_glob_slash();
150613
150679
  const minimatch = require_minimatch();
@@ -150930,7 +150996,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150930
150996
  };
150931
150997
  const getHandlers = (methods) => Object.assign({
150932
150998
  lstat: promisify$1(lstat),
150933
- realpath: promisify$1(realpath$1),
150999
+ realpath: promisify$1(realpath),
150934
151000
  createReadStream: createReadStream$1,
150935
151001
  readdir: promisify$1(readdir$1),
150936
151002
  sendError
@@ -151069,8 +151135,6 @@ const sendStartupProgress = (message) => {
151069
151135
  };
151070
151136
  //#endregion
151071
151137
  //#region ../../packages/core-node/src/utils/remote.ts
151072
- const DEFAULT_NODE_VERSION = "24.14.1";
151073
- const DEFAULT_PNPM_VERSION = "10.12.0";
151074
151138
  function isPackageComplete(packageDir) {
151075
151139
  return existsSync(join(packageDir, "package.json"));
151076
151140
  }
@@ -151111,6 +151175,20 @@ async function withLock(key, fn) {
151111
151175
  activeOperations.set(key, promise);
151112
151176
  return promise;
151113
151177
  }
151178
+ let isOnlineCached = null;
151179
+ let lastCheckTime = 0;
151180
+ async function isOnline() {
151181
+ const now = Date.now();
151182
+ if (isOnlineCached !== null && now - lastCheckTime < 1e4) return isOnlineCached;
151183
+ try {
151184
+ await Promise.race([dns.lookup("registry.npmjs.org"), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("timeout")), 1500))]);
151185
+ isOnlineCached = true;
151186
+ } catch {
151187
+ isOnlineCached = false;
151188
+ }
151189
+ lastCheckTime = now;
151190
+ return isOnlineCached;
151191
+ }
151114
151192
  /**
151115
151193
  * Robust utility to fetch, cache, and resolve an NPM package.
151116
151194
  * Centralized in core-node to avoid circular dependencies.
@@ -151137,7 +151215,15 @@ async function fetchPackage(packageName, versionOrRange, options) {
151137
151215
  if (resolvedVersionOrRange === "local") resolvedVersionOrRange = "latest";
151138
151216
  console.log(`[Fetcher] Resolving ${packageName}@${resolvedVersionOrRange || "latest"}...`);
151139
151217
  const resolveStart = Date.now();
151140
- try {
151218
+ if (!await isOnline()) {
151219
+ console.warn(`[Fetcher] ${packageName}: offline mode detected (${Date.now() - resolveStart}ms), trying local fallback...`);
151220
+ const fallbackStart = Date.now();
151221
+ const fallbackVersion = await tryLocalFallback(resolvedVersionOrRange, /* @__PURE__ */ new Error("Offline"), baseDir, packageName);
151222
+ if (fallbackVersion) {
151223
+ resolvedVersion = fallbackVersion;
151224
+ console.log(`[Fetcher] ${packageName}: Resolved to local fallback ${resolvedVersion} (${Date.now() - fallbackStart}ms)`);
151225
+ } else throw new Error(`Offline and no local fallback version available for ${packageName}`);
151226
+ } else try {
151141
151227
  const cachePath = join(ctx.userDataPath, "cache", "pacote");
151142
151228
  let packumentPromise = packumentRequests.get(packageName);
151143
151229
  if (!packumentPromise) {
@@ -151147,7 +151233,16 @@ async function fetchPackage(packageName, versionOrRange, options) {
151147
151233
  const packument = await packumentPromise;
151148
151234
  const versions = Object.keys(packument.versions);
151149
151235
  const range = resolvedVersionOrRange || "latest";
151150
- const foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
151236
+ let foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
151237
+ if (range === "latest" && ctx.releaseTag && ctx.releaseTag !== "latest") {
151238
+ const releaseTagVersion = packument["dist-tags"]?.[ctx.releaseTag];
151239
+ if (releaseTagVersion && import_semver.default.valid(releaseTagVersion)) {
151240
+ if (!foundVersion || import_semver.default.valid(foundVersion) && import_semver.default.gte(releaseTagVersion, foundVersion)) {
151241
+ console.log(`[Fetcher] Using release tag "${ctx.releaseTag}" (${releaseTagVersion}) instead of "latest" (${foundVersion || "none"}) for ${packageName}`);
151242
+ foundVersion = releaseTagVersion;
151243
+ } else if (foundVersion) console.warn(`[Fetcher] Tag "${ctx.releaseTag}" (${releaseTagVersion}) is older than "latest" (${foundVersion}) for ${packageName}, keeping "latest"`);
151244
+ }
151245
+ }
151151
151246
  if (!foundVersion) throw new Error(`Package ${packageName}@${range} not found on npm (available tags: ${Object.keys(packument["dist-tags"] || {}).join(", ")})`);
151152
151247
  resolvedVersion = foundVersion;
151153
151248
  console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm (${Date.now() - resolveStart}ms)`);
@@ -151262,7 +151357,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
151262
151357
  const extension = isWindows ? "zip" : "tar.gz";
151263
151358
  const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
151264
151359
  const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
151265
- const tempDir = await generateTempFolder(tmpdir());
151360
+ const tempDir = await context.createTempFolder("node-download-");
151266
151361
  const archivePath = join(tempDir, fileName);
151267
151362
  sendStartupProgress(`Downloading Node.js v${version}...`);
151268
151363
  console.log(`Downloading Node.js from ${downloadUrl}...`);
@@ -151490,84 +151585,100 @@ if (isDev && projectRoot) {
151490
151585
  const createActionRunner = (runner) => runner;
151491
151586
  //#endregion
151492
151587
  //#region src/index.ts
151493
- var src_default = createNodeDefinition({ nodes: [{
151494
- node: createAction({
151495
- id: "poki-upload",
151496
- name: "Upload to Poki.io",
151497
- description: "",
151498
- icon: "",
151499
- 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')})`",
151500
- meta: {},
151501
- params: {
151502
- "input-folder": createPathParam("", {
151503
- required: true,
151504
- label: "Folder to Upload",
151505
- control: {
151506
- type: "path",
151507
- options: { properties: ["openDirectory"] }
151508
- }
151509
- }),
151510
- project: createStringParam("", {
151511
- required: true,
151512
- label: "Project",
151513
- description: "This is you Poki game id"
151514
- }),
151515
- name: createStringParam("", {
151516
- required: true,
151517
- label: "Version name",
151518
- description: "This is the name of the version"
151519
- }),
151520
- notes: createStringParam("", {
151521
- required: true,
151522
- label: "Version notes",
151523
- description: "These are notes you want to specify with your version"
151524
- })
151525
- },
151526
- outputs: {}
151527
- }),
151528
- runner: createActionRunner(async ({ log, inputs, paths, abortSignal, cwd, context }) => {
151529
- const { node, thirdparty, pnpm } = paths;
151530
- const { packageDir: pokiDir } = await fetchPackage("@poki/cli", "0.1.19", {
151531
- context,
151532
- installDeps: true
151533
- });
151534
- const poki = join(pokiDir, "bin", "index.js");
151535
- const dist = join(cwd, "dist");
151536
- await mkdir(dist, { recursive: true });
151537
- await cp(inputs["input-folder"], dist, { recursive: true });
151538
- const pokiJsonPath = join(cwd, "poki.json");
151539
- console.log("pokiJsonPath", pokiJsonPath);
151540
- await writeFile(pokiJsonPath, JSON.stringify({
151541
- game_id: inputs.project,
151542
- build_dir: "dist"
151543
- }, void 0, 2), "utf-8");
151544
- log("process.env.MSW_BRIDGE_PORT", process.env.MSW_BRIDGE_PORT);
151545
- log("process.env.NODE_OPTIONS", process.env.NODE_OPTIONS);
151546
- await runWithLiveLogs(node, [
151547
- poki,
151548
- "upload",
151549
- "--name",
151550
- inputs.name,
151551
- "--notes",
151552
- inputs.notes
151553
- ], {
151554
- cwd,
151555
- env: {
151556
- ...process.env,
151557
- PATH: `${dirname(node)}${delimiter}${process.env.PATH}`
151558
- },
151559
- cancelSignal: abortSignal
151560
- }, log, {
151561
- onStderr(data, subprocess) {
151562
- log(data);
151588
+ var src_default = createNodeDefinition({
151589
+ nodes: [{
151590
+ node: createAction({
151591
+ id: "poki-upload",
151592
+ name: "Upload to Poki.io",
151593
+ description: "",
151594
+ icon: "",
151595
+ 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')})`",
151596
+ meta: {},
151597
+ params: {
151598
+ "input-folder": createPathParam("", {
151599
+ required: true,
151600
+ label: "Folder to Upload",
151601
+ control: {
151602
+ type: "path",
151603
+ options: { properties: ["openDirectory"] }
151604
+ }
151605
+ }),
151606
+ project: createStringParam("", {
151607
+ required: true,
151608
+ label: "Project",
151609
+ description: "This is you Poki game id"
151610
+ }),
151611
+ name: createStringParam("", {
151612
+ required: true,
151613
+ label: "Version name",
151614
+ description: "This is the name of the version"
151615
+ }),
151616
+ notes: createStringParam("", {
151617
+ required: true,
151618
+ label: "Version notes",
151619
+ description: "These are notes you want to specify with your version"
151620
+ })
151563
151621
  },
151564
- onStdout(data, subprocess) {
151565
- log(data);
151566
- }
151567
- });
151568
- log("Uploaded to poki");
151569
- })
151570
- }] });
151622
+ outputs: {}
151623
+ }),
151624
+ runner: createActionRunner(async ({ log, inputs, paths, abortSignal, cwd, context }) => {
151625
+ const { node, thirdparty, pnpm } = paths;
151626
+ const { packageDir: pokiDir } = await fetchPackage("@poki/cli", "0.1.19", {
151627
+ context,
151628
+ installDeps: true
151629
+ });
151630
+ const poki = join(pokiDir, "bin", "index.js");
151631
+ const dist = join(cwd, "dist");
151632
+ await mkdir(dist, { recursive: true });
151633
+ await cp(inputs["input-folder"], dist, { recursive: true });
151634
+ const pokiJsonPath = join(cwd, "poki.json");
151635
+ console.log("pokiJsonPath", pokiJsonPath);
151636
+ await writeFile(pokiJsonPath, JSON.stringify({
151637
+ game_id: inputs.project,
151638
+ build_dir: "dist"
151639
+ }, void 0, 2), "utf-8");
151640
+ log("process.env.MSW_BRIDGE_PORT", process.env.MSW_BRIDGE_PORT);
151641
+ log("process.env.NODE_OPTIONS", process.env.NODE_OPTIONS);
151642
+ await runWithLiveLogs(node, [
151643
+ poki,
151644
+ "upload",
151645
+ "--name",
151646
+ inputs.name,
151647
+ "--notes",
151648
+ inputs.notes
151649
+ ], {
151650
+ cwd,
151651
+ env: {
151652
+ ...process.env,
151653
+ PATH: `${dirname(node)}${delimiter}${process.env.PATH}`
151654
+ },
151655
+ cancelSignal: abortSignal
151656
+ }, log, {
151657
+ onStderr(data, subprocess) {
151658
+ log(data);
151659
+ },
151660
+ onStdout(data, subprocess) {
151661
+ log(data);
151662
+ }
151663
+ });
151664
+ log("Uploaded to poki");
151665
+ })
151666
+ }],
151667
+ integrations: [{
151668
+ name: "Poki Developer Profile",
151669
+ fields: [{
151670
+ key: "gameId",
151671
+ label: "Game ID",
151672
+ type: "text",
151673
+ placeholder: "e.g., poki-game-id"
151674
+ }, {
151675
+ key: "apiKey",
151676
+ label: "Developer Token",
151677
+ type: "password",
151678
+ placeholder: "Poki Developer Token"
151679
+ }]
151680
+ }]
151681
+ });
151571
151682
  //#endregion
151572
151683
  export { src_default as default };
151573
151684