Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
220a600
events: add captureRejection option
mcollina May 19, 2019
89bc571
stream: add support for captureRejection option
mcollina Aug 19, 2019
33a6bf3
http: implement capture rejections for 'request' event
mcollina Sep 3, 2019
334d4f6
http: add captureRejection support to OutgoingMessage
mcollina Sep 20, 2019
4eecee0
net: implement capture rejections for 'connection' event
mcollina Oct 1, 2019
5ad3efb
tls: implement capture rejections for 'secureConnection' event
mcollina Oct 1, 2019
c3ac4c8
http2: implement capture rection for 'request' and 'stream' events
mcollina Oct 2, 2019
50ab1fa
test: change common.PORT to arbitrary port
Trott Dec 1, 2019
9bd5c72
test: move test-child-process-fork-getconnections to parallel
Trott Dec 1, 2019
145f881
doc: update status of Python 3 support
mhdawson Nov 29, 2019
a0fa327
test: use block-scoping in test-net-server-address
Trott Dec 1, 2019
b51b26f
src: fix node_dir.cc memory allocation
piyukore06 Dec 1, 2019
cb69ff4
src: improve node_crypto.cc memory allocation
piyukore06 Dec 1, 2019
66db874
src: remove redundant cast in node_dir.cc
gengjiawen Dec 1, 2019
838ae10
src: delete redundant method in node_dir.h
gengjiawen Dec 1, 2019
8369562
doc: clarify text about using 'session' event for compatibility
Trott Dec 1, 2019
9428304
doc: Buffer.toString(): add note about invalid data
jgehrcke Nov 28, 2019
255cd7e
tls: expose IETF name for current cipher suite
sam-github Jun 3, 2019
71d43a5
worker: add argv constructor option
legendecas Nov 20, 2019
60b1e1a
fs: fix existsSync for invalid symlink at win32
pd4d10 Nov 22, 2019
2c0f1ed
doc: adds assert doc for strict mode with pointer to strict equality
shobhitchittora Nov 14, 2019
543bf9d
doc: fix up N-API doc
NickNaso Nov 26, 2019
510eb3a
doc: revise addons introduction for brevity and clarity
Trott Dec 2, 2019
7cb84fd
doc: remove usage of "Node" in favor of "Node.js"
Trott Dec 2, 2019
d3f0dd2
inspector: do not access queueMicrotask from global
targos Nov 30, 2019
54a266c
test: increase debugging information in subprocess test
Trott Dec 2, 2019
7b9400c
tools: update ESLint to 6.7.2
Trott Dec 2, 2019
eb4f443
esm: make specifier flag clearly experimental
MylesBorins Nov 27, 2019
55a270b
test: remove duplicate entries from root.status
richardlau Dec 2, 2019
851f313
module: add warnings for experimental flags
pd4d10 Nov 24, 2019
67823e8
doc: remove imprecise and redundant testing text
Trott Dec 2, 2019
fb31ab5
test: simplify tmpdir import in wasi tests
Trott Dec 2, 2019
30756e3
test: improve wasi test coverage
Trott Dec 2, 2019
94f237e
lib,test: improves ERR_REQUIRE_ESM message
juanarbol Nov 28, 2019
bd2f127
module: ignore resolution failures for inspect-brk
arcanis Nov 8, 2019
a7ec78f
module: fixup lint and test regressions
guybedford Dec 5, 2019
1d5c4e2
doc: add documentation about node_mksnapshot and mkcodecache
joyeecheung Dec 3, 2019
5067463
test: use callback arguments in getconnections test
Trott Dec 3, 2019
325128e
lib: delay access to CLI option to pre-execution
joyeecheung Dec 3, 2019
1baa6ab
doc: improve napi formatting
BridgeAR Nov 30, 2019
bbbba76
doc,benchmark: move benchmark guide to benchmark directory
Trott Dec 3, 2019
43e947a
build: remove (almost) unused macros/constants
Dec 1, 2019
3840abe
http2: small clean up in OnStreamRead
lundibundi Nov 10, 2019
71bb026
http2: streamline OnStreamRead streamline memory accounting
lundibundi Dec 1, 2019
c440f3f
repl: use better uncaught exceptions indicator
BridgeAR Sep 23, 2019
0cb7720
tools: update icu to 65.1
albertyw Nov 3, 2019
4588606
deps: fix OPENSSLDIR on Windows
shigeki Sep 5, 2019
2b687af
tools: update remark-preset-lint-node to 1.11.0
Trott Dec 4, 2019
ca47f72
deps: upgrade to libuv 1.34.0
cjihrig Dec 4, 2019
77ffd54
util: improve inspect's customInspect performance
BridgeAR Nov 21, 2019
608d720
util: add more predefined color codes to inspect.colors
BridgeAR Nov 25, 2019
ad4d52d
benchmark: add more util inspect and format benchmarks
BridgeAR Nov 30, 2019
eeaeb51
util: improve performance inspecting proxies
BridgeAR Nov 30, 2019
3898b23
util: never trigger any proxy traps using `format()`
BridgeAR Dec 1, 2019
1c4b2f1
assert,util: stricter type comparison using deep equal comparisons
BridgeAR Dec 2, 2019
3557659
test: run more assert tests
BridgeAR Dec 2, 2019
d4aa656
module: fix dynamic import from eval
coreyfarrell Nov 23, 2019
dc69cbe
util: add internal sleep() function
cjihrig Dec 4, 2019
a574cb0
test: remove common.busyLoop()
cjihrig Dec 4, 2019
d9d6475
lib: add warning on dynamic import es modules
juanarbol Nov 29, 2019
2c439bb
lib: add parent to ERR_UNKNOWN_FILE_EXTENSION
qualitymanifest Nov 30, 2019
1ed1a64
tools: use CC instead of CXX when pointing to gcc
Dec 6, 2019
25e3696
test: improve WASI options validation
Trott Dec 5, 2019
e6e379e
src: use checked allocations in WASI::New()
cjihrig Dec 5, 2019
8ad53ab
src: free preopen memory in WASI::New()
cjihrig Dec 5, 2019
2f1ae4f
readline: eagerly load string_decoder
BridgeAR Dec 5, 2019
4dc9d8d
test: mark addons/openssl-bindings/test flaky on arm
richardlau Dec 7, 2019
ccf0917
src: don't use deprecated OpenSSL APIs
neheb Dec 5, 2019
041daaa
src: port memory-tracking allocator from QUIC repo
addaleax Dec 1, 2019
8a9f57d
http2: use shared memory tracking implementation
addaleax Sep 21, 2019
d17ea8f
http2: track nghttp2-allocated memory in heap snapshot
addaleax Dec 1, 2019
13fe9f7
deps: update uvwasi
addaleax Dec 1, 2019
14269d1
wasi: use memory-tracking allocator
addaleax Dec 1, 2019
2123d53
doc: include line/cursor in readline documentation
Js-Brecht Nov 23, 2019
305e45a
test: mark tests as flaky
joaocgreis Dec 8, 2019
7ed867d
src: improve checked uv loop close output
addaleax Dec 5, 2019
af01417
lib: replace Symbol global by the primordials Symbol
Sebastien-Ahkrin Nov 30, 2019
97e0efe
test: scale keepalive timeouts for slow machines
bnoordhuis Dec 7, 2019
5523950
fs: add synchronous retries to rimraf
cjihrig Dec 4, 2019
7e1dee3
fs: reduce unnecessary sync rimraf retries
cjihrig Dec 8, 2019
daca078
http: llhttp opt-in insecure HTTP header parsing
sam-github Nov 20, 2019
e551c16
repl: support previews by eager evaluating input
BridgeAR Dec 5, 2019
6088603
src: fix the false isatty() issue on IBMi
dmabupt Dec 7, 2019
5ae3a85
test: refactor test-accessor-properties
himself65 Oct 13, 2019
0022d75
doc: improve doc Http2Stream: FrameError, Timeout and Trailers
dev-script Nov 12, 2019
93ca4f4
doc: deprecate http finished
ronag Jul 14, 2019
0a34fcb
lib: replace var with let/const
jens-cappelle Nov 12, 2019
8e16093
module: fix require in node repl
ZYSzys Dec 7, 2019
5e98de1
fs: only operate on buffers in rimraf
cjihrig Nov 20, 2019
18758ef
fs: retry unlink operations in rimraf
cjihrig Dec 9, 2019
cc4a6ed
test: use fs rimraf to refresh tmpdir
cjihrig Aug 20, 2019
6c07a72
fs: synchronize close with other I/O for streams
addaleax Dec 7, 2019
3d05d4b
build: ease DragonFlyBSD build
devnexen Nov 1, 2019
78eaf50
benchmark: improve `--filter` pattern matching
mmarchini Oct 15, 2019
ce21fc7
test: wait for stream close before writing to file
addaleax Dec 7, 2019
123327d
net: remove duplicate _undestroy
ronag Dec 7, 2019
1cce000
doc: add code example to inspector.url() method
juanarbol Sep 8, 2019
39898a9
lib: replace every Symbol.for by SymbolFor primordials
Sebastien-Ahkrin Dec 8, 2019
64ab5c9
lib: replace Symbol.iterator by SymbolIterator
Sebastien-Ahkrin Dec 8, 2019
9d1c793
doc: clarify Tier 2 implications in BUILDING.md
Trott Dec 9, 2019
5f42b1f
test: assert: fix deepStrictEqual comparing a real array and fake array
ljharb Dec 1, 2019
5ab3ca4
url: declare iterator inside loop
trivikr Nov 17, 2019
de36820
src: accept single argument in getProxyDetails
BridgeAR Dec 8, 2019
dfd3a4d
build: add flag to enable pointer compression
mcollina Nov 13, 2019
0379fb6
deps: update npm to 6.13.4
isaacs Dec 11, 2019
d1c4fcc
build: fix library version and compile flags on Android
gcampax Sep 24, 2017
d90815d
build: on Android, use android log library to print stack traces
gcampax Sep 24, 2017
df9df18
doc: fix argument type of setAAD
tniessen Dec 9, 2019
822fb00
http2: forward debug message in debugStreamObj
lundibundi Dec 7, 2019
eb6e32c
test: disable colorMode in test-console-group
Trott Dec 10, 2019
8bf0da6
doc: edit colorMode information
Trott Dec 10, 2019
1b534d5
test: work around ENOTEMPTY when cleaning tmp dir
bnoordhuis Dec 12, 2019
e61f4ea
module: conditional exports import condition
guybedford Dec 5, 2019
5203ffb
tools: update link to google styleguide for cpplint
danbev Dec 10, 2019
71c6d44
lib: enforce use of BigInt from primordials
targos Dec 10, 2019
b3ae532
doc: clarify build support text
Trott Dec 11, 2019
f15fe94
2019-12-17, Version 13.4.0 (Current)
MylesBorins Dec 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
module: add warnings for experimental flags
PR-URL: #30617
Fixes: #30600
Reviewed-By: Guy Bedford <guybedford@gmail.com>
  • Loading branch information
