@pipelab/plugin-construct 1.0.0-beta.14 → 1.0.0-beta.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +209 -104
- package/dist/index.mjs +186 -82
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -5,11 +5,11 @@ import { normalize } from "path";
|
|
|
5
5
|
import { formatWithOptions, types } from "util";
|
|
6
6
|
import path, { delimiter, dirname, join } from "node:path";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { constants, homedir
|
|
8
|
+
import { constants, homedir } from "node:os";
|
|
9
9
|
import { appendFileSync, createReadStream, createWriteStream, existsSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
10
|
+
import { chmod, cp, mkdir, readFile, readdir, rename, rm } from "node:fs/promises";
|
|
10
11
|
import http from "node:http";
|
|
11
12
|
import { webcrypto } from "node:crypto";
|
|
12
|
-
import { chmod, cp, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm } from "node:fs/promises";
|
|
13
13
|
import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
14
14
|
import { StringDecoder } from "node:string_decoder";
|
|
15
15
|
import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
|
|
@@ -21,6 +21,7 @@ import { serialize } from "node:v8";
|
|
|
21
21
|
import { finished, pipeline } from "node:stream/promises";
|
|
22
22
|
import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark } from "node:stream";
|
|
23
23
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
24
|
+
import dns from "node:dns/promises";
|
|
24
25
|
//#region ../../packages/migration/src/models/createMigration.ts
|
|
25
26
|
function createMigration$1(migration) {
|
|
26
27
|
return {
|
|
@@ -1596,6 +1597,56 @@ function literal(literal_, message) {
|
|
|
1596
1597
|
}
|
|
1597
1598
|
};
|
|
1598
1599
|
}
|
|
1600
|
+
function looseObject(entries, message) {
|
|
1601
|
+
return {
|
|
1602
|
+
kind: "schema",
|
|
1603
|
+
type: "loose_object",
|
|
1604
|
+
reference: looseObject,
|
|
1605
|
+
expects: "Object",
|
|
1606
|
+
async: false,
|
|
1607
|
+
entries,
|
|
1608
|
+
message,
|
|
1609
|
+
_run(dataset, config2) {
|
|
1610
|
+
const input = dataset.value;
|
|
1611
|
+
if (input && typeof input === "object") {
|
|
1612
|
+
dataset.typed = true;
|
|
1613
|
+
dataset.value = {};
|
|
1614
|
+
for (const key in this.entries) {
|
|
1615
|
+
const value2 = input[key];
|
|
1616
|
+
const valueDataset = this.entries[key]._run({
|
|
1617
|
+
typed: false,
|
|
1618
|
+
value: value2
|
|
1619
|
+
}, config2);
|
|
1620
|
+
if (valueDataset.issues) {
|
|
1621
|
+
const pathItem = {
|
|
1622
|
+
type: "object",
|
|
1623
|
+
origin: "value",
|
|
1624
|
+
input,
|
|
1625
|
+
key,
|
|
1626
|
+
value: value2
|
|
1627
|
+
};
|
|
1628
|
+
for (const issue of valueDataset.issues) {
|
|
1629
|
+
if (issue.path) issue.path.unshift(pathItem);
|
|
1630
|
+
else issue.path = [pathItem];
|
|
1631
|
+
dataset.issues?.push(issue);
|
|
1632
|
+
}
|
|
1633
|
+
if (!dataset.issues) dataset.issues = valueDataset.issues;
|
|
1634
|
+
if (config2.abortEarly) {
|
|
1635
|
+
dataset.typed = false;
|
|
1636
|
+
break;
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
if (!valueDataset.typed) dataset.typed = false;
|
|
1640
|
+
if (valueDataset.value !== void 0 || key in input) dataset.value[key] = valueDataset.value;
|
|
1641
|
+
}
|
|
1642
|
+
if (!dataset.issues || !config2.abortEarly) {
|
|
1643
|
+
for (const key in input) if (_isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];
|
|
1644
|
+
}
|
|
1645
|
+
} else _addIssue(this, "type", dataset, config2);
|
|
1646
|
+
return dataset;
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1599
1650
|
function number(message) {
|
|
1600
1651
|
return {
|
|
1601
1652
|
kind: "schema",
|
|
@@ -2133,6 +2184,18 @@ settingsMigratorInternal.createMigrations({
|
|
|
2133
2184
|
})
|
|
2134
2185
|
]
|
|
2135
2186
|
});
|
|
2187
|
+
const connectionsMigratorInternal = createMigrator();
|
|
2188
|
+
const defaultConnections = connectionsMigratorInternal.createDefault({
|
|
2189
|
+
version: "1.0.0",
|
|
2190
|
+
connections: []
|
|
2191
|
+
});
|
|
2192
|
+
connectionsMigratorInternal.createMigrations({
|
|
2193
|
+
defaultValue: defaultConnections,
|
|
2194
|
+
migrations: [createMigration({
|
|
2195
|
+
version: "1.0.0",
|
|
2196
|
+
up: finalVersion
|
|
2197
|
+
})]
|
|
2198
|
+
});
|
|
2136
2199
|
const fileRepoMigratorInternal = createMigrator();
|
|
2137
2200
|
const defaultFileRepo = fileRepoMigratorInternal.createDefault({
|
|
2138
2201
|
version: "2.0.0",
|
|
@@ -2294,11 +2357,51 @@ const LEGACY_ID_MAP = {
|
|
|
2294
2357
|
};
|
|
2295
2358
|
const getStrictPluginId = (pluginId) => {
|
|
2296
2359
|
if (!pluginId) return pluginId;
|
|
2297
|
-
|
|
2298
|
-
if (pluginId.startsWith("@") || pluginId.includes("/") || pluginId.startsWith("pipelab-plugin-")) return pluginId;
|
|
2299
|
-
const prefixed = `@pipelab/plugin-${pluginId}`;
|
|
2300
|
-
return LEGACY_ID_MAP[prefixed] || prefixed;
|
|
2360
|
+
return LEGACY_ID_MAP[pluginId] || pluginId;
|
|
2301
2361
|
};
|
|
2362
|
+
//#endregion
|
|
2363
|
+
//#region ../../packages/shared/src/save-location.ts
|
|
2364
|
+
const SaveLocationInternalValidator = object({
|
|
2365
|
+
id: string(),
|
|
2366
|
+
project: string(),
|
|
2367
|
+
lastModified: string(),
|
|
2368
|
+
type: literal("internal"),
|
|
2369
|
+
configName: string()
|
|
2370
|
+
});
|
|
2371
|
+
const SaveLocationValidator = union([
|
|
2372
|
+
object({
|
|
2373
|
+
id: string(),
|
|
2374
|
+
project: string(),
|
|
2375
|
+
path: string(),
|
|
2376
|
+
lastModified: string(),
|
|
2377
|
+
type: literal("external"),
|
|
2378
|
+
summary: object({
|
|
2379
|
+
plugins: array(string()),
|
|
2380
|
+
name: string(),
|
|
2381
|
+
description: string()
|
|
2382
|
+
})
|
|
2383
|
+
}),
|
|
2384
|
+
SaveLocationInternalValidator,
|
|
2385
|
+
object({
|
|
2386
|
+
id: string(),
|
|
2387
|
+
project: string(),
|
|
2388
|
+
type: literal("pipelab-cloud")
|
|
2389
|
+
})
|
|
2390
|
+
]);
|
|
2391
|
+
object({
|
|
2392
|
+
version: literal("1.0.0"),
|
|
2393
|
+
data: optional(record(string(), SaveLocationValidator), {})
|
|
2394
|
+
});
|
|
2395
|
+
const FileRepoProjectValidatorV2$1 = object({
|
|
2396
|
+
id: string(),
|
|
2397
|
+
name: string(),
|
|
2398
|
+
description: string()
|
|
2399
|
+
});
|
|
2400
|
+
object({
|
|
2401
|
+
version: literal("2.0.0"),
|
|
2402
|
+
projects: array(FileRepoProjectValidatorV2$1),
|
|
2403
|
+
pipelines: optional(array(SaveLocationValidator), [])
|
|
2404
|
+
});
|
|
2302
2405
|
object({
|
|
2303
2406
|
cacheFolder: string(),
|
|
2304
2407
|
theme: union([literal("light"), literal("dark")]),
|
|
@@ -2450,6 +2553,17 @@ object({
|
|
|
2450
2553
|
})),
|
|
2451
2554
|
isInternalMigrationBannerClosed: optional(boolean(), false)
|
|
2452
2555
|
});
|
|
2556
|
+
const ConnectionValidator = looseObject({
|
|
2557
|
+
id: string(),
|
|
2558
|
+
pluginName: string(),
|
|
2559
|
+
name: string(),
|
|
2560
|
+
createdAt: string(),
|
|
2561
|
+
isDefault: boolean()
|
|
2562
|
+
});
|
|
2563
|
+
object({
|
|
2564
|
+
version: literal("1.0.0"),
|
|
2565
|
+
connections: array(ConnectionValidator)
|
|
2566
|
+
});
|
|
2453
2567
|
//#endregion
|
|
2454
2568
|
//#region ../../node_modules/tslog/dist/esm/prettyLogStyles.js
|
|
2455
2569
|
const prettyLogStyles = {
|
|
@@ -2970,7 +3084,7 @@ const useLogger = () => {
|
|
|
2970
3084
|
const OriginValidator = object({
|
|
2971
3085
|
pluginId: string(),
|
|
2972
3086
|
nodeId: string(),
|
|
2973
|
-
version: pipe(
|
|
3087
|
+
version: optional(pipe(string(), description("Pinned version of the plugin for this block. Falls back to \"latest\" when absent.")))
|
|
2974
3088
|
});
|
|
2975
3089
|
const BlockActionValidatorV1 = object({
|
|
2976
3090
|
type: literal("action"),
|
|
@@ -2983,7 +3097,7 @@ const EditorParamValidatorV3 = union([literal("simple"), literal("editor")]);
|
|
|
2983
3097
|
const BlockActionValidatorV3 = object({
|
|
2984
3098
|
type: literal("action"),
|
|
2985
3099
|
uid: string(),
|
|
2986
|
-
name: pipe(
|
|
3100
|
+
name: optional(pipe(string(), description("A custom name provided by the user"))),
|
|
2987
3101
|
disabled: optional(boolean()),
|
|
2988
3102
|
params: record(string(), object({
|
|
2989
3103
|
editor: EditorParamValidatorV3,
|
|
@@ -45306,35 +45420,6 @@ const createNumberParam = (value, definition) => {
|
|
|
45306
45420
|
};
|
|
45307
45421
|
};
|
|
45308
45422
|
//#endregion
|
|
45309
|
-
//#region ../../packages/shared/src/save-location.ts
|
|
45310
|
-
const SaveLocationInternalValidator = object({
|
|
45311
|
-
id: string(),
|
|
45312
|
-
project: string(),
|
|
45313
|
-
lastModified: string(),
|
|
45314
|
-
type: literal("internal"),
|
|
45315
|
-
configName: string()
|
|
45316
|
-
});
|
|
45317
|
-
const SaveLocationValidator = union([
|
|
45318
|
-
object({
|
|
45319
|
-
id: string(),
|
|
45320
|
-
project: string(),
|
|
45321
|
-
path: string(),
|
|
45322
|
-
lastModified: string(),
|
|
45323
|
-
type: literal("external"),
|
|
45324
|
-
summary: object({
|
|
45325
|
-
plugins: array(string()),
|
|
45326
|
-
name: string(),
|
|
45327
|
-
description: string()
|
|
45328
|
-
})
|
|
45329
|
-
}),
|
|
45330
|
-
SaveLocationInternalValidator,
|
|
45331
|
-
object({
|
|
45332
|
-
id: string(),
|
|
45333
|
-
project: string(),
|
|
45334
|
-
type: literal("pipelab-cloud")
|
|
45335
|
-
})
|
|
45336
|
-
]);
|
|
45337
|
-
//#endregion
|
|
45338
45423
|
//#region ../../packages/shared/src/websocket.types.ts
|
|
45339
45424
|
var WebSocketError = class extends Error {
|
|
45340
45425
|
constructor(message, code, requestId) {
|
|
@@ -45351,20 +45436,6 @@ object({
|
|
|
45351
45436
|
version: literal("1.0.0"),
|
|
45352
45437
|
data: optional(record(string(), SaveLocationValidator), {})
|
|
45353
45438
|
});
|
|
45354
|
-
const FileRepoProjectValidatorV2$1 = object({
|
|
45355
|
-
id: string(),
|
|
45356
|
-
name: string(),
|
|
45357
|
-
description: string()
|
|
45358
|
-
});
|
|
45359
|
-
object({
|
|
45360
|
-
version: literal("2.0.0"),
|
|
45361
|
-
projects: array(FileRepoProjectValidatorV2$1),
|
|
45362
|
-
pipelines: optional(array(SaveLocationValidator), [])
|
|
45363
|
-
});
|
|
45364
|
-
object({
|
|
45365
|
-
version: literal("1.0.0"),
|
|
45366
|
-
data: optional(record(string(), SaveLocationValidator), {})
|
|
45367
|
-
});
|
|
45368
45439
|
const FileRepoProjectValidatorV2 = object({
|
|
45369
45440
|
id: string(),
|
|
45370
45441
|
name: string(),
|
|
@@ -45384,9 +45455,15 @@ var init_esm_shims = __esmMin((() => {
|
|
|
45384
45455
|
__dirname = /* @__PURE__ */ getDirname();
|
|
45385
45456
|
}));
|
|
45386
45457
|
//#endregion
|
|
45387
|
-
//#region ../../packages/
|
|
45458
|
+
//#region ../../packages/constants/src/index.ts
|
|
45388
45459
|
init_esm_shims();
|
|
45389
|
-
const
|
|
45460
|
+
const websocketPort = 33753;
|
|
45461
|
+
const DEFAULT_NODE_VERSION = "24.14.1";
|
|
45462
|
+
const DEFAULT_PNPM_VERSION = "10.12.0";
|
|
45463
|
+
//#endregion
|
|
45464
|
+
//#region ../../packages/core-node/src/context.ts
|
|
45465
|
+
const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
|
|
45466
|
+
const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
|
|
45390
45467
|
const isDev = process.env.NODE_ENV === "development";
|
|
45391
45468
|
/**
|
|
45392
45469
|
* Finds the monorepo root by looking for pnpm-workspace.yaml.
|
|
@@ -48958,9 +49035,6 @@ const useAPI = () => {
|
|
|
48958
49035
|
};
|
|
48959
49036
|
};
|
|
48960
49037
|
//#endregion
|
|
48961
|
-
//#region ../../packages/constants/src/index.ts
|
|
48962
|
-
const websocketPort = 33753;
|
|
48963
|
-
//#endregion
|
|
48964
49038
|
//#region ../../packages/core-node/src/websocket-server.ts
|
|
48965
49039
|
var WebSocketServer = class {
|
|
48966
49040
|
wss = null;
|
|
@@ -89365,14 +89439,6 @@ var import_tar = /* @__PURE__ */ __toESM(require_tar$1(), 1);
|
|
|
89365
89439
|
var import_yauzl = /* @__PURE__ */ __toESM(require_yauzl(), 1);
|
|
89366
89440
|
var import_archiver = /* @__PURE__ */ __toESM(require_archiver(), 1);
|
|
89367
89441
|
/**
|
|
89368
|
-
* Generates a unique temporary folder.
|
|
89369
|
-
*/
|
|
89370
|
-
const generateTempFolder = async (base) => {
|
|
89371
|
-
const targetBase = base || tmpdir();
|
|
89372
|
-
await mkdir(targetBase, { recursive: true });
|
|
89373
|
-
return await mkdtemp(join(await realpath(targetBase), "pipelab-"));
|
|
89374
|
-
};
|
|
89375
|
-
/**
|
|
89376
89442
|
* Extracts a .tar.gz archive.
|
|
89377
89443
|
*/
|
|
89378
89444
|
async function extractTarGz(archivePath, destinationDir) {
|
|
@@ -100953,11 +101019,11 @@ var require_cp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
100953
101019
|
var require_with_temp_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
100954
101020
|
const { join: join$5, sep: sep$1 } = __require("path");
|
|
100955
101021
|
const getOptions = require_get_options();
|
|
100956
|
-
const { mkdir: mkdir$4, mkdtemp
|
|
101022
|
+
const { mkdir: mkdir$4, mkdtemp, rm: rm$5 } = __require("fs/promises");
|
|
100957
101023
|
const withTempDir = async (root, fn, opts) => {
|
|
100958
101024
|
const options = getOptions(opts, { copy: ["tmpPrefix"] });
|
|
100959
101025
|
await mkdir$4(root, { recursive: true });
|
|
100960
|
-
const target = await mkdtemp
|
|
101026
|
+
const target = await mkdtemp(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
|
|
100961
101027
|
let err;
|
|
100962
101028
|
let result;
|
|
100963
101029
|
try {
|
|
@@ -110556,9 +110622,9 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
110556
110622
|
//#region ../../node_modules/pacote/lib/util/cache-dir.js
|
|
110557
110623
|
var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
110558
110624
|
const { resolve: resolve$6 } = __require("node:path");
|
|
110559
|
-
const { tmpdir
|
|
110625
|
+
const { tmpdir, homedir: homedir$1 } = __require("node:os");
|
|
110560
110626
|
module.exports = (fakePlatform = false) => {
|
|
110561
|
-
const temp = tmpdir
|
|
110627
|
+
const temp = tmpdir();
|
|
110562
110628
|
const uidOrPid = process.getuid ? process.getuid() : process.pid;
|
|
110563
110629
|
const home = homedir$1() || resolve$6(temp, "npm-" + uidOrPid);
|
|
110564
110630
|
const platform = fakePlatform || process.platform;
|
|
@@ -123809,7 +123875,7 @@ var require_auth = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
123809
123875
|
//#endregion
|
|
123810
123876
|
//#region ../../node_modules/make-fetch-happen/lib/options.js
|
|
123811
123877
|
var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
123812
|
-
const dns$
|
|
123878
|
+
const dns$3 = __require("dns");
|
|
123813
123879
|
const conditionalHeaders = [
|
|
123814
123880
|
"if-modified-since",
|
|
123815
123881
|
"if-none-match",
|
|
@@ -123834,7 +123900,7 @@ var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
123834
123900
|
};
|
|
123835
123901
|
options.dns = {
|
|
123836
123902
|
ttl: 300 * 1e3,
|
|
123837
|
-
lookup: dns$
|
|
123903
|
+
lookup: dns$3.lookup,
|
|
123838
123904
|
...options.dns
|
|
123839
123905
|
};
|
|
123840
123906
|
options.cache = options.cache || "default";
|
|
@@ -125251,9 +125317,9 @@ var require_key$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
125251
125317
|
//#region ../../node_modules/@npmcli/agent/lib/dns.js
|
|
125252
125318
|
var require_dns = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
125253
125319
|
const { LRUCache } = require_index_min$5();
|
|
125254
|
-
const dns$
|
|
125320
|
+
const dns$2 = __require("dns");
|
|
125255
125321
|
const cache = new LRUCache({ max: 50 });
|
|
125256
|
-
const getOptions = ({ family = 0, hints = dns$
|
|
125322
|
+
const getOptions = ({ family = 0, hints = dns$2.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$2.lookup }) => ({
|
|
125257
125323
|
hints,
|
|
125258
125324
|
lookup: (hostname, ...args) => {
|
|
125259
125325
|
const callback = args.pop();
|
|
@@ -130292,7 +130358,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
130292
130358
|
const socks_1 = require_build$1();
|
|
130293
130359
|
const agent_base_1 = require_dist$12();
|
|
130294
130360
|
const debug_1 = __importDefault(require_src$1());
|
|
130295
|
-
const dns = __importStar(__require("dns"));
|
|
130361
|
+
const dns$1 = __importStar(__require("dns"));
|
|
130296
130362
|
const net$1 = __importStar(__require("net"));
|
|
130297
130363
|
const tls$1 = __importStar(__require("tls"));
|
|
130298
130364
|
const url_1$1 = __require("url");
|
|
@@ -130364,7 +130430,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
130364
130430
|
const { shouldLookup, proxy, timeout } = this;
|
|
130365
130431
|
if (!opts.host) throw new Error("No `host` defined!");
|
|
130366
130432
|
let { host } = opts;
|
|
130367
|
-
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
130433
|
+
const { port, lookup: lookupFn = dns$1.lookup } = opts;
|
|
130368
130434
|
if (shouldLookup) host = await new Promise((resolve, reject) => {
|
|
130369
130435
|
lookupFn(host, {}, (err, res) => {
|
|
130370
130436
|
if (err) reject(err);
|
|
@@ -150631,7 +150697,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
150631
150697
|
const { promisify: promisify$1 } = __require("util");
|
|
150632
150698
|
const path$1 = __require("path");
|
|
150633
150699
|
const { createHash } = __require("crypto");
|
|
150634
|
-
const { realpath
|
|
150700
|
+
const { realpath, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
|
|
150635
150701
|
const url = __require("url");
|
|
150636
150702
|
const slasher = require_glob_slash();
|
|
150637
150703
|
const minimatch = require_minimatch();
|
|
@@ -150954,7 +151020,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
150954
151020
|
};
|
|
150955
151021
|
const getHandlers = (methods) => Object.assign({
|
|
150956
151022
|
lstat: promisify$1(lstat),
|
|
150957
|
-
realpath: promisify$1(realpath
|
|
151023
|
+
realpath: promisify$1(realpath),
|
|
150958
151024
|
createReadStream: createReadStream$1,
|
|
150959
151025
|
readdir: promisify$1(readdir$1),
|
|
150960
151026
|
sendError
|
|
@@ -151093,8 +151159,6 @@ const sendStartupProgress = (message) => {
|
|
|
151093
151159
|
};
|
|
151094
151160
|
//#endregion
|
|
151095
151161
|
//#region ../../packages/core-node/src/utils/remote.ts
|
|
151096
|
-
const DEFAULT_NODE_VERSION = "24.14.1";
|
|
151097
|
-
const DEFAULT_PNPM_VERSION = "10.12.0";
|
|
151098
151162
|
function isPackageComplete(packageDir) {
|
|
151099
151163
|
return existsSync(join(packageDir, "package.json"));
|
|
151100
151164
|
}
|
|
@@ -151135,6 +151199,20 @@ async function withLock(key, fn) {
|
|
|
151135
151199
|
activeOperations.set(key, promise);
|
|
151136
151200
|
return promise;
|
|
151137
151201
|
}
|
|
151202
|
+
let isOnlineCached = null;
|
|
151203
|
+
let lastCheckTime = 0;
|
|
151204
|
+
async function isOnline() {
|
|
151205
|
+
const now = Date.now();
|
|
151206
|
+
if (isOnlineCached !== null && now - lastCheckTime < 1e4) return isOnlineCached;
|
|
151207
|
+
try {
|
|
151208
|
+
await Promise.race([dns.lookup("registry.npmjs.org"), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("timeout")), 1500))]);
|
|
151209
|
+
isOnlineCached = true;
|
|
151210
|
+
} catch {
|
|
151211
|
+
isOnlineCached = false;
|
|
151212
|
+
}
|
|
151213
|
+
lastCheckTime = now;
|
|
151214
|
+
return isOnlineCached;
|
|
151215
|
+
}
|
|
151138
151216
|
/**
|
|
151139
151217
|
* Robust utility to fetch, cache, and resolve an NPM package.
|
|
151140
151218
|
* Centralized in core-node to avoid circular dependencies.
|
|
@@ -151161,7 +151239,15 @@ async function fetchPackage(packageName, versionOrRange, options) {
|
|
|
151161
151239
|
if (resolvedVersionOrRange === "local") resolvedVersionOrRange = "latest";
|
|
151162
151240
|
console.log(`[Fetcher] Resolving ${packageName}@${resolvedVersionOrRange || "latest"}...`);
|
|
151163
151241
|
const resolveStart = Date.now();
|
|
151164
|
-
|
|
151242
|
+
if (!await isOnline()) {
|
|
151243
|
+
console.warn(`[Fetcher] ${packageName}: offline mode detected (${Date.now() - resolveStart}ms), trying local fallback...`);
|
|
151244
|
+
const fallbackStart = Date.now();
|
|
151245
|
+
const fallbackVersion = await tryLocalFallback(resolvedVersionOrRange, /* @__PURE__ */ new Error("Offline"), baseDir, packageName);
|
|
151246
|
+
if (fallbackVersion) {
|
|
151247
|
+
resolvedVersion = fallbackVersion;
|
|
151248
|
+
console.log(`[Fetcher] ${packageName}: Resolved to local fallback ${resolvedVersion} (${Date.now() - fallbackStart}ms)`);
|
|
151249
|
+
} else throw new Error(`Offline and no local fallback version available for ${packageName}`);
|
|
151250
|
+
} else try {
|
|
151165
151251
|
const cachePath = join(ctx.userDataPath, "cache", "pacote");
|
|
151166
151252
|
let packumentPromise = packumentRequests.get(packageName);
|
|
151167
151253
|
if (!packumentPromise) {
|
|
@@ -151171,7 +151257,16 @@ async function fetchPackage(packageName, versionOrRange, options) {
|
|
|
151171
151257
|
const packument = await packumentPromise;
|
|
151172
151258
|
const versions = Object.keys(packument.versions);
|
|
151173
151259
|
const range = resolvedVersionOrRange || "latest";
|
|
151174
|
-
|
|
151260
|
+
let foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
|
|
151261
|
+
if (range === "latest" && ctx.releaseTag && ctx.releaseTag !== "latest") {
|
|
151262
|
+
const releaseTagVersion = packument["dist-tags"]?.[ctx.releaseTag];
|
|
151263
|
+
if (releaseTagVersion && import_semver.default.valid(releaseTagVersion)) {
|
|
151264
|
+
if (!foundVersion || import_semver.default.valid(foundVersion) && import_semver.default.gte(releaseTagVersion, foundVersion)) {
|
|
151265
|
+
console.log(`[Fetcher] Using release tag "${ctx.releaseTag}" (${releaseTagVersion}) instead of "latest" (${foundVersion || "none"}) for ${packageName}`);
|
|
151266
|
+
foundVersion = releaseTagVersion;
|
|
151267
|
+
} else if (foundVersion) console.warn(`[Fetcher] Tag "${ctx.releaseTag}" (${releaseTagVersion}) is older than "latest" (${foundVersion}) for ${packageName}, keeping "latest"`);
|
|
151268
|
+
}
|
|
151269
|
+
}
|
|
151175
151270
|
if (!foundVersion) throw new Error(`Package ${packageName}@${range} not found on npm (available tags: ${Object.keys(packument["dist-tags"] || {}).join(", ")})`);
|
|
151176
151271
|
resolvedVersion = foundVersion;
|
|
151177
151272
|
console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm (${Date.now() - resolveStart}ms)`);
|
|
@@ -151286,7 +151381,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
|
|
|
151286
151381
|
const extension = isWindows ? "zip" : "tar.gz";
|
|
151287
151382
|
const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
|
|
151288
151383
|
const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
|
|
151289
|
-
const tempDir = await
|
|
151384
|
+
const tempDir = await context.createTempFolder("node-download-");
|
|
151290
151385
|
const archivePath = join(tempDir, fileName);
|
|
151291
151386
|
sendStartupProgress(`Downloading Node.js v${version}...`);
|
|
151292
151387
|
console.log(`Downloading Node.js from ${downloadUrl}...`);
|
|
@@ -151954,7 +152049,16 @@ var src_default = createNodeDefinition({
|
|
|
151954
152049
|
node: exportProjectAction,
|
|
151955
152050
|
runner: ExportProjectActionRunner
|
|
151956
152051
|
}],
|
|
151957
|
-
validators: []
|
|
152052
|
+
validators: [],
|
|
152053
|
+
integrations: [{
|
|
152054
|
+
name: "Browser Executable Link",
|
|
152055
|
+
fields: [{
|
|
152056
|
+
key: "path",
|
|
152057
|
+
label: "Browser Executable Path",
|
|
152058
|
+
type: "file",
|
|
152059
|
+
placeholder: "e.g., /usr/bin/google-chrome"
|
|
152060
|
+
}]
|
|
152061
|
+
}]
|
|
151958
152062
|
});
|
|
151959
152063
|
//#endregion
|
|
151960
152064
|
export { src_default as default };
|