@pipelab/plugin-tauri 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 +211 -115
- package/dist/index.mjs +188 -93
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -6
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 } from "node:url";
|
|
7
|
-
import { arch, constants, homedir, platform
|
|
7
|
+
import { arch, constants, homedir, platform } from "node:os";
|
|
8
8
|
import { appendFileSync, createReadStream, createWriteStream, existsSync, readFile, readFileSync, readdirSync, statSync, writeFile, writeFileSync } from "node:fs";
|
|
9
|
+
import { access, chmod, cp, mkdir, readFile as readFile$1, readdir, rename, rm, writeFile as writeFile$1 } 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 as readFile$1, readdir, realpath, rename, rm, writeFile as writeFile$1 } 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
|
-
|
|
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(
|
|
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(
|
|
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,
|
|
@@ -45305,35 +45419,6 @@ const createBooleanParam = (value, definition) => {
|
|
|
45305
45419
|
};
|
|
45306
45420
|
};
|
|
45307
45421
|
//#endregion
|
|
45308
|
-
//#region ../../packages/shared/src/save-location.ts
|
|
45309
|
-
const SaveLocationInternalValidator = object({
|
|
45310
|
-
id: string(),
|
|
45311
|
-
project: string(),
|
|
45312
|
-
lastModified: string(),
|
|
45313
|
-
type: literal("internal"),
|
|
45314
|
-
configName: string()
|
|
45315
|
-
});
|
|
45316
|
-
const SaveLocationValidator = union([
|
|
45317
|
-
object({
|
|
45318
|
-
id: string(),
|
|
45319
|
-
project: string(),
|
|
45320
|
-
path: string(),
|
|
45321
|
-
lastModified: string(),
|
|
45322
|
-
type: literal("external"),
|
|
45323
|
-
summary: object({
|
|
45324
|
-
plugins: array(string()),
|
|
45325
|
-
name: string(),
|
|
45326
|
-
description: string()
|
|
45327
|
-
})
|
|
45328
|
-
}),
|
|
45329
|
-
SaveLocationInternalValidator,
|
|
45330
|
-
object({
|
|
45331
|
-
id: string(),
|
|
45332
|
-
project: string(),
|
|
45333
|
-
type: literal("pipelab-cloud")
|
|
45334
|
-
})
|
|
45335
|
-
]);
|
|
45336
|
-
//#endregion
|
|
45337
45422
|
//#region ../../packages/shared/src/websocket.types.ts
|
|
45338
45423
|
var WebSocketError = class extends Error {
|
|
45339
45424
|
constructor(message, code, requestId) {
|
|
@@ -45350,20 +45435,6 @@ object({
|
|
|
45350
45435
|
version: literal("1.0.0"),
|
|
45351
45436
|
data: optional(record(string(), SaveLocationValidator), {})
|
|
45352
45437
|
});
|
|
45353
|
-
const FileRepoProjectValidatorV2$1 = object({
|
|
45354
|
-
id: string(),
|
|
45355
|
-
name: string(),
|
|
45356
|
-
description: string()
|
|
45357
|
-
});
|
|
45358
|
-
object({
|
|
45359
|
-
version: literal("2.0.0"),
|
|
45360
|
-
projects: array(FileRepoProjectValidatorV2$1),
|
|
45361
|
-
pipelines: optional(array(SaveLocationValidator), [])
|
|
45362
|
-
});
|
|
45363
|
-
object({
|
|
45364
|
-
version: literal("1.0.0"),
|
|
45365
|
-
data: optional(record(string(), SaveLocationValidator), {})
|
|
45366
|
-
});
|
|
45367
45438
|
const FileRepoProjectValidatorV2 = object({
|
|
45368
45439
|
id: string(),
|
|
45369
45440
|
name: string(),
|
|
@@ -45383,9 +45454,27 @@ var init_esm_shims = __esmMin((() => {
|
|
|
45383
45454
|
__dirname = /* @__PURE__ */ getDirname();
|
|
45384
45455
|
}));
|
|
45385
45456
|
//#endregion
|
|
45386
|
-
//#region ../../packages/
|
|
45457
|
+
//#region ../../packages/constants/src/index.ts
|
|
45387
45458
|
init_esm_shims();
|
|
45388
|
-
|
|
45459
|
+
/**
|
|
45460
|
+
* Get the binary name for a given platform
|
|
45461
|
+
* @param name
|
|
45462
|
+
* @param platform If not provided, it will try to use process.platform (Node.js only)
|
|
45463
|
+
* @returns
|
|
45464
|
+
*/
|
|
45465
|
+
const getBinName = (name, platform) => {
|
|
45466
|
+
const p = platform || (typeof process !== "undefined" ? process.platform : "unknown");
|
|
45467
|
+
if (p === "win32") return `${name}.exe`;
|
|
45468
|
+
if (p === "darwin") return `${name}.app/Contents/MacOS/${name}`;
|
|
45469
|
+
return name;
|
|
45470
|
+
};
|
|
45471
|
+
const websocketPort = 33753;
|
|
45472
|
+
const DEFAULT_NODE_VERSION = "24.14.1";
|
|
45473
|
+
const DEFAULT_PNPM_VERSION = "10.12.0";
|
|
45474
|
+
//#endregion
|
|
45475
|
+
//#region ../../packages/core-node/src/context.ts
|
|
45476
|
+
const metaUrl = typeof import.meta !== "undefined" ? import.meta.url : void 0;
|
|
45477
|
+
const _dirname = typeof __dirname !== "undefined" ? __dirname : metaUrl ? dirname(fileURLToPath(metaUrl)) : process.cwd();
|
|
45389
45478
|
const isDev = process.env.NODE_ENV === "development";
|
|
45390
45479
|
/**
|
|
45391
45480
|
* Finds the monorepo root by looking for pnpm-workspace.yaml.
|
|
@@ -48957,21 +49046,6 @@ const useAPI = () => {
|
|
|
48957
49046
|
};
|
|
48958
49047
|
};
|
|
48959
49048
|
//#endregion
|
|
48960
|
-
//#region ../../packages/constants/src/index.ts
|
|
48961
|
-
/**
|
|
48962
|
-
* Get the binary name for a given platform
|
|
48963
|
-
* @param name
|
|
48964
|
-
* @param platform If not provided, it will try to use process.platform (Node.js only)
|
|
48965
|
-
* @returns
|
|
48966
|
-
*/
|
|
48967
|
-
const getBinName = (name, platform) => {
|
|
48968
|
-
const p = platform || (typeof process !== "undefined" ? process.platform : "unknown");
|
|
48969
|
-
if (p === "win32") return `${name}.exe`;
|
|
48970
|
-
if (p === "darwin") return `${name}.app/Contents/MacOS/${name}`;
|
|
48971
|
-
return name;
|
|
48972
|
-
};
|
|
48973
|
-
const websocketPort = 33753;
|
|
48974
|
-
//#endregion
|
|
48975
49049
|
//#region ../../packages/core-node/src/websocket-server.ts
|
|
48976
49050
|
var WebSocketServer = class {
|
|
48977
49051
|
wss = null;
|
|
@@ -89376,14 +89450,6 @@ var import_tar = /* @__PURE__ */ __toESM(require_tar$1(), 1);
|
|
|
89376
89450
|
var import_yauzl = /* @__PURE__ */ __toESM(require_yauzl(), 1);
|
|
89377
89451
|
require_archiver();
|
|
89378
89452
|
/**
|
|
89379
|
-
* Generates a unique temporary folder.
|
|
89380
|
-
*/
|
|
89381
|
-
const generateTempFolder = async (base) => {
|
|
89382
|
-
const targetBase = base || tmpdir();
|
|
89383
|
-
await mkdir(targetBase, { recursive: true });
|
|
89384
|
-
return await mkdtemp(join(await realpath(targetBase), "pipelab-"));
|
|
89385
|
-
};
|
|
89386
|
-
/**
|
|
89387
89453
|
* Extracts a .tar.gz archive.
|
|
89388
89454
|
*/
|
|
89389
89455
|
async function extractTarGz(archivePath, destinationDir) {
|
|
@@ -100964,11 +101030,11 @@ var require_cp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
100964
101030
|
var require_with_temp_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
100965
101031
|
const { join: join$5, sep: sep$1 } = __require("path");
|
|
100966
101032
|
const getOptions = require_get_options();
|
|
100967
|
-
const { mkdir: mkdir$4, mkdtemp
|
|
101033
|
+
const { mkdir: mkdir$4, mkdtemp, rm: rm$5 } = __require("fs/promises");
|
|
100968
101034
|
const withTempDir = async (root, fn, opts) => {
|
|
100969
101035
|
const options = getOptions(opts, { copy: ["tmpPrefix"] });
|
|
100970
101036
|
await mkdir$4(root, { recursive: true });
|
|
100971
|
-
const target = await mkdtemp
|
|
101037
|
+
const target = await mkdtemp(join$5(`${root}${sep$1}`, options.tmpPrefix || ""));
|
|
100972
101038
|
let err;
|
|
100973
101039
|
let result;
|
|
100974
101040
|
try {
|
|
@@ -110567,9 +110633,9 @@ var require_protected = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
110567
110633
|
//#region ../../node_modules/pacote/lib/util/cache-dir.js
|
|
110568
110634
|
var require_cache_dir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
110569
110635
|
const { resolve: resolve$6 } = __require("node:path");
|
|
110570
|
-
const { tmpdir
|
|
110636
|
+
const { tmpdir, homedir: homedir$1 } = __require("node:os");
|
|
110571
110637
|
module.exports = (fakePlatform = false) => {
|
|
110572
|
-
const temp = tmpdir
|
|
110638
|
+
const temp = tmpdir();
|
|
110573
110639
|
const uidOrPid = process.getuid ? process.getuid() : process.pid;
|
|
110574
110640
|
const home = homedir$1() || resolve$6(temp, "npm-" + uidOrPid);
|
|
110575
110641
|
const platform = fakePlatform || process.platform;
|
|
@@ -123820,7 +123886,7 @@ var require_auth = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
123820
123886
|
//#endregion
|
|
123821
123887
|
//#region ../../node_modules/make-fetch-happen/lib/options.js
|
|
123822
123888
|
var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
123823
|
-
const dns$
|
|
123889
|
+
const dns$3 = __require("dns");
|
|
123824
123890
|
const conditionalHeaders = [
|
|
123825
123891
|
"if-modified-since",
|
|
123826
123892
|
"if-none-match",
|
|
@@ -123845,7 +123911,7 @@ var require_options$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
123845
123911
|
};
|
|
123846
123912
|
options.dns = {
|
|
123847
123913
|
ttl: 300 * 1e3,
|
|
123848
|
-
lookup: dns$
|
|
123914
|
+
lookup: dns$3.lookup,
|
|
123849
123915
|
...options.dns
|
|
123850
123916
|
};
|
|
123851
123917
|
options.cache = options.cache || "default";
|
|
@@ -125262,9 +125328,9 @@ var require_key$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
125262
125328
|
//#region ../../node_modules/@npmcli/agent/lib/dns.js
|
|
125263
125329
|
var require_dns = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
125264
125330
|
const { LRUCache } = require_index_min$5();
|
|
125265
|
-
const dns$
|
|
125331
|
+
const dns$2 = __require("dns");
|
|
125266
125332
|
const cache = new LRUCache({ max: 50 });
|
|
125267
|
-
const getOptions = ({ family = 0, hints = dns$
|
|
125333
|
+
const getOptions = ({ family = 0, hints = dns$2.ADDRCONFIG, all = false, verbatim = void 0, ttl = 300 * 1e3, lookup = dns$2.lookup }) => ({
|
|
125268
125334
|
hints,
|
|
125269
125335
|
lookup: (hostname, ...args) => {
|
|
125270
125336
|
const callback = args.pop();
|
|
@@ -130303,7 +130369,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
130303
130369
|
const socks_1 = require_build$1();
|
|
130304
130370
|
const agent_base_1 = require_dist$12();
|
|
130305
130371
|
const debug_1 = __importDefault(require_src$1());
|
|
130306
|
-
const dns = __importStar(__require("dns"));
|
|
130372
|
+
const dns$1 = __importStar(__require("dns"));
|
|
130307
130373
|
const net$1 = __importStar(__require("net"));
|
|
130308
130374
|
const tls$1 = __importStar(__require("tls"));
|
|
130309
130375
|
const url_1$1 = __require("url");
|
|
@@ -130375,7 +130441,7 @@ var require_dist$9 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
130375
130441
|
const { shouldLookup, proxy, timeout } = this;
|
|
130376
130442
|
if (!opts.host) throw new Error("No `host` defined!");
|
|
130377
130443
|
let { host } = opts;
|
|
130378
|
-
const { port, lookup: lookupFn = dns.lookup } = opts;
|
|
130444
|
+
const { port, lookup: lookupFn = dns$1.lookup } = opts;
|
|
130379
130445
|
if (shouldLookup) host = await new Promise((resolve, reject) => {
|
|
130380
130446
|
lookupFn(host, {}, (err, res) => {
|
|
130381
130447
|
if (err) reject(err);
|
|
@@ -150642,7 +150708,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
150642
150708
|
const { promisify: promisify$1 } = __require("util");
|
|
150643
150709
|
const path$1 = __require("path");
|
|
150644
150710
|
const { createHash } = __require("crypto");
|
|
150645
|
-
const { realpath
|
|
150711
|
+
const { realpath, lstat, createReadStream: createReadStream$1, readdir: readdir$1 } = __require("fs");
|
|
150646
150712
|
const url = __require("url");
|
|
150647
150713
|
const slasher = require_glob_slash();
|
|
150648
150714
|
const minimatch = require_minimatch();
|
|
@@ -150965,7 +151031,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
150965
151031
|
};
|
|
150966
151032
|
const getHandlers = (methods) => Object.assign({
|
|
150967
151033
|
lstat: promisify$1(lstat),
|
|
150968
|
-
realpath: promisify$1(realpath
|
|
151034
|
+
realpath: promisify$1(realpath),
|
|
150969
151035
|
createReadStream: createReadStream$1,
|
|
150970
151036
|
readdir: promisify$1(readdir$1),
|
|
150971
151037
|
sendError
|
|
@@ -151104,8 +151170,6 @@ const sendStartupProgress = (message) => {
|
|
|
151104
151170
|
};
|
|
151105
151171
|
//#endregion
|
|
151106
151172
|
//#region ../../packages/core-node/src/utils/remote.ts
|
|
151107
|
-
const DEFAULT_NODE_VERSION = "24.14.1";
|
|
151108
|
-
const DEFAULT_PNPM_VERSION = "10.12.0";
|
|
151109
151173
|
function isPackageComplete(packageDir) {
|
|
151110
151174
|
return existsSync(join(packageDir, "package.json"));
|
|
151111
151175
|
}
|
|
@@ -151146,6 +151210,20 @@ async function withLock(key, fn) {
|
|
|
151146
151210
|
activeOperations.set(key, promise);
|
|
151147
151211
|
return promise;
|
|
151148
151212
|
}
|
|
151213
|
+
let isOnlineCached = null;
|
|
151214
|
+
let lastCheckTime = 0;
|
|
151215
|
+
async function isOnline() {
|
|
151216
|
+
const now = Date.now();
|
|
151217
|
+
if (isOnlineCached !== null && now - lastCheckTime < 1e4) return isOnlineCached;
|
|
151218
|
+
try {
|
|
151219
|
+
await Promise.race([dns.lookup("registry.npmjs.org"), new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("timeout")), 1500))]);
|
|
151220
|
+
isOnlineCached = true;
|
|
151221
|
+
} catch {
|
|
151222
|
+
isOnlineCached = false;
|
|
151223
|
+
}
|
|
151224
|
+
lastCheckTime = now;
|
|
151225
|
+
return isOnlineCached;
|
|
151226
|
+
}
|
|
151149
151227
|
/**
|
|
151150
151228
|
* Robust utility to fetch, cache, and resolve an NPM package.
|
|
151151
151229
|
* Centralized in core-node to avoid circular dependencies.
|
|
@@ -151172,7 +151250,15 @@ async function fetchPackage(packageName, versionOrRange, options) {
|
|
|
151172
151250
|
if (resolvedVersionOrRange === "local") resolvedVersionOrRange = "latest";
|
|
151173
151251
|
console.log(`[Fetcher] Resolving ${packageName}@${resolvedVersionOrRange || "latest"}...`);
|
|
151174
151252
|
const resolveStart = Date.now();
|
|
151175
|
-
|
|
151253
|
+
if (!await isOnline()) {
|
|
151254
|
+
console.warn(`[Fetcher] ${packageName}: offline mode detected (${Date.now() - resolveStart}ms), trying local fallback...`);
|
|
151255
|
+
const fallbackStart = Date.now();
|
|
151256
|
+
const fallbackVersion = await tryLocalFallback(resolvedVersionOrRange, /* @__PURE__ */ new Error("Offline"), baseDir, packageName);
|
|
151257
|
+
if (fallbackVersion) {
|
|
151258
|
+
resolvedVersion = fallbackVersion;
|
|
151259
|
+
console.log(`[Fetcher] ${packageName}: Resolved to local fallback ${resolvedVersion} (${Date.now() - fallbackStart}ms)`);
|
|
151260
|
+
} else throw new Error(`Offline and no local fallback version available for ${packageName}`);
|
|
151261
|
+
} else try {
|
|
151176
151262
|
const cachePath = join(ctx.userDataPath, "cache", "pacote");
|
|
151177
151263
|
let packumentPromise = packumentRequests.get(packageName);
|
|
151178
151264
|
if (!packumentPromise) {
|
|
@@ -151182,7 +151268,16 @@ async function fetchPackage(packageName, versionOrRange, options) {
|
|
|
151182
151268
|
const packument = await packumentPromise;
|
|
151183
151269
|
const versions = Object.keys(packument.versions);
|
|
151184
151270
|
const range = resolvedVersionOrRange || "latest";
|
|
151185
|
-
|
|
151271
|
+
let foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
|
|
151272
|
+
if (range === "latest" && ctx.releaseTag && ctx.releaseTag !== "latest") {
|
|
151273
|
+
const releaseTagVersion = packument["dist-tags"]?.[ctx.releaseTag];
|
|
151274
|
+
if (releaseTagVersion && import_semver.default.valid(releaseTagVersion)) {
|
|
151275
|
+
if (!foundVersion || import_semver.default.valid(foundVersion) && import_semver.default.gte(releaseTagVersion, foundVersion)) {
|
|
151276
|
+
console.log(`[Fetcher] Using release tag "${ctx.releaseTag}" (${releaseTagVersion}) instead of "latest" (${foundVersion || "none"}) for ${packageName}`);
|
|
151277
|
+
foundVersion = releaseTagVersion;
|
|
151278
|
+
} else if (foundVersion) console.warn(`[Fetcher] Tag "${ctx.releaseTag}" (${releaseTagVersion}) is older than "latest" (${foundVersion}) for ${packageName}, keeping "latest"`);
|
|
151279
|
+
}
|
|
151280
|
+
}
|
|
151186
151281
|
if (!foundVersion) throw new Error(`Package ${packageName}@${range} not found on npm (available tags: ${Object.keys(packument["dist-tags"] || {}).join(", ")})`);
|
|
151187
151282
|
resolvedVersion = foundVersion;
|
|
151188
151283
|
console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm (${Date.now() - resolveStart}ms)`);
|
|
@@ -151297,7 +151392,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
|
|
|
151297
151392
|
const extension = isWindows ? "zip" : "tar.gz";
|
|
151298
151393
|
const fileName = `node-v${version}-${platform === "osx" ? "darwin" : platform}-${arch}.${extension}`;
|
|
151299
151394
|
const downloadUrl = `https://nodejs.org/dist/v${version}/${fileName}`;
|
|
151300
|
-
const tempDir = await
|
|
151395
|
+
const tempDir = await context.createTempFolder("node-download-");
|
|
151301
151396
|
const archivePath = join(tempDir, fileName);
|
|
151302
151397
|
sendStartupProgress(`Downloading Node.js v${version}...`);
|
|
151303
151398
|
console.log(`Downloading Node.js from ${downloadUrl}...`);
|