mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
f074612b74
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: https://github.com/nodejs/node/pull/20403 Reviewed-By: Bradley Farias <bradley.meck@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>
15 lines
382 B
JavaScript
15 lines
382 B
JavaScript
// Flags: --experimental-modules
|
|
import '../common';
|
|
import * as fs from 'fs';
|
|
import assert from 'assert';
|
|
import Module from 'module';
|
|
|
|
const keys = Object.entries(
|
|
Object.getOwnPropertyDescriptors(new Module().require('fs')))
|
|
.filter(([name, d]) => d.enumerable)
|
|
.map(([name]) => name)
|
|
.concat('default')
|
|
.sort();
|
|
|
|
assert.deepStrictEqual(Object.keys(fs).sort(), keys);
|