pubm 0.2.4 → 0.2.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/bin/cli.js CHANGED
@@ -5466,7 +5466,7 @@ import process14 from "node:process";
5466
5466
  import npmCli3 from "@npmcli/promise-spawn";
5467
5467
  import SemVer from "semver";
5468
5468
  import { isCI as isCI2 } from "std-env";
5469
- import { exec as exec8 } from "tinyexec";
5469
+ import { exec as exec9 } from "tinyexec";
5470
5470
 
5471
5471
  // src/utils/cli.ts
5472
5472
  var warningBadge = color.bgYellow(" Warning ");
@@ -5478,6 +5478,7 @@ function link2(text, url) {
5478
5478
  import { readFile, stat as stat2, writeFile } from "node:fs/promises";
5479
5479
  import path8 from "node:path";
5480
5480
  import { parse, stringify } from "smol-toml";
5481
+ import { exec as exec4 } from "tinyexec";
5481
5482
 
5482
5483
  // src/ecosystem/ecosystem.ts
5483
5484
  var Ecosystem = class {
@@ -5520,6 +5521,28 @@ var RustEcosystem = class extends Ecosystem {
5520
5521
  pkg.version = newVersion;
5521
5522
  await writeFile(filePath, stringify(cargo));
5522
5523
  }
5524
+ async syncLockfile() {
5525
+ const lockfilePath = await this.findLockfile();
5526
+ if (!lockfilePath) return void 0;
5527
+ const name = await this.packageName();
5528
+ await exec4("cargo", ["update", "--package", name], {
5529
+ nodeOptions: { cwd: path8.dirname(lockfilePath) }
5530
+ });
5531
+ return lockfilePath;
5532
+ }
5533
+ async findLockfile() {
5534
+ let dir = this.packagePath;
5535
+ const { root } = path8.parse(dir);
5536
+ while (dir !== root) {
5537
+ const candidate = path8.join(dir, "Cargo.lock");
5538
+ try {
5539
+ if ((await stat2(candidate)).isFile()) return candidate;
5540
+ } catch {
5541
+ }
5542
+ dir = path8.dirname(dir);
5543
+ }
5544
+ return void 0;
5545
+ }
5523
5546
  async dependencies() {
5524
5547
  const cargo = await this.readCargoToml();
5525
5548
  const deps = [];
@@ -5827,10 +5850,19 @@ async function replaceVersion(version2, packages) {
5827
5850
  { cause: error }
5828
5851
  );
5829
5852
  }
5830
- return path9.join(pkg.path, "Cargo.toml");
5853
+ let lockfilePath;
5854
+ try {
5855
+ lockfilePath = await eco.syncLockfile();
5856
+ } catch (error) {
5857
+ throw new AbstractError(
5858
+ `Failed to sync Cargo.lock at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
5859
+ { cause: error }
5860
+ );
5861
+ }
5862
+ return [path9.join(pkg.path, "Cargo.toml"), lockfilePath];
5831
5863
  })
5832
5864
  ]);
5833
- return results.filter((v) => v);
5865
+ return [...new Set(results.flat().filter((v) => !!v))];
5834
5866
  }
5835
5867
 
5836
5868
  // src/utils/package-manager.ts
@@ -5869,7 +5901,7 @@ function collectRegistries(ctx) {
5869
5901
 
5870
5902
  // src/registry/crates.ts
5871
5903
  import path10 from "node:path";
5872
- import { exec as exec4, NonZeroExitError } from "tinyexec";
5904
+ import { exec as exec5, NonZeroExitError } from "tinyexec";
5873
5905
 
5874
5906
  // src/registry/registry.ts
5875
5907
  var Registry = class {
@@ -5909,7 +5941,7 @@ var CratesRegistry = class extends Registry {
5909
5941
  }
5910
5942
  async isInstalled() {
5911
5943
  try {
5912
- await exec4("cargo", ["--version"]);
5944
+ await exec5("cargo", ["--version"]);
5913
5945
  return true;
5914
5946
  } catch {
5915
5947
  return false;
@@ -5950,7 +5982,7 @@ var CratesRegistry = class extends Registry {
5950
5982
  if (manifestDir) {
5951
5983
  args.push("--manifest-path", path10.join(manifestDir, "Cargo.toml"));
5952
5984
  }
5953
- await exec4("cargo", args, { throwOnError: true });
5985
+ await exec5("cargo", args, { throwOnError: true });
5954
5986
  return true;
5955
5987
  } catch (error) {
5956
5988
  const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
@@ -5965,7 +5997,7 @@ ${stderr}` : "Failed to run `cargo publish`";
5965
5997
  if (manifestDir) {
5966
5998
  args.push("--manifest-path", path10.join(manifestDir, "Cargo.toml"));
5967
5999
  }
5968
- await exec4("cargo", args, { throwOnError: true });
6000
+ await exec5("cargo", args, { throwOnError: true });
5969
6001
  } catch (error) {
5970
6002
  const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
5971
6003
  const message = stderr ? `Failed to run \`cargo publish --dry-run\`:
@@ -6063,7 +6095,7 @@ var cratesPublishTasks = createCratesPublishTask();
6063
6095
  import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter2 } from "@listr2/prompt-adapter-enquirer";
6064
6096
 
6065
6097
  // src/registry/jsr.ts
6066
- import { exec as exec5, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
6098
+ import { exec as exec6, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
6067
6099
 
6068
6100
  // src/utils/package-name.ts
6069
6101
  import { builtinModules } from "node:module";
@@ -6130,7 +6162,7 @@ var JsrRegisry = class extends Registry {
6130
6162
  this.client = new JsrClient(getApiEndpoint(this.registry));
6131
6163
  }
6132
6164
  async jsr(args) {
6133
- const { stdout } = await exec5("jsr", args, { throwOnError: true });
6165
+ const { stdout } = await exec6("jsr", args, { throwOnError: true });
6134
6166
  return stdout;
6135
6167
  }
6136
6168
  async isInstalled() {
@@ -6146,7 +6178,7 @@ var JsrRegisry = class extends Registry {
6146
6178
  }
6147
6179
  async ping() {
6148
6180
  try {
6149
- const { stdout } = await exec5(
6181
+ const { stdout } = await exec6(
6150
6182
  "ping",
6151
6183
  [new URL(this.registry).hostname, "-c", "1"],
6152
6184
  { throwOnError: true }
@@ -6161,7 +6193,7 @@ var JsrRegisry = class extends Registry {
6161
6193
  }
6162
6194
  async publish() {
6163
6195
  try {
6164
- await exec5(
6196
+ await exec6(
6165
6197
  "jsr",
6166
6198
  ["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
6167
6199
  {
@@ -6192,7 +6224,7 @@ ${stderr}` : ""}`,
6192
6224
  }
6193
6225
  async dryRunPublish() {
6194
6226
  try {
6195
- await exec5(
6227
+ await exec6(
6196
6228
  "jsr",
6197
6229
  [
6198
6230
  "publish",
@@ -6452,7 +6484,7 @@ async function jsrRegistry() {
6452
6484
  // src/registry/npm.ts
6453
6485
  import { tmpdir } from "node:os";
6454
6486
  import { join } from "node:path";
6455
- import { exec as exec6, NonZeroExitError as NonZeroExitError3 } from "tinyexec";
6487
+ import { exec as exec7, NonZeroExitError as NonZeroExitError3 } from "tinyexec";
6456
6488
  var NpmError = class extends AbstractError {
6457
6489
  constructor() {
6458
6490
  super(...arguments);
@@ -6465,7 +6497,7 @@ var NpmRegistry = class extends Registry {
6465
6497
  __publicField(this, "registry", "https://registry.npmjs.org");
6466
6498
  }
6467
6499
  async npm(args) {
6468
- const { stdout } = await exec6("npm", args, { throwOnError: true });
6500
+ const { stdout } = await exec7("npm", args, { throwOnError: true });
6469
6501
  return stdout;
6470
6502
  }
6471
6503
  async isInstalled() {
@@ -6576,7 +6608,7 @@ var NpmRegistry = class extends Registry {
6576
6608
  }
6577
6609
  async ping() {
6578
6610
  try {
6579
- await exec6("npm", ["ping"], { throwOnError: true });
6611
+ await exec7("npm", ["ping"], { throwOnError: true });
6580
6612
  return true;
6581
6613
  } catch (error) {
6582
6614
  throw new NpmError("Failed to run `npm ping`", { cause: error });
@@ -6607,7 +6639,7 @@ var NpmRegistry = class extends Registry {
6607
6639
  }
6608
6640
  async dryRunPublish() {
6609
6641
  try {
6610
- await exec6("npm", ["publish", "--dry-run"], {
6642
+ await exec7("npm", ["publish", "--dry-run"], {
6611
6643
  throwOnError: true,
6612
6644
  nodeOptions: {
6613
6645
  env: {
@@ -7245,10 +7277,10 @@ var prerequisitesCheckTask = (options) => {
7245
7277
  import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter6 } from "@listr2/prompt-adapter-enquirer";
7246
7278
 
7247
7279
  // src/registry/custom-registry.ts
7248
- import { exec as exec7 } from "tinyexec";
7280
+ import { exec as exec8 } from "tinyexec";
7249
7281
  var CustomRegistry = class extends NpmRegistry {
7250
7282
  async npm(args) {
7251
- const { stdout } = await exec7(
7283
+ const { stdout } = await exec8(
7252
7284
  "npm",
7253
7285
  args.concat("--registry", this.registry),
7254
7286
  { throwOnError: true }
@@ -7564,7 +7596,7 @@ async function run(options) {
7564
7596
  task: async (ctx2) => {
7565
7597
  const packageManager = await getPackageManager();
7566
7598
  try {
7567
- await exec8(packageManager, ["run", ctx2.testScript], {
7599
+ await exec9(packageManager, ["run", ctx2.testScript], {
7568
7600
  throwOnError: true
7569
7601
  });
7570
7602
  } catch (error) {
@@ -7581,7 +7613,7 @@ async function run(options) {
7581
7613
  task: async (ctx2) => {
7582
7614
  const packageManager = await getPackageManager();
7583
7615
  try {
7584
- await exec8(packageManager, ["run", ctx2.buildScript], {
7616
+ await exec9(packageManager, ["run", ctx2.buildScript], {
7585
7617
  throwOnError: true
7586
7618
  });
7587
7619
  } catch (error) {
package/dist/index.cjs CHANGED
@@ -4486,7 +4486,7 @@ var Listr = (_a23 = class {
4486
4486
  // src/tasks/runner.ts
4487
4487
  var import_semver3 = __toESM(require("semver"), 1);
4488
4488
  var import_std_env = require("std-env");
4489
- var import_tinyexec7 = require("tinyexec");
4489
+ var import_tinyexec8 = require("tinyexec");
4490
4490
 
4491
4491
  // src/error.ts
4492
4492
  var AbstractError = class extends Error {
@@ -4818,6 +4818,7 @@ function link2(text, url) {
4818
4818
  var import_promises2 = require("fs/promises");
4819
4819
  var import_node_path2 = __toESM(require("path"), 1);
4820
4820
  var import_smol_toml = require("smol-toml");
4821
+ var import_tinyexec2 = require("tinyexec");
4821
4822
 
4822
4823
  // src/ecosystem/ecosystem.ts
4823
4824
  var Ecosystem = class {
@@ -4860,6 +4861,28 @@ var RustEcosystem = class extends Ecosystem {
4860
4861
  pkg.version = newVersion;
4861
4862
  await (0, import_promises2.writeFile)(filePath, (0, import_smol_toml.stringify)(cargo));
4862
4863
  }
4864
+ async syncLockfile() {
4865
+ const lockfilePath = await this.findLockfile();
4866
+ if (!lockfilePath) return void 0;
4867
+ const name = await this.packageName();
4868
+ await (0, import_tinyexec2.exec)("cargo", ["update", "--package", name], {
4869
+ nodeOptions: { cwd: import_node_path2.default.dirname(lockfilePath) }
4870
+ });
4871
+ return lockfilePath;
4872
+ }
4873
+ async findLockfile() {
4874
+ let dir = this.packagePath;
4875
+ const { root } = import_node_path2.default.parse(dir);
4876
+ while (dir !== root) {
4877
+ const candidate = import_node_path2.default.join(dir, "Cargo.lock");
4878
+ try {
4879
+ if ((await (0, import_promises2.stat)(candidate)).isFile()) return candidate;
4880
+ } catch {
4881
+ }
4882
+ dir = import_node_path2.default.dirname(dir);
4883
+ }
4884
+ return void 0;
4885
+ }
4863
4886
  async dependencies() {
4864
4887
  const cargo = await this.readCargoToml();
4865
4888
  const deps = [];
@@ -5167,10 +5190,19 @@ async function replaceVersion(version2, packages) {
5167
5190
  { cause: error }
5168
5191
  );
5169
5192
  }
5170
- return import_node_path3.default.join(pkg.path, "Cargo.toml");
5193
+ let lockfilePath;
5194
+ try {
5195
+ lockfilePath = await eco.syncLockfile();
5196
+ } catch (error) {
5197
+ throw new AbstractError(
5198
+ `Failed to sync Cargo.lock at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
5199
+ { cause: error }
5200
+ );
5201
+ }
5202
+ return [import_node_path3.default.join(pkg.path, "Cargo.toml"), lockfilePath];
5171
5203
  })
