Socket
Socket
Sign inDemoInstall

rollup-plugin-node-resolve

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-node-resolve - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

37

dist/rollup-plugin-node-resolve.cjs.js

@@ -20,2 +20,30 @@ 'use strict';

var readFileCache = {};
var readFileAsync = function (file) { return new Promise(function (fulfil, reject) { return fs.readFile(file, function (err, contents) { return err ? reject(err) : fulfil(contents); }); }); };
var statAsync = function (file) { return new Promise(function (fulfil, reject) { return fs.stat(file, function (err, contents) { return err ? reject(err) : fulfil(contents); }); }); };
function cachedReadFile (file, cb) {
if (file in readFileCache === false) {
readFileCache[file] = readFileAsync(file).catch(function (err) {
delete readFileCache[file];
throw err;
});
}
readFileCache[file].then(function (contents) { return cb(null, contents); }, cb);
}
var isFileCache = {};
function cachedIsFile (file, cb) {
if (file in isFileCache === false) {
isFileCache[file] = statAsync(file)
.then(
function (stat) { return stat.isFile(); },
function (err) {
if (err.code == 'ENOENT') { return false; }
delete isFileCache[file];
throw err;
});
}
isFileCache[file].then(function (contents) { return cb(null, contents); }, cb);
}
function nodeResolve ( options ) {

@@ -52,2 +80,7 @@ if ( options === void 0 ) options = {};

onwrite: function onwrite () {
isFileCache = {};
readFileCache = {};
},
resolveId: function resolveId$1 ( importee, importer ) {

@@ -107,3 +140,3 @@ if ( /\0/.test( importee ) ) { return null; } // ignore IDs with null character, these belong to other plugins

}
if (options.browser && typeof pkg[ 'browser' ] === 'string') {

@@ -120,2 +153,4 @@ pkg[ 'main' ] = pkg[ 'browser' ];

},
readFile: cachedReadFile,
isFile: cachedIsFile,
extensions: options.extensions

@@ -122,0 +157,0 @@ };

@@ -16,2 +16,30 @@ import { dirname, resolve, extname, normalize, sep } from 'path';

var readFileCache = {};
var readFileAsync = function (file) { return new Promise(function (fulfil, reject) { return fs.readFile(file, function (err, contents) { return err ? reject(err) : fulfil(contents); }); }); };
var statAsync = function (file) { return new Promise(function (fulfil, reject) { return fs.stat(file, function (err, contents) { return err ? reject(err) : fulfil(contents); }); }); };
function cachedReadFile (file, cb) {
if (file in readFileCache === false) {
readFileCache[file] = readFileAsync(file).catch(function (err) {
delete readFileCache[file];
throw err;
});
}
readFileCache[file].then(function (contents) { return cb(null, contents); }, cb);
}
var isFileCache = {};
function cachedIsFile (file, cb) {
if (file in isFileCache === false) {
isFileCache[file] = statAsync(file)
.then(
function (stat) { return stat.isFile(); },
function (err) {
if (err.code == 'ENOENT') { return false; }
delete isFileCache[file];
throw err;
});
}
isFileCache[file].then(function (contents) { return cb(null, contents); }, cb);
}
function nodeResolve ( options ) {

@@ -48,2 +76,7 @@ if ( options === void 0 ) options = {};

onwrite: function onwrite () {
isFileCache = {};
readFileCache = {};
},
resolveId: function resolveId$1 ( importee, importer ) {

@@ -103,3 +136,3 @@ if ( /\0/.test( importee ) ) { return null; } // ignore IDs with null character, these belong to other plugins

}
if (options.browser && typeof pkg[ 'browser' ] === 'string') {

@@ -116,2 +149,4 @@ pkg[ 'main' ] = pkg[ 'browser' ];

},
readFile: cachedReadFile,
isFile: cachedIsFile,
extensions: options.extensions

@@ -118,0 +153,0 @@ };

2

package.json
{
"name": "rollup-plugin-node-resolve",
"description": "Bundle third-party dependencies in node_modules",
"version": "3.1.0",
"version": "3.2.0",
"devDependencies": {

@@ -6,0 +6,0 @@ "buble": "^0.19.3",

@@ -11,2 +11,30 @@ import { dirname, resolve, extname, normalize, sep } from 'path';

let readFileCache = {};
const readFileAsync = file => new Promise((fulfil, reject) => fs.readFile(file, (err, contents) => err ? reject(err) : fulfil(contents)));
const statAsync = file => new Promise((fulfil, reject) => fs.stat(file, (err, contents) => err ? reject(err) : fulfil(contents)));
function cachedReadFile (file, cb) {
if (file in readFileCache === false) {
readFileCache[file] = readFileAsync(file).catch(err => {
delete readFileCache[file];
throw err;
});
}
readFileCache[file].then(contents => cb(null, contents), cb);
}
let isFileCache = {};
function cachedIsFile (file, cb) {
if (file in isFileCache === false) {
isFileCache[file] = statAsync(file)
.then(
stat => stat.isFile(),
err => {
if (err.code == 'ENOENT') return false;
delete isFileCache[file];
throw err;
});
}
isFileCache[file].then(contents => cb(null, contents), cb);
}
export default function nodeResolve ( options = {} ) {

@@ -41,2 +69,7 @@ const useModule = options.module !== false;

onwrite () {
isFileCache = {};
readFileCache = {};
},
resolveId ( importee, importer ) {

@@ -96,3 +129,3 @@ if ( /\0/.test( importee ) ) return null; // ignore IDs with null character, these belong to other plugins

}
if (options.browser && typeof pkg[ 'browser' ] === 'string') {

@@ -109,2 +142,4 @@ pkg[ 'main' ] = pkg[ 'browser' ];

},
readFile: cachedReadFile,
isFile: cachedIsFile,
extensions: options.extensions

@@ -111,0 +146,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc