new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,228 @@
|
||||
/* tslint:disable:no-unused-variable */
|
||||
// Subject imported before Observable to bypass circular dependency issue since
|
||||
// Subject extends Observable and Observable references Subject in it's
|
||||
// definition
|
||||
export {Subject, AnonymousSubject} from './Subject';
|
||||
/* tslint:enable:no-unused-variable */
|
||||
export {Observable} from './Observable';
|
||||
|
||||
export { config } from './config';
|
||||
|
||||
// statics
|
||||
/* tslint:disable:no-use-before-declare */
|
||||
import 'rxjs-compat/add/observable/bindCallback';
|
||||
import 'rxjs-compat/add/observable/bindNodeCallback';
|
||||
import 'rxjs-compat/add/observable/combineLatest';
|
||||
import 'rxjs-compat/add/observable/concat';
|
||||
import 'rxjs-compat/add/observable/defer';
|
||||
import 'rxjs-compat/add/observable/empty';
|
||||
import 'rxjs-compat/add/observable/forkJoin';
|
||||
import 'rxjs-compat/add/observable/from';
|
||||
import 'rxjs-compat/add/observable/fromEvent';
|
||||
import 'rxjs-compat/add/observable/fromEventPattern';
|
||||
import 'rxjs-compat/add/observable/fromPromise';
|
||||
import 'rxjs-compat/add/observable/generate';
|
||||
import 'rxjs-compat/add/observable/if';
|
||||
import 'rxjs-compat/add/observable/interval';
|
||||
import 'rxjs-compat/add/observable/merge';
|
||||
import 'rxjs-compat/add/observable/race';
|
||||
import 'rxjs-compat/add/observable/never';
|
||||
import 'rxjs-compat/add/observable/of';
|
||||
import 'rxjs-compat/add/observable/onErrorResumeNext';
|
||||
import 'rxjs-compat/add/observable/pairs';
|
||||
import 'rxjs-compat/add/observable/range';
|
||||
import 'rxjs-compat/add/observable/using';
|
||||
import 'rxjs-compat/add/observable/throw';
|
||||
import 'rxjs-compat/add/observable/timer';
|
||||
import 'rxjs-compat/add/observable/zip';
|
||||
|
||||
//dom
|
||||
import 'rxjs-compat/add/observable/dom/ajax';
|
||||
import 'rxjs-compat/add/observable/dom/webSocket';
|
||||
|
||||
//internal/operators
|
||||
import 'rxjs-compat/add/operator/buffer';
|
||||
import 'rxjs-compat/add/operator/bufferCount';
|
||||
import 'rxjs-compat/add/operator/bufferTime';
|
||||
import 'rxjs-compat/add/operator/bufferToggle';
|
||||
import 'rxjs-compat/add/operator/bufferWhen';
|
||||
import 'rxjs-compat/add/operator/catch';
|
||||
import 'rxjs-compat/add/operator/combineAll';
|
||||
import 'rxjs-compat/add/operator/combineLatest';
|
||||
import 'rxjs-compat/add/operator/concat';
|
||||
import 'rxjs-compat/add/operator/concatAll';
|
||||
import 'rxjs-compat/add/operator/concatMap';
|
||||
import 'rxjs-compat/add/operator/concatMapTo';
|
||||
import 'rxjs-compat/add/operator/count';
|
||||
import 'rxjs-compat/add/operator/dematerialize';
|
||||
import 'rxjs-compat/add/operator/debounce';
|
||||
import 'rxjs-compat/add/operator/debounceTime';
|
||||
import 'rxjs-compat/add/operator/defaultIfEmpty';
|
||||
import 'rxjs-compat/add/operator/delay';
|
||||
import 'rxjs-compat/add/operator/delayWhen';
|
||||
import 'rxjs-compat/add/operator/distinct';
|
||||
import 'rxjs-compat/add/operator/distinctUntilChanged';
|
||||
import 'rxjs-compat/add/operator/distinctUntilKeyChanged';
|
||||
import 'rxjs-compat/add/operator/do';
|
||||
import 'rxjs-compat/add/operator/exhaust';
|
||||
import 'rxjs-compat/add/operator/exhaustMap';
|
||||
import 'rxjs-compat/add/operator/expand';
|
||||
import 'rxjs-compat/add/operator/elementAt';
|
||||
import 'rxjs-compat/add/operator/filter';
|
||||
import 'rxjs-compat/add/operator/finally';
|
||||
import 'rxjs-compat/add/operator/find';
|
||||
import 'rxjs-compat/add/operator/findIndex';
|
||||
import 'rxjs-compat/add/operator/first';
|
||||
import 'rxjs-compat/add/operator/groupBy';
|
||||
import 'rxjs-compat/add/operator/ignoreElements';
|
||||
import 'rxjs-compat/add/operator/isEmpty';
|
||||
import 'rxjs-compat/add/operator/audit';
|
||||
import 'rxjs-compat/add/operator/auditTime';
|
||||
import 'rxjs-compat/add/operator/last';
|
||||
import 'rxjs-compat/add/operator/let';
|
||||
import 'rxjs-compat/add/operator/every';
|
||||
import 'rxjs-compat/add/operator/map';
|
||||
import 'rxjs-compat/add/operator/mapTo';
|
||||
import 'rxjs-compat/add/operator/materialize';
|
||||
import 'rxjs-compat/add/operator/max';
|
||||
import 'rxjs-compat/add/operator/merge';
|
||||
import 'rxjs-compat/add/operator/mergeAll';
|
||||
import 'rxjs-compat/add/operator/mergeMap';
|
||||
import 'rxjs-compat/add/operator/mergeMapTo';
|
||||
import 'rxjs-compat/add/operator/mergeScan';
|
||||
import 'rxjs-compat/add/operator/min';
|
||||
import 'rxjs-compat/add/operator/multicast';
|
||||
import 'rxjs-compat/add/operator/observeOn';
|
||||
import 'rxjs-compat/add/operator/onErrorResumeNext';
|
||||
import 'rxjs-compat/add/operator/pairwise';
|
||||
import 'rxjs-compat/add/operator/partition';
|
||||
import 'rxjs-compat/add/operator/pluck';
|
||||
import 'rxjs-compat/add/operator/publish';
|
||||
import 'rxjs-compat/add/operator/publishBehavior';
|
||||
import 'rxjs-compat/add/operator/publishReplay';
|
||||
import 'rxjs-compat/add/operator/publishLast';
|
||||
import 'rxjs-compat/add/operator/race';
|
||||
import 'rxjs-compat/add/operator/reduce';
|
||||
import 'rxjs-compat/add/operator/repeat';
|
||||
import 'rxjs-compat/add/operator/repeatWhen';
|
||||
import 'rxjs-compat/add/operator/retry';
|
||||
import 'rxjs-compat/add/operator/retryWhen';
|
||||
import 'rxjs-compat/add/operator/sample';
|
||||
import 'rxjs-compat/add/operator/sampleTime';
|
||||
import 'rxjs-compat/add/operator/scan';
|
||||
import 'rxjs-compat/add/operator/sequenceEqual';
|
||||
import 'rxjs-compat/add/operator/share';
|
||||
import 'rxjs-compat/add/operator/shareReplay';
|
||||
import 'rxjs-compat/add/operator/single';
|
||||
import 'rxjs-compat/add/operator/skip';
|
||||
import 'rxjs-compat/add/operator/skipLast';
|
||||
import 'rxjs-compat/add/operator/skipUntil';
|
||||
import 'rxjs-compat/add/operator/skipWhile';
|
||||
import 'rxjs-compat/add/operator/startWith';
|
||||
import 'rxjs-compat/add/operator/subscribeOn';
|
||||
import 'rxjs-compat/add/operator/switch';
|
||||
import 'rxjs-compat/add/operator/switchMap';
|
||||
import 'rxjs-compat/add/operator/switchMapTo';
|
||||
import 'rxjs-compat/add/operator/take';
|
||||
import 'rxjs-compat/add/operator/takeLast';
|
||||
import 'rxjs-compat/add/operator/takeUntil';
|
||||
import 'rxjs-compat/add/operator/takeWhile';
|
||||
import 'rxjs-compat/add/operator/throttle';
|
||||
import 'rxjs-compat/add/operator/throttleTime';
|
||||
import 'rxjs-compat/add/operator/timeInterval';
|
||||
import 'rxjs-compat/add/operator/timeout';
|
||||
import 'rxjs-compat/add/operator/timeoutWith';
|
||||
import 'rxjs-compat/add/operator/timestamp';
|
||||
import 'rxjs-compat/add/operator/toArray';
|
||||
import 'rxjs-compat/add/operator/toPromise';
|
||||
import 'rxjs-compat/add/operator/window';
|
||||
import 'rxjs-compat/add/operator/windowCount';
|
||||
import 'rxjs-compat/add/operator/windowTime';
|
||||
import 'rxjs-compat/add/operator/windowToggle';
|
||||
import 'rxjs-compat/add/operator/windowWhen';
|
||||
import 'rxjs-compat/add/operator/withLatestFrom';
|
||||
import 'rxjs-compat/add/operator/zip';
|
||||
import 'rxjs-compat/add/operator/zipAll';
|
||||
|
||||
/* tslint:disable:no-unused-variable */
|
||||
export {Operator} from './Operator';
|
||||
export {Observer} from './types';
|
||||
export {Subscription} from './Subscription';
|
||||
export {Subscriber} from './Subscriber';
|
||||
export {AsyncSubject} from './AsyncSubject';
|
||||
export {ReplaySubject} from './ReplaySubject';
|
||||
export {BehaviorSubject} from './BehaviorSubject';
|
||||
export {ConnectableObservable} from './observable/ConnectableObservable';
|
||||
export {Notification, NotificationKind} from './Notification';
|
||||
export {EmptyError} from './util/EmptyError';
|
||||
export {ArgumentOutOfRangeError} from './util/ArgumentOutOfRangeError';
|
||||
export {ObjectUnsubscribedError} from './util/ObjectUnsubscribedError';
|
||||
export {TimeoutError} from './util/TimeoutError';
|
||||
export {UnsubscriptionError} from './util/UnsubscriptionError';
|
||||
export {TimeInterval} from './operators/timeInterval';
|
||||
export {Timestamp} from './operators/timestamp';
|
||||
export {TestScheduler} from './testing/TestScheduler';
|
||||
export {VirtualTimeScheduler} from './scheduler/VirtualTimeScheduler';
|
||||
export {AjaxRequest, AjaxResponse, AjaxError, AjaxTimeoutError} from './observable/dom/AjaxObservable';
|
||||
export { pipe } from './util/pipe';
|
||||
|
||||
import { asap } from './scheduler/asap';
|
||||
import { async } from './scheduler/async';
|
||||
import { queue } from './scheduler/queue';
|
||||
import { animationFrame } from './scheduler/animationFrame';
|
||||
import { AsapScheduler } from './scheduler/AsapScheduler';
|
||||
import { AsyncScheduler } from './scheduler/AsyncScheduler';
|
||||
import { QueueScheduler } from './scheduler/QueueScheduler';
|
||||
import { AnimationFrameScheduler } from './scheduler/AnimationFrameScheduler';
|
||||
import { rxSubscriber } from './symbol/rxSubscriber';
|
||||
import { iterator } from './symbol/iterator';
|
||||
import { observable } from './symbol/observable';
|
||||
|
||||
import * as _operators from './operators/index';
|
||||
|
||||
export const operators = _operators;
|
||||
|
||||
/* tslint:enable:no-unused-variable */
|
||||
|
||||
/**
|
||||
* @typedef {Object} Rx.Scheduler
|
||||
* @property {SchedulerLike} asap Schedules on the micro task queue, which is the same
|
||||
* queue used for promises. Basically after the current job, but before the next job.
|
||||
* Use this for asynchronous conversions.
|
||||
* @property {SchedulerLike} queue Schedules on a queue in the current event frame
|
||||
* (trampoline scheduler). Use this for iteration operations.
|
||||
* @property {SchedulerLike} animationFrame Schedules work with `requestAnimationFrame`.
|
||||
* Use this for synchronizing with the platform's painting.
|
||||
* @property {SchedulerLike} async Schedules work with `setInterval`. Use this for
|
||||
* time-based operations.
|
||||
*/
|
||||
let Scheduler = {
|
||||
asap,
|
||||
queue,
|
||||
animationFrame,
|
||||
async
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {Object} Rx.Symbol
|
||||
* @property {Symbol|string} rxSubscriber A symbol to use as a property name to
|
||||
* retrieve an "Rx safe" Observer from an object. "Rx safety" can be defined as
|
||||
* an object that has all of the traits of an Rx Subscriber, including the
|
||||
* ability to add and remove subscriptions to the subscription chain and
|
||||
* guarantees involving event triggering (can't "next" after unsubscription,
|
||||
* etc).
|
||||
* @property {Symbol|string} observable A symbol to use as a property name to
|
||||
* retrieve an Observable as defined by the [ECMAScript "Observable" spec](https://github.com/zenparsing/es-observable).
|
||||
* @property {Symbol|string} iterator The ES6 symbol to use as a property name
|
||||
* to retrieve an iterator from an object.
|
||||
*/
|
||||
let Symbol = {
|
||||
rxSubscriber,
|
||||
observable,
|
||||
iterator
|
||||
};
|
||||
|
||||
export {
|
||||
Scheduler,
|
||||
Symbol
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"timer.js","sources":["../../../src/internal/observable/timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAqDlD,MAAM,UAAU,KAAK,CAAC,OAA0B,EAC1B,iBAA0C,EAC1C,SAAyB;IAFzB,wBAAA,EAAA,WAA0B;IAG9C,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;IAChB,IAAI,SAAS,CAAC,iBAAiB,CAAC,EAAE;QAChC,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC;KAC1E;SAAM,IAAI,WAAW,CAAC,iBAAiB,CAAC,EAAE;QACzC,SAAS,GAAG,iBAAwB,CAAC;KACtC;IAED,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;QAC3B,SAAS,GAAG,KAAK,CAAC;KACnB;IAED,OAAO,IAAI,UAAU,CAAC,UAAA,UAAU;QAC9B,IAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC;YAC5B,CAAC,CAAE,OAAkB;YACrB,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;QAEjC,OAAO,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;YACvC,KAAK,EAAE,CAAC,EAAE,MAAM,QAAA,EAAE,UAAU,YAAA;SAC7B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAQD,SAAS,QAAQ,CAAoC,KAAiB;IAC5D,IAAA,mBAAK,EAAE,qBAAM,EAAE,6BAAU,CAAW;IAC5C,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEvB,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,OAAO;KACR;SAAM,IAAI,MAAM,KAAK,CAAC,CAAC,EAAE;QACxB,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;KAC9B;IAED,KAAK,CAAC,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC;IACxB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
||||
@@ -0,0 +1,156 @@
|
||||
import { WebSocketSubject, WebSocketSubjectConfig } from './WebSocketSubject';
|
||||
|
||||
/**
|
||||
* Wrapper around the w3c-compatible WebSocket object provided by the browser.
|
||||
*
|
||||
* <span class="informal">{@link Subject} that communicates with a server via WebSocket</span>
|
||||
*
|
||||
* `webSocket` is a factory function that produces a `WebSocketSubject`,
|
||||
* which can be used to make WebSocket connection with an arbitrary endpoint.
|
||||
* `webSocket` accepts as an argument either a string with url of WebSocket endpoint, or an
|
||||
* {@link WebSocketSubjectConfig} object for providing additional configuration, as
|
||||
* well as Observers for tracking lifecycle of WebSocket connection.
|
||||
*
|
||||
* When `WebSocketSubject` is subscribed, it attempts to make a socket connection,
|
||||
* unless there is one made already. This means that many subscribers will always listen
|
||||
* on the same socket, thus saving resources. If however, two instances are made of `WebSocketSubject`,
|
||||
* even if these two were provided with the same url, they will attempt to make separate
|
||||
* connections. When consumer of a `WebSocketSubject` unsubscribes, socket connection is closed,
|
||||
* only if there are no more subscribers still listening. If after some time a consumer starts
|
||||
* subscribing again, connection is reestablished.
|
||||
*
|
||||
* Once connection is made, whenever a new message comes from the server, `WebSocketSubject` will emit that
|
||||
* message as a value in the stream. By default, a message from the socket is parsed via `JSON.parse`. If you
|
||||
* want to customize how deserialization is handled (if at all), you can provide custom `resultSelector`
|
||||
* function in {@link WebSocketSubject}. When connection closes, stream will complete, provided it happened without
|
||||
* any errors. If at any point (starting, maintaining or closing a connection) there is an error,
|
||||
* stream will also error with whatever WebSocket API has thrown.
|
||||
*
|
||||
* By virtue of being a {@link Subject}, `WebSocketSubject` allows for receiving and sending messages from the server. In order
|
||||
* to communicate with a connected endpoint, use `next`, `error` and `complete` methods. `next` sends a value to the server, so bear in mind
|
||||
* that this value will not be serialized beforehand. Because of This, `JSON.stringify` will have to be called on a value by hand,
|
||||
* before calling `next` with a result. Note also that if at the moment of nexting value
|
||||
* there is no socket connection (for example no one is subscribing), those values will be buffered, and sent when connection
|
||||
* is finally established. `complete` method closes socket connection. `error` does the same,
|
||||
* as well as notifying the server that something went wrong via status code and string with details of what happened.
|
||||
* Since status code is required in WebSocket API, `WebSocketSubject` does not allow, like regular `Subject`,
|
||||
* arbitrary values being passed to the `error` method. It needs to be called with an object that has `code`
|
||||
* property with status code number and optional `reason` property with string describing details
|
||||
* of an error.
|
||||
*
|
||||
* Calling `next` does not affect subscribers of `WebSocketSubject` - they have no
|
||||
* information that something was sent to the server (unless of course the server
|
||||
* responds somehow to a message). On the other hand, since calling `complete` triggers
|
||||
* an attempt to close socket connection. If that connection is closed without any errors, stream will
|
||||
* complete, thus notifying all subscribers. And since calling `error` closes
|
||||
* socket connection as well, just with a different status code for the server, if closing itself proceeds
|
||||
* without errors, subscribed Observable will not error, as one might expect, but complete as usual. In both cases
|
||||
* (calling `complete` or `error`), if process of closing socket connection results in some errors, *then* stream
|
||||
* will error.
|
||||
*
|
||||
* **Multiplexing**
|
||||
*
|
||||
* `WebSocketSubject` has an additional operator, not found in other Subjects. It is called `multiplex` and it is
|
||||
* used to simulate opening several socket connections, while in reality maintaining only one.
|
||||
* For example, an application has both chat panel and real-time notifications about sport news. Since these are two distinct functions,
|
||||
* it would make sense to have two separate connections for each. Perhaps there could even be two separate services with WebSocket
|
||||
* endpoints, running on separate machines with only GUI combining them together. Having a socket connection
|
||||
* for each functionality could become too resource expensive. It is a common pattern to have single
|
||||
* WebSocket endpoint that acts as a gateway for the other services (in this case chat and sport news services).
|
||||
* Even though there is a single connection in a client app, having the ability to manipulate streams as if it
|
||||
* were two separate sockets is desirable. This eliminates manually registering and unregistering in a gateway for
|
||||
* given service and filter out messages of interest. This is exactly what `multiplex` method is for.
|
||||
*
|
||||
* Method accepts three parameters. First two are functions returning subscription and unsubscription messages
|
||||
* respectively. These are messages that will be sent to the server, whenever consumer of resulting Observable
|
||||
* subscribes and unsubscribes. Server can use them to verify that some kind of messages should start or stop
|
||||
* being forwarded to the client. In case of the above example application, after getting subscription message with proper identifier,
|
||||
* gateway server can decide that it should connect to real sport news service and start forwarding messages from it.
|
||||
* Note that both messages will be sent as returned by the functions, they are by default serialized using JSON.stringify, just
|
||||
* as messages pushed via `next`. Also bear in mind that these messages will be sent on *every* subscription and
|
||||
* unsubscription. This is potentially dangerous, because one consumer of an Observable may unsubscribe and the server
|
||||
* might stop sending messages, since it got unsubscription message. This needs to be handled
|
||||
* on the server or using {@link publish} on a Observable returned from 'multiplex'.
|
||||
*
|
||||
* Last argument to `multiplex` is a `messageFilter` function which should return a boolean. It is used to filter out messages
|
||||
* sent by the server to only those that belong to simulated WebSocket stream. For example, server might mark these
|
||||
* messages with some kind of string identifier on a message object and `messageFilter` would return `true`
|
||||
* if there is such identifier on an object emitted by the socket. Messages which returns `false` in `messageFilter` are simply skipped,
|
||||
* and are not passed down the stream.
|
||||
*
|
||||
* Return value of `multiplex` is an Observable with messages incoming from emulated socket connection. Note that this
|
||||
* is not a `WebSocketSubject`, so calling `next` or `multiplex` again will fail. For pushing values to the
|
||||
* server, use root `WebSocketSubject`.
|
||||
*
|
||||
* ### Examples
|
||||
* #### Listening for messages from the server
|
||||
* ```ts
|
||||
* import { webSocket } from "rxjs/webSocket";
|
||||
* const subject = webSocket("ws://localhost:8081");
|
||||
*
|
||||
* subject.subscribe(
|
||||
* msg => console.log('message received: ' + msg), // Called whenever there is a message from the server.
|
||||
* err => console.log(err), // Called if at any point WebSocket API signals some kind of error.
|
||||
* () => console.log('complete') // Called when connection is closed (for whatever reason).
|
||||
* );
|
||||
* ```
|
||||
*
|
||||
* #### Pushing messages to the server
|
||||
* ```ts
|
||||
* import { webSocket } from "rxjs/webSocket";
|
||||
* const subject = webSocket('ws://localhost:8081');
|
||||
*
|
||||
* subject.subscribe();
|
||||
* // Note that at least one consumer has to subscribe to the created subject - otherwise "nexted" values will be just buffered and not sent,
|
||||
* // since no connection was established!
|
||||
*
|
||||
* subject.next({message: 'some message'});
|
||||
* // This will send a message to the server once a connection is made. Remember value is serialized with JSON.stringify by default!
|
||||
*
|
||||
* subject.complete(); // Closes the connection.
|
||||
*
|
||||
* subject.error({code: 4000, reason: 'I think our app just broke!'});
|
||||
* // Also closes the connection, but let's the server know that this closing is caused by some error.
|
||||
* ```
|
||||
*
|
||||
* #### Multiplexing WebSocket
|
||||
* ```ts
|
||||
* import { webSocket } from "rxjs/webSocket";
|
||||
* const subject = webSocket('ws://localhost:8081');
|
||||
*
|
||||
* const observableA = subject.multiplex(
|
||||
* () => ({subscribe: 'A'}), // When server gets this message, it will start sending messages for 'A'...
|
||||
* () => ({unsubscribe: 'A'}), // ...and when gets this one, it will stop.
|
||||
* message => message.type === 'A' // If the function returns `true` message is passed down the stream. Skipped if the function returns false.
|
||||
* );
|
||||
*
|
||||
* const observableB = subject.multiplex( // And the same goes for 'B'.
|
||||
* () => ({subscribe: 'B'}),
|
||||
* () => ({unsubscribe: 'B'}),
|
||||
* message => message.type === 'B'
|
||||
* );
|
||||
*
|
||||
* const subA = observableA.subscribe(messageForA => console.log(messageForA));
|
||||
* // At this moment WebSocket connection is established. Server gets '{"subscribe": "A"}' message and starts sending messages for 'A',
|
||||
* // which we log here.
|
||||
*
|
||||
* const subB = observableB.subscribe(messageForB => console.log(messageForB));
|
||||
* // Since we already have a connection, we just send '{"subscribe": "B"}' message to the server. It starts sending messages for 'B',
|
||||
* // which we log here.
|
||||
*
|
||||
* subB.unsubscribe();
|
||||
* // Message '{"unsubscribe": "B"}' is sent to the server, which stops sending 'B' messages.
|
||||
*
|
||||
* subA.unsubscribe();
|
||||
* // Message '{"unsubscribe": "A"}' makes the server stop sending messages for 'A'. Since there is no more subscribers to root Subject,
|
||||
* // socket connection closes.
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @param {string|WebSocketSubjectConfig} urlConfigOrSource The WebSocket endpoint as an url or an object with
|
||||
* configuration and additional Observers.
|
||||
* @return {WebSocketSubject} Subject which allows to both send and receive messages via WebSocket connection.
|
||||
*/
|
||||
export function webSocket<T>(urlConfigOrSource: string | WebSocketSubjectConfig<T>): WebSocketSubject<T> {
|
||||
return new WebSocketSubject<T>(urlConfigOrSource);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"switchAll.js","sources":["../../src/internal/operators/switchAll.ts"],"names":[],"mappings":";;AACA,yCAAwC;AACxC,6CAA4C;AA4D5C,SAAgB,SAAS;IACvB,OAAO,qBAAS,CAAC,mBAAQ,CAAC,CAAC;AAC7B,CAAC;AAFD,8BAEC"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"F G A B","2":"J E BC"},B:{"2":"C K L H M N O P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t"},C:{"2":"0 1 2 3 4 5 6 7 8 9 CC tB I u J E F G A B C K L H M N O v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB DC EC"},D:{"1":"0 1 2 3 4 5 6 7 I u J E F G A B C K L H M N O v w x y z","2":"8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R S T U V W X Y Z a b c d f g h i j k l m n o p q r s D t xB yB FC"},E:{"1":"u J HC","2":"E F G A B C K L H JC KC 0B qB rB 1B LC MC 2B 3B 4B 5B sB 6B 7B 8B NC","16":"IC","129":"I GC zB"},F:{"1":"G B C H M N O OC PC QC RC qB 9B SC rB","2":"0 1 2 3 4 5 6 7 8 9 v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB e lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d"},G:{"1":"TC AC UC VC WC","2":"F XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC 2B 3B 4B 5B sB 6B 7B 8B","129":"zB"},H:{"1":"nC"},I:{"1":"tB I oC pC qC rC AC sC","2":"D tC"},J:{"1":"E A"},K:{"1":"A B C qB 9B rB","2":"e"},L:{"2":"D"},M:{"2":"D"},N:{"1":"A B"},O:{"2":"uC"},P:{"2":"I vC wC xC yC zC 0B 0C 1C 2C 3C 4C sB 5C 6C 7C"},Q:{"2":"1B"},R:{"2":"8C"},S:{"2":"9C"}},B:4,C:"display: run-in"};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0.00428,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0.00428,"51":0.00428,"52":0.01285,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0.00428,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0.00428,"77":0,"78":0.01285,"79":0.00428,"80":0.01285,"81":0.01713,"82":0.00428,"83":0.00428,"84":0,"85":0,"86":0.00857,"87":0,"88":0,"89":0,"90":0,"91":0.01285,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0.00428,"100":0,"101":0,"102":0.00428,"103":0.00857,"104":0.00428,"105":0.00857,"106":0.00428,"107":0.05996,"108":0.454,"109":0.227,"110":0.00428,"111":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.00428,"39":0,"40":0,"41":0.00428,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00428,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0.02998,"57":0.00857,"58":4.35153,"59":0,"60":0,"61":0,"62":0.00428,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0.00428,"71":0,"72":0.00428,"73":0.00857,"74":0.00428,"75":0.00428,"76":0,"77":0.00428,"78":0.00428,"79":0.02142,"80":0.00857,"81":0.00428,"83":0.03855,"84":0.07281,"85":0.05996,"86":0.0514,"87":0.05568,"88":0.00428,"89":0.00428,"90":0.00857,"91":0.00857,"92":0.02998,"93":0.00428,"94":0.04283,"95":0.00857,"96":0.02142,"97":0.00857,"98":0.00857,"99":0.00857,"100":0.01713,"101":0.00857,"102":0.01285,"103":0.08138,"104":0.03426,"105":0.05996,"106":0.11564,"107":0.08994,"108":5.09249,"109":3.38785,"110":0.00857,"111":0.00428,"112":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0.00857,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0.00428,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0.00428,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0.00857,"71":0.00428,"72":0,"73":0.00428,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0.00428,"84":0,"85":0,"86":0.00428,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0.05996,"94":0.32123,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0.00428,"15":0,"16":0.00428,"17":0,"18":0.01285,"79":0,"80":0,"81":0,"83":0,"84":0.00428,"85":0.00857,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0.00428,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0.00428,"106":0.00857,"107":0.00857,"108":0.39404,"109":0.34692},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0.00428,"11":0,"12":0,"13":0.01285,"14":0.03855,"15":0.00857,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.00857,"13.1":0.02998,"14.1":0.08566,"15.1":0.02142,"15.2-15.3":0.02142,"15.4":0.04283,"15.5":0.08566,"15.6":0.37262,"16.0":0.03426,"16.1":0.1756,"16.2":0.16275,"16.3":0.01285},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0.01728,"8.1-8.4":0.02419,"9.0-9.2":0,"9.3":0.09331,"10.0-10.2":0.0311,"10.3":0.08294,"11.0-11.2":0.02073,"11.3-11.4":0.0622,"12.0-12.1":0.04492,"12.2-12.5":1.47906,"13.0-13.1":0.05184,"13.2":0.04838,"13.3":0.12095,"13.4-13.7":0.45962,"14.0-14.4":1.30973,"14.5-14.8":2.28771,"15.0-15.1":0.58057,"15.2-15.3":0.7499,"15.4":0.82938,"15.5":1.53781,"15.6":5.01084,"16.0":4.74129,"16.1":6.78019,"16.2":4.74475,"16.3":0.51491},P:{"4":0.11189,"5.0-5.4":0.01017,"6.2-6.4":0,"7.2-7.4":0.01017,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.01017,"12.0":0.01017,"13.0":0.03052,"14.0":0.01017,"15.0":0.01017,"16.0":0.05086,"17.0":0.05086,"18.0":0.06103,"19.0":1.17993},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.01714,"4.4":0,"4.4.3-4.4.4":0.03999},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0.01843,"9":0.00461,"10":0.00461,"11":0.27645,"5.5":0},J:{"7":0,"10":0.00572},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.18294},Q:{"13.1":0.01143},O:{"0":0.68032},H:{"0":0.47089},L:{"0":46.41684},S:{"2.5":0}};
|
||||
@@ -0,0 +1,66 @@
|
||||
/** PURE_IMPORTS_START tslib,_Subject,_innerSubscribe PURE_IMPORTS_END */
|
||||
import * as tslib_1 from "tslib";
|
||||
import { Subject } from '../Subject';
|
||||
import { SimpleOuterSubscriber, innerSubscribe, SimpleInnerSubscriber } from '../innerSubscribe';
|
||||
export function window(windowBoundaries) {
|
||||
return function windowOperatorFunction(source) {
|
||||
return source.lift(new WindowOperator(windowBoundaries));
|
||||
};
|
||||
}
|
||||
var WindowOperator = /*@__PURE__*/ (function () {
|
||||
function WindowOperator(windowBoundaries) {
|
||||
this.windowBoundaries = windowBoundaries;
|
||||
}
|
||||
WindowOperator.prototype.call = function (subscriber, source) {
|
||||
var windowSubscriber = new WindowSubscriber(subscriber);
|
||||
var sourceSubscription = source.subscribe(windowSubscriber);
|
||||
if (!sourceSubscription.closed) {
|
||||
windowSubscriber.add(innerSubscribe(this.windowBoundaries, new SimpleInnerSubscriber(windowSubscriber)));
|
||||
}
|
||||
return sourceSubscription;
|
||||
};
|
||||
return WindowOperator;
|
||||
}());
|
||||
var WindowSubscriber = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(WindowSubscriber, _super);
|
||||
function WindowSubscriber(destination) {
|
||||
var _this = _super.call(this, destination) || this;
|
||||
_this.window = new Subject();
|
||||
destination.next(_this.window);
|
||||
return _this;
|
||||
}
|
||||
WindowSubscriber.prototype.notifyNext = function () {
|
||||
this.openWindow();
|
||||
};
|
||||
WindowSubscriber.prototype.notifyError = function (error) {
|
||||
this._error(error);
|
||||
};
|
||||
WindowSubscriber.prototype.notifyComplete = function () {
|
||||
this._complete();
|
||||
};
|
||||
WindowSubscriber.prototype._next = function (value) {
|
||||
this.window.next(value);
|
||||
};
|
||||
WindowSubscriber.prototype._error = function (err) {
|
||||
this.window.error(err);
|
||||
this.destination.error(err);
|
||||
};
|
||||
WindowSubscriber.prototype._complete = function () {
|
||||
this.window.complete();
|
||||
this.destination.complete();
|
||||
};
|
||||
WindowSubscriber.prototype._unsubscribe = function () {
|
||||
this.window = null;
|
||||
};
|
||||
WindowSubscriber.prototype.openWindow = function () {
|
||||
var prevWindow = this.window;
|
||||
if (prevWindow) {
|
||||
prevWindow.complete();
|
||||
}
|
||||
var destination = this.destination;
|
||||
var newWindow = this.window = new Subject();
|
||||
destination.next(newWindow);
|
||||
};
|
||||
return WindowSubscriber;
|
||||
}(SimpleOuterSubscriber));
|
||||
//# sourceMappingURL=window.js.map
|
||||
@@ -0,0 +1,17 @@
|
||||
sudo: false
|
||||
arch:
|
||||
- amd64
|
||||
- ppc64le
|
||||
language: node_js
|
||||
node_js:
|
||||
- '6'
|
||||
- '8'
|
||||
- '10'
|
||||
- '12'
|
||||
- '14'
|
||||
- '15'
|
||||
- lts/*
|
||||
notifications:
|
||||
email:
|
||||
- rod@vagg.org
|
||||
- matteo.collina@gmail.com
|
||||
@@ -0,0 +1,21 @@
|
||||
import { CosmiconfigResult, ExplorerOptions, ExplorerOptionsSync, Cache, LoadedFileContent } from './types';
|
||||
import { Loader } from './index';
|
||||
declare class ExplorerBase<T extends ExplorerOptions | ExplorerOptionsSync> {
|
||||
protected readonly loadCache?: Cache;
|
||||
protected readonly searchCache?: Cache;
|
||||
protected readonly config: T;
|
||||
constructor(options: T);
|
||||
clearLoadCache(): void;
|
||||
clearSearchCache(): void;
|
||||
clearCaches(): void;
|
||||
private validateConfig;
|
||||
protected shouldSearchStopWithResult(result: CosmiconfigResult): boolean;
|
||||
protected nextDirectoryToSearch(currentDir: string, currentResult: CosmiconfigResult): string | null;
|
||||
private loadPackageProp;
|
||||
protected getLoaderEntryForFile(filepath: string): Loader;
|
||||
protected loadedContentToCosmiconfigResult(filepath: string, loadedContent: LoadedFileContent): CosmiconfigResult;
|
||||
protected validateFilePath(filepath: string): void;
|
||||
}
|
||||
declare function getExtensionDescription(filepath: string): string;
|
||||
export { ExplorerBase, getExtensionDescription };
|
||||
//# sourceMappingURL=ExplorerBase.d.ts.map
|
||||
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"name": "yargs-parser",
|
||||
"version": "20.2.9",
|
||||
"description": "the mighty option parser used by yargs",
|
||||
"main": "build/index.cjs",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./build/lib/index.js",
|
||||
"require": "./build/index.cjs"
|
||||
},
|
||||
"./build/index.cjs"
|
||||
]
|
||||
},
|
||||
"type": "module",
|
||||
"module": "./build/lib/index.js",
|
||||
"scripts": {
|
||||
"check": "standardx '**/*.ts' && standardx '**/*.js' && standardx '**/*.cjs'",
|
||||
"fix": "standardx --fix '**/*.ts' && standardx --fix '**/*.js' && standardx --fix '**/*.cjs'",
|
||||
"pretest": "rimraf build && tsc -p tsconfig.test.json && cross-env NODE_ENV=test npm run build:cjs",
|
||||
"test": "c8 --reporter=text --reporter=html mocha test/*.cjs",
|
||||
"test:browser": "start-server-and-test 'serve ./ -p 8080' http://127.0.0.1:8080/package.json 'node ./test/browser/yargs-test.cjs'",
|
||||
"pretest:typescript": "npm run pretest",
|
||||
"test:typescript": "c8 mocha ./build/test/typescript/*.js",
|
||||
"coverage": "c8 report --check-coverage",
|
||||
"precompile": "rimraf build",
|
||||
"compile": "tsc",
|
||||
"postcompile": "npm run build:cjs",
|
||||
"build:cjs": "rollup -c",
|
||||
"prepare": "npm run compile"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/yargs/yargs-parser.git"
|
||||
},
|
||||
"keywords": [
|
||||
"argument",
|
||||
"parser",
|
||||
"yargs",
|
||||
"command",
|
||||
"cli",
|
||||
"parsing",
|
||||
"option",
|
||||
"args",
|
||||
"argument"
|
||||
],
|
||||
"author": "Ben Coe <ben@npmjs.com>",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.2.11",
|
||||
"@types/mocha": "^8.0.0",
|
||||
"@types/node": "^14.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^3.10.1",
|
||||
"@typescript-eslint/parser": "^3.10.1",
|
||||
"@wessberg/rollup-plugin-ts": "^1.2.28",
|
||||
"c8": "^7.3.0",
|
||||
"chai": "^4.2.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "^7.0.0",
|
||||
"eslint-plugin-import": "^2.20.1",
|
||||
"eslint-plugin-node": "^11.0.0",
|
||||
"gts": "^3.0.0",
|
||||
"mocha": "^9.0.0",
|
||||
"puppeteer": "^10.0.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.22.1",
|
||||
"rollup-plugin-cleanup": "^3.1.1",
|
||||
"serve": "^12.0.0",
|
||||
"standardx": "^7.0.0",
|
||||
"start-server-and-test": "^1.11.2",
|
||||
"ts-transform-default-export": "^1.0.2",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"files": [
|
||||
"browser.js",
|
||||
"build",
|
||||
"!*.d.ts"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"standardx": {
|
||||
"ignore": [
|
||||
"build"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
const is = require('@sindresorhus/is');
|
||||
|
||||
module.exports = function deepFreeze(object) {
|
||||
for (const [key, value] of Object.entries(object)) {
|
||||
if (is.plainObject(value) || is.array(value)) {
|
||||
deepFreeze(object[key]);
|
||||
}
|
||||
}
|
||||
|
||||
return Object.freeze(object);
|
||||
};
|
||||
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
}
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var innerSubscribe_1 = require("../innerSubscribe");
|
||||
function expand(project, concurrent, scheduler) {
|
||||
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
|
||||
concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;
|
||||
return function (source) { return source.lift(new ExpandOperator(project, concurrent, scheduler)); };
|
||||
}
|
||||
exports.expand = expand;
|
||||
var ExpandOperator = (function () {
|
||||
function ExpandOperator(project, concurrent, scheduler) {
|
||||
this.project = project;
|
||||
this.concurrent = concurrent;
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
ExpandOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler));
|
||||
};
|
||||
return ExpandOperator;
|
||||
}());
|
||||
exports.ExpandOperator = ExpandOperator;
|
||||
var ExpandSubscriber = (function (_super) {
|
||||
__extends(ExpandSubscriber, _super);
|
||||
function ExpandSubscriber(destination, project, concurrent, scheduler) {
|
||||
var _this = _super.call(this, destination) || this;
|
||||
_this.project = project;
|
||||
_this.concurrent = concurrent;
|
||||
_this.scheduler = scheduler;
|
||||
_this.index = 0;
|
||||
_this.active = 0;
|
||||
_this.hasCompleted = false;
|
||||
if (concurrent < Number.POSITIVE_INFINITY) {
|
||||
_this.buffer = [];
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
ExpandSubscriber.dispatch = function (arg) {
|
||||
var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index;
|
||||
subscriber.subscribeToProjection(result, value, index);
|
||||
};
|
||||
ExpandSubscriber.prototype._next = function (value) {
|
||||
var destination = this.destination;
|
||||
if (destination.closed) {
|
||||
this._complete();
|
||||
return;
|
||||
}
|
||||
var index = this.index++;
|
||||
if (this.active < this.concurrent) {
|
||||
destination.next(value);
|
||||
try {
|
||||
var project = this.project;
|
||||
var result = project(value, index);
|
||||
if (!this.scheduler) {
|
||||
this.subscribeToProjection(result, value, index);
|
||||
}
|
||||
else {
|
||||
var state = { subscriber: this, result: result, value: value, index: index };
|
||||
var destination_1 = this.destination;
|
||||
destination_1.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
destination.error(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.buffer.push(value);
|
||||
}
|
||||
};
|
||||
ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) {
|
||||
this.active++;
|
||||
var destination = this.destination;
|
||||
destination.add(innerSubscribe_1.innerSubscribe(result, new innerSubscribe_1.SimpleInnerSubscriber(this)));
|
||||
};
|
||||
ExpandSubscriber.prototype._complete = function () {
|
||||
this.hasCompleted = true;
|
||||
if (this.hasCompleted && this.active === 0) {
|
||||
this.destination.complete();
|
||||
}
|
||||
this.unsubscribe();
|
||||
};
|
||||
ExpandSubscriber.prototype.notifyNext = function (innerValue) {
|
||||
this._next(innerValue);
|
||||
};
|
||||
ExpandSubscriber.prototype.notifyComplete = function () {
|
||||
var buffer = this.buffer;
|
||||
this.active--;
|
||||
if (buffer && buffer.length > 0) {
|
||||
this._next(buffer.shift());
|
||||
}
|
||||
if (this.hasCompleted && this.active === 0) {
|
||||
this.destination.complete();
|
||||
}
|
||||
};
|
||||
return ExpandSubscriber;
|
||||
}(innerSubscribe_1.SimpleOuterSubscriber));
|
||||
exports.ExpandSubscriber = ExpandSubscriber;
|
||||
//# sourceMappingURL=expand.js.map
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("rxjs-compat/operators/every"));
|
||||
//# sourceMappingURL=every.js.map
|
||||
@@ -0,0 +1,14 @@
|
||||
import { ExplorerBase } from './ExplorerBase';
|
||||
import { CosmiconfigResult, ExplorerOptionsSync } from './types';
|
||||
declare class ExplorerSync extends ExplorerBase<ExplorerOptionsSync> {
|
||||
constructor(options: ExplorerOptionsSync);
|
||||
searchSync(searchFrom?: string): CosmiconfigResult;
|
||||
private searchFromDirectorySync;
|
||||
private searchDirectorySync;
|
||||
private loadSearchPlaceSync;
|
||||
private loadFileContentSync;
|
||||
private createCosmiconfigResultSync;
|
||||
loadSync(filepath: string): CosmiconfigResult;
|
||||
}
|
||||
export { ExplorerSync };
|
||||
//# sourceMappingURL=ExplorerSync.d.ts.map
|
||||
@@ -0,0 +1,182 @@
|
||||
/** PURE_IMPORTS_START tslib,_Subscriber,_Subscription,_Observable,_Subject PURE_IMPORTS_END */
|
||||
import * as tslib_1 from "tslib";
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { Observable } from '../Observable';
|
||||
import { Subject } from '../Subject';
|
||||
export function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) {
|
||||
return function (source) {
|
||||
return source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector));
|
||||
};
|
||||
}
|
||||
var GroupByOperator = /*@__PURE__*/ (function () {
|
||||
function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) {
|
||||
this.keySelector = keySelector;
|
||||
this.elementSelector = elementSelector;
|
||||
this.durationSelector = durationSelector;
|
||||
this.subjectSelector = subjectSelector;
|
||||
}
|
||||
GroupByOperator.prototype.call = function (subscriber, source) {
|
||||
return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector));
|
||||
};
|
||||
return GroupByOperator;
|
||||
}());
|
||||
var GroupBySubscriber = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(GroupBySubscriber, _super);
|
||||
function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) {
|
||||
var _this = _super.call(this, destination) || this;
|
||||
_this.keySelector = keySelector;
|
||||
_this.elementSelector = elementSelector;
|
||||
_this.durationSelector = durationSelector;
|
||||
_this.subjectSelector = subjectSelector;
|
||||
_this.groups = null;
|
||||
_this.attemptedToUnsubscribe = false;
|
||||
_this.count = 0;
|
||||
return _this;
|
||||
}
|
||||
GroupBySubscriber.prototype._next = function (value) {
|
||||
var key;
|
||||
try {
|
||||
key = this.keySelector(value);
|
||||
}
|
||||
catch (err) {
|
||||
this.error(err);
|
||||
return;
|
||||
}
|
||||
this._group(value, key);
|
||||
};
|
||||
GroupBySubscriber.prototype._group = function (value, key) {
|
||||
var groups = this.groups;
|
||||
if (!groups) {
|
||||
groups = this.groups = new Map();
|
||||
}
|
||||
var group = groups.get(key);
|
||||
var element;
|
||||
if (this.elementSelector) {
|
||||
try {
|
||||
element = this.elementSelector(value);
|
||||
}
|
||||
catch (err) {
|
||||
this.error(err);
|
||||
}
|
||||
}
|
||||
else {
|
||||
element = value;
|
||||
}
|
||||
if (!group) {
|
||||
group = (this.subjectSelector ? this.subjectSelector() : new Subject());
|
||||
groups.set(key, group);
|
||||
var groupedObservable = new GroupedObservable(key, group, this);
|
||||
this.destination.next(groupedObservable);
|
||||
if (this.durationSelector) {
|
||||
var duration = void 0;
|
||||
try {
|
||||
duration = this.durationSelector(new GroupedObservable(key, group));
|
||||
}
|
||||
catch (err) {
|
||||
this.error(err);
|
||||
return;
|
||||
}
|
||||
this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this)));
|
||||
}
|
||||
}
|
||||
if (!group.closed) {
|
||||
group.next(element);
|
||||
}
|
||||
};
|
||||
GroupBySubscriber.prototype._error = function (err) {
|
||||
var groups = this.groups;
|
||||
if (groups) {
|
||||
groups.forEach(function (group, key) {
|
||||
group.error(err);
|
||||
});
|
||||
groups.clear();
|
||||
}
|
||||
this.destination.error(err);
|
||||
};
|
||||
GroupBySubscriber.prototype._complete = function () {
|
||||
var groups = this.groups;
|
||||
if (groups) {
|
||||
groups.forEach(function (group, key) {
|
||||
group.complete();
|
||||
});
|
||||
groups.clear();
|
||||
}
|
||||
this.destination.complete();
|
||||
};
|
||||
GroupBySubscriber.prototype.removeGroup = function (key) {
|
||||
this.groups.delete(key);
|
||||
};
|
||||
GroupBySubscriber.prototype.unsubscribe = function () {
|
||||
if (!this.closed) {
|
||||
this.attemptedToUnsubscribe = true;
|
||||
if (this.count === 0) {
|
||||
_super.prototype.unsubscribe.call(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
return GroupBySubscriber;
|
||||
}(Subscriber));
|
||||
var GroupDurationSubscriber = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(GroupDurationSubscriber, _super);
|
||||
function GroupDurationSubscriber(key, group, parent) {
|
||||
var _this = _super.call(this, group) || this;
|
||||
_this.key = key;
|
||||
_this.group = group;
|
||||
_this.parent = parent;
|
||||
return _this;
|
||||
}
|
||||
GroupDurationSubscriber.prototype._next = function (value) {
|
||||
this.complete();
|
||||
};
|
||||
GroupDurationSubscriber.prototype._unsubscribe = function () {
|
||||
var _a = this, parent = _a.parent, key = _a.key;
|
||||
this.key = this.parent = null;
|
||||
if (parent) {
|
||||
parent.removeGroup(key);
|
||||
}
|
||||
};
|
||||
return GroupDurationSubscriber;
|
||||
}(Subscriber));
|
||||
var GroupedObservable = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(GroupedObservable, _super);
|
||||
function GroupedObservable(key, groupSubject, refCountSubscription) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.key = key;
|
||||
_this.groupSubject = groupSubject;
|
||||
_this.refCountSubscription = refCountSubscription;
|
||||
return _this;
|
||||
}
|
||||
GroupedObservable.prototype._subscribe = function (subscriber) {
|
||||
var subscription = new Subscription();
|
||||
var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject;
|
||||
if (refCountSubscription && !refCountSubscription.closed) {
|
||||
subscription.add(new InnerRefCountSubscription(refCountSubscription));
|
||||
}
|
||||
subscription.add(groupSubject.subscribe(subscriber));
|
||||
return subscription;
|
||||
};
|
||||
return GroupedObservable;
|
||||
}(Observable));
|
||||
export { GroupedObservable };
|
||||
var InnerRefCountSubscription = /*@__PURE__*/ (function (_super) {
|
||||
tslib_1.__extends(InnerRefCountSubscription, _super);
|
||||
function InnerRefCountSubscription(parent) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.parent = parent;
|
||||
parent.count++;
|
||||
return _this;
|
||||
}
|
||||
InnerRefCountSubscription.prototype.unsubscribe = function () {
|
||||
var parent = this.parent;
|
||||
if (!parent.closed && !this.closed) {
|
||||
_super.prototype.unsubscribe.call(this);
|
||||
parent.count -= 1;
|
||||
if (parent.count === 0 && parent.attemptedToUnsubscribe) {
|
||||
parent.unsubscribe();
|
||||
}
|
||||
}
|
||||
};
|
||||
return InnerRefCountSubscription;
|
||||
}(Subscription));
|
||||
//# sourceMappingURL=groupBy.js.map
|
||||
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("rxjs-compat/add/operator/publish");
|
||||
//# sourceMappingURL=publish.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ignoreElements.js","sources":["../../../src/internal/operators/ignoreElements.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA8B3C,MAAM,UAAU,cAAc;IAC5B,OAAO,SAAS,8BAA8B,CAAC,MAAuB;QACpE,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,sBAAsB,EAAE,CAAC,CAAC;IACnD,CAAC,CAAC;AACJ,CAAC;AAED;IAAA;IAIA,CAAC;IAHC,qCAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,wBAAwB,CAAC,UAAU,CAAC,CAAC,CAAC;IACpE,CAAC;IACH,6BAAC;AAAD,CAAC,AAJD,IAIC;AAOD;IAA0C,oDAAa;IAAvD;;IAIA,CAAC;IAHW,wCAAK,GAAf,UAAgB,MAAS;IAEzB,CAAC;IACH,+BAAC;AAAD,CAAC,AAJD,CAA0C,UAAU,GAInD"}
|
||||
@@ -0,0 +1,102 @@
|
||||
# Colorette
|
||||
|
||||
> Easily set the text color and style in the terminal.
|
||||
|
||||
- No wonky prototype method-chain API.
|
||||
- Automatic color support detection.
|
||||
- Up to [2x faster](#benchmarks) than alternatives.
|
||||
- [`NO_COLOR`](https://no-color.org) friendly. 👌
|
||||
|
||||
Here's the first example to get you started.
|
||||
|
||||
```js
|
||||
import { blue, bold, underline } from "colorette"
|
||||
|
||||
console.log(
|
||||
blue("I'm blue"),
|
||||
bold(blue("da ba dee")),
|
||||
underline(bold(blue("da ba daa")))
|
||||
)
|
||||
```
|
||||
|
||||
Here's an example using [template literals](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals).
|
||||
|
||||
```js
|
||||
console.log(`
|
||||
There's a ${underline(blue("house"))},
|
||||
With a ${bold(blue("window"))},
|
||||
And a ${blue("corvette")}
|
||||
And everything is blue
|
||||
`)
|
||||
```
|
||||
|
||||
Of course, you can nest styles without breaking existing color sequences.
|
||||
|
||||
```js
|
||||
console.log(bold(`I'm ${blue(`da ba ${underline("dee")} da ba`)} daa`))
|
||||
```
|
||||
|
||||
Feeling adventurous? Try the [pipeline operator](https://github.com/tc39/proposal-pipeline-operator).
|
||||
|
||||
```js
|
||||
console.log("Da ba dee da ba daa" |> blue |> bold)
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```console
|
||||
npm install colorette
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `<style>(string)`
|
||||
|
||||
See [supported styles](#supported-styles).
|
||||
|
||||
```js
|
||||
import { blue } from "colorette"
|
||||
|
||||
blue("I'm blue") //=> \x1b[34mI'm blue\x1b[39m
|
||||
```
|
||||
|
||||
### `options.enabled`
|
||||
|
||||
Colorette automatically detects if your terminal can display color, but you can toggle color as needed.
|
||||
|
||||
```js
|
||||
import { options } from "colorette"
|
||||
|
||||
options.enabled = false
|
||||
```
|
||||
|
||||
You can also force the use of color globally by setting `FORCE_COLOR=` or `NO_COLOR=` from the CLI.
|
||||
|
||||
```console
|
||||
$ FORCE_COLOR= node example.js >log
|
||||
$ NO_COLOR= node example.js
|
||||
```
|
||||
|
||||
## Supported styles
|
||||
|
||||
| Colors | Background Colors | Bright Colors | Bright Background Colors | Modifiers |
|
||||
| ------- | ----------------- | ------------- | ------------------------ | ----------------- |
|
||||
| black | bgBlack | blackBright | bgBlackBright | dim |
|
||||
| red | bgRed | redBright | bgRedBright | **bold** |
|
||||
| green | bgGreen | greenBright | bgGreenBright | hidden |
|
||||
| yellow | bgYellow | yellowBright | bgYellowBright | _italic_ |
|
||||
| blue | bgBlue | blueBright | bgBlueBright | <u>underline</u> |
|
||||
| magenta | bgMagenta | magentaBright | bgMagentaBright | ~~strikethrough~~ |
|
||||
| cyan | bgCyan | cyanBright | bgCyanBright | reset |
|
||||
| white | bgWhite | whiteBright | bgWhiteBright | |
|
||||
| gray | | | | |
|
||||
|
||||
## Benchmarks
|
||||
|
||||
```console
|
||||
npm --prefix bench start
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE.md)
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/observable/SubscribeOnObservable';
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"exhaust.js","sources":["../../../src/internal/operators/exhaust.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAiDjG,MAAM,UAAU,OAAO;IACrB,OAAO,CAAC,MAAqB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,mBAAmB,EAAK,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,mBAAmB;IACvB,IAAI,CAAC,UAAyB,EAAE,MAAW;QACzC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,CAAC;CACF;AAOD,MAAM,qBAAyB,SAAQ,qBAA2B;IAIhE,YAAY,WAA0B;QACpC,KAAK,CAAC,WAAW,CAAC,CAAC;QAJb,iBAAY,GAAY,KAAK,CAAC;QAC9B,oBAAe,GAAY,KAAK,CAAC;IAIzC,CAAC;IAES,KAAK,CAAC,KAAQ;QACtB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACzB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAC5B,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAClE;IACH,CAAC;IAES,SAAS;QACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACzB,IAAI,CAAC,WAAW,CAAC,QAAS,EAAE,CAAC;SAC9B;IACH,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,WAAW,CAAC,QAAS,EAAE,CAAC;SAC9B;IACH,CAAC;CACF"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"combineLatest.js","sources":["../src/operators/combineLatest.ts"],"names":[],"mappings":";;;;;AAAA,yDAAoD"}
|
||||
@@ -0,0 +1,16 @@
|
||||
import assertString from './util/assertString';
|
||||
import { decimal } from './alpha';
|
||||
export default function isFloat(str, options) {
|
||||
assertString(str);
|
||||
options = options || {};
|
||||
|
||||
var _float = new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\".concat(options.locale ? decimal[options.locale] : '.', "[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"));
|
||||
|
||||
if (str === '' || str === '.' || str === '-' || str === '+') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var value = parseFloat(str.replace(',', '.'));
|
||||
return _float.test(str) && (!options.hasOwnProperty('min') || value >= options.min) && (!options.hasOwnProperty('max') || value <= options.max) && (!options.hasOwnProperty('lt') || value < options.lt) && (!options.hasOwnProperty('gt') || value > options.gt);
|
||||
}
|
||||
export var locales = Object.keys(decimal);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("rxjs-compat/observable/dom/ajax"));
|
||||
//# sourceMappingURL=ajax.js.map
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operators/isEmpty';
|
||||
Reference in New Issue
Block a user