New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esm: provide named exports for builtin libs #20403

Closed
wants to merge 1 commit into
base: master
from

Conversation

@devsnek
Member

devsnek commented Apr 29, 2018

provide named exports for all builtin libraries so that the libraries may be
imported in a nicer way for esm users: import { readFile } from 'fs'
instead of importing the entire namespace, import fs from 'fs', and
calling fs.readFile. the default export is left as the entire
namespace (module.exports)

continuation of #18131 because it got too long and github was giving unicorns

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@devsnek devsnek requested review from bmeck, jkrems and guybedford Apr 29, 2018

@devsnek

This comment has been minimized.

Member

devsnek commented Apr 29, 2018

@guybedford i'm not quite sure what the setter-based approach looks like (do we iterate through the exports and re-assign every property to have get/set instead of value?) how do we prevent common ways that userland monkeypatches while keeping property values updated (defineProperty) how do we make sure that deleted properties become representative in esm land

@@ -1,10 +1,11 @@
import _url from 'url';
import { URL } from 'url';

This comment has been minimized.

@addaleax

addaleax Apr 29, 2018

Member

Side note: This is global now, so we could just remove this line and/or split this change into a separate PR.

This comment has been minimized.

@devsnek

devsnek Apr 29, 2018

Member

i left it in just in case these changes get backported to other release lines

@guybedford

This comment has been minimized.

Contributor

guybedford commented Apr 29, 2018

@devsnek yes exactly. There may well be issues with backwards compatibility for configuration/reflection or it may not provide such a performance benefit, but I think it's worth running the experiment.

@guybedford

This comment has been minimized.

Contributor

guybedford commented Apr 29, 2018

I just had a look through some common core-instrumenting packages (newrelic, old graceful-fs) and they both do a direct member expression assignment. I think we may well be ok with setter-only.

@devsnek

This comment has been minimized.

Member

devsnek commented Apr 29, 2018

@guybedford it is worth noting that the added time is from the iterating and creation and such at startup, not from actually calling those traps. i'm can't think of how you will build hundreds of getter/setters in less time while still having the majority of the same code for enumerable filtering and such

@guybedford

This comment has been minimized.

Contributor

guybedford commented Apr 29, 2018

@devsnek 10% startup time cost is a huge regression on its own. But I'm specifically referring to how turning core modules into proxies affects existing hot code like for (let i = 0; i < 1000) crypto.createHash('sha256').update('asdf').digest('hex').

@jdalton

This comment has been minimized.

Member

jdalton commented Apr 29, 2018

@guybedford The perf run mentioned was done on an incomplete implementation. None of the methods in your hot code example are wrapped (createHash, update, digest) so are unaffected.

