@rnx-kit/cli 0.9.52 → 0.9.56

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 (41) hide show
  1. package/CHANGELOG.md +41 -3
  2. package/coverage/clover.xml +116 -73
  3. package/coverage/coverage-final.json +3 -2
  4. package/coverage/lcov-report/index.html +43 -28
  5. package/coverage/lcov-report/src/bundle/index.html +15 -15
  6. package/coverage/lcov-report/src/bundle/kit-config.ts.html +1 -1
  7. package/coverage/lcov-report/src/bundle/metro.ts.html +15 -78
  8. package/coverage/lcov-report/src/bundle/overrides.ts.html +1 -1
  9. package/coverage/lcov-report/src/index.html +21 -21
  10. package/coverage/lcov-report/src/metro-config.ts.html +112 -121
  11. package/coverage/lcov-report/src/typescript/index.html +111 -0
  12. package/coverage/lcov-report/src/typescript/project-cache.ts.html +614 -0
  13. package/coverage/lcov.info +206 -128
  14. package/lib/bundle/metro.d.ts +1 -2
  15. package/lib/bundle/metro.d.ts.map +1 -1
  16. package/lib/bundle/metro.js +5 -17
  17. package/lib/bundle/metro.js.map +1 -1
  18. package/lib/bundle.d.ts.map +1 -1
  19. package/lib/bundle.js +1 -3
  20. package/lib/bundle.js.map +1 -1
  21. package/lib/metro-config.d.ts +3 -3
  22. package/lib/metro-config.d.ts.map +1 -1
  23. package/lib/metro-config.js +58 -67
  24. package/lib/metro-config.js.map +1 -1
  25. package/lib/start.d.ts.map +1 -1
  26. package/lib/start.js +6 -17
  27. package/lib/start.js.map +1 -1
  28. package/lib/types.d.ts +3 -4
  29. package/lib/types.d.ts.map +1 -1
  30. package/lib/typescript/project-cache.d.ts +42 -0
  31. package/lib/typescript/project-cache.d.ts.map +1 -0
  32. package/lib/typescript/project-cache.js +110 -0
  33. package/lib/typescript/project-cache.js.map +1 -0
  34. package/package.json +15 -15
  35. package/src/bundle/metro.ts +6 -27
  36. package/src/bundle.ts +1 -4
  37. package/src/metro-config.ts +78 -81
  38. package/src/start.ts +7 -26
  39. package/src/types.ts +3 -5
  40. package/src/typescript/project-cache.ts +178 -0
  41. package/CHANGELOG.json +0 -3175
@@ -1,113 +1,112 @@
1
1
  TN:
2
2
  SF:src/metro-config.ts
3
- FN:27,createSerializerHook
4
- FN:30,resetProject
5
- FN:38,getProject
6
- FN:47,(anonymous_3)
7
- FN:51,(anonymous_4)
8
- FN:78,(anonymous_5)
9
- FN:108,(anonymous_6)
10
- FN:121,customizeMetroConfig
11
- FNF:8
12
- FNH:1
13
- FNDA:0,createSerializerHook
14
- FNDA:0,resetProject
15
- FNDA:0,getProject
3
+ FN:33,createSerializerHook
4
+ FN:37,(anonymous_1)
5
+ FN:39,(anonymous_2)
6
+ FN:53,(anonymous_3)
7
+ FN:58,(anonymous_4)
8
+ FN:67,(anonymous_5)
9
+ FN:77,(anonymous_6)
10
+ FN:85,(anonymous_7)
11
+ FN:101,(anonymous_8)
12
+ FN:114,customizeMetroConfig
13
+ FNF:10
14
+ FNH:2
15
+ FNDA:6,createSerializerHook
16
+ FNDA:0,(anonymous_1)
17
+ FNDA:0,(anonymous_2)
16
18
  FNDA:0,(anonymous_3)
17
19
  FNDA:0,(anonymous_4)
18
20
  FNDA:0,(anonymous_5)
19
21
  FNDA:0,(anonymous_6)
22
+ FNDA:0,(anonymous_7)
23
+ FNDA:0,(anonymous_8)
20
24
  FNDA:6,customizeMetroConfig
21
- DA:28,0
22
- DA:31,0
23
- DA:32,0
24
- DA:33,0
25
- DA:34,0
26
- DA:39,0
25
+ DA:34,6
26
+ DA:36,6
27
+ DA:37,6
28
+ DA:39,6
27
29
  DA:40,0
