@pipelab/cli 2.0.0-beta.10 → 2.0.0-beta.11

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.
Files changed (2) hide show
  1. package/index.mjs +67 -17
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -104200,10 +104200,12 @@ async function withLock(key, fn) {
104200
104200
  * Centralized in core-node to avoid circular dependencies.
104201
104201
  */
104202
104202
  async function fetchPackage(packageName, versionOrRange, options) {
104203
+ const start = Date.now();
104203
104204
  const ctx = options.context;
104204
104205
  const baseDir = ctx.getPackagesPath(packageName);
104205
104206
  let resolvedVersion;
104206
104207
  console.log(`[Fetcher] Resolving ${packageName}@${versionOrRange || "latest"}...`);
104208
+ const resolveStart = Date.now();
104207
104209
  try {
104208
104210
  const cachePath = join(ctx.userDataPath, "cache", "pacote");
104209
104211
  let packumentPromise = packumentRequests.get(packageName);
@@ -104217,22 +104219,32 @@ async function fetchPackage(packageName, versionOrRange, options) {
104217
104219
  const foundVersion = packument["dist-tags"]?.[range] || import_semver.default.maxSatisfying(versions, range);
104218
104220
  if (!foundVersion) throw new Error(`Package ${packageName}@${range} not found on npm (available tags: ${Object.keys(packument["dist-tags"] || {}).join(", ")})`);
104219
104221
  resolvedVersion = foundVersion;
104220
- console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm`);
104222
+ console.log(`[Fetcher] ${packageName}: Resolved to v${resolvedVersion} via npm (${Date.now() - resolveStart}ms)`);
104221
104223
  } catch (error) {
104222
- console.warn(`[Fetcher] ${packageName}: remote resolution failed, trying local fallback...`);
104224
+ console.warn(`[Fetcher] ${packageName}: remote resolution failed (${Date.now() - resolveStart}ms), trying local fallback...`);
104225
+ const fallbackStart = Date.now();
104223
104226
  const fallbackVersion = await tryLocalFallback(versionOrRange, error, baseDir, packageName);
104224
- if (fallbackVersion) resolvedVersion = fallbackVersion;
104225
- else throw error;
104227
+ if (fallbackVersion) {
104228
+ resolvedVersion = fallbackVersion;
104229
+ console.log(`[Fetcher] ${packageName}: Resolved to local fallback ${resolvedVersion} (${Date.now() - fallbackStart}ms)`);
104230
+ } else throw error;
104226
104231
  }
104227
104232
  const cachePath = join(ctx.userDataPath, "cache", "pacote");
104228
104233
  const packageDir = join(baseDir, resolvedVersion);
104229
- if (options?.installDeps ? isPackageComplete(packageDir) && isDependenciesInstalledSync(packageDir) : isPackageComplete(packageDir)) return {
104230
- packageDir,
104231
- resolvedVersion
104232
- };
104234
+ const checkStart = Date.now();
104235
+ const isInstalled = options?.installDeps ? isPackageComplete(packageDir) && isDependenciesInstalledSync(packageDir) : isPackageComplete(packageDir);
104236
+ const checkDuration = Date.now() - checkStart;
104237
+ if (isInstalled) {
104238
+ console.log(`[Fetcher] ${packageName}@${resolvedVersion}: Already installed (check took ${checkDuration}ms, fetchPackage took ${Date.now() - start}ms)`);
104239
+ return {
104240
+ packageDir,
104241
+ resolvedVersion
104242
+ };
104243
+ }
104233
104244
  return withLock(`package:${packageName}:${resolvedVersion}`, async () => {
104234
104245
  if (!isPackageComplete(packageDir)) {
104235
104246
  console.log(`[Fetcher] ${packageName}@${resolvedVersion}: Downloading to ${packageDir}...`);
104247
+ const downloadStart = Date.now();
104236
104248
  const tempDir = join(baseDir, `.tmp-${resolvedVersion}-${Math.random().toString(36).slice(2)}`);
104237
104249
  await mkdir(tempDir, { recursive: true });
104238
104250
  try {
@@ -104248,6 +104260,7 @@ async function fetchPackage(packageName, versionOrRange, options) {
104248
104260
  if (isPackageComplete(packageDir)) console.log(`[Fetcher] Destination ${packageDir} already exists and is valid.`);
104249
104261
  else throw err;
104250
104262
  }
104263
+ console.log(`[Fetcher] ${packageName}@${resolvedVersion}: Downloaded and extracted in ${Date.now() - downloadStart}ms`);
104251
104264
  } catch (err) {
104252
104265
  await rm(tempDir, {
104253
104266
  recursive: true,
@@ -104256,8 +104269,15 @@ async function fetchPackage(packageName, versionOrRange, options) {
104256
104269
  throw err;
104257
104270
  }
104258
104271
  }
104272
+ const entryStart = Date.now();
104259
104273
  const entryPoint = await resolveEntryPoint(packageDir, packageName);
104260
- if (options?.installDeps) await installDependencies(packageDir, packageName, options);
104274
+ console.log(`[Fetcher] ${packageName}@${resolvedVersion}: Resolved entry point in ${Date.now() - entryStart}ms`);
104275
+ if (options?.installDeps) {
104276
+ const depsStart = Date.now();
104277
+ await installDependencies(packageDir, packageName, options);
104278
+ console.log(`[Fetcher] ${packageName}@${resolvedVersion}: Installed dependencies in ${Date.now() - depsStart}ms`);
104279
+ }
104280
+ console.log(`[Fetcher] ${packageName}@${resolvedVersion}: FetchPackage complete in ${Date.now() - start}ms`);
104261
104281
  return {
104262
104282
  packageDir,
104263
104283
  resolvedVersion,
@@ -104296,10 +104316,14 @@ async function runPnpm(cwd, options) {
104296
104316
  * Installs a specific version of Node.js if not already present.
104297
104317
  */
104298
104318
  async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
104319
+ const checkStart = Date.now();
104299
104320
  const isWindows = process.platform === "win32";
104300
104321
  const nodeDir = context.getThirdPartyPath("node", version);
104301
104322
  const finalNodePath = join(nodeDir, isWindows ? "node.exe" : "bin/node");
104302
- if (isNodeJSComplete(finalNodePath)) return finalNodePath;
104323
+ if (isNodeJSComplete(finalNodePath)) {
104324
+ console.log(`[Environment] Node.js check took ${Date.now() - checkStart}ms (found at ${finalNodePath})`);
104325
+ return finalNodePath;
104326
+ }
104303
104327
  return withLock(`node:${version}`, async () => {
104304
104328
  if (isNodeJSComplete(finalNodePath)) return finalNodePath;
104305
104329
  const arch = process.arch === "x64" ? "x64" : process.arch === "arm64" ? "arm64" : "x86";
@@ -104311,9 +104335,12 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
104311
104335
  const archivePath = join(tempDir, fileName);
104312
104336
  sendStartupProgress(`Downloading Node.js v${version}...`);
104313
104337
  console.log(`Downloading Node.js from ${downloadUrl}...`);
104338
+ const dlStart = Date.now();
104314
104339
  await downloadFile(downloadUrl, archivePath);
104340
+ console.log(`[Environment] Node.js download took ${Date.now() - dlStart}ms`);
104315
104341
  sendStartupProgress(`Extracting Node.js v${version}...`);
104316
104342
  console.log(`Extracting Node.js to ${tempDir}...`);
104343
+ const extStart = Date.now();
104317
104344
  const extractTempDir = join(tempDir, "extracted");
104318
104345
  await mkdir(extractTempDir, { recursive: true });
104319
104346
  if (extension === "zip") await extractZip(archivePath, extractTempDir);
@@ -104338,6 +104365,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
104338
104365
  if (isNodeJSComplete(finalNodePath)) console.log(`[Fetcher] Node.js directory already exists and is valid.`);
104339
104366
  else throw err;
104340
104367
  }
104368
+ console.log(`[Environment] Node.js extraction took ${Date.now() - extStart}ms`);
104341
104369
  } finally {
104342
104370
  await rm(tempNodeDir, {
104343
104371
  recursive: true,
@@ -104348,6 +104376,7 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
104348
104376
  force: true
104349
104377
  }).catch(() => {});
104350
104378
  }
104379
+ console.log(`[Environment] Node.js set up complete in ${Date.now() - checkStart}ms`);
104351
104380
  return finalNodePath;
104352
104381
  });
104353
104382
  }
@@ -104355,16 +104384,22 @@ async function ensureNodeJS(context, version = DEFAULT_NODE_VERSION) {
104355
104384
  * Installs the PNPM package from npm if not already present.
104356
104385
  */
104357
104386
  async function ensurePNPM(context, version = DEFAULT_PNPM_VERSION) {
104387
+ const checkStart = Date.now();
104358
104388
  const pnpmPath = join(context.getPackagesPath("pnpm", version), "bin", "pnpm.cjs");
104359
- if (existsSync(pnpmPath)) return pnpmPath;
104389
+ if (existsSync(pnpmPath)) {
104390
+ console.log(`[Environment] PNPM check took ${Date.now() - checkStart}ms (found at ${pnpmPath})`);
104391
+ return pnpmPath;
104392
+ }
104360
104393
  return withLock(`pnpm:${version}`, async () => {
104361
104394
  if (existsSync(pnpmPath)) return pnpmPath;
104362
104395
  sendStartupProgress(`Checking PNPM v${version}...`);
104363
104396
  const { packageDir } = await fetchPackage("pnpm", version, { context });
104397
+ console.log(`[Environment] PNPM set up complete in ${Date.now() - checkStart}ms`);
104364
104398
  return join(packageDir, "bin", "pnpm.cjs");
104365
104399
  });
104366
104400
  }
104367
104401
  async function installDependencies(packageDir, packageName, options) {
104402
+ const start = Date.now();
104368
104403
  const nodeModulesPath = join(packageDir, "node_modules");
104369
104404
  if (isDependenciesInstalledSync(packageDir)) {
104370
104405
  console.log(`[Fetcher] ${packageName}: Dependencies already installed, skipping.`);
@@ -104375,18 +104410,21 @@ async function installDependencies(packageDir, packageName, options) {
104375
104410
  try {
104376
104411
  await cp(join(packageDir, "package.json"), join(tempDir, "package.json"));
104377
104412
  console.log(`[Fetcher] ${packageName}: Ensuring dependencies are installed...`);
104413
+ const pnpmStart = Date.now();
104378
104414
  const { all } = await runPnpm(tempDir, {
104379
104415
  signal: options.signal,
104380
104416
  context: options.context
104381
104417
  });
104418
+ console.log(`[Fetcher] ${packageName}: pnpm install command took ${Date.now() - pnpmStart}ms`);
104382
104419
  if (all) console.log(`[Fetcher] ${packageName}: Installation trace:\n${all}`);
104383
104420
  const tempNodeModules = join(tempDir, "node_modules");
104384
104421
  if (existsSync(nodeModulesPath)) await rm(nodeModulesPath, {
104385
104422
  recursive: true,
104386
104423
  force: true
104387
104424
  }).catch(() => {});
104425
+ const renameStart = Date.now();
104388
104426
  await rename(tempNodeModules, nodeModulesPath);
104389
- console.log(`[Fetcher] ${packageName}: Dependencies installed successfully.`);
104427
+ console.log(`[Fetcher] ${packageName}: Dependencies installed successfully (rename took ${Date.now() - renameStart}ms, total installDependencies took ${Date.now() - start}ms).`);
104390
104428
  } catch (err) {
104391
104429
  console.error(`[Fetcher] ${packageName}: CRITICAL ERROR during dependency installation: ${err.message}`);
104392
104430
  if (err.all) console.error(`[Fetcher] ${packageName}: Error details:\n${err.all}`);
@@ -104611,11 +104649,15 @@ const DEFAULT_PLUGIN_IDS = [
104611
104649
  "netlify"
104612
104650
  ];
104613
104651
  const loadPipelabPlugin = async (id, options) => {
104652
+ const start = Date.now();
104614
104653
  try {
104615
- const { packageDir, entryPoint } = await fetchPipelabPlugin(`@pipelab/plugin-${id}`, options.context.releaseTag, {
104654
+ const packageName = `@pipelab/plugin-${id}`;
104655
+ const fetchStart = Date.now();
104656
+ const { packageDir, entryPoint } = await fetchPipelabPlugin(packageName, options.context.releaseTag, {
104616
104657
  context: options.context,
104617
104658
  installDeps: false
104618
104659
  });
104660
+ const fetchDuration = Date.now() - fetchStart;
104619
104661
  console.log(`[Plugins] [${id}] Attempting to import from: ${entryPoint}`);
104620
104662
  if (!existsSync(entryPoint)) {
104621
104663
  console.error(`[Plugins] [${id}] CRITICAL: Plugin entry point not found at ${entryPoint}`);
@@ -104624,11 +104666,14 @@ const loadPipelabPlugin = async (id, options) => {
104624
104666
  console.log(`[Plugins] [${id}] Directory contents:`, files);
104625
104667
  } catch (e) {}
104626
104668
  }
104669
+ const importStart = Date.now();
104627
104670
  const pluginModule = await import(pathToFileURL(entryPoint).href);
104628
- console.log(`[Plugins] [${id}] Successfully loaded from: ${packageDir}`);
104671
+ const importDuration = Date.now() - importStart;
104672
+ const totalDuration = Date.now() - start;
104673
+ console.log(`[Plugins] [${id}] Successfully loaded from: ${packageDir} (fetch: ${fetchDuration}ms, import: ${importDuration}ms, total: ${totalDuration}ms)`);
104629
104674
  return pluginModule.default;
104630
104675
  } catch (e) {
104631
- console.error(`[Plugins] [${id}] CRITICAL: Failed to load:`, e);
104676
+ console.error(`[Plugins] [${id}] CRITICAL: Failed to load after ${Date.now() - start}ms:`, e);
104632
104677
  if (e.code === "ERR_MODULE_NOT_FOUND") console.error(`[Plugins] [${id}] This usually means a dependency is missing in the plugin's node_modules.`);
104633
104678
  return null;
104634
104679
  }
@@ -104636,20 +104681,25 @@ const loadPipelabPlugin = async (id, options) => {
104636
104681
  const builtInPlugins = async (options) => {
104637
104682
  console.log("[Plugins] Starting background plugin loading...");
104638
104683
  sendStartupProgress("Preparing environment...");
104684
+ const envStart = Date.now();
104639
104685
  await Promise.all([ensureNodeJS(options.context), ensurePNPM(options.context)]);
104686
+ console.log(`[Plugins] Environment preparation took ${Date.now() - envStart}ms`);
104640
104687
  const { usePlugins } = await import("./src-7LlbJymi.mjs");
104641
104688
  const { registerPlugins } = usePlugins();
104642
104689
  const { webSocketServer } = await import("./src-n8V4fRSD.mjs");
104643
104690
  (async () => {
104691
+ const totalStart = Date.now();
104644
104692
  for (const id of DEFAULT_PLUGIN_IDS) {
104645
104693
  sendStartupProgress(`Loading plugin: ${id}`);
104694
+ const pluginStart = Date.now();
104646
104695
  const plugin = await loadPipelabPlugin(id, options);
104696
+ console.log(`[Plugins] [${id}] loadPipelabPlugin loop step took ${Date.now() - pluginStart}ms`);
104647
104697
  if (plugin) {
104648
104698
  registerPlugins([plugin]);
104649
104699
  webSocketServer.broadcast("plugin:loaded", { plugin });
104650
104700
  }
104651
104701
  }
104652
- console.log("[Plugins] All default plugins loaded.");
104702
+ console.log(`[Plugins] All default plugins loaded in ${Date.now() - totalStart}ms.`);
104653
104703
  sendStartupProgress("All plugins loaded.");
104654
104704
  setTimeout(() => {
104655
104705
  webSocketServer.broadcast("startup:progress", { type: "ready" });
@@ -105649,7 +105699,7 @@ async function runPipelineCommand(file, options, version) {
105649
105699
  }
105650
105700
  //#endregion
105651
105701
  //#region package.json
105652
- var version$2 = "2.0.0-beta.10";
105702
+ var version$2 = "2.0.0-beta.11";
105653
105703
  //#endregion
105654
105704
  //#region src/paths.ts
105655
105705
  const getDefaultUserDataPath = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipelab/cli",
3
- "version": "2.0.0-beta.10",
3
+ "version": "2.0.0-beta.11",
4
4
  "description": "The command line interface for Pipelab",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "author": "CynToolkit",