react-native-platform-override 0.4.6 → 0.81.0-preview.10
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/bin.js +1 -2
- package/lib-commonjs/Api.d.ts +57 -56
- package/lib-commonjs/Api.js +187 -167
- package/lib-commonjs/Api.js.map +1 -1
- package/lib-commonjs/BatchingQueue.d.ts +15 -15
- package/lib-commonjs/BatchingQueue.js +57 -57
- package/lib-commonjs/BatchingQueue.js.map +1 -1
- package/lib-commonjs/Cli.d.ts +7 -7
- package/lib-commonjs/Cli.js +323 -291
- package/lib-commonjs/Cli.js.map +1 -1
- package/lib-commonjs/CrossProcessLock.d.ts +44 -44
- package/lib-commonjs/CrossProcessLock.js +147 -144
- package/lib-commonjs/CrossProcessLock.js.map +1 -1
- package/lib-commonjs/DiffStrategy.d.ts +24 -24
- package/lib-commonjs/DiffStrategy.js +34 -34
- package/lib-commonjs/DiffStrategy.js.map +1 -1
- package/lib-commonjs/FileRepository.d.ts +63 -62
- package/lib-commonjs/FileRepository.js +21 -21
- package/lib-commonjs/FileRepository.js.map +1 -1
- package/lib-commonjs/FileSearch.d.ts +21 -21
- package/lib-commonjs/FileSearch.js +77 -91
- package/lib-commonjs/FileSearch.js.map +1 -1
- package/lib-commonjs/FileSystemRepository.d.ts +21 -20
- package/lib-commonjs/FileSystemRepository.js +62 -59
- package/lib-commonjs/FileSystemRepository.js.map +1 -1
- package/lib-commonjs/GitReactFileRepository.d.ts +57 -58
- package/lib-commonjs/GitReactFileRepository.js +202 -208
- package/lib-commonjs/GitReactFileRepository.js.map +1 -1
- package/lib-commonjs/Hash.d.ts +34 -33
- package/lib-commonjs/Hash.js +81 -81
- package/lib-commonjs/Hash.js.map +1 -1
- package/lib-commonjs/Manifest.d.ts +80 -80
- package/lib-commonjs/Manifest.js +157 -154
- package/lib-commonjs/Manifest.js.map +1 -1
- package/lib-commonjs/Override.d.ts +182 -182
- package/lib-commonjs/Override.js +248 -245
- package/lib-commonjs/Override.js.map +1 -1
- package/lib-commonjs/OverrideFactory.d.ts +33 -33
- package/lib-commonjs/OverrideFactory.js +85 -70
- package/lib-commonjs/OverrideFactory.js.map +1 -1
- package/lib-commonjs/OverridePrompt.d.ts +30 -30
- package/lib-commonjs/OverridePrompt.js +130 -104
- package/lib-commonjs/OverridePrompt.js.map +1 -1
- package/lib-commonjs/PackageUtils.d.ts +15 -15
- package/lib-commonjs/PackageUtils.js +40 -38
- package/lib-commonjs/PackageUtils.js.map +1 -1
- package/lib-commonjs/PathUtils.d.ts +14 -14
- package/lib-commonjs/PathUtils.js +31 -28
- package/lib-commonjs/PathUtils.js.map +1 -1
- package/lib-commonjs/Serialized.d.ts +158 -158
- package/lib-commonjs/Serialized.js +145 -119
- package/lib-commonjs/Serialized.js.map +1 -1
- package/lib-commonjs/UpgradeStrategy.d.ts +39 -39
- package/lib-commonjs/UpgradeStrategy.js +102 -99
- package/lib-commonjs/UpgradeStrategy.js.map +1 -1
- package/lib-commonjs/ValidationStrategy.d.ts +57 -57
- package/lib-commonjs/ValidationStrategy.js +124 -124
- package/lib-commonjs/ValidationStrategy.js.map +1 -1
- package/lib-commonjs/refFromVersion.d.ts +10 -0
- package/lib-commonjs/refFromVersion.js +99 -0
- package/lib-commonjs/refFromVersion.js.map +1 -0
- package/lib-commonjs/scripts/generateManifest.d.ts +7 -7
- package/lib-commonjs/scripts/generateManifest.js +196 -170
- package/lib-commonjs/scripts/generateManifest.js.map +1 -1
- package/lib-commonjs/scripts/hashFile.d.ts +7 -7
- package/lib-commonjs/scripts/hashFile.js +17 -14
- package/lib-commonjs/scripts/hashFile.js.map +1 -1
- package/lib-commonjs/scripts/testLocks.d.ts +1 -1
- package/lib-commonjs/scripts/testLocks.js +29 -26
- package/lib-commonjs/scripts/testLocks.js.map +1 -1
- package/package.json +53 -43
- package/CHANGELOG.json +0 -524
- package/CHANGELOG.md +0 -230
package/lib-commonjs/Hash.d.ts
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
/// <reference types="node" />
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
private readonly
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
/// <reference types="node" />
|
|
8
|
+
/// <reference types="node" />
|
|
9
|
+
import FileRepository from './FileRepository';
|
|
10
|
+
export type HashOpts = {
|
|
11
|
+
/**
|
|
12
|
+
* What differences between files should we be insensitive to when generating
|
|
13
|
+
* a hash? Defaults to line-ending insensitivity
|
|
14
|
+
*/
|
|
15
|
+
insensitivity?: 'none' | 'line-ending' | 'whitespace';
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Creates a hash from content, attempting to normalize for line-feeds
|
|
19
|
+
*/
|
|
20
|
+
export declare class Hasher {
|
|
21
|
+
private readonly hash;
|
|
22
|
+
private readonly hashOpts;
|
|
23
|
+
constructor(hashOpts?: HashOpts);
|
|
24
|
+
feedContent(content: string | Buffer): Hasher;
|
|
25
|
+
digest(): string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Convenience helper which hashes a single buffer
|
|
29
|
+
*/
|
|
30
|
+
export declare function hashContent(content: string | Buffer, opts?: HashOpts): string;
|
|
31
|
+
/**
|
|
32
|
+
* Helper to hash a file/directory belonging to a repository
|
|
33
|
+
*/
|
|
34
|
+
export declare function hashFileOrDirectory(name: string, repo: FileRepository, opts?: HashOpts): Promise<string | null>;
|
package/lib-commonjs/Hash.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) Microsoft Corporation.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*
|
|
6
|
-
* @format
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
case '
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates a hash from content, attempting to normalize for line-feeds
|
|
35
|
-
*/
|
|
36
|
-
class Hasher {
|
|
37
|
-
constructor(hashOpts) {
|
|
38
|
-
this.hash =
|
|
39
|
-
this.hashOpts = hashOpts || {};
|
|
40
|
-
}
|
|
41
|
-
feedContent(content) {
|
|
42
|
-
this.hash.update(normalizeContent(content, this.hashOpts));
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
digest() {
|
|
46
|
-
return this.hash.digest('hex');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.Hasher = Hasher;
|
|
50
|
-
/**
|
|
51
|
-
* Convenience helper which hashes a single buffer
|
|
52
|
-
*/
|
|
53
|
-
function hashContent(content, opts) {
|
|
54
|
-
return new Hasher(opts).feedContent(content).digest();
|
|
55
|
-
}
|
|
56
|
-
exports.hashContent = hashContent;
|
|
57
|
-
/**
|
|
58
|
-
* Helper to hash a file/directory belonging to a repository
|
|
59
|
-
*/
|
|
60
|
-
async function hashFileOrDirectory(name, repo, opts) {
|
|
61
|
-
const type = await repo.stat(name);
|
|
62
|
-
if (type === 'none') {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
if (type === 'file') {
|
|
66
|
-
return hashContent((await repo.readFile(name)), opts);
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
const hasher = new Hasher(opts);
|
|
70
|
-
const subfiles = await repo.listFiles([`${PathUtils_1.unixPath(name)}/**`]);
|
|
71
|
-
for (const file of subfiles.sort()) {
|
|
72
|
-
const contents = await repo.readFile(file);
|
|
73
|
-
hasher.feedContent(contents);
|
|
74
|
-
// Incorporate the filename to detect if renames happen
|
|
75
|
-
const platformIndependentPath = PathUtils_1.unixPath(
|
|
76
|
-
hasher.feedContent(platformIndependentPath);
|
|
77
|
-
}
|
|
78
|
-
return hasher.digest();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.hashFileOrDirectory = hashFileOrDirectory;
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*
|
|
6
|
+
* @format
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.hashFileOrDirectory = exports.hashContent = exports.Hasher = void 0;
|
|
13
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const PathUtils_1 = require("./PathUtils");
|
|
16
|
+
const isutf8_1 = __importDefault(require("isutf8"));
|
|
17
|
+
/**
|
|
18
|
+
* Normalize content according to insensitivity rules
|
|
19
|
+
*/
|
|
20
|
+
function normalizeContent(content, opts) {
|
|
21
|
+
if (opts.insensitivity === 'none' ||
|
|
22
|
+
(typeof content !== 'string' && !(0, isutf8_1.default)(content))) {
|
|
23
|
+
return content;
|
|
24
|
+
}
|
|
25
|
+
switch (opts.insensitivity || 'line-ending') {
|
|
26
|
+
case 'line-ending':
|
|
27
|
+
// Convert to CRLF for legacy hash stability
|
|
28
|
+
return content.toString('utf8').replace(/(?<!\r)\n/g, '\r\n');
|
|
29
|
+
case 'whitespace':
|
|
30
|
+
return content.toString('utf8').trim().replace(/\s+/g, ' ');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a hash from content, attempting to normalize for line-feeds
|
|
35
|
+
*/
|
|
36
|
+
class Hasher {
|
|
37
|
+
constructor(hashOpts) {
|
|
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
|
+
this.hashOpts = hashOpts || {};
|
|
40
|
+
}
|
|
41
|
+
feedContent(content) {
|
|
42
|
+
this.hash.update(normalizeContent(content, this.hashOpts));
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
digest() {
|
|
46
|
+
return this.hash.digest('hex');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.Hasher = Hasher;
|
|
50
|
+
/**
|
|
51
|
+
* Convenience helper which hashes a single buffer
|
|
52
|
+
*/
|
|
53
|
+
function hashContent(content, opts) {
|
|
54
|
+
return new Hasher(opts).feedContent(content).digest();
|
|
55
|
+
}
|
|
56
|
+
exports.hashContent = hashContent;
|
|
57
|
+
/**
|
|
58
|
+
* Helper to hash a file/directory belonging to a repository
|
|
59
|
+
*/
|
|
60
|
+
async function hashFileOrDirectory(name, repo, opts) {
|
|
61
|
+
const type = await repo.stat(name);
|
|
62
|
+
if (type === 'none') {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
if (type === 'file') {
|
|
66
|
+
return hashContent((await repo.readFile(name)), opts);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const hasher = new Hasher(opts);
|
|
70
|
+
const subfiles = await repo.listFiles([`${(0, PathUtils_1.unixPath)(name)}/**`]);
|
|
71
|
+
for (const file of subfiles.sort()) {
|
|
72
|
+
const contents = await repo.readFile(file);
|
|
73
|
+
hasher.feedContent(contents);
|
|
74
|
+
// Incorporate the filename to detect if renames happen
|
|
75
|
+
const platformIndependentPath = (0, PathUtils_1.unixPath)(path_1.default.relative(name, (0, PathUtils_1.normalizePath)(file)));
|
|
76
|
+
hasher.feedContent(platformIndependentPath);
|
|
77
|
+
}
|
|
78
|
+
return hasher.digest();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.hashFileOrDirectory = hashFileOrDirectory;
|
|
82
82
|
//# sourceMappingURL=Hash.js.map
|
package/lib-commonjs/Hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Hash.js","sourceRoot":"","sources":["../src/Hash.ts"],"names":[],"mappings":";AAAA;;;;;GAKG
|
|
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,CAAC,8HAA8H;QACrK,IAAI,CAAC,QAAQ,GAAG,QAAQ,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,WAAW,CAAC,OAAwB;QAClC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CACF;AAjBD,wBAiBC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,OAAwB,EAAE,IAAe;IACnE,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;AACxD,CAAC;AAFD,kCAEC;AAED;;GAEG;AACI,KAAK,UAAU,mBAAmB,CACvC,IAAY,EACZ,IAAoB,EACpB,IAAe;IAEf,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAO,IAAI,CAAC;KACb;IAED,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAO,WAAW,CAAC,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAE,EAAE,IAAI,CAAC,CAAC;KACxD;SAAM;QACL,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,IAAA,oBAAQ,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAEhE,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE;YAClC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,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"]}
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
import * as Serialized from './Serialized';
|
|
8
|
-
import Override from './Override';
|
|
9
|
-
import { ReactFileRepository, WritableFileRepository } from './FileRepository';
|
|
10
|
-
import OverrideFactory from './OverrideFactory';
|
|
11
|
-
import { ValidationError } from './ValidationStrategy';
|
|
12
|
-
/**
|
|
13
|
-
* Represents a collection of overrides listed in an on-disk manifest. Allows
|
|
14
|
-
* performing aggregate operations on the overrides.
|
|
15
|
-
*/
|
|
16
|
-
export default class Manifest {
|
|
17
|
-
private readonly includePatterns?;
|
|
18
|
-
private readonly excludePatterns?;
|
|
19
|
-
private baseVersion?;
|
|
20
|
-
private readonly overrides;
|
|
21
|
-
/**
|
|
22
|
-
* Construct the manifest
|
|
23
|
-
*
|
|
24
|
-
* @param overrides List of overrides to evaluate
|
|
25
|
-
* @param opts Allows specifying globs to include or exclude paths to enforce
|
|
26
|
-
* exist in the manifest
|
|
27
|
-
*/
|
|
28
|
-
constructor(overrides: Override[], opts?: {
|
|
29
|
-
includePatterns?: string[];
|
|
30
|
-
excludePatterns?: string[];
|
|
31
|
-
baseVersion?: string;
|
|
32
|
-
});
|
|
33
|
-
static fromSerialized(man: Serialized.Manifest): Manifest;
|
|
34
|
-
/**
|
|
35
|
-
* Check that overrides are accurately accounted for in the manifest. E.g.
|
|
36
|
-
* all files should be accounted for, and base files should be up to date
|
|
37
|
-
* with upstream.
|
|
38
|
-
*/
|
|
39
|
-
validate(overrideRepo: WritableFileRepository, reactRepo: ReactFileRepository): Promise<ValidationError[]>;
|
|
40
|
-
/**
|
|
41
|
-
* Add an override to the manifest
|
|
42
|
-
*/
|
|
43
|
-
addOverride(override: Override): void;
|
|
44
|
-
/**
|
|
45
|
-
* Whether the manifest contains a given override
|
|
46
|
-
*/
|
|
47
|
-
hasOverride(overrideName: string): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Try to remove an override.
|
|
50
|
-
* @returns false if none is found with the given name
|
|
51
|
-
*/
|
|
52
|
-
removeOverride(overrideName: string): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Returns the entry corresponding to the given override path, or null if none
|
|
55
|
-
* exists.
|
|
56
|
-
*/
|
|
57
|
-
findOverride(overrideName: string): Override | null;
|
|
58
|
-
/**
|
|
59
|
-
* Updates an override entry to mark it as up-to-date in regards to its
|
|
60
|
-
* current base file.
|
|
61
|
-
*/
|
|
62
|
-
markUpToDate(overrideName: string, overrideFactory: OverrideFactory): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Return a serialized representation of the manifest
|
|
65
|
-
*/
|
|
66
|
-
serialize(): Serialized.Manifest;
|
|
67
|
-
/**
|
|
68
|
-
* Returns the overrides in the
|
|
69
|
-
*/
|
|
70
|
-
listOverrides(): Override[];
|
|
71
|
-
/**
|
|
72
|
-
* Set the default baseVersion for the manifest
|
|
73
|
-
*/
|
|
74
|
-
setBaseVersion(baseVersion?: string): void;
|
|
75
|
-
/**
|
|
76
|
-
* Find the index to a given override.
|
|
77
|
-
* @returns -1 if it cannot be found
|
|
78
|
-
*/
|
|
79
|
-
private findOverrideIndex;
|
|
80
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*
|
|
5
|
+
* @format
|
|
6
|
+
*/
|
|
7
|
+
import * as Serialized from './Serialized';
|
|
8
|
+
import Override from './Override';
|
|
9
|
+
import { ReactFileRepository, WritableFileRepository } from './FileRepository';
|
|
10
|
+
import OverrideFactory from './OverrideFactory';
|
|
11
|
+
import { ValidationError } from './ValidationStrategy';
|
|
12
|
+
/**
|
|
13
|
+
* Represents a collection of overrides listed in an on-disk manifest. Allows
|
|
14
|
+
* performing aggregate operations on the overrides.
|
|
15
|
+
*/
|
|
16
|
+
export default class Manifest {
|
|
17
|
+
private readonly includePatterns?;
|
|
18
|
+
private readonly excludePatterns?;
|
|
19
|
+
private baseVersion?;
|
|
20
|
+
private readonly overrides;
|
|
21
|
+
/**
|
|
22
|
+
* Construct the manifest
|
|
23
|
+
*
|
|
24
|
+
* @param overrides List of overrides to evaluate
|
|
25
|
+
* @param opts Allows specifying globs to include or exclude paths to enforce
|
|
26
|
+
* exist in the manifest
|
|
27
|
+
*/
|
|
28
|
+
constructor(overrides: Override[], opts?: {
|
|
29
|
+
includePatterns?: string[];
|
|
30
|
+
excludePatterns?: string[];
|
|
31
|
+
baseVersion?: string;
|
|
32
|
+
});
|
|
33
|
+
static fromSerialized(man: Serialized.Manifest): Manifest;
|
|
34
|
+
/**
|
|
35
|
+
* Check that overrides are accurately accounted for in the manifest. E.g.
|
|
36
|
+
* all files should be accounted for, and base files should be up to date
|
|
37
|
+
* with upstream.
|
|
38
|
+
*/
|
|
39
|
+
validate(overrideRepo: WritableFileRepository, reactRepo: ReactFileRepository): Promise<ValidationError[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Add an override to the manifest
|
|
42
|
+
*/
|
|
43
|
+
addOverride(override: Override): void;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the manifest contains a given override
|
|
46
|
+
*/
|
|
47
|
+
hasOverride(overrideName: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Try to remove an override.
|
|
50
|
+
* @returns false if none is found with the given name
|
|
51
|
+
*/
|
|
52
|
+
removeOverride(overrideName: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the entry corresponding to the given override path, or null if none
|
|
55
|
+
* exists.
|
|
56
|
+
*/
|
|
57
|
+
findOverride(overrideName: string): Override | null;
|
|
58
|
+
/**
|
|
59
|
+
* Updates an override entry to mark it as up-to-date in regards to its
|
|
60
|
+
* current base file.
|
|
61
|
+
*/
|
|
62
|
+
markUpToDate(overrideName: string, overrideFactory: OverrideFactory): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Return a serialized representation of the manifest
|
|
65
|
+
*/
|
|
66
|
+
serialize(): Serialized.Manifest;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the overrides in the manifest
|
|
69
|
+
*/
|
|
70
|
+
listOverrides(): Override[];
|
|
71
|
+
/**
|
|
72
|
+
* Set the default baseVersion for the manifest
|
|
73
|
+
*/
|
|
74
|
+
setBaseVersion(baseVersion?: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* Find the index to a given override.
|
|
77
|
+
* @returns -1 if it cannot be found
|
|
78
|
+
*/
|
|
79
|
+
private findOverrideIndex;
|
|
80
|
+
}
|