30
+ DA:41,0
28
31
  DA:42,0
29
- DA:43,0
30
- DA:44,0
31
- DA:45,0
32
32
  DA:46,0
33
- DA:47,0
34
- DA:48,0
35
33
  DA:51,0
36
34
  DA:53,0
37
35
  DA:56,0
38
- DA:57,0
39
36
  DA:58,0
40
- DA:59,0
41
- DA:70,0
42
- DA:71,0
37
+ DA:61,0
38
+ DA:66,0
39
+ DA:67,0
40
+ DA:68,0
41
+ DA:72,0
43
42
  DA:73,0
44
- DA:75,0
43
+ DA:74,0
44
+ DA:77,0
45
45
  DA:78,0
46
46
  DA:79,0
47
47
  DA:80,0
48
- DA:81,0
49
- DA:82,0
48
+ DA:84,0
50
49
  DA:85,0
50
+ DA:86,0
51
+ DA:87,0
51
52
  DA:91,0
52
- DA:92,0
53
- DA:94,0
54
- DA:95,0
55
- DA:97,0
56
- DA:98,0
57
- DA:101,0
58
- DA:105,0
59
- DA:108,2
60
- DA:130,6
61
- DA:132,6
62
- DA:133,6
63
- DA:134,1
64
- DA:135,5
65
- DA:136,2
66
- DA:138,6
53
+ DA:93,0
54
+ DA:98,6
55
+ DA:101,2
56
+ DA:123,6
57
+ DA:125,6
58
+ DA:126,6
59
+ DA:127,1
60
+ DA:128,5
61
+ DA:129,2
62
+ DA:131,6
63
+ DA:132,1
64
+ DA:133,5
65
+ DA:134,2
66
+ DA:137,6
67
+ DA:138,1
67
68
  DA:139,1
68
69
  DA:140,5
69
- DA:141,2
70
- DA:144,6
71
- DA:145,1
72
- DA:146,1
73
- DA:147,5
74
- DA:158,4
75
- DA:162,1
76
- DA:165,6
77
- LF:56
78
- LH:18
79
- BRDA:32,0,0,0
80
- BRDA:32,0,1,0
81
- BRDA:40,1,0,0
82
- BRDA:40,1,1,0
83
- BRDA:43,2,0,0
84
- BRDA:43,2,1,0
85
- BRDA:45,3,0,0
86
- BRDA:45,3,1,0
87
- BRDA:53,4,0,0
88
- BRDA:53,4,1,0
89
- BRDA:53,5,0,0
90
- BRDA:53,5,1,0
91
- BRDA:80,6,0,0
92
- BRDA:80,6,1,0
93
- BRDA:81,7,0,0
94
- BRDA:81,7,1,0
95
- BRDA:133,8,0,1
96
- BRDA:133,8,1,5
97
- BRDA:135,9,0,2
98
- BRDA:135,9,1,3
99
- BRDA:138,10,0,1
100
- BRDA:138,10,1,5
101
- BRDA:140,11,0,2
102
- BRDA:140,11,1,3
103
- BRDA:144,12,0,1
104
- BRDA:144,12,1,5
105
- BRDA:147,13,0,4
106
- BRDA:147,13,1,1
107
- BRDA:165,14,0,0
108
- BRDA:165,14,1,6
109
- BRF:30
110
- BRH:13
70
+ DA:151,4
71
+ DA:155,1
72
+ DA:158,6
73
+ DA:159,6
74
+ DA:160,0
75
+ DA:161,6
76
+ DA:162,6
77
+ DA:164,6
78
+ LF:53
79
+ LH:27
80
+ BRDA:41,0,0,0
81
+ BRDA:41,0,1,0
82
+ BRDA:42,1,0,0
83
+ BRDA:42,1,1,0
84
+ BRDA:72,2,0,0
85
+ BRDA:72,2,1,0
86
+ BRDA:86,3,0,0
87
+ BRDA:86,3,1,0
88
+ BRDA:91,4,0,0
89
+ BRDA:91,4,1,0
90
+ BRDA:91,5,0,0
91
+ BRDA:91,5,1,0
92
+ BRDA:126,6,0,1
93
+ BRDA:126,6,1,5
94
+ BRDA:128,7,0,2
95
+ BRDA:128,7,1,3
96
+ BRDA:131,8,0,1
97
+ BRDA:131,8,1,5
98
+ BRDA:133,9,0,2
99
+ BRDA:133,9,1,3
100
+ BRDA:137,10,0,1
101
+ BRDA:137,10,1,5
102
+ BRDA:140,11,0,4
103
+ BRDA:140,11,1,1
104
+ BRDA:159,12,0,0
105
+ BRDA:159,12,1,6
106
+ BRDA:161,13,0,6
107
+ BRDA:161,13,1,0
108
+ BRF:28
109
+ BRH:14
111
110
  end_of_record
