Repository navigation
implement require.extensions - #18478
Conversation
|
Updated 6:23 PM PT - Mar 26th, 2025
✅ @paperclover, your commit 965794b5fceaaf7975f16cd01aa9b65dc03cd9f9 passed in 🧪 try this PR locally: bunx bun-pr 18478 |
|
this will be rewritten to not use ProxyObject |
|
the pr is reworked to not use a ProxyObject. instead of fixing issues in the direct calls, i have removed those implementations as i do not think it is important to support. |
a58dabc to
fc93602
Compare
| auto* name = propertyName.publicName(); | ||
| if (!name->startsWith("."_s)) return; | ||
| BunString ext = Bun::toString(name); | ||
| uint32_t kind = 0; |
There was a problem hiding this comment.
i chose not to use an enum because it is used for a single parameter in one very specific function. the enum would have to be manually transcribed anyways, so it doesn't make it safer (until we get translate-c++)
| const i = bun.strings.indexOfCharPos(basename, '.', next) orelse | ||
| return null; | ||
| next = i + 1; | ||
| if (i == 0) continue; |
There was a problem hiding this comment.
should this i == 0 check be deleted? "foo/.bar" won't get a custom function if i'm understanding correctly
There was a problem hiding this comment.
i have had it hit. this is also a closer port to what node does here
This reverts commit 70ddfb5.
Closes #15795
Closes #15566
See BUN-11234
Closes BUN-11893
Closes BUN-11705
Closes Unitech/pm2#5964
require.extensionsnow contains the newly added extensions that Node 22-23 addsrequire.extensionscan be mutated to affect resolution and module loadingextensions['.js'],extensions['.json'], or another into a new extension will add a fast path