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.
Files changed (139) hide show
  1. package/README.md +12 -3
  2. package/lib/adapter/GitAdapter.d.ts +25 -64
  3. package/lib/adapter/GitAdapter.js +352 -483
  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 +5 -4
  8. package/lib/adapter/ioExecutor.js +22 -14
  9. package/lib/adapter/ioExecutor.js.map +1 -1
  10. package/lib/adapter/pathMatching.d.ts +9 -0
  11. package/lib/adapter/pathMatching.js +83 -0
  12. package/lib/adapter/pathMatching.js.map +1 -0
  13. package/lib/adapter/tsgitErrorMap.d.ts +7 -0
  14. package/lib/adapter/tsgitErrorMap.js +32 -0
  15. package/lib/adapter/tsgitErrorMap.js.map +1 -0
  16. package/lib/commands/sgd/source/delta.js.map +1 -1
  17. package/lib/constant/gitConstants.d.ts +0 -2
  18. package/lib/constant/gitConstants.js +0 -8
  19. package/lib/constant/gitConstants.js.map +1 -1
  20. package/lib/constant/metadataConstants.d.ts +1 -0
  21. package/lib/constant/metadataConstants.js +1 -0
  22. package/lib/constant/metadataConstants.js.map +1 -1
  23. package/lib/main.d.ts +2 -2
  24. package/lib/main.js +64 -35
  25. package/lib/main.js.map +1 -1
  26. package/lib/post-processor/baseProcessor.d.ts +9 -6
  27. package/lib/post-processor/baseProcessor.js +5 -6
  28. package/lib/post-processor/baseProcessor.js.map +1 -1
  29. package/lib/post-processor/changesManifestProcessor.d.ts +3 -2
  30. package/lib/post-processor/changesManifestProcessor.js +5 -4
  31. package/lib/post-processor/changesManifestProcessor.js.map +1 -1
  32. package/lib/post-processor/flowTranslationProcessor.d.ts +8 -7
  33. package/lib/post-processor/flowTranslationProcessor.js +20 -19
  34. package/lib/post-processor/flowTranslationProcessor.js.map +1 -1
  35. package/lib/post-processor/includeProcessor.d.ts +6 -5
  36. package/lib/post-processor/includeProcessor.js +7 -6
  37. package/lib/post-processor/includeProcessor.js.map +1 -1
  38. package/lib/post-processor/packageGenerator.d.ts +3 -2
  39. package/lib/post-processor/packageGenerator.js +5 -4
  40. package/lib/post-processor/packageGenerator.js.map +1 -1
  41. package/lib/post-processor/postProcessorManager.d.ts +5 -7
  42. package/lib/post-processor/postProcessorManager.js +23 -31
  43. package/lib/post-processor/postProcessorManager.js.map +1 -1
  44. package/lib/service/botHandler.d.ts +1 -2
  45. package/lib/service/botHandler.js +17 -10
  46. package/lib/service/botHandler.js.map +1 -1
  47. package/lib/service/containedDecomposedHandler.d.ts +4 -5
  48. package/lib/service/containedDecomposedHandler.js +13 -12
  49. package/lib/service/containedDecomposedHandler.js.map +1 -1
  50. package/lib/service/customFieldHandler.d.ts +1 -2
  51. package/lib/service/customFieldHandler.js +7 -6
  52. package/lib/service/customFieldHandler.js.map +1 -1
  53. package/lib/service/customLabelHandler.d.ts +1 -2
  54. package/lib/service/customLabelHandler.js +3 -3
  55. package/lib/service/customLabelHandler.js.map +1 -1
  56. package/lib/service/customObjectHandler.d.ts +3 -4
  57. package/lib/service/customObjectHandler.js +10 -9
  58. package/lib/service/customObjectHandler.js.map +1 -1
  59. package/lib/service/decomposedHandler.d.ts +3 -4
  60. package/lib/service/decomposedHandler.js +5 -4
  61. package/lib/service/decomposedHandler.js.map +1 -1
  62. package/lib/service/diffLineInterpreter.d.ts +3 -3
  63. package/lib/service/diffLineInterpreter.js +18 -14
  64. package/lib/service/diffLineInterpreter.js.map +1 -1
  65. package/lib/service/flowHandler.d.ts +1 -2
  66. package/lib/service/flowHandler.js +9 -4
  67. package/lib/service/flowHandler.js.map +1 -1
  68. package/lib/service/inFileHandler.d.ts +8 -9
  69. package/lib/service/inFileHandler.js +28 -27
  70. package/lib/service/inFileHandler.js.map +1 -1
  71. package/lib/service/inFolderHandler.d.ts +4 -5
  72. package/lib/service/inFolderHandler.js +6 -5
  73. package/lib/service/inFolderHandler.js.map +1 -1
  74. package/lib/service/inResourceHandler.d.ts +4 -5
  75. package/lib/service/inResourceHandler.js +8 -7
  76. package/lib/service/inResourceHandler.js.map +1 -1
  77. package/lib/service/objectTranslationHandler.d.ts +1 -2
  78. package/lib/service/objectTranslationHandler.js +6 -5
  79. package/lib/service/objectTranslationHandler.js.map +1 -1
  80. package/lib/service/reportingFolderHandler.d.ts +6 -7
  81. package/lib/service/reportingFolderHandler.js +6 -6
  82. package/lib/service/reportingFolderHandler.js.map +1 -1
  83. package/lib/service/sharedFolderHandler.d.ts +4 -5
  84. package/lib/service/sharedFolderHandler.js +6 -6
  85. package/lib/service/sharedFolderHandler.js.map +1 -1
  86. package/lib/service/standardHandler.d.ts +5 -9
  87. package/lib/service/standardHandler.js +28 -35
  88. package/lib/service/standardHandler.js.map +1 -1
  89. package/lib/service/typeHandlerFactory.d.ts +3 -3
  90. package/lib/service/typeHandlerFactory.js +6 -6
  91. package/lib/service/typeHandlerFactory.js.map +1 -1
  92. package/lib/types/config.d.ts +5 -1
  93. package/lib/types/handlerResult.d.ts +7 -7
  94. package/lib/types/handlerResult.js +10 -1
  95. package/lib/types/handlerResult.js.map +1 -1
  96. package/lib/types/work.d.ts +1 -1
  97. package/lib/utils/arrayUtils.d.ts +1 -1
  98. package/lib/utils/arrayUtils.js.map +1 -1
  99. package/lib/utils/bundleRollup.d.ts +6 -0
  100. package/lib/utils/bundleRollup.js +62 -0
  101. package/lib/utils/bundleRollup.js.map +1 -0
  102. package/lib/utils/changeSet.d.ts +12 -15
  103. package/lib/utils/changeSet.js +23 -120
  104. package/lib/utils/changeSet.js.map +1 -1
  105. package/lib/utils/changesAssembly.d.ts +8 -0
  106. package/lib/utils/changesAssembly.js +21 -0
  107. package/lib/utils/changesAssembly.js.map +1 -0
  108. package/lib/utils/configValidator.d.ts +7 -6
  109. package/lib/utils/configValidator.js +32 -11
  110. package/lib/utils/configValidator.js.map +1 -1
  111. package/lib/utils/fsHelper.d.ts +2 -1
  112. package/lib/utils/fsHelper.js +7 -3
  113. package/lib/utils/fsHelper.js.map +1 -1
  114. package/lib/utils/messageSanitizer.d.ts +1 -0
  115. package/lib/utils/messageSanitizer.js +48 -0
  116. package/lib/utils/messageSanitizer.js.map +1 -0
  117. package/lib/utils/metadataDiff/index.d.ts +0 -2
  118. package/lib/utils/metadataDiff/index.js.map +1 -1
  119. package/lib/utils/metadataDiff/streamingDiff.d.ts +1 -3
  120. package/lib/utils/metadataDiff/streamingDiff.js +16 -54
  121. package/lib/utils/metadataDiff/streamingDiff.js.map +1 -1
  122. package/lib/utils/pathspec.d.ts +15 -0
  123. package/lib/utils/pathspec.js +71 -0
  124. package/lib/utils/pathspec.js.map +1 -0
  125. package/lib/utils/renameResolver.d.ts +6 -6
  126. package/lib/utils/renameResolver.js +10 -9
  127. package/lib/utils/renameResolver.js.map +1 -1
  128. package/lib/utils/repoGitDiff.d.ts +2 -0
  129. package/lib/utils/repoGitDiff.js +14 -1
  130. package/lib/utils/repoGitDiff.js.map +1 -1
  131. package/messages/delta.md +26 -0
  132. package/oclif.manifest.json +2 -2
  133. package/package.json +28 -20
  134. package/lib/adapter/gitBatchCatFile.d.ts +0 -42
  135. package/lib/adapter/gitBatchCatFile.js +0 -203
  136. package/lib/adapter/gitBatchCatFile.js.map +0 -1
  137. package/lib/post-processor/bundleRollupProcessor.d.ts +0 -7
  138. package/lib/post-processor/bundleRollupProcessor.js +0 -81
  139. package/lib/post-processor/bundleRollupProcessor.js.map +0 -1
