@whatwg-node/node-fetch 0.7.13 → 0.7.14
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/cjs/URL.js +4 -3
- package/esm/URL.js +4 -2
- package/package.json +1 -1
- package/typings/URL.d.cts +10 -1
- package/typings/URL.d.ts +10 -1
package/cjs/URL.js
CHANGED
@@ -4,7 +4,8 @@ exports.PonyfillURL = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const node_buffer_1 = tslib_1.__importDefault(require("node:buffer"));
|
6
6
|
const node_crypto_1 = require("node:crypto");
|
7
|
-
|
7
|
+
const NativeURL = globalThis.URL;
|
8
|
+
class URL extends NativeURL {
|
8
9
|
// This part is only needed to handle `PonyfillBlob` objects
|
9
10
|
static blobRegistry = new Map();
|
10
11
|
static createObjectURL(blob) {
|
@@ -14,7 +15,7 @@ class PonyfillURL extends URL {
|
|
14
15
|
}
|
15
16
|
static revokeObjectURL(url) {
|
16
17
|
if (!this.blobRegistry.has(url)) {
|
17
|
-
|
18
|
+
NativeURL.revokeObjectURL(url);
|
18
19
|
}
|
19
20
|
else {
|
20
21
|
this.blobRegistry.delete(url);
|
@@ -24,4 +25,4 @@ class PonyfillURL extends URL {
|
|
24
25
|
return (this.blobRegistry.get(url) || node_buffer_1.default?.resolveObjectURL?.(url));
|
25
26
|
}
|
26
27
|
}
|
27
|
-
exports.PonyfillURL =
|
28
|
+
exports.PonyfillURL = URL;
|
package/esm/URL.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import NodeBuffer from 'node:buffer';
|
2
2
|
import { randomUUID } from 'node:crypto';
|
3
|
-
|
3
|
+
const NativeURL = globalThis.URL;
|
4
|
+
class URL extends NativeURL {
|
4
5
|
// This part is only needed to handle `PonyfillBlob` objects
|
5
6
|
static blobRegistry = new Map();
|
6
7
|
static createObjectURL(blob) {
|
@@ -10,7 +11,7 @@ export class PonyfillURL extends URL {
|
|
10
11
|
}
|
11
12
|
static revokeObjectURL(url) {
|
12
13
|
if (!this.blobRegistry.has(url)) {
|
13
|
-
|
14
|
+
NativeURL.revokeObjectURL(url);
|
14
15
|
}
|
15
16
|
else {
|
16
17
|
this.blobRegistry.delete(url);
|
@@ -20,3 +21,4 @@ export class PonyfillURL extends URL {
|
|
20
21
|
return (this.blobRegistry.get(url) || NodeBuffer?.resolveObjectURL?.(url));
|
21
22
|
}
|
22
23
|
}
|
24
|
+
export { URL as PonyfillURL };
|
package/package.json
CHANGED
package/typings/URL.d.cts
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
import { PonyfillBlob } from './Blob.cjs';
|
2
|
-
|
2
|
+
declare const NativeURL: {
|
3
|
+
new (url: string | globalThis.URL, base?: string | globalThis.URL): globalThis.URL;
|
4
|
+
prototype: globalThis.URL;
|
5
|
+
canParse(url: string | globalThis.URL, base?: string | globalThis.URL): boolean;
|
6
|
+
createObjectURL(obj: Blob | MediaSource): string;
|
7
|
+
parse(url: string | globalThis.URL, base?: string | globalThis.URL): globalThis.URL | null;
|
8
|
+
revokeObjectURL(url: string): void;
|
9
|
+
};
|
10
|
+
declare class URL extends NativeURL {
|
3
11
|
static blobRegistry: Map<string, Blob | PonyfillBlob>;
|
4
12
|
static createObjectURL(blob: Blob): string;
|
5
13
|
static revokeObjectURL(url: string): void;
|
6
14
|
static getBlobFromURL(url: string): Blob | PonyfillBlob | undefined;
|
7
15
|
}
|
16
|
+
export { URL as PonyfillURL };
|
package/typings/URL.d.ts
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
import { PonyfillBlob } from './Blob.js';
|
2
|
-
|
2
|
+
declare const NativeURL: {
|
3
|
+
new (url: string | globalThis.URL, base?: string | globalThis.URL): globalThis.URL;
|
4
|
+
prototype: globalThis.URL;
|
5
|
+
canParse(url: string | globalThis.URL, base?: string | globalThis.URL): boolean;
|
6
|
+
createObjectURL(obj: Blob | MediaSource): string;
|
7
|
+
parse(url: string | globalThis.URL, base?: string | globalThis.URL): globalThis.URL | null;
|
8
|
+
revokeObjectURL(url: string): void;
|
9
|
+
};
|
10
|
+
declare class URL extends NativeURL {
|
3
11
|
static blobRegistry: Map<string, Blob | PonyfillBlob>;
|
4
12
|
static createObjectURL(blob: Blob): string;
|
5
13
|
static revokeObjectURL(url: string): void;
|
6
14
|
static getBlobFromURL(url: string): Blob | PonyfillBlob | undefined;
|
7
15
|
}
|
16
|
+
export { URL as PonyfillURL };
|