pubm 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/bin/cli.js +221 -170
  2. package/dist/index.cjs +241 -190
  3. package/dist/index.js +238 -187
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4821,9 +4821,71 @@ function createListr(...args) {
4821
4821
  }
4822
4822
 
4823
4823
  // src/utils/package.ts
4824
+ import { readFile as readFile2, stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
4825
+ import path3 from "node:path";
4826
+ import process7 from "node:process";
4827
+
4828
+ // src/ecosystem/rust.ts
4824
4829
  import { readFile, stat as stat2, writeFile } from "node:fs/promises";
4825
4830
  import path2 from "node:path";
4826
- import process7 from "node:process";
4831
+ import { parse, stringify } from "smol-toml";
4832
+
4833
+ // src/ecosystem/ecosystem.ts
4834
+ var Ecosystem = class {
4835
+ constructor(packagePath) {
4836
+ this.packagePath = packagePath;
4837
+ }
4838
+ };
4839
+
4840
+ // src/ecosystem/rust.ts
4841
+ var RustEcosystem = class extends Ecosystem {
4842
+ static async detect(packagePath) {
4843
+ try {
4844
+ return (await stat2(path2.join(packagePath, "Cargo.toml"))).isFile();
4845
+ } catch {
4846
+ return false;
4847
+ }
4848
+ }
4849
+ async readCargoToml() {
4850
+ const raw = await readFile(
4851
+ path2.join(this.packagePath, "Cargo.toml"),
4852
+ "utf-8"
4853
+ );
4854
+ return parse(raw);
4855
+ }
4856
+ async packageName() {
4857
+ const cargo = await this.readCargoToml();
4858
+ const pkg = cargo.package;
4859
+ return pkg.name;
4860
+ }
4861
+ async readVersion() {
4862
+ const cargo = await this.readCargoToml();
4863
+ const pkg = cargo.package;
4864
+ return pkg.version;
4865
+ }
4866
+ async writeVersion(newVersion) {
4867
+ const filePath = path2.join(this.packagePath, "Cargo.toml");
4868
+ const raw = await readFile(filePath, "utf-8");
4869
+ const cargo = parse(raw);
4870
+ const pkg = cargo.package;
4871
+ pkg.version = newVersion;
4872
+ await writeFile(filePath, stringify(cargo));
4873
+ }
4874
+ manifestFiles() {
4875
+ return ["Cargo.toml"];
4876
+ }
4877
+ defaultTestCommand() {
4878
+ return "cargo test";
4879
+ }
4880
+ defaultBuildCommand() {
4881
+ return "cargo build --release";
4882
+ }
4883
+ supportedRegistries() {
4884
+ return ["crates"];
4885
+ }
4886
+ };
4887
+
4888
+ // src/utils/package.ts
4827
4889
  var cachedPackageJson = {};
4828
4890
  var cachedJsrJson = {};
4829
4891
  function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
@@ -4832,16 +4894,16 @@ function patchCachedJsrJson(contents, { cwd = process7.cwd() } = {}) {
4832
4894
  async function findOutFile(file, { cwd = process7.cwd() } = {}) {
4833
4895
  let directory = cwd;
4834
4896
  let filePath = "";
4835
- const { root } = path2.parse(cwd);
4897
+ const { root } = path3.parse(cwd);
4836
4898
  while (directory) {
4837
- filePath = path2.join(directory, file);
4899
+ filePath = path3.join(directory, file);
4838
4900
  try {
4839
- if ((await stat2(filePath)).isFile()) {
4901
+ if ((await stat3(filePath)).isFile()) {
4840
4902
  break;
4841
4903
  }
4842
4904
  } catch {
4843
4905
  }
4844
- directory = path2.dirname(directory);
4906
+ directory = path3.dirname(directory);
4845
4907
  if (directory === root) return null;
4846
4908
  }
4847
4909
  return filePath;
@@ -4853,7 +4915,7 @@ async function getPackageJson({
4853
4915
  if (cachedPackageJson[cwd]) return cachedPackageJson[cwd];
4854
4916
  try {
4855
4917
  const packageJsonPath = await findOutFile("package.json");
4856
- const raw = packageJsonPath && (await readFile(packageJsonPath)).toString();
4918
+ const raw = packageJsonPath && (await readFile2(packageJsonPath)).toString();
4857
4919
  if (!raw) {
4858
4920
  if (!fallbackJsr) {
4859
4921
  throw new Error(
@@ -4886,7 +4948,7 @@ async function getJsrJson({
4886
4948
  if (cachedJsrJson[cwd]) return cachedJsrJson[cwd];
4887
4949
  try {
4888
4950
  const jsrJsonPath = await findOutFile("jsr.json");
4889
- const raw = jsrJsonPath && (await readFile(jsrJsonPath)).toString();
4951
+ const raw = jsrJsonPath && (await readFile2(jsrJsonPath)).toString();
4890
4952
  if (!raw) {
4891
4953
  if (!fallbackPackage) {
4892
4954
  throw new Error(
@@ -4970,14 +5032,14 @@ async function version({ cwd = process7.cwd() } = {}) {
4970
5032
  return version2;
4971
5033
  }
4972
5034
  var versionRegex = /("version"\s*:\s*")[^"]*(")/;
4973
- async function replaceVersion(version2) {
5035
+ async function replaceVersion(version2, packages) {
4974
5036
  const results = await Promise.all([
4975
5037
  (async () => {
4976
5038
  const packageJsonPath = await findOutFile("package.json");
4977
5039
  if (!packageJsonPath) return void 0;
4978
- const packageJson = (await readFile(packageJsonPath)).toString();
5040
+ const packageJson = (await readFile2(packageJsonPath)).toString();
4979
5041
  try {
4980
- await writeFile(
5042
+ await writeFile2(
4981
5043
  packageJsonPath,
4982
5044
  packageJson.replace(versionRegex, `$1${version2}$2`)
4983
5045
  );
@@ -4992,9 +5054,9 @@ async function replaceVersion(version2) {
4992
5054
  (async () => {
4993
5055
  const jsrJsonPath = await findOutFile("jsr.json");
4994
5056
  if (!jsrJsonPath) return void 0;
4995
- const jsrJson = (await readFile(jsrJsonPath)).toString();
5057
+ const jsrJson = (await readFile2(jsrJsonPath)).toString();
4996
5058
  try {
4997
- await writeFile(
5059
+ await writeFile2(
4998
5060
  jsrJsonPath,
4999
5061
  jsrJson.replace(versionRegex, `$1${version2}$2`)
5000
5062
  );
@@ -5005,7 +5067,19 @@ async function replaceVersion(version2) {
5005
5067
  );
5006
5068
  }
5007
5069
  return "jsr.json";
5008
- })()
5070
+ })(),
5071
+ ...(packages ?? []).filter((pkg) => pkg.registries.includes("crates")).map(async (pkg) => {
5072
+ const eco = new RustEcosystem(path3.resolve(pkg.path));
5073
+ try {
5074
+ await eco.writeVersion(version2);
5075
+ } catch (error) {
5076
+ throw new AbstractError(
5077
+ `Failed to write version to Cargo.toml at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
5078
+ { cause: error }
5079
+ );
5080
+ }
5081
+ return path3.join(pkg.path, "Cargo.toml");
5082
+ })
5009
5083
  ]);
5010
5084
  return results.filter((v) => v);
5011
5085
  }
@@ -5026,67 +5100,26 @@ async function getPackageManager() {
5026
5100
  return "npm";
5027
5101
  }
5028
5102
 
5029
- // src/ecosystem/rust.ts
5030
- import { readFile as readFile2, stat as stat3, writeFile as writeFile2 } from "node:fs/promises";
5031
- import path3 from "node:path";
5032
- import { parse, stringify } from "smol-toml";
5033
-
5034
- // src/ecosystem/ecosystem.ts
5035
- var Ecosystem = class {
5036
- constructor(packagePath) {
5037
- this.packagePath = packagePath;
5038
- }
5039
- };
5040
-
5041
- // src/ecosystem/rust.ts
5042
- var RustEcosystem = class extends Ecosystem {
5043
- static async detect(packagePath) {
5044
- try {
5045
- return (await stat3(path3.join(packagePath, "Cargo.toml"))).isFile();
5046
- } catch {
5047
- return false;
5103
+ // src/utils/registries.ts
5104
+ function collectRegistries(ctx) {
5105
+ if (ctx.packages?.length) {
5106
+ const seen = /* @__PURE__ */ new Set();
5107
+ const result = [];
5108
+ for (const pkg of ctx.packages) {
5109
+ for (const reg of pkg.registries) {
5110
+ if (!seen.has(reg)) {
5111
+ seen.add(reg);
5112
+ result.push(reg);
5113
+ }
5114
+ }
5048
5115
  }
5116
+ return result;
5049
5117
  }
5050
- async readCargoToml() {
5051
- const raw = await readFile2(
5052
- path3.join(this.packagePath, "Cargo.toml"),
5053
- "utf-8"
5054
- );
5055
- return parse(raw);
5056
- }
5057
- async packageName() {
5058
- const cargo = await this.readCargoToml();
5059
- const pkg = cargo.package;
5060
- return pkg.name;
5061
- }
5062
- async readVersion() {
5063
- const cargo = await this.readCargoToml();
5064
- const pkg = cargo.package;
5065
- return pkg.version;
5066
- }
5067
- async writeVersion(newVersion) {
5068
- const filePath = path3.join(this.packagePath, "Cargo.toml");
5069
- const raw = await readFile2(filePath, "utf-8");
5070
- const cargo = parse(raw);
5071
- const pkg = cargo.package;
5072
- pkg.version = newVersion;
5073
- await writeFile2(filePath, stringify(cargo));
5074
- }
5075
- manifestFiles() {
5076
- return ["Cargo.toml"];
5077
- }
5078
- defaultTestCommand() {
5079
- return "cargo test";
5080
- }
5081
- defaultBuildCommand() {
5082
- return "cargo build --release";
5083
- }
5084
- supportedRegistries() {
5085
- return ["crates"];
5086
- }
5087
- };
5118
+ return ctx.registries;
5119
+ }
5088
5120
 
5089
5121
  // src/registry/crates.ts
5122
+ import path4 from "node:path";
5090
5123
  import { exec as exec3 } from "tinyexec";
5091
5124
 
5092
5125
  // src/registry/registry.ts
@@ -5160,9 +5193,13 @@ var CratesRegistry = class extends Registry {
5160
5193
  );
5161
5194
  }
5162
5195
  }
5163
- async publish() {
5196
+ async publish(manifestDir) {
5164
5197
  try {
5165
- await exec3("cargo", ["publish"], { throwOnError: true });
5198
+ const args = ["publish"];
5199
+ if (manifestDir) {
5200
+ args.push("--manifest-path", path4.join(manifestDir, "Cargo.toml"));
5201
+ }
5202
+ await exec3("cargo", args, { throwOnError: true });
5166
5203
  return true;
5167
5204
  } catch (error) {
5168
5205
  throw new CratesError("Failed to run `cargo publish`", {
@@ -5218,35 +5255,43 @@ var CratesError2 = class extends AbstractError {
5218
5255
  this.stack = "";
5219
5256
  }
5220
5257
  };
5221
- async function getCrateName() {
5222
- const eco = new RustEcosystem(process.cwd());
5258
+ async function getCrateName(packagePath) {
5259
+ const eco = new RustEcosystem(packagePath ?? process.cwd());
5223
5260
  return await eco.packageName();
5224
5261
  }
5225
- var cratesAvailableCheckTasks = {
5226
- title: "Checking crates.io availability",
5227
- task: async () => {
5228
- const packageName = await getCrateName();
5229
- const registry = new CratesRegistry(packageName);
5230
- if (!await registry.isInstalled()) {
5231
- throw new CratesError2(
5232
- "cargo is not installed. Please install Rust toolchain to proceed."
5233
- );
5262
+ function createCratesAvailableCheckTask(packagePath) {
5263
+ const label = packagePath ? ` (${packagePath})` : "";
5264
+ return {
5265
+ title: `Checking crates.io availability${label}`,
5266
+ task: async () => {
5267
+ const packageName = await getCrateName(packagePath);
5268
+ const registry = new CratesRegistry(packageName);
5269
+ if (!await registry.isInstalled()) {
5270
+ throw new CratesError2(
5271
+ "cargo is not installed. Please install Rust toolchain to proceed."
5272
+ );
5273
+ }
5274
+ if (!await registry.hasPermission()) {
5275
+ throw new CratesError2(
5276
+ "No crates.io credentials found. Run `cargo login` or set CARGO_REGISTRY_TOKEN."
5277
+ );
5278
+ }
5234
5279
  }
5235
- if (!await registry.hasPermission()) {
5236
- throw new CratesError2(
5237
- "No crates.io credentials found. Run `cargo login` or set CARGO_REGISTRY_TOKEN."
5238
- );
5280
+ };
5281
+ }
5282
+ function createCratesPublishTask(packagePath) {
5283
+ const label = packagePath ? ` (${packagePath})` : "";
5284
+ return {
5285
+ title: `Publishing to crates.io${label}`,
5286
+ task: async () => {
5287
+ const packageName = await getCrateName(packagePath);
5288
+ const registry = new CratesRegistry(packageName);
5289
+ await registry.publish(packagePath);
5239
5290
  }
5240
- }
5241
- };
5242
- var cratesPublishTasks = {
5243
- title: "Publishing to crates.io",
5244
- task: async () => {
5245
- const packageName = await getCrateName();
5246
- const registry = new CratesRegistry(packageName);
5247
- await registry.publish();
5248
- }
5249
- };
5291
+ };
5292
+ }
5293
+ var cratesAvailableCheckTasks = createCratesAvailableCheckTask();
5294
+ var cratesPublishTasks = createCratesPublishTask();
5250
5295
 
5251
5296
  // src/tasks/jsr.ts
5252
5297
  import process8 from "node:process";
@@ -5259,7 +5304,7 @@ import { exec as exec4, NonZeroExitError } from "tinyexec";
5259
5304
  // src/utils/db.ts
5260
5305
  import { createCipheriv, createDecipheriv, createHash } from "node:crypto";
5261
5306
  import { mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
5262
- import path4 from "node:path";
5307
+ import path5 from "node:path";
5263
5308
  var a = "aes-256-cbc";
5264
5309
  var n = statSync(import.meta.dirname);
5265
5310
  var k = `${n.rdev}${n.birthtimeMs}${n.nlink}${n.gid}`;
@@ -5274,7 +5319,7 @@ function d(g, h) {
5274
5319
  }
5275
5320
  var Db = class {
5276
5321
  constructor() {
5277
- __publicField(this, "path", path4.resolve(import.meta.dirname, ".pubm"));
5322
+ __publicField(this, "path", path5.resolve(import.meta.dirname, ".pubm"));
5278
5323
  try {
5279
5324
  if (!statSync(this.path).isDirectory()) {
5280
5325
  mkdirSync(this.path);
@@ -5292,7 +5337,7 @@ var Db = class {
5292
5337
  set(field, value) {
5293
5338
  try {
5294
5339
  writeFileSync(
5295
- path4.resolve(
5340
+ path5.resolve(
5296
5341
  this.path,
5297
5342
  Buffer.from(e(field, field)).toString("base64")
5298
5343
  ),
@@ -5306,7 +5351,7 @@ var Db = class {
5306
5351
  }
5307
5352
  }
5308
5353
  get(field) {
5309
- const filePath = path4.resolve(
5354
+ const filePath = path5.resolve(
5310
5355
  this.path,
5311
5356
  Buffer.from(e(field, field)).toString("base64")
5312
5357
  );
@@ -6143,9 +6188,7 @@ var npmAvailableCheckTasks = {
6143
6188
  child.stderr?.on("data", onData);
6144
6189
  child.on(
6145
6190
  "close",
6146
- (code) => code === 0 ? resolve() : reject(
6147
- new Error(`npm login exited with code ${code}`)
6148
- )
6191
+ (code) => code === 0 ? resolve() : reject(new Error(`npm login exited with code ${code}`))
6149
6192
  );
6150
6193
  child.on("error", reject);
6151
6194
  });
@@ -6448,7 +6491,7 @@ var requiredConditionsCheckTask = (options) => createListr({
6448
6491
  {
6449
6492
  title: "Ping registries",
6450
6493
  task: (ctx, parentTask2) => parentTask2.newListr(
6451
- ctx.registries.map((registryKey) => ({
6494
+ collectRegistries(ctx).map((registryKey) => ({
6452
6495
  title: `Ping to ${registryKey}`,
6453
6496
  task: async () => {
6454
6497
  const registry = await getRegistry(registryKey);
@@ -6465,7 +6508,9 @@ var requiredConditionsCheckTask = (options) => createListr({
6465
6508
  task: async (_2, parentTask2) => parentTask2.newListr(
6466
6509
  [
6467
6510
  {
6468
- enabled: (ctx) => ctx.registries.some((registry) => registry !== "jsr"),
6511
+ enabled: (ctx) => collectRegistries(ctx).some(
6512
+ (registry) => registry !== "jsr"
6513
+ ),
6469
6514
  title: "Verifying if npm are installed",
6470
6515
  task: async () => {
6471
6516
  const npm = await npmRegistry();
@@ -6477,7 +6522,9 @@ var requiredConditionsCheckTask = (options) => createListr({
6477
6522
  }
6478
6523
  },
6479
6524
  {
6480
- enabled: (ctx) => ctx.registries.some((registry) => registry === "jsr"),
6525
+ enabled: (ctx) => collectRegistries(ctx).some(
6526
+ (registry) => registry === "jsr"
6527
+ ),
6481
6528
  title: "Verifying if jsr are installed",
6482
6529
  task: async (_3, task) => {
6483
6530
  const jsr = await jsrRegistry();
@@ -6508,7 +6555,7 @@ var requiredConditionsCheckTask = (options) => createListr({
6508
6555
  },
6509
6556
  {
6510
6557
  title: "Checking if test and build scripts exist",
6511
- skip: (ctx) => !needsPackageScripts(ctx.registries),
6558
+ skip: (ctx) => !needsPackageScripts(collectRegistries(ctx)),
6512
6559
  task: async (ctx) => {
6513
6560
  const { scripts } = await getPackageJson();
6514
6561
  const errors = [];
@@ -6536,23 +6583,42 @@ var requiredConditionsCheckTask = (options) => createListr({
6536
6583
  },
6537
6584
  {
6538
6585
  title: "Checking available registries for publishing",
6539
- task: (ctx, parentTask2) => parentTask2.newListr(
6540
- ctx.registries.map((registryKey) => {
6541
- switch (registryKey) {
6542
- case "npm":
6543
- return npmAvailableCheckTasks;
6544
- case "jsr":
6545
- return jsrAvailableCheckTasks;
6546
- case "crates":
6547
- return cratesAvailableCheckTasks;
6548
- default:
6549
- return npmAvailableCheckTasks;
6550
- }
6551
- }),
6552
- {
6553
- concurrent: true
6586
+ task: (ctx, parentTask2) => {
6587
+ if (ctx.packages?.length) {
6588
+ const tasks = ctx.packages.flatMap(
6589
+ (pkg) => pkg.registries.map((registryKey) => {
6590
+ switch (registryKey) {
6591
+ case "npm":
6592
+ return npmAvailableCheckTasks;
6593
+ case "jsr":
6594
+ return jsrAvailableCheckTasks;
6595
+ case "crates":
6596
+ return createCratesAvailableCheckTask(pkg.path);
6597
+ default:
6598
+ return npmAvailableCheckTasks;
6599
+ }
6600
+ })
6601
+ );
6602
+ return parentTask2.newListr(tasks, { concurrent: true });
6554
6603
  }
6555
- )
6604
+ return parentTask2.newListr(
6605
+ collectRegistries(ctx).map((registryKey) => {
6606
+ switch (registryKey) {
6607
+ case "npm":
6608
+ return npmAvailableCheckTasks;
6609
+ case "jsr":
6610
+ return jsrAvailableCheckTasks;
6611
+ case "crates":
6612
+ return cratesAvailableCheckTasks;
6613
+ default:
6614
+ return npmAvailableCheckTasks;
6615
+ }
6616
+ }),
6617
+ {
6618
+ concurrent: true
6619
+ }
6620
+ );
6621
+ }
6556
6622
  }
6557
6623
  ],
6558
6624
  {
@@ -6564,21 +6630,27 @@ var requiredConditionsCheckTask = (options) => createListr({
6564
6630
  // src/tasks/runner.ts
6565
6631
  var { open: open3 } = npmCli3;
6566
6632
  var { prerelease } = SemVer;
6567
- function collectRegistries(ctx) {
6633
+ function registryTask(registry) {
6634
+ switch (registry) {
6635
+ case "npm":
6636
+ return npmPublishTasks;
6637
+ case "jsr":
6638
+ return jsrPublishTasks;
6639
+ case "crates":
6640
+ return cratesPublishTasks;
6641
+ default:
6642
+ return npmPublishTasks;
6643
+ }
6644
+ }
6645
+ function collectPublishTasks(ctx) {
6568
6646
  if (ctx.packages?.length) {
6569
- const seen = /* @__PURE__ */ new Set();
6570
- const result = [];
6571
- for (const pkg of ctx.packages) {
6572
- for (const reg of pkg.registries) {
6573
- if (!seen.has(reg)) {
6574
- seen.add(reg);
6575
- result.push(reg);
6576
- }
6577
- }
6578
- }
6579
- return result;
6647
+ return ctx.packages.flatMap(
6648
+ (pkg) => pkg.registries.map(
6649
+ (reg) => reg === "crates" ? createCratesPublishTask(pkg.path) : registryTask(reg)
6650
+ )
6651
+ );
6580
6652
  }
6581
- return ctx.registries;
6653
+ return collectRegistries(ctx).map(registryTask);
6582
6654
  }
6583
6655
  async function run(options) {
6584
6656
  const ctx = {
@@ -6598,21 +6670,9 @@ async function run(options) {
6598
6670
  await createListr(
6599
6671
  options.publishOnly ? {
6600
6672
  title: "Publishing",
6601
- task: (ctx2, parentTask) => parentTask.newListr(
6602
- collectRegistries(ctx2).map((registry) => {
6603
- switch (registry) {
6604
- case "npm":
6605
- return npmPublishTasks;
6606
- case "jsr":
6607
- return jsrPublishTasks;
6608
- case "crates":
6609
- return cratesPublishTasks;
6610
- default:
6611
- return npmPublishTasks;
6612
- }
6613
- }),
6614
- { concurrent: true }
6615
- )
6673
+ task: (ctx2, parentTask) => parentTask.newListr(collectPublishTasks(ctx2), {
6674
+ concurrent: true
6675
+ })
6616
6676
  } : [
6617
6677
  {
6618
6678
  skip: options.skipTests,
@@ -6681,7 +6741,10 @@ async function run(options) {
6681
6741
  }
6682
6742
  }, ctx2);
6683
6743
  await git.reset();
6684
- const replaced = await replaceVersion(ctx2.version);
6744
+ const replaced = await replaceVersion(
6745
+ ctx2.version,
6746
+ ctx2.packages
6747
+ );
6685
6748
  for (const replacedFile of replaced) {
6686
6749
  await git.stage(replacedFile);
6687
6750
  }
@@ -6696,21 +6759,9 @@ async function run(options) {
6696
6759
  {
6697
6760
  skip: (ctx2) => options.skipPublish || !!ctx2.preview,
6698
6761
  title: "Publishing",
6699
- task: (ctx2, parentTask) => parentTask.newListr(
6700
- collectRegistries(ctx2).map((registry) => {
6701
- switch (registry) {
6702
- case "npm":
6703
- return npmPublishTasks;
6704
- case "jsr":
6705
- return jsrPublishTasks;
6706
- case "crates":
6707
- return cratesPublishTasks;
6708
- default:
6709
- return npmPublishTasks;
6710
- }
6711
- }),
6712
- { concurrent: true }
6713
- )
6762
+ task: (ctx2, parentTask) => parentTask.newListr(collectPublishTasks(ctx2), {
6763
+ concurrent: true
6764
+ })
6714
6765
  },
6715
6766
  {
6716
6767
  title: "Pushing tags to GitHub",
@@ -6812,11 +6863,11 @@ function generateChangelog(version2, entries, depUpdates) {
6812
6863
 
6813
6864
  // src/changeset/migrate.ts
6814
6865
  import { copyFileSync, existsSync, mkdirSync as mkdirSync2, readdirSync } from "node:fs";
6815
- import path5 from "node:path";
6866
+ import path6 from "node:path";
6816
6867
  import process11 from "node:process";
6817
6868
  var SKIPPED_FILES = /* @__PURE__ */ new Set(["config.json", "README.md"]);
6818
6869
  function migrateFromChangesets(cwd = process11.cwd()) {
6819
- const changesetDir = path5.join(cwd, ".changeset");
6870
+ const changesetDir = path6.join(cwd, ".changeset");
6820
6871
  if (!existsSync(changesetDir)) {
6821
6872
  return {
6822
6873
  success: false,
@@ -6825,7 +6876,7 @@ function migrateFromChangesets(cwd = process11.cwd()) {
6825
6876
  configMigrated: false
6826
6877
  };
6827
6878
  }
6828
- const pubmDir = path5.join(cwd, ".pubm", "changesets");
6879
+ const pubmDir = path6.join(cwd, ".pubm", "changesets");
6829
6880
  mkdirSync2(pubmDir, { recursive: true });
6830
6881
  const files = readdirSync(changesetDir);
6831
6882
  const migratedFiles = [];
@@ -6840,15 +6891,15 @@ function migrateFromChangesets(cwd = process11.cwd()) {
6840
6891
  }
6841
6892
  if (file === "pre.json") {
6842
6893
  copyFileSync(
6843
- path5.join(changesetDir, file),
6844
- path5.resolve(cwd, ".pubm", "pre.json")
6894
+ path6.join(changesetDir, file),
6895
+ path6.resolve(cwd, ".pubm", "pre.json")
6845
6896
  );
6846
6897
  migratedFiles.push(file);
6847
6898
  continue;
6848
6899
  }
6849
6900
  if (file.endsWith(".md")) {
6850
- const src = path5.join(changesetDir, file);
6851
- const dest = path5.join(pubmDir, file);
6901
+ const src = path6.join(changesetDir, file);
6902
+ const dest = path6.join(pubmDir, file);
6852
6903
  copyFileSync(src, dest);
6853
6904
  migratedFiles.push(file);
6854
6905
  }
@@ -6895,10 +6946,10 @@ function parseChangeset(content, fileName) {
6895
6946
 
6896
6947
  // src/changeset/reader.ts
6897
6948
  import { existsSync as existsSync2, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
6898
- import path6 from "node:path";
6949
+ import path7 from "node:path";
6899
6950
  import process12 from "node:process";
6900
6951
  function readChangesets(cwd = process12.cwd()) {
6901
- const changesetsDir = path6.join(cwd, ".pubm", "changesets");
6952
+ const changesetsDir = path7.join(cwd, ".pubm", "changesets");
6902
6953
  if (!existsSync2(changesetsDir)) {
6903
6954
  return [];
6904
6955
  }
@@ -6908,7 +6959,7 @@ function readChangesets(cwd = process12.cwd()) {
6908
6959
  if (!file.endsWith(".md") || file === "README.md") {
6909
6960
  continue;
6910
6961
  }
6911
- const filePath = path6.join(changesetsDir, file);
6962
+ const filePath = path7.join(changesetsDir, file);
6912
6963
  const content = readFileSync2(filePath, "utf-8");
6913
6964
  changesets.push(parseChangeset(content, file));
6914
6965
  }
@@ -6978,7 +7029,7 @@ function calculateVersionBumps(currentVersions, cwd = process14.cwd()) {
6978
7029
 
6979
7030
  // src/changeset/writer.ts
6980
7031
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2 } from "node:fs";
6981
- import path7 from "node:path";
7032
+ import path8 from "node:path";
6982
7033
  import process15 from "node:process";
6983
7034
  import { stringify as stringifyYaml } from "yaml";
6984
7035
  var adjectives = [
@@ -7073,11 +7124,11 @@ ${summary}
7073
7124
  return content;
7074
7125
  }
7075
7126
  function writeChangeset(releases, summary, cwd = process15.cwd()) {
7076
- const changesetsDir = path7.join(cwd, ".pubm", "changesets");
7127
+ const changesetsDir = path8.join(cwd, ".pubm", "changesets");
7077
7128
  mkdirSync3(changesetsDir, { recursive: true });
7078
7129
  const id = generateChangesetId();
7079
7130
  const fileName = `${id}.md`;
7080
- const filePath = path7.join(changesetsDir, fileName);
7131
+ const filePath = path8.join(changesetsDir, fileName);
7081
7132
  const content = generateChangesetContent(releases, summary);
7082
7133
  writeFileSync2(filePath, content, "utf-8");
7083
7134
  return filePath;
@@ -7136,7 +7187,7 @@ function topologicalSort(graph) {
7136
7187
 
7137
7188
  // src/monorepo/discover.ts
7138
7189
  import { existsSync as existsSync4, readdirSync as readdirSync3, statSync as statSync2 } from "node:fs";
7139
- import path8 from "node:path";
7190
+ import path9 from "node:path";
7140
7191
  import micromatch from "micromatch";
7141
7192
 
7142
7193
  // src/monorepo/workspace.ts
@@ -7219,9 +7270,9 @@ import {
7219
7270
  rmSync,
7220
7271
  writeFileSync as writeFileSync3
7221
7272
  } from "node:fs";
7222
- import path9 from "node:path";
7273
+ import path10 from "node:path";
7223
7274
  function getPreStatePath(cwd) {
7224
- return path9.resolve(cwd ?? process.cwd(), ".pubm", "pre.json");
7275
+ return path10.resolve(cwd ?? process.cwd(), ".pubm", "pre.json");
7225
7276
  }
7226
7277
  function readPreState(cwd) {
7227
7278
  const filePath = getPreStatePath(cwd);
@@ -7238,7 +7289,7 @@ function enterPreMode(tag, cwd) {
7238
7289
  "Already in pre mode. Exit pre mode first before entering a new one."
7239
7290
  );
7240
7291
  }
7241
- const dir = path9.dirname(filePath);
7292
+ const dir = path10.dirname(filePath);
7242
7293
  if (!existsSync5(dir)) {
7243
7294
  mkdirSync4(dir, { recursive: true });
7244
7295
  }
@@ -7280,10 +7331,10 @@ function generateSnapshotVersion(options) {
7280
7331
 
7281
7332
  // src/validate/entry-points.ts
7282
7333
  import { existsSync as existsSync6 } from "node:fs";
7283
- import path10 from "node:path";
7334
+ import path11 from "node:path";
7284
7335
  var SIMPLE_FIELDS = ["main", "module", "types", "typings"];
7285
7336
  function checkPath(filePath, cwd) {
7286
- return existsSync6(path10.resolve(cwd, filePath));
7337
+ return existsSync6(path11.resolve(cwd, filePath));
7287
7338
  }
7288
7339
  function validateExports(exports, cwd, prefix = "exports") {
7289
7340
  const errors = [];