@pubm/core 0.5.1 → 0.5.2

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.js CHANGED
@@ -17614,7 +17614,7 @@ var package_default;
17614
17614
  var init_package = __esm(() => {
17615
17615
  package_default = {
17616
17616
  name: "@pubm/core",
17617
- version: "0.5.1",
17617
+ version: "0.5.2",
17618
17618
  type: "module",
17619
17619
  description: "Core SDK for pubm - publish manager for multiple registries",
17620
17620
  types: "./dist/index.d.ts",
@@ -17693,7 +17693,7 @@ var coreEngines, PUBM_VERSION, PUBM_ENGINES;
17693
17693
  var init_pubm_metadata = __esm(() => {
17694
17694
  init_package();
17695
17695
  coreEngines = package_default.engines ?? {};
17696
- PUBM_VERSION = resolveDefine("0.5.1", package_default.version);
17696
+ PUBM_VERSION = resolveDefine("0.5.2", package_default.version);
17697
17697
  PUBM_ENGINES = {
17698
17698
  node: resolveDefine(">=24", coreEngines.node ?? ">=18"),
17699
17699
  git: resolveDefine(">=2.11.0", coreEngines.git ?? ">=2.11.0"),
@@ -22075,11 +22075,16 @@ var init_rust = __esm(() => {
22075
22075
  manifestFiles() {
22076
22076
  return ["Cargo.toml"];
22077
22077
  }
22078
- defaultTestCommand(_scriptName) {
22079
- return "cargo test";
22078
+ resolveTestCommand(script) {
22079
+ const parts = script.split(/\s+/);
22080
+ return Promise.resolve({ cmd: "cargo", args: parts });
22080
22081
  }
22081
- defaultBuildCommand(_scriptName) {
22082
- return "cargo build --release";
22082
+ resolveBuildCommand(script) {
22083
+ const parts = script.split(/\s+/);
22084
+ return Promise.resolve({ cmd: "cargo", args: parts });
22085
+ }
22086
+ validateScript(_script, _type) {
22087
+ return Promise.resolve(null);
22083
22088
  }
22084
22089
  supportedRegistries() {
22085
22090
  return ["crates"];
@@ -23608,13 +23613,26 @@ var init_js = __esm(() => {
23608
23613
  manifestFiles() {
23609
23614
  return ["package.json"];
23610
23615
  }
23611
- async defaultTestCommand(scriptName) {
23616
+ async resolveTestCommand(script) {
23612
23617
  const pm = await getPackageManager();
23613
- return `${pm} run ${scriptName ?? "test"}`;
23618
+ return { cmd: pm, args: ["run", script] };
23614
23619
  }
23615
- async defaultBuildCommand(scriptName) {
23620
+ async resolveBuildCommand(script) {
23616
23621
  const pm = await getPackageManager();
23617
- return `${pm} run ${scriptName ?? "build"}`;
23622
+ return { cmd: pm, args: ["run", script] };
23623
+ }
23624
+ async validateScript(script, _type) {
23625
+ const pkgPath = path5.join(this.packagePath, "package.json");
23626
+ try {
23627
+ const raw = await readFile5(pkgPath, "utf-8");
23628
+ const { scripts } = JSON.parse(raw);
23629
+ if (!scripts?.[script]) {
23630
+ return `Script '${script}' not found in ${pkgPath}`;
23631
+ }
23632
+ return null;
23633
+ } catch {
23634
+ return `Cannot read ${pkgPath}`;
23635
+ }
23618
23636
  }
23619
23637
  supportedRegistries() {
23620
23638
  return ["npm", "jsr"];
@@ -23755,13 +23773,6 @@ var init_catalog2 = __esm(() => {
23755
23773
  init_js();
23756
23774
  init_rust();
23757
23775
  ecosystemCatalog = new EcosystemCatalog;
23758
- ecosystemCatalog.register({
23759
- key: "js",
23760
- label: "JavaScript",
23761
- defaultRegistries: ["npm", "jsr"],
23762
- ecosystemClass: JsEcosystem,
23763
- detect: (path6) => JsEcosystem.detect(path6)
23764
- });
23765
23776
  ecosystemCatalog.register({
23766
23777
  key: "rust",
23767
23778
  label: "Rust",
@@ -23769,6 +23780,13 @@ var init_catalog2 = __esm(() => {
23769
23780
  ecosystemClass: RustEcosystem,
23770
23781
  detect: (path6) => RustEcosystem.detect(path6)
23771
23782
  });
23783
+ ecosystemCatalog.register({
23784
+ key: "js",
23785
+ label: "JavaScript",
23786
+ defaultRegistries: ["npm", "jsr"],
23787
+ ecosystemClass: JsEcosystem,
23788
+ detect: (path6) => JsEcosystem.detect(path6)
23789
+ });
23772
23790
  });
23773
23791
 
23774
23792
  // src/plugin/runner.ts
@@ -35519,8 +35537,8 @@ var prerequisitesCheckTask = (options) => {
35519
35537
  };
35520
35538
 
35521
35539
  // src/tasks/required-conditions-check.ts
35522
- import { readFile as readFile7 } from "node:fs/promises";
35523
- import { join as join9 } from "node:path";
35540
+ import path12 from "node:path";
35541
+ init_catalog2();
35524
35542
  init_error4();
35525
35543
  init_git();
35526
35544
  init_i18n();
@@ -35608,20 +35626,66 @@ var requiredConditionsCheckTask = (options) => {
35608
35626
  },
35609
35627
  {
35610
35628
  title: t("task.conditions.checkScripts"),
35611
- skip: (ctx2) => !ctx2.config.packages.some((pkg) => (pkg.ecosystem ?? "js") === "js"),
35629
+ skip: (ctx2) => !!ctx2.options.skipTests && !!ctx2.options.skipBuild,
35612
35630
  task: async (ctx2) => {
35613
- const raw = await readFile7(join9(ctx2.cwd, "package.json"), "utf-8");
35614
- const { scripts } = JSON.parse(raw);
35615
35631
  const errors = [];
35616
- if (!ctx2.options.skipTests && !scripts?.[ctx2.options.testScript]) {
35617
- errors.push(t("error.conditions.testScriptMissing", {
35618
- script: ctx2.options.testScript
35619
- }));
35632
+ const JS_WS_TYPES = new Set([
35633
+ "pnpm",
35634
+ "npm",
35635
+ "yarn",
35636
+ "bun",
35637
+ "deno"
35638
+ ]);
35639
+ const workspaces = detectWorkspace(ctx2.cwd);
35640
+ const byEcosystem = new Map;
35641
+ for (const pkg of ctx2.config.packages) {
35642
+ const key = pkg.ecosystem ?? "js";
35643
+ if (!byEcosystem.has(key))
35644
+ byEcosystem.set(key, []);
35645
+ byEcosystem.get(key).push(pkg);
35620
35646
  }
35621
- if (!ctx2.options.skipBuild && !scripts?.[ctx2.options.buildScript]) {
35622
- errors.push(t("error.conditions.buildScriptMissing", {
35623
- script: ctx2.options.buildScript
35624
- }));
35647
+ for (const [ecosystemKey, packages] of byEcosystem) {
35648
+ const descriptor = ecosystemCatalog.get(ecosystemKey);
35649
+ if (!descriptor)
35650
+ continue;
35651
+ const hasWorkspace = ecosystemKey === "js" ? workspaces.some((w2) => JS_WS_TYPES.has(w2.type)) : ecosystemKey === "rust" ? workspaces.some((w2) => w2.type === "cargo") : false;
35652
+ const ecoConfig = ctx2.config.ecosystems?.[ecosystemKey];
35653
+ let testGroupValidated = false;
35654
+ let buildGroupValidated = false;
35655
+ for (const pkg of packages) {
35656
+ if (!ctx2.options.skipTests) {
35657
+ const hasCommand = pkg.testCommand ?? ecoConfig?.testCommand;
35658
+ if (!hasCommand) {
35659
+ const script = pkg.testScript ?? ecoConfig?.testScript ?? ctx2.options.testScript;
35660
+ const isPackageOverride = !!pkg.testScript;
35661
+ const validateCwd = hasWorkspace && !isPackageOverride ? ctx2.cwd : path12.resolve(ctx2.cwd, pkg.path);
35662
+ if (!hasWorkspace || isPackageOverride || !testGroupValidated) {
35663
+ const instance = new descriptor.ecosystemClass(validateCwd);
35664
+ const error4 = await instance.validateScript(script, "test");
35665
+ if (error4)
35666
+ errors.push(error4);
35667
+ if (hasWorkspace && !isPackageOverride)
35668
+ testGroupValidated = true;
35669
+ }
35670
+ }
35671
+ }
35672
+ if (!ctx2.options.skipBuild) {
35673
+ const hasCommand = pkg.buildCommand ?? ecoConfig?.buildCommand;
35674
+ if (!hasCommand) {
35675
+ const script = pkg.buildScript ?? ecoConfig?.buildScript ?? ctx2.options.buildScript;
35676
+ const isPackageOverride = !!pkg.buildScript;
35677
+ const validateCwd = hasWorkspace && !isPackageOverride ? ctx2.cwd : path12.resolve(ctx2.cwd, pkg.path);
35678
+ if (!hasWorkspace || isPackageOverride || !buildGroupValidated) {
35679
+ const instance = new descriptor.ecosystemClass(validateCwd);
35680
+ const error4 = await instance.validateScript(script, "build");
35681
+ if (error4)
35682
+ errors.push(error4);
35683
+ if (hasWorkspace && !isPackageOverride)
35684
+ buildGroupValidated = true;
35685
+ }
35686
+ }
35687
+ }
35688
+ }
35625
35689
  }
35626
35690
  if (errors.length) {
35627
35691
  throw new RequiredConditionCheckError(t("error.conditions.scriptsMissing", {
@@ -35799,7 +35863,7 @@ function createPublishTasks(hasPublish, dryRun, skipPublish) {
35799
35863
  init_dist2();
35800
35864
  var import_semver4 = __toESM(require_semver2(), 1);
35801
35865
  import { existsSync as existsSync6, readFileSync as readFileSync9, rmSync } from "node:fs";
35802
- import { join as join10 } from "node:path";
35866
+ import { join as join9 } from "node:path";
35803
35867
  import process19 from "node:process";
35804
35868
 
35805
35869
  // src/changeset/changelog-parser.ts
@@ -35974,7 +36038,7 @@ async function deleteGitHubRelease(releaseId) {
35974
36038
 
35975
36039
  // src/tasks/runner-utils/version-pr.ts
35976
36040
  import { existsSync as existsSync5, readFileSync as readFileSync8 } from "node:fs";
35977
- import path12 from "node:path";
36041
+ import path13 from "node:path";
35978
36042
  import process18 from "node:process";
35979
36043
  init_error4();
35980
36044
  init_git();
@@ -36159,8 +36223,8 @@ function buildPrBodyFromContext(ctx, plan) {
36159
36223
  const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
36160
36224
  const name = pkgConfig?.name ?? pkgPath;
36161
36225
  packages.push({ name, version: pkgVersion, bump: "" });
36162
- const changelogDir = pkgConfig ? path12.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
36163
- const changelogPath = path12.join(changelogDir, "CHANGELOG.md");
36226
+ const changelogDir = pkgConfig ? path13.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
36227
+ const changelogPath = path13.join(changelogDir, "CHANGELOG.md");
36164
36228
  if (existsSync5(changelogPath)) {
36165
36229
  const section = parseChangelogSection(readFileSync8(changelogPath, "utf-8"), pkgVersion);
36166
36230
  if (section)
@@ -36173,7 +36237,7 @@ function buildPrBodyFromContext(ctx, plan) {
36173
36237
  packages.push({ name: pkg.name, version, bump: "" });
36174
36238
  }
36175
36239
  if (plan.mode === "single") {
36176
- const changelogPath = path12.join(ctx.cwd, "CHANGELOG.md");
36240
+ const changelogPath = path13.join(ctx.cwd, "CHANGELOG.md");
36177
36241
  if (existsSync5(changelogPath)) {
36178
36242
  const section = parseChangelogSection(readFileSync8(changelogPath, "utf-8"), version);
36179
36243
  if (section)
@@ -36181,7 +36245,7 @@ function buildPrBodyFromContext(ctx, plan) {
36181
36245
  }
36182
36246
  } else {
36183
36247
  for (const pkg of ctx.config.packages) {
36184
- const changelogPath = path12.join(ctx.cwd, pkg.path, "CHANGELOG.md");
36248
+ const changelogPath = path13.join(ctx.cwd, pkg.path, "CHANGELOG.md");
36185
36249
  if (existsSync5(changelogPath)) {
36186
36250
  const section = parseChangelogSection(readFileSync8(changelogPath, "utf-8"), version);
36187
36251
  if (section)
@@ -36284,7 +36348,7 @@ function createReleaseTask(hasPublish, dryRun, mode, skipReleaseDraft) {
36284
36348
  let changelogBody;
36285
36349
  const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
36286
36350
  if (pkgConfig) {
36287
- const changelogPath = join10(ctx.cwd, pkgConfig.path, "CHANGELOG.md");
36351
+ const changelogPath = join9(ctx.cwd, pkgConfig.path, "CHANGELOG.md");
36288
36352
  if (existsSync6(changelogPath)) {
36289
36353
  const section = parseChangelogSection(readFileSync9(changelogPath, "utf-8"), pkgVersion);
36290
36354
  if (section)
@@ -36342,7 +36406,7 @@ function createReleaseTask(hasPublish, dryRun, mode, skipReleaseDraft) {
36342
36406
  const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath2);
36343
36407
  if (!pkgConfig)
36344
36408
  continue;
36345
- const changelogPath = join10(ctx.cwd, pkgConfig.path, "CHANGELOG.md");
36409
+ const changelogPath = join9(ctx.cwd, pkgConfig.path, "CHANGELOG.md");
36346
36410
  if (existsSync6(changelogPath)) {
36347
36411
  const section = parseChangelogSection(readFileSync9(changelogPath, "utf-8"), pkgVersion);
36348
36412
  if (section) {
@@ -36360,7 +36424,7 @@ ${section}`);
36360
36424
  `);
36361
36425
  }
36362
36426
  } else {
36363
- const changelogPath = join10(ctx.cwd, "CHANGELOG.md");
36427
+ const changelogPath = join9(ctx.cwd, "CHANGELOG.md");
36364
36428
  if (existsSync6(changelogPath)) {
36365
36429
  const section = parseChangelogSection(readFileSync9(changelogPath, "utf-8"), version);
36366
36430
  if (section)
@@ -36471,24 +36535,158 @@ ${repositoryUrl}/compare/${lastRev}...${tag}`;
36471
36535
  init_catalog2();
36472
36536
  init_error4();
36473
36537
  init_i18n();
36538
+ import path14 from "node:path";
36474
36539
  init_exec();
36475
- function collectUniqueEcosystems(ctx) {
36476
- const seen = new Set;
36540
+ var JS_WORKSPACE_TYPES = new Set(["pnpm", "npm", "yarn", "bun", "deno"]);
36541
+ var ECOSYSTEM_DEFAULTS = {
36542
+ js: { test: "test", build: "build" },
36543
+ rust: { test: "test", build: "build --release" }
36544
+ };
36545
+ function hasWorkspaceForEcosystem(cwd, ecosystemKey) {
36546
+ const workspaces = detectWorkspace(cwd);
36547
+ if (ecosystemKey === "js") {
36548
+ return workspaces.some((w2) => JS_WORKSPACE_TYPES.has(w2.type));
36549
+ }
36550
+ if (ecosystemKey === "rust") {
36551
+ return workspaces.some((w2) => w2.type === "cargo");
36552
+ }
36553
+ return false;
36554
+ }
36555
+ function hasPackageLevelOverride(pkg, type) {
36556
+ return type === "test" ? !!(pkg.testCommand || pkg.testScript) : !!(pkg.buildCommand || pkg.buildScript);
36557
+ }
36558
+ function resolveScript(pkg, ecosystemKey, ctx, type) {
36559
+ const sf = type === "test" ? "testScript" : "buildScript";
36560
+ const cf = type === "test" ? "testCommand" : "buildCommand";
36561
+ if (pkg[cf])
36562
+ return { command: pkg[cf] };
36563
+ if (pkg[sf])
36564
+ return { script: pkg[sf] };
36565
+ const eco = ctx.config.ecosystems?.[ecosystemKey];
36566
+ if (eco?.[cf])
36567
+ return { command: eco[cf] };
36568
+ if (eco?.[sf])
36569
+ return { script: eco[sf] };
36570
+ const globalScript = type === "test" ? ctx.options.testScript : ctx.options.buildScript;
36571
+ if (globalScript)
36572
+ return { script: globalScript };
36573
+ return { script: ECOSYSTEM_DEFAULTS[ecosystemKey]?.[type] ?? type };
36574
+ }
36575
+ function groupByEcosystem(ctx, type) {
36576
+ const map = new Map;
36477
36577
  for (const pkg of ctx.config.packages) {
36478
- seen.add(pkg.ecosystem ?? "js");
36578
+ const key = pkg.ecosystem ?? "js";
36579
+ if (!map.has(key))
36580
+ map.set(key, { group: [], individual: [] });
36581
+ const entry = map.get(key);
36582
+ if (hasPackageLevelOverride(pkg, type)) {
36583
+ entry.individual.push(pkg);
36584
+ } else {
36585
+ entry.group.push(pkg);
36586
+ }
36479
36587
  }
36480
- return [...seen];
36588
+ const result = [];
36589
+ for (const descriptor of ecosystemCatalog.all()) {
36590
+ const entry = map.get(descriptor.key);
36591
+ if (!entry)
36592
+ continue;
36593
+ if (entry.group.length === 0 && entry.individual.length === 0)
36594
+ continue;
36595
+ result.push({
36596
+ ecosystemKey: descriptor.key,
36597
+ groupPackages: entry.group,
36598
+ individualPackages: entry.individual,
36599
+ hasWorkspace: hasWorkspaceForEcosystem(ctx.cwd, descriptor.key)
36600
+ });
36601
+ }
36602
+ return result;
36481
36603
  }
36482
- async function execEcosystemCommand(ctx, task, command) {
36483
- const parts = command.split(/\s+/);
36484
- const [cmd, ...args] = parts;
36485
- const liveOutput = shouldRenderLiveCommandOutput(ctx) ? createLiveCommandOutput(task, command) : undefined;
36486
- task.output = `Executing \`${command}\``;
36604
+ async function resolveExecutions(ctx, type) {
36605
+ const groups = groupByEcosystem(ctx, type);
36606
+ const executions = [];
36607
+ for (const group of groups) {
36608
+ const descriptor = ecosystemCatalog.get(group.ecosystemKey);
36609
+ if (!descriptor)
36610
+ continue;
36611
+ if (group.groupPackages.length > 0) {
36612
+ const resolved = resolveScript(group.groupPackages[0], group.ecosystemKey, ctx, type);
36613
+ if (resolved.command) {
36614
+ if (group.hasWorkspace) {
36615
+ executions.push({
36616
+ label: resolved.command,
36617
+ cmd: "sh",
36618
+ args: ["-c", resolved.command],
36619
+ cwd: ctx.cwd
36620
+ });
36621
+ } else {
36622
+ for (const pkg of group.groupPackages) {
36623
+ const pkgCwd = path14.resolve(ctx.cwd, pkg.path);
36624
+ executions.push({
36625
+ label: `${resolved.command} (${pkg.path})`,
36626
+ cmd: "sh",
36627
+ args: ["-c", resolved.command],
36628
+ cwd: pkgCwd
36629
+ });
36630
+ }
36631
+ }
36632
+ } else if (resolved.script) {
36633
+ if (group.hasWorkspace) {
36634
+ const instance = new descriptor.ecosystemClass(ctx.cwd);
36635
+ const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
36636
+ executions.push({
36637
+ label: `${cmd} ${args.join(" ")}`,
36638
+ cmd,
36639
+ args,
36640
+ cwd: ctx.cwd
36641
+ });
36642
+ } else {
36643
+ for (const pkg of group.groupPackages) {
36644
+ const pkgCwd = path14.resolve(ctx.cwd, pkg.path);
36645
+ const instance = new descriptor.ecosystemClass(pkgCwd);
36646
+ const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
36647
+ executions.push({
36648
+ label: `${cmd} ${args.join(" ")} (${pkg.path})`,
36649
+ cmd,
36650
+ args,
36651
+ cwd: pkgCwd
36652
+ });
36653
+ }
36654
+ }
36655
+ }
36656
+ }
36657
+ for (const pkg of group.individualPackages) {
36658
+ const pkgCwd = path14.resolve(ctx.cwd, pkg.path);
36659
+ const resolved = resolveScript(pkg, group.ecosystemKey, ctx, type);
36660
+ if (resolved.command) {
36661
+ executions.push({
36662
+ label: `${resolved.command} (${pkg.path})`,
36663
+ cmd: "sh",
36664
+ args: ["-c", resolved.command],
36665
+ cwd: pkgCwd
36666
+ });
36667
+ } else if (resolved.script) {
36668
+ const instance = new descriptor.ecosystemClass(pkgCwd);
36669
+ const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
36670
+ executions.push({
36671
+ label: `${cmd} ${args.join(" ")} (${pkg.path})`,
36672
+ cmd,
36673
+ args,
36674
+ cwd: pkgCwd
36675
+ });
36676
+ }
36677
+ }
36678
+ }
36679
+ return executions;
36680
+ }
36681
+ async function runExecution(execution, ctx, task) {
36682
+ const liveOutput = shouldRenderLiveCommandOutput(ctx) ? createLiveCommandOutput(task, execution.label) : undefined;
36683
+ task.output = `Executing \`${execution.label}\``;
36487
36684
  try {
36488
- await exec3(cmd, args, {
36685
+ await exec3(execution.cmd, execution.args, {
36489
36686
  onStdout: liveOutput?.onStdout,
36490
36687
  onStderr: liveOutput?.onStderr,
36491
- throwOnError: true
36688
+ throwOnError: true,
36689
+ nodeOptions: { cwd: execution.cwd }
36492
36690
  });
36493
36691
  } finally {
36494
36692
  liveOutput?.finish();
@@ -36501,29 +36699,24 @@ function createTestTask(hasPrepare, skipTests) {
36501
36699
  task: async (ctx, task) => {
36502
36700
  task.output = t("task.test.runningBeforeHooks");
36503
36701
  await ctx.runtime.pluginRunner.runHook("beforeTest", ctx);
36504
- const ecosystems = collectUniqueEcosystems(ctx);
36505
- const executedCommands = [];
36506
- for (const key of ecosystems) {
36507
- const descriptor = ecosystemCatalog.get(key);
36508
- if (!descriptor)
36509
- continue;
36510
- const instance = new descriptor.ecosystemClass(ctx.cwd);
36511
- const command = await instance.defaultTestCommand(ctx.options.testScript);
36512
- executedCommands.push(command);
36513
- task.title = t("task.test.titleWithCommand", { command });
36702
+ const executions = await resolveExecutions(ctx, "test");
36703
+ for (const execution of executions) {
36704
+ task.title = t("task.test.titleWithCommand", {
36705
+ command: execution.label
36706
+ });
36514
36707
  try {
36515
- await execEcosystemCommand(ctx, task, command);
36708
+ await runExecution(execution, ctx, task);
36516
36709
  } catch (error4) {
36517
36710
  throw new AbstractError(t("error.test.failedWithHint", {
36518
- script: command,
36519
- command
36711
+ script: execution.label,
36712
+ command: execution.label
36520
36713
  }), { cause: error4 });
36521
36714
  }
36522
36715
  }
36523
36716
  task.output = t("task.test.runningAfterHooks");
36524
36717
  await ctx.runtime.pluginRunner.runHook("afterTest", ctx);
36525
36718
  task.output = t("task.test.completed", {
36526
- command: executedCommands.join(", ")
36719
+ command: executions.map((e3) => e3.label).join(", ")
36527
36720
  });
36528
36721
  }
36529
36722
  };
@@ -36535,29 +36728,24 @@ function createBuildTask(hasPrepare, skipBuild) {
36535
36728
  task: async (ctx, task) => {
36536
36729
  task.output = t("task.build.runningBeforeHooks");
36537
36730
  await ctx.runtime.pluginRunner.runHook("beforeBuild", ctx);
36538
- const ecosystems = collectUniqueEcosystems(ctx);
36539
- const executedCommands = [];
36540
- for (const key of ecosystems) {
36541
- const descriptor = ecosystemCatalog.get(key);
36542
- if (!descriptor)
36543
- continue;
36544
- const instance = new descriptor.ecosystemClass(ctx.cwd);
36545
- const command = await instance.defaultBuildCommand(ctx.options.buildScript);
36546
- executedCommands.push(command);
36547
- task.title = t("task.build.titleWithCommand", { command });
36731
+ const executions = await resolveExecutions(ctx, "build");
36732
+ for (const execution of executions) {
36733
+ task.title = t("task.build.titleWithCommand", {
36734
+ command: execution.label
36735
+ });
36548
36736
  try {
36549
- await execEcosystemCommand(ctx, task, command);
36737
+ await runExecution(execution, ctx, task);
36550
36738
  } catch (error4) {
36551
36739
  throw new AbstractError(t("error.build.failedWithHint", {
36552
- script: command,
36553
- command
36740
+ script: execution.label,
36741
+ command: execution.label
36554
36742
  }), { cause: error4 });
36555
36743
  }
36556
36744
  }
36557
36745
  task.output = t("task.build.runningAfterHooks");
36558
36746
  await ctx.runtime.pluginRunner.runHook("afterBuild", ctx);
36559
36747
  task.output = t("task.build.completed", {
36560
- command: executedCommands.join(", ")
36748
+ command: executions.map((e3) => e3.label).join(", ")
36561
36749
  });
36562
36750
  }
36563
36751
  };
@@ -36565,13 +36753,13 @@ function createBuildTask(hasPrepare, skipBuild) {
36565
36753
 
36566
36754
  // src/tasks/phases/version.ts
36567
36755
  init_dist2();
36568
- import path15 from "node:path";
36756
+ import path17 from "node:path";
36569
36757
 
36570
36758
  // src/changelog/file.ts
36571
36759
  import { existsSync as existsSync7, readFileSync as readFileSync10, writeFileSync as writeFileSync8 } from "node:fs";
36572
- import path13 from "node:path";
36760
+ import path15 from "node:path";
36573
36761
  function writeChangelogToFile(cwd, newContent) {
36574
- const changelogPath = path13.join(cwd, "CHANGELOG.md");
36762
+ const changelogPath = path15.join(cwd, "CHANGELOG.md");
36575
36763
  let existing = "";
36576
36764
  if (existsSync7(changelogPath)) {
36577
36765
  existing = readFileSync10(changelogPath, "utf-8");
@@ -36636,7 +36824,7 @@ function buildChangelogEntries(changesets, packagePath) {
36636
36824
 
36637
36825
  // src/changeset/reader.ts
36638
36826
  import { existsSync as existsSync8, readdirSync as readdirSync3, readFileSync as readFileSync11, rmSync as rmSync2 } from "node:fs";
36639
- import path14 from "node:path";
36827
+ import path16 from "node:path";
36640
36828
  import process20 from "node:process";
36641
36829
 
36642
36830
  // src/changeset/parser.ts
@@ -36657,8 +36845,8 @@ function parseChangeset(content, fileName, resolveKey) {
36657
36845
  if (!VALID_BUMP_TYPES.has(type)) {
36658
36846
  throw new Error(`Invalid bump type "${type}" for package "${key}" in "${fileName}". Expected: patch, minor, or major.`);
36659
36847
  }
36660
- const path14 = resolveKey ? resolveKey(key) : key;
36661
- releases.push({ path: path14, type });
36848
+ const path16 = resolveKey ? resolveKey(key) : key;
36849
+ releases.push({ path: path16, type });
36662
36850
  }
36663
36851
  }
36664
36852
  const id = fileName.replace(/\.md$/, "");
@@ -36671,7 +36859,7 @@ function parseChangeset(content, fileName, resolveKey) {
36671
36859
 
36672
36860
  // src/changeset/reader.ts
36673
36861
  function readChangesets(cwd = process20.cwd(), resolveKey) {
36674
- const changesetsDir = path14.join(cwd, ".pubm", "changesets");
36862
+ const changesetsDir = path16.join(cwd, ".pubm", "changesets");
36675
36863
  if (!existsSync8(changesetsDir)) {
36676
36864
  return [];
36677
36865
  }
@@ -36681,16 +36869,16 @@ function readChangesets(cwd = process20.cwd(), resolveKey) {
36681
36869
  if (!file.endsWith(".md") || file === "README.md") {
36682
36870
  continue;
36683
36871
  }
36684
- const filePath = path14.join(changesetsDir, file);
36872
+ const filePath = path16.join(changesetsDir, file);
36685
36873
  const content = readFileSync11(filePath, "utf-8");
36686
36874
  changesets.push(parseChangeset(content, file, resolveKey));
36687
36875
  }
36688
36876
  return changesets;
36689
36877
  }
36690
36878
  function deleteChangesetFiles(cwd, changesets) {
36691
- const changesetsDir = path14.join(cwd, ".pubm", "changesets");
36879
+ const changesetsDir = path16.join(cwd, ".pubm", "changesets");
36692
36880
  for (const changeset of changesets) {
36693
- const filePath = path14.join(changesetsDir, `${changeset.id}.md`);
36881
+ const filePath = path16.join(changesetsDir, `${changeset.id}.md`);
36694
36882
  if (existsSync8(filePath)) {
36695
36883
  rmSync2(filePath);
36696
36884
  }
@@ -36747,7 +36935,7 @@ function createVersionTask(hasPrepare, dryRun) {
36747
36935
  const changesets = readChangesets(ctx.cwd, resolver);
36748
36936
  if (changesets.length > 0) {
36749
36937
  registerChangesetBackups(ctx, changesets);
36750
- const changelogPath = path15.join(ctx.cwd, "CHANGELOG.md");
36938
+ const changelogPath = path17.join(ctx.cwd, "CHANGELOG.md");
36751
36939
  registerChangelogBackup(ctx, changelogPath);
36752
36940
  const pkgPath = ctx.config.packages[0]?.path ?? "";
36753
36941
  const entries = buildChangelogEntries(changesets, pkgPath);
@@ -36804,7 +36992,7 @@ ${ctx.config.packages.map((pkg) => `- ${pkg.name}: ${plan.version}`).join(`
36804
36992
  const changesets = readChangesets(ctx.cwd, resolver);
36805
36993
  if (changesets.length > 0) {
36806
36994
  registerChangesetBackups(ctx, changesets);
36807
- const changelogPath = path15.join(ctx.cwd, "CHANGELOG.md");
36995
+ const changelogPath = path17.join(ctx.cwd, "CHANGELOG.md");
36808
36996
  registerChangelogBackup(ctx, changelogPath);
36809
36997
  const allEntries = [...plan.packages.keys()].flatMap((pkgPath) => buildChangelogEntries(changesets, pkgPath));
36810
36998
  if (allEntries.length > 0) {
@@ -36864,15 +37052,15 @@ ${[...plan.packages].map(([pkgPath]) => `- ${getPackageName(ctx, pkgPath)}: ${pl
36864
37052
  registerChangesetBackups(ctx, changesets);
36865
37053
  for (const [pkgPath] of plan.packages) {
36866
37054
  const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
36867
- const changelogDir = pkgConfig ? path15.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
36868
- const changelogPath = path15.join(changelogDir, "CHANGELOG.md");
37055
+ const changelogDir = pkgConfig ? path17.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
37056
+ const changelogPath = path17.join(changelogDir, "CHANGELOG.md");
36869
37057
  registerChangelogBackup(ctx, changelogPath);
36870
37058
  }
36871
37059
  for (const [pkgPath, pkgVersion] of plan.packages) {
36872
37060
  const entries = buildChangelogEntries(changesets, pkgPath);
36873
37061
  if (entries.length > 0) {
36874
37062
  const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
36875
- const changelogDir = pkgConfig ? path15.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
37063
+ const changelogDir = pkgConfig ? path17.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
36876
37064
  writeChangelogToFile(changelogDir, generateChangelog(pkgVersion, entries));
36877
37065
  }
36878
37066
  }
@@ -37124,11 +37312,11 @@ function maxBump(a3, b2) {
37124
37312
  }
37125
37313
  // src/changeset/migrate.ts
37126
37314
  import { copyFileSync, existsSync as existsSync9, mkdirSync as mkdirSync3, readdirSync as readdirSync4 } from "node:fs";
37127
- import path16 from "node:path";
37315
+ import path18 from "node:path";
37128
37316
  import process22 from "node:process";
37129
37317
  var SKIPPED_FILES = new Set(["config.json", "README.md"]);
37130
37318
  function migrateFromChangesets(cwd = process22.cwd()) {
37131
- const changesetDir = path16.join(cwd, ".changeset");
37319
+ const changesetDir = path18.join(cwd, ".changeset");
37132
37320
  if (!existsSync9(changesetDir)) {
37133
37321
  return {
37134
37322
  success: false,
@@ -37137,7 +37325,7 @@ function migrateFromChangesets(cwd = process22.cwd()) {
37137
37325
  configMigrated: false
37138
37326
  };
37139
37327
  }
37140
- const pubmDir = path16.join(cwd, ".pubm", "changesets");
37328
+ const pubmDir = path18.join(cwd, ".pubm", "changesets");
37141
37329
  mkdirSync3(pubmDir, { recursive: true });
37142
37330
  const files = readdirSync4(changesetDir);
37143
37331
  const migratedFiles = [];
@@ -37151,13 +37339,13 @@ function migrateFromChangesets(cwd = process22.cwd()) {
37151
37339
  continue;
37152
37340
  }
37153
37341
  if (file === "pre.json") {
37154
- copyFileSync(path16.join(changesetDir, file), path16.resolve(cwd, ".pubm", "pre.json"));
37342
+ copyFileSync(path18.join(changesetDir, file), path18.resolve(cwd, ".pubm", "pre.json"));
37155
37343
  migratedFiles.push(file);
37156
37344
  continue;
37157
37345
  }
37158
37346
  if (file.endsWith(".md")) {
37159
- const src = path16.join(changesetDir, file);
37160
- const dest = path16.join(pubmDir, file);
37347
+ const src = path18.join(changesetDir, file);
37348
+ const dest = path18.join(pubmDir, file);
37161
37349
  copyFileSync(src, dest);
37162
37350
  migratedFiles.push(file);
37163
37351
  }
@@ -37232,7 +37420,7 @@ function calculateVersionBumps(currentVersions, cwd = process24.cwd(), resolveKe
37232
37420
  // src/changeset/writer.ts
37233
37421
  var import_yaml3 = __toESM(require_dist(), 1);
37234
37422
  import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync9 } from "node:fs";
37235
- import path17 from "node:path";
37423
+ import path19 from "node:path";
37236
37424
  import process25 from "node:process";
37237
37425
  var adjectives = [
37238
37426
  "brave",
@@ -37328,11 +37516,11 @@ ${summary}
37328
37516
  return content;
37329
37517
  }
37330
37518
  function writeChangeset(releases, summary, cwd = process25.cwd()) {
37331
- const changesetsDir = path17.join(cwd, ".pubm", "changesets");
37519
+ const changesetsDir = path19.join(cwd, ".pubm", "changesets");
37332
37520
  mkdirSync4(changesetsDir, { recursive: true });
37333
37521
  const id = generateChangesetId();
37334
37522
  const fileName = `${id}.md`;
37335
- const filePath = path17.join(changesetsDir, fileName);
37523
+ const filePath = path19.join(changesetsDir, fileName);
37336
37524
  const content = generateChangesetContent(releases, summary);
37337
37525
  writeFileSync9(filePath, content, "utf-8");
37338
37526
  return filePath;
@@ -37340,6 +37528,8 @@ function writeChangeset(releases, summary, cwd = process25.cwd()) {
37340
37528
  // src/config/defaults.ts
37341
37529
  init_catalog2();
37342
37530
  init_i18n();
37531
+ var import_micromatch4 = __toESM(require_micromatch(), 1);
37532
+ import path20 from "node:path";
37343
37533
  init_catalog();
37344
37534
  var defaultValidate = {
37345
37535
  cleanInstall: true,
@@ -37385,6 +37575,16 @@ async function resolveConfig(config, cwd) {
37385
37575
  }
37386
37576
  }
37387
37577
  }
37578
+ if (config.ecosystems) {
37579
+ for (const key of Object.keys(config.ecosystems)) {
37580
+ if (!ecosystemCatalog.get(key)) {
37581
+ throw new Error(t("error.config.unknownEcosystem", {
37582
+ ecosystem: key,
37583
+ list: ecosystemCatalog.all().map((d3) => d3.key).join(", ")
37584
+ }));
37585
+ }
37586
+ }
37587
+ }
37388
37588
  const configPackages = config.packages?.map((pkg) => {
37389
37589
  if (!pkg.registries)
37390
37590
  return pkg;
@@ -37406,15 +37606,29 @@ async function resolveConfig(config, cwd) {
37406
37606
  discoveryEmpty = true;
37407
37607
  packages = [];
37408
37608
  } else {
37409
- packages = discovered.map((pkg) => ({
37410
- path: pkg.path,
37411
- name: pkg.name,
37412
- version: pkg.version,
37413
- dependencies: pkg.dependencies,
37414
- ecosystem: pkg.ecosystem,
37415
- registries: pkg.registries,
37416
- ...pkg.registryVersions ? { registryVersions: pkg.registryVersions } : {}
37417
- }));
37609
+ packages = discovered.map((pkg) => {
37610
+ const configPkg = configPackages?.find((cp) => {
37611
+ const normalized = cp.path.replace(/\\/g, "/");
37612
+ const pkgPathForward = pkg.path.replace(/\\/g, "/");
37613
+ if (import_micromatch4.default.scan(normalized).isGlob) {
37614
+ return import_micromatch4.default.isMatch(pkgPathForward, normalized);
37615
+ }
37616
+ return path20.normalize(cp.path) === pkg.path;
37617
+ });
37618
+ return {
37619
+ path: pkg.path,
37620
+ name: pkg.name,
37621
+ version: pkg.version,
37622
+ dependencies: pkg.dependencies,
37623
+ ecosystem: pkg.ecosystem,
37624
+ registries: pkg.registries,
37625
+ ...pkg.registryVersions ? { registryVersions: pkg.registryVersions } : {},
37626
+ ...configPkg?.testScript ? { testScript: configPkg.testScript } : {},
37627
+ ...configPkg?.testCommand ? { testCommand: configPkg.testCommand } : {},
37628
+ ...configPkg?.buildScript ? { buildScript: configPkg.buildScript } : {},
37629
+ ...configPkg?.buildCommand ? { buildCommand: configPkg.buildCommand } : {}
37630
+ };
37631
+ });
37418
37632
  }
37419
37633
  return {
37420
37634
  ...defaultConfig,
@@ -37427,6 +37641,7 @@ async function resolveConfig(config, cwd) {
37427
37641
  ...config.rollback
37428
37642
  },
37429
37643
  snapshotTemplate: config.snapshotTemplate ?? defaultConfig.snapshotTemplate,
37644
+ ecosystems: config.ecosystems ?? {},
37430
37645
  plugins: config.plugins ?? [],
37431
37646
  versionSources: config.versionSources ?? defaultConfig.versionSources,
37432
37647
  conventionalCommits: {
@@ -37451,14 +37666,14 @@ import { execFile } from "node:child_process";
37451
37666
  import {
37452
37667
  mkdir,
37453
37668
  mkdtemp,
37454
- readFile as readFile8,
37669
+ readFile as readFile7,
37455
37670
  rm,
37456
37671
  stat as stat6,
37457
37672
  writeFile as writeFile3
37458
37673
  } from "node:fs/promises";
37459
37674
  import { createRequire as createRequire2 } from "node:module";
37460
37675
  import { tmpdir as tmpdir3 } from "node:os";
37461
- import path18 from "node:path";
37676
+ import path21 from "node:path";
37462
37677
  import { pathToFileURL } from "node:url";
37463
37678
  import vm from "node:vm";
37464
37679
  var CONFIG_FILES = [
@@ -37511,7 +37726,7 @@ var CONFIG_MODULE_SHIMS = {
37511
37726
  };
37512
37727
  async function findConfigFile(cwd) {
37513
37728
  for (const file of CONFIG_FILES) {
37514
- const filePath = path18.join(cwd, file);
37729
+ const filePath = path21.join(cwd, file);
37515
37730
  try {
37516
37731
  if ((await stat6(filePath)).isFile()) {
37517
37732
  return filePath;
@@ -37532,15 +37747,15 @@ function isBareSpecifier(specifier) {
37532
37747
  return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("file:") && !specifier.startsWith("node:");
37533
37748
  }
37534
37749
  async function findClosestPackageManifest(filePath) {
37535
- let current = path18.dirname(filePath);
37750
+ let current = path21.dirname(filePath);
37536
37751
  while (true) {
37537
- const manifestPath = path18.join(current, "package.json");
37752
+ const manifestPath = path21.join(current, "package.json");
37538
37753
  try {
37539
37754
  if ((await stat6(manifestPath)).isFile()) {
37540
37755
  return manifestPath;
37541
37756
  }
37542
37757
  } catch {}
37543
- const parent = path18.dirname(current);
37758
+ const parent = path21.dirname(current);
37544
37759
  if (parent === current) {
37545
37760
  return null;
37546
37761
  }
@@ -37556,7 +37771,7 @@ async function isOptionalDependencyImport(specifier, importerPath) {
37556
37771
  return false;
37557
37772
  }
37558
37773
  const packageName = getPackageName2(specifier);
37559
- const manifest = JSON.parse(await readFile8(manifestPath, "utf8"));
37774
+ const manifest = JSON.parse(await readFile7(manifestPath, "utf8"));
37560
37775
  if (manifest.optionalDependencies?.[packageName]) {
37561
37776
  return true;
37562
37777
  }
@@ -37627,7 +37842,7 @@ async function collectOptionalDependenciesForInputs(inputPaths) {
37627
37842
  }
37628
37843
  const optionalDependencies = new Set;
37629
37844
  for (const manifestPath of manifestPaths) {
37630
- const manifest = JSON.parse(await readFile8(manifestPath, "utf8"));
37845
+ const manifest = JSON.parse(await readFile7(manifestPath, "utf8"));
37631
37846
  for (const dependency of Object.keys(manifest.optionalDependencies ?? {})) {
37632
37847
  optionalDependencies.add(dependency);
37633
37848
  }
@@ -37642,13 +37857,13 @@ async function collectOptionalDependenciesForInputs(inputPaths) {
37642
37857
  async function findInstalledPackagePath(startDir, dependency) {
37643
37858
  let current = startDir;
37644
37859
  while (true) {
37645
- const packageDir = path18.join(current, "node_modules", dependency);
37860
+ const packageDir = path21.join(current, "node_modules", dependency);
37646
37861
  try {
37647
37862
  if ((await stat6(packageDir)).isDirectory()) {
37648
37863
  return packageDir;
37649
37864
  }
37650
37865
  } catch {}
37651
- const parent = path18.dirname(current);
37866
+ const parent = path21.dirname(current);
37652
37867
  if (parent === current) {
37653
37868
  return null;
37654
37869
  }
@@ -37656,19 +37871,19 @@ async function findInstalledPackagePath(startDir, dependency) {
37656
37871
  }
37657
37872
  }
37658
37873
  async function writeOptionalDependencyStubs(moduleDir, resolveFromDir, optionalDependencies) {
37659
- const nodeModulesDir = path18.join(moduleDir, "node_modules");
37874
+ const nodeModulesDir = path21.join(moduleDir, "node_modules");
37660
37875
  for (const dependency of optionalDependencies) {
37661
37876
  if (await findInstalledPackagePath(resolveFromDir, dependency)) {
37662
37877
  continue;
37663
37878
  }
37664
- const packageDir = path18.join(nodeModulesDir, dependency);
37879
+ const packageDir = path21.join(nodeModulesDir, dependency);
37665
37880
  await mkdir(packageDir, { recursive: true });
37666
- await writeFile3(path18.join(packageDir, "package.json"), JSON.stringify({
37881
+ await writeFile3(path21.join(packageDir, "package.json"), JSON.stringify({
37667
37882
  name: dependency,
37668
37883
  private: true,
37669
37884
  main: "./index.js"
37670
37885
  }, null, 2), "utf8");
37671
- await writeFile3(path18.join(packageDir, "index.js"), createOptionalDependencyProxyPackage(dependency), "utf8");
37886
+ await writeFile3(path21.join(packageDir, "index.js"), createOptionalDependencyProxyPackage(dependency), "utf8");
37672
37887
  }
37673
37888
  }
37674
37889
  function createOptionalDependencyPlugin(specifiers) {
@@ -37722,7 +37937,7 @@ function createConfigModuleShimPlugin() {
37722
37937
  };
37723
37938
  }
37724
37939
  async function runBunBuild(build, entrypoint, format3 = "esm", optionalDynamicImports = []) {
37725
- const entrypointSource = await readFile8(entrypoint, "utf8");
37940
+ const entrypointSource = await readFile7(entrypoint, "utf8");
37726
37941
  const result = await build({
37727
37942
  entrypoints: [entrypoint],
37728
37943
  target: "bun",
@@ -37780,10 +37995,10 @@ async function buildConfigWithFormat(entrypoint, format3) {
37780
37995
  }
37781
37996
  async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
37782
37997
  const extension = format3 === "esm" ? "mjs" : "cjs";
37783
- const tempDir = await mkdtemp(path18.join(tmpdir3(), "pubm-config-"));
37784
- const buildScript = path18.join(tempDir, "build-config.mjs");
37785
- const outfile = path18.join(tempDir, `pubm.config.${extension}`);
37786
- const resultFile = path18.join(tempDir, "build-result.json");
37998
+ const tempDir = await mkdtemp(path21.join(tmpdir3(), "pubm-config-"));
37999
+ const buildScript = path21.join(tempDir, "build-config.mjs");
38000
+ const outfile = path21.join(tempDir, `pubm.config.${extension}`);
38001
+ const resultFile = path21.join(tempDir, "build-result.json");
37787
38002
  try {
37788
38003
  await writeFile3(buildScript, [
37789
38004
  'import { readFile, stat, writeFile } from "node:fs/promises";',
@@ -38034,8 +38249,8 @@ async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
38034
38249
  resolve2();
38035
38250
  });
38036
38251
  });
38037
- const result = JSON.parse(await readFile8(resultFile, "utf8"));
38038
- const contents = result.hasEntrypoint ? await readFile8(outfile, "utf8") : null;
38252
+ const result = JSON.parse(await readFile7(resultFile, "utf8"));
38253
+ const contents = result.hasEntrypoint ? await readFile7(outfile, "utf8") : null;
38039
38254
  return {
38040
38255
  success: result.success,
38041
38256
  logs: result.logs,
@@ -38059,11 +38274,11 @@ async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
38059
38274
  }
38060
38275
  function rewriteImportMeta(source, configPath) {
38061
38276
  const replacements = [
38062
- ["import.meta.dirname", JSON.stringify(path18.dirname(configPath))],
38277
+ ["import.meta.dirname", JSON.stringify(path21.dirname(configPath))],
38063
38278
  ["import.meta.filename", JSON.stringify(configPath)],
38064
38279
  ["import.meta.path", JSON.stringify(configPath)],
38065
38280
  ["import.meta.url", JSON.stringify(pathToFileURL(configPath).href)],
38066
- ["import.meta.dir", JSON.stringify(path18.dirname(configPath))]
38281
+ ["import.meta.dir", JSON.stringify(path21.dirname(configPath))]
38067
38282
  ];
38068
38283
  let rewritten = source;
38069
38284
  for (const [pattern, value] of replacements) {
@@ -38079,10 +38294,10 @@ async function importConfigModule(configPath) {
38079
38294
  return normalizeConfigNamespace(namespace);
38080
38295
  }
38081
38296
  async function importBundledConfig(source, configPath, optionalDependencies) {
38082
- const tempDir = await mkdtemp(path18.join(path18.dirname(configPath), ".pubm-config-module-"));
38083
- const tempFile = path18.join(tempDir, "pubm.config.mjs");
38297
+ const tempDir = await mkdtemp(path21.join(path21.dirname(configPath), ".pubm-config-module-"));
38298
+ const tempFile = path21.join(tempDir, "pubm.config.mjs");
38084
38299
  try {
38085
- await writeOptionalDependencyStubs(tempDir, path18.dirname(configPath), optionalDependencies);
38300
+ await writeOptionalDependencyStubs(tempDir, path21.dirname(configPath), optionalDependencies);
38086
38301
  await writeFile3(tempFile, source, "utf8");
38087
38302
  return importConfigModule(tempFile);
38088
38303
  } finally {
@@ -38097,7 +38312,7 @@ async function executeBundledConfigInVm(source, configPath) {
38097
38312
  exports: module.exports,
38098
38313
  require: require2,
38099
38314
  __filename: configPath,
38100
- __dirname: path18.dirname(configPath),
38315
+ __dirname: path21.dirname(configPath),
38101
38316
  console,
38102
38317
  process,
38103
38318
  Buffer,
@@ -38128,7 +38343,7 @@ function formatStageError(stage, error4) {
38128
38343
  async function loadConfig(cwd = process.cwd(), configPath) {
38129
38344
  let resolvedConfigPath;
38130
38345
  if (configPath) {
38131
- resolvedConfigPath = path18.resolve(cwd, configPath);
38346
+ resolvedConfigPath = path21.resolve(cwd, configPath);
38132
38347
  try {
38133
38348
  if (!(await stat6(resolvedConfigPath)).isFile()) {
38134
38349
  throw new Error(`Config path is not a file: ${resolvedConfigPath}`);
@@ -38208,12 +38423,12 @@ function defineConfig(config) {
38208
38423
  init_context();
38209
38424
 
38210
38425
  // src/conventional-commit/scope-resolver.ts
38211
- import path19 from "node:path";
38426
+ import path22 from "node:path";
38212
38427
  function resolveCommitPackages(commit, packagePaths) {
38213
38428
  const matched = new Set;
38214
38429
  if (commit.scope) {
38215
38430
  for (const pkgPath of packagePaths) {
38216
- const dirName = path19.basename(pkgPath);
38431
+ const dirName = path22.basename(pkgPath);
38217
38432
  if (dirName === commit.scope) {
38218
38433
  matched.add(pkgPath);
38219
38434
  }
@@ -38468,7 +38683,7 @@ function inspectPackages(config, cwd) {
38468
38683
  init_manifest_reader();
38469
38684
  // src/migrate/adapters/changesets.ts
38470
38685
  import { existsSync as existsSync10, readdirSync as readdirSync5, readFileSync as readFileSync12 } from "node:fs";
38471
- import path20 from "node:path";
38686
+ import path23 from "node:path";
38472
38687
  var SKIPPED_DIR_ENTRIES = new Set(["config.json", "README.md", ".gitkeep"]);
38473
38688
  var CHANGELOG_PRESET_MAP = {
38474
38689
  "@changesets/changelog-github": "github",
@@ -38486,11 +38701,11 @@ var changesetsAdapter = {
38486
38701
  name: "changesets",
38487
38702
  configFilePatterns: [".changeset/config.json"],
38488
38703
  async detect(cwd) {
38489
- const configFile = path20.join(cwd, ".changeset", "config.json");
38704
+ const configFile = path23.join(cwd, ".changeset", "config.json");
38490
38705
  if (!existsSync10(configFile)) {
38491
38706
  return { found: false, configFiles: [], relatedFiles: [] };
38492
38707
  }
38493
- const changesetDir = path20.dirname(configFile);
38708
+ const changesetDir = path23.dirname(configFile);
38494
38709
  const relatedFiles = [];
38495
38710
  try {
38496
38711
  const entries = readdirSync5(changesetDir, { encoding: "utf-8" });
@@ -38498,7 +38713,7 @@ var changesetsAdapter = {
38498
38713
  if (SKIPPED_DIR_ENTRIES.has(entry))
38499
38714
  continue;
38500
38715
  if (entry.endsWith(".md") || entry === "pre.json") {
38501
- relatedFiles.push(path20.join(changesetDir, entry));
38716
+ relatedFiles.push(path23.join(changesetDir, entry));
38502
38717
  }
38503
38718
  }
38504
38719
  } catch {}
@@ -38509,7 +38724,7 @@ var changesetsAdapter = {
38509
38724
  };
38510
38725
  },
38511
38726
  async parse(files, cwd) {
38512
- const configFile = files.find((f2) => f2.endsWith(`${path20.sep}config.json`) || f2.endsWith("/config.json"));
38727
+ const configFile = files.find((f2) => f2.endsWith(`${path23.sep}config.json`) || f2.endsWith("/config.json"));
38513
38728
  if (configFile === undefined) {
38514
38729
  return { source: "changesets", unmappable: [] };
38515
38730
  }
@@ -38544,7 +38759,7 @@ var changesetsAdapter = {
38544
38759
  if (hasUpdateInternalDeps)
38545
38760
  result.monorepo.updateInternalDeps = config.updateInternalDependencies;
38546
38761
  }
38547
- const preJsonPath = path20.join(cwd, ".changeset", "pre.json");
38762
+ const preJsonPath = path23.join(cwd, ".changeset", "pre.json");
38548
38763
  if (existsSync10(preJsonPath)) {
38549
38764
  try {
38550
38765
  const preRaw = readFileSync12(preJsonPath, "utf-8");
@@ -38578,12 +38793,12 @@ var changesetsAdapter = {
38578
38793
  const configFile = detected.configFiles[0];
38579
38794
  if (configFile === undefined)
38580
38795
  return [];
38581
- return [path20.dirname(configFile)];
38796
+ return [path23.dirname(configFile)];
38582
38797
  }
38583
38798
  };
38584
38799
  // src/migrate/adapters/np.ts
38585
38800
  import { existsSync as existsSync11, readFileSync as readFileSync13 } from "node:fs";
38586
- import path21 from "node:path";
38801
+ import path24 from "node:path";
38587
38802
  import { pathToFileURL as pathToFileURL2 } from "node:url";
38588
38803
  var STANDALONE_CONFIG_FILES = [
38589
38804
  ".np-config.json",
@@ -38688,12 +38903,12 @@ var npAdapter = {
38688
38903
  async detect(cwd) {
38689
38904
  const configFiles = [];
38690
38905
  for (const filename of STANDALONE_CONFIG_FILES) {
38691
- const filePath = path21.join(cwd, filename);
38906
+ const filePath = path24.join(cwd, filename);
38692
38907
  if (existsSync11(filePath)) {
38693
38908
  configFiles.push(filePath);
38694
38909
  }
38695
38910
  }
38696
- const pkgJsonPath = path21.join(cwd, PACKAGE_JSON);
38911
+ const pkgJsonPath = path24.join(cwd, PACKAGE_JSON);
38697
38912
  if (existsSync11(pkgJsonPath)) {
38698
38913
  try {
38699
38914
  const raw = readFileSync13(pkgJsonPath, "utf-8");
@@ -38710,8 +38925,8 @@ var npAdapter = {
38710
38925
  };
38711
38926
  },
38712
38927
  async parse(files, _cwd) {
38713
- const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES.some((name) => f2.endsWith(path21.sep + name) || f2.endsWith(`/${name}`)));
38714
- const pkgJsonFile = files.find((f2) => f2.endsWith(path21.sep + PACKAGE_JSON) || f2.endsWith(`/${PACKAGE_JSON}`));
38928
+ const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES.some((name) => f2.endsWith(path24.sep + name) || f2.endsWith(`/${name}`)));
38929
+ const pkgJsonFile = files.find((f2) => f2.endsWith(path24.sep + PACKAGE_JSON) || f2.endsWith(`/${PACKAGE_JSON}`));
38715
38930
  const configFile = standaloneFile ?? pkgJsonFile;
38716
38931
  if (configFile === undefined) {
38717
38932
  return {
@@ -38730,13 +38945,13 @@ var npAdapter = {
38730
38945
  };
38731
38946
  },
38732
38947
  getCleanupTargets(detected) {
38733
- return detected.configFiles.filter((f2) => !f2.endsWith(path21.sep + PACKAGE_JSON) && !f2.endsWith(`/${PACKAGE_JSON}`));
38948
+ return detected.configFiles.filter((f2) => !f2.endsWith(path24.sep + PACKAGE_JSON) && !f2.endsWith(`/${PACKAGE_JSON}`));
38734
38949
  }
38735
38950
  };
38736
38951
  // src/migrate/adapters/release-it.ts
38737
38952
  var import_yaml4 = __toESM(require_dist(), 1);
38738
38953
  import { existsSync as existsSync12, readFileSync as readFileSync14 } from "node:fs";
38739
- import path22 from "node:path";
38954
+ import path25 from "node:path";
38740
38955
  import { pathToFileURL as pathToFileURL3 } from "node:url";
38741
38956
  var STANDALONE_CONFIG_FILES2 = [
38742
38957
  ".release-it.json",
@@ -38761,7 +38976,7 @@ async function loadConfigFile(filePath) {
38761
38976
  if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
38762
38977
  return import_yaml4.default.parse(raw);
38763
38978
  }
38764
- if (filePath.endsWith(path22.sep + PACKAGE_JSON2) || filePath.endsWith(`/${PACKAGE_JSON2}`)) {
38979
+ if (filePath.endsWith(path25.sep + PACKAGE_JSON2) || filePath.endsWith(`/${PACKAGE_JSON2}`)) {
38765
38980
  const parsed = JSON.parse(raw);
38766
38981
  return parsed["release-it"] ?? {};
38767
38982
  }
@@ -38876,12 +39091,12 @@ var releaseItAdapter = {
38876
39091
  async detect(cwd) {
38877
39092
  const configFiles = [];
38878
39093
  for (const filename of STANDALONE_CONFIG_FILES2) {
38879
- const filePath = path22.join(cwd, filename);
39094
+ const filePath = path25.join(cwd, filename);
38880
39095
  if (existsSync12(filePath)) {
38881
39096
  configFiles.push(filePath);
38882
39097
  }
38883
39098
  }
38884
- const pkgJsonPath = path22.join(cwd, PACKAGE_JSON2);
39099
+ const pkgJsonPath = path25.join(cwd, PACKAGE_JSON2);
38885
39100
  if (existsSync12(pkgJsonPath)) {
38886
39101
  try {
38887
39102
  const raw = readFileSync14(pkgJsonPath, "utf-8");
@@ -38898,8 +39113,8 @@ var releaseItAdapter = {
38898
39113
  };
38899
39114
  },
38900
39115
  async parse(files, _cwd) {
38901
- const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES2.some((name) => f2.endsWith(path22.sep + name) || f2.endsWith(`/${name}`)));
38902
- const pkgJsonFile = files.find((f2) => f2.endsWith(path22.sep + PACKAGE_JSON2) || f2.endsWith(`/${PACKAGE_JSON2}`));
39116
+ const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES2.some((name) => f2.endsWith(path25.sep + name) || f2.endsWith(`/${name}`)));
39117
+ const pkgJsonFile = files.find((f2) => f2.endsWith(path25.sep + PACKAGE_JSON2) || f2.endsWith(`/${PACKAGE_JSON2}`));
38903
39118
  const configFile = standaloneFile ?? pkgJsonFile;
38904
39119
  if (configFile === undefined) {
38905
39120
  return {
@@ -38929,13 +39144,13 @@ var releaseItAdapter = {
38929
39144
  };
38930
39145
  },
38931
39146
  getCleanupTargets(detected) {
38932
- return detected.configFiles.filter((f2) => !f2.endsWith(path22.sep + PACKAGE_JSON2) && !f2.endsWith(`/${PACKAGE_JSON2}`));
39147
+ return detected.configFiles.filter((f2) => !f2.endsWith(path25.sep + PACKAGE_JSON2) && !f2.endsWith(`/${PACKAGE_JSON2}`));
38933
39148
  }
38934
39149
  };
38935
39150
  // src/migrate/adapters/semantic-release.ts
38936
39151
  var import_yaml5 = __toESM(require_dist(), 1);
38937
39152
  import { existsSync as existsSync13, readFileSync as readFileSync15 } from "node:fs";
38938
- import path23 from "node:path";
39153
+ import path26 from "node:path";
38939
39154
  import { pathToFileURL as pathToFileURL4 } from "node:url";
38940
39155
  var STANDALONE_CONFIG_FILES3 = [
38941
39156
  ".releaserc",
@@ -39025,11 +39240,11 @@ async function loadConfigFile2(filePath) {
39025
39240
  if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
39026
39241
  return import_yaml5.default.parse(raw);
39027
39242
  }
39028
- if (filePath.endsWith(path23.sep + PACKAGE_JSON3) || filePath.endsWith(`/${PACKAGE_JSON3}`)) {
39243
+ if (filePath.endsWith(path26.sep + PACKAGE_JSON3) || filePath.endsWith(`/${PACKAGE_JSON3}`)) {
39029
39244
  const parsed = JSON.parse(raw);
39030
39245
  return parsed.release ?? {};
39031
39246
  }
39032
- const basename4 = path23.basename(filePath);
39247
+ const basename4 = path26.basename(filePath);
39033
39248
  if (basename4 === ".releaserc") {
39034
39249
  try {
39035
39250
  return JSON.parse(raw);
@@ -39139,12 +39354,12 @@ var semanticReleaseAdapter = {
39139
39354
  async detect(cwd) {
39140
39355
  const configFiles = [];
39141
39356
  for (const filename of STANDALONE_CONFIG_FILES3) {
39142
- const filePath = path23.join(cwd, filename);
39357
+ const filePath = path26.join(cwd, filename);
39143
39358
  if (existsSync13(filePath)) {
39144
39359
  configFiles.push(filePath);
39145
39360
  }
39146
39361
  }
39147
- const pkgJsonPath = path23.join(cwd, PACKAGE_JSON3);
39362
+ const pkgJsonPath = path26.join(cwd, PACKAGE_JSON3);
39148
39363
  if (existsSync13(pkgJsonPath)) {
39149
39364
  try {
39150
39365
  const raw = readFileSync15(pkgJsonPath, "utf-8");
@@ -39161,8 +39376,8 @@ var semanticReleaseAdapter = {
39161
39376
  };
39162
39377
  },
39163
39378
  async parse(files, _cwd) {
39164
- const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES3.some((name) => f2.endsWith(path23.sep + name) || f2.endsWith(`/${name}`)));
39165
- const pkgJsonFile = files.find((f2) => f2.endsWith(path23.sep + PACKAGE_JSON3) || f2.endsWith(`/${PACKAGE_JSON3}`));
39379
+ const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES3.some((name) => f2.endsWith(path26.sep + name) || f2.endsWith(`/${name}`)));
39380
+ const pkgJsonFile = files.find((f2) => f2.endsWith(path26.sep + PACKAGE_JSON3) || f2.endsWith(`/${PACKAGE_JSON3}`));
39166
39381
  const configFile = standaloneFile ?? pkgJsonFile;
39167
39382
  if (configFile === undefined) {
39168
39383
  return {
@@ -39180,12 +39395,12 @@ var semanticReleaseAdapter = {
39180
39395
  };
39181
39396
  },
39182
39397
  getCleanupTargets(detected) {
39183
- return detected.configFiles.filter((f2) => !f2.endsWith(path23.sep + PACKAGE_JSON3) && !f2.endsWith(`/${PACKAGE_JSON3}`));
39398
+ return detected.configFiles.filter((f2) => !f2.endsWith(path26.sep + PACKAGE_JSON3) && !f2.endsWith(`/${PACKAGE_JSON3}`));
39184
39399
  }
39185
39400
  };
39186
39401
  // src/migrate/ci-advisor.ts
39187
39402
  import { existsSync as existsSync14, readdirSync as readdirSync6, readFileSync as readFileSync16 } from "node:fs";
39188
- import { join as join11 } from "node:path";
39403
+ import { join as join10 } from "node:path";
39189
39404
  var CI_PATTERNS = {
39190
39405
  "semantic-release": [
39191
39406
  /npx\s+semantic-release/,
@@ -39205,7 +39420,7 @@ var CI_PATTERNS = {
39205
39420
  np: [/npx\s+np\b/, /yarn\s+np\b/]
39206
39421
  };
39207
39422
  function scanCiWorkflows(cwd, source) {
39208
- const workflowsDir = join11(cwd, ".github", "workflows");
39423
+ const workflowsDir = join10(cwd, ".github", "workflows");
39209
39424
  if (!existsSync14(workflowsDir))
39210
39425
  return [];
39211
39426
  const patterns = CI_PATTERNS[source];
@@ -39214,7 +39429,7 @@ function scanCiWorkflows(cwd, source) {
39214
39429
  for (const filename of files) {
39215
39430
  if (!filename.endsWith(".yml") && !filename.endsWith(".yaml"))
39216
39431
  continue;
39217
- const filePath = join11(workflowsDir, filename);
39432
+ const filePath = join10(workflowsDir, filename);
39218
39433
  const content = readFileSync16(filePath, "utf-8");
39219
39434
  for (const line of content.split(`
39220
39435
  `)) {
@@ -39457,7 +39672,7 @@ async function detectMigrationSources(cwd, adapters, from) {
39457
39672
  }
39458
39673
  // src/migrate/pipeline.ts
39459
39674
  import { existsSync as existsSync15, writeFileSync as writeFileSync10 } from "node:fs";
39460
- import { join as join12 } from "node:path";
39675
+ import { join as join11 } from "node:path";
39461
39676
  async function executeMigration(options) {
39462
39677
  const { adapter, detected, cwd, dryRun, clean } = options;
39463
39678
  const parsed = await adapter.parse(detected.configFiles, cwd);
@@ -39466,7 +39681,7 @@ async function executeMigration(options) {
39466
39681
  const configString = generateConfigString(convertResult.config);
39467
39682
  const ciAdvice = scanCiWorkflows(cwd, adapter.name);
39468
39683
  if (!dryRun) {
39469
- const outFile = join12(cwd, "pubm.config.ts");
39684
+ const outFile = join11(cwd, "pubm.config.ts");
39470
39685
  if (existsSync15(outFile)) {
39471
39686
  throw new Error("pubm.config.ts already exists. Remove or rename it before migrating.");
39472
39687
  }
@@ -39531,12 +39746,12 @@ function topologicalSort(graph) {
39531
39746
  return sorted.reverse();
39532
39747
  }
39533
39748
  // src/monorepo/groups.ts
39534
- var import_micromatch4 = __toESM(require_micromatch(), 1);
39749
+ var import_micromatch5 = __toESM(require_micromatch(), 1);
39535
39750
  function resolveGroups(groups, allPackages) {
39536
39751
  return groups.map((group) => {
39537
39752
  const resolved = new Set;
39538
39753
  for (const pattern of group) {
39539
- const matches = import_micromatch4.default(allPackages, pattern);
39754
+ const matches = import_micromatch5.default(allPackages, pattern);
39540
39755
  for (const match of matches) {
39541
39756
  resolved.add(match);
39542
39757
  }
@@ -39733,7 +39948,7 @@ class ChangesetSource {
39733
39948
  }
39734
39949
  }
39735
39950
  // src/version-source/conventional-commit-source.ts
39736
- import path24 from "node:path";
39951
+ import path27 from "node:path";
39737
39952
  class ConventionalCommitSource {
39738
39953
  name = "conventional-commit";
39739
39954
  typeOverrides;
@@ -39744,7 +39959,7 @@ class ConventionalCommitSource {
39744
39959
  const packagePaths = [...context.packages.keys()];
39745
39960
  const recommendations = [];
39746
39961
  for (const packagePath of packagePaths) {
39747
- const packageName = path24.basename(packagePath);
39962
+ const packageName = path27.basename(packagePath);
39748
39963
  const ref = findLastReleaseRef(context.cwd, packageName);
39749
39964
  const rawCommits = getCommitsSinceRef(context.cwd, ref);
39750
39965
  const parsed = [];
@@ -40494,7 +40709,7 @@ import { spawn } from "child_process";
40494
40709
  import { execFile as execFile2 } from "child_process";
40495
40710
  import { createWriteStream } from "fs";
40496
40711
  import fs2 from "fs/promises";
40497
- import path25 from "path";
40712
+ import path28 from "path";
40498
40713
  import { Readable } from "stream";
40499
40714
  import { pipeline } from "stream/promises";
40500
40715
  import { promisify } from "util";
@@ -40503,16 +40718,16 @@ import crypto2 from "crypto";
40503
40718
  import { createReadStream } from "fs";
40504
40719
  import crypto from "crypto";
40505
40720
  import fs3 from "fs/promises";
40506
- import path26 from "path";
40721
+ import path29 from "path";
40507
40722
  import { realpath } from "fs/promises";
40508
40723
  import { execFile as execFile22 } from "child_process";
40509
40724
  import { promisify as promisify2 } from "util";
40510
40725
  import { execFile as execFile3 } from "child_process";
40511
40726
  import { lstat, readlink } from "fs/promises";
40512
40727
  import { promisify as promisify3 } from "util";
40513
- import { readFile as readFile9 } from "fs/promises";
40728
+ import { readFile as readFile8 } from "fs/promises";
40514
40729
  import { homedir as homedir2 } from "os";
40515
- import { join as join13 } from "path";
40730
+ import { join as join12 } from "path";
40516
40731
  import os2 from "os";
40517
40732
  import path32 from "path";
40518
40733
  import { readFileSync as readFileSync17 } from "fs";
@@ -40924,7 +41139,7 @@ async function downloadArtifact(url, tmpDir, options) {
40924
41139
  }
40925
41140
  const totalBytes = Number(response.headers.get("content-length")) || undefined;
40926
41141
  const filename = extractFilename(url);
40927
- const destPath = path25.join(tmpDir, filename);
41142
+ const destPath = path28.join(tmpDir, filename);
40928
41143
  let bytesDownloaded = 0;
40929
41144
  const nodeStream = Readable.fromWeb(response.body);
40930
41145
  const writeStream = createWriteStream(destPath);
@@ -40940,7 +41155,7 @@ async function downloadArtifact(url, tmpDir, options) {
40940
41155
  return destPath;
40941
41156
  }
40942
41157
  async function extractBinary(archivePath, tmpDir) {
40943
- const extractDir = path25.join(tmpDir, "extracted");
41158
+ const extractDir = path28.join(tmpDir, "extracted");
40944
41159
  await fs2.mkdir(extractDir, { recursive: true });
40945
41160
  if (archivePath.endsWith(".tar.gz") || archivePath.endsWith(".tgz")) {
40946
41161
  try {
@@ -40967,7 +41182,7 @@ async function extractBinary(archivePath, tmpDir) {
40967
41182
  });
40968
41183
  }
40969
41184
  } else {
40970
- const destPath = path25.join(extractDir, path25.basename(archivePath));
41185
+ const destPath = path28.join(extractDir, path28.basename(archivePath));
40971
41186
  await fs2.copyFile(archivePath, destPath);
40972
41187
  return destPath;
40973
41188
  }
@@ -40984,10 +41199,10 @@ async function findBinaryInDir(dir) {
40984
41199
  if (!e3.isFile())
40985
41200
  continue;
40986
41201
  const parentDir = e3.parentPath ?? ("path" in e3 ? e3.path : dir);
40987
- const filePath = path25.join(parentDir, e3.name);
41202
+ const filePath = path28.join(parentDir, e3.name);
40988
41203
  try {
40989
41204
  const resolvedFile = await fs2.realpath(filePath);
40990
- if (!resolvedFile.startsWith(resolvedDir + path25.sep) && resolvedFile !== resolvedDir) {
41205
+ if (!resolvedFile.startsWith(resolvedDir + path28.sep) && resolvedFile !== resolvedDir) {
40991
41206
  continue;
40992
41207
  }
40993
41208
  } catch {
@@ -41021,8 +41236,8 @@ async function findBinaryInDir(dir) {
41021
41236
  ".css"
41022
41237
  ]);
41023
41238
  const binaryCandidates = files.filter((file) => {
41024
- const ext = path25.extname(file).toLowerCase();
41025
- const basename4 = path25.basename(file).toLowerCase();
41239
+ const ext = path28.extname(file).toLowerCase();
41240
+ const basename4 = path28.basename(file).toLowerCase();
41026
41241
  return !NON_BINARY_EXTENSIONS.has(ext) && basename4 !== "license" && basename4 !== "readme";
41027
41242
  });
41028
41243
  return binaryCandidates.length > 0 ? binaryCandidates[0] : files[0];
@@ -41033,8 +41248,8 @@ function extractFilename(url) {
41033
41248
  return segments[segments.length - 1] || "artifact";
41034
41249
  }
41035
41250
  async function createTempDir(targetPath) {
41036
- const targetDir = path25.dirname(targetPath);
41037
- const tmpDir = path25.join(targetDir, `.update-kit-tmp-${process.pid}-${Date.now()}`);
41251
+ const targetDir = path28.dirname(targetPath);
41252
+ const tmpDir = path28.join(targetDir, `.update-kit-tmp-${process.pid}-${Date.now()}`);
41038
41253
  await fs2.mkdir(tmpDir, { recursive: true });
41039
41254
  return tmpDir;
41040
41255
  }
@@ -41047,7 +41262,7 @@ async function setExecutablePermission(filePath) {
41047
41262
  await fs2.chmod(filePath, 493);
41048
41263
  }
41049
41264
  function getCachePath(cacheDir, appName) {
41050
- return path26.join(cacheDir, appName, "update-check.json");
41265
+ return path29.join(cacheDir, appName, "update-check.json");
41051
41266
  }
41052
41267
  async function readCache(cacheDir, appName) {
41053
41268
  const filePath = getCachePath(cacheDir, appName);
@@ -41067,7 +41282,7 @@ async function readCache(cacheDir, appName) {
41067
41282
  }
41068
41283
  async function writeCache(cacheDir, appName, entry) {
41069
41284
  const filePath = getCachePath(cacheDir, appName);
41070
- const dir = path26.dirname(filePath);
41285
+ const dir = path29.dirname(filePath);
41071
41286
  await fs3.mkdir(dir, { recursive: true });
41072
41287
  const tmpPath = `${filePath}.${process.pid}-${Date.now()}.tmp`;
41073
41288
  try {
@@ -41783,10 +41998,10 @@ async function detectFromNpm(execPath) {
41783
41998
  };
41784
41999
  }
41785
42000
  async function detectFromReceipt(config, receiptDir) {
41786
- const dir = receiptDir ?? join13(homedir2(), ".config", config.appName);
41787
- const receiptPath = join13(dir, "install-receipt.json");
42001
+ const dir = receiptDir ?? join12(homedir2(), ".config", config.appName);
42002
+ const receiptPath = join12(dir, "install-receipt.json");
41788
42003
  try {
41789
- const content = await readFile9(receiptPath, "utf-8");
42004
+ const content = await readFile8(receiptPath, "utf-8");
41790
42005
  const receipt = JSON.parse(content);
41791
42006
  if (receipt.appName !== config.appName) {
41792
42007
  return null;
@@ -42506,10 +42721,10 @@ init_ui();
42506
42721
 
42507
42722
  // src/validate/entry-points.ts
42508
42723
  import { existsSync as existsSync16 } from "node:fs";
42509
- import path27 from "node:path";
42724
+ import path30 from "node:path";
42510
42725
  var SIMPLE_FIELDS = ["main", "module", "types", "typings"];
42511
42726
  function checkPath(filePath, cwd) {
42512
- return existsSync16(path27.resolve(cwd, filePath));
42727
+ return existsSync16(path30.resolve(cwd, filePath));
42513
42728
  }
42514
42729
  function validateExports(exports, cwd, prefix = "exports") {
42515
42730
  const errors = [];
@@ -42559,7 +42774,7 @@ function validateEntryPoints(pkg, cwd) {
42559
42774
  return errors;
42560
42775
  }
42561
42776
  // src/validate/extraneous-files.ts
42562
- var import_micromatch5 = __toESM(require_micromatch(), 1);
42777
+ var import_micromatch6 = __toESM(require_micromatch(), 1);
42563
42778
  var PATTERNS = [
42564
42779
  {
42565
42780
  pattern: [".env", ".env.*"],
@@ -42597,7 +42812,7 @@ function detectExtraneousFiles(files) {
42597
42812
  const seen = new Set;
42598
42813
  for (const { pattern, reason, basename: basename4 } of PATTERNS) {
42599
42814
  const options = basename4 ? { basename: true } : {};
42600
- const matched = import_micromatch5.default(files, pattern, options);
42815
+ const matched = import_micromatch6.default(files, pattern, options);
42601
42816
  for (const file of matched) {
42602
42817
  if (!seen.has(file)) {
42603
42818
  seen.add(file);