@rnx-kit/cli 0.14.3 → 0.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +18 -19
- package/coverage/clover.xml +72 -71
- package/coverage/coverage-final.json +5 -5
- package/coverage/lcov-report/index.html +18 -18
- package/coverage/lcov-report/src/{bundler-plugin-defaults.ts.html → bundle/defaultPlugins.ts.html} +10 -10
- package/coverage/lcov-report/src/bundle/index.html +23 -8
- package/coverage/lcov-report/src/bundle/kit-config.ts.html +3 -3
- package/coverage/lcov-report/src/bundle/metro.ts.html +13 -22
- package/coverage/lcov-report/src/bundle/overrides.ts.html +51 -33
- package/coverage/lcov-report/src/copy-assets.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +7 -22
- package/coverage/lcov-report/src/metro-config.ts.html +20 -35
- package/coverage/lcov-report/src/typescript/index.html +1 -1
- package/coverage/lcov-report/src/typescript/project-cache.ts.html +3 -3
- package/coverage/lcov.info +121 -119
- package/lib/bundle/cliOptions.d.ts +39 -0
- package/lib/bundle/cliOptions.d.ts.map +1 -0
- package/lib/bundle/cliOptions.js +75 -0
- package/lib/bundle/cliOptions.js.map +1 -0
- package/lib/{bundler-plugin-defaults.d.ts → bundle/defaultPlugins.d.ts} +1 -1
- package/lib/bundle/defaultPlugins.d.ts.map +1 -0
- package/lib/{bundler-plugin-defaults.js → bundle/defaultPlugins.js} +1 -1
- package/lib/bundle/defaultPlugins.js.map +1 -0
- package/lib/bundle/kit-config.d.ts +1 -1
- package/lib/bundle/kit-config.d.ts.map +1 -1
- package/lib/bundle/kit-config.js +3 -3
- package/lib/bundle/kit-config.js.map +1 -1
- package/lib/bundle/metro.d.ts +3 -1
- package/lib/bundle/metro.d.ts.map +1 -1
- package/lib/bundle/metro.js +29 -8
- package/lib/bundle/metro.js.map +1 -1
- package/lib/bundle/overrides.d.ts +5 -14
- package/lib/bundle/overrides.d.ts.map +1 -1
- package/lib/bundle/overrides.js +14 -13
- package/lib/bundle/overrides.js.map +1 -1
- package/lib/bundle/types.d.ts +18 -0
- package/lib/bundle/types.d.ts.map +1 -1
- package/lib/bundle.d.ts +45 -19
- package/lib/bundle.d.ts.map +1 -1
- package/lib/bundle.js +20 -3
- package/lib/bundle.js.map +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +10 -6
- package/lib/index.js.map +1 -1
- package/lib/metro-config.d.ts +3 -8
- package/lib/metro-config.d.ts.map +1 -1
- package/lib/metro-config.js +2 -5
- package/lib/metro-config.js.map +1 -1
- package/lib/ram-bundle.d.ts +49 -0
- package/lib/ram-bundle.d.ts.map +1 -0
- package/lib/ram-bundle.js +47 -0
- package/lib/ram-bundle.js.map +1 -0
- package/lib/serve/kit-config.js +2 -2
- package/lib/serve/kit-config.js.map +1 -1
- package/lib/start.d.ts.map +1 -1
- package/lib/start.js +28 -5
- package/lib/start.js.map +1 -1
- package/lib/typescript/project-cache.js +28 -5
- package/lib/typescript/project-cache.js.map +1 -1
- package/package.json +4 -4
- package/react-native.config.js +4 -96
- package/src/bundle/cliOptions.ts +82 -0
- package/src/{bundler-plugin-defaults.ts → bundle/defaultPlugins.ts} +0 -0
- package/src/bundle/kit-config.ts +2 -2
- package/src/bundle/metro.ts +8 -11
- package/src/bundle/overrides.ts +31 -25
- package/src/bundle/types.ts +19 -0
- package/src/bundle.ts +29 -23
- package/src/index.ts +4 -3
- package/src/metro-config.ts +18 -23
- package/src/ram-bundle.ts +78 -0
- package/src/serve/kit-config.ts +1 -1
- package/src/start.ts +5 -12
- package/src/typescript/project-cache.ts +2 -2
- package/test/bundle/overrides.test.ts +25 -14
- package/test/metro-config.test.ts +33 -45
- package/lib/bundler-plugin-defaults.d.ts.map +0 -1
- package/lib/bundler-plugin-defaults.js.map +0 -1
|
@@ -25,28 +25,28 @@
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
26
|
<span class="strong">100% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>27/27</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
33
|
<span class="strong">100% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>21/21</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
40
|
<span class="strong">100% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>7/7</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
47
|
<span class="strong">100% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>27/27</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -79,6 +79,21 @@
|
|
|
79
79
|
</tr>
|
|
80
80
|
</thead>
|
|
81
81
|
<tbody><tr>
|
|
82
|
+
<td class="file high" data-value="defaultPlugins.ts"><a href="defaultPlugins.ts.html">defaultPlugins.ts</a></td>
|
|
83
|
+
<td data-value="100" class="pic high">
|
|
84
|
+
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
85
|
+
</td>
|
|
86
|
+
<td data-value="100" class="pct high">100%</td>
|
|
87
|
+
<td data-value="1" class="abs high">1/1</td>
|
|
88
|
+
<td data-value="100" class="pct high">100%</td>
|
|
89
|
+
<td data-value="0" class="abs high">0/0</td>
|
|
90
|
+
<td data-value="100" class="pct high">100%</td>
|
|
91
|
+
<td data-value="1" class="abs high">1/1</td>
|
|
92
|
+
<td data-value="100" class="pct high">100%</td>
|
|
93
|
+
<td data-value="1" class="abs high">1/1</td>
|
|
94
|
+
</tr>
|
|
95
|
+
|
|
96
|
+
<tr>
|
|
82
97
|
<td class="file high" data-value="kit-config.ts"><a href="kit-config.ts.html">kit-config.ts</a></td>
|
|
83
98
|
<td data-value="100" class="pic high">
|
|
84
99
|
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
@@ -101,7 +116,7 @@
|
|
|
101
116
|
<td data-value="100" class="pct high">100%</td>
|
|
102
117
|
<td data-value="7" class="abs high">7/7</td>
|
|
103
118
|
<td data-value="100" class="pct high">100%</td>
|
|
104
|
-
<td data-value="
|
|
119
|
+
<td data-value="5" class="abs high">5/5</td>
|
|
105
120
|
<td data-value="100" class="pct high">100%</td>
|
|
106
121
|
<td data-value="1" class="abs high">1/1</td>
|
|
107
122
|
<td data-value="100" class="pct high">100%</td>
|
|
@@ -114,13 +129,13 @@
|
|
|
114
129
|
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
115
130
|
</td>
|
|
116
131
|
<td data-value="100" class="pct high">100%</td>
|
|
117
|
-
<td data-value="
|
|
132
|
+
<td data-value="5" class="abs high">5/5</td>
|
|
118
133
|
<td data-value="100" class="pct high">100%</td>
|
|
119
134
|
<td data-value="2" class="abs high">2/2</td>
|
|
120
135
|
<td data-value="100" class="pct high">100%</td>
|
|
121
136
|
<td data-value="1" class="abs high">1/1</td>
|
|
122
137
|
<td data-value="100" class="pct high">100%</td>
|
|
123
|
-
<td data-value="
|
|
138
|
+
<td data-value="5" class="abs high">5/5</td>
|
|
124
139
|
</tr>
|
|
125
140
|
|
|
126
141
|
</tbody>
|
|
@@ -131,7 +146,7 @@
|
|
|
131
146
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
132
147
|
Code coverage generated by
|
|
133
148
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
134
|
-
at
|
|
149
|
+
at Mon Sep 19 2022 06:55:21 GMT+0000 (Coordinated Universal Time)
|
|
135
150
|
</div>
|
|
136
151
|
<script src="../../prettify.js"></script>
|
|
137
152
|
<script>
|
|
@@ -231,8 +231,8 @@
|
|
|
231
231
|
getKitConfig,
|
|
232
232
|
} from "@rnx-kit/config";
|
|
233
233
|
import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";
|
|
234
|
+
import { getDefaultBundlerPlugins } from "./defaultPlugins";
|
|
234
235
|
import type { CliPlatformBundleConfig } from "./types";
|
|
235
|
-
import { getDefaultBundlerPlugins } from "../bundler-plugin-defaults";
|
|
236
236
|
|
|
237
237
|
/**
|
|
238
238
|
* Get the list of target platforms for bundling.
|
|
@@ -276,7 +276,7 @@ function getDefaultBundleParameters(platform: string) {
|
|
|
276
276
|
*
|
|
277
277
|
* @param id Optional identity of the target bundle definition to return
|
|
278
278
|
* @param overridePlatform Override platform, typically from the command-line. When given, this overrides the list of target platforms.
|
|
279
|
-
* @returns
|
|
279
|
+
* @returns Array of platform-specific bundle configurations
|
|
280
280
|
*/
|
|
281
281
|
export function getCliPlatformBundleConfigs(
|
|
282
282
|
id?: string,
|
|
@@ -313,7 +313,7 @@ export function getCliPlatformBundleConfigs(
|
|
|
313
313
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
314
314
|
Code coverage generated by
|
|
315
315
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
316
|
-
at
|
|
316
|
+
at Mon Sep 19 2022 06:55:21 GMT+0000 (Coordinated Universal Time)
|
|
317
317
|
</div>
|
|
318
318
|
<script src="../../prettify.js"></script>
|
|
319
319
|
<script>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
33
|
<span class="strong">100% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>5/5</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
@@ -110,10 +110,7 @@
|
|
|
110
110
|
<a name='L45'></a><a href='#L45'>45</a>
|
|
111
111
|
<a name='L46'></a><a href='#L46'>46</a>
|
|
112
112
|
<a name='L47'></a><a href='#L47'>47</a>
|
|
113
|
-
<a name='L48'></a><a href='#L48'>48</a>
|
|
114
|
-
<a name='L49'></a><a href='#L49'>49</a>
|
|
115
|
-
<a name='L50'></a><a href='#L50'>50</a>
|
|
116
|
-
<a name='L51'></a><a href='#L51'>51</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
113
|
+
<a name='L48'></a><a href='#L48'>48</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
117
114
|
<span class="cline-any cline-neutral"> </span>
|
|
118
115
|
<span class="cline-any cline-neutral"> </span>
|
|
119
116
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -138,15 +135,12 @@
|
|
|
138
135
|
<span class="cline-any cline-neutral"> </span>
|
|
139
136
|
<span class="cline-any cline-neutral"> </span>
|
|
140
137
|
<span class="cline-any cline-neutral"> </span>
|
|
141
|
-
<span class="cline-any cline-yes">4x</span>
|
|
142
|
-
<span class="cline-any cline-neutral"> </span>
|
|
143
|
-
<span class="cline-any cline-yes">4x</span>
|
|
144
|
-
<span class="cline-any cline-neutral"> </span>
|
|
145
|
-
<span class="cline-any cline-neutral"> </span>
|
|
146
138
|
<span class="cline-any cline-neutral"> </span>
|
|
147
139
|
<span class="cline-any cline-neutral"> </span>
|
|
148
140
|
<span class="cline-any cline-neutral"> </span>
|
|
141
|
+
<span class="cline-any cline-yes">4x</span>
|
|
149
142
|
<span class="cline-any cline-neutral"> </span>
|
|
143
|
+
<span class="cline-any cline-yes">4x</span>
|
|
150
144
|
<span class="cline-any cline-neutral"> </span>
|
|
151
145
|
<span class="cline-any cline-yes">4x</span>
|
|
152
146
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -164,10 +158,11 @@
|
|
|
164
158
|
<span class="cline-any cline-yes">4x</span>
|
|
165
159
|
<span class="cline-any cline-neutral"> </span>
|
|
166
160
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { info } from "@rnx-kit/console";
|
|
167
|
-
import {
|
|
161
|
+
import type { BundleArgs as MetroBundleArgs } from "@rnx-kit/metro-service";
|
|
162
|
+
import { bundle } from "@rnx-kit/metro-service";
|
|
168
163
|
import { createDirectory } from "@rnx-kit/tools-node/fs";
|
|
169
164
|
import type { ConfigT } from "metro-config";
|
|
170
|
-
import path from "path";
|
|
165
|
+
import * as path from "path";
|
|
171
166
|
import { customizeMetroConfig } from "../metro-config";
|
|
172
167
|
import type { CliPlatformBundleConfig } from "./types";
|
|
173
168
|
|
|
@@ -181,22 +176,18 @@ import type { CliPlatformBundleConfig } from "./types";
|
|
|
181
176
|
* Further, optimizations like constant folding are disabled.
|
|
182
177
|
* When `false`, warnings are disabled and the bundle is minified by default.
|
|
183
178
|
* @param minify Optionally choose whether or not the bundle is minified. When not set, minification is controlled by the `dev` property.
|
|
179
|
+
* @param output Output bundle format; defaults to plain JS
|
|
184
180
|
*/
|
|
185
181
|
export async function metroBundle(
|
|
186
182
|
metroConfig: ConfigT,
|
|
187
183
|
bundleConfig: CliPlatformBundleConfig,
|
|
188
184
|
dev: boolean,
|
|
189
|
-
minify?: boolean
|
|
185
|
+
minify?: boolean,
|
|
186
|
+
output = bundle
|
|
190
187
|
): Promise<void> {
|
|
191
188
|
info(`Bundling ${bundleConfig.platform}...`);
|
|
192
189
|
|
|
193
|
-
customizeMetroConfig(
|
|
194
|
-
metroConfig,
|
|
195
|
-
bundleConfig.detectCyclicDependencies,
|
|
196
|
-
bundleConfig.detectDuplicateDependencies,
|
|
197
|
-
bundleConfig.typescriptValidation,
|
|
198
|
-
bundleConfig.treeShake
|
|
199
|
-
);
|
|
190
|
+
customizeMetroConfig(metroConfig, bundleConfig);
|
|
200
191
|
|
|
201
192
|
const metroBundleArgs: MetroBundleArgs = {
|
|
202
193
|
...bundleConfig,
|
|
@@ -211,7 +202,7 @@ export async function metroBundle(
|
|
|
211
202
|
metroBundleArgs.assetsDest && createDirectory(metroBundleArgs.assetsDest);
|
|
212
203
|
|
|
213
204
|
// create the bundle
|
|
214
|
-
await
|
|
205
|
+
await output(metroBundleArgs, metroConfig);
|
|
215
206
|
}
|
|
216
207
|
</pre></td></tr></table></pre>
|
|
217
208
|
|
|
@@ -220,7 +211,7 @@ export async function metroBundle(
|
|
|
220
211
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
221
212
|
Code coverage generated by
|
|
222
213
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
223
|
-
at
|
|
214
|
+
at Mon Sep 19 2022 06:55:21 GMT+0000 (Coordinated Universal Time)
|
|
224
215
|
</div>
|
|
225
216
|
<script src="../../prettify.js"></script>
|
|
226
217
|
<script>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
26
|
<span class="strong">100% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>5/5</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
47
|
<span class="strong">100% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>5/5</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -107,7 +107,13 @@
|
|
|
107
107
|
<a name='L42'></a><a href='#L42'>42</a>
|
|
108
108
|
<a name='L43'></a><a href='#L43'>43</a>
|
|
109
109
|
<a name='L44'></a><a href='#L44'>44</a>
|
|
110
|
-
<a name='L45'></a><a href='#L45'>45</a
|
|
110
|
+
<a name='L45'></a><a href='#L45'>45</a>
|
|
111
|
+
<a name='L46'></a><a href='#L46'>46</a>
|
|
112
|
+
<a name='L47'></a><a href='#L47'>47</a>
|
|
113
|
+
<a name='L48'></a><a href='#L48'>48</a>
|
|
114
|
+
<a name='L49'></a><a href='#L49'>49</a>
|
|
115
|
+
<a name='L50'></a><a href='#L50'>50</a>
|
|
116
|
+
<a name='L51'></a><a href='#L51'>51</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
111
117
|
<span class="cline-any cline-neutral"> </span>
|
|
112
118
|
<span class="cline-any cline-neutral"> </span>
|
|
113
119
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -127,6 +133,12 @@
|
|
|
127
133
|
<span class="cline-any cline-neutral"> </span>
|
|
128
134
|
<span class="cline-any cline-neutral"> </span>
|
|
129
135
|
<span class="cline-any cline-neutral"> </span>
|
|
136
|
+
<span class="cline-any cline-yes">1x</span>
|
|
137
|
+
<span class="cline-any cline-neutral"> </span>
|
|
138
|
+
<span class="cline-any cline-neutral"> </span>
|
|
139
|
+
<span class="cline-any cline-neutral"> </span>
|
|
140
|
+
<span class="cline-any cline-neutral"> </span>
|
|
141
|
+
<span class="cline-any cline-neutral"> </span>
|
|
130
142
|
<span class="cline-any cline-neutral"> </span>
|
|
131
143
|
<span class="cline-any cline-neutral"> </span>
|
|
132
144
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -134,7 +146,6 @@
|
|
|
134
146
|
<span class="cline-any cline-neutral"> </span>
|
|
135
147
|
<span class="cline-any cline-neutral"> </span>
|
|
136
148
|
<span class="cline-any cline-neutral"> </span>
|
|
137
|
-
<span class="cline-any cline-yes">9x</span>
|
|
138
149
|
<span class="cline-any cline-neutral"> </span>
|
|
139
150
|
<span class="cline-any cline-neutral"> </span>
|
|
140
151
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -145,50 +156,57 @@
|
|
|
145
156
|
<span class="cline-any cline-neutral"> </span>
|
|
146
157
|
<span class="cline-any cline-neutral"> </span>
|
|
147
158
|
<span class="cline-any cline-neutral"> </span>
|
|
159
|
+
<span class="cline-any cline-yes">10x</span>
|
|
160
|
+
<span class="cline-any cline-yes">10x</span>
|
|
161
|
+
<span class="cline-any cline-yes">9x</span>
|
|
148
162
|
<span class="cline-any cline-yes">9x</span>
|
|
149
|
-
<span class="cline-any cline-yes">8x</span>
|
|
150
|
-
<span class="cline-any cline-yes">8x</span>
|
|
151
163
|
<span class="cline-any cline-neutral"> </span>
|
|
152
164
|
<span class="cline-any cline-neutral"> </span>
|
|
153
165
|
<span class="cline-any cline-neutral"> </span>
|
|
154
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import
|
|
155
|
-
import type { BundleArgs } from "@rnx-kit/metro-service";
|
|
156
|
-
import { pickValues } from "@rnx-kit/tools-language/properties";
|
|
166
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { pickValues } from "@rnx-kit/tools-language/properties";
|
|
157
167
|
import type { CliPlatformBundleConfig } from "./types";
|
|
158
168
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
type BundleConfigOverrides = Partial<
|
|
170
|
+
Pick<
|
|
171
|
+
CliPlatformBundleConfig,
|
|
172
|
+
| "entryFile"
|
|
173
|
+
| "bundleOutput"
|
|
174
|
+
| "bundleEncoding"
|
|
175
|
+
| "sourcemapOutput"
|
|
176
|
+
| "sourcemapSourcesRoot"
|
|
177
|
+
| "sourcemapUseAbsolutePath"
|
|
178
|
+
| "assetsDest"
|
|
179
|
+
| "treeShake"
|
|
180
|
+
| "unstableTransformProfile"
|
|
181
|
+
| "indexedRamBundle"
|
|
182
|
+
>
|
|
183
|
+
>;
|
|
184
|
+
|
|
185
|
+
export const overridableCommonBundleOptions: readonly (keyof BundleConfigOverrides)[] =
|
|
186
|
+
[
|
|
187
|
+
"assetsDest",
|
|
188
|
+
"bundleEncoding",
|
|
189
|
+
"bundleOutput",
|
|
190
|
+
"entryFile",
|
|
191
|
+
"sourcemapOutput",
|
|
192
|
+
"sourcemapSourcesRoot",
|
|
193
|
+
"sourcemapUseAbsolutePath",
|
|
194
|
+
"unstableTransformProfile",
|
|
195
|
+
];
|
|
170
196
|
|
|
171
197
|
/**
|
|
172
198
|
* Apply overrides, if any, to each rnx-kit bundle configuration. Overrides are applied in-place.
|
|
173
199
|
*
|
|
174
200
|
* @param overrides Optional overrides to apply
|
|
175
201
|
* @param configs Array of platform-specific bundle configurations. This is modified if any overrides are applied.
|
|
202
|
+
* @param keys Config keys to pick from {@link overrides}
|
|
176
203
|
*/
|
|
177
204
|
export function applyBundleConfigOverrides(
|
|
178
205
|
overrides: BundleConfigOverrides,
|
|
179
|
-
configs: CliPlatformBundleConfig[]
|
|
206
|
+
configs: CliPlatformBundleConfig[],
|
|
207
|
+
keys: (keyof BundleConfigOverrides)[]
|
|
180
208
|
): void {
|
|
181
|
-
const overridesToApply = pickValues(overrides,
|
|
182
|
-
"entryFile",
|
|
183
|
-
"bundleOutput",
|
|
184
|
-
"bundleEncoding",
|
|
185
|
-
"sourcemapOutput",
|
|
186
|
-
"sourcemapSourcesRoot",
|
|
187
|
-
"sourcemapUseAbsolutePath",
|
|
188
|
-
"assetsDest",
|
|
189
|
-
"treeShake",
|
|
190
|
-
"unstableTransformProfile",
|
|
191
|
-
]);
|
|
209
|
+
const overridesToApply = pickValues(overrides, keys);
|
|
192
210
|
if (overridesToApply) {
|
|
193
211
|
for (const config of configs) {
|
|
194
212
|
Object.assign(config, overridesToApply);
|
|
@@ -202,7 +220,7 @@ export function applyBundleConfigOverrides(
|
|
|
202
220
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
203
221
|
Code coverage generated by
|
|
204
222
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
205
|
-
at
|
|
223
|
+
at Mon Sep 19 2022 06:55:21 GMT+0000 (Coordinated Universal Time)
|
|
206
224
|
</div>
|
|
207
225
|
<script src="../../prettify.js"></script>
|
|
208
226
|
<script>
|
|
@@ -1765,7 +1765,7 @@ export const rnxCopyAssetsCommand = {
|
|
|
1765
1765
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1766
1766
|
Code coverage generated by
|
|
1767
1767
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1768
|
-
at
|
|
1768
|
+
at Mon Sep 19 2022 06:55:21 GMT+0000 (Coordinated Universal Time)
|
|
1769
1769
|
</div>
|
|
1770
1770
|
<script src="../prettify.js"></script>
|
|
1771
1771
|
<script>
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">52.
|
|
26
|
+
<span class="strong">52.38% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>110/210</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">57.14% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>16/28</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">52.
|
|
47
|
+
<span class="strong">52.4% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>109/208</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -79,21 +79,6 @@
|
|
|
79
79
|
</tr>
|
|
80
80
|
</thead>
|
|
81
81
|
<tbody><tr>
|
|
82
|
-
<td class="file high" data-value="bundler-plugin-defaults.ts"><a href="bundler-plugin-defaults.ts.html">bundler-plugin-defaults.ts</a></td>
|
|
83
|
-
<td data-value="100" class="pic high">
|
|
84
|
-
<div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
|
|
85
|
-
</td>
|
|
86
|
-
<td data-value="100" class="pct high">100%</td>
|
|
87
|
-
<td data-value="1" class="abs high">1/1</td>
|
|
88
|
-
<td data-value="100" class="pct high">100%</td>
|
|
89
|
-
<td data-value="0" class="abs high">0/0</td>
|
|
90
|
-
<td data-value="100" class="pct high">100%</td>
|
|
91
|
-
<td data-value="1" class="abs high">1/1</td>
|
|
92
|
-
<td data-value="100" class="pct high">100%</td>
|
|
93
|
-
<td data-value="1" class="abs high">1/1</td>
|
|
94
|
-
</tr>
|
|
95
|
-
|
|
96
|
-
<tr>
|
|
97
82
|
<td class="file medium" data-value="copy-assets.ts"><a href="copy-assets.ts.html">copy-assets.ts</a></td>
|
|
98
83
|
<td data-value="54.6" class="pic medium">
|
|
99
84
|
<div class="chart"><div class="cover-fill" style="width: 54%"></div><div class="cover-empty" style="width: 46%"></div></div>
|
|
@@ -131,7 +116,7 @@
|
|
|
131
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
132
117
|
Code coverage generated by
|
|
133
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
134
|
-
at
|
|
119
|
+
at Mon Sep 19 2022 06:55:21 GMT+0000 (Coordinated Universal Time)
|
|
135
120
|
</div>
|
|
136
121
|
<script src="../prettify.js"></script>
|
|
137
122
|
<script>
|
|
@@ -235,16 +235,7 @@
|
|
|
235
235
|
<a name='L170'></a><a href='#L170'>170</a>
|
|
236
236
|
<a name='L171'></a><a href='#L171'>171</a>
|
|
237
237
|
<a name='L172'></a><a href='#L172'>172</a>
|
|
238
|
-
<a name='L173'></a><a href='#L173'>173</a>
|
|
239
|
-
<a name='L174'></a><a href='#L174'>174</a>
|
|
240
|
-
<a name='L175'></a><a href='#L175'>175</a>
|
|
241
|
-
<a name='L176'></a><a href='#L176'>176</a>
|
|
242
|
-
<a name='L177'></a><a href='#L177'>177</a>
|
|
243
|
-
<a name='L178'></a><a href='#L178'>178</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
244
|
-
<span class="cline-any cline-neutral"> </span>
|
|
245
|
-
<span class="cline-any cline-neutral"> </span>
|
|
246
|
-
<span class="cline-any cline-neutral"> </span>
|
|
247
|
-
<span class="cline-any cline-neutral"> </span>
|
|
238
|
+
<a name='L173'></a><a href='#L173'>173</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
248
239
|
<span class="cline-any cline-neutral"> </span>
|
|
249
240
|
<span class="cline-any cline-neutral"> </span>
|
|
250
241
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -373,7 +364,6 @@
|
|
|
373
364
|
<span class="cline-any cline-neutral"> </span>
|
|
374
365
|
<span class="cline-any cline-neutral"> </span>
|
|
375
366
|
<span class="cline-any cline-neutral"> </span>
|
|
376
|
-
<span class="cline-any cline-neutral"> </span>
|
|
377
367
|
<span class="cline-any cline-yes">10x</span>
|
|
378
368
|
<span class="cline-any cline-neutral"> </span>
|
|
379
369
|
<span class="cline-any cline-yes">10x</span>
|
|
@@ -417,27 +407,23 @@
|
|
|
417
407
|
<span class="cline-any cline-neutral"> </span>
|
|
418
408
|
<span class="cline-any cline-yes">10x</span>
|
|
419
409
|
<span class="cline-any cline-neutral"> </span>
|
|
420
|
-
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import type {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
} from "@rnx-kit/metro-plugin-cyclic-dependencies-detector";
|
|
425
|
-
import {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
} from "@rnx-kit/metro-plugin-duplicates-checker";
|
|
429
|
-
import { MetroPlugin, MetroSerializer } from "@rnx-kit/metro-serializer";
|
|
410
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import type {
|
|
411
|
+
BundlerPlugins,
|
|
412
|
+
TypeScriptValidationOptions,
|
|
413
|
+
} from "@rnx-kit/config";
|
|
414
|
+
import { CyclicDependencies } from "@rnx-kit/metro-plugin-cyclic-dependencies-detector";
|
|
415
|
+
import { DuplicateDependencies } from "@rnx-kit/metro-plugin-duplicates-checker";
|
|
416
|
+
import type { MetroPlugin } from "@rnx-kit/metro-serializer";
|
|
417
|
+
import { MetroSerializer } from "@rnx-kit/metro-serializer";
|
|
430
418
|
import {
|
|
431
419
|
esbuildTransformerConfig,
|
|
432
420
|
MetroSerializer as MetroSerializerEsbuild,
|
|
433
421
|
} from "@rnx-kit/metro-serializer-esbuild";
|
|
434
|
-
import { AllPlatforms } from "@rnx-kit/tools-react-native/platform";
|
|
435
|
-
import { Project } from "@rnx-kit/typescript-service";
|
|
436
|
-
|
|
437
|
-
import { createProjectCache } from "./typescript/project-cache";
|
|
438
|
-
|
|
422
|
+
import type { AllPlatforms } from "@rnx-kit/tools-react-native/platform";
|
|
423
|
+
import type { Project } from "@rnx-kit/typescript-service";
|
|
439
424
|
import type { DeltaResult, Graph } from "metro";
|
|
440
425
|
import type { InputConfigT, SerializerConfigT } from "metro-config";
|
|
426
|
+
import { createProjectCache } from "./typescript/project-cache";
|
|
441
427
|
|
|
442
428
|
/**
|
|
443
429
|
* Create a hook function to be registered with Metro during serialization.
|
|
@@ -535,18 +521,17 @@ const emptySerializerHook = <span class="fstat-no" title="function not covered"
|
|
|
535
521
|
* Customize the Metro configuration.
|
|
536
522
|
*
|
|
537
523
|
* @param metroConfigReadonly Metro configuration
|
|
538
|
-
* @param
|
|
539
|
-
* @param detectDuplicateDependencies When true, duplicate dependency checking is enabled with a default set of options. Otherwise, the object allows for fine-grained control over the detection process.
|
|
540
|
-
* @param typescriptValidation When true, TypeScript type-checking is enabled with a default set of options. Otherwise, the object allows for fine-grained control over the type-checking process.
|
|
541
|
-
* @param treeShake When true, tree shaking is enabled.
|
|
524
|
+
* @param bundlerPlugins Plugins used to further customize Metro configuration
|
|
542
525
|
* @param print Optional function to use when printing status messages to the Metro console
|
|
543
526
|
*/
|
|
544
527
|
export function customizeMetroConfig(
|
|
545
528
|
metroConfigReadonly: InputConfigT,
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
529
|
+
{
|
|
530
|
+
detectCyclicDependencies,
|
|
531
|
+
detectDuplicateDependencies,
|
|
532
|
+
treeShake,
|
|
533
|
+
typescriptValidation,
|
|
534
|
+
}: BundlerPlugins,
|
|
550
535
|
print?: (message: string) => void
|
|
551
536
|
): void {
|
|
552
537
|
// We will be making changes to the Metro configuration. Coerce from a
|
|
@@ -601,7 +586,7 @@ export function customizeMetroConfig(
|
|
|
601
586
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
602
587
|
Code coverage generated by
|
|
603
588
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
604
|
-
at
|
|
589
|
+
at Mon Sep 19 2022 06:55:21 GMT+0000 (Coordinated Universal Time)
|
|
605
590
|
</div>
|
|
606
591
|
<script src="../prettify.js"></script>
|
|
607
592
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at
|
|
104
|
+
at Mon Sep 19 2022 06:55:21 GMT+0000 (Coordinated Universal Time)
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -492,8 +492,8 @@ import {
|
|
|
492
492
|
Project,
|
|
493
493
|
readConfigFile,
|
|
494
494
|
} from "@rnx-kit/typescript-service";
|
|
495
|
-
import fs from "fs";
|
|
496
|
-
import path from "path";
|
|
495
|
+
import * as fs from "fs";
|
|
496
|
+
import * as path from "path";
|
|
497
497
|
import ts from "typescript";
|
|
498
498
|
|
|
499
499
|
export type ProjectInfo = {
|
|
@@ -697,7 +697,7 @@ export function createProjectCache(
|
|
|
697
697
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
698
698
|
Code coverage generated by
|
|
699
699
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
700
|
-
at
|
|
700
|
+
at Mon Sep 19 2022 06:55:21 GMT+0000 (Coordinated Universal Time)
|
|
701
701
|
</div>
|
|
702
702
|
<script src="../../prettify.js"></script>
|
|
703
703
|
<script>
|