Comparing version 1.0.15 to 1.0.16
@@ -0,1 +1,7 @@ | ||
## 2013.10.29, Version 1.0.16(Stable) | ||
### bugfix | ||
- combo增加参数fixModuleName,默认为false,@issue 31 | ||
## 2013.09.23, Version 1.0.15(Stable) | ||
@@ -2,0 +8,0 @@ |
/** | ||
* | ||
* @author: 橘子<daxingplay@gmail.com> | ||
* KISSY Module Compiler | ||
* @author: daxingplay<daxingplay@gmail.com> | ||
* @time: 13-3-12 11:41 | ||
@@ -129,3 +129,3 @@ * @description: | ||
}, | ||
combo: function(inputFile, depFileName, depFileCharset){ | ||
combo: function(inputFile, depFileName, depFileCharset, fixModuleName){ | ||
var self = this, | ||
@@ -136,5 +136,6 @@ content, | ||
config = _.cloneDeep(self._config); | ||
fixModuleName = fixModuleName === true; | ||
var c = new Compiler(config); | ||
c.analyze(inputFile); | ||
content = c.combo(); | ||
content = c.combo(fixModuleName); | ||
if(content && depFileName){ | ||
@@ -141,0 +142,0 @@ utils.writeFileSync(depFileName, content, depFileCharset); |
@@ -201,3 +201,15 @@ /** | ||
}; | ||
Compiler.prototype._generateRealModuleContent = function(mod){ | ||
var self = this; | ||
var fileContent = fs.readFileSync(mod.path); | ||
var modContent = iconv.decode(fileContent, mod.charset); | ||
// fix issue 23: remove file BOM before combo. | ||
if(/^\uFEFF/.test(modContent)){ | ||
modContent = modContent.toString().replace(/^\uFEFF/, ''); | ||
} | ||
modContent = self._mapContent(modContent, mod); | ||
return self._addModuleName(modContent, mod.name); | ||
}; | ||
Compiler.prototype.getAst = getAst; | ||
@@ -344,12 +356,5 @@ | ||
_.forEach(self.analyzedModules, function(modName){ | ||
var mod = self.modules[modName], | ||
fileContent = fs.readFileSync(mod.path); | ||
var modContent = iconv.decode(fileContent, mod.charset); | ||
// fix issue 23: remove file BOM before combo. | ||
if(/^\uFEFF/.test(modContent)){ | ||
modContent = modContent.toString().replace(/^\uFEFF/, ''); | ||
} | ||
modContent = self._mapContent(modContent, mod); | ||
modContent = self._addModuleName(modContent, mod.name) + os.EOL; | ||
var mod = self.modules[modName]; | ||
// add EOL to end of file. | ||
var modContent = self._generateRealModuleContent(mod) + os.EOL; | ||
var buffer = iconv.encode(modContent, outputCharset); | ||
@@ -370,3 +375,3 @@ fs.writeSync(fd, buffer, 0, buffer.length); | ||
}; | ||
Compiler.prototype.combo = function(){ | ||
Compiler.prototype.combo = function(fixModuleName){ | ||
var self = this, | ||
@@ -383,2 +388,7 @@ content = []; | ||
} | ||
if(fixModuleName === true){ | ||
var modContent = self._generateRealModuleContent(mod); | ||
var buffer = iconv.encode(modContent, mod.charset); | ||
fs.writeFile(mod.path, buffer); | ||
} | ||
}); | ||
@@ -385,0 +395,0 @@ } |
{ | ||
"name":"kmc", | ||
"version":"1.0.15", | ||
"version":"1.0.16", | ||
"description":"KISSY Module Compiler", | ||
@@ -5,0 +5,0 @@ "author":"daxingplay <daxingplay@gmail.com>", |
@@ -11,2 +11,4 @@ # ModuleCompiler | ||
如果您有任何问题,请邮件或者来往(daxingplay)上联系我。 | ||
## 特点 | ||
@@ -109,3 +111,3 @@ | ||
* kmc.build(inputPath, outputPath, outputCharset, depFilePath, traverse):打包函数,具体见wiki | ||
* kmc.combo(inputPath, depFilePath, depFileCharset): 不打包,只生成KISSY 1.3的自动combo依赖文件 | ||
* kmc.combo(inputPath, depFilePath, depFileCharset, fixModuleName): 不打包,只生成KISSY 1.3的自动combo依赖文件,fixModuleName默认为false | ||
* kmc.clean(): 可以清空config中的设置。因为ModuleCompiler是单例运行,所以如果出现一些特别情况,可以在config前执行clean方法清空之前的配置。 | ||
@@ -112,0 +114,0 @@ |
@@ -532,3 +532,3 @@ /** | ||
}); | ||
result = ModuleCompiler.combo(inputFile, depFile, 'gbk'); | ||
result = ModuleCompiler.combo(inputFile, depFile, 'gbk', false); | ||
}); | ||
@@ -535,0 +535,0 @@ |
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
103349
2763
118