chore(build): replace traceur-runtime with es6-shim.

This removes traceur as a dependency for the t push -f
angular2 build.

Closes #4148
This commit is contained in:
Rado Kirov 2015-09-11 16:00:26 -07:00 committed by Rado Kirov
parent 309944931f
commit cac25fe003
20 changed files with 91 additions and 230 deletions

View File

@ -91,19 +91,18 @@ var treatTestErrorsAsFatal = true;
function runJasmineTests(globs, done) {
var args = ['--'].concat(globs);
fork('./tools/traceur-jasmine', args, {
stdio: 'inherit'
}).on('close', function jasmineCloseHandler(exitCode) {
if (exitCode && treatTestErrorsAsFatal) {
var err = new Error('Jasmine tests failed');
// Mark the error for gulp similar to how gulp-utils.PluginError does it.
// The stack is not useful in this context.
err.showStack = false;
done(err);
} else {
done();
}
});
fork('./tools/cjs-jasmine', args, {stdio: 'inherit'})
.on('close', function jasmineCloseHandler(exitCode) {
if (exitCode && treatTestErrorsAsFatal) {
var err = new Error('Jasmine tests failed');
// Mark the error for gulp similar to how gulp-utils.PluginError does it.
// The stack is not useful in this context.
err.showStack = false;
done(err);
} else {
done();
}
});
}
// Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
@ -141,11 +140,8 @@ var BENCHPRESS_BUNDLE_CONFIG = {
'angular2'
],
excludes: [
'traceur',
'traceur/bin/traceur-runtime',
'reflect-metadata',
'selenium-webdriver',
'rtts_assert',
'zone.js'
],
ignore: [
@ -837,47 +833,46 @@ gulp.task('build/pure-packages.dart', function() {
])
.pipe(gulp.dest(path.join(CONFIG.dest.dart, 'angular2')));
var moveStream = gulp
.src([
'modules_dart/**/*.dart',
'modules_dart/**/pubspec.yaml',
'!modules_dart/transform/**'
])
.pipe(through2.obj(function(file, enc, done) {
if (file.path.endsWith('pubspec.yaml')) {
// Pure packages specify dependency_overrides relative to
// `modules_dart`, so they have to walk up and into `dist`.
//
// Example:
//
// dependency_overrides:
// angular2:
// path: ../../dist/dart/angular2
//
// When we copy a pure package into `dist` the relative path
// must be updated. The code below replaces paths accordingly.
// So the example above is turned into:
//
// dependency_overrides:
// angular2:
// path: ../angular2
//
var pubspec = yaml.safeLoad(file.contents.toString());
var overrides = pubspec.dependency_overrides;
if (overrides) {
Object.keys(overrides).forEach(function(pkg) {
var overridePath = overrides[pkg].path;
if (overridePath.startsWith(originalPrefix)) {
overrides[pkg].path = overridePath.replace(originalPrefix, '../');
}
});
file.contents = new Buffer(yaml.safeDump(pubspec));
}
}
this.push(file);
done();
}))
.pipe(gulp.dest(CONFIG.dest.dart));
var moveStream = gulp.src([
'modules_dart/**/*.dart',
'modules_dart/**/pubspec.yaml',
'!modules_dart/transform/**'
])
.pipe(through2.obj(function(file, enc, done) {
if (/pubspec.yaml$/.test(file.path)) {
// Pure packages specify dependency_overrides relative to
// `modules_dart`, so they have to walk up and into `dist`.
//
// Example:
//
// dependency_overrides:
// angular2:
// path: ../../dist/dart/angular2
//
// When we copy a pure package into `dist` the relative path
// must be updated. The code below replaces paths accordingly.
// So the example above is turned into:
//
// dependency_overrides:
// angular2:
// path: ../angular2
//
var pubspec = yaml.safeLoad(file.contents.toString());
var overrides = pubspec.dependency_overrides;
if (overrides) {
Object.keys(overrides).forEach(function(pkg) {
var overridePath = overrides[pkg].path;
if ((new RegExp('^' + originalPrefix)).test(overridePath)) {
overrides[pkg].path = overridePath.replace(originalPrefix, '../');
}
});
file.contents = new Buffer(yaml.safeDump(pubspec));
}
}
this.push(file);
done();
}))
.pipe(gulp.dest(CONFIG.dest.dart));
return merge2(transformStream, moveStream);
@ -1145,13 +1140,11 @@ gulp.task('!bundle.js.min.deps', ['!bundle.js.min'], function() {
});
var JS_DEV_DEPS = [
licenseWrap('node_modules/zone.js/LICENSE', true),
'node_modules/zone.js/dist/zone-microtask.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
licenseWrap('node_modules/reflect-metadata/LICENSE', true),
'node_modules/reflect-metadata/Reflect.js',
// traceur-runtime is always first in the bundle
licenseWrap('node_modules/traceur/LICENSE', true)
licenseWrap('node_modules/zone.js/LICENSE', true),
'node_modules/zone.js/dist/zone-microtask.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
licenseWrap('node_modules/reflect-metadata/LICENSE', true),
'node_modules/reflect-metadata/Reflect.js'
];
// Splice in RX license if rx is in the bundle.

View File

@ -17,7 +17,7 @@ module.exports = function(config) {
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/traceur/bin/traceur-runtime.js',
'node_modules/es6-shim/es6-shim.js',
// Including systemjs because it defines `__eval`, which produces correct stack traces.
'modules/angular2/src/test_lib/shims_for_IE.js',
'node_modules/systemjs/dist/system.src.js',
@ -28,10 +28,7 @@ module.exports = function(config) {
{pattern: 'modules/**/test/**/static_assets/**', included: false, watched: false}
],
exclude: [
'dist/js/dev/es5/**/e2e_test/**',
'dist/angular1_router.js'
],
exclude: ['dist/js/dev/es5/**/e2e_test/**', 'dist/angular1_router.js'],
customLaunchers: sauceConf.customLaunchers,

View File

@ -21,8 +21,8 @@ var files = [
var PRELUDE = '(function(){\n';
var POSTLUDE = '\n}());\n';
var FACADES = fs.readFileSync(__dirname + '/lib/facades.es5', 'utf8');
var TRACEUR_RUNTIME = fs.readFileSync(__dirname + '/../../node_modules/traceur/bin/traceur-runtime.js', 'utf8');
var DIRECTIVES = fs.readFileSync(__dirname + '/src/ng_outlet.js', 'utf8');
var ES6_SHIM = fs.readFileSync(__dirname + '/../../node_modules/es6-shim/es6-shim.js', 'utf8');
function main() {
var dir = __dirname + '/../angular2/src/router/';
@ -85,7 +85,7 @@ function main() {
"return router;"
].join('\n'));
return PRELUDE + TRACEUR_RUNTIME + DIRECTIVES + out + POSTLUDE;
return PRELUDE + ES6_SHIM + DIRECTIVES + out + POSTLUDE;
}

View File

@ -128,7 +128,7 @@ var StringMapWrapper = {
},
forEach: function (m, fn) {
for (prop in m) {
for (var prop in m) {
if (m.hasOwnProperty(prop)) {
fn(m[prop], prop);
}

View File

@ -27,7 +27,7 @@ To bootstrap Hello World in a WebWorker we do the following in TypeScript
```HTML
<html>
<head>
<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.js"></script>
<script src="https://jspm.io/system@0.16.js"></script>
<script src="angular2/web_worker/ui.js"></script>
</head>
@ -44,7 +44,7 @@ bootstrap("loader.js");
```
```JavaScript
// loader.js
importScripts("https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js", "https://jspm.io/system@0.16.js", "angular2/web_worker/worker.js");
importScripts("https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.js", "https://jspm.io/system@0.16.js", "angular2/web_worker/worker.js");
System.import("app");
```
```TypeScript

View File

@ -15,7 +15,7 @@
interface PromiseLike<T> extends Thenable<T> {}
// Extend the ES5 standard library with some ES6 features we polyfill at runtime
// by loading traceur-runtime.js
// by loading es6-shim.js
// These are mostly copied from lib.es6.d.ts

View File

@ -1,6 +1,6 @@
// Index to be used if Http is ever configured as a standalone npm package.
// require('reflect-metadata');
// require('traceur-runtime');
// require('es6-shim');
// import {HTTP_BINDINGS, JSONP_BINDINGS, Http, Jsonp} from './http';
// import {Injector} from 'angular2/angular2';
// export * from './http';

View File

@ -1,5 +1,5 @@
require('reflect-metadata');
require('traceur/bin/traceur-runtime');
require('es6-shim');
module.exports = require('./benchpress.js');
// when bundling benchpress to one file, this is used
// for getting exports out of browserify's scope.

View File

@ -10,7 +10,6 @@
"repository": <%= JSON.stringify(packageJson.repository) %>,
"dependencies": {
"angular2": "<%= packageJson.version %>",
"traceur": "<%= packageJson.dependencies.traceur %>",
"selenium-webdriver": "<%= packageJson.dependencies['selenium-webdriver'] %>",
"reflect-metadata": "<%= packageJson.dependencies['reflect-metadata'] %>"
},

View File

@ -1,5 +1,5 @@
/// <reference path="../../../angular2/typings/node/node.d.ts" />
require('traceur/bin/traceur-runtime.js');
require('es6-shim/es6-shim.js');
require('reflect-metadata');
var testHelper = require('../../src/firefox_extension/lib/test_helper.js');

View File

@ -2999,6 +2999,9 @@
}
}
},
"es6-shim": {
"version": "0.33.3"
},
"event-stream": {
"version": "3.3.1",
"dependencies": {
@ -9776,57 +9779,6 @@
}
}
},
"traceur": {
"version": "0.0.87",
"dependencies": {
"commander": {
"version": "2.6.0"
},
"glob": {
"version": "4.3.5",
"dependencies": {
"inflight": {
"version": "1.0.4",
"dependencies": {
"wrappy": {
"version": "1.0.1"
}
}
},
"inherits": {
"version": "2.0.1"
},
"once": {
"version": "1.3.2",
"dependencies": {
"wrappy": {
"version": "1.0.1"
}
}
}
}
},
"rsvp": {
"version": "3.0.18"
},
"semver": {
"version": "2.3.2"
},
"source-map-support": {
"version": "0.2.10",
"dependencies": {
"source-map": {
"version": "0.1.32",
"dependencies": {
"amdefine": {
"version": "0.1.0"
}
}
}
}
}
}
},
"ts2dart": {
"version": "0.7.4",
"dependencies": {
@ -10509,5 +10461,5 @@
}
},
"name": "angular",
"version": "2.0.0-alpha.36"
"version": "2.0.0-alpha.37"
}

84
npm-shrinkwrap.json generated
View File

@ -1,6 +1,6 @@
{
"name": "angular",
"version": "2.0.0-alpha.36",
"version": "2.0.0-alpha.37",
"dependencies": {
"angular": {
"version": "1.3.5",
@ -4633,6 +4633,11 @@
}
}
},
"es6-shim": {
"version": "0.33.3",
"from": "es6-shim@*",
"resolved": "https://registry.npmjs.org/es6-shim/-/es6-shim-0.33.3.tgz"
},
"event-stream": {
"version": "3.3.1",
"from": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.1.tgz",
@ -15112,83 +15117,6 @@
}
}
},
"traceur": {
"version": "0.0.87",
"from": "https://registry.npmjs.org/traceur/-/traceur-0.0.87.tgz",
"resolved": "https://registry.npmjs.org/traceur/-/traceur-0.0.87.tgz",
"dependencies": {
"commander": {
"version": "2.6.0",
"from": "https://registry.npmjs.org/commander/-/commander-2.6.0.tgz",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.6.0.tgz"
},
"glob": {
"version": "4.3.5",
"from": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz",
"resolved": "https://registry.npmjs.org/glob/-/glob-4.3.5.tgz",
"dependencies": {
"inflight": {
"version": "1.0.4",
"from": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz",
"dependencies": {
"wrappy": {
"version": "1.0.1",
"from": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
}
}
},
"inherits": {
"version": "2.0.1",
"from": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
},
"once": {
"version": "1.3.2",
"from": "https://registry.npmjs.org/once/-/once-1.3.2.tgz",
"resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz",
"dependencies": {
"wrappy": {
"version": "1.0.1",
"from": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
}
}
}
}
},
"rsvp": {
"version": "3.0.18",
"from": "https://registry.npmjs.org/rsvp/-/rsvp-3.0.18.tgz",
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.0.18.tgz"
},
"semver": {
"version": "2.3.2",
"from": "https://registry.npmjs.org/semver/-/semver-2.3.2.tgz",
"resolved": "https://registry.npmjs.org/semver/-/semver-2.3.2.tgz"
},
"source-map-support": {
"version": "0.2.10",
"from": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.2.10.tgz",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.2.10.tgz",
"dependencies": {
"source-map": {
"version": "0.1.32",
"from": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz",
"dependencies": {
"amdefine": {
"version": "0.1.0",
"from": "https://registry.npmjs.org/amdefine/-/amdefine-0.1.0.tgz",
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-0.1.0.tgz"
}
}
}
}
}
}
},
"ts2dart": {
"version": "0.7.4",
"from": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.4.tgz",

View File

@ -30,7 +30,6 @@
"dependencies": {
"reflect-metadata": "0.1.1",
"rx": "2.5.1",
"traceur": "0.0.87",
"zone.js": "0.5.4"
},
"devDependencies": {
@ -57,6 +56,7 @@
"del": "~1",
"dgeni": "^0.4.1",
"dgeni-packages": "^0.10.11",
"es6-shim": "^0.33.3",
"event-stream": "^3.1.5",
"firefox-profile": "^0.3.4",
"fs-extra": "^0.18.0",

View File

@ -1,6 +1,6 @@
<script src="zone-microtask.js" type="text/javascript"></script>
<script src="long-stack-trace-zone.js" type="text/javascript"></script>
<script src="traceur-runtime.js" type="text/javascript"></script>
<script src="es6-shim.js" type="text/javascript"></script>
<script src="system.src.js" type="text/javascript"></script>
<script src="Reflect.js" type="text/javascript"></script>
<script type="text/javascript">

View File

@ -1,7 +1,7 @@
<script src="zone-microtask.js" type="text/javascript"></script>
<script src="long-stack-trace-zone.js" type="text/javascript"></script>
<script src="url_params_to_form.js" type="text/javascript"></script>
<script src="traceur-runtime.js" type="text/javascript"></script>
<script src="es6-shim.js" type="text/javascript"></script>
<script src="system.src.js" type="text/javascript"></script>
<script src="Reflect.js" type="text/javascript"></script>
<script type="text/javascript">

View File

@ -2,7 +2,7 @@
<script src="long-stack-trace-zone.js" type="text/javascript"></script>
<script src="angular.js" type="text/javascript"></script>
<script src="url_params_to_form.js" type="text/javascript"></script>
<script src="traceur-runtime.js" type="text/javascript"></script>
<script src="es6-shim.js" type="text/javascript"></script>
<script src="system.src.js" type="text/javascript"></script>
<script src="Reflect.js" type="text/javascript"></script>
<script type="text/javascript">

View File

@ -1,2 +1,2 @@
importScripts("zone-microtask.js", "long-stack-trace-zone.js", "traceur-runtime.js",
"system.src.js", "Reflect.js");
importScripts("zone-microtask.js", "long-stack-trace-zone.js", "es6-shim.js", "system.src.js",
"Reflect.js");

View File

@ -5,7 +5,6 @@ var htmlReplace = require('../html-replace');
var jsReplace = require('../js-replace');
var path = require('path');
var stew = require('broccoli-stew');
var traceur = require('traceur');
import compileWithTypescript from '../broccoli-typescript';
import destCopy from '../broccoli-dest-copy';
@ -143,7 +142,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
'node_modules/rx/dist/rx.js',
'node_modules/base64-js/lib/b64.js',
'node_modules/reflect-metadata/Reflect.js',
path.relative(projectRootDir, traceur.RUNTIME_PATH)
'node_modules/es6-shim/es6-shim.js'
]
}));

View File

@ -5,12 +5,11 @@ var insert = require('gulp-insert');
var fs = require('fs-extra');
var browserify = require('browserify');
var path = require('path');
var Builder = require('systemjs-builder');
module.exports.bundle = function(buildConfig, moduleName, outputFile, outputConfig,
sfx) {
var sfx = sfx || false;
// loading it earlier interfers with custom traceur.
var Builder = require('systemjs-builder');
var builder = new Builder();
builder.config(buildConfig);
if (sfx) {

View File

@ -3,8 +3,7 @@
var glob = require('glob');
var JasmineRunner = require('jasmine');
var path = require('path');
// Require traceur to exposes $traceurRuntime on global context so that CJS files can run
require('traceur/bin/traceur-runtime.js');
require('es6-shim/es6-shim.js');
require('reflect-metadata/Reflect');
var jrunner = new JasmineRunner();
@ -23,19 +22,14 @@ if (globsIndex < 0) {
args = process.argv.slice(globsIndex + 1);
}
var specFiles = args.
map(function(globstr) { return glob.sync(globstr); }).
reduce(function(specFiles, paths) { return specFiles.concat(paths); }, []);
var specFiles = args.map(function(globstr) { return glob.sync(globstr); })
.reduce(function(specFiles, paths) { return specFiles.concat(paths); }, []);
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
jrunner.configureDefaultReporter({
showColors: process.argv.indexOf('--no-color') === -1
});
jrunner.configureDefaultReporter({showColors: process.argv.indexOf('--no-color') === -1});
jrunner.onComplete(function(passed) {
process.exit(passed ? 0 : 1);
});
jrunner.onComplete(function(passed) { process.exit(passed ? 0 : 1); });
jrunner.projectBaseDir = path.resolve(__dirname, '../../');
jrunner.specDir = '';
jrunner.addSpecFiles(specFiles);