react-native-platform-override 1.9.21 → 1.9.23

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,86 +1,86 @@
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.OverrideFactoryImpl = void 0;
13
- const path_1 = __importDefault(require("path"));
14
- const Override_1 = require("./Override");
15
- const Hash_1 = require("./Hash");
16
- /**
17
- * Concrete implementation of an OverrideFactory
18
- */
19
- class OverrideFactoryImpl {
20
- constructor(reactRepo, overrideRepo) {
21
- this.reactRepo = reactRepo;
22
- this.overrideRepo = overrideRepo;
23
- }
24
- async createPlatformOverride(file) {
25
- await this.checkOverrideExists(file, 'file');
26
- return new Override_1.PlatformOverride({ file });
27
- }
28
- async createCopyOverride(file, baseFile, issue) {
29
- await this.checkOverrideExists(file, 'file');
30
- return new Override_1.CopyOverride({
31
- file,
32
- baseFile,
33
- issue,
34
- ...(await this.getBaseInfo(baseFile)),
35
- });
36
- }
37
- async createDerivedOverride(file, baseFile, issue) {
38
- await this.checkOverrideExists(file, 'file');
39
- return new Override_1.DerivedOverride({
40
- file,
41
- baseFile,
42
- issue,
43
- ...(await this.getBaseInfo(baseFile)),
44
- });
45
- }
46
- async createPatchOverride(file, baseFile, issue) {
47
- await this.checkOverrideExists(file, 'file');
48
- return new Override_1.PatchOverride({
49
- file,
50
- baseFile,
51
- issue,
52
- ...(await this.getBaseInfo(baseFile)),
53
- });
54
- }
55
- async createDirectoryCopyOverride(directory, baseDirectory, issue) {
56
- await this.checkOverrideExists(directory, 'directory');
57
- return new Override_1.DirectoryCopyOverride({
58
- directory,
59
- baseDirectory,
60
- issue,
61
- ...(await this.getBaseInfo(baseDirectory)),
62
- });
63
- }
64
- async checkOverrideExists(overridePath, type) {
65
- if (path_1.default.isAbsolute(overridePath)) {
66
- throw new Error(`Expected override path to be repo relative. Got '${overridePath}'`);
67
- }
68
- if ((await this.overrideRepo.stat(overridePath)) !== type) {
69
- throw new Error(`Could not find ${type} at repo relative path '${overridePath}'`);
70
- }
71
- }
72
- async getBaseInfo(basePath) {
73
- if (path_1.default.isAbsolute(basePath)) {
74
- throw new Error(`Expected base path to be repo relative. Got '${basePath}'`);
75
- }
76
- const baseType = await this.reactRepo.stat(basePath);
77
- if (baseType === 'none') {
78
- throw new Error(`Could not find base file/directory '${basePath}'`);
79
- }
80
- const baseVersion = this.reactRepo.getVersion();
81
- const baseHash = (await (0, Hash_1.hashFileOrDirectory)(basePath, this.reactRepo));
82
- return { baseVersion, baseHash };
83
- }
84
- }
85
- exports.OverrideFactoryImpl = OverrideFactoryImpl;
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.OverrideFactoryImpl = void 0;
13
+ const path_1 = __importDefault(require("path"));
14
+ const Override_1 = require("./Override");
15
+ const Hash_1 = require("./Hash");
16
+ /**
17
+ * Concrete implementation of an OverrideFactory
18
+ */
19
+ class OverrideFactoryImpl {
20
+ constructor(reactRepo, overrideRepo) {
21
+ this.reactRepo = reactRepo;
22
+ this.overrideRepo = overrideRepo;
23
+ }
24
+ async createPlatformOverride(file) {
25
+ await this.checkOverrideExists(file, 'file');
26
+ return new Override_1.PlatformOverride({ file });
27
+ }
28
+ async createCopyOverride(file, baseFile, issue) {
29
+ await this.checkOverrideExists(file, 'file');
30
+ return new Override_1.CopyOverride({
31
+ file,
32
+ baseFile,
33
+ issue,
34
+ ...(await this.getBaseInfo(baseFile)),
35
+ });
36
+ }
37
+ async createDerivedOverride(file, baseFile, issue) {
38
+ await this.checkOverrideExists(file, 'file');
39
+ return new Override_1.DerivedOverride({
40
+ file,
41
+ baseFile,
42
+ issue,
43
+ ...(await this.getBaseInfo(baseFile)),
44
+ });
45
+ }
46
+ async createPatchOverride(file, baseFile, issue) {
47
+ await this.checkOverrideExists(file, 'file');
48
+ return new Override_1.PatchOverride({
49
+ file,
50
+ baseFile,
51
+ issue,
52
+ ...(await this.getBaseInfo(baseFile)),
53
+ });
54
+ }
55
+ async createDirectoryCopyOverride(directory, baseDirectory, issue) {
56
+ await this.checkOverrideExists(directory, 'directory');
57
+ return new Override_1.DirectoryCopyOverride({
58
+ directory,
59
+ baseDirectory,
60
+ issue,
61
+ ...(await this.getBaseInfo(baseDirectory)),
62
+ });
63
+ }
64
+ async checkOverrideExists(overridePath, type) {
65
+ if (path_1.default.isAbsolute(overridePath)) {
66
+ throw new Error(`Expected override path to be repo relative. Got '${overridePath}'`);
67
+ }
68
+ if ((await this.overrideRepo.stat(overridePath)) !== type) {
69
+ throw new Error(`Could not find ${type} at repo relative path '${overridePath}'`);
70
+ }
71
+ }
72
+ async getBaseInfo(basePath) {
73
+ if (path_1.default.isAbsolute(basePath)) {
74
+ throw new Error(`Expected base path to be repo relative. Got '${basePath}'`);
75
+ }
76
+ const baseType = await this.reactRepo.stat(basePath);
77
+ if (baseType === 'none') {
78
+ throw new Error(`Could not find base file/directory '${basePath}'`);
79
+ }
80
+ const baseVersion = this.reactRepo.getVersion();
81
+ const baseHash = (await (0, Hash_1.hashFileOrDirectory)(basePath, this.reactRepo));
82
+ return { baseVersion, baseHash };
83
+ }
84
+ }
85
+ exports.OverrideFactoryImpl = OverrideFactoryImpl;
86
86
  //# sourceMappingURL=OverrideFactory.js.map
