Skip to content

Commit cac25fe

Browse files
committed
chore(build): replace traceur-runtime with es6-shim.
This removes traceur as a dependency for the t push -f angular2 build. Closes angular#4148
1 parent 3099449 commit cac25fe

File tree

20 files changed

+91
-230
lines changed

20 files changed

+91
-230
lines changed

gulpfile.js

Lines changed: 57 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,18 @@ var treatTestErrorsAsFatal = true;
9191

9292
function runJasmineTests(globs, done) {
9393
var args = ['--'].concat(globs);
94-
fork('./tools/traceur-jasmine', args, {
95-
stdio: 'inherit'
96-
}).on('close', function jasmineCloseHandler(exitCode) {
97-
if (exitCode && treatTestErrorsAsFatal) {
98-
var err = new Error('Jasmine tests failed');
99-
// Mark the error for gulp similar to how gulp-utils.PluginError does it.
100-
// The stack is not useful in this context.
101-
err.showStack = false;
102-
done(err);
103-
} else {
104-
done();
105-
}
106-
});
94+
fork('./tools/cjs-jasmine', args, {stdio: 'inherit'})
95+
.on('close', function jasmineCloseHandler(exitCode) {
96+
if (exitCode && treatTestErrorsAsFatal) {
97+
var err = new Error('Jasmine tests failed');
98+
// Mark the error for gulp similar to how gulp-utils.PluginError does it.
99+
// The stack is not useful in this context.
100+
err.showStack = false;
101+
done(err);
102+
} else {
103+
done();
104+
}
105+
});
107106
}
108107

