Comparing version 0.4.3 to 0.4.4
{ | ||
"name": "jsdc", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "compiler ecmascript6 to ecmascript5", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -1,4 +0,5 @@ | ||
# Javascript Downcast | ||
Javascript Downcast | ||
==== | ||
### compiler ecmascript6 to ecmascript5 | ||
compiler ecmascript6 to ecmascript5 | ||
@@ -5,0 +6,0 @@ [![NPM version](https://badge.fury.io/js/jsdc.png)](https://npmjs.org/package/jsdc) |
@@ -31,2 +31,17 @@ var homunculus = require('homunculus'); | ||
} | ||
//import id from "string" | ||
else if(one.name() == JsNode.IMPORTCAULSE | ||
&& one.size() == 1 | ||
&& one.first().name() == JsNode.TOKEN) { | ||
var id = one.first().token().content(); | ||
var last = node.last(); | ||
if(last.name() != JsNode.FROMCAULSE) { | ||
last = last.prev(); | ||
} | ||
self.jsdc.append('var ' + id); | ||
self.jsdc.append('=require('); | ||
self.jsdc.append(last.last().token().content()); | ||
self.jsdc.append(');'); | ||
} | ||
//import ids from "string",import {ids} from "string" | ||
else { | ||
@@ -72,3 +87,3 @@ var ids = getIds(one); | ||
else if(s == 'default') { | ||
this.jsdc.append('module.exports='); | ||
this.jsdc.append('exports.default='); | ||
this.jsdc.ignore(node.leaf(0), 'module4'); | ||
@@ -75,0 +90,0 @@ this.jsdc.ignore(node.leaf(1), 'module5'); |
@@ -32,2 +32,17 @@ define(function(require, exports, module) { | ||
} | ||
//import id from "string" | ||
else if(one.name() == JsNode.IMPORTCAULSE | ||
&& one.size() == 1 | ||
&& one.first().name() == JsNode.TOKEN) { | ||
var id = one.first().token().content(); | ||
var last = node.last(); | ||
if(last.name() != JsNode.FROMCAULSE) { | ||
last = last.prev(); | ||
} | ||
self.jsdc.append('var ' + id); | ||
self.jsdc.append('=require('); | ||
self.jsdc.append(last.last().token().content()); | ||
self.jsdc.append(');'); | ||
} | ||
//import ids from "string",import {ids} from "string" | ||
else { | ||
@@ -73,3 +88,3 @@ var ids = getIds(one); | ||
else if(s == 'default') { | ||
this.jsdc.append('module.exports='); | ||
this.jsdc.append('exports.default='); | ||
this.jsdc.ignore(node.leaf(0), 'module4'); | ||
@@ -76,0 +91,0 @@ this.jsdc.ignore(node.leaf(1), 'module5'); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302039
7005
807