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.cjs CHANGED
@@ -4394,11 +4394,17 @@ class UserConfig {
4394
4394
  const __filename$4 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
4395
4395
  const __dirname$4 = path.dirname(__filename$4);
4396
4396
 
4397
+ // Determine proto path based on whether we're running from dist or src
4398
+ const inDist$3 = __dirname$4.includes('/dist') || __dirname$4.includes('\\dist');
4399
+ const protoDir$3 = inDist$3
4400
+ ? path.join(__dirname$4, '..', 'src', 'protos')
4401
+ : path.join(__dirname$4, '..', 'protos');
4402
+
4397
4403
  class JJCheckout {
4398
4404
  constructor(fs, dir) {
4399
4405
  this.fs = fs;
4400
4406
  this.dir = dir;
4401
- this.protoPath = path.join(__dirname$4, '..', 'protos', 'local_working_copy.proto');
4407
+ this.protoPath = path.join(protoDir$3, 'local_working_copy.proto');
4402
4408
  }
4403
4409
 
4404
4410
  /**
@@ -4470,11 +4476,17 @@ class JJCheckout {
4470
4476
  const __filename$3 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
4471
4477
  const __dirname$3 = path.dirname(__filename$3);
4472
4478
 
4479
+ // Determine proto path based on whether we're running from dist or src
4480
+ const inDist$2 = __dirname$3.includes('/dist') || __dirname$3.includes('\\dist');
4481
+ const protoDir$2 = inDist$2
4482
+ ? path.join(__dirname$3, '..', 'src', 'protos')
4483
+ : path.join(__dirname$3, '..', 'protos');
4484
+
4473
4485
  class JJTreeState {
4474
4486
  constructor(fs, dir) {
4475
4487
  this.fs = fs;
4476
4488
  this.dir = dir;
4477
- this.protoPath = path.join(__dirname$3, '..', 'protos', 'local_working_copy.proto');
4489
+ this.protoPath = path.join(protoDir$2, 'local_working_copy.proto');
4478
4490
  }
4479
4491
 
4480
4492
  /**
@@ -4562,11 +4574,17 @@ class JJTreeState {
4562
4574
  const __filename$2 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
4563
4575
  const __dirname$2 = path.dirname(__filename$2);
4564
4576
 
4577
+ // Determine proto path based on whether we're running from dist or src
4578
+ const inDist$1 = __dirname$2.includes('/dist') || __dirname$2.includes('\\dist');
4579
+ const protoDir$1 = inDist$1
4580
+ ? path.join(__dirname$2, '..', 'src', 'protos')
4581
+ : path.join(__dirname$2, '..', 'protos');
4582
+
4565
4583
  class JJOperationStore {
4566
4584
  constructor(fs, dir) {
4567
4585
  this.fs = fs;
4568
4586
  this.dir = dir;
4569
- this.protoPath = path.join(__dirname$2, '..', 'protos', 'simple_op_store.proto');
4587
+ this.protoPath = path.join(protoDir$1, 'simple_op_store.proto');
4570
4588
  }
4571
4589
 
4572
4590
  /**
@@ -4680,11 +4698,17 @@ class JJOperationStore {
4680
4698
  const __filename$1 = url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
4681
4699
  const __dirname$1 = path.dirname(__filename$1);
4682
4700
 
4701
+ // Determine proto path based on whether we're running from dist or src
4702
+ const inDist = __dirname$1.includes('/dist') || __dirname$1.includes('\\dist');
4703
+ const protoDir = inDist
4704
+ ? path.join(__dirname$1, '..', 'src', 'protos')
4705
+ : path.join(__dirname$1, '..', 'protos');
4706
+
4683
4707
  class JJViewStore {
4684
4708
  constructor(fs, dir) {
4685
4709
  this.fs = fs;
4686
4710
  this.dir = dir;
4687
- this.protoPath = path.join(__dirname$1, '..', 'protos', 'simple_op_store.proto');
4711
+ this.protoPath = path.join(protoDir, 'simple_op_store.proto');
4688
4712
  }
4689
4713
 
4690
4714
  /**
@@ -10770,9 +10794,21 @@ async function createJJ(options) {
10770
10794
  * @returns {Promise<Object>} Bookmark info
10771
10795
  */
10772
10796
  async set(args) {
10797
+ // Normalize: accept common parameter aliases
10798
+ if (args) {
10799
+ if (args.target && !args.changeId) {
10800
+ args = { ...args, changeId: args.target };
10801
+ } else if (args.change && !args.changeId) {
10802
+ args = { ...args, changeId: args.change };
10803
+ } else if (args.revision && !args.changeId) {
10804
+ args = { ...args, changeId: args.revision };
10805
+ }
10806
+ }
10807
+
10773
10808
  if (!args || !args.name || !args.changeId) {
10774
10809
  throw new JJError('INVALID_ARGUMENT', 'Missing name or changeId', {
10775
- suggestion: 'Provide both: { name: "main", changeId: "abc123..." }',
10810
+ args,
10811
+ suggestion: 'Provide both: { name: "main", changeId: "abc123..." } (or use target/change/revision instead of changeId)',
10776
10812
  });
10777
10813
  }
10778
10814
 
@@ -10808,6 +10844,17 @@ async function createJJ(options) {
10808
10844
  * @returns {Promise<Object>} Bookmark info
10809
10845
  */
10810
10846
  async create(args) {
10847
+ // Normalize: accept common parameter aliases
10848
+ if (args) {
10849
+ if (args.target && !args.changeId) {
10850
+ args = { ...args, changeId: args.target };
10851
+ } else if (args.change && !args.changeId) {
10852
+ args = { ...args, changeId: args.change };
10853
+ } else if (args.revision && !args.changeId) {
10854
+ args = { ...args, changeId: args.revision };
10855
+ }
10856
+ }
10857
+
10811
10858
  if (!args || !args.name) {
10812
10859
  throw new JJError('INVALID_ARGUMENT', 'Missing name argument', {
10813
10860
  suggestion: 'Provide: { name: "main", changeId: "abc123..." } or { name: "main" } for working copy',
@@ -10860,9 +10907,23 @@ async function createJJ(options) {
10860
10907
  * @returns {Promise<Object>} Move result
10861
10908
  */
10862
10909
  async move(args) {
10910
+ // Normalize: accept common parameter aliases
10911
+ if (args) {
10912
+ if (args.target && !args.to) {
10913
+ args = { ...args, to: args.target };
10914
+ } else if (args.changeId && !args.to) {
10915
+ args = { ...args, to: args.changeId };
10916
+ } else if (args.change && !args.to) {
10917
+ args = { ...args, to: args.change };
10918
+ } else if (args.revision && !args.to) {
10919
+ args = { ...args, to: args.revision };
10920
+ }
10921
+ }
10922
+
10863
10923
  if (!args || !args.name || !args.to) {
10864
10924
  throw new JJError('INVALID_ARGUMENT', 'Missing name or to', {
10865
- suggestion: 'Provide both: { name: "main", to: "abc123..." }',
10925
+ args,
10926
+ suggestion: 'Provide both: { name: "main", to: "abc123..." } (or use target/changeId/change/revision instead of to)',
10866
10927
  });
10867
10928
  }
10868
10929