isomorphic-jj 1.1.2 → 1.1.3

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.mjs CHANGED
@@ -4391,11 +4391,17 @@ class UserConfig {
4391
4391
  const __filename$3 = fileURLToPath(import.meta.url);
4392
4392
  const __dirname$3 = path.dirname(__filename$3);
4393
4393
 
4394
+ // Determine proto path based on whether we're running from dist or src
4395
+ const inDist$3 = __dirname$3.includes('/dist') || __dirname$3.includes('\\dist');
4396
+ const protoDir$3 = inDist$3
4397
+ ? path.join(__dirname$3, '..', 'src', 'protos')
4398
+ : path.join(__dirname$3, '..', 'protos');
4399
+
4394
4400
  class JJCheckout {
4395
4401
  constructor(fs, dir) {
4396
4402
  this.fs = fs;
4397
4403
  this.dir = dir;
4398
- this.protoPath = path.join(__dirname$3, '..', 'protos', 'local_working_copy.proto');
4404
+ this.protoPath = path.join(protoDir$3, 'local_working_copy.proto');
4399
4405
  }
4400
4406
 
4401
4407
  /**
@@ -4467,11 +4473,17 @@ class JJCheckout {
4467
4473
  const __filename$2 = fileURLToPath(import.meta.url);
4468
4474
  const __dirname$2 = path.dirname(__filename$2);
4469
4475
 
4476
+ // Determine proto path based on whether we're running from dist or src
4477
+ const inDist$2 = __dirname$2.includes('/dist') || __dirname$2.includes('\\dist');
4478
+ const protoDir$2 = inDist$2
4479
+ ? path.join(__dirname$2, '..', 'src', 'protos')
4480
+ : path.join(__dirname$2, '..', 'protos');
4481
+
4470
4482
  class JJTreeState {
4471
4483
  constructor(fs, dir) {
4472
4484
  this.fs = fs;
4473
4485
  this.dir = dir;
4474
- this.protoPath = path.join(__dirname$2, '..', 'protos', 'local_working_copy.proto');
4486
+ this.protoPath = path.join(protoDir$2, 'local_working_copy.proto');
4475
4487
  }
4476
4488
 
4477
4489
  /**
@@ -4559,11 +4571,17 @@ class JJTreeState {
4559
4571
  const __filename$1 = fileURLToPath(import.meta.url);
4560
4572
  const __dirname$1 = path.dirname(__filename$1);
4561
4573
 
4574
+ // Determine proto path based on whether we're running from dist or src
4575
+ const inDist$1 = __dirname$1.includes('/dist') || __dirname$1.includes('\\dist');
4576
+ const protoDir$1 = inDist$1
4577
+ ? path.join(__dirname$1, '..', 'src', 'protos')
4578
+ : path.join(__dirname$1, '..', 'protos');
4579
+
4562
4580
  class JJOperationStore {
4563
4581
  constructor(fs, dir) {
4564
4582
  this.fs = fs;
4565
4583
  this.dir = dir;
4566
- this.protoPath = path.join(__dirname$1, '..', 'protos', 'simple_op_store.proto');
4584
+ this.protoPath = path.join(protoDir$1, 'simple_op_store.proto');
4567
4585
  }
4568
4586
 
4569
4587
  /**
@@ -4677,11 +4695,17 @@ class JJOperationStore {
4677
4695
  const __filename = fileURLToPath(import.meta.url);
4678
4696
  const __dirname = path.dirname(__filename);
4679
4697
 
4698
+ // Determine proto path based on whether we're running from dist or src
4699
+ const inDist = __dirname.includes('/dist') || __dirname.includes('\\dist');
4700
+ const protoDir = inDist
4701
+ ? path.join(__dirname, '..', 'src', 'protos')
4702
+ : path.join(__dirname, '..', 'protos');
4703
+
4680
4704
  class JJViewStore {
4681
4705
  constructor(fs, dir) {
4682
4706
  this.fs = fs;
4683
4707
  this.dir = dir;
4684
- this.protoPath = path.join(__dirname, '..', 'protos', 'simple_op_store.proto');
4708
+ this.protoPath = path.join(protoDir, 'simple_op_store.proto');
4685
4709
  }
4686
4710
 
4687
4711
  /**
@@ -10767,9 +10791,21 @@ async function createJJ(options) {
10767
10791
  * @returns {Promise<Object>} Bookmark info
10768
10792
  */
10769
10793
  async set(args) {
10794
+ // Normalize: accept common parameter aliases
10795
+ if (args) {
10796
+ if (args.target && !args.changeId) {
10797
+ args = { ...args, changeId: args.target };
10798
+ } else if (args.change && !args.changeId) {
10799
+ args = { ...args, changeId: args.change };
10800
+ } else if (args.revision && !args.changeId) {
10801
+ args = { ...args, changeId: args.revision };
10802
+ }
10803
+ }
10804
+
10770
10805
  if (!args || !args.name || !args.changeId) {
10771
10806
  throw new JJError('INVALID_ARGUMENT', 'Missing name or changeId', {
10772
- suggestion: 'Provide both: { name: "main", changeId: "abc123..." }',
10807
+ args,
10808
+ suggestion: 'Provide both: { name: "main", changeId: "abc123..." } (or use target/change/revision instead of changeId)',
10773
10809
  });
10774
10810
  }
10775
10811
 
@@ -10805,6 +10841,17 @@ async function createJJ(options) {
10805
10841
  * @returns {Promise<Object>} Bookmark info
10806
10842
  */
10807
10843
  async create(args) {
10844
+ // Normalize: accept common parameter aliases
10845
+ if (args) {
10846
+ if (args.target && !args.changeId) {
10847
+ args = { ...args, changeId: args.target };
10848
+ } else if (args.change && !args.changeId) {
10849
+ args = { ...args, changeId: args.change };
10850
+ } else if (args.revision && !args.changeId) {
10851
+ args = { ...args, changeId: args.revision };
10852
+ }
10853
+ }
10854
+
10808
10855
  if (!args || !args.name) {
10809
10856
  throw new JJError('INVALID_ARGUMENT', 'Missing name argument', {
10810
10857
  suggestion: 'Provide: { name: "main", changeId: "abc123..." } or { name: "main" } for working copy',
@@ -10857,9 +10904,23 @@ async function createJJ(options) {
10857
10904
  * @returns {Promise<Object>} Move result
10858
10905
  */
10859
10906
  async move(args) {
10907
+ // Normalize: accept common parameter aliases
10908
+ if (args) {
10909
+ if (args.target && !args.to) {
10910
+ args = { ...args, to: args.target };
10911
+ } else if (args.changeId && !args.to) {
10912
+ args = { ...args, to: args.changeId };
10913
+ } else if (args.change && !args.to) {
10914
+ args = { ...args, to: args.change };
10915
+ } else if (args.revision && !args.to) {
10916
+ args = { ...args, to: args.revision };
10917
+ }
10918
+ }
10919
+
10860
10920
  if (!args || !args.name || !args.to) {
10861
10921
  throw new JJError('INVALID_ARGUMENT', 'Missing name or to', {
10862
- suggestion: 'Provide both: { name: "main", to: "abc123..." }',
10922
+ args,
10923
+ suggestion: 'Provide both: { name: "main", to: "abc123..." } (or use target/changeId/change/revision instead of to)',
10863
10924
  });
10864
10925
  }
10865
10926