type-git 0.6.0 → 0.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/README.md +23 -7
- package/dist/adapters/bun/index.cjs +8 -7
- package/dist/adapters/bun/index.d.cts +2 -1
- package/dist/adapters/bun/index.d.ts +2 -1
- package/dist/adapters/bun/index.js +2 -1
- package/dist/adapters/deno/index.cjs +8 -7
- package/dist/adapters/deno/index.d.cts +2 -1
- package/dist/adapters/deno/index.d.ts +2 -1
- package/dist/adapters/deno/index.js +2 -1
- package/dist/adapters/node/index.cjs +4 -3
- package/dist/adapters/node/index.d.cts +2 -1
- package/dist/adapters/node/index.d.ts +2 -1
- package/dist/adapters/node/index.js +3 -2
- package/dist/chunk-5NI3KM5Z.js +4822 -0
- package/dist/{chunk-FHV2WOQG.js → chunk-IAJF67MB.js} +1 -1
- package/dist/chunk-MFY7MGIJ.cjs +4822 -0
- package/dist/chunk-NBX6BNQF.cjs +5588 -0
- package/dist/{chunk-DDWWKTAE.cjs → chunk-X3F6MDXQ.cjs} +7 -7
- package/dist/chunk-YIWTIIXH.js +5588 -0
- package/dist/client.d-Cs32YZX6.d.ts +566 -0
- package/dist/client.d-PRQCR2_T.d.cts +566 -0
- package/dist/git.d-DrhCzWEn.d.cts +9706 -0
- package/dist/index.cjs +9 -3
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +12 -6
- package/dist/strict/index.cjs +2919 -0
- package/dist/{client.d-D9Lqi1a2.d.cts → strict/index.d.cts} +22052 -28366
- package/dist/strict/index.d.ts +1 -0
- package/dist/strict/index.js +2919 -0
- package/docs/adapters.md +7 -7
- package/docs/migrations/0.7.0.md +152 -0
- package/package.json +12 -1
- package/dist/chunk-BRFWPLJ7.cjs +0 -13025
- package/dist/chunk-IYOGHATP.js +0 -13025
package/README.md
CHANGED
|
@@ -89,19 +89,35 @@ import { TypeGit } from 'type-git/node';
|
|
|
89
89
|
const git = await TypeGit.create({ useLegacyVersion: true });
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
### Typed CLI commands
|
|
92
|
+
### Typed CLI commands (`type-git/strict`)
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
For registered CLI operations without a parsed convenience method, import `strict` from
|
|
95
|
+
`type-git/strict`. It wraps a client or repository and adds a grammar-checked `command()`:
|
|
95
96
|
|
|
96
97
|
```typescript
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
import { strict } from 'type-git/strict';
|
|
99
|
+
|
|
100
|
+
const strictGit = strict(git);
|
|
101
|
+
const hash = await strictGit.command('hash-object', [['--stdin']], { stdin: 'hello' });
|
|
102
|
+
|
|
103
|
+
const strictRepo = strict(repo);
|
|
104
|
+
await strictRepo.command('remote add', [{ operand: 'origin' }, { operand: '/path/to/upstream' }]);
|
|
105
|
+
await strictRepo.status(); // every other method is still available
|
|
99
106
|
```
|
|
100
107
|
|
|
101
108
|
Option tuples and operand objects retain ordering and repeated flags. Literal combinations are
|
|
102
|
-
checked against
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
checked against Git's option grammar at compile time; dynamic input is validated at runtime,
|
|
110
|
+
including probes of the selected Git executable where its parser behavior differs between
|
|
111
|
+
builds. The result contains raw stdout, stderr, and exit status. See the
|
|
112
|
+
[API design and pinned baselines](docs/design/typed-command-api.md) and
|
|
113
|
+
[coverage ledger](docs/design/command-coverage.md) for the registered scopes and remaining audit
|
|
114
|
+
work.
|
|
115
|
+
|
|
116
|
+
The grammar catalogue is large, so it lives only in `type-git/strict`. The main entry point
|
|
117
|
+
(`type-git`, `type-git/node`, `type-git/bun`, `type-git/deno`) keeps `raw()`, the high-level API,
|
|
118
|
+
and the runtime checks against argument injection, and neither its bundle nor its type
|
|
119
|
+
declarations include the catalogue. For an application that only calls high-level methods such
|
|
120
|
+
as `repo.status()`, the bundled size is about 180 KB minified instead of about 1.6 MB.
|
|
105
121
|
|
|
106
122
|
### Advanced Usage
|
|
107
123
|
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkNBX6BNQFcjs = require('../../chunk-NBX6BNQF.cjs');
|
|
9
|
+
require('../../chunk-MFY7MGIJ.cjs');
|
|
9
10
|
|
|
10
11
|
// src/adapters/bun/exec.ts
|
|
11
12
|
function resolveChildEnv(env, inheritEnv) {
|
|
@@ -116,7 +117,7 @@ var BunExecAdapter = class {
|
|
|
116
117
|
let stderr = "";
|
|
117
118
|
if (binary) {
|
|
118
119
|
[stdout, stderr] = await Promise.all([
|
|
119
|
-
proc.stdout ?
|
|
120
|
+
proc.stdout ? _chunkNBX6BNQFcjs.readBytes.call(void 0, proc.stdout) : Promise.resolve(new Uint8Array(0)),
|
|
120
121
|
proc.stderr ? readStream(proc.stderr, _optionalChain([handlers, 'optionalAccess', _4 => _4.onStderr])) : Promise.resolve("")
|
|
121
122
|
]);
|
|
122
123
|
} else if (_optionalChain([handlers, 'optionalAccess', _5 => _5.onStdout]) || _optionalChain([handlers, 'optionalAccess', _6 => _6.onStderr])) {
|
|
@@ -293,7 +294,7 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
|
|
|
293
294
|
},
|
|
294
295
|
sleep: (ms) => Bun.sleep(ms)
|
|
295
296
|
};
|
|
296
|
-
await
|
|
297
|
+
await _chunkNBX6BNQFcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
|
|
297
298
|
}
|
|
298
299
|
async deleteFile(filePath) {
|
|
299
300
|
const tempDir = this.tempFileDirs.get(filePath);
|
|
@@ -337,7 +338,7 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
|
|
|
337
338
|
},
|
|
338
339
|
sleep: (ms) => Bun.sleep(ms)
|
|
339
340
|
};
|
|
340
|
-
return
|
|
341
|
+
return _chunkNBX6BNQFcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
|
|
341
342
|
}
|
|
342
343
|
}, _class);
|
|
343
344
|
|
|
@@ -348,13 +349,13 @@ function createBunAdapters() {
|
|
|
348
349
|
fs: new BunFsAdapter()
|
|
349
350
|
};
|
|
350
351
|
}
|
|
351
|
-
var TypeGit = class _TypeGit extends
|
|
352
|
+
var TypeGit = class _TypeGit extends _chunkNBX6BNQFcjs.GitClient {
|
|
352
353
|
static async create(options) {
|
|
353
|
-
return new _TypeGit(await
|
|
354
|
+
return new _TypeGit(await _chunkNBX6BNQFcjs.createGit.call(void 0, { ...options, adapters: createBunAdapters() }));
|
|
354
355
|
}
|
|
355
356
|
constructor(optionsOrGit) {
|
|
356
357
|
super(
|
|
357
|
-
optionsOrGit && "open" in optionsOrGit ? optionsOrGit :
|
|
358
|
+
optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkNBX6BNQFcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createBunAdapters() })
|
|
358
359
|
);
|
|
359
360
|
}
|
|
360
361
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter,
|
|
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-PRQCR2_T.cjs';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Bun ExecAdapter implementation
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter,
|
|
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-Cs32YZX6.js';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Bun ExecAdapter implementation
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkNBX6BNQFcjs = require('../../chunk-NBX6BNQF.cjs');
|
|
9
|
+
require('../../chunk-MFY7MGIJ.cjs');
|
|
9
10
|
|
|
10
11
|
// src/adapters/deno/exec.ts
|
|
11
12
|
function resolveChildEnvOptions(env, inheritEnv) {
|
|
@@ -140,7 +141,7 @@ var DenoExecAdapter = class {
|
|
|
140
141
|
let stderr = "";
|
|
141
142
|
if (binary) {
|
|
142
143
|
[stdout, stderr] = await Promise.all([
|
|
143
|
-
child.stdout ?
|
|
144
|
+
child.stdout ? _chunkNBX6BNQFcjs.readBytes.call(void 0, child.stdout) : Promise.resolve(new Uint8Array(0)),
|
|
144
145
|
child.stderr ? readStream(child.stderr, _optionalChain([handlers, 'optionalAccess', _4 => _4.onStderr])) : Promise.resolve("")
|
|
145
146
|
]);
|
|
146
147
|
} else if (_optionalChain([handlers, 'optionalAccess', _5 => _5.onStdout]) || _optionalChain([handlers, 'optionalAccess', _6 => _6.onStderr])) {
|
|
@@ -356,7 +357,7 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
|
|
|
356
357
|
},
|
|
357
358
|
sleep: (ms) => delay(ms)
|
|
358
359
|
};
|
|
359
|
-
await
|
|
360
|
+
await _chunkNBX6BNQFcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
|
|
360
361
|
}
|
|
361
362
|
async deleteFile(filePath) {
|
|
362
363
|
const tempDir = this.tempFileDirs.get(filePath);
|
|
@@ -427,7 +428,7 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
|
|
|
427
428
|
},
|
|
428
429
|
sleep: (ms) => delay(ms)
|
|
429
430
|
};
|
|
430
|
-
return
|
|
431
|
+
return _chunkNBX6BNQFcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
|
|
431
432
|
}
|
|
432
433
|
}, _class);
|
|
433
434
|
|
|
@@ -438,13 +439,13 @@ function createDenoAdapters() {
|
|
|
438
439
|
fs: new DenoFsAdapter()
|
|
439
440
|
};
|
|
440
441
|
}
|
|
441
|
-
var TypeGit = class _TypeGit extends
|
|
442
|
+
var TypeGit = class _TypeGit extends _chunkNBX6BNQFcjs.GitClient {
|
|
442
443
|
static async create(options) {
|
|
443
|
-
return new _TypeGit(await
|
|
444
|
+
return new _TypeGit(await _chunkNBX6BNQFcjs.createGit.call(void 0, { ...options, adapters: createDenoAdapters() }));
|
|
444
445
|
}
|
|
445
446
|
constructor(optionsOrGit) {
|
|
446
447
|
super(
|
|
447
|
-
optionsOrGit && "open" in optionsOrGit ? optionsOrGit :
|
|
448
|
+
optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkNBX6BNQFcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createDenoAdapters() })
|
|
448
449
|
);
|
|
449
450
|
}
|
|
450
451
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter,
|
|
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-PRQCR2_T.cjs';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Deno ExecAdapter implementation
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter,
|
|
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-Cs32YZX6.js';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Deno ExecAdapter implementation
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('../../chunk-
|
|
6
|
+
var _chunkX3F6MDXQcjs = require('../../chunk-X3F6MDXQ.cjs');
|
|
7
|
+
require('../../chunk-NBX6BNQF.cjs');
|
|
8
|
+
require('../../chunk-MFY7MGIJ.cjs');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
|
13
|
-
exports.NodeExecAdapter =
|
|
14
|
+
exports.NodeExecAdapter = _chunkX3F6MDXQcjs.NodeExecAdapter; exports.NodeFsAdapter = _chunkX3F6MDXQcjs.NodeFsAdapter; exports.TypeGit = _chunkX3F6MDXQcjs.TypeGit; exports.createNodeAdapters = _chunkX3F6MDXQcjs.createNodeAdapters;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter,
|
|
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-PRQCR2_T.cjs';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Options for {@link NodeExecAdapter}.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { E as ExecAdapter,
|
|
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-Cs32YZX6.js';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DrhCzWEn.cjs';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Options for {@link NodeExecAdapter}.
|
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
NodeFsAdapter,
|
|
4
4
|
TypeGit,
|
|
5
5
|
createNodeAdapters
|
|
6
|
-
} from "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
} from "../../chunk-IAJF67MB.js";
|
|
7
|
+
import "../../chunk-YIWTIIXH.js";
|
|
8
|
+
import "../../chunk-5NI3KM5Z.js";
|
|
8
9
|
export {
|
|
9
10
|
NodeExecAdapter,
|
|
10
11
|
NodeFsAdapter,
|