fis-postprocessor-jswrapper
Advanced tools
Comparing version 0.0.4 to 0.0.5
10
index.js
@@ -11,7 +11,9 @@ /* | ||
if(conf.type === 'amd'){ | ||
// var deps = file.requires.length ? '[\'' + file.requires.join("', '") + '\']' : '[]'; | ||
// content = 'define(\'' + file.getId() + '\', ' + deps + ', function(require, exports, module){\n\n' + content + '\n\n});'; | ||
content = 'define(\'' + file.getId() + '\', function(require, exports, module){\n\n' + content + '\n\n});'; | ||
if(!/^\s*define\s*\(/.test(content)){ | ||
content = 'define(\'' + file.getId() + '\', function(require, exports, module){\n\n' + content + '\n\n});'; | ||
} | ||
} else { | ||
content = '!function(){\n\n' + content + '\n\n}();'; | ||
if(!/^\s*(?:[!(]\s*|void\s+)function\(/.test(content)){ | ||
content = '!function(){\n\n' + content + '\n\n}();'; | ||
} | ||
} | ||
@@ -18,0 +20,0 @@ } |
{ | ||
"name" : "fis-postprocessor-jswrapper", | ||
"description" : "A postprocessor plugin for fis to wrap javascript with closure or amd define.", | ||
"version" : "0.0.4", | ||
"version" : "0.0.5", | ||
"author" : "FIS Team <fis@baidu.com>", | ||
@@ -6,0 +6,0 @@ "homepage" : "http://fis.baidu.com/", |
19
2857