Commit 68fd2ac
loader: fix package resolution for edge case
this commit solves a regression introduced with PR-40980.
if a resolve call results in a script with .mjs extension the
is automatically set to . This avoids the case where an additional
in the same directory as the .mjs file would declare the
to commonjs
PR-URL: #41218
Refs: #40980
Refs: yargs/yargs#2068
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent fac0871 commit 68fd2acCopy full SHA for 68fd2ac
File tree
Expand file treeCollapse file tree
5 files changed
+233
-169
lines changedOpen diff view settings
Filter options
- lib/internal/modules
- cjs
- esm
- test/es-module
Expand file treeCollapse file tree
5 files changed
+233
-169
lines changedOpen diff view settings
Collapse file
lib/internal/modules/cjs/loader.js
Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/loader.js+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
457 | 457 | |
458 | 458 | |
459 | 459 | |
460 | | - |
| 460 | + |
461 | 461 | |
462 | 462 | |
463 | 463 | |
| ||
481 | 481 | |
482 | 482 | |
483 | 483 | |
484 | | - |
| 484 | + |
485 | 485 | |
486 | 486 | |
487 | 487 | |
|
Collapse file
lib/internal/modules/esm/get_format.js
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/get_format.js+42-24Lines changed: 42 additions & 24 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
32 | 32 | |
33 | 33 | |
34 | 34 | |
| 35 | + |
| 36 | + |
35 | 37 | |
36 | 38 | |
37 | 39 | |
| ||
53 | 55 | |
54 | 56 | |
55 | 57 | |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | | - |
67 | | - |
68 | | - |
69 | | - |
70 | | - |
71 | | - |
72 | | - |
73 | | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
| 58 | + |
78 | 59 | |
79 | 60 | |
80 | 61 | |
81 | | - |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + |
82 | 93 | |
| 94 | + |
| 95 | + |
| 96 | + |
| 97 | + |
83 | 98 | |
| 99 | + |
| 100 | + |
84 | 101 | |
85 | | - |
| 102 | + |
86 | 103 | |
87 | 104 | |
88 | 105 | |
89 | 106 | |
90 | 107 | |
| 108 | + |
91 | 109 | |
92 | 110 | |
93 | 111 | |
Collapse file
lib/internal/modules/esm/load.js
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/load.js+1-2Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | | - |
6 | 5 | |
7 | 6 | |
8 | 7 | |
| ||
18 | 17 | |
19 | 18 | |
20 | 19 | |
21 | | - |
| 20 | + |
22 | 21 | |
23 | 22 | |
24 | 23 | |
|
Collapse file
lib/internal/modules/esm/resolve.js
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/resolve.js+40-59Lines changed: 40 additions & 59 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
107 | 107 | |
108 | 108 | |
109 | 109 | |
110 | | - |
| 110 | + |
111 | 111 | |
112 | 112 | |
113 | 113 | |
| ||
464 | 464 | |
465 | 465 | |
466 | 466 | |
467 | | - |
468 | | - |
469 | | - |
470 | | - |
471 | | - |
472 | | - |
473 | | - |
474 | | - |
475 | | - |
476 | | - |
477 | | - |
478 | | - |
479 | | - |
480 | | - |
481 | | - |
482 | | - |
483 | 467 | |
484 | 468 | |
485 | 469 | |
| ||
512 | 496 | |
513 | 497 | |
514 | 498 | |
515 | | - |
| 499 | + |
516 | 500 | |
517 | 501 | |
518 | 502 | |
| ||
521 | 505 | |
522 | 506 | |
523 | 507 | |
524 | | - |
525 | | - |
526 | | - |
| 508 | + |
| 509 | + |
| 510 | + |
| 511 | + |
| 512 | + |
| 513 | + |
| 514 | + |
527 | 515 | |
528 | 516 | |
529 | | - |
| 517 | + |
530 | 518 | |
531 | 519 | |
532 | 520 | |
| ||
753 | 741 | |
754 | 742 | |
755 | 743 | |
756 | | - |
| 744 | + |
757 | 745 | |
758 | 746 | |
759 | 747 | |
| ||
785 | 773 | |
786 | 774 | |
787 | 775 | |
788 | | - |
| 776 | + |
789 | 777 | |
790 | 778 | |
791 | 779 | |
| ||
849 | 837 | |
850 | 838 | |
851 | 839 | |
852 | | - |
| 840 | + |
853 | 841 | |
854 | 842 | |
855 | 843 | |
| ||
888 | 876 | |
889 | 877 | |
890 | 878 | |
891 | | - |
892 | | - |
893 | | - |
894 | | - |
895 | | - |
896 | | - |
897 | | - |
| 879 | + |
| 880 | + |
| 881 | + |
| 882 | + |
| 883 | + |
898 | 884 | |
899 | 885 | |
900 | | - |
901 | | - |
902 | | - |
903 | | - |
| 886 | + |
904 | 887 | |
905 | 888 | |
906 | 889 | |
| ||
944 | 927 | |
945 | 928 | |
946 | 929 | |
947 | | - |
948 | 930 | |
949 | 931 | |
950 | 932 | |
| ||
953 | 935 | |
954 | 936 | |
955 | 937 | |
956 | | - |
| 938 | + |
957 | 939 | |
958 | 940 | |
959 | 941 | |
960 | | - |
961 | | - |
962 | | - |
| 942 | + |
963 | 943 | |
964 | | - |
965 | | - |
966 | | - |
967 | | - |
968 | | - |
| 944 | + |
969 | 945 | |
970 | 946 | |
971 | 947 | |
| ||
1014 | 990 | |
1015 | 991 | |
1016 | 992 | |
| 993 | + |
| 994 | + |
| 995 | + |
| 996 | + |
| 997 | + |
| 998 | + |
| 999 | + |
1017 | 1000 | |
1018 | 1001 | |
1019 | 1002 | |
| ||
1054 | 1037 | |
1055 | 1038 | |
1056 | 1039 | |
1057 | | - |
1058 | 1040 | |
1059 | | - |
1060 | | - |
1061 | | - |
1062 | | - |
1063 | | - |
1064 | | - |
1065 | | - |
| 1041 | + |
| 1042 | + |
| 1043 | + |
| 1044 | + |
| 1045 | + |
| 1046 | + |
1066 | 1047 | |
1067 | 1048 | |
1068 | 1049 | |
| ||
1086 | 1067 | |
1087 | 1068 | |
1088 | 1069 | |
1089 | | - |
1090 | | - |
1091 | | - |
| 1070 | + |
1092 | 1071 | |
1093 | 1072 | |
1094 | 1073 | |
1095 | | - |
| 1074 | + |
1096 | 1075 | |
1097 | 1076 | |
1098 | 1077 | |
| ||
1107 | 1086 | |
1108 | 1087 | |
1109 | 1088 | |
1110 | | - |
| 1089 | + |
| 1090 | + |
| 1091 | + |
0 commit comments