@ms-cloudpack/package-hashes 0.5.28 → 0.6.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/lib/PackageHashes.js.map +1 -1
- package/lib/getPackageHashEntries.d.ts +3 -3
- package/lib/getPackageHashEntries.d.ts.map +1 -1
- package/lib/hashVersion.d.ts +1 -1
- package/lib/hashVersion.js +1 -1
- package/lib/hashVersion.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/{HashFunctions.d.ts → HashFunction.d.ts} +1 -1
- package/lib/types/HashFunction.d.ts.map +1 -0
- package/lib/types/HashFunction.js +2 -0
- package/lib/types/HashFunction.js.map +1 -0
- package/lib/types/PackageHashOptions.d.ts +1 -1
- package/lib/types/PackageHashOptions.d.ts.map +1 -1
- package/lib/types/PackageHashOptions.js.map +1 -1
- package/package.json +4 -4
- package/lib/types/HashFunctions.d.ts.map +0 -1
- package/lib/types/HashFunctions.js +0 -2
- package/lib/types/HashFunctions.js.map +0 -1
package/lib/PackageHashes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageHashes.js","sourceRoot":"","sources":["../src/PackageHashes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;GAEG;AACH,MAAM,OAAO,aAAa;IAKxB,YAAqB,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;QAJjC,sBAAiB,GAAG,IAAI,GAAG,EAA+C,CAAC;QAC3E,wBAAmB,GAAG,IAAI,GAAG,EAA+C,CAAC;QAI5F,IAAI,MAAM,IAAI,OAAO,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;YAC1B,OAAO;QACT,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;QACnC,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC;YACtC,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,WAAW,EAAE,MAAM,CAAC,qBAAqB;SAC1C,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,EAAE,EAAE,CACrB,WAAW,CAAC;YACV,KAAK;YACL,OAAO,EAAE;gBACP,GAAG,OAAO,CAAC,OAAO;gBAClB,OAAO;aACR;SACF,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,CAAC,KAIT;QACC,MAAM,EAAE,WAAW,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;QAEzE,MAAM,GAAG,GAAG,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC;QAEvF,IAAI,CAAC,iBAAiB,IAAI,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YAC/C,OAAO,GAAG,CAAC,GAAG,CAAC,WAAW,CAAW,CAAC;QACxC,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAErC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAE3B,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["import { PackagePatchesCache } from './PackagePatchesCache.js';\nimport { hashPackage } from './hashPackage.js';\nimport type { HashFunction } from './types/
|
|
1
|
+
{"version":3,"file":"PackageHashes.js","sourceRoot":"","sources":["../src/PackageHashes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/C;;GAEG;AACH,MAAM,OAAO,a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chesCache } from './PackagePatchesCache.js';\nimport { hashPackage } from './hashPackage.js';\nimport type { HashFunction } from './types/HashFunction.js';\nimport type { PackageHashesOptions } from './types/PackageHashOptions.js';\n\n/**\n * Utility class for hashing packages and caching the results.\n */\nexport class PackageHashes {\n private readonly _hashesWithSource = new Map<string /* packagePath */, string /* hash */>();\n private readonly _hashesWithNoSource = new Map<string /* packagePath */, string /* hash */>();\n private readonly _hash: HashFunction;\n\n constructor(readonly options: PackageHashesOptions) {\n if ('hash' in options) {\n this._hash = options.hash;\n return;\n }\n\n const { config } = options.context;\n const patches = new PackagePatchesCache({\n cwd: options.cwd,\n globPattern: config.patchFilesGlobPattern,\n });\n\n this._hash = (input) =>\n hashPackage({\n input,\n context: {\n ...options.context,\n patches,\n },\n });\n }\n\n /**\n * Gets the hash for a given package path. This is useful for caching, to determine if the package has changed.\n * If the package definition has not been calculated, it will be calculated and cached.\n * @param packagePath - The package path to get the hash for.\n * @param isSourceHashingEnabled - Whether or not to hash the source files.\n * @param shouldRecalculate - Whether or not to force a re-calculation of the hash.\n * @returns The hash for the package.\n */\n async get(input: {\n packagePath: string;\n isSourceHashingEnabled: boolean;\n shouldRecalculate?: boolean;\n }): Promise<string> {\n const { packagePath, isSourceHashingEnabled, shouldRecalculate } = input;\n\n const map = isSourceHashingEnabled ? this._hashesWithSource : this._hashesWithNoSource;\n\n if (!shouldRecalculate && map.has(packagePath)) {\n return map.get(packagePath) as string;\n }\n\n const hash = await this._hash(input);\n\n map.set(packagePath, hash);\n\n return hash;\n }\n}\n"]}
|
|
@@ -23,9 +23,6 @@ export declare function getPackageHashEntries(params: {
|
|
|
23
23
|
userPackageSettings: PackageSettings | undefined;
|
|
24
24
|
generatedPackageSettings: PackageSettings | undefined;
|
|
25
25
|
};
|
|
26
|
-
/**
|
|
27
|
-
* @returns the entries that are used to calculate the hash of a package
|
|
28
|
-
*/
|
|
29
26
|
description?: string | undefined;
|
|
30
27
|
files?: string[] | undefined;
|
|
31
28
|
directories?: {
|
|
@@ -77,6 +74,9 @@ export declare function getPackageHashEntries(params: {
|
|
|
77
74
|
packages?: string[] | undefined;
|
|
78
75
|
nohoist?: string[] | undefined;
|
|
79
76
|
} | undefined;
|
|
77
|
+
cloudpack?: (Omit<PackageSettings, "match"> & {
|
|
78
|
+
mode: string | undefined;
|
|
79
|
+
}) | undefined;
|
|
80
80
|
cloudpackRemapped?: {
|
|
81
81
|
originalName: string;
|
|
82
82
|
originalVersion: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageHashEntries.d.ts","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI5G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;IACF,OAAO,EAAE;QACP,MAAM,EAAE,eAAe,CAAC;QACxB,QAAQ,EAAE,uBAAuB,CAAC;QAClC,OAAO,EAAE,cAAc,CAAC;KACzB,CAAC;CACH
|
|
1
|
+
{"version":3,"file":"getPackageHashEntries.d.ts","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI5G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;IACF,OAAO,EAAE;QACP,MAAM,EAAE,eAAe,CAAC;QACxB,QAAQ,EAAE,uBAAuB,CAAC;QAClC,OAAO,EAAE,cAAc,CAAC;KACzB,CAAC;CACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDA"}
|
package/lib/hashVersion.d.ts
CHANGED
package/lib/hashVersion.js
CHANGED
package/lib/hashVersion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashVersion.js","sourceRoot":"","sources":["../src/hashVersion.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC","sourcesContent":["/**\n * Hash version is used to invalidate the cache when the hashing algorithm changes.\n */\nexport const hashVersion =
|
|
1
|
+
{"version":3,"file":"hashVersion.js","sourceRoot":"","sources":["../src/hashVersion.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC","sourcesContent":["/**\n * Hash version is used to invalidate the cache when the hashing algorithm changes.\n */\nexport const hashVersion = 9;\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { PackageHashes } from './PackageHashes.js';
|
|
2
2
|
export type { PackageHashesOptions } from './types/PackageHashOptions.js';
|
|
3
|
-
export type { HashFunction } from './types/
|
|
3
|
+
export type { HashFunction } from './types/HashFunction.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { PackageHashes } from './PackageHashes.js';\nexport type { PackageHashesOptions } from './types/PackageHashOptions.js';\nexport type { HashFunction } from './types/
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { PackageHashes } from './PackageHashes.js';\nexport type { PackageHashesOptions } from './types/PackageHashOptions.js';\nexport type { HashFunction } from './types/HashFunction.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HashFunction.d.ts","sourceRoot":"","sources":["../../src/types/HashFunction.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,sBAAsB,EAAE,OAAO,CAAA;CAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HashFunction.js","sourceRoot":"","sources":["../../src/types/HashFunction.ts"],"names":[],"mappings":"","sourcesContent":["export type HashFunction = (params: { packagePath: string; isSourceHashingEnabled: boolean }) => Promise<string>;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';
|
|
2
|
-
import type { HashFunction } from './
|
|
2
|
+
import type { HashFunction } from './HashFunction.js';
|
|
3
3
|
import type { ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
4
4
|
/**
|
|
5
5
|
* Options for the PackageHashes class.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageHashOptions.d.ts","sourceRoot":"","sources":["../../src/types/PackageHashOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"PackageHashOptions.d.ts","sourceRoot":"","sources":["../../src/types/PackageHashOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IACE;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,iFAAiF;IACjF,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,OAAO,EAAE;QACP,MAAM,EAAE,eAAe,CAAC;QACxB,QAAQ,EAAE,uBAAuB,CAAC;QAClC,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageHashOptions.js","sourceRoot":"","sources":["../../src/types/PackageHashOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport type { HashFunction } from './
|
|
1
|
+
{"version":3,"file":"PackageHashOptions.js","sourceRoot":"","sources":["../../src/types/PackageHashOptions.ts"],"names":[],"mappings":"","sourcesContent":["import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport type { HashFunction } from './HashFunction.js';\nimport type { ResolveMap } from '@ms-cloudpack/package-utilities';\n\n/**\n * Options for the PackageHashes class.\n */\nexport type PackageHashesOptions =\n | {\n /**\n * A function that returns the hash for a given package path. This is intended for testing purposes.\n */\n hash: HashFunction;\n }\n | {\n /** Working directory used to find the project root (usually repository root). */\n cwd: string;\n /**\n * Context for the hash calculations.\n */\n context: {\n config: CloudpackConfig;\n packages: PackageDefinitionsCache;\n resolveMap: ResolveMap;\n };\n };\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/package-hashes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Utilities for hashing packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ms-cloudpack/common-types": "^0.
|
|
18
|
-
"@ms-cloudpack/config": "^0.
|
|
19
|
-
"@ms-cloudpack/package-utilities": "^7.
|
|
17
|
+
"@ms-cloudpack/common-types": "^0.8.0",
|
|
18
|
+
"@ms-cloudpack/config": "^0.21.0",
|
|
19
|
+
"@ms-cloudpack/package-utilities": "^7.6.0",
|
|
20
20
|
"fast-glob": "^3.2.12",
|
|
21
21
|
"glob-hasher": "^1.4.2",
|
|
22
22
|
"object-hash": "^3.0.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HashFunctions.d.ts","sourceRoot":"","sources":["../../src/types/HashFunctions.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,sBAAsB,EAAE,OAAO,CAAA;CAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HashFunctions.js","sourceRoot":"","sources":["../../src/types/HashFunctions.ts"],"names":[],"mappings":"","sourcesContent":["export type HashFunction = (params: { packagePath: string; isSourceHashingEnabled: boolean }) => Promise<string>;\n"]}
|