Skip to content

Commit

Permalink
Patially revert: "build: explore updating to rxjs 7"
Browse files Browse the repository at this point in the history
  • Loading branch information
gkalpak committed Jun 25, 2021
1 parent 096de87 commit 1188781
Show file tree
Hide file tree
Showing 30 changed files with 48 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// #enddocregion upgrade-static-umd

// other libraries
'rxjs': 'npm:rxjs/dist/cjs',
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
},
// packages tells the System loader how to load when no filename and/or no extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// #enddocregion paths

// other libraries
'rxjs': 'npm:rxjs/dist/cjs',
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
// #docregion paths
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

// other libraries
'rxjs': 'npm:rxjs/dist/cjs',
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api',
},
// packages tells the System loader how to load when no filename and/or no extension
Expand Down
2 changes: 1 addition & 1 deletion aio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"@angular/router": "12.0.5",
"@angular/service-worker": "12.0.5",
"@webcomponents/custom-elements": "1.4.3",
"rxjs": "^7.0.0-rc.2",
"rxjs": "^6.6.7",
"tslib": "^2.2.0",
"zone.js": "~0.11.4"
},
Expand Down
2 changes: 1 addition & 1 deletion aio/src/app/layout/notification/notification.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class NotificationComponent implements OnInit {
@Input() dismissOnContentClick: boolean;
@Input() notificationId: string;
@Input() expirationDate: string;
@Output() dismissed = new EventEmitter<void>();
@Output() dismissed = new EventEmitter();

@HostBinding('@hideAnimation')
showNotification: 'show'|'hide';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'@angular/upgrade/static': 'npm:@angular/upgrade/bundles/upgrade-static.umd.js',

// other libraries
'rxjs': 'npm:rxjs/dist/cjs',
'rxjs': 'npm:rxjs',
'tslib': 'npm:tslib/tslib.js',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
},
Expand Down
36 changes: 5 additions & 31 deletions aio/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10811,34 +10811,13 @@ run-parallel@^1.1.9:
dependencies:
queue-microtask "^1.2.2"

run-queue@^1.0.0, run-queue@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47"
integrity sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=
dependencies:
aproba "^1.1.1"

rxjs@6.6.3:
version "6.6.3"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552"
integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==
dependencies:
tslib "^1.9.0"

rxjs@^6.4.0, rxjs@^6.5.3, rxjs@^6.6.0:
rxjs@6.6.7, rxjs@^6.4.0, rxjs@^6.5.3, rxjs@^6.6.6, rxjs@^6.6.7:
version "6.6.7"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9"
integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==
dependencies:
tslib "^1.9.0"

rxjs@^7.0.0-rc.2:
version "7.0.0-rc.2"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.0.0-rc.2.tgz#bd5b18ff9b60ca28ea4b3a824419035007064fdf"
integrity sha512-81+TFxK8hUK3tmJ9TPon07bgun2ASgZ8OXumUuWSAnktSAzTvubw4NCJTr0Tc0lO9IfTThi5z3GDVlmjY3n5ug==
dependencies:
tslib "~2.1.0"

safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
Expand Down Expand Up @@ -12173,15 +12152,10 @@ ts-node@^10.0.0:
source-map-support "^0.5.17"
yn "3.1.1"

ts-pnp@^1.1.6:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92"
integrity sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==

tslib@2.1.0, tslib@^2.0.0, tslib@^2.0.1, tslib@^2.1.0, tslib@~2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==
tslib@2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==

