Socket
Socket
Sign inDemoInstall

rollup-plugin-inject

Package Overview
Dependencies
Maintainers
3
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-inject - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

4

CHANGELOG.md
# rollup-plugin-inject
## 2.1.0
* Update all dependencies ([#15](https://github.com/rollup/rollup-plugin-inject/pull/15))
## 2.0.0

@@ -4,0 +8,0 @@

24

dist/rollup-plugin-inject.cjs.js

@@ -11,20 +11,4 @@ 'use strict';

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( ' ' );
var builtins = '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( ' ' );
var blacklisted = Object.create( null );
reservedWords.concat( builtins ).forEach( function (word) { return blacklisted[ word ] = true; } );
function makeLegalIdentifier ( str ) {
str = str
.replace( /-(\w)/g, function ( _, letter ) { return letter.toUpperCase(); } )
.replace( /[^$_a-zA-Z0-9]/g, '_' );
if ( /\d/.test( str[0] ) || blacklisted[ str ] ) { str = "_" + str; }
return str;
}
function escape ( str ) {
return str.replace( /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&' );
return str.replace( /[-[\]/{}()*+?.\\^$|]/g, '\\$&' );
}

@@ -87,2 +71,4 @@

} catch ( err ) {
// TODO this should use rollup's official mechanism for plugin warnings (i.e. "this.warn" on the plugin context)
// eslint-disable-next-line no-console
console.warn( ("rollup-plugin-inject: failed to parse " + id + ". Consider restricting the plugin to particular files via options.include") );

@@ -159,3 +145,3 @@ }

var importLocalName = name === keypath ? name : makeLegalIdentifier( ("$inject_" + keypath) );
var importLocalName = name === keypath ? name : rollupPluginutils.makeLegalIdentifier( ("$inject_" + keypath) );

@@ -171,3 +157,3 @@ if ( !newImports[ hash ] ) {

if ( name !== keypath ) {
magicString.overwrite( node.start, node.end, importLocalName, true );
magicString.overwrite( node.start, node.end, importLocalName, { storeName: true } );
}

@@ -174,0 +160,0 @@

@@ -1,2 +0,2 @@

import { attachScopes, createFilter } from 'rollup-pluginutils';
import { attachScopes, createFilter, makeLegalIdentifier } from 'rollup-pluginutils';
import { sep } from 'path';

@@ -7,20 +7,4 @@ import { walk } from 'estree-walker';

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( ' ' );
var builtins = '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( ' ' );
var blacklisted = Object.create( null );
reservedWords.concat( builtins ).forEach( function (word) { return blacklisted[ word ] = true; } );
function makeLegalIdentifier ( str ) {
str = str
.replace( /-(\w)/g, function ( _, letter ) { return letter.toUpperCase(); } )
.replace( /[^$_a-zA-Z0-9]/g, '_' );
if ( /\d/.test( str[0] ) || blacklisted[ str ] ) { str = "_" + str; }
return str;
}
function escape ( str ) {
return str.replace( /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&' );
return str.replace( /[-[\]/{}()*+?.\\^$|]/g, '\\$&' );
}

@@ -83,2 +67,4 @@

} catch ( err ) {
// TODO this should use rollup's official mechanism for plugin warnings (i.e. "this.warn" on the plugin context)
// eslint-disable-next-line no-console
console.warn( ("rollup-plugin-inject: failed to parse " + id + ". Consider restricting the plugin to particular files via options.include") );

@@ -166,3 +152,3 @@ }

if ( name !== keypath ) {
magicString.overwrite( node.start, node.end, importLocalName, true );
magicString.overwrite( node.start, node.end, importLocalName, { storeName: true } );
}

@@ -169,0 +155,0 @@

{
"name": "rollup-plugin-inject",
"description": "Scan modules for global variables and inject `import` statements where necessary",
"version": "2.0.0",
"version": "2.1.0",
"devDependencies": {
"eslint": "^3.5.0",
"mocha": "^3.0.2",
"rollup": "^0.36.0",
"rollup-plugin-buble": "^0.14.0"
"eslint": "^5.2.0",
"mocha": "^5.2.0",
"rollup": "^0.63.4",
"rollup-plugin-buble": "^0.19.2"
},

@@ -14,7 +14,9 @@ "main": "dist/rollup-plugin-inject.cjs.js",

"scripts": {
"pretest": "npm run build",
"test": "mocha",
"pretest": "npm run build",
"build": "rollup -c -f cjs -o dist/rollup-plugin-inject.cjs.js && rollup -c -f es6 -o dist/rollup-plugin-inject.es6.js",
"prebuild": "rm -rf dist/*",
"prepublish": "npm test"
"prebuild": "shx rm -rf dist",
"build": "rollup -c",
"prepublishOnly": "npm run lint && npm run test",
"prepare": "npm run build",
"lint": "eslint --fix src test/test.js"
},

@@ -27,6 +29,7 @@ "files": [

"dependencies": {
"acorn": "^4.0.3",
"estree-walker": "^0.2.0",
"magic-string": "^0.16.0",
"rollup-pluginutils": "^1.2.0"
"acorn": "^5.1.2",
"estree-walker": "^0.5.0",
"magic-string": "^0.25.0",
"rollup-pluginutils": "^2.0.1",
"shx": "^0.3.2"
},

@@ -33,0 +36,0 @@ "repository": {

@@ -1,10 +0,11 @@

import { attachScopes, createFilter } from 'rollup-pluginutils';
import { attachScopes, createFilter, makeLegalIdentifier } from 'rollup-pluginutils';
import { sep } from 'path';
import { walk } from 'estree-walker';
// TODO this should be using the "this.parse" function on rollup's plugin context instead
import { parse } from 'acorn';
import makeLegalIdentifier from './makeLegalIdentifier';
import MagicString from 'magic-string';
function escape ( str ) {
return str.replace( /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&' );
return str.replace( /[-[\]/{}()*+?.\\^$|]/g, '\\$&' );
}

@@ -67,2 +68,4 @@

} catch ( err ) {
// TODO this should use rollup's official mechanism for plugin warnings (i.e. "this.warn" on the plugin context)
// eslint-disable-next-line no-console
console.warn( `rollup-plugin-inject: failed to parse ${id}. Consider restricting the plugin to particular files via options.include` );

@@ -150,3 +153,3 @@ }

if ( name !== keypath ) {
magicString.overwrite( node.start, node.end, importLocalName, true );
magicString.overwrite( node.start, node.end, importLocalName, { storeName: true } );
}

@@ -153,0 +156,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