Skip to content

Commit

Permalink
Merge 225aad0 into a4c31c2
Browse files Browse the repository at this point in the history
  • Loading branch information
divdavem committed Apr 3, 2014
2 parents a4c31c2 + 225aad0 commit 67dbd02
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 23 deletions.
13 changes: 7 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
node_modules
/node_modules
/dist
/sauce_connect.log
/sc.log
/test-results
/tmp
*.peg.js
.DS_STORE
._.DS_STORE
dist
sauce_connect.log
sc.log
*.peg.js
test-results
60 changes: 44 additions & 16 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,18 +296,22 @@ module.exports = function (grunt) {
}
},
atpackager : {
runtime : {
options : {
sourceDirectories : ['.'],
sourceFiles : ['hsp/**/*.js'],
outputDirectory : 'dist/' + pkg.version,
defaultBuilder : {
type : "NoderPackage",
cfg : {
outputFileWrapper : "(function(define){$CONTENT$;})(noder.define);"
}
},
visitors : [{
type : "ImportSourceFile",
cfg : {
sourceFile : "tmp/uglify-js.js",
targetLogicalPath : "uglify-js.js"
}
}, {
type : "NoderExportVars",
cfg : {
files : ["uglify-js.js"]
}
}, {
type : "ImportSourceFile",
cfg : {
sourceFile : require.resolve("acorn/acorn"),
Expand All @@ -318,17 +322,41 @@ module.exports = function (grunt) {
cfg : {
noCircularDependencies : false
}
}],
packages : [{
name : "hashspace-noder.js",
files : ['hsp/*.js', 'hsp/rt/*.js', 'hsp/gestures/*.js']
}, {
name : "hashspace-noder-compiler.js",
files : ['hsp/compiler/compiler.js']
}]

},
uglify : {
options : {
sourceDirectories : ["node_modules/uglify-js/lib"],
sourceFiles : [],
outputDirectory : 'tmp',
visitors : [],
packages : [{
builder : "Concat",
name : 'uglify-js.js',
files : ["utils.js", "ast.js", "parse.js", "transform.js", "scope.js", "output.js",
"compress.js"]
}]
}
},
runtime : {
options : {
defaultBuilder : {
type : "NoderPackage",
cfg : {
outputFileWrapper : "(function(define){$CONTENT$;})(noder.define);"
}
},
packages : [{
name : "hashspace-noder.js",
files : ['hsp/*.js', 'hsp/rt/*.js', 'hsp/gestures/*.js']
}, {
name : "hashspace-noder-compiler.js",
files : ['hsp/compiler/compile.js','hsp/transpiler/transpile.js']
}]
}
}
}
}
});

// Automatically load all the grunt tasks
Expand All @@ -338,7 +366,7 @@ module.exports = function (grunt) {
require('atpackager').loadNpmPlugin('noder-js');

grunt.registerTask('prepublish', ['peg']);
grunt.registerTask('package', ['prepublish', 'browserify', 'atpackager', 'uglify']);
grunt.registerTask('package', ['prepublish', 'browserify', 'atpackager:uglify','atpackager:runtime','uglify']);
grunt.registerTask('mocha', ['peg', 'inittests', 'mochaTest', 'finalizetests']);
grunt.registerTask('test', ['checkStyle', 'jscs', 'mocha', 'karma:unit']);
grunt.registerTask('ci', ['checkStyle', 'jscs', 'mocha', 'karma:ci1', 'karma:ci2', 'karma:coverage', 'package']);
Expand Down
21 changes: 21 additions & 0 deletions hsp/compiler/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2014 Amadeus s.a.s.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var compiler = require("./compiler");

module.exports = function (code, moduleName) {
var compileRes = compiler.compile(code, moduleName);
return compileRes.code;
};
21 changes: 21 additions & 0 deletions hsp/transpiler/transpile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2014 Amadeus s.a.s.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

var processString = require("./processString");

module.exports = function (code, moduleName) {
var transpileRes = processString(code, moduleName);
return transpileRes.code;
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"karma-phantomjs-launcher": "~0.1",
"load-grunt-tasks": "~0.2.1",
"expect.js": "0.2.0",
"noder-js": "~1.2.0",
"noder-js": "1.2.1",
"jquery": "~1.11.0",
"grunt-jscs-checker": "~0.4.0",
"karma-hsp-preprocessor": "~0.0.6"
Expand Down

0 comments on commit 67dbd02

Please sign in to comment.