sfdx-git-delta 7.0.1 → 7.1.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.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/lib/adapter/GitAdapter.d.ts +15 -62
  3. package/lib/adapter/GitAdapter.js +376 -485
  4. package/lib/adapter/GitAdapter.js.map +1 -1
  5. package/lib/adapter/gitBlobReader.d.ts +8 -10
  6. package/lib/adapter/gitBlobReader.js.map +1 -1
  7. package/lib/adapter/ioExecutor.d.ts +4 -3
  8. package/lib/adapter/ioExecutor.js +22 -14
  9. package/lib/adapter/ioExecutor.js.map +1 -1
  10. package/lib/adapter/tsgitErrorMap.d.ts +7 -0
  11. package/lib/adapter/tsgitErrorMap.js +32 -0
  12. package/lib/adapter/tsgitErrorMap.js.map +1 -0
  13. package/lib/constant/gitConstants.d.ts +0 -2
  14. package/lib/constant/gitConstants.js +0 -8
  15. package/lib/constant/gitConstants.js.map +1 -1
  16. package/lib/constant/metadataConstants.d.ts +1 -0
  17. package/lib/constant/metadataConstants.js +1 -0
  18. package/lib/constant/metadataConstants.js.map +1 -1
  19. package/lib/main.js +1 -1
  20. package/lib/main.js.map +1 -1
  21. package/lib/post-processor/flowTranslationProcessor.js +2 -3
  22. package/lib/post-processor/flowTranslationProcessor.js.map +1 -1
  23. package/lib/service/inFileHandler.js +4 -3
  24. package/lib/service/inFileHandler.js.map +1 -1
  25. package/lib/utils/metadataDiff/index.d.ts +0 -2
  26. package/lib/utils/metadataDiff/index.js.map +1 -1
  27. package/lib/utils/metadataDiff/streamingDiff.d.ts +1 -3
  28. package/lib/utils/metadataDiff/streamingDiff.js +16 -54
  29. package/lib/utils/metadataDiff/streamingDiff.js.map +1 -1
  30. package/oclif.manifest.json +1 -1
  31. package/package.json +22 -15
  32. package/lib/adapter/gitBatchCatFile.d.ts +0 -42
  33. package/lib/adapter/gitBatchCatFile.js +0 -203
  34. package/lib/adapter/gitBatchCatFile.js.map +0 -1
package/README.md CHANGED
@@ -119,7 +119,7 @@ It's also important to implement a way to switch back to full deployment in case
119
119
 
120
120
  ### Prerequisites
121
121
 
122
- The plugin requires git command line on the running environment.
122
+ No `git` binary is required: the plugin reads the repository's git object store in-process.
123
123
 
124
124
  **Node v22 or above is required**.
125
125
  To check if Salesforce CLI runs under a supported node version for SGD, run `sf --version`. You should see a node version of v22 or above to use SGD.
@@ -203,7 +203,7 @@ FLAG DESCRIPTIONS
203
203
  of a diff, in which case changes may still be picked up.
