Socket
Socket
Sign inDemoInstall

insert-module-globals

Package Overview
Dependencies
Maintainers
40
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

insert-module-globals - npm Package Compare versions

Comparing version 7.2.0 to 7.2.1

CHANGELOG.md

13

index.js

@@ -157,6 +157,9 @@ var undeclaredIdentifiers = require('undeclared-identifiers');

var wrappedSource;
// we double-wrap the source in IIFEs to prevent code like
// (function(Buffer){ const Buffer = null }())
// which causes a parse error.
var wrappedSource = '(function (){\n' + src + '\n}).call(this)';
if (keys.length <= 3) {
wrappedSource = '(function (' + keys.join(',') + '){\n'
+ src + '\n}).call(this,' + values.join(',') + ')'
wrappedSource = '(function (' + keys.join(',') + '){'
+ wrappedSource + '}).call(this,' + values.join(',') + ')'
;

@@ -173,4 +176,4 @@ }

);
wrappedSource = '(function (' + names.join(',') + '){\n'
+ src + '\n}).call(this,' + values.join(',') + ')';
wrappedSource = '(function (' + names.join(',') + '){'
+ wrappedSource + '}).call(this,' + values.join(',') + ')';
}

@@ -177,0 +180,0 @@

{
"name": "insert-module-globals",
"version": "7.2.0",
"version": "7.2.1",
"description": "insert implicit module globals into a module-deps stream",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -104,2 +104,30 @@ var test = require('tape')

test('inserted names do not cause const name collisions', function (t) {
t.plan(1);
var s = mdeps({
modules: {
buffer: require.resolve('buffer/'),
timers: require.resolve('timers-browserify')
}
});
s.on('error', t.fail);
s.pipe(bpack({ raw: true })).pipe(concat(function (src) {
var c = {
t: t,
Buffer: 'sandbox Buffer'
};
vm.runInNewContext(src, c);
}));
s.write({
transform: inserter({
always: true,
vars: {
Buffer: function() { return '"sandbox Buffer"' }
}
}),
global: true
});
s.end(__dirname + '/always/collision.js');
});
function inserter (opts) {

@@ -106,0 +134,0 @@ return function (file) {

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