@ms-cloudpack/package-hashes 0.7.15 → 0.7.17

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 { findProjectRoot } from '@ms-cloudpack/package-utilities';
1
+ import { findProjectRoot } from '@ms-cloudpack/path-utilities';
2
2
  import fsPromises from 'fs/promises';
3
3
  import glob from 'fast-glob';
4
4
  import path from 'path';
@@ -1 +1 @@
1
- {"version":3,"file":"PackagePatchesCache.js","sourceRoot":"","sources":["../src/PackagePatchesCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAkB7D;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IAQ9B,YAA6B,QAAgC;QAAhC,aAAQ,GAAR,QAAQ,CAAwB;IAAG,CAAC;IAEzD,MAAM,CAAC,WAAmB,EAAE,OAAe;QACjD,OAAO,GAAG,WAAW,IAAI,OAAO,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,mBAAmB;QAC/B,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;YACtC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QAEnB,oBAAoB;QACpB,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAEzE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,yEAA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,EAAE,CAAC;QACnC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;QAErE,IAAI,SAAS,EAAE,CAAC;YACd,+BAA+B;YAC/B,SAAS,CAAC,QAAQ,KAAK,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChE,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { findProjectRoot } from '@ms-cloudpack/package-utilities';\nimport fsPromises from 'fs/promises';\nimport glob from 'fast-glob';\nimport path from 'path';\nimport { parsePatchFilePath } from './parsePatchFilePath.js';\n\nexport interface PackagePatchesSettings {\n /** Working directory, used to determine the project root where patches are stored. */\n cwd: string;\n\n /** Custom glob pattern for patch files (from `AppConfig.patchFilesGlobPattern`). */\n globPattern?: string;\n\n /** Patches to use instead of reading from disk (for testing). */\n patches?: Record<`${string}@${string}`, PackagePatch>;\n}\n\ninterface PackagePatch {\n path: string;\n contents?: string;\n}\n\n/**\n * PackagePatchesCache manages a cache of information about patch files, which are usually stored in the\n * `patches` folder at the root of the repo. It provides a method to retrieve the patch file\n * path and contents for a given package name and version.\n */\nexport class PackagePatchesCache {\n /**\n * Mapping from `${packageName}@${version}` to patch file path and contents.\n * The paths are saved on an initial pass, but the contents are only saved on first read\n * (in case of very large patch files which are never used).\n */\n private _patches: Record<`${string}@${string}`, PackagePatch> | undefined;\n\n constructor(private readonly settings: PackagePatchesSettings) {}\n\n private getKey(packageName: string, version: string): `${string}@${string}` {\n return `${packageName}@${version}`;\n }\n\n /**\n * Loads the list of patched packages from the `patches` folder.\n */\n private async loadPatchedPackages() {\n if (this.settings.patches) {\n this._patches = this.settings.patches;\n return;\n }\n\n this._patches = {};\n\n // get the repo root\n const rootPath = findProjectRoot(this.settings.cwd) || this.settings.cwd;\n\n if (!rootPath) {\n console.info('Could not find the root of the repo. Skipping loading patched packages.');\n return;\n }\n\n // get the files with .patch extension\n const patchFiles = await glob(this.settings.globPattern || 'patches/*.patch', {\n cwd: rootPath,\n absolute: true,\n });\n\n for (const absoluteFilePath of patchFiles) {\n try {\n const normalizedPath = path.normalize(absoluteFilePath);\n\n const { packageName, version } = parsePatchFilePath(normalizedPath);\n\n console.debug(`Found patch file for package: ${packageName}@${version}`);\n\n this._patches[this.getKey(packageName, version)] = { path: normalizedPath };\n } catch (e) {\n console.warn(`Invalid patch file \"${absoluteFilePath}\": ${e}`);\n }\n }\n }\n\n private async readPatchFile(patchFilePath: string): Promise<string> {\n try {\n return await fsPromises.readFile(patchFilePath, 'utf-8');\n } catch (e) {\n console.warn(`Error reading patch file \"${patchFilePath}\": ${e}`);\n return '';\n }\n }\n\n /**\n * Gets info about the patch file for the specified package.\n * @param packageName - The name of the package to check.\n * @param version - The version of the package to check.\n * @returns Patch file path and contents if the package has been patched, undefined otherwise.\n */\n public async getPackagePatch(packageName: string, version: string): Promise<PackagePatch | undefined> {\n if (!this._patches) {\n await this.loadPatchedPackages();\n }\n\n const patchInfo = this._patches?.[this.getKey(packageName, version)];\n\n if (patchInfo) {\n // The contents are lazy loaded\n patchInfo.contents ??= await this.readPatchFile(patchInfo.path);\n return patchInfo;\n }\n\n return undefined;\n }\n}\n"]}
1
+ {"version":3,"file":"PackagePatchesCache.js","sourceRoot":"","sources":["../src/PackagePatchesCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAkB7D;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IAQ9B,YAA6B,QAAgC;QAAhC,aAAQ,GAAR,QAAQ,CAAw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BACX,OAAO,CAAC,IAAI,CAAC,uBAAuB,gBAAgB,MAAM,CAAC,EAAE,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,aAAqB;QAC/C,IAAI,CAAC;YACH,OAAO,MAAM,UAAU,CAAC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC3D,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,IAAI,CAAC,6BAA6B,aAAa,MAAM,CAAC,EAAE,CAAC,CAAC;YAClE,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,eAAe,CAAC,WAAmB,EAAE,OAAe;QAC/D,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACnC,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;QAErE,IAAI,SAAS,EAAE,CAAC;YACd,+BAA+B;YAC/B,SAAS,CAAC,QAAQ,KAAK,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAChE,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;CACF","sourcesContent":["import { findProjectRoot } from '@ms-cloudpack/path-utilities';\nimport fsPromises from 'fs/promises';\nimport glob from 'fast-glob';\nimport path from 'path';\nimport { parsePatchFilePath } from './parsePatchFilePath.js';\n\nexport interface PackagePatchesSettings {\n /** Working directory, used to determine the project root where patches are stored. */\n cwd: string;\n\n /** Custom glob pattern for patch files (from `AppConfig.patchFilesGlobPattern`). */\n globPattern?: string;\n\n /** Patches to use instead of reading from disk (for testing). */\n patches?: Record<`${string}@${string}`, PackagePatch>;\n}\n\ninterface PackagePatch {\n path: string;\n contents?: string;\n}\n\n/**\n * PackagePatchesCache manages a cache of information about patch files, which are usually stored in the\n * `patches` folder at the root of the repo. It provides a method to retrieve the patch file\n * path and contents for a given package name and version.\n */\nexport class PackagePatchesCache {\n /**\n * Mapping from `${packageName}@${version}` to patch file path and contents.\n * The paths are saved on an initial pass, but the contents are only saved on first read\n * (in case of very large patch files which are never used).\n */\n private _patches: Record<`${string}@${string}`, PackagePatch> | undefined;\n\n constructor(private readonly settings: PackagePatchesSettings) {}\n\n private getKey(packageName: string, version: string): `${string}@${string}` {\n return `${packageName}@${version}`;\n }\n\n /**\n * Loads the list of patched packages from the `patches` folder.\n */\n private async loadPatchedPackages(): Promise<void> {\n if (this.settings.patches) {\n this._patches = this.settings.patches;\n return;\n }\n\n this._patches = {};\n\n // get the repo root\n const rootPath = findProjectRoot(this.settings.cwd) || this.settings.cwd;\n\n if (!rootPath) {\n console.info('Could not find the root of the repo. Skipping loading patched packages.');\n return;\n }\n\n // get the files with .patch extension\n const patchFiles = await glob(this.settings.globPattern || 'patches/*.patch', {\n cwd: rootPath,\n absolute: true,\n });\n\n for (const absoluteFilePath of patchFiles) {\n try {\n const normalizedPath = path.normalize(absoluteFilePath);\n\n const { packageName, version } = parsePatchFilePath(normalizedPath);\n\n console.debug(`Found patch file for package: ${packageName}@${version}`);\n\n this._patches[this.getKey(packageName, version)] = { path: normalizedPath };\n } catch (e) {\n console.warn(`Invalid patch file \"${absoluteFilePath}\": ${e}`);\n }\n }\n }\n\n private async readPatchFile(patchFilePath: string): Promise<string> {\n try {\n return await fsPromises.readFile(patchFilePath, 'utf-8');\n } catch (e) {\n console.warn(`Error reading patch file \"${patchFilePath}\": ${e}`);\n return '';\n }\n }\n\n /**\n * Gets info about the patch file for the specified package.\n * @param packageName - The name of the package to check.\n * @param version - The version of the package to check.\n * @returns Patch file path and contents if the package has been patched, undefined otherwise.\n */\n public async getPackagePatch(packageName: string, version: string): Promise<PackagePatch | undefined> {\n if (!this._patches) {\n await this.loadPatchedPackages();\n }\n\n const patchInfo = this._patches?.[this.getKey(packageName, version)];\n\n if (patchInfo) {\n // The contents are lazy loaded\n patchInfo.contents ??= await this.readPatchFile(patchInfo.path);\n return patchInfo;\n }\n\n return undefined;\n }\n}\n"]}
@@ -1,5 +1,4 @@
1
- import type { PackageJson } from '@ms-cloudpack/common-types';
2
- import { type ResolveMap } from '@ms-cloudpack/package-utilities';
1
+ import type { PackageJson, ResolveMap } from '@ms-cloudpack/common-types';
3
2
  export declare function getInlinedDependenciesPaths(params: {
4
3
  options: {
5
4
  packageName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"getInlinedDependenciesPaths.d.ts","sourceRoot":"","sources":["../src/getInlinedDependenciesPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAEvF,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IAClD,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,WAAW,CAAC;QACxB,mBAAmB,EAAE,MAAM,EAAE,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE;QACP,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;CACH,YAqBA"}
1
+ {"version":3,"file":"getInlinedDependenciesPaths.d.ts","sourceRoot":"","sources":["../src/getInlinedDependenciesPaths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAG1E,wBAAgB,2BAA2B,CAAC,MAAM,EAAE;IAClD,OAAO,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,WAAW,CAAC;QACxB,mBAAmB,EAAE,MAAM,EAAE,CAAC;KAC/B,CAAC;IACF,OAAO,EAAE;QACP,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;CACH,GAAG,MAAM,EAAE,CAqBX"}
@@ -1 +1 @@
1
- {"version":3,"file":"getInlinedDependenciesPaths.js","sourceRoot":"","sources":["../src/getInlinedDependenciesPaths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAmB,MAAM,iCAAiC,CAAC;AAEvF,MAAM,UAAU,2BAA2B,CAAC,MAS3C;IACC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC;IACpD,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,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';\n\nexport function getInlinedDependenciesPaths(params: {\n options: {\n packageName: string;\n definition: PackageJson;\n inlinedDependencies: string[];\n };\n context: {\n resolveMap: ResolveMap;\n };\n}) {\n const { options, context } = params;\n const { definition, inlinedDependencies } = options;\n const { resolveMap } = context;\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
+ {"version":3,"file":"getInlinedDependenciesPaths.js","sourceRoot":"","sources":["../src/getInlinedDependenciesPaths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,UAAU,2BAA2B,CAAC,MAS3C;IACC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC;IACpD,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,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, ResolveMap } from '@ms-cloudpack/common-types';\nimport { findResolveMapEntry } from '@ms-cloudpack/package-utilities';\n\nexport function getInlinedDependenciesPaths(params: {\n options: {\n packageName: string;\n definition: PackageJson;\n inlinedDependencies: string[];\n };\n context: {\n resolveMap: ResolveMap;\n };\n}): string[] {\n const { options, context } = params;\n const { definition, inlinedDependencies } = options;\n const { resolveMap } = context;\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,4 +1,4 @@
1
- import { isExternalPackage } from '@ms-cloudpack/package-utilities';
1
+ import { isExternalPackage } from '@ms-cloudpack/path-utilities';
2
2
  import { getSourceHash } from './getSourceHash.js';
3
3
  /**
4
4
  * Get an object that's used to calculate the hash of the package.
@@ -1 +1 @@
1
- {"version":3,"file":"getPackageHashEntries.js","sourceRoot":"","sources":["../src/getPackageHashEntries.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,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,4BAA4B,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;IAElG,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAErC,4FAA4F;IAC5F,MAAM,eAAe,GAAG,EAAE,GAAG,UAAU,CAAC,SAAS,EAAE,CAAC;IAEpD,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAElD,MAAM,SAAS,GACb,CAAC,UAAU,IAAI,sBAAsB;QACnC,CAAC,CAAC,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,CAAC,UAAU,EAAE,CAAC;QAC9E,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,gBAAgB,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAE3G,gFAAgF;IAChF,MAAM,MAAM,GAAuB;QACjC,0FAA0F;QAC1F,sCAAsC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,uEAAuE;QACvE,iDAAiD;QACjD,YAAY,EAAE,4BAA4B,CAAC,YAAY;QACvD,gBAAgB,EAAE,4BAA4B,CAAC,gBAAgB;QAC/D,IAAI;QACJ,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW;QAC3C,SAAS;QACT,gBAAgB;QAChB,eAAe;KAChB,CAAC;IAEF,MAAM,0BAA0B,GAAG,MAAM,wBAAwB,CAAC,GAAG,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;IAC3G,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 PackageJson,\n PackageJsonDependencies,\n PackageJsonExports,\n} from '@ms-cloudpack/common-types';\nimport { isExternalPackage } from '@ms-cloudpack/package-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<NonNullable<PackageJson['cloudpack']>>;\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 disabledTransformsDefinition = 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: disabledTransformsDefinition.dependencies,\n peerDependencies: disabledTransformsDefinition.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;\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GAAuB;QACjC,0FAA0F;QAC1F,sCAAsC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,uEAAuE;QACvE,iDAAiD;QACjD,YAAY,EAAE,4BAA4B,CAAC,YAAY;QACvD,gBAAgB,EAAE,4BAA4B,CAAC,gBAAgB;QAC/D,IAAI;QACJ,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW;QAC3C,SAAS;QACT,gBAAgB;QAChB,eAAe;KAChB,CAAC;IAEF,MAAM,0BAA0B,GAAG,MAAM,wBAAwB,CAAC,GAAG,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;IAC3G,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 PackageJson,\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<NonNullable<PackageJson['cloudpack']>>;\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 disabledTransformsDefinition = 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: disabledTransformsDefinition.dependencies,\n peerDependencies: disabledTransformsDefinition.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"]}
@@ -1,5 +1,4 @@
1
- import type { PackageDefinitionsCache } from '@ms-cloudpack/common-types';
2
- import { type ResolveMap } from '@ms-cloudpack/package-utilities';
1
+ import type { PackageDefinitionsCache, ResolveMap } from '@ms-cloudpack/common-types';
3
2
  import type { PackagePatchesCache } from './PackagePatchesCache.js';
4
3
  import type { HashFunctionOptions } from './types/HashFunction.js';
5
4
  import type { BundlerCapabilitiesCache } from './BundlerCapabilitiesCache.js';
@@ -1 +1 @@
1
- {"version":3,"file":"hashPackage.d.ts","sourceRoot":"","sources":["../src/hashPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAIlE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAI9E,wBAAsB,WAAW,CAAC,MAAM,EAAE;IACxC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,OAAO,EAAE;QACP,QAAQ,EAAE,uBAAuB,CAAC;QAClC,UAAU,EAAE,UAAU,CAAC;QACvB,OAAO,EAAE,mBAAmB,CAAC;QAC7B,wBAAwB,EAAE,wBAAwB,CAAC;KACpD,CAAC;CACH,GAAG,OAAO,CAAC,MAAM,CAAC,CAgDlB"}
1
+ {"version":3,"file":"hashPackage.d.ts","sourceRoot":"","sources":["../src/hashPackage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAItF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAI9E,wBAAsB,WAAW,CAAC,MAAM,EAAE;IACxC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,OAAO,EAAE;QACP,QAAQ,EAAE,uBAAuB,CAAC;QAClC,UAAU,EA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gB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEnC,IAAI,WAAW,CAAC,eAAe,CAAC,mBAAmB,EAAE,CAAC;YACpD,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;gBAC3D,OAAO,EAAE;oBACP,WAAW,EAAE,WAAW,CAAC,IAAI;oBAC7B,UAAU,EAAE,WAAW;oBACvB,mBAAmB,EAAE,WAAW,CAAC,eAAe,CAAC,mBAAmB;iBACrE;gBACD,OAAO,EAAE,EAAE,UAAU,EAAE;aACxB,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 { PackageDefinitionsCache } from '@ms-cloudpack/common-types';\nimport { type ResolveMap } from '@ms-cloudpack/package-utilities';\nimport objectHash from 'object-hash';\nimport { getPackageHashEntries, type PackageHashEntries } from './getPackageHashEntries.js';\nimport { getInlinedDependenciesPaths } from './getInlinedDependenciesPaths.js';\nimport type { PackagePatchesCache } from './PackagePatchesCache.js';\nimport { hashVersion } from './hashVersion.js';\nimport type { HashFunctionOptions } from './types/HashFunction.js';\nimport type { BundlerCapabilitiesCache } from './BundlerCapabilitiesCache.js';\n\nlet totalTime = 0;\n\nexport async function hashPackage(params: {\n input: HashFunctionOptions;\n context: {\n packages: PackageDefinitionsCache;\n resolveMap: ResolveMap;\n patches: PackagePatchesCache;\n bundlerCapabilitiesCache: BundlerCapabilitiesCache;\n };\n}): Promise<string> {\n const start = performance.now();\n const { input, context } = params;\n const { packagePath, isSourceHashingEnabled } = input;\n const { resolveMap, packages, patches, bundlerCapabilitiesCache } = context;\n const hashEntriesArray: PackageHashEntries[] = [];\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, patches, bundlerCapabilitiesCache },\n });\n\n hashEntriesArray.push(hashEntries);\n\n if (hashEntries.packageSettings.inlinedDependencies) {\n const inlinedDependenciesPaths = getInlinedDependenciesPaths({\n options: {\n packageName: hashEntries.name,\n definition: hashEntries,\n inlinedDependencies: hashEntries.packageSettings.inlinedDependencies,\n },\n context: { 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
+ {"version":3,"file":"hashPackage.js","sourceRoot":"","sources":["../src/hashPackage.ts"],"names":[],"mappings":"AACA,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAA2B,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC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G,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 { PackageDefinitionsCache, ResolveMap } from '@ms-cloudpack/common-types';\nimport objectHash from 'object-hash';\nimport { getPackageHashEntries, type PackageHashEntries } from './getPackageHashEntries.js';\nimport { getInlinedDependenciesPaths } from './getInlinedDependenciesPaths.js';\nimport type { PackagePatchesCache } from './PackagePatchesCache.js';\nimport { hashVersion } from './hashVersion.js';\nimport type { HashFunctionOptions } from './types/HashFunction.js';\nimport type { BundlerCapabilitiesCache } from './BundlerCapabilitiesCache.js';\n\nlet totalTime = 0;\n\nexport async function hashPackage(params: {\n input: HashFunctionOptions;\n context: {\n packages: PackageDefinitionsCache;\n resolveMap: ResolveMap;\n patches: PackagePatchesCache;\n bundlerCapabilitiesCache: BundlerCapabilitiesCache;\n };\n}): Promise<string> {\n const start = performance.now();\n const { input, context } = params;\n const { packagePath, isSourceHashingEnabled } = input;\n const { resolveMap, packages, patches, bundlerCapabilitiesCache } = context;\n const hashEntriesArray: PackageHashEntries[] = [];\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, patches, bundlerCapabilitiesCache },\n });\n\n hashEntriesArray.push(hashEntries);\n\n if (hashEntries.packageSettings.inlinedDependencies) {\n const inlinedDependenciesPaths = getInlinedDependenciesPaths({\n options: {\n packageName: hashEntries.name,\n definition: hashEntries,\n inlinedDependencies: hashEntries.packageSettings.inlinedDependencies,\n },\n context: { 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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/package-hashes",
3
- "version": "0.7.15",
3
+ "version": "0.7.17",
4
4
  "description": "Utilities for hashing packages.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,10 +14,11 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/common-types": "^0.23.6",
18
- "@ms-cloudpack/config": "^0.33.3",
19
- "@ms-cloudpack/package-utilities": "^10.4.2",
20
- "@ms-cloudpack/path-string-parsing": "^1.2.5",
17
+ "@ms-cloudpack/common-types": "^0.23.7",
18
+ "@ms-cloudpack/config": "^0.33.5",
19
+ "@ms-cloudpack/package-utilities": "^11.0.1",
20
+ "@ms-cloudpack/path-string-parsing": "^1.2.6",
21
+ "@ms-cloudpack/path-utilities": "^2.8.0",
21
22
  "fast-glob": "^3.2.12",
22
23
  "glob-hasher": "^1.4.2",
23
24
  "object-hash": "^3.0.0"
@@ -1,11 +0,0 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.11"
9
- }
10
- ]
11
- }