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

es6-module-transpiler

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6-module-transpiler - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

27

lib/exports.js

@@ -54,2 +54,4 @@ /* jshint node:true, undef:true, unused:true */

return new FunctionExportDeclaration(this.module, node);
} else if (n.ClassDeclaration.check(node.declaration)) {
return new ClassExportDeclaration(this.module, node);
} else if (n.ExportBatchSpecifier.check(node.specifiers[0])) {

@@ -207,2 +209,27 @@ throw new Error(

*
* export class Foo {}
*
* @constructor
* @extends ExportDeclaration
* @param {Module} mod
* @param {AST.ExportDeclaration} node
*/
function ClassExportDeclaration(mod, node) {
ExportDeclaration.call(this, mod, node);
}
extend(ClassExportDeclaration, ExportDeclaration);
/**
* Gets the list of export specifiers for this declaration.
*
* @type {ExportSpecifier[]}
* @name ClassExportDeclaration#specifiers
*/
memo(ClassExportDeclaration.prototype, 'specifiers', /** @this ClassExportDeclaration */function() {
return [new ExportSpecifier(this, this.node.declaration)];
});
/**
* Represents an export declaration of the form:
*
* export function foo() {}

@@ -209,0 +236,0 @@ *

@@ -332,2 +332,10 @@ /* jshint node:true, undef:true, unused:true */

);
} else if (n.ClassDeclaration.check(node.declaration)) {
return Replacement.swaps(
// drop `export`
nodePath, node.declaration
).and(
// transform the class
this.processClassDeclaration(mod, nodePath.get('declaration'))
);
} else if (n.VariableDeclaration.check(node.declaration)) {

@@ -399,2 +407,24 @@ return Replacement.swaps(

/**
* Rename the top-level class declaration to a unique name.
*
* ```js
* class Foo {}
* ```
*
* Becomes e.g.
*
* ```js
* class mod$$Foo {}
* ```
*
* @override
*/
BundleFormatter.prototype.processClassDeclaration = function(mod, nodePath) {
return Replacement.swaps(
nodePath.get('id'),
this.reference(mod, nodePath.node.id)
);
};
/**
* Since import declarations only control how we rewrite references we can just

@@ -401,0 +431,0 @@ * remove them -- they don't turn into any actual statements.

5

package.json
{
"name": "es6-module-transpiler",
"version": "0.9.1",
"version": "0.9.2",
"description": "es6-module-transpiler is an experimental compiler that allows you to write your JavaScript using a subset of the current ES6 module syntax, and compile it into various formats.",

@@ -49,2 +49,3 @@ "homepage": "http://esnext.github.io/es6-module-transpiler",

"browserify": "^5.12.1",
"es6-class": "^0.9.1",
"example-runner": "^0.1.0",

@@ -59,2 +60,2 @@ "fake-fs": "^0.4.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