react-native-platform-override 1.9.20 → 1.9.22

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.
Files changed (48) hide show
  1. package/lib-commonjs/Api.d.ts +57 -57
  2. package/lib-commonjs/Api.js +187 -187
  3. package/lib-commonjs/BatchingQueue.d.ts +15 -15
  4. package/lib-commonjs/BatchingQueue.js +57 -57
  5. package/lib-commonjs/Cli.d.ts +7 -7
  6. package/lib-commonjs/Cli.js +323 -323
  7. package/lib-commonjs/CrossProcessLock.d.ts +44 -44
  8. package/lib-commonjs/CrossProcessLock.js +147 -147
  9. package/lib-commonjs/DiffStrategy.d.ts +24 -24
  10. package/lib-commonjs/DiffStrategy.js +34 -34
  11. package/lib-commonjs/FileRepository.d.ts +62 -62
  12. package/lib-commonjs/FileRepository.js +21 -21
  13. package/lib-commonjs/FileSearch.d.ts +21 -21
  14. package/lib-commonjs/FileSearch.js +77 -77
  15. package/lib-commonjs/FileSystemRepository.d.ts +20 -20
  16. package/lib-commonjs/FileSystemRepository.js +62 -62
  17. package/lib-commonjs/GitReactFileRepository.d.ts +56 -56
  18. package/lib-commonjs/GitReactFileRepository.js +202 -202
  19. package/lib-commonjs/Hash.d.ts +33 -33
  20. package/lib-commonjs/Hash.js +81 -81
  21. package/lib-commonjs/Manifest.d.ts +80 -80
  22. package/lib-commonjs/Manifest.js +157 -157
  23. package/lib-commonjs/Override.d.ts +182 -182
  24. package/lib-commonjs/Override.js +248 -248
  25. package/lib-commonjs/OverrideFactory.d.ts +33 -33
  26. package/lib-commonjs/OverrideFactory.js +85 -85
  27. package/lib-commonjs/OverridePrompt.d.ts +30 -30
  28. package/lib-commonjs/OverridePrompt.js +130 -130
  29. package/lib-commonjs/PackageUtils.d.ts +15 -15
  30. package/lib-commonjs/PackageUtils.js +40 -40
  31. package/lib-commonjs/PathUtils.d.ts +14 -14
  32. package/lib-commonjs/PathUtils.js +31 -31
  33. package/lib-commonjs/Serialized.d.ts +158 -158
  34. package/lib-commonjs/Serialized.js +145 -145
  35. package/lib-commonjs/UpgradeStrategy.d.ts +39 -39
  36. package/lib-commonjs/UpgradeStrategy.js +102 -102
  37. package/lib-commonjs/ValidationStrategy.d.ts +57 -57
  38. package/lib-commonjs/ValidationStrategy.js +124 -124
  39. package/lib-commonjs/refFromVersion.d.ts +10 -10
  40. package/lib-commonjs/refFromVersion.js +98 -98
  41. package/lib-commonjs/refFromVersion.js.map +1 -1
  42. package/lib-commonjs/scripts/generateManifest.d.ts +7 -7
  43. package/lib-commonjs/scripts/generateManifest.js +196 -196
  44. package/lib-commonjs/scripts/hashFile.d.ts +7 -7
  45. package/lib-commonjs/scripts/hashFile.js +17 -17
  46. package/lib-commonjs/scripts/testLocks.d.ts +1 -1
  47. package/lib-commonjs/scripts/testLocks.js +29 -29
  48. package/package.json +10 -10
@@ -1,32 +1,32 @@
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.normalizePath = exports.unixPath = void 0;
13
- const path_1 = __importDefault(require("path"));
14
- const upath_1 = __importDefault(require("upath"));
15
- /**
16
- * Convert a path to use Unix-style slashes
17
- */
18
- function unixPath(filepath) {
19
- return upath_1.default.toUnix(filepath);
20
- }
21
- exports.unixPath = unixPath;
22
- /**
23
- * Normalize a path and convert to use platform-specific slashes
24
- */
25
- function normalizePath(filepath) {
26
- // path.normalize will convert unix paths to win32, but not the other way
27
- // around. Normalize to Unix paths first to get both cases.
28
- const unixStylePath = unixPath(filepath);
29
- return path_1.default.normalize(unixStylePath);
30
- }
31
- exports.normalizePath = normalizePath;
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.normalizePath = exports.unixPath = void 0;
13
+ const path_1 = __importDefault(require("path"));
14
+ const upath_1 = __importDefault(require("upath"));
15
+ /**
16
+ * Convert a path to use Unix-style slashes
17
+ */
18
+ function unixPath(filepath) {
19
+ return upath_1.default.toUnix(filepath);
20
+ }
21
+ exports.unixPath = unixPath;
22
+ /**
23
+ * Normalize a path and convert to use platform-specific slashes
24
+ */
25
+ function normalizePath(filepath) {
26
+ // path.normalize will convert unix paths to win32, but not the other way
27
+ // around. Normalize to Unix paths first to get both cases.
28
+ const unixStylePath = unixPath(filepath);
29
+ return path_1.default.normalize(unixStylePath);
30
+ }
31
+ exports.normalizePath = normalizePath;
32
32
  //# sourceMappingURL=PathUtils.js.map
