refactor(facade): use rxjs package

move to new RxJS distribution.

BREAKING CHANGE:

RxJS imports now are via `rxjs` instead of `@reactivex/rxjs`
Individual operators can be imported `import 'rxjs/operators/map'`
This commit is contained in:
Rob Wormald 2015-11-30 17:22:52 -08:00 committed by Jeremy Elbourn
parent a16ac84840
commit 5514dc19d9
16 changed files with 42 additions and 69 deletions

View File

@ -146,7 +146,7 @@ var BENCHPRESS_BUNDLE_CONFIG = {
packageJson: './dist/js/cjs/benchpress/package.json',
includes: ['angular2'],
excludes: ['reflect-metadata', 'selenium-webdriver', 'zone.js'],
ignore: ['@reactivex/rxjs'],
ignore: [],
dest: CONFIG.dest.benchpress_bundle
};
@ -815,8 +815,7 @@ gulp.task('static-checks', ['!build.tools'], function(done) {
// Make sure the two typings tests are isolated, by running this one in a tempdir
var tmpdir = path.join(os.tmpdir(), 'test.typings', new Date().getTime().toString());
gulp.task('!pre.test.typings.layoutNodeModule', ['build.js.cjs'], function() {
return gulp.src(['dist/js/cjs/angular2/**/*', 'node_modules/@reactivex/rxjs/dist/cjs/**'],
{base: 'dist/js/cjs'})
return gulp.src(['dist/js/cjs/angular2/**/*', 'node_modules/rxjs/**'], {base: 'dist/js/cjs'})
.pipe(gulp.dest(path.join(tmpdir, 'node_modules')));
});
gulp.task('!pre.test.typings.copyTypingsSpec', function() {
@ -1152,9 +1151,11 @@ var JS_DEV_DEPS = [
// Splice in RX license if rx is in the bundle.
function insertRXLicense(source) {
var n = source.indexOf('System.register("@reactivex/rxjs/dist/cjs/Subject"');
var n = source.indexOf('System.register("rxjs/Subject"');
if (n >= 0) {
var rxLicense = licenseWrap('node_modules/@reactivex/rxjs/LICENSE.txt');
// TODO: point this to Rx once Rx includes license in dist
// https://github.com/angular/angular/issues/5558
var rxLicense = licenseWrap('LICENSE');
return source.slice(0, n) + rxLicense + source.slice(n);
} else {
return source;

View File

@ -25,7 +25,7 @@ module.exports = function(config) {
// Including systemjs because it defines `__eval`, which produces correct stack traces.
'modules/angular2/src/testing/shims_for_IE.js',
'node_modules/systemjs/dist/system.src.js',
{pattern: 'node_modules/@reactivex/rxjs/**', included: false, watched: false, served: true},
{pattern: 'node_modules/rxjs/**', included: false, watched: false, served: true},
'node_modules/reflect-metadata/Reflect.js',
'tools/build/file2modulename.js',
'test-main.js',

View File

@ -9,7 +9,7 @@
"repository": <%= JSON.stringify(packageJson.repository) %>,
"dependencies": {
"reflect-metadata": "<%= packageJson.dependencies['reflect-metadata'] %>",
"@reactivex/rxjs": "<%= packageJson.dependencies['@reactivex/rxjs'] %>",
"rxjs": "<%= packageJson.dependencies['rxjs'] %>",
"zone.js": "<%= packageJson.dependencies['zone.js'] %>"
},
"devDependencies": <%= JSON.stringify(packageJson.defaultDevDependencies) %>

View File

@ -4,11 +4,16 @@ import {global, isPresent, noop} from 'angular2/src/facade/lang';
import {PromiseWrapper, Promise, PromiseCompleter} from 'angular2/src/facade/promise';
export {PromiseWrapper, Promise, PromiseCompleter} from 'angular2/src/facade/promise';
import {Subject} from '@reactivex/rxjs/dist/cjs/Subject';
import {Observable as RxObservable} from '@reactivex/rxjs/dist/cjs/Observable';
import {Subscription} from '@reactivex/rxjs/dist/cjs/Subscription';
import {Operator} from '@reactivex/rxjs/dist/cjs/Operator';
export {Subject} from '@reactivex/rxjs/dist/cjs/Subject';
import {Subject} from 'rxjs/Subject';
import {Observable as RxObservable} from 'rxjs/Observable';
import {Subscription} from 'rxjs/Subscription';
import {Operator} from 'rxjs/Operator';
import 'rxjs/observable/fromPromise';
import 'rxjs/operators/toPromise';
export {Subject} from 'rxjs/Subject';
export namespace NodeJS {

View File

@ -5,7 +5,8 @@ import {ReadyStates} from '../enums';
import {Connection, ConnectionBackend} from '../interfaces';
import {isPresent} from 'angular2/src/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/facade/exceptions';
import {Subject, ReplaySubject} from '@reactivex/rxjs/dist/cjs/Rx';
import {Subject} from 'rxjs/Subject';
import {ReplaySubject} from 'rxjs/subjects/ReplaySubject';
/**
*

View File

@ -9,7 +9,7 @@
"repository": <%= JSON.stringify(packageJson.repository) %>,
"dependencies": {
"angular2": "<%= packageJson.version %>",
"@reactivex/rxjs": "<%= packageJson.dependencies['@reactivex/rxjs'] %>",
"rxjs": "<%= packageJson.dependencies['rxjs'] %>",
"reflect-metadata": "<%= packageJson.dependencies['reflect-metadata'] %>"
},
"devDependencies": <%= JSON.stringify(packageJson.defaultDevDependencies) %>

View File

@ -29,7 +29,8 @@ import {
Http,
Jsonp
} from 'angular2/http';
import {Observable, Subject} from '@reactivex/rxjs/dist/cjs/Rx';
import {Observable} from 'rxjs/Observable';
import {Subject} from 'rxjs/Subject';
class SpyObserver extends SpyObject {
onNext: Function;

View File

@ -689,47 +689,12 @@ var NG_ALL = [
'EventEmitter.emit():js',
'Observable:js',
'Observable#create():js',
'Observable.buffer():js',
'Observable.bufferCount():js',
'Observable.bufferTime():js',
'Observable.bufferToggle():js',
'Observable.bufferWhen():js',
'Observable.catch():js',
'Observable.combineAll():js',
'Observable.combineLatest():js',
'Observable.concat():js',
'Observable.concatAll():js',
'Observable.concatMap():js',
'Observable.concatMapTo():js',
'Observable.count():js',
'Observable.debounce():js',
'Observable.debounceTime():js',
'Observable.defaultIfEmpty():js',
'Observable.delay():js',
'Observable.dematerialize():js',
'Observable.distinctUntilChanged():js',
'Observable.do():js',
'Observable.every():js',
'Observable.expand():js',
'Observable.filter():js',
'Observable.finally():js',
'Observable.first():js',
'Observable.flatMap():js',
'Observable.flatMapTo():js',
'Observable.forEach():js',
'Observable.groupBy():js',
'Observable.ignoreElements():js',
'Observable.last():js',
'Observable#fromPromise():js',
'Observable.lift():js',
'Observable.map():js',
'Observable.mapTo():js',
'Observable.materialize():js',
'Observable.merge():js',
'Observable.mergeAll():js',
'Observable.mergeMap():js',
'Observable.mergeMapTo():js',
'Observable.multicast():js',
'Observable.observeOn():js',
'Observable.subscribe():js',
'Observable.take():js',
'Observable.toPromise():js',
'OutputMetadata',
'OutputMetadata.bindingPropertyName',

View File

@ -9,7 +9,7 @@
"repository": <%= JSON.stringify(packageJson.repository) %>,
"dependencies": {
"angular2": "<%= packageJson.version %>",
"@reactivex/rxjs": "<%= packageJson.dependencies['@reactivex/rxjs'] %>",
"rxjs": "<%= packageJson.dependencies['rxjs'] %>",
"zone.js": "<%= packageJson.dependencies['zone.js'] %>"
},
"devDependencies": <%= JSON.stringify(packageJson.defaultDevDependencies) %>

View File

@ -1,8 +1,5 @@
{
"dependencies": {
"@reactivex/rxjs": {
"version": "5.0.0-alpha.10"
},
"angular": {
"version": "1.4.7"
},
@ -13184,6 +13181,9 @@
}
}
},
"rxjs": {
"version": "5.0.0-alpha.11"
},
"selenium-webdriver": {
"version": "2.48.2",
"dependencies": {

12
npm-shrinkwrap.json generated
View File

@ -2,11 +2,6 @@
"name": "angular-srcs",
"version": "2.0.0-alpha.46",
"dependencies": {
"@reactivex/rxjs": {
"version": "5.0.0-alpha.10",
"from": "@reactivex/rxjs@5.0.0-alpha.10",
"resolved": "http://registry.npmjs.org/@reactivex/rxjs/-/rxjs-5.0.0-alpha.10.tgz"
},
"angular": {
"version": "1.4.7",
"from": "https://registry.npmjs.org/angular/-/angular-1.4.7.tgz",
@ -20211,6 +20206,11 @@
}
}
},
"rxjs": {
"version": "5.0.0-alpha.11",
"from": "http://registry.npmjs.org/rxjs/-/rxjs-5.0.0-alpha.11.tgz",
"resolved": "http://registry.npmjs.org/rxjs/-/rxjs-5.0.0-alpha.11.tgz"
},
"selenium-webdriver": {
"version": "2.48.2",
"from": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-2.48.2.tgz",
@ -20341,7 +20341,7 @@
},
"source-map-loader": {
"version": "0.1.5",
"from": "source-map-loader@*",
"from": "source-map-loader@>=0.1.5 <0.2.0",
"resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-0.1.5.tgz",
"dependencies": {
"loader-utils": {

View File

@ -31,8 +31,8 @@
"test": "gulp test.all.js && gulp test.all.dart"
},
"dependencies": {
"@reactivex/rxjs": "5.0.0-alpha.10",
"reflect-metadata": "0.1.2",
"rxjs": "^5.0.0-alpha.11",
"zone.js": "0.5.8"
},
"devDependencies": {

View File

@ -14,7 +14,7 @@ System.config({
'benchpress/*': 'dist/js/dev/es5/benchpress/*.js',
'angular2/*': 'dist/js/dev/es5/angular2/*.js',
'angular2_material/*': 'dist/js/dev/es5/angular2_material/*.js',
'@reactivex/rxjs/*': 'node_modules/@reactivex/rxjs/*.js'
'rxjs/*': 'node_modules/rxjs/*.js'
}
});

View File

@ -17,7 +17,7 @@ class CheckImports implements DiffingBroccoliPlugin {
"angular2/src/core",
"angular2/src/facade",
],
"angular2/src/facade": ["angular2/src/facade", "@reactivex/rxjs"],
"angular2/src/facade": ["angular2/src/facade", "rxjs"],
"angular2/src/common": ["angular2/core", "angular2/src/facade", "angular2/src/common"]
//"angular2/src/render": [
// "angular2/animate",

View File

@ -263,7 +263,7 @@ class CustomLanguageServiceHost implements ts.LanguageServiceHost {
} else if (this.compilerOptions.moduleResolution === ts.ModuleResolutionKind.NodeJs &&
tsFilePath.match(/^node_modules/)) {
absoluteTsFilePath = path.resolve(tsFilePath);
} else if (tsFilePath.match(/^@reactivex/)) {
} else if (tsFilePath.match(/^rxjs/)) {
absoluteTsFilePath = path.resolve('node_modules', tsFilePath);
} else {
absoluteTsFilePath = path.join(this.treeInputPath, tsFilePath);

View File

@ -279,7 +279,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
// typescript resolves dependencies automatically
if (modules.bundle_deps) {
var nodeModules = new Funnel(
'node_modules', {include: ['@reactivex/**/**', 'parse5/**/**', 'css/**/**'], destDir: '/'});
'node_modules', {include: ['rxjs/**/**', 'parse5/**/**', 'css/**/**'], destDir: '/'});
}
if (generateEs6) {