Skip to content

Commit 4a53d07

Browse files
committed
resolve conflict
2 parents b48dead + d5c505d commit 4a53d07

File tree

4 files changed

+217
-0
lines changed

4 files changed

+217
-0
lines changed

.npmignore

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.iml
2+
.idea/
3+
*.ipr
4+
*.iws
5+
*~
6+
~*
7+
*.diff
8+
*.patch
9+
*.bak
10+
.DS_Store
11+
Thumbs.db
12+
.project
13+
.*proj
14+
.svn/
15+
*.swp
16+
out/
17+
node_modules/

HISTORY.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
## 2013.04.23, Version 1.0.6(Stable)
2+
3+
### bugfix
4+
5+
- ✔ 修正require路径为目录导致解析出错的bug
6+
- ✔ 默认关闭任何console的log信息,silent默认为true
7+
8+
## 2013.04.12, Version 1.0.5(Stable)
9+
10+
### bugfix
11+
12+
- ✔ 修正部分相对路径解析出错的bug
13+
14+
## 2013.04.12, Version 1.0.4(Stable)
15+
16+
### enhancement
17+
18+
- ✔ 增加exclude、ignoreFiles功能支持,添加相应测试用例
19+
20+
## 2013.04.12, Version 1.0.3(Stable)
21+
22+
### enhancement
23+
24+
- ✔ 增加map功能支持,添加相应测试用例
25+
26+
## 2013.04.10, Version 1.0.2(Stable)
27+
28+
### enhancement
29+
30+
- ✔ 完全重构,增加对KISSY 1.3的自动Combo支持
31+
32+
## 2012.11.28, Version 0.0.6(Stable)
33+
34+
### enhancement
35+
36+
- ✔ build的时候可以直接使用入口模块名进行打包
37+
38+
## 2012.11.28, Version 0.0.5(Stable)
39+
40+
### enhancement
41+
42+
- ✔ 增加ignoreFiles配置,方便打包目录的时候排除一些文件
43+
44+
## 2012.11.28, Version 0.0.4(Stable)
45+
46+
### bug fix
47+
48+
- ✔ 修正一处self未定义bug
49+
- ✔ 修正require正则分析少了一处引号的bug
50+
51+
## 2012.09.27, Version 0.0.3(Stable)
52+
53+
### bug fix
54+
55+
-#9 0.0.2中如果build没有设置编码,会输出utf-8的问题
56+
- ✔ 判断文件是否循环过导致一些模块无法打包进来的问题
57+
58+
## 2012.09.19, Version 0.0.2(Stable)
59+
60+
### bug fix
61+
62+
- ✔ 修复了模块互相依赖导致死循环的问题
63+
64+
### enhancement
65+
- 增加analyze接口,只分析依赖
66+
- build接口可以返回打包的具体信息了。
67+
- build接口可以单独设置输出编码了。
68+
- 增加了silent的config项目,可以完全关闭Module Compiler的控制台输出,方便集成到自己的工具当中
69+
- ModuleCompiler.config可以返回当前的所有配置信息,包括包信息,方便用户查看。
70+
71+
## 2012.08.28, Version 0.0.1(Stable)
72+
73+
### bug fix
74+
75+
- ✔ 修复了输出编码设置无效的问题
76+
77+
### test case
78+
- 增加编码测试脚本

