sfdx-git-delta 7.0.1 → 7.2.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 +12 -3
- package/lib/adapter/GitAdapter.d.ts +25 -64
- package/lib/adapter/GitAdapter.js +352 -483
- package/lib/adapter/GitAdapter.js.map +1 -1
- package/lib/adapter/gitBlobReader.d.ts +8 -10
- package/lib/adapter/gitBlobReader.js.map +1 -1
- package/lib/adapter/ioExecutor.d.ts +5 -4
- package/lib/adapter/ioExecutor.js +22 -14
- package/lib/adapter/ioExecutor.js.map +1 -1
- package/lib/adapter/pathMatching.d.ts +9 -0
- package/lib/adapter/pathMatching.js +83 -0
- package/lib/adapter/pathMatching.js.map +1 -0
- package/lib/adapter/tsgitErrorMap.d.ts +7 -0
- package/lib/adapter/tsgitErrorMap.js +32 -0
- package/lib/adapter/tsgitErrorMap.js.map +1 -0
- package/lib/commands/sgd/source/delta.js.map +1 -1
- package/lib/constant/gitConstants.d.ts +0 -2
- package/lib/constant/gitConstants.js +0 -8
- package/lib/constant/gitConstants.js.map +1 -1
- package/lib/constant/metadataConstants.d.ts +1 -0
- package/lib/constant/metadataConstants.js +1 -0
- package/lib/constant/metadataConstants.js.map +1 -1
- package/lib/main.d.ts +2 -2
- package/lib/main.js +64 -35
- package/lib/main.js.map +1 -1
- package/lib/post-processor/baseProcessor.d.ts +9 -6
- package/lib/post-processor/baseProcessor.js +5 -6
- package/lib/post-processor/baseProcessor.js.map +1 -1
- package/lib/post-processor/changesManifestProcessor.d.ts +3 -2
- package/lib/post-processor/changesManifestProcessor.js +5 -4
- package/lib/post-processor/changesManifestProcessor.js.map +1 -1
- package/lib/post-processor/flowTranslationProcessor.d.ts +8 -7
- package/lib/post-processor/flowTranslationProcessor.js +20 -19
- package/lib/post-processor/flowTranslationProcessor.js.map +1 -1
- package/lib/post-processor/includeProcessor.d.ts +6 -5
- package/lib/post-processor/includeProcessor.js +7 -6
- package/lib/post-processor/includeProcessor.js.map +1 -1
- package/lib/post-processor/packageGenerator.d.ts +3 -2
- package/lib/post-processor/packageGenerator.js +5 -4
- package/lib/post-processor/packageGenerator.js.map +1 -1
- package/lib/post-processor/postProcessorManager.d.ts +5 -7
- package/lib/post-processor/postProcessorManager.js +23 -31
- package/lib/post-processor/postProcessorManager.js.map +1 -1
- package/lib/service/botHandler.d.ts +1 -2
- package/lib/service/botHandler.js +17 -10
- package/lib/service/botHandler.js.map +1 -1
- package/lib/service/containedDecomposedHandler.d.ts +4 -5
- package/lib/service/containedDecomposedHandler.js +13 -12
- package/lib/service/containedDecomposedHandler.js.map +1 -1
- package/lib/service/customFieldHandler.d.ts +1 -2
- package/lib/service/customFieldHandler.js +7 -6
- package/lib/service/customFieldHandler.js.map +1 -1
- package/lib/service/customLabelHandler.d.ts +1 -2
- package/lib/service/customLabelHandler.js +3 -3
- package/lib/service/customLabelHandler.js.map +1 -1
- package/lib/service/customObjectHandler.d.ts +3 -4
- package/lib/service/customObjectHandler.js +10 -9
- package/lib/service/customObjectHandler.js.map +1 -1
- package/lib/service/decomposedHandler.d.ts +3 -4
- package/lib/service/decomposedHandler.js +5 -4
- package/lib/service/decomposedHandler.js.map +1 -1
- package/lib/service/diffLineInterpreter.d.ts +3 -3
- package/lib/service/diffLineInterpreter.js +18 -14
- package/lib/service/diffLineInterpreter.js.map +1 -1
- package/lib/service/flowHandler.d.ts +1 -2
- package/lib/service/flowHandler.js +9 -4
- package/lib/service/flowHandler.js.map +1 -1
- package/lib/service/inFileHandler.d.ts +8 -9
- package/lib/service/inFileHandler.js +28 -27
- package/lib/service/inFileHandler.js.map +1 -1
- package/lib/service/inFolderHandler.d.ts +4 -5
- package/lib/service/inFolderHandler.js +6 -5
- package/lib/service/inFolderHandler.js.map +1 -1
- package/lib/service/inResourceHandler.d.ts +4 -5
- package/lib/service/inResourceHandler.js +8 -7
- package/lib/service/inResourceHandler.js.map +1 -1
- package/lib/service/objectTranslationHandler.d.ts +1 -2
- package/lib/service/objectTranslationHandler.js +6 -5
- package/lib/service/objectTranslationHandler.js.map +1 -1
- package/lib/service/reportingFolderHandler.d.ts +6 -7
- package/lib/service/reportingFolderHandler.js +6 -6
- package/lib/service/reportingFolderHandler.js.map +1 -1
- package/lib/service/sharedFolderHandler.d.ts +4 -5
- package/lib/service/sharedFolderHandler.js +6 -6
- package/lib/service/sharedFolderHandler.js.map +1 -1
- package/lib/service/standardHandler.d.ts +5 -9
- package/lib/service/standardHandler.js +28 -35
- package/lib/service/standardHandler.js.map +1 -1
- package/lib/service/typeHandlerFactory.d.ts +3 -3
- package/lib/service/typeHandlerFactory.js +6 -6
- package/lib/service/typeHandlerFactory.js.map +1 -1
- package/lib/types/config.d.ts +5 -1
- package/lib/types/handlerResult.d.ts +7 -7
- package/lib/types/handlerResult.js +10 -1
- package/lib/types/handlerResult.js.map +1 -1
- package/lib/types/work.d.ts +1 -1
- package/lib/utils/arrayUtils.d.ts +1 -1
- package/lib/utils/arrayUtils.js.map +1 -1
- package/lib/utils/bundleRollup.d.ts +6 -0
- package/lib/utils/bundleRollup.js +62 -0
- package/lib/utils/bundleRollup.js.map +1 -0
- package/lib/utils/changeSet.d.ts +12 -15
- package/lib/utils/changeSet.js +23 -120
- package/lib/utils/changeSet.js.map +1 -1
- package/lib/utils/changesAssembly.d.ts +8 -0
- package/lib/utils/changesAssembly.js +21 -0
- package/lib/utils/changesAssembly.js.map +1 -0
- package/lib/utils/configValidator.d.ts +7 -6
- package/lib/utils/configValidator.js +32 -11
- package/lib/utils/configValidator.js.map +1 -1
- package/lib/utils/fsHelper.d.ts +2 -1
- package/lib/utils/fsHelper.js +7 -3
- package/lib/utils/fsHelper.js.map +1 -1
- package/lib/utils/messageSanitizer.d.ts +1 -0
- package/lib/utils/messageSanitizer.js +48 -0
- package/lib/utils/messageSanitizer.js.map +1 -0
- package/lib/utils/metadataDiff/index.d.ts +0 -2
- package/lib/utils/metadataDiff/index.js.map +1 -1
- package/lib/utils/metadataDiff/streamingDiff.d.ts +1 -3
- package/lib/utils/metadataDiff/streamingDiff.js +16 -54
- package/lib/utils/metadataDiff/streamingDiff.js.map +1 -1
- package/lib/utils/pathspec.d.ts +15 -0
- package/lib/utils/pathspec.js +71 -0
- package/lib/utils/pathspec.js.map +1 -0
- package/lib/utils/renameResolver.d.ts +6 -6
- package/lib/utils/renameResolver.js +10 -9
- package/lib/utils/renameResolver.js.map +1 -1
- package/lib/utils/repoGitDiff.d.ts +2 -0
- package/lib/utils/repoGitDiff.js +14 -1
- package/lib/utils/repoGitDiff.js.map +1 -1
- package/messages/delta.md +26 -0
- package/oclif.manifest.json +2 -2
- package/package.json +28 -20
- package/lib/adapter/gitBatchCatFile.d.ts +0 -42
- package/lib/adapter/gitBatchCatFile.js +0 -203
- package/lib/adapter/gitBatchCatFile.js.map +0 -1
- package/lib/post-processor/bundleRollupProcessor.d.ts +0 -7
- package/lib/post-processor/bundleRollupProcessor.js +0 -81
- package/lib/post-processor/bundleRollupProcessor.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
|
-
|
|
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.
|
|
@@ -201,9 +201,13 @@ FLAG DESCRIPTIONS
|
|
|
201
201
|
* If the folder exists, its contents will be processed.
|
|
202
202
|
* If the folder doesn't exist, it usually won't show any output—unless the folder was recently deleted and is part
|
|
203
203
|
of a diff, in which case changes may still be picked up.
|
|
204
|
+
|
|
205
|
+
Each value must be a literal repository-relative path: wildcards (`*`, `?`, `[`), git pathspec magic (`:(...)`),
|
|
206
|
+
absolute paths, `..` and the empty string are all rejected. Matching is rooted at the repository root, so
|
|
207
|
+
`--source-dir force-app` does not match `nested/force-app/...`.
|
|
204
208
|
```
|
|
205
209
|
|
|
206
|
-
_See code: [src/commands/sgd/source/delta.ts](https://github.com/scolladon/sfdx-git-delta/blob/v7.0
|
|
210
|
+
_See code: [src/commands/sgd/source/delta.ts](https://github.com/scolladon/sfdx-git-delta/blob/v7.2.0/src/commands/sgd/source/delta.ts)_
|
|
207
211
|
<!-- commandsstop -->
|
|
208
212
|
|
|
209
213
|
### Windows users
|
|
@@ -511,6 +515,10 @@ $ tree
|
|
|
511
515
|
$ sf sgd source delta --from commit --source-dir force-app/unpackaged/admin --source-dir force-app/unpackaged/ui
|
|
512
516
|
```
|
|
513
517
|
|
|
518
|
+
Each `--source-dir` value is a **literal** repository-relative folder (or file) path, matched from the repository root — `--source-dir force-app` matches `force-app/...` but never `nested/force-app/...`. A trailing slash or a leading `./` is accepted and canonicalised (`force-app/`, `./force-app` and `force-app` all scope the same folder).
|
|
519
|
+
|
|
520
|
+
Wildcards (`*`, `?`, `[`), git pathspec magic (`:(exclude)…`, `:!…`, `:(glob)…`, …), absolute paths, `..`, and the empty string are all rejected with an error — `--source-dir` never matches a glob pattern. For pattern matching, repeat `--source-dir` once per folder, or use `--include-file [-n]` / `--ignore-file [-i]` (gitignore-spec patterns) instead.
|
|
521
|
+
|
|
514
522
|
> The ignored patterns specified using `--ignore-file [-i]` and `--ignore-destructive-file [-D]` still apply.
|
|
515
523
|
> The `--source-dir` path must be relative to the `--repo-dir` path
|
|
516
524
|
|
|
@@ -525,7 +533,7 @@ sf sgd source delta --from baseline --to HEAD --output-dir ./delta --generate-de
|
|
|
525
533
|
$(jq -r '.packageDirectories[] | "--source-dir", .path' sfdx-project.json)
|
|
526
534
|
```
|
|
527
535
|
|
|
528
|
-
[jq](https://jqlang.github.io/jq/) reads every `packageDirectories[].path` entry and expands it into a `--source-dir` argument.
|
|
536
|
+
[jq](https://jqlang.github.io/jq/) reads every `packageDirectories[].path` entry and expands it into a `--source-dir` argument. `sfdx-project.json` package directory paths commonly carry a trailing slash (e.g. `"force-app/"`); since `--source-dir` canonicalises trailing slashes away, this recipe works unchanged whether or not your `packageDirectories[].path` entries end in `/`.
|
|
529
537
|
|
|
530
538
|
> See [Scoping delta generation to specific folders](#scoping-delta-generation-to-specific-folders) for the `--source-dir` behavior.
|
|
531
539
|
> Prefer `--ignore-file [-i]` when you only need to skip a few known paths (e.g. `**/.claude/**`) without coupling to `sfdx-project.json`.
|
|
@@ -604,6 +612,7 @@ const work = await sgd({
|
|
|
604
612
|
output: '', // source package specific output. [default : "./output"]
|
|
605
613
|
apiVersion: '', // salesforce API version. [default : latest]
|
|
606
614
|
repo: '', // git repository location. [default : "."]
|
|
615
|
+
source: ['.'], // (required) one or more repo-relative folders to scope the diff to; '.' (or an empty array) means the whole repository
|
|
607
616
|
})
|
|
608
617
|
|
|
609
618
|
console.log(JSON.stringify(work))
|
|
@@ -1,91 +1,52 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
5
|
-
import type
|
|
5
|
+
import type { Pathspec } from '../utils/pathspec.js';
|
|
6
|
+
import { type GitBlobReader } from './gitBlobReader.js';
|
|
6
7
|
import { TreeIndex } from './treeIndex.js';
|
|
8
|
+
export type DiffScopeVerdict = {
|
|
9
|
+
changesSeen: number;
|
|
10
|
+
linesYielded: number;
|
|
11
|
+
};
|
|
7
12
|
export default class GitAdapter implements GitBlobReader {
|
|
8
13
|
protected readonly config: Config;
|
|
9
14
|
private static instances;
|
|
10
15
|
private static keyFor;
|
|
11
16
|
static getInstance(config: Config): GitAdapter;
|
|
17
|
+
static closeAll(): Promise<void>;
|
|
12
18
|
protected readonly treeIndex: Map<string, TreeIndex>;
|
|
13
|
-
protected
|
|
14
|
-
private
|
|
15
|
-
private static readonly STDERR_BUFFER_CAP;
|
|
16
|
-
private static readonly LFS_POINTER_CAP;
|
|
17
|
-
private spawnFn;
|
|
19
|
+
protected readonly blobIdIndex: Map<string, Map<string, ObjectId>>;
|
|
20
|
+
private repoHandle;
|
|
18
21
|
private constructor();
|
|
19
|
-
|
|
20
|
-
|
|
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;
|
|
22
|
+
protected getRepo(): Promise<Repository>;
|
|
23
|
+
close(): Promise<void>;
|
|
27
24
|
configureRepository(): Promise<void>;
|
|
28
25
|
parseRev(ref: string): Promise<string>;
|
|
29
26
|
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;
|
|
27
|
+
protected indexRevision(revision: string): Promise<Map<string, ObjectId>>;
|
|
55
28
|
protected pathExistsImpl(path: string, revision: string): boolean;
|
|
56
29
|
pathExists(path: string, revision?: string): Promise<boolean>;
|
|
57
30
|
getFirstCommitRef(): Promise<string>;
|
|
31
|
+
protected resolveObjectId(forRef: FileGitRef): Promise<ObjectId>;
|
|
32
|
+
protected readBlobBuffer(forRef: FileGitRef): Promise<Buffer>;
|
|
58
33
|
getBufferContent(forRef: FileGitRef): Promise<Buffer>;
|
|
59
34
|
getBufferContentOrEscalate(forRef: FileGitRef): Promise<Buffer>;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
*/
|
|
35
|
+
streamContent(forRef: FileGitRef): Readable;
|
|
36
|
+
private pipeBlobContent;
|
|
37
|
+
private pipeLfsObject;
|
|
70
38
|
streamArchive(path: string, revision: string): AsyncGenerator<{
|
|
71
39
|
path: string;
|
|
72
40
|
stream: Readable;
|
|
73
41
|
}>;
|
|
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
42
|
getStringContent(forRef: FileGitRef): Promise<string>;
|
|
84
43
|
protected getFilesPathCached(path: string, revision: string): string[];
|
|
85
44
|
getFilesPath(paths: string | string[], revision?: string): Promise<string[]>;
|
|
86
45
|
listDirAtRevision(dir: string, revision: string): Promise<string[]>;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
46
|
+
grepUnderPaths(pattern: string, path: string | string[], revision?: string): Promise<string[]>;
|
|
47
|
+
grepMatchingPathspecs(pattern: string, path: string | string[], revision?: string): Promise<string[]>;
|
|
48
|
+
private grepBlobs;
|
|
49
|
+
streamDiffLines(verdict: DiffScopeVerdict, scopes: readonly Pathspec[]): AsyncGenerator<string>;
|
|
50
|
+
getUnmatchedSourceScopes(verdict: DiffScopeVerdict, scopes: readonly Pathspec[]): readonly string[];
|
|
51
|
+
private requestDiff;
|
|
91
52
|
}
|