@rushstack/package-deps-hash 3.0.86 → 3.1.3

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/CHANGELOG.json CHANGED
@@ -1,6 +1,80 @@
1
1
  {
2
2
  "name": "@rushstack/package-deps-hash",
3
3
  "entries": [
4
+ {
5
+ "version": "3.1.3",
6
+ "tag": "@rushstack/package-deps-hash_v3.1.3",
7
+ "date": "Fri, 03 Dec 2021 03:05:22 GMT",
8
+ "comments": {
9
+ "dependency": [
10
+ {
11
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `3.44.0`"
12
+ },
13
+ {
14
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.42.4`"
15
+ },
16
+ {
17
+ "comment": "Updating dependency \"@rushstack/heft-node-rig\" to `1.2.33`"
18
+ },
19
+ {
20
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `3.44.0`"
21
+ }
22
+ ]
23
+ }
24
+ },
25
+ {
26
+ "version": "3.1.2",
27
+ "tag": "@rushstack/package-deps-hash_v3.1.2",
28
+ "date": "Tue, 30 Nov 2021 20:18:41 GMT",
29
+ "comments": {
30
+ "dependency": [
31
+ {
32
+ "comment": "Updating dependency \"@rushstack/heft-node-rig\" to `1.2.32`"
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ {
38
+ "version": "3.1.1",
39
+ "tag": "@rushstack/package-deps-hash_v3.1.1",
40
+ "date": "Mon, 29 Nov 2021 07:26:16 GMT",
41
+ "comments": {
42
+ "dependency": [
43
+ {
44
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.42.3`"
45
+ },
46
+ {
47
+ "comment": "Updating dependency \"@rushstack/heft-node-rig\" to `1.2.31`"
48
+ }
49
+ ]
50
+ }
51
+ },
52
+ {
53
+ "version": "3.1.0",
54
+ "tag": "@rushstack/package-deps-hash_v3.1.0",
55
+ "date": "Sat, 06 Nov 2021 00:09:13 GMT",
56
+ "comments": {
57
+ "minor": [
58
+ {
59
+ "comment": "Added repo-level state extraction and change listing functions to support having rush.json in a subfolder of the repository."
60
+ }
61
+ ],
62
+ "dependency": [
63
+ {
64
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `3.43.2`"
65
+ },
66
+ {
67
+ "comment": "Updating dependency \"@rushstack/heft\" to `0.42.2`"
68
+ },
69
+ {
70
+ "comment": "Updating dependency \"@rushstack/heft-node-rig\" to `1.2.30`"
71
+ },
72
+ {
73
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `3.43.2`"
74
+ }
75
+ ]
76
+ }
77
+ },
4
78
  {
5
79
  "version": "3.0.86",
6
80
  "tag": "@rushstack/package-deps-hash_v3.0.86",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,28 @@
1
1
  # Change Log - @rushstack/package-deps-hash
2
2
 
3
- This log was last generated on Fri, 05 Nov 2021 15:09:18 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 03 Dec 2021 03:05:22 GMT and should not be manually modified.
4
+
5
+ ## 3.1.3
6
+ Fri, 03 Dec 2021 03:05:22 GMT
7
+
8
+ _Version update only_
9
+
10
+ ## 3.1.2
11
+ Tue, 30 Nov 2021 20:18:41 GMT
12
+
13
+ _Version update only_
14
+
15
+ ## 3.1.1
16
+ Mon, 29 Nov 2021 07:26:16 GMT
17
+
18
+ _Version update only_
19
+
20
+ ## 3.1.0
21
+ Sat, 06 Nov 2021 00:09:13 GMT
22
+
23
+ ### Minor changes
24
+
25
+ - Added repo-level state extraction and change listing functions to support having rush.json in a subfolder of the repository.
4
26
 
5
27
  ## 3.0.86
6
28
  Fri, 05 Nov 2021 15:09:18 GMT
@@ -29,4 +29,44 @@ export declare function getGitHashForFiles(filesToHash: string[], packagePath: s
29
29
  */
30
30
  export declare function getPackageDeps(packagePath?: string, excludedPaths?: string[], gitPath?: string): Map<string, string>;
31
31
 
32
+ /**
33
+ * Find all changed files tracked by Git, their current hashes, and the nature of the change. Only useful if all changes are staged or committed.
34
+ * @param currentWorkingDirectory - The working directory. Only used to find the repository root.
35
+ * @param revision - The Git revision specifier to detect changes relative to. Defaults to HEAD (i.e. will compare staged vs. committed)
36
+ * @param gitPath - The path to the Git executable
37
+ * @returns A map from the Git file path to the corresponding file change metadata
38
+ * @beta
39
+ */
40
+ export declare function getRepoChanges(currentWorkingDirectory: string, revision?: string, gitPath?: string): Map<string, IFileDiffStatus>;
41
+
42
+ /**
43
+ * Finds the root of the current Git repository
44
+ *
45
+ * @param currentWorkingDirectory - The working directory for which to locate the repository
46
+ * @param gitPath - The path to the Git executable
47
+ *
48
+ * @returns The full path to the root directory of the Git repository
49
+ * @beta
50
+ */
51
+ export declare function getRepoRoot(currentWorkingDirectory: string, gitPath?: string): string;
52
+
53
+ /**
54
+ * Gets the object hashes for all files in the Git repo, combining the current commit with working tree state.
55
+ * @param currentWorkingDirectory - The working directory. Only used to find the repository root.
56
+ * @param gitPath - The path to the Git executable
57
+ * @beta
58
+ */
59
+ export declare function getRepoState(currentWorkingDirectory: string, gitPath?: string): Map<string, string>;
60
+
61
+ /**
62
+ * Information about the changes to a file.
63
+ * @beta
64
+ */
65
+ export declare interface IFileDiffStatus {
66
+ mode: string;
67
+ oldhash: string;
68
+ newhash: string;
69
+ status: 'A' | 'D' | 'M';
70
+ }
71
+
32
72
  export { }
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.18.17"
8
+ "packageVersion": "7.18.19"
9
9
  }
10
10
  ]
11
11
  }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Parses the output of the "git ls-tree -r -z" command
3
+ * @internal
4
+ */
5
+ export declare function parseGitLsTree(output: string): Map<string, string>;
6
+ /**
7
+ * Information about the changes to a file.
8
+ * @beta
9
+ */
10
+ export interface IFileDiffStatus {
11
+ mode: string;
12
+ oldhash: string;
13
+ newhash: string;
14
+ status: 'A' | 'D' | 'M';
15
+ }
16
+ /**
17
+ * Parses the output of `git diff-index --color=never --no-renames --no-commit-id -z <REVISION> --
18
+ * Returns a map of file path to diff
19
+ * @internal
20
+ */
21
+ export declare function parseGitDiffIndex(output: string): Map<string, IFileDiffStatus>;
22
+ /**
23
+ * Parses the output of `git status -z -u`
24
+ *
25
+ * @param output - The raw output from Git
26
+ * @returns a map of file path to if it exists
27
+ * @internal
28
+ */
29
+ export declare function parseGitStatus(output: string): Map<string, boolean>;
30
+ /**
31
+ * Finds the root of the current Git repository
32
+ *
33
+ * @param currentWorkingDirectory - The working directory for which to locate the repository
34
+ * @param gitPath - The path to the Git executable
35
+ *
36
+ * @returns The full path to the root directory of the Git repository
37
+ * @beta
38
+ */
39
+ export declare function getRepoRoot(currentWorkingDirectory: string, gitPath?: string): string;
40
+ /**
41
+ * Augments the state value with modifications that are not in the index.
42
+ * @param rootDirectory - The root directory of the Git repository
43
+ * @param state - The current map of git path -> object hash. Will be mutated.
44
+ * @param gitPath - The path to the Git executable
45
+ * @internal
46
+ */
47
+ export declare function applyWorkingTreeState(rootDirectory: string, state: Map<string, string>, gitPath?: string): void;
48
+ /**
49
+ * Gets the object hashes for all files in the Git repo, combining the current commit with working tree state.
50
+ * @param currentWorkingDirectory - The working directory. Only used to find the repository root.
51
+ * @param gitPath - The path to the Git executable
52
+ * @beta
53
+ */
54
+ export declare function getRepoState(currentWorkingDirectory: string, gitPath?: string): Map<string, string>;
55
+ /**
56
+ * Find all changed files tracked by Git, their current hashes, and the nature of the change. Only useful if all changes are staged or committed.
57
+ * @param currentWorkingDirectory - The working directory. Only used to find the repository root.
58
+ * @param revision - The Git revision specifier to detect changes relative to. Defaults to HEAD (i.e. will compare staged vs. committed)
59
+ * @param gitPath - The path to the Git executable
60
+ * @returns A map from the Git file path to the corresponding file change metadata
61
+ * @beta
62
+ */
63
+ export declare function getRepoChanges(currentWorkingDirectory: string, revision?: string, gitPath?: string): Map<string, IFileDiffStatus>;
64
+ //# sourceMappingURL=getRepoState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRepoState.d.ts","sourceRoot":"","sources":["../src/getRepoState.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CA0BlE;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAoC9E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAyBnE;AAID;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,uBAAuB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAmBrF;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1B,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAyDN;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,uBAAuB,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBnG;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,GAAE,MAAe,EACzB,OAAO,CAAC,EAAE,MAAM,GACf,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CA4B9B"}
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getRepoChanges = exports.getRepoState = exports.applyWorkingTreeState = exports.getRepoRoot = exports.parseGitStatus = exports.parseGitDiffIndex = exports.parseGitLsTree = void 0;
6
+ const node_core_library_1 = require("@rushstack/node-core-library");
7
+ /**
8
+ * Parses the output of the "git ls-tree -r -z" command
9
+ * @internal
10
+ */
11
+ function parseGitLsTree(output) {
12
+ const result = new Map();
13
+ // Parse the output
14
+ // With the -z modifier, paths are delimited by nulls
15
+ // A line looks like:
16
+ // <mode> <type> <newhash>\t<path>\0
17
+ // 100644 blob a300ccb0b36bd2c85ef18e3c619a2c747f95959e\ttools/prettier-git/prettier-git.js\0
18
+ let last = 0;
19
+ let index = output.indexOf('\0', last);
20
+ while (index >= 0) {
21
+ const item = output.slice(last, index);
22
+ const tabIndex = item.indexOf('\t');
23
+ const filePath = item.slice(tabIndex + 1);
24
+ // The newHash will be all zeros if the file is deleted, or a hash if it exists
25
+ const hash = item.slice(tabIndex - 40, tabIndex);
26
+ result.set(filePath, hash);
27
+ last = index + 1;
28
+ index = output.indexOf('\0', last);
29
+ }
30
+ return result;
31
+ }
32
+ exports.parseGitLsTree = parseGitLsTree;
33
+ /**
34
+ * Parses the output of `git diff-index --color=never --no-renames --no-commit-id -z <REVISION> --
35
+ * Returns a map of file path to diff
36
+ * @internal
37
+ */
38
+ function parseGitDiffIndex(output) {
39
+ const result = new Map();
40
+ // Parse the output
41
+ // With the -z modifier, paths are delimited by nulls
42
+ // A line looks like:
43
+ // :<oldmode> <newmode> <oldhash> <newhash> <status>\0<path>\0
44
+ // :100644 100644 a300ccb0b36bd2c85ef18e3c619a2c747f95959e 0000000000000000000000000000000000000000 M\0tools/prettier-git/prettier-git.js\0
45
+ let last = 0;
46
+ let index = output.indexOf('\0', last);
47
+ while (index >= 0) {
48
+ const header = output.slice(last, index);
49
+ const status = header.slice(-1);
50
+ last = index + 1;
51
+ index = output.indexOf('\0', last);
52
+ const filePath = output.slice(last, index);
53
+ // We passed --no-renames above, so a rename will be a delete of the old location and an add at the new.
54
+ // The newHash will be all zeros if the file is deleted, or a hash if it exists
55
+ const mode = header.slice(8, 14);
56
+ const oldhash = header.slice(-83, -43);
57
+ const newhash = header.slice(-42, -2);
58
+ result.set(filePath, {
59
+ mode,
60
+ oldhash,
61
+ newhash,
62
+ status
63
+ });
64
+ last = index + 1;
65
+ index = output.indexOf('\0', last);
66
+ }
67
+ return result;
68
+ }
69
+ exports.parseGitDiffIndex = parseGitDiffIndex;
70
+ /**
71
+ * Parses the output of `git status -z -u`
72
+ *
73
+ * @param output - The raw output from Git
74
+ * @returns a map of file path to if it exists
75
+ * @internal
76
+ */
77
+ function parseGitStatus(output) {
78
+ const result = new Map();
79
+ // Parse the output
80
+ // With the -z modifier, paths are delimited by nulls
81
+ // A line looks like:
82
+ // XY <path>\0
83
+ // M tools/prettier-git/prettier-git.js\0
84
+ let last = 0;
85
+ let index = output.indexOf('\0', last);
86
+ while (index >= 0) {
87
+ // We passed --no-renames above, so a rename will be a delete of the old location and an add at the new.
88
+ const workingTreeStatus = output.charAt(last + 2);
89
+ const exists = workingTreeStatus !== 'D' && (workingTreeStatus !== ' ' || output.charAt(last + 1) !== 'D');
90
+ const filePath = output.slice(last + 3, index);
91
+ result.set(filePath, exists);
92
+ last = index + 1;
93
+ index = output.indexOf('\0', last);
94
+ }
95
+ return result;
96
+ }
97
+ exports.parseGitStatus = parseGitStatus;
98
+ const repoRootCache = new Map();
99
+ /**
100
+ * Finds the root of the current Git repository
101
+ *
102
+ * @param currentWorkingDirectory - The working directory for which to locate the repository
103
+ * @param gitPath - The path to the Git executable
104
+ *
105
+ * @returns The full path to the root directory of the Git repository
106
+ * @beta
107
+ */
108
+ function getRepoRoot(currentWorkingDirectory, gitPath) {
109
+ let cachedResult = repoRootCache.get(currentWorkingDirectory);
110
+ if (!cachedResult) {
111
+ const result = node_core_library_1.Executable.spawnSync(gitPath || 'git', ['--no-optional-locks', 'rev-parse', '--show-toplevel'], {
112
+ currentWorkingDirectory
113
+ });
114
+ if (result.status !== 0) {
115
+ throw new Error(`git rev-parse exited with status ${result.status}: ${result.stderr}`);
116
+ }
117
+ repoRootCache.set(currentWorkingDirectory, (cachedResult = result.stdout.trim()));
118
+ }
119
+ return cachedResult;
120
+ }
121
+ exports.getRepoRoot = getRepoRoot;
122
+ /**
123
+ * Augments the state value with modifications that are not in the index.
124
+ * @param rootDirectory - The root directory of the Git repository
125
+ * @param state - The current map of git path -> object hash. Will be mutated.
126
+ * @param gitPath - The path to the Git executable
127
+ * @internal
128
+ */
129
+ function applyWorkingTreeState(rootDirectory, state, gitPath) {
130
+ const statusResult = node_core_library_1.Executable.spawnSync(gitPath || 'git', ['--no-optional-locks', 'status', '-z', '-u', '--no-renames', '--'], {
131
+ currentWorkingDirectory: rootDirectory
132
+ });
133
+ if (statusResult.status !== 0) {
134
+ throw new Error(`git status exited with status ${statusResult.status}: ${statusResult.stderr}`);
135
+ }
136
+ const locallyModified = parseGitStatus(statusResult.stdout);
137
+ const filesToHash = [];
138
+ for (const [filePath, exists] of locallyModified) {
139
+ if (exists) {
140
+ filesToHash.push(filePath);
141
+ }
142
+ else {
143
+ state.delete(filePath);
144
+ }
145
+ }
146
+ if (filesToHash.length) {
147
+ // Use --stdin-paths arg to pass the list of files to git in order to avoid issues with
148
+ // command length
149
+ const hashObjectResult = node_core_library_1.Executable.spawnSync(gitPath || 'git', ['hash-object', '--stdin-paths'], { input: filesToHash.join('\n') });
150
+ if (hashObjectResult.status !== 0) {
151
+ throw new Error(`git hash-object exited with status ${hashObjectResult.status}: ${hashObjectResult.stderr}`);
152
+ }
153
+ const hashStdout = hashObjectResult.stdout.trim();
154
+ // The result of "git hash-object" will be a list of file hashes delimited by newlines
155
+ const hashes = hashStdout.split('\n');
156
+ if (hashes.length !== filesToHash.length) {
157
+ throw new Error(`Passed ${filesToHash.length} file paths to Git to hash, but received ${hashes.length} hashes.`);
158
+ }
159
+ const len = hashes.length;
160
+ for (let i = 0; i < len; i++) {
161
+ const hash = hashes[i];
162
+ const filePath = filesToHash[i];
163
+ state.set(filePath, hash);
164
+ }
165
+ }
166
+ }
167
+ exports.applyWorkingTreeState = applyWorkingTreeState;
168
+ /**
169
+ * Gets the object hashes for all files in the Git repo, combining the current commit with working tree state.
170
+ * @param currentWorkingDirectory - The working directory. Only used to find the repository root.
171
+ * @param gitPath - The path to the Git executable
172
+ * @beta
173
+ */
174
+ function getRepoState(currentWorkingDirectory, gitPath) {
175
+ const rootDirectory = getRepoRoot(currentWorkingDirectory, gitPath);
176
+ const lsTreeResult = node_core_library_1.Executable.spawnSync(gitPath || 'git', ['--no-optional-locks', 'ls-tree', '-r', '-z', '--full-name', 'HEAD', '--'], {
177
+ currentWorkingDirectory: rootDirectory
178
+ });
179
+ if (lsTreeResult.status !== 0) {
180
+ throw new Error(`git ls-tree exited with status ${lsTreeResult.status}: ${lsTreeResult.stderr}`);
181
+ }
182
+ const state = parseGitLsTree(lsTreeResult.stdout);
183
+ applyWorkingTreeState(rootDirectory, state, gitPath);
184
+ return state;
185
+ }
186
+ exports.getRepoState = getRepoState;
187
+ /**
188
+ * Find all changed files tracked by Git, their current hashes, and the nature of the change. Only useful if all changes are staged or committed.
189
+ * @param currentWorkingDirectory - The working directory. Only used to find the repository root.
190
+ * @param revision - The Git revision specifier to detect changes relative to. Defaults to HEAD (i.e. will compare staged vs. committed)
191
+ * @param gitPath - The path to the Git executable
192
+ * @returns A map from the Git file path to the corresponding file change metadata
193
+ * @beta
194
+ */
195
+ function getRepoChanges(currentWorkingDirectory, revision = 'HEAD', gitPath) {
196
+ const rootDirectory = getRepoRoot(currentWorkingDirectory, gitPath);
197
+ const result = node_core_library_1.Executable.spawnSync(gitPath || 'git', [
198
+ '--no-optional-locks',
199
+ 'diff-index',
200
+ '--color=never',
201
+ '--no-renames',
202
+ '--no-commit-id',
203
+ '--cached',
204
+ '-z',
205
+ revision,
206
+ '--'
207
+ ], {
208
+ currentWorkingDirectory: rootDirectory
209
+ });
210
+ if (result.status !== 0) {
211
+ throw new Error(`git diff-index exited with status ${result.status}: ${result.stderr}`);
212
+ }
213
+ const changes = parseGitDiffIndex(result.stdout);
214
+ return changes;
215
+ }
216
+ exports.getRepoChanges = getRepoChanges;
217
+ //# sourceMappingURL=getRepoState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRepoState.js","sourceRoot":"","sources":["../src/getRepoState.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,oEAA0D;AAE1D;;;GAGG;AACH,SAAgB,cAAc,CAAC,MAAc;IAC3C,MAAM,MAAM,GAAwB,IAAI,GAAG,EAAE,CAAC;IAE9C,mBAAmB;IACnB,qDAAqD;IACrD,qBAAqB;IACrB,oCAAoC;IACpC,6FAA6F;IAE7F,IAAI,IAAI,GAAW,CAAC,CAAC;IACrB,IAAI,KAAK,GAAW,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC/C,OAAO,KAAK,IAAI,CAAC,EAAE;QACjB,MAAM,IAAI,GAAW,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAE/C,MAAM,QAAQ,GAAW,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAW,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;QAElD,+EAA+E;QAC/E,MAAM,IAAI,GAAW,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;QACzD,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAE3B,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC;QACjB,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;KACpC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AA1BD,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a,EAAE,MAAM,EAAE,IAAI,CAAC,EAC3E;QACE,uBAAuB,EAAE,aAAa;KACvC,CACF,CAAC;IAEF,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,kCAAkC,YAAY,CAAC,MAAM,KAAK,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;KAClG;IAED,MAAM,KAAK,GAAwB,cAAc,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAEvE,qBAAqB,CAAC,aAAa,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAErD,OAAO,KAAK,CAAC;AACf,CAAC;AApBD,oCAoBC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,uBAA+B,EAC/B,WAAmB,MAAM,EACzB,OAAgB;IAEhB,MAAM,aAAa,GAAW,WAAW,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAE5E,MAAM,MAAM,GAA2C,8BAAU,CAAC,SAAS,CACzE,OAAO,IAAI,KAAK,EAChB;QACE,qBAAqB;QACrB,YAAY;QACZ,eAAe;QACf,cAAc;QACd,gBAAgB;QAChB,UAAU;QACV,IAAI;QACJ,QAAQ;QACR,IAAI;KACL,EACD;QACE,uBAAuB,EAAE,aAAa;KACvC,CACF,CAAC;IAEF,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,qCAAqC,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;KACzF;IAED,MAAM,OAAO,GAAiC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAE/E,OAAO,OAAO,CAAC;AACjB,CAAC;AAhCD,wCAgCC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport type * as child_process from 'child_process';\r\nimport { Executable } from '@rushstack/node-core-library';\r\n\r\n/**\r\n * Parses the output of the \"git ls-tree -r -z\" command\r\n * @internal\r\n */\r\nexport function parseGitLsTree(output: string): Map<string, string> {\r\n const result: Map<string, string> = new Map();\r\n\r\n // Parse the output\r\n // With the -z modifier, paths are delimited by nulls\r\n // A line looks like:\r\n // <mode> <type> <newhash>\\t<path>\\0\r\n // 100644 blob a300ccb0b36bd2c85ef18e3c619a2c747f95959e\\ttools/prettier-git/prettier-git.js\\0\r\n\r\n let last: number = 0;\r\n let index: number = output.indexOf('\\0', last);\r\n while (index >= 0) {\r\n const item: string = output.slice(last, index);\r\n\r\n const tabIndex: number = item.indexOf('\\t');\r\n const filePath: string = item.slice(tabIndex + 1);\r\n\r\n // The newHash will be all zeros if the file is deleted, or a hash if it exists\r\n const hash: string = item.slice(tabIndex - 40, tabIndex);\r\n result.set(filePath, hash);\r\n\r\n last = index + 1;\r\n index = output.indexOf('\\0', last);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Information about the changes to a file.\r\n * @beta\r\n */\r\nexport interface IFileDiffStatus {\r\n mode: string;\r\n oldhash: string;\r\n newhash: string;\r\n status: 'A' | 'D' | 'M';\r\n}\r\n\r\n/**\r\n * Parses the output of `git diff-index --color=never --no-renames --no-commit-id -z <REVISION> --\r\n * Returns a map of file path to diff\r\n * @internal\r\n */\r\nexport function parseGitDiffIndex(output: string): Map<string, IFileDiffStatus> {\r\n const result: Map<string, IFileDiffStatus> = new Map();\r\n\r\n // Parse the output\r\n // With the -z modifier, paths are delimited by nulls\r\n // A line looks like:\r\n // :<oldmode> <newmode> <oldhash> <newhash> <status>\\0<path>\\0\r\n // :100644 100644 a300ccb0b36bd2c85ef18e3c619a2c747f95959e 0000000000000000000000000000000000000000 M\\0tools/prettier-git/prettier-git.js\\0\r\n\r\n let last: number = 0;\r\n let index: number = output.indexOf('\\0', last);\r\n while (index >= 0) {\r\n const header: string = output.slice(last, index);\r\n const status: IFileDiffStatus['status'] = header.slice(-1) as IFileDiffStatus['status'];\r\n\r\n last = index + 1;\r\n index = output.indexOf('\\0', last);\r\n const filePath: string = output.slice(last, index);\r\n\r\n // We passed --no-renames above, so a rename will be a delete of the old location and an add at the new.\r\n // The newHash will be all zeros if the file is deleted, or a hash if it exists\r\n const mode: string = header.slice(8, 14);\r\n const oldhash: string = header.slice(-83, -43);\r\n const newhash: string = header.slice(-42, -2);\r\n result.set(filePath, {\r\n mode,\r\n oldhash,\r\n newhash,\r\n status\r\n });\r\n\r\n last = index + 1;\r\n index = output.indexOf('\\0', last);\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Parses the output of `git status -z -u`\r\n *\r\n * @param output - The raw output from Git\r\n * @returns a map of file path to if it exists\r\n * @internal\r\n */\r\nexport function parseGitStatus(output: string): Map<string, boolean> {\r\n const result: Map<string, boolean> = new Map();\r\n\r\n // Parse the output\r\n // With the -z modifier, paths are delimited by nulls\r\n // A line looks like:\r\n // XY <path>\\0\r\n // M tools/prettier-git/prettier-git.js\\0\r\n\r\n let last: number = 0;\r\n let index: number = output.indexOf('\\0', last);\r\n while (index >= 0) {\r\n // We passed --no-renames above, so a rename will be a delete of the old location and an add at the new.\r\n const workingTreeStatus: string = output.charAt(last + 2);\r\n const exists: boolean =\r\n workingTreeStatus !== 'D' && (workingTreeStatus !== ' ' || output.charAt(last + 1) !== 'D');\r\n const filePath: string = output.slice(last + 3, index);\r\n\r\n result.set(filePath, exists);\r\n\r\n last = index + 1;\r\n index = output.indexOf('\\0', last);\r\n }\r\n\r\n return result;\r\n}\r\n\r\nconst repoRootCache: Map<string, string> = new Map();\r\n\r\n/**\r\n * Finds the root of the current Git repository\r\n *\r\n * @param currentWorkingDirectory - The working directory for which to locate the repository\r\n * @param gitPath - The path to the Git executable\r\n *\r\n * @returns The full path to the root directory of the Git repository\r\n * @beta\r\n */\r\nexport function getRepoRoot(currentWorkingDirectory: string, gitPath?: string): string {\r\n let cachedResult: string | undefined = repoRootCache.get(currentWorkingDirectory);\r\n if (!cachedResult) {\r\n const result: child_process.SpawnSyncReturns<string> = Executable.spawnSync(\r\n gitPath || 'git',\r\n ['--no-optional-locks', 'rev-parse', '--show-toplevel'],\r\n {\r\n currentWorkingDirectory\r\n }\r\n );\r\n\r\n if (result.status !== 0) {\r\n throw new Error(`git rev-parse exited with status ${result.status}: ${result.stderr}`);\r\n }\r\n\r\n repoRootCache.set(currentWorkingDirectory, (cachedResult = result.stdout.trim()));\r\n }\r\n\r\n return cachedResult;\r\n}\r\n\r\n/**\r\n * Augments the state value with modifications that are not in the index.\r\n * @param rootDirectory - The root directory of the Git repository\r\n * @param state - The current map of git path -> object hash. Will be mutated.\r\n * @param gitPath - The path to the Git executable\r\n * @internal\r\n */\r\nexport function applyWorkingTreeState(\r\n rootDirectory: string,\r\n state: Map<string, string>,\r\n gitPath?: string\r\n): void {\r\n const statusResult: child_process.SpawnSyncReturns<string> = Executable.spawnSync(\r\n gitPath || 'git',\r\n ['--no-optional-locks', 'status', '-z', '-u', '--no-renames', '--'],\r\n {\r\n currentWorkingDirectory: rootDirectory\r\n }\r\n );\r\n\r\n if (statusResult.status !== 0) {\r\n throw new Error(`git status exited with status ${statusResult.status}: ${statusResult.stderr}`);\r\n }\r\n\r\n const locallyModified: Map<string, boolean> = parseGitStatus(statusResult.stdout);\r\n\r\n const filesToHash: string[] = [];\r\n for (const [filePath, exists] of locallyModified) {\r\n if (exists) {\r\n filesToHash.push(filePath);\r\n } else {\r\n state.delete(filePath);\r\n }\r\n }\r\n\r\n if (filesToHash.length) {\r\n // Use --stdin-paths arg to pass the list of files to git in order to avoid issues with\r\n // command length\r\n const hashObjectResult: child_process.SpawnSyncReturns<string> = Executable.spawnSync(\r\n gitPath || 'git',\r\n ['hash-object', '--stdin-paths'],\r\n { input: filesToHash.join('\\n') }\r\n );\r\n\r\n if (hashObjectResult.status !== 0) {\r\n throw new Error(\r\n `git hash-object exited with status ${hashObjectResult.status}: ${hashObjectResult.stderr}`\r\n );\r\n }\r\n\r\n const hashStdout: string = hashObjectResult.stdout.trim();\r\n\r\n // The result of \"git hash-object\" will be a list of file hashes delimited by newlines\r\n const hashes: string[] = hashStdout.split('\\n');\r\n\r\n if (hashes.length !== filesToHash.length) {\r\n throw new Error(\r\n `Passed ${filesToHash.length} file paths to Git to hash, but received ${hashes.length} hashes.`\r\n );\r\n }\r\n\r\n const len: number = hashes.length;\r\n for (let i: number = 0; i < len; i++) {\r\n const hash: string = hashes[i];\r\n const filePath: string = filesToHash[i];\r\n state.set(filePath, hash);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Gets the object hashes for all files in the Git repo, combining the current commit with working tree state.\r\n * @param currentWorkingDirectory - The working directory. Only used to find the repository root.\r\n * @param gitPath - The path to the Git executable\r\n * @beta\r\n */\r\nexport function getRepoState(currentWorkingDirectory: string, gitPath?: string): Map<string, string> {\r\n const rootDirectory: string = getRepoRoot(currentWorkingDirectory, gitPath);\r\n\r\n const lsTreeResult: child_process.SpawnSyncReturns<string> = Executable.spawnSync(\r\n gitPath || 'git',\r\n ['--no-optional-locks', 'ls-tree', '-r', '-z', '--full-name', 'HEAD', '--'],\r\n {\r\n currentWorkingDirectory: rootDirectory\r\n }\r\n );\r\n\r\n if (lsTreeResult.status !== 0) {\r\n throw new Error(`git ls-tree exited with status ${lsTreeResult.status}: ${lsTreeResult.stderr}`);\r\n }\r\n\r\n const state: Map<string, string> = parseGitLsTree(lsTreeResult.stdout);\r\n\r\n applyWorkingTreeState(rootDirectory, state, gitPath);\r\n\r\n return state;\r\n}\r\n\r\n/**\r\n * Find all changed files tracked by Git, their current hashes, and the nature of the change. Only useful if all changes are staged or committed.\r\n * @param currentWorkingDirectory - The working directory. Only used to find the repository root.\r\n * @param revision - The Git revision specifier to detect changes relative to. Defaults to HEAD (i.e. will compare staged vs. committed)\r\n * @param gitPath - The path to the Git executable\r\n * @returns A map from the Git file path to the corresponding file change metadata\r\n * @beta\r\n */\r\nexport function getRepoChanges(\r\n currentWorkingDirectory: string,\r\n revision: string = 'HEAD',\r\n gitPath?: string\r\n): Map<string, IFileDiffStatus> {\r\n const rootDirectory: string = getRepoRoot(currentWorkingDirectory, gitPath);\r\n\r\n const result: child_process.SpawnSyncReturns<string> = Executable.spawnSync(\r\n gitPath || 'git',\r\n [\r\n '--no-optional-locks',\r\n 'diff-index',\r\n '--color=never',\r\n '--no-renames',\r\n '--no-commit-id',\r\n '--cached',\r\n '-z',\r\n revision,\r\n '--'\r\n ],\r\n {\r\n currentWorkingDirectory: rootDirectory\r\n }\r\n );\r\n\r\n if (result.status !== 0) {\r\n throw new Error(`git diff-index exited with status ${result.status}: ${result.stderr}`);\r\n }\r\n\r\n const changes: Map<string, IFileDiffStatus> = parseGitDiffIndex(result.stdout);\r\n\r\n return changes;\r\n}\r\n"]}
package/lib/index.d.ts CHANGED
@@ -10,4 +10,6 @@
10
10
  * @packageDocumentation
11
11
  */
12
12
  export { getPackageDeps, getGitHashForFiles } from './getPackageDeps';
13
+ export { getRepoChanges, getRepoRoot, getRepoState } from './getRepoState';
14
+ export { IFileDiffStatus } from './getRepoState';
13
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.getGitHashForFiles = exports.getPackageDeps = void 0;
5
+ exports.getRepoState = exports.getRepoRoot = exports.getRepoChanges = exports.getGitHashForFiles = exports.getPackageDeps = void 0;
6
6
  /**
7
7
  * This package builds a JSON object containing the git hashes of all files used to produce a given NPM package.
8
8
  * The {@link https://rushjs.io/ | Rush} tool uses this library to implement incremental build detection.
@@ -17,4 +17,8 @@ exports.getGitHashForFiles = exports.getPackageDeps = void 0;
17
17
  var getPackageDeps_1 = require("./getPackageDeps");
18
18
  Object.defineProperty(exports, "getPackageDeps", { enumerable: true, get: function () { return getPackageDeps_1.getPackageDeps; } });
19
19
  Object.defineProperty(exports, "getGitHashForFiles", { enumerable: true, get: function () { return getPackageDeps_1.getGitHashForFiles; } });
20
+ var getRepoState_1 = require("./getRepoState");
21
+ Object.defineProperty(exports, "getRepoChanges", { enumerable: true, get: function () { return getRepoState_1.getRepoChanges; } });
22
+ Object.defineProperty(exports, "getRepoRoot", { enumerable: true, get: function () { return getRepoState_1.getRepoRoot; } });
23
+ Object.defineProperty(exports, "getRepoState", { enumerable: true, get: function () { return getRepoState_1.getRepoState; } });
20
24
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;;;;GAUG;AAEH,mDAAsE;AAA7D,gHAAA,cAAc,OAAA;AAAE,oHAAA,kBAAkB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\n/**\r\n * This package builds a JSON object containing the git hashes of all files used to produce a given NPM package.\r\n * The {@link https://rushjs.io/ | Rush} tool uses this library to implement incremental build detection.\r\n *\r\n * @remarks\r\n *\r\n * For more info, please see the package {@link https://www.npmjs.com/package/@rushstack/package-deps-hash\r\n * | README}.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nexport { getPackageDeps, getGitHashForFiles } from './getPackageDeps';\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;;;;GAUG;AAEH,mDAAsE;AAA7D,gHAAA,cAAc,OAAA;AAAE,oHAAA,kBAAkB,OAAA;AAC3C,+CAA2E;AAAlE,8GAAA,cAAc,OAAA;AAAE,2GAAA,WAAW,OAAA;AAAE,4GAAA,YAAY,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\r\n// See LICENSE in the project root for license information.\r\n\r\n/**\r\n * This package builds a JSON object containing the git hashes of all files used to produce a given NPM package.\r\n * The {@link https://rushjs.io/ | Rush} tool uses this library to implement incremental build detection.\r\n *\r\n * @remarks\r\n *\r\n * For more info, please see the package {@link https://www.npmjs.com/package/@rushstack/package-deps-hash\r\n * | README}.\r\n *\r\n * @packageDocumentation\r\n */\r\n\r\nexport { getPackageDeps, getGitHashForFiles } from './getPackageDeps';\r\nexport { getRepoChanges, getRepoRoot, getRepoState } from './getRepoState';\r\nexport { IFileDiffStatus } from './getRepoState';\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/package-deps-hash",
3
- "version": "3.0.86",
3
+ "version": "3.1.3",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "dist/package-deps-hash.d.ts",
@@ -12,14 +12,14 @@
12
12
  },
13
13
  "devDependencies": {
14
14
  "@rushstack/eslint-config": "2.4.5",
15
- "@rushstack/heft": "0.42.1",
16
- "@rushstack/heft-node-rig": "1.2.29",
17
- "@rushstack/node-core-library": "3.43.1",
15
+ "@rushstack/heft": "0.42.4",
16
+ "@rushstack/heft-node-rig": "1.2.33",
17
+ "@rushstack/node-core-library": "3.44.0",
18
18
  "@types/heft-jest": "1.0.1",
19
19
  "@types/node": "12.20.24"
20
20
  },
21
21
  "dependencies": {
22
- "@rushstack/node-core-library": "3.43.1"
22
+ "@rushstack/node-core-library": "3.44.0"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "heft test --clean"