Commit 30fc738
Amjad Masad
[react-packager] Fix more node_modules resolution rules
Summary:
@public
Fixes facebook#773
This fixes `.json` name resolution. And also reads `package.json` when doing a directory module resolution.
The algorithm can be found here: https://nodejs.org/api/modules.html
I'll probably start including the node (or browserify) modules test in later diffs to make sure we're fully compliant.
Test Plan:
* ./runJestTests.sh
* ./runJestTests.sh PackagerIntegration
* open playground and require a json file
* test redbox1 parent 53b2c39 commit 30fc738
File tree
2 files changed
+80
-24
lines changed- packager/react-packager/src/DependencyResolver/haste/DependencyGraph
- __tests__
2 files changed
+80
-24
lines changedLines changed: 67 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
| 175 | + | |
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
| |||
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
189 | | - | |
| 191 | + | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
| |||
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
208 | 221 | | |
209 | 222 | | |
210 | 223 | | |
| |||
851 | 864 | | |
852 | 865 | | |
853 | 866 | | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
854 | 919 | | |
855 | 920 | | |
856 | 921 | | |
| |||
Lines changed: 13 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | 1 | | |
5 | 2 | | |
6 | 3 | | |
| |||
296 | 293 | | |
297 | 294 | | |
298 | 295 | | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
305 | 299 | | |
306 | | - | |
| 300 | + | |
307 | 301 | | |
308 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
309 | 308 | | |
310 | 309 | | |
311 | 310 | | |
| |||
444 | 443 | | |
445 | 444 | | |
446 | 445 | | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | 446 | | |
456 | 447 | | |
457 | 448 | | |
| |||
461 | 452 | | |
462 | 453 | | |
463 | 454 | | |
464 | | - | |
| 455 | + | |
465 | 456 | | |
466 | 457 | | |
467 | 458 | | |
468 | 459 | | |
469 | 460 | | |
470 | 461 | | |
471 | | - | |
| 462 | + | |
472 | 463 | | |
473 | 464 | | |
474 | 465 | | |
| |||
536 | 527 | | |
537 | 528 | | |
538 | 529 | | |
539 | | - | |
| 530 | + | |
540 | 531 | | |
541 | 532 | | |
542 | 533 | | |
| |||
0 commit comments