Skip to content

Commit f5090b4

Browse files
committed
fix(Rx): remove kitchenSink and DOM, let Rx export all
closes #1650 BREAKING CHANGE: `Rx.kitchenSink` and `Rx.DOM` are removed, `Rx` export everything.
1 parent 56a12ba commit f5090b4

File tree

80 files changed

+130
-173
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+130
-173
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Thank you very much for your pull request!
33
44
If your PR is the addition of a new operator, please make sure all these boxes are ticked with an x:
55
6-
- [ ] Add the operator to either Core or KitchenSink
6+
- [ ] Add the operator to Rx
77
- [ ] It must have a `-spec.ts` tests file covering the canonical corner cases, with marble diagram tests
88
- [ ] If possible, write a `asDiagram` test case too, for PNG diagram generation purposes
99
- [ ] The spec file should have a type definition test at the end of the spec to verify type definition for various use cases

doc/operator-creation.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Operator Creation
22

3-
There are many ways to create an operator for RxJS. In this version of RxJS, performance was the primary consideration, as such, operator creation
4-
in a way that adheres to the existing structures in this library may not be straight forward. This is an attempt to document how to
3+
There are many ways to create an operator for RxJS. In this version of RxJS, performance was the primary consideration, as such, operator creation
4+
in a way that adheres to the existing structures in this library may not be straight forward. This is an attempt to document how to
55
create an operator either for yourself, or for this library.
66

