@pubm/core 0.5.0 → 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.cjs CHANGED
@@ -17641,7 +17641,7 @@ var package_default;
17641
17641
  var init_package = __esm(() => {
17642
17642
  package_default = {
17643
17643
  name: "@pubm/core",
17644
- version: "0.5.0",
17644
+ version: "0.5.2",
17645
17645
  type: "module",
17646
17646
  description: "Core SDK for pubm - publish manager for multiple registries",
17647
17647
  types: "./dist/index.d.ts",
@@ -17720,7 +17720,7 @@ var coreEngines, PUBM_VERSION, PUBM_ENGINES;
17720
17720
  var init_pubm_metadata = __esm(() => {
17721
17721
  init_package();
17722
17722
  coreEngines = package_default.engines ?? {};
17723
- PUBM_VERSION = resolveDefine("0.5.0", package_default.version);
17723
+ PUBM_VERSION = resolveDefine("0.5.2", package_default.version);
17724
17724
  PUBM_ENGINES = {
17725
17725
  node: resolveDefine(">=24", coreEngines.node ?? ">=18"),
17726
17726
  git: resolveDefine(">=2.11.0", coreEngines.git ?? ">=2.11.0"),
@@ -20513,7 +20513,6 @@ ${stderr}` : ""}`, {
20513
20513
  }
20514
20514
  getRequirements() {
20515
20515
  return {
20516
- needsPackageScripts: false,
20517
20516
  requiredManifest: "jsr.json or deno.json"
20518
20517
  };
20519
20518
  }
@@ -21918,7 +21917,6 @@ ${cleanCargoStderr(stderr)}` : "Failed to run `cargo publish --dry-run`";
21918
21917
  }
21919
21918
  getRequirements() {
21920
21919
  return {
21921
- needsPackageScripts: false,
21922
21920
  requiredManifest: "Cargo.toml"
21923
21921
  };
21924
21922
  }
@@ -22099,11 +22097,16 @@ var init_rust = __esm(() => {
22099
22097
  manifestFiles() {
22100
22098
  return ["Cargo.toml"];
22101
22099
  }
22102
- defaultTestCommand() {
22103
- return "cargo test";
22100
+ resolveTestCommand(script) {
22101
+ const parts = script.split(/\s+/);
22102
+ return Promise.resolve({ cmd: "cargo", args: parts });
22104
22103
  }
22105
- defaultBuildCommand() {
22106
- return "cargo build --release";
22104
+ resolveBuildCommand(script) {
22105
+ const parts = script.split(/\s+/);
22106
+ return Promise.resolve({ cmd: "cargo", args: parts });
22107
+ }
22108
+ validateScript(_script, _type) {
22109
+ return Promise.resolve(null);
22107
22110
  }
22108
22111
  supportedRegistries() {
22109
22112
  return ["crates"];
@@ -22975,7 +22978,6 @@ function registerPrivateRegistry(config, ecosystemKey, catalog = registryCatalog
22975
22978
  tokenUrl: config.url,
22976
22979
  tokenUrlLabel: key
22977
22980
  },
22978
- needsPackageScripts: false,
22979
22981
  concurrentPublish: true,
22980
22982
  unpublishLabel: "Unpublish",
22981
22983
  requiresEarlyAuth: false,
@@ -23018,7 +23020,6 @@ var init_catalog = __esm(() => {
23018
23020
  tokenUrl: "https://www.npmjs.com/settings/~/tokens/granular-access-tokens/new",
23019
23021
  tokenUrlLabel: "npmjs.com"
23020
23022
  },
23021
- needsPackageScripts: true,
23022
23023
  additionalEnvVars: (token) => ({
23023
23024
  "npm_config_//registry.npmjs.org/:_authToken": token
23024
23025
  }),
@@ -23066,7 +23067,6 @@ var init_catalog = __esm(() => {
23066
23067
  tokenUrl: "https://jsr.io/account/tokens/create",
23067
23068
  tokenUrlLabel: "jsr.io"
23068
23069
  },
23069
- needsPackageScripts: false,
23070
23070
  validateToken: async (token) => {
23071
23071
  const res = await fetch("https://jsr.io/api/user", {
23072
23072
  headers: { Authorization: `Bearer ${token}` }
@@ -23104,7 +23104,6 @@ var init_catalog = __esm(() => {
23104
23104
  tokenUrl: "https://crates.io/settings/tokens/new",
23105
23105
  tokenUrlLabel: "crates.io"
23106
23106
  },
23107
- needsPackageScripts: false,
23108
23107
  validateToken: async (token) => {
23109
23108
  return token.trim().length >= 32;
23110
23109
  },
@@ -23480,7 +23479,6 @@ ${stderr}` : ""}`, { cause: error4 });
23480
23479
  }
23481
23480
  getRequirements() {
23482
23481
  return {
23483
- needsPackageScripts: true,
23484
23482
  requiredManifest: "package.json"
23485
23483
  };
23486
23484
  }
@@ -23643,13 +23641,26 @@ var init_js = __esm(() => {
23643
23641
  manifestFiles() {
23644
23642
  return ["package.json"];
23645
23643
  }
23646
- async defaultTestCommand() {
23644
+ async resolveTestCommand(script) {
23647
23645
  const pm = await getPackageManager();
23648
- return `${pm} run test`;
23646
+ return { cmd: pm, args: ["run", script] };
23649
23647
  }
23650
- async defaultBuildCommand() {
23648
+ async resolveBuildCommand(script) {
23651
23649
  const pm = await getPackageManager();
23652
- return `${pm} run build`;
23650
+ return { cmd: pm, args: ["run", script] };
23651
+ }
23652
+ async validateScript(script, _type) {
23653
+ const pkgPath = import_node_path8.default.join(this.packagePath, "package.json");
23654
+ try {
23655
+ const raw = await import_promises6.readFile(pkgPath, "utf-8");
23656
+ const { scripts } = JSON.parse(raw);
23657
+ if (!scripts?.[script]) {
23658
+ return `Script '${script}' not found in ${pkgPath}`;
23659
+ }
23660
+ return null;
23661
+ } catch {
23662
+ return `Cannot read ${pkgPath}`;
23663
+ }
23653
23664
  }
23654
23665
  supportedRegistries() {
23655
23666
  return ["npm", "jsr"];
@@ -23790,13 +23801,6 @@ var init_catalog2 = __esm(() => {
23790
23801
  init_js();
23791
23802
  init_rust();
23792
23803
  ecosystemCatalog = new EcosystemCatalog;
23793
- ecosystemCatalog.register({
23794
- key: "js",
23795
- label: "JavaScript",
23796
- defaultRegistries: ["npm", "jsr"],
23797
- ecosystemClass: JsEcosystem,
23798
- detect: (path6) => JsEcosystem.detect(path6)
23799
- });
23800
23804
  ecosystemCatalog.register({
23801
23805
  key: "rust",
23802
23806
  label: "Rust",
@@ -23804,6 +23808,13 @@ var init_catalog2 = __esm(() => {
23804
23808
  ecosystemClass: RustEcosystem,
23805
23809
  detect: (path6) => RustEcosystem.detect(path6)
23806
23810
  });
23811
+ ecosystemCatalog.register({
23812
+ key: "js",
23813
+ label: "JavaScript",
23814
+ defaultRegistries: ["npm", "jsr"],
23815
+ ecosystemClass: JsEcosystem,
23816
+ detect: (path6) => JsEcosystem.detect(path6)
23817
+ });
23807
23818
  });
23808
23819
 
23809
23820
  // src/plugin/runner.ts
@@ -35664,8 +35675,8 @@ var prerequisitesCheckTask = (options) => {
35664
35675
  };
35665
35676
 
35666
35677
  // src/tasks/required-conditions-check.ts
35667
- var import_promises8 = require("node:fs/promises");
35668
- var import_node_path21 = require("node:path");
35678
+ var import_node_path21 = __toESM(require("node:path"));
35679
+ init_catalog2();
35669
35680
  init_error4();
35670
35681
  init_git();
35671
35682
  init_i18n();
@@ -35692,10 +35703,6 @@ async function validateEngineVersion(engine, version) {
35692
35703
  }
35693
35704
 
35694
35705
  // src/tasks/required-conditions-check.ts
35695
- function needsPackageScripts(registries) {
35696
- return registries.some((r2) => registryCatalog.get(r2)?.needsPackageScripts ?? true);
35697
- }
35698
-
35699
35706
  class RequiredConditionCheckError extends AbstractError {
35700
35707
  name = t("error.conditions.name");
35701
35708
  constructor(message, { cause } = {}) {
@@ -35757,20 +35764,66 @@ var requiredConditionsCheckTask = (options) => {
35757
35764
  },
35758
35765
  {
35759
35766
  title: t("task.conditions.checkScripts"),
35760
- skip: (ctx2) => !needsPackageScripts(collectRegistries(ctx2.config)),
35767
+ skip: (ctx2) => !!ctx2.options.skipTests && !!ctx2.options.skipBuild,
35761
35768
  task: async (ctx2) => {
35762
- const raw = await import_promises8.readFile(import_node_path21.join(ctx2.cwd, "package.json"), "utf-8");
35763
- const { scripts } = JSON.parse(raw);
35764
35769
  const errors = [];
35765
- if (!ctx2.options.skipTests && !scripts?.[ctx2.options.testScript]) {
35766
- errors.push(t("error.conditions.testScriptMissing", {
35767
- script: ctx2.options.testScript
35768
- }));
35770
+ const JS_WS_TYPES = new Set([
35771
+ "pnpm",
35772
+ "npm",
35773
+ "yarn",
35774
+ "bun",
35775
+ "deno"
35776
+ ]);
35777
+ const workspaces = detectWorkspace(ctx2.cwd);
35778
+ const byEcosystem = new Map;
35779
+ for (const pkg of ctx2.config.packages) {
35780
+ const key = pkg.ecosystem ?? "js";
35781
+ if (!byEcosystem.has(key))
35782
+ byEcosystem.set(key, []);
35783
+ byEcosystem.get(key).push(pkg);
35769
35784
  }
35770
- if (!ctx2.options.skipBuild && !scripts?.[ctx2.options.buildScript]) {
35771
- errors.push(t("error.conditions.buildScriptMissing", {
35772
- script: ctx2.options.buildScript
35773
- }));
35785
+ for (const [ecosystemKey, packages] of byEcosystem) {
35786
+ const descriptor = ecosystemCatalog.get(ecosystemKey);
35787
+ if (!descriptor)
35788
+ continue;
35789
+ const hasWorkspace = ecosystemKey === "js" ? workspaces.some((w2) => JS_WS_TYPES.has(w2.type)) : ecosystemKey === "rust" ? workspaces.some((w2) => w2.type === "cargo") : false;
35790
+ const ecoConfig = ctx2.config.ecosystems?.[ecosystemKey];
35791
+ let testGroupValidated = false;
35792
+ let buildGroupValidated = false;
35793
+ for (const pkg of packages) {
35794
+ if (!ctx2.options.skipTests) {
35795
+ const hasCommand = pkg.testCommand ?? ecoConfig?.testCommand;
35796
+ if (!hasCommand) {
35797
+ const script = pkg.testScript ?? ecoConfig?.testScript ?? ctx2.options.testScript;
35798
+ const isPackageOverride = !!pkg.testScript;
35799
+ const validateCwd = hasWorkspace && !isPackageOverride ? ctx2.cwd : import_node_path21.default.resolve(ctx2.cwd, pkg.path);
35800
+ if (!hasWorkspace || isPackageOverride || !testGroupValidated) {
35801
+ const instance = new descriptor.ecosystemClass(validateCwd);
35802
+ const error4 = await instance.validateScript(script, "test");
35803
+ if (error4)
35804
+ errors.push(error4);
35805
+ if (hasWorkspace && !isPackageOverride)
35806
+ testGroupValidated = true;
35807
+ }
35808
+ }
35809
+ }
35810
+ if (!ctx2.options.skipBuild) {
35811
+ const hasCommand = pkg.buildCommand ?? ecoConfig?.buildCommand;
35812
+ if (!hasCommand) {
35813
+ const script = pkg.buildScript ?? ecoConfig?.buildScript ?? ctx2.options.buildScript;
35814
+ const isPackageOverride = !!pkg.buildScript;
35815
+ const validateCwd = hasWorkspace && !isPackageOverride ? ctx2.cwd : import_node_path21.default.resolve(ctx2.cwd, pkg.path);
35816
+ if (!hasWorkspace || isPackageOverride || !buildGroupValidated) {
35817
+ const instance = new descriptor.ecosystemClass(validateCwd);
35818
+ const error4 = await instance.validateScript(script, "build");
35819
+ if (error4)
35820
+ errors.push(error4);
35821
+ if (hasWorkspace && !isPackageOverride)
35822
+ buildGroupValidated = true;
35823
+ }
35824
+ }
35825
+ }
35826
+ }
35774
35827
  }
35775
35828
  if (errors.length) {
35776
35829
  throw new RequiredConditionCheckError(t("error.conditions.scriptsMissing", {
@@ -36617,10 +36670,166 @@ ${repositoryUrl}/compare/${lastRev}...${tag}`;
36617
36670
  }
36618
36671
 
36619
36672
  // src/tasks/phases/test-build.ts
36673
+ init_catalog2();
36620
36674
  init_error4();
36621
36675
  init_i18n();
36676
+ var import_node_path24 = __toESM(require("node:path"));
36622
36677
  init_exec();
36623
- init_package_manager();
36678
+ var JS_WORKSPACE_TYPES = new Set(["pnpm", "npm", "yarn", "bun", "deno"]);
36679
+ var ECOSYSTEM_DEFAULTS = {
36680
+ js: { test: "test", build: "build" },
36681
+ rust: { test: "test", build: "build --release" }
36682
+ };
36683
+ function hasWorkspaceForEcosystem(cwd, ecosystemKey) {
36684
+ const workspaces = detectWorkspace(cwd);
36685
+ if (ecosystemKey === "js") {
36686
+ return workspaces.some((w2) => JS_WORKSPACE_TYPES.has(w2.type));
36687
+ }
36688
+ if (ecosystemKey === "rust") {
36689
+ return workspaces.some((w2) => w2.type === "cargo");
36690
+ }
36691
+ return false;
36692
+ }
36693
+ function hasPackageLevelOverride(pkg, type) {
36694
+ return type === "test" ? !!(pkg.testCommand || pkg.testScript) : !!(pkg.buildCommand || pkg.buildScript);
36695
+ }
36696
+ function resolveScript(pkg, ecosystemKey, ctx, type) {
36697
+ const sf = type === "test" ? "testScript" : "buildScript";
36698
+ const cf = type === "test" ? "testCommand" : "buildCommand";
36699
+ if (pkg[cf])
36700
+ return { command: pkg[cf] };
36701
+ if (pkg[sf])
36702
+ return { script: pkg[sf] };
36703
+ const eco = ctx.config.ecosystems?.[ecosystemKey];
36704
+ if (eco?.[cf])
36705
+ return { command: eco[cf] };
36706
+ if (eco?.[sf])
36707
+ return { script: eco[sf] };
36708
+ const globalScript = type === "test" ? ctx.options.testScript : ctx.options.buildScript;
36709
+ if (globalScript)
36710
+ return { script: globalScript };
36711
+ return { script: ECOSYSTEM_DEFAULTS[ecosystemKey]?.[type] ?? type };
36712
+ }
36713
+ function groupByEcosystem(ctx, type) {
36714
+ const map = new Map;
36715
+ for (const pkg of ctx.config.packages) {
36716
+ const key = pkg.ecosystem ?? "js";
36717
+ if (!map.has(key))
36718
+ map.set(key, { group: [], individual: [] });
36719
+ const entry = map.get(key);
36720
+ if (hasPackageLevelOverride(pkg, type)) {
36721
+ entry.individual.push(pkg);
36722
+ } else {
36723
+ entry.group.push(pkg);
36724
+ }
36725
+ }
36726
+ const result = [];
36727
+ for (const descriptor of ecosystemCatalog.all()) {
36728
+ const entry = map.get(descriptor.key);
36729
+ if (!entry)
36730
+ continue;
36731
+ if (entry.group.length === 0 && entry.individual.length === 0)
36732
+ continue;
36733
+ result.push({
36734
+ ecosystemKey: descriptor.key,
36735
+ groupPackages: entry.group,
36736
+ individualPackages: entry.individual,
36737
+ hasWorkspace: hasWorkspaceForEcosystem(ctx.cwd, descriptor.key)
36738
+ });
36739
+ }
36740
+ return result;
36741
+ }
36742
+ async function resolveExecutions(ctx, type) {
36743
+ const groups = groupByEcosystem(ctx, type);
36744
+ const executions = [];
36745
+ for (const group of groups) {
36746
+ const descriptor = ecosystemCatalog.get(group.ecosystemKey);
36747
+ if (!descriptor)
36748
+ continue;
36749
+ if (group.groupPackages.length > 0) {
36750
+ const resolved = resolveScript(group.groupPackages[0], group.ecosystemKey, ctx, type);
36751
+ if (resolved.command) {
36752
+ if (group.hasWorkspace) {
36753
+ executions.push({
36754
+ label: resolved.command,
36755
+ cmd: "sh",
36756
+ args: ["-c", resolved.command],
36757
+ cwd: ctx.cwd
36758
+ });
36759
+ } else {
36760
+ for (const pkg of group.groupPackages) {
36761
+ const pkgCwd = import_node_path24.default.resolve(ctx.cwd, pkg.path);
36762
+ executions.push({
36763
+ label: `${resolved.command} (${pkg.path})`,
36764
+ cmd: "sh",
36765
+ args: ["-c", resolved.command],
36766
+ cwd: pkgCwd
36767
+ });
36768
+ }
36769
+ }
36770
+ } else if (resolved.script) {
36771
+ if (group.hasWorkspace) {
36772
+ const instance = new descriptor.ecosystemClass(ctx.cwd);
36773
+ const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
36774
+ executions.push({
36775
+ label: `${cmd} ${args.join(" ")}`,
36776
+ cmd,
36777
+ args,
36778
+ cwd: ctx.cwd
36779
+ });
36780
+ } else {
36781
+ for (const pkg of group.groupPackages) {
36782
+ const pkgCwd = import_node_path24.default.resolve(ctx.cwd, pkg.path);
36783
+ const instance = new descriptor.ecosystemClass(pkgCwd);
36784
+ const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
36785
+ executions.push({
36786
+ label: `${cmd} ${args.join(" ")} (${pkg.path})`,
36787
+ cmd,
36788
+ args,
36789
+ cwd: pkgCwd
36790
+ });
36791
+ }
36792
+ }
36793
+ }
36794
+ }
36795
+ for (const pkg of group.individualPackages) {
36796
+ const pkgCwd = import_node_path24.default.resolve(ctx.cwd, pkg.path);
36797
+ const resolved = resolveScript(pkg, group.ecosystemKey, ctx, type);
36798
+ if (resolved.command) {
36799
+ executions.push({
36800
+ label: `${resolved.command} (${pkg.path})`,
36801
+ cmd: "sh",
36802
+ args: ["-c", resolved.command],
36803
+ cwd: pkgCwd
36804
+ });
36805
+ } else if (resolved.script) {
36806
+ const instance = new descriptor.ecosystemClass(pkgCwd);
36807
+ const { cmd, args } = type === "test" ? await instance.resolveTestCommand(resolved.script) : await instance.resolveBuildCommand(resolved.script);
36808
+ executions.push({
36809
+ label: `${cmd} ${args.join(" ")} (${pkg.path})`,
36810
+ cmd,
36811
+ args,
36812
+ cwd: pkgCwd
36813
+ });
36814
+ }
36815
+ }
36816
+ }
36817
+ return executions;
36818
+ }
36819
+ async function runExecution(execution, ctx, task) {
36820
+ const liveOutput = shouldRenderLiveCommandOutput(ctx) ? createLiveCommandOutput(task, execution.label) : undefined;
36821
+ task.output = `Executing \`${execution.label}\``;
36822
+ try {
36823
+ await exec3(execution.cmd, execution.args, {
36824
+ onStdout: liveOutput?.onStdout,
36825
+ onStderr: liveOutput?.onStderr,
36826
+ throwOnError: true,
36827
+ nodeOptions: { cwd: execution.cwd }
36828
+ });
36829
+ } finally {
36830
+ liveOutput?.finish();
36831
+ }
36832
+ }
36624
36833
  function createTestTask(hasPrepare, skipTests) {
36625
36834
  return {
36626
36835
  enabled: hasPrepare && !skipTests,
@@ -36628,28 +36837,25 @@ function createTestTask(hasPrepare, skipTests) {
36628
36837
  task: async (ctx, task) => {
36629
36838
  task.output = t("task.test.runningBeforeHooks");
36630
36839
  await ctx.runtime.pluginRunner.runHook("beforeTest", ctx);
36631
- const packageManager = await getPackageManager();
36632
- const command = `${packageManager} run ${ctx.options.testScript}`;
36633
- task.title = t("task.test.titleWithCommand", { command });
36634
- const liveOutput = shouldRenderLiveCommandOutput(ctx) ? createLiveCommandOutput(task, command) : undefined;
36635
- task.output = `Executing \`${command}\``;
36636
- try {
36637
- await exec3(packageManager, ["run", ctx.options.testScript], {
36638
- onStdout: liveOutput?.onStdout,
36639
- onStderr: liveOutput?.onStderr,
36640
- throwOnError: true
36840
+ const executions = await resolveExecutions(ctx, "test");
36841
+ for (const execution of executions) {
36842
+ task.title = t("task.test.titleWithCommand", {
36843
+ command: execution.label
36641
36844
  });
36642
- } catch (error4) {
36643
- liveOutput?.finish();
36644
- throw new AbstractError(t("error.test.failedWithHint", {
36645
- script: ctx.options.testScript,
36646
- command
36647
- }), { cause: error4 });
36845
+ try {
36846
+ await runExecution(execution, ctx, task);
36847
+ } catch (error4) {
36848
+ throw new AbstractError(t("error.test.failedWithHint", {
36849
+ script: execution.label,
36850
+ command: execution.label
36851
+ }), { cause: error4 });
36852
+ }
36648
36853
  }
36649
- liveOutput?.finish();
36650
36854
  task.output = t("task.test.runningAfterHooks");
36651
36855
  await ctx.runtime.pluginRunner.runHook("afterTest", ctx);
36652
- task.output = t("task.test.completed", { command });
36856
+ task.output = t("task.test.completed", {
36857
+ command: executions.map((e3) => e3.label).join(", ")
36858
+ });
36653
36859
  }
36654
36860
  };
36655
36861
  }
@@ -36660,41 +36866,38 @@ function createBuildTask(hasPrepare, skipBuild) {
36660
36866
  task: async (ctx, task) => {
36661
36867
  task.output = t("task.build.runningBeforeHooks");
36662
36868
  await ctx.runtime.pluginRunner.runHook("beforeBuild", ctx);
36663
- const packageManager = await getPackageManager();
36664
- const command = `${packageManager} run ${ctx.options.buildScript}`;
36665
- task.title = t("task.build.titleWithCommand", { command });
36666
- const liveOutput = shouldRenderLiveCommandOutput(ctx) ? createLiveCommandOutput(task, command) : undefined;
36667
- task.output = `Executing \`${command}\``;
36668
- try {
36669
- await exec3(packageManager, ["run", ctx.options.buildScript], {
36670
- onStdout: liveOutput?.onStdout,
36671
- onStderr: liveOutput?.onStderr,
36672
- throwOnError: true
36869
+ const executions = await resolveExecutions(ctx, "build");
36870
+ for (const execution of executions) {
36871
+ task.title = t("task.build.titleWithCommand", {
36872
+ command: execution.label
36673
36873
  });
36674
- } catch (error4) {
36675
- liveOutput?.finish();
36676
- throw new AbstractError(t("error.build.failedWithHint", {
36677
- script: ctx.options.buildScript,
36678
- command
36679
- }), { cause: error4 });
36874
+ try {
36875
+ await runExecution(execution, ctx, task);
36876
+ } catch (error4) {
36877
+ throw new AbstractError(t("error.build.failedWithHint", {
36878
+ script: execution.label,
36879
+ command: execution.label
36880
+ }), { cause: error4 });
36881
+ }
36680
36882
  }
36681
- liveOutput?.finish();
36682
36883
  task.output = t("task.build.runningAfterHooks");
36683
36884
  await ctx.runtime.pluginRunner.runHook("afterBuild", ctx);
36684
- task.output = t("task.build.completed", { command });
36885
+ task.output = t("task.build.completed", {
36886
+ command: executions.map((e3) => e3.label).join(", ")
36887
+ });
36685
36888
  }
36686
36889
  };
36687
36890
  }
36688
36891
 
36689
36892
  // src/tasks/phases/version.ts
36690
36893
  init_dist2();
36691
- var import_node_path26 = __toESM(require("node:path"));
36894
+ var import_node_path27 = __toESM(require("node:path"));
36692
36895
 
36693
36896
  // src/changelog/file.ts
36694
36897
  var import_node_fs15 = require("node:fs");
36695
- var import_node_path24 = __toESM(require("node:path"));
36898
+ var import_node_path25 = __toESM(require("node:path"));
36696
36899
  function writeChangelogToFile(cwd, newContent) {
36697
- const changelogPath = import_node_path24.default.join(cwd, "CHANGELOG.md");
36900
+ const changelogPath = import_node_path25.default.join(cwd, "CHANGELOG.md");
36698
36901
  let existing = "";
36699
36902
  if (import_node_fs15.existsSync(changelogPath)) {
36700
36903
  existing = import_node_fs15.readFileSync(changelogPath, "utf-8");
@@ -36759,7 +36962,7 @@ function buildChangelogEntries(changesets, packagePath) {
36759
36962
 
36760
36963
  // src/changeset/reader.ts
36761
36964
  var import_node_fs16 = require("node:fs");
36762
- var import_node_path25 = __toESM(require("node:path"));
36965
+ var import_node_path26 = __toESM(require("node:path"));
36763
36966
  var import_node_process18 = __toESM(require("node:process"));
36764
36967
 
36765
36968
  // src/changeset/parser.ts
@@ -36780,8 +36983,8 @@ function parseChangeset(content, fileName, resolveKey) {
36780
36983
  if (!VALID_BUMP_TYPES.has(type)) {
36781
36984
  throw new Error(`Invalid bump type "${type}" for package "${key}" in "${fileName}". Expected: patch, minor, or major.`);
36782
36985
  }
36783
- const path14 = resolveKey ? resolveKey(key) : key;
36784
- releases.push({ path: path14, type });
36986
+ const path16 = resolveKey ? resolveKey(key) : key;
36987
+ releases.push({ path: path16, type });
36785
36988
  }
36786
36989
  }
36787
36990
  const id = fileName.replace(/\.md$/, "");
@@ -36794,7 +36997,7 @@ function parseChangeset(content, fileName, resolveKey) {
36794
36997
 
36795
36998
  // src/changeset/reader.ts
36796
36999
  function readChangesets(cwd = import_node_process18.default.cwd(), resolveKey) {
36797
- const changesetsDir = import_node_path25.default.join(cwd, ".pubm", "changesets");
37000
+ const changesetsDir = import_node_path26.default.join(cwd, ".pubm", "changesets");
36798
37001
  if (!import_node_fs16.existsSync(changesetsDir)) {
36799
37002
  return [];
36800
37003
  }
@@ -36804,16 +37007,16 @@ function readChangesets(cwd = import_node_process18.default.cwd(), resolveKey) {
36804
37007
  if (!file.endsWith(".md") || file === "README.md") {
36805
37008
  continue;
36806
37009
  }
36807
- const filePath = import_node_path25.default.join(changesetsDir, file);
37010
+ const filePath = import_node_path26.default.join(changesetsDir, file);
36808
37011
  const content = import_node_fs16.readFileSync(filePath, "utf-8");
36809
37012
  changesets.push(parseChangeset(content, file, resolveKey));
36810
37013
  }
36811
37014
  return changesets;
36812
37015
  }
36813
37016
  function deleteChangesetFiles(cwd, changesets) {
36814
- const changesetsDir = import_node_path25.default.join(cwd, ".pubm", "changesets");
37017
+ const changesetsDir = import_node_path26.default.join(cwd, ".pubm", "changesets");
36815
37018
  for (const changeset of changesets) {
36816
- const filePath = import_node_path25.default.join(changesetsDir, `${changeset.id}.md`);
37019
+ const filePath = import_node_path26.default.join(changesetsDir, `${changeset.id}.md`);
36817
37020
  if (import_node_fs16.existsSync(filePath)) {
36818
37021
  import_node_fs16.rmSync(filePath);
36819
37022
  }
@@ -36870,7 +37073,7 @@ function createVersionTask(hasPrepare, dryRun) {
36870
37073
  const changesets = readChangesets(ctx.cwd, resolver);
36871
37074
  if (changesets.length > 0) {
36872
37075
  registerChangesetBackups(ctx, changesets);
36873
- const changelogPath = import_node_path26.default.join(ctx.cwd, "CHANGELOG.md");
37076
+ const changelogPath = import_node_path27.default.join(ctx.cwd, "CHANGELOG.md");
36874
37077
  registerChangelogBackup(ctx, changelogPath);
36875
37078
  const pkgPath = ctx.config.packages[0]?.path ?? "";
36876
37079
  const entries = buildChangelogEntries(changesets, pkgPath);
@@ -36927,7 +37130,7 @@ ${ctx.config.packages.map((pkg) => `- ${pkg.name}: ${plan.version}`).join(`
36927
37130
  const changesets = readChangesets(ctx.cwd, resolver);
36928
37131
  if (changesets.length > 0) {
36929
37132
  registerChangesetBackups(ctx, changesets);
36930
- const changelogPath = import_node_path26.default.join(ctx.cwd, "CHANGELOG.md");
37133
+ const changelogPath = import_node_path27.default.join(ctx.cwd, "CHANGELOG.md");
36931
37134
  registerChangelogBackup(ctx, changelogPath);
36932
37135
  const allEntries = [...plan.packages.keys()].flatMap((pkgPath) => buildChangelogEntries(changesets, pkgPath));
36933
37136
  if (allEntries.length > 0) {
@@ -36987,15 +37190,15 @@ ${[...plan.packages].map(([pkgPath]) => `- ${getPackageName(ctx, pkgPath)}: ${pl
36987
37190
  registerChangesetBackups(ctx, changesets);
36988
37191
  for (const [pkgPath] of plan.packages) {
36989
37192
  const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
36990
- const changelogDir = pkgConfig ? import_node_path26.default.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
36991
- const changelogPath = import_node_path26.default.join(changelogDir, "CHANGELOG.md");
37193
+ const changelogDir = pkgConfig ? import_node_path27.default.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
37194
+ const changelogPath = import_node_path27.default.join(changelogDir, "CHANGELOG.md");
36992
37195
  registerChangelogBackup(ctx, changelogPath);
36993
37196
  }
36994
37197
  for (const [pkgPath, pkgVersion] of plan.packages) {
36995
37198
  const entries = buildChangelogEntries(changesets, pkgPath);
36996
37199
  if (entries.length > 0) {
36997
37200
  const pkgConfig = ctx.config.packages.find((p2) => p2.path === pkgPath);
36998
- const changelogDir = pkgConfig ? import_node_path26.default.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
37201
+ const changelogDir = pkgConfig ? import_node_path27.default.resolve(ctx.cwd, pkgConfig.path) : ctx.cwd;
36999
37202
  writeChangelogToFile(changelogDir, generateChangelog(pkgVersion, entries));
37000
37203
  }
37001
37204
  }
@@ -37247,11 +37450,11 @@ function maxBump(a3, b2) {
37247
37450
  }
37248
37451
  // src/changeset/migrate.ts
37249
37452
  var import_node_fs17 = require("node:fs");
37250
- var import_node_path27 = __toESM(require("node:path"));
37453
+ var import_node_path28 = __toESM(require("node:path"));
37251
37454
  var import_node_process20 = __toESM(require("node:process"));
37252
37455
  var SKIPPED_FILES = new Set(["config.json", "README.md"]);
37253
37456
  function migrateFromChangesets(cwd = import_node_process20.default.cwd()) {
37254
- const changesetDir = import_node_path27.default.join(cwd, ".changeset");
37457
+ const changesetDir = import_node_path28.default.join(cwd, ".changeset");
37255
37458
  if (!import_node_fs17.existsSync(changesetDir)) {
37256
37459
  return {
37257
37460
  success: false,
@@ -37260,7 +37463,7 @@ function migrateFromChangesets(cwd = import_node_process20.default.cwd()) {
37260
37463
  configMigrated: false
37261
37464
  };
37262
37465
  }
37263
- const pubmDir = import_node_path27.default.join(cwd, ".pubm", "changesets");
37466
+ const pubmDir = import_node_path28.default.join(cwd, ".pubm", "changesets");
37264
37467
  import_node_fs17.mkdirSync(pubmDir, { recursive: true });
37265
37468
  const files = import_node_fs17.readdirSync(changesetDir);
37266
37469
  const migratedFiles = [];
@@ -37274,13 +37477,13 @@ function migrateFromChangesets(cwd = import_node_process20.default.cwd()) {
37274
37477
  continue;
37275
37478
  }
37276
37479
  if (file === "pre.json") {
37277
- import_node_fs17.copyFileSync(import_node_path27.default.join(changesetDir, file), import_node_path27.default.resolve(cwd, ".pubm", "pre.json"));
37480
+ import_node_fs17.copyFileSync(import_node_path28.default.join(changesetDir, file), import_node_path28.default.resolve(cwd, ".pubm", "pre.json"));
37278
37481
  migratedFiles.push(file);
37279
37482
  continue;
37280
37483
  }
37281
37484
  if (file.endsWith(".md")) {
37282
- const src = import_node_path27.default.join(changesetDir, file);
37283
- const dest = import_node_path27.default.join(pubmDir, file);
37485
+ const src = import_node_path28.default.join(changesetDir, file);
37486
+ const dest = import_node_path28.default.join(pubmDir, file);
37284
37487
  import_node_fs17.copyFileSync(src, dest);
37285
37488
  migratedFiles.push(file);
37286
37489
  }
@@ -37354,7 +37557,7 @@ function calculateVersionBumps(currentVersions, cwd = import_node_process22.defa
37354
37557
  }
37355
37558
  // src/changeset/writer.ts
37356
37559
  var import_node_fs18 = require("node:fs");
37357
- var import_node_path28 = __toESM(require("node:path"));
37560
+ var import_node_path29 = __toESM(require("node:path"));
37358
37561
  var import_node_process23 = __toESM(require("node:process"));
37359
37562
  var import_yaml3 = __toESM(require_dist(), 1);
37360
37563
  var adjectives = [
@@ -37451,11 +37654,11 @@ ${summary}
37451
37654
  return content;
37452
37655
  }
37453
37656
  function writeChangeset(releases, summary, cwd = import_node_process23.default.cwd()) {
37454
- const changesetsDir = import_node_path28.default.join(cwd, ".pubm", "changesets");
37657
+ const changesetsDir = import_node_path29.default.join(cwd, ".pubm", "changesets");
37455
37658
  import_node_fs18.mkdirSync(changesetsDir, { recursive: true });
37456
37659
  const id = generateChangesetId();
37457
37660
  const fileName = `${id}.md`;
37458
- const filePath = import_node_path28.default.join(changesetsDir, fileName);
37661
+ const filePath = import_node_path29.default.join(changesetsDir, fileName);
37459
37662
  const content = generateChangesetContent(releases, summary);
37460
37663
  import_node_fs18.writeFileSync(filePath, content, "utf-8");
37461
37664
  return filePath;
@@ -37463,6 +37666,8 @@ function writeChangeset(releases, summary, cwd = import_node_process23.default.c
37463
37666
  // src/config/defaults.ts
37464
37667
  init_catalog2();
37465
37668
  init_i18n();
37669
+ var import_node_path30 = __toESM(require("node:path"));
37670
+ var import_micromatch4 = __toESM(require_micromatch(), 1);
37466
37671
  init_catalog();
37467
37672
  var defaultValidate = {
37468
37673
  cleanInstall: true,
@@ -37508,6 +37713,16 @@ async function resolveConfig(config, cwd) {
37508
37713
  }
37509
37714
  }
37510
37715
  }
37716
+ if (config.ecosystems) {
37717
+ for (const key of Object.keys(config.ecosystems)) {
37718
+ if (!ecosystemCatalog.get(key)) {
37719
+ throw new Error(t("error.config.unknownEcosystem", {
37720
+ ecosystem: key,
37721
+ list: ecosystemCatalog.all().map((d3) => d3.key).join(", ")
37722
+ }));
37723
+ }
37724
+ }
37725
+ }
37511
37726
  const configPackages = config.packages?.map((pkg) => {
37512
37727
  if (!pkg.registries)
37513
37728
  return pkg;
@@ -37529,15 +37744,29 @@ async function resolveConfig(config, cwd) {
37529
37744
  discoveryEmpty = true;
37530
37745
  packages = [];
37531
37746
  } else {
37532
- packages = discovered.map((pkg) => ({
37533
- path: pkg.path,
37534
- name: pkg.name,
37535
- version: pkg.version,
37536
- dependencies: pkg.dependencies,
37537
- ecosystem: pkg.ecosystem,
37538
- registries: pkg.registries,
37539
- ...pkg.registryVersions ? { registryVersions: pkg.registryVersions } : {}
37540
- }));
37747
+ packages = discovered.map((pkg) => {
37748
+ const configPkg = configPackages?.find((cp) => {
37749
+ const normalized = cp.path.replace(/\\/g, "/");
37750
+ const pkgPathForward = pkg.path.replace(/\\/g, "/");
37751
+ if (import_micromatch4.default.scan(normalized).isGlob) {
37752
+ return import_micromatch4.default.isMatch(pkgPathForward, normalized);
37753
+ }
37754
+ return import_node_path30.default.normalize(cp.path) === pkg.path;
37755
+ });
37756
+ return {
37757
+ path: pkg.path,
37758
+ name: pkg.name,
37759
+ version: pkg.version,
37760
+ dependencies: pkg.dependencies,
37761
+ ecosystem: pkg.ecosystem,
37762
+ registries: pkg.registries,
37763
+ ...pkg.registryVersions ? { registryVersions: pkg.registryVersions } : {},
37764
+ ...configPkg?.testScript ? { testScript: configPkg.testScript } : {},
37765
+ ...configPkg?.testCommand ? { testCommand: configPkg.testCommand } : {},
37766
+ ...configPkg?.buildScript ? { buildScript: configPkg.buildScript } : {},
37767
+ ...configPkg?.buildCommand ? { buildCommand: configPkg.buildCommand } : {}
37768
+ };
37769
+ });
37541
37770
  }
37542
37771
  return {
37543
37772
  ...defaultConfig,
@@ -37550,6 +37779,7 @@ async function resolveConfig(config, cwd) {
37550
37779
  ...config.rollback
37551
37780
  },
37552
37781
  snapshotTemplate: config.snapshotTemplate ?? defaultConfig.snapshotTemplate,
37782
+ ecosystems: config.ecosystems ?? {},
37553
37783
  plugins: config.plugins ?? [],
37554
37784
  versionSources: config.versionSources ?? defaultConfig.versionSources,
37555
37785
  conventionalCommits: {
@@ -37571,10 +37801,10 @@ function resolveEcosystemKey(pkg, _entry) {
37571
37801
  }
37572
37802
  // src/config/loader.ts
37573
37803
  var import_node_child_process = require("node:child_process");
37574
- var import_promises9 = require("node:fs/promises");
37804
+ var import_promises8 = require("node:fs/promises");
37575
37805
  var import_node_module2 = require("node:module");
37576
37806
  var import_node_os5 = require("node:os");
37577
- var import_node_path29 = __toESM(require("node:path"));
37807
+ var import_node_path31 = __toESM(require("node:path"));
37578
37808
  var import_node_url = require("node:url");
37579
37809
  var import_node_vm = __toESM(require("node:vm"));
37580
37810
  var CONFIG_FILES = [
@@ -37627,9 +37857,9 @@ var CONFIG_MODULE_SHIMS = {
37627
37857
  };
37628
37858
  async function findConfigFile(cwd) {
37629
37859
  for (const file of CONFIG_FILES) {
37630
- const filePath = import_node_path29.default.join(cwd, file);
37860
+ const filePath = import_node_path31.default.join(cwd, file);
37631
37861
  try {
37632
- if ((await import_promises9.stat(filePath)).isFile()) {
37862
+ if ((await import_promises8.stat(filePath)).isFile()) {
37633
37863
  return filePath;
37634
37864
  }
37635
37865
  } catch {}
@@ -37648,15 +37878,15 @@ function isBareSpecifier(specifier) {
37648
37878
  return !specifier.startsWith(".") && !specifier.startsWith("/") && !specifier.startsWith("file:") && !specifier.startsWith("node:");
37649
37879
  }
37650
37880
  async function findClosestPackageManifest(filePath) {
37651
- let current = import_node_path29.default.dirname(filePath);
37881
+ let current = import_node_path31.default.dirname(filePath);
37652
37882
  while (true) {
37653
- const manifestPath = import_node_path29.default.join(current, "package.json");
37883
+ const manifestPath = import_node_path31.default.join(current, "package.json");
37654
37884
  try {
37655
- if ((await import_promises9.stat(manifestPath)).isFile()) {
37885
+ if ((await import_promises8.stat(manifestPath)).isFile()) {
37656
37886
  return manifestPath;
37657
37887
  }
37658
37888
  } catch {}
37659
- const parent = import_node_path29.default.dirname(current);
37889
+ const parent = import_node_path31.default.dirname(current);
37660
37890
  if (parent === current) {
37661
37891
  return null;
37662
37892
  }
@@ -37672,7 +37902,7 @@ async function isOptionalDependencyImport(specifier, importerPath) {
37672
37902
  return false;
37673
37903
  }
37674
37904
  const packageName = getPackageName2(specifier);
37675
- const manifest = JSON.parse(await import_promises9.readFile(manifestPath, "utf8"));
37905
+ const manifest = JSON.parse(await import_promises8.readFile(manifestPath, "utf8"));
37676
37906
  if (manifest.optionalDependencies?.[packageName]) {
37677
37907
  return true;
37678
37908
  }
@@ -37743,7 +37973,7 @@ async function collectOptionalDependenciesForInputs(inputPaths) {
37743
37973
  }
37744
37974
  const optionalDependencies = new Set;
37745
37975
  for (const manifestPath of manifestPaths) {
37746
- const manifest = JSON.parse(await import_promises9.readFile(manifestPath, "utf8"));
37976
+ const manifest = JSON.parse(await import_promises8.readFile(manifestPath, "utf8"));
37747
37977
  for (const dependency of Object.keys(manifest.optionalDependencies ?? {})) {
37748
37978
  optionalDependencies.add(dependency);
37749
37979
  }
@@ -37758,13 +37988,13 @@ async function collectOptionalDependenciesForInputs(inputPaths) {
37758
37988
  async function findInstalledPackagePath(startDir, dependency) {
37759
37989
  let current = startDir;
37760
37990
  while (true) {
37761
- const packageDir = import_node_path29.default.join(current, "node_modules", dependency);
37991
+ const packageDir = import_node_path31.default.join(current, "node_modules", dependency);
37762
37992
  try {
37763
- if ((await import_promises9.stat(packageDir)).isDirectory()) {
37993
+ if ((await import_promises8.stat(packageDir)).isDirectory()) {
37764
37994
  return packageDir;
37765
37995
  }
37766
37996
  } catch {}
37767
- const parent = import_node_path29.default.dirname(current);
37997
+ const parent = import_node_path31.default.dirname(current);
37768
37998
  if (parent === current) {
37769
37999
  return null;
37770
38000
  }
@@ -37772,19 +38002,19 @@ async function findInstalledPackagePath(startDir, dependency) {
37772
38002
  }
37773
38003
  }
37774
38004
  async function writeOptionalDependencyStubs(moduleDir, resolveFromDir, optionalDependencies) {
37775
- const nodeModulesDir = import_node_path29.default.join(moduleDir, "node_modules");
38005
+ const nodeModulesDir = import_node_path31.default.join(moduleDir, "node_modules");
37776
38006
  for (const dependency of optionalDependencies) {
37777
38007
  if (await findInstalledPackagePath(resolveFromDir, dependency)) {
37778
38008
  continue;
37779
38009
  }
37780
- const packageDir = import_node_path29.default.join(nodeModulesDir, dependency);
37781
- await import_promises9.mkdir(packageDir, { recursive: true });
37782
- await import_promises9.writeFile(import_node_path29.default.join(packageDir, "package.json"), JSON.stringify({
38010
+ const packageDir = import_node_path31.default.join(nodeModulesDir, dependency);
38011
+ await import_promises8.mkdir(packageDir, { recursive: true });
38012
+ await import_promises8.writeFile(import_node_path31.default.join(packageDir, "package.json"), JSON.stringify({
37783
38013
  name: dependency,
37784
38014
  private: true,
37785
38015
  main: "./index.js"
37786
38016
  }, null, 2), "utf8");
37787
- await import_promises9.writeFile(import_node_path29.default.join(packageDir, "index.js"), createOptionalDependencyProxyPackage(dependency), "utf8");
38017
+ await import_promises8.writeFile(import_node_path31.default.join(packageDir, "index.js"), createOptionalDependencyProxyPackage(dependency), "utf8");
37788
38018
  }
37789
38019
  }
37790
38020
  function createOptionalDependencyPlugin(specifiers) {
@@ -37838,7 +38068,7 @@ function createConfigModuleShimPlugin() {
37838
38068
  };
37839
38069
  }
37840
38070
  async function runBunBuild(build, entrypoint, format3 = "esm", optionalDynamicImports = []) {
37841
- const entrypointSource = await import_promises9.readFile(entrypoint, "utf8");
38071
+ const entrypointSource = await import_promises8.readFile(entrypoint, "utf8");
37842
38072
  const result = await build({
37843
38073
  entrypoints: [entrypoint],
37844
38074
  target: "bun",
@@ -37896,12 +38126,12 @@ async function buildConfigWithFormat(entrypoint, format3) {
37896
38126
  }
37897
38127
  async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
37898
38128
  const extension = format3 === "esm" ? "mjs" : "cjs";
37899
- const tempDir = await import_promises9.mkdtemp(import_node_path29.default.join(import_node_os5.tmpdir(), "pubm-config-"));
37900
- const buildScript = import_node_path29.default.join(tempDir, "build-config.mjs");
37901
- const outfile = import_node_path29.default.join(tempDir, `pubm.config.${extension}`);
37902
- const resultFile = import_node_path29.default.join(tempDir, "build-result.json");
38129
+ const tempDir = await import_promises8.mkdtemp(import_node_path31.default.join(import_node_os5.tmpdir(), "pubm-config-"));
38130
+ const buildScript = import_node_path31.default.join(tempDir, "build-config.mjs");
38131
+ const outfile = import_node_path31.default.join(tempDir, `pubm.config.${extension}`);
38132
+ const resultFile = import_node_path31.default.join(tempDir, "build-result.json");
37903
38133
  try {
37904
- await import_promises9.writeFile(buildScript, [
38134
+ await import_promises8.writeFile(buildScript, [
37905
38135
  'import { readFile, stat, writeFile } from "node:fs/promises";',
37906
38136
  'import path from "node:path";',
37907
38137
  'import { pathToFileURL } from "node:url";',
@@ -38150,8 +38380,8 @@ async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
38150
38380
  resolve2();
38151
38381
  });
38152
38382
  });
38153
- const result = JSON.parse(await import_promises9.readFile(resultFile, "utf8"));
38154
- const contents = result.hasEntrypoint ? await import_promises9.readFile(outfile, "utf8") : null;
38383
+ const result = JSON.parse(await import_promises8.readFile(resultFile, "utf8"));
38384
+ const contents = result.hasEntrypoint ? await import_promises8.readFile(outfile, "utf8") : null;
38155
38385
  return {
38156
38386
  success: result.success,
38157
38387
  logs: result.logs,
@@ -38170,16 +38400,16 @@ async function buildConfigWithChildProcess(entrypoint, format3 = "esm") {
38170
38400
  outputs: []
38171
38401
  };
38172
38402
  } finally {
38173
- await import_promises9.rm(tempDir, { recursive: true, force: true });
38403
+ await import_promises8.rm(tempDir, { recursive: true, force: true });
38174
38404
  }
38175
38405
  }
38176
38406
  function rewriteImportMeta(source, configPath) {
38177
38407
  const replacements = [
38178
- ["import.meta.dirname", JSON.stringify(import_node_path29.default.dirname(configPath))],
38408
+ ["import.meta.dirname", JSON.stringify(import_node_path31.default.dirname(configPath))],
38179
38409
  ["import.meta.filename", JSON.stringify(configPath)],
38180
38410
  ["import.meta.path", JSON.stringify(configPath)],
38181
38411
  ["import.meta.url", JSON.stringify(import_node_url.pathToFileURL(configPath).href)],
38182
- ["import.meta.dir", JSON.stringify(import_node_path29.default.dirname(configPath))]
38412
+ ["import.meta.dir", JSON.stringify(import_node_path31.default.dirname(configPath))]
38183
38413
  ];
38184
38414
  let rewritten = source;
38185
38415
  for (const [pattern, value] of replacements) {
@@ -38195,14 +38425,14 @@ async function importConfigModule(configPath) {
38195
38425
  return normalizeConfigNamespace(namespace);
38196
38426
  }
38197
38427
  async function importBundledConfig(source, configPath, optionalDependencies) {
38198
- const tempDir = await import_promises9.mkdtemp(import_node_path29.default.join(import_node_path29.default.dirname(configPath), ".pubm-config-module-"));
38199
- const tempFile = import_node_path29.default.join(tempDir, "pubm.config.mjs");
38428
+ const tempDir = await import_promises8.mkdtemp(import_node_path31.default.join(import_node_path31.default.dirname(configPath), ".pubm-config-module-"));
38429
+ const tempFile = import_node_path31.default.join(tempDir, "pubm.config.mjs");
38200
38430
  try {
38201
- await writeOptionalDependencyStubs(tempDir, import_node_path29.default.dirname(configPath), optionalDependencies);
38202
- await import_promises9.writeFile(tempFile, source, "utf8");
38431
+ await writeOptionalDependencyStubs(tempDir, import_node_path31.default.dirname(configPath), optionalDependencies);
38432
+ await import_promises8.writeFile(tempFile, source, "utf8");
38203
38433
  return importConfigModule(tempFile);
38204
38434
  } finally {
38205
- await import_promises9.rm(tempDir, { recursive: true, force: true });
38435
+ await import_promises8.rm(tempDir, { recursive: true, force: true });
38206
38436
  }
38207
38437
  }
38208
38438
  async function executeBundledConfigInVm(source, configPath) {
@@ -38213,7 +38443,7 @@ async function executeBundledConfigInVm(source, configPath) {
38213
38443
  exports: module2.exports,
38214
38444
  require: require2,
38215
38445
  __filename: configPath,
38216
- __dirname: import_node_path29.default.dirname(configPath),
38446
+ __dirname: import_node_path31.default.dirname(configPath),
38217
38447
  console,
38218
38448
  process,
38219
38449
  Buffer,
@@ -38244,9 +38474,9 @@ function formatStageError(stage, error4) {
38244
38474
  async function loadConfig(cwd = process.cwd(), configPath) {
38245
38475
  let resolvedConfigPath;
38246
38476
  if (configPath) {
38247
- resolvedConfigPath = import_node_path29.default.resolve(cwd, configPath);
38477
+ resolvedConfigPath = import_node_path31.default.resolve(cwd, configPath);
38248
38478
  try {
38249
- if (!(await import_promises9.stat(resolvedConfigPath)).isFile()) {
38479
+ if (!(await import_promises8.stat(resolvedConfigPath)).isFile()) {
38250
38480
  throw new Error(`Config path is not a file: ${resolvedConfigPath}`);
38251
38481
  }
38252
38482
  } catch (e3) {
@@ -38324,12 +38554,12 @@ function defineConfig(config) {
38324
38554
  init_context();
38325
38555
 
38326
38556
  // src/conventional-commit/scope-resolver.ts
38327
- var import_node_path30 = __toESM(require("node:path"));
38557
+ var import_node_path32 = __toESM(require("node:path"));
38328
38558
  function resolveCommitPackages(commit, packagePaths) {
38329
38559
  const matched = new Set;
38330
38560
  if (commit.scope) {
38331
38561
  for (const pkgPath of packagePaths) {
38332
- const dirName = import_node_path30.default.basename(pkgPath);
38562
+ const dirName = import_node_path32.default.basename(pkgPath);
38333
38563
  if (dirName === commit.scope) {
38334
38564
  matched.add(pkgPath);
38335
38565
  }
@@ -38584,7 +38814,7 @@ function inspectPackages(config, cwd) {
38584
38814
  init_manifest_reader();
38585
38815
  // src/migrate/adapters/changesets.ts
38586
38816
  var import_node_fs19 = require("node:fs");
38587
- var import_node_path31 = __toESM(require("node:path"));
38817
+ var import_node_path33 = __toESM(require("node:path"));
38588
38818
  var SKIPPED_DIR_ENTRIES = new Set(["config.json", "README.md", ".gitkeep"]);
38589
38819
  var CHANGELOG_PRESET_MAP = {
38590
38820
  "@changesets/changelog-github": "github",
@@ -38602,11 +38832,11 @@ var changesetsAdapter = {
38602
38832
  name: "changesets",
38603
38833
  configFilePatterns: [".changeset/config.json"],
38604
38834
  async detect(cwd) {
38605
- const configFile = import_node_path31.default.join(cwd, ".changeset", "config.json");
38835
+ const configFile = import_node_path33.default.join(cwd, ".changeset", "config.json");
38606
38836
  if (!import_node_fs19.existsSync(configFile)) {
38607
38837
  return { found: false, configFiles: [], relatedFiles: [] };
38608
38838
  }
38609
- const changesetDir = import_node_path31.default.dirname(configFile);
38839
+ const changesetDir = import_node_path33.default.dirname(configFile);
38610
38840
  const relatedFiles = [];
38611
38841
  try {
38612
38842
  const entries = import_node_fs19.readdirSync(changesetDir, { encoding: "utf-8" });
@@ -38614,7 +38844,7 @@ var changesetsAdapter = {
38614
38844
  if (SKIPPED_DIR_ENTRIES.has(entry))
38615
38845
  continue;
38616
38846
  if (entry.endsWith(".md") || entry === "pre.json") {
38617
- relatedFiles.push(import_node_path31.default.join(changesetDir, entry));
38847
+ relatedFiles.push(import_node_path33.default.join(changesetDir, entry));
38618
38848
  }
38619
38849
  }
38620
38850
  } catch {}
@@ -38625,7 +38855,7 @@ var changesetsAdapter = {
38625
38855
  };
38626
38856
  },
38627
38857
  async parse(files, cwd) {
38628
- const configFile = files.find((f2) => f2.endsWith(`${import_node_path31.default.sep}config.json`) || f2.endsWith("/config.json"));
38858
+ const configFile = files.find((f2) => f2.endsWith(`${import_node_path33.default.sep}config.json`) || f2.endsWith("/config.json"));
38629
38859
  if (configFile === undefined) {
38630
38860
  return { source: "changesets", unmappable: [] };
38631
38861
  }
@@ -38660,7 +38890,7 @@ var changesetsAdapter = {
38660
38890
  if (hasUpdateInternalDeps)
38661
38891
  result.monorepo.updateInternalDeps = config.updateInternalDependencies;
38662
38892
  }
38663
- const preJsonPath = import_node_path31.default.join(cwd, ".changeset", "pre.json");
38893
+ const preJsonPath = import_node_path33.default.join(cwd, ".changeset", "pre.json");
38664
38894
  if (import_node_fs19.existsSync(preJsonPath)) {
38665
38895
  try {
38666
38896
  const preRaw = import_node_fs19.readFileSync(preJsonPath, "utf-8");
@@ -38694,12 +38924,12 @@ var changesetsAdapter = {
38694
38924
  const configFile = detected.configFiles[0];
38695
38925
  if (configFile === undefined)
38696
38926
  return [];
38697
- return [import_node_path31.default.dirname(configFile)];
38927
+ return [import_node_path33.default.dirname(configFile)];
38698
38928
  }
38699
38929
  };
38700
38930
  // src/migrate/adapters/np.ts
38701
38931
  var import_node_fs20 = require("node:fs");
38702
- var import_node_path32 = __toESM(require("node:path"));
38932
+ var import_node_path34 = __toESM(require("node:path"));
38703
38933
  var import_node_url2 = require("node:url");
38704
38934
  var STANDALONE_CONFIG_FILES = [
38705
38935
  ".np-config.json",
@@ -38804,12 +39034,12 @@ var npAdapter = {
38804
39034
  async detect(cwd) {
38805
39035
  const configFiles = [];
38806
39036
  for (const filename of STANDALONE_CONFIG_FILES) {
38807
- const filePath = import_node_path32.default.join(cwd, filename);
39037
+ const filePath = import_node_path34.default.join(cwd, filename);
38808
39038
  if (import_node_fs20.existsSync(filePath)) {
38809
39039
  configFiles.push(filePath);
38810
39040
  }
38811
39041
  }
38812
- const pkgJsonPath = import_node_path32.default.join(cwd, PACKAGE_JSON);
39042
+ const pkgJsonPath = import_node_path34.default.join(cwd, PACKAGE_JSON);
38813
39043
  if (import_node_fs20.existsSync(pkgJsonPath)) {
38814
39044
  try {
38815
39045
  const raw = import_node_fs20.readFileSync(pkgJsonPath, "utf-8");
@@ -38826,8 +39056,8 @@ var npAdapter = {
38826
39056
  };
38827
39057
  },
38828
39058
  async parse(files, _cwd) {
38829
- const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES.some((name) => f2.endsWith(import_node_path32.default.sep + name) || f2.endsWith(`/${name}`)));
38830
- const pkgJsonFile = files.find((f2) => f2.endsWith(import_node_path32.default.sep + PACKAGE_JSON) || f2.endsWith(`/${PACKAGE_JSON}`));
39059
+ const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES.some((name) => f2.endsWith(import_node_path34.default.sep + name) || f2.endsWith(`/${name}`)));
39060
+ const pkgJsonFile = files.find((f2) => f2.endsWith(import_node_path34.default.sep + PACKAGE_JSON) || f2.endsWith(`/${PACKAGE_JSON}`));
38831
39061
  const configFile = standaloneFile ?? pkgJsonFile;
38832
39062
  if (configFile === undefined) {
38833
39063
  return {
@@ -38846,12 +39076,12 @@ var npAdapter = {
38846
39076
  };
38847
39077
  },
38848
39078
  getCleanupTargets(detected) {
38849
- return detected.configFiles.filter((f2) => !f2.endsWith(import_node_path32.default.sep + PACKAGE_JSON) && !f2.endsWith(`/${PACKAGE_JSON}`));
39079
+ return detected.configFiles.filter((f2) => !f2.endsWith(import_node_path34.default.sep + PACKAGE_JSON) && !f2.endsWith(`/${PACKAGE_JSON}`));
38850
39080
  }
38851
39081
  };
38852
39082
  // src/migrate/adapters/release-it.ts
38853
39083
  var import_node_fs21 = require("node:fs");
38854
- var import_node_path33 = __toESM(require("node:path"));
39084
+ var import_node_path35 = __toESM(require("node:path"));
38855
39085
  var import_node_url3 = require("node:url");
38856
39086
  var import_yaml4 = __toESM(require_dist(), 1);
38857
39087
  var STANDALONE_CONFIG_FILES2 = [
@@ -38877,7 +39107,7 @@ async function loadConfigFile(filePath) {
38877
39107
  if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
38878
39108
  return import_yaml4.default.parse(raw);
38879
39109
  }
38880
- if (filePath.endsWith(import_node_path33.default.sep + PACKAGE_JSON2) || filePath.endsWith(`/${PACKAGE_JSON2}`)) {
39110
+ if (filePath.endsWith(import_node_path35.default.sep + PACKAGE_JSON2) || filePath.endsWith(`/${PACKAGE_JSON2}`)) {
38881
39111
  const parsed = JSON.parse(raw);
38882
39112
  return parsed["release-it"] ?? {};
38883
39113
  }
@@ -38992,12 +39222,12 @@ var releaseItAdapter = {
38992
39222
  async detect(cwd) {
38993
39223
  const configFiles = [];
38994
39224
  for (const filename of STANDALONE_CONFIG_FILES2) {
38995
- const filePath = import_node_path33.default.join(cwd, filename);
39225
+ const filePath = import_node_path35.default.join(cwd, filename);
38996
39226
  if (import_node_fs21.existsSync(filePath)) {
38997
39227
  configFiles.push(filePath);
38998
39228
  }
38999
39229
  }
39000
- const pkgJsonPath = import_node_path33.default.join(cwd, PACKAGE_JSON2);
39230
+ const pkgJsonPath = import_node_path35.default.join(cwd, PACKAGE_JSON2);
39001
39231
  if (import_node_fs21.existsSync(pkgJsonPath)) {
39002
39232
  try {
39003
39233
  const raw = import_node_fs21.readFileSync(pkgJsonPath, "utf-8");
@@ -39014,8 +39244,8 @@ var releaseItAdapter = {
39014
39244
  };
39015
39245
  },
39016
39246
  async parse(files, _cwd) {
39017
- const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES2.some((name) => f2.endsWith(import_node_path33.default.sep + name) || f2.endsWith(`/${name}`)));
39018
- const pkgJsonFile = files.find((f2) => f2.endsWith(import_node_path33.default.sep + PACKAGE_JSON2) || f2.endsWith(`/${PACKAGE_JSON2}`));
39247
+ const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES2.some((name) => f2.endsWith(import_node_path35.default.sep + name) || f2.endsWith(`/${name}`)));
39248
+ const pkgJsonFile = files.find((f2) => f2.endsWith(import_node_path35.default.sep + PACKAGE_JSON2) || f2.endsWith(`/${PACKAGE_JSON2}`));
39019
39249
  const configFile = standaloneFile ?? pkgJsonFile;
39020
39250
  if (configFile === undefined) {
39021
39251
  return {
@@ -39045,12 +39275,12 @@ var releaseItAdapter = {
39045
39275
  };
39046
39276
  },
39047
39277
  getCleanupTargets(detected) {
39048
- return detected.configFiles.filter((f2) => !f2.endsWith(import_node_path33.default.sep + PACKAGE_JSON2) && !f2.endsWith(`/${PACKAGE_JSON2}`));
39278
+ return detected.configFiles.filter((f2) => !f2.endsWith(import_node_path35.default.sep + PACKAGE_JSON2) && !f2.endsWith(`/${PACKAGE_JSON2}`));
39049
39279
  }
39050
39280
  };
39051
39281
  // src/migrate/adapters/semantic-release.ts
39052
39282
  var import_node_fs22 = require("node:fs");
39053
- var import_node_path34 = __toESM(require("node:path"));
39283
+ var import_node_path36 = __toESM(require("node:path"));
39054
39284
  var import_node_url4 = require("node:url");
39055
39285
  var import_yaml5 = __toESM(require_dist(), 1);
39056
39286
  var STANDALONE_CONFIG_FILES3 = [
@@ -39141,11 +39371,11 @@ async function loadConfigFile2(filePath) {
39141
39371
  if (filePath.endsWith(".yaml") || filePath.endsWith(".yml")) {
39142
39372
  return import_yaml5.default.parse(raw);
39143
39373
  }
39144
- if (filePath.endsWith(import_node_path34.default.sep + PACKAGE_JSON3) || filePath.endsWith(`/${PACKAGE_JSON3}`)) {
39374
+ if (filePath.endsWith(import_node_path36.default.sep + PACKAGE_JSON3) || filePath.endsWith(`/${PACKAGE_JSON3}`)) {
39145
39375
  const parsed = JSON.parse(raw);
39146
39376
  return parsed.release ?? {};
39147
39377
  }
39148
- const basename4 = import_node_path34.default.basename(filePath);
39378
+ const basename4 = import_node_path36.default.basename(filePath);
39149
39379
  if (basename4 === ".releaserc") {
39150
39380
  try {
39151
39381
  return JSON.parse(raw);
@@ -39255,12 +39485,12 @@ var semanticReleaseAdapter = {
39255
39485
  async detect(cwd) {
39256
39486
  const configFiles = [];
39257
39487
  for (const filename of STANDALONE_CONFIG_FILES3) {
39258
- const filePath = import_node_path34.default.join(cwd, filename);
39488
+ const filePath = import_node_path36.default.join(cwd, filename);
39259
39489
  if (import_node_fs22.existsSync(filePath)) {
39260
39490
  configFiles.push(filePath);
39261
39491
  }
39262
39492
  }
39263
- const pkgJsonPath = import_node_path34.default.join(cwd, PACKAGE_JSON3);
39493
+ const pkgJsonPath = import_node_path36.default.join(cwd, PACKAGE_JSON3);
39264
39494
  if (import_node_fs22.existsSync(pkgJsonPath)) {
39265
39495
  try {
39266
39496
  const raw = import_node_fs22.readFileSync(pkgJsonPath, "utf-8");
@@ -39277,8 +39507,8 @@ var semanticReleaseAdapter = {
39277
39507
  };
39278
39508
  },
39279
39509
  async parse(files, _cwd) {
39280
- const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES3.some((name) => f2.endsWith(import_node_path34.default.sep + name) || f2.endsWith(`/${name}`)));
39281
- const pkgJsonFile = files.find((f2) => f2.endsWith(import_node_path34.default.sep + PACKAGE_JSON3) || f2.endsWith(`/${PACKAGE_JSON3}`));
39510
+ const standaloneFile = files.find((f2) => STANDALONE_CONFIG_FILES3.some((name) => f2.endsWith(import_node_path36.default.sep + name) || f2.endsWith(`/${name}`)));
39511
+ const pkgJsonFile = files.find((f2) => f2.endsWith(import_node_path36.default.sep + PACKAGE_JSON3) || f2.endsWith(`/${PACKAGE_JSON3}`));
39282
39512
  const configFile = standaloneFile ?? pkgJsonFile;
39283
39513
  if (configFile === undefined) {
39284
39514
  return {
@@ -39296,12 +39526,12 @@ var semanticReleaseAdapter = {
39296
39526
  };
39297
39527
  },
39298
39528
  getCleanupTargets(detected) {
39299
- return detected.configFiles.filter((f2) => !f2.endsWith(import_node_path34.default.sep + PACKAGE_JSON3) && !f2.endsWith(`/${PACKAGE_JSON3}`));
39529
+ return detected.configFiles.filter((f2) => !f2.endsWith(import_node_path36.default.sep + PACKAGE_JSON3) && !f2.endsWith(`/${PACKAGE_JSON3}`));
39300
39530
  }
39301
39531
  };
39302
39532
  // src/migrate/ci-advisor.ts
39303
39533
  var import_node_fs23 = require("node:fs");
39304
- var import_node_path35 = require("node:path");
39534
+ var import_node_path37 = require("node:path");
39305
39535
  var CI_PATTERNS = {
39306
39536
  "semantic-release": [
39307
39537
  /npx\s+semantic-release/,
@@ -39321,7 +39551,7 @@ var CI_PATTERNS = {
39321
39551
  np: [/npx\s+np\b/, /yarn\s+np\b/]
39322
39552
  };
39323
39553
  function scanCiWorkflows(cwd, source) {
39324
- const workflowsDir = import_node_path35.join(cwd, ".github", "workflows");
39554
+ const workflowsDir = import_node_path37.join(cwd, ".github", "workflows");
39325
39555
  if (!import_node_fs23.existsSync(workflowsDir))
39326
39556
  return [];
39327
39557
  const patterns = CI_PATTERNS[source];
@@ -39330,7 +39560,7 @@ function scanCiWorkflows(cwd, source) {
39330
39560
  for (const filename of files) {
39331
39561
  if (!filename.endsWith(".yml") && !filename.endsWith(".yaml"))
39332
39562
  continue;
39333
- const filePath = import_node_path35.join(workflowsDir, filename);
39563
+ const filePath = import_node_path37.join(workflowsDir, filename);
39334
39564
  const content = import_node_fs23.readFileSync(filePath, "utf-8");
39335
39565
  for (const line of content.split(`
39336
39566
  `)) {
@@ -39573,7 +39803,7 @@ async function detectMigrationSources(cwd, adapters, from) {
39573
39803
  }
39574
39804
  // src/migrate/pipeline.ts
39575
39805
  var import_node_fs25 = require("node:fs");
39576
- var import_node_path36 = require("node:path");
39806
+ var import_node_path38 = require("node:path");
39577
39807
  async function executeMigration(options) {
39578
39808
  const { adapter, detected, cwd, dryRun, clean } = options;
39579
39809
  const parsed = await adapter.parse(detected.configFiles, cwd);
@@ -39582,7 +39812,7 @@ async function executeMigration(options) {
39582
39812
  const configString = generateConfigString(convertResult.config);
39583
39813
  const ciAdvice = scanCiWorkflows(cwd, adapter.name);
39584
39814
  if (!dryRun) {
39585
- const outFile = import_node_path36.join(cwd, "pubm.config.ts");
39815
+ const outFile = import_node_path38.join(cwd, "pubm.config.ts");
39586
39816
  if (import_node_fs25.existsSync(outFile)) {
39587
39817
  throw new Error("pubm.config.ts already exists. Remove or rename it before migrating.");
39588
39818
  }
@@ -39647,12 +39877,12 @@ function topologicalSort(graph) {
39647
39877
  return sorted.reverse();
39648
39878
  }
39649
39879
  // src/monorepo/groups.ts
39650
- var import_micromatch4 = __toESM(require_micromatch(), 1);
39880
+ var import_micromatch5 = __toESM(require_micromatch(), 1);
39651
39881
  function resolveGroups(groups, allPackages) {
39652
39882
  return groups.map((group) => {
39653
39883
  const resolved = new Set;
39654
39884
  for (const pattern of group) {
39655
- const matches = import_micromatch4.default(allPackages, pattern);
39885
+ const matches = import_micromatch5.default(allPackages, pattern);
39656
39886
  for (const match of matches) {
39657
39887
  resolved.add(match);
39658
39888
  }
@@ -39717,8 +39947,8 @@ init_catalog();
39717
39947
 
39718
39948
  // src/tasks/prompts/independent-mode.ts
39719
39949
  init_dist2();
39720
- init_i18n();
39721
39950
  var import_semver9 = __toESM(require_semver2(), 1);
39951
+ init_i18n();
39722
39952
 
39723
39953
  // src/utils/filter-config.ts
39724
39954
  function filterConfigPackages(ctx, publishPaths) {
@@ -39849,7 +40079,7 @@ class ChangesetSource {
39849
40079
  }
39850
40080
  }
39851
40081
  // src/version-source/conventional-commit-source.ts
39852
- var import_node_path37 = __toESM(require("node:path"));
40082
+ var import_node_path39 = __toESM(require("node:path"));
39853
40083
  class ConventionalCommitSource {
39854
40084
  name = "conventional-commit";
39855
40085
  typeOverrides;
@@ -39860,7 +40090,7 @@ class ConventionalCommitSource {
39860
40090
  const packagePaths = [...context.packages.keys()];
39861
40091
  const recommendations = [];
39862
40092
  for (const packagePath of packagePaths) {
39863
- const packageName = import_node_path37.default.basename(packagePath);
40093
+ const packageName = import_node_path39.default.basename(packagePath);
39864
40094
  const ref = findLastReleaseRef(context.cwd, packageName);
39865
40095
  const rawCommits = getCommitsSinceRef(context.cwd, ref);
39866
40096
  const parsed = [];
@@ -40091,7 +40321,7 @@ async function handleMultiPackage(ctx, task, packageInfos) {
40091
40321
  const graph = buildGraphFromPackages(packageInfos);
40092
40322
  const currentVersions = new Map(packageInfos.map((p2) => [p2.path, p2.version]));
40093
40323
  const recommendations = await analyzeAllSources(ctx);
40094
- if (!ctx.runtime.promptEnabled && recommendations.length > 0) {
40324
+ if (m && recommendations.length > 0) {
40095
40325
  const packages = new Map;
40096
40326
  for (const rec of recommendations) {
40097
40327
  const current = currentVersions.get(rec.packagePath);
@@ -40263,8 +40493,8 @@ async function handleIndependentMode(ctx, task, packageInfos, currentVersions, g
40263
40493
 
40264
40494
  // src/tasks/prompts/single-package.ts
40265
40495
  init_dist2();
40266
- init_i18n();
40267
40496
  var import_semver10 = __toESM(require_semver2(), 1);
40497
+ init_i18n();
40268
40498
  async function handleSinglePackage(ctx, task) {
40269
40499
  const pkg = ctx.config.packages[0];
40270
40500
  const currentVersion = pkg?.version ?? "0.0.0";
@@ -40273,7 +40503,7 @@ async function handleSinglePackage(ctx, task) {
40273
40503
  if (rec) {
40274
40504
  const newVer = import_semver10.default.inc(currentVersion, rec.bumpType);
40275
40505
  if (newVer) {
40276
- if (!ctx.runtime.promptEnabled) {
40506
+ if (m) {
40277
40507
  ctx.runtime.versionPlan = {
40278
40508
  mode: "single",
40279
40509
  version: newVer,
@@ -40606,33 +40836,33 @@ init_exec();
40606
40836
  var import_child_process = require("child_process");
40607
40837
  var import_child_process2 = require("child_process");
40608
40838
  var import_fs = require("fs");
40609
- var import_promises10 = __toESM(require("fs/promises"));
40839
+ var import_promises9 = __toESM(require("fs/promises"));
40610
40840
  var import_path = __toESM(require("path"));
40611
40841
  var import_stream2 = require("stream");
40612
- var import_promises11 = require("stream/promises");
40842
+ var import_promises10 = require("stream/promises");
40613
40843
  var import_util6 = require("util");
40614
- var import_promises12 = __toESM(require("fs/promises"));
40844
+ var import_promises11 = __toESM(require("fs/promises"));
40615
40845
  var import_crypto2 = __toESM(require("crypto"));
40616
40846
  var import_fs2 = require("fs");
40617
40847
  var import_crypto3 = __toESM(require("crypto"));
40618
40848
  var import_semver12 = __toESM(require_semver2(), 1);
40619
- var import_promises13 = __toESM(require("fs/promises"));
40849
+ var import_promises12 = __toESM(require("fs/promises"));
40620
40850
  var import_path2 = __toESM(require("path"));
40621
40851
  var import_semver13 = __toESM(require_semver2(), 1);
40622
40852
  var import_semver14 = __toESM(require_semver2(), 1);
40623
- var import_promises14 = require("fs/promises");
40853
+ var import_promises13 = require("fs/promises");
40624
40854
  var import_child_process3 = require("child_process");
40625
40855
  var import_util7 = require("util");
40626
40856
  var import_child_process4 = require("child_process");
40627
- var import_promises15 = require("fs/promises");
40857
+ var import_promises14 = require("fs/promises");
40628
40858
  var import_util8 = require("util");
40629
- var import_promises16 = require("fs/promises");
40859
+ var import_promises15 = require("fs/promises");
40630
40860
  var import_os2 = require("os");
40631
40861
  var import_path3 = require("path");
40632
40862
  var import_os3 = __toESM(require("os"));
40633
40863
  var import_path4 = __toESM(require("path"));
40634
40864
  var import_fs3 = require("fs");
40635
- var import_promises17 = require("fs/promises");
40865
+ var import_promises16 = require("fs/promises");
40636
40866
  var import_path5 = require("path");
40637
40867
  var import_url = require("url");
40638
40868
  var DEFAULT_CHECK_INTERVAL_MS = 72000000;
@@ -40827,7 +41057,7 @@ function isBrewAlreadyInstalled(stdout, stderr) {
40827
41057
  }
40828
41058
  async function atomicReplace(newPath, targetPath) {
40829
41059
  try {
40830
- await import_promises12.default.access(targetPath, import_promises12.default.constants.W_OK);
41060
+ await import_promises11.default.access(targetPath, import_promises11.default.constants.W_OK);
40831
41061
  } catch {
40832
41062
  throw new UpdateKitError(PERMISSION_DENIED, `No write permission: ${targetPath}. Run with appropriate permissions.`);
40833
41063
  }
@@ -40840,12 +41070,12 @@ async function atomicReplace(newPath, targetPath) {
40840
41070
  async function unixReplace(newPath, targetPath) {
40841
41071
  const tmpInPlace = `${targetPath}.new.${process.pid}`;
40842
41072
  try {
40843
- await import_promises12.default.copyFile(newPath, tmpInPlace);
40844
- await import_promises12.default.chmod(tmpInPlace, 493);
40845
- await import_promises12.default.rename(tmpInPlace, targetPath);
41073
+ await import_promises11.default.copyFile(newPath, tmpInPlace);
41074
+ await import_promises11.default.chmod(tmpInPlace, 493);
41075
+ await import_promises11.default.rename(tmpInPlace, targetPath);
40846
41076
  } catch (error4) {
40847
41077
  try {
40848
- await import_promises12.default.unlink(tmpInPlace);
41078
+ await import_promises11.default.unlink(tmpInPlace);
40849
41079
  } catch {}
40850
41080
  throw error4;
40851
41081
  }
@@ -40853,21 +41083,21 @@ async function unixReplace(newPath, targetPath) {
40853
41083
  async function windowsReplace(newPath, targetPath) {
40854
41084
  const backupPath = `${targetPath}.old`;
40855
41085
  try {
40856
- await import_promises12.default.unlink(backupPath);
41086
+ await import_promises11.default.unlink(backupPath);
40857
41087
  } catch {}
40858
- await import_promises12.default.rename(targetPath, backupPath);
41088
+ await import_promises11.default.rename(targetPath, backupPath);
40859
41089
  try {
40860
- await import_promises12.default.copyFile(newPath, targetPath);
41090
+ await import_promises11.default.copyFile(newPath, targetPath);
40861
41091
  } catch (copyError) {
40862
41092
  try {
40863
- await import_promises12.default.rename(backupPath, targetPath);
41093
+ await import_promises11.default.rename(backupPath, targetPath);
40864
41094
  } catch (rollbackError) {
40865
41095
  throw new UpdateKitError(APPLY_FAILED, `Update failed and rollback also failed. Original binary may be at ${backupPath}. Copy error: ${copyError instanceof Error ? copyError.message : String(copyError)}. Rollback error: ${rollbackError instanceof Error ? rollbackError.message : String(rollbackError)}.`);
40866
41096
  }
40867
41097
  throw copyError;
40868
41098
  }
40869
41099
  try {
40870
- await import_promises12.default.unlink(backupPath);
41100
+ await import_promises11.default.unlink(backupPath);
40871
41101
  } catch {}
40872
41102
  }
40873
41103
  async function fetchWithTimeout(url, options = {}) {
@@ -41052,12 +41282,12 @@ async function downloadArtifact(url, tmpDir, options) {
41052
41282
  totalBytes
41053
41283
  });
41054
41284
  });
41055
- await import_promises11.pipeline(nodeStream, writeStream);
41285
+ await import_promises10.pipeline(nodeStream, writeStream);
41056
41286
  return destPath;
41057
41287
  }
41058
41288
  async function extractBinary(archivePath, tmpDir) {
41059
41289
  const extractDir = import_path.default.join(tmpDir, "extracted");
41060
- await import_promises10.default.mkdir(extractDir, { recursive: true });
41290
+ await import_promises9.default.mkdir(extractDir, { recursive: true });
41061
41291
  if (archivePath.endsWith(".tar.gz") || archivePath.endsWith(".tgz")) {
41062
41292
  try {
41063
41293
  await execFileAsync("tar", ["xzf", archivePath, "-C", extractDir]);
@@ -41084,14 +41314,14 @@ async function extractBinary(archivePath, tmpDir) {
41084
41314
  }
41085
41315
  } else {
41086
41316
  const destPath = import_path.default.join(extractDir, import_path.default.basename(archivePath));
41087
- await import_promises10.default.copyFile(archivePath, destPath);
41317
+ await import_promises9.default.copyFile(archivePath, destPath);
41088
41318
  return destPath;
41089
41319
  }
41090
41320
  return findBinaryInDir(extractDir);
41091
41321
  }
41092
41322
  async function findBinaryInDir(dir) {
41093
- const resolvedDir = await import_promises10.default.realpath(dir);
41094
- const entries = await import_promises10.default.readdir(dir, {
41323
+ const resolvedDir = await import_promises9.default.realpath(dir);
41324
+ const entries = await import_promises9.default.readdir(dir, {
41095
41325
  withFileTypes: true,
41096
41326
  recursive: true
41097
41327
  });
@@ -41102,7 +41332,7 @@ async function findBinaryInDir(dir) {
41102
41332
  const parentDir = e3.parentPath ?? ("path" in e3 ? e3.path : dir);
41103
41333
  const filePath = import_path.default.join(parentDir, e3.name);
41104
41334
  try {
41105
- const resolvedFile = await import_promises10.default.realpath(filePath);
41335
+ const resolvedFile = await import_promises9.default.realpath(filePath);
41106
41336
  if (!resolvedFile.startsWith(resolvedDir + import_path.default.sep) && resolvedFile !== resolvedDir) {
41107
41337
  continue;
41108
41338
  }
@@ -41119,7 +41349,7 @@ async function findBinaryInDir(dir) {
41119
41349
  }
41120
41350
  for (const file of files) {
41121
41351
  try {
41122
- await import_promises10.default.access(file, import_promises10.default.constants.X_OK);
41352
+ await import_promises9.default.access(file, import_promises9.default.constants.X_OK);
41123
41353
  return file;
41124
41354
  } catch {}
41125
41355
  }
@@ -41151,16 +41381,16 @@ function extractFilename(url) {
41151
41381
  async function createTempDir(targetPath) {
41152
41382
  const targetDir = import_path.default.dirname(targetPath);
41153
41383
  const tmpDir = import_path.default.join(targetDir, `.update-kit-tmp-${process.pid}-${Date.now()}`);
41154
- await import_promises10.default.mkdir(tmpDir, { recursive: true });
41384
+ await import_promises9.default.mkdir(tmpDir, { recursive: true });
41155
41385
  return tmpDir;
41156
41386
  }
41157
41387
  async function cleanupTempDir(tmpDir) {
41158
41388
  try {
41159
- await import_promises10.default.rm(tmpDir, { recursive: true, force: true });
41389
+ await import_promises9.default.rm(tmpDir, { recursive: true, force: true });
41160
41390
  } catch {}
41161
41391
  }
41162
41392
  async function setExecutablePermission(filePath) {
41163
- await import_promises10.default.chmod(filePath, 493);
41393
+ await import_promises9.default.chmod(filePath, 493);
41164
41394
  }
41165
41395
  function getCachePath(cacheDir, appName) {
41166
41396
  return import_path2.default.join(cacheDir, appName, "update-check.json");
@@ -41168,7 +41398,7 @@ function getCachePath(cacheDir, appName) {
41168
41398
  async function readCache(cacheDir, appName) {
41169
41399
  const filePath = getCachePath(cacheDir, appName);
41170
41400
  try {
41171
- const raw = await import_promises13.default.readFile(filePath, "utf-8");
41401
+ const raw = await import_promises12.default.readFile(filePath, "utf-8");
41172
41402
  const parsed = JSON.parse(raw);
41173
41403
  if (typeof parsed.latestVersion !== "string" || typeof parsed.currentVersionAtCheck !== "string" || typeof parsed.lastCheckedAt !== "string" || typeof parsed.source !== "string") {
41174
41404
  return null;
@@ -41184,16 +41414,16 @@ async function readCache(cacheDir, appName) {
41184
41414
  async function writeCache(cacheDir, appName, entry) {
41185
41415
  const filePath = getCachePath(cacheDir, appName);
41186
41416
  const dir = import_path2.default.dirname(filePath);
41187
- await import_promises13.default.mkdir(dir, { recursive: true });
41417
+ await import_promises12.default.mkdir(dir, { recursive: true });
41188
41418
  const tmpPath = `${filePath}.${process.pid}-${Date.now()}.tmp`;
41189
41419
  try {
41190
41420
  const data = `${JSON.stringify(entry, null, 2)}
41191
41421
  `;
41192
- await import_promises13.default.writeFile(tmpPath, data, "utf-8");
41193
- await import_promises13.default.rename(tmpPath, filePath);
41422
+ await import_promises12.default.writeFile(tmpPath, data, "utf-8");
41423
+ await import_promises12.default.rename(tmpPath, filePath);
41194
41424
  } catch (error4) {
41195
41425
  try {
41196
- await import_promises13.default.unlink(tmpPath);
41426
+ await import_promises12.default.unlink(tmpPath);
41197
41427
  } catch {}
41198
41428
  throw new UpdateKitError(CACHE_ERROR, `Failed to write cache for ${appName}: ${error4 instanceof Error ? error4.message : String(error4)}`, { cause: error4 instanceof Error ? error4 : undefined });
41199
41429
  }
@@ -41877,9 +42107,9 @@ async function detectFromNpm(execPath) {
41877
42107
  }
41878
42108
  } catch {}
41879
42109
  try {
41880
- const stats = await import_promises15.lstat(execPath);
42110
+ const stats = await import_promises14.lstat(execPath);
41881
42111
  if (stats.isSymbolicLink()) {
41882
- const target = await import_promises15.readlink(execPath);
42112
+ const target = await import_promises14.readlink(execPath);
41883
42113
  if (target.includes("node_modules")) {
41884
42114
  evidence.push({
41885
42115
  source: "symlink",
@@ -41902,7 +42132,7 @@ async function detectFromReceipt(config, receiptDir) {
41902
42132
  const dir = receiptDir ?? import_path3.join(import_os2.homedir(), ".config", config.appName);
41903
42133
  const receiptPath = import_path3.join(dir, "install-receipt.json");
41904
42134
  try {
41905
- const content = await import_promises16.readFile(receiptPath, "utf-8");
42135
+ const content = await import_promises15.readFile(receiptPath, "utf-8");
41906
42136
  const receipt = JSON.parse(content);
41907
42137
  if (receipt.appName !== config.appName) {
41908
42138
  return null;
@@ -41924,7 +42154,7 @@ async function detectFromReceipt(config, receiptDir) {
41924
42154
  async function detectInstall(execPath, config) {
41925
42155
  let resolvedPath;
41926
42156
  try {
41927
- resolvedPath = await import_promises14.realpath(execPath);
42157
+ resolvedPath = await import_promises13.realpath(execPath);
41928
42158
  } catch {
41929
42159
  resolvedPath = execPath;
41930
42160
  }
@@ -42195,7 +42425,7 @@ async function findPackageJson(startDir) {
42195
42425
  for (;; ) {
42196
42426
  const candidate = import_path5.join(current, "package.json");
42197
42427
  try {
42198
- const content = await import_promises17.readFile(candidate, "utf-8");
42428
+ const content = await import_promises16.readFile(candidate, "utf-8");
42199
42429
  const result = parsePackageJson(content, candidate);
42200
42430
  if (result)
42201
42431
  return result;
@@ -42622,10 +42852,10 @@ init_ui();
42622
42852
 
42623
42853
  // src/validate/entry-points.ts
42624
42854
  var import_node_fs26 = require("node:fs");
42625
- var import_node_path38 = __toESM(require("node:path"));
42855
+ var import_node_path40 = __toESM(require("node:path"));
42626
42856
  var SIMPLE_FIELDS = ["main", "module", "types", "typings"];
42627
42857
  function checkPath(filePath, cwd) {
42628
- return import_node_fs26.existsSync(import_node_path38.default.resolve(cwd, filePath));
42858
+ return import_node_fs26.existsSync(import_node_path40.default.resolve(cwd, filePath));
42629
42859
  }
42630
42860
  function validateExports(exports2, cwd, prefix = "exports") {
42631
42861
  const errors = [];
@@ -42675,7 +42905,7 @@ function validateEntryPoints(pkg, cwd) {
42675
42905
  return errors;
42676
42906
  }
42677
42907
  // src/validate/extraneous-files.ts
42678
- var import_micromatch5 = __toESM(require_micromatch(), 1);
42908
+ var import_micromatch6 = __toESM(require_micromatch(), 1);
42679
42909
  var PATTERNS = [
42680
42910
  {
42681
42911
  pattern: [".env", ".env.*"],
@@ -42713,7 +42943,7 @@ function detectExtraneousFiles(files) {
42713
42943
  const seen = new Set;
42714
42944
  for (const { pattern, reason, basename: basename4 } of PATTERNS) {
42715
42945
  const options = basename4 ? { basename: true } : {};
42716
- const matched = import_micromatch5.default(files, pattern, options);
42946
+ const matched = import_micromatch6.default(files, pattern, options);
42717
42947
  for (const file of matched) {
42718
42948
  if (!seen.has(file)) {
42719
42949
  seen.add(file);