tslib@^1.10.0, tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0:
version "1.14.1"
Expand Down
1 change: 0 additions & 1 deletion goldens/public-api/core/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ export declare class ErrorHandler {
export declare interface EventEmitter<T> extends Subject<T> {
new (isAsync?: boolean): EventEmitter<T>;
emit(value?: T): void;
next(value?: T): void;
subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;
subscribe(observerOrNext?: any, error?: any, complete?: any): Subscription;
}
Expand Down
6 changes: 3 additions & 3 deletions integration/bazel/src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package(default_visibility = ["//visibility:public"])

load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
load("@npm//http-server:index.bzl", "http_server")
load("@npm//@angular/bazel:index.bzl", "ng_module")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load("@npm//@bazel/terser:index.bzl", "terser_minified")
load("@npm//@bazel/concatjs:index.bzl", "concatjs_devserver")

package(default_visibility = ["//visibility:public"])

# Allow targets under sub-packages to reference the tsconfig.json file
exports_files(["tsconfig.json"])

Expand All @@ -30,7 +30,7 @@ filegroup(
name = "rxjs_umd_modules",
srcs = [
# do not sort
"@npm//:node_modules/rxjs/dist/bundles/rxjs.umd.js",
"@npm//:node_modules/rxjs/bundles/rxjs.umd.js",
":rxjs_shims.js",
],
)
Expand Down
4 changes: 2 additions & 2 deletions integration/hello_world__systemjs_umd/src/systemjs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic':
'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'rxjs': 'npm:rxjs/dist/cjs',
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ts': 'npm:plugin-typescript/lib/plugin.js',
'typescript': 'npm:typescript/lib/typescript.js',
Expand All @@ -42,4 +42,4 @@
'rxjs': { main: 'index.js', defaultExtension: 'js' },
}
});
})(this);
})(this);
4 changes: 2 additions & 2 deletions modules/benchmarks/src/bootstrap_ng2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function benchmarksBootstrap() {
'/packages-dist/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/upgrade': '/packages-dist/upgrade/bundles/upgrade.umd.js',
'@angular/router': '/packages-dist/router/bundles/router.umd.js',
'rxjs': '/all/benchmarks/vendor/rxjs/dist/cjs',
'rxjs': '/all/benchmarks/vendor/rxjs',
},
packages: {
'rxjs/ajax': {main: 'index.js', defaultExtension: 'js'},
Expand All @@ -52,7 +52,7 @@ function benchmarksBootstrap() {

System.config({
defaultJSExtensions: true,
map: {'@angular': '/all/@angular', 'rxjs': '/all/benchmarks/vendor/rxjs/dist/cjs'},
map: {'@angular': '/all/@angular', 'rxjs': '/all/benchmarks/vendor/rxjs'},
packages: {
'@angular/core': {main: 'index.js', defaultExtension: 'js'},
'@angular/animations': {main: 'index.js', defaultExtension: 'js'},
Expand Down
2 changes: 1 addition & 1 deletion modules/playground/src/routing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ts_devserver(
# there is only one RxJS UMD bundle that re-exports everything at the root.
"//modules/playground:systemjs-rxjs-operators.js",
"//third_party/fonts.google.com/open-sans",
"@npm//:node_modules/rxjs/dist/bundles/rxjs.umd.js",
"@npm//:node_modules/rxjs/bundles/rxjs.umd.js",
"@npm//:node_modules/tslib/tslib.js",
"//packages/zone.js/bundles:zone.umd.js",
"index.html",
Expand Down
2 changes: 1 addition & 1 deletion modules/playground/systemjs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const angularPackages = [
const packagesConfig = {};
const mapConfig = {
'tslib': 'npm/node_modules/tslib/tslib.js',
'rxjs': 'npm/node_modules/rxjs/dist/bundles/rxjs.umd.js',
'rxjs': 'npm/node_modules/rxjs/bundles/rxjs.umd.js',
'rxjs/operators': 'angular/modules/playground/systemjs-rxjs-operators.js',
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"rxjs": "^7.0.0-rc.2",
"rxjs": "^6.5.3",
"selenium-webdriver": "3.5.0",
"shelljs": "^0.8.4",
"source-map": "^0.6.1",
Expand Down
3 changes: 1 addition & 2 deletions packages/common/http/test/client_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import {HttpClient} from '@angular/common/http/src/client';
import {HttpErrorResponse, HttpEventType, HttpResponse, HttpStatusCode} from '@angular/common/http/src/response';
import {HttpClientTestingBackend} from '@angular/common/http/testing/src/backend';
import {firstValueFrom} from 'rxjs';
import {toArray} from 'rxjs/operators';

{
Expand Down Expand Up @@ -107,7 +106,7 @@ import {toArray} from 'rxjs/operators';
backend.expectOne('/test').flush(body);
});
it('that returns a stream of events', done => {
firstValueFrom(client.get('/test', {observe: 'events'}).pipe(toArray())).then(events => {
client.get('/test', {observe: 'events'}).pipe(toArray()).toPromise().then(events => {
expect(events.length).toBe(2);
let x = HttpResponse;
expect(events[0].type).toBe(HttpEventType.Sent);
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"peerDependencies": {
"@angular/core": "0.0.0-PLACEHOLDER",
"rxjs": "^7.0.0-rc.2"
"rxjs": "^6.5.3"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"tslib": "^2.2.0"
},
"peerDependencies": {
"rxjs": "^7.0.0-rc.2",
"rxjs": "^6.5.3",
"zone.js": "~0.11.4"
},
"repository": {
Expand Down
12 changes: 1 addition & 11 deletions packages/core/src/event_emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

/// <reference types="rxjs/dist/types" />
/// <reference types="rxjs" />

import {PartialObserver, Subject, Subscription} from 'rxjs';

Expand Down Expand Up @@ -82,12 +82,6 @@ export interface EventEmitter<T> extends Subject<T> {
*/
emit(value?: T): void;

/**
* Emits an event containing a given value.
* @param value The value to emit.
*/
next(value?: T): void; // Backwards compat for calls with zero arguments.

/**
* Registers handlers for events emitted by this instance.
* @param next When supplied, a custom handler for emitted events.
Expand Down Expand Up @@ -120,10 +114,6 @@ class EventEmitter_ extends Subject<any> {
super.next(value);
}

next(value?: any) {
super.next(value);
}

subscribe(observerOrNext?: any, error?: any, complete?: any): Subscription {
let nextFn = observerOrNext;
let errorFn = error || (() => null);
Expand Down
2 changes: 1 addition & 1 deletion packages/elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"peerDependencies": {
"@angular/core": "0.0.0-PLACEHOLDER",
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
"rxjs": "^7.0.0-rc.2"
"rxjs": "^6.5.3"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/forms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@angular/core": "0.0.0-PLACEHOLDER",
"@angular/common": "0.0.0-PLACEHOLDER",
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
"rxjs": "^7.0.0-rc.2"
"rxjs": "^6.5.3"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/misc/angular-in-memory-web-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"peerDependencies": {
"@angular/core": "^12.0.0-next.6",
"@angular/common": "^12.0.0-next.6",
"rxjs": "^7.0.0-rc.2"
"rxjs": "^6.5.3"
},
"dependencies": {
"tslib": "^2.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/router/karma-test-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ System.config({
System.config({
map: {
'@angular': 'dist/all/@angular',
'rxjs': 'node_modules/rxjs/dist/cjs',
'rxjs': 'node_modules/rxjs',
},
packages: {
'@angular/core/testing': {main: 'index.js', defaultExtension: 'js'},
Expand Down
2 changes: 1 addition & 1 deletion packages/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@angular/core": "0.0.0-PLACEHOLDER",
"@angular/common": "0.0.0-PLACEHOLDER",
"@angular/platform-browser": "0.0.0-PLACEHOLDER",
"rxjs": "^7.0.0-rc.2"
"rxjs": "^6.5.3"
},
"ng-update": {
"packageGroup": "NG_UPDATE_PACKAGE_GROUP"
Expand Down
7 changes: 4 additions & 3 deletions packages/service-worker/src/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {Injectable} from '@angular/core';
import {lastValueFrom, merge, NEVER, Observable, Subject} from 'rxjs';
import {merge, NEVER, Observable, Subject} from 'rxjs';
import {map, switchMap, take} from 'rxjs/operators';

import {ERR_SW_NOT_SUPPORTED, NgswCommChannel, PushEvent} from './low_level';
Expand Down Expand Up @@ -174,7 +174,8 @@ export class SwPush {
}
pushOptions.applicationServerKey = applicationServerKey;

return lastValueFrom(this.pushManager.pipe(switchMap(pm => pm.subscribe(pushOptions)), take(1)))
return this.pushManager.pipe(switchMap(pm => pm.subscribe(pushOptions)), take(1))
.toPromise()
.then(sub => {
this.subscriptionChanges.next(sub);
return sub;
Expand Down Expand Up @@ -206,7 +207,7 @@ export class SwPush {
});
};

return lastValueFrom(this.subscription.pipe(take(1), switchMap(doUnsubscribe)));
return this.subscription.pipe(take(1), switchMap(doUnsubscribe)).toPromise();
}

private decodeBase64(input: string): string {
Expand Down
13 changes: 9 additions & 4 deletions packages/service-worker/test/integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {Manifest} from '@angular/service-worker/worker/src/manifest';
import {MockRequest} from '@angular/service-worker/worker/testing/fetch';
import {MockFileSystemBuilder, MockServerStateBuilder, tmpHashTableForFs} from '@angular/service-worker/worker/testing/mock';
import {SwTestHarness, SwTestHarnessBuilder} from '@angular/service-worker/worker/testing/scope';
import {firstValueFrom} from 'rxjs';
import {Observable} from 'rxjs';
import {take} from 'rxjs/operators';

(function() {
// Skip environments that don't support the minimum APIs needed to run the SW tests.
Expand All @@ -28,6 +29,10 @@ const dist = new MockFileSystemBuilder().addFile('/only.txt', 'this is only').bu

const distUpdate = new MockFileSystemBuilder().addFile('/only.txt', 'this is only v2').build();

function obsToSinglePromise<T>(obs: Observable<T>): Promise<T> {
return obs.pipe(take(1)).toPromise();
}

const manifest: Manifest = {
configVersion: 1,
timestamp: 1234567890123,
Expand Down Expand Up @@ -113,7 +118,7 @@ describe('ngsw + companion lib', () => {
scope.updateServerState(serverUpdate);

const gotUpdateNotice = (async () => {
const notice = await firstValueFrom(update.available);
const notice = await obsToSinglePromise(update.available);
})();

await update.checkForUpdate();
Expand All @@ -125,7 +130,7 @@ describe('ngsw + companion lib', () => {
scope.updateServerState(serverUpdate);

const gotPushNotice = (async () => {
const message = await firstValueFrom(push.messages);
const message = await obsToSinglePromise(push.messages);
expect(message).toEqual({
test: 'success',
});
Expand All @@ -142,7 +147,7 @@ describe('ngsw + companion lib', () => {
scope.updateServerState(serverUpdate);

const gotNotificationClick = (async () => {
const event: any = await firstValueFrom(push.notificationClicks);
const event: any = await obsToSinglePromise(push.notificationClicks);
expect(event.action).toEqual('clicked');
expect(event.notification.title).toEqual('This is a test');
})();
Expand Down

0 comments on commit 1188781

Please sign in to comment.