react-native-platform-override 1.9.30 → 1.9.31

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.
@@ -35,7 +35,7 @@ function normalizeContent(content, opts) {
35
35
  */
36
36
  class Hasher {
37
37
  constructor(hashOpts) {
38
- this.hash = crypto_1.default.createHash('sha1');
38
+ this.hash = crypto_1.default.createHash('sha1'); // CodeQL [js/weak-hashes] Hash is used for file name mapping as a convenience. Decryption does not leave any data vulnerable.
39
39
  this.hashOpts = hashOpts || {};
40
40
  }
41
41
  feedContent(content) {
@@ -1 +1 @@
1
- {"version":3,"file":"Hash.js","sourceRoot":"","sources":["../src/Hash.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,oDAA4B;AAC5B,gDAAwB;AACxB,2CAAoD;AAEpD,oDAA4B;AAU5B;;GAEG;AACH,SAAS,gBAAgB,CACvB,OAAwB,EACxB,IAAc;IAEd,IACE,IAAI,CAAC,aAAa,KAAK,MAAM;QAC7B,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,IAAA,gBAAM,EAAC,OAAO,CAAC,CAAC,EACjD;QACA,OAAO,OAAO,CAAC;KAChB;IAED,QAAQ,IAAI,CAAC,aAAa,IAAI,aAAa,EAAE;QAC3C,KAAK,aAAa;YAChB,4CAA4C;YAC5C,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAEhE,KAAK,YAAY;YACf,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC/D;AACH,CAAC;AAED;;GAEG;AACH,MAAa,MAAM;IAIjB,YAAY,QAAmB;QAC7B,IAAI,CAAC,IAAI,GAAG,gBAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ,G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,uDAAuD;YACvD,MAAM,uBAAuB,GAAG,IAAA,oBAAQ,EACtC,cAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAA,yBAAa,EAAC,IAAI,CAAC,CAAC,CACzC,CAAC;YACF,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;SAC7C;QACD,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;KACxB;AACH,CAAC;AA5BD,kDA4BC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport crypto from 'crypto';\nimport path from 'path';\nimport {normalizePath, unixPath} from './PathUtils';\nimport FileRepository from './FileRepository';\nimport isUtf8 from 'isutf8';\n\nexport type HashOpts = {\n /**\n * What differences between files should we be insensitive to when generating\n * a hash? Defaults to line-ending insensitivity\n */\n insensitivity?: 'none' | 'line-ending' | 'whitespace';\n};\n\n/**\n * Normalize content according to insensitivity rules\n */\nfunction normalizeContent(\n content: string | Buffer,\n opts: HashOpts,\n): string | Buffer {\n if (\n opts.insensitivity === 'none' ||\n (typeof content !== 'string' && !isUtf8(content))\n ) {\n return content;\n }\n\n switch (opts.insensitivity || 'line-ending') {\n case 'line-ending':\n // Convert to CRLF for legacy hash stability\n return content.toString('utf8').replace(/(?<!\\r)\\n/g, '\\r\\n');\n\n case 'whitespace':\n return content.toString('utf8').trim().replace(/\\s+/g, ' ');\n }\n}\n\n/**\n * Creates a hash from content, attempting to normalize for line-feeds\n */\nexport class Hasher {\n private readonly hash: crypto.Hash;\n private readonly hashOpts: HashOpts;\n\n constructor(hashOpts?: HashOpts) {\n this.hash = crypto.createHash('sha1');\n this.hashOpts = hashOpts || {};\n }\n\n feedContent(content: string | Buffer): Hasher {\n this.hash.update(normalizeContent(content, this.hashOpts));\n return this;\n }\n\n digest(): string {\n return this.hash.digest('hex');\n }\n}\n\n/**\n * Convenience helper which hashes a single buffer\n */\nexport function hashContent(content: string | Buffer, opts?: HashOpts): string {\n return new Hasher(opts).feedContent(content).digest();\n}\n\n/**\n * Helper to hash a file/directory belonging to a repository\n */\nexport async function hashFileOrDirectory(\n name: string,\n repo: FileRepository,\n opts?: HashOpts,\n): Promise<string | null> {\n const type = await repo.stat(name);\n if (type === 'none') {\n return null;\n }\n\n if (type === 'file') {\n return hashContent((await repo.readFile(name))!, opts);\n } else {\n const hasher = new Hasher(opts);\n const subfiles = await repo.listFiles([`${unixPath(name)}/**`]);\n\n for (const file of subfiles.sort()) {\n const contents = await repo.readFile(file);\n hasher.feedContent(contents!);\n\n // Incorporate the filename to detect if renames happen\n const platformIndependentPath = unixPath(\n path.relative(name, normalizePath(file)),\n );\n hasher.feedContent(platformIndependentPath);\n }\n return hasher.digest();\n }\n}\n"]}
1
+ {"version":3,"file":"Hash.js","sourceRoot":"","sources":["../src/Hash.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;AAEH,oDAA4B;AAC5B,gDAAwB;AACxB,2CAAoD;AAEpD,oDAA4B;AAU5B;;GAEG;AACH,SAAS,gBAAgB,CACvB,OAAwB,EACxB,IAAc;IAEd,IACE,IAAI,CAAC,aAAa,KAAK,MAAM;QAC7B,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,IAAA,gBAAM,EAAC,OAAO,CAAC,CAAC,EACjD;QACA,OAAO,OAAO,CAAC;KAChB;IAED,QAAQ,IAAI,CAAC,aAAa,IAAI,aAAa,EAAE;QAC3C,KAAK,aAAa;YAChB,4CAA4C;YAC5C,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAEhE,KAAK,YAAY;YACf,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC/D;AACH,CAAC;AAED;;GAEG;AACH,MAAa,MAAM;IAIjB,YAAY,QAAmB;QAC7B,IAAI,CAAC,IAAI,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AC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC3C,MAAM,CAAC,WAAW,CAAC,QAAS,CAAC,CAAC;YAE9B,uDAAuD;YACvD,MAAM,uBAAuB,GAAG,IAAA,oBAAQ,EACtC,cAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAA,yBAAa,EAAC,IAAI,CAAC,CAAC,CACzC,CAAC;YACF,MAAM,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;SAC7C;QACD,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;KACxB;AACH,CAAC;AA5BD,kDA4BC","sourcesContent":["/**\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * @format\n */\n\nimport crypto from 'crypto';\nimport path from 'path';\nimport {normalizePath, unixPath} from './PathUtils';\nimport FileRepository from './FileRepository';\nimport isUtf8 from 'isutf8';\n\nexport type HashOpts = {\n /**\n * What differences between files should we be insensitive to when generating\n * a hash? Defaults to line-ending insensitivity\n */\n insensitivity?: 'none' | 'line-ending' | 'whitespace';\n};\n\n/**\n * Normalize content according to insensitivity rules\n */\nfunction normalizeContent(\n content: string | Buffer,\n opts: HashOpts,\n): string | Buffer {\n if (\n opts.insensitivity === 'none' ||\n (typeof content !== 'string' && !isUtf8(content))\n ) {\n return content;\n }\n\n switch (opts.insensitivity || 'line-ending') {\n case 'line-ending':\n // Convert to CRLF for legacy hash stability\n return content.toString('utf8').replace(/(?<!\\r)\\n/g, '\\r\\n');\n\n case 'whitespace':\n return content.toString('utf8').trim().replace(/\\s+/g, ' ');\n }\n}\n\n/**\n * Creates a hash from content, attempting to normalize for line-feeds\n */\nexport class Hasher {\n private readonly hash: crypto.Hash;\n private readonly hashOpts: HashOpts;\n\n constructor(hashOpts?: HashOpts) {\n this.hash = crypto.createHash('sha1'); // CodeQL [js/weak-hashes] Hash is used for file name mapping as a convenience. Decryption does not leave any data vulnerable.\n this.hashOpts = hashOpts || {};\n }\n\n feedContent(content: string | Buffer): Hasher {\n this.hash.update(normalizeContent(content, this.hashOpts));\n return this;\n }\n\n digest(): string {\n return this.hash.digest('hex');\n }\n}\n\n/**\n * Convenience helper which hashes a single buffer\n */\nexport function hashContent(content: string | Buffer, opts?: HashOpts): string {\n return new Hasher(opts).feedContent(content).digest();\n}\n\n/**\n * Helper to hash a file/directory belonging to a repository\n */\nexport async function hashFileOrDirectory(\n name: string,\n repo: FileRepository,\n opts?: HashOpts,\n): Promise<string | null> {\n const type = await repo.stat(name);\n if (type === 'none') {\n return null;\n }\n\n if (type === 'file') {\n return hashContent((await repo.readFile(name))!, opts);\n } else {\n const hasher = new Hasher(opts);\n const subfiles = await repo.listFiles([`${unixPath(name)}/**`]);\n\n for (const file of subfiles.sort()) {\n const contents = await repo.readFile(file);\n hasher.feedContent(contents!);\n\n // Incorporate the filename to detect if renames happen\n const platformIndependentPath = unixPath(\n path.relative(name, normalizePath(file)),\n );\n hasher.feedContent(platformIndependentPath);\n }\n return hasher.digest();\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-platform-override",
3
- "version": "1.9.30",
3
+ "version": "1.9.31",
4
4
  "description": "react-native-platform-override offers CLI tools to manage Javascript overrides in out-of-tree React Native platforms",
5
5
  "license": "MIT",
6
6
  "main": "./lib-commonjs/Api.js",
@@ -22,8 +22,8 @@
22
22
  "react-native-platform-override": "./bin.js"
23
23
  },
24
24
  "dependencies": {
25
- "@react-native-windows/fs": "^0.0.0-canary.41",
26
- "@react-native-windows/package-utils": "^0.0.0-canary.67",
25
+ "@react-native-windows/fs": "^0.0.0-canary.42",
26
+ "@react-native-windows/package-utils": "^0.0.0-canary.68",
27
27
  "@typescript-eslint/eslint-plugin": "^5.30.5",
28
28
  "@typescript-eslint/parser": "^5.57.1",
29
29
  "async": "^3.2.3",
@@ -46,9 +46,9 @@
46
46
  "@babel/core": "^7.20.0",
47
47
  "@babel/preset-env": "^7.20.0",
48
48
  "@babel/preset-typescript": "^7.8.3",
49
- "@rnw-scripts/eslint-config": "1.2.13",
49
+ "@rnw-scripts/eslint-config": "1.2.14",
50
50
  "@rnw-scripts/jest-unittest-config": "1.5.8",
51
- "@rnw-scripts/just-task": "2.3.29",
51
+ "@rnw-scripts/just-task": "2.3.30",
52
52
  "@rnw-scripts/ts-config": "2.0.5",
53
53
  "@types/async": "^3.2.5",
54
54
  "@types/chalk": "^2.2.0",