@@ -1,30 +1,30 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * @format
6
- */
7
- import Override from './Override';
8
- import OverrideFactory from './OverrideFactory';
9
- export type OverridePromptAnswers = {
10
- type: 'derived';
11
- baseFile: string;
12
- codeCopied: boolean;
13
- issue?: number;
14
- } | {
15
- type: 'patch';
16
- baseFile: string;
17
- issue: number;
18
- } | {
19
- type: 'platform';
20
- } | {
21
- type: 'copy';
22
- baseFile: string;
23
- issue: number;
24
- } | {
25
- type: 'directoryCopy';
26
- baseDirectory: string;
27
- issue: number;
28
- };
29
- export declare function overrideFromDetails(overridePath: string, answers: OverridePromptAnswers, factory: OverrideFactory): Promise<Override>;
30
- export declare function promptForOverrideDetails(): Promise<OverridePromptAnswers>;
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @format
6
+ */
7
+ import Override from './Override';
8
+ import OverrideFactory from './OverrideFactory';
9
+ export type OverridePromptAnswers = {
10
+ type: 'derived';
11
+ baseFile: string;
12
+ codeCopied: boolean;
13
+ issue?: number;
14
+ } | {
15
+ type: 'patch';
16
+ baseFile: string;
17
+ issue: number;
18
+ } | {
19
+ type: 'platform';
20
+ } | {
21
+ type: 'copy';
22
+ baseFile: string;
23
+ issue: number;
24
+ } | {
25
+ type: 'directoryCopy';
26
+ baseDirectory: string;
27
+ issue: number;
28
+ };
29
+ export declare function overrideFromDetails(overridePath: string, answers: OverridePromptAnswers, factory: OverrideFactory): Promise<Override>;
30
+ export declare function promptForOverrideDetails(): Promise<OverridePromptAnswers>;
@@ -1,131 +1,131 @@
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.promptForOverrideDetails = exports.overrideFromDetails = void 0;
36
- const FileSearch = __importStar(require("./FileSearch"));
37
- const inquirer_1 = __importDefault(require("inquirer"));
38
- const path_1 = __importDefault(require("path"));
39
- const PathUtils_1 = require("./PathUtils");
40
- async function overrideFromDetails(overridePath, answers, factory) {
41
- const manifestPath = await FileSearch.findManifest(overridePath);
42
- const manifestDir = path_1.default.dirname(manifestPath);
43
- const overrideName = (0, PathUtils_1.normalizePath)(path_1.default.relative(manifestDir, overridePath));
44
- switch (answers.type) {
45
- case 'derived':
46
- return factory.createDerivedOverride(overrideName, answers.baseFile, answers.issue);
47
- case 'patch':
48
- return factory.createPatchOverride(overrideName, answers.baseFile, answers.issue);
49
- case 'platform':
50
- return factory.createPlatformOverride(overridePath);
51
- case 'copy':
52
- return factory.createCopyOverride(overrideName, answers.baseFile, answers.issue);
53
- case 'directoryCopy':
54
- return factory.createDirectoryCopyOverride(overrideName, answers.baseDirectory, answers.issue);
55
- }
56
- }
57
- exports.overrideFromDetails = overrideFromDetails;
58
- async function promptForOverrideDetails() {
59
- return inquirer_1.default.prompt([
60
- {
61
- type: 'list',
62
- name: 'type',
63
- message: 'Override type:',
64
- choices: [
65
- {
66
- name: 'Derived from upstream (E.g. a Windows implementation of an existing component)',
67
- value: 'derived',
68
- short: 'Derived',
69
- },
70
- {
71
- name: 'Patches to upstream (E.g. commenting out code)',
72
- value: 'patch',
73
- short: 'Patch',
74
- },
75
- {
76
- name: 'Independent platform logic (E.g. Windows-specific modules)',
77
- value: 'platform',
78
- short: 'Platform',
79
- },
80
- {
81
- name: 'Copy of an upstream file',
82
- value: 'copy',
83
- short: 'Copy',
84
- },
85
- {
86
- name: 'Copy of an upstream directory',
87
- value: 'directoryCopy',
88
- short: 'Directory Copy',
89
- },
90
- ],
91
- },
92
- {
93
- when: res => res.type === 'derived',
94
- type: 'confirm',
95
- name: 'codeCopied',
96
- default: true,
97
- message: 'Does the derived file copy code from upstream?',
98
- },
99
- {
100
- when: res => (res.type === 'derived' && res.codeCopied) ||
101
- ['copy', 'directoryCopy', 'patch'].includes(res.type),
102
- type: 'input',
103
- validate: validateIssueNumber,
104
- filter: filterIssueNumber,
105
- askAnswered: true,
106
- name: 'issue',
107
- message: 'Issue number tracking removal:',
108
- },
109
- {
110
- when: res => ['copy', 'patch', 'derived'].includes(res.type),
111
- type: 'input',
112
- name: 'baseFile',
113
- message: 'What file is this override based off of?',
114
- },
115
- {
116
- when: res => res.type === 'directoryCopy',
117
- type: 'input',
118
- name: 'baseDirectory',
119
- message: 'What directory are you copying from?',
120
- },
121
- ]);
122
- }
123
- exports.promptForOverrideDetails = promptForOverrideDetails;
124
- function filterIssueNumber(answer) {
125
- const parsedInt = Number.parseInt(answer, 10);
126
- return Number.isInteger(parsedInt) ? parsedInt : '';
127
- }
128
- function validateIssueNumber(answer) {
129
- return (Number.isInteger(Number.parseInt(answer, 10)) || 'Issue must be a number');
130
- }
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.promptForOverrideDetails = exports.overrideFromDetails = void 0;
36
+ const FileSearch = __importStar(require("./FileSearch"));
37
+ const inquirer_1 = __importDefault(require("inquirer"));
38
+ const path_1 = __importDefault(require("path"));
39
+ const PathUtils_1 = require("./PathUtils");
40
+ async function overrideFromDetails(overridePath, answers, factory) {
41
+ const manifestPath = await FileSearch.findManifest(overridePath);
42
+ const manifestDir = path_1.default.dirname(manifestPath);
43
+ const overrideName = (0, PathUtils_1.normalizePath)(path_1.default.relative(manifestDir, overridePath));
44
+ switch (answers.type) {
45
+ case 'derived':
46
+ return factory.createDerivedOverride(overrideName, answers.baseFile, answers.issue);
47
+ case 'patch':
48
+ return factory.createPatchOverride(overrideName, answers.baseFile, answers.issue);
49
+ case 'platform':
50
+ return factory.createPlatformOverride(overridePath);
51
+ case 'copy':
52
+ return factory.createCopyOverride(overrideName, answers.baseFile, answers.issue);
53
+ case 'directoryCopy':
54
+ return factory.createDirectoryCopyOverride(overrideName, answers.baseDirectory, answers.issue);
55
+ }
56
+ }
57
+ exports.overrideFromDetails = overrideFromDetails;
58
+ async function promptForOverrideDetails() {
59
+ return inquirer_1.default.prompt([
60
+ {
61
+ type: 'list',
62
+ name: 'type',
63
+ message: 'Override type:',
64
+ choices: [
65
+ {
66
+ name: 'Derived from upstream (E.g. a Windows implementation of an existing component)',
67
+ value: 'derived',
68
+ short: 'Derived',
69
+ },
70
+ {
71
+ name: 'Patches to upstream (E.g. commenting out code)',
72
+ value: 'patch',
73
+ short: 'Patch',
74
+ },
75
+ {
76
+ name: 'Independent platform logic (E.g. Windows-specific modules)',
77
+ value: 'platform',
78
+ short: 'Platform',
79
+ },
80
+ {
81
+ name: 'Copy of an upstream file',
82
+ value: 'copy',
83
+ short: 'Copy',
84
+ },
85
+ {
86
+ name: 'Copy of an upstream directory',
87
+ value: 'directoryCopy',
88
+ short: 'Directory Copy',
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ when: res => res.type === 'derived',
94
+ type: 'confirm',
95
+ name: 'codeCopied',
96
+ default: true,
97
+ message: 'Does the derived file copy code from upstream?',
98
+ },
99
+ {
100
+ when: res => (res.type === 'derived' && res.codeCopied) ||
101
+ ['copy', 'directoryCopy', 'patch'].includes(res.type),
102
+ type: 'input',
103
+ validate: validateIssueNumber,
104
+ filter: filterIssueNumber,
105
+ askAnswered: true,
106
+ name: 'issue',
107
+ message: 'Issue number tracking removal:',
108
+ },
109
+ {
110
+ when: res => ['copy', 'patch', 'derived'].includes(res.type),
111
+ type: 'input',
112
+ name: 'baseFile',
113
+ message: 'What file is this override based off of?',
114
+ },
115
+ {
116
+ when: res => res.type === 'directoryCopy',
117
+ type: 'input',
118
+ name: 'baseDirectory',
119
+ message: 'What directory are you copying from?',
120
+ },
121
+ ]);
122
+ }
123
+ exports.promptForOverrideDetails = promptForOverrideDetails;
124
+ function filterIssueNumber(answer) {
125
+ const parsedInt = Number.parseInt(answer, 10);
126
+ return Number.isInteger(parsedInt) ? parsedInt : '';
127
+ }
128
+ function validateIssueNumber(answer) {
129
+ return (Number.isInteger(Number.parseInt(answer, 10)) || 'Issue must be a number');
130
+ }
131
131
  //# sourceMappingURL=OverridePrompt.js.map
@@ -1,15 +1,15 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * @format
6
- */
7
- /**
8
- * Try to find the currently installed React Native version by searching for and
9
- * reading it's package.json.
10
- */
11
- export declare function getInstalledRNVersion(): Promise<string>;
12
- /**
13
- * Return an object representing the package.json of our current package
14
- */
15
- export declare function getNpmPackage(): Promise<any>;
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @format
6
+ */
7
+ /**
8
+ * Try to find the currently installed React Native version by searching for and
9
+ * reading it's package.json.
10
+ */
11
+ export declare function getInstalledRNVersion(): Promise<string>;
12
+ /**
13
+ * Return an object representing the package.json of our current package
14
+ */
15
+ export declare function getNpmPackage(): Promise<any>;
@@ -1,41 +1,41 @@
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.getNpmPackage = exports.getInstalledRNVersion = void 0;
13
- const fs_1 = __importDefault(require("@react-native-windows/fs"));
14
- const FileSearch_1 = require("./FileSearch");
15
- let npmPackage = null;
16
- /**
17
- * Try to find the currently installed React Native version by searching for and
18
- * reading it's package.json.
19
- */
20
- async function getInstalledRNVersion() {
21
- const rnPackage = require('react-native/package.json');
22
- const version = rnPackage.version;
23
- if (typeof version !== 'string') {
24
- throw new Error('Unexpected format of React Native package.json');
25
- }
26
- return version;
27
- }
28
- exports.getInstalledRNVersion = getInstalledRNVersion;
29
- /**
30
- * Return an object representing the package.json of our current package
31
- */
32
- async function getNpmPackage() {
33
- if (npmPackage !== null) {
34
- return npmPackage;
35
- }
36
- const npmPackagePath = await (0, FileSearch_1.findThisPackage)();
37
- npmPackage = await fs_1.default.readJsonFile(npmPackagePath);
38
- return npmPackage;
39
- }
40
- exports.getNpmPackage = getNpmPackage;
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.getNpmPackage = exports.getInstalledRNVersion = void 0;
13
+ const fs_1 = __importDefault(require("@react-native-windows/fs"));
14
+ const FileSearch_1 = require("./FileSearch");
15
+ let npmPackage = null;
16
+ /**
17
+ * Try to find the currently installed React Native version by searching for and
18
+ * reading it's package.json.
19
+ */
20
+ async function getInstalledRNVersion() {
21
+ const rnPackage = require('react-native/package.json');
22
+ const version = rnPackage.version;
23
+ if (typeof version !== 'string') {
24
+ throw new Error('Unexpected format of React Native package.json');
25
+ }
26
+ return version;
27
+ }
28
+ exports.getInstalledRNVersion = getInstalledRNVersion;
29
+ /**
30
+ * Return an object representing the package.json of our current package
31
+ */
32
+ async function getNpmPackage() {
33
+ if (npmPackage !== null) {
34
+ return npmPackage;
35
+ }
36
+ const npmPackagePath = await (0, FileSearch_1.findThisPackage)();
37
+ npmPackage = await fs_1.default.readJsonFile(npmPackagePath);
38
+ return npmPackage;
39
+ }
40
+ exports.getNpmPackage = getNpmPackage;
41
41
  //# sourceMappingURL=PackageUtils.js.map
@@ -1,14 +1,14 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- *
5
- * @format
6
- */
7
- /**
8
- * Convert a path to use Unix-style slashes
9
- */
10
- export declare function unixPath(filepath: string): string;
11
- /**
12
- * Normalize a path and convert to use platform-specific slashes
13
- */
14
- export declare function normalizePath(filepath: string): string;
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * @format
6
+ */
7
+ /**
8
+ * Convert a path to use Unix-style slashes
9
+ */
10
+ export declare function unixPath(filepath: string): string;
11
+ /**
12
+ * Normalize a path and convert to use platform-specific slashes
13
+ */
14
+ export declare function normalizePath(filepath: string): string;