Socket
Socket
Sign inDemoInstall

es6-module-crosspiler

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-module-crosspiler - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

26

lib/exports.js

@@ -27,3 +27,8 @@

if (node.default) {
var id = node._varname = this.sourceToVariableName('default')
var id
if (n.FunctionExpression.check(declaration) && declaration.id) {
id = node._varname = declaration.id.name
} else {
id = node._varname = this.sourceToVariableName('default')
}
exports.push([id, 'default'])

@@ -74,10 +79,15 @@ return

visitExportDeclaration: function (path) {
var declaration = path.node.declaration
if (path.node.default) {
// remove `export default`s
path.replace(b.variableDeclaration('var', [
b.variableDeclarator(
b.identifier(path.node._varname),
path.node.declaration
)
]))
if (n.FunctionExpression.check(declaration) && declaration.id) {
path.replace(b.functionDeclaration(declaration.id, declaration.params, declaration.body))
} else {
path.replace(b.variableDeclaration('var', [
b.variableDeclarator(
b.identifier(path.node._varname),
declaration
)
]))
}
} else if (path.node.specifiers) {

@@ -88,3 +98,3 @@ // remove `export { x, y }`s

// remove the `export` from `export <expression>`
path.replace(path.node.declaration)
path.replace(declaration)
}

@@ -91,0 +101,0 @@

{
"name": "es6-module-crosspiler",
"description": "An ES6 and CommonJS cross-compatible transpiler",
"version": "0.2.1",
"version": "0.2.2",
"author": {

@@ -6,0 +6,0 @@ "name": "Jonathan Ong",

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