204
204
  ```
205
205
 
206
- _See code: [src/commands/sgd/source/delta.ts](https://github.com/scolladon/sfdx-git-delta/blob/v7.0.1/src/commands/sgd/source/delta.ts)_
206
+ _See code: [src/commands/sgd/source/delta.ts](https://github.com/scolladon/sfdx-git-delta/blob/v7.1.0/src/commands/sgd/source/delta.ts)_
207
207
  <!-- commandsstop -->
208
208
 
209
209
  ### Windows users
@@ -1,91 +1,44 @@
1
- import { type Readable } from 'node:stream';
1
+ import { Readable } from 'node:stream';
2
+ import { type ObjectId, type Repository } from '@scolladon/tsgit';
2
3
  import type { Config } from '../types/config.js';
3
4
  import type { FileGitRef } from '../types/git.js';
4
- import { GitBatchCatFile } from './gitBatchCatFile.js';
5
- import type { GitBlobReader, SpawnFn } from './gitBlobReader.js';
5
+ import { type GitBlobReader } from './gitBlobReader.js';
6
6
  import { TreeIndex } from './treeIndex.js';
7
7
  export default class GitAdapter implements GitBlobReader {
8
8
  protected readonly config: Config;
9
9
  private static instances;
10
10
  private static keyFor;
11
11
  static getInstance(config: Config): GitAdapter;
12
+ static closeAll(): Promise<void>;
12
13
  protected readonly treeIndex: Map<string, TreeIndex>;
13
- protected batchCatFile: GitBatchCatFile | null;
14
- private readonly streamingChildren;
15
- private static readonly STDERR_BUFFER_CAP;
16
- private static readonly LFS_POINTER_CAP;
17
- private spawnFn;
14
+ protected readonly blobIdIndex: Map<string, Map<string, ObjectId>>;
15
+ private repoHandle;
18
16
  private constructor();
19
- /**
20
- * Testability seam: lets unit tests swap in a fake spawn for streaming
21
- * subprocesses. Production always uses `child_process.spawn`.
22
- */
23
- setSpawnFn(spawnFn: SpawnFn): void;
24
- protected getBatchCatFile(): GitBatchCatFile;
25
- closeBatchProcess(): void;
26
- static closeAll(): void;
17
+ protected getRepo(): Promise<Repository>;
18
+ close(): Promise<void>;
27
19
  configureRepository(): Promise<void>;
28
20
  parseRev(ref: string): Promise<string>;
29
21
  preBuildTreeIndex(revision: string, scopePaths: string[]): Promise<void>;
30
- /**
31
- * Spawns `git <args>`, streams stdout through a readline interface, and
32
- * yields one line at a time. Replaces the old "run command, split on EOL"
33
- * pattern that accumulated a multi-MB string for megarepo diffs / tree
34
- * listings before any downstream consumer ran.
35
- *
36
- * The spawned child is pushed into streamingChildren so closeAll()
37
- * kills it if teardown happens mid-stream. stderr is drained to the
38
- * debug log; a non-zero exit code rejects the iterator on next read.
39
- */
40
- protected _spawnLines(args: string[]): AsyncGenerator<string>;
41
- /**
42
- * One-shot buffered git invocation. Spawns `git <args>`, drains stdout
43
- * fully, and returns the trimmed UTF-8 string. Used by callers that
44
- * need the complete output as a single string (revparse, raw-style
45
- * commands, config writes) rather than a line-by-line stream.
46
- *
47
- * Mirrors _spawnLines' exit-code handling: non-zero exits throw with
48
- * the stderr tail (capped at STDERR_BUFFER_CAP) in the message. Output
49
- * is trimmed so callers receive the same shape they used to get from
50
- * the legacy `simpleGit({ trimmed: true })` configuration.
51
- */
52
- protected _gitBuffered(args: string[]): Promise<string>;
53
- private _buildExitError;
54
- private _trackChild;
22
+ protected indexRevision(revision: string): Promise<Map<string, ObjectId>>;
55
23
  protected pathExistsImpl(path: string, revision: string): boolean;
56
24
  pathExists(path: string, revision?: string): Promise<boolean>;
57
25
  getFirstCommitRef(): Promise<string>;
26
+ protected resolveObjectId(forRef: FileGitRef): Promise<ObjectId>;
27
+ protected readBlobBuffer(forRef: FileGitRef): Promise<Buffer>;
58
28
  getBufferContent(forRef: FileGitRef): Promise<Buffer>;
59
29
  getBufferContentOrEscalate(forRef: FileGitRef): Promise<Buffer>;
60
- /**
61
- * Streams a directory from `revision` as `git archive --format=tar`
62
- * entries. Yields `{ path, stream }` per file entry (directories are
63
- * skipped). The tar subprocess is registered in streamingChildren so
64
- * closeAll kills it on teardown.
65
- *
66
- * Callers MUST consume each entry's stream — even when skipping the
67
- * entry — otherwise tar-stream back-pressures and halts parsing. For
68
- * skip cases use `stream.resume()` to drain-and-discard.
69
- */
30
+ streamContent(forRef: FileGitRef): Readable;
31
+ private pipeBlobContent;
32
+ private pipeLfsObject;
70
33
  streamArchive(path: string, revision: string): AsyncGenerator<{
71
34
  path: string;
72
35
  stream: Readable;
73
36
  }>;
74
- /**
75
- * Spawns a dedicated `git cat-file blob <oid>` subprocess and returns a
76
- * Readable that peeks the first chunks for LFS pointer magic. On match,
77
- * the spawned subprocess is killed and the Readable is fed from the
78
- * resolved LFS object file. Otherwise bytes are forwarded as-is.
79
- */
80
- streamContent(forRef: FileGitRef): Readable;
81
- private _wireStreamContent;
82
- private _handoffToLfs;
83
37
  getStringContent(forRef: FileGitRef): Promise<string>;
84
38
  protected getFilesPathCached(path: string, revision: string): string[];
85
39
  getFilesPath(paths: string | string[], revision?: string): Promise<string[]>;
86
40
  listDirAtRevision(dir: string, revision: string): Promise<string[]>;
87
41
  gitGrep(pattern: string, path: string | string[], revision?: string): Promise<string[]>;
88
42
  streamDiffLines(): AsyncGenerator<string>;
89
- protected _getNumstatLines(changeType: string, detectRenames: boolean): Promise<string[]>;
90
- private _getRenameLines;
43
+ private requestDiff;
91
44
  }