Skip to content

node:process: populate process.config variables and target_defaults #2596

Description

@andrewtdiz

Summary

Node exposes process.config as a populated build-time configuration object with variables and target_defaults fields. Perry origin/main currently synthesizes only the broad object shape with empty sub-objects, which is enough for typeof process.config === 'object' but not enough for packages that inspect Node build variables.

Node docs: https://nodejs.org/api/process.html#processconfig

Node behavior

Local Node probe with node v25.9.0:

config type object object object
variable keys sample debug_node,host_arch,icu_gyp_path,icu_small,icu_ver_major,node_builtin_shareable_builtins,node_byteorder,node_cctest_sources,node_debug_lib,node_enable_d8,node_enable_v8_vtunejit,node_enable_v8windbg,node_fipsinstall,node_install_corepack,node_install_npm,node_library_files,node_module_version,node_no_browser_globals,node_prefix,node_release_urlbase
target keys cflags,conditions,configurations,default_configuration,defines,include_dirs,libraries
node_shared_openssl true
target_arch arm64

Probe script:

console.log('config type', typeof process.config, typeof process.config.variables, typeof process.config.target_defaults);
console.log(
  'variable keys sample',
  Object.keys(process.config.variables).filter(k => /arch|openssl|node|v8|uv|icu/.test(k)).sort().slice(0, 20).join(','),
);
console.log('target keys', Object.keys(process.config.target_defaults).sort().join(','));
console.log('node_shared_openssl', process.config.variables.node_shared_openssl);
console.log('target_arch', process.config.variables.target_arch);

Perry evidence

Source review against origin/main:

  • crates/perry-hir/src/lower/expr_member.rs handles process.config by returning:
Expr::Object(vec![
    ("variables".to_string(), Expr::Object(Vec::new())),
    ("target_defaults".to_string(), Expr::Object(Vec::new())),
])
  • The nearby source comment says this intentionally returns the shape with empty sub-objects for feature detection.
  • docs/runtime-parity.md marks process.config as covered.
  • test-files/test_parity_process.ts only checks typeof process.config and skips Object.keys(process.config) because the older undefined shape crashed.
  • test-parity/node-suite/process/config/config.ts expects variables and target_defaults objects but does not assert meaningful key/value coverage.

Duplicate check

Searched existing issues and PRs for:

  • process.config variables target_defaults

The only match was merged PR #1484 / closed #1379, which implemented the broad object shape after process.config was undefined. This issue is a follow-up for populated Node-compatible metadata values, not for the existence of process.config itself.

Expected compatibility

  • process.config.variables exposes representative Node-compatible build variables used by ecosystem feature detection, such as target_arch, host_arch, node_module_version, node_shared_openssl, and relevant v8 / uv / icu flags.
  • process.config.target_defaults exposes the standard object shape with keys such as cflags, default_configuration, defines, include_dirs, and libraries.
  • Values can be Perry-specific where Node internals do not apply, but missing keys should be deliberate and documented.
  • Parity tests should assert representative keys and value types, not only typeof.

Scope / non-goals

  • This does not require pretending Perry is a full Node binary or matching every host-specific Node build flag byte-for-byte.
  • It should provide stable, truthful, package-compatible metadata for common feature detection and native-addon tooling checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions