@pipelab/plugin-core 1.0.1-beta.8 → 1.0.1-latest.29
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/CHANGELOG.md +154 -0
- package/dist/index.cjs +78 -114
- package/dist/index.d.cts +39 -73
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +39 -73
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +35 -110
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
- package/src/pipelab.ts +62 -70
- package/src/utils.ts +17 -167
package/dist/index.d.mts
CHANGED
|
@@ -1,73 +1,72 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActionRunner, ActionRunnerData, ConditionRunner, DownloadHooks as Hooks, EventRunner, ExpressionRunner, LoopRunner, PipelabContext, Runner, RunnerCallbackFnArgument, downloadFile, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
|
|
2
2
|
import { z as schema } from "zod";
|
|
3
|
-
import { BrowserWindow } from "electron";
|
|
4
3
|
|
|
5
4
|
//#region src/pipelab.d.ts
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
id: string;
|
|
9
|
-
log: (...args: Parameters<(typeof console)["log"]>) => void;
|
|
10
|
-
};
|
|
11
|
-
type ActionRunnerData<ACTION extends Action> = {
|
|
5
|
+
declare const createActionRunner: <ACTION extends Action>(runner: (data: ActionRunnerData<ACTION>) => Promise<void>) => (data: ActionRunnerData<ACTION>) => Promise<void>;
|
|
6
|
+
declare const createConditionRunner: <CONDITION extends Condition>(runner: (data: {
|
|
12
7
|
log: typeof console.log;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
meta: ACTION["meta"];
|
|
8
|
+
inputs: ExtractInputsFromCondition<CONDITION>;
|
|
9
|
+
setMeta: (callback: (data: CONDITION["meta"]) => CONDITION["meta"]) => void;
|
|
10
|
+
meta: CONDITION["meta"];
|
|
17
11
|
cwd: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
cache: string;
|
|
21
|
-
pnpm: string;
|
|
22
|
-
node: string;
|
|
23
|
-
userData: string;
|
|
24
|
-
modules: string;
|
|
25
|
-
thirdparty: string;
|
|
26
|
-
};
|
|
27
|
-
api: {
|
|
28
|
-
fetchAsset: (packageName: string, version?: string) => Promise<string>;
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
};
|
|
31
|
-
browserWindow: BrowserWindow;
|
|
32
|
-
abortSignal: AbortSignal;
|
|
33
|
-
};
|
|
34
|
-
type ActionRunner<ACTION extends Action> = (data: ActionRunnerData<ACTION>) => Promise<void>;
|
|
35
|
-
declare const createActionRunner: <ACTION extends Action>(runner: ActionRunner<ACTION>) => ActionRunner<ACTION>;
|
|
36
|
-
type ConditionRunner<CONDITION extends Condition> = (data: {
|
|
12
|
+
context: PipelabContext;
|
|
13
|
+
}) => Promise<boolean>) => (data: {
|
|
37
14
|
log: typeof console.log;
|
|
38
15
|
inputs: ExtractInputsFromCondition<CONDITION>;
|
|
39
16
|
setMeta: (callback: (data: CONDITION["meta"]) => CONDITION["meta"]) => void;
|
|
40
17
|
meta: CONDITION["meta"];
|
|
41
18
|
cwd: string;
|
|
19
|
+
context: PipelabContext;
|
|
42
20
|
}) => Promise<boolean>;
|
|
43
|
-
declare const
|
|
44
|
-
|
|
21
|
+
declare const createLoopRunner: <LOOP extends Loop>(runner: (data: {
|
|
22
|
+
log: typeof console.log;
|
|
23
|
+
setOutput: SetOutputLoopFn<LOOP>;
|
|
24
|
+
inputs: ExtractInputsFromLoop<LOOP>;
|
|
25
|
+
setMeta: (callback: (data: LOOP["meta"]) => LOOP["meta"]) => void;
|
|
26
|
+
meta: LOOP["meta"];
|
|
27
|
+
cwd: string;
|
|
28
|
+
context: PipelabContext;
|
|
29
|
+
}) => Promise<"step" | "exit">) => (data: {
|
|
45
30
|
log: typeof console.log;
|
|
46
31
|
setOutput: SetOutputLoopFn<LOOP>;
|
|
47
32
|
inputs: ExtractInputsFromLoop<LOOP>;
|
|
48
33
|
setMeta: (callback: (data: LOOP["meta"]) => LOOP["meta"]) => void;
|
|
49
34
|
meta: LOOP["meta"];
|
|
50
35
|
cwd: string;
|
|
36
|
+
context: PipelabContext;
|
|
51
37
|
}) => Promise<"step" | "exit">;
|
|
52
|
-
declare const
|
|
53
|
-
|
|
38
|
+
declare const createExpressionRunner: <EXPRESSION extends Expression>(runner: (data: {
|
|
39
|
+
log: typeof console.log;
|
|
40
|
+
setOutput: SetOutputExpressionFn<EXPRESSION>;
|
|
41
|
+
inputs: ExtractInputsFromExpression<EXPRESSION>;
|
|
42
|
+
setMeta: (callback: (data: EXPRESSION["meta"]) => EXPRESSION["meta"]) => void;
|
|
43
|
+
meta: EXPRESSION["meta"];
|
|
44
|
+
cwd: string;
|
|
45
|
+
context: PipelabContext;
|
|
46
|
+
}) => Promise<string>) => (data: {
|
|
54
47
|
log: typeof console.log;
|
|
55
48
|
setOutput: SetOutputExpressionFn<EXPRESSION>;
|
|
56
49
|
inputs: ExtractInputsFromExpression<EXPRESSION>;
|
|
57
50
|
setMeta: (callback: (data: EXPRESSION["meta"]) => EXPRESSION["meta"]) => void;
|
|
58
51
|
meta: EXPRESSION["meta"];
|
|
59
52
|
cwd: string;
|
|
53
|
+
context: PipelabContext;
|
|
60
54
|
}) => Promise<string>;
|
|
61
|
-
declare const
|
|
62
|
-
|
|
55
|
+
declare const createEventRunner: <EVENT extends Event>(runner: (data: {
|
|
56
|
+
log: typeof console.log;
|
|
57
|
+
inputs: ExtractInputsFromEvent<EVENT>;
|
|
58
|
+
setMeta: (callback: (data: EVENT["meta"]) => EVENT["meta"]) => void;
|
|
59
|
+
meta: EVENT["meta"];
|
|
60
|
+
cwd: string;
|
|
61
|
+
context: PipelabContext;
|
|
62
|
+
}) => Promise<void>) => (data: {
|
|
63
63
|
log: typeof console.log;
|
|
64
64
|
inputs: ExtractInputsFromEvent<EVENT>;
|
|
65
65
|
setMeta: (callback: (data: EVENT["meta"]) => EVENT["meta"]) => void;
|
|
66
66
|
meta: EVENT["meta"];
|
|
67
67
|
cwd: string;
|
|
68
|
+
context: PipelabContext;
|
|
68
69
|
}) => Promise<void>;
|
|
69
|
-
declare const createEventRunner: <EVENT extends Event>(runner: EventRunner<EVENT>) => EventRunner<EVENT>;
|
|
70
|
-
type Runner = ActionRunner<any> | LoopRunner<any> | EventRunner<any> | ConditionRunner<any>;
|
|
71
70
|
declare const sleep: (duration: number) => Promise<unknown>;
|
|
72
71
|
//#endregion
|
|
73
72
|
//#region src/create-plugin.d.ts
|
|
@@ -79,39 +78,6 @@ declare const createPlugin: (plugin: Plugin) => Plugin;
|
|
|
79
78
|
//#endregion
|
|
80
79
|
//#region src/utils.d.ts
|
|
81
80
|
declare const fileExists: (path: string) => Promise<boolean>;
|
|
82
|
-
declare const runWithLiveLogs: (command: string, args: string[], execaOptions: Options, log: typeof console.log, hooks?: {
|
|
83
|
-
onStdout?: (data: string, subprocess: Subprocess) => void;
|
|
84
|
-
onStderr?: (data: string, subprocess: Subprocess) => void;
|
|
85
|
-
onExit?: (code: number) => void;
|
|
86
|
-
onCreated?: (subprocess: Subprocess) => void;
|
|
87
|
-
}, abortSignal?: AbortSignal) => Promise<void>;
|
|
88
|
-
interface Hooks {
|
|
89
|
-
onProgress?: (data: {
|
|
90
|
-
progress: number;
|
|
91
|
-
downloadedSize: number;
|
|
92
|
-
}) => void;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Downloads a file from a given URL to a specified local path with progress tracking.
|
|
96
|
-
*
|
|
97
|
-
* @param url - The URL of the file to download.
|
|
98
|
-
* @param localPath - The local file path to save the downloaded file.
|
|
99
|
-
* @returns A promise that resolves when the file is downloaded.
|
|
100
|
-
*/
|
|
101
|
-
declare const downloadFile: (url: string, localPath: string, hooks?: Hooks, abortSignal?: AbortSignal) => Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Installs an NPM package from the npm registry as a tarball if not already present.
|
|
104
|
-
* @param thirdpartyDir The directory where third-party tools are stored.
|
|
105
|
-
* @param name The name of the package (e.g., 'pnpm' or '@poki/cli').
|
|
106
|
-
* @param version The version of the package.
|
|
107
|
-
* @param options (Optional) configuration for dependency installation.
|
|
108
|
-
* @returns A Promise that resolves to the path of the extracted package (the 'package' subfolder).
|
|
109
|
-
*/
|
|
110
|
-
declare const ensureNPMPackage: (thirdpartyDir: string, name: string, version: string, options?: {
|
|
111
|
-
nodePath?: string;
|
|
112
|
-
pnpmPath?: string;
|
|
113
|
-
installDeps?: boolean;
|
|
114
|
-
}) => Promise<string>;
|
|
115
81
|
//#endregion
|
|
116
82
|
//#region src/fs-utils.d.ts
|
|
117
83
|
declare const ensure: (filesPath: string, defaultContent?: string) => Promise<void>;
|
|
@@ -151,5 +117,5 @@ declare const detectRuntime: (appFolder: string | undefined) => Promise<OutputRu
|
|
|
151
117
|
//#region src/index.d.ts
|
|
152
118
|
type NoData = { [index in string]?: unknown };
|
|
153
119
|
//#endregion
|
|
154
|
-
export { ActionRunner, ActionRunnerData, ConditionRunner, EventRunner, ExpressionRunner, ExternalCommandError, Hooks, LoopRunner, NoData, OutputRuntimes, Plugin, Runner, RunnerCallbackFnArgument, createActionRunner, createConditionRunner, createEventRunner, createExpressionRunner, createLoopRunner, createPlugin, detectRuntime, downloadFile, ensure,
|
|
120
|
+
export { type ActionRunner, type ActionRunnerData, type ConditionRunner, type EventRunner, type ExpressionRunner, ExternalCommandError, type Hooks, type LoopRunner, NoData, OutputRuntimes, PipelabContext, Plugin, type Runner, type RunnerCallbackFnArgument, createActionRunner, createConditionRunner, createEventRunner, createExpressionRunner, createLoopRunner, createPlugin, detectRuntime, downloadFile, ensure, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, generateTempFolder, runPnpm, runWithLiveLogs, schema, sleep, zipFolder };
|
|
155
121
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/pipelab.ts","../src/create-plugin.ts","../src/utils.ts","../src/fs-utils.ts","../src/archive-utils.ts","../src/custom-errors.ts","../src/node-utils.ts","../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/pipelab.ts","../src/create-plugin.ts","../src/utils.ts","../src/fs-utils.ts","../src/archive-utils.ts","../src/custom-errors.ts","../src/node-utils.ts","../src/index.ts"],"mappings":"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"}
|
package/dist/index.mjs
CHANGED
|
@@ -2,13 +2,11 @@ import { o as debugLog, t as QuickJSEmscriptenModuleError } from "./chunk-JTKJZQ
|
|
|
2
2
|
import { hostname } from "os";
|
|
3
3
|
import { normalize } from "path";
|
|
4
4
|
import { formatWithOptions, types } from "util";
|
|
5
|
-
import {
|
|
6
|
-
import { dirname, join } from "node:path";
|
|
5
|
+
import { PipelabContext, downloadFile, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, runPnpm, runWithLiveLogs } from "@pipelab/core-node";
|
|
7
6
|
import { access, mkdir, mkdtemp, realpath, writeFile } from "node:fs/promises";
|
|
8
|
-
import {
|
|
9
|
-
import { pipeline } from "node:stream/promises";
|
|
10
|
-
import pacote from "pacote";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
11
8
|
import { tmpdir } from "node:os";
|
|
9
|
+
import { createWriteStream } from "node:fs";
|
|
12
10
|
import tar from "tar";
|
|
13
11
|
import yauzl from "yauzl";
|
|
14
12
|
import archiver from "archiver";
|
|
@@ -2351,8 +2349,6 @@ const AppSettingsValidatorV6 = object({
|
|
|
2351
2349
|
const AppSettingsValidatorV7 = object({
|
|
2352
2350
|
theme: union([literal("light"), literal("dark")]),
|
|
2353
2351
|
version: literal("7.0.0"),
|
|
2354
|
-
cacheFolder: string(),
|
|
2355
|
-
clearTemporaryFoldersOnPipelineEnd: boolean(),
|
|
2356
2352
|
locale: union([
|
|
2357
2353
|
literal("en-US"),
|
|
2358
2354
|
literal("fr-FR"),
|
|
@@ -2376,7 +2372,12 @@ const AppSettingsValidatorV7 = object({
|
|
|
2376
2372
|
id: string(),
|
|
2377
2373
|
name: string(),
|
|
2378
2374
|
url: string()
|
|
2379
|
-
}))
|
|
2375
|
+
})),
|
|
2376
|
+
buildHistory: object({ retentionPolicy: object({
|
|
2377
|
+
enabled: boolean(),
|
|
2378
|
+
maxEntries: number(),
|
|
2379
|
+
maxAge: number()
|
|
2380
|
+
}) })
|
|
2380
2381
|
});
|
|
2381
2382
|
const AppSettingsValidator = AppSettingsValidatorV7;
|
|
2382
2383
|
//#endregion
|
|
@@ -4084,8 +4085,6 @@ var en_US_default = {
|
|
|
4084
4085
|
"advanced": "Advanced",
|
|
4085
4086
|
"billing": "Billing"
|
|
4086
4087
|
},
|
|
4087
|
-
"clearTempFolders": "Automatically clean up temporary files",
|
|
4088
|
-
"clearTempFoldersDescription": "When enabled, all temporary files created during pipeline execution will be automatically deleted after the pipeline completes. This helps save disk space but you may need to copy artifacts yourself to preserve them.",
|
|
4089
4088
|
"pipeline-cache-folder": "Pipeline Cache Folder:",
|
|
4090
4089
|
"enter-or-browse-for-a-folder": "Enter or browse for a folder",
|
|
4091
4090
|
"browse": "Browse",
|
|
@@ -4101,7 +4100,20 @@ var en_US_default = {
|
|
|
4101
4100
|
"select-cache-folder": "Select Cache Folder",
|
|
4102
4101
|
"restart-dashboard-tour": "Restart Dashboard Tour",
|
|
4103
4102
|
"restart-editor-tour": "Restart Editor Tour",
|
|
4104
|
-
"tour-reset-success": "Tour has been reset. It will start the next time you visit the page."
|
|
4103
|
+
"tour-reset-success": "Tour has been reset. It will start the next time you visit the page.",
|
|
4104
|
+
"retentionPolicy": "Retention Policy",
|
|
4105
|
+
"retentionPolicyDescription": "Manage how long your build logs and history are kept.",
|
|
4106
|
+
"retentionEnabled": "Enable Retention Policy",
|
|
4107
|
+
"retentionMaxEntries": "Maximum Entries",
|
|
4108
|
+
"retentionMaxEntriesDescription": "Keep up to this number of entries per pipeline.",
|
|
4109
|
+
"retentionMaxAge": "Maximum Age (days)",
|
|
4110
|
+
"retentionMaxAgeDescription": "Keep entries for up to this many days.",
|
|
4111
|
+
"storage-pipelab": "Pipelab",
|
|
4112
|
+
"storage-other": "Other Apps",
|
|
4113
|
+
"storage-free": "Free Space",
|
|
4114
|
+
"disk-usage": "Disk Usage",
|
|
4115
|
+
"free": "Free",
|
|
4116
|
+
"other": "Other"
|
|
4105
4117
|
},
|
|
4106
4118
|
headers: {
|
|
4107
4119
|
"dashboard": "Dashboard",
|
|
@@ -64287,113 +64299,16 @@ const createPlugin = (plugin) => {
|
|
|
64287
64299
|
return plugin;
|
|
64288
64300
|
};
|
|
64289
64301
|
//#endregion
|
|
64290
|
-
//#region src/custom-errors.ts
|
|
64291
|
-
var ExternalCommandError = class ExternalCommandError extends Error {
|
|
64292
|
-
code;
|
|
64293
|
-
constructor(message, code) {
|
|
64294
|
-
super(message);
|
|
64295
|
-
this.code = code;
|
|
64296
|
-
Object.setPrototypeOf(this, ExternalCommandError.prototype);
|
|
64297
|
-
}
|
|
64298
|
-
};
|
|
64299
|
-
//#endregion
|
|
64300
64302
|
//#region src/utils.ts
|
|
64301
64303
|
const fileExists = async (path) => {
|
|
64302
64304
|
try {
|
|
64305
|
+
const { access } = await import("node:fs/promises");
|
|
64303
64306
|
await access(path);
|
|
64304
64307
|
return true;
|
|
64305
64308
|
} catch {
|
|
64306
64309
|
return false;
|
|
64307
64310
|
}
|
|
64308
64311
|
};
|
|
64309
|
-
const runWithLiveLogs = async (command, args, execaOptions, log, hooks, abortSignal) => {
|
|
64310
|
-
console.log("command: ", command, args.join(" "));
|
|
64311
|
-
const subprocess = execa(command, args, {
|
|
64312
|
-
...execaOptions,
|
|
64313
|
-
stdout: "pipe",
|
|
64314
|
-
stderr: "pipe",
|
|
64315
|
-
stdin: "pipe",
|
|
64316
|
-
env: {
|
|
64317
|
-
...process.env,
|
|
64318
|
-
...execaOptions.env,
|
|
64319
|
-
TERM: "xterm-256color",
|
|
64320
|
-
FORCE_STDERR_LOGGING: "1"
|
|
64321
|
-
},
|
|
64322
|
-
cancelSignal: abortSignal
|
|
64323
|
-
});
|
|
64324
|
-
hooks?.onCreated?.(subprocess);
|
|
64325
|
-
subprocess.stdout?.on("data", (data) => {
|
|
64326
|
-
hooks?.onStdout?.(data.toString(), subprocess);
|
|
64327
|
-
});
|
|
64328
|
-
subprocess.stderr?.on("data", (data) => {
|
|
64329
|
-
hooks?.onStderr?.(data.toString(), subprocess);
|
|
64330
|
-
});
|
|
64331
|
-
try {
|
|
64332
|
-
const { exitCode } = await subprocess;
|
|
64333
|
-
hooks?.onExit?.(exitCode ?? 0);
|
|
64334
|
-
} catch (error) {
|
|
64335
|
-
const code = error.exitCode ?? 1;
|
|
64336
|
-
hooks?.onExit?.(code);
|
|
64337
|
-
throw new ExternalCommandError(error.message, code);
|
|
64338
|
-
}
|
|
64339
|
-
};
|
|
64340
|
-
/**
|
|
64341
|
-
* Downloads a file from a given URL to a specified local path with progress tracking.
|
|
64342
|
-
*
|
|
64343
|
-
* @param url - The URL of the file to download.
|
|
64344
|
-
* @param localPath - The local file path to save the downloaded file.
|
|
64345
|
-
* @returns A promise that resolves when the file is downloaded.
|
|
64346
|
-
*/
|
|
64347
|
-
const downloadFile = async (url, localPath, hooks, abortSignal) => {
|
|
64348
|
-
const response = await fetch(url, { signal: abortSignal });
|
|
64349
|
-
if (!response.ok) throw new Error(`Failed to fetch file: ${response.statusText}`);
|
|
64350
|
-
const contentLength = response.headers.get("content-length");
|
|
64351
|
-
if (!contentLength) throw new Error("Content-Length header is missing");
|
|
64352
|
-
const totalSize = parseInt(contentLength, 10);
|
|
64353
|
-
let downloadedSize = 0;
|
|
64354
|
-
const fileStream = createWriteStream(localPath);
|
|
64355
|
-
const progressStream = new TransformStream({ transform(chunk, controller) {
|
|
64356
|
-
downloadedSize += chunk.length;
|
|
64357
|
-
const progress = downloadedSize / totalSize * 100;
|
|
64358
|
-
if (hooks?.onProgress) hooks.onProgress({
|
|
64359
|
-
progress,
|
|
64360
|
-
downloadedSize
|
|
64361
|
-
});
|
|
64362
|
-
controller.enqueue(chunk);
|
|
64363
|
-
} });
|
|
64364
|
-
const readable = response.body?.pipeThrough(progressStream);
|
|
64365
|
-
if (!readable) throw new Error("Failed to create a readable stream");
|
|
64366
|
-
await pipeline(readable, fileStream);
|
|
64367
|
-
};
|
|
64368
|
-
/**
|
|
64369
|
-
* Installs an NPM package from the npm registry as a tarball if not already present.
|
|
64370
|
-
* @param thirdpartyDir The directory where third-party tools are stored.
|
|
64371
|
-
* @param name The name of the package (e.g., 'pnpm' or '@poki/cli').
|
|
64372
|
-
* @param version The version of the package.
|
|
64373
|
-
* @param options (Optional) configuration for dependency installation.
|
|
64374
|
-
* @returns A Promise that resolves to the path of the extracted package (the 'package' subfolder).
|
|
64375
|
-
*/
|
|
64376
|
-
const ensureNPMPackage = async (thirdpartyDir, name, version, options) => {
|
|
64377
|
-
const packageDir = join(thirdpartyDir, name, version);
|
|
64378
|
-
const finalPath = join(packageDir, "package");
|
|
64379
|
-
if (await fileExists(finalPath)) return finalPath;
|
|
64380
|
-
console.log(`NPM package ${name}@${version} not found at ${finalPath}, installing...`);
|
|
64381
|
-
console.log(`Extracting ${name}@${version} to ${finalPath}...`);
|
|
64382
|
-
await mkdir(packageDir, { recursive: true });
|
|
64383
|
-
await pacote.extract(`${name}@${version}`, finalPath);
|
|
64384
|
-
if (options?.installDeps && options.pnpmPath) {
|
|
64385
|
-
console.log(`Installing dependencies for ${name}@${version} using pnpm at ${options.pnpmPath}...`);
|
|
64386
|
-
await execa(options.nodePath || process.execPath, [
|
|
64387
|
-
options.pnpmPath,
|
|
64388
|
-
"install",
|
|
64389
|
-
"--prod"
|
|
64390
|
-
], {
|
|
64391
|
-
cwd: finalPath,
|
|
64392
|
-
stdio: "inherit"
|
|
64393
|
-
});
|
|
64394
|
-
}
|
|
64395
|
-
return finalPath;
|
|
64396
|
-
};
|
|
64397
64312
|
//#endregion
|
|
64398
64313
|
//#region src/fs-utils.ts
|
|
64399
64314
|
const ensure = async (filesPath, defaultContent = "{}") => {
|
|
@@ -64486,6 +64401,16 @@ const zipFolder = async (from, to, log) => {
|
|
|
64486
64401
|
});
|
|
64487
64402
|
};
|
|
64488
64403
|
//#endregion
|
|
64404
|
+
//#region src/custom-errors.ts
|
|
64405
|
+
var ExternalCommandError = class ExternalCommandError extends Error {
|
|
64406
|
+
code;
|
|
64407
|
+
constructor(message, code) {
|
|
64408
|
+
super(message);
|
|
64409
|
+
this.code = code;
|
|
64410
|
+
Object.setPrototypeOf(this, ExternalCommandError.prototype);
|
|
64411
|
+
}
|
|
64412
|
+
};
|
|
64413
|
+
//#endregion
|
|
64489
64414
|
//#region src/node-utils.ts
|
|
64490
64415
|
const fileExists$1 = async (path) => {
|
|
64491
64416
|
try {
|
|
@@ -64515,6 +64440,6 @@ const detectRuntime = async (appFolder) => {
|
|
|
64515
64440
|
return detectedRuntime;
|
|
64516
64441
|
};
|
|
64517
64442
|
//#endregion
|
|
64518
|
-
export { AppSettingsValidator, AppSettingsValidatorV1, AppSettingsValidatorV2, AppSettingsValidatorV3, AppSettingsValidatorV4, AppSettingsValidatorV5, AppSettingsValidatorV6, AppSettingsValidatorV7, BenefitNotFoundError, EditorParamValidatorV3, ExternalCommandError, OriginValidator, src_default as RELEASE_SYNC, SaveLocationExternalValidator, SaveLocationInternalValidator, SaveLocationPipelabCloudValidator, SaveLocationValidator, SavedFileDefaultValidator, SavedFileSimpleValidator, SavedFileValidator, SavedFileValidatorV1, SavedFileValidatorV2, SavedFileValidatorV3, SavedFileValidatorV4, ShellChannels, SubscriptionExpiredError, SubscriptionRequiredError, UnauthorizedError, VariableValidatorV1, WebSocketConnectionError, WebSocketError, WebSocketTimeoutError, appSettingsMigrator, configRegistry, createAction, createActionRunner, createArray, createBooleanParam, createColorPicker, createCondition, createConditionRunner, createDefinition, createEvent, createEventRunner, createExpression, createExpressionRunner, createLoop, createLoopRunner, createNetlifySiteParam, createNodeDefinition, createNumberParam, createPasswordParam, createPathParam, createPlugin, createQuickJs, createQuickJsFromVariant, createRawParam, createStringParam, createSubscriptionError, createVersionSchema, de_DE_default as de_DE, defaultAppSettings, defaultFileRepo, detectRuntime, downloadFile, en_US_default as en_US, ensure,
|
|
64443
|
+
export { AppSettingsValidator, AppSettingsValidatorV1, AppSettingsValidatorV2, AppSettingsValidatorV3, AppSettingsValidatorV4, AppSettingsValidatorV5, AppSettingsValidatorV6, AppSettingsValidatorV7, BenefitNotFoundError, EditorParamValidatorV3, ExternalCommandError, OriginValidator, PipelabContext, src_default as RELEASE_SYNC, SaveLocationExternalValidator, SaveLocationInternalValidator, SaveLocationPipelabCloudValidator, SaveLocationValidator, SavedFileDefaultValidator, SavedFileSimpleValidator, SavedFileValidator, SavedFileValidatorV1, SavedFileValidatorV2, SavedFileValidatorV3, SavedFileValidatorV4, ShellChannels, SubscriptionExpiredError, SubscriptionRequiredError, UnauthorizedError, VariableValidatorV1, WebSocketConnectionError, WebSocketError, WebSocketTimeoutError, appSettingsMigrator, configRegistry, createAction, createActionRunner, createArray, createBooleanParam, createColorPicker, createCondition, createConditionRunner, createDefinition, createEvent, createEventRunner, createExpression, createExpressionRunner, createLoop, createLoopRunner, createNetlifySiteParam, createNodeDefinition, createNumberParam, createPasswordParam, createPathParam, createPlugin, createQuickJs, createQuickJsFromVariant, createRawParam, createStringParam, createSubscriptionError, createVersionSchema, de_DE_default as de_DE, defaultAppSettings, defaultFileRepo, detectRuntime, downloadFile, en_US_default as en_US, ensure, es_ES_default as es_ES, extractTarGz, extractZip, fetchPackage, fetchPipelabAsset, fetchPipelabCli, fetchPipelabPlugin, fileExists, fileRepoMigrations, fmt, foo, fr_FR_default as fr_FR, generateTempFolder, getSubscriptionErrorMessage, isRenderer, isRequired, isSubscriptionError, isSupabaseAvailable, isWebSocketErrorMessage, isWebSocketRequestMessage, isWebSocketResponseMessage, makeResolvedParams, newVariant, processGraph, pt_BR_default as pt_BR, runPnpm, runWithLiveLogs, savedFileMigrator, schema, sleep, supabase, useLogger, usePlugins, variableToFormattedVariable, zh_CN_default as zh_CN, zipFolder };
|
|
64519
64444
|
|
|
64520
64445
|
//# sourceMappingURL=index.mjs.map
|