Comparing version 0.4.4 to 0.4.5
{ | ||
"name": "jsdc", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "compiler ecmascript6 to ecmascript5", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -529,8 +529,10 @@ Javascript Downcast | ||
``` | ||
`export default`会直接赋给`module.exports`: | ||
`export default`会赋给`exports.default`,这样在使用时会判断是否有`default`属性: | ||
```js | ||
export default a | ||
import b from "a" | ||
``` | ||
```js | ||
module.exports=a | ||
var b=function(){var _0_=require("a");return _0_.hasOwnProperty("default")?_0_.default:_0_}()}() | ||
``` | ||
@@ -537,0 +539,0 @@ |
@@ -40,6 +40,11 @@ var homunculus = require('homunculus'); | ||
} | ||
self.jsdc.append('var ' + id); | ||
var temp = self.jsdc.uid(); | ||
self.jsdc.append('var ' + id + '='); | ||
self.jsdc.append('function(){var ' + temp); | ||
self.jsdc.append('=require('); | ||
self.jsdc.append(last.last().token().content()); | ||
self.jsdc.append(');'); | ||
self.jsdc.append(');return '); | ||
self.jsdc.append(temp + '.hasOwnProperty("default")?'); | ||
self.jsdc.append(temp + '.default:' + temp); | ||
self.jsdc.append('}()'); | ||
} | ||
@@ -46,0 +51,0 @@ //import ids from "string",import {ids} from "string" |
@@ -41,6 +41,11 @@ define(function(require, exports, module) { | ||
} | ||
self.jsdc.append('var ' + id); | ||
var temp = self.jsdc.uid(); | ||
self.jsdc.append('var ' + id + '='); | ||
self.jsdc.append('function(){var ' + temp); | ||
self.jsdc.append('=require('); | ||
self.jsdc.append(last.last().token().content()); | ||
self.jsdc.append(');'); | ||
self.jsdc.append(');return '); | ||
self.jsdc.append(temp + '.hasOwnProperty("default")?'); | ||
self.jsdc.append(temp + '.default:' + temp); | ||
self.jsdc.append('}()'); | ||
} | ||
@@ -47,0 +52,0 @@ //import ids from "string",import {ids} from "string" |
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
303236
7015
809