isomorphic-jj 1.4.3 → 1.7.0
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/CHANGELOG.md +226 -0
- package/README.md +9 -11
- package/bin/isojj.js +270 -102
- package/dist/index.cjs +2910 -1666
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2910 -1666
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
- package/src/api/repository.js +1099 -739
- package/src/backend/isomorphic-git-backend.js +183 -136
- package/src/backend/lazy-git-backend.js +12 -19
- package/src/browser/helpers.js +6 -2
- package/src/core/background-ops.js +58 -41
- package/src/core/bookmark-store.js +12 -8
- package/src/core/change-graph.js +26 -29
- package/src/core/conflict-model.js +66 -26
- package/src/core/jj-checkout.js +8 -4
- package/src/core/jj-operation-store.js +16 -12
- package/src/core/jj-tree-state.js +13 -9
- package/src/core/jj-view-store.js +11 -5
- package/src/core/merge-driver-registry.js +92 -46
- package/src/core/operation-log.js +30 -33
- package/src/core/revset-engine.js +1069 -485
- package/src/core/storage-manager.js +25 -19
- package/src/core/tag-store.js +2 -2
- package/src/core/user-config.js +3 -1
- package/src/core/working-copy.js +125 -9
- package/src/core/workspace-manager.js +2 -2
- package/src/drivers/built-in-drivers.js +66 -33
- package/src/types.d.ts +67 -1
- package/src/utils/errors.js +3 -3
- package/src/utils/id-generation.js +4 -4
- package/src/utils/validation.js +6 -10
package/src/utils/errors.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* JJError - Custom error class for isomorphic-jj
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Provides structured errors with error codes, context, and user-actionable suggestions.
|
|
5
5
|
*/
|
|
6
6
|
export class JJError extends Error {
|
|
7
7
|
/**
|
|
8
8
|
* @param {string} code - Error code (e.g., 'CHANGE_NOT_FOUND')
|
|
9
9
|
* @param {string} message - Human-readable error message
|
|
10
|
-
* @param {Object} [context
|
|
11
|
-
*
|
|
10
|
+
* @param {Object.<string, any>} [context] - Additional error context. May
|
|
11
|
+
* include a `suggestion` string plus any other diagnostic fields.
|
|
12
12
|
*/
|
|
13
13
|
constructor(code, message, context = {}) {
|
|
14
14
|
super(message);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ID Generation utilities for isomorphic-jj
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Generates stable change IDs and operation IDs using cryptographically secure random values.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Generate a stable change ID
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* Uses 128-bit cryptographically random value encoded as 32-character hex string.
|
|
11
11
|
* Collision probability is negligible (2^128 space).
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* @returns {string} 32-character lowercase hex string
|
|
14
14
|
*/
|
|
15
15
|
export function generateChangeId() {
|
|
@@ -22,7 +22,7 @@ export function generateChangeId() {
|
|
|
22
22
|
*
|
|
23
23
|
* Uses SHA-256 hash of operation content for integrity verification.
|
|
24
24
|
*
|
|
25
|
-
* @param {Object} operation - Operation data
|
|
25
|
+
* @param {Object.<string, any>} operation - Operation data
|
|
26
26
|
* @returns {Promise<string>} 64-character lowercase hex string (SHA-256)
|
|
27
27
|
*/
|
|
28
28
|
export async function generateOperationId(operation) {
|
package/src/utils/validation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Validation utilities for isomorphic-jj
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* Provides validation functions for change IDs, paths, bookmark names, etc.
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ import { JJError } from './errors.js';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Validate a change ID
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* @param {string} changeId - Change ID to validate
|
|
13
13
|
* @throws {JJError} If change ID is invalid
|
|
14
14
|
*/
|
|
@@ -84,7 +84,7 @@ export function validatePath(path) {
|
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Validate a bookmark name (follows Git ref name rules)
|
|
87
|
-
*
|
|
87
|
+
*
|
|
88
88
|
* @param {string} name - Bookmark name to validate
|
|
89
89
|
* @throws {JJError} If bookmark name is invalid
|
|
90
90
|
*/
|
|
@@ -115,13 +115,9 @@ export function validateBookmarkName(name) {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
if (name.startsWith('.') || name.endsWith('.')) {
|
|
118
|
-
throw new JJError(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
{
|
|
122
|
-
name,
|
|
123
|
-
}
|
|
124
|
-
);
|
|
118
|
+
throw new JJError('INVALID_BOOKMARK_NAME', 'Bookmark name cannot start or end with "."', {
|
|
119
|
+
name,
|
|
120
|
+
});
|
|
125
121
|
}
|
|
126
122
|
|
|
127
123
|
if (name.endsWith('.lock')) {
|