new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
# event-emitter
|
||||
## Environment agnostic event emitter
|
||||
|
||||
### Installation
|
||||
|
||||
$ npm install event-emitter
|
||||
|
||||
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)
|
||||
|
||||
### Usage
|
||||
|
||||
```javascript
|
||||
var ee = require('event-emitter');
|
||||
|
||||
var MyClass = function () { /* .. */ };
|
||||
ee(MyClass.prototype); // All instances of MyClass will expose event-emitter interface
|
||||
|
||||
var emitter = new MyClass(), listener;
|
||||
|
||||
emitter.on('test', listener = function (args) {
|
||||
// … react to 'test' event
|
||||
});
|
||||
|
||||
emitter.once('test', function (args) {
|
||||
// … react to first 'test' event (invoked only once!)
|
||||
});
|
||||
|
||||
emitter.emit('test', arg1, arg2/*…args*/); // Two above listeners invoked
|
||||
emitter.emit('test', arg1, arg2/*…args*/); // Only first listener invoked
|
||||
|
||||
emitter.off('test', listener); // Removed first listener
|
||||
emitter.emit('test', arg1, arg2/*…args*/); // No listeners invoked
|
||||
```
|
||||
### Additional utilities
|
||||
|
||||
#### allOff(obj) _(event-emitter/all-off)_
|
||||
|
||||
Removes all listeners from given event emitter object
|
||||
|
||||
#### hasListeners(obj[, name]) _(event-emitter/has-listeners)_
|
||||
|
||||
Whether object has some listeners attached to the object.
|
||||
When `name` is provided, it checks listeners for specific event name
|
||||
|
||||
```javascript
|
||||
var emitter = ee();
|
||||
var hasListeners = require('event-emitter/has-listeners');
|
||||
var listener = function () {};
|
||||
|
||||
hasListeners(emitter); // false
|
||||
|
||||
emitter.on('foo', listener);
|
||||
hasListeners(emitter); // true
|
||||
hasListeners(emitter, 'foo'); // true
|
||||
hasListeners(emitter, 'bar'); // false
|
||||
|
||||
emitter.off('foo', listener);
|
||||
hasListeners(emitter, 'foo'); // false
|
||||
```
|
||||
|
||||
#### pipe(source, target[, emitMethodName]) _(event-emitter/pipe)_
|
||||
|
||||
Pipes all events from _source_ emitter onto _target_ emitter (all events from _source_ emitter will be emitted also on _target_ emitter, but not other way).
|
||||
Returns _pipe_ object which exposes `pipe.close` function. Invoke it to close configured _pipe_.
|
||||
It works internally by redefinition of `emit` method, if in your interface this method is referenced differently, provide its name (or symbol) with third argument.
|
||||
|
||||
#### unify(emitter1, emitter2) _(event-emitter/unify)_
|
||||
|
||||
Unifies event handling for two objects. Events emitted on _emitter1_ would be also emitted on _emitter2_, and other way back.
|
||||
Non reversible.
|
||||
|
||||
```javascript
|
||||
var eeUnify = require('event-emitter/unify');
|
||||
|
||||
var emitter1 = ee(), listener1, listener3;
|
||||
var emitter2 = ee(), listener2, listener4;
|
||||
|
||||
emitter1.on('test', listener1 = function () { });
|
||||
emitter2.on('test', listener2 = function () { });
|
||||
|
||||
emitter1.emit('test'); // Invoked listener1
|
||||
emitter2.emit('test'); // Invoked listener2
|
||||
|
||||
var unify = eeUnify(emitter1, emitter2);
|
||||
|
||||
emitter1.emit('test'); // Invoked listener1 and listener2
|
||||
emitter2.emit('test'); // Invoked listener1 and listener2
|
||||
|
||||
emitter1.on('test', listener3 = function () { });
|
||||
emitter2.on('test', listener4 = function () { });
|
||||
|
||||
emitter1.emit('test'); // Invoked listener1, listener2, listener3 and listener4
|
||||
emitter2.emit('test'); // Invoked listener1, listener2, listener3 and listener4
|
||||
```
|
||||
|
||||
### Tests [](https://travis-ci.org/medikoo/event-emitter)
|
||||
|
||||
$ npm test
|
||||
@@ -0,0 +1,10 @@
|
||||
module.exports = function (x, opts) {
|
||||
/**
|
||||
* This file is purposefully a passthrough. It's expected that third-party
|
||||
* environments will override it at runtime in order to inject special logic
|
||||
* into `resolve` (by manipulating the options). One such example is the PnP
|
||||
* code path in Yarn.
|
||||
*/
|
||||
|
||||
return opts || {};
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "base64-js",
|
||||
"description": "Base64 encoding/decoding in pure JS",
|
||||
"version": "1.5.1",
|
||||
"author": "T. Jameson Little <t.jameson.little@gmail.com>",
|
||||
"typings": "index.d.ts",
|
||||
"bugs": {
|
||||
"url": "https://github.com/beatgammit/base64-js/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-minify": "^0.5.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"browserify": "^16.3.0",
|
||||
"standard": "*",
|
||||
"tape": "4.x"
|
||||
},
|
||||
"homepage": "https://github.com/beatgammit/base64-js",
|
||||
"keywords": [
|
||||
"base64"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/beatgammit/base64-js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "browserify -s base64js -r ./ | minify > base64js.min.js",
|
||||
"lint": "standard",
|
||||
"test": "npm run lint && npm run unit",
|
||||
"unit": "tape test/*.js"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
declare type EventArgs<T> = [T] extends [(...args: infer U) => any]
|
||||
? U
|
||||
: [T] extends [void]
|
||||
? []
|
||||
: [T];
|
||||
/**
|
||||
* Example:
|
||||
*
|
||||
* export interface BaseEvents<P, S> {
|
||||
* SET_STATE: (component: BaseComponent<P, S>, state: S) => void;
|
||||
* }
|
||||
*/
|
||||
export interface EventEmitter<EventTypes> {
|
||||
addListener<EventName extends keyof EventTypes>(
|
||||
event: EventName,
|
||||
listener: (...args: EventArgs<EventTypes[EventName]>) => void,
|
||||
): EventEmitter<EventTypes>;
|
||||
on<EventName extends keyof EventTypes>(
|
||||
event: EventName,
|
||||
listener: (...args: EventArgs<EventTypes[EventName]>) => void,
|
||||
): EventEmitter<EventTypes>;
|
||||
off<EventName extends keyof EventTypes>(
|
||||
event: EventName,
|
||||
listener: (...args: EventArgs<EventTypes[EventName]>) => void,
|
||||
): EventEmitter<EventTypes>;
|
||||
emit<EventName extends keyof EventTypes>(
|
||||
event: EventName,
|
||||
...args: EventArgs<EventTypes[EventName]>
|
||||
): boolean;
|
||||
}
|
||||
export declare class EventEmitter<EventTypes> {
|
||||
private callbacks;
|
||||
private init;
|
||||
}
|
||||
export {};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/ecma402-abstract/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CASvD;AAED,wBAAgB,eAAe,CAC7B,QAAQ,SAAS,MAAM,EACvB,QAAQ,SAAS,MAAM,EACvB,KAAK,SAAS,MAAM,QAAQ,EAE5B,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAChC,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,QAOpC;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,SAAS,MAAM,EACvB,QAAQ,SAAS,MAAM,EACvB,CAAC,SAAS,MAAM,QAAQ,EAExB,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAChC,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAKtC;AAED,wBAAgB,eAAe,CAC7B,QAAQ,SAAS,MAAM,EACvB,QAAQ,SAAS,MAAM,EACvB,KAAK,SAAS,MAAM,QAAQ,EAE5B,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAChC,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,KAAK,GACX,QAAQ,CAAC,KAAK,CAAC,CAEjB;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,SAAS,MAAM,EACvB,QAAQ,SAAS,MAAM,EACvB,KAAK,SAAS,MAAM,QAAQ,EAE5B,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAChC,EAAE,EAAE,QAAQ,EACZ,GAAG,MAAM,EAAE,KAAK,EAAE,GACjB,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CASvB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,aAAa,CAC3B,WAAW,EAAE,WAAW,GAAG;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,GACxD,WAAW,IAAI,WAAW,CAE5B;AAYD,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,EAAC,KAAK,EAAC,EAAE;IAAC,KAAK,EAAE,GAAG,CAAA;CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,QAQtC;AAED,eAAO,MAAM,gCAAgC,QAA4B,CAAA;AAEzE,wBAAgB,SAAS,CACvB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,GAAW,GACf,OAAO,CAAC,SAAS,CAInB"}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"max-statements": [2, 12],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
- 0.10
|
||||
@@ -0,0 +1,51 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { Unsubscribable, ObservableInput, ObservedValueOf } from '../types';
|
||||
import { innerFrom } from './innerFrom';
|
||||
import { EMPTY } from './empty';
|
||||
|
||||
/**
|
||||
* Creates an Observable that uses a resource which will be disposed at the same time as the Observable.
|
||||
*
|
||||
* <span class="informal">Use it when you catch yourself cleaning up after an Observable.</span>
|
||||
*
|
||||
* `using` is a factory operator, which accepts two functions. First function returns a disposable resource.
|
||||
* It can be an arbitrary object that implements `unsubscribe` method. Second function will be injected with
|
||||
* that object and should return an Observable. That Observable can use resource object during its execution.
|
||||
* Both functions passed to `using` will be called every time someone subscribes - neither an Observable nor
|
||||
* resource object will be shared in any way between subscriptions.
|
||||
*
|
||||
* When Observable returned by `using` is subscribed, Observable returned from the second function will be subscribed
|
||||
* as well. All its notifications (nexted values, completion and error events) will be emitted unchanged by the output
|
||||
* Observable. If however someone unsubscribes from the Observable or source Observable completes or errors by itself,
|
||||
* the `unsubscribe` method on resource object will be called. This can be used to do any necessary clean up, which
|
||||
* otherwise would have to be handled by hand. Note that complete or error notifications are not emitted when someone
|
||||
* cancels subscription to an Observable via `unsubscribe`, so `using` can be used as a hook, allowing you to make
|
||||
* sure that all resources which need to exist during an Observable execution will be disposed at appropriate time.
|
||||
*
|
||||
* @see {@link defer}
|
||||
*
|
||||
* @param {function(): ISubscription} resourceFactory A function which creates any resource object
|
||||
* that implements `unsubscribe` method.
|
||||
* @param {function(resource: ISubscription): Observable<T>} observableFactory A function which
|
||||
* creates an Observable, that can use injected resource object.
|
||||
* @return {Observable<T>} An Observable that behaves the same as Observable returned by `observableFactory`, but
|
||||
* which - when completed, errored or unsubscribed - will also call `unsubscribe` on created resource object.
|
||||
*/
|
||||
export function using<T extends ObservableInput<any>>(
|
||||
resourceFactory: () => Unsubscribable | void,
|
||||
observableFactory: (resource: Unsubscribable | void) => T | void
|
||||
): Observable<ObservedValueOf<T>> {
|
||||
return new Observable<ObservedValueOf<T>>((subscriber) => {
|
||||
const resource = resourceFactory();
|
||||
const result = observableFactory(resource);
|
||||
const source = result ? innerFrom(result) : EMPTY;
|
||||
source.subscribe(subscriber);
|
||||
return () => {
|
||||
// NOTE: Optional chaining did not work here.
|
||||
// Related TS Issue: https://github.com/microsoft/TypeScript/issues/40818
|
||||
if (resource) {
|
||||
resource.unsubscribe();
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
var ExternalEditor = require('./main').ExternalEditor;
|
||||
var readline = require('readline');
|
||||
|
||||
var rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: null
|
||||
});
|
||||
|
||||
var message = '\n\n# Please Write a message\n# Any line starting with # is ignored';
|
||||
|
||||
process.stdout.write('Please write a message. (press enter to launch your preferred editor)');
|
||||
|
||||
editor = new ExternalEditor(message);
|
||||
|
||||
rl.on('line', function () {
|
||||
try {
|
||||
rl.pause();
|
||||
editor.runAsync(function (error, response)
|
||||
{
|
||||
if (error) {
|
||||
process.stdout.write(error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
if (response.length === 0) {
|
||||
readline.moveCursor(process.stdout, 0, -1);
|
||||
process.stdout.write('Your message was empty, please try again. (press enter to launch your preferred editor)');
|
||||
rl.resume();
|
||||
} else {
|
||||
process.stdout.write('Your Message:\n');
|
||||
process.stdout.write(response);
|
||||
process.stdout.write('\n');
|
||||
rl.close();
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
process.stderr.write(err.message);
|
||||
process.stdout.write('\n');
|
||||
rl.close();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
import { VNode } from 'preact';
|
||||
export declare function decode(content: string): string;
|
||||
export declare function html(content: string, parentElement?: string): VNode;
|
||||
@@ -0,0 +1,223 @@
|
||||
body, html {
|
||||
margin:0; padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
font-family: Helvetica Neue, Helvetica, Arial;
|
||||
font-size: 14px;
|
||||
color:#333;
|
||||
}
|
||||
.small { font-size: 12px; }
|
||||
*, *:after, *:before {
|
||||
-webkit-box-sizing:border-box;
|
||||
-moz-box-sizing:border-box;
|
||||
box-sizing:border-box;
|
||||
}
|
||||
h1 { font-size: 20px; margin: 0;}
|
||||
h2 { font-size: 14px; }
|
||||
pre {
|
||||
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
-moz-tab-size: 2;
|
||||
-o-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
a { color:#0074D9; text-decoration:none; }
|
||||
a:hover { text-decoration:underline; }
|
||||
.strong { font-weight: bold; }
|
||||
.space-top1 { padding: 10px 0 0 0; }
|
||||
.pad2y { padding: 20px 0; }
|
||||
.pad1y { padding: 10px 0; }
|
||||
.pad2x { padding: 0 20px; }
|
||||
.pad2 { padding: 20px; }
|
||||
.pad1 { padding: 10px; }
|
||||
.space-left2 { padding-left:55px; }
|
||||
.space-right2 { padding-right:20px; }
|
||||
.center { text-align:center; }
|
||||
.clearfix { display:block; }
|
||||
.clearfix:after {
|
||||
content:'';
|
||||
display:block;
|
||||
height:0;
|
||||
clear:both;
|
||||
visibility:hidden;
|
||||
}
|
||||
.fl { float: left; }
|
||||
@media only screen and (max-width:640px) {
|
||||
.col3 { width:100%; max-width:100%; }
|
||||
.hide-mobile { display:none!important; }
|
||||
}
|
||||
|
||||
.quiet {
|
||||
color: #7f7f7f;
|
||||
color: rgba(0,0,0,0.5);
|
||||
}
|
||||
.quiet a { opacity: 0.7; }
|
||||
|
||||
.fraction {
|
||||
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
font-size: 10px;
|
||||
color: #555;
|
||||
background: #E8E8E8;
|
||||
padding: 4px 5px;
|
||||
border-radius: 3px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
div.path a:link, div.path a:visited { color: #333; }
|
||||
table.coverage {
|
||||
border-collapse: collapse;
|
||||
margin: 10px 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table.coverage td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
table.coverage td.line-count {
|
||||
text-align: right;
|
||||
padding: 0 5px 0 20px;
|
||||
}
|
||||
table.coverage td.line-coverage {
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
min-width:20px;
|
||||
}
|
||||
|
||||
table.coverage td span.cline-any {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
width: 100%;
|
||||
}
|
||||
.missing-if-branch {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
border-radius: 3px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #333;
|
||||
color: yellow;
|
||||
}
|
||||
|
||||
.skip-if-branch {
|
||||
display: none;
|
||||
margin-right: 10px;
|
||||
position: relative;
|
||||
padding: 0 4px;
|
||||
background: #ccc;
|
||||
color: white;
|
||||
}
|
||||
.missing-if-branch .typ, .skip-if-branch .typ {
|
||||
color: inherit !important;
|
||||
}
|
||||
.coverage-summary {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
||||
.keyline-all { border: 1px solid #ddd; }
|
||||
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
||||
.coverage-summary tbody { border: 1px solid #bbb; }
|
||||
.coverage-summary td { border-right: 1px solid #bbb; }
|
||||
.coverage-summary td:last-child { border-right: none; }
|
||||
.coverage-summary th {
|
||||
text-align: left;
|
||||
font-weight: normal;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.coverage-summary th.file { border-right: none !important; }
|
||||
.coverage-summary th.pct { }
|
||||
.coverage-summary th.pic,
|
||||
.coverage-summary th.abs,
|
||||
.coverage-summary td.pct,
|
||||
.coverage-summary td.abs { text-align: right; }
|
||||
.coverage-summary td.file { white-space: nowrap; }
|
||||
.coverage-summary td.pic { min-width: 120px !important; }
|
||||
.coverage-summary tfoot td { }
|
||||
|
||||
.coverage-summary .sorter {
|
||||
height: 10px;
|
||||
width: 7px;
|
||||
display: inline-block;
|
||||
margin-left: 0.5em;
|
||||
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
||||
}
|
||||
.coverage-summary .sorted .sorter {
|
||||
background-position: 0 -20px;
|
||||
}
|
||||
.coverage-summary .sorted-desc .sorter {
|
||||
background-position: 0 -10px;
|
||||
}
|
||||
.status-line { height: 10px; }
|
||||
/* yellow */
|
||||
.cbranch-no { background: yellow !important; color: #111; }
|
||||
/* dark red */
|
||||
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
||||
.low .chart { border:1px solid #C21F39 }
|
||||
.highlighted,
|
||||
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
|
||||
background: #C21F39 !important;
|
||||
}
|
||||
/* medium red */
|
||||
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
||||
/* light red */
|
||||
.low, .cline-no { background:#FCE1E5 }
|
||||
/* light green */
|
||||
.high, .cline-yes { background:rgb(230,245,208) }
|
||||
/* medium green */
|
||||
.cstat-yes { background:rgb(161,215,106) }
|
||||
/* dark green */
|
||||
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
||||
.high .chart { border:1px solid rgb(77,146,33) }
|
||||
|
||||
.medium .chart { border:1px solid #666; }
|
||||
.medium .cover-fill { background: #666; }
|
||||
|
||||
.cstat-skip { background: #ddd; color: #111; }
|
||||
.fstat-skip { background: #ddd; color: #111 !important; }
|
||||
.cbranch-skip { background: #ddd !important; color: #111; }
|
||||
|
||||
span.cline-neutral { background: #eaeaea; }
|
||||
.medium { background: #eaeaea; }
|
||||
|
||||
.coverage-summary td.empty {
|
||||
opacity: .5;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
line-height: 1;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.cover-fill, .cover-empty {
|
||||
display:inline-block;
|
||||
height: 12px;
|
||||
}
|
||||
.chart {
|
||||
line-height: 0;
|
||||
}
|
||||
.cover-empty {
|
||||
background: white;
|
||||
}
|
||||
.cover-full {
|
||||
border-right: none !important;
|
||||
}
|
||||
pre.prettyprint {
|
||||
border: none !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
.com { color: #999 !important; }
|
||||
.ignore-none { color: #999; font-weight: normal; }
|
||||
|
||||
.wrapper {
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%;
|
||||
margin: 0 auto -48px;
|
||||
}
|
||||
.footer, .push {
|
||||
height: 48px;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('flattenDepth', require('../flattenDepth'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (value) {
|
||||
try { value = Number(value); }
|
||||
catch (e) { return false; }
|
||||
if (isNaN(value)) return false;
|
||||
if (Math.abs(value) > 8.64e15) return false;
|
||||
return true;
|
||||
};
|
||||
@@ -0,0 +1,88 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { innerFrom } from './innerFrom';
|
||||
import { Subscription } from '../Subscription';
|
||||
import { ObservableInput, ObservableInputTuple } from '../types';
|
||||
import { argsOrArgArray } from '../util/argsOrArgArray';
|
||||
import { createOperatorSubscriber } from '../operators/OperatorSubscriber';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
|
||||
export function race<T extends readonly unknown[]>(inputs: [...ObservableInputTuple<T>]): Observable<T[number]>;
|
||||
export function race<T extends readonly unknown[]>(...inputs: [...ObservableInputTuple<T>]): Observable<T[number]>;
|
||||
|
||||
/**
|
||||
* Returns an observable that mirrors the first source observable to emit an item.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* `race` returns an observable, that when subscribed to, subscribes to all source observables immediately.
|
||||
* As soon as one of the source observables emits a value, the result unsubscribes from the other sources.
|
||||
* The resulting observable will forward all notifications, including error and completion, from the "winning"
|
||||
* source observable.
|
||||
*
|
||||
* If one of the used source observable throws an errors before a first notification
|
||||
* the race operator will also throw an error, no matter if another source observable
|
||||
* could potentially win the race.
|
||||
*
|
||||
* `race` can be useful for selecting the response from the fastest network connection for
|
||||
* HTTP or WebSockets. `race` can also be useful for switching observable context based on user
|
||||
* input.
|
||||
*
|
||||
* ## Example
|
||||
*
|
||||
* Subscribes to the observable that was the first to start emitting.
|
||||
*
|
||||
* ```ts
|
||||
* import { interval, map, race } from 'rxjs';
|
||||
*
|
||||
* const obs1 = interval(7000).pipe(map(() => 'slow one'));
|
||||
* const obs2 = interval(3000).pipe(map(() => 'fast one'));
|
||||
* const obs3 = interval(5000).pipe(map(() => 'medium one'));
|
||||
*
|
||||
* race(obs1, obs2, obs3)
|
||||
* .subscribe(winner => console.log(winner));
|
||||
*
|
||||
* // Outputs
|
||||
* // a series of 'fast one'
|
||||
* ```
|
||||
*
|
||||
* @param {...Observables} ...observables sources used to race for which Observable emits first.
|
||||
* @return {Observable} an Observable that mirrors the output of the first Observable to emit an item.
|
||||
*/
|
||||
export function race<T>(...sources: (ObservableInput<T> | ObservableInput<T>[])[]): Observable<any> {
|
||||
sources = argsOrArgArray(sources);
|
||||
// If only one source was passed, just return it. Otherwise return the race.
|
||||
return sources.length === 1 ? innerFrom(sources[0] as ObservableInput<T>) : new Observable<T>(raceInit(sources as ObservableInput<T>[]));
|
||||
}
|
||||
|
||||
/**
|
||||
* An observable initializer function for both the static version and the
|
||||
* operator version of race.
|
||||
* @param sources The sources to race
|
||||
*/
|
||||
export function raceInit<T>(sources: ObservableInput<T>[]) {
|
||||
return (subscriber: Subscriber<T>) => {
|
||||
let subscriptions: Subscription[] = [];
|
||||
|
||||
// Subscribe to all of the sources. Note that we are checking `subscriptions` here
|
||||
// Is is an array of all actively "racing" subscriptions, and it is `null` after the
|
||||
// race has been won. So, if we have racer that synchronously "wins", this loop will
|
||||
// stop before it subscribes to any more.
|
||||
for (let i = 0; subscriptions && !subscriber.closed && i < sources.length; i++) {
|
||||
subscriptions.push(
|
||||
innerFrom(sources[i] as ObservableInput<T>).subscribe(
|
||||
createOperatorSubscriber(subscriber, (value) => {
|
||||
if (subscriptions) {
|
||||
// We're still racing, but we won! So unsubscribe
|
||||
// all other subscriptions that we have, except this one.
|
||||
for (let s = 0; s < subscriptions.length; s++) {
|
||||
s !== i && subscriptions[s].unsubscribe();
|
||||
}
|
||||
subscriptions = null!;
|
||||
}
|
||||
subscriber.next(value);
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"func-name-matching": 0,
|
||||
"id-length": 0,
|
||||
"new-cap": [2, {
|
||||
"capIsNewExceptions": ["GetIntrinsic"],
|
||||
}],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
const isYarnGlobal = () => {
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const isWindows = process.platform === 'win32';
|
||||
const yarnPath = isWindows
|
||||
? path.join('Yarn', 'config', 'global')
|
||||
: path.join('.config', 'yarn', 'global');
|
||||
return __dirname.includes(yarnPath);
|
||||
};
|
||||
export default isYarnGlobal;
|
||||
@@ -0,0 +1,14 @@
|
||||
var coreJsData = require('./_coreJsData'),
|
||||
isFunction = require('./isFunction'),
|
||||
stubFalse = require('./stubFalse');
|
||||
|
||||
/**
|
||||
* Checks if `func` is capable of being masked.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `func` is maskable, else `false`.
|
||||
*/
|
||||
var isMaskable = coreJsData ? isFunction : stubFalse;
|
||||
|
||||
module.exports = isMaskable;
|
||||
@@ -0,0 +1,9 @@
|
||||
import { reduce } from './reduce';
|
||||
import { operate } from '../util/lift';
|
||||
const arrReducer = (arr, value) => (arr.push(value), arr);
|
||||
export function toArray() {
|
||||
return operate((source, subscriber) => {
|
||||
reduce(arrReducer, [])(source).subscribe(subscriber);
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=toArray.js.map
|
||||
@@ -0,0 +1,4 @@
|
||||
import { MonoTypeOperatorFunction } from '../types';
|
||||
export declare function distinctUntilChanged<T>(comparator?: (previous: T, current: T) => boolean): MonoTypeOperatorFunction<T>;
|
||||
export declare function distinctUntilChanged<T, K>(comparator: (previous: K, current: K) => boolean, keySelector: (value: T) => K): MonoTypeOperatorFunction<T>;
|
||||
//# sourceMappingURL=distinctUntilChanged.d.ts.map
|
||||
@@ -0,0 +1,9 @@
|
||||
# `string.camelToHyphen()` _(ext/string\_/camel-to-hyphen)_
|
||||
|
||||
Convert camelCase string to hyphen separated, e.g. `oneTwoThree` into `one-to-three`. Useful when converting names from js property convention into filename convention.
|
||||
|
||||
```javascript
|
||||
const camelToHyphen = require("ext/string_/camelToHyphen");
|
||||
|
||||
camelToHyphen.call("razDwaTrzy"); // raz-dwa-trzy
|
||||
```
|
||||
@@ -0,0 +1,27 @@
|
||||
# camelcase-css [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
|
||||
|
||||
> Convert a kebab-cased CSS property into a camelCased DOM property.
|
||||
|
||||
|
||||
## Installation
|
||||
[Node.js](http://nodejs.org/) `>= 6` is required. Type this at the command line:
|
||||
```shell
|
||||
npm install camelcase-css
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
```js
|
||||
const camelCaseCSS = require('camelcase-css');
|
||||
|
||||
camelCaseCSS('-webkit-border-radius'); //-> WebkitBorderRadius
|
||||
camelCaseCSS('-moz-border-radius'); //-> MozBorderRadius
|
||||
camelCaseCSS('-ms-border-radius'); //-> msBorderRadius
|
||||
camelCaseCSS('border-radius'); //-> borderRadius
|
||||
```
|
||||
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/camelcase-css.svg
|
||||
[npm-url]: https://npmjs.org/package/camelcase-css
|
||||
[travis-image]: https://img.shields.io/travis/stevenvachon/camelcase-css.svg
|
||||
[travis-url]: https://travis-ci.org/stevenvachon/camelcase-css
|
||||
@@ -0,0 +1,79 @@
|
||||
import * as stream from 'stream';
|
||||
|
||||
declare const isStream: {
|
||||
/**
|
||||
@returns Whether `stream` is a [`Stream`](https://nodejs.org/api/stream.html#stream_stream).
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
|
||||
isStream({});
|
||||
//=> false
|
||||
```
|
||||
*/
|
||||
(stream: unknown): stream is stream.Stream;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Writable`](https://nodejs.org/api/stream.html#stream_class_stream_writable).
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream.writable(fs.createWriteStrem('unicorn.txt'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
writable(stream: unknown): stream is stream.Writable;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable).
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream.readable(fs.createReadStream('unicorn.png'));
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
readable(stream: unknown): stream is stream.Readable;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Duplex`](https://nodejs.org/api/stream.html#stream_class_stream_duplex).
|
||||
|
||||
@example
|
||||
```
|
||||
import {Duplex} from 'stream';
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream.duplex(new Duplex());
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
duplex(stream: unknown): stream is stream.Duplex;
|
||||
|
||||
/**
|
||||
@returns Whether `stream` is a [`stream.Transform`](https://nodejs.org/api/stream.html#stream_class_stream_transform).
|
||||
|
||||
@example
|
||||
```
|
||||
import * as fs from 'fs';
|
||||
import Stringify = require('streaming-json-stringify');
|
||||
import isStream = require('is-stream');
|
||||
|
||||
isStream.transform(Stringify());
|
||||
//=> true
|
||||
```
|
||||
*/
|
||||
transform(input: unknown): input is stream.Transform;
|
||||
};
|
||||
|
||||
export = isStream;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
||||
import type { Config } from './types/config'
|
||||
import { DefaultTheme } from './types/generated/default-theme'
|
||||
declare const theme: Config['theme'] & DefaultTheme
|
||||
export = theme
|
||||
@@ -0,0 +1,25 @@
|
||||
Copyright 2017 Kat Marchán
|
||||
Copyright npm, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
---
|
||||
|
||||
This library is a fork of 'better-json-errors' by Kat Marchán, extended and
|
||||
distributed under the terms of the MIT license above.
|
||||
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
var keys = require("../keys")
|
||||
, value = require("../valid-value")
|
||||
, max = Math.max;
|
||||
|
||||
module.exports = function (dest, src /*, …srcn*/) {
|
||||
var error, i, length = max(arguments.length, 2), assign;
|
||||
dest = Object(value(dest));
|
||||
assign = function (key) {
|
||||
try {
|
||||
dest[key] = src[key];
|
||||
} catch (e) {
|
||||
if (!error) error = e;
|
||||
}
|
||||
};
|
||||
for (i = 1; i < length; ++i) {
|
||||
src = arguments[i];
|
||||
keys(src).forEach(assign);
|
||||
}
|
||||
if (error !== undefined) throw error;
|
||||
return dest;
|
||||
};
|
||||
@@ -0,0 +1,102 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Code coverage report for csv2json/libs/core/index.js</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../../../prettify.css" />
|
||||
<link rel="stylesheet" href="../../../base.css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style type='text/css'>
|
||||
.coverage-summary .sorter {
|
||||
background-image: url(../../../sort-arrow-sprite.png);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='wrapper'>
|
||||
<div class='pad1'>
|
||||
<h1>
|
||||
<a href="../../../index.html">All files</a> / <a href="index.html">csv2json/libs/core</a> index.js
|
||||
</h1>
|
||||
<div class='clearfix'>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Statements</span>
|
||||
<span class='fraction'>0/3</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">100% </span>
|
||||
<span class="quiet">Branches</span>
|
||||
<span class='fraction'>0/0</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Functions</span>
|
||||
<span class='fraction'>0/1</span>
|
||||
</div>
|
||||
<div class='fl pad1y space-right2'>
|
||||
<span class="strong">0% </span>
|
||||
<span class="quiet">Lines</span>
|
||||
<span class='fraction'>0/3</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="quiet">
|
||||
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
||||
</p>
|
||||
</div>
|
||||
<div class='status-line low'></div>
|
||||
<pre><table class="coverage">
|
||||
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
||||
<a name='L2'></a><a href='#L2'>2</a>
|
||||
<a name='L3'></a><a href='#L3'>3</a>
|
||||
<a name='L4'></a><a href='#L4'>4</a>
|
||||
<a name='L5'></a><a href='#L5'>5</a>
|
||||
<a name='L6'></a><a href='#L6'>6</a>
|
||||
<a name='L7'></a><a href='#L7'>7</a>
|
||||
<a name='L8'></a><a href='#L8'>8</a>
|
||||
<a name='L9'></a><a href='#L9'>9</a>
|
||||
<a name='L10'></a><a href='#L10'>10</a>
|
||||
<a name='L11'></a><a href='#L11'>11</a>
|
||||
<a name='L12'></a><a href='#L12'>12</a></td><td class="line-coverage quiet"><span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span>
|
||||
<span class="cline-any cline-no">0</span></td><td class="text"><pre class="prettyprint lang-js">Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/index.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/index.js')
|
||||
Error: Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/index.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/index.js')
|
||||
at Context.defaultSourceLookup [as sourceFinder] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:15:15)
|
||||
at Context.getSource (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:74:17)
|
||||
at Object.annotateSourceCode (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:172:38)
|
||||
at HtmlReport.onDetail (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/index.js:237:39)
|
||||
at Visitor.(anonymous function) [as onDetail] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:34:30)
|
||||
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:123:17)
|
||||
at /Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:116:23
|
||||
at Array.forEach (native)
|
||||
at visitChildren (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:115:32)
|
||||
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:126:5)</pre></td></tr>
|
||||
</table></pre>
|
||||
<div class='push'></div><!-- for sticky footer -->
|
||||
</div><!-- /wrapper -->
|
||||
<div class='footer quiet pad2 space-top1 center small'>
|
||||
Code coverage
|
||||
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:36:07 GMT+0100 (IST)
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../../prettify.js"></script>
|
||||
<script>
|
||||
window.onload = function () {
|
||||
if (typeof prettyPrint === 'function') {
|
||||
prettyPrint();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script src="../../../sorter.js"></script>
|
||||
<script src="../../../block-navigation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,730 @@
|
||||
const { defaults } = require('./defaults.js');
|
||||
const {
|
||||
rtrim,
|
||||
splitCells,
|
||||
escape,
|
||||
findClosingBracket
|
||||
} = require('./helpers.js');
|
||||
|
||||
function outputLink(cap, link, raw) {
|
||||
const href = link.href;
|
||||
const title = link.title ? escape(link.title) : null;
|
||||
const text = cap[1].replace(/\\([\[\]])/g, '$1');
|
||||
|
||||
if (cap[0].charAt(0) !== '!') {
|
||||
return {
|
||||
type: 'link',
|
||||
raw,
|
||||
href,
|
||||
title,
|
||||
text
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: 'image',
|
||||
raw,
|
||||
href,
|
||||
title,
|
||||
text: escape(text)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function indentCodeCompensation(raw, text) {
|
||||
const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
|
||||
|
||||
if (matchIndentToCode === null) {
|
||||
return text;
|
||||
}
|
||||
|
||||
const indentToCode = matchIndentToCode[1];
|
||||
|
||||
return text
|
||||
.split('\n')
|
||||
.map(node => {
|
||||
const matchIndentInNode = node.match(/^\s+/);
|
||||
if (matchIndentInNode === null) {
|
||||
return node;
|
||||
}
|
||||
|
||||
const [indentInNode] = matchIndentInNode;
|
||||
|
||||
if (indentInNode.length >= indentToCode.length) {
|
||||
return node.slice(indentToCode.length);
|
||||
}
|
||||
|
||||
return node;
|
||||
})
|
||||
.join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tokenizer
|
||||
*/
|
||||
module.exports = class Tokenizer {
|
||||
constructor(options) {
|
||||
this.options = options || defaults;
|
||||
}
|
||||
|
||||
space(src) {
|
||||
const cap = this.rules.block.newline.exec(src);
|
||||
if (cap) {
|
||||
if (cap[0].length > 1) {
|
||||
return {
|
||||
type: 'space',
|
||||
raw: cap[0]
|
||||
};
|
||||
}
|
||||
return { raw: '\n' };
|
||||
}
|
||||
}
|
||||
|
||||
code(src) {
|
||||
const cap = this.rules.block.code.exec(src);
|
||||
if (cap) {
|
||||
const text = cap[0].replace(/^ {1,4}/gm, '');
|
||||
return {
|
||||
type: 'code',
|
||||
raw: cap[0],
|
||||
codeBlockStyle: 'indented',
|
||||
text: !this.options.pedantic
|
||||
? rtrim(text, '\n')
|
||||
: text
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
fences(src) {
|
||||
const cap = this.rules.block.fences.exec(src);
|
||||
if (cap) {
|
||||
const raw = cap[0];
|
||||
const text = indentCodeCompensation(raw, cap[3] || '');
|
||||
|
||||
return {
|
||||
type: 'code',
|
||||
raw,
|
||||
lang: cap[2] ? cap[2].trim() : cap[2],
|
||||
text
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
heading(src) {
|
||||
const cap = this.rules.block.heading.exec(src);
|
||||
if (cap) {
|
||||
let text = cap[2].trim();
|
||||
|
||||
// remove trailing #s
|
||||
if (/#$/.test(text)) {
|
||||
const trimmed = rtrim(text, '#');
|
||||
if (this.options.pedantic) {
|
||||
text = trimmed.trim();
|
||||
} else if (!trimmed || / $/.test(trimmed)) {
|
||||
// CommonMark requires space before trailing #s
|
||||
text = trimmed.trim();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'heading',
|
||||
raw: cap[0],
|
||||
depth: cap[1].length,
|
||||
text: text
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
nptable(src) {
|
||||
const cap = this.rules.block.nptable.exec(src);
|
||||
if (cap) {
|
||||
const item = {
|
||||
type: 'table',
|
||||
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
||||
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
||||
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [],
|
||||
raw: cap[0]
|
||||
};
|
||||
|
||||
if (item.header.length === item.align.length) {
|
||||
let l = item.align.length;
|
||||
let i;
|
||||
for (i = 0; i < l; i++) {
|
||||
if (/^ *-+: *$/.test(item.align[i])) {
|
||||
item.align[i] = 'right';
|
||||
} else if (/^ *:-+: *$/.test(item.align[i])) {
|
||||
item.align[i] = 'center';
|
||||
} else if (/^ *:-+ *$/.test(item.align[i])) {
|
||||
item.align[i] = 'left';
|
||||
} else {
|
||||
item.align[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
l = item.cells.length;
|
||||
for (i = 0; i < l; i++) {
|
||||
item.cells[i] = splitCells(item.cells[i], item.header.length);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hr(src) {
|
||||
const cap = this.rules.block.hr.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'hr',
|
||||
raw: cap[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
blockquote(src) {
|
||||
const cap = this.rules.block.blockquote.exec(src);
|
||||
if (cap) {
|
||||
const text = cap[0].replace(/^ *> ?/gm, '');
|
||||
|
||||
return {
|
||||
type: 'blockquote',
|
||||
raw: cap[0],
|
||||
text
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
list(src) {
|
||||
const cap = this.rules.block.list.exec(src);
|
||||
if (cap) {
|
||||
let raw = cap[0];
|
||||
const bull = cap[2];
|
||||
const isordered = bull.length > 1;
|
||||
|
||||
const list = {
|
||||
type: 'list',
|
||||
raw,
|
||||
ordered: isordered,
|
||||
start: isordered ? +bull.slice(0, -1) : '',
|
||||
loose: false,
|
||||
items: []
|
||||
};
|
||||
|
||||
// Get each top-level item.
|
||||
const itemMatch = cap[0].match(this.rules.block.item);
|
||||
|
||||
let next = false,
|
||||
item,
|
||||
space,
|
||||
bcurr,
|
||||
bnext,
|
||||
addBack,
|
||||
loose,
|
||||
istask,
|
||||
ischecked,
|
||||
endMatch;
|
||||
|
||||
let l = itemMatch.length;
|
||||
bcurr = this.rules.block.listItemStart.exec(itemMatch[0]);
|
||||
for (let i = 0; i < l; i++) {
|
||||
item = itemMatch[i];
|
||||
raw = item;
|
||||
|
||||
if (!this.options.pedantic) {
|
||||
// Determine if current item contains the end of the list
|
||||
endMatch = item.match(new RegExp('\\n\\s*\\n {0,' + (bcurr[0].length - 1) + '}\\S'));
|
||||
if (endMatch) {
|
||||
addBack = item.length - endMatch.index + itemMatch.slice(i + 1).join('\n').length;
|
||||
list.raw = list.raw.substring(0, list.raw.length - addBack);
|
||||
|
||||
item = item.substring(0, endMatch.index);
|
||||
raw = item;
|
||||
l = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Determine whether the next list item belongs here.
|
||||
// Backpedal if it does not belong in this list.
|
||||
if (i !== l - 1) {
|
||||
bnext = this.rules.block.listItemStart.exec(itemMatch[i + 1]);
|
||||
if (
|
||||
!this.options.pedantic
|
||||
? bnext[1].length >= bcurr[0].length || bnext[1].length > 3
|
||||
: bnext[1].length > bcurr[1].length
|
||||
) {
|
||||
// nested list or continuation
|
||||
itemMatch.splice(i, 2, itemMatch[i] + (!this.options.pedantic && bnext[1].length < bcurr[0].length && !itemMatch[i].match(/\n$/) ? '' : '\n') + itemMatch[i + 1]);
|
||||
i--;
|
||||
l--;
|
||||
continue;
|
||||
} else if (
|
||||
// different bullet style
|
||||
!this.options.pedantic || this.options.smartLists
|
||||
? bnext[2][bnext[2].length - 1] !== bull[bull.length - 1]
|
||||
: isordered === (bnext[2].length === 1)
|
||||
) {
|
||||
addBack = itemMatch.slice(i + 1).join('\n').length;
|
||||
list.raw = list.raw.substring(0, list.raw.length - addBack);
|
||||
i = l - 1;
|
||||
}
|
||||
bcurr = bnext;
|
||||
}
|
||||
|
||||
// Remove the list item's bullet
|
||||
// so it is seen as the next token.
|
||||
space = item.length;
|
||||
item = item.replace(/^ *([*+-]|\d+[.)]) ?/, '');
|
||||
|
||||
// Outdent whatever the
|
||||
// list item contains. Hacky.
|
||||
if (~item.indexOf('\n ')) {
|
||||
space -= item.length;
|
||||
item = !this.options.pedantic
|
||||
? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')
|
||||
: item.replace(/^ {1,4}/gm, '');
|
||||
}
|
||||
|
||||
// trim item newlines at end
|
||||
item = rtrim(item, '\n');
|
||||
if (i !== l - 1) {
|
||||
raw = raw + '\n';
|
||||
}
|
||||
|
||||
// Determine whether item is loose or not.
|
||||
// Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
|
||||
// for discount behavior.
|
||||
loose = next || /\n\n(?!\s*$)/.test(raw);
|
||||
if (i !== l - 1) {
|
||||
next = raw.slice(-2) === '\n\n';
|
||||
if (!loose) loose = next;
|
||||
}
|
||||
|
||||
if (loose) {
|
||||
list.loose = true;
|
||||
}
|
||||
|
||||
// Check for task list items
|
||||
if (this.options.gfm) {
|
||||
istask = /^\[[ xX]\] /.test(item);
|
||||
ischecked = undefined;
|
||||
if (istask) {
|
||||
ischecked = item[1] !== ' ';
|
||||
item = item.replace(/^\[[ xX]\] +/, '');
|
||||
}
|
||||
}
|
||||
|
||||
list.items.push({
|
||||
type: 'list_item',
|
||||
raw,
|
||||
task: istask,
|
||||
checked: ischecked,
|
||||
loose: loose,
|
||||
text: item
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
html(src) {
|
||||
const cap = this.rules.block.html.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: this.options.sanitize
|
||||
? 'paragraph'
|
||||
: 'html',
|
||||
raw: cap[0],
|
||||
pre: !this.options.sanitizer
|
||||
&& (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
||||
text: this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0])) : cap[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
def(src) {
|
||||
const cap = this.rules.block.def.exec(src);
|
||||
if (cap) {
|
||||
if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
|
||||
const tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
|
||||
return {
|
||||
type: 'def',
|
||||
tag,
|
||||
raw: cap[0],
|
||||
href: cap[2],
|
||||
title: cap[3]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
table(src) {
|
||||
const cap = this.rules.block.table.exec(src);
|
||||
if (cap) {
|
||||
const item = {
|
||||
type: 'table',
|
||||
header: splitCells(cap[1].replace(/^ *| *\| *$/g, '')),
|
||||
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
||||
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
|
||||
};
|
||||
|
||||
if (item.header.length === item.align.length) {
|
||||
item.raw = cap[0];
|
||||
|
||||
let l = item.align.length;
|
||||
let i;
|
||||
for (i = 0; i < l; i++) {
|
||||
if (/^ *-+: *$/.test(item.align[i])) {
|
||||
item.align[i] = 'right';
|
||||
} else if (/^ *:-+: *$/.test(item.align[i])) {
|
||||
item.align[i] = 'center';
|
||||
} else if (/^ *:-+ *$/.test(item.align[i])) {
|
||||
item.align[i] = 'left';
|
||||
} else {
|
||||
item.align[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
l = item.cells.length;
|
||||
for (i = 0; i < l; i++) {
|
||||
item.cells[i] = splitCells(
|
||||
item.cells[i].replace(/^ *\| *| *\| *$/g, ''),
|
||||
item.header.length);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lheading(src) {
|
||||
const cap = this.rules.block.lheading.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'heading',
|
||||
raw: cap[0],
|
||||
depth: cap[2].charAt(0) === '=' ? 1 : 2,
|
||||
text: cap[1]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
paragraph(src) {
|
||||
const cap = this.rules.block.paragraph.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'paragraph',
|
||||
raw: cap[0],
|
||||
text: cap[1].charAt(cap[1].length - 1) === '\n'
|
||||
? cap[1].slice(0, -1)
|
||||
: cap[1]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
text(src) {
|
||||
const cap = this.rules.block.text.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'text',
|
||||
raw: cap[0],
|
||||
text: cap[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
escape(src) {
|
||||
const cap = this.rules.inline.escape.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'escape',
|
||||
raw: cap[0],
|
||||
text: escape(cap[1])
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
tag(src, inLink, inRawBlock) {
|
||||
const cap = this.rules.inline.tag.exec(src);
|
||||
if (cap) {
|
||||
if (!inLink && /^<a /i.test(cap[0])) {
|
||||
inLink = true;
|
||||
} else if (inLink && /^<\/a>/i.test(cap[0])) {
|
||||
inLink = false;
|
||||
}
|
||||
if (!inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
||||
inRawBlock = true;
|
||||
} else if (inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
||||
inRawBlock = false;
|
||||
}
|
||||
|
||||
return {
|
||||
type: this.options.sanitize
|
||||
? 'text'
|
||||
: 'html',
|
||||
raw: cap[0],
|
||||
inLink,
|
||||
inRawBlock,
|
||||
text: this.options.sanitize
|
||||
? (this.options.sanitizer
|
||||
? this.options.sanitizer(cap[0])
|
||||
: escape(cap[0]))
|
||||
: cap[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
link(src) {
|
||||
const cap = this.rules.inline.link.exec(src);
|
||||
if (cap) {
|
||||
const trimmedUrl = cap[2].trim();
|
||||
if (!this.options.pedantic && /^</.test(trimmedUrl)) {
|
||||
// commonmark requires matching angle brackets
|
||||
if (!(/>$/.test(trimmedUrl))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ending angle bracket cannot be escaped
|
||||
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
|
||||
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// find closing parenthesis
|
||||
const lastParenIndex = findClosingBracket(cap[2], '()');
|
||||
if (lastParenIndex > -1) {
|
||||
const start = cap[0].indexOf('!') === 0 ? 5 : 4;
|
||||
const linkLen = start + cap[1].length + lastParenIndex;
|
||||
cap[2] = cap[2].substring(0, lastParenIndex);
|
||||
cap[0] = cap[0].substring(0, linkLen).trim();
|
||||
cap[3] = '';
|
||||
}
|
||||
}
|
||||
let href = cap[2];
|
||||
let title = '';
|
||||
if (this.options.pedantic) {
|
||||
// split pedantic href and title
|
||||
const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
|
||||
|
||||
if (link) {
|
||||
href = link[1];
|
||||
title = link[3];
|
||||
}
|
||||
} else {
|
||||
title = cap[3] ? cap[3].slice(1, -1) : '';
|
||||
}
|
||||
|
||||
href = href.trim();
|
||||
if (/^</.test(href)) {
|
||||
if (this.options.pedantic && !(/>$/.test(trimmedUrl))) {
|
||||
// pedantic allows starting angle bracket without ending angle bracket
|
||||
href = href.slice(1);
|
||||
} else {
|
||||
href = href.slice(1, -1);
|
||||
}
|
||||
}
|
||||
return outputLink(cap, {
|
||||
href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
|
||||
title: title ? title.replace(this.rules.inline._escapes, '$1') : title
|
||||
}, cap[0]);
|
||||
}
|
||||
}
|
||||
|
||||
reflink(src, links) {
|
||||
let cap;
|
||||
if ((cap = this.rules.inline.reflink.exec(src))
|
||||
|| (cap = this.rules.inline.nolink.exec(src))) {
|
||||
let link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
|
||||
link = links[link.toLowerCase()];
|
||||
if (!link || !link.href) {
|
||||
const text = cap[0].charAt(0);
|
||||
return {
|
||||
type: 'text',
|
||||
raw: text,
|
||||
text
|
||||
};
|
||||
}
|
||||
return outputLink(cap, link, cap[0]);
|
||||
}
|
||||
}
|
||||
|
||||
emStrong(src, maskedSrc, prevChar = '') {
|
||||
let match = this.rules.inline.emStrong.lDelim.exec(src);
|
||||
if (!match) return;
|
||||
|
||||
if (match[3] && prevChar.match(/[\p{L}\p{N}]/u)) return; // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
|
||||
|
||||
const nextChar = match[1] || match[2] || '';
|
||||
|
||||
if (!nextChar || (nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
|
||||
const lLength = match[0].length - 1;
|
||||
let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
|
||||
|
||||
const endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
|
||||
endReg.lastIndex = 0;
|
||||
|
||||
maskedSrc = maskedSrc.slice(-1 * src.length + lLength); // Bump maskedSrc to same section of string as src (move to lexer?)
|
||||
|
||||
while ((match = endReg.exec(maskedSrc)) != null) {
|
||||
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
||||
|
||||
if (!rDelim) continue; // matched the first alternative in rules.js (skip the * in __abc*abc__)
|
||||
|
||||
rLength = rDelim.length;
|
||||
|
||||
if (match[3] || match[4]) { // found another Left Delim
|
||||
delimTotal += rLength;
|
||||
continue;
|
||||
} else if (match[5] || match[6]) { // either Left or Right Delim
|
||||
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
||||
midDelimTotal += rLength;
|
||||
continue; // CommonMark Emphasis Rules 9-10
|
||||
}
|
||||
}
|
||||
|
||||
delimTotal -= rLength;
|
||||
|
||||
if (delimTotal > 0) continue; // Haven't found enough closing delimiters
|
||||
|
||||
// If this is the last rDelimiter, remove extra characters. *a*** -> *a*
|
||||
if (delimTotal + midDelimTotal - rLength <= 0 && !maskedSrc.slice(endReg.lastIndex).match(endReg)) {
|
||||
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
||||
}
|
||||
|
||||
if (Math.min(lLength, rLength) % 2) {
|
||||
return {
|
||||
type: 'em',
|
||||
raw: src.slice(0, lLength + match.index + rLength + 1),
|
||||
text: src.slice(1, lLength + match.index + rLength)
|
||||
};
|
||||
}
|
||||
if (Math.min(lLength, rLength) % 2 === 0) {
|
||||
return {
|
||||
type: 'strong',
|
||||
raw: src.slice(0, lLength + match.index + rLength + 1),
|
||||
text: src.slice(2, lLength + match.index + rLength - 1)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
codespan(src) {
|
||||
const cap = this.rules.inline.code.exec(src);
|
||||
if (cap) {
|
||||
let text = cap[2].replace(/\n/g, ' ');
|
||||
const hasNonSpaceChars = /[^ ]/.test(text);
|
||||
const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
|
||||
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
||||
text = text.substring(1, text.length - 1);
|
||||
}
|
||||
text = escape(text, true);
|
||||
return {
|
||||
type: 'codespan',
|
||||
raw: cap[0],
|
||||
text
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
br(src) {
|
||||
const cap = this.rules.inline.br.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'br',
|
||||
raw: cap[0]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
del(src) {
|
||||
const cap = this.rules.inline.del.exec(src);
|
||||
if (cap) {
|
||||
return {
|
||||
type: 'del',
|
||||
raw: cap[0],
|
||||
text: cap[2]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
autolink(src, mangle) {
|
||||
const cap = this.rules.inline.autolink.exec(src);
|
||||
if (cap) {
|
||||
let text, href;
|
||||
if (cap[2] === '@') {
|
||||
text = escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
|
||||
href = 'mailto:' + text;
|
||||
} else {
|
||||
text = escape(cap[1]);
|
||||
href = text;
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'link',
|
||||
raw: cap[0],
|
||||
text,
|
||||
href,
|
||||
tokens: [
|
||||
{
|
||||
type: 'text',
|
||||
raw: text,
|
||||
text
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
url(src, mangle) {
|
||||
let cap;
|
||||
if (cap = this.rules.inline.url.exec(src)) {
|
||||
let text, href;
|
||||
if (cap[2] === '@') {
|
||||
text = escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
|
||||
href = 'mailto:' + text;
|
||||
} else {
|
||||
// do extended autolink path validation
|
||||
let prevCapZero;
|
||||
do {
|
||||
prevCapZero = cap[0];
|
||||
cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
|
||||
} while (prevCapZero !== cap[0]);
|
||||
text = escape(cap[0]);
|
||||
if (cap[1] === 'www.') {
|
||||
href = 'http://' + text;
|
||||
} else {
|
||||
href = text;
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: 'link',
|
||||
raw: cap[0],
|
||||
text,
|
||||
href,
|
||||
tokens: [
|
||||
{
|
||||
type: 'text',
|
||||
raw: text,
|
||||
text
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
inlineText(src, inRawBlock, smartypants) {
|
||||
const cap = this.rules.inline.text.exec(src);
|
||||
if (cap) {
|
||||
let text;
|
||||
if (inRawBlock) {
|
||||
text = this.options.sanitize ? (this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0])) : cap[0];
|
||||
} else {
|
||||
text = escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
|
||||
}
|
||||
return {
|
||||
type: 'text',
|
||||
raw: cap[0],
|
||||
text
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,125 @@
|
||||
const isWindows = process.platform === 'win32' ||
|
||||
process.env.OSTYPE === 'cygwin' ||
|
||||
process.env.OSTYPE === 'msys'
|
||||
|
||||
const path = require('path')
|
||||
const COLON = isWindows ? ';' : ':'
|
||||
const isexe = require('isexe')
|
||||
|
||||
const getNotFoundError = (cmd) =>
|
||||
Object.assign(new Error(`not found: ${cmd}`), { code: 'ENOENT' })
|
||||
|
||||
const getPathInfo = (cmd, opt) => {
|
||||
const colon = opt.colon || COLON
|
||||
|
||||
// If it has a slash, then we don't bother searching the pathenv.
|
||||
// just check the file itself, and that's it.
|
||||
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? ['']
|
||||
: (
|
||||
[
|
||||
// windows always checks the cwd first
|
||||
...(isWindows ? [process.cwd()] : []),
|
||||
...(opt.path || process.env.PATH ||
|
||||
/* istanbul ignore next: very unusual */ '').split(colon),
|
||||
]
|
||||
)
|
||||
const pathExtExe = isWindows
|
||||
? opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM'
|
||||
: ''
|
||||
const pathExt = isWindows ? pathExtExe.split(colon) : ['']
|
||||
|
||||
if (isWindows) {
|
||||
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
|
||||
pathExt.unshift('')
|
||||
}
|
||||
|
||||
return {
|
||||
pathEnv,
|
||||
pathExt,
|
||||
pathExtExe,
|
||||
}
|
||||
}
|
||||
|
||||
const which = (cmd, opt, cb) => {
|
||||
if (typeof opt === 'function') {
|
||||
cb = opt
|
||||
opt = {}
|
||||
}
|
||||
if (!opt)
|
||||
opt = {}
|
||||
|
||||
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
|
||||
const found = []
|
||||
|
||||
const step = i => new Promise((resolve, reject) => {
|
||||
if (i === pathEnv.length)
|
||||
return opt.all && found.length ? resolve(found)
|
||||
: reject(getNotFoundError(cmd))
|
||||
|
||||
const ppRaw = pathEnv[i]
|
||||
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
|
||||
|
||||
const pCmd = path.join(pathPart, cmd)
|
||||
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
|
||||
: pCmd
|
||||
|
||||
resolve(subStep(p, i, 0))
|
||||
})
|
||||
|
||||
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
||||
if (ii === pathExt.length)
|
||||
return resolve(step(i + 1))
|
||||
const ext = pathExt[ii]
|
||||
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
||||
if (!er && is) {
|
||||
if (opt.all)
|
||||
found.push(p + ext)
|
||||
else
|
||||
return resolve(p + ext)
|
||||
}
|
||||
return resolve(subStep(p, i, ii + 1))
|
||||
})
|
||||
})
|
||||
|
||||
return cb ? step(0).then(res => cb(null, res), cb) : step(0)
|
||||
}
|
||||
|
||||
const whichSync = (cmd, opt) => {
|
||||
opt = opt || {}
|
||||
|
||||
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt)
|
||||
const found = []
|
||||
|
||||
for (let i = 0; i < pathEnv.length; i ++) {
|
||||
const ppRaw = pathEnv[i]
|
||||
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw
|
||||
|
||||
const pCmd = path.join(pathPart, cmd)
|
||||
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
|
||||
: pCmd
|
||||
|
||||
for (let j = 0; j < pathExt.length; j ++) {
|
||||
const cur = p + pathExt[j]
|
||||
try {
|
||||
const is = isexe.sync(cur, { pathExt: pathExtExe })
|
||||
if (is) {
|
||||
if (opt.all)
|
||||
found.push(cur)
|
||||
else
|
||||
return cur
|
||||
}
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (opt.all && found.length)
|
||||
return found
|
||||
|
||||
if (opt.nothrow)
|
||||
return null
|
||||
|
||||
throw getNotFoundError(cmd)
|
||||
}
|
||||
|
||||
module.exports = which
|
||||
which.sync = whichSync
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"isPromise.js","sourceRoot":"","sources":["../../../../src/internal/util/isPromise.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAM1C,SAAgB,SAAS,CAAC,KAAU;IAClC,OAAO,uBAAU,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC,CAAC;AACjC,CAAC;AAFD,8BAEC"}
|
||||
@@ -0,0 +1,17 @@
|
||||
import BaseStore from '../../base/store';
|
||||
import { SortActionsType } from './actions';
|
||||
import { Comparator, TCell } from '../../../types';
|
||||
export declare type SortStoreState = {
|
||||
index: number;
|
||||
direction: 1 | -1;
|
||||
compare?: Comparator<TCell>;
|
||||
}[];
|
||||
export declare class SortStore extends BaseStore<
|
||||
SortStoreState,
|
||||
SortActionsType
|
||||
> {
|
||||
getInitialState(): SortStoreState;
|
||||
handle(type: any, payload: any): void;
|
||||
private sortToggle;
|
||||
private sortColumn;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('toJSON', require('../toJSON'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.0.1](https://github.com/ljharb/gopd/compare/v1.0.0...v1.0.1) - 2022-11-01
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] actually export gOPD instead of dP [`4b624bf`](https://github.com/ljharb/gopd/commit/4b624bfbeff788c5e3ff16d9443a83627847234f)
|
||||
|
||||
## v1.0.0 - 2022-11-01
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial implementation, tests, readme [`0911e01`](https://github.com/ljharb/gopd/commit/0911e012cd642092bd88b732c161c58bf4f20bea)
|
||||
- Initial commit [`b84e33f`](https://github.com/ljharb/gopd/commit/b84e33f5808a805ac57ff88d4247ad935569acbe)
|
||||
- [actions] add reusable workflows [`12ae28a`](https://github.com/ljharb/gopd/commit/12ae28ae5f50f86e750215b6e2188901646d0119)
|
||||
- npm init [`280118b`](https://github.com/ljharb/gopd/commit/280118badb45c80b4483836b5cb5315bddf6e582)
|
||||
- [meta] add `auto-changelog` [`bb78de5`](https://github.com/ljharb/gopd/commit/bb78de5639a180747fb290c28912beaaf1615709)
|
||||
- [meta] create FUNDING.yml; add `funding` in package.json [`11c22e6`](https://github.com/ljharb/gopd/commit/11c22e6355bb01f24e7fac4c9bb3055eb5b25002)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`4f4537a`](https://github.com/ljharb/gopd/commit/4f4537a843b39f698c52f072845092e6fca345bb)
|
||||
- Only apps should have lockfiles [`c567022`](https://github.com/ljharb/gopd/commit/c567022a18573aa7951cf5399445d9840e23e98b)
|
||||
@@ -0,0 +1,60 @@
|
||||
import { EMPTY } from '../observable/empty';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { innerFrom } from '../observable/innerFrom';
|
||||
import { timer } from '../observable/timer';
|
||||
export function repeat(countOrConfig) {
|
||||
var _a;
|
||||
var count = Infinity;
|
||||
var delay;
|
||||
if (countOrConfig != null) {
|
||||
if (typeof countOrConfig === 'object') {
|
||||
(_a = countOrConfig.count, count = _a === void 0 ? Infinity : _a, delay = countOrConfig.delay);
|
||||
}
|
||||
else {
|
||||
count = countOrConfig;
|
||||
}
|
||||
}
|
||||
return count <= 0
|
||||
? function () { return EMPTY; }
|
||||
: operate(function (source, subscriber) {
|
||||
var soFar = 0;
|
||||
var sourceSub;
|
||||
var resubscribe = function () {
|
||||
sourceSub === null || sourceSub === void 0 ? void 0 : sourceSub.unsubscribe();
|
||||
sourceSub = null;
|
||||
if (delay != null) {
|
||||
var notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(soFar));
|
||||
var notifierSubscriber_1 = createOperatorSubscriber(subscriber, function () {
|
||||
notifierSubscriber_1.unsubscribe();
|
||||
subscribeToSource();
|
||||
});
|
||||
notifier.subscribe(notifierSubscriber_1);
|
||||
}
|
||||
else {
|
||||
subscribeToSource();
|
||||
}
|
||||
};
|
||||
var subscribeToSource = function () {
|
||||
var syncUnsub = false;
|
||||
sourceSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, function () {
|
||||
if (++soFar < count) {
|
||||
if (sourceSub) {
|
||||
resubscribe();
|
||||
}
|
||||
else {
|
||||
syncUnsub = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
subscriber.complete();
|
||||
}
|
||||
}));
|
||||
if (syncUnsub) {
|
||||
resubscribe();
|
||||
}
|
||||
};
|
||||
subscribeToSource();
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=repeat.js.map
|
||||
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $push = callBound('Array.prototype.push');
|
||||
|
||||
var CodePointAt = require('./CodePointAt');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://262.ecma-international.org/12.0/#sec-stringtocodepoints
|
||||
|
||||
module.exports = function StringToCodePoints(string) {
|
||||
if (Type(string) !== 'String') {
|
||||
throw new $TypeError('Assertion failed: `string` must be a String');
|
||||
}
|
||||
var codePoints = [];
|
||||
var size = string.length;
|
||||
var position = 0;
|
||||
while (position < size) {
|
||||
var cp = CodePointAt(string, position);
|
||||
$push(codePoints, cp['[[CodePoint]]']);
|
||||
position += cp['[[CodeUnitCount]]'];
|
||||
}
|
||||
return codePoints;
|
||||
};
|
||||
@@ -0,0 +1,2 @@
|
||||
if(typeof cptable === 'undefined') cptable = {};
|
||||
cptable[28604] = (function(){ var d = "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ", D = [], e = {}; for(var i=0;i!=d.length;++i) { if(d.charCodeAt(i) !== 0xFFFD) e[d.charAt(i)] = i; D[i] = d.charAt(i); } return {"enc": e, "dec": D }; })();
|
||||
@@ -0,0 +1,116 @@
|
||||
const escape = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
'`': '`',
|
||||
'=': '='
|
||||
};
|
||||
|
||||
const badChars = /[&<>"'`=]/g,
|
||||
possible = /[&<>"'`=]/;
|
||||
|
||||
function escapeChar(chr) {
|
||||
return escape[chr];
|
||||
}
|
||||
|
||||
export function extend(obj /* , ...source */) {
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
for (let key in arguments[i]) {
|
||||
if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
|
||||
obj[key] = arguments[i][key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
export let toString = Object.prototype.toString;
|
||||
|
||||
// Sourced from lodash
|
||||
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
|
||||
/* eslint-disable func-style */
|
||||
let isFunction = function(value) {
|
||||
return typeof value === 'function';
|
||||
};
|
||||
// fallback for older versions of Chrome and Safari
|
||||
/* istanbul ignore next */
|
||||
if (isFunction(/x/)) {
|
||||
isFunction = function(value) {
|
||||
return (
|
||||
typeof value === 'function' &&
|
||||
toString.call(value) === '[object Function]'
|
||||
);
|
||||
};
|
||||
}
|
||||
export { isFunction };
|
||||
/* eslint-enable func-style */
|
||||
|
||||
/* istanbul ignore next */
|
||||
export const isArray =
|
||||
Array.isArray ||
|
||||
function(value) {
|
||||
return value && typeof value === 'object'
|
||||
? toString.call(value) === '[object Array]'
|
||||
: false;
|
||||
};
|
||||
|
||||
// Older IE versions do not directly support indexOf so we must implement our own, sadly.
|
||||
export function indexOf(array, value) {
|
||||
for (let i = 0, len = array.length; i < len; i++) {
|
||||
if (array[i] === value) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
export function escapeExpression(string) {
|
||||
if (typeof string !== 'string') {
|
||||
// don't escape SafeStrings, since they're already safe
|
||||
if (string && string.toHTML) {
|
||||
return string.toHTML();
|
||||
} else if (string == null) {
|
||||
return '';
|
||||
} else if (!string) {
|
||||
return string + '';
|
||||
}
|
||||
|
||||
// Force a string conversion as this will be done by the append regardless and
|
||||
// the regex test will do this transparently behind the scenes, causing issues if
|
||||
// an object's to string has escaped characters in it.
|
||||
string = '' + string;
|
||||
}
|
||||
|
||||
if (!possible.test(string)) {
|
||||
return string;
|
||||
}
|
||||
return string.replace(badChars, escapeChar);
|
||||
}
|
||||
|
||||
export function isEmpty(value) {
|
||||
if (!value && value !== 0) {
|
||||
return true;
|
||||
} else if (isArray(value) && value.length === 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function createFrame(object) {
|
||||
let frame = extend({}, object);
|
||||
frame._parent = object;
|
||||
return frame;
|
||||
}
|
||||
|
||||
export function blockParams(params, ids) {
|
||||
params.path = ids;
|
||||
return params;
|
||||
}
|
||||
|
||||
export function appendContextPath(contextPath, id) {
|
||||
return (contextPath ? contextPath + '.' : '') + id;
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
'use strict';
|
||||
const ansiStyles = require('ansi-styles');
|
||||
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
|
||||
const {
|
||||
stringReplaceAll,
|
||||
stringEncaseCRLFWithFirstIndex
|
||||
} = require('./util');
|
||||
|
||||
const {isArray} = Array;
|
||||
|
||||
// `supportsColor.level` → `ansiStyles.color[name]` mapping
|
||||
const levelMapping = [
|
||||
'ansi',
|
||||
'ansi',
|
||||
'ansi256',
|
||||
'ansi16m'
|
||||
];
|
||||
|
||||
const styles = Object.create(null);
|
||||
|
||||
const applyOptions = (object, options = {}) => {
|
||||
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
||||
throw new Error('The `level` option should be an integer from 0 to 3');
|
||||
}
|
||||
|
||||
// Detect level if not set manually
|
||||
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
||||
object.level = options.level === undefined ? colorLevel : options.level;
|
||||
};
|
||||
|
||||
class ChalkClass {
|
||||
constructor(options) {
|
||||
// eslint-disable-next-line no-constructor-return
|
||||
return chalkFactory(options);
|
||||
}
|
||||
}
|
||||
|
||||
const chalkFactory = options => {
|
||||
const chalk = {};
|
||||
applyOptions(chalk, options);
|
||||
|
||||
chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
|
||||
|
||||
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||
Object.setPrototypeOf(chalk.template, chalk);
|
||||
|
||||
chalk.template.constructor = () => {
|
||||
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
|
||||
};
|
||||
|
||||
chalk.template.Instance = ChalkClass;
|
||||
|
||||
return chalk.template;
|
||||
};
|
||||
|
||||
function Chalk(options) {
|
||||
return chalkFactory(options);
|
||||
}
|
||||
|
||||
for (const [styleName, style] of Object.entries(ansiStyles)) {
|
||||
styles[styleName] = {
|
||||
get() {
|
||||
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
|
||||
Object.defineProperty(this, styleName, {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
styles.visible = {
|
||||
get() {
|
||||
const builder = createBuilder(this, this._styler, true);
|
||||
Object.defineProperty(this, 'visible', {value: builder});
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
|
||||
const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
|
||||
|
||||
for (const model of usedModels) {
|
||||
styles[model] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
for (const model of usedModels) {
|
||||
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
|
||||
styles[bgModel] = {
|
||||
get() {
|
||||
const {level} = this;
|
||||
return function (...arguments_) {
|
||||
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
|
||||
return createBuilder(this, styler, this._isEmpty);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const proto = Object.defineProperties(() => {}, {
|
||||
...styles,
|
||||
level: {
|
||||
enumerable: true,
|
||||
get() {
|
||||
return this._generator.level;
|
||||
},
|
||||
set(level) {
|
||||
this._generator.level = level;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const createStyler = (open, close, parent) => {
|
||||
let openAll;
|
||||
let closeAll;
|
||||
if (parent === undefined) {
|
||||
openAll = open;
|
||||
closeAll = close;
|
||||
} else {
|
||||
openAll = parent.openAll + open;
|
||||
closeAll = close + parent.closeAll;
|
||||
}
|
||||
|
||||
return {
|
||||
open,
|
||||
close,
|
||||
openAll,
|
||||
closeAll,
|
||||
parent
|
||||
};
|
||||
};
|
||||
|
||||
const createBuilder = (self, _styler, _isEmpty) => {
|
||||
const builder = (...arguments_) => {
|
||||
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
|
||||
// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
|
||||
return applyStyle(builder, chalkTag(builder, ...arguments_));
|
||||
}
|
||||
|
||||
// Single argument is hot path, implicit coercion is faster than anything
|
||||
// eslint-disable-next-line no-implicit-coercion
|
||||
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
|
||||
};
|
||||
|
||||
// We alter the prototype because we must return a function, but there is
|
||||
// no way to create a function with a different prototype
|
||||
Object.setPrototypeOf(builder, proto);
|
||||
|
||||
builder._generator = self;
|
||||
builder._styler = _styler;
|
||||
builder._isEmpty = _isEmpty;
|
||||
|
||||
return builder;
|
||||
};
|
||||
|
||||
const applyStyle = (self, string) => {
|
||||
if (self.level <= 0 || !string) {
|
||||
return self._isEmpty ? '' : string;
|
||||
}
|
||||
|
||||
let styler = self._styler;
|
||||
|
||||
if (styler === undefined) {
|
||||
return string;
|
||||
}
|
||||
|
||||
const {openAll, closeAll} = styler;
|
||||
if (string.indexOf('\u001B') !== -1) {
|
||||
while (styler !== undefined) {
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
string = stringReplaceAll(string, styler.close, styler.open);
|
||||
|
||||
styler = styler.parent;
|
||||
}
|
||||
}
|
||||
|
||||
// We can move both next actions out of loop, because remaining actions in loop won't have
|
||||
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
|
||||
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
|
||||
const lfIndex = string.indexOf('\n');
|
||||
if (lfIndex !== -1) {
|
||||
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
||||
}
|
||||
|
||||
return openAll + string + closeAll;
|
||||
};
|
||||
|
||||
let template;
|
||||
const chalkTag = (chalk, ...strings) => {
|
||||
const [firstString] = strings;
|
||||
|
||||
if (!isArray(firstString) || !isArray(firstString.raw)) {
|
||||
// If chalk() was called by itself or with a string,
|
||||
// return the string itself as a string.
|
||||
return strings.join(' ');
|
||||
}
|
||||
|
||||
const arguments_ = strings.slice(1);
|
||||
const parts = [firstString.raw[0]];
|
||||
|
||||
for (let i = 1; i < firstString.length; i++) {
|
||||
parts.push(
|
||||
String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
|
||||
String(firstString.raw[i])
|
||||
);
|
||||
}
|
||||
|
||||
if (template === undefined) {
|
||||
template = require('./templates');
|
||||
}
|
||||
|
||||
return template(chalk, parts.join(''));
|
||||
};
|
||||
|
||||
Object.defineProperties(Chalk.prototype, styles);
|
||||
|
||||
const chalk = Chalk(); // eslint-disable-line new-cap
|
||||
chalk.supportsColor = stdoutColor;
|
||||
chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
|
||||
chalk.stderr.supportsColor = stderrColor;
|
||||
|
||||
module.exports = chalk;
|
||||
@@ -0,0 +1,69 @@
|
||||
import { OneDArray, TColumn, TwoDArray } from './types';
|
||||
import Base from './base';
|
||||
import { UserConfig } from './config';
|
||||
import { Component, ComponentChild, RefObject } from 'preact';
|
||||
declare class Header extends Base {
|
||||
private _columns;
|
||||
constructor();
|
||||
get columns(): OneDArray<TColumn>;
|
||||
set columns(columns: OneDArray<TColumn>);
|
||||
get visibleColumns(): OneDArray<TColumn>;
|
||||
/**
|
||||
* Tries to automatically adjust the width of columns based on:
|
||||
* - Header cell content
|
||||
* - Cell content of the first row
|
||||
* - Cell content of the last row
|
||||
*
|
||||
* @param container
|
||||
* @param tableRef
|
||||
* @param tempRef
|
||||
* @param autoWidth
|
||||
*/
|
||||
adjustWidth(
|
||||
container: Element,
|
||||
tableRef: RefObject<Component>,
|
||||
tempRef: RefObject<HTMLDivElement>,
|
||||
autoWidth?: boolean,
|
||||
): this;
|
||||
private setSort;
|
||||
private setFixedHeader;
|
||||
private setID;
|
||||
private populatePlugins;
|
||||
static fromColumns(
|
||||
columns: OneDArray<TColumn | string | ComponentChild>,
|
||||
): Header;
|
||||
static fromUserConfig(userConfig: UserConfig): Header | null;
|
||||
static fromHTMLTable(element: HTMLElement): Header;
|
||||
/**
|
||||
* Converts the tree-like format of Header to a tabular format
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* H1
|
||||
* H1-H1
|
||||
* H1-H2
|
||||
* H2
|
||||
* H2-H1
|
||||
*
|
||||
* becomes:
|
||||
* [
|
||||
* [H1, H2],
|
||||
* [H1-H1, H1-H2, H2-H1]
|
||||
* ]
|
||||
*
|
||||
* @param columns
|
||||
*/
|
||||
static tabularFormat(columns: OneDArray<TColumn>): TwoDArray<TColumn>;
|
||||
/**
|
||||
* Returns an array of leaf columns (last columns in the tree)
|
||||
*
|
||||
* @param columns
|
||||
*/
|
||||
static leafColumns(columns: OneDArray<TColumn>): OneDArray<TColumn>;
|
||||
/**
|
||||
* Returns the maximum depth of a column tree
|
||||
* @param column
|
||||
*/
|
||||
static maximumDepth(column: TColumn): number;
|
||||
}
|
||||
export default Header;
|
||||
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
||||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
||||
to[j] = from[i];
|
||||
return to;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.concat = void 0;
|
||||
var lift_1 = require("../util/lift");
|
||||
var concatAll_1 = require("./concatAll");
|
||||
var args_1 = require("../util/args");
|
||||
var from_1 = require("../observable/from");
|
||||
function concat() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var scheduler = args_1.popScheduler(args);
|
||||
return lift_1.operate(function (source, subscriber) {
|
||||
concatAll_1.concatAll()(from_1.from(__spreadArray([source], __read(args)), scheduler)).subscribe(subscriber);
|
||||
});
|
||||
}
|
||||
exports.concat = concat;
|
||||
//# sourceMappingURL=concat.js.map
|
||||
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
const checkType = (name, value, types) => {
|
||||
const valid = types.some(type => {
|
||||
const typeofType = typeof type;
|
||||
if (typeofType === 'string') {
|
||||
return typeof value === type;
|
||||
}
|
||||
|
||||
return value instanceof type;
|
||||
});
|
||||
|
||||
if (!valid) {
|
||||
const names = types.map(type => typeof type === 'string' ? type : type.name);
|
||||
|
||||
throw new TypeError(`Expected '${name}' to be a type of ${names.join(' or ')}, got ${typeof value}`);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = checkType;
|
||||
@@ -0,0 +1,5 @@
|
||||
import { EnsureBaseOptions, EnsureIsOptional, EnsureDefault } from '../ensure';
|
||||
|
||||
declare function ensureTimeValue(value: any, options?: EnsureBaseOptions & EnsureIsOptional): number | null;
|
||||
declare function ensureTimeValue(value: any, options?: EnsureBaseOptions & EnsureIsOptional & EnsureDefault<number>): number;
|
||||
export default ensureTimeValue;
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
|
||||
export declare function parseUrl(template: string): {
|
||||
expand: (context: object) => string;
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
import { SchedulerLike, ReadableStreamLike } from '../types';
|
||||
import { Observable } from '../Observable';
|
||||
import { scheduleAsyncIterable } from './scheduleAsyncIterable';
|
||||
import { readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';
|
||||
|
||||
export function scheduleReadableStreamLike<T>(input: ReadableStreamLike<T>, scheduler: SchedulerLike): Observable<T> {
|
||||
return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"QueueAction.js","sourceRoot":"","sources":["../../../../src/internal/scheduler/QueueAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,MAAM,OAAO,WAAe,SAAQ,WAAc;IAChD,YAAsB,SAAyB,EAAY,IAAmD;QAC5G,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QADH,cAAS,GAAT,SAAS,CAAgB;QAAY,SAAI,GAAJ,IAAI,CAA+C;IAE9G,CAAC;IAEM,QAAQ,CAAC,KAAS,EAAE,QAAgB,CAAC;QAC1C,IAAI,KAAK,GAAG,CAAC,EAAE;YACb,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACrC;QACD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,OAAO,CAAC,KAAQ,EAAE,KAAa;QACpC,OAAO,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9F,CAAC;IAES,cAAc,CAAC,SAAyB,EAAE,EAAgB,EAAE,QAAgB,CAAC;QAKrF,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE;YACrE,OAAO,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACnD;QAGD,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAMtB,OAAO,CAAC,CAAC;IACX,CAAC;CACF"}
|
||||
@@ -0,0 +1,4 @@
|
||||
export function parse() {
|
||||
throw new Error("You're trying to format an uncompiled message with react-intl without parser, please import from 'react-int' instead");
|
||||
}
|
||||
export * from './types';
|
||||
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = require("./is-implemented")() ? Array.prototype.keys : require("./shim");
|
||||
@@ -0,0 +1,36 @@
|
||||
var arrayReduceRight = require('./_arrayReduceRight'),
|
||||
baseEachRight = require('./_baseEachRight'),
|
||||
baseIteratee = require('./_baseIteratee'),
|
||||
baseReduce = require('./_baseReduce'),
|
||||
isArray = require('./isArray');
|
||||
|
||||
/**
|
||||
* This method is like `_.reduce` except that it iterates over elements of
|
||||
* `collection` from right to left.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
||||
* @param {*} [accumulator] The initial value.
|
||||
* @returns {*} Returns the accumulated value.
|
||||
* @see _.reduce
|
||||
* @example
|
||||
*
|
||||
* var array = [[0, 1], [2, 3], [4, 5]];
|
||||
*
|
||||
* _.reduceRight(array, function(flattened, other) {
|
||||
* return flattened.concat(other);
|
||||
* }, []);
|
||||
* // => [4, 5, 2, 3, 0, 1]
|
||||
*/
|
||||
function reduceRight(collection, iteratee, accumulator) {
|
||||
var func = isArray(collection) ? arrayReduceRight : baseReduce,
|
||||
initAccum = arguments.length < 3;
|
||||
|
||||
return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
|
||||
}
|
||||
|
||||
module.exports = reduceRight;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "http2-wrapper",
|
||||
"version": "2.2.0",
|
||||
"description": "HTTP2 client, just with the familiar `https` API",
|
||||
"main": "source",
|
||||
"types": "index.d.ts",
|
||||
"engines": {
|
||||
"node": ">=10.19.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && nyc --reporter=lcovonly --reporter=text --reporter=html ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"source",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"http2",
|
||||
"https",
|
||||
"http",
|
||||
"request"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/szmarczak/http2-wrapper.git"
|
||||
},
|
||||
"author": "Szymon Marczak",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/szmarczak/http2-wrapper/issues"
|
||||
},
|
||||
"homepage": "https://github.com/szmarczak/http2-wrapper#readme",
|
||||
"dependencies": {
|
||||
"quick-lru": "^5.1.1",
|
||||
"resolve-alpn": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sindresorhus/is": "^4.0.1",
|
||||
"ava": "^3.15.0",
|
||||
"benchmark": "^2.1.4",
|
||||
"get-stream": "^6.0.1",
|
||||
"got": "^11.8.2",
|
||||
"http2-proxy": "^5.0.53",
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"lolex": "^6.0.0",
|
||||
"many-keys-map": "^1.0.3",
|
||||
"nyc": "^15.1.0",
|
||||
"p-event": "^4.2.0",
|
||||
"tempy": "^1.0.1",
|
||||
"to-readable-stream": "^2.1.0",
|
||||
"tsd": "^0.17.0",
|
||||
"websocket-stream": "^5.5.2",
|
||||
"ws": "^7.5.3",
|
||||
"xo": "0.39.1"
|
||||
},
|
||||
"ava": {
|
||||
"timeout": "10s"
|
||||
},
|
||||
"nyc": {
|
||||
"include": [
|
||||
"source"
|
||||
]
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"unicorn/no-for-loop": "off",
|
||||
"unicorn/prefer-module": "off",
|
||||
"comma-dangle": "off",
|
||||
"@typescript-eslint/comma-dangle": "off",
|
||||
"quotes": [
|
||||
"error",
|
||||
"single",
|
||||
{
|
||||
"avoidEscape": true,
|
||||
"allowTemplateLiterals": true
|
||||
}
|
||||
],
|
||||
"operator-linebreak": ["error", "before"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"k l m n o p q r s t u f H","2":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j"},C:{"1":"t u f H xB yB","2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j EC FC","258":"k l m n o p q","578":"r s"},D:{"1":"k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g 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 h lB mB nB oB pB P Q R S T U V W X Y","194":"Z a b c d e i j"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g 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 h lB mB nB oB pB P Q R wB S T U PC QC RC SC qB AC TC rB"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"f","2":"tB I pC qC rC sC BC tC uC"},J:{"16":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"16":"A B"},O:{"2":"vC"},P:{"1":"g 7C 8C","2":"I wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C"},Q:{"2":"1B"},R:{"2":"9C"},S:{"2":"AD BD"}},B:6,C:"COLR/CPAL(v1) Font Formats"};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"1":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","2":"C K L G M N O"},C:{"1":"5 6 7 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"0 1 2 3 4 DC tB I v J D E F A B C K L G M N O w g x y z EC FC"},D:{"1":"PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB","194":"NB OB"},E:{"1":"G MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I v J D E F A B C HC zB IC JC KC LC 0B qB","322":"K L rB 1B"},F:{"1":"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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z PC QC RC SC qB AC TC rB","194":"AB BB"},G:{"1":"mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC","578":"fC gC hC iC jC kC lC"},H:{"2":"oC"},I:{"2":"tB I f pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"1":"h","2":"A B C qB AC rB"},L:{"1":"H"},M:{"2":"H"},N:{"2":"A B"},O:{"1":"vC"},P:{"1":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C","2":"I"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:"MediaRecorder API"};
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { ObservableInput, OperatorFunction } from '../types';
|
||||
import { identity } from '../util/identity';
|
||||
import { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';
|
||||
import { pipe } from '../util/pipe';
|
||||
import { mergeMap } from './mergeMap';
|
||||
import { toArray } from './toArray';
|
||||
|
||||
/**
|
||||
* Collects all of the inner sources from source observable. Then, once the
|
||||
* source completes, joins the values using the given static.
|
||||
*
|
||||
* This is used for {@link combineLatestAll} and {@link zipAll} which both have the
|
||||
* same behavior of collecting all inner observables, then operating on them.
|
||||
*
|
||||
* @param joinFn The type of static join to apply to the sources collected
|
||||
* @param project The projection function to apply to the values, if any
|
||||
*/
|
||||
export function joinAllInternals<T, R>(joinFn: (sources: ObservableInput<T>[]) => Observable<T>, project?: (...args: any[]) => R) {
|
||||
return pipe(
|
||||
// Collect all inner sources into an array, and emit them when the
|
||||
// source completes.
|
||||
toArray() as OperatorFunction<ObservableInput<T>, ObservableInput<T>[]>,
|
||||
// Run the join function on the collected array of inner sources.
|
||||
mergeMap((sources) => joinFn(sources)),
|
||||
// If a projection function was supplied, apply it to each result.
|
||||
project ? mapOneOrManyArgs(project) : (identity as any)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
var isValue = require("../value/is");
|
||||
|
||||
// Sanity BigInt support check
|
||||
BigInt(0);
|
||||
|
||||
module.exports = function (value) {
|
||||
if (!isValue(value)) return null;
|
||||
if (typeof value === "bigint") return value;
|
||||
try { return BigInt(value); }
|
||||
catch (error) { return null; }
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
# which
|
||||
|
||||
Like the unix `which` utility.
|
||||
|
||||
Finds the first instance of a specified executable in the PATH
|
||||
environment variable. Does not cache the results, so `hash -r` is not
|
||||
needed when the PATH changes.
|
||||
|
||||
## USAGE
|
||||
|
||||
```javascript
|
||||
var which = require('which')
|
||||
|
||||
// async usage
|
||||
which('node', function (er, resolvedPath) {
|
||||
// er is returned if no "node" is found on the PATH
|
||||
// if it is found, then the absolute path to the exec is returned
|
||||
})
|
||||
|
||||
// or promise
|
||||
which('node').then(resolvedPath => { ... }).catch(er => { ... not found ... })
|
||||
|
||||
// sync usage
|
||||
// throws if not found
|
||||
var resolved = which.sync('node')
|
||||
|
||||
// if nothrow option is used, returns null if not found
|
||||
resolved = which.sync('node', {nothrow: true})
|
||||
|
||||
// Pass options to override the PATH and PATHEXT environment vars.
|
||||
which('node', { path: someOtherPath }, function (er, resolved) {
|
||||
if (er)
|
||||
throw er
|
||||
console.log('found at %j', resolved)
|
||||
})
|
||||
```
|
||||
|
||||
## CLI USAGE
|
||||
|
||||
Same as the BSD `which(1)` binary.
|
||||
|
||||
```
|
||||
usage: which [-as] program ...
|
||||
```
|
||||
|
||||
## OPTIONS
|
||||
|
||||
You may pass an options object as the second argument.
|
||||
|
||||
- `path`: Use instead of the `PATH` environment variable.
|
||||
- `pathExt`: Use instead of the `PATHEXT` environment variable.
|
||||
- `all`: Return all matches, instead of just the first one. Note that
|
||||
this means the function returns an array of strings instead of a
|
||||
single string.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
import { isFunction } from '../util/isFunction';
|
||||
import { operate } from '../util/lift';
|
||||
import { createOperatorSubscriber } from './OperatorSubscriber';
|
||||
import { identity } from '../util/identity';
|
||||
export function tap(observerOrNext, error, complete) {
|
||||
var tapObserver = isFunction(observerOrNext) || error || complete
|
||||
?
|
||||
{ next: observerOrNext, error: error, complete: complete }
|
||||
: observerOrNext;
|
||||
return tapObserver
|
||||
? operate(function (source, subscriber) {
|
||||
var _a;
|
||||
(_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
||||
var isUnsub = true;
|
||||
source.subscribe(createOperatorSubscriber(subscriber, function (value) {
|
||||
var _a;
|
||||
(_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
|
||||
subscriber.next(value);
|
||||
}, function () {
|
||||
var _a;
|
||||
isUnsub = false;
|
||||
(_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
||||
subscriber.complete();
|
||||
}, function (err) {
|
||||
var _a;
|
||||
isUnsub = false;
|
||||
(_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);
|
||||
subscriber.error(err);
|
||||
}, function () {
|
||||
var _a, _b;
|
||||
if (isUnsub) {
|
||||
(_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
|
||||
}
|
||||
(_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);
|
||||
}));
|
||||
})
|
||||
:
|
||||
identity;
|
||||
}
|
||||
//# sourceMappingURL=tap.js.map
|
||||
@@ -0,0 +1,246 @@
|
||||
import {
|
||||
createElement,
|
||||
render as preactRender,
|
||||
cloneElement as preactCloneElement,
|
||||
createRef,
|
||||
Component,
|
||||
createContext,
|
||||
Fragment
|
||||
} from 'preact';
|
||||
import {
|
||||
useState,
|
||||
useId,
|
||||
useReducer,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
useImperativeHandle,
|
||||
useMemo,
|
||||
useCallback,
|
||||
useContext,
|
||||
useDebugValue
|
||||
} from 'preact/hooks';
|
||||
import { PureComponent } from './PureComponent';
|
||||
import { memo } from './memo';
|
||||
import { forwardRef } from './forwardRef';
|
||||
import { Children } from './Children';
|
||||
import { Suspense, lazy } from './suspense';
|
||||
import { SuspenseList } from './suspense-list';
|
||||
import { createPortal } from './portals';
|
||||
import { is } from './util';
|
||||
import {
|
||||
hydrate,
|
||||
render,
|
||||
REACT_ELEMENT_TYPE,
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
||||
} from './render';
|
||||
|
||||
const version = '17.0.2'; // trick libraries to think we are react
|
||||
|
||||
/**
|
||||
* Legacy version of createElement.
|
||||
* @param {import('./internal').VNode["type"]} type The node name or Component constructor
|
||||
*/
|
||||
function createFactory(type) {
|
||||
return createElement.bind(null, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the passed element is a valid (p)react node.
|
||||
* @param {*} element The element to check
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isValidElement(element) {
|
||||
return !!element && element.$$typeof === REACT_ELEMENT_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap `cloneElement` to abort if the passed element is not a valid element and apply
|
||||
* all vnode normalizations.
|
||||
* @param {import('./internal').VNode} element The vnode to clone
|
||||
* @param {object} props Props to add when cloning
|
||||
* @param {Array<import('./internal').ComponentChildren>} rest Optional component children
|
||||
*/
|
||||
function cloneElement(element) {
|
||||
if (!isValidElement(element)) return element;
|
||||
return preactCloneElement.apply(null, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a component tree from the DOM, including state and event handlers.
|
||||
* @param {import('./internal').PreactElement} container
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function unmountComponentAtNode(container) {
|
||||
if (container._children) {
|
||||
preactRender(null, container);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the matching DOM node for a component
|
||||
* @param {import('./internal').Component} component
|
||||
* @returns {import('./internal').PreactElement | null}
|
||||
*/
|
||||
function findDOMNode(component) {
|
||||
return (
|
||||
(component &&
|
||||
(component.base || (component.nodeType === 1 && component))) ||
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecated way to control batched rendering inside the reconciler, but we
|
||||
* already schedule in batches inside our rendering code
|
||||
* @template Arg
|
||||
* @param {(arg: Arg) => void} callback function that triggers the updated
|
||||
* @param {Arg} [arg] Optional argument that can be passed to the callback
|
||||
*/
|
||||
// eslint-disable-next-line camelcase
|
||||
const unstable_batchedUpdates = (callback, arg) => callback(arg);
|
||||
|
||||
/**
|
||||
* In React, `flushSync` flushes the entire tree and forces a rerender. It's
|
||||
* implmented here as a no-op.
|
||||
* @template Arg
|
||||
* @template Result
|
||||
* @param {(arg: Arg) => Result} callback function that runs before the flush
|
||||
* @param {Arg} [arg] Optional argument that can be passed to the callback
|
||||
* @returns
|
||||
*/
|
||||
const flushSync = (callback, arg) => callback(arg);
|
||||
|
||||
/**
|
||||
* Strict Mode is not implemented in Preact, so we provide a stand-in for it
|
||||
* that just renders its children without imposing any restrictions.
|
||||
*/
|
||||
const StrictMode = Fragment;
|
||||
|
||||
export function startTransition(cb) {
|
||||
cb();
|
||||
}
|
||||
|
||||
export function useDeferredValue(val) {
|
||||
return val;
|
||||
}
|
||||
|
||||
export function useTransition() {
|
||||
return [false, startTransition];
|
||||
}
|
||||
|
||||
// TODO: in theory this should be done after a VNode is diffed as we want to insert
|
||||
// styles/... before it attaches
|
||||
export const useInsertionEffect = useLayoutEffect;
|
||||
|
||||
/**
|
||||
* This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84
|
||||
* on a high level this cuts out the warnings, ... and attempts a smaller implementation
|
||||
*/
|
||||
export function useSyncExternalStore(subscribe, getSnapshot) {
|
||||
const value = getSnapshot();
|
||||
|
||||
const [{ _instance }, forceUpdate] = useState({
|
||||
_instance: { _value: value, _getSnapshot: getSnapshot }
|
||||
});
|
||||
|
||||
useLayoutEffect(() => {
|
||||
_instance._value = value;
|
||||
_instance._getSnapshot = getSnapshot;
|
||||
|
||||
if (!is(_instance._value, getSnapshot())) {
|
||||
forceUpdate({ _instance });
|
||||
}
|
||||
}, [subscribe, value, getSnapshot]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!is(_instance._value, _instance._getSnapshot())) {
|
||||
forceUpdate({ _instance });
|
||||
}
|
||||
|
||||
return subscribe(() => {
|
||||
if (!is(_instance._value, _instance._getSnapshot())) {
|
||||
forceUpdate({ _instance });
|
||||
}
|
||||
});
|
||||
}, [subscribe]);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
export * from 'preact/hooks';
|
||||
export {
|
||||
version,
|
||||
Children,
|
||||
render,
|
||||
hydrate,
|
||||
unmountComponentAtNode,
|
||||
createPortal,
|
||||
createElement,
|
||||
createContext,
|
||||
createFactory,
|
||||
cloneElement,
|
||||
createRef,
|
||||
Fragment,
|
||||
isValidElement,
|
||||
findDOMNode,
|
||||
Component,
|
||||
PureComponent,
|
||||
memo,
|
||||
forwardRef,
|
||||
flushSync,
|
||||
// eslint-disable-next-line camelcase
|
||||
unstable_batchedUpdates,
|
||||
StrictMode,
|
||||
Suspense,
|
||||
SuspenseList,
|
||||
lazy,
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
||||
};
|
||||
|
||||
// React copies the named exports to the default one.
|
||||
export default {
|
||||
useState,
|
||||
useId,
|
||||
useReducer,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useInsertionEffect,
|
||||
useTransition,
|
||||
useDeferredValue,
|
||||
useSyncExternalStore,
|
||||
startTransition,
|
||||
useRef,
|
||||
useImperativeHandle,
|
||||
useMemo,
|
||||
useCallback,
|
||||
useContext,
|
||||
useDebugValue,
|
||||
version,
|
||||
Children,
|
||||
render,
|
||||
hydrate,
|
||||
unmountComponentAtNode,
|
||||
createPortal,
|
||||
createElement,
|
||||
createContext,
|
||||
createFactory,
|
||||
cloneElement,
|
||||
createRef,
|
||||
Fragment,
|
||||
isValidElement,
|
||||
findDOMNode,
|
||||
Component,
|
||||
PureComponent,
|
||||
memo,
|
||||
forwardRef,
|
||||
flushSync,
|
||||
unstable_batchedUpdates,
|
||||
StrictMode,
|
||||
Suspense,
|
||||
SuspenseList,
|
||||
lazy,
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* Actions can return an object containing the two properties defined in this interface. Both are optional.
|
||||
* - update: An action can have a parameter. This method will be called whenever that parameter changes,
|
||||
* immediately after Svelte has applied updates to the markup.
|
||||
* - destroy: Method that is called after the element is unmounted
|
||||
*
|
||||
* Additionally, you can specify which additional attributes and events the action enables on the applied element.
|
||||
* This applies to TypeScript typings only and has no effect at runtime.
|
||||
*
|
||||
* Example usage:
|
||||
* ```ts
|
||||
* interface Attributes {
|
||||
* newprop?: string;
|
||||
* 'on:event': (e: CustomEvent<boolean>) => void;
|
||||
* }
|
||||
*
|
||||
* export function myAction(node: HTMLElement, parameter: Parameter): ActionReturn<Parameter, Attributes> {
|
||||
* // ...
|
||||
* return {
|
||||
* update: (updatedParameter) => {...},
|
||||
* destroy: () => {...}
|
||||
* };
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Docs: https://svelte.dev/docs#template-syntax-element-directives-use-action
|
||||
*/
|
||||
export interface ActionReturn<Parameter = any, Attributes extends Record<string, any> = Record<never, any>> {
|
||||
update?: (parameter: Parameter) => void;
|
||||
destroy?: () => void;
|
||||
/**
|
||||
* ### DO NOT USE THIS
|
||||
* This exists solely for type-checking and has no effect at runtime.
|
||||
* Set this through the `Attributes` generic instead.
|
||||
*/
|
||||
$$_attributes?: Attributes;
|
||||
}
|
||||
/**
|
||||
* Actions are functions that are called when an element is created.
|
||||
* You can use this interface to type such actions.
|
||||
* The following example defines an action that only works on `<div>` elements
|
||||
* and optionally accepts a parameter which it has a default value for:
|
||||
* ```ts
|
||||
* export const myAction: Action<HTMLDivElement, { someProperty: boolean }> = (node, param = { someProperty: true }) => {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
* You can return an object with methods `update` and `destroy` from the function and type which additional attributes and events it has.
|
||||
* See interface `ActionReturn` for more details.
|
||||
*
|
||||
* Docs: https://svelte.dev/docs#template-syntax-element-directives-use-action
|
||||
*/
|
||||
export interface Action<Element = HTMLElement, Parameter = any, Attributes extends Record<string, any> = Record<never, any>> {
|
||||
<Node extends Element>(node: Node, parameter?: Parameter): void | ActionReturn<Parameter, Attributes>;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* A faster alternative to `Function#apply`, this function invokes `func`
|
||||
* with the `this` binding of `thisArg` and the arguments of `args`.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to invoke.
|
||||
* @param {*} thisArg The `this` binding of `func`.
|
||||
* @param {Array} args The arguments to invoke `func` with.
|
||||
* @returns {*} Returns the result of `func`.
|
||||
*/
|
||||
function apply(func, thisArg, args) {
|
||||
switch (args.length) {
|
||||
case 0: return func.call(thisArg);
|
||||
case 1: return func.call(thisArg, args[0]);
|
||||
case 2: return func.call(thisArg, args[0], args[1]);
|
||||
case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
||||
}
|
||||
return func.apply(thisArg, args);
|
||||
}
|
||||
|
||||
module.exports = apply;
|
||||
@@ -0,0 +1,14 @@
|
||||
import assertString from './util/assertString';
|
||||
var uuid = {
|
||||
1: /^[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
|
||||
2: /^[0-9A-F]{8}-[0-9A-F]{4}-2[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
|
||||
3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,
|
||||
4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
||||
5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,
|
||||
all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i
|
||||
};
|
||||
export default function isUUID(str, version) {
|
||||
assertString(str);
|
||||
var pattern = uuid[![undefined, null].includes(version) ? version : 'all'];
|
||||
return !!pattern && pattern.test(str);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
var convert = require('./convert'),
|
||||
func = convert('toPairsIn', require('../toPairsIn'), require('./_falseOptions'));
|
||||
|
||||
func.placeholder = require('./placeholder');
|
||||
module.exports = func;
|
||||
@@ -0,0 +1,15 @@
|
||||
ISC License
|
||||
|
||||
Copyright (c) 2012-2018, Mariusz Nowak, @medikoo, medikoo.com
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||
OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./async').transformSeries;
|
||||
@@ -0,0 +1,24 @@
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
import assertString from './util/assertString';
|
||||
/* eslint-disable prefer-rest-params */
|
||||
|
||||
export default function isLength(str, options) {
|
||||
assertString(str);
|
||||
var min;
|
||||
var max;
|
||||
|
||||
if (_typeof(options) === 'object') {
|
||||
min = options.min || 0;
|
||||
max = options.max;
|
||||
} else {
|
||||
// backwards compatibility: isLength(str, min [, max])
|
||||
min = arguments[1] || 0;
|
||||
max = arguments[2];
|
||||
}
|
||||
|
||||
var presentationSequences = str.match(/(\uFE0F|\uFE0E)/g) || [];
|
||||
var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || [];
|
||||
var len = str.length - presentationSequences.length - surrogatePairs.length;
|
||||
return len >= min && (typeof max === 'undefined' || len <= max);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"name":"formdata-polyfill","version":"4.0.10","files":{"formdata-to-blob.js":{"checkedAt":1678883671431,"integrity":"sha512-K/TbXCqcr70LJgDT5z1DB19zdpQNL4+fNdACxhLaTrxxczWBPUC9Ti84kbVn8H+zNHHM23QmAX7cmTKAQdNlFQ==","mode":420,"size":1296},"LICENSE":{"checkedAt":1678883671431,"integrity":"sha512-bGceCSqzTC3019b4ydlkR+T5DanqLFxyMlvEwkP/eds9s/FfJGi2T3f5kWNdzMzJROcmI6HbsX9am1cR4r8fCQ==","mode":420,"size":1083},"esm.min.js":{"checkedAt":1678883671431,"integrity":"sha512-4i9Ig4CCuTemSiqLTWKZsz7NVdsHYT8JtLABX34KsbeSAh1LIqoBs9gI7v+wRagHaXYr1jGTeBg2jqVaY/ohLA==","mode":420,"size":2378},"formdata.min.js":{"checkedAt":1678883671436,"integrity":"sha512-Adrr9l/H2QHNwJ9E/Af9RbqtI3YF5o3r3/8WePfbndcKx7DVSDHStBWtBM4b5XKmYsc2Qq3VX+HLCPUBBbk33A==","mode":420,"size":8890},"package.json":{"checkedAt":1678883671436,"integrity":"sha512-jgRcCn/qZJrl6JhSqzNf55do0pt7f1hLMcsWSVc3h+dE05xYsmo+M5j9LiDu85bIUcAXDHPr++1kfGjaH4n8/Q==","mode":420,"size":1259},"FormData.js":{"checkedAt":1678883671436,"integrity":"sha512-mOgmPyfe78r0xK7vH/tA5Ccnlv2VK1V2J6K2eic/46NkwQJeFFqlGhhZVEigVen0HU/Jgep5vfDVr8YKpkOjKQ==","mode":420,"size":11874},"README.md":{"checkedAt":1678883671440,"integrity":"sha512-4/HFPcInRlVIEwY33YlD47usaHcvS1KZn88shEUwMITuVQ8np6kb2cVklpGfdzrGiTbvayJGahy3PJvGEXCang==","mode":420,"size":5295},"esm.min.d.ts":{"checkedAt":1678883671440,"integrity":"sha512-/w5D2UcaBLAlv0Q27uiKEOp/3DA0mHTo6KINf8zuieNducotC2KlS1vGn84TC8ABqpVTJEc2lx8S8YTk4lPZLQ==","mode":420,"size":145}}}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"switchAll.d.ts","sourceRoot":"","sources":["../../../../src/internal/operators/switchAll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,CAAC,KAAK,gBAAgB,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,CAEnG"}
|
||||
@@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function (t, a, d) {
|
||||
var invoked, id;
|
||||
id = setTimeout(function () {
|
||||
invoked = true;
|
||||
}, t);
|
||||
setTimeout(function () {
|
||||
a(invoked, undefined);
|
||||
clearTimeout(id);
|
||||
d();
|
||||
}, 100);
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"A B","2":"J D E F CC"},B:{"1":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g 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 h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC","16":"I v J D E F A B C K L"},E:{"1":"v J D E F A B C K L G IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC","2":"I HC zB"},F:{"1":"0 1 2 3 4 5 6 7 8 9 G M N O w g 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 h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e","16":"F PC","132":"B C QC RC SC qB AC TC rB"},G:{"1":"E VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B","2":"zB UC BC"},H:{"132":"oC"},I:{"1":"tB I f rC sC BC tC uC","16":"pC qC"},J:{"1":"D A"},K:{"1":"h","132":"A B C qB AC rB"},L:{"1":"H"},M:{"1":"H"},N:{"1":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:5,C:":optional CSS pseudo-class"};
|
||||
Reference in New Issue
Block a user