77
For how to develop a custom operator for *this* library, [see below](#advanced).
@@ -11,20 +11,20 @@ For how to develop a custom operator for *this* library, [see below](#advanced).
1111

1212
### Guidelines
1313

14-
In the most common case, users might like to create an operator to be used only by their app. These can be developed in
14+
In the most common case, users might like to create an operator to be used only by their app. These can be developed in
1515
any way the developer sees fit, but here are some guidelines:
1616

1717
1. __Operators should always return an Observable__. You're performing operations on unknown sets of things to create new sets.
1818
It only makes sense to return a new set. If you create a method that returns something other than an Observable, it's not an operator,
1919
and that's fine.
2020
2. __Be sure to manage subscriptions__ created inside of the Observable your operator returns. Your operator is going to have to
21-
subscribe to the source (or `this`) inside of the returned Observable, be sure that it's returned as part of unsubscribe handler or
21+
subscribe to the source (or `this`) inside of the returned Observable, be sure that it's returned as part of unsubscribe handler or
2222
subscription.
23-
3. __Be sure to handle exceptions from passed functions__. If you're implementing an operator that takes a function as an argument,
23+
3. __Be sure to handle exceptions from passed functions__. If you're implementing an operator that takes a function as an argument,
2424
when you call it, you'll want to wrap it in a `try/catch` and send the error down the `error()` path on the observable.
2525
4. __Be sure to teardown scarce resources__ in your unsubscribe handler of your returned Observable. If you're setting up event handlers
2626
or a web socket, or something like that, the unsubscribe handler is a great place to remove that event handler or close that socket.
27-
27+
2828

2929

3030
<!-- share-code-between-examples -->
@@ -36,7 +36,7 @@ function mySimpleOperator(someCallback) {
3636
return Observable.create(subscriber => {
3737
// because we're in an arrow function `this` is from the outer scope.
3838
var source = this;
39-
39+
4040
// save our inner subscription
4141
var subscription = source.subscribe(value => {
4242
// important: catch errors from user-provided callbacks
@@ -45,12 +45,12 @@ function mySimpleOperator(someCallback) {
4545
} catch(err) {
4646
subscriber.error(err);
4747
}
48-
},
48+
},
4949
// be sure to handle errors and completions as appropriate and
5050
// send them along
5151
err => subscriber.error(err),
5252
() => subscriber.complete());
53-
53+
5454
// to return now
5555
return subscription;
5656
});
@@ -77,10 +77,10 @@ class MyObservable extends Observable {
7777
observable.operator = operator;
7878
return observable;
7979
}
80-
80+
8181
// put it here .. or ..
8282
customOperator() {
83-
/* do things and return an Observable */
83+
/* do things and return an Observable */
8484
}
8585
}
8686

@@ -101,11 +101,11 @@ someObservable.mySimpleOperator(x => x + '!');
101101

102102
## <a id="advanced"></a>Creating An Operator For Inclusion In *This* Library
103103

104-
__To create an operator for inclusion in this library, it's probably best to work from prior art__. Something
104+
__To create an operator for inclusion in this library, it's probably best to work from prior art__. Something
105105
like the `filter` operator would be a good start. It's not expected that you'll be able to read
106106
this section and suddenly be an expert operator contributor.
107107

108-
**If you find yourself confused, DO NOT worry. Follow prior examples in the repo, submit a PR, and we'll work with you.**
108+
**If you find yourself confused, DO NOT worry. Follow prior examples in the repo, submit a PR, and we'll work with you.**
109109

110110
Hopefully the information provided here will give context to decisions made while developing operators in this library.
111111
There are a few things to know and (try to) understand while developing operators:
@@ -114,15 +114,15 @@ There are a few things to know and (try to) understand while developing operator
114114
"build their own observable" by pulling in operator methods an adding them to observable in their own module.
115115
It also means operators can be brought in ad-hock and used directly, either with the ES7 function bind operator
116116
in Babel (`::`) or by using it with `.call()`.
117-
2. Every operator has an `Operator` class. The `Operator` class is really a `Subscriber` "factory". It's
118-
what gets passed into the `lift` method to make the "magic" happen. It's sole job is to create the operation's
117+
2. Every operator has an `Operator` class. The `Operator` class is really a `Subscriber` "factory". It's
118+
what gets passed into the `lift` method to make the "magic" happen. It's sole job is to create the operation's
119119
`Subscriber` instance on subscription.
120-
3. Every operator has a `Subscriber` class. This class does *all* of the logic for the operation. It's job is to
121-
handle values being nexted in (generally by overriding `_next()`) and forward it along to the `destination`,
120+
3. Every operator has a `Subscriber` class. This class does *all* of the logic for the operation. It's job is to
121+
handle values being nexted in (generally by overriding `_next()`) and forward it along to the `destination`,
122122
which is the next observer in the chain.
123123
- It's important to note that the `destination` Observer set on any `Subscriber` serves as more than just
124124
the destinations for the events passing through, If the `destination` is a `Subscriber` it also is used to set up
125-
a shared underlying `Subscription`, which, in fact, is also a `Subscriber`, and is the first `Subscriber` in the
125+
a shared underlying `Subscription`, which, in fact, is also a `Subscriber`, and is the first `Subscriber` in the
126126
chain.
127127
- Subscribers all have `add` and `remove` methods that are used for adding and removing inner subscriptions to
128128
the shared underlying subscription.
@@ -133,7 +133,7 @@ There are a few things to know and (try to) understand while developing operator
133133

134134
Please complete these steps for each new operator added to RxJS as a pull request:
135135

136-
- Add the operator to either Core or KitchenSink
136+
- Add the operator to Rx
137137
- It must have a `-spec.ts` tests file covering the canonical corner cases, with marble diagram tests
138138
- If possible, write a `asDiagram` test case too, for PNG diagram generation purposes
139139
- The spec file should have a type definition test at the end of the spec to verify type definition for various use cases
@@ -152,7 +152,7 @@ for their `unsubscribe` calls. Meaning if you call `unsubscribe` on them, it mig
152152
not to set the `destination` of inner subscriptions. An example of this might be the switch operators, that have a single underlying
153153
inner subscription that needs to unsubscribe independent of the main subscription.
154154

155-
If you find yourself creating inner subscriptions, it might also be worth checking to see if the observable being passed `_isScalar`,
155+
If you find yourself creating inner subscriptions, it might also be worth checking to see if the observable being passed `_isScalar`,
156156
because if it is, you can pull the `value` out of it directly and improve the performance of your operator when it's operating over
157157
scalar observables. For reference a scalar observable is any observable that has a single static value underneath it. `Observable.of('foo')` will
158158
return a `ScalarObservable`, likewise, resolved `PromiseObservable`s will act as scalars.

doc/scripts/setup-rx-script.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

esdoc.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
"title": "RxJS",
1111
"styles": ["./doc/styles/main.css"],
1212
"scripts": [
13-
"./dist/global/Rx.KitchenSink.umd.js",
13+
"./dist/global/Rx.umd.js",
1414
"./doc/asset/devtools-welcome.js",
1515
"./doc/scripts/custom-manual-styles.js",
16-
"./doc/decision-tree-widget/dist/decision-tree-widget.min.js",
17-
"./doc/scripts/setup-rx-script.js"
16+
"./doc/decision-tree-widget/dist/decision-tree-widget.min.js"
1817
],
1918
"index": "./doc/index.md",
2019
"plugins": [

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = require('./dist/cjs/Rx.KitchenSink');
1+
module.exports = require('./dist/cjs/Rx');

package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"build_cjs": "Build CJS package with clean up existing build, copy source into dist",
1919
"build_es6": "Build ES6 package with clean up existing build, copy source into dist",
2020
"build_closure_core": "Minify Global core build using closure compiler",
21-
"build_closure_kitchensink": "Minify Global kitchenSink build using closure compiler",
22-
"build_global": "Build Global package, then minify core & kitchensink build",
21+
"build_global": "Build Global package, then minify build",
2322
"build_perf": "Build CJS & Global build, run macro performance test",
2423
"build_test": "Build CJS package & test spec, execute mocha test runner",
2524
"build_cover": "Run lint to current code, build CJS & test spec, execute test coverage",
@@ -55,8 +54,7 @@
5554
"build_es6": "npm-run-all clean_dist_es6 copy_src_es6 compile_dist_es6",
5655
"build_es6_for_docs": "npm-run-all clean_dist_es6 copy_src_es6 compile_dist_es6_for_docs",
5756
"build_closure_core": "java -jar ./node_modules/google-closure-compiler/compiler.jar --js ./dist/global/Rx.umd.js --language_in ECMASCRIPT5 --create_source_map ./dist/global/Rx.umd.min.js.map --js_output_file ./dist/global/Rx.umd.min.js",
58-
"build_closure_kitchensink": "java -jar ./node_modules/google-closure-compiler/compiler.jar --js ./dist/global/Rx.KitchenSink.umd.js --language_in ECMASCRIPT5 --create_source_map ./dist/global/Rx.KitchenSink.umd.min.js.map --js_output_file ./dist/global/Rx.KitchenSink.umd.min.js",
59-
"build_global": "rm -rf ./dist/global && mkdirp ./dist/global && node tools/make-umd-bundle.js && node tools/make-system-bundle.js && npm-run-all build_closure_core build_closure_kitchensink",
57+
"build_global": "rm -rf ./dist/global && mkdirp ./dist/global && node tools/make-umd-bundle.js && node tools/make-system-bundle.js && npm-run-all build_closure_core",
6058
"build_perf": "webdriver-manager update && npm-run-all build_cjs build_global perf",
6159
"build_test": "rm -rf ./dist/ && npm-run-all lint build_cjs clean_spec build_spec test_mocha",
6260
"build_cover": "rm -rf ./dist/ && npm-run-all lint build_cjs build_spec cover",
@@ -72,12 +70,12 @@
7270
"copy_src_cjs": "mkdirp ./dist/cjs/src && cp -r ./src/* ./dist/cjs/src",
7371
"copy_src_es6": "mkdirp ./dist/es6/src && cp -r ./src/* ./dist/es6/src",
7472
"commit": "git-cz",
75-
"compile_dist_amd": "tsc typings/main/ambient/es6-shim/index.d.ts ./dist/amd/src/Rx.ts ./dist/amd/src/Rx.KitchenSink.ts ./dist/amd/src/Rx.DOM.ts ./dist/amd/src/add/observable/of.ts -m amd --sourceMap --outDir ./dist/amd --target ES5 --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors --moduleResolution node",
76-
"compile_dist_cjs": "tsc typings/main/ambient/es6-shim/index.d.ts ./dist/cjs/src/Rx.ts ./dist/cjs/src/Rx.KitchenSink.ts ./dist/cjs/src/Rx.DOM.ts ./dist/cjs/src/add/observable/of.ts -m commonjs --sourceMap --outDir ./dist/cjs --target ES5 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors --moduleResolution node",
77-
"compile_dist_es6": "tsc ./dist/es6/src/Rx.ts ./dist/es6/src/Rx.KitchenSink.ts ./dist/es6/src/Rx.DOM.ts ./dist/es6/src/add/observable/of.ts -m es2015 --sourceMap --outDir ./dist/es6 --target ES6 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors --moduleResolution node",
78-
"compile_dist_es6_for_docs": "tsc ./dist/es6/src/Rx.ts ./dist/es6/src/Rx.KitchenSink.ts ./dist/es6/src/Rx.DOM.ts ./dist/es6/src/add/observable/of.ts ./dist/es6/src/MiscJSDoc.ts -m es2015 --sourceMap --outDir ./dist/es6 --target ES6 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors --moduleResolution node",
73+
"compile_dist_amd": "tsc typings/main/ambient/es6-shim/index.d.ts ./dist/amd/src/Rx.ts ./dist/amd/src/add/observable/of.ts -m amd --sourceMap --outDir ./dist/amd --target ES5 --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors --moduleResolution node",
74+
"compile_dist_cjs": "tsc typings/main/ambient/es6-shim/index.d.ts ./dist/cjs/src/Rx.ts ./dist/cjs/src/add/observable/of.ts -m commonjs --sourceMap --outDir ./dist/cjs --target ES5 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors --moduleResolution node",
75+
"compile_dist_es6": "tsc ./dist/es6/src/Rx.ts ./dist/es6/src/add/observable/of.ts -m es2015 --sourceMap --outDir ./dist/es6 --target ES6 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors --moduleResolution node",
76+
"compile_dist_es6_for_docs": "tsc ./dist/es6/src/Rx.ts ./dist/es6/src/add/observable/of.ts ./dist/es6/src/MiscJSDoc.ts -m es2015 --sourceMap --outDir ./dist/es6 --target ES6 -d --diagnostics --pretty --noImplicitAny --suppressImplicitAnyIndexErrors --moduleResolution node",
7977
"cover": "npm-run-all cover_test cover_remapping",
80-
"cover_test": "rm -rf dist/cjs && tsc typings/main/ambient/es6-shim/index.d.ts src/Rx.ts src/Rx.KitchenSink.ts src/Rx.DOM.ts src/add/observable/of.ts -m commonjs --outDir dist/cjs --sourceMap --target ES5 -d && istanbul cover -x \"spec-js/**/*\" -x \"mocha-setup-node.js\" ./node_modules/mocha/bin/_mocha -- --opts spec/support/default.opts spec-js",
78+
"cover_test": "rm -rf dist/cjs && tsc typings/main/ambient/es6-shim/index.d.ts src/Rx.ts src/add/observable/of.ts -m commonjs --outDir dist/cjs --sourceMap --target ES5 -d && istanbul cover -x \"spec-js/**/*\" -x \"mocha-setup-node.js\" ./node_modules/mocha/bin/_mocha -- --opts spec/support/default.opts spec-js",
8179
"cover_remapping": "remap-istanbul -i coverage/coverage.json -o coverage/coverage-remapped.json && remap-istanbul -i coverage/coverage.json -o coverage/coverage-remapped.lcov -t lcovonly && remap-istanbul -i coverage/coverage.json -o coverage/coverage-remapped -t html",
8280
"decision_tree_widget": "cd doc/decision-tree-widget && npm run build && cd ../..",
8381
"generate_packages": "node .make-packages.js",

perf/micro/immediate-scheduler/operators/distinct-keyselector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var RxOld = require('rx');
2-
var RxNew = require('../../../../dist/cjs/Rx.KitchenSink');
2+
var RxNew = require('../../../../dist/cjs/Rx');
33

44
module.exports = function (suite) {
55
var source = Array.from({ length: 25 }, function (_, i) { return { value: i % 3 }; });

perf/micro/immediate-scheduler/operators/distinct.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var RxOld = require('rx');
2-
var RxNew = require('../../../../dist/cjs/Rx.KitchenSink');
2+
var RxNew = require('../../../../dist/cjs/Rx');
33

44
module.exports = function (suite) {
55
var source = Array.from({ length: 25 }, function (_, i) { return i % 3; });

spec/helpers/test-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
declare const global: any;
33
declare const Symbol: any;
44

5-
import * as Rx from '../../dist/cjs/Rx.KitchenSink';
5+
import * as Rx from '../../dist/cjs/Rx';
66
import {root} from '../../dist/cjs/util/root';
77

88
export function lowerCaseO<T>(...args): Rx.Observable<T> {

spec/helpers/testScheduler-ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as escapeRe from 'escape-string-regexp';
77
import * as chai from 'chai';
88
import * as sinonChai from 'sinon-chai';
99

10-
import * as Rx from '../../dist/cjs/Rx.KitchenSink';
10+
import * as Rx from '../../dist/cjs/Rx';
1111
import * as marble from './marble-testing';
1212

1313
//setup sinon-chai

0 commit comments

Comments
 (0)