jtaro-module
Advanced tools
+1
-1
| { | ||
| "name": "jtaro-module", | ||
| "version": "0.2.6", | ||
| "version": "0.2.7", | ||
| "description": "Explain the ES6 module to Es5 syntax", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+9
-4
@@ -1,2 +0,2 @@ | ||
| /*! JTaro-Module parse.js v0.2.6 ~ (c) 2017 Author:BarZu Git:https://github.com/chjtx/JTaro-Module/ */ | ||
| /*! JTaro-Module parse.js v0.2.7 ~ (c) 2017 Author:BarZu Git:https://github.com/chjtx/JTaro-Module/ */ | ||
| /** | ||
@@ -149,3 +149,3 @@ * JTaro Module | ||
| function removeImport (a, f, h) { // (imports, file, header) | ||
| function nodeImport (a, f, h) { // (imports, file, header) | ||
| var t | ||
@@ -264,4 +264,4 @@ for (var i = 0, l = a.length; i < l; i++) { | ||
| header = mixHeader(loaders, name) | ||
| // 去掉已转换的import | ||
| file = removeImport(imports, file, header) + '\n})' | ||
| // 注释已转换的import | ||
| file = nodeImport(imports, file, header) + '\n})' | ||
| } | ||
@@ -273,2 +273,7 @@ | ||
| if (exports) { | ||
| // 只有export没有import也需要使用闭包 | ||
| if (!imports) { | ||
| file = '!function(){' + file + '\n}()' | ||
| } | ||
| exportMaps = getExportMaps(exports, name) | ||
@@ -275,0 +280,0 @@ exportMaps.forEach((item, index) => { |
624
0.65%31817
-2.82%