LICENSE.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The MIT License
2+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3+
4+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
5+
6+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# ModuleCompiler
2+
3+
[![Build Status](https://secure.travis-ci.org/daxingplay/ModuleCompiler.png)](http://travis-ci.org/daxingplay/ModuleCompiler)
4+
5+
[![NPM version](https://badge.fury.io/js/kmc.png)](http://badge.fury.io/js/kmc)
6+
7+
## 简介
8+
9+
KISSY Module Compiler(kmc)是一个基于NodeJS的KISSY模块打包工具,目前适用于KISSY 1.2+的代码打包
10+
11+
## 特点
12+
13+
- 支持GruntJS,参见[grunt-kmc](https://github.com/daxingplay/grunt-kmc).
14+
- 基于NodeJS,相比于KISSY自带的Java工具,打包快速
15+
- 参照浏览器端的KISSY的config进行配置,无需额外知识,只需要改一下包路径即能快速打包
16+
- 支持混合编码打包,不同的包可以使用不同的编码
17+
- 支持GBK输出
18+
- 支持KISSY 1.3的自动combo功能,可以生成依赖关系文件
19+
- 提供底层依赖分析接口,方便集成到其他工具当中
20+
- 支持map功能,可以使用正则自由替换输出的模块名
21+
22+
## 版本说明
23+
24+
- 0.0.7版本适用于KISSY 1.2、1.3的打包,目前已经在淘宝多个业务广泛使用,单纯打包没有任何问题,但是不具备依赖分析生成功能,此版本已经不再维护,推荐使用新版本。
25+
- 1.0.0版本开始支持KISSY 1.3的自动combo功能,推荐使用
26+
27+
## 使用
28+
29+
### 安装
30+
npm install kmc
31+
32+
or
33+
34+
git clone git://github.com/daxingplay/ModuleCompiler.git
35+
36+
**注意**: 新版本的KISSY Module Compiler的npm包已经更名为kmc,如果使用老版本(此版已经不再维护),请`npm install module-compiler`
37+
38+
### 编写你的打包脚本
39+
40+
```js
41+
var ModuleCompiler = require('module-compiler');
42+
43+
// 这里和KISSY.config一样,先配置包
44+
ModuleCompiler.config({
45+
packages: [{
46+
'name': 'sh',
47+
'path': '这里建议写绝对路径,即sh这个包所在的目录',
48+
'charset': 'gbk'
49+
}]
50+
});
51+
52+
// 将xxx.js打包为xxx.combine.js,输出编码为GBK
53+
ModuleCompiler.build('xxx.js', 'xxx.combine.js', 'gbk');
54+
55+
// 用node执行你这个打包脚本就ok啦~
56+
```
57+
58+
### 高级使用指南
59+
60+
```js
61+
var ModuleCompiler = require('module-compiler');
62+
63+
ModuleCompiler.config({
64+
// 和KISSY一样,可以配置多个包
65+
packages: [{
66+
'name': 'app1',
67+
'path': 'app1这个包所在目录的绝对路径',
68+
// 这里是指app1这个包中的文件的编码,同一个包内的编码请保持一致
69+
'charset': 'gbk'
70+
}, {
71+
'name': 'app2',
72+
'path': 'app2这个包所在目录的绝对路径',
73+
// 这里是指app2这个包源码的编码
74+
'charset': 'utf-8'
75+
}],
76+
// 可以设置哪些模块不打包进来。注意,这里exclude的是具体的模块名,支持正则
77+
exclude: ['base', 'event'],
78+
// 如果是对一个目录下的所有文件进行打包,可以设置哪些文件不打包进来,支持正则。注意和上面的exclude的配置的区别。
79+
ignoreFiles: ['.combo.js', '-min.js'],
80+
// 输出的文件名后缀,不带.js,比如打包后你想输出为xxx.combine.js,那么这里就配置为:.combine
81+
suffix: '',
82+
// 类似于KISSY的map方法,可以自己定义把模块名中的路径进行替换
83+
map: [
84+
// 这样配置的话,那么,如果原先输出的app1的模块名中含有app1/2.0/字样的话,就会被替换成app1/19891014/
85+
['app1/2.0/', 'app1/19891014/']
86+
],
87+
// 这里设置的是最后打包出来的文件的编码,默认UTF-8,这里的设置相当于是全局设置,下面build中的设置是针对单一打包实例的
88+
charset: 'gbk'
89+
});
90+
91+
/**
92+
* 打包一个文件/目录
93+
* @param inputPath {String} 源文件/目录的绝对路径.
94+
* @param outputPath {String} 打包出来的文件/目录的路径.
95+
* @param outputCharset {String} 输出编码,这里的设置会覆盖config.charset中的设置,默认UTF-8
96+
* @return {Object} 打包出来的文件信息
97+
*/
98+
ModuleCompiler.build('xxx.js', 'xxx.combine.js', 'gbk');
99+
```
100+
101+
更详细的文档,请参见[wiki](https://github.com/daxingplay/ModuleCompiler/wiki)
102+
103+
### API汇总
104+
105+
* ModuleCompiler.config(cfg):配置包,返回当前所有配置信息。如果不带参数,直接返回当前所有配置信息。
106+
* ModuleCompiler.analyze(inputPath):只分析该文件依赖,不打包。
107+
* ModuleCompiler.build(inputPath, outputPath, outputCharset, depFilePath):打包函数,具体见wiki
108+
* ModuleCompiler.combo(inputPath, depFilePath, depFileCharset): 不打包,只生成KISSY 1.3的自动combo依赖文件
109+
* ModuleCompiler.clean(): 可以清空config中的设置。因为ModuleCompiler是单例运行,所以如果出现一些特别情况,可以在config前执行clean方法清空之前的配置。
110+
111+
## CHANGELOG
112+
113+
[版本更新记录](https://github.com/daxingplay/ModuleCompiler/blob/master/HISTORY.md)
114+
115+
## License
116+
遵守 "MIT":https://github.com/daxingplay/ModuleCompiler/blob/master/LICENSE.md 协议

0 commit comments

Comments
 (0)