@pubm/core 0.4.4 → 0.4.5

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
@@ -20263,6 +20263,10 @@ __export(exports_src, {
20263
20263
  module.exports = __toCommonJS(exports_src);
20264
20264
 
20265
20265
  // src/plugin/runner.ts
20266
+ function isDefined(value) {
20267
+ return value !== undefined;
20268
+ }
20269
+
20266
20270
  class PluginRunner {
20267
20271
  plugins;
20268
20272
  constructor(plugins) {
@@ -20300,7 +20304,7 @@ class PluginRunner {
20300
20304
  }
20301
20305
  collectAssetHooks() {
20302
20306
  const collected = {};
20303
- const resolveChain = this.plugins.map((p) => p.hooks?.resolveAssets).filter(Boolean);
20307
+ const resolveChain = this.plugins.map((p) => p.hooks?.resolveAssets).filter(isDefined);
20304
20308
  if (resolveChain.length > 0) {
20305
20309
  collected.resolveAssets = async (assets, ctx) => {
20306
20310
  let result = assets;
@@ -20310,7 +20314,7 @@ class PluginRunner {
20310
20314
  return result;
20311
20315
  };
20312
20316
  }
20313
- const transformChain = this.plugins.map((p) => p.hooks?.transformAsset).filter(Boolean);
20317
+ const transformChain = this.plugins.map((p) => p.hooks?.transformAsset).filter(isDefined);
20314
20318
  if (transformChain.length > 0) {
20315
20319
  collected.transformAsset = async (asset, ctx) => {
20316
20320
  let items = [asset];
@@ -20325,17 +20329,18 @@ class PluginRunner {
20325
20329
  return items.length === 1 ? items[0] : items;
20326
20330
  };
20327
20331
  }
20328
- const compressChain = this.plugins.map((p) => p.hooks?.compressAsset).filter(Boolean);
20332
+ const compressChain = this.plugins.map((p) => p.hooks?.compressAsset).filter(isDefined);
20329
20333
  if (compressChain.length > 0) {
20330
20334
  collected.compressAsset = async (asset, ctx) => {
20331
- let result = asset;
20332
- for (const hook of compressChain) {
20335
+ const [firstHook, ...restHooks] = compressChain;
20336
+ let result = await firstHook(asset, ctx);
20337
+ for (const hook of restHooks) {
20333
20338
  result = await hook(result, ctx);
20334
20339
  }
20335
20340
  return result;
20336
20341
  };
20337
20342
  }
20338
- const nameChain = this.plugins.map((p) => p.hooks?.nameAsset).filter(Boolean);
20343
+ const nameChain = this.plugins.map((p) => p.hooks?.nameAsset).filter(isDefined);
20339
20344
  if (nameChain.length > 0) {
20340
20345
  collected.nameAsset = (asset, ctx) => {
20341
20346
  let result = "";
@@ -20345,7 +20350,7 @@ class PluginRunner {
20345
20350
  return result;
20346
20351
  };
20347
20352
  }
20348
- const checksumChain = this.plugins.map((p) => p.hooks?.generateChecksums).filter(Boolean);
20353
+ const checksumChain = this.plugins.map((p) => p.hooks?.generateChecksums).filter(isDefined);
20349
20354
  if (checksumChain.length > 0) {
20350
20355
  collected.generateChecksums = async (assets, ctx) => {
20351
20356
  let result = assets;
@@ -20355,7 +20360,7 @@ class PluginRunner {
20355
20360
  return result;
20356
20361
  };
20357
20362
  }
20358
- const uploadHooks = this.plugins.map((p) => p.hooks?.uploadAssets).filter(Boolean);
20363
+ const uploadHooks = this.plugins.map((p) => p.hooks?.uploadAssets).filter(isDefined);
20359
20364
  if (uploadHooks.length > 0) {
20360
20365
  collected.uploadAssets = async (assets, ctx) => {
20361
20366
  const allResults = [];
@@ -20371,7 +20376,7 @@ class PluginRunner {
20371
20376
  }
20372
20377
 
20373
20378
  // src/tasks/runner.ts
20374
- var import_node_fs11 = require("node:fs");
20379
+ var import_node_fs13 = require("node:fs");
20375
20380
  var import_node_os4 = require("node:os");
20376
20381
  var import_node_path20 = __toESM(require("node:path"));
20377
20382
  var import_node_process15 = __toESM(require("node:process"));
@@ -22967,6 +22972,7 @@ function createKeyResolver(packages) {
22967
22972
  }
22968
22973
 
22969
22974
  // src/ecosystem/js.ts
22975
+ var import_node_fs7 = require("node:fs");
22970
22976
  var import_promises4 = require("node:fs/promises");
22971
22977
  var import_node_path11 = __toESM(require("node:path"));
22972
22978
 
@@ -23071,7 +23077,7 @@ function isValidPackageName(packageName) {
23071
23077
  // package.json
23072
23078
  var package_default = {
23073
23079
  name: "@pubm/core",
23074
- version: "0.4.4",
23080
+ version: "0.4.5",
23075
23081
  type: "module",
23076
23082
  description: "Core SDK for pubm - publish manager for multiple registries",
23077
23083
  types: "./dist/index.d.ts",
@@ -23145,7 +23151,7 @@ var coreEngines = package_default.engines ?? {};
23145
23151
  function resolveDefine(injected, fallback) {
23146
23152
  return typeof injected === "string" ? injected : fallback;
23147
23153
  }
23148
- var PUBM_VERSION = resolveDefine("0.4.4", package_default.version);
23154
+ var PUBM_VERSION = resolveDefine("0.4.5", package_default.version);
23149
23155
  var PUBM_ENGINES = {
23150
23156
  node: resolveDefine(">=24", coreEngines.node ?? ">=18"),
23151
23157
  git: resolveDefine(">=2.11.0", coreEngines.git ?? ">=2.11.0"),
@@ -24139,6 +24145,8 @@ async function getPackageManager() {
24139
24145
  }
24140
24146
 
24141
24147
  // src/ecosystem/ecosystem.ts
24148
+ var import_node_fs6 = require("node:fs");
24149
+
24142
24150
  class Ecosystem {
24143
24151
  packagePath;
24144
24152
  constructor(packagePath) {
@@ -24182,6 +24190,14 @@ class Ecosystem {
24182
24190
  async syncLockfile() {
24183
24191
  return;
24184
24192
  }
24193
+ async resolvePublishDependencies(_workspaceVersions) {
24194
+ return new Map;
24195
+ }
24196
+ restorePublishDependencies(backups) {
24197
+ for (const [filePath, content] of backups) {
24198
+ import_node_fs6.writeFileSync(filePath, content, "utf-8");
24199
+ }
24200
+ }
24185
24201
  }
24186
24202
 
24187
24203
  // src/ecosystem/descriptor.ts
@@ -24252,6 +24268,48 @@ class JsEcosystem extends Ecosystem {
24252
24268
  supportedRegistries() {
24253
24269
  return ["npm", "jsr"];
24254
24270
  }
24271
+ async resolvePublishDependencies(workspaceVersions) {
24272
+ const backups = new Map;
24273
+ const manifestPath = import_node_path11.default.join(this.packagePath, "package.json");
24274
+ if (!import_node_fs7.existsSync(manifestPath))
24275
+ return backups;
24276
+ const original = import_node_fs7.readFileSync(manifestPath, "utf-8");
24277
+ const pkg = JSON.parse(original);
24278
+ let modified = false;
24279
+ const WORKSPACE_PREFIX = "workspace:";
24280
+ const DEPENDENCY_FIELDS = [
24281
+ "dependencies",
24282
+ "devDependencies",
24283
+ "optionalDependencies",
24284
+ "peerDependencies"
24285
+ ];
24286
+ for (const field of DEPENDENCY_FIELDS) {
24287
+ const deps = pkg[field];
24288
+ if (!deps)
24289
+ continue;
24290
+ for (const [depName, spec] of Object.entries(deps)) {
24291
+ if (!spec.startsWith(WORKSPACE_PREFIX))
24292
+ continue;
24293
+ const range = spec.slice(WORKSPACE_PREFIX.length);
24294
+ if (range === "*" || range === "^" || range === "~") {
24295
+ const version = workspaceVersions.get(depName);
24296
+ if (!version) {
24297
+ throw new Error(`Cannot resolve "${spec}" for dependency "${depName}": package not found in workspace`);
24298
+ }
24299
+ deps[depName] = range === "*" ? version : range === "^" ? `^${version}` : `~${version}`;
24300
+ } else {
24301
+ deps[depName] = range;
24302
+ }
24303
+ modified = true;
24304
+ }
24305
+ }
24306
+ if (modified) {
24307
+ backups.set(manifestPath, original);
24308
+ import_node_fs7.writeFileSync(manifestPath, `${JSON.stringify(pkg, null, 2)}
24309
+ `, "utf-8");
24310
+ }
24311
+ return backups;
24312
+ }
24255
24313
  async createDescriptor() {
24256
24314
  const npmReader = NpmPackageRegistry.reader;
24257
24315
  const jsrReader = JsrPackageRegistry.reader;
@@ -25701,11 +25759,11 @@ async function writeVersionsForEcosystem(ecosystems, versions) {
25701
25759
  }
25702
25760
 
25703
25761
  // src/monorepo/resolve-workspace.ts
25704
- var import_node_fs8 = require("node:fs");
25762
+ var import_node_fs10 = require("node:fs");
25705
25763
  var import_node_path17 = require("node:path");
25706
25764
 
25707
25765
  // src/monorepo/discover.ts
25708
- var import_node_fs7 = require("node:fs");
25766
+ var import_node_fs9 = require("node:fs");
25709
25767
  var import_node_path16 = __toESM(require("node:path"));
25710
25768
  var import_micromatch2 = __toESM(require_micromatch(), 1);
25711
25769
 
@@ -25782,6 +25840,9 @@ function normalizeRegistryUrl(url) {
25782
25840
  init_exec();
25783
25841
  class CustomPackageRegistry extends NpmPackageRegistry {
25784
25842
  async npm(args, cwd) {
25843
+ if (!this.registry) {
25844
+ throw new Error("Custom registry URL is required for npm operations.");
25845
+ }
25785
25846
  const { stdout } = await exec3("npm", args.concat("--registry", this.registry), {
25786
25847
  throwOnError: true,
25787
25848
  nodeOptions: cwd ? { cwd } : undefined
@@ -25886,7 +25947,7 @@ registryCatalog.register({
25886
25947
  return token.trim().length >= 32;
25887
25948
  },
25888
25949
  resolveDisplayName: async (ctx) => {
25889
- return ctx.packages?.filter((pkg) => pkg.registries?.includes("crates")).map((pkg) => pkg.path) ?? ["crate"];
25950
+ return ctx.packages?.filter((pkg) => pkg.registries?.includes("crates")).map((pkg) => pkg.name) ?? ["crate"];
25890
25951
  },
25891
25952
  concurrentPublish: false,
25892
25953
  orderPackages: (paths) => sortCratesByDependencyOrder(paths),
@@ -25938,6 +25999,12 @@ async function readJsonSafe(path8) {
25938
25999
  return null;
25939
26000
  }
25940
26001
  }
26002
+ function asRecord(value) {
26003
+ return value !== null && typeof value === "object" ? value : null;
26004
+ }
26005
+ function readString(value) {
26006
+ return typeof value === "string" ? value : undefined;
26007
+ }
25941
26008
  async function readFileSafe(path8) {
25942
26009
  try {
25943
26010
  return await import_promises6.readFile(path8, "utf-8");
@@ -25987,8 +26054,8 @@ async function inferJsRegistries(packagePath, rootPath) {
25987
26054
  return [];
25988
26055
  }
25989
26056
  const packageJson = await readJsonSafe(import_node_path14.join(packagePath, "package.json"));
25990
- const packageName = packageJson?.name;
25991
- const publishConfigRegistry = packageJson?.publishConfig?.registry;
26057
+ const packageName = readString(packageJson?.name);
26058
+ const publishConfigRegistry = readString(asRecord(packageJson?.publishConfig)?.registry);
25992
26059
  let npmRegistryUrl = null;
25993
26060
  if (publishConfigRegistry) {
25994
26061
  npmRegistryUrl = publishConfigRegistry;
@@ -26029,7 +26096,7 @@ async function inferRegistries(packagePath, ecosystemKey, rootPath) {
26029
26096
  }
26030
26097
 
26031
26098
  // src/monorepo/workspace.ts
26032
- var import_node_fs6 = require("node:fs");
26099
+ var import_node_fs8 = require("node:fs");
26033
26100
  var import_node_path15 = require("node:path");
26034
26101
 
26035
26102
  // ../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
@@ -26842,15 +26909,15 @@ function detectWorkspace(cwd) {
26842
26909
  const root = cwd ?? process.cwd();
26843
26910
  const workspaces = [];
26844
26911
  const pnpmWorkspacePath = import_node_path15.join(root, "pnpm-workspace.yaml");
26845
- if (import_node_fs6.existsSync(pnpmWorkspacePath)) {
26846
- const content = import_node_fs6.readFileSync(pnpmWorkspacePath, "utf-8");
26912
+ if (import_node_fs8.existsSync(pnpmWorkspacePath)) {
26913
+ const content = import_node_fs8.readFileSync(pnpmWorkspacePath, "utf-8");
26847
26914
  const parsed = import_yaml2.parse(content);
26848
26915
  const packages = parsed?.packages ?? [];
26849
26916
  workspaces.push({ type: "pnpm", patterns: packages });
26850
26917
  }
26851
26918
  const cargoTomlPath = import_node_path15.join(root, "Cargo.toml");
26852
- if (import_node_fs6.existsSync(cargoTomlPath)) {
26853
- const content = import_node_fs6.readFileSync(cargoTomlPath, "utf-8");
26919
+ if (import_node_fs8.existsSync(cargoTomlPath)) {
26920
+ const content = import_node_fs8.readFileSync(cargoTomlPath, "utf-8");
26854
26921
  try {
26855
26922
  const parsed = parse(content);
26856
26923
  const workspace = parsed.workspace;
@@ -26865,8 +26932,8 @@ function detectWorkspace(cwd) {
26865
26932
  }
26866
26933
  for (const denoFile of ["deno.json", "deno.jsonc"]) {
26867
26934
  const denoPath = import_node_path15.join(root, denoFile);
26868
- if (import_node_fs6.existsSync(denoPath)) {
26869
- const content = import_node_fs6.readFileSync(denoPath, "utf-8");
26935
+ if (import_node_fs8.existsSync(denoPath)) {
26936
+ const content = import_node_fs8.readFileSync(denoPath, "utf-8");
26870
26937
  try {
26871
26938
  const parsed = denoFile.endsWith(".jsonc") ? parse3(content) : JSON.parse(content);
26872
26939
  if (Array.isArray(parsed?.workspace)) {
@@ -26879,12 +26946,12 @@ function detectWorkspace(cwd) {
26879
26946
  }
26880
26947
  if (!workspaces.some((w2) => w2.type === "pnpm")) {
26881
26948
  const packageJsonPath = import_node_path15.join(root, "package.json");
26882
- if (import_node_fs6.existsSync(packageJsonPath)) {
26883
- const content = import_node_fs6.readFileSync(packageJsonPath, "utf-8");
26949
+ if (import_node_fs8.existsSync(packageJsonPath)) {
26950
+ const content = import_node_fs8.readFileSync(packageJsonPath, "utf-8");
26884
26951
  const pkg = JSON.parse(content);
26885
26952
  if (pkg.workspaces) {
26886
26953
  const bunfigPath = import_node_path15.join(root, "bunfig.toml");
26887
- const isBun2 = import_node_fs6.existsSync(bunfigPath);
26954
+ const isBun2 = import_node_fs8.existsSync(bunfigPath);
26888
26955
  if (Array.isArray(pkg.workspaces)) {
26889
26956
  workspaces.push({
26890
26957
  type: isBun2 ? "bun" : "npm",
@@ -26916,16 +26983,32 @@ function matchesIgnore(pkgPath, ignorePatterns) {
26916
26983
  return regex3.test(normalized);
26917
26984
  });
26918
26985
  }
26919
- function resolvePatterns(cwd, patterns) {
26920
- const entries = import_node_fs7.readdirSync(cwd, { recursive: true, encoding: "utf-8" });
26921
- const dirs = entries.filter((entry) => {
26922
- const fullPath = import_node_path16.default.join(cwd, entry);
26986
+ function readdirRecursiveNoSymlinks(dir, root) {
26987
+ const results = [];
26988
+ let entries;
26989
+ try {
26990
+ entries = import_node_fs9.readdirSync(dir, { encoding: "utf-8" });
26991
+ } catch {
26992
+ return results;
26993
+ }
26994
+ for (const entry of entries) {
26995
+ if (entry === "node_modules" || entry === ".git")
26996
+ continue;
26997
+ const fullPath = import_node_path16.default.join(dir, entry);
26923
26998
  try {
26924
- return import_node_fs7.statSync(fullPath).isDirectory();
26925
- } catch {
26926
- return false;
26927
- }
26928
- });
26999
+ const stat5 = import_node_fs9.lstatSync(fullPath);
27000
+ if (stat5.isSymbolicLink())
27001
+ continue;
27002
+ if (stat5.isDirectory()) {
27003
+ results.push(import_node_path16.default.relative(root, fullPath));
27004
+ results.push(...readdirRecursiveNoSymlinks(fullPath, root));
27005
+ }
27006
+ } catch {}
27007
+ }
27008
+ return results;
27009
+ }
27010
+ function resolvePatterns(cwd, patterns) {
27011
+ const dirs = readdirRecursiveNoSymlinks(cwd, cwd);
26929
27012
  const normalizedDirs = dirs.map((d3) => d3.replace(/\\/g, "/"));
26930
27013
  const matched = import_micromatch2.default(normalizedDirs, patterns);
26931
27014
  return matched.map((d3) => import_node_path16.default.resolve(cwd, d3));
@@ -27022,31 +27105,6 @@ async function discoverPackages(options) {
27022
27105
  }
27023
27106
 
27024
27107
  // src/monorepo/resolve-workspace.ts
27025
- var WORKSPACE_PREFIX = "workspace:";
27026
- var DEPENDENCY_FIELDS = [
27027
- "dependencies",
27028
- "devDependencies",
27029
- "optionalDependencies",
27030
- "peerDependencies"
27031
- ];
27032
- function resolveWorkspaceProtocol(spec, version) {
27033
- if (!spec.startsWith(WORKSPACE_PREFIX))
27034
- return spec;
27035
- const range = spec.slice(WORKSPACE_PREFIX.length);
27036
- switch (range) {
27037
- case "*":
27038
- return version;
27039
- case "^":
27040
- return `^${version}`;
27041
- case "~":
27042
- return `~${version}`;
27043
- default:
27044
- return range;
27045
- }
27046
- }
27047
- function isDynamicWorkspaceSpec(range) {
27048
- return range === "*" || range === "^" || range === "~";
27049
- }
27050
27108
  function collectWorkspaceVersions(cwd) {
27051
27109
  const versions = new Map;
27052
27110
  const workspaces = detectWorkspace(cwd);
@@ -27058,10 +27116,10 @@ function collectWorkspaceVersions(cwd) {
27058
27116
  const dirs = resolvePatterns(cwd, workspace.patterns);
27059
27117
  for (const dir of dirs) {
27060
27118
  const pkgJsonPath = import_node_path17.join(dir, "package.json");
27061
- if (!import_node_fs8.existsSync(pkgJsonPath))
27119
+ if (!import_node_fs10.existsSync(pkgJsonPath))
27062
27120
  continue;
27063
27121
  try {
27064
- const content = import_node_fs8.readFileSync(pkgJsonPath, "utf-8");
27122
+ const content = import_node_fs10.readFileSync(pkgJsonPath, "utf-8");
27065
27123
  const pkg = JSON.parse(content);
27066
27124
  if (typeof pkg.name === "string" && pkg.name && typeof pkg.version === "string" && pkg.version) {
27067
27125
  versions.set(pkg.name, pkg.version);
@@ -27071,44 +27129,9 @@ function collectWorkspaceVersions(cwd) {
27071
27129
  }
27072
27130
  return versions;
27073
27131
  }
27074
- function resolveWorkspaceProtocolsInManifests(packagePaths, workspaceVersions) {
27075
- const backups = new Map;
27076
- for (const pkgPath of packagePaths) {
27077
- const manifestPath = import_node_path17.join(pkgPath, "package.json");
27078
- const original = import_node_fs8.readFileSync(manifestPath, "utf-8");
27079
- const pkg = JSON.parse(original);
27080
- let modified = false;
27081
- for (const field of DEPENDENCY_FIELDS) {
27082
- const deps = pkg[field];
27083
- if (!deps)
27084
- continue;
27085
- for (const [depName, spec] of Object.entries(deps)) {
27086
- if (!spec.startsWith(WORKSPACE_PREFIX))
27087
- continue;
27088
- const range = spec.slice(WORKSPACE_PREFIX.length);
27089
- if (isDynamicWorkspaceSpec(range)) {
27090
- const version = workspaceVersions.get(depName);
27091
- if (!version) {
27092
- throw new Error(`Cannot resolve "${spec}" for dependency "${depName}": package not found in workspace`);
27093
- }
27094
- deps[depName] = resolveWorkspaceProtocol(spec, version);
27095
- } else {
27096
- deps[depName] = range;
27097
- }
27098
- modified = true;
27099
- }
27100
- }
27101
- if (modified) {
27102
- backups.set(manifestPath, original);
27103
- import_node_fs8.writeFileSync(manifestPath, `${JSON.stringify(pkg, null, 2)}
27104
- `, "utf-8");
27105
- }
27106
- }
27107
- return backups;
27108
- }
27109
27132
  function restoreManifests(backups) {
27110
27133
  for (const [filePath, content] of backups) {
27111
- import_node_fs8.writeFileSync(filePath, content, "utf-8");
27134
+ import_node_fs10.writeFileSync(filePath, content, "utf-8");
27112
27135
  }
27113
27136
  }
27114
27137
 
@@ -27412,7 +27435,8 @@ function createContext(config, options, cwd) {
27412
27435
  tag: options.tag ?? "latest",
27413
27436
  promptEnabled: false,
27414
27437
  cleanWorkingTree: false,
27415
- pluginRunner: new PluginRunner([])
27438
+ pluginRunner: new PluginRunner([]),
27439
+ tokenRetryPromises: {}
27416
27440
  };
27417
27441
  const ctx = Object.defineProperties(Object.create(null), {
27418
27442
  config: {
@@ -27499,9 +27523,10 @@ async function withTokenRetry(registryKey, ctx, task, action) {
27499
27523
  if (!descriptor)
27500
27524
  throw error2;
27501
27525
  const config = descriptor.tokenConfig;
27502
- const retryKey = `_tokenRetry_${registryKey}`;
27503
- if (!ctx.runtime[retryKey]) {
27504
- ctx.runtime[retryKey] = (async () => {
27526
+ const retryPromises = ctx.runtime.tokenRetryPromises ?? {};
27527
+ ctx.runtime.tokenRetryPromises = retryPromises;
27528
+ if (!retryPromises[registryKey]) {
27529
+ retryPromises[registryKey] = (async () => {
27505
27530
  task.output = `Auth failed. Re-enter ${config.promptLabel}`;
27506
27531
  const newToken = await task.prompt(ListrEnquirerPromptAdapter).run({
27507
27532
  type: "password",
@@ -27512,7 +27537,7 @@ async function withTokenRetry(registryKey, ctx, task, action) {
27512
27537
  return newToken;
27513
27538
  })();
27514
27539
  }
27515
- await ctx.runtime[retryKey];
27540
+ await retryPromises[registryKey];
27516
27541
  await action();
27517
27542
  }
27518
27543
  }
@@ -27569,7 +27594,11 @@ async function findUnpublishedSiblingDeps(packagePath, siblingPaths) {
27569
27594
  }));
27570
27595
  const siblingDeps = deps.filter((d3) => siblingNameToPath.has(d3));
27571
27596
  const results = await Promise.all(siblingDeps.map(async (name) => {
27572
- const registry = await cratesPackageRegistry(siblingNameToPath.get(name));
27597
+ const siblingPath = siblingNameToPath.get(name);
27598
+ if (!siblingPath) {
27599
+ throw new Error(`Missing sibling crate path for dependency: ${name}`);
27600
+ }
27601
+ const registry = await cratesPackageRegistry(siblingPath);
27573
27602
  const published = await registry.isPublished();
27574
27603
  return published ? null : name;
27575
27604
  }));
@@ -27619,7 +27648,7 @@ function createCratesDryRunPublishTask(packagePath, siblingPaths) {
27619
27648
  // src/tasks/github-release.ts
27620
27649
  init_error();
27621
27650
  init_git();
27622
- var import_node_fs9 = require("node:fs");
27651
+ var import_node_fs11 = require("node:fs");
27623
27652
  var import_semver2 = __toESM(require_semver2(), 1);
27624
27653
  var { prerelease } = import_semver2.default;
27625
27654
 
@@ -27689,7 +27718,7 @@ async function createGitHubRelease(_ctx, options) {
27689
27718
  const uploadUrl = release.upload_url.replace(/\{[^}]*\}/, "");
27690
27719
  const releaseAssets = [];
27691
27720
  for (const asset of options.assets) {
27692
- const archiveContent = import_node_fs9.readFileSync(asset.filePath);
27721
+ const archiveContent = import_node_fs11.readFileSync(asset.filePath);
27693
27722
  const uploadResponse = await fetch(`${uploadUrl}?name=${encodeURIComponent(asset.name)}`, {
27694
27723
  method: "POST",
27695
27724
  headers: {
@@ -27938,7 +27967,7 @@ init_error();
27938
27967
  init_exec();
27939
27968
 
27940
27969
  // src/utils/gh-secrets-sync-state.ts
27941
- var import_node_fs10 = require("node:fs");
27970
+ var import_node_fs12 = require("node:fs");
27942
27971
  var import_node_path18 = __toESM(require("node:path"));
27943
27972
  var SYNC_HASH_FILENAME = "gh-secrets-sync-hash";
27944
27973
  function syncHashFilePath() {
@@ -27946,14 +27975,14 @@ function syncHashFilePath() {
27946
27975
  }
27947
27976
  function readGhSecretsSyncHash() {
27948
27977
  try {
27949
- const value = import_node_fs10.readFileSync(syncHashFilePath(), "utf8").trim();
27978
+ const value = import_node_fs12.readFileSync(syncHashFilePath(), "utf8").trim();
27950
27979
  return value || null;
27951
27980
  } catch {
27952
27981
  return null;
27953
27982
  }
27954
27983
  }
27955
27984
  function writeGhSecretsSyncHash(hash) {
27956
- import_node_fs10.writeFileSync(syncHashFilePath(), `${hash}
27985
+ import_node_fs12.writeFileSync(syncHashFilePath(), `${hash}
27957
27986
  `, "utf8");
27958
27987
  }
27959
27988
 
@@ -28321,7 +28350,7 @@ async function prepareReleaseAssets(ctx, packageName, version, packagePath) {
28321
28350
  const normalizedGroups = normalizeConfig(assetConfig, ctx.config.compress);
28322
28351
  const relevantGroup = normalizedGroups.find((g) => !g.packagePath || g.packagePath === packagePath) ?? { files: [] };
28323
28352
  const tempDir = import_node_path20.join(import_node_os4.tmpdir(), `pubm-assets-${Date.now()}`);
28324
- import_node_fs11.mkdirSync(tempDir, { recursive: true });
28353
+ import_node_fs13.mkdirSync(tempDir, { recursive: true });
28325
28354
  ctx.runtime.tempDir = tempDir;
28326
28355
  const resolvedAssets = resolveAssets(relevantGroup, ctx.config.compress, ctx.cwd);
28327
28356
  const preparedAssets = await runAssetPipeline(resolvedAssets, assetHooks, {
@@ -28341,12 +28370,26 @@ function isReleaseExcluded(config, pkgPath) {
28341
28370
  function getPackageName(ctx, packagePath) {
28342
28371
  return ctx.config.packages.find((p2) => p2.path === packagePath)?.name ?? packagePath;
28343
28372
  }
28373
+ function requirePackageEcosystem(pkg) {
28374
+ if (!pkg.ecosystem) {
28375
+ throw new Error(`Package ${pkg.path} is missing an ecosystem.`);
28376
+ }
28377
+ return pkg.ecosystem;
28378
+ }
28379
+ function requireVersionPlan(ctx) {
28380
+ const { versionPlan } = ctx.runtime;
28381
+ if (!versionPlan) {
28382
+ throw new Error("Version plan is required before running release tasks.");
28383
+ }
28384
+ return versionPlan;
28385
+ }
28344
28386
  async function writeVersions(ctx, versions) {
28345
28387
  const ecosystems = ctx.config.packages.map((pkg) => {
28346
28388
  const absPath = import_node_path20.default.resolve(ctx.cwd ?? import_node_process15.default.cwd(), pkg.path);
28347
- const descriptor = ecosystemCatalog.get(pkg.ecosystem);
28389
+ const ecosystem = requirePackageEcosystem(pkg);
28390
+ const descriptor = ecosystemCatalog.get(ecosystem);
28348
28391
  if (!descriptor)
28349
- throw new Error(`Unknown ecosystem: ${pkg.ecosystem}`);
28392
+ throw new Error(`Unknown ecosystem: ${ecosystem}`);
28350
28393
  const eco = new descriptor.ecosystemClass(absPath);
28351
28394
  return { eco, pkg };
28352
28395
  });
@@ -28365,17 +28408,38 @@ function createPublishTaskForPath(registryKey, packagePath) {
28365
28408
  return { title: `Publish to ${registryKey}`, task: async () => {} };
28366
28409
  return factory(packagePath);
28367
28410
  }
28368
- function resolveWorkspaceProtocols(ctx) {
28411
+ async function resolveWorkspaceProtocols(ctx) {
28369
28412
  if (!ctx.cwd)
28370
28413
  return;
28371
28414
  const workspaceVersions = collectWorkspaceVersions(ctx.cwd);
28372
28415
  if (workspaceVersions.size === 0)
28373
28416
  return;
28374
- const packagePaths = ctx.config.packages.map((pkg) => import_node_path20.default.resolve(ctx.cwd, pkg.path));
28375
- const backups = resolveWorkspaceProtocolsInManifests(packagePaths, workspaceVersions);
28376
- if (backups.size > 0) {
28377
- ctx.runtime.workspaceBackups = backups;
28378
- addRollback(async () => restoreManifests(backups), ctx);
28417
+ const allBackups = new Map;
28418
+ for (const pkg of ctx.config.packages) {
28419
+ const absPath = import_node_path20.default.resolve(ctx.cwd, pkg.path);
28420
+ const ecosystem = requirePackageEcosystem(pkg);
28421
+ const descriptor = ecosystemCatalog.get(ecosystem);
28422
+ if (!descriptor)
28423
+ continue;
28424
+ const eco = new descriptor.ecosystemClass(absPath);
28425
+ const backups = await eco.resolvePublishDependencies(workspaceVersions);
28426
+ for (const [k3, v2] of backups) {
28427
+ allBackups.set(k3, v2);
28428
+ }
28429
+ }
28430
+ if (allBackups.size > 0) {
28431
+ ctx.runtime.workspaceBackups = allBackups;
28432
+ addRollback(async () => {
28433
+ for (const pkg of ctx.config.packages) {
28434
+ const absPath = import_node_path20.default.resolve(ctx.cwd, pkg.path);
28435
+ const ecosystem = requirePackageEcosystem(pkg);
28436
+ const descriptor = ecosystemCatalog.get(ecosystem);
28437
+ if (!descriptor)
28438
+ continue;
28439
+ const eco = new descriptor.ecosystemClass(absPath);
28440
+ eco.restorePublishDependencies(allBackups);
28441
+ }
28442
+ }, ctx);
28379
28443
  }
28380
28444
  }
28381
28445
  async function applyVersionsForDryRun(ctx) {
@@ -28495,8 +28559,8 @@ ${[...plan.packages].map(([pkgPath, ver]) => ` ${getPackageName(ctx, pkgPath)}:
28495
28559
  }
28496
28560
  return "";
28497
28561
  }
28498
- function shouldRenderLiveCommandOutput(ctx) {
28499
- return ctx.options.mode !== "ci" && !m && Boolean(import_node_process15.default.stdout.isTTY);
28562
+ function shouldRenderLiveCommandOutput(_ctx) {
28563
+ return !m && Boolean(import_node_process15.default.stdout.isTTY);
28500
28564
  }
28501
28565
  function normalizeLiveCommandOutputLine(line) {
28502
28566
  const normalized = import_node_util3.stripVTControlCharacters(line).trimEnd();
@@ -28577,7 +28641,7 @@ async function run(ctx) {
28577
28641
  await requiredConditionsCheckTask({
28578
28642
  skip: ctx.options.skipConditionsCheck
28579
28643
  }).run(ctx);
28580
- const pipelineListrOptions2 = mode === "ci" || m ? createCiListrOptions() : undefined;
28644
+ const pipelineListrOptions2 = m ? createCiListrOptions() : undefined;
28581
28645
  await createListr([
28582
28646
  {
28583
28647
  skip: ctx.options.skipTests,
@@ -28659,7 +28723,7 @@ async function run(ctx) {
28659
28723
  skip: () => dryRun,
28660
28724
  task: async (ctx2, task) => {
28661
28725
  const git = new Git;
28662
- const snapshotPlan = ctx2.runtime.versionPlan;
28726
+ const snapshotPlan = requireVersionPlan(ctx2);
28663
28727
  const tagName = `v${snapshotPlan.mode !== "independent" ? snapshotPlan.version : ""}`;
28664
28728
  task.output = `Creating tag ${tagName}...`;
28665
28729
  const headCommit = await git.latestCommit();
@@ -28726,7 +28790,7 @@ async function run(ctx) {
28726
28790
  skip: ctx.options.skipConditionsCheck
28727
28791
  }).run(ctx);
28728
28792
  }
28729
- const pipelineListrOptions = mode === "ci" || m ? createCiListrOptions() : undefined;
28793
+ const pipelineListrOptions = m ? createCiListrOptions() : undefined;
28730
28794
  await createListr([
28731
28795
  {
28732
28796
  skip: !hasPrepare || ctx.options.skipTests,
@@ -28792,7 +28856,7 @@ async function run(ctx) {
28792
28856
  const git = new Git;
28793
28857
  let tagCreated = false;
28794
28858
  let commited = false;
28795
- const plan = ctx2.runtime.versionPlan;
28859
+ const plan = requireVersionPlan(ctx2);
28796
28860
  task.output = formatVersionPlan(ctx2);
28797
28861
  addRollback(async () => {
28798
28862
  if (tagCreated) {
@@ -29016,7 +29080,7 @@ ${[...plan.packages].map(([pkgPath, ver]) => `- ${getPackageName(ctx2, pkgPath)}
29016
29080
  task: async (ctx2, parentTask) => {
29017
29081
  parentTask.output = "Running plugin beforePublish hooks...";
29018
29082
  await ctx2.runtime.pluginRunner.runHook("beforePublish", ctx2);
29019
- resolveWorkspaceProtocols(ctx2);
29083
+ await resolveWorkspaceProtocols(ctx2);
29020
29084
  const publishTasks = await collectPublishTasks(ctx2);
29021
29085
  parentTask.title = `Publishing (${countPublishTargets(ctx2)} targets)`;
29022
29086
  parentTask.output = formatRegistryGroupSummary("Concurrent publish tasks", ctx2, true);
@@ -29029,7 +29093,11 @@ ${[...plan.packages].map(([pkgPath, ver]) => `- ${getPackageName(ctx2, pkgPath)}
29029
29093
  skip: (ctx2) => !hasPublish || !!ctx2.options.skipPublish || dryRun || !ctx2.runtime.workspaceBackups?.size,
29030
29094
  title: "Restoring workspace protocols",
29031
29095
  task: (ctx2) => {
29032
- restoreManifests(ctx2.runtime.workspaceBackups);
29096
+ const backups = ctx2.runtime.workspaceBackups;
29097
+ if (!backups) {
29098
+ throw new Error("Workspace backups are required for restore.");
29099
+ }
29100
+ restoreManifests(backups);
29033
29101
  ctx2.runtime.workspaceBackups = undefined;
29034
29102
  }
29035
29103
  },
@@ -29046,7 +29114,7 @@ ${[...plan.packages].map(([pkgPath, ver]) => `- ${getPackageName(ctx2, pkgPath)}
29046
29114
  skip: !dryRun && !(mode === "ci" && hasPrepare),
29047
29115
  title: "Validating publish (dry-run)",
29048
29116
  task: async (ctx2, parentTask) => {
29049
- resolveWorkspaceProtocols(ctx2);
29117
+ await resolveWorkspaceProtocols(ctx2);
29050
29118
  await applyVersionsForDryRun(ctx2);
29051
29119
  const dryRunTasks = await collectDryRunPublishTasks(ctx2);
29052
29120
  parentTask.title = `Validating publish (${countRegistryTargets(collectEcosystemRegistryGroups(ctx2.config))} targets)`;
@@ -29060,7 +29128,11 @@ ${[...plan.packages].map(([pkgPath, ver]) => `- ${getPackageName(ctx2, pkgPath)}
29060
29128
  skip: (ctx2) => !dryRun && !(mode === "ci" && hasPrepare) || !ctx2.runtime.workspaceBackups?.size,
29061
29129
  title: "Restoring workspace protocols",
29062
29130
  task: (ctx2) => {
29063
- restoreManifests(ctx2.runtime.workspaceBackups);
29131
+ const backups = ctx2.runtime.workspaceBackups;
29132
+ if (!backups) {
29133
+ throw new Error("Workspace backups are required for restore.");
29134
+ }
29135
+ restoreManifests(backups);
29064
29136
  ctx2.runtime.workspaceBackups = undefined;
29065
29137
  }
29066
29138
  },
@@ -29068,7 +29140,11 @@ ${[...plan.packages].map(([pkgPath, ver]) => `- ${getPackageName(ctx2, pkgPath)}
29068
29140
  skip: (ctx2) => !dryRun || !ctx2.runtime.dryRunVersionBackup?.size,
29069
29141
  title: "Restoring original versions (dry-run)",
29070
29142
  task: async (ctx2) => {
29071
- await writeVersions(ctx2, ctx2.runtime.dryRunVersionBackup);
29143
+ const backupVersions = ctx2.runtime.dryRunVersionBackup;
29144
+ if (!backupVersions) {
29145
+ throw new Error("Dry-run version backup is required for restore.");
29146
+ }
29147
+ await writeVersions(ctx2, backupVersions);
29072
29148
  ctx2.runtime.dryRunVersionBackup = undefined;
29073
29149
  }
29074
29150
  },
@@ -29095,7 +29171,7 @@ ${[...plan.packages].map(([pkgPath, ver]) => `- ${getPackageName(ctx2, pkgPath)}
29095
29171
  skip: (ctx2) => !hasPublish || !!ctx2.options.skipReleaseDraft || dryRun,
29096
29172
  title: "Creating GitHub Release",
29097
29173
  task: async (ctx2, task) => {
29098
- const plan = ctx2.runtime.versionPlan;
29174
+ const plan = requireVersionPlan(ctx2);
29099
29175
  const tokenResult = resolveGitHubToken();
29100
29176
  let hasToken = !!tokenResult;
29101
29177
  if (tokenResult) {
@@ -29141,8 +29217,8 @@ ${[...plan.packages].map(([pkgPath, ver]) => `- ${getPackageName(ctx2, pkgPath)}
29141
29217
  const pkgConfig = ctx2.config.packages.find((p2) => p2.path === pkgPath);
29142
29218
  if (pkgConfig) {
29143
29219
  const changelogPath = import_node_path20.join(import_node_process15.default.cwd(), pkgConfig.path, "CHANGELOG.md");
29144
- if (import_node_fs11.existsSync(changelogPath)) {
29145
- const section = parseChangelogSection(import_node_fs11.readFileSync(changelogPath, "utf-8"), pkgVersion);
29220
+ if (import_node_fs13.existsSync(changelogPath)) {
29221
+ const section = parseChangelogSection(import_node_fs13.readFileSync(changelogPath, "utf-8"), pkgVersion);
29146
29222
  if (section)
29147
29223
  changelogBody = section;
29148
29224
  }
@@ -29173,7 +29249,7 @@ ${[...plan.packages].map(([pkgPath, ver]) => `- ${getPackageName(ctx2, pkgPath)}
29173
29249
  task.output = `Release already exists for ${tag}, skipped.`;
29174
29250
  }
29175
29251
  if (tempDir)
29176
- import_node_fs11.rmSync(tempDir, { recursive: true, force: true });
29252
+ import_node_fs13.rmSync(tempDir, { recursive: true, force: true });
29177
29253
  }
29178
29254
  } else {
29179
29255
  const version = plan.version;
@@ -29188,8 +29264,8 @@ ${[...plan.packages].map(([pkgPath, ver]) => `- ${getPackageName(ctx2, pkgPath)}
29188
29264
  if (!pkgConfig)
29189
29265
  continue;
29190
29266
  const changelogPath = import_node_path20.join(import_node_process15.default.cwd(), pkgConfig.path, "CHANGELOG.md");
29191
- if (import_node_fs11.existsSync(changelogPath)) {
29192
- const section = parseChangelogSection(import_node_fs11.readFileSync(changelogPath, "utf-8"), pkgVersion);
29267
+ if (import_node_fs13.existsSync(changelogPath)) {
29268
+ const section = parseChangelogSection(import_node_fs13.readFileSync(changelogPath, "utf-8"), pkgVersion);
29193
29269
  if (section) {
29194
29270
  sections.push(`## ${pkgName} v${pkgVersion}
29195
29271
 
@@ -29206,8 +29282,8 @@ ${section}`);
29206
29282
  }
29207
29283
  } else {
29208
29284
  const changelogPath = import_node_path20.join(import_node_process15.default.cwd(), "CHANGELOG.md");
29209
- if (import_node_fs11.existsSync(changelogPath)) {
29210
- const section = parseChangelogSection(import_node_fs11.readFileSync(changelogPath, "utf-8"), version);
29285
+ if (import_node_fs13.existsSync(changelogPath)) {
29286
+ const section = parseChangelogSection(import_node_fs13.readFileSync(changelogPath, "utf-8"), version);
29211
29287
  if (section)
29212
29288
  changelogBody = section;
29213
29289
  }
@@ -29240,7 +29316,7 @@ ${section}`);
29240
29316
  task.output = `Release already exists for ${tag}, skipped.`;
29241
29317
  }
29242
29318
  if (tempDir)
29243
- import_node_fs11.rmSync(tempDir, { recursive: true, force: true });
29319
+ import_node_fs13.rmSync(tempDir, { recursive: true, force: true });
29244
29320
  }
29245
29321
  } else {
29246
29322
  const git = new Git;
@@ -29347,13 +29423,13 @@ function maxBump(a3, b2) {
29347
29423
  return BUMP_ORDER[a3] >= BUMP_ORDER[b2] ? a3 : b2;
29348
29424
  }
29349
29425
  // src/changeset/migrate.ts
29350
- var import_node_fs12 = require("node:fs");
29426
+ var import_node_fs14 = require("node:fs");
29351
29427
  var import_node_path21 = __toESM(require("node:path"));
29352
29428
  var import_node_process16 = __toESM(require("node:process"));
29353
29429
  var SKIPPED_FILES = new Set(["config.json", "README.md"]);
29354
29430
  function migrateFromChangesets(cwd = import_node_process16.default.cwd()) {
29355
29431
  const changesetDir = import_node_path21.default.join(cwd, ".changeset");
29356
- if (!import_node_fs12.existsSync(changesetDir)) {
29432
+ if (!import_node_fs14.existsSync(changesetDir)) {
29357
29433
  return {
29358
29434
  success: false,
29359
29435
  error: ".changeset/ directory not found",
@@ -29362,8 +29438,8 @@ function migrateFromChangesets(cwd = import_node_process16.default.cwd()) {
29362
29438
  };
29363
29439
  }
29364
29440
  const pubmDir = import_node_path21.default.join(cwd, ".pubm", "changesets");
29365
- import_node_fs12.mkdirSync(pubmDir, { recursive: true });
29366
- const files = import_node_fs12.readdirSync(changesetDir);
29441
+ import_node_fs14.mkdirSync(pubmDir, { recursive: true });
29442
+ const files = import_node_fs14.readdirSync(changesetDir);
29367
29443
  const migratedFiles = [];
29368
29444
  let configMigrated = false;
29369
29445
  for (const file of files) {
@@ -29375,14 +29451,14 @@ function migrateFromChangesets(cwd = import_node_process16.default.cwd()) {
29375
29451
  continue;
29376
29452
  }
29377
29453
  if (file === "pre.json") {
29378
- import_node_fs12.copyFileSync(import_node_path21.default.join(changesetDir, file), import_node_path21.default.resolve(cwd, ".pubm", "pre.json"));
29454
+ import_node_fs14.copyFileSync(import_node_path21.default.join(changesetDir, file), import_node_path21.default.resolve(cwd, ".pubm", "pre.json"));
29379
29455
  migratedFiles.push(file);
29380
29456
  continue;
29381
29457
  }
29382
29458
  if (file.endsWith(".md")) {
29383
29459
  const src = import_node_path21.default.join(changesetDir, file);
29384
29460
  const dest = import_node_path21.default.join(pubmDir, file);
29385
- import_node_fs12.copyFileSync(src, dest);
29461
+ import_node_fs14.copyFileSync(src, dest);
29386
29462
  migratedFiles.push(file);
29387
29463
  }
29388
29464
  }
@@ -29454,7 +29530,7 @@ function calculateVersionBumps(currentVersions, cwd = import_node_process18.defa
29454
29530
  return result;
29455
29531
  }
29456
29532
  // src/changeset/writer.ts
29457
- var import_node_fs13 = require("node:fs");
29533
+ var import_node_fs15 = require("node:fs");
29458
29534
  var import_node_path22 = __toESM(require("node:path"));
29459
29535
  var import_node_process19 = __toESM(require("node:process"));
29460
29536
  var import_yaml3 = __toESM(require_dist(), 1);
@@ -29553,12 +29629,12 @@ ${summary}
29553
29629
  }
29554
29630
  function writeChangeset(releases, summary, cwd = import_node_process19.default.cwd()) {
29555
29631
  const changesetsDir = import_node_path22.default.join(cwd, ".pubm", "changesets");
29556
- import_node_fs13.mkdirSync(changesetsDir, { recursive: true });
29632
+ import_node_fs15.mkdirSync(changesetsDir, { recursive: true });
29557
29633
  const id = generateChangesetId();
29558
29634
  const fileName = `${id}.md`;
29559
29635
  const filePath = import_node_path22.default.join(changesetsDir, fileName);
29560
29636
  const content = generateChangesetContent(releases, summary);
29561
- import_node_fs13.writeFileSync(filePath, content, "utf-8");
29637
+ import_node_fs15.writeFileSync(filePath, content, "utf-8");
29562
29638
  return filePath;
29563
29639
  }
29564
29640
  // src/config/defaults.ts
@@ -30313,17 +30389,32 @@ function formatStageError(stage, error2) {
30313
30389
  const message = error2 instanceof Error ? error2.stack ?? error2.message : String(error2);
30314
30390
  return `[${stage}] ${message}`;
30315
30391
  }
30316
- async function loadConfig(cwd = process.cwd()) {
30317
- const configPath = await findConfigFile(cwd);
30318
- if (!configPath)
30392
+ async function loadConfig(cwd = process.cwd(), configPath) {
30393
+ let resolvedConfigPath;
30394
+ if (configPath) {
30395
+ resolvedConfigPath = import_node_path23.default.resolve(cwd, configPath);
30396
+ try {
30397
+ if (!(await import_promises8.stat(resolvedConfigPath)).isFile()) {
30398
+ throw new Error(`Config path is not a file: ${resolvedConfigPath}`);
30399
+ }
30400
+ } catch (e3) {
30401
+ if (e3.code === "ENOENT") {
30402
+ throw new Error(`Config file not found: ${resolvedConfigPath}`);
30403
+ }
30404
+ throw e3;
30405
+ }
30406
+ } else {
30407
+ resolvedConfigPath = await findConfigFile(cwd);
30408
+ }
30409
+ if (!resolvedConfigPath)
30319
30410
  return null;
30320
30411
  const errors = [];
30321
30412
  try {
30322
- return await importConfigModule(configPath);
30413
+ return await importConfigModule(resolvedConfigPath);
30323
30414
  } catch (error2) {
30324
30415
  errors.push(formatStageError("native import", error2));
30325
30416
  }
30326
- const output = await buildConfig(configPath);
30417
+ const output = await buildConfig(resolvedConfigPath);
30327
30418
  if (!output.success) {
30328
30419
  errors.push(formatStageError("bundled build", output.logs.map((log) => log.message).join(`
30329
30420
  `)));
@@ -30342,11 +30433,11 @@ ${errors.join(`
30342
30433
  }
30343
30434
  const bundledSource = await entrypoint.text();
30344
30435
  try {
30345
- return await importBundledConfig(bundledSource, configPath, output.optionalDependencies);
30436
+ return await importBundledConfig(bundledSource, resolvedConfigPath, output.optionalDependencies);
30346
30437
  } catch (error2) {
30347
30438
  errors.push(formatStageError("bundled import", error2));
30348
30439
  }
30349
- const vmOutput = await buildConfigWithFormat(configPath, "cjs");
30440
+ const vmOutput = await buildConfigWithFormat(resolvedConfigPath, "cjs");
30350
30441
  if (!vmOutput.success) {
30351
30442
  errors.push(formatStageError("bundled vm build", vmOutput.logs.map((log) => log.message).join(`
30352
30443
  `)));
@@ -30364,7 +30455,7 @@ ${errors.join(`
30364
30455
  `)}`);
30365
30456
  }
30366
30457
  try {
30367
- return await executeBundledConfigInVm(await vmEntrypoint.text(), configPath);
30458
+ return await executeBundledConfigInVm(await vmEntrypoint.text(), resolvedConfigPath);
30368
30459
  } catch (error2) {
30369
30460
  errors.push(formatStageError("bundled vm", error2));
30370
30461
  throw new Error(`Failed to load config:
@@ -30784,6 +30875,9 @@ async function handleMultiPackage(ctx, task, packageInfos) {
30784
30875
  if (result === "accepted")
30785
30876
  return;
30786
30877
  if (result === "add_packages") {
30878
+ if (!bumps) {
30879
+ throw new Error("Changeset bumps are required for add_packages.");
30880
+ }
30787
30881
  await handleAddPackages(ctx, task, sortedPackageInfos, currentVersions, graph, bumps);
30788
30882
  return;
30789
30883
  }
@@ -33110,11 +33204,11 @@ function isBun2() {
33110
33204
  init_ui();
33111
33205
 
33112
33206
  // src/validate/entry-points.ts
33113
- var import_node_fs14 = require("node:fs");
33207
+ var import_node_fs16 = require("node:fs");
33114
33208
  var import_node_path24 = __toESM(require("node:path"));
33115
33209
  var SIMPLE_FIELDS = ["main", "module", "types", "typings"];
33116
33210
  function checkPath(filePath, cwd) {
33117
- return import_node_fs14.existsSync(import_node_path24.default.resolve(cwd, filePath));
33211
+ return import_node_fs16.existsSync(import_node_path24.default.resolve(cwd, filePath));
33118
33212
  }
33119
33213
  function validateExports(exports2, cwd, prefix = "exports") {
33120
33214
  const errors = [];