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 +67 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +67 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/repository.js +39 -2
- package/src/core/jj-checkout.js +7 -1
- package/src/core/jj-operation-store.js +7 -1
- package/src/core/jj-tree-state.js +7 -1
- package/src/core/jj-view-store.js +7 -1
package/package.json
CHANGED
package/src/api/repository.js
CHANGED
|
@@ -5331,9 +5331,21 @@ export async function createJJ(options) {
|
|
|
5331
5331
|
* @returns {Promise<Object>} Bookmark info
|
|
5332
5332
|
*/
|
|
5333
5333
|
async set(args) {
|
|
5334
|
+
// Normalize: accept common parameter aliases
|
|
5335
|
+
if (args) {
|
|
5336
|
+
if (args.target && !args.changeId) {
|
|
5337
|
+
args = { ...args, changeId: args.target };
|
|
5338
|
+
} else if (args.change && !args.changeId) {
|
|
5339
|
+
args = { ...args, changeId: args.change };
|
|
5340
|
+
} else if (args.revision && !args.changeId) {
|
|
5341
|
+
args = { ...args, changeId: args.revision };
|
|
5342
|
+
}
|
|
5343
|
+
}
|
|
5344
|
+
|
|
5334
5345
|
if (!args || !args.name || !args.changeId) {
|
|
5335
5346
|
throw new JJError('INVALID_ARGUMENT', 'Missing name or changeId', {
|
|
5336
|
-
|
|
5347
|
+
args,
|
|
5348
|
+
suggestion: 'Provide both: { name: "main", changeId: "abc123..." } (or use target/change/revision instead of changeId)',
|
|
5337
5349
|
});
|
|
5338
5350
|
}
|
|
5339
5351
|
|
|
@@ -5369,6 +5381,17 @@ export async function createJJ(options) {
|
|
|
5369
5381
|
* @returns {Promise<Object>} Bookmark info
|
|
5370
5382
|
*/
|
|
5371
5383
|
async create(args) {
|
|
5384
|
+
// Normalize: accept common parameter aliases
|
|
5385
|
+
if (args) {
|
|
5386
|
+
if (args.target && !args.changeId) {
|
|
5387
|
+
args = { ...args, changeId: args.target };
|
|
5388
|
+
} else if (args.change && !args.changeId) {
|
|
5389
|
+
args = { ...args, changeId: args.change };
|
|
5390
|
+
} else if (args.revision && !args.changeId) {
|
|
5391
|
+
args = { ...args, changeId: args.revision };
|
|
5392
|
+
}
|
|
5393
|
+
}
|
|
5394
|
+
|
|
5372
5395
|
if (!args || !args.name) {
|
|
5373
5396
|
throw new JJError('INVALID_ARGUMENT', 'Missing name argument', {
|
|
5374
5397
|
suggestion: 'Provide: { name: "main", changeId: "abc123..." } or { name: "main" } for working copy',
|
|
@@ -5421,9 +5444,23 @@ export async function createJJ(options) {
|
|
|
5421
5444
|
* @returns {Promise<Object>} Move result
|
|
5422
5445
|
*/
|
|
5423
5446
|
async move(args) {
|
|
5447
|
+
// Normalize: accept common parameter aliases
|
|
5448
|
+
if (args) {
|
|
5449
|
+
if (args.target && !args.to) {
|
|
5450
|
+
args = { ...args, to: args.target };
|
|
5451
|
+
} else if (args.changeId && !args.to) {
|
|
5452
|
+
args = { ...args, to: args.changeId };
|
|
5453
|
+
} else if (args.change && !args.to) {
|
|
5454
|
+
args = { ...args, to: args.change };
|
|
5455
|
+
} else if (args.revision && !args.to) {
|
|
5456
|
+
args = { ...args, to: args.revision };
|
|
5457
|
+
}
|
|
5458
|
+
}
|
|
5459
|
+
|
|
5424
5460
|
if (!args || !args.name || !args.to) {
|
|
5425
5461
|
throw new JJError('INVALID_ARGUMENT', 'Missing name or to', {
|
|
5426
|
-
|
|
5462
|
+
args,
|
|
5463
|
+
suggestion: 'Provide both: { name: "main", to: "abc123..." } (or use target/changeId/change/revision instead of to)',
|
|
5427
5464
|
});
|
|
5428
5465
|
}
|
|
5429
5466
|
|
package/src/core/jj-checkout.js
CHANGED
|
@@ -12,11 +12,17 @@ import { fileURLToPath } from 'url';
|
|
|
12
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
13
|
const __dirname = path.dirname(__filename);
|
|
14
14
|
|
|
15
|
+
// Determine proto path based on whether we're running from dist or src
|
|
16
|
+
const inDist = __dirname.includes('/dist') || __dirname.includes('\\dist');
|
|
17
|
+
const protoDir = inDist
|
|
18
|
+
? path.join(__dirname, '..', 'src', 'protos')
|
|
19
|
+
: path.join(__dirname, '..', 'protos');
|
|
20
|
+
|
|
15
21
|
export class JJCheckout {
|
|
16
22
|
constructor(fs, dir) {
|
|
17
23
|
this.fs = fs;
|
|
18
24
|
this.dir = dir;
|
|
19
|
-
this.protoPath = path.join(
|
|
25
|
+
this.protoPath = path.join(protoDir, 'local_working_copy.proto');
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
/**
|
|
@@ -12,11 +12,17 @@ import { fileURLToPath } from 'url';
|
|
|
12
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
13
|
const __dirname = path.dirname(__filename);
|
|
14
14
|
|
|
15
|
+
// Determine proto path based on whether we're running from dist or src
|
|
16
|
+
const inDist = __dirname.includes('/dist') || __dirname.includes('\\dist');
|
|
17
|
+
const protoDir = inDist
|
|
18
|
+
? path.join(__dirname, '..', 'src', 'protos')
|
|
19
|
+
: path.join(__dirname, '..', 'protos');
|
|
20
|
+
|
|
15
21
|
export class JJOperationStore {
|
|
16
22
|
constructor(fs, dir) {
|
|
17
23
|
this.fs = fs;
|
|
18
24
|
this.dir = dir;
|
|
19
|
-
this.protoPath = path.join(
|
|
25
|
+
this.protoPath = path.join(protoDir, 'simple_op_store.proto');
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
/**
|
|
@@ -12,11 +12,17 @@ import { fileURLToPath } from 'url';
|
|
|
12
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
13
|
const __dirname = path.dirname(__filename);
|
|
14
14
|
|
|
15
|
+
// Determine proto path based on whether we're running from dist or src
|
|
16
|
+
const inDist = __dirname.includes('/dist') || __dirname.includes('\\dist');
|
|
17
|
+
const protoDir = inDist
|
|
18
|
+
? path.join(__dirname, '..', 'src', 'protos')
|
|
19
|
+
: path.join(__dirname, '..', 'protos');
|
|
20
|
+
|
|
15
21
|
export class JJTreeState {
|
|
16
22
|
constructor(fs, dir) {
|
|
17
23
|
this.fs = fs;
|
|
18
24
|
this.dir = dir;
|
|
19
|
-
this.protoPath = path.join(
|
|
25
|
+
this.protoPath = path.join(protoDir, 'local_working_copy.proto');
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
/**
|
|
@@ -12,11 +12,17 @@ import { fileURLToPath } from 'url';
|
|
|
12
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
13
13
|
const __dirname = path.dirname(__filename);
|
|
14
14
|
|
|
15
|
+
// Determine proto path based on whether we're running from dist or src
|
|
16
|
+
const inDist = __dirname.includes('/dist') || __dirname.includes('\\dist');
|
|
17
|
+
const protoDir = inDist
|
|
18
|
+
? path.join(__dirname, '..', 'src', 'protos')
|
|
19
|
+
: path.join(__dirname, '..', 'protos');
|
|
20
|
+
|
|
15
21
|
export class JJViewStore {
|
|
16
22
|
constructor(fs, dir) {
|
|
17
23
|
this.fs = fs;
|
|
18
24
|
this.dir = dir;
|
|
19
|
-
this.protoPath = path.join(
|
|
25
|
+
this.protoPath = path.join(protoDir, 'simple_op_store.proto');
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
/**
|