@depthbomb/common 1.2.0 → 1.3.1
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.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/urllib.cjs +1 -1
- package/dist/urllib.d.cts +5 -2
- package/dist/urllib.d.mts +5 -2
- package/dist/urllib.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,5 +4,5 @@ import { once } from "./fn.cjs";
|
|
|
4
4
|
import { lazy, lazyAsync, resettableLazy } from "./lazy.cjs";
|
|
5
5
|
import { Queue } from "./queue.cjs";
|
|
6
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 };
|
|
7
|
+
import { QueryObject, QueryValue, URLLike, URLPath } from "./urllib.cjs";
|
|
8
|
+
export { Awaitable, Maybe, Nullable, QueryObject, QueryValue, Queue, URLLike, URLPath, allSettledSuccessful, assume, cache, cast, lazy, lazyAsync, once, pollUntil, rejectionTimeout, resettableLazy, sequential, timeout, typedEntries, withTimeout };
|
package/dist/index.d.mts
CHANGED
|
@@ -4,5 +4,5 @@ import { once } from "./fn.mjs";
|
|
|
4
4
|
import { lazy, lazyAsync, resettableLazy } from "./lazy.mjs";
|
|
5
5
|
import { Queue } from "./queue.mjs";
|
|
6
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 };
|
|
7
|
+
import { QueryObject, QueryValue, URLLike, URLPath } from "./urllib.mjs";
|
|
8
|
+
export { Awaitable, Maybe, Nullable, QueryObject, QueryValue, Queue, URLLike, URLPath, allSettledSuccessful, assume, cache, cast, lazy, lazyAsync, once, pollUntil, rejectionTimeout, resettableLazy, sequential, timeout, typedEntries, withTimeout };
|
package/dist/urllib.cjs
CHANGED
|
@@ -1 +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;
|
|
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)}async fetch(e){return fetch(this.#e,e)}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;
|
package/dist/urllib.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
//#region src/urllib.d.ts
|
|
2
2
|
type URLLike = string | URL | URLPath;
|
|
3
|
+
type QueryValue = string | number | undefined | null | boolean | Array<QueryValue> | Record<string, any>;
|
|
4
|
+
type QueryObject = Record<string, QueryValue | QueryValue[]>;
|
|
3
5
|
declare class URLPath {
|
|
4
6
|
#private;
|
|
5
7
|
constructor(input: URLLike, base?: URLLike);
|
|
@@ -22,10 +24,11 @@ declare class URLPath {
|
|
|
22
24
|
joinpath(...segments: string[]): URLPath;
|
|
23
25
|
div(...segments: string[]): URLPath;
|
|
24
26
|
private withPath;
|
|
25
|
-
withQuery(params:
|
|
27
|
+
withQuery(params: QueryObject): URLPath;
|
|
26
28
|
withoutQuery(...keys: string[]): URLPath;
|
|
27
29
|
withHash(hash: string): URLPath;
|
|
28
30
|
withoutHash(): URLPath;
|
|
31
|
+
fetch(init?: RequestInit): Promise<Response>;
|
|
29
32
|
resolve(relative: string): URLPath;
|
|
30
33
|
equals(other: URLLike): boolean;
|
|
31
34
|
toURL(): URL;
|
|
@@ -36,4 +39,4 @@ declare class URLPath {
|
|
|
36
39
|
static parse(input: string): URLPath;
|
|
37
40
|
}
|
|
38
41
|
//#endregion
|
|
39
|
-
export { URLLike, URLPath };
|
|
42
|
+
export { QueryObject, QueryValue, URLLike, URLPath };
|
package/dist/urllib.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
//#region src/urllib.d.ts
|
|
2
2
|
type URLLike = string | URL | URLPath;
|
|
3
|
+
type QueryValue = string | number | undefined | null | boolean | Array<QueryValue> | Record<string, any>;
|
|
4
|
+
type QueryObject = Record<string, QueryValue | QueryValue[]>;
|
|
3
5
|
declare class URLPath {
|
|
4
6
|
#private;
|
|
5
7
|
constructor(input: URLLike, base?: URLLike);
|
|
@@ -22,10 +24,11 @@ declare class URLPath {
|
|
|
22
24
|
joinpath(...segments: string[]): URLPath;
|
|
23
25
|
div(...segments: string[]): URLPath;
|
|
24
26
|
private withPath;
|
|
25
|
-
withQuery(params:
|
|
27
|
+
withQuery(params: QueryObject): URLPath;
|
|
26
28
|
withoutQuery(...keys: string[]): URLPath;
|
|
27
29
|
withHash(hash: string): URLPath;
|
|
28
30
|
withoutHash(): URLPath;
|
|
31
|
+
fetch(init?: RequestInit): Promise<Response>;
|
|
29
32
|
resolve(relative: string): URLPath;
|
|
30
33
|
equals(other: URLLike): boolean;
|
|
31
34
|
toURL(): URL;
|
|
@@ -36,4 +39,4 @@ declare class URLPath {
|
|
|
36
39
|
static parse(input: string): URLPath;
|
|
37
40
|
}
|
|
38
41
|
//#endregion
|
|
39
|
-
export { URLLike, URLPath };
|
|
42
|
+
export { QueryObject, QueryValue, URLLike, URLPath };
|
package/dist/urllib.mjs
CHANGED
|
@@ -1 +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};
|
|
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)}async fetch(e){return fetch(this.#e,e)}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};
|