镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

process.features: deprecate it or add more properties? #25343

Closed

Description

@joyeecheung

Stem from #25291 (comment)

What I liked about process.config.variables.v8_enable_inspector is that it's also a user accessible way to detect if the inspector is enabled. Instead of moving to an internal solution it would be rad to expose this in a more user-friendly way.

Right now, there is an undocumented process.features for that purpose, but it has not been well-maintained. It's possible to detect certain features known at build time via process.config.variables but that object is mutable in the user land so it's not exactly reliable (whereas process.features have been immutable). Also it's not really a good design to have users rely on internal variable names.

Should we deprecate it in favor of a better feature detection API, or start maintain it properly?

Related: #22585 but that is more about availability of specific APIs like recursive fs.mkdir, whereas process.features have been more about higher-level feature sets.

Activity

  1. added
    discussIssues opened for discussion and feedback.
    processIssues and PRs related to the process subsystem.
    on Jan 4, 2019
  2. addaleax commented on Jan 4, 2019

    @addaleax
    Member

    but that object is mutable in the user land so it's not exactly reliable (whereas process.features have been immutable).

    Mutability is good – I’d be in favour of making process.features mutable, too – at the very least, that’s helpful for testing purposes, and accidental changes are incredibly unlikely.

    I’d be 👍 on documenting this feature, esp. since I’d assume we can’t really remove it.

  3. changed the title [-]`process.features`: deprecate it or adding more properties?[/-] [+]`process.features`: deprecate it or add more properties?[/+] on Jan 4, 2019
  4. joyeecheung commented on Jan 4, 2019

    @joyeecheung
    MemberAuthor

    @addaleax I've took another look, the current behavior and the behavior before #25239 have both been that process.features itself is not writable/configurable while the properties on it are (i.e. the object is not frozen).

  5. addaleax commented on Jan 4, 2019

    @addaleax
    Member

    @joyeecheung Okay, sorry for not double-checking myself – then I’m totally fine with documenting process.features and otherwise leaving it as it is. :)

  6. silverwind commented on Jun 14, 2019

    @silverwind
    Contributor

    This looks like a great way to ease feature detection. I think we should document and require a addition to it for every feature that can not easily be detected (like new options), ideally as part of the PR that adds the feature.

    I do believe that it should be frozen thought to be reliable.

  7. jasnell commented on Jun 26, 2020

    @jasnell
    Member

    I believe we can close this issue. process.features is not going anywhere any time soon.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussIssues opened for discussion and feedback.processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions