@react-native-windows/cli 0.73.2 → 0.74.0-preview.2

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 (76) hide show
  1. package/lib-commonjs/commands/autolinkWindows/autolinkWindows.d.ts +87 -87
  2. package/lib-commonjs/commands/autolinkWindows/autolinkWindows.js +654 -654
  3. package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.d.ts +14 -14
  4. package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.js +32 -32
  5. package/lib-commonjs/commands/codegenWindows/codegenWindows.d.ts +27 -27
  6. package/lib-commonjs/commands/codegenWindows/codegenWindows.js +205 -205
  7. package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.d.ts +12 -12
  8. package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.js +22 -22
  9. package/lib-commonjs/commands/config/configUtils.d.ts +123 -123
  10. package/lib-commonjs/commands/config/configUtils.js +380 -380
  11. package/lib-commonjs/commands/config/dependencyConfig.d.ts +37 -37
  12. package/lib-commonjs/commands/config/dependencyConfig.js +227 -227
  13. package/lib-commonjs/commands/config/projectConfig.d.ts +27 -27
  14. package/lib-commonjs/commands/config/projectConfig.js +180 -180
  15. package/lib-commonjs/commands/healthCheck/healthCheckList.d.ts +6 -6
  16. package/lib-commonjs/commands/healthCheck/healthCheckList.js +20 -20
  17. package/lib-commonjs/commands/healthCheck/healthCheckList.js.map +1 -1
  18. package/lib-commonjs/commands/healthCheck/healthChecks.d.ts +7 -7
  19. package/lib-commonjs/commands/healthCheck/healthChecks.js +123 -123
  20. package/lib-commonjs/commands/initWindows/initWindows.d.ts +46 -46
  21. package/lib-commonjs/commands/initWindows/initWindows.js +243 -243
  22. package/lib-commonjs/commands/initWindows/initWindowsOptions.d.ts +15 -15
  23. package/lib-commonjs/commands/initWindows/initWindowsOptions.js +37 -37
  24. package/lib-commonjs/commands/runWindows/runWindows.d.ts +10 -10
  25. package/lib-commonjs/commands/runWindows/runWindows.js +321 -321
  26. package/lib-commonjs/commands/runWindows/runWindowsOptions.d.ts +56 -56
  27. package/lib-commonjs/commands/runWindows/runWindowsOptions.js +132 -132
  28. package/lib-commonjs/e2etest/autolink.test.d.ts +6 -6
  29. package/lib-commonjs/e2etest/autolink.test.js +366 -366
  30. package/lib-commonjs/e2etest/dependencyConfig.test.d.ts +6 -6
  31. package/lib-commonjs/e2etest/dependencyConfig.test.js +129 -129
  32. package/lib-commonjs/e2etest/healthChecks.test.d.ts +6 -6
  33. package/lib-commonjs/e2etest/healthChecks.test.js +30 -30
  34. package/lib-commonjs/e2etest/initWindows.test.d.ts +6 -6
  35. package/lib-commonjs/e2etest/initWindows.test.js +42 -42
  36. package/lib-commonjs/e2etest/projectConfig.test.d.ts +6 -6
  37. package/lib-commonjs/e2etest/projectConfig.test.js +110 -110
  38. package/lib-commonjs/e2etest/projectConfig.utils.d.ts +8 -8
  39. package/lib-commonjs/e2etest/projectConfig.utils.js +76 -76
  40. package/lib-commonjs/e2etest/runWindows.test.d.ts +6 -6
  41. package/lib-commonjs/e2etest/runWindows.test.js +60 -60
  42. package/lib-commonjs/e2etest/typesUpToDate.test.d.ts +6 -0
  43. package/lib-commonjs/e2etest/typesUpToDate.test.js +21 -0
  44. package/lib-commonjs/e2etest/typesUpToDate.test.js.map +1 -0
  45. package/lib-commonjs/generator-common/index.d.ts +39 -39
  46. package/lib-commonjs/generator-common/index.js +242 -242
  47. package/lib-commonjs/generator-windows/index.d.ts +10 -10
  48. package/lib-commonjs/generator-windows/index.js +316 -316
  49. package/lib-commonjs/index.d.ts +50 -50
  50. package/lib-commonjs/index.js +77 -77
  51. package/lib-commonjs/utils/build.d.ts +12 -12
  52. package/lib-commonjs/utils/build.js +84 -84
  53. package/lib-commonjs/utils/checkRequirements.d.ts +6 -6
  54. package/lib-commonjs/utils/checkRequirements.js +69 -69
  55. package/lib-commonjs/utils/commandWithProgress.d.ts +21 -21
  56. package/lib-commonjs/utils/commandWithProgress.js +149 -149
  57. package/lib-commonjs/utils/deploy.d.ts +12 -12
  58. package/lib-commonjs/utils/deploy.js +353 -353
  59. package/lib-commonjs/utils/info.d.ts +6 -6
  60. package/lib-commonjs/utils/info.js +28 -28
  61. package/lib-commonjs/utils/msbuildtools.d.ts +28 -28
  62. package/lib-commonjs/utils/msbuildtools.js +273 -273
  63. package/lib-commonjs/utils/msbuildtools.js.map +1 -1
  64. package/lib-commonjs/utils/pathHelpers.d.ts +9 -9
  65. package/lib-commonjs/utils/pathHelpers.js +36 -36
  66. package/lib-commonjs/utils/telemetryHelpers.d.ts +29 -29
  67. package/lib-commonjs/utils/telemetryHelpers.js +120 -120
  68. package/lib-commonjs/utils/version.d.ts +19 -19
  69. package/lib-commonjs/utils/version.js +109 -109
  70. package/lib-commonjs/utils/vsInstalls.d.ts +34 -34
  71. package/lib-commonjs/utils/vsInstalls.js +99 -99
  72. package/lib-commonjs/utils/vstools.d.ts +16 -16
  73. package/lib-commonjs/utils/vstools.js +189 -189
  74. package/lib-commonjs/utils/winappdeploytool.d.ts +24 -24
  75. package/lib-commonjs/utils/winappdeploytool.js +108 -108
  76. package/package.json +16 -16
