refactor(@angular-devkit/core): replace fast-json-stable-stringify import to es6

This commit is contained in:
Alan Agius 2022-04-08 12:00:02 +02:00 committed by Douglas Parker
parent ebbb0adf56
commit a66cfd0c6d

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import stableStringify from 'fast-json-stable-stringify';
import { Observable, Subject, concat, of } from 'rxjs';
import { finalize, ignoreElements, share, shareReplay, tap } from 'rxjs/operators';
import { JsonValue } from '../../json';
@ -18,14 +19,12 @@ import {
JobOutboundMessageKind,
} from './api';
const stableStringify = require('fast-json-stable-stringify');
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace strategy {
export type JobStrategy<
A extends JsonValue = JsonValue,
I extends JsonValue = JsonValue,
O extends JsonValue = JsonValue
O extends JsonValue = JsonValue,
> = (
handler: JobHandler<A, I, O>,
options?: Partial<Readonly<JobDescription>>,
@ -37,7 +36,7 @@ export namespace strategy {
export function serialize<
A extends JsonValue = JsonValue,
I extends JsonValue = JsonValue,
O extends JsonValue = JsonValue
O extends JsonValue = JsonValue,
>(): JobStrategy<A, I, O> {
let latest: Observable<JobOutboundMessage<O>> = of();
@ -66,7 +65,7 @@ export namespace strategy {
export function reuse<
A extends JsonValue = JsonValue,
I extends JsonValue = JsonValue,
O extends JsonValue = JsonValue
O extends JsonValue = JsonValue,
>(replayMessages = false): JobStrategy<A, I, O> {
let inboundBus = new Subject<JobInboundMessage<I>>();
let run: Observable<JobOutboundMessage<O>> | null = null;
@ -121,7 +120,7 @@ export namespace strategy {
export function memoize<
A extends JsonValue = JsonValue,
I extends JsonValue = JsonValue,
O extends JsonValue = JsonValue
O extends JsonValue = JsonValue,
>(replayMessages = false): JobStrategy<A, I, O> {
const runs = new Map<string, Observable<JobOutboundMessage<O>>>();