Skip to content

Commit

Permalink
deps: is-core-module@2.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed May 11, 2022
1 parent c0806ba commit cc7be6b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 46 deletions.
1 change: 1 addition & 0 deletions node_modules/is-core-module/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"node:string_decoder": [">= 14.18 && < 15", ">= 16"],
"sys": [">= 0.4 && < 0.7", ">= 0.8"],
"node:sys": [">= 14.18 && < 15", ">= 16"],
"node:test": ">= 18",
"timers": true,
"node:timers": [">= 14.18 && < 15", ">= 16"],
"timers/promises": ">= 15",
Expand Down
20 changes: 8 additions & 12 deletions node_modules/is-core-module/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
{
"name": "is-core-module",
"version": "2.8.1",
"version": "2.9.0",
"description": "Is this specifier a node.js core module?",
"main": "index.js",
"sideEffects": false,
"exports": {
".": [
{
"default": "./index.js"
},
"./index.js"
],
".": "./index.js",
"./package.json": "./package.json"
},
"scripts": {
Expand Down Expand Up @@ -49,14 +44,15 @@
"has": "^1.0.3"
},
"devDependencies": {
"@ljharb/eslint-config": "^20.1.0",
"aud": "^1.1.5",
"auto-changelog": "^2.3.0",
"eslint": "^8.6.0",
"@ljharb/eslint-config": "^21.0.0",
"aud": "^2.0.0",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"mock-property": "^1.0.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"semver": "^6.3.0",
"tape": "^5.4.0"
"tape": "^5.5.3"
},
"auto-changelog": {
"output": "CHANGELOG.md",
Expand Down
65 changes: 34 additions & 31 deletions node_modules/is-core-module/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
var test = require('tape');
var keys = require('object-keys');
var semver = require('semver');
var mockProperty = require('mock-property');

var isCore = require('../');
var data = require('../core.json');

Expand Down Expand Up @@ -51,16 +53,18 @@ test('core modules', function (t) {
function () { require(mod); }, // eslint-disable-line no-loop-func
'requiring ' + mod + ' does not throw'
);
if (supportsNodePrefix) {
st.doesNotThrow(
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
'requiring node:' + mod + ' does not throw'
);
} else {
st['throws'](
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
'requiring node:' + mod + ' throws'
);
if (mod.slice(0, 5) !== 'node:') {
if (supportsNodePrefix) {
st.doesNotThrow(
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
'requiring node:' + mod + ' does not throw'
);
} else {
st['throws'](
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
'requiring node:' + mod + ' throws'
);
}
}
}
}
Expand All @@ -79,6 +83,10 @@ test('core modules', function (t) {
'v8/tools/tickprocessor',
'v8/tools/profile'
];
// see https://github.com/nodejs/node/issues/42785
if (semver.satisfies(process.version, '>= 18')) {
libs = libs.concat('node:test');
}
for (var i = 0; i < libs.length; ++i) {
var mod = libs[i];
if (excludeList.indexOf(mod) === -1) {
Expand All @@ -87,16 +95,18 @@ test('core modules', function (t) {
function () { require(mod); }, // eslint-disable-line no-loop-func
'requiring ' + mod + ' does not throw'
);
if (supportsNodePrefix) {
st.doesNotThrow(
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
'requiring node:' + mod + ' does not throw'
);
} else {
st['throws'](
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
'requiring node:' + mod + ' throws'
);
if (mod.slice(0, 5) !== 'node:') {
if (supportsNodePrefix) {
st.doesNotThrow(
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
'requiring node:' + mod + ' does not throw'
);
} else {
st['throws'](
function () { require('node:' + mod); }, // eslint-disable-line no-loop-func
'requiring node:' + mod + ' throws'
);
}
}
}
}
Expand All @@ -105,18 +115,11 @@ test('core modules', function (t) {
});

t.test('Object.prototype pollution', function (st) {
/* eslint no-extend-native: 1 */
var nonKey = 'not a core module';
st.teardown(function () {
delete Object.prototype.fs;
delete Object.prototype.path;
delete Object.prototype.http;
delete Object.prototype[nonKey];
});
Object.prototype.fs = false;
Object.prototype.path = '>= 999999999';
Object.prototype.http = data.http;
Object.prototype[nonKey] = true;
st.teardown(mockProperty(Object.prototype, 'fs', { value: false }));
st.teardown(mockProperty(Object.prototype, 'path', { value: '>= 999999999' }));
st.teardown(mockProperty(Object.prototype, 'http', { value: data.http }));
st.teardown(mockProperty(Object.prototype, nonKey, { value: true }));

st.equal(isCore('fs'), true, 'fs is a core module even if Object.prototype lies');
st.equal(isCore('path'), true, 'path is a core module even if Object.prototype lies');
Expand Down
9 changes: 6 additions & 3 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -3848,9 +3848,10 @@
}
},
"node_modules/is-core-module": {
"version": "2.8.1",
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
"integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
"inBundle": true,
"license": "MIT",
"dependencies": {
"has": "^1.0.3"
},
Expand Down Expand Up @@ -12662,7 +12663,9 @@
}
},
"is-core-module": {
"version": "2.8.1",
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz",
"integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==",
"requires": {
"has": "^1.0.3"
}
Expand Down

0 comments on commit cc7be6b

Please sign in to comment.