@ms-cloudpack/package-hashes 0.3.12 → 0.3.14

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 +1 @@
1
- {"version":3,"file":"PackagePatchesCache.d.ts","sourceRoot":"","sources":["../src/PackagePatchesCache.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,MAAM,WAAW,sBAAsB;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAaD;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,YAAW,cAAc;IAG5C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,QAAQ,CAAmG;gBAEtF,QAAQ,EAAE,sBAAsB;IAE7D,OAAO,CAAC,MAAM;IAId;;OAEG;YACW,mBAAmB;IAgCjC;;;;;OAKG;IACU,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAMlE"}
1
+ {"version":3,"file":"PackagePatchesCache.d.ts","sourceRoot":"","sources":["../src/PackagePatchesCache.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,WAAW,sBAAsB;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,YAAW,cAAc;IAG5C,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,QAAQ,CAAmG;gBAEtF,QAAQ,EAAE,sBAAsB;IAE7D,OAAO,CAAC,MAAM;IAId;;OAEG;YACW,mBAAmB;IAgCjC;;;;;OAKG;IACU,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAMlE"}
@@ -1,18 +1,7 @@
1
- import { parsePatchFilePath } from './parsePatchFilePath.js';
1
+ import { findProjectRoot } from '@ms-cloudpack/package-utilities';
2
2
  import glob from 'fast-glob';
3
- import { findGitRoot } from 'workspace-tools';
4
3
  import path from 'path';
5
- /**
6
- * Gets the root path of the repo. If the repo is not a git repo, it will return undefined.
7
- */
8
- function getGitRepoPathSafe(currentPath) {
9
- try {
10
- return findGitRoot(currentPath);
11
- }
12
- catch {
13
- return undefined;
14
- }
15
- }
4
+ import { parsePatchFilePath } from './parsePatchFilePath.js';
16
5
  /**
17
6
  * PackagePatchesCache is a class responsible for managing a cache of patched packages
18
7
  * by reading and storing information about patch files in the patches folder at the root of the repo.
@@ -35,7 +24,7 @@ export class PackagePatchesCache {
35
24
  async loadPatchedPackages() {
36
25
  this._patches = {};
37
26
  // get the repo root
38
- const rootPath = this.settings.globRootPath || getGitRepoPathSafe(process.cwd());
27
+ const rootPath = this.settings.globRootPath || findProjectRoot(process.cwd());
39
28
  if (!rootPath) {
40
29
  console.info('Could not find the root of the repo. Skipping loading patched packages.');
41
30
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"PackagePatchesCache.js","sourceRoot":"","sources":["../src/PackagePatchesCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB;;GAEG;AACH,SAAS,kBAAkB,CAAC,WAAmB;IAC7C,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,WAAW,CAAC,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IAG9B,YAA6B,QAAgC;QAAhC,aAAQ,GAAR,QAAQ,CAAwB;IAAG,CAAC;IAEz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AQ,EAAE,CAAC;YACnB,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACnC,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF","sourcesContent":["import { parsePatchFilePath } from './parsePatchFilePath.js';\nimport glob from 'fast-glob';\nimport type { PackagePatches } from './types/PackagePatches.js';\nimport { findGitRoot } from 'workspace-tools';\nimport path from 'path';\n\nexport interface PackagePatchesSettings {\n globRootPath?: string;\n globPattern?: string;\n}\n\n/**\n * Gets the root path of the repo. If the repo is not a git repo, it will return undefined.\n */\nfunction getGitRepoPathSafe(currentPath: string) {\n try {\n return findGitRoot(currentPath);\n } catch {\n return undefined;\n }\n}\n\n/**\n * PackagePatchesCache is a class responsible for managing a cache of patched packages\n * by reading and storing information about patch files in the patches folder at the root of the repo.\n * It provides a method to retrieve the path to the patch file for a given package\n * based on the package name and version.\n *\n * @class PackagePatchesCache\n * @implements {PackagePatches}\n */\nexport class PackagePatchesCache implements PackagePatches {\n private _patches: Record<`${string}@${string}` /* ${packageName}@${version} */, string /* filePath */> | 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 this._patches = {};\n\n // get the repo root\n const rootPath = this.settings.globRootPath || getGitRepoPathSafe(process.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)] = normalizedPath;\n } catch (e) {\n console.warn(`Invalid patch file: ${absoluteFilePath}`);\n }\n }\n }\n\n /**\n * Gets the path to 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 - Path to the patch file if the package has been patched, undefined otherwise.\n */\n public async getPackagePatch(packageName: string, version: string) {\n if (!this._patches) {\n await this.loadPatchedPackages();\n }\n return this._patches?.[this.getKey(packageName, version)];\n }\n}\n"]}
1
+ {"version":3,"file":"PackagePatchesCache.js","sourceRoot":"","sources":["../src/PackagePatchesCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAQ7D;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IAG9B,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,CAAC,QAAQ,GAAG,EAAE,CAAC;QAEnB,oBAAoB;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAE9E,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;YACxF,OAAO;QACT,CAAC;QAED,sCAAsC;QACtC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,iBAAiB,EAAE;YAC5E,GAAG,EAAE,QAAQ;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,KAAK,MAAM,gBAAgB,IAAI,UAAU,EAAE,CAAC;YAC1C,IAAI,CAAC;gBACH,MAAM,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;gBAExD,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;gBAEpE,OAAO,CAAC,KAAK,CAAC,iCAAiC,WAAW,IAAI,OAAO,EAAE,CAAC,CAAC;gBAEzE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,GAAG,cAAc,CAAC;YACpE,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,uBAAuB,gBAAgB,EAAE,CAAC,CAAC;YAC1D,CAAC;QACH,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;QACD,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAC5D,CAAC;CACF","sourcesContent":["import { findProjectRoot } from '@ms-cloudpack/package-utilities';\nimport glob from 'fast-glob';\nimport path from 'path';\nimport { parsePatchFilePath } from './parsePatchFilePath.js';\nimport type { PackagePatches } from './types/PackagePatches.js';\n\nexport interface PackagePatchesSettings {\n globRootPath?: string;\n globPattern?: string;\n}\n\n/**\n * PackagePatchesCache is a class responsible for managing a cache of patched packages\n * by reading and storing information about patch files in the patches folder at the root of the repo.\n * It provides a method to retrieve the path to the patch file for a given package\n * based on the package name and version.\n *\n * @class PackagePatchesCache\n * @implements {PackagePatches}\n */\nexport class PackagePatchesCache implements PackagePatches {\n private _patches: Record<`${string}@${string}` /* ${packageName}@${version} */, string /* filePath */> | 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 this._patches = {};\n\n // get the repo root\n const rootPath = this.settings.globRootPath || findProjectRoot(process.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)] = normalizedPath;\n } catch (e) {\n console.warn(`Invalid patch file: ${absoluteFilePath}`);\n }\n }\n }\n\n /**\n * Gets the path to 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 - Path to the patch file if the package has been patched, undefined otherwise.\n */\n public async getPackagePatch(packageName: string, version: string) {\n if (!this._patches) {\n await this.loadPatchedPackages();\n }\n return this._patches?.[this.getKey(packageName, version)];\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/package-hashes",
3
- "version": "0.3.12",
3
+ "version": "0.3.14",
4
4
  "description": "Utilities for hashing packages.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,14 +14,13 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/bundler-types": "^0.23.10",
18
- "@ms-cloudpack/package-utilities": "^5.7.9",
19
- "@ms-cloudpack/config": "^0.17.16",
20
- "@ms-cloudpack/config-types": "^0.4.1",
17
+ "@ms-cloudpack/bundler-types": "^0.23.12",
18
+ "@ms-cloudpack/package-utilities": "^5.8.0",
19
+ "@ms-cloudpack/config": "^0.17.18",
20
+ "@ms-cloudpack/config-types": "^0.4.3",
21
21
  "fast-glob": "^3.2.12",
22
22
  "glob-hasher": "^1.2.1",
23
- "object-hash": "^3.0.0",
24
- "workspace-tools": "^0.36.4"
23
+ "object-hash": "^3.0.0"
25
24
  },
26
25
  "devDependencies": {
27
26
  "@ms-cloudpack/eslint-plugin-internal": "*",