5172
5204
  ]);
5173
- return results.filter((v) => v);
5205
+ return [...new Set(results.flat().filter((v) => !!v))];
5174
5206
  }
5175
5207
 
5176
5208
  // src/utils/package-manager.ts
@@ -5332,7 +5364,7 @@ function injectTokensToEnv(tokens) {
5332
5364
 
5333
5365
  // src/registry/crates.ts
5334
5366
  var import_node_path5 = __toESM(require("path"), 1);
5335
- var import_tinyexec2 = require("tinyexec");
5367
+ var import_tinyexec3 = require("tinyexec");
5336
5368
 
5337
5369
  // src/registry/registry.ts
5338
5370
  var Registry = class {
@@ -5372,7 +5404,7 @@ var CratesRegistry = class extends Registry {
5372
5404
  }
5373
5405
  async isInstalled() {
5374
5406
  try {
5375
- await (0, import_tinyexec2.exec)("cargo", ["--version"]);
5407
+ await (0, import_tinyexec3.exec)("cargo", ["--version"]);
5376
5408
  return true;
5377
5409
  } catch {
5378
5410
  return false;
@@ -5413,10 +5445,10 @@ var CratesRegistry = class extends Registry {
5413
5445
  if (manifestDir) {
5414
5446
  args.push("--manifest-path", import_node_path5.default.join(manifestDir, "Cargo.toml"));
5415
5447
  }
5416
- await (0, import_tinyexec2.exec)("cargo", args, { throwOnError: true });
5448
+ await (0, import_tinyexec3.exec)("cargo", args, { throwOnError: true });
5417
5449
  return true;
5418
5450
  } catch (error) {
5419
- const stderr = error instanceof import_tinyexec2.NonZeroExitError ? error.output?.stderr : void 0;
5451
+ const stderr = error instanceof import_tinyexec3.NonZeroExitError ? error.output?.stderr : void 0;
5420
5452
  const message = stderr ? `Failed to run \`cargo publish\`:
5421
5453
  ${stderr}` : "Failed to run `cargo publish`";
5422
5454
  throw new CratesError(message, { cause: error });
@@ -5428,9 +5460,9 @@ ${stderr}` : "Failed to run `cargo publish`";
5428
5460
  if (manifestDir) {
5429
5461
  args.push("--manifest-path", import_node_path5.default.join(manifestDir, "Cargo.toml"));
5430
5462
  }
5431
- await (0, import_tinyexec2.exec)("cargo", args, { throwOnError: true });
5463
+ await (0, import_tinyexec3.exec)("cargo", args, { throwOnError: true });
5432
5464
  } catch (error) {
5433
- const stderr = error instanceof import_tinyexec2.NonZeroExitError ? error.output?.stderr : void 0;
5465
+ const stderr = error instanceof import_tinyexec3.NonZeroExitError ? error.output?.stderr : void 0;
5434
5466
  const message = stderr ? `Failed to run \`cargo publish --dry-run\`:
5435
5467
  ${stderr}` : "Failed to run `cargo publish --dry-run`";
5436
5468
  throw new CratesError(message, { cause: error });
@@ -5526,7 +5558,7 @@ var cratesPublishTasks = createCratesPublishTask();
5526
5558
  var import_prompt_adapter_enquirer = require("@listr2/prompt-adapter-enquirer");
5527
5559
 
5528
5560
  // src/registry/jsr.ts
5529
- var import_tinyexec3 = require("tinyexec");
5561
+ var import_tinyexec4 = require("tinyexec");
5530
5562
 
5531
5563
  // src/utils/package-name.ts
5532
5564
  var import_node_module = require("module");
@@ -5594,7 +5626,7 @@ var JsrRegisry = class extends Registry {
5594
5626
  this.client = new JsrClient(getApiEndpoint(this.registry));
5595
5627
  }
5596
5628
  async jsr(args) {
5597
- const { stdout } = await (0, import_tinyexec3.exec)("jsr", args, { throwOnError: true });
5629
+ const { stdout } = await (0, import_tinyexec4.exec)("jsr", args, { throwOnError: true });
5598
5630
  return stdout;
5599
5631
  }
5600
5632
  async isInstalled() {
@@ -5610,7 +5642,7 @@ var JsrRegisry = class extends Registry {
5610
5642
  }
5611
5643
  async ping() {
5612
5644
  try {
5613
- const { stdout } = await (0, import_tinyexec3.exec)(
5645
+ const { stdout } = await (0, import_tinyexec4.exec)(
5614
5646
  "ping",
5615
5647
  [new URL(this.registry).hostname, "-c", "1"],
5616
5648
  { throwOnError: true }
@@ -5625,7 +5657,7 @@ var JsrRegisry = class extends Registry {
5625
5657
  }
5626
5658
  async publish() {
5627
5659
  try {
5628
- await (0, import_tinyexec3.exec)(
5660
+ await (0, import_tinyexec4.exec)(
5629
5661
  "jsr",
5630
5662
  ["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
5631
5663
  {
@@ -5635,7 +5667,7 @@ var JsrRegisry = class extends Registry {
5635
5667
  this.packageCreationUrls = void 0;
5636
5668
  return true;
5637
5669
  } catch (error) {
5638
- const stderr = error instanceof import_tinyexec3.NonZeroExitError ? error.output?.stderr : void 0;
5670
+ const stderr = error instanceof import_tinyexec4.NonZeroExitError ? error.output?.stderr : void 0;
5639
5671
  if (stderr?.includes("don't exist")) {
5640
5672
  const urls = [...stderr.matchAll(/https:\/\/jsr\.io\/new\S+/g)].map(
5641
5673
  (m) => m[0]
@@ -5656,7 +5688,7 @@ ${stderr}` : ""}`,
5656
5688
  }
5657
5689
  async dryRunPublish() {
5658
5690
  try {
5659
- await (0, import_tinyexec3.exec)(
5691
+ await (0, import_tinyexec4.exec)(
5660
5692
  "jsr",
5661
5693
  [
5662
5694
  "publish",
@@ -5916,7 +5948,7 @@ async function jsrRegistry() {
5916
5948
  // src/registry/npm.ts
5917
5949
  var import_node_os = require("os");
5918
5950
  var import_node_path6 = require("path");
5919
- var import_tinyexec4 = require("tinyexec");
5951
+ var import_tinyexec5 = require("tinyexec");
5920
5952
  var NpmError = class extends AbstractError {
5921
5953
  constructor() {
5922
5954
  super(...arguments);
@@ -5929,7 +5961,7 @@ var NpmRegistry = class extends Registry {
5929
5961
  __publicField(this, "registry", "https://registry.npmjs.org");
5930
5962
  }
5931
5963
  async npm(args) {
5932
- const { stdout } = await (0, import_tinyexec4.exec)("npm", args, { throwOnError: true });
5964
+ const { stdout } = await (0, import_tinyexec5.exec)("npm", args, { throwOnError: true });
5933
5965
  return stdout;
5934
5966
  }
5935
5967
  async isInstalled() {
@@ -5973,7 +6005,7 @@ var NpmRegistry = class extends Registry {
5973
6005
  await this.npm(["whoami"]);
5974
6006
  return true;
5975
6007
  } catch (error) {
5976
- if (error instanceof import_tinyexec4.NonZeroExitError) {
6008
+ if (error instanceof import_tinyexec5.NonZeroExitError) {
5977
6009
  return false;
5978
6010
  }
5979
6011
  throw new NpmError("Failed to run `npm whoami`", { cause: error });
@@ -6040,7 +6072,7 @@ var NpmRegistry = class extends Registry {
6040
6072
  }
6041
6073
  async ping() {
6042
6074
  try {
6043
- await (0, import_tinyexec4.exec)("npm", ["ping"], { throwOnError: true });
6075
+ await (0, import_tinyexec5.exec)("npm", ["ping"], { throwOnError: true });
6044
6076
  return true;
6045
6077
  } catch (error) {
6046
6078
  throw new NpmError("Failed to run `npm ping`", { cause: error });
@@ -6051,7 +6083,7 @@ var NpmRegistry = class extends Registry {
6051
6083
  await this.npm(["publish", "--provenance", "--access", "public"]);
6052
6084
  return true;
6053
6085
  } catch (error) {
6054
- if (error instanceof import_tinyexec4.NonZeroExitError && error.output?.stderr.includes("EOTP")) {
6086
+ if (error instanceof import_tinyexec5.NonZeroExitError && error.output?.stderr.includes("EOTP")) {
6055
6087
  return false;
6056
6088
  }
6057
6089
  throw this.classifyPublishError(error);
@@ -6063,7 +6095,7 @@ var NpmRegistry = class extends Registry {
6063
6095
  await this.npm(args);
6064
6096
  return true;
6065
6097
  } catch (error) {
6066
- if (error instanceof import_tinyexec4.NonZeroExitError && error.output?.stderr.includes("EOTP")) {
6098
+ if (error instanceof import_tinyexec5.NonZeroExitError && error.output?.stderr.includes("EOTP")) {
6067
6099
  return false;
6068
6100
  }
6069
6101
  throw this.classifyPublishError(error);
@@ -6071,7 +6103,7 @@ var NpmRegistry = class extends Registry {
6071
6103
  }
6072
6104
  async dryRunPublish() {
6073
6105
  try {
6074
- await (0, import_tinyexec4.exec)("npm", ["publish", "--dry-run"], {
6106
+ await (0, import_tinyexec5.exec)("npm", ["publish", "--dry-run"], {
6075
6107
  throwOnError: true,
6076
6108
  nodeOptions: {
6077
6109
  env: {
@@ -6081,7 +6113,7 @@ var NpmRegistry = class extends Registry {
6081
6113
  }
6082
6114
  });
6083
6115
  } catch (error) {
6084
- const stderr = error instanceof import_tinyexec4.NonZeroExitError ? error.output?.stderr : void 0;
6116
+ const stderr = error instanceof import_tinyexec5.NonZeroExitError ? error.output?.stderr : void 0;
6085
6117
  throw new NpmError(
6086
6118
  `Failed to run \`npm publish --dry-run\`${stderr ? `
6087
6119
  ${stderr}` : ""}`,
@@ -6108,7 +6140,7 @@ ${stderr}` : ""}`,
6108
6140
  };
6109
6141
  }
6110
6142
  classifyPublishError(error) {
6111
- if (error instanceof import_tinyexec4.NonZeroExitError) {
6143
+ if (error instanceof import_tinyexec5.NonZeroExitError) {
6112
6144
  const stderr = error.output?.stderr ?? "";
6113
6145
  if (stderr.includes("EOTP")) {
6114
6146
  return new NpmError("OTP required for publishing", { cause: error });
@@ -6562,7 +6594,7 @@ var npmPublishTasks = {
6562
6594
  // src/tasks/preflight.ts
6563
6595
  var import_node_crypto2 = require("crypto");
6564
6596
  var import_prompt_adapter_enquirer4 = require("@listr2/prompt-adapter-enquirer");
6565
- var import_tinyexec5 = require("tinyexec");
6597
+ var import_tinyexec6 = require("tinyexec");
6566
6598
  var PreflightError = class extends AbstractError {
6567
6599
  constructor() {
6568
6600
  super(...arguments);
@@ -6589,7 +6621,7 @@ async function syncGhSecrets(tokens) {
6589
6621
  for (const [registry, token] of Object.entries(tokens)) {
6590
6622
  const config = TOKEN_CONFIG[registry];
6591
6623
  if (!config) continue;
6592
- const result = (0, import_tinyexec5.exec)("gh", ["secret", "set", config.ghSecretName], {
6624
+ const result = (0, import_tinyexec6.exec)("gh", ["secret", "set", config.ghSecretName], {
6593
6625
  throwOnError: true
6594
6626
  });
6595
6627
  const proc = result.process;
@@ -6783,10 +6815,10 @@ var prerequisitesCheckTask = (options) => {
6783
6815
  var import_prompt_adapter_enquirer6 = require("@listr2/prompt-adapter-enquirer");
6784
6816
 
6785
6817
  // src/registry/custom-registry.ts
6786
- var import_tinyexec6 = require("tinyexec");
6818
+ var import_tinyexec7 = require("tinyexec");
6787
6819
  var CustomRegistry = class extends NpmRegistry {
6788
6820
  async npm(args) {
6789
- const { stdout } = await (0, import_tinyexec6.exec)(
6821
+ const { stdout } = await (0, import_tinyexec7.exec)(
6790
6822
  "npm",
6791
6823
  args.concat("--registry", this.registry),
6792
6824
  { throwOnError: true }
@@ -7103,7 +7135,7 @@ async function run(options) {
7103
7135
  task: async (ctx2) => {
7104
7136
  const packageManager = await getPackageManager();
7105
7137
  try {
7106
- await (0, import_tinyexec7.exec)(packageManager, ["run", ctx2.testScript], {
7138
+ await (0, import_tinyexec8.exec)(packageManager, ["run", ctx2.testScript], {
7107
7139
  throwOnError: true
7108
7140
  });
7109
7141
  } catch (error) {
@@ -7120,7 +7152,7 @@ async function run(options) {
7120
7152
  task: async (ctx2) => {
7121
7153
  const packageManager = await getPackageManager();
7122
7154
  try {
7123
- await (0, import_tinyexec7.exec)(packageManager, ["run", ctx2.buildScript], {
7155
+ await (0, import_tinyexec8.exec)(packageManager, ["run", ctx2.buildScript], {
7124
7156
  throwOnError: true
7125
7157
  });
7126
7158
  } catch (error) {
package/dist/index.js CHANGED
@@ -4453,7 +4453,7 @@ var Listr = (_a23 = class {
4453
4453
  // src/tasks/runner.ts
4454
4454
  import SemVer from "semver";
4455
4455
  import { isCI as isCI2 } from "std-env";
4456
- import { exec as exec8 } from "tinyexec";
4456
+ import { exec as exec9 } from "tinyexec";
4457
4457
 
4458
4458
  // src/error.ts
4459
4459
  var AbstractError = class extends Error {
@@ -4785,6 +4785,7 @@ function link2(text, url) {
4785
4785
  import { readFile, stat as stat2, writeFile } from "node:fs/promises";
4786
4786
  import path2 from "node:path";
4787
4787
  import { parse, stringify } from "smol-toml";
4788
+ import { exec as exec3 } from "tinyexec";
4788
4789
 
4789
4790
  // src/ecosystem/ecosystem.ts
4790
4791
  var Ecosystem = class {
@@ -4827,6 +4828,28 @@ var RustEcosystem = class extends Ecosystem {
4827
4828
  pkg.version = newVersion;
4828
4829
  await writeFile(filePath, stringify(cargo));
4829
4830
  }
4831
+ async syncLockfile() {
4832
+ const lockfilePath = await this.findLockfile();
4833
+ if (!lockfilePath) return void 0;
4834
+ const name = await this.packageName();
4835
+ await exec3("cargo", ["update", "--package", name], {
4836
+ nodeOptions: { cwd: path2.dirname(lockfilePath) }
4837
+ });
4838
+ return lockfilePath;
4839
+ }
4840
+ async findLockfile() {
4841
+ let dir = this.packagePath;
4842
+ const { root } = path2.parse(dir);
4843
+ while (dir !== root) {
4844
+ const candidate = path2.join(dir, "Cargo.lock");
4845
+ try {
4846
+ if ((await stat2(candidate)).isFile()) return candidate;
4847
+ } catch {
4848
+ }
4849
+ dir = path2.dirname(dir);
4850
+ }
4851
+ return void 0;
4852
+ }
4830
4853
  async dependencies() {
4831
4854
  const cargo = await this.readCargoToml();
4832
4855
  const deps = [];
@@ -5134,10 +5157,19 @@ async function replaceVersion(version2, packages) {
5134
5157
  { cause: error }
5135
5158
  );
5136
5159
  }
5137
- return path3.join(pkg.path, "Cargo.toml");
5160
+ let lockfilePath;
5161
+ try {
5162
+ lockfilePath = await eco.syncLockfile();
5163
+ } catch (error) {
5164
+ throw new AbstractError(
5165
+ `Failed to sync Cargo.lock at ${pkg.path}: ${error instanceof Error ? error.message : error}`,
5166
+ { cause: error }
5167
+ );
5168
+ }
5169
+ return [path3.join(pkg.path, "Cargo.toml"), lockfilePath];
5138
5170
  })
5139
5171
  ]);
5140
- return results.filter((v) => v);
5172
+ return [...new Set(results.flat().filter((v) => !!v))];
5141
5173
  }
5142
5174
 
5143
5175
  // src/utils/package-manager.ts
@@ -5298,7 +5330,7 @@ function injectTokensToEnv(tokens) {
5298
5330
 
5299
5331
  // src/registry/crates.ts
5300
5332
  import path5 from "node:path";
5301
- import { exec as exec3, NonZeroExitError } from "tinyexec";
5333
+ import { exec as exec4, NonZeroExitError } from "tinyexec";
5302
5334
 
5303
5335
  // src/registry/registry.ts
5304
5336
  var Registry = class {
@@ -5338,7 +5370,7 @@ var CratesRegistry = class extends Registry {
5338
5370
  }
5339
5371
  async isInstalled() {
5340
5372
  try {
5341
- await exec3("cargo", ["--version"]);
5373
+ await exec4("cargo", ["--version"]);
5342
5374
  return true;
5343
5375
  } catch {
5344
5376
  return false;
@@ -5379,7 +5411,7 @@ var CratesRegistry = class extends Registry {
5379
5411
  if (manifestDir) {
5380
5412
  args.push("--manifest-path", path5.join(manifestDir, "Cargo.toml"));
5381
5413
  }
5382
- await exec3("cargo", args, { throwOnError: true });
5414
+ await exec4("cargo", args, { throwOnError: true });
5383
5415
  return true;
5384
5416
  } catch (error) {
5385
5417
  const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
@@ -5394,7 +5426,7 @@ ${stderr}` : "Failed to run `cargo publish`";
5394
5426
  if (manifestDir) {
5395
5427
  args.push("--manifest-path", path5.join(manifestDir, "Cargo.toml"));
5396
5428
  }
5397
- await exec3("cargo", args, { throwOnError: true });
5429
+ await exec4("cargo", args, { throwOnError: true });
5398
5430
  } catch (error) {
5399
5431
  const stderr = error instanceof NonZeroExitError ? error.output?.stderr : void 0;
5400
5432
  const message = stderr ? `Failed to run \`cargo publish --dry-run\`:
@@ -5492,7 +5524,7 @@ var cratesPublishTasks = createCratesPublishTask();
5492
5524
  import { ListrEnquirerPromptAdapter } from "@listr2/prompt-adapter-enquirer";
5493
5525
 
5494
5526
  // src/registry/jsr.ts
5495
- import { exec as exec4, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
5527
+ import { exec as exec5, NonZeroExitError as NonZeroExitError2 } from "tinyexec";
5496
5528
 
5497
5529
  // src/utils/package-name.ts
5498
5530
  import { builtinModules } from "node:module";
@@ -5559,7 +5591,7 @@ var JsrRegisry = class extends Registry {
5559
5591
  this.client = new JsrClient(getApiEndpoint(this.registry));
5560
5592
  }
5561
5593
  async jsr(args) {
5562
- const { stdout } = await exec4("jsr", args, { throwOnError: true });
5594
+ const { stdout } = await exec5("jsr", args, { throwOnError: true });
5563
5595
  return stdout;
5564
5596
  }
5565
5597
  async isInstalled() {
@@ -5575,7 +5607,7 @@ var JsrRegisry = class extends Registry {
5575
5607
  }
5576
5608
  async ping() {
5577
5609
  try {
5578
- const { stdout } = await exec4(
5610
+ const { stdout } = await exec5(
5579
5611
  "ping",
5580
5612
  [new URL(this.registry).hostname, "-c", "1"],
5581
5613
  { throwOnError: true }
@@ -5590,7 +5622,7 @@ var JsrRegisry = class extends Registry {
5590
5622
  }
5591
5623
  async publish() {
5592
5624
  try {
5593
- await exec4(
5625
+ await exec5(
5594
5626
  "jsr",
5595
5627
  ["publish", "--allow-dirty", "--token", `${JsrClient.token}`],
5596
5628
  {
@@ -5621,7 +5653,7 @@ ${stderr}` : ""}`,
5621
5653
  }
5622
5654
  async dryRunPublish() {
5623
5655
  try {
5624
- await exec4(
5656
+ await exec5(
5625
5657
  "jsr",
5626
5658
  [
5627
5659
  "publish",
@@ -5881,7 +5913,7 @@ async function jsrRegistry() {
5881
5913
  // src/registry/npm.ts
5882
5914
  import { tmpdir } from "node:os";
5883
5915
  import { join } from "node:path";
5884
- import { exec as exec5, NonZeroExitError as NonZeroExitError3 } from "tinyexec";
5916
+ import { exec as exec6, NonZeroExitError as NonZeroExitError3 } from "tinyexec";
5885
5917
  var NpmError = class extends AbstractError {
5886
5918
  constructor() {
5887
5919
  super(...arguments);
@@ -5894,7 +5926,7 @@ var NpmRegistry = class extends Registry {
5894
5926
  __publicField(this, "registry", "https://registry.npmjs.org");
5895
5927
  }
5896
5928
  async npm(args) {
5897
- const { stdout } = await exec5("npm", args, { throwOnError: true });
5929
+ const { stdout } = await exec6("npm", args, { throwOnError: true });
5898
5930
  return stdout;
5899
5931
  }
5900
5932
  async isInstalled() {
@@ -6005,7 +6037,7 @@ var NpmRegistry = class extends Registry {
6005
6037
  }
6006
6038
  async ping() {
6007
6039
  try {
6008
- await exec5("npm", ["ping"], { throwOnError: true });
6040
+ await exec6("npm", ["ping"], { throwOnError: true });
6009
6041
  return true;
6010
6042
  } catch (error) {
6011
6043
  throw new NpmError("Failed to run `npm ping`", { cause: error });
@@ -6036,7 +6068,7 @@ var NpmRegistry = class extends Registry {
6036
6068
  }
6037
6069
  async dryRunPublish() {
6038
6070
  try {
6039
- await exec5("npm", ["publish", "--dry-run"], {
6071
+ await exec6("npm", ["publish", "--dry-run"], {
6040
6072
  throwOnError: true,
6041
6073
  nodeOptions: {
6042
6074
  env: {
@@ -6527,7 +6559,7 @@ var npmPublishTasks = {
6527
6559
  // src/tasks/preflight.ts
6528
6560
  import { createHash as createHash2 } from "node:crypto";
6529
6561
  import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter4 } from "@listr2/prompt-adapter-enquirer";
6530
- import { exec as exec6 } from "tinyexec";
6562
+ import { exec as exec7 } from "tinyexec";
6531
6563
  var PreflightError = class extends AbstractError {
6532
6564
  constructor() {
6533
6565
  super(...arguments);
@@ -6554,7 +6586,7 @@ async function syncGhSecrets(tokens) {
6554
6586
  for (const [registry, token] of Object.entries(tokens)) {
6555
6587
  const config = TOKEN_CONFIG[registry];
6556
6588
  if (!config) continue;
6557
- const result = exec6("gh", ["secret", "set", config.ghSecretName], {
6589
+ const result = exec7("gh", ["secret", "set", config.ghSecretName], {
6558
6590
  throwOnError: true
6559
6591
  });
6560
6592
  const proc = result.process;
@@ -6748,10 +6780,10 @@ var prerequisitesCheckTask = (options) => {
6748
6780
  import { ListrEnquirerPromptAdapter as ListrEnquirerPromptAdapter6 } from "@listr2/prompt-adapter-enquirer";
6749
6781
 
6750
6782
  // src/registry/custom-registry.ts
6751
- import { exec as exec7 } from "tinyexec";
6783
+ import { exec as exec8 } from "tinyexec";
6752
6784
  var CustomRegistry = class extends NpmRegistry {
6753
6785
  async npm(args) {
6754
- const { stdout } = await exec7(
6786
+ const { stdout } = await exec8(
6755
6787
  "npm",
6756
6788
  args.concat("--registry", this.registry),
6757
6789
  { throwOnError: true }
@@ -7067,7 +7099,7 @@ async function run(options) {
7067
7099
  task: async (ctx2) => {
7068
7100
  const packageManager = await getPackageManager();
7069
7101
  try {
7070
- await exec8(packageManager, ["run", ctx2.testScript], {
7102
+ await exec9(packageManager, ["run", ctx2.testScript], {
7071
7103
  throwOnError: true
7072
7104
  });
7073
7105
  } catch (error) {
@@ -7084,7 +7116,7 @@ async function run(options) {
7084
7116
  task: async (ctx2) => {
7085
7117
  const packageManager = await getPackageManager();
7086
7118
  try {
7087
- await exec8(packageManager, ["run", ctx2.buildScript], {
7119
+ await exec9(packageManager, ["run", ctx2.buildScript], {
7088
7120
  throwOnError: true
7089
7121
  });
7090
7122
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pubm",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "engines": {
5
5
  "node": ">=18",
6
6
  "git": ">=2.11.0"