Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rollup-pluginutils

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-pluginutils - npm Package Compare versions

Comparing version 1.5.2 to 2.0.0

dist/pluginutils.es.js

5

CHANGELOG.md
# rollup-pluginutils changelog
## 2.0.0
* Use `micromatch` instead of `minimatch` ([#19](https://github.com/rollup/rollup-pluginutils/issues/19))
* Allow `createFilter` to take regexes ([#5](https://github.com/rollup/rollup-pluginutils/issues/5))
## 1.5.2

@@ -4,0 +9,0 @@

61

dist/pluginutils.cjs.js

@@ -5,13 +5,15 @@ 'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var estreeWalker = require('estree-walker');
var path = require('path');
var minimatch = require('minimatch');
var mm = _interopDefault(require('micromatch'));
function basename ( path ) {
return path.split( /(\/|\\)/ ).pop();
function basename ( path$$1 ) {
return path$$1.split( /(\/|\\)/ ).pop();
}
function extname ( path ) {
var match = /\.[^\.]+$/.exec( basename( path ) );
if ( !match ) return '';
function extname ( path$$1 ) {
var match = /\.[^\.]+$/.exec( basename( path$$1 ) );
if ( !match ) { return ''; }
return match[0];

@@ -23,3 +25,3 @@ }

if ( !extname( filename ) ) filename += ext;
if ( !extname( filename ) ) { filename += ext; }
return filename;

@@ -46,3 +48,3 @@ }

param.elements.forEach( function (element) {
if ( element ) extractors[ element.type ]( names, element );
if ( element ) { extractors[ element.type ]( names, element ); }
});

@@ -172,3 +174,3 @@ },

leave: function leave ( node ) {
if ( node[ propertyName ] ) scope = scope.parent;
if ( node[ propertyName ] ) { scope = scope.parent; }
}

@@ -181,4 +183,4 @@ });

function ensureArray ( thing ) {
if ( Array.isArray( thing ) ) return thing;
if ( thing == undefined ) return [];
if ( Array.isArray( thing ) ) { return thing; }
if ( thing == undefined ) { return []; }
return [ thing ];

@@ -188,24 +190,31 @@ }

function createFilter ( include, exclude ) {
include = ensureArray( include ).map( function (id) { return path.resolve( id ); } ).map( function (id) { return new minimatch.Minimatch(id); } );
exclude = ensureArray( exclude ).map( function (id) { return path.resolve( id ); } ).map( function (id) { return new minimatch.Minimatch(id); } );
var getMatcher = function (id) { return ( isRegexp( id ) ? id : { test: mm.matcher( path.resolve( id ) ) } ); };
include = ensureArray( include ).map( getMatcher );
exclude = ensureArray( exclude ).map( getMatcher );
return function ( id ) {
if ( typeof id !== 'string' ) return false;
if ( /\0/.test( id ) ) return false;
var included = !include.length;
id = id.split(path.sep).join('/');
if ( typeof id !== 'string' ) { return false; }
if ( /\0/.test( id ) ) { return false; }
include.forEach( function (minimatch) {
if ( minimatch.match( id ) ) included = true;
});
id = id.split( path.sep ).join( '/' );
exclude.forEach( function (minimatch) {
if ( minimatch.match( id ) ) included = false;
});
for ( var i = 0; i < exclude.length; ++i ) {
var matcher = exclude[i];
if ( matcher.test( id ) ) { return false; }
}
return included;
for ( var i$1 = 0; i$1 < include.length; ++i$1 ) {
var matcher$1 = include[i$1];
if ( matcher$1.test( id ) ) { return true; }
}
return !include.length;
};
}
function isRegexp ( val ) {
return val instanceof RegExp;
}
var reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'.split( ' ' );

@@ -222,3 +231,3 @@ var builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'.split( ' ' );

if ( /\d/.test( str[0] ) || blacklisted[ str ] ) str = "_" + str;
if ( /\d/.test( str[0] ) || blacklisted[ str ] ) { str = "_" + str; }

@@ -231,2 +240,2 @@ return str;

exports.createFilter = createFilter;
exports.makeLegalIdentifier = makeLegalIdentifier;
exports.makeLegalIdentifier = makeLegalIdentifier;
{
"name": "rollup-pluginutils",
"description": "Functionality commonly needed by Rollup plugins",
"version": "1.5.2",
"version": "2.0.0",
"main": "dist/pluginutils.cjs.js",
"jsnext:main": "dist/pluginutils.es6.js",
"module": "dist/pluginutils.es.js",
"jsnext:main": "dist/pluginutils.es.js",
"files": [
"src",
"dist",
"README.md"
],
"devDependencies": {
"eslint": "^2.13.1",
"mocha": "^2.5.3",
"rollup": "^0.33.0",
"rollup-plugin-buble": "^0.12.1"
"eslint": "^3.12.2",
"mocha": "^3.2.0",
"rollup": "^0.40.0",
"rollup-plugin-buble": "^0.15.0"
},
"scripts": {
"test": "mocha",
"build": "rollup -c -f cjs -o dist/pluginutils.cjs.js && rollup -c -f es6 -o dist/pluginutils.es6.js",
"build": "rollup -c",
"pretest": "npm run build",

@@ -20,14 +26,6 @@ "prepublish": "npm test"

"dependencies": {
"estree-walker": "^0.2.1",
"minimatch": "^3.0.2"
"estree-walker": "^0.3.0",
"micromatch": "^2.3.11"
},
"files": [
"src",
"dist",
"README.md"
],
"repository": {
"type": "git",
"url": "git+https://github.com/rollup/rollup-pluginutils.git"
},
"repository": "rollup/rollup-pluginutils",
"keywords": [

@@ -34,0 +32,0 @@ "rollup",

import { resolve, sep } from 'path';
import { Minimatch } from 'minimatch';
import mm from 'micromatch';
import ensureArray from './utils/ensureArray';
export default function createFilter ( include, exclude ) {
include = ensureArray( include ).map( id => resolve( id ) ).map( id => new Minimatch(id) );
exclude = ensureArray( exclude ).map( id => resolve( id ) ).map( id => new Minimatch(id) );
const getMatcher = id => ( isRegexp( id ) ? id : { test: mm.matcher( resolve( id ) ) } );
include = ensureArray( include ).map( getMatcher );
exclude = ensureArray( exclude ).map( getMatcher );
return function ( id ) {
if ( typeof id !== 'string' ) return false;
if ( /\0/.test( id ) ) return false;
let included = !include.length;
id = id.split(sep).join('/');
id = id.split( sep ).join( '/' );
include.forEach( minimatch => {
if ( minimatch.match( id ) ) included = true;
});
for ( let i = 0; i < exclude.length; ++i ) {
const matcher = exclude[i];
if ( matcher.test( id ) ) return false;
}
exclude.forEach( minimatch => {
if ( minimatch.match( id ) ) included = false;
});
for ( let i = 0; i < include.length; ++i ) {
const matcher = include[i];
if ( matcher.test( id ) ) return true;
}
return included;
return !include.length;
};
}
function isRegexp ( val ) {
return val instanceof RegExp;
}
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