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

rewrite-imports

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rewrite-imports - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

12

dist/rewrite.js
'use strict';
var UNNAMED = /import\s*['"]([^'"]+)['"];?/gi;
var NAMED = /import\s*(\*\s*as)?\s*(\w*?)\s*,?\s*(?:\{([\s\S]*?)\})?\s*from\s*['"]([^'"]+)['"];?/gi;
var UNNAMED = /(^|;|\s+)import\s*['"]([^'"]+)['"](?=($|;|\s))/gi;
var NAMED = /(^|[;\s]+)?import\s*(\*\s*as)?\s*(\w*?)\s*,?\s*(?:\{([\s\S]*?)\})?\s*from\s*['"]([^'"]+)['"];?/gi;

@@ -21,8 +21,6 @@ function destruct(keys, target) {

return str
.replace(NAMED, function (x, asterisk, base, req, dep) {
return generate(req ? req.split(',') : [], dep, base, fn);
})
.replace(UNNAMED, function (x, dep) {
return (fn + "('" + dep + "');");
.replace(UNNAMED, "$1" + fn + "('$2')")
.replace(NAMED, function (x, y, z, base, req, dep) {
return (y || '') + generate(req ? req.split(',') : [], dep, base, fn);
});
}

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e["rewrite-imports"]=t()}(this,function(){"use strict";var e=/import\s*['"]([^'"]+)['"];?/gi,t=/import\s*(\*\s*as)?\s*(\w*?)\s*,?\s*(?:\{([\s\S]*?)\})?\s*from\s*['"]([^'"]+)['"];?/gi;function n(e,t){for(var n=[];e.length;)n.push(e.shift().trim().replace(/ as /g,":"));return"const { "+n.join(", ")+" } = "+t+";"}return function(r,i){return i=i||"require",r.replace(t,function(e,t,r,o,s){return function(e,t,r,i){return t=i+"('"+t+"')",e.length&&!r?n(e,t):"const "+r+" = "+t+";"+(e.length?"\n"+n(e,r):"")}(o?o.split(","):[],s,r,i)}).replace(e,function(e,t){return i+"('"+t+"');"})}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e["rewrite-imports"]=t()}(this,function(){"use strict";var e=/(^|;|\s+)import\s*['"]([^'"]+)['"](?=($|;|\s))/gi,t=/(^|[;\s]+)?import\s*(\*\s*as)?\s*(\w*?)\s*,?\s*(?:\{([\s\S]*?)\})?\s*from\s*['"]([^'"]+)['"];?/gi;function n(e,t){for(var n=[];e.length;)n.push(e.shift().trim().replace(/ as /g,":"));return"const { "+n.join(", ")+" } = "+t+";"}return function(r,s){return s=s||"require",r.replace(e,"$1"+s+"('$2')").replace(t,function(e,t,r,i,o,u){return(t||"")+function(e,t,r,s){return t=s+"('"+t+"')",e.length&&!r?n(e,t):"const "+r+" = "+t+";"+(e.length?"\n"+n(e,r):"")}(o?o.split(","):[],u,i,s)})}});
{
"name": "rewrite-imports",
"version": "2.0.2",
"version": "2.0.3",
"repository": "lukeed/rewrite-imports",

@@ -5,0 +5,0 @@ "description": "Rewrite `import` statements as `require()`s; via RegExp",

Sorry, the diff of this file is not supported yet

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