@depthbomb/common 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +1 -0
- package/dist/queue.cjs +1 -1
- package/dist/queue.mjs +1 -1
- package/dist/urllib.cjs +1 -0
- package/dist/urllib.d.cts +39 -0
- package/dist/urllib.d.mts +39 -0
- package/dist/urllib.mjs +1 -0
- package/package.json +9 -7
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require(`./async.cjs`),t=require(`./decorators.cjs`),n=require(`./fn.cjs`),r=require(`./lazy.cjs`),i=require(`./queue.cjs`),a=require(`./types.cjs`),o=require(`./urllib.cjs`);exports.Queue=i.Queue,exports.URLPath=o.URLPath,exports.allSettledSuccessful=e.allSettledSuccessful,exports.assume=a.assume,exports.cache=t.cache,exports.cast=a.cast,exports.lazy=r.lazy,exports.lazyAsync=r.lazyAsync,exports.once=n.once,exports.pollUntil=e.pollUntil,exports.rejectionTimeout=e.rejectionTimeout,exports.resettableLazy=r.resettableLazy,exports.sequential=e.sequential,exports.timeout=e.timeout,exports.typedEntries=a.typedEntries,exports.withTimeout=e.withTimeout;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { allSettledSuccessful, pollUntil, rejectionTimeout, sequential, timeout, withTimeout } from "./async.cjs";
|
|
2
|
+
import { cache } from "./decorators.cjs";
|
|
3
|
+
import { once } from "./fn.cjs";
|
|
4
|
+
import { lazy, lazyAsync, resettableLazy } from "./lazy.cjs";
|
|
5
|
+
import { Queue } from "./queue.cjs";
|
|
6
|
+
import { Awaitable, Maybe, Nullable, assume, cast, typedEntries } from "./types.cjs";
|
|
7
|
+
import { URLLike, URLPath } from "./urllib.cjs";
|
|
8
|
+
export { Awaitable, Maybe, Nullable, Queue, URLLike, URLPath, allSettledSuccessful, assume, cache, cast, lazy, lazyAsync, once, pollUntil, rejectionTimeout, resettableLazy, sequential, timeout, typedEntries, withTimeout };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { allSettledSuccessful, pollUntil, rejectionTimeout, sequential, timeout, withTimeout } from "./async.mjs";
|
|
2
|
+
import { cache } from "./decorators.mjs";
|
|
3
|
+
import { once } from "./fn.mjs";
|
|
4
|
+
import { lazy, lazyAsync, resettableLazy } from "./lazy.mjs";
|
|
5
|
+
import { Queue } from "./queue.mjs";
|
|
6
|
+
import { Awaitable, Maybe, Nullable, assume, cast, typedEntries } from "./types.mjs";
|
|
7
|
+
import { URLLike, URLPath } from "./urllib.mjs";
|
|
8
|
+
export { Awaitable, Maybe, Nullable, Queue, URLLike, URLPath, allSettledSuccessful, assume, cache, cast, lazy, lazyAsync, once, pollUntil, rejectionTimeout, resettableLazy, sequential, timeout, typedEntries, withTimeout };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{allSettledSuccessful as e,pollUntil as t,rejectionTimeout as n,sequential as r,timeout as i,withTimeout as a}from"./async.mjs";import{cache as o}from"./decorators.mjs";import{once as s}from"./fn.mjs";import{lazy as c,lazyAsync as l,resettableLazy as u}from"./lazy.mjs";import{Queue as d}from"./queue.mjs";import{assume as f,cast as p,typedEntries as m}from"./types.mjs";import{URLPath as h}from"./urllib.mjs";export{d as Queue,h as URLPath,e as allSettledSuccessful,f as assume,o as cache,p as cast,c as lazy,l as lazyAsync,s as once,t as pollUntil,n as rejectionTimeout,u as resettableLazy,r as sequential,i as timeout,m as typedEntries,a as withTimeout};
|
package/dist/queue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=class{items=[];constructor(e){e&&(this.items=[...e])}get size(){return this.items.length}get isEmpty(){return this.items.length===0}enqueue(e){this.items.push(e)}dequeue(){return this.items.shift()}peek(){return this.items[0]}clear(){this.items=[]}[Symbol.iterator](){return this.items[Symbol.iterator]()}toArray(){return[...this.items]}};exports.Queue=e;
|
package/dist/queue.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=class{items=[];constructor(e){e&&(this.items=[...e])}get size(){return this.items.length}get isEmpty(){return this.items.length===0}enqueue(e){this.items.push(e)}dequeue(){return this.items.shift()}peek(){return this.items[0]}clear(){this.items=[]}[Symbol.iterator](){return this.items[Symbol.iterator]()}toArray(){return[...this.items]}};export{e as Queue};
|
package/dist/urllib.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class e{#e;constructor(t,n){t instanceof e||t instanceof URL?this.#e=new URL(t.toString()):n?this.#e=new URL(t,n.toString()):this.#e=new URL(t)}get protocol(){return this.#e.protocol}get host(){return this.#e.host}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get origin(){return this.#e.origin}get username(){return this.#e.username}get password(){return this.#e.password}get hash(){return this.#e.hash}get search(){return this.#e.search}get searchParams(){return new URLSearchParams(this.#e.search)}get pathname(){return this.#e.pathname}get parts(){return this.#e.pathname.split(`/`).filter(Boolean).map(decodeURIComponent)}get name(){return this.parts.at(-1)??``}get suffix(){let e=this.name,t=e.lastIndexOf(`.`);return t>=0?e.slice(t):``}get stem(){let e=this.name,t=e.lastIndexOf(`.`);return t>=0?e.slice(0,t):e}get parent(){let e=this.parts.slice(0,-1);return this.withPath(e)}joinpath(...e){let t=[...this.parts,...e.map(e=>e.replace(/^\/+|\/+$/g,``))];return this.withPath(t)}div(...e){return this.joinpath(...e)}withPath(t){let n=new URL(this.#e.toString());return n.pathname=`/`+t.map(encodeURIComponent).join(`/`),new e(n)}withQuery(t){let n=new URL(this.#e.toString());for(let[e,r]of Object.entries(t))r==null?n.searchParams.delete(e):n.searchParams.set(e,String(r));return new e(n)}withoutQuery(...t){let n=new URL(this.#e.toString());for(let e of t)n.searchParams.delete(e);return new e(n)}withHash(t){let n=new URL(this.#e.toString());return n.hash=t.startsWith(`#`)?t:`#${t}`,new e(n)}withoutHash(){let t=new URL(this.#e.toString());return t.hash=``,new e(t)}resolve(t){return new e(t,this)}equals(t){return this.toString()===new e(t).toString()}toURL(){return new URL(this.#e.toString())}toString(){return this.#e.toString()}valueOf(){return this.toString()}[Symbol.toPrimitive](){return this.toString()}static from(t,n){return new e(t,n)}static parse(t){return new e(t)}};exports.URLPath=e;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/urllib.d.ts
|
|
2
|
+
type URLLike = string | URL | URLPath;
|
|
3
|
+
declare class URLPath {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(input: URLLike, base?: URLLike);
|
|
6
|
+
get protocol(): string;
|
|
7
|
+
get host(): string;
|
|
8
|
+
get hostname(): string;
|
|
9
|
+
get port(): string;
|
|
10
|
+
get origin(): string;
|
|
11
|
+
get username(): string;
|
|
12
|
+
get password(): string;
|
|
13
|
+
get hash(): string;
|
|
14
|
+
get search(): string;
|
|
15
|
+
get searchParams(): URLSearchParams;
|
|
16
|
+
get pathname(): string;
|
|
17
|
+
get parts(): string[];
|
|
18
|
+
get name(): string;
|
|
19
|
+
get suffix(): string;
|
|
20
|
+
get stem(): string;
|
|
21
|
+
get parent(): URLPath;
|
|
22
|
+
joinpath(...segments: string[]): URLPath;
|
|
23
|
+
div(...segments: string[]): URLPath;
|
|
24
|
+
private withPath;
|
|
25
|
+
withQuery(params: Record<string, string | number | boolean | null | undefined>): URLPath;
|
|
26
|
+
withoutQuery(...keys: string[]): URLPath;
|
|
27
|
+
withHash(hash: string): URLPath;
|
|
28
|
+
withoutHash(): URLPath;
|
|
29
|
+
resolve(relative: string): URLPath;
|
|
30
|
+
equals(other: URLLike): boolean;
|
|
31
|
+
toURL(): URL;
|
|
32
|
+
toString(): string;
|
|
33
|
+
valueOf(): string;
|
|
34
|
+
[Symbol.toPrimitive](): string;
|
|
35
|
+
static from(input: URLLike, base?: URLLike): URLPath;
|
|
36
|
+
static parse(input: string): URLPath;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { URLLike, URLPath };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//#region src/urllib.d.ts
|
|
2
|
+
type URLLike = string | URL | URLPath;
|
|
3
|
+
declare class URLPath {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(input: URLLike, base?: URLLike);
|
|
6
|
+
get protocol(): string;
|
|
7
|
+
get host(): string;
|
|
8
|
+
get hostname(): string;
|
|
9
|
+
get port(): string;
|
|
10
|
+
get origin(): string;
|
|
11
|
+
get username(): string;
|
|
12
|
+
get password(): string;
|
|
13
|
+
get hash(): string;
|
|
14
|
+
get search(): string;
|
|
15
|
+
get searchParams(): URLSearchParams;
|
|
16
|
+
get pathname(): string;
|
|
17
|
+
get parts(): string[];
|
|
18
|
+
get name(): string;
|
|
19
|
+
get suffix(): string;
|
|
20
|
+
get stem(): string;
|
|
21
|
+
get parent(): URLPath;
|
|
22
|
+
joinpath(...segments: string[]): URLPath;
|
|
23
|
+
div(...segments: string[]): URLPath;
|
|
24
|
+
private withPath;
|
|
25
|
+
withQuery(params: Record<string, string | number | boolean | null | undefined>): URLPath;
|
|
26
|
+
withoutQuery(...keys: string[]): URLPath;
|
|
27
|
+
withHash(hash: string): URLPath;
|
|
28
|
+
withoutHash(): URLPath;
|
|
29
|
+
resolve(relative: string): URLPath;
|
|
30
|
+
equals(other: URLLike): boolean;
|
|
31
|
+
toURL(): URL;
|
|
32
|
+
toString(): string;
|
|
33
|
+
valueOf(): string;
|
|
34
|
+
[Symbol.toPrimitive](): string;
|
|
35
|
+
static from(input: URLLike, base?: URLLike): URLPath;
|
|
36
|
+
static parse(input: string): URLPath;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { URLLike, URLPath };
|
package/dist/urllib.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class e{#e;constructor(t,n){t instanceof e||t instanceof URL?this.#e=new URL(t.toString()):n?this.#e=new URL(t,n.toString()):this.#e=new URL(t)}get protocol(){return this.#e.protocol}get host(){return this.#e.host}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get origin(){return this.#e.origin}get username(){return this.#e.username}get password(){return this.#e.password}get hash(){return this.#e.hash}get search(){return this.#e.search}get searchParams(){return new URLSearchParams(this.#e.search)}get pathname(){return this.#e.pathname}get parts(){return this.#e.pathname.split(`/`).filter(Boolean).map(decodeURIComponent)}get name(){return this.parts.at(-1)??``}get suffix(){let e=this.name,t=e.lastIndexOf(`.`);return t>=0?e.slice(t):``}get stem(){let e=this.name,t=e.lastIndexOf(`.`);return t>=0?e.slice(0,t):e}get parent(){let e=this.parts.slice(0,-1);return this.withPath(e)}joinpath(...e){let t=[...this.parts,...e.map(e=>e.replace(/^\/+|\/+$/g,``))];return this.withPath(t)}div(...e){return this.joinpath(...e)}withPath(t){let n=new URL(this.#e.toString());return n.pathname=`/`+t.map(encodeURIComponent).join(`/`),new e(n)}withQuery(t){let n=new URL(this.#e.toString());for(let[e,r]of Object.entries(t))r==null?n.searchParams.delete(e):n.searchParams.set(e,String(r));return new e(n)}withoutQuery(...t){let n=new URL(this.#e.toString());for(let e of t)n.searchParams.delete(e);return new e(n)}withHash(t){let n=new URL(this.#e.toString());return n.hash=t.startsWith(`#`)?t:`#${t}`,new e(n)}withoutHash(){let t=new URL(this.#e.toString());return t.hash=``,new e(t)}resolve(t){return new e(t,this)}equals(t){return this.toString()===new e(t).toString()}toURL(){return new URL(this.#e.toString())}toString(){return this.#e.toString()}valueOf(){return this.toString()}[Symbol.toPrimitive](){return this.toString()}static from(t,n){return new e(t,n)}static parse(t){return new e(t)}};export{e as URLPath};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depthbomb/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A set of common utilities for TypeScript/JavaScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -11,35 +11,37 @@
|
|
|
11
11
|
"utilities"
|
|
12
12
|
],
|
|
13
13
|
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"require": "./dist/index.cjs",
|
|
16
|
+
"import": "./dist/index.mjs"
|
|
17
|
+
},
|
|
14
18
|
"./async": {
|
|
15
|
-
"types": "./dist/",
|
|
16
19
|
"require": "./dist/async.cjs",
|
|
17
20
|
"import": "./dist/async.mjs"
|
|
18
21
|
},
|
|
19
22
|
"./decorators": {
|
|
20
|
-
"types": "./dist/",
|
|
21
23
|
"require": "./dist/decorators.cjs",
|
|
22
24
|
"import": "./dist/decorators.mjs"
|
|
23
25
|
},
|
|
24
26
|
"./fn": {
|
|
25
|
-
"types": "./dist/",
|
|
26
27
|
"require": "./dist/fn.cjs",
|
|
27
28
|
"import": "./dist/fn.mjs"
|
|
28
29
|
},
|
|
29
30
|
"./lazy": {
|
|
30
|
-
"types": "./dist/",
|
|
31
31
|
"require": "./dist/lazy.cjs",
|
|
32
32
|
"import": "./dist/lazy.mjs"
|
|
33
33
|
},
|
|
34
34
|
"./queue": {
|
|
35
|
-
"types": "./dist/",
|
|
36
35
|
"require": "./dist/queue.cjs",
|
|
37
36
|
"import": "./dist/queue.mjs"
|
|
38
37
|
},
|
|
39
38
|
"./types": {
|
|
40
|
-
"types": "./dist/",
|
|
41
39
|
"require": "./dist/types.cjs",
|
|
42
40
|
"import": "./dist/types.mjs"
|
|
41
|
+
},
|
|
42
|
+
"./urllib": {
|
|
43
|
+
"require": "./dist/urllib.cjs",
|
|
44
|
+
"import": "./dist/urllib.mjs"
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
"main": "./dist/index.cjs",
|