Skip to content

make all experimental warning messages consistent #30803

@pd4d10

Description

@pd4d10

Some experimental warning messages' contents are not consistent, for example:

(node:70168) ExperimentalWarning: The ESM module loader is experimental.
(node:70372) ExperimentalWarning: Conditional exports is an experimental feature. This feature could change at any time

Shall we make them consistent? If so I'm willing to submit a PR to solve this.

There are two general methods to emit experimental warnings. I think we can make use of them.

JavaScript version

node/lib/internal/util.js

Lines 170 to 176 in 1549c8e

function emitExperimentalWarning(feature) {
if (experimentalWarnings.has(feature)) return;
const msg = `${feature} is an experimental feature. This feature could ` +
'change at any time';
experimentalWarnings.add(feature);
process.emitWarning(msg, 'ExperimentalWarning');
}

C++ version (introduced in #30617)

Maybe<bool> ProcessEmitExperimentalWarning(Environment* env,
const char* warning) {
if (experimental_warnings.find(warning) != experimental_warnings.end())
return Nothing<bool>();
experimental_warnings.insert(warning);
std::string message(warning);
message.append(
" is an experimental feature. This feature could change at any time");
return ProcessEmitWarningGeneric(env, message.c_str(), "ExperimentalWarning");
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    experimentalIssues and PRs related to experimental features.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions