feat(build): bundle as ES module
BREAKING CHANGE: removes the umd module in favor of a smaller, standard ES module. Consumers will need native support for ES modules (recent evergreen browsers) or a bundler with the same (rollup, webpack, etc).
This commit is contained in:
parent
9d5be03d29
commit
040fecc6e3
5
Makefile
5
Makefile
|
@ -109,7 +109,10 @@ test: ## run mocha unit tests
|
|||
test: test-cover
|
||||
|
||||
test-check: ## run mocha unit tests with coverage reports
|
||||
$(NODE_BIN)/nyc $(COVER_OPTS) $(NODE_BIN)/mocha $(MOCHA_OPTS) $(TARGET_PATH)/test.js
|
||||
$(NODE_BIN)/nyc $(COVER_OPTS) \
|
||||
$(NODE_BIN)/mocha $(MOCHA_OPTS) \
|
||||
--require esm \
|
||||
$(TARGET_PATH)/test.js
|
||||
|
||||
test-cover: ## run mocha unit tests with coverage reports
|
||||
test-cover: test-check
|
||||
|
|
|
@ -3,22 +3,20 @@ import commonjs from 'rollup-plugin-commonjs';
|
|||
import { eslint } from 'rollup-plugin-eslint';
|
||||
import json from 'rollup-plugin-json';
|
||||
import multiEntry from 'rollup-plugin-multi-entry';
|
||||
import externals from 'rollup-plugin-node-externals';
|
||||
import builtins from 'rollup-plugin-node-builtins';
|
||||
import globals from 'rollup-plugin-node-globals';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import replace from 'rollup-plugin-replace';
|
||||
import typescript from 'rollup-plugin-typescript2';
|
||||
import visualizer from 'rollup-plugin-visualizer';
|
||||
import yaml from 'rollup-plugin-yaml';
|
||||
|
||||
const debug = process.env['DEBUG'] === 'TRUE';
|
||||
const flag_debug = process.env['DEBUG'] === 'TRUE';
|
||||
|
||||
const metadata = require('../package.json');
|
||||
|
||||
const external = require('./rollup-external.json').names;
|
||||
const globals = require('./rollup-globals.json');
|
||||
const namedExports = require('./rollup-named.json');
|
||||
const stubNames = require('./rollup-stub.json').names;
|
||||
|
||||
const passStub = 'require("pass-stub")';
|
||||
const stubs = stubNames.reduce((p, c) => (p[c] = passStub, p), {});
|
||||
|
||||
const rootPath = process.env['ROOT_PATH'];
|
||||
const targetPath = process.env['TARGET_PATH'];
|
||||
|
@ -41,6 +39,14 @@ const bundle = {
|
|||
return 'vendor';
|
||||
}
|
||||
|
||||
if (id.match(/node-resolve:/)) {
|
||||
return 'vendor';
|
||||
}
|
||||
|
||||
/* if (id.includes(`chai`) || id.includes(`sinon`)) {
|
||||
return 'test';
|
||||
} */
|
||||
|
||||
if (id.includes(`${sep}node_modules${sep}`)) {
|
||||
return 'vendor';
|
||||
}
|
||||
|
@ -49,12 +55,16 @@ const bundle = {
|
|||
return 'index';
|
||||
}
|
||||
|
||||
if (id.includes(`${sep}src${sep}`)) {
|
||||
if (id.includes(`${sep}src${sep}`) || id.includes(`${sep}rules${sep}`)) {
|
||||
return 'main';
|
||||
}
|
||||
|
||||
if (debug) {
|
||||
console.log('file belongs to no chunk', id);
|
||||
if (flag_debug) {
|
||||
console.log('file does not belong to any chunk:', id);
|
||||
}
|
||||
|
||||
if (id.length === 30 && id.match(/^[a-f0-9]+$/)) {
|
||||
return 'vendor';
|
||||
}
|
||||
|
||||
return 'nochunk';
|
||||
|
@ -63,28 +73,13 @@ const bundle = {
|
|||
dir: targetPath,
|
||||
chunkFileNames: '[name].js',
|
||||
entryFileNames: 'entry-[name].js',
|
||||
format: 'cjs',
|
||||
globals,
|
||||
format: 'module',
|
||||
sourcemap: true,
|
||||
},
|
||||
plugins: [
|
||||
multiEntry(),
|
||||
json(),
|
||||
yaml(),
|
||||
externals({
|
||||
builtins: true,
|
||||
deps: true,
|
||||
devDeps: false,
|
||||
peerDeps: false,
|
||||
}),
|
||||
replace({
|
||||
delimiters: ['require("', '")'],
|
||||
values: stubs,
|
||||
}),
|
||||
replace({
|
||||
delimiters: ['require(\'', '\')'],
|
||||
values: stubs,
|
||||
}),
|
||||
replace({
|
||||
delimiters: ['{{ ', ' }}'],
|
||||
values: {
|
||||
|
@ -103,6 +98,7 @@ const bundle = {
|
|||
commonjs({
|
||||
namedExports,
|
||||
}),
|
||||
globals(),
|
||||
eslint({
|
||||
configFile: join('.', 'config', 'eslint.json'),
|
||||
exclude: [
|
||||
|
@ -112,14 +108,20 @@ const bundle = {
|
|||
join('src', '**', '*.yml'),
|
||||
],
|
||||
include: [
|
||||
join('**', '*.ts'),
|
||||
join('src', '**', '*.ts'),
|
||||
join('test', '**', '*.ts'),
|
||||
],
|
||||
throwOnError: true,
|
||||
useEslintrc: false,
|
||||
}),
|
||||
typescript({
|
||||
cacheRoot: join(targetPath, 'cache', 'rts2'),
|
||||
rollupCommonJSResolveHack: true,
|
||||
}),
|
||||
visualizer({
|
||||
filename: join(rootPath, 'out', 'bundle-graph.html'),
|
||||
sourcemap: true,
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
@ -16,5 +16,5 @@ constructor(options: ArrayMapperOptions);
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| options | <code>ArrayMapperOptions</code> | |
|
||||
| options | [ArrayMapperOptions](./js-utils.arraymapperoptions.md) | |
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ map(input: Array<string>): Map<string, Array<string>>;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| input | <code>Array<string></code> | |
|
||||
| input | Array<string> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Map<string, Array<string>>`
|
||||
Map<string, Array<string>>
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ export declare class ArrayMapper
|
|||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [rest](./js-utils.arraymapper.rest.md) | | <code>string</code> | |
|
||||
| [skip](./js-utils.arraymapper.skip.md) | | <code>number</code> | |
|
||||
| [take](./js-utils.arraymapper.take.md) | | <code>Array<string></code> | |
|
||||
| [rest](./js-utils.arraymapper.rest.md) | | string | |
|
||||
| [skip](./js-utils.arraymapper.skip.md) | | number | |
|
||||
| [take](./js-utils.arraymapper.take.md) | | Array<string> | |
|
||||
|
||||
## Methods
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ export interface ArrayMapperOptions
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [rest](./js-utils.arraymapperoptions.rest.md) | <code>string</code> | Key for any remaining, unmatched elements. |
|
||||
| [skip](./js-utils.arraymapperoptions.skip.md) | <code>number</code> | Number of initial elements to skip. |
|
||||
| [take](./js-utils.arraymapperoptions.take.md) | <code>Array<string></code> | List of element keys. |
|
||||
| [rest](./js-utils.arraymapperoptions.rest.md) | string | Key for any remaining, unmatched elements. |
|
||||
| [skip](./js-utils.arraymapperoptions.skip.md) | number | Number of initial elements to skip. |
|
||||
| [take](./js-utils.arraymapperoptions.take.md) | Array<string> | List of element keys. |
|
||||
|
||||
|
|
|
@ -11,5 +11,5 @@ clear(): void;
|
|||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`void`
|
||||
void
|
||||
|
||||
|
|
|
@ -11,5 +11,5 @@ disable(): void;
|
|||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`void`
|
||||
void
|
||||
|
||||
|
|
|
@ -13,5 +13,5 @@ dump(): void;
|
|||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`void`
|
||||
void
|
||||
|
||||
|
|
|
@ -11,5 +11,5 @@ enable(): void;
|
|||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`void`
|
||||
void
|
||||
|
||||
|
|
|
@ -13,5 +13,5 @@ getStack(): string;
|
|||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`string`
|
||||
string
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ export declare class AsyncTracker
|
|||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [filter](./js-utils.asynctracker.filter.md) | | <code>Optional<StackFilter></code> | |
|
||||
| [size](./js-utils.asynctracker.size.md) | | <code>number</code> | |
|
||||
| [filter](./js-utils.asynctracker.filter.md) | | [Optional](./js-utils.optional.md)<!-- --><StackFilter> | |
|
||||
| [size](./js-utils.asynctracker.size.md) | | number | |
|
||||
|
||||
## Methods
|
||||
|
||||
|
|
|
@ -16,5 +16,5 @@ constructor(options: ChecklistOptions<T>);
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| options | <code>ChecklistOptions<T></code> | |
|
||||
| options | [ChecklistOptions](./js-utils.checklistoptions.md)<!-- --><T> | |
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ check(value: T): boolean;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| value | <code>T</code> | |
|
||||
| value | T | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`boolean`
|
||||
boolean
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ Check whether items are included or not (blacklist or whitelist, depending on `m
|
|||
```typescript
|
||||
export declare class Checklist<T> implements ChecklistOptions<T>
|
||||
```
|
||||
<b>Implements:</b> [ChecklistOptions](./js-utils.checklistoptions.md)<!-- --><T>
|
||||
|
||||
## Constructors
|
||||
|
||||
|
@ -22,8 +23,8 @@ export declare class Checklist<T> implements ChecklistOptions<T>
|
|||
|
||||
| Property | Modifiers | Type | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| [data](./js-utils.checklist.data.md) | | <code>Array<T></code> | TODO: switch to Set |
|
||||
| [mode](./js-utils.checklist.mode.md) | | <code>ChecklistMode</code> | |
|
||||
| [data](./js-utils.checklist.data.md) | | Array<T> | TODO: switch to Set |
|
||||
| [mode](./js-utils.checklist.mode.md) | | [ChecklistMode](./js-utils.checklistmode.md) | |
|
||||
|
||||
## Methods
|
||||
|
||||
|
|
|
@ -14,6 +14,6 @@ export interface ChecklistOptions<T>
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [data](./js-utils.checklistoptions.data.md) | <code>Array<T></code> | |
|
||||
| [mode](./js-utils.checklistoptions.mode.md) | <code>ChecklistMode</code> | |
|
||||
| [data](./js-utils.checklistoptions.data.md) | Array<T> | |
|
||||
| [mode](./js-utils.checklistoptions.mode.md) | [ChecklistMode](./js-utils.checklistmode.md) | |
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
```typescript
|
||||
export interface ChildOptions extends ChildProcessOptions
|
||||
```
|
||||
<b>Extends:</b> ChildProcessOptions
|
||||
|
||||
## Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [args](./js-utils.childoptions.args.md) | <code>Array<string></code> | |
|
||||
| [command](./js-utils.childoptions.command.md) | <code>string</code> | |
|
||||
| [args](./js-utils.childoptions.args.md) | Array<string> | |
|
||||
| [command](./js-utils.childoptions.command.md) | string | |
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| msg | <code>string</code> | |
|
||||
| nested | <code>Array<Error></code> | |
|
||||
| msg | string | |
|
||||
| nested | Array<Error> | |
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ Error indicating that a child process exited with an error status.
|
|||
```typescript
|
||||
export declare class ChildProcessError extends BaseError
|
||||
```
|
||||
<b>Extends:</b> BaseError
|
||||
|
||||
## Constructors
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ export interface ChildResult
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [status](./js-utils.childresult.status.md) | <code>number</code> | |
|
||||
| [stderr](./js-utils.childresult.stderr.md) | <code>string</code> | |
|
||||
| [stdout](./js-utils.childresult.stdout.md) | <code>string</code> | |
|
||||
| [status](./js-utils.childresult.status.md) | number | |
|
||||
| [stderr](./js-utils.childresult.stderr.md) | string | |
|
||||
| [stdout](./js-utils.childresult.stdout.md) | string | |
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function concat(chunks: Array<Buffer>): Buffer;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| chunks | <code>Array<Buffer></code> | |
|
||||
| chunks | Array<Buffer> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Buffer`
|
||||
Buffer
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function constructorName(val: object): string;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>object</code> | |
|
||||
| val | object | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`string`
|
||||
string
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ export declare function countOf(val: unknown): number;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>unknown</code> | |
|
||||
| val | unknown | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`number`
|
||||
number
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ export declare function defaultWhen<TVal>(condition: boolean, ...items: Array<TV
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| condition | <code>boolean</code> | |
|
||||
| items | <code>Array<TVal></code> | |
|
||||
| condition | boolean | |
|
||||
| items | Array<TVal> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`TVal`
|
||||
TVal
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ export declare function defer<T = undefined>(ms: number, val?: T): Promise<T>;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| ms | <code>number</code> | |
|
||||
| val | <code>T</code> | |
|
||||
| ms | number | |
|
||||
| val | T | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Promise<T>`
|
||||
Promise<T>
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function doesExist<T>(val: Optional<T>): val is T;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>Optional<T></code> | |
|
||||
| val | [Optional](./js-utils.optional.md)<!-- --><T> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`val is T`
|
||||
val is T
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ export declare function encode(chunks: Array<Buffer>, encoding: string): string;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| chunks | <code>Array<Buffer></code> | |
|
||||
| encoding | <code>string</code> | |
|
||||
| chunks | Array<Buffer> | |
|
||||
| encoding | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`string`
|
||||
string
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ export declare function ensureArray<T>(val: Optional<Array<T>>): Array<T>;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>Optional<Array<T>></code> | |
|
||||
| val | [Optional](./js-utils.optional.md)<!-- --><Array<T>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Array<T>`
|
||||
Array<T>
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function entriesOf<TVal>(map: Optional<MapLike<TVal>>): Array<[st
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| map | <code>Optional<MapLike<TVal>></code> | |
|
||||
| map | [Optional](./js-utils.optional.md)<!-- --><[MapLike](./js-utils.maplike.md)<!-- --><TVal>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Array<[string, TVal]>`
|
||||
Array<\[string, TVal\]>
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ export interface ExternalModule
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [data](./js-utils.externalmodule.data.md) | <code>unknown</code> | |
|
||||
| [export](./js-utils.externalmodule.export.md) | <code>string</code> | |
|
||||
| [require](./js-utils.externalmodule.require.md) | <code>string</code> | |
|
||||
| [data](./js-utils.externalmodule.data.md) | unknown | |
|
||||
| [export](./js-utils.externalmodule.export.md) | string | |
|
||||
| [require](./js-utils.externalmodule.require.md) | string | |
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function filterNil<TItem>(list: ArrayLike<Optional<TItem>>): Arra
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| list | <code>ArrayLike<Optional<TItem>></code> | |
|
||||
| list | ArrayLike<[Optional](./js-utils.optional.md)<!-- --><TItem>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Array<TItem>`
|
||||
Array<TItem>
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function getConstructor(val: object): Function;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>object</code> | |
|
||||
| val | object | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Function`
|
||||
Function
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ export declare function getHead<TKey, TVal>(map: Map<TKey, Array<TVal>>, key: TK
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| map | <code>Map<TKey, Array<TVal>></code> | |
|
||||
| key | <code>TKey</code> | |
|
||||
| map | Map<TKey, Array<TVal>> | |
|
||||
| key | TKey | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`TVal`
|
||||
TVal
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ export declare function getHeadOrDefault<TKey, TVal>(map: Map<TKey, Array<Option
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| map | <code>Map<TKey, Array<Optional<TVal>>></code> | |
|
||||
| key | <code>TKey</code> | |
|
||||
| defaultValue | <code>TVal</code> | |
|
||||
| map | Map<TKey, Array<[Optional](./js-utils.optional.md)<!-- --><TVal>>> | |
|
||||
| key | TKey | |
|
||||
| defaultValue | TVal | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`TVal`
|
||||
TVal
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function getMethods<TValue extends object>(value: TValue): Set<Fu
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| value | <code>TValue</code> | |
|
||||
| value | TValue | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Set<Function>`
|
||||
Set<Function>
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ export declare function getOrDefault<TKey, TVal>(map: Map<TKey, TVal>, key: TKey
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| map | <code>Map<TKey, TVal></code> | |
|
||||
| key | <code>TKey</code> | |
|
||||
| defaultValue | <code>TVal</code> | |
|
||||
| map | Map<TKey, TVal> | |
|
||||
| key | TKey | |
|
||||
| defaultValue | TVal | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`TVal`
|
||||
TVal
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function getTestLogger(verbose?: boolean): Logger;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| verbose | <code>boolean</code> | |
|
||||
| verbose | boolean | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Logger`
|
||||
Logger
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ export declare function hasItems<T>(val: Optional<Array<T>>): val is Array<T>;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>Optional<Array<T>></code> | |
|
||||
| val | [Optional](./js-utils.optional.md)<!-- --><Array<T>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`val is Array<T>`
|
||||
val is Array<T>
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ export declare function hasItems<T>(val: Optional<ReadonlyArray<T>>): val is Rea
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>Optional<ReadonlyArray<T>></code> | |
|
||||
| val | [Optional](./js-utils.optional.md)<!-- --><ReadonlyArray<T>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`val is ReadonlyArray<T>`
|
||||
val is ReadonlyArray<T>
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| msg | <code>string</code> | |
|
||||
| nested | <code>Array<Error></code> | |
|
||||
| msg | string | |
|
||||
| nested | Array<Error> | |
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ Error indicating that an invalid argument was passed to a function call.
|
|||
```typescript
|
||||
export declare class InvalidArgumentError extends BaseError
|
||||
```
|
||||
<b>Extends:</b> BaseError
|
||||
|
||||
## Constructors
|
||||
|
||||
|
|
|
@ -15,5 +15,5 @@ export declare function isDebug(): boolean;
|
|||
```
|
||||
<b>Returns:</b>
|
||||
|
||||
`boolean`
|
||||
boolean
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function isNil<T>(val: Optional<T>): val is Nil;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>Optional<T></code> | |
|
||||
| val | [Optional](./js-utils.optional.md)<!-- --><T> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`val is Nil`
|
||||
val is [Nil](./js-utils.nil.md)
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ export declare function leftPad(val: string, min?: number, fill?: string): strin
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>string</code> | |
|
||||
| min | <code>number</code> | |
|
||||
| fill | <code>string</code> | |
|
||||
| val | string | |
|
||||
| min | number | |
|
||||
| fill | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`string`
|
||||
string
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function makeDict<TVal>(map: Optional<MapLike<TVal>>): Dict<TVal>
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| map | <code>Optional<MapLike<TVal>></code> | |
|
||||
| map | [Optional](./js-utils.optional.md)<!-- --><[MapLike](./js-utils.maplike.md)<!-- --><TVal>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Dict<TVal>`
|
||||
[Dict](./js-utils.dict.md)<!-- --><TVal>
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function makeMap<TVal>(val: Optional<MapLike<TVal>>): Map<string,
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>Optional<MapLike<TVal>></code> | |
|
||||
| val | [Optional](./js-utils.optional.md)<!-- --><[MapLike](./js-utils.maplike.md)<!-- --><TVal>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Map<string, TVal>`
|
||||
Map<string, TVal>
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function mergeList<TItem>(...parts: Array<TItem | Array<TItem>>):
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| parts | <code>Array<TItem | Array<TItem>></code> | |
|
||||
| parts | Array<TItem \| Array<TItem>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Array<TItem>`
|
||||
Array<TItem>
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ export declare function mergeMap<TKey, TVal>(target: Map<TKey, TVal>, source: Ma
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| target | <code>Map<TKey, TVal></code> | |
|
||||
| source | <code>Map<TKey, TVal> | Array<[TKey, TVal]></code> | |
|
||||
| target | Map<TKey, TVal> | |
|
||||
| source | Map<TKey, TVal> \| Array<\[TKey, TVal\]> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Map<TKey, TVal>`
|
||||
Map<TKey, TVal>
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| msg | <code>string</code> | |
|
||||
| nested | <code>Array<Error></code> | |
|
||||
| msg | string | |
|
||||
| nested | Array<Error> | |
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ Error indicating that a required key did not exist in a map-like.
|
|||
```typescript
|
||||
export declare class MissingKeyError extends NotFoundError
|
||||
```
|
||||
<b>Extends:</b> [NotFoundError](./js-utils.notfounderror.md)
|
||||
|
||||
## Constructors
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ export declare function mustCoalesce<T>(...values: Array<Optional<T>>): T;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| values | <code>Array<Optional<T>></code> | |
|
||||
| values | Array<[Optional](./js-utils.optional.md)<!-- --><T>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`T`
|
||||
T
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ export declare function mustExist<T>(val: Optional<T>): T;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>Optional<T></code> | |
|
||||
| val | [Optional](./js-utils.optional.md)<!-- --><T> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`T`
|
||||
T
|
||||
|
||||
val
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ export declare function mustFind<TVal>(list: Array<Optional<TVal>>, predicate: P
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| list | <code>Array<Optional<TVal>></code> | |
|
||||
| predicate | <code>PredicateC1<TVal></code> | |
|
||||
| list | Array<[Optional](./js-utils.optional.md)<!-- --><TVal>> | |
|
||||
| predicate | PredicateC1<TVal> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`TVal`
|
||||
TVal
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ export declare function mustGet<TKey, TVal>(map: Map<TKey, TVal>, key: TKey): TV
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| map | <code>Map<TKey, TVal></code> | |
|
||||
| key | <code>TKey</code> | |
|
||||
| map | Map<TKey, TVal> | |
|
||||
| key | TKey | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`TVal`
|
||||
TVal
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ export declare function normalizeMap(map: MapLike<unknown>): Dict<Array<string>>
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| map | <code>MapLike<unknown></code> | |
|
||||
| map | [MapLike](./js-utils.maplike.md)<!-- --><unknown> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Dict<Array<string>>`
|
||||
[Dict](./js-utils.dict.md)<!-- --><Array<string>>
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| msg | <code>string</code> | |
|
||||
| nested | <code>Array<Error></code> | |
|
||||
| msg | string | |
|
||||
| nested | Array<Error> | |
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ Error indicating that some value was not found.
|
|||
```typescript
|
||||
export declare class NotFoundError extends BaseError
|
||||
```
|
||||
<b>Extends:</b> BaseError
|
||||
|
||||
## Constructors
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| msg | <code>string</code> | |
|
||||
| nested | <code>Array<Error></code> | |
|
||||
| msg | string | |
|
||||
| nested | Array<Error> | |
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ Error indicating that a function has not been implemented yet.
|
|||
```typescript
|
||||
export declare class NotImplementedError extends BaseError
|
||||
```
|
||||
<b>Extends:</b> BaseError
|
||||
|
||||
## Constructors
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function pairsToMap<TVal>(pairs: Array<NameValuePair<TVal>>): Map
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| pairs | <code>Array<NameValuePair<TVal>></code> | |
|
||||
| pairs | Array<NameValuePair<TVal>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Map<string, TVal>`
|
||||
Map<string, TVal>
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function pushMergeMap<TKey, TVal>(...args: Array<Map<TKey, TVal |
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| args | <code>Array<Map<TKey, TVal | Array<TVal>>></code> | |
|
||||
| args | Array<Map<TKey, TVal \| Array<TVal>>> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Map<TKey, Array<TVal>>`
|
||||
Map<TKey, Array<TVal>>
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function removePid(path: string): Promise<void>;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| path | <code>string</code> | |
|
||||
| path | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Promise<void>`
|
||||
Promise<void>
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ export declare function setOrPush<TKey, TVal>(map: Map<TKey, Array<TVal>>, key:
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| map | <code>Map<TKey, Array<TVal>></code> | The destination map and source of existing values. |
|
||||
| key | <code>TKey</code> | The key to get and set. |
|
||||
| val | <code>TVal | Array<TVal></code> | The value to add. |
|
||||
| map | Map<TKey, Array<TVal>> | The destination map and source of existing values. |
|
||||
| key | TKey | The key to get and set. |
|
||||
| val | TVal \| Array<TVal> | The value to add. |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`void`
|
||||
void
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ export declare function signal(...signals: Array<NodeJS.Signals>): Promise<NodeJ
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| signals | <code>Array<NodeJS.Signals></code> | |
|
||||
| signals | Array<NodeJS.Signals> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Promise<NodeJS.Signals>`
|
||||
Promise<NodeJS.Signals>
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function spyLogger(spies: Partial<Logger>): Logger;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| spies | <code>Partial<Logger></code> | |
|
||||
| spies | Partial<Logger> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Logger`
|
||||
Logger
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ export declare function timeout<T>(ms: number, oper: Promise<T>): Promise<T>;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| ms | <code>number</code> | |
|
||||
| oper | <code>Promise<T></code> | |
|
||||
| ms | number | |
|
||||
| oper | Promise<T> | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Promise<T>`
|
||||
Promise<T>
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@ constructor(msg?: string, ...nested: Array<Error>);
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| msg | <code>string</code> | |
|
||||
| nested | <code>Array<Error></code> | |
|
||||
| msg | string | |
|
||||
| nested | Array<Error> | |
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ Error indicating that a promise timed out.
|
|||
```typescript
|
||||
export declare class TimeoutError extends BaseError
|
||||
```
|
||||
<b>Extends:</b> BaseError
|
||||
|
||||
## Constructors
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ export declare function trim(val: string, max: number, tail?: string): string;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| val | <code>string</code> | |
|
||||
| max | <code>number</code> | |
|
||||
| tail | <code>string</code> | |
|
||||
| val | string | |
|
||||
| max | number | |
|
||||
| tail | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`string`
|
||||
string
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function waitForChild(child: ChildStreams): Promise<ChildResult>;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| child | <code>ChildStreams</code> | |
|
||||
| child | ChildStreams | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Promise<ChildResult>`
|
||||
Promise<[ChildResult](./js-utils.childresult.md)<!-- -->>
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ export declare function writePid(path: string): Promise<void>;
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| path | <code>string</code> | |
|
||||
| path | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Promise<void>`
|
||||
Promise<void>
|
||||
|
||||
|
|
|
@ -14,10 +14,10 @@ export declare function writeValue(stream: Writable, value: string): Promise<boo
|
|||
|
||||
| Parameter | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| stream | <code>Writable</code> | |
|
||||
| value | <code>string</code> | |
|
||||
| stream | Writable | |
|
||||
| value | string | |
|
||||
|
||||
<b>Returns:</b>
|
||||
|
||||
`Promise<boolean>`
|
||||
Promise<boolean>
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
"eslint-plugin-mocha": "7.0.1",
|
||||
"eslint-plugin-no-null": "1.0.2",
|
||||
"eslint-plugin-sonarjs": "0.5.0",
|
||||
"esm": "^3.2.25",
|
||||
"lodash": "4.17.15",
|
||||
"mocha": "8.0.1",
|
||||
"mock-fs": "4.12.0",
|
||||
|
@ -54,11 +55,14 @@
|
|||
"rollup-plugin-eslint": "7.0.0",
|
||||
"rollup-plugin-json": "4.0.0",
|
||||
"rollup-plugin-multi-entry": "2.1.0",
|
||||
"rollup-plugin-node-builtins": "^2.1.2",
|
||||
"rollup-plugin-node-externals": "2.2.0",
|
||||
"rollup-plugin-node-globals": "^1.4.0",
|
||||
"rollup-plugin-node-resolve": "5.2.0",
|
||||
"rollup-plugin-replace": "2.2.0",
|
||||
"rollup-plugin-tslint": "0.2.2",
|
||||
"rollup-plugin-typescript2": "0.27.1",
|
||||
"rollup-plugin-visualizer": "^4.0.4",
|
||||
"rollup-plugin-yaml": "2.0.0",
|
||||
"sinon": "9.0.2",
|
||||
"sinon-chai": "3.5.0",
|
||||
|
|
Loading…
Reference in New Issue