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

babel-plugin-normalize-requires

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-normalize-requires - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

lib/__tests__/__snapshots__/index.test.js.snap

25

lib/index.js

@@ -25,3 +25,3 @@ 'use strict';

if (typeof moduleName === 'string') {
if (typeof moduleName === 'string' && !isPackageName(moduleName)) {
if (moduleName.endsWith('.js')) {

@@ -45,2 +45,25 @@ moduleName = moduleName.substring(0, moduleName.length - 3);

};
/**
* Check whether a module name refers to a package entry point.
* @param {String} moduleName the name of a JS module
* @return {boolean} true if moduleName is a package name
*/
function isPackageName(moduleName) {
var firstSlashIndex = moduleName.indexOf('/');
if (firstSlashIndex == -1) {
return true;
}
var restOfModuleName = moduleName.substring(firstSlashIndex + 1);
if (moduleName.startsWith('@') && restOfModuleName.indexOf('/') == -1) {
return true;
}
return false;
} /**
* @return {object} a babel visitor
*/
//# sourceMappingURL=index.js.map

7

package.json
{
"name": "babel-plugin-normalize-requires",
"version": "0.5.0",
"version": "0.6.0",
"description": "A Babel plugin that rewrites require() calls to normalize them (removing extensions and trailing slashes, for example).",

@@ -8,3 +8,3 @@ "main": "lib/index.js",

"build": "babel --source-maps -D -d lib src",
"prepublish": "babel --source-maps -D -d lib src"
"prepublish": "npm run build"
},

@@ -14,6 +14,3 @@ "devDependencies": {

"babel-preset-es2015": "^6.24.1"
},
"dependencies": {
"read-json-sync": "^1.1.1"
}
}

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