@ms-cloudpack/package-hashes 0.7.20 → 0.7.22
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PackageDefinitionsCache,
|
|
1
|
+
import type { PackageDefinitionsCache, PackageJsonCloudpackMeta, PackageJsonDependencies, PackageJsonExports } from '@ms-cloudpack/common-types';
|
|
2
2
|
import type { HashFunctionOptions } from './types/HashFunction.js';
|
|
3
3
|
import { type FilesHash } from './getSourceHash.js';
|
|
4
4
|
import type { PackagePatchesCache } from './PackagePatchesCache.js';
|
|
@@ -18,7 +18,7 @@ export interface PackageHashEntries {
|
|
|
18
18
|
/** Content of any `.patch` file for the package. */
|
|
19
19
|
patchFileContent: string | undefined;
|
|
20
20
|
/** Subset of calculated package settings and other info saved under `PackageJson.cloudpack`. */
|
|
21
|
-
packageSettings: Partial<
|
|
21
|
+
packageSettings: Partial<PackageJsonCloudpackMeta>;
|
|
22
22
|
/** Content of any bundler capabilities files for the package. */
|
|
23
23
|
bundlerCapabilitiesContent?: Record<string, string>;
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageHashEntries.d.ts","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"getPackageHashEntries.d.ts","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,gGAAgG;IAChG,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACxC,YAAY,EAAE,uBAAuB,GAAG,SAAS,CAAC;IAClD,gBAAgB,EAAE,uBAAuB,GAAG,SAAS,CAAC;IACtD,oCAAoC;IACpC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,oDAAoD;IACpD,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,gGAAgG;IAChG,eAAe,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACnD,iEAAiE;IACjE,0BAA0B,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAClD,OAAO,EAAE,mBAAmB,CAAC;IAC7B,OAAO,EAAE;QACP,QAAQ,EAAE,uBAAuB,CAAC;QAClC,OAAO,EAAE,mBAAmB,CAAC;QAC7B,wBAAwB,EAAE,wBAAwB,CAAC;KACpD,CAAC;CACH,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA4C9B"}
|
|
@@ -8,7 +8,7 @@ export async function getPackageHashEntries(params) {
|
|
|
8
8
|
const { packagePath, isSourceHashingEnabled } = options;
|
|
9
9
|
const { packages, patches, bundlerCapabilitiesCache } = context;
|
|
10
10
|
const definition = await packages.get(packagePath);
|
|
11
|
-
const
|
|
11
|
+
const originalDefinition = await packages.get(packagePath, { disableTransforms: true });
|
|
12
12
|
const { name, version } = definition;
|
|
13
13
|
// This has the cached calculated package settings, with included and excluded deps removed.
|
|
14
14
|
const packageSettings = { ...definition.cloudpack };
|
|
@@ -24,8 +24,8 @@ export async function getPackageHashEntries(params) {
|
|
|
24
24
|
exports: definition.exports,
|
|
25
25
|
// Use the original dependencies to ensure that the hash is consistent,
|
|
26
26
|
// and unaffected by include and exclude changes.
|
|
27
|
-
dependencies:
|
|
28
|
-
peerDependencies:
|
|
27
|
+
dependencies: originalDefinition.dependencies,
|
|
28
|
+
peerDependencies: originalDefinition.peerDependencies,
|
|
29
29
|
name,
|
|
30
30
|
version: isExternal ? version : packagePath,
|
|
31
31
|
filesHash,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageHashEntries.js","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAwBnE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAO3C;IACC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,WAAW,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,wBAAwB,EAAE,GAAG,OAAO,CAAC;IAEhE,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACnD,MAAM,
|
|
1
|
+
{"version":3,"file":"getPackageHashEntries.js","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAwBnE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAO3C;IACC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,WAAW,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,EAAE,QAAQ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IAAI,MAAM,CAAC,IAAI,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7D,MAAM,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;IACjE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type {\n PackageDefinitionsCache,\n PackageJsonCloudpackMeta,\n PackageJsonDependencies,\n PackageJsonExports,\n} from '@ms-cloudpack/common-types';\nimport { isExternalPackage } from '@ms-cloudpack/path-utilities';\nimport type { HashFunctionOptions } from './types/HashFunction.js';\nimport { getSourceHash, type FilesHash } from './getSourceHash.js';\nimport type { PackagePatchesCache } from './PackagePatchesCache.js';\nimport type { BundlerCapabilitiesCache } from './BundlerCapabilitiesCache.js';\n\n/**\n * Values used to calculate the hash of a package.\n */\nexport interface PackageHashEntries {\n name: string;\n /** This will be the actual version if the package is external, or the path if it's internal. */\n version: string;\n exports: PackageJsonExports | undefined;\n dependencies: PackageJsonDependencies | undefined;\n peerDependencies: PackageJsonDependencies | undefined;\n /** Hash of files in the package. */\n filesHash: FilesHash | undefined;\n /** Content of any `.patch` file for the package. */\n patchFileContent: string | undefined;\n /** Subset of calculated package settings and other info saved under `PackageJson.cloudpack`. */\n packageSettings: Partial<PackageJsonCloudpackMeta>;\n /** Content of any bundler capabilities files for the package. */\n bundlerCapabilitiesContent?: Record<string, string>;\n}\n\n/**\n * Get an object that's used to calculate the hash of the package.\n */\nexport async function getPackageHashEntries(params: {\n options: HashFunctionOptions;\n context: {\n packages: PackageDefinitionsCache;\n patches: PackagePatchesCache;\n bundlerCapabilitiesCache: BundlerCapabilitiesCache;\n };\n}): Promise<PackageHashEntries> {\n const { options, context } = params;\n const { packagePath, isSourceHashingEnabled } = options;\n const { packages, patches, bundlerCapabilitiesCache } = context;\n\n const definition = await packages.get(packagePath);\n const originalDefinition = await packages.get(packagePath, { disableTransforms: true });\n\n const { name, version } = definition;\n\n // This has the cached calculated package settings, with included and excluded deps removed.\n const packageSettings = { ...definition.cloudpack };\n\n const isExternal = isExternalPackage(packagePath);\n\n const filesHash =\n !isExternal && isSourceHashingEnabled\n ? await getSourceHash({ packagePath, inputPaths: packageSettings.inputPaths })\n : undefined;\n\n const patchFileContent = isExternal ? (await patches.getPackagePatch(name, version))?.contents : undefined;\n\n // Only include a subset of package.json properties to reduce the amount hashed.\n const result: PackageHashEntries = {\n // This will be calculated by createPackageSettingsTransform and incorporates the original\n // exports as well as main and module.\n exports: definition.exports,\n // Use the original dependencies to ensure that the hash is consistent,\n // and unaffected by include and exclude changes.\n dependencies: originalDefinition.dependencies,\n peerDependencies: originalDefinition.peerDependencies,\n name,\n version: isExternal ? version : packagePath,\n filesHash,\n patchFileContent,\n packageSettings,\n };\n\n const bundlerCapabilitiesContent = await bundlerCapabilitiesCache.get(packageSettings.bundlerCapabilities);\n if (Object.keys(bundlerCapabilitiesContent || {}).length > 0) {\n result.bundlerCapabilitiesContent = bundlerCapabilitiesContent;\n }\n\n return result;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/package-hashes",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.22",
|
|
4
4
|
"description": "Utilities for hashing packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ms-cloudpack/common-types": "^0.24.
|
|
18
|
-
"@ms-cloudpack/config": "^0.33.
|
|
19
|
-
"@ms-cloudpack/package-utilities": "^11.
|
|
17
|
+
"@ms-cloudpack/common-types": "^0.24.3",
|
|
18
|
+
"@ms-cloudpack/config": "^0.33.10",
|
|
19
|
+
"@ms-cloudpack/package-utilities": "^11.3.0",
|
|
20
20
|
"@ms-cloudpack/path-string-parsing": "^1.2.6",
|
|
21
|
-
"@ms-cloudpack/path-utilities": "^
|
|
21
|
+
"@ms-cloudpack/path-utilities": "^3.0.0",
|
|
22
22
|
"fast-glob": "^3.2.12",
|
|
23
23
|
"glob-hasher": "^1.4.2",
|
|
24
24
|
"object-hash": "^3.0.0"
|