Skip to content

Commit

Permalink
默认不对代码进行压缩,fix #11
Browse files Browse the repository at this point in the history
  • Loading branch information
guilipan committed May 11, 2015
1 parent 113548c commit 2d21b45
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 46 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module.exports = function (options) {

var newContent = ast.modify(file.contents.toString(), newAstSeaModule)

file.contents = new Buffer(newContent.print_to_string())
file.contents = new Buffer(newContent.print_to_string({beautify:true}))

}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gulp-seajs-transport",
"version": "0.2.1",
"version": "0.3.0",
"description": "transport seajs modules gulp plugin",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -34,7 +34,7 @@
"through2": "^0.6.1"
},
"devDependencies": {
"chai": "^1.9.1",
"chai": "^2.3.0",
"coveralls": "^2.11.1",
"event-stream": "^3.1.7",
"gulp": "^3.8.7",
Expand Down
46 changes: 3 additions & 43 deletions test/transport-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ describe("gulp的seajs插件,用于transport化seajs模块", function () {
var contents = file.contents.toString();

expect(file.isBuffer()).to.be.true;

expect(contents).to.contain("helloworld")

.and.to.contain('["./a","../dir/b"]')
.and.to.contain('"./a", "../dir/b"')

})

Expand Down Expand Up @@ -90,43 +89,6 @@ describe("gulp的seajs插件,用于transport化seajs模块", function () {

})

it("设置base路径后的transport", function (done) {

var fakeFile = new File({
cwd: "/",
base: "/test/",
path: "/test/demo/fuck/helloworld.js",
contents: new Buffer('define(function (require, exports, module) {\
\
var a=require("./a");\
var b=require("../dir/b");\
a.hello();\
\
})')
});

var stream = transport({base: "./test/demo"});

stream.once("data", function (file) {

var contents = file.contents.toString();

expect(file.isBuffer()).to.be.true;

expect(contents).to.contain("demo/fuck/helloworld")

.and.to.contain('["./a","../dir/b"]')

})

stream.on("end", done);

stream.write(fakeFile);

stream.end();

})

it("如果file的contents为null,不做任何事情", function (done) {
var fakeFile = new File({
base: "/test/",
Expand Down Expand Up @@ -168,9 +130,8 @@ describe("gulp的seajs插件,用于transport化seajs模块", function () {
var contents = file.contents.toString();

expect(file.isBuffer()).to.be.true;

expect(contents)
.to.contain("function Animal(a,b)")
.to.contain("function Animal(a, b)")
.and.to.contain("helloworld")
.and.to.contain("[]")
;
Expand Down Expand Up @@ -199,11 +160,10 @@ describe("gulp的seajs插件,用于transport化seajs模块", function () {
var contents = file.contents.toString();

expect(file.isBuffer()).to.be.true;

expect(contents)
.to.contain("supportedTransforms")
.and.to.contain("/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i")
.and.to.contain('str.replace(/([a-z])([A-Z])/,"$1-$2"');
.and.to.contain('"$1-$2"');


});
Expand Down

0 comments on commit 2d21b45

Please sign in to comment.