112
111
  TN:
113
112
  SF:src/bundle/kit-config.ts
@@ -165,53 +164,47 @@ BRH:15
165
164
  end_of_record
166
165
  TN:
167
166
  SF:src/bundle/metro.ts
168
- FN:18,createMetroBundleArgs
169
- FN:66,metroBundle
167
+ FN:16,createMetroBundleArgs
168
+ FN:64,metroBundle
170
169
  FNF:2
171
170
  FNH:1
172
171
  FNDA:15,createMetroBundleArgs
173
172
  FNDA:0,metroBundle
173
+ DA:30,15
174
+ DA:31,15
174
175
  DA:32,15
175
- DA:33,15
176
- DA:34,15
177
- DA:37,15
178
- DA:38,14
179
- DA:42,15
180
- DA:43,15
181
- DA:46,15
182
- DA:71,0
183
- DA:74,0
184
- DA:75,0
185
- DA:79,0
186
- DA:80,0
176
+ DA:35,15
177
+ DA:36,14
178
+ DA:40,15
179
+ DA:41,15
180
+ DA:44,15
181
+ DA:68,0
182
+ DA:70,0
183
+ DA:73,0
184
+ DA:81,0
185
+ DA:84,0
186
+ DA:85,0
187
187
  DA:87,0
188
- DA:94,0
189
- DA:102,0
190
- DA:105,0
191
- DA:106,0
192
- DA:108,0
193
- DA:111,0
194
- LF:20
188
+ DA:90,0
189
+ LF:16
195
190
  LH:8
196
- BRDA:32,0,0,12
197
- BRDA:32,0,1,3
198
- BRDA:32,1,0,15
199
- BRDA:32,1,1,4
200
- BRDA:37,2,0,14
201
- BRDA:37,2,1,1
202
- BRDA:38,3,0,14
203
- BRDA:38,3,1,1
204
- BRDA:42,4,0,15
205
- BRDA:42,4,1,0
206
- BRDA:74,5,0,0
207
- BRDA:74,5,1,0
208
- BRDA:79,6,0,0
209
- BRDA:79,6,1,0
210
- BRDA:106,7,0,0
211
- BRDA:106,7,1,0
212
- BRDA:108,8,0,0
213
- BRDA:108,8,1,0
214
- BRF:18
191
+ BRDA:30,0,0,12
192
+ BRDA:30,0,1,3
193
+ BRDA:30,1,0,15
194
+ BRDA:30,1,1,4
195
+ BRDA:35,2,0,14
196
+ BRDA:35,2,1,1
197
+ BRDA:36,3,0,14
198
+ BRDA:36,3,1,1
199
+ BRDA:40,4,0,15
200
+ BRDA:40,4,1,0
201
+ BRDA:77,5,0,0
202
+ BRDA:77,5,1,0
203
+ BRDA:85,6,0,0
204
+ BRDA:85,6,1,0
205
+ BRDA:87,7,0,0
206
+ BRDA:87,7,1,0
207
+ BRF:16
215
208
  BRH:9
216
209
  end_of_record
217
210
  TN:
@@ -231,3 +224,88 @@ BRDA:49,0,1,1
231
224
  BRF:2
232
225
  BRH:2
233
226
  end_of_record
