@pipelab/plugin-electron 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.mjs CHANGED
@@ -4,11 +4,11 @@ import { normalize } from "path";
4
4
  import { formatWithOptions, types } from "util";
5
5
  import path, { basename, delimiter, dirname, join } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
- import { arch, constants, platform, tmpdir } from "node:os";
7
+ import { arch, constants, platform } from "node:os";
8
8
  import { appendFileSync, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
9
+ import { access, 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 { access, 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";
@@ -1595,6 +1595,56 @@ function literal(literal_, message) {
1595
1595
  }
1596
1596
  };
1597
1597
  }
1598
+ function looseObject(entries, message) {
1599
+ return {
1600
+ kind: "schema",
1601
+ type: "loose_object",
1602
+ reference: looseObject,
1603
+ expects: "Object",
1604
+ async: false,
1605
+ entries,
1606
+ message,
1607
+ _run(dataset, config2) {
1608
+ const input = dataset.value;
1609
+ if (input && typeof input === "object") {
1610
+ dataset.typed = true;
1611
+ dataset.value = {};
1612
+ for (const key in this.entries) {
1613
+ const value2 = input[key];
1614
+ const valueDataset = this.entries[key]._run({
1615
+ typed: false,
1616
+ value: value2
1617
+ }, config2);
1618
+ if (valueDataset.issues) {
1619
+ const pathItem = {
1620
+ type: "object",
1621
+ origin: "value",
1622
+ input,
1623
+ key,
1624
+ value: value2
1625
+ };
1626
+ for (const issue of valueDataset.issues) {
1627
+ if (issue.path) issue.path.unshift(pathItem);
1628
+ else issue.path = [pathItem];
1629
+ dataset.issues?.push(issue);
1630
+ }
1631
+ if (!dataset.issues) dataset.issues = valueDataset.issues;
1632
+ if (config2.abortEarly) {
1633
+ dataset.typed = false;
1634
+ break;
1635
+ }
1636
+ }
1637
+ if (!valueDataset.typed) dataset.typed = false;
1638
+ if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
1639
+ }
1640
+ if (!dataset.issues || !config2.abortEarly) {
1641
+ for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
1642
+ }
1643
+ } else _addIssue(this, "type", dataset, config2);
1644
+ return dataset;
1645
+ }
1646
+ };
1647
+ }
1598
1648
  function number(message) {
1599
1649
  return {
1600
1650
  kind: "schema",
@@ -2132,6 +2182,18 @@ settingsMigratorInternal.createMigrations({
2132
2182
  })
2133
2183
  ]
2134
2184
  });
2185
+ const connectionsMigratorInternal = createMigrator();
2186
+ const defaultConnections = connectionsMigratorInternal.createDefault({
2187
+ version: "1.0.0",
2188
+ connections: []
2189
+ });
2190
+ connectionsMigratorInternal.createMigrations({
2191
+ defaultValue: defaultConnections,
2192
+ migrations: [createMigration({
2193
+ version: "1.0.0",
2194
+ up: finalVersion
2195
+ })]
2196
+ });
2135
2197
  const fileRepoMigratorInternal = createMigrator();