109108
// Note: when DART_SDK is not found, all gulp tasks ending with `.dart` will be skipped.
@@ -141,11 +140,8 @@ var BENCHPRESS_BUNDLE_CONFIG = {
141140
'angular2'
142141
],
143142
excludes: [
144-
'traceur',
145-
'traceur/bin/traceur-runtime',
146143
'reflect-metadata',
147144
'selenium-webdriver',
148-
'rtts_assert',
149145
'zone.js'
150146
],
151147
ignore: [
@@ -837,47 +833,46 @@ gulp.task('build/pure-packages.dart', function() {
837833
])
838834
.pipe(gulp.dest(path.join(CONFIG.dest.dart, 'angular2')));
839835

840-
var moveStream = gulp
841-
.src([
842-
'modules_dart/**/*.dart',
843-
'modules_dart/**/pubspec.yaml',
844-
'!modules_dart/transform/**'
845-
])
846-
.pipe(through2.obj(function(file, enc, done) {
847-
if (file.path.endsWith('pubspec.yaml')) {
848-
// Pure packages specify dependency_overrides relative to
849-
// `modules_dart`, so they have to walk up and into `dist`.
850-
//
851-
// Example:
852-
//
853-
// dependency_overrides:
854-
// angular2:
855-
// path: ../../dist/dart/angular2
856-
//
857-
// When we copy a pure package into `dist` the relative path
858-
// must be updated. The code below replaces paths accordingly.
859-
// So the example above is turned into:
860-
//
861-
// dependency_overrides:
862-
// angular2:
863-
// path: ../angular2
864-
//
865-
var pubspec = yaml.safeLoad(file.contents.toString());
866-
var overrides = pubspec.dependency_overrides;
867-
if (overrides) {
868-
Object.keys(overrides).forEach(function(pkg) {
869-
var overridePath = overrides[pkg].path;
870-
if (overridePath.startsWith(originalPrefix)) {
871-
overrides[pkg].path = overridePath.replace(originalPrefix, '../');
872-
}
873-
});
874-
file.contents = new Buffer(yaml.safeDump(pubspec));
875-
}
876-
}
877-
this.push(file);
878-
done();
879-
}))
880-
.pipe(gulp.dest(CONFIG.dest.dart));
836+
var moveStream = gulp.src([
837+
'modules_dart/**/*.dart',
838+
'modules_dart/**/pubspec.yaml',
839+
'!modules_dart/transform/**'
840+
])
841+
.pipe(through2.obj(function(file, enc, done) {
842+
if (/pubspec.yaml$/.test(file.path)) {
843+
// Pure packages specify dependency_overrides relative to
844+
// `modules_dart`, so they have to walk up and into `dist`.
845+
//
846+
// Example:
847+
//
848+
// dependency_overrides:
849+
// angular2:
850+
// path: ../../dist/dart/angular2
851+
//
852+
// When we copy a pure package into `dist` the relative path
853+
// must be updated. The code below replaces paths accordingly.
854+
// So the example above is turned into:
855+
//
856+
// dependency_overrides:
857+
// angular2:
858+
// path: ../angular2
859+
//
860+
var pubspec = yaml.safeLoad(file.contents.toString());
861+
var overrides = pubspec.dependency_overrides;
862+
if (overrides) {
863+
Object.keys(overrides).forEach(function(pkg) {
864+
var overridePath = overrides[pkg].path;
865+
if ((new RegExp('^' + originalPrefix)).test(overridePath)) {
866+
overrides[pkg].path = overridePath.replace(originalPrefix, '../');
867+
}
868+
});
869+
file.contents = new Buffer(yaml.safeDump(pubspec));
870+
}
871+
}
872+
this.push(file);
873+
done();
874+
}))
875+
.pipe(gulp.dest(CONFIG.dest.dart));
881876

882877

883878
return merge2(transformStream, moveStream);
@@ -1145,13 +1140,11 @@ gulp.task('!bundle.js.min.deps', ['!bundle.js.min'], function() {
11451140
});
11461141

11471142
var JS_DEV_DEPS = [
1148-
licenseWrap('node_modules/zone.js/LICENSE', true),
1149-
'node_modules/zone.js/dist/zone-microtask.js',
1150-
'node_modules/zone.js/dist/long-stack-trace-zone.js',
1151-
licenseWrap('node_modules/reflect-metadata/LICENSE', true),
1152-
'node_modules/reflect-metadata/Reflect.js',
1153-
// traceur-runtime is always first in the bundle
1154-
licenseWrap('node_modules/traceur/LICENSE', true)
1143+
licenseWrap('node_modules/zone.js/LICENSE', true),
1144+
'node_modules/zone.js/dist/zone-microtask.js',
1145+
'node_modules/zone.js/dist/long-stack-trace-zone.js',
1146+
licenseWrap('node_modules/reflect-metadata/LICENSE', true),
1147+
'node_modules/reflect-metadata/Reflect.js'
11551148
];
11561149

11571150
// Splice in RX license if rx is in the bundle.

karma-js.conf.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = function(config) {
1717
'node_modules/zone.js/dist/long-stack-trace-zone.js',
1818
'node_modules/zone.js/dist/jasmine-patch.js',
1919

20-
'node_modules/traceur/bin/traceur-runtime.js',
20+
'node_modules/es6-shim/es6-shim.js',
2121
// Including systemjs because it defines `__eval`, which produces correct stack traces.
2222
'modules/angular2/src/test_lib/shims_for_IE.js',
2323
'node_modules/systemjs/dist/system.src.js',
@@ -28,10 +28,7 @@ module.exports = function(config) {
2828
{pattern: 'modules/**/test/**/static_assets/**', included: false, watched: false}
2929
],
3030

31-
exclude: [
32-
'dist/js/dev/es5/**/e2e_test/**',
33-
'dist/angular1_router.js'
34-
],
31+
exclude: ['dist/js/dev/es5/**/e2e_test/**', 'dist/angular1_router.js'],
3532

3633
customLaunchers: sauceConf.customLaunchers,
3734

modules/angular1_router/build.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var files = [
2121
var PRELUDE = '(function(){\n';
2222
var POSTLUDE = '\n}());\n';
2323
var FACADES = fs.readFileSync(__dirname + '/lib/facades.es5', 'utf8');
24-
var TRACEUR_RUNTIME = fs.readFileSync(__dirname + '/../../node_modules/traceur/bin/traceur-runtime.js', 'utf8');
2524
var DIRECTIVES = fs.readFileSync(__dirname + '/src/ng_outlet.js', 'utf8');
25+
var ES6_SHIM = fs.readFileSync(__dirname + '/../../node_modules/es6-shim/es6-shim.js', 'utf8');
2626
function main() {
2727
var dir = __dirname + '/../angular2/src/router/';
2828

@@ -85,7 +85,7 @@ function main() {
8585
"return router;"
8686
].join('\n'));
8787

88-
return PRELUDE + TRACEUR_RUNTIME + DIRECTIVES + out + POSTLUDE;
88+
return PRELUDE + ES6_SHIM + DIRECTIVES + out + POSTLUDE;
8989
}
9090

9191

modules/angular1_router/lib/facades.es5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ var StringMapWrapper = {
128128
},
129129

130130
forEach: function (m, fn) {
131-
for (prop in m) {
131+
for (var prop in m) {
132132
if (m.hasOwnProperty(prop)) {
133133
fn(m[prop], prop);
134134
}

modules/angular2/docs/web_workers/web_workers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ To bootstrap Hello World in a WebWorker we do the following in TypeScript
2727
```HTML
2828
<html>
2929
<head>
30-
<script src="https://github.jspm.io/jmcriffey/[email protected]/traceur-runtime.js"></script>
30+
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.js"></script>
3131
<script src="https://jspm.io/[email protected]"></script>
3232
<script src="angular2/web_worker/ui.js"></script>
3333
</head>
@@ -44,7 +44,7 @@ bootstrap("loader.js");
4444
```
4545
```JavaScript
4646
// loader.js
47-
importScripts("https://github.jspm.io/jmcriffey/[email protected]/traceur-runtime.js", "https://jspm.io/[email protected]", "angular2/web_worker/worker.js");
47+
importScripts("https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.33.3/es6-shim.js", "https://jspm.io/[email protected]", "angular2/web_worker/worker.js");
4848
System.import("app");
4949
```
5050
```TypeScript

modules/angular2/manual_typings/traceur-runtime.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
interface PromiseLike<T> extends Thenable<T> {}
1616

1717
// Extend the ES5 standard library with some ES6 features we polyfill at runtime
18-
// by loading traceur-runtime.js
18+
// by loading es6-shim.js
1919

2020
// These are mostly copied from lib.es6.d.ts
2121

modules/angular2/src/http/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Index to be used if Http is ever configured as a standalone npm package.
22
// require('reflect-metadata');
3-
// require('traceur-runtime');
3+
// require('es6-shim');
44
// import {HTTP_BINDINGS, JSONP_BINDINGS, Http, Jsonp} from './http';
55
// import {Injector} from 'angular2/angular2';
66
// export * from './http';

modules/benchpress/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require('reflect-metadata');
2-
require('traceur/bin/traceur-runtime');
2+
require('es6-shim');
33
module.exports = require('./benchpress.js');
44
// when bundling benchpress to one file, this is used
55
// for getting exports out of browserify's scope.

modules/benchpress/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"repository": <%= JSON.stringify(packageJson.repository) %>,
1111
"dependencies": {
1212
"angular2": "<%= packageJson.version %>",
13-
"traceur": "<%= packageJson.dependencies.traceur %>",
1413
"selenium-webdriver": "<%= packageJson.dependencies['selenium-webdriver'] %>",
1514
"reflect-metadata": "<%= packageJson.dependencies['reflect-metadata'] %>"
1615
},

modules/benchpress/test/firefox_extension/conf.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// <reference path="../../../angular2/typings/node/node.d.ts" />
2-
require('traceur/bin/traceur-runtime.js');
2+
require('es6-shim/es6-shim.js');
33
require('reflect-metadata');
44
var testHelper = require('../../src/firefox_extension/lib/test_helper.js');
55

0 commit comments

Comments
 (0)