@ms-cloudpack/package-hashes 0.4.0 → 0.5.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/getInlinedDependenciesPaths.d.ts +1 -1
- package/lib/getInlinedDependenciesPaths.js.map +1 -1
- package/lib/getPackageHashEntries.d.ts +7 -8
- package/lib/getPackageHashEntries.d.ts.map +1 -1
- package/lib/getPackageHashEntries.js.map +1 -1
- package/lib/getSourceHash.d.ts +1 -1
- package/lib/getSourceHash.js.map +1 -1
- package/lib/hashPackage.d.ts +1 -2
- package/lib/hashPackage.d.ts.map +1 -1
- package/lib/hashPackage.js.map +1 -1
- package/lib/types/PackageHashOptions.d.ts +1 -2
- package/lib/types/PackageHashOptions.d.ts.map +1 -1
- package/lib/types/PackageHashOptions.js.map +1 -1
- package/package.json +7 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PackageJson } from '@ms-cloudpack/
|
|
1
|
+
import type { PackageJson } from '@ms-cloudpack/common-types';
|
|
2
2
|
import { type ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
3
3
|
import type { getPackageSettings } from '@ms-cloudpack/config';
|
|
4
4
|
export declare function getInlinedDependenciesPaths(params: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInlinedDependenciesPaths.js","sourceRoot":"","sources":["../src/getInlinedDependenciesPaths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAmB,MAAM,iCAAiC,CAAC;AAGvF,MAAM,UAAU,2BAA2B,CAAC,MAS3C;IACC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEhD,MAAM,mBAAmB,GAAG;QAC1B,GAAG,CAAC,eAAe,CAAC,mBAAmB,EAAE,mBAAmB,IAAI,EAAE,CAAC;QACnE,GAAG,CAAC,eAAe,CAAC,wBAAwB,EAAE,mBAAmB,IAAI,EAAE,CAAC;KACzE,CAAC;IAEF,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACtE,mBAAmB,CAAC;QAClB,WAAW,EAAE,UAAU;QACvB,UAAU;QACV,UAAU;KACX,CAAC,CACH,CAAC;IAEF,KAAK,MAAM,sBAAsB,IAAI,wBAAwB,EAAE,CAAC;QAC9D,IAAI,sBAAsB,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/
|
|
1
|
+
{"version":3,"file":"getInlinedDependenciesPaths.js","sourceRoot":"","sources":["../src/getInlinedDependenciesPaths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAmB,MAAM,iCAAiC,CAAC;AAGvF,MAAM,UAAU,2BAA2B,CAAC,MAS3C;IACC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEhD,MAAM,mBAAmB,GAAG;QAC1B,GAAG,CAAC,eAAe,CAAC,mBAAmB,EAAE,mBAAmB,IAAI,EAAE,CAAC;QACnE,GAAG,CAAC,eAAe,CAAC,wBAAwB,EAAE,mBAAmB,IAAI,EAAE,CAAC;KACzE,CAAC;IAEF,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,wBAAwB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CACtE,mBAAmB,CAAC;QAClB,WAAW,EAAE,UAAU;QACvB,UAAU;QACV,UAAU;KACX,CAAC,CACH,CAAC;IAEF,KAAK,MAAM,sBAAsB,IAAI,wBAAwB,EAAE,CAAC;QAC9D,IAAI,sBAAsB,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/common-types';\nimport { findResolveMapEntry, type ResolveMap } from '@ms-cloudpack/package-utilities';\nimport type { getPackageSettings } from '@ms-cloudpack/config';\n\nexport function getInlinedDependenciesPaths(params: {\n options: {\n packageName: string;\n definition: PackageJson;\n };\n context: {\n resolveMap: ResolveMap;\n packageSettings: ReturnType<typeof getPackageSettings>;\n };\n}) {\n const { options, context } = params;\n const { definition } = options;\n const { resolveMap, packageSettings } = context;\n\n const inlinedDependencies = [\n ...(packageSettings.userPackageSettings?.inlinedDependencies || []),\n ...(packageSettings.generatedPackageSettings?.inlinedDependencies || []),\n ];\n\n const result: string[] = [];\n const inlinedDependencyEntries = inlinedDependencies.map((dependency) =>\n findResolveMapEntry({\n packageName: dependency,\n resolveMap,\n definition,\n }),\n );\n\n for (const inlinedDependencyEntry of inlinedDependencyEntries) {\n if (inlinedDependencyEntry) {\n result.push(inlinedDependencyEntry.path);\n }\n }\n\n return result;\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { PackageDefinitionsCache } from '@ms-cloudpack/
|
|
2
|
-
import type { CloudpackConfig } from '@ms-cloudpack/config-types';
|
|
1
|
+
import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';
|
|
3
2
|
import type { PackagePatches } from './types/PackagePatches.js';
|
|
4
3
|
/**
|
|
5
4
|
* @returns the entries that are used to calculate the hash of a package
|
|
@@ -20,8 +19,8 @@ export declare function getPackageHashEntries(params: {
|
|
|
20
19
|
filesHash: Record<string, string> | null | undefined;
|
|
21
20
|
patchFileContent: string | undefined;
|
|
22
21
|
packageSettings: {
|
|
23
|
-
userPackageSettings: import("@ms-cloudpack/
|
|
24
|
-
generatedPackageSettings: import("@ms-cloudpack/
|
|
22
|
+
userPackageSettings: import("@ms-cloudpack/common-types").PackageSettings | undefined;
|
|
23
|
+
generatedPackageSettings: import("@ms-cloudpack/common-types").PackageSettings | undefined;
|
|
25
24
|
};
|
|
26
25
|
description?: string | undefined;
|
|
27
26
|
files?: string[] | undefined;
|
|
@@ -44,8 +43,8 @@ export declare function getPackageHashEntries(params: {
|
|
|
44
43
|
types?: string | undefined;
|
|
45
44
|
typings?: string | undefined;
|
|
46
45
|
typesVersions?: Partial<Record<string, Partial<Record<string, string[]>>>> | undefined;
|
|
47
|
-
exports?: import("@ms-cloudpack/
|
|
48
|
-
imports?: import("@ms-cloudpack/
|
|
46
|
+
exports?: import("@ms-cloudpack/common-types").PackageJsonExports | undefined;
|
|
47
|
+
imports?: import("@ms-cloudpack/common-types").PackageJsonImports | undefined;
|
|
49
48
|
dependencies?: Partial<Record<string, string>> | undefined;
|
|
50
49
|
devDependencies?: Partial<Record<string, string>> | undefined;
|
|
51
50
|
peerDependencies?: Partial<Record<string, string>> | undefined;
|
|
@@ -61,8 +60,8 @@ export declare function getPackageHashEntries(params: {
|
|
|
61
60
|
node?: string | undefined;
|
|
62
61
|
npm?: string | undefined;
|
|
63
62
|
} | undefined;
|
|
64
|
-
os?: import("@ms-cloudpack/
|
|
65
|
-
cpu?: import("@ms-cloudpack/
|
|
63
|
+
os?: import("@ms-cloudpack/common-types").LiteralOrString<"aix" | "darwin" | "freebsd" | "linux" | "openbsd" | "sunos" | "win32" | "!aix" | "!darwin" | "!freebsd" | "!linux" | "!openbsd" | "!sunos" | "!win32">[] | undefined;
|
|
64
|
+
cpu?: import("@ms-cloudpack/common-types").LiteralOrString<"arm" | "arm64" | "ia32" | "mips" | "mipsel" | "ppc" | "ppc64" | "s390" | "s390x" | "x32" | "x64" | "!arm" | "!arm64" | "!ia32" | "!mips" | "!mipsel" | "!ppc" | "!ppc64" | "!s390" | "!s390x" | "!x32" | "!x64">[] | undefined;
|
|
66
65
|
private?: boolean | undefined;
|
|
67
66
|
publishConfig?: {
|
|
68
67
|
[additionalProperties: string]: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageHashEntries.d.ts","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"getPackageHashEntries.d.ts","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAI3F,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageHashEntries.js","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"getPackageHashEntries.js","sourceRoot":"","sources":["../src/getPackageHashEntries.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AC,CAAC,SAAS,CAAC;IAE5G,MAAM,gBAAgB,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,mBAAmB,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEpG,OAAO;QACL,GAAG,UAAU;QACb,IAAI;QACJ,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW;QAC3C,SAAS;QACT,gBAAgB;QAChB,eAAe;KAChB,CAAC;AACJ,CAAC","sourcesContent":["import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport { isExternalPackage } from '@ms-cloudpack/package-utilities';\nimport { getSourceHash } from './getSourceHash.js';\nimport { getPackageSettings } from '@ms-cloudpack/config';\nimport type { PackagePatches } from './types/PackagePatches.js';\nimport { getPatchFileContent } from './getPatchFileContent.js';\n\n/**\n * @returns the entries that are used to calculate the hash of a package\n */\nexport async function getPackageHashEntries(params: {\n options: {\n packagePath: string;\n isSourceHashingEnabled: boolean;\n };\n context: {\n config: CloudpackConfig;\n packages: PackageDefinitionsCache;\n patches: PackagePatches;\n };\n}) {\n const { options, context } = params;\n const { packagePath, isSourceHashingEnabled } = options;\n const { packages, config, patches } = context;\n\n const definition = await packages.get(packagePath);\n\n if (!definition) {\n throw new Error(`Package definition (package.json) missing or invalid at \"${packagePath}\"`);\n }\n\n const { name, version } = definition;\n if (!name) {\n throw new Error(`Package definition (package.json) missing name at \"${packagePath}\"`);\n }\n if (!version) {\n throw new Error(`Package definition (package.json) missing version at \"${packagePath}\"`);\n }\n\n const isExternal = isExternalPackage(packagePath);\n\n const packageSettings = getPackageSettings({ name, version, config });\n\n const filesHash =\n !isExternal && isSourceHashingEnabled ? await getSourceHash({ packagePath, packageSettings }) : undefined;\n\n const patchFileContent = isExternal ? await getPatchFileContent(patches, name, version) : undefined;\n\n return {\n ...definition,\n name,\n version: isExternal ? version : packagePath,\n filesHash,\n patchFileContent,\n packageSettings,\n };\n}\n"]}
|
package/lib/getSourceHash.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PackageSettings } from '@ms-cloudpack/
|
|
1
|
+
import type { PackageSettings } from '@ms-cloudpack/common-types';
|
|
2
2
|
/**
|
|
3
3
|
* Get the hash of the source files in a package
|
|
4
4
|
* If there is a src folder, hash the files in that folder, the .*json files and the inputPaths
|
package/lib/getSourceHash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSourceHash.js","sourceRoot":"","sources":["../src/getSourceHash.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAMnC;IACC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEhC,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IACjD,MAAM,UAAU,GAAG,eAAe,EAAE,mBAAmB,EAAE,UAAU,CAAC;IACpE,oFAAoF;IACpF,+CAA+C;IAC/C,IAAI,QAAkB,CAAC;IACvB,IAAI,UAAU,EAAE,MAAM,EAAE,CAAC;QACvB,QAAQ,GAAG,UAAU,CAAC;IACxB,CAAC;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACrD,QAAQ,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE;QACjC,GAAG,EAAE,WAAW;KACjB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAEnD,OAAO,CAAC,KAAK,CAAC,0BAA0B,WAAW,OAAO,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC;IAEzF,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { PackageSettings } from '@ms-cloudpack/
|
|
1
|
+
{"version":3,"file":"getSourceHash.js","sourceRoot":"","sources":["../src/getSourceHash.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAMnC;IACC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEhC,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IACjD,MAAM,UAAU,GAAG,eAAe,EAAE,mBAAmB,EAAE,UAAU,CAAC;IACpE,oFAAoF;IACpF,+CAA+C;IAC/C,IAAI,QAAkB,CAAC;IACvB,IAAI,UAAU,EAAE,MAAM,EAAE,CAAC;QACvB,QAAQ,GAAG,UAAU,CAAC;IACxB,CAAC;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACrD,QAAQ,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE;QACjC,GAAG,EAAE,WAAW;KACjB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAEnD,OAAO,CAAC,KAAK,CAAC,0BAA0B,WAAW,OAAO,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC,CAAC;IAEzF,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { PackageSettings } from '@ms-cloudpack/common-types';\nimport glob from 'fast-glob';\nimport { existsSync } from 'fs';\nimport { hash } from 'glob-hasher';\nimport path from 'path';\n\nconst excludeNodeModules = '!**/node_modules/**';\n\n/**\n * Get the hash of the source files in a package\n * If there is a src folder, hash the files in that folder, the .*json files and the inputPaths\n * If there are inputPaths, hash those files in addition to the .*json files\n * Otherwise, hash all files except node_modules\n */\nexport async function getSourceHash(options: {\n packagePath: string;\n packageSettings?: {\n userPackageSettings: PackageSettings | undefined;\n generatedPackageSettings: PackageSettings | undefined;\n };\n}) {\n const start = performance.now();\n\n const { packagePath, packageSettings } = options;\n const inputPaths = packageSettings?.userPackageSettings?.inputPaths;\n // Use the inputPaths if they are defined, otherwise use the src folder if it exists\n // Otherwise, use all files except node_modules\n let patterns: string[];\n if (inputPaths?.length) {\n patterns = inputPaths;\n } else if (existsSync(path.join(packagePath, 'src'))) {\n patterns = ['src/**', '*.json', excludeNodeModules];\n } else {\n patterns = ['**', excludeNodeModules];\n }\n\n const files = await glob(patterns, {\n cwd: packagePath,\n });\n\n const globHash = hash(files, { cwd: packagePath });\n\n console.debug(`Hashed source files in ${packagePath} in ${performance.now() - start}ms`);\n\n return globHash;\n}\n"]}
|
package/lib/hashPackage.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { PackageDefinitionsCache } from '@ms-cloudpack/
|
|
1
|
+
import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';
|
|
2
2
|
import { type ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
3
|
-
import type { CloudpackConfig } from '@ms-cloudpack/config-types';
|
|
4
3
|
import type { PackagePatches } from './types/PackagePatches.js';
|
|
5
4
|
export declare function hashPackage(params: {
|
|
6
5
|
input: {
|
package/lib/hashPackage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashPackage.d.ts","sourceRoot":"","sources":["../src/hashPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"hashPackage.d.ts","sourceRoot":"","sources":["../src/hashPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAIlE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAShE,wBAAsB,WAAW,CAAC,MAAM,EAAE;IACxC,KAAK,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,sBAAsB,EAAE,OAAO,CAAC;KACjC,CAAC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,uBAAuB,CAAC;QAClC,MAAM,EAAE,eAAe,CAAC;QACxB,UAAU,EAAE,UAAU,CAAC;QACvB,OAAO,EAAE,cAAc,CAAC;KACzB,CAAC;CACH,GAAG,OAAO,CAAC,MAAM,CAAC,CA+ClB"}
|
package/lib/hashPackage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashPackage.js","sourceRoot":"","sources":["../src/hashPackage.ts"],"names":[],"mappings":"AAEA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,qBAA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AAE;oBACP,WAAW,EAAE,WAAW,CAAC,IAAI;oBAC7B,UAAU,EAAE,WAAW;iBACxB;gBACD,OAAO,EAAE,EAAE,eAAe,EAAE,WAAW,CAAC,eAAe,EAAE,UAAU,EAAE;aACtE,CAAC,CAAC;YACH,cAAc,CAAC,IAAI,CAAC,GAAG,wBAAwB,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,UAAU,CAAC,gBAAgB,EAAE;QAC9C,WAAW,EAAE,KAAK;QAClB,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,IAAI;QACnB,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;IAEH,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;IAC9C,SAAS,IAAI,WAAW,CAAC;IACzB,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,IAAI,OAAO,OAAO,WAAW,mBAAmB,SAAS,IAAI,CAAC,CAAC;IAE3F,OAAO,IAAI,WAAW,IAAI,UAAU,EAAE,CAAC;AACzC,CAAC","sourcesContent":["import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport { type ResolveMap } from '@ms-cloudpack/package-utilities';\nimport objectHash from 'object-hash';\nimport { getPackageHashEntries } from './getPackageHashEntries.js';\nimport { getInlinedDependenciesPaths } from './getInlinedDependenciesPaths.js';\nimport type { PackagePatches } from './types/PackagePatches.js';\n\nlet totalTime = 0;\n\n/**\n * Hash version is used to invalidate the cache when the hashing algorithm changes.\n */\nconst hashVersion = 4;\n\nexport async function hashPackage(params: {\n input: {\n packagePath: string;\n isSourceHashingEnabled: boolean;\n };\n context: {\n packages: PackageDefinitionsCache;\n config: CloudpackConfig;\n resolveMap: ResolveMap;\n patches: PackagePatches;\n };\n}): Promise<string> {\n const start = performance.now();\n const { input, context } = params;\n const { packagePath, isSourceHashingEnabled } = input;\n const { resolveMap, config, packages, patches } = context;\n const hashEntriesArray: Awaited<ReturnType<typeof getPackageHashEntries>>[] = [];\n const packagesToHash: string[] = [packagePath];\n\n while (packagesToHash.length > 0) {\n const packageToHash = packagesToHash.pop();\n if (!packageToHash) {\n continue;\n }\n\n const hashEntries = await getPackageHashEntries({\n options: { isSourceHashingEnabled, packagePath: packageToHash },\n context: { packages, config, patches },\n });\n\n hashEntriesArray.push(hashEntries);\n\n if (config) {\n const inlinedDependenciesPaths = getInlinedDependenciesPaths({\n options: {\n packageName: hashEntries.name,\n definition: hashEntries,\n },\n context: { packageSettings: hashEntries.packageSettings, resolveMap },\n });\n packagesToHash.push(...inlinedDependenciesPaths);\n }\n }\n\n const hashResult = objectHash(hashEntriesArray, {\n respectType: false,\n unorderedArrays: true,\n unorderedSets: true,\n unorderedObjects: true,\n ignoreUnknown: true,\n });\n\n const { name, version } = hashEntriesArray[0];\n const elapsedTime = performance.now() - start;\n totalTime += elapsedTime;\n console.debug(`Hashed ${name}@${version} in ${elapsedTime}ms, total time: ${totalTime}ms`);\n\n return `v${hashVersion}-${hashResult}`;\n}\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { CloudpackConfig } from '@ms-cloudpack/
|
|
1
|
+
import type { CloudpackConfig, PackageDefinitionsCache } from '@ms-cloudpack/common-types';
|
|
2
2
|
import type { HashFunction } from './HashFunctions.js';
|
|
3
|
-
import type { PackageDefinitionsCache } from '@ms-cloudpack/bundler-types';
|
|
4
3
|
import type { ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
5
4
|
/**
|
|
6
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,MAAM,4BAA4B,CAAC;
|
|
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,oBAAoB,CAAC;AACvD,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 } from '@ms-cloudpack/
|
|
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 './HashFunctions.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.5.0",
|
|
4
4
|
"description": "Utilities for hashing packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,18 +14,17 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@ms-cloudpack/
|
|
18
|
-
"@ms-cloudpack/config": "^0.
|
|
19
|
-
"@ms-cloudpack/
|
|
20
|
-
"@ms-cloudpack/package-utilities": "^7.0.1",
|
|
17
|
+
"@ms-cloudpack/common-types": "^0.1.1",
|
|
18
|
+
"@ms-cloudpack/config": "^0.18.0",
|
|
19
|
+
"@ms-cloudpack/package-utilities": "^7.1.0",
|
|
21
20
|
"fast-glob": "^3.2.12",
|
|
22
21
|
"glob-hasher": "^1.2.1",
|
|
23
22
|
"object-hash": "^3.0.0"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
|
-
"@ms-cloudpack/eslint-plugin-internal": "
|
|
27
|
-
"@ms-cloudpack/scripts": "
|
|
28
|
-
"@ms-cloudpack/test-utilities": "
|
|
25
|
+
"@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
|
|
26
|
+
"@ms-cloudpack/scripts": "^0.0.1",
|
|
27
|
+
"@ms-cloudpack/test-utilities": "^0.5.0",
|
|
29
28
|
"@types/object-hash": "^3.0.2"
|
|
30
29
|
},
|
|
31
30
|
"scripts": {
|