2136
2198
  const defaultFileRepo = fileRepoMigratorInternal.createDefault({
2137
2199
  version: "2.0.0",
@@ -2293,11 +2355,51 @@ const LEGACY_ID_MAP = {
2293
2355
  };
2294
2356
  const getStrictPluginId = (pluginId) => {
2295
2357
  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;
2358
+ return LEGACY_ID_MAP[pluginId] || pluginId;
2300
2359
  };
2360
+ //#endregion
2361
+ //#region ../../packages/shared/src/save-location.ts
2362
+ const SaveLocationInternalValidator = object({
2363
+ id: string(),
2364
+ project: string(),
2365
+ lastModified: string(),
2366
+ type: literal("internal"),
2367
+ configName: string()
2368
+ });
2369
+ const SaveLocationValidator = union([
2370
+ object({
2371
+ id: string(),
2372
+ project: string(),
2373
+ path: string(),
2374
+ lastModified: string(),
2375
+ type: literal("external"),
2376
+ summary: object({
2377
+ plugins: array(string()),
2378
+ name: string(),
2379
+ description: string()
2380
+ })
2381
+ }),
2382
+ SaveLocationInternalValidator,
2383
+ object({
2384
+ id: string(),
2385
+ project: string(),
2386
+ type: literal("pipelab-cloud")
2387
+ })
2388
+ ]);
2389
+ object({
2390
+ version: literal("1.0.0"),
2391
+ data: optional(record(string(), SaveLocationValidator), {})
2392
+ });
2393
+ const FileRepoProjectValidatorV2$1 = object({
2394
+ id: string(),
2395
+ name: string(),
2396
+ description: string()
2397
+ });
2398
+ object({
2399
+ version: literal("2.0.0"),
2400
+ projects: array(FileRepoProjectValidatorV2$1),
2401
+ pipelines: optional(array(SaveLocationValidator), [])
2402
+ });
2301
2403
  object({
2302
2404
  cacheFolder: string(),
2303
2405
  theme: union([literal("light"), literal("dark")]),
@@ -2449,6 +2551,17 @@ object({
2449
2551
  })),
2450
2552
  isInternalMigrationBannerClosed: optional(boolean(), false)
2451
2553
  });
2554
+ const ConnectionValidator = looseObject({
2555
+ id: string(),
2556
+ pluginName: string(),
2557
+ name: string(),
2558
+ createdAt: string(),
2559
+ isDefault: boolean()
2560
+ });
2561
+ object({
2562
+ version: literal("1.0.0"),
2563
+ connections: array(ConnectionValidator)
2564
+ });
2452
2565
  //#endregion
2453
2566
  //#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
2454
2567
  const prettyLogStyles = {
@@ -2969,7 +3082,7 @@ const useLogger = () => {
2969
3082
  const OriginValidator = object({
2970
3083
  pluginId: string(),
2971
3084
  nodeId: string(),
2972
- version: pipe(optional(string()), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent."))
3085
+ version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
2973
3086
  });
2974
3087
  const BlockActionValidatorV1 = object({
2975
3088
  type: literal("action"),
@@ -2982,7 +3095,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
2982
3095
  const BlockActionValidatorV3 = object({
2983
3096
  type: literal("action"),
2984
3097
  uid: string(),
2985
- name: pipe(optional(string()), description("A custom name provided by the user")),
3098
+ name: optional(pipe(string(), description("A custom name provided by the user"))),
2986
3099
  disabled: optional(boolean()),
2987
3100
  params: record(string(), object({
2988
3101
  editor: EditorParamValidatorV3,
@@ -45312,35 +45425,6 @@ const createBooleanParam = (value, definition) => {
45312
45425
  };
45313
45426
  };
45314
45427
  //#endregion
45315
- //#region ../../packages/shared/src/save-location.ts
45316
- const SaveLocationInternalValidator = object({
45317
- id: string(),
45318
- project: string(),
45319
- lastModified: string(),
45320
- type: literal("internal"),
45321
- configName: string()
45322
- });
45323
- const SaveLocationValidator = union([
45324
- object({
45325
- id: string(),
45326
- project: string(),
45327
- path: string(),
45328
- lastModified: string(),
45329
- type: literal("external"),
45330
- summary: object({
45331
- plugins: array(string()),
45332
- name: string(),
45333
- description: string()
45334
- })
45335
- }),
45336
- SaveLocationInternalValidator,
45337
- object({
45338
- id: string(),
45339
- project: string(),
45340
- type: literal("pipelab-cloud")
45341
- })
45342
- ]);
45343
- //#endregion
45344
45428
  //#region ../../packages/shared/src/websocket.types.ts
45345
45429
  var WebSocketError = class extends Error {
45346
45430
  constructor(message, code, requestId) {
@@ -45357,20 +45441,6 @@ object({
45357
45441
  version: literal("1.0.0"),
45358
45442
  data: optional(record(string(), SaveLocationValidator), {})
45359
45443
  });
45360
- const FileRepoProjectValidatorV2$1 = object({
45361
- id: string(),
45362
- name: string(),
45363
- description: string()
45364
- });
45365
- object({
45366
- version: literal("2.0.0"),
45367
- projects: array(FileRepoProjectValidatorV2$1),
45368
- pipelines: optional(array(SaveLocationValidator), [])
45369
- });
45370
- object({
45371
- version: literal("1.0.0"),
45372
- data: optional(record(string(), SaveLocationValidator), {})
45373
- });
45374
45444
  const FileRepoProjectValidatorV2 = object({
45375
45445
  id: string(),
45376
45446
  name: string(),
@@ -45390,9 +45460,42 @@ var init_esm_shims = __esmMin((() => {
45390
45460
  __dirname = /* @__PURE__ */ getDirname();
45391
45461
  }));
45392
45462
  //#endregion
45393
- //#region ../../packages/core-node/src/context.ts
45463
+ //#region ../../packages/constants/src/index.ts
45394
45464
  init_esm_shims();
45395
- const _dirname = typeof __dirname !== "undefined" ? __dirname : typeof import.meta !== "undefined" && import.meta.url ? dirname(fileURLToPath(import.meta.url)) : process.cwd();
45465
+ const outFolderName = (binName, platform, arch) => {
45466
+ let platformName = "";
45467
+ let archName = "";
45468
+ console.log("platform", platform);
45469
+ if (platform === "linux") platformName = "linux";
45470
+ else if (platform === "win32") platformName = "win32";
45471
+ else if (platform === "darwin") platformName = "darwin";
45472
+ else throw new Error("Unsupported platform");
45473
+ if (arch === "x64") archName = "x64";
45474
+ else if (arch === "arm") archName = "arm";
45475
+ else if (arch === "arm64") archName = "arm64";
45476
+ else if (arch === "ia32") archName = "ia32";
45477
+ else throw new Error("Unsupported architecture");
45478
+ return `${binName}-${platformName}-${archName}`;
45479
+ };
45480
+ /**
45481
+ * Get the binary name for a given platform
45482
+ * @param name
45483
+ * @param platform If not provided, it will try to use process.platform (Node.js only)
45484
+ * @returns
45485
+ */
45486
+ const getBinName = (name, platform) => {
45487
+ const p = platform || (typeof process !== "undefined" ? process.platform : "unknown");
45488
+ if (p === "win32") return `${name}.exe`;
45489
+ if (p === "darwin") return `${name}.app/Contents/MacOS/${name}`;
45490
+ return name;
45491
+ };
45492
+ const websocketPort = 33753;
45493
+ const DEFAULT_NODE_VERSION = "24.14.1";
45494
+ const DEFAULT_PNPM_VERSION = "10.12.0";
45495
+ //#endregion
45496
+ //#region ../../packages/core-node/src/context.ts
45497
+ const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
45498
+ const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
45396
45499
  const isDev = process.env.NODE_ENV === "development";
45397
45500
  /**
45398
45501
  * Finds the monorepo root by looking for pnpm-workspace.yaml.
@@ -48964,36 +49067,6 @@ const useAPI = () => {
48964
49067
  };
48965
49068
  };
48966
49069
  //#endregion
48967
- //#region ../../packages/constants/src/index.ts
48968
- const outFolderName = (binName, platform, arch) => {
48969
- let platformName = "";
48970
- let archName = "";
48971
- console.log("platform", platform);
48972
- if (platform === "linux") platformName = "linux";
48973
- else if (platform === "win32") platformName = "win32";
48974
- else if (platform === "darwin") platformName = "darwin";
48975
- else throw new Error("Unsupported platform");
48976
- if (arch === "x64") archName = "x64";
48977
- else if (arch === "arm") archName = "arm";
48978
- else if (arch === "arm64") archName = "arm64";
48979
- else if (arch === "ia32") archName = "ia32";
48980
- else throw new Error("Unsupported architecture");
48981
- return `${binName}-${platformName}-${archName}`;
48982
- };
48983
- /**
48984
- * Get the binary name for a given platform
48985
- * @param name
48986
- * @param platform If not provided, it will try to use process.platform (Node.js only)
48987
- * @returns
48988
- */
48989
- const getBinName = (name, platform) => {
48990
- const p = platform || (typeof process !== "undefined" ? process.platform : "unknown");
48991
- if (p === "win32") return `${name}.exe`;
48992
- if (p === "darwin") return `${name}.app/Contents/MacOS/${name}`;
48993
- return name;
48994
- };
48995
- const websocketPort = 33753;
48996
- //#endregion
48997
49070
  //#region ../../packages/core-node/src/websocket-server.ts
48998
49071
  var WebSocketServer = class {
48999
49072
  wss = null;
@@ -89398,14 +89471,6 @@ var import_tar = /* @__PURE__ */ __toESM(require_tar$1(), 1);
89398
89471
  var import_yauzl = /* @__PURE__ */ __toESM(require_yauzl(), 1);
89399
89472
  require_archiver();
89400
89473
  /**
89401
- * Generates a unique temporary folder.
89402
- */
89403
- const generateTempFolder$1 = async (base) => {
89404
- const targetBase = base || tmpdir();
89405
- await mkdir(targetBase, { recursive: true });
89406
- return await mkdtemp(join(await realpath(targetBase), "pipelab-"));
89407
- };
89408
- /**
89409
89474
  * Extracts a .tar.gz archive.
89410
89475
  */
89411
89476
  async function extractTarGz(archivePath, destinationDir) {
@@ -100986,11 +101051,11 @@ var require_cp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100986
101051
  var require_with_temp_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
100987
101052
  const { join: join$5, sep: sep$1 } = __require("path");
100988
101053
  const getOptions = require_get_options();
100989
- const { mkdir: mkdir$4, mkdtemp: mkdtemp$1, rm: rm$5 } = __require("fs/promises");
101054
+ const { mkdir: mkdir$4, mkdtemp, rm: rm$5 } = __require("fs/promises");
100990
101055
  const withTempDir = async (root, fn, opts) => {
100991
101056
  const options = getOptions(opts, { copy: ["tmpPrefix"] });
100992
101057
  await mkdir$4(root, { recursive: true });
100993
- const target = await mkdtemp$1(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
101058
+ const target = await mkdtemp(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
100994
101059
  let err;
100995
101060
  let result;
100996
101061
  try {
@@ -110589,9 +110654,9 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110589
110654
  //#region ../../node_modules/pacote/lib/util/cache-dir.js
110590
110655
  var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
110591
110656
  const { resolve: resolve$6 } = __require("node:path");
110592
- const { tmpdir: tmpdir$1, homedir } = __require("node:os");
110657
+ const { tmpdir, homedir } = __require("node:os");
110593
110658
  module.exports = (fakePlatform = false) => {
110594
- const temp = tmpdir$1();
110659
+ const temp = tmpdir();
110595
110660
  const uidOrPid = process.getuid ? process.getuid() : process.pid;
110596
110661
  const home = homedir() || resolve$6(temp, "npm-" + uidOrPid);
110597
110662
  const platform = fakePlatform || process.platform;
@@ -150664,7 +150729,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150664
150729
  const { promisify: promisify$1 } = __require("util");
150665
150730
  const path$1 = __require("path");
150666
150731
  const { createHash } = __require("crypto");
150667
- const { realpath: realpath$1, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150732
+ const { realpath, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
150668
150733
  const url = __require("url");
150669
150734
  const slasher = require_glob_slash();
150670
150735
  const minimatch = require_minimatch();
@@ -150987,7 +151052,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
150987
151052
  };
150988
151053
  const getHandlers = (methods) => Object.assign({
150989
151054
  lstat: promisify$1(lstat),
150990
- realpath: promisify$1(realpath$1),
151055
+ realpath: promisify$1(realpath),
150991
151056
  createReadStream: createReadStream$1,
150992
151057
  readdir: promisify$1(readdir$1),
150993
151058
  sendError
@@ -151126,8 +151191,6 @@ const sendStartupProgress = (message) => {
151126
151191
  };
151127
151192
  //#endregion
151128
151193
  //#region ../../packages/core-node/src/utils/remote.ts
151129
- const DEFAULT_NODE_VERSION = "24.14.1";
151130
- const DEFAULT_PNPM_VERSION = "10.12.0";
151131
151194
  function isPackageComplete(packageDir) {
151132
151195
  return existsSync(join(packageDir, "package.json"));
151133
151196
  }
@@ -151319,7 +151382,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
151319
151382
  const extension = isWindows ? "zip" : "tar.gz";
151320
151383
  const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
151321
151384
  const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
151322
- const tempDir = await generateTempFolder$1(tmpdir());
151385
+ const tempDir = await context.createTempFolder("node-download-");
151323
151386
  const archivePath = join(tempDir, fileName);
151324
151387
  sendStartupProgress(`Downloading Node.js v${version}...`);
151325
151388
  console.log(`Downloading Node.js from ${downloadUrl}...`);
@@ -151554,15 +151617,6 @@ if (isDev && projectRoot) {
151554
151617
  //#region ../plugin-core/src/pipelab.ts
151555
151618
  const createActionRunner = (runner) => runner;
151556
151619
  //#endregion
151557
- //#region ../plugin-core/src/fs-utils.ts
151558
- const generateTempFolder = async (base) => {
151559
- const targetBase = base || tmpdir();
151560
- await mkdir(targetBase, { recursive: true });
151561
- const realPath = await realpath(targetBase);
151562
- console.log("join", join(realPath, "pipelab-"));
151563
- return await mkdtemp(join(realPath, "pipelab-"));
151564
- };
151565
- //#endregion
151566
151620
  //#region ../plugin-core/src/node-utils.ts
151567
151621
  const fileExists = async (path) => {
151568
151622
  try {
@@ -152090,7 +152144,7 @@ const forge = async (action, appFolder, { cwd, log, inputs, setOutput, paths, ab
152090
152144
  log("Building electron");
152091
152145
  if (action !== "preview") await detectRuntime(appFolder);
152092
152146
  const { modules, node } = paths;
152093
- const destinationFolder = await generateTempFolder(paths.cache);
152147
+ const destinationFolder = await context.createTempFolder("electron-forge-");
152094
152148
  log(`Staging build in ${destinationFolder}`);
152095
152149
  try {
152096
152150
  const forge = join(destinationFolder, "node_modules", "@electron-forge", "cli", "dist", "electron-forge.js");
@@ -152122,7 +152176,7 @@ const forge = async (action, appFolder, { cwd, log, inputs, setOutput, paths, ab
152122
152176
  log("Setting productName to", completeConfiguration.name);
152123
152177
  pkgJSON.productName = completeConfiguration.name;
152124
152178
  completeConfiguration.icon = relativeIconPath1;
152125
- writeFile(join(destinationFolder, "config.cjs"), `module.exports = ${JSON.stringify(completeConfiguration, void 0, 2)}`, "utf8");
152179
+ await writeFile(join(destinationFolder, "config.cjs"), `module.exports = ${JSON.stringify(completeConfiguration, void 0, 2)}`, "utf8");
152126
152180
  if (isCJSOnly) {
152127
152181
  log("Setting type to", "commonjs");
152128
152182
  pkgJSON.type = "commonjs";