isomorphic-git 1.32.2 → 1.32.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/browser-tests.json +4 -4
- package/index.cjs +39 -11
- package/index.js +39 -11
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/size_report.html +1 -1
package/browser-tests.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
[
|
|
2
2
|
"Chrome Headless 79.0.3945.0 (Linux x86_64)",
|
|
3
|
-
"Firefox
|
|
4
|
-
"Edge 79.0.309.65 (Windows 10)",
|
|
3
|
+
"Firefox 141.0 (Linux x86_64)",
|
|
5
4
|
"Chrome 137.0.0.0 (Android 10)",
|
|
6
|
-
"
|
|
7
|
-
"Mobile Safari 14.0 (iOS 14.0.1)"
|
|
5
|
+
"Edge 79.0.309.65 (Windows 10)",
|
|
6
|
+
"Mobile Safari 14.0 (iOS 14.0.1)",
|
|
7
|
+
"Safari 14.1 (Mac OS 10.15.7)"
|
|
8
8
|
]
|
package/index.cjs
CHANGED
|
@@ -644,7 +644,7 @@ async function testSubtleSHA1() {
|
|
|
644
644
|
// some browsers that have crypto.subtle.digest don't actually implement SHA-1.
|
|
645
645
|
try {
|
|
646
646
|
const hash = await subtleSHA1(new Uint8Array([]));
|
|
647
|
-
|
|
647
|
+
return hash === 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
|
|
648
648
|
} catch (_) {
|
|
649
649
|
// no bother
|
|
650
650
|
}
|
|
@@ -2301,14 +2301,41 @@ class GitTree {
|
|
|
2301
2301
|
}
|
|
2302
2302
|
}
|
|
2303
2303
|
|
|
2304
|
+
/**
|
|
2305
|
+
* Represents a Git object and provides methods to wrap and unwrap Git objects
|
|
2306
|
+
* according to the Git object format.
|
|
2307
|
+
*/
|
|
2304
2308
|
class GitObject {
|
|
2309
|
+
/**
|
|
2310
|
+
* Wraps a raw object with a Git header.
|
|
2311
|
+
*
|
|
2312
|
+
* @param {Object} params - The parameters for wrapping.
|
|
2313
|
+
* @param {string} params.type - The type of the Git object (e.g., 'blob', 'tree', 'commit').
|
|
2314
|
+
* @param {Uint8Array} params.object - The raw object data to wrap.
|
|
2315
|
+
* @returns {Uint8Array} The wrapped Git object as a single buffer.
|
|
2316
|
+
*/
|
|
2305
2317
|
static wrap({ type, object }) {
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2318
|
+
const header = `${type} ${object.length}\x00`;
|
|
2319
|
+
const headerLen = header.length;
|
|
2320
|
+
const totalLength = headerLen + object.length;
|
|
2321
|
+
|
|
2322
|
+
// Allocate a single buffer for the header and object, rather than create multiple buffers
|
|
2323
|
+
const wrappedObject = new Uint8Array(totalLength);
|
|
2324
|
+
for (let i = 0; i < headerLen; i++) {
|
|
2325
|
+
wrappedObject[i] = header.charCodeAt(i);
|
|
2326
|
+
}
|
|
2327
|
+
wrappedObject.set(object, headerLen);
|
|
2328
|
+
|
|
2329
|
+
return wrappedObject
|
|
2310
2330
|
}
|
|
2311
2331
|
|
|
2332
|
+
/**
|
|
2333
|
+
* Unwraps a Git object buffer into its type and raw object data.
|
|
2334
|
+
*
|
|
2335
|
+
* @param {Buffer|Uint8Array} buffer - The buffer containing the wrapped Git object.
|
|
2336
|
+
* @returns {{ type: string, object: Buffer }} An object containing the type and the raw object data.
|
|
2337
|
+
* @throws {InternalError} If the length specified in the header does not match the actual object length.
|
|
2338
|
+
*/
|
|
2312
2339
|
static unwrap(buffer) {
|
|
2313
2340
|
const s = buffer.indexOf(32); // first space
|
|
2314
2341
|
const i = buffer.indexOf(0); // first null value
|
|
@@ -7776,8 +7803,8 @@ function filterCapabilities(server, client) {
|
|
|
7776
7803
|
|
|
7777
7804
|
const pkg = {
|
|
7778
7805
|
name: 'isomorphic-git',
|
|
7779
|
-
version: '1.32.
|
|
7780
|
-
agent: 'git/isomorphic-git@1.32.
|
|
7806
|
+
version: '1.32.3',
|
|
7807
|
+
agent: 'git/isomorphic-git@1.32.3',
|
|
7781
7808
|
};
|
|
7782
7809
|
|
|
7783
7810
|
class FIFO {
|
|
@@ -10752,17 +10779,18 @@ async function hashBlob({ object }) {
|
|
|
10752
10779
|
// Convert object to buffer
|
|
10753
10780
|
if (typeof object === 'string') {
|
|
10754
10781
|
object = Buffer.from(object, 'utf8');
|
|
10755
|
-
} else {
|
|
10756
|
-
object =
|
|
10782
|
+
} else if (!(object instanceof Uint8Array)) {
|
|
10783
|
+
object = new Uint8Array(object);
|
|
10757
10784
|
}
|
|
10758
10785
|
|
|
10759
10786
|
const type = 'blob';
|
|
10760
10787
|
const { oid, object: _object } = await hashObject({
|
|
10761
|
-
type
|
|
10788
|
+
type,
|
|
10762
10789
|
format: 'content',
|
|
10763
10790
|
object,
|
|
10764
10791
|
});
|
|
10765
|
-
|
|
10792
|
+
|
|
10793
|
+
return { oid, type, object: _object, format: 'wrapped' }
|
|
10766
10794
|
} catch (err) {
|
|
10767
10795
|
err.caller = 'git.hashBlob';
|
|
10768
10796
|
throw err
|
package/index.js
CHANGED
|
@@ -638,7 +638,7 @@ async function testSubtleSHA1() {
|
|
|
638
638
|
// some browsers that have crypto.subtle.digest don't actually implement SHA-1.
|
|
639
639
|
try {
|
|
640
640
|
const hash = await subtleSHA1(new Uint8Array([]));
|
|
641
|
-
|
|
641
|
+
return hash === 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
|
|
642
642
|
} catch (_) {
|
|
643
643
|
// no bother
|
|
644
644
|
}
|
|
@@ -2295,14 +2295,41 @@ class GitTree {
|
|
|
2295
2295
|
}
|
|
2296
2296
|
}
|
|
2297
2297
|
|
|
2298
|
+
/**
|
|
2299
|
+
* Represents a Git object and provides methods to wrap and unwrap Git objects
|
|
2300
|
+
* according to the Git object format.
|
|
2301
|
+
*/
|
|
2298
2302
|
class GitObject {
|
|
2303
|
+
/**
|
|
2304
|
+
* Wraps a raw object with a Git header.
|
|
2305
|
+
*
|
|
2306
|
+
* @param {Object} params - The parameters for wrapping.
|
|
2307
|
+
* @param {string} params.type - The type of the Git object (e.g., 'blob', 'tree', 'commit').
|
|
2308
|
+
* @param {Uint8Array} params.object - The raw object data to wrap.
|
|
2309
|
+
* @returns {Uint8Array} The wrapped Git object as a single buffer.
|
|
2310
|
+
*/
|
|
2299
2311
|
static wrap({ type, object }) {
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2312
|
+
const header = `${type} ${object.length}\x00`;
|
|
2313
|
+
const headerLen = header.length;
|
|
2314
|
+
const totalLength = headerLen + object.length;
|
|
2315
|
+
|
|
2316
|
+
// Allocate a single buffer for the header and object, rather than create multiple buffers
|
|
2317
|
+
const wrappedObject = new Uint8Array(totalLength);
|
|
2318
|
+
for (let i = 0; i < headerLen; i++) {
|
|
2319
|
+
wrappedObject[i] = header.charCodeAt(i);
|
|
2320
|
+
}
|
|
2321
|
+
wrappedObject.set(object, headerLen);
|
|
2322
|
+
|
|
2323
|
+
return wrappedObject
|
|
2304
2324
|
}
|
|
2305
2325
|
|
|
2326
|
+
/**
|
|
2327
|
+
* Unwraps a Git object buffer into its type and raw object data.
|
|
2328
|
+
*
|
|
2329
|
+
* @param {Buffer|Uint8Array} buffer - The buffer containing the wrapped Git object.
|
|
2330
|
+
* @returns {{ type: string, object: Buffer }} An object containing the type and the raw object data.
|
|
2331
|
+
* @throws {InternalError} If the length specified in the header does not match the actual object length.
|
|
2332
|
+
*/
|
|
2306
2333
|
static unwrap(buffer) {
|
|
2307
2334
|
const s = buffer.indexOf(32); // first space
|
|
2308
2335
|
const i = buffer.indexOf(0); // first null value
|
|
@@ -7770,8 +7797,8 @@ function filterCapabilities(server, client) {
|
|
|
7770
7797
|
|
|
7771
7798
|
const pkg = {
|
|
7772
7799
|
name: 'isomorphic-git',
|
|
7773
|
-
version: '1.32.
|
|
7774
|
-
agent: 'git/isomorphic-git@1.32.
|
|
7800
|
+
version: '1.32.3',
|
|
7801
|
+
agent: 'git/isomorphic-git@1.32.3',
|
|
7775
7802
|
};
|
|
7776
7803
|
|
|
7777
7804
|
class FIFO {
|
|
@@ -10746,17 +10773,18 @@ async function hashBlob({ object }) {
|
|
|
10746
10773
|
// Convert object to buffer
|
|
10747
10774
|
if (typeof object === 'string') {
|
|
10748
10775
|
object = Buffer.from(object, 'utf8');
|
|
10749
|
-
} else {
|
|
10750
|
-
object =
|
|
10776
|
+
} else if (!(object instanceof Uint8Array)) {
|
|
10777
|
+
object = new Uint8Array(object);
|
|
10751
10778
|
}
|
|
10752
10779
|
|
|
10753
10780
|
const type = 'blob';
|
|
10754
10781
|
const { oid, object: _object } = await hashObject({
|
|
10755
|
-
type
|
|
10782
|
+
type,
|
|
10756
10783
|
format: 'content',
|
|
10757
10784
|
object,
|
|
10758
10785
|
});
|
|
10759
|
-
|
|
10786
|
+
|
|
10787
|
+
return { oid, type, object: _object, format: 'wrapped' }
|
|
10760
10788
|
} catch (err) {
|
|
10761
10789
|
err.caller = 'git.hashBlob';
|
|
10762
10790
|
throw err
|