@@ -1,158 +1,158 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * @format
6
- */
7
- import * as t from 'io-ts';
8
- /**
9
- * Serialized form of {@see PlatformOverride}
10
- */
11
- declare const PlatformOverrideType: t.TypeC<{
12
- type: t.LiteralC<"platform">;
13
- file: t.StringC;
14
- }>;
15
- /**
16
- * Serialized form of {@see PatchOverride}
17
- */
18
- declare const PatchOverrideType: t.TypeC<{
19
- type: t.LiteralC<"patch">;
20
- file: t.StringC;
21
- baseFile: t.StringC;
22
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
23
- baseHash: t.StringC;
24
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
25
- }>;
26
- /**
27
- * Serialized form of {@see DerivedOverride}
28
- */
29
- declare const DerivedOverrideType: t.TypeC<{
30
- type: t.LiteralC<"derived">;
31
- file: t.StringC;
32
- baseFile: t.StringC;
33
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
34
- baseHash: t.StringC;
35
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
36
- }>;
37
- /**
38
- * Serialized form of {@see CopyOverride}
39
- */
40
- declare const CopyOverrideType: t.TypeC<{
41
- type: t.LiteralC<"copy">;
42
- file: t.StringC;
43
- baseFile: t.StringC;
44
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
45
- baseHash: t.StringC;
46
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
47
- }>;
48
- /**
49
- * Serialized form of {@see DirectoryCopyOverride}
50
- */
51
- declare const DirectoryCopyOverrideType: t.TypeC<{
52
- type: t.LiteralC<"copy">;
53
- directory: t.StringC;
54
- baseDirectory: t.StringC;
55
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
56
- baseHash: t.StringC;
57
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
58
- }>;
59
- /**
60
- * Union of all serialized override types
61
- */
62
- declare const OverrideType: t.UnionC<[t.TypeC<{
63
- type: t.LiteralC<"platform">;
64
- file: t.StringC;
65
- }>, t.TypeC<{
66
- type: t.LiteralC<"patch">;
67
- file: t.StringC;
68
- baseFile: t.StringC;
69
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
70
- baseHash: t.StringC;
71
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
72
- }>, t.TypeC<{
73
- type: t.LiteralC<"derived">;
74
- file: t.StringC;
75
- baseFile: t.StringC;
76
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
77
- baseHash: t.StringC;
78
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
79
- }>, t.TypeC<{
80
- type: t.LiteralC<"copy">;
81
- file: t.StringC;
82
- baseFile: t.StringC;
83
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
84
- baseHash: t.StringC;
85
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
86
- }>, t.TypeC<{
87
- type: t.LiteralC<"copy">;
88
- directory: t.StringC;
89
- baseDirectory: t.StringC;
90
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
91
- baseHash: t.StringC;
92
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
93
- }>]>;
94
- /**
95
- * Schema for the "overrides.json" manifest
96
- */
97
- declare const ManifestType: t.TypeC<{
98
- includePatterns: t.UnionC<[t.UndefinedC, t.ArrayC<t.StringC>]>;
99
- excludePatterns: t.UnionC<[t.UndefinedC, t.ArrayC<t.StringC>]>;
100
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
101
- overrides: t.ArrayC<t.UnionC<[t.TypeC<{
102
- type: t.LiteralC<"platform">;
103
- file: t.StringC;
104
- }>, t.TypeC<{
105
- type: t.LiteralC<"patch">;
106
- file: t.StringC;
107
- baseFile: t.StringC;
108
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
109
- baseHash: t.StringC;
110
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
111
- }>, t.TypeC<{
112
- type: t.LiteralC<"derived">;
113
- file: t.StringC;
114
- baseFile: t.StringC;
115
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
116
- baseHash: t.StringC;
117
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
118
- }>, t.TypeC<{
119
- type: t.LiteralC<"copy">;
120
- file: t.StringC;
121
- baseFile: t.StringC;
122
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
123
- baseHash: t.StringC;
124
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
125
- }>, t.TypeC<{
126
- type: t.LiteralC<"copy">;
127
- directory: t.StringC;
128
- baseDirectory: t.StringC;
129
- baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
130
- baseHash: t.StringC;
131
- issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
132
- }>]>>;
133
- }>;
134
- export type PlatformOverride = t.TypeOf<typeof PlatformOverrideType>;
135
- export type PatchOverride = t.TypeOf<typeof PatchOverrideType>;
136
- export type DerivedOverride = t.TypeOf<typeof DerivedOverrideType>;
137
- export type CopyOverride = t.TypeOf<typeof CopyOverrideType>;
138
- export type DirectoryCopyOverride = t.TypeOf<typeof DirectoryCopyOverrideType>;
139
- export type Override = t.TypeOf<typeof OverrideType>;
140
- export type Manifest = t.TypeOf<typeof ManifestType>;
141
- /**
142
- * Read an override manifest from a file.
143
- *
144
- * @throws if the file is invalid or cannot be found
145
- */
146
- export declare function readManifestFromFile(filePath: string): Promise<Manifest>;
147
- /**
148
- * Parse a string with JSON for the override manifest into one.
149
- *
150
- * @throws if the JSON doesn't describe a valid manifest
151
- */
152
- export declare function parseManifest(json: string): Manifest;
153
- /**
154
- * Writes the manifest to a JSON file. Does not validate correctness of the
155
- * manifest.
156
- */
157
- export declare function writeManifestToFile(manifest: Manifest, filePath: string): Promise<void>;
158
- export {};
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @format
6
+ */
7
+ import * as t from 'io-ts';
8
+ /**
9
+ * Serialized form of {@see PlatformOverride}
10
+ */
11
+ declare const PlatformOverrideType: t.TypeC<{
12
+ type: t.LiteralC<"platform">;
13
+ file: t.StringC;
14
+ }>;
15
+ /**
16
+ * Serialized form of {@see PatchOverride}
17
+ */
18
+ declare const PatchOverrideType: t.TypeC<{
19
+ type: t.LiteralC<"patch">;
20
+ file: t.StringC;
21
+ baseFile: t.StringC;
22
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
23
+ baseHash: t.StringC;
24
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
25
+ }>;
26
+ /**
27
+ * Serialized form of {@see DerivedOverride}
28
+ */
29
+ declare const DerivedOverrideType: t.TypeC<{
30
+ type: t.LiteralC<"derived">;
31
+ file: t.StringC;
32
+ baseFile: t.StringC;
33
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
34
+ baseHash: t.StringC;
35
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
36
+ }>;
37
+ /**
38
+ * Serialized form of {@see CopyOverride}
39
+ */
40
+ declare const CopyOverrideType: t.TypeC<{
41
+ type: t.LiteralC<"copy">;
42
+ file: t.StringC;
43
+ baseFile: t.StringC;
44
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
45
+ baseHash: t.StringC;
46
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
47
+ }>;
48
+ /**
49
+ * Serialized form of {@see DirectoryCopyOverride}
50
+ */
51
+ declare const DirectoryCopyOverrideType: t.TypeC<{
52
+ type: t.LiteralC<"copy">;
53
+ directory: t.StringC;
54
+ baseDirectory: t.StringC;
55
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
56
+ baseHash: t.StringC;
57
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
58
+ }>;
59
+ /**
60
+ * Union of all serialized override types
61
+ */
62
+ declare const OverrideType: t.UnionC<[t.TypeC<{
63
+ type: t.LiteralC<"platform">;
64
+ file: t.StringC;
65
+ }>, t.TypeC<{
66
+ type: t.LiteralC<"patch">;
67
+ file: t.StringC;
68
+ baseFile: t.StringC;
69
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
70
+ baseHash: t.StringC;
71
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
72
+ }>, t.TypeC<{
73
+ type: t.LiteralC<"derived">;
74
+ file: t.StringC;
75
+ baseFile: t.StringC;
76
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
77
+ baseHash: t.StringC;
78
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
79
+ }>, t.TypeC<{
80
+ type: t.LiteralC<"copy">;
81
+ file: t.StringC;
82
+ baseFile: t.StringC;
83
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
84
+ baseHash: t.StringC;
85
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
86
+ }>, t.TypeC<{
87
+ type: t.LiteralC<"copy">;
88
+ directory: t.StringC;
89
+ baseDirectory: t.StringC;
90
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
91
+ baseHash: t.StringC;
92
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
93
+ }>]>;
94
+ /**
95
+ * Schema for the "overrides.json" manifest
96
+ */
97
+ declare const ManifestType: t.TypeC<{
98
+ includePatterns: t.UnionC<[t.UndefinedC, t.ArrayC<t.StringC>]>;
99
+ excludePatterns: t.UnionC<[t.UndefinedC, t.ArrayC<t.StringC>]>;
100
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
101
+ overrides: t.ArrayC<t.UnionC<[t.TypeC<{
102
+ type: t.LiteralC<"platform">;
103
+ file: t.StringC;
104
+ }>, t.TypeC<{
105
+ type: t.LiteralC<"patch">;
106
+ file: t.StringC;
107
+ baseFile: t.StringC;
108
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
109
+ baseHash: t.StringC;
110
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
111
+ }>, t.TypeC<{
112
+ type: t.LiteralC<"derived">;
113
+ file: t.StringC;
114
+ baseFile: t.StringC;
115
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
116
+ baseHash: t.StringC;
117
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
118
+ }>, t.TypeC<{
119
+ type: t.LiteralC<"copy">;
120
+ file: t.StringC;
121
+ baseFile: t.StringC;
122
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
123
+ baseHash: t.StringC;
124
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
125
+ }>, t.TypeC<{
126
+ type: t.LiteralC<"copy">;
127
+ directory: t.StringC;
128
+ baseDirectory: t.StringC;
129
+ baseVersion: t.UnionC<[t.UndefinedC, t.StringC]>;
130
+ baseHash: t.StringC;
131
+ issue: t.UnionC<[t.UndefinedC, t.NumberC]>;
132
+ }>]>>;
133
+ }>;
134
+ export type PlatformOverride = t.TypeOf<typeof PlatformOverrideType>;
135
+ export type PatchOverride = t.TypeOf<typeof PatchOverrideType>;
136
+ export type DerivedOverride = t.TypeOf<typeof DerivedOverrideType>;
137
+ export type CopyOverride = t.TypeOf<typeof CopyOverrideType>;
138
+ export type DirectoryCopyOverride = t.TypeOf<typeof DirectoryCopyOverrideType>;
139
+ export type Override = t.TypeOf<typeof OverrideType>;
140
+ export type Manifest = t.TypeOf<typeof ManifestType>;
141
+ /**
142
+ * Read an override manifest from a file.
143
+ *
144
+ * @throws if the file is invalid or cannot be found
145
+ */
146
+ export declare function readManifestFromFile(filePath: string): Promise<Manifest>;
147
+ /**
148
+ * Parse a string with JSON for the override manifest into one.
149
+ *
150
+ * @throws if the JSON doesn't describe a valid manifest
151
+ */
152
+ export declare function parseManifest(json: string): Manifest;
153
+ /**
154
+ * Writes the manifest to a JSON file. Does not validate correctness of the
155
+ * manifest.
156
+ */
157
+ export declare function writeManifestToFile(manifest: Manifest, filePath: string): Promise<void>;
158
+ export {};
@@ -1,146 +1,146 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation.
4
- * Licensed under the MIT License.
5
- *
6
- * @format
7
- */
8
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- var desc = Object.getOwnPropertyDescriptor(m, k);
11
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
- desc = { enumerable: true, get: function() { return m[k]; } };
13
- }
14
- Object.defineProperty(o, k2, desc);
15
- }) : (function(o, m, k, k2) {
16
- if (k2 === undefined) k2 = k;
17
- o[k2] = m[k];
18
- }));
19
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
- Object.defineProperty(o, "default", { enumerable: true, value: v });
21
- }) : function(o, v) {
22
- o["default"] = v;
23
- });
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __importDefault = (this && this.__importDefault) || function (mod) {
32
- return (mod && mod.__esModule) ? mod : { "default": mod };
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.writeManifestToFile = exports.parseManifest = exports.readManifestFromFile = void 0;
36
- const fs_1 = __importDefault(require("@react-native-windows/fs"));
37
- const path_1 = __importDefault(require("path"));
38
- const t = __importStar(require("io-ts"));
39
- const ThrowReporter_1 = require("io-ts/lib/ThrowReporter");
40
- /**
41
- * Serialized form of {@see PlatformOverride}
42
- */
43
- const PlatformOverrideType = t.type({
44
- type: t.literal('platform'),
45
- file: t.string,
46
- });
47
- /**
48
- * Serialized form of {@see PatchOverride}
49
- */
50
- const PatchOverrideType = t.type({
51
- type: t.literal('patch'),
52
- file: t.string,
53
- baseFile: t.string,
54
- baseVersion: t.union([t.undefined, t.string]),
55
- baseHash: t.string,
56
- issue: t.union([t.undefined, t.number]),
57
- });
58
- /**
59
- * Serialized form of {@see DerivedOverride}
60
- */
61
- const DerivedOverrideType = t.type({
62
- type: t.literal('derived'),
63
- file: t.string,
64
- baseFile: t.string,
65
- baseVersion: t.union([t.undefined, t.string]),
66
- baseHash: t.string,
67
- issue: t.union([t.undefined, t.number]),
68
- });
69
- /**
70
- * Serialized form of {@see CopyOverride}
71
- */
72
- const CopyOverrideType = t.type({
73
- type: t.literal('copy'),
74
- file: t.string,
75
- baseFile: t.string,
76
- baseVersion: t.union([t.undefined, t.string]),
77
- baseHash: t.string,
78
- issue: t.union([t.undefined, t.number]),
79
- });
80
- /**
81
- * Serialized form of {@see DirectoryCopyOverride}
82
- */
83
- const DirectoryCopyOverrideType = t.type({
84
- type: t.literal('copy'),
85
- directory: t.string,
86
- baseDirectory: t.string,
87
- baseVersion: t.union([t.undefined, t.string]),
88
- baseHash: t.string,
89
- issue: t.union([t.undefined, t.number]),
90
- });
91
- /**
92
- * Union of all serialized override types
93
- */
94
- const OverrideType = t.union([
95
- PlatformOverrideType,
96
- PatchOverrideType,
97
- DerivedOverrideType,
98
- CopyOverrideType,
99
- DirectoryCopyOverrideType,
100
- ]);
101
- /**
102
- * Schema for the "overrides.json" manifest
103
- */
104
- const ManifestType = t.type({
105
- includePatterns: t.union([t.undefined, t.array(t.string)]),
106
- excludePatterns: t.union([t.undefined, t.array(t.string)]),
107
- baseVersion: t.union([t.undefined, t.string]),
108
- overrides: t.array(OverrideType),
109
- });
110
- /**
111
- * Read an override manifest from a file.
112
- *
113
- * @throws if the file is invalid or cannot be found
114
- */
115
- async function readManifestFromFile(filePath) {
116
- const json = (await fs_1.default.readFile(filePath)).toString();
117
- return parseManifest(json);
118
- }
119
- exports.readManifestFromFile = readManifestFromFile;
120
- /**
121
- * Parse a string with JSON for the override manifest into one.
122
- *
123
- * @throws if the JSON doesn't describe a valid manifest
124
- */
125
- function parseManifest(json) {
126
- const parsed = JSON.parse(json);
127
- try {
128
- ThrowReporter_1.ThrowReporter.report(ManifestType.decode(parsed));
129
- }
130
- catch (ex) {
131
- throw new Error('Could not parse manifest. Is it valid?');
132
- }
133
- return parsed;
134
- }
135
- exports.parseManifest = parseManifest;
136
- /**
137
- * Writes the manifest to a JSON file. Does not validate correctness of the
138
- * manifest.
139
- */
140
- async function writeManifestToFile(manifest, filePath) {
141
- const json = JSON.stringify(manifest, null /*replacer*/, 2 /*space*/);
142
- await fs_1.default.mkdir(path_1.default.dirname(filePath), { recursive: true });
143
- await fs_1.default.writeFile(filePath, json);
144
- }
145
- exports.writeManifestToFile = writeManifestToFile;
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ * Licensed under the MIT License.
5
+ *
6
+ * @format
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __importDefault = (this && this.__importDefault) || function (mod) {
32
+ return (mod && mod.__esModule) ? mod : { "default": mod };
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.writeManifestToFile = exports.parseManifest = exports.readManifestFromFile = void 0;
36
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
37
+ const path_1 = __importDefault(require("path"));
38
+ const t = __importStar(require("io-ts"));
39
+ const ThrowReporter_1 = require("io-ts/lib/ThrowReporter");
40
+ /**
41
+ * Serialized form of {@see PlatformOverride}
42
+ */
43
+ const PlatformOverrideType = t.type({
44
+ type: t.literal('platform'),
45
+ file: t.string,
46
+ });
47
+ /**
48
+ * Serialized form of {@see PatchOverride}
49
+ */
50
+ const PatchOverrideType = t.type({
51
+ type: t.literal('patch'),
52
+ file: t.string,
53
+ baseFile: t.string,
54
+ baseVersion: t.union([t.undefined, t.string]),
55
+ baseHash: t.string,
56
+ issue: t.union([t.undefined, t.number]),
57
+ });
58
+ /**
59
+ * Serialized form of {@see DerivedOverride}
60
+ */
61
+ const DerivedOverrideType = t.type({
62
+ type: t.literal('derived'),
63
+ file: t.string,
64
+ baseFile: t.string,
65
+ baseVersion: t.union([t.undefined, t.string]),
66
+ baseHash: t.string,
67
+ issue: t.union([t.undefined, t.number]),
68
+ });
69
+ /**
70
+ * Serialized form of {@see CopyOverride}
71
+ */
72
+ const CopyOverrideType = t.type({
73
+ type: t.literal('copy'),
74
+ file: t.string,
75
+ baseFile: t.string,
76
+ baseVersion: t.union([t.undefined, t.string]),
77
+ baseHash: t.string,
78
+ issue: t.union([t.undefined, t.number]),
79
+ });
80
+ /**
81
+ * Serialized form of {@see DirectoryCopyOverride}
82
+ */
83
+ const DirectoryCopyOverrideType = t.type({
84
+ type: t.literal('copy'),
85
+ directory: t.string,
86
+ baseDirectory: t.string,
87
+ baseVersion: t.union([t.undefined, t.string]),
88
+ baseHash: t.string,
89
+ issue: t.union([t.undefined, t.number]),
90
+ });
91
+ /**
92
+ * Union of all serialized override types
93
+ */
94
+ const OverrideType = t.union([
95
+ PlatformOverrideType,
96
+ PatchOverrideType,
97
+ DerivedOverrideType,
98
+ CopyOverrideType,
99
+ DirectoryCopyOverrideType,
100
+ ]);
101
+ /**
102
+ * Schema for the "overrides.json" manifest
103
+ */
104
+ const ManifestType = t.type({
105
+ includePatterns: t.union([t.undefined, t.array(t.string)]),
106
+ excludePatterns: t.union([t.undefined, t.array(t.string)]),
107
+ baseVersion: t.union([t.undefined, t.string]),
108
+ overrides: t.array(OverrideType),
109
+ });
110
+ /**
111
+ * Read an override manifest from a file.
112
+ *
113
+ * @throws if the file is invalid or cannot be found
114
+ */
115
+ async function readManifestFromFile(filePath) {
116
+ const json = (await fs_1.default.readFile(filePath)).toString();
117
+ return parseManifest(json);
118
+ }
119
+ exports.readManifestFromFile = readManifestFromFile;
120
+ /**
121
+ * Parse a string with JSON for the override manifest into one.
122
+ *
123
+ * @throws if the JSON doesn't describe a valid manifest
124
+ */
125
+ function parseManifest(json) {
126
+ const parsed = JSON.parse(json);
127
+ try {
128
+ ThrowReporter_1.ThrowReporter.report(ManifestType.decode(parsed));
129
+ }
130
+ catch (ex) {
131
+ throw new Error('Could not parse manifest. Is it valid?');
132
+ }
133
+ return parsed;
134
+ }
135
+ exports.parseManifest = parseManifest;
136
+ /**
137
+ * Writes the manifest to a JSON file. Does not validate correctness of the
138
+ * manifest.
139
+ */
140
+ async function writeManifestToFile(manifest, filePath) {
141
+ const json = JSON.stringify(manifest, null /*replacer*/, 2 /*space*/);
142
+ await fs_1.default.mkdir(path_1.default.dirname(filePath), { recursive: true });
143
+ await fs_1.default.writeFile(filePath, json);
144
+ }
145
+ exports.writeManifestToFile = writeManifestToFile;
146
146
  //# sourceMappingURL=Serialized.js.map