@mizchi/bit 0.43.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.
Files changed (8) hide show
  1. package/README.md +341 -0
  2. package/bin/bit.mjs +11 -0
  3. package/bit.cjs +30712 -0
  4. package/bit.js +8 -0
  5. package/lib.d.ts +604 -0
  6. package/lib.js +1261 -0
  7. package/lib.raw.js +58436 -0
  8. package/package.json +44 -0
package/bit.js ADDED
@@ -0,0 +1,8 @@
1
+ import { createRequire } from "node:module";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
5
+ const require = createRequire(import.meta.url);
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+
8
+ export default require(join(__dirname, "bit.cjs"));
package/lib.d.ts ADDED
@@ -0,0 +1,604 @@
1
+ export interface BitBackend {
2
+ mkdirP(path: string): void;
3
+ writeFile(path: string, content: Uint8Array): void;
4
+ writeString(path: string, content: string): void;
5
+ removeFile(path: string): void;
6
+ removeDir(path: string): void;
7
+ readFile(path: string): Uint8Array | ArrayBuffer | ArrayLike<number> | string;
8
+ readdir(path: string): Iterable<string> | ArrayLike<string>;
9
+ isDir(path: string): boolean;
10
+ isFile(path: string): boolean;
11
+ }
12
+
13
+ export type BitHost = BitBackend;
14
+
15
+ export interface BitStatus {
16
+ stagedAdded: string[];
17
+ stagedModified: string[];
18
+ stagedDeleted: string[];
19
+ unstagedModified: string[];
20
+ unstagedDeleted: string[];
21
+ untracked: string[];
22
+ }
23
+
24
+ export interface BitBranchInfo {
25
+ name: string;
26
+ commitId: string;
27
+ isCurrent: boolean;
28
+ }
29
+
30
+ export interface BitLogEntry {
31
+ id: string;
32
+ author: string;
33
+ message: string;
34
+ timestamp: number;
35
+ }
36
+
37
+ export interface BitRefInfo {
38
+ name: string;
39
+ id: string;
40
+ }
41
+
42
+ export interface BitReflogEntry {
43
+ oldId: string;
44
+ newId: string;
45
+ author: string;
46
+ email: string;
47
+ timestamp: number;
48
+ timezone: string;
49
+ message: string;
50
+ }
51
+
52
+ export interface BitGcResult {
53
+ packId: string | null;
54
+ objectCount: number;
55
+ packBytes: number;
56
+ dangling: string[];
57
+ }
58
+
59
+ export interface BitFsckResult {
60
+ errors: number;
61
+ reachable: number;
62
+ missing: string[];
63
+ rootCommits: string[];
64
+ tagObjects: string[];
65
+ }
66
+
67
+ export interface BitWorktreeInfo {
68
+ path: string;
69
+ headId: string | null;
70
+ branch: string | null;
71
+ locked: boolean;
72
+ isMain: boolean;
73
+ isBare: boolean;
74
+ }
75
+
76
+ export interface BitRemoteVerboseEntry {
77
+ name: string;
78
+ value: string;
79
+ }
80
+
81
+ export interface BitStashEntry {
82
+ id: string;
83
+ message: string;
84
+ }
85
+
86
+ export type BitMergeStatus =
87
+ | "alreadyUpToDate"
88
+ | "fastForward"
89
+ | "merged"
90
+ | "conflicted";
91
+
92
+ export interface BitMergeResult {
93
+ status: BitMergeStatus;
94
+ commitId: string | null;
95
+ conflicts: string[];
96
+ }
97
+
98
+ export type BitRebaseStatus =
99
+ | "complete"
100
+ | "conflict"
101
+ | "nothingToRebase";
102
+
103
+ export interface BitRebaseResult {
104
+ status: BitRebaseStatus;
105
+ commitId: string | null;
106
+ conflicts: string[];
107
+ }
108
+
109
+ export type BitCherryPickStatus = "success" | "conflict";
110
+
111
+ export interface BitCherryPickResult {
112
+ status: BitCherryPickStatus;
113
+ commitId: string | null;
114
+ conflicts: string[];
115
+ }
116
+
117
+ export type BitFetchStatus = "empty" | "fetched";
118
+
119
+ export interface BitFetchResult {
120
+ status: BitFetchStatus;
121
+ commitId: string | null;
122
+ refname: string | null;
123
+ remoteRef: string | null;
124
+ }
125
+
126
+ export type BitCloneStatus = "empty" | "cloned";
127
+
128
+ export interface BitCloneResult {
129
+ status: BitCloneStatus;
130
+ commitId: string | null;
131
+ refname: string | null;
132
+ }
133
+
134
+ export interface BitRelayPeer {
135
+ sender: string;
136
+ cloneUrl: string;
137
+ repo: string | null;
138
+ }
139
+
140
+ export interface BitResolvedRemote {
141
+ via: "session" | "peer";
142
+ url: string;
143
+ sender: string | null;
144
+ repo: string | null;
145
+ sessionId: string | null;
146
+ }
147
+
148
+ export interface BitTransportResponse {
149
+ status: number;
150
+ body?: Uint8Array | ArrayBuffer | ArrayLike<number> | string | null;
151
+ }
152
+
153
+ export interface BitTransport {
154
+ get(
155
+ url: string,
156
+ headers: Record<string, string>,
157
+ ): BitTransportResponse | Promise<BitTransportResponse>;
158
+ post(
159
+ url: string,
160
+ body: Uint8Array,
161
+ headers: Record<string, string>,
162
+ ): BitTransportResponse | Promise<BitTransportResponse>;
163
+ }
164
+
165
+ export interface BitFetchInit {
166
+ method?: string;
167
+ headers?: Record<string, string>;
168
+ body?: Uint8Array;
169
+ }
170
+
171
+ export interface BitFetchResponse {
172
+ status: number;
173
+ arrayBuffer(): Promise<ArrayBuffer>;
174
+ }
175
+
176
+ export type BitFetchImpl = (
177
+ input: string | URL,
178
+ init?: BitFetchInit,
179
+ ) => Promise<BitFetchResponse>;
180
+
181
+ export interface BitRmOptions {
182
+ cached?: boolean;
183
+ }
184
+
185
+ export interface BitBranchRenameOptions {
186
+ force?: boolean;
187
+ author?: string;
188
+ email?: string;
189
+ timestampSec?: number;
190
+ timezone?: string;
191
+ }
192
+
193
+ export interface BitSwitchBranchOptions {
194
+ create?: boolean;
195
+ checkoutFiles?: boolean;
196
+ }
197
+
198
+ export interface BitCommitAmendOptions {
199
+ committer?: string;
200
+ committerTimestampSec?: number;
201
+ timezone?: string;
202
+ encoding?: string;
203
+ authorTimezone?: string;
204
+ committerTimezone?: string;
205
+ }
206
+
207
+ export type BitCommitSigner = (
208
+ payload: string,
209
+ ) => string | Promise<string>;
210
+
211
+ export type BitResetMode = "soft" | "mixed" | "hard";
212
+
213
+ export interface BitFetchOptions {
214
+ refspec?: string;
215
+ preferV2?: boolean;
216
+ depth?: number;
217
+ preferredSender?: string;
218
+ preferredRepo?: string;
219
+ authToken?: string;
220
+ }
221
+
222
+ export interface BitCloneOptions {
223
+ preferV2?: boolean;
224
+ depth?: number;
225
+ preferredSender?: string;
226
+ preferredRepo?: string;
227
+ authToken?: string;
228
+ }
229
+
230
+ export interface BitPushOptions {
231
+ refname?: string;
232
+ force?: boolean;
233
+ preferredSender?: string;
234
+ preferredRepo?: string;
235
+ authToken?: string;
236
+ }
237
+
238
+ export interface BitRelayOptions {
239
+ preferredSender?: string;
240
+ preferredRepo?: string;
241
+ authToken?: string;
242
+ }
243
+
244
+ export interface BitCherryPickOptions {
245
+ noCommit?: boolean;
246
+ messageSuffix?: string;
247
+ signoffCommitter?: string;
248
+ timestampSec?: number;
249
+ }
250
+
251
+ export declare function createMemoryBackend(): BitBackend;
252
+ export declare function destroyBackend(backend: BitBackend): void;
253
+ export declare function createFetchTransport(fetchImpl: BitFetchImpl): BitTransport;
254
+ export declare function relayListClonePeers(
255
+ remoteUrl: string,
256
+ transport: BitTransport | BitFetchImpl,
257
+ options?: Pick<BitRelayOptions, "authToken">,
258
+ ): Promise<BitRelayPeer[]>;
259
+ export declare function relayResolveRemote(
260
+ remoteUrl: string,
261
+ transport: BitTransport | BitFetchImpl,
262
+ options?: BitRelayOptions,
263
+ ): Promise<BitResolvedRemote>;
264
+ export declare function writeString(backend: BitBackend, path: string, content: string): void;
265
+ export declare function readString(backend: BitBackend, path: string): string;
266
+ export declare function init(backend: BitBackend, root: string, defaultBranch?: string): void;
267
+ export declare function add(
268
+ backend: BitBackend,
269
+ root: string,
270
+ paths: Iterable<string> | ArrayLike<string>,
271
+ ): void;
272
+ export declare function status(backend: BitBackend, root: string): BitStatus;
273
+ export declare function statusPorcelain(backend: BitBackend, root: string): string[];
274
+ export declare function statusText(
275
+ backend: BitBackend,
276
+ root: string,
277
+ ): Promise<string>;
278
+ export declare function commit(
279
+ backend: BitBackend,
280
+ root: string,
281
+ message: string,
282
+ author: string,
283
+ timestampSec?: number,
284
+ ): string;
285
+ export declare function commitAmend(
286
+ backend: BitBackend,
287
+ root: string,
288
+ message: string,
289
+ author: string,
290
+ authorTimestampSec?: number,
291
+ options?: BitCommitAmendOptions,
292
+ ): string;
293
+ export declare function buildCommitPayload(
294
+ backend: BitBackend,
295
+ root: string,
296
+ message: string,
297
+ author: string,
298
+ timestampSec?: number,
299
+ ): string;
300
+ export declare function commitSigned(
301
+ backend: BitBackend,
302
+ root: string,
303
+ message: string,
304
+ author: string,
305
+ signature: string,
306
+ timestampSec?: number,
307
+ ): string;
308
+ export declare function commitSignedChecked(
309
+ backend: BitBackend,
310
+ root: string,
311
+ message: string,
312
+ author: string,
313
+ expectedPayload: string,
314
+ signature: string,
315
+ timestampSec?: number,
316
+ ): string;
317
+ export declare function commitWithSigner(
318
+ backend: BitBackend,
319
+ root: string,
320
+ message: string,
321
+ author: string,
322
+ signer: BitCommitSigner,
323
+ timestampSec?: number,
324
+ ): Promise<string>;
325
+ export declare function resolveSshEd25519PublicKey(
326
+ privateKeyPem: string,
327
+ comment?: string,
328
+ ): Promise<string>;
329
+ export declare function signGitPayloadSshEd25519(
330
+ privateKeyPem: string,
331
+ payload: string,
332
+ ): Promise<string>;
333
+ export declare function verifyGitPayloadSshEd25519(
334
+ publicKey: string,
335
+ payload: string,
336
+ signature: string,
337
+ ): Promise<boolean>;
338
+ export declare function verifyCommitSshEd25519(
339
+ backend: BitBackend,
340
+ root: string,
341
+ spec: string,
342
+ publicKey: string,
343
+ ): Promise<boolean>;
344
+ export declare function log(
345
+ backend: BitBackend,
346
+ root: string,
347
+ maxCount?: number,
348
+ ): BitLogEntry[];
349
+ export declare function revParse(
350
+ backend: BitBackend,
351
+ root: string,
352
+ spec: string,
353
+ ): string | null;
354
+ export declare function showRef(
355
+ backend: BitBackend,
356
+ root: string,
357
+ ): BitRefInfo[];
358
+ export declare function logOneline(
359
+ backend: BitBackend,
360
+ root: string,
361
+ maxCount?: number,
362
+ ): string[];
363
+ export declare function reflog(
364
+ backend: BitBackend,
365
+ root: string,
366
+ refname?: string,
367
+ ): BitReflogEntry[];
368
+ export declare function mergeBase(
369
+ backend: BitBackend,
370
+ root: string,
371
+ a: string,
372
+ b: string,
373
+ ): string[];
374
+ export declare function isAncestor(
375
+ backend: BitBackend,
376
+ root: string,
377
+ ancestor: string,
378
+ descendant: string,
379
+ ): boolean;
380
+ export declare function gc(
381
+ backend: BitBackend,
382
+ root: string,
383
+ ): BitGcResult;
384
+ export declare function fsck(
385
+ backend: BitBackend,
386
+ root: string,
387
+ ): BitFsckResult;
388
+ export declare function worktreeList(
389
+ backend: BitBackend,
390
+ root: string,
391
+ ): BitWorktreeInfo[];
392
+ export declare function merge(
393
+ backend: BitBackend,
394
+ root: string,
395
+ target: string,
396
+ message: string,
397
+ author: string,
398
+ timestampSec?: number,
399
+ ): BitMergeResult;
400
+ export declare function checkout(backend: BitBackend, root: string, target: string): void;
401
+ export declare function checkoutB(backend: BitBackend, root: string, branchName: string): void;
402
+ export declare function switchBranch(
403
+ backend: BitBackend,
404
+ root: string,
405
+ name: string,
406
+ options?: BitSwitchBranchOptions,
407
+ ): void;
408
+ export declare function restore(
409
+ backend: BitBackend,
410
+ root: string,
411
+ paths: Iterable<string> | ArrayLike<string>,
412
+ ): void;
413
+ export declare function branchList(backend: BitBackend, root: string): BitBranchInfo[];
414
+ export declare function branchCreate(backend: BitBackend, root: string, name: string): void;
415
+ export declare function branchDelete(backend: BitBackend, root: string, name: string): void;
416
+ export declare function branchRename(
417
+ backend: BitBackend,
418
+ root: string,
419
+ oldName: string,
420
+ newName: string,
421
+ options?: BitBranchRenameOptions,
422
+ ): void;
423
+ export declare function tagList(backend: BitBackend, root: string): string[];
424
+ export declare function tagDelete(
425
+ backend: BitBackend,
426
+ root: string,
427
+ name: string,
428
+ ): void;
429
+ export declare function tagCreateLightweight(
430
+ backend: BitBackend,
431
+ root: string,
432
+ name: string,
433
+ target?: string,
434
+ ): void;
435
+ export declare function tagCreateAnnotated(
436
+ backend: BitBackend,
437
+ root: string,
438
+ name: string,
439
+ target: string,
440
+ message: string,
441
+ tagger: string,
442
+ timestampSec?: number,
443
+ ): void;
444
+ export declare function rebaseStart(
445
+ backend: BitBackend,
446
+ root: string,
447
+ upstream: string,
448
+ ): BitRebaseResult;
449
+ export declare const rebase: typeof rebaseStart;
450
+ export declare function rebaseStartWithOnto(
451
+ backend: BitBackend,
452
+ root: string,
453
+ onto: string,
454
+ upstream: string,
455
+ ): BitRebaseResult;
456
+ export declare function rebaseContinue(
457
+ backend: BitBackend,
458
+ root: string,
459
+ ): BitRebaseResult;
460
+ export declare function rebaseAbort(backend: BitBackend, root: string): void;
461
+ export declare function rebaseSkip(
462
+ backend: BitBackend,
463
+ root: string,
464
+ ): BitRebaseResult;
465
+ export declare function reset(
466
+ backend: BitBackend,
467
+ root: string,
468
+ target: string,
469
+ mode?: BitResetMode,
470
+ ): string;
471
+ export declare function stashList(
472
+ backend: BitBackend,
473
+ root: string,
474
+ ): BitStashEntry[];
475
+ export declare function stashPush(
476
+ backend: BitBackend,
477
+ root: string,
478
+ message: string,
479
+ author: string,
480
+ timestampSec?: number,
481
+ ): Promise<string | null>;
482
+ export declare function stashApply(
483
+ backend: BitBackend,
484
+ root: string,
485
+ index?: number,
486
+ ): void;
487
+ export declare function stashPop(
488
+ backend: BitBackend,
489
+ root: string,
490
+ index?: number,
491
+ ): void;
492
+ export declare function stashDrop(
493
+ backend: BitBackend,
494
+ root: string,
495
+ index?: number,
496
+ ): void;
497
+ export declare function cherryPick(
498
+ backend: BitBackend,
499
+ root: string,
500
+ target: string,
501
+ author: string,
502
+ options?: BitCherryPickOptions,
503
+ ): BitCherryPickResult;
504
+ export declare function diffWorktree(
505
+ backend: BitBackend,
506
+ root: string,
507
+ ): Promise<string[]>;
508
+ export declare function diffWorktreeStat(
509
+ backend: BitBackend,
510
+ root: string,
511
+ ): Promise<string[]>;
512
+ export declare function diffIndex(
513
+ backend: BitBackend,
514
+ root: string,
515
+ ): string[];
516
+ export declare function diffIndexStat(
517
+ backend: BitBackend,
518
+ root: string,
519
+ ): string[];
520
+ export declare function listRemotes(
521
+ backend: BitBackend,
522
+ root: string,
523
+ ): string[];
524
+ export declare function listRemotesVerbose(
525
+ backend: BitBackend,
526
+ root: string,
527
+ ): BitRemoteVerboseEntry[];
528
+ export declare function getRemoteUrl(
529
+ backend: BitBackend,
530
+ root: string,
531
+ name: string,
532
+ ): string | null;
533
+ export declare function sparseCheckoutInit(
534
+ backend: BitBackend,
535
+ root: string,
536
+ cone?: boolean,
537
+ ): void;
538
+ export declare function sparseCheckoutSet(
539
+ backend: BitBackend,
540
+ root: string,
541
+ patterns: Iterable<string> | ArrayLike<string>,
542
+ ): void;
543
+ export declare function sparseCheckoutAdd(
544
+ backend: BitBackend,
545
+ root: string,
546
+ patterns: Iterable<string> | ArrayLike<string>,
547
+ ): void;
548
+ export declare function sparseCheckoutDisable(
549
+ backend: BitBackend,
550
+ root: string,
551
+ ): void;
552
+ export declare function sparseCheckoutReapply(
553
+ backend: BitBackend,
554
+ root: string,
555
+ ): void;
556
+ export declare function sparseCheckoutEnabled(
557
+ backend: BitBackend,
558
+ root: string,
559
+ ): boolean;
560
+ export declare function sparseCheckoutConeEnabled(
561
+ backend: BitBackend,
562
+ root: string,
563
+ ): boolean;
564
+ export declare function sparseCheckoutPatterns(
565
+ backend: BitBackend,
566
+ root: string,
567
+ ): string[];
568
+ export declare function sparseCheckoutDisplayPatterns(
569
+ backend: BitBackend,
570
+ root: string,
571
+ ): string[];
572
+ export declare function fetch(
573
+ backend: BitBackend,
574
+ root: string,
575
+ remoteUrl: string,
576
+ transport: BitTransport | BitFetchImpl,
577
+ options?: BitFetchOptions,
578
+ ): Promise<BitFetchResult>;
579
+ export declare function clone(
580
+ backend: BitBackend,
581
+ root: string,
582
+ remoteUrl: string,
583
+ transport: BitTransport | BitFetchImpl,
584
+ options?: BitCloneOptions,
585
+ ): Promise<BitCloneResult>;
586
+ export declare function push(
587
+ backend: BitBackend,
588
+ root: string,
589
+ remoteUrl: string,
590
+ transport: BitTransport | BitFetchImpl,
591
+ options?: BitPushOptions,
592
+ ): Promise<string>;
593
+ export declare function rm(
594
+ backend: BitBackend,
595
+ root: string,
596
+ paths: Iterable<string> | ArrayLike<string>,
597
+ options?: BitRmOptions,
598
+ ): void;
599
+ export declare function mv(
600
+ backend: BitBackend,
601
+ root: string,
602
+ source: string,
603
+ dest: string,
604
+ ): void;