-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing some builtins #2
Comments
I don't want to encourage using private core API's. They're private for a reason, and using them makes it more difficult for the Node.js core team to do important changes. If it's really needed, it should be added by the specific module that needs it. Not here. |
I understand your intentions, but I am frustrated by the historical inconsistency from both Node core and the userspace around what constitutes the "private core" API vs the "public core" API. For instance, you include the "constants" module in your list. It is not a documented part of the public API - why include it? |
Also, for practical purposes, tools like Webpack need to know the exact list of built-in module if one wishes for Webpack not to bundle those. People shouldn't use the private APIs, but people still need the entire list for practical purposes. |
In case anyone stumbles here, this is Node.js API for querying the list of all builtin modules: const builtin = require('module').builtinModules; and example of the output in Node repl: > require('module').builtinModules
[
'_http_agent', '_http_client', '_http_common',
'_http_incoming', '_http_outgoing', '_http_server',
'_stream_duplex', '_stream_passthrough', '_stream_readable',
'_stream_transform', '_stream_wrap', '_stream_writable',
'_tls_common', '_tls_wrap', 'assert',
'async_hooks', 'buffer', 'child_process',
'cluster', 'console', 'constants',
'crypto', 'dgram', 'dns',
'domain', 'events', 'fs',
'http', 'http2', 'https',
'inspector', 'module', 'net',
'os', 'path', 'perf_hooks',
'process', 'punycode', 'querystring',
'readline', 'repl', 'stream',
'string_decoder', 'sys', 'timers',
'tls', 'trace_events', 'tty',
'url', 'util', 'v8',
'vm', 'worker_threads', 'zlib'
] The doc for that (including supported Node versions) is here. |
These are builtin modules that are part of the undocumented "private" core API but are unfortunately shimmed in browserify, and some module authors continue to prefer them over the public builtins because using them shaves a few kb off of their bundle size:
My root problem is that my test-runner,
jest
, does not recognize_stream_transform
as a core module and breaks as a result. You can see I originally tried to fix it here in the module that requires_stream_transform
, but as switching from_stream_transform
tostream
would have increased the bundle size, I am now looking for other solutions. If you are willing to add them to this module that would be great. If not (for whatever reason) I will approachjest-resolve
and see if it can be addressed there.The text was updated successfully, but these errors were encountered: