ima.js-gulp-tasks
Advanced tools
Comparing version 0.10.2 to 0.10.3
113
package.json
{ | ||
"name": "ima.js-gulp-tasks", | ||
"version": "0.10.2", | ||
"description": "Default gulp tasks for IMA.js applications.", | ||
"main": "", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/seznam/IMA.js-gulp-tasks.git" | ||
}, | ||
"keywords": [ | ||
"name": "ima.js-gulp-tasks", | ||
"version": "0.10.3", | ||
"description": "Default gulp tasks for IMA.js applications.", | ||
"main": "", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/seznam/IMA.js-gulp-tasks.git" | ||
}, | ||
"keywords": [ | ||
"gulp", | ||
@@ -18,43 +18,50 @@ "IMA.js", | ||
], | ||
"author": "Seznam.cz, a.s.", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/seznam/IMA.js-gulp-tasks/issues" | ||
}, | ||
"publishConfig": { | ||
"registry": "http://registry.npmjs.org/" | ||
}, | ||
"homepage": "https://github.com/seznam/IMA.js-gulp-tasks", | ||
"devDependencies": { | ||
"babelify": "^6.3.0", | ||
"browserify": "^11.2.0", | ||
"del": "^2.1.0", | ||
"event-stream": "^3.3.2", | ||
"fb-flo": "^0.5.0", | ||
"gulp": "^3.9.0", | ||
"gulp-autoprefixer": "^3.1.0", | ||
"gulp-babel": "^5.3.0", | ||
"gulp-cached": "^1.1.0", | ||
"gulp-change": "^1.0.0", | ||
"gulp-concat": "^2.6.0", | ||
"gulp-eslint": "^1.1.0", | ||
"gulp-if": "^2.0.0", | ||
"gulp-insert": "^0.5.0", | ||
"gulp-less": "^3.0.5", | ||
"gulp-live-server": "0.0.29", | ||
"gulp-messageformat": "0.0.10", | ||
"gulp-minify-css": "^1.2.1", | ||
"gulp-plumber": "^1.0.1", | ||
"gulp-remember": "^0.3.0", | ||
"gulp-save": "^1.2.1", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-sweetjs": "^0.6.0", | ||
"gulp-uglify": "^1.5.1", | ||
"gulp-util": "^3.0.7", | ||
"gulp-watch": "^4.3.5", | ||
"gulp-yuidoc": "^0.1.2", | ||
"karma": "^0.13.15", | ||
"run-sequence": "^1.1.4", | ||
"vinyl-source-stream": "^1.1.0" | ||
} | ||
"author": "Seznam.cz, a.s.", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/seznam/IMA.js-gulp-tasks/issues" | ||
}, | ||
"publishConfig": { | ||
"registry": "http://registry.npmjs.org/" | ||
}, | ||
"homepage": "https://github.com/seznam/IMA.js-gulp-tasks", | ||
"devDependencies": { | ||
"babel-core": "^6.2.1", | ||
"babel-plugin-external-helpers-2": "^6.1.18", | ||
"babel-plugin-transform-es2015-modules-systemjs": "^6.1.18", | ||
"babel-plugin-transform-react-constant-elements": "^6.1.20", | ||
"babel-plugin-transform-react-inline-elements": "^6.1.20", | ||
"babel-preset-es2015": "^6.1.18", | ||
"babel-preset-react": "^6.1.18", | ||
"babelify": "^7.2.0", | ||
"browserify": "^12.0.1", | ||
"del": "^2.1.0", | ||
"event-stream": "^3.3.2", | ||
"fb-flo": "^0.5.0", | ||
"gulp": "^3.9.0", | ||
"gulp-autoprefixer": "^3.1.0", | ||
"gulp-babel": "^6.1.0", | ||
"gulp-cached": "^1.1.0", | ||
"gulp-change": "^1.0.0", | ||
"gulp-concat": "^2.6.0", | ||
"gulp-eslint": "^1.1.1", | ||
"gulp-if": "^2.0.0", | ||
"gulp-insert": "^0.5.0", | ||
"gulp-less": "^3.0.5", | ||
"gulp-live-server": "0.0.29", | ||
"gulp-messageformat": "0.0.10", | ||
"gulp-minify-css": "^1.2.1", | ||
"gulp-plumber": "^1.0.1", | ||
"gulp-remember": "^0.3.0", | ||
"gulp-save": "^1.2.1", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-sweetjs": "^0.6.0", | ||
"gulp-uglify": "^1.5.1", | ||
"gulp-util": "^3.0.7", | ||
"gulp-watch": "^4.3.5", | ||
"gulp-yuidoc": "^0.1.2", | ||
"karma": "^0.13.15", | ||
"run-sequence": "^1.1.5", | ||
"vinyl-source-stream": "^1.1.0" | ||
} | ||
} |
@@ -24,2 +24,3 @@ | ||
var files = gulpConfig.files; | ||
var babelConfig = gulpConfig.babelConfig; | ||
@@ -55,15 +56,8 @@ // build client logic app | ||
function moduleTransformer(pluginAndTypes) { | ||
var Plugin = pluginAndTypes.Plugin; | ||
function replaceToIMALoader() { | ||
return change(function (content) { | ||
content = content.replace(/System.import/g, '$IMA.Loader.import'); | ||
content = content.replace(/System.register/g, '$IMA.Loader.register'); | ||
return new Plugin('ima-babel-modules', { | ||
visitor: { | ||
Identifier: function (node) { | ||
if (node.name === 'System') { | ||
node.name = '$IMA.Loader'; | ||
} | ||
return node; | ||
} | ||
} | ||
return content; | ||
}); | ||
@@ -78,5 +72,7 @@ } | ||
.pipe(cache('Es6ToEs5:app')) | ||
.pipe(babel({ modules: 'system', moduleIds: true, loose: 'all', plugins: [ | ||
{ transformer: moduleTransformer, position: 'after' } | ||
], externalHelpers: true, optional: gulpConfig.babelOptional || [] })) | ||
.pipe(babel({ | ||
moduleIds: true, | ||
presets: ['es2015', 'react'].concat(babelConfig.app.presets), | ||
plugins: ['transform-es2015-modules-systemjs', 'external-helpers-2'].concat(babelConfig.app.plugins) | ||
})) | ||
.pipe(gulpif(isView, sweetjs({ | ||
@@ -91,2 +87,3 @@ modules: ['./imajs/macro/componentName.sjs'], | ||
.pipe(insertSystemImports()) | ||
.pipe(replaceToIMALoader()) | ||
.pipe(save('Es6ToEs5:app:source')) | ||
@@ -111,3 +108,6 @@ .pipe(insert.wrap('(function(){\n', '\n })();\n')) | ||
.pipe(plumber()) | ||
.pipe(babel({ modules: 'ignore', loose: 'all', externalHelpers: true })) | ||
.pipe(babel({ | ||
presets: ['es2015'].concat(babelConfig.server.presets), | ||
plugins: ['external-helpers-2'].concat(babelConfig.server.plugins) | ||
})) | ||
.pipe(plumber.stop()) | ||
@@ -123,3 +123,5 @@ .pipe(gulp.dest(files.server.dest)) | ||
.pipe(plumber()) | ||
.pipe(babel({ modules: 'commonStrict', loose: 'all', externalHelpers: true })) | ||
.pipe(babel({ | ||
presets: ['es2015', 'react'].concat(babelConfig.vendor.presets), | ||
plugins: ['external-helpers-2'].concat(babelConfig.vendor.plugins)})) | ||
.pipe(plumber.stop()) | ||
@@ -134,4 +136,6 @@ .pipe(concat(files.vendor.name.tmp)) | ||
browserify(files.vendor.dest.tmp + files.vendor.name.tmp, { debug: false, insertGlobals : false, basedir: '.' }) | ||
.transform(babelify.configure({ modules: 'ignore', loose: 'all', externalHelpers: true })) | ||
.external('vertx') | ||
.transform(babelify.configure({ | ||
presets: ['es2015', 'react'].concat(babelConfig.vendor.presets), | ||
plugins: ['external-helpers-2'].concat(babelConfig.vendor.plugins) | ||
})) | ||
.bundle() | ||
@@ -171,7 +175,5 @@ .pipe(source(files.vendor.name.client)) | ||
file.base = newBasePath; | ||
file.path = newPath; | ||
file.cwd = newBasePath; | ||
file.base = file.cwd; | ||
return file; | ||
}); | ||
} |
@@ -6,2 +6,3 @@ | ||
var sourcemaps = require('gulp-sourcemaps'); | ||
var builderBabelHeleprs = require('babel-core/lib/tools/build-external-helpers'); | ||
@@ -12,2 +13,4 @@ module.exports = function (gulpConfig) { | ||
gulp.task('shim', function () { | ||
var babelHelpers = builderBabelHeleprs(); | ||
return ( | ||
@@ -17,3 +20,3 @@ gulp | ||
.pipe(sourcemaps.init({loadMaps: true})) | ||
.pipe(insert.wrap('(function(){', '})();')) | ||
.pipe(insert.wrap('(function(){', '})();' + babelHelpers)) | ||
.pipe(concat(files.shim.name)) | ||
@@ -20,0 +23,0 @@ .pipe(gulp.dest(files.shim.dest.client)) |
21622
610
37