@@ -1,37 +1,37 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
- export interface ProjectDependency {
7
- projectFile: string;
8
- directDependency: boolean;
9
- projectName: string;
10
- projectLang: 'cpp' | 'cs' | null;
11
- projectGuid: string | null;
12
- cppHeaders: string[];
13
- cppPackageProviders: string[];
14
- csNamespaces: string[];
15
- csPackageProviders: string[];
16
- }
17
- export interface NuGetPackageDependency {
18
- packageName: string;
19
- packageVersion: string;
20
- cppHeaders: string[];
21
- cppPackageProviders: string[];
22
- csNamespaces: string[];
23
- csPackageProviders: string[];
24
- }
25
- export interface WindowsDependencyConfig {
26
- folder: string;
27
- sourceDir?: string;
28
- solutionFile?: string | null;
29
- projects: ProjectDependency[];
30
- nugetPackages: NuGetPackageDependency[];
31
- }
32
- /**
33
- * Gets the config of any RNW native modules under the target folder.
34
- * @param userConfig A manually specified override config.
35
- * @return The config if any RNW native modules exist.
36
- */
37
- export declare function dependencyConfigWindows(folder: string, userConfig?: Partial<WindowsDependencyConfig> | null): WindowsDependencyConfig | null;
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ * @format
5
+ */
6
+ export interface ProjectDependency {
7
+ projectFile: string;
8
+ directDependency: boolean;
9
+ projectName: string;
10
+ projectLang: 'cpp' | 'cs' | null;
11
+ projectGuid: string | null;
12
+ cppHeaders: string[];
13
+ cppPackageProviders: string[];
14
+ csNamespaces: string[];
15
+ csPackageProviders: string[];
16
+ }
17
+ export interface NuGetPackageDependency {
18
+ packageName: string;
19
+ packageVersion: string;
20
+ cppHeaders: string[];
21
+ cppPackageProviders: string[];
22
+ csNamespaces: string[];
23
+ csPackageProviders: string[];
24
+ }
25
+ export interface WindowsDependencyConfig {
26
+ folder: string;
27
+ sourceDir?: string;
28
+ solutionFile?: string | null;
29
+ projects: ProjectDependency[];
30
+ nugetPackages: NuGetPackageDependency[];
31
+ }
32
+ /**
33
+ * Gets the config of any RNW native modules under the target folder.
34
+ * @param userConfig A manually specified override config.
35
+ * @return The config if any RNW native modules exist.
36
+ */
37
+ export declare function dependencyConfigWindows(folder: string, userConfig?: Partial<WindowsDependencyConfig> | null): WindowsDependencyConfig | null;
@@ -1,228 +1,228 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation.
4
- * Licensed under the MIT License.
5
- * @format
6
- */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- var desc = Object.getOwnPropertyDescriptor(m, k);
10
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
- desc = { enumerable: true, get: function() { return m[k]; } };
12
- }
13
- Object.defineProperty(o, k2, desc);
14
- }) : (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- o[k2] = m[k];
17
- }));
18
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
- Object.defineProperty(o, "default", { enumerable: true, value: v });
20
- }) : function(o, v) {
21
- o["default"] = v;
22
- });
23
- var __importStar = (this && this.__importStar) || function (mod) {
24
- if (mod && mod.__esModule) return mod;
25
- var result = {};
26
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
27
- __setModuleDefault(result, mod);
28
- return result;
29
- };
30
- var __importDefault = (this && this.__importDefault) || function (mod) {
31
- return (mod && mod.__esModule) ? mod : { "default": mod };
32
- };
33
- Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.dependencyConfigWindows = void 0;
35
- // Types in this file are inaccurate compared to usage in terms of falsiness.
36
- // We should try to rewrite some of this to do automated schema validation to
37
- // guarantee correct types
38
- /* eslint-disable @typescript-eslint/no-unnecessary-condition */
39
- const os_1 = require("os");
40
- const path_1 = __importDefault(require("path"));
41
- const configUtils = __importStar(require("./configUtils"));
42
- /**
43
- * Gets the config of any RNW native modules under the target folder.
44
- * @param userConfig A manually specified override config.
45
- * @return The config if any RNW native modules exist.
46
- */
47
- // Disabled due to existing high cyclomatic complexity
48
- // eslint-disable-next-line complexity
49
- function dependencyConfigWindows(folder, userConfig = {}) {
50
- if ((0, os_1.platform)() !== 'win32') {
51
- return null;
52
- }
53
- if (userConfig === null) {
54
- return null;
55
- }
56
- const usingManualProjectsOverride = 'projects' in userConfig && Array.isArray(userConfig.projects);
57
- const usingManualNugetPackagesOverride = 'nugetPackages' in userConfig && Array.isArray(userConfig.nugetPackages);
58
- const result = {
59
- folder,
60
- projects: usingManualProjectsOverride ? userConfig.projects : [],
61
- solutionFile: null,
62
- nugetPackages: usingManualNugetPackagesOverride
63
- ? userConfig.nugetPackages
64
- : [],
65
- };
66
- let sourceDir = null;
67
- if (usingManualProjectsOverride && result.projects.length > 0) {
68
- // Manually provided projects, so extract the sourceDir
69
- if (!('sourceDir' in userConfig)) {
70
- sourceDir =
71
- 'Error: Source dir is required if projects are specified, but it is not specified in react-native.config.';
72
- }
73
- else if (userConfig.sourceDir === null) {
74
- sourceDir =
75
- 'Error: Source dir is required if projects are specified, but it is null in react-native.config.';
76
- }
77
- else {
78
- sourceDir = path_1.default.join(folder, userConfig.sourceDir);
79
- }
80
- }
81
- else if (!usingManualProjectsOverride) {
82
- // No manually provided projects, try to find sourceDir
83
- if ('sourceDir' in userConfig && userConfig.sourceDir !== null) {
84
- sourceDir = path_1.default.join(folder, userConfig.sourceDir);
85
- }
86
- else {
87
- sourceDir = configUtils.findWindowsFolder(folder);
88
- }
89
- }
90
- if (sourceDir === null) {
91
- // Try to salvage the missing sourceDir
92
- if (result.projects.length === 0 && result.nugetPackages.length > 0) {
93
- // Only nuget packages, no sourceDir required
94
- return result;
95
- }
96
- else if (result.projects.length > 0) {
97
- // Projects overridden but no sourceDir, assume the sourceDir === folder
98
- sourceDir = folder;
99
- }
100
- }
101
- else if (sourceDir.startsWith('Error: ')) {
102
- // Source dir error, bail with error
103
- result.sourceDir = sourceDir;
104
- return result;
105
- }
106
- if (sourceDir === null) {
107
- // After everything above, if sourceDir is still null,
108
- // there's nothing more to look for here, bail
109
- return null;
110
- }
111
- result.sourceDir = path_1.default.relative(folder, sourceDir);
112
- const usingManualSolutionFile = 'solutionFile' in userConfig;
113
- let solutionFile = null;
114
- if (usingManualSolutionFile && userConfig.solutionFile !== null) {
115
- // Manually provided solutionFile, so extract it
116
- solutionFile = path_1.default.join(sourceDir, userConfig.solutionFile);
117
- }
118
- else if (!usingManualSolutionFile) {
119
- // No manually provided solutionFile, try to find it
120
- const foundSolutions = configUtils.findSolutionFiles(sourceDir);
121
- if (foundSolutions.length === 1) {
122
- solutionFile = path_1.default.join(sourceDir, foundSolutions[0]);
123
- }
124
- }
125
- result.solutionFile =
126
- solutionFile !== null ? path_1.default.relative(sourceDir, solutionFile) : null;
127
- if (usingManualProjectsOverride) {
128
- // react-native.config used, fill out (auto) items for each provided project, verify (req) items are present
129
- const alwaysRequired = [
130
- 'projectFile',
131
- 'directDependency',
132
- ];
133
- for (const project of result.projects) {
134
- // Verifying (req) items
135
- let errorFound = false;
136
- alwaysRequired.forEach(item => {
137
- if (!(item in project)) {
138
- project[item] = `Error: ${item} is required for each project in react-native.config`;
139
- errorFound = true;
140
- }
141
- });
142
- if (errorFound) {
143
- break;
144
- }
145
- const projectFile = path_1.default.join(sourceDir, project.projectFile);
146
- const projectContents = configUtils.readProjectFile(projectFile);
147
- project.projectFile = path_1.default.relative(sourceDir, projectFile);
148
- // Calculating (auto) items
149
- project.projectName = configUtils.getProjectName(projectFile, projectContents);
150
- project.projectLang = configUtils.getProjectLanguage(projectFile);
151
- project.projectGuid = configUtils.getProjectGuid(projectContents);
152
- if (project.directDependency) {
153
- // Calculating more (auto) items
154
- const projectNamespace = configUtils.getProjectNamespace(projectContents);
155
- if (projectNamespace !== null) {
156
- const cppNamespace = projectNamespace.replace(/\./g, '::');
157
- const csNamespace = projectNamespace.replace(/::/g, '.');
158
- project.cppHeaders = project.cppHeaders || [`winrt/${csNamespace}.h`];
159
- project.cppPackageProviders = project.cppPackageProviders || [
160
- `${cppNamespace}::ReactPackageProvider`,
161
- ];
162
- project.csNamespaces = project.csNamespaces || [`${csNamespace}`];
163
- project.csPackageProviders = project.csPackageProviders || [
164
- `${csNamespace}.ReactPackageProvider`,
165
- ];
166
- }
167
- }
168
- }
169
- }
170
- else {
171
- // No react-native.config, try to heuristically find any projects
172
- const foundProjects = configUtils.findDependencyProjectFiles(sourceDir);
173
- for (const foundProject of foundProjects) {
174
- const projectFile = path_1.default.join(sourceDir, foundProject);
175
- const projectContents = configUtils.readProjectFile(projectFile);
176
- const projectType = configUtils.getProjectType(projectFile, projectContents);
177
- if (projectType === 'dynamiclibrary' ||
178
- projectType === 'winmdobj' ||
179
- projectType === 'library') {
180
- const projectLang = configUtils.getProjectLanguage(projectFile);
181
- const projectName = configUtils.getProjectName(projectFile, projectContents);
182
- const projectGuid = configUtils.getProjectGuid(projectContents);
183
- const projectNamespace = configUtils.getProjectNamespace(projectContents);
184
- const directDependency = true;
185
- const cppHeaders = [];
186
- const cppPackageProviders = [];
187
- const csNamespaces = [];
188
- const csPackageProviders = [];
189
- if (projectNamespace !== null) {
190
- const cppNamespace = projectNamespace.replace(/\./g, '::');
191
- const csNamespace = projectNamespace.replace(/::/g, '.');
192
- cppHeaders.push(`winrt/${csNamespace}.h`);
193
- cppPackageProviders.push(`${cppNamespace}::ReactPackageProvider`);
194
- csNamespaces.push(`${csNamespace}`);
195
- csPackageProviders.push(`${csNamespace}.ReactPackageProvider`);
196
- }
197
- result.projects.push({
198
- projectFile: path_1.default.relative(sourceDir, projectFile),
199
- projectName,
200
- projectLang,
201
- projectGuid,
202
- directDependency,
203
- cppHeaders,
204
- cppPackageProviders,
205
- csNamespaces,
206
- csPackageProviders,
207
- });
208
- }
209
- else {
210
- const projectPath = path_1.default.relative(sourceDir, projectFile);
211
- result.projects.push({
212
- projectFile: `Error: ${projectPath} is type '${projectType}'`,
213
- directDependency: false,
214
- projectName: '',
215
- projectLang: null,
216
- projectGuid: null,
217
- cppHeaders: [],
218
- cppPackageProviders: [],
219
- csNamespaces: [],
220
- csPackageProviders: [],
221
- });
222
- }
223
- }
224
- }
225
- return result;
226
- }
227
- exports.dependencyConfigWindows = dependencyConfigWindows;
1
+ "use strict";
2
+ /**
3
+ * Copyright (c) Microsoft Corporation.
4
+ * Licensed under the MIT License.
5
+ * @format
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
20
+ }) : function(o, v) {
21
+ o["default"] = v;
22
+ });
23
+ var __importStar = (this && this.__importStar) || function (mod) {
24
+ if (mod && mod.__esModule) return mod;
25
+ var result = {};
26
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
27
+ __setModuleDefault(result, mod);
28
+ return result;
29
+ };
30
+ var __importDefault = (this && this.__importDefault) || function (mod) {
31
+ return (mod && mod.__esModule) ? mod : { "default": mod };
32
+ };
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.dependencyConfigWindows = void 0;
35
+ // Types in this file are inaccurate compared to usage in terms of falsiness.
36
+ // We should try to rewrite some of this to do automated schema validation to
37
+ // guarantee correct types
38
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
39
+ const os_1 = require("os");
40
+ const path_1 = __importDefault(require("path"));
41
+ const configUtils = __importStar(require("./configUtils"));
42
+ /**
43
+ * Gets the config of any RNW native modules under the target folder.
44
+ * @param userConfig A manually specified override config.
45
+ * @return The config if any RNW native modules exist.
46
+ */
47
+ // Disabled due to existing high cyclomatic complexity
48
+ // eslint-disable-next-line complexity
49
+ function dependencyConfigWindows(folder, userConfig = {}) {
50
+ if ((0, os_1.platform)() !== 'win32') {
51
+ return null;
52
+ }
53
+ if (userConfig === null) {
54
+ return null;
55
+ }
56
+ const usingManualProjectsOverride = 'projects' in userConfig && Array.isArray(userConfig.projects);
57
+ const usingManualNugetPackagesOverride = 'nugetPackages' in userConfig && Array.isArray(userConfig.nugetPackages);
58
+ const result = {
59
+ folder,
60
+ projects: usingManualProjectsOverride ? userConfig.projects : [],
61
+ solutionFile: null,
62
+ nugetPackages: usingManualNugetPackagesOverride
63
+ ? userConfig.nugetPackages
64
+ : [],
65
+ };
66
+ let sourceDir = null;
67
+ if (usingManualProjectsOverride && result.projects.length > 0) {
68
+ // Manually provided projects, so extract the sourceDir
69
+ if (!('sourceDir' in userConfig)) {
70
+ sourceDir =
71
+ 'Error: Source dir is required if projects are specified, but it is not specified in react-native.config.';
72
+ }
73
+ else if (userConfig.sourceDir === null) {
74
+ sourceDir =
75
+ 'Error: Source dir is required if projects are specified, but it is null in react-native.config.';
76
+ }
77
+ else {
78
+ sourceDir = path_1.default.join(folder, userConfig.sourceDir);
79
+ }
80
+ }
81
+ else if (!usingManualProjectsOverride) {
82
+ // No manually provided projects, try to find sourceDir
83
+ if ('sourceDir' in userConfig && userConfig.sourceDir !== null) {
84
+ sourceDir = path_1.default.join(folder, userConfig.sourceDir);
85
+ }
86
+ else {
87
+ sourceDir = configUtils.findWindowsFolder(folder);
88
+ }
89
+ }
90
+ if (sourceDir === null) {
91
+ // Try to salvage the missing sourceDir
92
+ if (result.projects.length === 0 && result.nugetPackages.length > 0) {
93
+ // Only nuget packages, no sourceDir required
94
+ return result;
95
+ }
96
+ else if (result.projects.length > 0) {
97
+ // Projects overridden but no sourceDir, assume the sourceDir === folder
98
+ sourceDir = folder;
99
+ }
100
+ }
101
+ else if (sourceDir.startsWith('Error: ')) {
102
+ // Source dir error, bail with error
103
+ result.sourceDir = sourceDir;
104
+ return result;
105
+ }
106
+ if (sourceDir === null) {
107
+ // After everything above, if sourceDir is still null,
108
+ // there's nothing more to look for here, bail
109
+ return null;
110
+ }
111
+ result.sourceDir = path_1.default.relative(folder, sourceDir);
112
+ const usingManualSolutionFile = 'solutionFile' in userConfig;
113
+ let solutionFile = null;
114
+ if (usingManualSolutionFile && userConfig.solutionFile !== null) {
115
+ // Manually provided solutionFile, so extract it
116
+ solutionFile = path_1.default.join(sourceDir, userConfig.solutionFile);
117
+ }
118
+ else if (!usingManualSolutionFile) {
119
+ // No manually provided solutionFile, try to find it
120
+ const foundSolutions = configUtils.findSolutionFiles(sourceDir);
121
+ if (foundSolutions.length === 1) {
122
+ solutionFile = path_1.default.join(sourceDir, foundSolutions[0]);
123
+ }
124
+ }
125
+ result.solutionFile =
126
+ solutionFile !== null ? path_1.default.relative(sourceDir, solutionFile) : null;
127
+ if (usingManualProjectsOverride) {
128
+ // react-native.config used, fill out (auto) items for each provided project, verify (req) items are present
129
+ const alwaysRequired = [
130
+ 'projectFile',
131
+ 'directDependency',
132
+ ];
133
+ for (const project of result.projects) {
134
+ // Verifying (req) items
135
+ let errorFound = false;
136
+ alwaysRequired.forEach(item => {
137
+ if (!(item in project)) {
138
+ project[item] = `Error: ${item} is required for each project in react-native.config`;
139
+ errorFound = true;
140
+ }
141
+ });
142
+ if (errorFound) {
143
+ break;
144
+ }
145
+ const projectFile = path_1.default.join(sourceDir, project.projectFile);
146
+ const projectContents = configUtils.readProjectFile(projectFile);
147
+ project.projectFile = path_1.default.relative(sourceDir, projectFile);
148
+ // Calculating (auto) items
149
+ project.projectName = configUtils.getProjectName(projectFile, projectContents);
150
+ project.projectLang = configUtils.getProjectLanguage(projectFile);
151
+ project.projectGuid = configUtils.getProjectGuid(projectContents);
152
+ if (project.directDependency) {
153
+ // Calculating more (auto) items
154
+ const projectNamespace = configUtils.getProjectNamespace(projectContents);
155
+ if (projectNamespace !== null) {
156
+ const cppNamespace = projectNamespace.replace(/\./g, '::');
157
+ const csNamespace = projectNamespace.replace(/::/g, '.');
158
+ project.cppHeaders = project.cppHeaders || [`winrt/${csNamespace}.h`];
159
+ project.cppPackageProviders = project.cppPackageProviders || [
160
+ `${cppNamespace}::ReactPackageProvider`,
161
+ ];
162
+ project.csNamespaces = project.csNamespaces || [`${csNamespace}`];
163
+ project.csPackageProviders = project.csPackageProviders || [
164
+ `${csNamespace}.ReactPackageProvider`,
165
+ ];
166
+ }
167
+ }
168
+ }
169
+ }
170
+ else {
171
+ // No react-native.config, try to heuristically find any projects
172
+ const foundProjects = configUtils.findDependencyProjectFiles(sourceDir);
173
+ for (const foundProject of foundProjects) {
174
+ const projectFile = path_1.default.join(sourceDir, foundProject);
175
+ const projectContents = configUtils.readProjectFile(projectFile);
176
+ const projectType = configUtils.getProjectType(projectFile, projectContents);
177
+ if (projectType === 'dynamiclibrary' ||
178
+ projectType === 'winmdobj' ||
179
+ projectType === 'library') {
180
+ const projectLang = configUtils.getProjectLanguage(projectFile);
181
+ const projectName = configUtils.getProjectName(projectFile, projectContents);
182
+ const projectGuid = configUtils.getProjectGuid(projectContents);
183
+ const projectNamespace = configUtils.getProjectNamespace(projectContents);
184
+ const directDependency = true;
185
+ const cppHeaders = [];
186
+ const cppPackageProviders = [];
187
+ const csNamespaces = [];
188
+ const csPackageProviders = [];
189
+ if (projectNamespace !== null) {
190
+ const cppNamespace = projectNamespace.replace(/\./g, '::');
191
+ const csNamespace = projectNamespace.replace(/::/g, '.');
192
+ cppHeaders.push(`winrt/${csNamespace}.h`);
193
+ cppPackageProviders.push(`${cppNamespace}::ReactPackageProvider`);
194
+ csNamespaces.push(`${csNamespace}`);
195
+ csPackageProviders.push(`${csNamespace}.ReactPackageProvider`);
196
+ }
197
+ result.projects.push({
198
+ projectFile: path_1.default.relative(sourceDir, projectFile),
199
+ projectName,
200
+ projectLang,
201
+ projectGuid,
202
+ directDependency,
203
+ cppHeaders,
204
+ cppPackageProviders,
205
+ csNamespaces,
206
+ csPackageProviders,
207
+ });
208
+ }
209
+ else {
210
+ const projectPath = path_1.default.relative(sourceDir, projectFile);
211
+ result.projects.push({
212
+ projectFile: `Error: ${projectPath} is type '${projectType}'`,
213
+ directDependency: false,
214
+ projectName: '',
215
+ projectLang: null,
216
+ projectGuid: null,
217
+ cppHeaders: [],
218
+ cppPackageProviders: [],
219
+ csNamespaces: [],
220
+ csPackageProviders: [],
221
+ });
222
+ }
223
+ }
224
+ }
225
+ return result;
226
+ }
227
+ exports.dependencyConfigWindows = dependencyConfigWindows;
228
228
  //# sourceMappingURL=dependencyConfig.js.map
@@ -1,27 +1,27 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
- export interface Project {
7
- projectFile: string;
8
- projectName: string;
9
- projectLang: 'cpp' | 'cs' | null;
10
- projectGuid: string | null;
11
- projectTypeGuid?: string;
12
- }
13
- export interface WindowsProjectConfig {
14
- folder: string;
15
- sourceDir: string;
16
- solutionFile: string;
17
- project: Project;
18
- useWinUI3?: boolean;
19
- experimentalFeatures?: Record<string, string>;
20
- }
21
- /**
22
- * Gets the config of any RNW apps under the target folder.
23
- * @param folder The absolute path to the target folder.
24
- * @param userConfig A manually specified override config.
25
- * @return The config if any RNW apps exist.
26
- */
27
- export declare function projectConfigWindows(folder: string, userConfig?: Partial<WindowsProjectConfig> | null): WindowsProjectConfig | null;
1
+ /**
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ * @format
5
+ */
6
+ export interface Project {
7
+ projectFile: string;
8
+ projectName: string;
9
+ projectLang: 'cpp' | 'cs' | null;
10
+ projectGuid: string | null;
11
+ projectTypeGuid?: string;
12
+ }
13
+ export interface WindowsProjectConfig {
14
+ folder: string;
15
+ sourceDir: string;
16
+ solutionFile: string;
17
+ project: Project;
18
+ useWinUI3?: boolean;
19
+ experimentalFeatures?: Record<string, string>;
20
+ }
21
+ /**
22
+ * Gets the config of any RNW apps under the target folder.
23
+ * @param folder The absolute path to the target folder.
24
+ * @param userConfig A manually specified override config.
25
+ * @return The config if any RNW apps exist.
26
+ */
27
+ export declare function projectConfigWindows(folder: string, userConfig?: Partial<WindowsProjectConfig> | null): WindowsProjectConfig | null;