type-git 0.8.0 → 0.8.2
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/README.md +7 -0
- package/dist/adapters/bun/index.cjs +8 -8
- package/dist/adapters/bun/index.d.cts +2 -2
- package/dist/adapters/bun/index.d.ts +2 -2
- package/dist/adapters/bun/index.js +2 -2
- package/dist/adapters/deno/index.cjs +8 -8
- package/dist/adapters/deno/index.d.cts +2 -2
- package/dist/adapters/deno/index.d.ts +2 -2
- package/dist/adapters/deno/index.js +2 -2
- package/dist/adapters/node/index.cjs +4 -4
- package/dist/adapters/node/index.d.cts +2 -2
- package/dist/adapters/node/index.d.ts +2 -2
- package/dist/adapters/node/index.js +3 -3
- package/dist/{chunk-JDCCYWIX.cjs → chunk-4K65HJ37.cjs} +7 -7
- package/dist/{chunk-ADC26634.js → chunk-RR5Q2UP2.js} +170 -124
- package/dist/{chunk-6HDMSFY7.cjs → chunk-RWKMVYO5.cjs} +16 -9
- package/dist/{chunk-UHZWPYTF.cjs → chunk-SKN5H7RX.cjs} +543 -497
- package/dist/{chunk-UAKOSACD.js → chunk-SXHFNCJZ.js} +16 -9
- package/dist/{chunk-S3EFBFVP.js → chunk-YCSKHC3M.js} +1 -1
- package/dist/{client.d-Cg5wWJnY.d.cts → client.d-C8wHgA_S.d.ts} +1 -1
- package/dist/{client.d-DCiFA_CK.d.ts → client.d-DVs3pi2e.d.cts} +1 -1
- package/dist/{git.d-DqAvRXEf.d.cts → git.d-CJUJ4264.d.cts} +31 -8
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/strict/command-data.cjs +3 -0
- package/dist/strict/index.cjs +100 -100
- package/dist/strict/index.d.cts +66784 -127877
- package/dist/strict/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -119,6 +119,13 @@ and the runtime checks against argument injection, and neither its bundle nor it
|
|
|
119
119
|
declarations include the catalogue. For an application that only calls high-level methods such
|
|
120
120
|
as `repo.status()`, the bundled size is about 180 KB minified instead of about 1.6 MB.
|
|
121
121
|
|
|
122
|
+
Nothing outside `dist/strict/` loads from it, so an application that ships its `node_modules`
|
|
123
|
+
(for example an Electron app) and never imports `type-git/strict` can leave that directory out,
|
|
124
|
+
such as with `"!**/node_modules/type-git/dist/strict/**"` in electron-builder's `files`.
|
|
125
|
+
The strict entry keeps its catalogue in a CommonJS file that both its ESM and CJS builds load, so
|
|
126
|
+
an ESM bundler needs CommonJS interop to bundle `type-git/strict` (esbuild, webpack and Vite have
|
|
127
|
+
it built in; Rollup needs `@rollup/plugin-commonjs`).
|
|
128
|
+
|
|
122
129
|
### Advanced Usage
|
|
123
130
|
|
|
124
131
|
For more control over adapters, you can use the factory function:
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../../chunk-
|
|
8
|
+
var _chunkSKN5H7RXcjs = require('../../chunk-SKN5H7RX.cjs');
|
|
9
|
+
require('../../chunk-RWKMVYO5.cjs');
|
|
10
10
|
|
|
11
11
|
// src/adapters/bun/exec.ts
|
|
12
12
|
function resolveChildEnv(env, inheritEnv) {
|
|
@@ -117,7 +117,7 @@ var BunExecAdapter = class {
|
|
|
117
117
|
let stderr = "";
|
|
118
118
|
if (binary) {
|
|
119
119
|
[stdout, stderr] = await Promise.all([
|
|
120
|
-
proc.stdout ?
|
|
120
|
+
proc.stdout ? _chunkSKN5H7RXcjs.readBytes.call(void 0, proc.stdout) : Promise.resolve(new Uint8Array(0)),
|
|
121
121
|
proc.stderr ? readStream(proc.stderr, _optionalChain([handlers, 'optionalAccess', _4 => _4.onStderr])) : Promise.resolve("")
|
|
122
122
|
]);
|
|
123
123
|
} else if (_optionalChain([handlers, 'optionalAccess', _5 => _5.onStdout]) || _optionalChain([handlers, 'optionalAccess', _6 => _6.onStderr])) {
|
|
@@ -294,7 +294,7 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
|
|
|
294
294
|
},
|
|
295
295
|
sleep: (ms) => Bun.sleep(ms)
|
|
296
296
|
};
|
|
297
|
-
await
|
|
297
|
+
await _chunkSKN5H7RXcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
|
|
298
298
|
}
|
|
299
299
|
async deleteFile(filePath) {
|
|
300
300
|
const tempDir = this.tempFileDirs.get(filePath);
|
|
@@ -349,7 +349,7 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
|
|
|
349
349
|
},
|
|
350
350
|
sleep: (ms) => Bun.sleep(ms)
|
|
351
351
|
};
|
|
352
|
-
return
|
|
352
|
+
return _chunkSKN5H7RXcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
|
|
353
353
|
}
|
|
354
354
|
}, _class);
|
|
355
355
|
|
|
@@ -360,13 +360,13 @@ function createBunAdapters() {
|
|
|
360
360
|
fs: new BunFsAdapter()
|
|
361
361
|
};
|
|
362
362
|
}
|
|
363
|
-
var TypeGit = class _TypeGit extends
|
|
363
|
+
var TypeGit = class _TypeGit extends _chunkSKN5H7RXcjs.GitClient {
|
|
364
364
|
static async create(options) {
|
|
365
|
-
return new _TypeGit(await
|
|
365
|
+
return new _TypeGit(await _chunkSKN5H7RXcjs.createGit.call(void 0, { ...options, adapters: createBunAdapters() }));
|
|
366
366
|
}
|
|
367
367
|
constructor(optionsOrGit) {
|
|
368
368
|
super(
|
|
369
|
-
optionsOrGit && "open" in optionsOrGit ? optionsOrGit :
|
|
369
|
+
optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkSKN5H7RXcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createBunAdapters() })
|
|
370
370
|
);
|
|
371
371
|
}
|
|
372
372
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-
|
|
2
|
-
import { C as Capabilities, G as Git } from '../../git.d-
|
|
1
|
+
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-DVs3pi2e.cjs';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-CJUJ4264.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Bun ExecAdapter implementation
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-
|
|
2
|
-
import { C as Capabilities, G as Git } from '../../git.d-
|
|
1
|
+
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-C8wHgA_S.js';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-CJUJ4264.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Bun ExecAdapter implementation
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createTailPolling,
|
|
6
6
|
readBytes,
|
|
7
7
|
runTailPolling
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-RR5Q2UP2.js";
|
|
9
|
+
import "../../chunk-SXHFNCJZ.js";
|
|
10
10
|
|
|
11
11
|
// src/adapters/bun/exec.ts
|
|
12
12
|
function resolveChildEnv(env, inheritEnv) {
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../../chunk-
|
|
8
|
+
var _chunkSKN5H7RXcjs = require('../../chunk-SKN5H7RX.cjs');
|
|
9
|
+
require('../../chunk-RWKMVYO5.cjs');
|
|
10
10
|
|
|
11
11
|
// src/adapters/deno/exec.ts
|
|
12
12
|
function resolveChildEnvOptions(env, inheritEnv) {
|
|
@@ -141,7 +141,7 @@ var DenoExecAdapter = class {
|
|
|
141
141
|
let stderr = "";
|
|
142
142
|
if (binary) {
|
|
143
143
|
[stdout, stderr] = await Promise.all([
|
|
144
|
-
child.stdout ?
|
|
144
|
+
child.stdout ? _chunkSKN5H7RXcjs.readBytes.call(void 0, child.stdout) : Promise.resolve(new Uint8Array(0)),
|
|
145
145
|
child.stderr ? readStream(child.stderr, _optionalChain([handlers, 'optionalAccess', _4 => _4.onStderr])) : Promise.resolve("")
|
|
146
146
|
]);
|
|
147
147
|
} else if (_optionalChain([handlers, 'optionalAccess', _5 => _5.onStdout]) || _optionalChain([handlers, 'optionalAccess', _6 => _6.onStderr])) {
|
|
@@ -357,7 +357,7 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
|
|
|
357
357
|
},
|
|
358
358
|
sleep: (ms) => delay(ms)
|
|
359
359
|
};
|
|
360
|
-
await
|
|
360
|
+
await _chunkSKN5H7RXcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
|
|
361
361
|
}
|
|
362
362
|
async deleteFile(filePath) {
|
|
363
363
|
const tempDir = this.tempFileDirs.get(filePath);
|
|
@@ -443,7 +443,7 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
|
|
|
443
443
|
},
|
|
444
444
|
sleep: (ms) => delay(ms)
|
|
445
445
|
};
|
|
446
|
-
return
|
|
446
|
+
return _chunkSKN5H7RXcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
|
|
447
447
|
}
|
|
448
448
|
}, _class);
|
|
449
449
|
|
|
@@ -454,13 +454,13 @@ function createDenoAdapters() {
|
|
|
454
454
|
fs: new DenoFsAdapter()
|
|
455
455
|
};
|
|
456
456
|
}
|
|
457
|
-
var TypeGit = class _TypeGit extends
|
|
457
|
+
var TypeGit = class _TypeGit extends _chunkSKN5H7RXcjs.GitClient {
|
|
458
458
|
static async create(options) {
|
|
459
|
-
return new _TypeGit(await
|
|
459
|
+
return new _TypeGit(await _chunkSKN5H7RXcjs.createGit.call(void 0, { ...options, adapters: createDenoAdapters() }));
|
|
460
460
|
}
|
|
461
461
|
constructor(optionsOrGit) {
|
|
462
462
|
super(
|
|
463
|
-
optionsOrGit && "open" in optionsOrGit ? optionsOrGit :
|
|
463
|
+
optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkSKN5H7RXcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createDenoAdapters() })
|
|
464
464
|
);
|
|
465
465
|
}
|
|
466
466
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-
|
|
2
|
-
import { C as Capabilities, G as Git } from '../../git.d-
|
|
1
|
+
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-DVs3pi2e.cjs';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-CJUJ4264.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Deno ExecAdapter implementation
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-
|
|
2
|
-
import { C as Capabilities, G as Git } from '../../git.d-
|
|
1
|
+
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-C8wHgA_S.js';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-CJUJ4264.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Deno ExecAdapter implementation
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createTailPolling,
|
|
6
6
|
readBytes,
|
|
7
7
|
runTailPolling
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-RR5Q2UP2.js";
|
|
9
|
+
import "../../chunk-SXHFNCJZ.js";
|
|
10
10
|
|
|
11
11
|
// src/adapters/deno/exec.ts
|
|
12
12
|
function resolveChildEnvOptions(env, inheritEnv) {
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('../../chunk-
|
|
8
|
-
require('../../chunk-
|
|
6
|
+
var _chunk4K65HJ37cjs = require('../../chunk-4K65HJ37.cjs');
|
|
7
|
+
require('../../chunk-SKN5H7RX.cjs');
|
|
8
|
+
require('../../chunk-RWKMVYO5.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.NodeExecAdapter =
|
|
14
|
+
exports.NodeExecAdapter = _chunk4K65HJ37cjs.NodeExecAdapter; exports.NodeFsAdapter = _chunk4K65HJ37cjs.NodeFsAdapter; exports.TypeGit = _chunk4K65HJ37cjs.TypeGit; exports.createNodeAdapters = _chunk4K65HJ37cjs.createNodeAdapters;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-
|
|
2
|
-
import { C as Capabilities, G as Git } from '../../git.d-
|
|
1
|
+
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-DVs3pi2e.cjs';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-CJUJ4264.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Options for {@link NodeExecAdapter}.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-
|
|
2
|
-
import { C as Capabilities, G as Git } from '../../git.d-
|
|
1
|
+
import { E as ExecAdapter, S as SpawnOptions, a as StreamHandler, b as SpawnResult, c as SpawnHandle, F as FsAdapter, T as TailOptions, d as TailHandle, R as RuntimeAdapters, C as CreateGitOptions, G as GitClient } from '../../client.d-C8wHgA_S.js';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-CJUJ4264.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Options for {@link NodeExecAdapter}.
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
NodeFsAdapter,
|
|
4
4
|
TypeGit,
|
|
5
5
|
createNodeAdapters
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-YCSKHC3M.js";
|
|
7
|
+
import "../../chunk-RR5Q2UP2.js";
|
|
8
|
+
import "../../chunk-SXHFNCJZ.js";
|
|
9
9
|
export {
|
|
10
10
|
NodeExecAdapter,
|
|
11
11
|
NodeFsAdapter,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkSKN5H7RXcjs = require('./chunk-SKN5H7RX.cjs');
|
|
9
9
|
|
|
10
10
|
// src/adapters/node/exec.ts
|
|
11
11
|
var _child_process = require('child_process');
|
|
@@ -134,7 +134,7 @@ var NodeExecAdapter = class {
|
|
|
134
134
|
exitSignal = sig;
|
|
135
135
|
}
|
|
136
136
|
resolve({
|
|
137
|
-
stdout: binary ?
|
|
137
|
+
stdout: binary ? _chunkSKN5H7RXcjs.joinBytes.call(void 0, stdoutChunks) : stdout,
|
|
138
138
|
stderr,
|
|
139
139
|
exitCode: _nullishCoalesce(code, () => ( -1)),
|
|
140
140
|
signal: exitSignal,
|
|
@@ -273,7 +273,7 @@ var NodeFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
|
|
|
273
273
|
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
274
274
|
};
|
|
275
275
|
try {
|
|
276
|
-
await
|
|
276
|
+
await _chunkSKN5H7RXcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
|
|
277
277
|
} finally {
|
|
278
278
|
if (state.file) {
|
|
279
279
|
await state.file.close();
|
|
@@ -341,7 +341,7 @@ var NodeFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
|
|
|
341
341
|
},
|
|
342
342
|
sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms))
|
|
343
343
|
};
|
|
344
|
-
const polling =
|
|
344
|
+
const polling = _chunkSKN5H7RXcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
|
|
345
345
|
const closeFileHandle = async () => {
|
|
346
346
|
if (state.file) {
|
|
347
347
|
await state.file.close().catch(() => {
|
|
@@ -379,18 +379,18 @@ function splitOptions(options) {
|
|
|
379
379
|
adapters: createNodeAdapters(windowsHide === void 0 ? void 0 : { windowsHide })
|
|
380
380
|
};
|
|
381
381
|
}
|
|
382
|
-
var TypeGit = class _TypeGit extends
|
|
382
|
+
var TypeGit = class _TypeGit extends _chunkSKN5H7RXcjs.GitClient {
|
|
383
383
|
/**
|
|
384
384
|
* Create a client after checking the installed Git version. Node adapter options such as
|
|
385
385
|
* `windowsHide` are passed to the execution adapter.
|
|
386
386
|
*/
|
|
387
387
|
static async create(options) {
|
|
388
|
-
return new _TypeGit(await
|
|
388
|
+
return new _TypeGit(await _chunkSKN5H7RXcjs.createGit.call(void 0, splitOptions(options)));
|
|
389
389
|
}
|
|
390
390
|
/** Wrap an existing Git instance, or create one from options without the version check. */
|
|
391
391
|
constructor(optionsOrGit) {
|
|
392
392
|
super(
|
|
393
|
-
optionsOrGit && "open" in optionsOrGit ? optionsOrGit :
|
|
393
|
+
optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkSKN5H7RXcjs.createGitSync.call(void 0, splitOptions(optionsOrGit))
|
|
394
394
|
);
|
|
395
395
|
}
|
|
396
396
|
};
|