cleanup(misc): avoid importing rxjs in the core path

This commit is contained in:
Nrwl CI Machine 2021-08-06 13:53:49 -04:00 committed by Victor Savkin
parent 27a665c6c3
commit bc4ec52f53
6 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import { Observable } from 'rxjs';
import type { Observable } from 'rxjs';
import { first, toArray } from 'rxjs/operators';
/**

View File

@ -1,4 +1,4 @@
import { from, Observable } from 'rxjs';
import type { Observable } from 'rxjs';
import type { Executor, ExecutorContext } from '@nrwl/tao/src/shared/workspace';
import { Workspaces } from '@nrwl/tao/src/shared/workspace';
@ -41,9 +41,9 @@ function toObservable<T extends { success: boolean }>(
promiseOrAsyncIterator: Promise<T> | AsyncIterableIterator<T>
): Observable<T> {
if (typeof (promiseOrAsyncIterator as any).then === 'function') {
return from(promiseOrAsyncIterator as Promise<T>);
return require('rxjs').from(promiseOrAsyncIterator as Promise<T>);
} else {
return new Observable((subscriber) => {
return new (require('rxjs').Observable)((subscriber) => {
let asyncIterator = promiseOrAsyncIterator as AsyncIterableIterator<T>;
function recurse(iterator: AsyncIterableIterator<T>) {

View File

@ -18,7 +18,6 @@ import {
import * as chalk from 'chalk';
import { logger } from '../shared/logger';
import { eachValueFrom } from 'rxjs-for-await';
export interface Target {
project: string;
@ -257,7 +256,8 @@ async function runExecutorInternal<T extends { success: boolean }>(
},
isVerbose
);
return eachValueFrom<T>(observable as any);
const { eachValueFrom } = require('rxjs-for-await');
return eachValueFrom(observable as any);
}
}

View File

@ -1,4 +1,4 @@
import { Observable } from 'rxjs';
import { Observable } from 'rxjs/internal/Observable';
import { TaskCompleteEvent, TasksRunner } from './tasks-runner';
import type { ProjectGraph, NxJsonConfiguration, Task } from '@nrwl/devkit';
import { TaskOrchestrator } from './task-orchestrator';

View File

@ -1,6 +1,6 @@
import type { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
import { Observable } from 'rxjs';
import { Observable } from 'rxjs/internal/Observable';
import { extname } from 'path';
import * as url from 'url';

View File

@ -8,7 +8,7 @@ import {
TaskId,
Tree,
} from '@angular-devkit/schematics';
import { Observable } from 'rxjs';
import { Observable } from 'rxjs/internal/Observable';
import { fork } from 'child_process';
import { join } from 'path';
import { readJsonInTree } from './ast-utils';