Skip to content

Commit

Permalink
[New] add new core modules that will be in node v15
Browse files Browse the repository at this point in the history
 - `dns/promises`: nodejs/node#32953
 - `assert/strict`: nodejs/node#34001
 - `stream/promises`: nodejs/node#33991
 - `timers/promises`: nodejs/node#33950
  • Loading branch information
ljharb committed Sep 28, 2020
1 parent 87c3a11 commit cdd0b35
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function specifierIncluded(specifier) {
var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.');

for (var i = 0; i < 3; ++i) {
var cur = Number(current[i] || 0);
var ver = Number(versionParts[i] || 0);
var cur = parseInt(current[i] || 0, 10);
var ver = parseInt(versionParts[i] || 0, 10);
if (cur === ver) {
continue; // eslint-disable-line no-restricted-syntax, no-continue
}
Expand Down
4 changes: 4 additions & 0 deletions lib/core.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"assert": true,
"assert/strict": ">= 15",
"async_hooks": ">= 8",
"buffer_ieee754": "< 0.9.7",
"buffer": true,
Expand All @@ -12,6 +13,7 @@
"_debugger": "< 8",
"dgram": true,
"dns": true,
"dns/promises": ">= 15",
"domain": true,
"events": true,
"freelist": "< 6",
Expand Down Expand Up @@ -49,9 +51,11 @@
"_stream_readable": ">= 0.9.4",
"_stream_writable": ">= 0.9.4",
"stream": true,
"stream/promises": ">= 15",
"string_decoder": true,
"sys": true,
"timers": true,
"timers/promises": ">= 15",
"_tls_common": ">= 0.11.13",
"_tls_legacy": ">= 0.11.3 && < 10",
"_tls_wrap": ">= 0.11.3",
Expand Down
12 changes: 4 additions & 8 deletions test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@ test('core modules', function (t) {

for (var i = 0; i < cores.length; ++i) {
var mod = cores[i];
var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func
console.log(mod, resolve.core, resolve.core[mod]);
if (resolve.core[mod]) {
st.doesNotThrow(
function () { require(mod); }, // eslint-disable-line no-loop-func
mod + ' supported; requiring does not throw'
);
st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw');
} else {
st.throws(
function () { require(mod); }, // eslint-disable-line no-loop-func
mod + ' not supported; requiring throws'
);
st.throws(requireFunc, mod + ' not supported; requiring throws');
}
}

Expand Down

0 comments on commit cdd0b35

Please sign in to comment.