@react-native-windows/cli 0.0.0-canary.28 → 0.0.0-canary.280

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 (150) hide show
  1. package/README.md +117 -0
  2. package/lib-commonjs/commands/autolinkWindows/autolinkWindows.d.ts +88 -0
  3. package/lib-commonjs/commands/autolinkWindows/autolinkWindows.js +705 -0
  4. package/lib-commonjs/commands/autolinkWindows/autolinkWindows.js.map +1 -0
  5. package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.d.ts +14 -0
  6. package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.js +33 -0
  7. package/lib-commonjs/commands/autolinkWindows/autolinkWindowsOptions.js.map +1 -0
  8. package/lib-commonjs/commands/codegenWindows/codegenWindows.d.ts +27 -0
  9. package/lib-commonjs/commands/codegenWindows/codegenWindows.js +211 -0
  10. package/lib-commonjs/commands/codegenWindows/codegenWindows.js.map +1 -0
  11. package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.d.ts +12 -0
  12. package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.js +23 -0
  13. package/lib-commonjs/commands/codegenWindows/codegenWindowsOptions.js.map +1 -0
  14. package/lib-commonjs/{config → commands/config}/configUtils.d.ts +141 -93
  15. package/lib-commonjs/commands/config/configUtils.js +433 -0
  16. package/lib-commonjs/commands/config/configUtils.js.map +1 -0
  17. package/lib-commonjs/{config → commands/config}/dependencyConfig.d.ts +38 -37
  18. package/lib-commonjs/{config → commands/config}/dependencyConfig.js +229 -171
  19. package/lib-commonjs/commands/config/dependencyConfig.js.map +1 -0
  20. package/lib-commonjs/{config → commands/config}/projectConfig.d.ts +28 -25
  21. package/lib-commonjs/commands/config/projectConfig.js +191 -0
  22. package/lib-commonjs/commands/config/projectConfig.js.map +1 -0
  23. package/lib-commonjs/commands/healthCheck/healthCheckList.d.ts +6 -0
  24. package/lib-commonjs/commands/healthCheck/healthCheckList.js +21 -0
  25. package/lib-commonjs/commands/healthCheck/healthCheckList.js.map +1 -0
  26. package/lib-commonjs/commands/healthCheck/healthChecks.d.ts +7 -0
  27. package/lib-commonjs/commands/healthCheck/healthChecks.js +121 -0
  28. package/lib-commonjs/commands/healthCheck/healthChecks.js.map +1 -0
  29. package/lib-commonjs/commands/initWindows/initWindows.d.ts +46 -0
  30. package/lib-commonjs/commands/initWindows/initWindows.js +290 -0
  31. package/lib-commonjs/commands/initWindows/initWindows.js.map +1 -0
  32. package/lib-commonjs/commands/initWindows/initWindowsOptions.d.ts +16 -0
  33. package/lib-commonjs/commands/initWindows/initWindowsOptions.js +42 -0
  34. package/lib-commonjs/commands/initWindows/initWindowsOptions.js.map +1 -0
  35. package/lib-commonjs/{runWindows → commands/runWindows}/runWindows.d.ts +10 -10
  36. package/lib-commonjs/commands/runWindows/runWindows.js +327 -0
  37. package/lib-commonjs/commands/runWindows/runWindows.js.map +1 -0
  38. package/lib-commonjs/{runWindows → commands/runWindows}/runWindowsOptions.d.ts +54 -52
  39. package/lib-commonjs/{runWindows → commands/runWindows}/runWindowsOptions.js +128 -131
  40. package/lib-commonjs/commands/runWindows/runWindowsOptions.js.map +1 -0
  41. package/lib-commonjs/e2etest/autolink.test.d.ts +6 -0
  42. package/lib-commonjs/e2etest/autolink.test.js +367 -0
  43. package/lib-commonjs/e2etest/autolink.test.js.map +1 -0
  44. package/lib-commonjs/e2etest/createRnwApp.test.d.ts +6 -0
  45. package/lib-commonjs/e2etest/createRnwApp.test.js +296 -0
  46. package/lib-commonjs/e2etest/createRnwApp.test.js.map +1 -0
  47. package/lib-commonjs/e2etest/dependencyConfig.test.d.ts +6 -6
  48. package/lib-commonjs/e2etest/dependencyConfig.test.js +109 -101
  49. package/lib-commonjs/e2etest/dependencyConfig.test.js.map +1 -1
  50. package/lib-commonjs/e2etest/healthChecks.test.d.ts +6 -0
  51. package/lib-commonjs/e2etest/healthChecks.test.js +31 -0
  52. package/lib-commonjs/e2etest/healthChecks.test.js.map +1 -0
  53. package/lib-commonjs/e2etest/initWindows.test.d.ts +6 -0
  54. package/lib-commonjs/e2etest/initWindows.test.js +110 -0
  55. package/lib-commonjs/e2etest/initWindows.test.js.map +1 -0
  56. package/lib-commonjs/e2etest/projectConfig.test.d.ts +6 -6
  57. package/lib-commonjs/e2etest/projectConfig.test.js +107 -101
  58. package/lib-commonjs/e2etest/projectConfig.test.js.map +1 -1
  59. package/lib-commonjs/e2etest/projectConfig.utils.d.ts +8 -0
  60. package/lib-commonjs/e2etest/projectConfig.utils.js +54 -0
  61. package/lib-commonjs/e2etest/projectConfig.utils.js.map +1 -0
  62. package/lib-commonjs/e2etest/runWindows.test.d.ts +6 -0
  63. package/lib-commonjs/e2etest/runWindows.test.js +60 -0
  64. package/lib-commonjs/e2etest/runWindows.test.js.map +1 -0
  65. package/lib-commonjs/e2etest/typesUpToDate.test.d.ts +6 -0
  66. package/lib-commonjs/e2etest/typesUpToDate.test.js +21 -0
  67. package/lib-commonjs/e2etest/typesUpToDate.test.js.map +1 -0
  68. package/lib-commonjs/generator-common/index.d.ts +39 -39
  69. package/lib-commonjs/generator-common/index.js +242 -222
  70. package/lib-commonjs/generator-common/index.js.map +1 -1
  71. package/lib-commonjs/generator-windows/index.d.ts +10 -10
  72. package/lib-commonjs/generator-windows/index.js +331 -366
  73. package/lib-commonjs/generator-windows/index.js.map +1 -1
  74. package/lib-commonjs/index.d.ts +49 -47
  75. package/lib-commonjs/index.js +77 -39
  76. package/lib-commonjs/index.js.map +1 -1
  77. package/lib-commonjs/{runWindows/utils → utils}/build.d.ts +12 -13
  78. package/lib-commonjs/{runWindows/utils → utils}/build.js +89 -91
  79. package/lib-commonjs/utils/build.js.map +1 -0
  80. package/lib-commonjs/{runWindows/utils → utils}/checkRequirements.d.ts +6 -6
  81. package/lib-commonjs/{runWindows/utils → utils}/checkRequirements.js +69 -65
  82. package/lib-commonjs/utils/checkRequirements.js.map +1 -0
  83. package/lib-commonjs/{runWindows/utils → utils}/commandWithProgress.d.ts +21 -13
  84. package/lib-commonjs/{runWindows/utils → utils}/commandWithProgress.js +149 -113
  85. package/lib-commonjs/utils/commandWithProgress.js.map +1 -0
  86. package/lib-commonjs/{runWindows/utils → utils}/deploy.d.ts +12 -12
  87. package/lib-commonjs/utils/deploy.js +351 -0
  88. package/lib-commonjs/utils/deploy.js.map +1 -0
  89. package/lib-commonjs/{runWindows/utils → utils}/info.d.ts +6 -6
  90. package/lib-commonjs/{runWindows/utils → utils}/info.js +28 -25
  91. package/lib-commonjs/utils/info.js.map +1 -0
  92. package/lib-commonjs/utils/msbuildtools.d.ts +28 -0
  93. package/lib-commonjs/utils/msbuildtools.js +280 -0
  94. package/lib-commonjs/utils/msbuildtools.js.map +1 -0
  95. package/lib-commonjs/utils/nameHelpers.d.ts +9 -0
  96. package/lib-commonjs/utils/nameHelpers.js +46 -0
  97. package/lib-commonjs/utils/nameHelpers.js.map +1 -0
  98. package/lib-commonjs/utils/oldArchWarning.d.ts +9 -0
  99. package/lib-commonjs/utils/oldArchWarning.js +29 -0
  100. package/lib-commonjs/utils/oldArchWarning.js.map +1 -0
  101. package/lib-commonjs/utils/pathHelpers.d.ts +6 -0
  102. package/lib-commonjs/utils/pathHelpers.js +19 -0
  103. package/lib-commonjs/utils/pathHelpers.js.map +1 -0
  104. package/lib-commonjs/utils/telemetryHelpers.d.ts +29 -0
  105. package/lib-commonjs/utils/telemetryHelpers.js +127 -0
  106. package/lib-commonjs/utils/telemetryHelpers.js.map +1 -0
  107. package/lib-commonjs/{runWindows/utils → utils}/version.d.ts +19 -19
  108. package/lib-commonjs/{runWindows/utils → utils}/version.js +109 -109
  109. package/lib-commonjs/utils/version.js.map +1 -0
  110. package/lib-commonjs/{runWindows/utils → utils}/vsInstalls.d.ts +34 -34
  111. package/lib-commonjs/utils/vsInstalls.js +102 -0
  112. package/lib-commonjs/utils/vsInstalls.js.map +1 -0
  113. package/lib-commonjs/{runWindows/utils → utils}/vstools.d.ts +16 -16
  114. package/lib-commonjs/{runWindows/utils → utils}/vstools.js +189 -157
  115. package/lib-commonjs/utils/vstools.js.map +1 -0
  116. package/lib-commonjs/{runWindows/utils → utils}/winappdeploytool.d.ts +24 -24
  117. package/lib-commonjs/{runWindows/utils → utils}/winappdeploytool.js +108 -105
  118. package/lib-commonjs/utils/winappdeploytool.js.map +1 -0
  119. package/package.json +50 -31
  120. package/{powershell → src/powershell}/Add-AppDevPackage.ps1 +2 -2
  121. package/src/powershell/Eval-MsBuildProperties.ps1 +156 -0
  122. package/src/powershell/WindowsStoreAppUtils.psm1 +465 -0
  123. package/CHANGELOG.json +0 -443
  124. package/CHANGELOG.md +0 -216
  125. package/lib-commonjs/config/configUtils.js +0 -253
  126. package/lib-commonjs/config/configUtils.js.map +0 -1
  127. package/lib-commonjs/config/dependencyConfig.js.map +0 -1
  128. package/lib-commonjs/config/projectConfig.js +0 -121
  129. package/lib-commonjs/config/projectConfig.js.map +0 -1
  130. package/lib-commonjs/runWindows/runWindows.js +0 -159
  131. package/lib-commonjs/runWindows/runWindows.js.map +0 -1
  132. package/lib-commonjs/runWindows/runWindowsOptions.js.map +0 -1
  133. package/lib-commonjs/runWindows/utils/autolink.d.ts +0 -7
  134. package/lib-commonjs/runWindows/utils/autolink.js +0 -404
  135. package/lib-commonjs/runWindows/utils/autolink.js.map +0 -1
  136. package/lib-commonjs/runWindows/utils/build.js.map +0 -1
  137. package/lib-commonjs/runWindows/utils/checkRequirements.js.map +0 -1
  138. package/lib-commonjs/runWindows/utils/commandWithProgress.js.map +0 -1
  139. package/lib-commonjs/runWindows/utils/deploy.js +0 -247
  140. package/lib-commonjs/runWindows/utils/deploy.js.map +0 -1
  141. package/lib-commonjs/runWindows/utils/info.js.map +0 -1
  142. package/lib-commonjs/runWindows/utils/msbuildtools.d.ts +0 -22
  143. package/lib-commonjs/runWindows/utils/msbuildtools.js +0 -195
  144. package/lib-commonjs/runWindows/utils/msbuildtools.js.map +0 -1
  145. package/lib-commonjs/runWindows/utils/version.js.map +0 -1
  146. package/lib-commonjs/runWindows/utils/vsInstalls.js +0 -70
  147. package/lib-commonjs/runWindows/utils/vsInstalls.js.map +0 -1
  148. package/lib-commonjs/runWindows/utils/vstools.js.map +0 -1
  149. package/lib-commonjs/runWindows/utils/winappdeploytool.js.map +0 -1
  150. package/powershell/WindowsStoreAppUtils.ps1 +0 -264
@@ -0,0 +1,705 @@
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.autolinkCommand = exports.autolinkWindowsInternal = exports.AutoLinkWindows = 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 fs_1 = __importDefault(require("@react-native-windows/fs"));
40
+ const path_1 = __importDefault(require("path"));
41
+ const chalk_1 = __importDefault(require("chalk"));
42
+ const perf_hooks_1 = require("perf_hooks");
43
+ const xmldom_1 = require("@xmldom/xmldom");
44
+ const formatter = require('xml-formatter');
45
+ const telemetry_1 = require("@react-native-windows/telemetry");
46
+ const autolinkWindowsOptions_1 = require("./autolinkWindowsOptions");
47
+ const commandWithProgress_1 = require("../../utils/commandWithProgress");
48
+ const vstools = __importStar(require("../../utils/vstools"));
49
+ const generatorCommon = __importStar(require("../../generator-common"));
50
+ const configUtils = __importStar(require("../config/configUtils"));
51
+ const pathHelpers = __importStar(require("../../utils/pathHelpers"));
52
+ const telemetryHelpers_1 = require("../../utils/telemetryHelpers");
53
+ class AutoLinkWindows {
54
+ areChangesNeeded() {
55
+ return this.changesNecessary;
56
+ }
57
+ getWindowsConfig() {
58
+ return this.windowsAppConfig;
59
+ }
60
+ getSolutionFile() {
61
+ return path_1.default.join(this.getWindowsConfig().folder, this.getWindowsConfig().sourceDir, this.getWindowsConfig().solutionFile);
62
+ }
63
+ constructor(projectConfig, dependenciesConfig, options) {
64
+ this.projectConfig = projectConfig;
65
+ this.dependenciesConfig = dependenciesConfig;
66
+ this.options = options;
67
+ this.changesNecessary = false;
68
+ if (!('windows' in this.projectConfig) ||
69
+ this.projectConfig.windows === null) {
70
+ throw new telemetry_1.CodedError('NoWindowsConfig', 'Windows auto-link only supported on Windows app projects');
71
+ }
72
+ this.windowsAppConfig = projectConfig.windows;
73
+ }
74
+ async run(spinner) {
75
+ const verbose = this.options.logging;
76
+ verboseMessage('', verbose);
77
+ verboseMessage('Parsing project...', verbose);
78
+ const rnwRoot = resolveRnwRoot(this.windowsAppConfig);
79
+ const templateRoot = resolveTemplateRoot(this.windowsAppConfig);
80
+ this.fixUpForSlnOption();
81
+ this.fixUpForProjOption();
82
+ verboseMessage('Found Windows app project, config:', verbose);
83
+ verboseMessage(this.windowsAppConfig, verbose);
84
+ this.validateRequiredAppProperties();
85
+ const solutionFile = this.getSolutionFile();
86
+ const windowsAppProjectConfig = this.windowsAppConfig.project;
87
+ this.validateRequiredProjectProperties();
88
+ const projectFile = this.getProjectFile();
89
+ const projectDir = path_1.default.dirname(projectFile);
90
+ const projectLang = windowsAppProjectConfig.projectLang;
91
+ verboseMessage('Parsing dependencies...', verbose);
92
+ this.changesNecessary =
93
+ (await this.ensureXAMLDialect()) || this.changesNecessary;
94
+ // Generating cs/cpp files for app code consumption
95
+ if (projectLang === 'cs') {
96
+ this.changesNecessary =
97
+ (await this.generateCSAutolinking(templateRoot, projectDir)) ||
98
+ this.changesNecessary;
99
+ }
100
+ else if (projectLang === 'cpp') {
101
+ this.changesNecessary =
102
+ (await this.generateCppAutolinking(templateRoot, projectDir)) ||
103
+ this.changesNecessary;
104
+ }
105
+ // Generating props for app project consumption
106
+ let propertiesForProps = '';
107
+ let csModuleNames = [];
108
+ if (projectLang === 'cpp') {
109
+ csModuleNames = this.getCSModules();
110
+ if (csModuleNames.length > 0) {
111
+ propertiesForProps += `
112
+ <!-- Set due to dependency on C# module(s): ${csModuleNames.join()} -->
113
+ <ConsumeCSharpModules Condition="'$(ConsumeCSharpModules)'==''">true</ConsumeCSharpModules>`;
114
+ }
115
+ }
116
+ this.changesNecessary =
117
+ (await this.generateAutolinkProps(templateRoot, projectDir, propertiesForProps)) || this.changesNecessary;
118
+ // Generating targets for app project consumption
119
+ this.changesNecessary =
120
+ (await this.generateAutolinkTargets(projectDir, templateRoot)) ||
121
+ this.changesNecessary;
122
+ // Generating project entries for solution
123
+ this.changesNecessary =
124
+ this.updateSolution(rnwRoot, solutionFile) || this.changesNecessary;
125
+ spinner.succeed();
126
+ }
127
+ /**
128
+ * Handles the --proj command-line option by consuming its value into the windowsAppConfig
129
+ */
130
+ fixUpForProjOption() {
131
+ if (this.options.proj) {
132
+ const projFile = path_1.default.join(this.windowsAppConfig.folder, this.options.proj);
133
+ const projectContents = configUtils.readProjectFile(projFile);
134
+ this.windowsAppConfig.project = {
135
+ projectFile: path_1.default.relative(path_1.default.join(this.windowsAppConfig.folder, this.windowsAppConfig.sourceDir), projFile),
136
+ projectName: configUtils.getProjectName(projFile, projectContents),
137
+ projectLang: configUtils.getProjectLanguage(projFile),
138
+ projectGuid: configUtils.getProjectGuid(projectContents),
139
+ };
140
+ }
141
+ }
142
+ /**
143
+ * Handles the --sln command-line option by consuming its value into the windowsAppConfig
144
+ */
145
+ fixUpForSlnOption() {
146
+ if (this.options.sln) {
147
+ const slnFile = path_1.default.join(this.windowsAppConfig.folder, this.options.sln);
148
+ this.windowsAppConfig.solutionFile = path_1.default.relative(path_1.default.join(this.windowsAppConfig.folder, this.windowsAppConfig.sourceDir), slnFile);
149
+ }
150
+ }
151
+ /** Validates the all of the required app (solution) properties are present and valid */
152
+ validateRequiredAppProperties() {
153
+ const alwaysRequired = [
154
+ 'folder',
155
+ 'sourceDir',
156
+ 'solutionFile',
157
+ 'project',
158
+ ];
159
+ alwaysRequired.forEach(item => {
160
+ if (!(item in this.windowsAppConfig) ||
161
+ this.windowsAppConfig[item] === null) {
162
+ throw new telemetry_1.CodedError('IncompleteConfig', `${item} is required but not specified by @react-native-community/cli config`, { item: item });
163
+ }
164
+ else if (typeof this.windowsAppConfig[item] === 'string' &&
165
+ this.windowsAppConfig[item].startsWith('Error: ')) {
166
+ throw new telemetry_1.CodedError('InvalidConfig', `${item} invalid. ${this.windowsAppConfig[item]}`, { item: item });
167
+ }
168
+ });
169
+ }
170
+ /** @return the full path to the project file (.vcxproj or .csproj) */
171
+ getProjectFile() {
172
+ const windowsAppConfig = this.getWindowsConfig();
173
+ return path_1.default.join(windowsAppConfig.folder, windowsAppConfig.sourceDir, windowsAppConfig.project.projectFile);
174
+ }
175
+ /** Validates that all of the required app _project_ properties are present and valid */
176
+ validateRequiredProjectProperties() {
177
+ const windowsAppProjectConfig = this.windowsAppConfig.project;
178
+ const projectRequired = [
179
+ 'projectFile',
180
+ 'projectName',
181
+ 'projectLang',
182
+ 'projectGuid',
183
+ ];
184
+ projectRequired.forEach(item => {
185
+ if (!(item in windowsAppProjectConfig) ||
186
+ windowsAppProjectConfig[item] === null) {
187
+ throw new telemetry_1.CodedError('IncompleteConfig', `project.${item} is required but not specified by @react-native-community/cli config`, { item: item });
188
+ }
189
+ else if (typeof windowsAppProjectConfig[item] === 'string' &&
190
+ windowsAppProjectConfig[item].startsWith('Error: ')) {
191
+ throw new telemetry_1.CodedError('InvalidConfig', `project.${item} invalid. ${windowsAppProjectConfig[item]}`, { item: item });
192
+ }
193
+ });
194
+ }
195
+ getAutolinkTemplateFile(templateRoot, targetFile) {
196
+ if (templateRoot.endsWith('\\template')) {
197
+ // Old template split into different folders
198
+ switch (path_1.default.extname(targetFile)) {
199
+ case '.cpp':
200
+ case '.h':
201
+ templateRoot = path_1.default.join(templateRoot, 'cpp-app', 'src');
202
+ break;
203
+ case '.cs':
204
+ templateRoot = path_1.default.join(templateRoot, 'cs-app', 'src');
205
+ break;
206
+ case '.props':
207
+ case '.targets':
208
+ default:
209
+ templateRoot = path_1.default.join(templateRoot, 'shared-app', 'src');
210
+ break;
211
+ }
212
+ }
213
+ else {
214
+ // New template with projected layout
215
+ templateRoot = path_1.default.join(templateRoot, 'windows', 'MyApp');
216
+ }
217
+ return path_1.default.join(templateRoot, targetFile);
218
+ }
219
+ async generateCppAutolinking(templateRoot, projectDir) {
220
+ const { cppPackageProviders, cppIncludes } = this.getCppReplacements();
221
+ const cppFileName = 'AutolinkedNativeModules.g.cpp';
222
+ const headerFileName = 'AutolinkedNativeModules.g.h';
223
+ const srcCppFile = this.getAutolinkTemplateFile(templateRoot, cppFileName);
224
+ const srcHeaderFile = this.getAutolinkTemplateFile(templateRoot, headerFileName);
225
+ const destCppFile = path_1.default.join(projectDir, cppFileName);
226
+ const destHeaderFile = path_1.default.join(projectDir, headerFileName);
227
+ verboseMessage(`Calculating ${chalk_1.default.bold(path_1.default.basename(destCppFile))}...`, this.options.logging);
228
+ const cppContents = generatorCommon.resolveContents(srcCppFile, {
229
+ useMustache: true,
230
+ autolinkCppIncludes: cppIncludes,
231
+ autolinkCppPackageProviders: cppPackageProviders,
232
+ });
233
+ const cppChanged = await this.updateFile(destCppFile, cppContents);
234
+ verboseMessage(`Calculating ${chalk_1.default.bold(path_1.default.basename(destHeaderFile))}...`, this.options.logging);
235
+ const headerContents = generatorCommon.resolveContents(srcHeaderFile, {
236
+ useMustache: true,
237
+ autolinkCppIncludes: cppIncludes,
238
+ autolinkCppPackageProviders: cppPackageProviders,
239
+ });
240
+ const headerChanged = await this.updateFile(destHeaderFile, headerContents);
241
+ return cppChanged || headerChanged;
242
+ }
243
+ getCppReplacements() {
244
+ let cppIncludes = '';
245
+ let cppPackageProviders = '';
246
+ const windowsDependencies = this.getWindowsDependencies();
247
+ for (const dependencyName of Object.keys(windowsDependencies)) {
248
+ windowsDependencies[dependencyName].projects.forEach(project => {
249
+ if (project.directDependency) {
250
+ cppIncludes += `\n\n// Includes from ${dependencyName}`;
251
+ project.cppHeaders.forEach(header => {
252
+ cppIncludes += `\n#include <${header}>`;
253
+ });
254
+ cppPackageProviders += `\n // IReactPackageProviders from ${dependencyName}`;
255
+ project.cppPackageProviders.forEach(packageProvider => {
256
+ cppPackageProviders += `\n packageProviders.Append(winrt::${packageProvider}());`;
257
+ });
258
+ }
259
+ });
260
+ }
261
+ if (cppPackageProviders === '') {
262
+ // There are no windows dependencies, this would result in warning. C4100: 'packageProviders': unreferenced formal parameter.
263
+ // therefore add a usage.
264
+ cppPackageProviders = '\n UNREFERENCED_PARAMETER(packageProviders);'; // CODESYNC: @react-native-windows\cli\src\generator-windows\index.ts
265
+ }
266
+ return { cppPackageProviders, cppIncludes };
267
+ }
268
+ async generateCSAutolinking(templateRoot, projectDir) {
269
+ const { csUsingNamespaces, csReactPackageProviders } = this.getCsReplacements();
270
+ const csFileName = 'AutolinkedNativeModules.g.cs';
271
+ const srcCsFile = this.getAutolinkTemplateFile(templateRoot, csFileName);
272
+ const destCsFile = path_1.default.join(projectDir, csFileName);
273
+ verboseMessage(`Calculating ${chalk_1.default.bold(path_1.default.basename(destCsFile))}...`, this.options.logging);
274
+ const csContents = generatorCommon.resolveContents(srcCsFile, {
275
+ useMustache: true,
276
+ autolinkCsUsingNamespaces: csUsingNamespaces,
277
+ autolinkCsReactPackageProviders: csReactPackageProviders,
278
+ });
279
+ return await this.updateFile(destCsFile, csContents);
280
+ }
281
+ getCsReplacements() {
282
+ let csUsingNamespaces = '';
283
+ let csReactPackageProviders = '';
284
+ const windowsDependencies = this.getWindowsDependencies();
285
+ for (const dependencyName of Object.keys(windowsDependencies)) {
286
+ windowsDependencies[dependencyName].projects.forEach(project => {
287
+ if (project.directDependency) {
288
+ csUsingNamespaces += `\n\n// Namespaces from ${dependencyName}`;
289
+ project.csNamespaces.forEach(namespace => {
290
+ csUsingNamespaces += `\nusing ${namespace};`;
291
+ });
292
+ csReactPackageProviders += `\n // IReactPackageProviders from ${dependencyName}`;
293
+ project.csPackageProviders.forEach(packageProvider => {
294
+ csReactPackageProviders += `\n packageProviders.Add(new ${packageProvider}());`;
295
+ });
296
+ }
297
+ });
298
+ }
299
+ return { csUsingNamespaces, csReactPackageProviders };
300
+ }
301
+ getWindowsDependencies() {
302
+ if (!this.windowsDependencies) {
303
+ this.windowsDependencies = {};
304
+ for (const dependencyName of Object.keys(this.dependenciesConfig)) {
305
+ const windowsDependency = this.dependenciesConfig[dependencyName].platforms.windows;
306
+ if (windowsDependency) {
307
+ verboseMessage(`${chalk_1.default.bold(dependencyName)} has Windows implementation, config:`, this.options.logging);
308
+ verboseMessage(windowsDependency, this.options.logging);
309
+ let dependencyIsValid = false;
310
+ const hasValidSourceDir = 'sourceDir' in windowsDependency &&
311
+ windowsDependency.sourceDir !== undefined &&
312
+ !windowsDependency.sourceDir.startsWith('Error: ');
313
+ const hasProjectsInProjectsArray = 'projects' in windowsDependency &&
314
+ Array.isArray(windowsDependency.projects) &&
315
+ windowsDependency.projects.length > 0;
316
+ if (hasValidSourceDir && hasProjectsInProjectsArray) {
317
+ // Module is source-based and has projects
318
+ dependencyIsValid = true;
319
+ // Validate each source project
320
+ windowsDependency.projects.forEach(project => {
321
+ const itemsToCheck = [
322
+ 'projectFile',
323
+ 'directDependency',
324
+ ];
325
+ itemsToCheck.forEach(item => {
326
+ dependencyIsValid = !!(dependencyIsValid &&
327
+ item in project &&
328
+ project[item] !== '' &&
329
+ !project[item].toString().startsWith('Error: '));
330
+ });
331
+ });
332
+ }
333
+ if (dependencyIsValid) {
334
+ verboseMessage(`Adding ${chalk_1.default.bold(dependencyName)}.`, this.options.logging);
335
+ this.windowsDependencies[dependencyName] = windowsDependency;
336
+ }
337
+ else {
338
+ verboseMessage(`Invalid dependency configuration for dependency ${dependencyName}`, this.options.logging);
339
+ }
340
+ }
341
+ }
342
+ }
343
+ return this.windowsDependencies;
344
+ }
345
+ /**
346
+ * Updates the target file with the expected contents if it's different.
347
+ * @param filePath Path to the target file to update.
348
+ * @param expectedContents The expected contents of the file.
349
+ * @return Whether any changes were necessary.
350
+ */
351
+ async updateFile(filePath, expectedContents) {
352
+ const fileName = chalk_1.default.bold(path_1.default.basename(filePath));
353
+ verboseMessage(`Reading ${fileName}...`, this.options.logging);
354
+ const actualContents = fs_1.default.existsSync(filePath)
355
+ ? (await fs_1.default.readFile(filePath)).toString()
356
+ : '';
357
+ const contentsChanged = expectedContents !== actualContents;
358
+ if (contentsChanged) {
359
+ verboseMessage(chalk_1.default.yellow(`${fileName} needs to be updated.`), this.options.logging);
360
+ if (!this.options.check) {
361
+ verboseMessage(`Writing ${fileName}...`, this.options.logging);
362
+ await fs_1.default.writeFile(filePath, expectedContents, {
363
+ encoding: 'utf8',
364
+ flag: 'w',
365
+ });
366
+ }
367
+ }
368
+ else {
369
+ verboseMessage(`No changes to ${fileName}.`, this.options.logging);
370
+ }
371
+ return contentsChanged;
372
+ }
373
+ async generateAutolinkTargets(projectDir, templateRoot) {
374
+ let projectReferencesForTargets = '';
375
+ const windowsDependencies = this.getWindowsDependencies();
376
+ for (const dependencyName of Object.keys(windowsDependencies)) {
377
+ windowsDependencies[dependencyName].projects.forEach(project => {
378
+ if (project.directDependency) {
379
+ const dependencyProjectFile = path_1.default.join(windowsDependencies[dependencyName].folder, windowsDependencies[dependencyName].sourceDir, project.projectFile);
380
+ const relDependencyProjectFile = path_1.default.relative(projectDir, dependencyProjectFile);
381
+ projectReferencesForTargets += `
382
+ <!-- Projects from ${dependencyName} -->
383
+ <ProjectReference Include="$(ProjectDir)${relDependencyProjectFile}">
384
+ <Project>${project.projectGuid}</Project>
385
+ </ProjectReference>`;
386
+ }
387
+ });
388
+ }
389
+ const targetFileName = 'AutolinkedNativeModules.g.targets';
390
+ const srcTargetFile = this.getAutolinkTemplateFile(templateRoot, targetFileName);
391
+ const destTargetFile = path_1.default.join(projectDir, targetFileName);
392
+ verboseMessage(`Calculating ${chalk_1.default.bold(path_1.default.basename(destTargetFile))}...`, this.options.logging);
393
+ const targetContents = generatorCommon.resolveContents(srcTargetFile, {
394
+ useMustache: true,
395
+ autolinkProjectReferencesForTargets: projectReferencesForTargets,
396
+ });
397
+ return await this.updateFile(destTargetFile, targetContents);
398
+ }
399
+ async generateAutolinkProps(templateRoot, projectDir, propertiesForProps) {
400
+ const propsFileName = 'AutolinkedNativeModules.g.props';
401
+ const srcPropsFile = this.getAutolinkTemplateFile(templateRoot, propsFileName);
402
+ const destPropsFile = path_1.default.join(projectDir, propsFileName);
403
+ verboseMessage(`Calculating ${chalk_1.default.bold(path_1.default.basename(destPropsFile))}...`, this.options.logging);
404
+ const propsContents = generatorCommon.resolveContents(srcPropsFile, {
405
+ useMustache: true,
406
+ autolinkPropertiesForProps: propertiesForProps,
407
+ });
408
+ return await this.updateFile(destPropsFile, propsContents);
409
+ }
410
+ getCSModules() {
411
+ const csModuleNames = [];
412
+ const windowsDependencies = this.getWindowsDependencies();
413
+ for (const dependencyName of Object.keys(windowsDependencies)) {
414
+ windowsDependencies[dependencyName].projects.forEach(project => {
415
+ if (project.directDependency && project.projectLang === 'cs') {
416
+ csModuleNames.push(project.projectName);
417
+ }
418
+ });
419
+ }
420
+ return csModuleNames;
421
+ }
422
+ updateSolution(rnwRoot, solutionFile) {
423
+ const projectsForSolution = [];
424
+ const windowsDependencies = this.getWindowsDependencies();
425
+ for (const dependencyName of Object.keys(windowsDependencies)) {
426
+ // Process dependency projects
427
+ windowsDependencies[dependencyName].projects.forEach(project => {
428
+ const dependencyProjectFile = path_1.default.join(windowsDependencies[dependencyName].folder, windowsDependencies[dependencyName].sourceDir, project.projectFile);
429
+ projectsForSolution.push({
430
+ projectFile: dependencyProjectFile,
431
+ projectName: project.projectName,
432
+ projectLang: project.projectLang,
433
+ projectGuid: project.projectGuid,
434
+ });
435
+ });
436
+ }
437
+ const csModuleNames = this.getCSModules();
438
+ if (csModuleNames.length > 0) {
439
+ // Add managed projects
440
+ projectsForSolution.push({
441
+ projectFile: path_1.default.join(rnwRoot, 'Microsoft.ReactNative.Managed/Microsoft.ReactNative.Managed.csproj'),
442
+ projectName: 'Microsoft.ReactNative.Managed',
443
+ projectLang: 'cs',
444
+ projectGuid: '{F2824844-CE15-4242-9420-308923CD76C3}',
445
+ });
446
+ projectsForSolution.push({
447
+ projectFile: path_1.default.join(rnwRoot, 'Microsoft.ReactNative.Managed.CodeGen//Microsoft.ReactNative.Managed.CodeGen.csproj'),
448
+ projectName: 'Microsoft.ReactNative.Managed.CodeGen',
449
+ projectLang: 'cs',
450
+ projectGuid: '{ADED4FBE-887D-4271-AF24-F0823BCE7961}',
451
+ projectTypeGuid: vstools.dotNetCoreProjectTypeGuid,
452
+ });
453
+ }
454
+ verboseMessage(`Calculating ${chalk_1.default.bold(path_1.default.basename(solutionFile))} changes...`, this.options.logging);
455
+ let changesNecessary = false;
456
+ projectsForSolution.forEach(project => {
457
+ const contentsChanged = vstools.addProjectToSolution(solutionFile, project, this.options.logging, this.options.check);
458
+ changesNecessary = changesNecessary || contentsChanged;
459
+ });
460
+ return changesNecessary;
461
+ }
462
+ getExperimentalFeaturesPropsXml() {
463
+ const experimentalFeaturesProps = path_1.default.join(path_1.default.dirname(this.getSolutionFile()), 'ExperimentalFeatures.props');
464
+ if (fs_1.default.existsSync(experimentalFeaturesProps)) {
465
+ const experimentalFeaturesContents = configUtils.readProjectFile(experimentalFeaturesProps);
466
+ return {
467
+ path: experimentalFeaturesProps,
468
+ content: experimentalFeaturesContents,
469
+ };
470
+ }
471
+ return undefined;
472
+ }
473
+ async ensureXAMLDialect() {
474
+ var _a, _b;
475
+ let changesNeeded = false;
476
+ const useWinUI3FromConfig = this.getWindowsConfig().useWinUI3;
477
+ const experimentalFeatures = this.getExperimentalFeaturesPropsXml();
478
+ if (experimentalFeatures) {
479
+ const useWinUI3FromExperimentalFeatures = ((_a = configUtils
480
+ .tryFindPropertyValue(experimentalFeatures.content, 'UseWinUI3')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
481
+ // Check if WinUI2xVersion is specified in experimental features
482
+ const targetWinUI2xVersion = configUtils.tryFindPropertyValue(experimentalFeatures.content, 'WinUI2xVersion');
483
+ // Check if WinUI3Version is specified in experimental features
484
+ const targetWinUI3xVersion = configUtils.tryFindPropertyValue(experimentalFeatures.content, 'WinUI3Version');
485
+ // Use the UseWinUI3 value in react-native.config.js, or if not present, the value from ExperimentalFeatures.props
486
+ changesNeeded = await this.updatePackagesConfigXAMLDialect(useWinUI3FromConfig !== undefined
487
+ ? useWinUI3FromConfig
488
+ : useWinUI3FromExperimentalFeatures, targetWinUI2xVersion, targetWinUI3xVersion);
489
+ if (useWinUI3FromConfig !== undefined) {
490
+ // Make sure ExperimentalFeatures.props matches the value that comes from react-native.config.js
491
+ const node = experimentalFeatures.content.getElementsByTagName('UseWinUI3');
492
+ const newValue = useWinUI3FromConfig ? 'true' : 'false';
493
+ changesNeeded = ((_b = node.item(0)) === null || _b === void 0 ? void 0 : _b.textContent) !== newValue || changesNeeded;
494
+ if (!this.options.check && changesNeeded) {
495
+ node.item(0).textContent = newValue;
496
+ const experimentalFeaturesOutput = new xmldom_1.XMLSerializer().serializeToString(experimentalFeatures.content);
497
+ await this.updateFile(experimentalFeatures.path, experimentalFeaturesOutput);
498
+ }
499
+ }
500
+ }
501
+ return changesNeeded;
502
+ }
503
+ getPackagesConfigXml() {
504
+ const projectFile = this.getProjectFile();
505
+ const packagesConfig = path_1.default.join(path_1.default.dirname(projectFile), 'packages.config');
506
+ if (fs_1.default.existsSync(packagesConfig)) {
507
+ return {
508
+ path: packagesConfig,
509
+ content: configUtils.readProjectFile(packagesConfig),
510
+ };
511
+ }
512
+ return undefined;
513
+ }
514
+ async updatePackagesConfigXAMLDialect(useWinUI3, targetWinUI2xVersion, targetWinUI3xVersion) {
515
+ let changed = false;
516
+ const packagesConfig = this.getPackagesConfigXml();
517
+ if (packagesConfig) {
518
+ // if we don't have a packages.config, then this is a C# project, in which case we use <PackageReference> and dynamically pick the right XAML package.
519
+ const project = this.getWindowsConfig();
520
+ const winUIPropsPath = path_1.default.join(resolveRnwRoot(project), 'PropertySheets/WinUI.props');
521
+ const winuiPropsContents = configUtils.readProjectFile(winUIPropsPath);
522
+ // Use the given WinUI2xVersion, otherwise fallback to WinUI.props
523
+ const winui2xVersion = targetWinUI2xVersion !== null && targetWinUI2xVersion !== void 0 ? targetWinUI2xVersion : configUtils.tryFindPropertyValue(winuiPropsContents, 'WinUI2xVersion');
524
+ // Use the given WinUI3Version, otherwise fallback to WinUI.props
525
+ const winui3Version = targetWinUI3xVersion !== null && targetWinUI3xVersion !== void 0 ? targetWinUI3xVersion : configUtils.tryFindPropertyValue(winuiPropsContents, 'WinUI3Version');
526
+ const dialects = [
527
+ { id: 'Microsoft.WindowsAppSDK', version: winui3Version },
528
+ { id: 'Microsoft.UI.Xaml', version: winui2xVersion },
529
+ ];
530
+ const keepPkg = useWinUI3 ? dialects[0] : dialects[1];
531
+ const removePkg = useWinUI3 ? dialects[1] : dialects[0];
532
+ changed = this.updatePackagesConfig(packagesConfig, [removePkg], [keepPkg]);
533
+ if (!this.options.check && changed) {
534
+ const serializer = new xmldom_1.XMLSerializer();
535
+ const output = serializer.serializeToString(packagesConfig.content);
536
+ const formattedXml = formatter(output, { indentation: ' ' });
537
+ await this.updateFile(packagesConfig.path, formattedXml);
538
+ }
539
+ }
540
+ return changed;
541
+ }
542
+ updatePackagesConfig(packagesConfig, removePkgs, keepPkgs) {
543
+ let changed = false;
544
+ const packageElements = packagesConfig.content.documentElement.getElementsByTagName('package');
545
+ const nodesToRemove = [];
546
+ for (let i = 0; i < packageElements.length; i++) {
547
+ const packageElement = packageElements.item(i);
548
+ const idAttr = packageElement.getAttributeNode('id');
549
+ const id = idAttr.value;
550
+ const keepPkg = keepPkgs.find(pkg => pkg.id === id);
551
+ if (removePkgs.find(pkg => pkg.id === id)) {
552
+ nodesToRemove.push(packageElement);
553
+ changed = true;
554
+ }
555
+ else if (keepPkg) {
556
+ changed =
557
+ changed || keepPkg.version !== packageElement.getAttribute('version');
558
+ packageElement.setAttribute('version', keepPkg.version);
559
+ keepPkgs = keepPkgs.filter(pkg => pkg.id !== keepPkg.id);
560
+ }
561
+ }
562
+ nodesToRemove.forEach(pkg => packagesConfig.content.documentElement.removeChild(pkg));
563
+ keepPkgs.forEach(keepPkg => {
564
+ const newPkg = packagesConfig.content.createElement('package');
565
+ Object.entries(keepPkg).forEach(([attr, value]) => {
566
+ newPkg.setAttribute(attr, value);
567
+ });
568
+ newPkg.setAttribute('targetFramework', 'native');
569
+ packagesConfig.content.documentElement.appendChild(newPkg);
570
+ changed = true;
571
+ });
572
+ return changed;
573
+ }
574
+ /** @return The CLI command to invoke autolink-windows independently */
575
+ getAutolinkWindowsCommand() {
576
+ const folder = this.windowsAppConfig.folder;
577
+ const autolinkCommand = 'npx @react-native-community/cli autolink-windows';
578
+ const autolinkArgs = `--sln "${path_1.default.relative(folder, this.getSolutionFile())}" --proj "${path_1.default.relative(folder, this.getProjectFile())}"`;
579
+ return `${autolinkCommand} ${autolinkArgs}`;
580
+ }
581
+ }
582
+ exports.AutoLinkWindows = AutoLinkWindows;
583
+ /**
584
+ * Locates the react-native-windows directory
585
+ * @param config project configuration
586
+ */
587
+ function resolveRnwRoot(projectConfig) {
588
+ return pathHelpers.resolveRnwRoot(projectConfig.folder);
589
+ }
590
+ /**
591
+ * Locates the react-native-windows directory containing template files
592
+ * @param config project configuration
593
+ */
594
+ function resolveTemplateRoot(projectConfig) {
595
+ var _a, _b;
596
+ const rnwPackage = resolveRnwRoot(projectConfig);
597
+ const template = (_b = (_a = projectConfig.rnwConfig) === null || _a === void 0 ? void 0 : _a['init-windows']) === null || _b === void 0 ? void 0 : _b.template;
598
+ // For new templates, return the template's root path
599
+ if (template && !template.startsWith('old/')) {
600
+ return path_1.default.join(rnwPackage, 'templates', template);
601
+ }
602
+ // For old (unknown templates) fall back to old behavior
603
+ return path_1.default.join(rnwPackage, 'template');
604
+ }
605
+ /**
606
+ * Logs the given message if verbose is True.
607
+ * @param message The message to log.
608
+ * @param verbose Whether or not verbose logging is enabled.
609
+ */
610
+ function verboseMessage(message, verbose) {
611
+ if (verbose) {
612
+ console.log(message);
613
+ }
614
+ }
615
+ /**
616
+ * Sanitizes the given option for telemetry.
617
+ * @param key The key of the option.
618
+ * @param value The unsanitized value of the option.
619
+ * @returns The sanitized value of the option.
620
+ */
621
+ function optionSanitizer(key, value) {
622
+ // Do not add a default case here.
623
+ // Strings risking PII should just return true if present, false otherwise.
624
+ // All others should return the value (or false if undefined).
625
+ switch (key) {
626
+ case 'sln':
627
+ case 'proj':
628
+ return value === undefined ? false : true; // Strip PII
629
+ case 'logging':
630
+ case 'check':
631
+ case 'telemetry':
632
+ return value === undefined ? false : value; // Return value
633
+ }
634
+ }
635
+ /**
636
+ * Get the extra props to add to the `autolink-windows` telemetry event.
637
+ * @returns The extra props.
638
+ */
639
+ async function getExtraProps() {
640
+ const extraProps = {};
641
+ return extraProps;
642
+ }
643
+ /**
644
+ * The function run when calling `npx @react-native-community/cli autolink-windows`.
645
+ * @param args Unprocessed args passed from react-native CLI.
646
+ * @param config Config passed from react-native CLI.
647
+ * @param options Options passed from react-native CLI.
648
+ */
649
+ async function autolinkWindows(args, config, options) {
650
+ await (0, telemetryHelpers_1.startTelemetrySession)('autolink-windows', config, options, (0, telemetryHelpers_1.getDefaultOptions)(config, autolinkWindowsOptions_1.autolinkOptions), optionSanitizer);
651
+ let autolinkWindowsError;
652
+ try {
653
+ await autolinkWindowsInternal(args, config, options);
654
+ }
655
+ catch (ex) {
656
+ autolinkWindowsError =
657
+ ex instanceof Error ? ex : new Error(String(ex));
658
+ telemetry_1.Telemetry.trackException(autolinkWindowsError);
659
+ }
660
+ await (0, telemetryHelpers_1.endTelemetrySession)(autolinkWindowsError, getExtraProps);
661
+ (0, commandWithProgress_1.setExitProcessWithError)(options.logging, autolinkWindowsError);
662
+ }
663
+ /**
664
+ * Performs auto-linking for RNW native modules and apps.
665
+ * @param args Unprocessed args passed from react-native CLI.
666
+ * @param config Config passed from react-native CLI.
667
+ * @param options Options passed from react-native CLI.
668
+ */
669
+ async function autolinkWindowsInternal(args, config, options) {
670
+ const startTime = perf_hooks_1.performance.now();
671
+ const spinner = (0, commandWithProgress_1.newSpinner)(options.check ? 'Checking auto-linked files...' : 'Auto-linking...');
672
+ try {
673
+ const autolink = new AutoLinkWindows(config.project, config.dependencies, options);
674
+ await autolink.run(spinner);
675
+ const endTime = perf_hooks_1.performance.now();
676
+ if (!autolink.areChangesNeeded()) {
677
+ console.log(`${chalk_1.default.green('Success:')} No auto-linking changes necessary. (${Math.round(endTime - startTime)}ms)`);
678
+ }
679
+ else if (options.check) {
680
+ const autolinkCommand = autolink.getAutolinkWindowsCommand();
681
+ console.log(`${chalk_1.default.yellow('Warning:')} Auto-linking changes were necessary but ${chalk_1.default.bold('--check')} specified. Run '${chalk_1.default.bold(`${autolinkCommand}`)}' to apply the changes. (${Math.round(endTime - startTime)}ms)`);
682
+ throw new telemetry_1.CodedError('NeedAutolinking', `Auto-linking changes were necessary but --check was specified. Run '${autolinkCommand}' to apply the changes`);
683
+ }
684
+ else {
685
+ console.log(`${chalk_1.default.green('Success:')} Auto-linking changes completed. (${Math.round(endTime - startTime)}ms)`);
686
+ }
687
+ }
688
+ catch (e) {
689
+ spinner.fail();
690
+ const endTime = perf_hooks_1.performance.now();
691
+ console.log(`${chalk_1.default.red('Error:')} ${e.toString()}. (${Math.round(endTime - startTime)}ms)`);
692
+ throw e;
693
+ }
694
+ }
695
+ exports.autolinkWindowsInternal = autolinkWindowsInternal;
696
+ /**
697
+ * Performs auto-linking for RNW native modules and apps.
698
+ */
699
+ exports.autolinkCommand = {
700
+ name: 'autolink-windows',
701
+ description: 'Runs Windows-specific autolinking for your RNW project',
702
+ func: autolinkWindows,
703
+ options: autolinkWindowsOptions_1.autolinkOptions,
704
+ };
705
+ //# sourceMappingURL=autolinkWindows.js.map