@ms-cloudpack/package-hashes 0.7.46 → 0.8.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.
@@ -1 +1 @@
1
- {"version":3,"file":"getSourceHash.d.ts","sourceRoot":"","sources":["../src/getSourceHash.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAKnC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AAEhD;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAClC,GAAG,OAAO,CAAC,SAAS,CAAC,CA6BrB"}
1
+ {"version":3,"file":"getSourceHash.d.ts","sourceRoot":"","sources":["../src/getSourceHash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGnC,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC;AAEhD;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;CAClC,GAAG,OAAO,CAAC,SAAS,CAAC,CAoBrB"}
@@ -1,9 +1,7 @@
1
1
  import { appConfigFileName, generatedConfigFileName } from '@ms-cloudpack/config';
2
2
  import glob from 'fast-glob';
3
- import { existsSync } from 'fs';
4
3
  import { hash } from 'glob-hasher';
5
- import path from 'path';
6
- const excludeNodeModules = '!**/node_modules/**';
4
+ import { sourceFilesGlobs } from '@ms-cloudpack/path-utilities';
7
5
  /**
8
6
  * Get the hash of the source files in a package.
9
7
  * - If there is an `src` folder, hash the files in that folder, the `*.json` files and the `inputPaths`.
@@ -13,19 +11,8 @@ const excludeNodeModules = '!**/node_modules/**';
13
11
  export async function getSourceHash(options) {
14
12
  const start = performance.now();
15
13
  const { packagePath, inputPaths } = options;
16
- let patterns;
17
- if (inputPaths?.length) {
18
- // Use the inputPaths if they are defined
19
- patterns = inputPaths;
20
- }
21
- else if (existsSync(path.join(packagePath, 'src'))) {
22
- // Otherwise, use the src folder (and *.json files) if it exists
23
- patterns = ['src/**', '*.json', excludeNodeModules];
24
- }
25
- else {
26
- // Otherwise, use all files except node_modules
27
- patterns = ['**', excludeNodeModules];
28
- }
14
+ // Use the inputPaths if they are defined, otherwise use the default patterns
15
+ const patterns = inputPaths?.length ? inputPaths : sourceFilesGlobs;
29
16
  const files = await glob(patterns, {
30
17
  cwd: packagePath,
31
18
  // We want to ignore the app config and generated config files because they are not part of the source code.
@@ -1 +1 @@
1
- {"version":3,"file":"getSourceHash.js","sourceRoot":"","sources":["../src/getSourceHash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAClF,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;AAIjD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAInC;IACC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEhC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC5C,IAAI,QAAkB,CAAC;IACvB,IAAI,UAAU,EAAE,MAAM,EAAE,CAAC;QACvB,yCAAyC;QACzC,QAAQ,GAAG,UAAU,CAAC;IACxB,CAAC;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACrD,gEAAgE;QAChE,QAAQ,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC;IACtD,CAAC;SAAM,CAAC;QACN,+CAA+C;QAC/C,QAAQ,GAAG,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE;QACjC,GAAG,EAAE,WAAW;QAChB,4GAA4G;QAC5G,wFAAwF;QACxF,qFAAqF;QACrF,MAAM,EAAE,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;KACrD,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 { appConfigFileName, generatedConfigFileName } from '@ms-cloudpack/config';\nimport glob from 'fast-glob';\nimport { existsSync } from 'fs';\nimport { hash } from 'glob-hasher';\nimport path from 'path';\n\nconst excludeNodeModules = '!**/node_modules/**';\n\nexport type FilesHash = ReturnType<typeof hash>;\n\n/**\n * Get the hash of the source files in a package.\n * - If there is an `src` folder, hash the files in that folder, the `*.json` files and the `inputPaths`.\n * - If there are `inputPaths`, hash only those files.\n * - Otherwise, hash all files except `node_modules`.\n */\nexport async function getSourceHash(options: {\n packagePath: string;\n /** Input paths from the package settings */\n inputPaths: string[] | undefined;\n}): Promise<FilesHash> {\n const start = performance.now();\n\n const { packagePath, inputPaths } = options;\n let patterns: string[];\n if (inputPaths?.length) {\n // Use the inputPaths if they are defined\n patterns = inputPaths;\n } else if (existsSync(path.join(packagePath, 'src'))) {\n // Otherwise, use the src folder (and *.json files) if it exists\n patterns = ['src/**', '*.json', excludeNodeModules];\n } else {\n // Otherwise, use all files except node_modules\n patterns = ['**', excludeNodeModules];\n }\n\n const files = await glob(patterns, {\n cwd: packagePath,\n // We want to ignore the app config and generated config files because they are not part of the source code.\n // Ignoring the generated config is especially important because it changes during init,\n // and it would invalidate the cache for the entry package with the generated config.\n ignore: [appConfigFileName, generatedConfigFileName],\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"]}
1
+ {"version":3,"file":"getSourceHash.js","sourceRoot":"","sources":["../src/getSourceHash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAIhE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAInC;IACC,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAEhC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC5C,6EAA6E;IAC7E,MAAM,QAAQ,GAAG,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC;IAEpE,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE;QACjC,GAAG,EAAE,WAAW;QAChB,4GAA4G;QAC5G,wFAAwF;QACxF,qFAAqF;QACrF,MAAM,EAAE,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;KACrD,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 { appConfigFileName, generatedConfigFileName } from '@ms-cloudpack/config';\nimport glob from 'fast-glob';\nimport { hash } from 'glob-hasher';\nimport { sourceFilesGlobs } from '@ms-cloudpack/path-utilities';\n\nexport type FilesHash = ReturnType<typeof hash>;\n\n/**\n * Get the hash of the source files in a package.\n * - If there is an `src` folder, hash the files in that folder, the `*.json` files and the `inputPaths`.\n * - If there are `inputPaths`, hash only those files.\n * - Otherwise, hash all files except `node_modules`.\n */\nexport async function getSourceHash(options: {\n packagePath: string;\n /** Input paths from the package settings */\n inputPaths: string[] | undefined;\n}): Promise<FilesHash> {\n const start = performance.now();\n\n const { packagePath, inputPaths } = options;\n // Use the inputPaths if they are defined, otherwise use the default patterns\n const patterns = inputPaths?.length ? inputPaths : sourceFilesGlobs;\n\n const files = await glob(patterns, {\n cwd: packagePath,\n // We want to ignore the app config and generated config files because they are not part of the source code.\n // Ignoring the generated config is especially important because it changes during init,\n // and it would invalidate the cache for the entry package with the generated config.\n ignore: [appConfigFileName, generatedConfigFileName],\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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/package-hashes",
3
- "version": "0.7.46",
3
+ "version": "0.8.0",
4
4
  "description": "Utilities for hashing packages.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,10 +15,10 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@ms-cloudpack/common-types": "^0.24.16",
18
- "@ms-cloudpack/config": "^0.34.1",
19
- "@ms-cloudpack/package-utilities": "^12.3.1",
18
+ "@ms-cloudpack/config": "^0.35.0",
19
+ "@ms-cloudpack/package-utilities": "^12.3.3",
20
20
  "@ms-cloudpack/path-string-parsing": "^1.2.7",
21
- "@ms-cloudpack/path-utilities": "^3.0.13",
21
+ "@ms-cloudpack/path-utilities": "^3.1.0",
22
22
  "fast-glob": "^3.2.12",
23
23
  "glob-hasher": "^1.4.2",
24
24
  "object-hash": "^3.0.0"