@@ -13,8 +13,8 @@ import { log } from './LoggingDecorator.js';
13
13
  import { Logger, lazy } from './LoggingService.js';
14
14
  /**
15
15
  * Turns the `{ fromPath, toPath }` pairs git emitted for `-M` renames into
16
- * `ChangeSet.recordRename(type, from, to)` calls by re-using the handler
17
- * machinery to resolve each side to its Salesforce (type, member).
16
+ * `RenameTriple` values by re-using the handler machinery to resolve each
17
+ * side to its Salesforce (type, member).
18
18
  *
19
19
  * Pairs where metadata resolution fails (ignored path, unknown type) or where
20
20
  * the from/to side land on the same component are skipped — those reduce to
@@ -22,16 +22,17 @@ import { Logger, lazy } from './LoggingService.js';
22
22
  */
23
23
  export default class RenameResolver {
24
24
  factory;
25
- constructor(work, metadata) {
26
- this.factory = new TypeHandlerFactory(work, metadata);
25
+ constructor(config, metadata) {
26
+ this.factory = new TypeHandlerFactory(config, metadata);
27
27
  }
28
- async apply(changes, pairs) {
28
+ async resolve(pairs) {
29
+ const triples = [];
29
30
  for (const pair of pairs) {
30
31
  const resolved = await this._resolve(pair);
31
- if (resolved) {
32
- changes.recordRename(resolved.type, resolved.from, resolved.to);
33
- }
32
+ if (resolved)
33
+ triples.push(resolved);
34
34
  }
35
+ return triples;
35
36
  }
36
37
  async _resolve(pair) {
37
38
  try {
@@ -56,5 +57,5 @@ export default class RenameResolver {
56
57
  }
57
58
  __decorate([
58
59
  log
59
- ], RenameResolver.prototype, "apply", null);
60
+ ], RenameResolver.prototype, "resolve", null);
60
61
  //# sourceMappingURL=renameResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renameResolver.js","sourceRoot":"","sources":["../../src/utils/renameResolver.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;;AAEZ,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAEhE,OAAO,kBAAkB,MAAM,kCAAkC,CAAA;AAGjE,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAGlD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IAChB,OAAO,CAAoB;IAE5C,YAAY,IAAU,EAAE,QAA4B;QAClD,IAAI,CAAC,OAAO,GAAG,IA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AC;YACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CACnD,GAAG,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,CACpC,CAAA;YACD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,cAAc,CACjD,GAAG,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAClC,CAAA;YACD,MAAM,IAAI,GAAG,WAAW,CAAC,oBAAoB,EAAE,CAAA;YAC/C,MAAM,EAAE,GAAG,SAAS,CAAC,oBAAoB,EAAE,CAAA;YAC3C,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAA;YACtC,gOAAgO;YAChO,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAA;YAC1C,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,MAAM,EAAE,CAAA;QAC9D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,IAAI;YACT,0IAA0I;YAC1I,IAAI,CAAA,qCAAqC,IAAI,CAAC,QAAQ,OAAO,IAAI,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAC5G,CAAA;YACD,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF;AAnCc;IADZ,GAAG;6CAUH"}
@@ -10,6 +10,7 @@ export default class RepoGitDiff {
10
10
  protected readonly metadata: MetadataRepository;
11
11
  protected readonly gitAdapter: GitAdapter;
12
12
  private renamePairs;
13
+ private readonly diffScopeVerdict;
13
14
  constructor(config: Config, metadata: MetadataRepository);
14
15
  /**
15
16
  * Streams the filtered, rename-expanded diff lines. Yields A/M lines as
@@ -23,6 +24,7 @@ export default class RepoGitDiff {
23
24
  */
24
25
  getLines(): AsyncGenerator<string>;
25
26
  getRenamePairs(): readonly RenamePathPair[];
27
+ getUnmatchedSourceScopes(): readonly string[];
26
28
  protected _expandRename(line: string): Iterable<string>;
27
29
  protected _extractComparisonName(line: string): string;
28
30
  }
@@ -8,6 +8,14 @@ export default class RepoGitDiff {
8
8
  metadata;
9
9
  gitAdapter;
10
10
  renamePairs = [];
11
+ // The field initialiser only zeroes this once, at construction.
12
+ // getLines() can be called more than once on the same instance (see the
13
+ // renamePairs reset below), so the verdict is reset explicitly at the
14
+ // start of every call rather than relying on the initialiser alone.
15
+ diffScopeVerdict = {
16
+ changesSeen: 0,
17
+ linesYielded: 0,
18
+ };
11
19
  constructor(config, metadata) {
12
20
  this.config = config;
13
21
  this.metadata = metadata;
@@ -25,10 +33,12 @@ export default class RepoGitDiff {
25
33
  */
26
34
  async *getLines() {
27
35
  this.renamePairs = [];
36
+ this.diffScopeVerdict.changesSeen = 0;
37
+ this.diffScopeVerdict.linesYielded = 0;
28
38
  const ignoreHelper = await buildIgnoreHelper(this.config);
29
39
  const additionNames = new Set();
30
40
  const deferredDeletions = [];
31
- for await (const rawLine of this.gitAdapter.streamDiffLines()) {
41
+ for await (const rawLine of this.gitAdapter.streamDiffLines(this.diffScopeVerdict, this.config.source)) {
32
42
  for (const expanded of this._expandRename(rawLine)) {
33
43
  // Stryker disable next-line ConditionalExpression -- equivalent: _expandRename never yields empty/falsy strings — it yields the original line or the synthetic D/A pair, both non-empty; the false-flip falls through to metadata.has which would return false on empty paths, observably the same continue
34
44
  if (!expanded)
@@ -64,6 +74,9 @@ export default class RepoGitDiff {
64
74
  getRenamePairs() {
65
75
  return this.renamePairs;
66
76
  }
77
+ getUnmatchedSourceScopes() {
78
+ return this.gitAdapter.getUnmatchedSourceScopes(this.diffScopeVerdict, this.config.source);
79
+ }
67
80
  // git emits `R<score>\tfrom\tto` when -M detects a rename. Each rename is
68
81
  // expanded into the equivalent D/A pair so every downstream handler keeps
69
82
  // operating on a (status, path) tuple; the rename pair is captured for
@@ -1 +1 @@
1
- {"version":3,"file":"repoGitDiff.js","sourceRoot":"","sources":["../../src/utils/repoGitDiff.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AACZ,OAAO,UAAU,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAIzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAIrD,MAAM,CAAC,OAAO,OAAO,WAAW;IAKT,MAAM;IACN,QAAQ;IALV,UAAU,CAAY;IACjC,WAAW,GAAqB,EAAE,CAAA;IAE1C,YACqB,MAAc,EACd,QAA4B;sBAD5B,MAAM;wBACN,QAAQ;QAE3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACvD,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,CAAC,QAAQ;QACpB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAA;QACrB,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACzD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAA;QACvC,MAAM,iBAAiB,GAAa,EAAE,CAAA;QAEtC,IAAI,KAAK,EAAE,MAAM,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,CAAC;YAC9D,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnD,4SAA4S;gBAC5S,IAAI,CAAC,QAAQ;oBAAE,SAAQ;gBACvB,wQAAwQ;gBACxQ,oIAAoI;gBACpI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;oBAAE,SAAQ;gBAC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C;CACF"}
package/messages/delta.md CHANGED
@@ -44,6 +44,8 @@ The folder can exist or not.
44
44
  * If the folder exists, its contents will be processed.
45
45
  * If the folder doesn't exist, it usually won't show any output—unless the folder was recently deleted and is part of a diff, in which case changes may still be picked up.
46
46
 
47
+ Each value must be a literal repository-relative path: wildcards (`*`, `?`, `[`), git pathspec magic (`:(...)`), absolute paths, `..` and the empty string are all rejected. Matching is rooted at the repository root, so `--source-dir force-app` does not match `nested/force-app/...`.
48
+
47
49
  # flags.ignore.summary
48
50
 
49
51
  file listing paths to explicitly ignore for any diff actions
@@ -96,6 +98,26 @@ path to a JSON file grouping changed components by kind (add, modify, delete, re
96
98
 
97
99
  --changes-manifest: cannot inspect '%s': %s
98
100
 
101
+ # error.SourceDirIsEmpty
102
+
103
+ --source-dir does not accept an empty value; use '.' to scope the whole repository (received: '%s')
104
+
105
+ # error.SourceDirIsAbsolute
106
+
107
+ --source-dir must be a path relative to --repo-dir, not an absolute path (received: '%s')
108
+
109
+ # error.SourceDirEscapesRepository
110
+
111
+ --source-dir does not accept '..' path segments; use a literal repository-relative path instead (received: '%s')
112
+
113
+ # error.SourceDirContainsWildcard
114
+
115
+ --source-dir does not accept wildcards (*, ?, [); repeat --source-dir once per folder, or use --include-file/--ignore-file to filter by pattern (received: '%s')
116
+
117
+ # error.SourceDirUsesPathspecMagic
118
+
119
+ --source-dir does not accept git pathspec magic (e.g. ':(exclude)', ':!'); use a literal repository-relative path instead (received: '%s')
120
+
99
121
  # warning.ApiVersionOverridden
100
122
 
101
123
  API version '%s' is not supported, using '%s' instead
@@ -120,6 +142,10 @@ Attempt to delete the flow '%s' via destructiveChanges.xml may not work as expec
120
142
 
121
143
  Deleting the DigitalExperienceBundle '%s' via destructiveChanges.xml requires the related Experience site to be deactivated first for the deployment to succeed
122
144
 
145
+ # warning.SourceDirMatchedNothing
146
+
147
+ No changes found under '%s' between '%s' and '%s'
148
+
123
149
  # info.CommandIsRunning
124
150
 
125
151
  Generating incremental package
@@ -80,7 +80,7 @@
80
80
  ],
81
81
  "char": "s",
82
82
  "deprecateAliases": true,
83
- "description": "You can use this flag multiple times to include different folders that contain source files. Each path should be relative to --repo-dir.\n\nThe folder can exist or not.\n* If the folder exists, its contents will be processed.\n* If the folder doesn't exist, it usually won't show any output—unless the folder was recently deleted and is part of a diff, in which case changes may still be picked up.",
83
+ "description": "You can use this flag multiple times to include different folders that contain source files. Each path should be relative to --repo-dir.\n\nThe folder can exist or not.\n* If the folder exists, its contents will be processed.\n* If the folder doesn't exist, it usually won't show any output—unless the folder was recently deleted and is part of a diff, in which case changes may still be picked up.\n\nEach value must be a literal repository-relative path: wildcards (`*`, `?`, `[`), git pathspec magic (`:(...)`), absolute paths, `..` and the empty string are all rejected. Matching is rooted at the repository root, so `--source-dir force-app` does not match `nested/force-app/...`.",
84
84
  "name": "source-dir",
85
85
  "summary": "source folders focus location relative to --repo-dir",
86
86
  "default": [
@@ -199,5 +199,5 @@
199
199
  ]
200
200
  }
201
201
  },
202
- "version": "7.0.1"
202
+ "version": "7.2.0"
203
203
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfdx-git-delta",
3
- "version": "7.0.1",
3
+ "version": "7.2.0",
4
4
  "description": "Generate the sfdx content in source format and destructive change from two git commits",
5
5
  "keywords": [
6
6
  "salesforce",
@@ -14,12 +14,12 @@
14
14
  "sf-plugin"
15
15
  ],
16
16
  "engines": {
17
- "node": ">=22.19"
17
+ "node": ">=22.22.1",
18
+ "npm": ">=12"
18
19
  },
19
20
  "files": [
20
21
  "/lib",
21
22
  "/messages",
22
- "/npm-shrinkwrap.json",
23
23
  "/oclif.lock",
24
24
  "/oclif.manifest.json"
25
25
  ],
@@ -48,33 +48,33 @@
48
48
  "access": "public"
49
49
  },
50
50
  "dependencies": {
51
- "@oclif/core": "4.11.14",
52
- "@salesforce/core": "8.32.2",
53
- "@salesforce/sf-plugins-core": "12.2.26",
54
- "@salesforce/source-deploy-retrieve": "12.37.1",
51
+ "@oclif/core": "4.13.3",
52
+ "@salesforce/core": "9.1.0",
53
+ "@salesforce/sf-plugins-core": "13.0.0",
54
+ "@salesforce/source-deploy-retrieve": "13.0.1",
55
+ "@scolladon/tsgit": "3.2.1",
55
56
  "ignore": "7.0.6",
56
- "tar-stream": "3.2.0",
57
57
  "txml": "6.0.0",
58
58
  "zod": "4.4.3"
59
59
  },
60
60
  "devDependencies": {
61
- "@biomejs/biome": "2.5.3",
61
+ "@biomejs/biome": "2.5.7",
62
62
  "@commitlint/cli": "21.2.1",
63
63
  "@commitlint/config-conventional": "21.2.0",
64
64
  "@ls-lint/ls-lint": "2.3.1",
65
- "@oclif/plugin-help": "6.2.53",
66
- "@salesforce/cli-plugins-testkit": "5.3.62",
65
+ "@oclif/plugin-help": "6.2.56",
66
+ "@salesforce/cli-plugins-testkit": "5.3.65",
67
67
  "@salesforce/dev-config": "4.3.3",
68
68
  "@stryker-mutator/core": "9.6.1",
69
69
  "@stryker-mutator/vitest-runner": "9.6.1",
70
- "@types/node": "26.1.1",
71
- "@types/tar-stream": "3.1.4",
70
+ "@types/node": "26.1.2",
72
71
  "@vitest/coverage-v8": "4.1.10",
73
72
  "husky": "9.1.7",
74
- "knip": "6.26.0",
75
- "lint-staged": "17.0.8",
73
+ "knip": "6.32.0",
74
+ "lint-staged": "17.3.0",
76
75
  "ls-engines": "0.10.1",
77
- "oclif": "4.23.27",
76
+ "oclif": "4.23.30",
77
+ "pkg-pr-new": "0.0.87",
78
78
  "shx": "0.4.0",
79
79
  "ts-node": "10.9.2",
80
80
  "typescript": "7.0.2",
@@ -82,6 +82,17 @@
82
82
  "vitest": "4.1.10",
83
83
  "wireit": "0.14.13"
84
84
  },
85
+ "overrides": {
86
+ "@salesforce/source-deploy-retrieve": {
87
+ "minimatch": "^10.1.2"
88
+ },
89
+ "filelist": {
90
+ "minimatch": "^10.1.2"
91
+ },
92
+ "typed-rest-client": {
93
+ "qs": "^6.15.3"
94
+ }
95
+ },
85
96
  "scripts": {
86
97
  "build": "wireit",
87
98
  "clean": "wireit",
@@ -89,9 +100,6 @@
89
100
  "clean:package-manager": "wireit",
90
101
  "dependencies:reinstall": "npm install",
91
102
  "dependencies:upgrade": "npx npm-check-updates -u ; npm install ; npm audit fix",
92
- "devops:cleanup:dev-tag": "./tooling/devops-cleanup.sh",
93
- "devops:cleanup:dev-tag:all": "./tooling/devops-cleanup-all.sh",
94
- "devops:move-tag": "./tooling/devops-movetag.sh",
95
103
  "lint:dependencies": "wireit",
96
104
  "lint:engine": "wireit",
97
105
  "lint:fs": "wireit",
@@ -100,7 +108,7 @@
100
108
  "postpack": "shx rm -f oclif.manifest.json && shx sed -i 'blob/v[^/]*/' 'blob/main/' README.md",
101
109
  "prepack": "wireit",
102
110
  "prepare": "husky",
103
- "prepublishOnly": "shx cp package-lock.json npm-shrinkwrap.json",
111
+ "preview:publish": "pkg-pr-new publish --comment=off",
104
112
  "sync:registry": "TS_NODE_COMPILER_OPTIONS='{\"rootDir\":\".\"}' node --loader ts-node/esm tooling/syncInternalRegistryWithSdr.ts",
105
113
  "test:build": "wireit",
106
114
  "test:functional": "wireit",
@@ -1,42 +0,0 @@
1
- import { type ChildProcessWithoutNullStreams } from 'node:child_process';
2
- import { type SpawnFn } from './gitBlobReader.js';
3
- type PendingRequest = {
4
- oid: string;
5
- path: string;
6
- allowStreamingEscalation: boolean;
7
- resolve: (buf: Buffer) => void;
8
- reject: (err: unknown) => void;
9
- };
10
- export type GitBatchCatFileOptions = {
11
- sizeThreshold?: number;
12
- spawnFn?: SpawnFn;
13
- };
14
- export declare class GitBatchCatFile {
15
- protected readonly cwd: string;
16
- protected process: ChildProcessWithoutNullStreams;
17
- protected queue: PendingRequest[];
18
- protected chunks: Buffer[];
19
- protected totalLength: number;
20
- protected pendingSize: number;
21
- private readonly sizeThreshold;
22
- private readonly spawnFn;
23
- constructor(cwd: string, options?: GitBatchCatFileOptions);
24
- getContent(oid: string, path: string): Promise<Buffer>;
25
- /**
26
- * Like getContent, but rejects with EscalateToStreamingSignal when the
27
- * blob size (from the git cat-file header) is at or above SIZE_THRESHOLD.
28
- * The subprocess is then recycled so queued reads keep flowing.
29
- */
30
- getContentOrEscalate(oid: string, path: string): Promise<Buffer>;
31
- close(): void;
32
- private _enqueue;
33
- protected _onData(chunk: Buffer): void;
34
- protected _materializeBuffer(): Buffer;
35
- protected _advance(buffer: Buffer, consumed: number): Buffer;
36
- protected _processBuffer(): void;
37
- private _parseHeader;
38
- private _escalateHead;
39
- private _recycleSubprocess;
40
- private _spawnSubprocess;
41
- }
42
- export {};
@@ -1,203 +0,0 @@
1
- 'use strict';
2
- import { spawn } from 'node:child_process';
3
- import { getErrorMessage } from '../utils/errorUtils.js';
4
- import { Logger, lazy } from '../utils/LoggingService.js';
5
- import { EscalateToStreamingSignal, SIZE_THRESHOLD, } from './gitBlobReader.js';
6
- export class GitBatchCatFile {
7
- cwd;
8
- process;
9
- queue = [];
10
- chunks = [];
11
- totalLength = 0;
12
- pendingSize = -1;
13
- sizeThreshold;
14
- spawnFn;
15
- constructor(cwd, options = {}) {
16
- this.cwd = cwd;
17
- this.sizeThreshold = options.sizeThreshold ?? SIZE_THRESHOLD;
18
- this.spawnFn = options.spawnFn ?? spawn;
19
- this.process = this._spawnSubprocess();
20
- }
21
- async getContent(oid, path) {
22
- return this._enqueue(oid, path, false);
23
- }
24
- /**
25
- * Like getContent, but rejects with EscalateToStreamingSignal when the
26
- * blob size (from the git cat-file header) is at or above SIZE_THRESHOLD.
27
- * The subprocess is then recycled so queued reads keep flowing.
28
- */
29
- async getContentOrEscalate(oid, path) {
30
- return this._enqueue(oid, path, true);
31
- }
32
- close() {
33
- if (!this.process.killed) {
34
- this.process.stdin.end();
35
- this.process.kill();
36
- }
37
- for (const entry of this.queue) {
38
- entry.reject(new Error('GitBatchCatFile closed'));
39
- }
40
- this.queue = [];
41
- }
42
- _enqueue(oid, path, allowStreamingEscalation) {
43
- return new Promise((resolve, reject) => {
44
- this.queue.push({
45
- oid,
46
- path,
47
- allowStreamingEscalation,
48
- resolve,
49
- reject,
50
- });
51
- this.process.stdin.write(`${oid}:${path}\n`);
52
- });
53
- }
54
- _onData(chunk) {
55
- this.chunks.push(chunk);
56
- this.totalLength += chunk.length;
57
- this._processBuffer();
58
- }
59
- _materializeBuffer() {
60
- // Stryker disable next-line ConditionalExpression -- equivalent: single-chunk fast path; flipping to false forces a Buffer.concat([oneBuffer], length) which returns the same logical bytes, so observably equivalent
61
- if (this.chunks.length === 1)
62
- return this.chunks[0];
63
- const merged = Buffer.concat(this.chunks, this.totalLength);
64
- // Stryker disable next-line ArrayDeclaration -- equivalent: assignment resets chunks to a single concat'd buffer; injecting a different initial value is overwritten on the next _onData chunk push
65
- this.chunks = [merged];
66
- return merged;
67
- }
68
- _advance(buffer, consumed) {
69
- const rest = buffer.subarray(consumed);
70
- // Stryker disable next-line ConditionalExpression -- equivalent: empty-vs-non-empty rest path; either branch leaves chunks consistent with totalLength=rest.length, and downstream _materializeBuffer concat handles both shapes identically
71
- if (rest.length === 0) {
72
- this.chunks = [];
73
- this.totalLength = 0;
74
- }
75
- else {
76
- this.chunks = [rest];
77
- this.totalLength = rest.length;
78
- }
79
- return rest;
80
- }
81
- _processBuffer() {
82
- let buffer = this._materializeBuffer();
83
- // Stryker disable next-line BlockStatement -- equivalent: the loop is the entirety of header/body parsing; emptying it leaves the queue stuck unprocessed but the unit test surface only awaits resolutions that are already in flight, so the empty-body mutant manifests as a hang detected by stryker as Survived rather than killed cleanly
84
- while (this.queue.length > 0) {
85
- if (this.pendingSize === -1) {
86
- const outcome = this._parseHeader(buffer);
87
- if (outcome === 'need-more-data')
88
- return;
89
- buffer = outcome.remaining;
90
- // Stryker disable next-line ConditionalExpression -- equivalent: the OR-chained reject/escalated continue is a tight loop optimisation; flipping to true continues on every header parse, which is a no-op when the only follow-up is the loop's queue.length re-check
91
- if (outcome.action === 'reject' || outcome.action === 'escalated') {
92
- continue;
93
- }
94
- }
95
- if (buffer.length < this.pendingSize + 1)
96
- return;
97
- const content = Buffer.from(buffer.subarray(0, this.pendingSize));
98
- buffer = this._advance(buffer, this.pendingSize + 1);
99
- this.pendingSize = -1;
100
- this.queue.shift().resolve(content);
101
- }
102
- }
103
- _parseHeader(buffer) {
104
- const newlineIdx = buffer.indexOf(0x0a);
105
- if (newlineIdx === -1)
106
- return 'need-more-data';
107
- const header = buffer.subarray(0, newlineIdx).toString();
108
- const remaining = this._advance(buffer, newlineIdx + 1);
109
- if (header.endsWith('missing')) {
110
- this.queue.shift().reject(new Error(`Object not found: ${header}`));
111
- return { remaining, action: 'reject' };
112
- }
113
- const parts = header.split(' ');
114
- const parsedSize = Number.parseInt(parts[2], 10);
115
- if (Number.isNaN(parsedSize)) {
116
- this.queue.shift().reject(new Error(`Invalid header: ${header}`));
117
- return { remaining, action: 'reject' };
118
- }
119
- const head = this.queue[0];
120
- if (head.allowStreamingEscalation && parsedSize >= this.sizeThreshold) {
121
- this._escalateHead(parsedSize);
122
- return { remaining: Buffer.alloc(0), action: 'escalated' };
123
- }
124
- this.pendingSize = parsedSize;
125
- // Stryker disable next-line StringLiteral -- equivalent: 'await-body' is an internal action token consumed by _processBuffer's outcome.action check; the string only matters for the inverse equality on 'reject'|'escalated' which the await-body branch falls through, so the literal name is unobservable
126
- return { remaining, action: 'await-body' };
127
- }
128
- _escalateHead(size) {
129
- const escalated = this.queue.shift();
130
- escalated.reject(new EscalateToStreamingSignal(size, {
131
- oid: escalated.oid,
132
- path: escalated.path,
133
- }));
134
- const pending = this.queue.splice(0);
135
- this._recycleSubprocess();
136
- for (const request of pending) {
137
- this.queue.push(request);
138
- // Stryker disable next-line StringLiteral -- equivalent: the cat-file --batch protocol terminates each input with a newline; the test surface stubs stdin.write so the literal template is opaque past the call
139
- this.process.stdin.write(`${request.oid}:${request.path}\n`);
140
- }
141
- }
142
- _recycleSubprocess() {
143
- const stale = this.process;
144
- // Detach listeners BEFORE kill: Node may have already queued stdout
145
- // `data` events for bytes read before the escalation header was
146
- // parsed. Those events would still fire on `_onData` and corrupt the
147
- // fresh subprocess's header state via the shared chunks/pendingSize
148
- // fields.
149
- stale.stdout.removeAllListeners('data');
150
- // Stryker disable next-line StringLiteral -- equivalent: 'data' event name on stderr is symmetric with stdout; tests stub the EventEmitter shape so literal name swaps don't change the recycle's observable effect on the next subprocess
151
- stale.stderr.removeAllListeners('data');
152
- // Stryker disable next-line StringLiteral -- equivalent: 'close' event detachment ensures the prior subprocess close doesn't fire on the new process; the test surface verifies the new subprocess handles requests without checking the prior subprocess listener cleanup
153
- stale.removeAllListeners('close');
154
- // Stryker disable next-line StringLiteral -- equivalent: 'error' event detachment is symmetric with the others; the new subprocess installs its own listeners
155
- stale.removeAllListeners('error');
156
- if (!stale.killed) {
157
- // Stryker disable next-line BlockStatement -- equivalent: the try/catch wraps a best-effort stdin.end() during recycle; emptying the body skips the close-stdin path but stale.kill() below still terminates the subprocess
158
- try {
159
- stale.stdin.end();
160
- }
161
- catch {
162
- // ignore broken pipe while recycling
163
- }
164
- stale.kill();
165
- }
166
- this.chunks = [];
167
- this.totalLength = 0;
168
- this.pendingSize = -1;
169
- this.process = this._spawnSubprocess();
170
- }
171
- _spawnSubprocess() {
172
- const child = this.spawnFn('git', ['cat-file', '--batch'], {
173
- cwd: this.cwd,
174
- stdio: ['pipe', 'pipe', 'pipe'],
175
- });
176
- child.stdout.on('data', (chunk) => this._onData(chunk));
177
- // Stryker disable BlockStatement,StringLiteral,ArrowFunction -- equivalent: stderr/error listeners are observability-only; tests assert the protocol contract via stdout, not on the lazy log content
178
- child.stderr.on('data', (chunk) => {
179
- Logger.debug(lazy `GitBatchCatFile stderr: ${() => chunk.toString()}`);
180
- });
181
- child.on('error', (err) => {
182
- Logger.debug(lazy `GitBatchCatFile process error: ${() => getErrorMessage(err)}`);
183
- });
184
- // Stryker restore BlockStatement,StringLiteral,ArrowFunction
185
- child.on('close', (code) => {
186
- // Stryker disable next-line ConditionalExpression -- equivalent: see v8 ignore — the close listener is bound to the active process by construction
187
- /* v8 ignore next -- defensive: the close listener is bound to the active process; only fires for `this.process` in practice */
188
- if (child !== this.process)
189
- return;
190
- // Stryker disable next-line ConditionalExpression,EqualityOperator -- equivalent: the close handler cleans up pending requests on non-zero exit when the queue is non-empty; flipping to true rejects on every close (including the recycle path) but the recycle clears queue first via _escalateHead, and flipping >= 0 is always true (queue.length is always >= 0) — both arms still reject pending entries with the same error
191
- if (code !== 0 && this.queue.length > 0) {
192
- const error = new Error(`git cat-file exited with code ${code}`);
193
- for (const entry of this.queue) {
194
- entry.reject(error);
195
- }
196
- // Stryker disable next-line ArrayDeclaration -- equivalent: queue reset; an injected initial element would be rejected by the next _enqueue or close, neither of which the test surface observes for the synthetic element
197
- this.queue = [];
198
- }
199
- });
200
- return child;
201
- }
202
- }
203
- //# sourceMappingURL=gitBatchCatFile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gitBatchCatFile.js","sourceRoot":"","sources":["../../src/adapter/gitBatchCatFile.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AACZ,OAAO,EAAuC,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EACL,yBAAyB,EACzB,cAAc,GAEf,MAAM,oBAAoB,CAAA;AAe3B,MAAM,OAAO,eAAe;IAUL,GAAG;IATd,OAAO,CAAgC;IACvC,KAAK,GAAqB,EAAE,CAAA;IAC5B,MAAM,GAAa,EAAE,CAAA;IACrB,WAAW,GAAW,CAAC,CAAA;IACvB,WAAW,GAAW,CAAC,CAAC,CAAA;IACjB,aAAa,CAAQ;IACrB,OAAO,CAAS;IAEjC,YACqB,GAAW,EAC9B,OAAO,GAA2B,EAAE;mBADjB,GAAG;QAGtB,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,IAAI,cAAc,CAAA;QAC5D,IAAI,CAAC,OAAO,GA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AO,KAAK,CAAA;IACd,CAAC;CACF"}
@@ -1,7 +0,0 @@
1
- import BaseProcessor from './baseProcessor.js';
2
- export default class BundleRollupProcessor extends BaseProcessor {
3
- process(): Promise<void>;
4
- private _collectBundleMembers;
5
- private _isCoveredByBundle;
6
- private _warnBundleDeletions;
7
- }
@@ -1,81 +0,0 @@
1
- 'use strict';
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- import { DOT } from '../constant/fsConstants.js';
9
- import { DIGITAL_EXPERIENCE_BUNDLE_TYPE, DIGITAL_EXPERIENCE_TYPE, } from '../constant/metadataConstants.js';
10
- import { ManifestTarget } from '../types/handlerResult.js';
11
- import { log } from '../utils/LoggingDecorator.js';
12
- import { MessageService } from '../utils/MessageService.js';
13
- import BaseProcessor from './baseProcessor.js';
14
- // Generic shape (one concrete pair today): a parent metadata type whose
15
- // member subsumes every child of the same site/bundle in the deploy contract.
16
- // For DigitalExperienceBundle → DigitalExperience, a DEB member deploys (or
17
- // deletes) every DE child, so DE entries covered by a same-manifest DEB are
18
- // redundant. This processor collapses them per manifest and — because a
19
- // whole-bundle deletion is org-gated — warns when a DEB lands in
20
- // destructiveChanges. When a second parent/child pair appears, generalize to
21
- // a `BundleRollupProcessor` that takes a list of (parentType, childType,
22
- // parentMemberOf) configs; until then we keep the implementation focused on
23
- // the only pair we have empirical deploy semantics for.
24
- export default class BundleRollupProcessor extends BaseProcessor {
25
- async process() {
26
- const elements = this.work.changes.toElements();
27
- const bundleMembersByTarget = this._collectBundleMembers(elements);
28
- for (const element of elements) {
29
- if (
30
- // Stryker disable next-line ConditionalExpression -- equivalent: flipping the type guard to `true` would also attempt to remove non-DE elements covered by a same-prefix bundle member, but `ChangeSet.removeMember` is a no-op for non-shrinkable types — so the post-process manifest is byte-identical to the original.
31
- element.type === DIGITAL_EXPERIENCE_TYPE &&
32
- this._isCoveredByBundle(element, bundleMembersByTarget)) {
33
- this.work.changes.removeMember(element.target, element.type, element.member);
34
- }
35
- }
36
- this._warnBundleDeletions(bundleMembersByTarget.get(ManifestTarget.DestructiveChanges));
37
- }
38
- _collectBundleMembers(elements) {
39
- const bundleMembersByTarget = new Map();
40
- for (const { target, type, member } of elements) {
41
- if (type !== DIGITAL_EXPERIENCE_BUNDLE_TYPE)
42
- continue;
43
- let members = bundleMembersByTarget.get(target);
44
- if (!members) {
45
- members = new Set();
46
- bundleMembersByTarget.set(target, members);
47
- }
48
- members.add(member);
49
- }
50
- return bundleMembersByTarget;
51
- }
52
- _isCoveredByBundle(element, bundleMembersByTarget) {
53
- const bundleMembers = bundleMembersByTarget.get(element.target);
54
- if (!bundleMembers)
55
- return false;
56
- // A canonical `DigitalExperience` member is `<base>/<space>.<ct>/<cn>` and
57
- // `<space>` (a Salesforce API name) cannot contain `.`, so the first `.`
58
- // delimits the parent bundle's member exactly. One Set lookup vs. an
59
- // `O(B)` linear `startsWith` scan over `bundleMembers`.
60
- const dotIdx = element.member.indexOf(DOT);
61
- // Stryker disable next-line ConditionalExpression,EqualityOperator,BlockStatement,BooleanLiteral -- equivalent/defensive: `BundleHandler.getElementDescriptor` constructs every `DigitalExperience` member as `<base>/<space>.<ct>/<cn>`, so a dotless member cannot reach this branch from the production pipeline.
62
- /* v8 ignore next -- defensive: a DigitalExperience member without `.` is unreachable in production */
63
- if (dotIdx < 0)
64
- return false;
65
- return bundleMembers.has(element.member.slice(0, dotIdx));
66
- }
67
- _warnBundleDeletions(bundleMembers) {
68
- if (!bundleMembers)
69
- return;
70
- const message = new MessageService();
71
- for (const bundleMember of bundleMembers) {
72
- this.work.warnings.push(new Error(message.getMessage('warning.DigitalExperienceBundleDeletion', [
73
- bundleMember,
74
- ])));
75
- }
76
- }
77
- }
78
- __decorate([
79
- log
80
- ], BundleRollupProcessor.prototype, "process", null);
81
- //# sourceMappingURL=bundleRollupProcessor.js.map