Perf is important (duh), and at this stage it's good to keep an eye on for sure. There's plenty of perf work to be done on ES modules in Node in general (and that work will come). Since this is experimental things should be allowed to progress and take shape. Any performance concerns you have about specific JS constructions should be filed for V8 to tackle (there's plenty of runway to improve whatever needs improving).

You too could experiment with your own implementation without obstructing. If a better implementation shakes out down the road then so be it.

// bar.js
import foo from './foo.js';
foo.one === 1; // true

This comment has been minimized.

@vsemozhetbyt

vsemozhetbyt Apr 29, 2018

Member

Ignorable nit: as this is a file, not a REPL, maybe add assert() or console.log() here?

```js
import { readFile } from 'fs';
readFile('./foo.txt', (err, body) => {

This comment has been minimized.

@vsemozhetbyt

vsemozhetbyt Apr 29, 2018

Member

Nit: it seems a bit unexpected to name file content body (no body in fs doc), it seems more natural for http(s) docs. However, I can miss some conventions)

This comment has been minimized.

@devsnek

devsnek Apr 29, 2018

Member

does src/source work?

This comment has been minimized.

@vsemozhetbyt

vsemozhetbyt Apr 29, 2018

Member

Yes, it seems more neutral to me.

@devsnek

This comment has been minimized.

@guybedford

I've done an initial review here - looking through this more closely it is looking really great actually!

Agreed a setter approach would incur a lot of property definitions that might slow us down more anyway.

@jdalton points taken that we can improve perf here over time. I ran some initial subsets of the benchmarks against this code and haven't yet spotted any issues, but it's worth keeping an eye on the hot paths here.

@devsnek I would really appreciate it if you can help me understand the wrap magic to more properly review. I'll also aim to stare at it again this week if I get a moment. I must admit the layered proxy situation also doesn't seem ideal from a perf perspective, so would be nice to be able to follow the driving use cases to see where hot paths might be carved out from that further.

const nativeRegExp = new RegExp(`^${re}$`);
isNative = (fn) => {
if (typeof fn === 'function' &&
nativeRegExp.test(toString.call(fn))) {

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

This is quite tricky to follow, and if there are changes in v8 perhaps tricky to maintain.

Surely toString.call(fn).endsWith('{ [native code ] }') would give just as strong a guarantee?

This comment has been minimized.

@devsnek

devsnek Apr 29, 2018

Member

if there are changes in v8 perhaps tricky to maintain.

just the opposite (ignoring that Function.prototype.toString is standardised now) different engines or different versions of the same engine may represent native functions differently

This comment has been minimized.

@jdalton

jdalton Apr 30, 2018

Member

@guybedford For a reference implementation see this and this. The idea is to use a builtin native method as a template for detection of others. @devsnek has a todo to implement a v8 helper for this too.

This comment has been minimized.

@guybedford

guybedford Apr 30, 2018

Contributor

Sure, perhaps a comment would help maintenance though - it's pretty tough to follow.

This comment has been minimized.

@jdalton

jdalton Apr 30, 2018

Member

I'm a fan of comments for sure 📖

if (typeof fn === 'function' &&
nativeRegExp.test(toString.call(fn))) {
const { name } = fn;
if (typeof name !== 'string' || !/^bound /.test(name))

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

name.startsWith('bound ').

This comment has been minimized.

@devsnek

devsnek Apr 29, 2018

Member

any particular reason? regex is still faster at this time

This comment has been minimized.

@jdalton

jdalton Apr 29, 2018

Member

👆 It's micro-opt territory here so it's up to personal preference is all.

This comment has been minimized.

@guybedford

guybedford Apr 30, 2018

Contributor

Interesting, I didn't realise that had changed in v8. Just paying attention to the getter hot path here.

This comment has been minimized.

@jdalton

jdalton Apr 30, 2018

Member

Keep in mind this a few steps/checks into the native check so many values will have already exited with false by then. This check is also performed once per changed value (so not per repeated get request).

This comment has been minimized.

@guybedford

guybedford Apr 30, 2018

Contributor

This very much does seem on the hot path to me? get -> wrap -> isNative is on every get in the proxy, so this path seems like it will hit every access to bound functions on exports?

This comment has been minimized.

@jdalton

jdalton Apr 30, 2018

Member

This startsWith check is done after the first few check so will only apply to the first access of bound functions and native functions. I don't think there's a need to get hung up on micro-optimizations at this point. If you find the need later then sure we can tweak various ways to detect xyz.

this.exportKeys = Object.keys(this.exports);
const update = (property, value) => {
if (this.reflect !== undefined && this.exportKeys.includes(property))

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

property in this.reflect.exports might be a nicer check here.

This comment has been minimized.

@ljharb

ljharb Apr 29, 2018

is reflect.exports a null object?

This comment has been minimized.

@guybedford

guybedford Apr 30, 2018

Contributor

hasOwnProperty could work too, just nice to avoid linear lookup if we can.

This comment has been minimized.

@ljharb

ljharb Apr 30, 2018

exportKeys could be made a Set as well

if (typeof value === 'function')
value = methodUnwrapMap.get(value) || value;
if (ReflectSet(target, prop, value, receiver)) {
update(prop, ReflectGet(target, prop, receiver));

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

When the receiver is not equal to the target, surely we don't want to be running the update method?

For example, if someone does Object.create(module.exports).asdf = 'asdf', we don't want to be updating the ES module object.

This comment has been minimized.

@devsnek

devsnek Apr 29, 2018

Member

not quite sure i understand this one, but i do know that Object.create(module.exports).asdf = 'asdf' doesn't change anything on module.exports

This comment has been minimized.

@guybedford

guybedford Apr 30, 2018

Contributor

Exactly, so it shouldn't call the update function, whereas right now it does I believe.

This comment has been minimized.

@jdalton

jdalton Apr 30, 2018

Member

@guybedford

Exactly, so it shouldn't call the update function, whereas right now it does I believe.

I cannot reproduce your concern.

import { isArray } from 'util'
> Object.create(util).isArray  = 'asdf'
'asdf'
> isArray
[Function: isArray]
> util.isArray
[Function: isArray]

This comment has been minimized.

@bmeck

bmeck May 1, 2018

Member

Standard set will create a new "own" property on the receiver if it isn't the same as the target and won't update the target normally. Easiest example of this is with Object.prototype not being updated in :

x={}; // has Object.prototype ; ~= Object.create(Object.prototype)
x.toString = null;
assert.notEqual(x.toString, Object.prototype.toString);

This seems to be a slight bug.

This comment has been minimized.

@jdalton

jdalton May 2, 2018

Member

@bmeck

Looks like userland can do some stuff since we allow defineProperty trapping that exhibits these behaviors,

In your example above you have removed the own property of fs when you assigned it fs.readFile=null because in the setter it performed delete fs.readFile. So when you logged both fs.readFile values they had a fs.hasOwnProperty("readFile") of false and are logging the Object.prototype.readFile value. The deleteProperty trap should have updated the ns values to be undefined though, so I should check that out.

In my own implementation I get the expected results:

fs 123 from namespace undefined
fs 456 from namespace undefined

This comment has been minimized.

@jdalton

jdalton May 2, 2018

Member

@bmeck

In my local tests for the worstTargetEver things are looking alright.

  1. we need to add a test to ensure we don't get value since that is an own property on the receiver so we can prevent regressions.

This looks good

import { foo, bar } from "worstTargetEver"
import w from "worstTargetEver"

w.foo = 3
foo // undefined
w.foo // undefined
bar // 3
w.bar // 3
  1. right now it could update to Object.prototype.foo since there isn't a descriptor anymore but we still do a non-guarded Get after the Set. I didn't see any existing things in core that would be problematic.

The worstTargetEver example did not result in a value getting assigned to Object.prototype.foo

 Reflect.has(Object.prototype, "foo") // false

This could be because this line of worstTargetEver...

 Object.defineProperty(this, 'foo', {value}) // not on target, need to ensure it isn't picked up

...the this, while not the target, is the proxy, so it's ok.

  1. this somewhat shows a problem if setters are defining other properties that might need to be updated.

The example above works as expected, to me at least.

I'll work with @devsnek to add tests and ensure the PR results align with my local.

This comment has been minimized.

@TimothyGu

TimothyGu May 2, 2018

Member

@bmeck I had the same concern at the beginning, but because of the limited scope of this PR (only applies to core modules) I didn't think we have to be that watertight, because we don't really have those weird setters/getters.

This comment has been minimized.

@bmeck

bmeck May 2, 2018

Member

@jdalton which example? we have multiple in this thread.

@TimothyGu since userland is able to create those situations by mutating core I think we still need to at least document how things work. I don't find the synchronization mismatch intuitive, but am not trying to stop this PR as long as it is well understood.

This comment has been minimized.

@jdalton

jdalton May 2, 2018

Member

@bmeck @TimothyGu As mentioned above (here and here) there should be no synchronization mismatch or unexpected gotchas once I get a chance to update this PR (I'll add tests too).

const methodWrapMap = new WeakMap();
const methodUnwrapMap = new WeakMap();
const wrap = (target, name, value) => {

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

Can you provide a few examples for what this is mitigating? Would help a lot to follow this, and a comment would likely help as well.

This comment has been minimized.

@jdalton

jdalton Apr 30, 2018

Member

👆 There should be unit tests for it (or added if not) but the gist of the issue is that native methods (so not plain or bound ones) may be picky about their this binding and need wrapping for general use when separated from their object.

process.cwd.call(new Proxy(process, {}))
// TypeError: Illegal invocation

We should totally file a v8 bug on this though since this doesn't affect NodeChakra.
Once fixed the workaround isn't needed.

Update: V8 bug here.

This comment has been minimized.

@guybedford

guybedford Apr 30, 2018

Contributor

Amazing, that helps a lot to know! If it seems like it may well be removed by the time this is unflagged, then we really don't need to worry about the perf on this path for now.

Could be worth noting the justification and v8 issue in a comment.

This comment has been minimized.

@jdalton

jdalton Apr 30, 2018

Member

I'm 👍 on adding comments. I'll add moar to my implementation too.

Update:

Once the V8 bug is fixed in addition to dropping the proxy wrapper for native methods we can also conditionally exclude the get trap on the module.exports proxy for exports that are functions or those we expect to be [object Object] (so likely all builtin modules). Since then, the only thing the get trap will be used for is correcting toStringTag values.

typeof value !== 'string') {
const toStringTag = ObjectToString.call(target).slice(8, -1);
return toStringTag === 'Object' ? value : toStringTag;
}

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

Very nice!

const toStringTag = ObjectToString.call(target).slice(8, -1);
return toStringTag === 'Object' ? value : toStringTag;
}
return wrap(target, prop, value);

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

Perhaps do the function check here so we don't need to go into the wrap function unnecessarily as this is our hot path.

return descriptor;
},
get: (target, prop, receiver) => {
const value = ReflectGet(target, prop, receiver);

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

I wonder which is faster - target[prop] or ReflectGet(target, prop)? Worth thinking of this one from a perf perspective.

This comment has been minimized.

@devsnek

devsnek Apr 29, 2018

Member

doesn't matter, because i have to pass the receiver through

This comment has been minimized.

@guybedford

guybedford Apr 30, 2018

Contributor

Again, I'm not sure we want to support prototypal getters here? Could they not be a shortpath:

get (target, prop, receiver) {
  if (target !== receiver)
    return ReflectGet(target, prop, receiver);
  // ... target receiver case
}

This comment has been minimized.

@jdalton

jdalton Apr 30, 2018

Member

The get trap here is just to detect a native method that needs wrapping and handle the toString proxy juggle. There is no other editorial bits going on here.

}
return wrap(target, prop, value);
},
__proto__: null,

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

While it's good to be safe, I'm not sure this is a necessary protection here?

This comment has been minimized.

@jdalton

jdalton Apr 30, 2018

Member

👆 It's a precaution since trap handlers, like descriptors, will read inherited traps/descriptors as well as own.
Does Node have a convention established for this?

This comment has been minimized.

@bmeck

bmeck May 1, 2018

Member

places needing to avoid Object.prototype use Object.create in the existing codebase but loader has some usage of __proto__ in literals. No linting or style guide rules exist for Node to my knowledge on this topic.

// slice 'node:' scheme
const id = url.slice(5);
NativeModule.require(id);
const module = NativeModule.getCached(id);

This comment has been minimized.

@guybedford

guybedford Apr 29, 2018

Contributor

const module = NativeModule.require(id) should work here and avoid a double lookup :)

This comment has been minimized.

@devsnek

devsnek Apr 29, 2018

Member

getCached returns the entire module object, require just gives the exports object

This comment has been minimized.

@guybedford

guybedford Apr 30, 2018

Contributor

Ah right, I see, we can reconsider the interface if necessary then for future work.

@devsnek

This comment has been minimized.

Member

devsnek commented Apr 30, 2018

interesting thought i should have had a while ago... i should be able to ignore this entire path for all the internal modules right? (conditionally on --expose-internals)

@jdalton

This comment has been minimized.

Member

jdalton commented Apr 30, 2018

interesting thought i should have had a while ago... i should be able to ignore this entire path for all the internal modules right? (conditionally on --expose-internals)

Yep. I didn't even know --expose-internals was a thing.

@devsnek

This comment has been minimized.

Member

devsnek commented Apr 30, 2018

that should really improve that degraded startup time 😅

@devsnek

This comment has been minimized.

if (typeof value === 'function')
value = methodUnwrapMap.get(value) || value;
if (ReflectSet(target, prop, value, receiver)) {
update(prop, ReflectGet(target, prop, receiver));

This comment has been minimized.

@bmeck

bmeck May 1, 2018

Member

Standard set will create a new "own" property on the receiver if it isn't the same as the target and won't update the target normally. Easiest example of this is with Object.prototype not being updated in :

x={}; // has Object.prototype ; ~= Object.create(Object.prototype)
x.toString = null;
assert.notEqual(x.toString, Object.prototype.toString);

This seems to be a slight bug.

update(prop, ReflectGet(target, prop));
return true;
}
return false;

This comment has been minimized.

@bmeck

bmeck May 1, 2018

Member

this line gets hit when you do:

import events from 'events';
Object.defineProperty(events, 'defaultMaxListeners', {value: 333})

/*
TypeError: 'defineProperty' on proxy: trap returned falsish for property 'defaultMaxListeners'
    at Function.defineProperty (<anonymous>)
    at file:///Users/bfarias/Documents/node/t.mjs:2:8
    at ModuleJob.run (internal/modules/esm/module_job.js:106:14)
*/

But it should probably report this as an error for redefining like it does right now:

> Object.defineProperty(events, 'defaultMaxListeners', {value: 333})
TypeError: Cannot redefine property: defaultMaxListeners
    at Function.defineProperty (<anonymous>)

This comment has been minimized.

@jdalton

jdalton May 1, 2018

Member

@devsnek @bmeck
By changing the defineProperty trap from

if (ReflectDefineProperty(target, prop, descriptor)) {
  update(prop, ReflectGet(target, prop));
  return true;
}
return false;

to

ObjectDefineProperty(target, prop, descriptor);
update(prop, ReflectGet(target, prop));
return true;

we get the expected error:

TypeError: Cannot redefine property: defaultMaxListeners
    at Function.defineProperty (<anonymous>)
@@ -193,6 +206,12 @@
'\n});'
];
const getOwn = (target, property, receiver) => {
return ObjectHasOwnProperty.call(target, property) ?

This comment has been minimized.

@TimothyGu

TimothyGu May 9, 2018

Member

Use Reflect.apply instead.

if (threw) {
throw error;
}

This comment has been minimized.

@TimothyGu

TimothyGu May 9, 2018

Member

Use finally block instead. Just curious, why is it necessary to reset the property even in case of thrown exception?

This comment has been minimized.

@jdalton

jdalton May 9, 2018

Member

I wasn't sure how the runner operates. If it loads tests and runs them in sequence in a shared process then even if there are failed tests augmented environments could effect other tests if not properly reset/cleaned.

This comment has been minimized.

@TimothyGu

TimothyGu May 9, 2018

Member

@jdalton Each test is in a separate process. The Python test runner spawns node processes in parallel.

This comment has been minimized.

@jdalton

jdalton May 9, 2018

Member

Nice!

@guybedford

This has cleaned up really nicely! Will be great to see it moving forward. Note I see we're getting the fs promises warnings when loading fs now.

@jdalton

This comment has been minimized.

Member

jdalton commented May 9, 2018

This has cleaned up really nicely! Will be great to see it moving forward. Note I see we're getting the fs promises warnings when loading fs now.

Thanks! Yap, I mentioned that to Gus this morning. That will be resolved by #20632.

@jdalton

This comment has been minimized.

Member

jdalton commented May 10, 2018

@bmeck regarding your x on the PR. We've added tests for the inherited receiver case. For the worstTargetEver case, since this is feature is gated to builtin modules, I added the test to my implementation (here and here) to ensure there isn't an issue either (we share the same approach).

},
});
assert.strictEqual(events.defaultMaxListeners, originDefaultMaxListeners);

This comment has been minimized.

@bmeck

bmeck May 10, 2018

Member

these should add imported live binding tests.

Reflect.defineProperty(fs, 'readFile', {
get() { return fn; },
set() {},

This comment has been minimized.

@bmeck

bmeck May 10, 2018

Member

is this needed / we don't test set() in this file

Builtin modules will provide named exports of their public API, as well as a
default export which can be used for, among other things, modifying the named
exports.

This comment has been minimized.

@bmeck

bmeck May 10, 2018

Member

we should make a note about getter/setters being defined in place of named exports on builtins as potentially leading to unexpected behavior since the sync is only done on get/set operations on the builtin module:

import fs, {readFile} from 'fs';
import assert from 'assert';
let i = 10;
Object.defineProperty(fs, 'readFile', {
  get() { return i; }
});
i++;
const a = readFile;
const b = fs.readFile;
const c = readFile;
assert.equal(a, b);
assert.equal(b, c);

I'd be reluctant to document the actual behavior here, just want to document that this is considered and edge case of behavior.

This comment has been minimized.

@jdalton

jdalton May 10, 2018

Member

Yep that's a good idea. Maybe just documenting when syncs are done (define/delete/set) and that anything done outside of those won't be captured. To me the above get() { return i; } example makes sense, but I have the context of knowing the traps used to simulate live bindings.

This comment has been minimized.

@bmeck

bmeck May 10, 2018

Member

we could trap on get as well, but we don't for now. I would find it more intuitive if we trapped on get but have no objections to how it behaves.

This comment has been minimized.

@jdalton

jdalton May 10, 2018

Member

but have no objections to how it behaves.

Cool! Keep in mind trapping on get wouldn't help the first assert since accessing readFile doesn't trigger a get trap of fs.readFile so a would still be 10 and b would be 11.

This comment has been minimized.

@bmeck

bmeck May 10, 2018

Member

yup, we cannot have perfect sync, just interesting that fs.readFile = fs.readFile updates but fs.readFile doesn't.

This comment has been minimized.

@jdalton

jdalton May 10, 2018

Member

yup, we cannot have perfect sync, just interesting that fs.readFile = fs.readFile updates but fs.readFile doesn't.

I'll add the trap.

Update:

Added :)

@bmeck

impl looks fine, needs a doc callout; otherwise, nits

@bmeck

This comment has been minimized.

Member

bmeck commented May 10, 2018

@jdalton ran though tests etc. and looks fine to land if a doc callout (1-2 sentences is plenty) exists to warn people off relying on edge casey behavior.

@jkrems

jkrems approved these changes May 10, 2018

shisama added a commit to shisama/node that referenced this pull request May 13, 2018

esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.

PR-URL: nodejs#20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>

@addaleax addaleax referenced this pull request May 14, 2018

Merged

v10.2.0 proposal #20724

addaleax added a commit that referenced this pull request May 15, 2018

2018-05-15, Version 10.2.0 (Current), @???
Notable Changes:

* **addons**:
  - Fixed a memory leak for users of `AsyncResource` and N-API. (Michael Dawson) [#20668](#20668)
* **assert**:
  - The `error` parameter of `assert.throws()` can be an object containing regular expressions now. (Ruben Bridgewater) [#20485](#20485)
* **crypto**:
  - The `authTagLength` option has been made more flexible. (Tobias Nießen) [#20235](#20235), [#20039](#20039)
* **http**:
  - Handling of `close` and `aborted` events has been made more consistent. (Robert Nagy) [#20075](#20075), [#20611](#20611)
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with Node.js-specific behaviour have been added to the API. (helloshuangzi) [#20639](#20639)
  - Node.js `Environment`s clean up resources before exiting now. (Anna Henningsen) [#19377](#19377)
  - Support for multi-threaded embedding has been improved. (Anna Henningsen) [#20542](#20542), [#20539](#20539), [#20541](#20541)
* **esm**:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules. (Gus Caplan) [#20403](#20403)
* **timers**:
  - `timeout.refresh()` has been added to the public API. (Jeremiah Senkpiel) [#20298](#20298)

PR-URL: #20724

addaleax added a commit that referenced this pull request May 15, 2018

2018-05-15, Version 10.2.0 (Current), @???
Notable Changes:

* **addons**:
  - Fixed a memory leak for users of `AsyncResource` and N-API. (Michael Dawson) [#20668](#20668)
* **assert**:
  - The `error` parameter of `assert.throws()` can be an object containing regular expressions now. (Ruben Bridgewater) [#20485](#20485)
* **crypto**:
  - The `authTagLength` option has been made more flexible. (Tobias Nießen) [#20235](#20235), [#20039](#20039)
* **http**:
  - Handling of `close` and `aborted` events has been made more consistent. (Robert Nagy) [#20075](#20075), [#20611](#20611)
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with Node.js-specific behaviour have been added to the API. (Allen Yonghuang Wang) [#20639](#20639)
  - Node.js `Environment`s clean up resources before exiting now. (Anna Henningsen) [#19377](#19377)
  - Support for multi-threaded embedding has been improved. (Anna Henningsen) [#20542](#20542), [#20539](#20539), [#20541](#20541)
* **esm**:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules. (Gus Caplan) [#20403](#20403)
* **timers**:
  - `timeout.refresh()` has been added to the public API. (Jeremiah Senkpiel) [#20298](#20298)

PR-URL: #20724

addaleax added a commit that referenced this pull request May 15, 2018

2018-05-15, Version 10.2.0 (Current), @???
Notable Changes:

* **addons**:
  - Fixed a memory leak for users of `AsyncResource` and N-API. (Michael Dawson) [#20668](#20668)
* **assert**:
  - The `error` parameter of `assert.throws()` can be an object containing regular expressions now. (Ruben Bridgewater) [#20485](#20485)
* **crypto**:
  - The `authTagLength` option has been made more flexible. (Tobias Nießen) [#20235](#20235), [#20039](#20039)
* **http**:
  - Handling of `close` and `aborted` events has been made more consistent. (Robert Nagy) [#20075](#20075), [#20611](#20611)
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with Node.js-specific behaviour have been added to the API. (Allen Yonghuang Wang) [#20639](#20639)
  - Node.js `Environment`s clean up resources before exiting now. (Anna Henningsen) [#19377](#19377)
  - Support for multi-threaded embedding has been improved. (Anna Henningsen) [#20542](#20542), [#20539](#20539), [#20541](#20541)
* **esm**:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules. (Gus Caplan) [#20403](#20403)
* **timers**:
  - `timeout.refresh()` has been added to the public API. (Jeremiah Senkpiel) [#20298](#20298)

PR-URL: #20724

MylesBorins added a commit that referenced this pull request May 22, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    #20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    #20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    #20235)
    #20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    #20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    #20075
    #20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    #19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    #20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    #20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    #19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    #20542
    #20539
    #20541

PR-URL: #20724

MylesBorins added a commit that referenced this pull request May 23, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    #20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    #20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    #20235)
    #20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    #20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    #20075
    #20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    #19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    #20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    #20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    #19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    #20542
    #20539
    #20541

PR-URL: #20724

MylesBorins added a commit that referenced this pull request May 23, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    #20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    #20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    #20235)
    #20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    #20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    #20075
    #20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    #19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    #20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    #20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    #19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    #20542
    #20539
    #20541

PR-URL: #20724

MylesBorins added a commit that referenced this pull request May 23, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    #20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    #20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    #20235)
    #20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    #20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    #20075
    #20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    #19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    #20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    #20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    #19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    #20542
    #20539
    #20541

PR-URL: #20724

@chrisveness chrisveness referenced this pull request May 25, 2018

Merged

fs: move fs/promises to fs.promises #20504

4 of 4 tasks complete

shisama added a commit to shisama/node that referenced this pull request May 30, 2018

esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.

PR-URL: nodejs#20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>

shisama added a commit to shisama/node that referenced this pull request May 30, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    nodejs#20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    nodejs#20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    nodejs#20235)
    nodejs#20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    nodejs#20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    nodejs#20075
    nodejs#20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    nodejs#19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    nodejs#20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    nodejs#20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    nodejs#19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    nodejs#20542
    nodejs#20539
    nodejs#20541

PR-URL: nodejs#20724

shisama added a commit to shisama/node that referenced this pull request May 30, 2018

esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.

PR-URL: nodejs#20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>

shisama added a commit to shisama/node that referenced this pull request May 30, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    nodejs#20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    nodejs#20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    nodejs#20235)
    nodejs#20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    nodejs#20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    nodejs#20075
    nodejs#20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    nodejs#19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    nodejs#20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    nodejs#20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    nodejs#19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    nodejs#20542
    nodejs#20539
    nodejs#20541

PR-URL: nodejs#20724

shisama added a commit to shisama/node that referenced this pull request Jun 5, 2018

esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.

PR-URL: nodejs#20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>

shisama added a commit to shisama/node that referenced this pull request Jun 5, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    nodejs#20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    nodejs#20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    nodejs#20235)
    nodejs#20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    nodejs#20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    nodejs#20075
    nodejs#20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    nodejs#19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    nodejs#20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    nodejs#20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    nodejs#19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    nodejs#20542
    nodejs#20539
    nodejs#20541

PR-URL: nodejs#20724

shisama added a commit to shisama/node that referenced this pull request Jun 9, 2018

esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.

PR-URL: nodejs#20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>

shisama added a commit to shisama/node that referenced this pull request Jun 9, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    nodejs#20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    nodejs#20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    nodejs#20235)
    nodejs#20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    nodejs#20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    nodejs#20075
    nodejs#20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    nodejs#19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    nodejs#20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    nodejs#20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    nodejs#19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    nodejs#20542
    nodejs#20539
    nodejs#20541

PR-URL: nodejs#20724

shisama added a commit to shisama/node that referenced this pull request Jun 11, 2018

esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.

PR-URL: nodejs#20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>

shisama added a commit to shisama/node that referenced this pull request Jun 11, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    nodejs#20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    nodejs#20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    nodejs#20235)
    nodejs#20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    nodejs#20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    nodejs#20075
    nodejs#20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    nodejs#19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    nodejs#20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    nodejs#20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    nodejs#19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    nodejs#20542
    nodejs#20539
    nodejs#20541

PR-URL: nodejs#20724

shisama added a commit to shisama/node that referenced this pull request Jun 12, 2018

esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.

PR-URL: nodejs#20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>

shisama added a commit to shisama/node that referenced this pull request Jun 12, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    nodejs#20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    nodejs#20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    nodejs#20235)
    nodejs#20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    nodejs#20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    nodejs#20075
    nodejs#20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    nodejs#19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    nodejs#20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    nodejs#20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    nodejs#19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    nodejs#20542
    nodejs#20539
    nodejs#20541

PR-URL: nodejs#20724

shisama added a commit to shisama/node that referenced this pull request Jun 17, 2018

esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.

PR-URL: nodejs#20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>

shisama added a commit to shisama/node that referenced this pull request Jun 17, 2018

2018-05-23, Version 10.2.0 (Current)
* addons:
  - Fixed a memory leak for users of `AsyncResource` and N-API.
    (Michael Dawson)
    nodejs#20668
* assert:
  - The `error` parameter of `assert.throws()` can be an object containing
    regular expressions now. (Ruben Bridgewater)
    nodejs#20485
* crypto:
  - The `authTagLength` option has been made more flexible (Tobias Nießen)
    nodejs#20235)
    nodejs#20039
* esm:
  - Builtin modules (e.g. `fs`) now provide named exports in ES6 modules.
    (Gus Caplan)
    nodejs#20403
* http:
  - Handling of `close` and `aborted` events has been made more consistent.
    (Robert Nagy)
    nodejs#20075
    nodejs#20611
* module:
  - add --preserve-symlinks-main (David Goldstein)
    nodejs#19911
* timers:
  - `timeout.refresh()` has been added to the public API.
    (Jeremiah Senkpiel)
    nodejs#20298
* Embedder support:
  - Functions for creating V8 `Isolate` and `Context` objects with
    Node.js-specific behaviour have been added to the API.
    (Allen Yonghuang Wang)
    nodejs#20639
  - Node.js `Environment`s clean up resources before exiting now.
    (Anna Henningsen)
    nodejs#19377
  - Support for multi-threaded embedding has been improved.
    (Anna Henningsen)
    nodejs#20542
    nodejs#20539
    nodejs#20541

PR-URL: nodejs#20724
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment