type-git 0.7.0 → 0.8.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 +93 -0
- package/dist/adapters/bun/index.cjs +19 -8
- package/dist/adapters/bun/index.d.cts +3 -2
- package/dist/adapters/bun/index.d.ts +3 -2
- package/dist/adapters/bun/index.js +14 -3
- package/dist/adapters/deno/index.cjs +23 -8
- package/dist/adapters/deno/index.d.cts +3 -2
- package/dist/adapters/deno/index.d.ts +3 -2
- package/dist/adapters/deno/index.js +17 -2
- package/dist/adapters/node/index.cjs +4 -4
- package/dist/adapters/node/index.d.cts +3 -2
- package/dist/adapters/node/index.d.ts +3 -2
- package/dist/adapters/node/index.js +3 -3
- package/dist/{chunk-MFY7MGIJ.cjs → chunk-6HDMSFY7.cjs} +1388 -129
- package/dist/{chunk-YIWTIIXH.js → chunk-ADC26634.js} +467 -27
- package/dist/{chunk-X3F6MDXQ.cjs → chunk-JDCCYWIX.cjs} +18 -7
- package/dist/{chunk-IAJF67MB.js → chunk-S3EFBFVP.js} +13 -2
- package/dist/{chunk-5NI3KM5Z.js → chunk-UAKOSACD.js} +1329 -70
- package/dist/{chunk-NBX6BNQF.cjs → chunk-UHZWPYTF.cjs} +1421 -981
- package/dist/{client.d-Cs32YZX6.d.ts → client.d-Cg5wWJnY.d.cts} +20 -2
- package/dist/{client.d-PRQCR2_T.d.cts → client.d-DCiFA_CK.d.ts} +20 -2
- package/dist/{git.d-DrhCzWEn.d.cts → git.d-DqAvRXEf.d.cts} +926 -117
- 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/index.cjs +235 -206
- package/dist/strict/index.d.cts +2713 -179
- package/dist/strict/index.js +32 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -165,6 +165,9 @@ const lfsStatus = await repo.lfs.status();
|
|
|
165
165
|
|
|
166
166
|
// Raw escape hatch when needed
|
|
167
167
|
const result = await repo.raw(['rev-parse', 'HEAD']);
|
|
168
|
+
|
|
169
|
+
// Send data on stdin instead of putting it in argv
|
|
170
|
+
const { stdout: blobId } = await repo.raw(['hash-object', '-w', '--stdin'], { stdin: 'hello' });
|
|
168
171
|
```
|
|
169
172
|
|
|
170
173
|
### Audit Mode
|
|
@@ -218,6 +221,96 @@ Runs `git lfs push --object-id origin --stdin`, sending one OID per line and
|
|
|
218
221
|
closing standard input. This avoids command-line length limits for large OID lists.
|
|
219
222
|
Omit `stdin` to pass object IDs as command-line arguments.
|
|
220
223
|
|
|
224
|
+
## Security model
|
|
225
|
+
|
|
226
|
+
type-git checks where an untrusted value, such as a branch name, remote URL or path typed by a
|
|
227
|
+
user, could otherwise turn into a Git option. It does not make every input safe. This section
|
|
228
|
+
lists what each API level checks and what stays the caller's responsibility.
|
|
229
|
+
|
|
230
|
+
**High-level API** (`repo.status()`, `git.clone()`, `repo.fetch()`, …)
|
|
231
|
+
|
|
232
|
+
- Remotes, URLs, refs, paths and other positional operands that start with `-` are refused
|
|
233
|
+
with `GitArgumentError` before Git starts, because Git would parse them as options such as
|
|
234
|
+
`--upload-pack=<command>`. Many path lists are also passed after `--`.
|
|
235
|
+
- Option names come from the typed option fields. A caller's string becomes an option value or
|
|
236
|
+
an operand, not a new option.
|
|
237
|
+
- `git.clone(url, path, { config })` accepts only data-only configuration keys (see
|
|
238
|
+
`CloneConfigSchema`). Keys such as `protocol.ext.allow`, `include.path`, `core.sshCommand`
|
|
239
|
+
or `core.fsmonitor` are refused, because `git clone -c` would apply them to the first fetch.
|
|
240
|
+
Transport keys such as `http.sslVerify`, `http.proxy` and `http.extraHeader` are accepted:
|
|
241
|
+
they cannot run a program, but they decide which server is trusted and what is sent to it.
|
|
242
|
+
- Some options exist to run a program, and they run what you give them. Treat these values
|
|
243
|
+
as code: `config.set()`, `config.add()` and `config.setRaw()` (for example `core.sshCommand`,
|
|
244
|
+
`core.pager`, `gpg.program`), `submodule.foreach()`, `rebase({ exec })`, the merge
|
|
245
|
+
`strategy` (Git runs `git-merge-<strategy>`) and the `credentialHelper` open option.
|
|
246
|
+
|
|
247
|
+
**Strict API** (`strict(repo).command(...)`)
|
|
248
|
+
|
|
249
|
+
- Options are checked against Git's option grammar. Only canonical option names are accepted:
|
|
250
|
+
abbreviations such as `--upload-p` and bundled short options that hide another option, such as
|
|
251
|
+
`-vu`, are refused.
|
|
252
|
+
- An `{ operand }` that starts with `-` is refused wherever Git would read it as an option, for
|
|
253
|
+
example before an explicit `['--']`.
|
|
254
|
+
|
|
255
|
+
**Raw API** (`git.raw(argv)`, `repo.raw(argv)`)
|
|
256
|
+
|
|
257
|
+
- `raw()` passes `argv` to Git unchanged and checks nothing. Build its argv only from trusted
|
|
258
|
+
values. Send untrusted data on standard input with the `stdin` option instead of in argv, but
|
|
259
|
+
only to a command that reads standard input as data, such as `hash-object --stdin` or
|
|
260
|
+
`commit -F -`. Commands that read standard input as instructions, such as `fast-import` or
|
|
261
|
+
`update-ref --stdin`, let that input create or move refs, so do not feed them untrusted input.
|
|
262
|
+
|
|
263
|
+
**Environment**
|
|
264
|
+
|
|
265
|
+
- Spawned Git processes inherit only an allowlist of the parent environment
|
|
266
|
+
(`DEFAULT_ENV_ALLOWLIST`), so other application secrets are not passed on. No variable that
|
|
267
|
+
names a program Git runs, such as `GIT_SSH_COMMAND`, `GIT_ASKPASS`, `GIT_EXTERNAL_DIFF` or
|
|
268
|
+
`GIT_PAGER`, is inherited by default. Opt one in with `inheritEnv: ['GIT_SSH_COMMAND']`, or
|
|
269
|
+
pass it with the `env` option, when you trust the value.
|
|
270
|
+
- `inheritEnv: true` passes the whole parent environment, including application secrets and the
|
|
271
|
+
program-naming variables above. A predicate passed as `inheritEnv` bypasses
|
|
272
|
+
`DEFAULT_ENV_ALLOWLIST` and passes exactly the variables it selects. Use these forms only when
|
|
273
|
+
every variable they can select is trusted.
|
|
274
|
+
- The allowlist does pass `PATH` (which picks the `ssh`, `git-lfs` and `git-remote-*` programs),
|
|
275
|
+
`HOME` (and so `~/.gitconfig`), the proxy variables (whose URLs may hold credentials) and the
|
|
276
|
+
SSH agent variables. An HTTPS-only application can drop the agent with
|
|
277
|
+
`inheritEnv: { remove: ['SSH_AUTH_SOCK', 'SSH_AGENT_PID'] }`.
|
|
278
|
+
|
|
279
|
+
**Untrusted repositories** (`git.open(path, { untrusted: true })`)
|
|
280
|
+
|
|
281
|
+
- Git runs whatever a repository's own configuration and hooks name, such as `core.fsmonitor`,
|
|
282
|
+
hooks, and clean, smudge or diff filters. By default, opening a repository directory that
|
|
283
|
+
someone else controls is as dangerous with type-git as running `git status` in it yourself.
|
|
284
|
+
- With `untrusted: true` (also on `openBare()` and `openRaw()`), every command runs with `-c`
|
|
285
|
+
overrides that point `core.hooksPath` at a path that cannot hold hooks, turn off
|
|
286
|
+
`core.fsmonitor`, refuse the `ext::` transport and set `safe.bareRepository=explicit`.
|
|
287
|
+
Opening fails with `GitError` kind `'UnsafeRepoConfig'` when the repository's own
|
|
288
|
+
configuration (`local` and `worktree` scopes, including included files) sets any key outside a
|
|
289
|
+
closed list of data-only keys. The list covers the usual keys that `git init`, `git clone`,
|
|
290
|
+
`git sparse-checkout` and `git lfs install` write, `branch.<name>.*` and similar; driver keys
|
|
291
|
+
such as `diff.<driver>.textconv` cannot be overridden by name, so they are refused instead.
|
|
292
|
+
The configuration of every populated submodule is checked the same way, because Git runs
|
|
293
|
+
commands such as `status` inside submodules.
|
|
294
|
+
- A key that names a remote, such as `branch.<name>.remote`, must name a remote whose URL the
|
|
295
|
+
repository's configuration sets, and a repository with legacy `.git/remotes/` or
|
|
296
|
+
`.git/branches/` files is refused: Git reads those for remotes the configuration does not
|
|
297
|
+
define, and a name without a URL is read as a path. A custom file system adapter needs
|
|
298
|
+
`readDirectory` for untrusted mode.
|
|
299
|
+
- Remote and submodule URLs in that configuration must be `https`, `http`, `ssh`, `git` or
|
|
300
|
+
scp-style URLs. A local path or `file://` URL would make Git run `upload-pack` or
|
|
301
|
+
`receive-pack` in another repository without the overrides, so its hooks and configuration
|
|
302
|
+
would run unchecked. The same holds for a local path you pass yourself as a remote, so pass
|
|
303
|
+
one only when you trust that repository.
|
|
304
|
+
- The check runs once, when the repository is opened, so nobody else may change the directory
|
|
305
|
+
while you use it. Your own global and system configuration is still trusted. Open a worktree
|
|
306
|
+
by its top-level directory, not its `.git` directory. Untrusted mode needs Git 2.38 or later.
|
|
307
|
+
|
|
308
|
+
**Not covered**
|
|
309
|
+
- A cloned repository does not carry the remote's configuration or hooks. Its `.gitattributes`
|
|
310
|
+
can still select filters that your own configuration defines, and its `.gitmodules` and
|
|
311
|
+
`.lfsconfig` still steer submodule and LFS transfers. The clone `template` option and your
|
|
312
|
+
`init.templateDir` copy hooks into the new repository.
|
|
313
|
+
|
|
221
314
|
## Architecture
|
|
222
315
|
|
|
223
316
|
```
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../../chunk-
|
|
8
|
+
var _chunkUHZWPYTFcjs = require('../../chunk-UHZWPYTF.cjs');
|
|
9
|
+
require('../../chunk-6HDMSFY7.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 ? _chunkUHZWPYTFcjs.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 _chunkUHZWPYTFcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
|
|
298
298
|
}
|
|
299
299
|
async deleteFile(filePath) {
|
|
300
300
|
const tempDir = this.tempFileDirs.get(filePath);
|
|
@@ -308,6 +308,17 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
|
|
|
308
308
|
async deleteDirectory(dirPath) {
|
|
309
309
|
await _promises.rm.call(void 0, dirPath, { force: true, recursive: true });
|
|
310
310
|
}
|
|
311
|
+
async readDirectory(dirPath) {
|
|
312
|
+
try {
|
|
313
|
+
return await _promises.readdir.call(void 0, dirPath);
|
|
314
|
+
} catch (error) {
|
|
315
|
+
const code = error.code;
|
|
316
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
throw error;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
311
322
|
async exists(filePath) {
|
|
312
323
|
const file = Bun.file(filePath);
|
|
313
324
|
return await file.exists();
|
|
@@ -338,7 +349,7 @@ var BunFsAdapter = (_class = class {constructor() { _class.prototype.__init.call
|
|
|
338
349
|
},
|
|
339
350
|
sleep: (ms) => Bun.sleep(ms)
|
|
340
351
|
};
|
|
341
|
-
return
|
|
352
|
+
return _chunkUHZWPYTFcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
|
|
342
353
|
}
|
|
343
354
|
}, _class);
|
|
344
355
|
|
|
@@ -349,13 +360,13 @@ function createBunAdapters() {
|
|
|
349
360
|
fs: new BunFsAdapter()
|
|
350
361
|
};
|
|
351
362
|
}
|
|
352
|
-
var TypeGit = class _TypeGit extends
|
|
363
|
+
var TypeGit = class _TypeGit extends _chunkUHZWPYTFcjs.GitClient {
|
|
353
364
|
static async create(options) {
|
|
354
|
-
return new _TypeGit(await
|
|
365
|
+
return new _TypeGit(await _chunkUHZWPYTFcjs.createGit.call(void 0, { ...options, adapters: createBunAdapters() }));
|
|
355
366
|
}
|
|
356
367
|
constructor(optionsOrGit) {
|
|
357
368
|
super(
|
|
358
|
-
optionsOrGit && "open" in optionsOrGit ? optionsOrGit :
|
|
369
|
+
optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkUHZWPYTFcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createBunAdapters() })
|
|
359
370
|
);
|
|
360
371
|
}
|
|
361
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-Cg5wWJnY.cjs';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Bun ExecAdapter implementation
|
|
@@ -29,6 +29,7 @@ declare class BunFsAdapter implements FsAdapter {
|
|
|
29
29
|
tail(options: TailOptions): Promise<void>;
|
|
30
30
|
deleteFile(filePath: string): Promise<void>;
|
|
31
31
|
deleteDirectory(dirPath: string): Promise<void>;
|
|
32
|
+
readDirectory(dirPath: string): Promise<string[]>;
|
|
32
33
|
exists(filePath: string): Promise<boolean>;
|
|
33
34
|
readFile(filePath: string): Promise<string>;
|
|
34
35
|
writeFile(filePath: string, contents: string): Promise<void>;
|
|
@@ -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-DCiFA_CK.js';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Bun ExecAdapter implementation
|
|
@@ -29,6 +29,7 @@ declare class BunFsAdapter implements FsAdapter {
|
|
|
29
29
|
tail(options: TailOptions): Promise<void>;
|
|
30
30
|
deleteFile(filePath: string): Promise<void>;
|
|
31
31
|
deleteDirectory(dirPath: string): Promise<void>;
|
|
32
|
+
readDirectory(dirPath: string): Promise<string[]>;
|
|
32
33
|
exists(filePath: string): Promise<boolean>;
|
|
33
34
|
readFile(filePath: string): Promise<string>;
|
|
34
35
|
writeFile(filePath: string, contents: string): Promise<void>;
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createTailPolling,
|
|
6
6
|
readBytes,
|
|
7
7
|
runTailPolling
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-ADC26634.js";
|
|
9
|
+
import "../../chunk-UAKOSACD.js";
|
|
10
10
|
|
|
11
11
|
// src/adapters/bun/exec.ts
|
|
12
12
|
function resolveChildEnv(env, inheritEnv) {
|
|
@@ -259,7 +259,7 @@ var BunExecAdapter = class {
|
|
|
259
259
|
};
|
|
260
260
|
|
|
261
261
|
// src/adapters/bun/fs.ts
|
|
262
|
-
import { mkdtemp, rm } from "fs/promises";
|
|
262
|
+
import { mkdtemp, readdir, rm } from "fs/promises";
|
|
263
263
|
import { tmpdir } from "os";
|
|
264
264
|
import { join } from "path";
|
|
265
265
|
var BunFsAdapter = class {
|
|
@@ -308,6 +308,17 @@ var BunFsAdapter = class {
|
|
|
308
308
|
async deleteDirectory(dirPath) {
|
|
309
309
|
await rm(dirPath, { force: true, recursive: true });
|
|
310
310
|
}
|
|
311
|
+
async readDirectory(dirPath) {
|
|
312
|
+
try {
|
|
313
|
+
return await readdir(dirPath);
|
|
314
|
+
} catch (error) {
|
|
315
|
+
const code = error.code;
|
|
316
|
+
if (code === "ENOENT" || code === "ENOTDIR") {
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
throw error;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
311
322
|
async exists(filePath) {
|
|
312
323
|
const file = Bun.file(filePath);
|
|
313
324
|
return await file.exists();
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../../chunk-
|
|
8
|
+
var _chunkUHZWPYTFcjs = require('../../chunk-UHZWPYTF.cjs');
|
|
9
|
+
require('../../chunk-6HDMSFY7.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 ? _chunkUHZWPYTFcjs.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 _chunkUHZWPYTFcjs.runTailPolling.call(void 0, { adapter, signal, pollInterval, onLine });
|
|
361
361
|
}
|
|
362
362
|
async deleteFile(filePath) {
|
|
363
363
|
const tempDir = this.tempFileDirs.get(filePath);
|
|
@@ -385,6 +385,21 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
|
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
+
async readDirectory(dirPath) {
|
|
389
|
+
const names = [];
|
|
390
|
+
try {
|
|
391
|
+
for await (const entry of Deno.readDir(dirPath)) {
|
|
392
|
+
names.push(entry.name);
|
|
393
|
+
}
|
|
394
|
+
} catch (error) {
|
|
395
|
+
const notADirectory = Deno.errors.NotADirectory;
|
|
396
|
+
if (error instanceof Deno.errors.NotFound || notADirectory !== void 0 && error instanceof notADirectory) {
|
|
397
|
+
return [];
|
|
398
|
+
}
|
|
399
|
+
throw error;
|
|
400
|
+
}
|
|
401
|
+
return names;
|
|
402
|
+
}
|
|
388
403
|
async exists(filePath) {
|
|
389
404
|
try {
|
|
390
405
|
await Deno.stat(filePath);
|
|
@@ -428,7 +443,7 @@ var DenoFsAdapter = (_class = class {constructor() { _class.prototype.__init.cal
|
|
|
428
443
|
},
|
|
429
444
|
sleep: (ms) => delay(ms)
|
|
430
445
|
};
|
|
431
|
-
return
|
|
446
|
+
return _chunkUHZWPYTFcjs.createTailPolling.call(void 0, { adapter, signal, pollInterval });
|
|
432
447
|
}
|
|
433
448
|
}, _class);
|
|
434
449
|
|
|
@@ -439,13 +454,13 @@ function createDenoAdapters() {
|
|
|
439
454
|
fs: new DenoFsAdapter()
|
|
440
455
|
};
|
|
441
456
|
}
|
|
442
|
-
var TypeGit = class _TypeGit extends
|
|
457
|
+
var TypeGit = class _TypeGit extends _chunkUHZWPYTFcjs.GitClient {
|
|
443
458
|
static async create(options) {
|
|
444
|
-
return new _TypeGit(await
|
|
459
|
+
return new _TypeGit(await _chunkUHZWPYTFcjs.createGit.call(void 0, { ...options, adapters: createDenoAdapters() }));
|
|
445
460
|
}
|
|
446
461
|
constructor(optionsOrGit) {
|
|
447
462
|
super(
|
|
448
|
-
optionsOrGit && "open" in optionsOrGit ? optionsOrGit :
|
|
463
|
+
optionsOrGit && "open" in optionsOrGit ? optionsOrGit : _chunkUHZWPYTFcjs.createGitSync.call(void 0, { ...optionsOrGit, adapters: createDenoAdapters() })
|
|
449
464
|
);
|
|
450
465
|
}
|
|
451
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-Cg5wWJnY.cjs';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Deno ExecAdapter implementation
|
|
@@ -31,6 +31,7 @@ declare class DenoFsAdapter implements FsAdapter {
|
|
|
31
31
|
tail(options: TailOptions): Promise<void>;
|
|
32
32
|
deleteFile(filePath: string): Promise<void>;
|
|
33
33
|
deleteDirectory(dirPath: string): Promise<void>;
|
|
34
|
+
readDirectory(dirPath: string): Promise<string[]>;
|
|
34
35
|
exists(filePath: string): Promise<boolean>;
|
|
35
36
|
readFile(filePath: string): Promise<string>;
|
|
36
37
|
writeFile(filePath: string, contents: string): Promise<void>;
|
|
@@ -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-DCiFA_CK.js';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Deno ExecAdapter implementation
|
|
@@ -31,6 +31,7 @@ declare class DenoFsAdapter implements FsAdapter {
|
|
|
31
31
|
tail(options: TailOptions): Promise<void>;
|
|
32
32
|
deleteFile(filePath: string): Promise<void>;
|
|
33
33
|
deleteDirectory(dirPath: string): Promise<void>;
|
|
34
|
+
readDirectory(dirPath: string): Promise<string[]>;
|
|
34
35
|
exists(filePath: string): Promise<boolean>;
|
|
35
36
|
readFile(filePath: string): Promise<string>;
|
|
36
37
|
writeFile(filePath: string, contents: string): Promise<void>;
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
createTailPolling,
|
|
6
6
|
readBytes,
|
|
7
7
|
runTailPolling
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-ADC26634.js";
|
|
9
|
+
import "../../chunk-UAKOSACD.js";
|
|
10
10
|
|
|
11
11
|
// src/adapters/deno/exec.ts
|
|
12
12
|
function resolveChildEnvOptions(env, inheritEnv) {
|
|
@@ -385,6 +385,21 @@ var DenoFsAdapter = class {
|
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
+
async readDirectory(dirPath) {
|
|
389
|
+
const names = [];
|
|
390
|
+
try {
|
|
391
|
+
for await (const entry of Deno.readDir(dirPath)) {
|
|
392
|
+
names.push(entry.name);
|
|
393
|
+
}
|
|
394
|
+
} catch (error) {
|
|
395
|
+
const notADirectory = Deno.errors.NotADirectory;
|
|
396
|
+
if (error instanceof Deno.errors.NotFound || notADirectory !== void 0 && error instanceof notADirectory) {
|
|
397
|
+
return [];
|
|
398
|
+
}
|
|
399
|
+
throw error;
|
|
400
|
+
}
|
|
401
|
+
return names;
|
|
402
|
+
}
|
|
388
403
|
async exists(filePath) {
|
|
389
404
|
try {
|
|
390
405
|
await Deno.stat(filePath);
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('../../chunk-
|
|
8
|
-
require('../../chunk-
|
|
6
|
+
var _chunkJDCCYWIXcjs = require('../../chunk-JDCCYWIX.cjs');
|
|
7
|
+
require('../../chunk-UHZWPYTF.cjs');
|
|
8
|
+
require('../../chunk-6HDMSFY7.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.NodeExecAdapter =
|
|
14
|
+
exports.NodeExecAdapter = _chunkJDCCYWIXcjs.NodeExecAdapter; exports.NodeFsAdapter = _chunkJDCCYWIXcjs.NodeFsAdapter; exports.TypeGit = _chunkJDCCYWIXcjs.TypeGit; exports.createNodeAdapters = _chunkJDCCYWIXcjs.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-Cg5wWJnY.cjs';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Options for {@link NodeExecAdapter}.
|
|
@@ -51,6 +51,7 @@ declare class NodeFsAdapter implements FsAdapter {
|
|
|
51
51
|
tail(options: TailOptions): Promise<void>;
|
|
52
52
|
deleteFile(filePath: string): Promise<void>;
|
|
53
53
|
deleteDirectory(dirPath: string): Promise<void>;
|
|
54
|
+
readDirectory(dirPath: string): Promise<string[]>;
|
|
54
55
|
exists(filePath: string): Promise<boolean>;
|
|
55
56
|
readFile(filePath: string): Promise<string>;
|
|
56
57
|
writeFile(filePath: string, contents: string): Promise<void>;
|
|
@@ -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-DCiFA_CK.js';
|
|
2
|
+
import { C as Capabilities, G as Git } from '../../git.d-DqAvRXEf.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Options for {@link NodeExecAdapter}.
|
|
@@ -51,6 +51,7 @@ declare class NodeFsAdapter implements FsAdapter {
|
|
|
51
51
|
tail(options: TailOptions): Promise<void>;
|
|
52
52
|
deleteFile(filePath: string): Promise<void>;
|
|
53
53
|
deleteDirectory(dirPath: string): Promise<void>;
|
|
54
|
+
readDirectory(dirPath: string): Promise<string[]>;
|
|
54
55
|
exists(filePath: string): Promise<boolean>;
|
|
55
56
|
readFile(filePath: string): Promise<string>;
|
|
56
57
|
writeFile(filePath: string, contents: string): Promise<void>;
|
|
@@ -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-S3EFBFVP.js";
|
|
7
|
+
import "../../chunk-ADC26634.js";
|
|
8
|
+
import "../../chunk-UAKOSACD.js";
|
|
9
9
|
export {
|
|
10
10
|
NodeExecAdapter,
|
|
11
11
|
NodeFsAdapter,
|