pd4d10 authored and targos committed Dec 9, 2019
commit 851f3135aba0fdbf0fc89f1ef346adf438f4c399
15 changes: 10 additions & 5 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const {
rekeySourceMap
} = require('internal/source_map/source_map_cache');
const { pathToFileURL, fileURLToPath, URL } = require('internal/url');
const { deprecate } = require('internal/util');
const { deprecate, emitExperimentalWarning } = require('internal/util');
const vm = require('vm');
const assert = require('internal/assert');
const fs = require('fs');
Expand Down Expand Up @@ -584,17 +584,21 @@ function resolveExportsTarget(pkgPath, target, subpath, basePath, mappingKey) {
if (experimentalConditionalExports &&
ObjectPrototypeHasOwnProperty(target, 'require')) {
try {
return resolveExportsTarget(pkgPath, target.require, subpath,
basePath, mappingKey);
const result = resolveExportsTarget(pkgPath, target.require, subpath,
basePath, mappingKey);
emitExperimentalWarning('Conditional exports');
return result;
} catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') throw e;
}
}
if (experimentalConditionalExports &&
ObjectPrototypeHasOwnProperty(target, 'node')) {
try {
return resolveExportsTarget(pkgPath, target.node, subpath,
basePath, mappingKey);
const result = resolveExportsTarget(pkgPath, target.node, subpath,
basePath, mappingKey);
emitExperimentalWarning('Conditional exports');
return result;
} catch (e) {
if (e.code !== 'MODULE_NOT_FOUND') throw e;
}
Expand Down Expand Up @@ -697,6 +701,7 @@ Module._findPath = function(request, paths, isMain) {

const selfFilename = trySelf(paths, exts, isMain, trailingSlash, request);
if (selfFilename) {
emitExperimentalWarning('Package name self resolution');
Module._pathCache[cacheKey] = selfFilename;
return selfFilename;
}
Expand Down
4 changes: 3 additions & 1 deletion lib/internal/modules/esm/translators.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const createDynamicModule = require(
const fs = require('fs');
const { fileURLToPath, URL } = require('url');
const { debuglog } = require('internal/util/debuglog');
const { promisify } = require('internal/util');
const { promisify, emitExperimentalWarning } = require('internal/util');
const {
ERR_INVALID_URL,
ERR_INVALID_URL_SCHEME,
Expand Down Expand Up @@ -133,6 +133,7 @@ translators.set('builtin', async function builtinStrategy(url) {

// Strategy for loading a JSON file
translators.set('json', async function jsonStrategy(url) {
emitExperimentalWarning('Importing JSON modules');
debug(`Translating JSONModule ${url}`);
debug(`Loading JSONModule ${url}`);
const pathname = url.startsWith('file:') ? fileURLToPath(url) : null;
Expand Down Expand Up @@ -187,6 +188,7 @@ translators.set('json', async function jsonStrategy(url) {

// Strategy for loading a wasm module
translators.set('wasm', async function(url) {
emitExperimentalWarning('Importing Web Assembly modules');
const buffer = await getSource(url);
debug(`Translating WASMModule ${url}`);
let compiled;
Expand Down
3 changes: 3 additions & 0 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "util-inl.h"
#include "node_contextify.h"
#include "node_watchdog.h"
#include "node_process.h"

#include <sys/stat.h> // S_IFDIR

Expand Down Expand Up @@ -962,6 +963,7 @@ Maybe<URL> ResolveExportsTarget(Environment* env,
Maybe<URL> resolved = ResolveExportsTarget(env, pjson_url,
conditionalTarget, subpath, pkg_subpath, base, false);
if (!resolved.IsNothing()) {
ProcessEmitExperimentalWarning(env, "Conditional exports");
return resolved;
}
}
Expand Down Expand Up @@ -1267,6 +1269,7 @@ Maybe<URL> PackageResolve(Environment* env,

Maybe<URL> self_url = ResolveSelf(env, specifier, base);
if (self_url.IsJust()) {
ProcessEmitExperimentalWarning(env, "Package name self resolution");
return self_url;
}

Expand Down
2 changes: 2 additions & 0 deletions src/node_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ v8::Maybe<bool> ProcessEmitWarningGeneric(Environment* env,
const char* code = nullptr);

v8::Maybe<bool> ProcessEmitWarning(Environment* env, const char* fmt, ...);
v8::Maybe<bool> ProcessEmitExperimentalWarning(Environment* env,
const char* warning);
v8::Maybe<bool> ProcessEmitDeprecationWarning(Environment* env,
const char* warning,
const char* deprecation_code);
Expand Down
16 changes: 16 additions & 0 deletions src/node_process_events.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <cstdarg>
#include <set>

#include "env-inl.h"
#include "node_process.h"
Expand Down Expand Up @@ -95,6 +96,21 @@ Maybe<bool> ProcessEmitWarning(Environment* env, const char* fmt, ...) {
return ProcessEmitWarningGeneric(env, warning);
}


std::set<std::string> experimental_warnings;

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");
}

Maybe<bool> ProcessEmitDeprecationWarning(Environment* env,
const char* warning,
const char* deprecation_code) {
Expand Down
16 changes: 16 additions & 0 deletions test/common/fixtures.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable node-core/require-common-first, node-core/required-modules */
import fixtures from './fixtures.js';

const {
fixturesDir,
path,
readSync,
readKey,
} = fixtures;

export {
fixturesDir,
path,
readSync,
readKey,
};
32 changes: 32 additions & 0 deletions test/es-module/test-esm-exports.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Flags: --experimental-modules
import { mustCall } from '../common/index.mjs';
import { path } from '../common/fixtures.mjs';
import { ok, deepStrictEqual, strictEqual } from 'assert';
import { spawn } from 'child_process';

import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs';
import fromInside from '../fixtures/node_modules/pkgexports/lib/hole.js';
Expand Down Expand Up @@ -149,3 +151,33 @@ function assertIncludes(actual, expected) {
ok(actual.toString().indexOf(expected) !== -1,
`${JSON.stringify(actual)} includes ${JSON.stringify(expected)}`);
}

// Test warning message
[
[
'--experimental-conditional-exports',
'/es-modules/conditional-exports.js',
'Conditional exports',
],
[
'--experimental-resolve-self',
'/node_modules/pkgexports/resolve-self.js',
'Package name self resolution',
],
].forEach(([flag, file, message]) => {
const child = spawn(process.execPath, [flag, path(file)]);

let stderr = '';
child.stderr.setEncoding('utf8');
child.stderr.on('data', (data) => {
stderr += data;
});
child.on('close', (code, signal) => {
strictEqual(code, 0);
strictEqual(signal, null);
ok(stderr.toString().includes(
`ExperimentalWarning: ${message} is an experimental feature. ` +
'This feature could change at any time'
));
});
});
24 changes: 23 additions & 1 deletion test/es-module/test-esm-json.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
// Flags: --experimental-json-modules
import '../common/index.mjs';
import { strictEqual } from 'assert';
import { path } from '../common/fixtures.mjs';
import { strictEqual, ok } from 'assert';
import { spawn } from 'child_process';

import secret from '../fixtures/experimental.json';

strictEqual(secret.ofLife, 42);

// Test warning message
const child = spawn(process.execPath, [
'--experimental-json-modules',
path('/es-modules/json-modules.mjs')
]);

let stderr = '';
child.stderr.setEncoding('utf8');
child.stderr.on('data', (data) => {
stderr += data;
});
child.on('close', (code, signal) => {
strictEqual(code, 0);
strictEqual(signal, null);
ok(stderr.toString().includes(
'ExperimentalWarning: Importing JSON modules is an experimental feature. ' +
'This feature could change at any time'
));
});
24 changes: 23 additions & 1 deletion test/es-module/test-esm-wasm.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Flags: --experimental-wasm-modules
import '../common/index.mjs';
import { path } from '../common/fixtures.mjs';
import { add, addImported } from '../fixtures/es-modules/simple.wasm';
import { state } from '../fixtures/es-modules/wasm-dep.mjs';
import { strictEqual } from 'assert';
import { strictEqual, ok } from 'assert';
import { spawn } from 'child_process';

strictEqual(state, 'WASM Start Executed');

Expand All @@ -13,3 +15,23 @@ strictEqual(addImported(0), 42);
strictEqual(state, 'WASM JS Function Executed');

strictEqual(addImported(1), 43);

// Test warning message
const child = spawn(process.execPath, [
'--experimental-wasm-modules',
path('/es-modules/wasm-modules.mjs')
]);

let stderr = '';
child.stderr.setEncoding('utf8');
child.stderr.on('data', (data) => {
stderr += data;
});
child.on('close', (code, signal) => {
strictEqual(code, 0);
strictEqual(signal, null);
ok(stderr.toString().includes(
'ExperimentalWarning: Importing Web Assembly modules is ' +
'an experimental feature. This feature could change at any time'
));
});
1 change: 1 addition & 0 deletions test/fixtures/es-modules/conditional-exports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('pkgexports/condition')
1 change: 1 addition & 0 deletions test/fixtures/es-modules/json-modules.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import secret from '../experimental.json';
2 changes: 2 additions & 0 deletions test/fixtures/es-modules/wasm-modules.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { add, addImported } from './simple.wasm';
import { state } from './wasm-dep.mjs';
1 change: 1 addition & 0 deletions test/fixtures/node_modules/pkgexports/resolve-self.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.