GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Expose up-to-date list of builtin modules · Issue #3307 · nodejs/node

Expose up-to-date list of builtin modules #3307

New issue
Copy link
New issue
Copy link
Closed
Closed
Expose up-to-date list of builtin modules#3307
Copy link
Assignees
maclover7
Labels
feature requestIssues requesting new Node.js features.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.

Description

@zkat
zkat
opened on Oct 9, 2015
Issue body actions

npm's normalize-package-data needs a list of built in node modules in order to warn against potential package name conflicts (see fixNameField.

We used to have the list hardcoded, and then @sindresorhus was kind enough to author an external package that would maintain such a list, is-builtin-module.

It seems that this list is best maintained by node itself, since there's always a risk of things going out of sync or being just plain wrong. Would it be possible to expose this directly through some built-in value in node?

Ref: https://github.com/nodejs/node/pull/3299/files#r41686776

cc @Fishrock123

Activity

Next
  1. mscdex
    added
    feature requestIssues requesting new Node.js features.
    on Oct 9, 2015
  2. Fishrock123 commented on Oct 10, 2015

    @Fishrock123
    Fishrock123
    on Oct 10, 2015
    Contributor
    More actions

    Fwiw is-builtin-module uses the builtin-modules module, whose source code is as follows:

    'use strict';
    
    var blacklist = [
        'freelist',
        'sys'
    ];
    
    module.exports = Object.keys(process.binding('natives')).filter(function (el) {
        return !/^_|^internal/.test(el) && blacklist.indexOf(el) === -1;
    }).sort();

    Specifically, this bit: Object.keys(process.binding('natives')) will stop working in the future.

    See:

    • src: log warning on process.binding('natives'): src: log warning on process.binding('natives') #2741 (LANDED)
    • node: deprecate public access to process.binding: node: deprecate public access to process.binding #2768 (discussion)

    About the first, process.binding('natives') returns data (the whole damn source code) which cannot be guaranteed not to change. As such we're going to be moving away from it pretty much asap.

  3. Fishrock123 commented on Oct 10, 2015

    @Fishrock123
    Fishrock123
    on Oct 10, 2015
    Contributor
    More actions

    I suggest we have an API that exposes a list of core module names only.

  4. piranna commented on Oct 10, 2015

    @piranna
    piranna
    on Oct 10, 2015
    Contributor
    More actions

    On NodeOS we were thinking about moving out all build-in modules to reduce the size of the binary and it's memory foot print, I think this could be really useful...

  5. sindresorhus commented on Oct 11, 2015

    @sindresorhus
    sindresorhus
    on Oct 11, 2015
    More actions

    👍 As illustrated, doing this in user-land is brittle.

  6. ChALkeR commented on Oct 20, 2015

    @ChALkeR
    ChALkeR
    on Oct 20, 2015
    Member
    More actions

    See also: #3078 (comment) and ayecue/node-cjs-deps@b3ea440.

    We might want to provide a way to expose a list of _prefixed (but not internal) module names.
    For example, require('module').builtinModules for the normal list and require('module')._builtinModules for the full list that includes both normal and _prefixed builtin module names.

    And yes, names only.

    Note: per doc, this should not be put into the module module, it's Frozen. We need a different place I guess.

  7. ChALkeR commented on Oct 20, 2015

    @ChALkeR
    ChALkeR
    on Oct 20, 2015
    Member
    More actions

    cc @Trott

  8. trevnorris commented on Oct 20, 2015

    @trevnorris
    trevnorris
    on Oct 20, 2015
    Contributor
    More actions

    Ref: #2180

    NM. Different list.

  9. Fishrock123 commented on Oct 20, 2015

    @Fishrock123
    Fishrock123
    on Oct 20, 2015
    Contributor
    More actions

    @trevnorris that's not quite the same though, is it?

    Also, should it list internal modules too, or should that be something separate?

    I've noticed some things, such as debuggers, apparently rely on knowing what internal modules there are, which is weird. I'd prefer someone to give a solid reason why first.

  10. sindresorhus commented on Oct 20, 2015

    @sindresorhus
    sindresorhus
    on Oct 20, 2015
    More actions

    Also, should it list internal modules too, or should that be something separate?

    Only public modules. If there's a need for a list of internal modules, it should be a separate thing.

  11. ChALkeR commented on Oct 20, 2015

    @ChALkeR
    ChALkeR
    on Oct 20, 2015
    Member
    More actions

    @Fishrock123 Internal or prefixed? Could you give an example, please?

  12. Fishrock123 commented on Oct 20, 2015

    @Fishrock123
    Fishrock123
    on Oct 20, 2015
    Contributor
    More actions

    Only public modules. If there's a need for a list of internal modules, it should be a separate thing.

    Makes sense, I was thinking along these lines too.

    @ChALkeR I meant /internal/. Prefixed modules would appear in the regular one as they are potential module name conflicts.

  13. hemanth commented on Oct 28, 2015

    @hemanth
    hemanth
    on Oct 28, 2015
    Contributor
    More actions

    There is all-builtins as well.

  14. Trott commented on Oct 28, 2015

    @Trott
    Trott
    on Oct 28, 2015
    Member
    More actions

    @hemanth That looks like it lists all the modules that are automatically loaded by the REPL, but not all the built-ins available in Node. It misses console, constants, module, process, repl, timers and the deprecated modules sys and freelist.

  15. hemanth commented on Oct 29, 2015

    @hemanth
    hemanth
    on Oct 29, 2015
    Contributor
    More actions

    @Trott Right, we need to work on process.binding('natives') then.

  16. 15 remaining items

  17. addaleax
    added a commit that references this issue on Nov 28, 2017

    module: add builtinModules

    1c1ef3c
  18. MylesBorins
    added 3 commits that reference this issue on Dec 12, 2017

    module: add builtinModules

    eddf7d9

    module: add builtinModules

    95778d5

    module: add builtinModules

    7ae7124
  19. apapirovski commented on Dec 12, 2017

    @apapirovski
    apapirovski
    on Dec 12, 2017
    Contributor
    More actions

    @maclover7 do you know if this issue can be closed? I believe your builtinModules PR addressed this?

  20. maclover7 commented on Dec 12, 2017

    @maclover7
    maclover7
    on Dec 12, 2017
    Contributor
    More actions

    I believe so, closing

  21. maclover7
    closed this as completedon Dec 12, 2017
  22. maclover7
    self-assigned this
    on Dec 12, 2017
  23. MylesBorins
    added a commit that references this issue on Jan 18, 2018

    module: add builtinModules

    ae9af7a
  24. MylesBorins
    added 3 commits that reference this issue on Feb 11, 2018

    module: add builtinModules

    d9f4b0f

    module: add builtinModules

    4b6f4ad

    module: add builtinModules

    cdf4a9c
  25. gibfahn
    added a commit that references this issue on Feb 19, 2018

    module: add builtinModules

    c5093fc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @maclover7
    maclover7

Labels

feature requestIssues requesting new Node.js features.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.