227
+ TN:
228
+ SF:src/typescript/project-cache.ts
229
+ FN:56,createProjectCache
230
+ FN:68,findProjectRoot
231
+ FN:87,readTSConfig
232
+ FN:95,(anonymous_3)
233
+ FN:102,createProjectInfo
234
+ FN:111,(anonymous_5)
235
+ FN:147,getProjectInfo
236
+ FN:162,clearPlatform
237
+ FN:163,(anonymous_8)
238
+ FNF:9
239
+ FNH:1
240
+ FNDA:6,createProjectCache
241
+ FNDA:0,findProjectRoot
242
+ FNDA:0,readTSConfig
243
+ FNDA:0,(anonymous_3)
244
+ FNDA:0,createProjectInfo
245
+ FNDA:0,(anonymous_5)
246
+ FNDA:0,getProjectInfo
247
+ FNDA:0,clearPlatform
248
+ FNDA:0,(anonymous_8)
249
+ DA:59,6
250
+ DA:60,6
251
+ DA:66,6
252
+ DA:70,0
253
+ DA:71,0
254
+ DA:72,0
255
+ DA:77,0
256
+ DA:78,0
257
+ DA:79,0
258
+ DA:84,0
259
+ DA:88,0
260
+ DA:90,0
261
+ DA:91,0
262
+ DA:92,0
263
+ DA:93,0
264
+ DA:94,0
265
+ DA:95,0
266
+ DA:96,0
267
+ DA:99,0
268
+ DA:107,0
269
+ DA:111,0
270
+ DA:112,0
271
+ DA:113,0
272
+ DA:114,0
273
+ DA:115,0
274
+ DA:116,0
275
+ DA:126,0
276
+ DA:136,0
277
+ DA:139,0
278
+ DA:141,0
279
+ DA:151,0
280
+ DA:152,0
281
+ DA:154,0
282
+ DA:155,0
283
+ DA:156,0
284
+ DA:157,0
285
+ DA:159,0
286
+ DA:163,0
287
+ DA:164,0
288
+ DA:165,0
289
+ DA:166,0
290
+ DA:167,0
291
+ DA:169,0
292
+ DA:174,6
293
+ LF:44
294
+ LH:4
295
+ BRDA:71,0,0,0
296
+ BRDA:71,0,1,0
297
+ BRDA:78,1,0,0
298
+ BRDA:78,1,1,0
299
+ BRDA:91,2,0,0
300
+ BRDA:91,2,1,0
301
+ BRDA:93,3,0,0
302
+ BRDA:93,3,1,0
303
+ BRDA:155,4,0,0
304
+ BRDA:155,4,1,0
305
+ BRDA:165,5,0,0
306
+ BRDA:165,5,1,0
307
+ BRDA:166,6,0,0
308
+ BRDA:166,6,1,0
309
+ BRF:14
310
+ BRH:0
311
+ end_of_record
@@ -1,5 +1,4 @@
1
1
  import { BundleArgs as MetroBundleArgs } from "@rnx-kit/metro-service";
2
- import { Service } from "@rnx-kit/typescript-service";
3
2
  import type { ConfigT } from "metro-config";
4
3
  import type { BundleConfig } from "./types";
5
4
  /**
@@ -16,5 +15,5 @@ export declare function createMetroBundleArgs({ entryPath: entryFile, distPath,
16
15
  * @param metroConfig Metro configuration
17
16
  * @param bundleConfig Bundle configuration
18
17
  */
19
- export declare function metroBundle(tsservice: Service, metroConfig: ConfigT, bundleConfig: BundleConfig): Promise<void>;
18
+ export declare function metroBundle(metroConfig: ConfigT, bundleConfig: BundleConfig): Promise<void>;
20
19
  //# sourceMappingURL=metro.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metro.d.ts","sourceRoot":"","sources":["../../src/bundle/metro.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,UAAU,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAkB,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAI5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EAAE,SAAS,EACpB,QAAQ,EACR,UAAU,EAAE,UAAU,EACtB,YAAY,EACZ,cAAc,EACd,aAAa,EAAE,eAAe,EAC9B,uBAAuB,EAAE,oBAAoB,EAC7C,QAAQ,EACR,GAAG,EACH,MAAM,GACP,EAAE,YAAY,GAAG,eAAe,CA4BhC;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC,CA0Cf"}
1
+ {"version":3,"file":"metro.d.ts","sourceRoot":"","sources":["../../src/bundle/metro.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,UAAU,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,SAAS,EAAE,SAAS,EACpB,QAAQ,EACR,UAAU,EAAE,UAAU,EACtB,YAAY,EACZ,cAAc,EACd,aAAa,EAAE,eAAe,EAC9B,uBAAuB,EAAE,oBAAoB,EAC7C,QAAQ,EACR,GAAG,EACH,MAAM,GACP,EAAE,YAAY,GAAG,eAAe,CA4BhC;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC,CAwBf"}
@@ -16,8 +16,6 @@ exports.metroBundle = exports.createMetroBundleArgs = void 0;
16
16
  const console_1 = require("@rnx-kit/console");
17
17
  const metro_service_1 = require("@rnx-kit/metro-service");
18
18
  const fs_1 = require("@rnx-kit/tools-node/fs");
19
- const typescript_service_1 = require("@rnx-kit/typescript-service");
20
- const chalk_1 = __importDefault(require("chalk"));
21
19
  const path_1 = __importDefault(require("path"));
22
20
  const metro_config_1 = require("../metro-config");
23
21
  /**
@@ -59,23 +57,13 @@ exports.createMetroBundleArgs = createMetroBundleArgs;
59
57
  * @param metroConfig Metro configuration
60
58
  * @param bundleConfig Bundle configuration
61
59
  */
62
- function metroBundle(tsservice, metroConfig, bundleConfig) {
60
+ function metroBundle(metroConfig, bundleConfig) {
63
61
  return __awaiter(this, void 0, void 0, function* () {
64
62
  (0, console_1.info)(`Bundling ${bundleConfig.platform}...`);
65
- let tsprojectInfo;
66
- if (bundleConfig.typescriptValidation) {
67
- const configFileName = (0, typescript_service_1.findConfigFile)(bundleConfig.entryPath, "tsconfig.json");
68
- if (!configFileName) {
69
- (0, console_1.warn)(chalk_1.default.yellow("skipping TypeScript validation -- cannot find tsconfig.json for entry file %o"), bundleConfig.entryPath);
70
- }
71
- else {
72
- tsprojectInfo = {
73
- service: tsservice,
74
- configFileName,
75
- };
76
- }
77
- }
78
- (0, metro_config_1.customizeMetroConfig)(metroConfig, bundleConfig.detectCyclicDependencies, bundleConfig.detectDuplicateDependencies, tsprojectInfo, bundleConfig.experimental_treeShake);
63
+ const typescriptValidationOptions = {
64
+ throwOnError: true,
65
+ };
66
+ (0, metro_config_1.customizeMetroConfig)(metroConfig, bundleConfig.detectCyclicDependencies, bundleConfig.detectDuplicateDependencies, bundleConfig.typescriptValidation ? typescriptValidationOptions : false, bundleConfig.experimental_treeShake);
79
67
  const metroBundleArgs = createMetroBundleArgs(bundleConfig);
80
68
  // ensure all output directories exist
81
69
  (0, fs_1.createDirectory)(path_1.default.dirname(metroBundleArgs.bundleOutput));
@@ -1 +1 @@
1
- {"version":3,"file":"metro.js","sourceRoot":"","sources":["../../src/bundle/metro.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8CAA8C;AAC9C,0DAA+E;AAC/E,+CAAyD;AACzD,oEAAsE;AACtE,kDAA0B;AAE1B,gDAAwB;AACxB,kDAAuD;AAIvD;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,EACpC,SAAS,EAAE,SAAS,EACpB,QAAQ,EACR,UAAU,EAAE,UAAU,EACtB,YAAY,EACZ,cAAc,EACd,aAAa,EAAE,eAAe,EAC9B,uBAAuB,EAAE,oBAAoB,EAC7C,QAAQ,EACR,GAAG,EACH,MAAM,GACO;IACb,6CAA6C;IAC7C,MAAM,eAAe,GACnB,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;IACrE,MAAM,UAAU,GAAG,GAAG,YAAY,IAAI,QAAQ,IAAI,eAAe,EAAE,CAAC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,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC;IAC9C,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAsB,SAAS,CAC7B,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EACpB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,gBAAgB,GAC3B,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
package/lib/bundle.js CHANGED
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.rnxBundle = void 0;
13
13
  const metro_service_1 = require("@rnx-kit/metro-service");
14
14
  const properties_1 = require("@rnx-kit/tools-language/properties");
15
- const typescript_service_1 = require("@rnx-kit/typescript-service");
16
15
  const kit_config_1 = require("./bundle/kit-config");
17
16
  const metro_1 = require("./bundle/metro");
18
17
  const overrides_1 = require("./bundle/overrides");
@@ -28,9 +27,8 @@ function rnxBundle(_argv, cliConfig, cliOptions) {
28
27
  dev: cliOptions.dev,
29
28
  minify: cliOptions.minify,
30
29
  });
31
- const tsservice = new typescript_service_1.Service();
32
30
  for (const bundleConfig of bundleConfigs) {
33
- yield (0, metro_1.metroBundle)(tsservice, metroConfig, bundleConfig);
31
+ yield (0, metro_1.metroBundle)(metroConfig, bundleConfig);
34
32
  }
35
33
  return Promise.resolve();
36
34
  });
package/lib/bundle.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0DAAqE;AACrE,mEAAuE;AAEvE,oEAAsD;AACtD,oDAA0D;AAC1D,0CAA6C;AAC7C,kDAAmE;AAqBnE,SAAsB,SAAS,CAC7B,KAAoB,EACpB,SAAoB,EACpB,UAA4B;;QAE5B,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAe,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAEjE,MAAM,gBAAgB,GAAG,IAAA,gCAAmB,EAC1C,UAAU,CAAC,EAAE,EACb,UAAU,CAAC,QAAQ,CACpB,CAAC;QACF,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC1B;QAED,IAAA,yCAA6B,EAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAE5D,MAAM,aAAa,GAAG,IAAA,8BAAiB,EACrC,gBAAgB,EAChB;YACE,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CACF,CAAC;QAEF,MAAM,SAAS,GAAG,IAAI,4BAAO,EAAE,CAAC;QAEhC,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;YACxC,MAAM,IAAA,mBAAW,EAAC,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;SACzD;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CAAA;AAhCD,8BAgCC"}
1
+ {"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0DAAqE;AACrE,mEAAuE;AAEvE,oDAA0D;AAC1D,0CAA6C;AAC7C,kDAAmE;AAqBnE,SAAsB,SAAS,CAC7B,KAAoB,EACpB,SAAoB,EACpB,UAA4B;;QAE5B,MAAM,WAAW,GAAG,MAAM,IAAA,+BAAe,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QAEjE,MAAM,gBAAgB,GAAG,IAAA,gCAAmB,EAC1C,UAAU,CAAC,EAAE,EACb,UAAU,CAAC,QAAQ,CACpB,CAAC;QACF,IAAI,CAAC,gBAAgB,EAAE;YACrB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SAC1B;QAED,IAAA,yCAA6B,EAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;QAE5D,MAAM,aAAa,GAAG,IAAA,8BAAiB,EACrC,gBAAgB,EAChB;YACE,GAAG,EAAE,UAAU,CAAC,GAAG;YACnB,MAAM,EAAE,UAAU,CAAC,MAAM;SAC1B,CACF,CAAC;QAEF,KAAK,MAAM,YAAY,IAAI,aAAa,EAAE;YACxC,MAAM,IAAA,mBAAW,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC;SAC9C;QAED,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CAAA;AA9BD,8BA8BC"}
@@ -1,15 +1,15 @@
1
1
  import { PluginOptions as CyclicDetectorOptions } from "@rnx-kit/metro-plugin-cyclic-dependencies-detector";
2
2
  import { Options as DuplicateDetectorOptions } from "@rnx-kit/metro-plugin-duplicates-checker";
3
+ import type { TypeScriptValidationOptions } from "./types";
3
4
  import type { InputConfigT } from "metro-config";
4
- import type { TSProjectInfo } from "./types";
5
5
  /**
6
6
  * Customize the Metro configuration.
7
7
  *
8
8
  * @param metroConfigReadonly Metro configuration
9
9
  * @param detectCyclicDependencies When true, cyclic dependency checking is enabled with a default set of options. Otherwise the object allows for fine-grained control over the detection process.
10
10
  * @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.
11
- * @param tsprojectInfo When set, TypeScript validation is enabled during bundling and serving.
11
+ * @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.
12
12
  * @param experimental_treeShake When true, experimental tree-shaking is enabled.
13
13
  */
14
- export declare function customizeMetroConfig(metroConfigReadonly: InputConfigT, detectCyclicDependencies: boolean | CyclicDetectorOptions, detectDuplicateDependencies: boolean | DuplicateDetectorOptions, tsprojectInfo: TSProjectInfo | undefined, experimental_treeShake: boolean): void;
14
+ export declare function customizeMetroConfig(metroConfigReadonly: InputConfigT, detectCyclicDependencies: boolean | CyclicDetectorOptions, detectDuplicateDependencies: boolean | DuplicateDetectorOptions, typescriptValidation: boolean | TypeScriptValidationOptions, experimental_treeShake: boolean): void;
15
15
  //# sourceMappingURL=metro-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"metro-config.d.ts","sourceRoot":"","sources":["../src/metro-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,IAAI,qBAAqB,EACvC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAEL,OAAO,IAAI,wBAAwB,EACpC,MAAM,0CAA0C,CAAC;AAclD,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,cAAc,CAAC;AAGpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAuF7C;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,YAAY,EACjC,wBAAwB,EAAE,OAAO,GAAG,qBAAqB,EACzD,2BAA2B,EAAE,OAAO,GAAG,wBAAwB,EAC/D,aAAa,EAAE,aAAa,GAAG,SAAS,EACxC,sBAAsB,EAAE,OAAO,GAC9B,IAAI,CAyCN"}
1
+ {"version":3,"file":"metro-config.d.ts","sourceRoot":"","sources":["../src/metro-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,IAAI,qBAAqB,EACvC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAEL,OAAO,IAAI,wBAAwB,EACpC,MAAM,0CAA0C,CAAC;AAUlD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAG3D,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,cAAc,CAAC;AAoFpE;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,mBAAmB,EAAE,YAAY,EACjC,wBAAwB,EAAE,OAAO,GAAG,qBAAqB,EACzD,2BAA2B,EAAE,OAAO,GAAG,wBAAwB,EAC/D,oBAAoB,EAAE,OAAO,GAAG,2BAA2B,EAC3D,sBAAsB,EAAE,OAAO,GAC9B,IAAI,CA6CN"}
@@ -5,74 +5,60 @@ const metro_plugin_cyclic_dependencies_detector_1 = require("@rnx-kit/metro-plug
5
5
  const metro_plugin_duplicates_checker_1 = require("@rnx-kit/metro-plugin-duplicates-checker");
6
6
  const metro_serializer_1 = require("@rnx-kit/metro-serializer");
7
7
  const metro_serializer_esbuild_1 = require("@rnx-kit/metro-serializer-esbuild");
8
- const typescript_react_native_resolver_1 = require("@rnx-kit/typescript-react-native-resolver");
9
- const typescript_service_1 = require("@rnx-kit/typescript-service");
10
- function createSerializerHook({ service, configFileName }) {
11
- const tsprojectByPlatform = new Map();
12
- function resetProject(platform) {
13
- const tsproject = tsprojectByPlatform.get(platform);
14
- if (tsproject) {
15
- tsproject.dispose();
16
- tsprojectByPlatform.delete(platform);
17
- }
18
- }
19
- function getProject(platform) {
20
- let tsproject = tsprojectByPlatform.get(platform);
21
- if (!tsproject) {
22
- // start with an empty project, ignoring the file graph provided by tsconfig.json
23
- const cmdLine = (0, typescript_service_1.readConfigFile)(configFileName);
24
- if (!cmdLine) {
25
- throw new Error(`Failed to load '${configFileName}'`);
26
- }
27
- else if (cmdLine.errors.length > 0) {
28
- const writer = (0, typescript_service_1.createDiagnosticWriter)();
29
- cmdLine.errors.forEach((e) => writer.print(e));
30
- throw new Error(`Failed to load '${configFileName}'`);
31
- }
32
- const enhanceLanguageServiceHost = (host) => {
33
- const platformExtensionNames = platform === "windows" || platform === "win32"
34
- ? ["win", "native"]
35
- : ["native"];
36
- const disableReactNativePackageSubstitution = true;
37
- const traceReactNativeModuleResolutionErrors = false;
38
- const traceResolutionLog = undefined;
39
- (0, typescript_react_native_resolver_1.changeHostToUseReactNativeResolver)({
40
- host,
41
- options: cmdLine.options,
42
- platform,
43
- platformExtensionNames,
44
- disableReactNativePackageSubstitution,
45
- traceReactNativeModuleResolutionErrors,
46
- traceResolutionLog,
47
- });
48
- };
49
- tsproject = service.openProject(cmdLine, enhanceLanguageServiceHost);
50
- tsproject.removeAllFiles();
51
- tsprojectByPlatform.set(platform, tsproject);
52
- }
53
- return tsproject;
54
- }
8
+ const project_cache_1 = require("./typescript/project-cache");
9
+ /**
10
+ * Create a hook function to be registered with Metro during serialization.
11
+ * Each serialization pass runs the hook which type-checks each added/updated
12
+ * source file.
13
+ *
14
+ * Source file in node_modules (external packages) are ignored.
15
+ *
16
+ * @param options TypeScript validation options
17
+ * @returns Hook function
18
+ */
19
+ function createSerializerHook(options) {
20
+ const projectCache = (0, project_cache_1.createProjectCache)(options.print);
21
+ const patternNodeModules = /[/\\]node_modules[/\\]/;
22
+ const excludeNodeModules = (p) => !patternNodeModules.test(p);
55
23
  const hook = (graph, delta) => {
56
24
  const platform = graph.transformOptions.platform;
57
25
  if (platform) {
58
26
  if (delta.reset) {
59
- resetProject(platform);
60
- }
61
- const tsproject = getProject(platform);
62
- // Apply delta change changes to the TypeScript project. New files are
63
- // added to the project file list. Updated files have their cached
64
- // snapshot cleared, causing the file to be reloaded. Deleted files
65
- // are removed from the project file list.
66
- for (const module of delta.added.values()) {
67
- tsproject.setFile(module.path);
27
+ // Metro is signaling that all cached data for this Graph should be
28
+ // thrown out. Each Graph is scoped to one platform, so discard all
29
+ // of that platform's projects.
30
+ projectCache.clearPlatform(platform);
68
31
  }
69
- for (const module of delta.modified.values()) {
70
- tsproject.setFile(module.path);
32
+ // Filter adds, updates, and deletes coming from Metro. Do not look at
33
+ // anything in an external package (e.g. under node_modules).
34
+ const adds = Array.from(delta.added.values(), (module) => module.path).filter(excludeNodeModules);
35
+ const updates = Array.from(delta.modified.values(), (module) => module.path).filter(excludeNodeModules);
36
+ const deletes = Array.from(delta.deleted.values()).filter(excludeNodeModules);
37
+ // Map each file to a TypeScript project, and apply its delta operation.
38
+ const tsprojectsToValidate = new Set();
39
+ adds.concat(updates).forEach((sourceFile) => {
40
+ const { tsproject, tssourceFiles } = projectCache.getProjectInfo(sourceFile, platform);
41
+ if (tssourceFiles.has(sourceFile)) {
42
+ tsproject.setFile(sourceFile);
43
+ tsprojectsToValidate.add(tsproject);
44
+ }
45
+ });
46
+ deletes.forEach((sourceFile) => {
47
+ const { tsproject } = projectCache.getProjectInfo(sourceFile, platform);
48
+ tsproject.removeFile(sourceFile);
49
+ tsprojectsToValidate.add(tsproject);
50
+ });
51
+ // Validate all projects which changed, printing all type errors.
52
+ let isValid = true;
53
+ tsprojectsToValidate.forEach((p) => {
54
+ if (!p.validate()) {
55
+ isValid = false;
56
+ }
57
+ });
58
+ if (!isValid && options.throwOnError) {
59
+ // Type-checking failed. Fail the Metro operation (bundling or serving).
60
+ throw new Error("Type validation failed");
71
61
  }
72
- for (const module of delta.deleted.values()) {
73
- tsproject.removeFile(module);
74
- }
75
- tsproject.validate();
76
62
  }
77
63
  };
78
64
  return hook;
@@ -86,10 +72,10 @@ const emptySerializerHook = (_graph, _delta) => {
86
72
  * @param metroConfigReadonly Metro configuration
87
73
  * @param detectCyclicDependencies When true, cyclic dependency checking is enabled with a default set of options. Otherwise the object allows for fine-grained control over the detection process.
88
74
  * @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.
89
- * @param tsprojectInfo When set, TypeScript validation is enabled during bundling and serving.
75
+ * @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.
90
76
  * @param experimental_treeShake When true, experimental tree-shaking is enabled.
91
77
  */
92
- function customizeMetroConfig(metroConfigReadonly, detectCyclicDependencies, detectDuplicateDependencies, tsprojectInfo, experimental_treeShake) {
78
+ function customizeMetroConfig(metroConfigReadonly, detectCyclicDependencies, detectDuplicateDependencies, typescriptValidation, experimental_treeShake) {
93
79
  // We will be making changes to the Metro configuration. Coerce from a
94
80
  // type with readonly props to a type where the props are writeable.
95
81
  const metroConfig = metroConfigReadonly;
@@ -126,9 +112,14 @@ function customizeMetroConfig(metroConfigReadonly, detectCyclicDependencies, det
126
112
  else {
127
113
  delete metroConfig.serializer.customSerializer;
128
114
  }
129
- metroConfig.serializer.experimentalSerializerHook = tsprojectInfo
130
- ? createSerializerHook(tsprojectInfo)
131
- : emptySerializerHook;
115
+ let hook = emptySerializerHook;
116
+ if (typeof typescriptValidation === "object") {
117
+ hook = createSerializerHook(typescriptValidation);
118
+ }
119
+ else if (typescriptValidation !== false) {
120
+ hook = createSerializerHook({});
121
+ }
122
+ metroConfig.serializer.experimentalSerializerHook = hook;
132
123
  }
133
124
  exports.customizeMetroConfig = customizeMetroConfig;
134
125
  //# sourceMappingURL=metro-config.js.map