@lage-run/hasher 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +31 -1
- package/CHANGELOG.md +18 -2
- package/lib/PackageTree.js +2 -1
- package/lib/TargetHasher.d.ts +3 -0
- package/lib/TargetHasher.js +7 -1
- package/package.json +2 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,37 @@
|
|
|
2
2
|
"name": "@lage-run/hasher",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 21 Jun 2023 19:05:46 GMT",
|
|
6
|
+
"tag": "@lage-run/hasher_v1.0.2",
|
|
7
|
+
"version": "1.0.2",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "brunoru@microsoft.com",
|
|
12
|
+
"package": "@lage-run/hasher",
|
|
13
|
+
"commit": "3efba30544ff1844986f469e01b47316d700ceeb",
|
|
14
|
+
"comment": "Added logging in TargetHasher, now logs hash of glob-hashed files for global input hash comparison"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Fri, 26 May 2023 01:09:04 GMT",
|
|
21
|
+
"tag": "@lage-run/hasher_v1.0.1",
|
|
22
|
+
"version": "1.0.1",
|
|
23
|
+
"comments": {
|
|
24
|
+
"patch": [
|
|
25
|
+
{
|
|
26
|
+
"author": "kchau@microsoft.com",
|
|
27
|
+
"package": "@lage-run/hasher",
|
|
28
|
+
"commit": "8cb78bef8aeb568c2da2ac62d0e0a62d3580847d",
|
|
29
|
+
"comment": "makes sure the presence of a file does not crash lage on the file hashing"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Mon, 08 May 2023 22:27:16 GMT",
|
|
6
36
|
"tag": "@lage-run/hasher_v1.0.0",
|
|
7
37
|
"version": "1.0.0",
|
|
8
38
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
# Change Log - @lage-run/hasher
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 21 Jun 2023 19:05:46 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.0.2
|
|
8
|
+
|
|
9
|
+
Wed, 21 Jun 2023 19:05:46 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Added logging in TargetHasher, now logs hash of glob-hashed files for global input hash comparison (brunoru@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 1.0.1
|
|
16
|
+
|
|
17
|
+
Fri, 26 May 2023 01:09:04 GMT
|
|
18
|
+
|
|
19
|
+
### Patches
|
|
20
|
+
|
|
21
|
+
- makes sure the presence of a file does not crash lage on the file hashing (kchau@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 1.0.0
|
|
8
24
|
|
|
9
|
-
Mon, 08 May 2023 22:
|
|
25
|
+
Mon, 08 May 2023 22:27:16 GMT
|
|
10
26
|
|
|
11
27
|
### Major changes
|
|
12
28
|
|
package/lib/PackageTree.js
CHANGED
|
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "PackageTree", {
|
|
|
10
10
|
});
|
|
11
11
|
const _execa = /*#__PURE__*/ _interop_require_default(require("execa"));
|
|
12
12
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
13
14
|
const _micromatch = /*#__PURE__*/ _interop_require_default(require("micromatch"));
|
|
14
15
|
function _check_private_redeclaration(obj, privateCollection) {
|
|
15
16
|
if (privateCollection.has(obj)) {
|
|
@@ -97,7 +98,7 @@ class PackageTree {
|
|
|
97
98
|
cwd: root
|
|
98
99
|
});
|
|
99
100
|
if (lsFilesResults.exitCode === 0) {
|
|
100
|
-
const files = lsFilesResults.stdout.split("\0").filter(Boolean);
|
|
101
|
+
const files = lsFilesResults.stdout.split("\0").filter((f)=>Boolean(f) && _fs.default.existsSync(_path.default.join(root, f)));
|
|
101
102
|
this.addToPackageTree(files);
|
|
102
103
|
}
|
|
103
104
|
if (includeUntracked) {
|
package/lib/TargetHasher.d.ts
CHANGED
|
@@ -2,12 +2,14 @@ import type { Target } from "@lage-run/target-graph";
|
|
|
2
2
|
import { type ParsedLock, type WorkspaceInfo, type PackageInfos } from "workspace-tools";
|
|
3
3
|
import type { DependencyMap } from "workspace-tools/lib/graph/createDependencyMap.js";
|
|
4
4
|
import { FileHasher } from "./FileHasher.js";
|
|
5
|
+
import type { Logger } from "@lage-run/logger";
|
|
5
6
|
import { PackageTree } from "./PackageTree.js";
|
|
6
7
|
export interface TargetHasherOptions {
|
|
7
8
|
root: string;
|
|
8
9
|
environmentGlob: string[];
|
|
9
10
|
cacheKey?: string;
|
|
10
11
|
cliArgs?: string[];
|
|
12
|
+
logger?: Logger;
|
|
11
13
|
}
|
|
12
14
|
export interface TargetManifest {
|
|
13
15
|
id: string;
|
|
@@ -28,6 +30,7 @@ export interface TargetManifest {
|
|
|
28
30
|
*/
|
|
29
31
|
export declare class TargetHasher {
|
|
30
32
|
private options;
|
|
33
|
+
logger: Logger | undefined;
|
|
31
34
|
fileHasher: FileHasher;
|
|
32
35
|
packageTree: PackageTree | undefined;
|
|
33
36
|
initializedPromise: Promise<unknown> | undefined;
|
package/lib/TargetHasher.js
CHANGED
|
@@ -130,6 +130,10 @@ class TargetHasher {
|
|
|
130
130
|
(0, _workspacetools.parseLockFile)(root).then((lockInfo)=>this.lockInfo = lockInfo)
|
|
131
131
|
]);
|
|
132
132
|
await this.initializedPromise;
|
|
133
|
+
if (this.logger !== undefined) {
|
|
134
|
+
const globalInputsHash = (0, _hashStrings.hashStrings)(Object.values(this.globalInputsHash ?? {}));
|
|
135
|
+
this.logger.verbose(`Global inputs hash: ${globalInputsHash}`);
|
|
136
|
+
}
|
|
133
137
|
}
|
|
134
138
|
async hash(target) {
|
|
135
139
|
this.ensureInitialized();
|
|
@@ -194,6 +198,7 @@ class TargetHasher {
|
|
|
194
198
|
}
|
|
195
199
|
constructor(options){
|
|
196
200
|
_define_property(this, "options", void 0);
|
|
201
|
+
_define_property(this, "logger", void 0);
|
|
197
202
|
_define_property(this, "fileHasher", void 0);
|
|
198
203
|
_define_property(this, "packageTree", void 0);
|
|
199
204
|
_define_property(this, "initializedPromise", void 0);
|
|
@@ -210,7 +215,8 @@ class TargetHasher {
|
|
|
210
215
|
dependencies: new Map(),
|
|
211
216
|
dependents: new Map()
|
|
212
217
|
};
|
|
213
|
-
const { root } = options;
|
|
218
|
+
const { root , logger } = options;
|
|
219
|
+
this.logger = logger;
|
|
214
220
|
this.fileHasher = new _FileHasher.FileHasher({
|
|
215
221
|
root
|
|
216
222
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/hasher",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Hasher for Lage Targets",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/microsoft/lage"
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@lage-run/target-graph": "^0.8.6",
|
|
19
|
+
"@lage-run/logger": "^1.3.0",
|
|
19
20
|
"execa": "5.1.1",
|
|
20
21
|
"workspace-tools": "0.30.0",
|
|
21
22
|
"fast-glob": "3.2.12",
|