just-git 1.3.7 → 1.3.9
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 +15 -6
- package/dist/{hooks-DNBNCTgb.d.ts → hooks-C7c_BLqp.d.ts} +18 -62
- package/dist/index.d.ts +2 -2
- package/dist/index.js +322 -322
- package/dist/repo/index.d.ts +3 -148
- package/dist/repo/index.js +11 -11
- package/dist/server/index.d.ts +74 -37
- package/dist/server/index.js +70 -69
- package/dist/writing-CnM1ufDP.d.ts +204 -0
- package/package.json +1 -1
package/dist/repo/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { g as GitRepo,
|
|
1
|
+
import { g as GitRepo, Z as RefEntry, e as Commit, a3 as TreeEntry, i as ObjectId, h as Identity, a4 as TreeDiffEntry, d as GitContext, F as FileSystem } from '../hooks-C7c_BLqp.js';
|
|
2
|
+
export { B as BuildCommitOptions, C as CommitAuthor, a as CommitIdentity, b as CommitOptions, c as CommitResult, d as CreateAnnotatedTagOptions, e as CreateCommitOptions, T as TreeEntryInput, f as TreeUpdate, g as buildCommit, h as commit, i as createAnnotatedTag, j as createCommit, u as updateTree, w as writeBlob, k as writeTree } from '../writing-CnM1ufDP.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Core grep matching logic shared by the `git grep` command and the
|
|
@@ -216,152 +217,6 @@ declare function walkCommitHistory(repo: GitRepo, startHash: string | string[],
|
|
|
216
217
|
paths?: string[];
|
|
217
218
|
}): AsyncGenerator<CommitInfo>;
|
|
218
219
|
|
|
219
|
-
/**
|
|
220
|
-
* Simplified identity for the public API. When `date` is omitted,
|
|
221
|
-
* defaults to the current time. Accepts either this form or the
|
|
222
|
-
* internal `Identity` (with `timestamp`/`timezone`) for full control.
|
|
223
|
-
*/
|
|
224
|
-
interface CommitAuthor {
|
|
225
|
-
name: string;
|
|
226
|
-
email: string;
|
|
227
|
-
/** Defaults to `new Date()` (current time). */
|
|
228
|
-
date?: Date;
|
|
229
|
-
}
|
|
230
|
-
/** Accepts either the simplified {@link CommitAuthor} or the internal `Identity` with raw timestamp/timezone. */
|
|
231
|
-
type CommitIdentity = CommitAuthor | Identity;
|
|
232
|
-
/** Options for {@link createCommit}. */
|
|
233
|
-
interface CreateCommitOptions {
|
|
234
|
-
/** Hash of the tree object for this commit. */
|
|
235
|
-
tree: string;
|
|
236
|
-
/** Parent commit hashes (empty for root commits). */
|
|
237
|
-
parents: string[];
|
|
238
|
-
/** Author identity. Accepts `{ name, email, date? }` or full `Identity`. */
|
|
239
|
-
author: CommitIdentity;
|
|
240
|
-
/** Committer identity. Defaults to `author` when omitted. */
|
|
241
|
-
committer?: CommitIdentity;
|
|
242
|
-
message: string;
|
|
243
|
-
/**
|
|
244
|
-
* When set, advances `refs/heads/<branch>` to the new commit.
|
|
245
|
-
* If HEAD does not exist yet, it is created as a symbolic ref
|
|
246
|
-
* pointing to the branch — matching `git init` + `git commit`.
|
|
247
|
-
*/
|
|
248
|
-
branch?: string;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Create a commit object directly in the object store.
|
|
252
|
-
* Returns the new commit's hash.
|
|
253
|
-
*
|
|
254
|
-
* When `branch` is provided, also advances the branch ref and
|
|
255
|
-
* (if HEAD is absent) initializes HEAD as a symbolic ref to it.
|
|
256
|
-
* Without `branch`, no refs are updated.
|
|
257
|
-
*/
|
|
258
|
-
declare function createCommit(repo: GitRepo, options: CreateCommitOptions): Promise<string>;
|
|
259
|
-
/** Options for {@link createAnnotatedTag}. */
|
|
260
|
-
interface CreateAnnotatedTagOptions {
|
|
261
|
-
/** Hash of the target object (usually a commit). */
|
|
262
|
-
target: string;
|
|
263
|
-
/** Tag name (written into the tag object and used for the ref). */
|
|
264
|
-
name: string;
|
|
265
|
-
/** Tagger identity. Accepts `{ name, email, date? }` or full `Identity`. */
|
|
266
|
-
tagger: CommitIdentity;
|
|
267
|
-
message: string;
|
|
268
|
-
/** Type of the target object. Defaults to `"commit"`. */
|
|
269
|
-
targetType?: ObjectType;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Create an annotated tag object and its ref.
|
|
273
|
-
* Returns the tag object's hash.
|
|
274
|
-
*
|
|
275
|
-
* ```ts
|
|
276
|
-
* await createAnnotatedTag(repo, {
|
|
277
|
-
* target: commitHash,
|
|
278
|
-
* name: "v1.0.0",
|
|
279
|
-
* tagger: { name: "Alice", email: "alice@example.com" },
|
|
280
|
-
* message: "Release 1.0.0",
|
|
281
|
-
* });
|
|
282
|
-
* ```
|
|
283
|
-
*/
|
|
284
|
-
declare function createAnnotatedTag(repo: GitRepo, options: CreateAnnotatedTagOptions): Promise<string>;
|
|
285
|
-
/** Options for {@link commit}. */
|
|
286
|
-
interface CommitOptions {
|
|
287
|
-
/**
|
|
288
|
-
* Files to add, update, or delete.
|
|
289
|
-
* - `string` values are written as UTF-8 blobs.
|
|
290
|
-
* - `Uint8Array` values are written as raw blobs.
|
|
291
|
-
* - `null` deletes the file from the tree.
|
|
292
|
-
*/
|
|
293
|
-
files: Record<string, string | Uint8Array | null>;
|
|
294
|
-
message: string;
|
|
295
|
-
/** Author identity. Accepts `{ name, email, date? }` or full `Identity`. Timestamp defaults to now. */
|
|
296
|
-
author: CommitIdentity;
|
|
297
|
-
/** Committer identity. Defaults to `author` when omitted. */
|
|
298
|
-
committer?: CommitIdentity;
|
|
299
|
-
/** Branch to commit to. Parent is auto-resolved from the current branch tip. */
|
|
300
|
-
branch: string;
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* Commit files to a branch in one call.
|
|
304
|
-
*
|
|
305
|
-
* Handles blob creation, tree construction, parent resolution, and
|
|
306
|
-
* ref advancement. When the branch already exists, the specified
|
|
307
|
-
* files are applied on top of the existing tree (unmentioned files
|
|
308
|
-
* are preserved). When the branch doesn't exist, a root commit is
|
|
309
|
-
* created with only the specified files.
|
|
310
|
-
*
|
|
311
|
-
* ```ts
|
|
312
|
-
* await commit(repo, {
|
|
313
|
-
* files: { "README.md": "# Hello\n", "src/index.ts": "export {};\n" },
|
|
314
|
-
* message: "initial commit",
|
|
315
|
-
* author: { name: "Alice", email: "alice@example.com" },
|
|
316
|
-
* branch: "main",
|
|
317
|
-
* });
|
|
318
|
-
* ```
|
|
319
|
-
*/
|
|
320
|
-
declare function commit(repo: GitRepo, options: CommitOptions): Promise<string>;
|
|
321
|
-
/** An entry to include in a tree built by {@link writeTree}. */
|
|
322
|
-
interface TreeEntryInput {
|
|
323
|
-
/** Filename (not a path — nesting is achieved by including tree entries). */
|
|
324
|
-
name: string;
|
|
325
|
-
/** Hash of the blob or tree object. */
|
|
326
|
-
hash: string;
|
|
327
|
-
/** File mode (e.g. "100644"). Auto-detected from the object store when omitted. */
|
|
328
|
-
mode?: string;
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Build a tree object from a flat list of entries and write it to the
|
|
332
|
-
* object store. When `mode` is omitted, the object store is consulted:
|
|
333
|
-
* tree objects get "040000", everything else gets "100644".
|
|
334
|
-
*/
|
|
335
|
-
declare function writeTree(repo: GitRepo, entries: TreeEntryInput[]): Promise<string>;
|
|
336
|
-
/**
|
|
337
|
-
* Write a UTF-8 string as a blob to the object store.
|
|
338
|
-
* Returns the blob's hash.
|
|
339
|
-
*/
|
|
340
|
-
declare function writeBlob(repo: GitRepo, content: string): Promise<string>;
|
|
341
|
-
/** A file to add or update in a tree via {@link updateTree}. */
|
|
342
|
-
interface TreeUpdate {
|
|
343
|
-
/** Full repo-relative path (e.g. `"src/lib/foo.ts"`). */
|
|
344
|
-
path: string;
|
|
345
|
-
/** Blob hash. When `null`, the file is removed. */
|
|
346
|
-
hash: string | null;
|
|
347
|
-
/** File mode (default `"100644"`). Ignored when `hash` is `null`. */
|
|
348
|
-
mode?: string;
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Apply path-based additions, updates, and deletions to an existing
|
|
352
|
-
* tree, handling nested subtree construction automatically.
|
|
353
|
-
* Returns the new root tree hash.
|
|
354
|
-
*
|
|
355
|
-
* ```ts
|
|
356
|
-
* const blob = await writeBlob(repo, "hello world\n");
|
|
357
|
-
* const newTree = await updateTree(repo, commit.tree, [
|
|
358
|
-
* { path: "src/new-file.ts", hash: blob },
|
|
359
|
-
* { path: "old-file.txt", hash: null },
|
|
360
|
-
* ]);
|
|
361
|
-
* ```
|
|
362
|
-
*/
|
|
363
|
-
declare function updateTree(repo: GitRepo, treeHash: string, updates: TreeUpdate[]): Promise<string>;
|
|
364
|
-
|
|
365
220
|
interface MergeConflict {
|
|
366
221
|
path: string;
|
|
367
222
|
reason: "content" | "delete-modify" | "add-add" | "rename-delete" | "rename-rename" | "directory-rename";
|
|
@@ -544,4 +399,4 @@ declare function readonlyRepo(repo: GitRepo): GitRepo;
|
|
|
544
399
|
*/
|
|
545
400
|
declare function overlayRepo(repo: GitRepo): GitRepo;
|
|
546
401
|
|
|
547
|
-
export { type BlameEntry, Commit, type
|
|
402
|
+
export { type BlameEntry, Commit, type CommitInfo, type CreateWorktreeOptions, type DiffHunk, type ExtractTreeResult, type FileDiff, type FlatTreeEntry, GitRepo, type GrepFileMatch, type GrepMatch, type GrepOptions, Identity, type MergeConflict, type MergeTreesResult, RefEntry, TreeDiffEntry, TreeEntry, type WorktreeResult, blame, countAheadBehind, createSandboxWorktree, createWorktree, diffCommits, diffTrees, extractTree, findMergeBases, flattenTree, getChangedFiles, getNewCommits, grep, isAncestor, listBranches, listTags, mergeTrees, mergeTreesFromTreeHashes, overlayRepo, readBlob, readBlobText, readCommit, readFileAtCommit, readTree, readonlyRepo, resolveRef, walkCommitHistory };
|