chore(build): rename .es6 files to .js
Change es6 source files in npm distribution to use .js extensions. Closes #2447
This commit is contained in:
parent
6cafaba993
commit
796fc66771
|
@ -9,7 +9,7 @@ module.exports = function tsParser(createCompilerHost, log) {
|
||||||
// During migration from Traceur, there is a mix of `.ts`, `.es6` and `.js` (atScript)
|
// During migration from Traceur, there is a mix of `.ts`, `.es6` and `.js` (atScript)
|
||||||
// files in the project and the TypeScript compiler only looks for `.ts` files when trying
|
// files in the project and the TypeScript compiler only looks for `.ts` files when trying
|
||||||
// to load imports.
|
// to load imports.
|
||||||
extensions: ['.ts', '.js', '.es6'],
|
extensions: ['.ts', '.js'],
|
||||||
|
|
||||||
// The options for the TS compiler
|
// The options for the TS compiler
|
||||||
options: {
|
options: {
|
||||||
|
|
10
gulpfile.js
10
gulpfile.js
|
@ -223,7 +223,7 @@ gulp.task('build/checkCircularDependencies', function (done) {
|
||||||
var dependencyObject = madge(CONFIG.dest.js.dev.es6, {
|
var dependencyObject = madge(CONFIG.dest.js.dev.es6, {
|
||||||
format: 'es6',
|
format: 'es6',
|
||||||
paths: [CONFIG.dest.js.dev.es6],
|
paths: [CONFIG.dest.js.dev.es6],
|
||||||
extensions: ['.js', '.es6'],
|
extensions: ['.js'],
|
||||||
onParseFile: function(data) {
|
onParseFile: function(data) {
|
||||||
data.src = data.src.replace(/import \* as/g, "//import * as");
|
data.src = data.src.replace(/import \* as/g, "//import * as");
|
||||||
}
|
}
|
||||||
|
@ -708,7 +708,7 @@ gulp.task('!build.js.cjs', function() {
|
||||||
|
|
||||||
var bundleConfig = {
|
var bundleConfig = {
|
||||||
paths: {
|
paths: {
|
||||||
"*": "dist/js/prod/es6/*.es6",
|
"*": "dist/js/prod/es6/*.js",
|
||||||
"rx": "node_modules/rx/dist/rx.js"
|
"rx": "node_modules/rx/dist/rx.js"
|
||||||
},
|
},
|
||||||
meta: {
|
meta: {
|
||||||
|
@ -747,7 +747,7 @@ gulp.task('bundle.js.dev', ['build.js.dev'], function() {
|
||||||
var devBundleConfig = merge(true, bundleConfig);
|
var devBundleConfig = merge(true, bundleConfig);
|
||||||
devBundleConfig.paths =
|
devBundleConfig.paths =
|
||||||
merge(true, devBundleConfig.paths, {
|
merge(true, devBundleConfig.paths, {
|
||||||
"*": "dist/js/dev/es6/*.es6"
|
"*": "dist/js/dev/es6/*.js"
|
||||||
});
|
});
|
||||||
return bundler.bundle(
|
return bundler.bundle(
|
||||||
devBundleConfig,
|
devBundleConfig,
|
||||||
|
@ -760,7 +760,7 @@ gulp.task('router.bundle.js.dev', ['build.js.dev'], function() {
|
||||||
var devBundleConfig = merge(true, bundleConfig);
|
var devBundleConfig = merge(true, bundleConfig);
|
||||||
devBundleConfig.paths =
|
devBundleConfig.paths =
|
||||||
merge(true, devBundleConfig.paths, {
|
merge(true, devBundleConfig.paths, {
|
||||||
"*": "dist/js/dev/es6/*.es6"
|
"*": "dist/js/dev/es6/*.js"
|
||||||
});
|
});
|
||||||
return bundler.bundle(
|
return bundler.bundle(
|
||||||
devBundleConfig,
|
devBundleConfig,
|
||||||
|
@ -778,7 +778,7 @@ gulp.task('bundle.js.sfx.dev', ['build.js.dev'], function() {
|
||||||
var devBundleConfig = merge(true, bundleConfig);
|
var devBundleConfig = merge(true, bundleConfig);
|
||||||
devBundleConfig.paths =
|
devBundleConfig.paths =
|
||||||
merge(true, devBundleConfig.paths, {
|
merge(true, devBundleConfig.paths, {
|
||||||
'*': 'dist/js/dev/es6/*.es6'
|
'*': 'dist/js/dev/es6/*.js'
|
||||||
});
|
});
|
||||||
return bundler.bundle(
|
return bundler.bundle(
|
||||||
devBundleConfig,
|
devBundleConfig,
|
||||||
|
|
|
@ -34,7 +34,7 @@ describe('sourcemaps', function() {
|
||||||
|
|
||||||
var originalPosition = decoder.originalPositionFor({line: errorLine, column: errorColumn});
|
var originalPosition = decoder.originalPositionFor({line: errorLine, column: errorColumn});
|
||||||
|
|
||||||
var finalMapData = fs.readFileSync('dist/js/prod/es6/examples/src/sourcemap/index.es6.map');
|
var finalMapData = fs.readFileSync('dist/js/prod/es6/examples/src/sourcemap/index.js.map');
|
||||||
var finalDecoder = new sourceMap.SourceMapConsumer(JSON.parse(finalMapData));
|
var finalDecoder = new sourceMap.SourceMapConsumer(JSON.parse(finalMapData));
|
||||||
|
|
||||||
var finalPosition = finalDecoder.originalPositionFor(originalPosition);
|
var finalPosition = finalDecoder.originalPositionFor(originalPosition);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
A run-time type assertion library for JavaScript.
|
A run-time type assertion library for JavaScript.
|
||||||
Designed to be used with [Traceur](https://github.com/google/traceur-compiler).
|
Designed to be used with [Traceur](https://github.com/google/traceur-compiler).
|
||||||
|
|
||||||
All sources are in ES6 format and have the suffix `.es6`. They don't depend on any runtime
|
All sources are in ES6 format. They don't depend on any runtime
|
||||||
and can be used by any modern ES6 -> ES5 transpiler.
|
and can be used by any modern ES6 -> ES5 transpiler.
|
||||||
|
|
||||||
As a convenience, we provide you with `es5build.js`, a script to transpile the sources into es5
|
As a convenience, we provide you with `es5build.js`, a script to transpile the sources into es5
|
||||||
|
|
|
@ -13,7 +13,7 @@ let xtend = require('xtend');
|
||||||
class DiffingTraceurCompiler implements DiffingBroccoliPlugin {
|
class DiffingTraceurCompiler implements DiffingBroccoliPlugin {
|
||||||
constructor(public inputPath: string, public cachePath: string, public options) {}
|
constructor(public inputPath: string, public cachePath: string, public options) {}
|
||||||
|
|
||||||
static includeExtensions = ['.js', '.es6', '.cjs'];
|
static includeExtensions = ['.js', '.cjs'];
|
||||||
|
|
||||||
rebuild(treeDiff: DiffResult) {
|
rebuild(treeDiff: DiffResult) {
|
||||||
treeDiff.addedPaths.concat(treeDiff.changedPaths)
|
treeDiff.addedPaths.concat(treeDiff.changedPaths)
|
||||||
|
|
|
@ -64,7 +64,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
|
||||||
|
|
||||||
// Use Traceur to transpile *.js sources to ES6
|
// Use Traceur to transpile *.js sources to ES6
|
||||||
var traceurTree = transpileWithTraceur(modulesTree, {
|
var traceurTree = transpileWithTraceur(modulesTree, {
|
||||||
destExtension: '.es6',
|
destExtension: '.js',
|
||||||
destSourceMapExtension: '.map',
|
destSourceMapExtension: '.map',
|
||||||
traceurOptions: {
|
traceurOptions: {
|
||||||
sourceMaps: true,
|
sourceMaps: true,
|
||||||
|
@ -93,7 +93,6 @@ module.exports = function makeBrowserTree(options, destinationPath) {
|
||||||
sourceRoot: '.',
|
sourceRoot: '.',
|
||||||
target: 'ES6'
|
target: 'ES6'
|
||||||
});
|
});
|
||||||
typescriptTree = stew.rename(typescriptTree, '.js', '.es6');
|
|
||||||
|
|
||||||
var es6Tree = mergeTrees([traceurTree, typescriptTree]);
|
var es6Tree = mergeTrees([traceurTree, typescriptTree]);
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,8 @@ if (!module.parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function run(config) {
|
function run(config) {
|
||||||
var src = ['!node_modules', '!node_modules/**', './**/*.es6'];
|
var src = ['!node_modules', '!node_modules/**', './**/*.js'];
|
||||||
return gulp.src(src, {cwd: config.src})
|
return gulp.src(src, {cwd: config.src})
|
||||||
.pipe(rename(function(file) {
|
|
||||||
file.extname = file.extname.replace('.es6', '.js');
|
|
||||||
}))
|
|
||||||
// TODO(tbosch): Using sourcemaps.init({loadMaps:true}) does not combine
|
// TODO(tbosch): Using sourcemaps.init({loadMaps:true}) does not combine
|
||||||
// the sourcemaps correctly!
|
// the sourcemaps correctly!
|
||||||
.pipe(sourcemaps.init())
|
.pipe(sourcemaps.init())
|
||||||
|
|
Loading…
Reference in New Issue