@pezkuwi/x-fetch 14.0.13 → 14.0.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.
Files changed (58) hide show
  1. package/cjs/node.js +34 -1
  2. package/cjs/packageInfo.js +1 -1
  3. package/package.json +15 -54
  4. package/packageInfo.js +1 -1
  5. package/build/LICENSE +0 -201
  6. package/build/README.md +0 -13
  7. package/build/browser.d.ts +0 -2
  8. package/build/browser.js +0 -3
  9. package/build/cjs/browser.d.ts +0 -2
  10. package/build/cjs/browser.js +0 -7
  11. package/build/cjs/node.d.ts +0 -2
  12. package/build/cjs/node.js +0 -52
  13. package/build/cjs/package.json +0 -3
  14. package/build/cjs/packageInfo.d.ts +0 -6
  15. package/build/cjs/packageInfo.js +0 -4
  16. package/build/cjs/react-native.d.ts +0 -1
  17. package/build/cjs/react-native.js +0 -4
  18. package/build/cjs/shim.d.ts +0 -1
  19. package/build/cjs/shim.js +0 -5
  20. package/build/node.d.ts +0 -2
  21. package/build/node.js +0 -15
  22. package/build/package.json +0 -141
  23. package/build/packageInfo.d.ts +0 -6
  24. package/build/packageInfo.js +0 -1
  25. package/build/react-native.d.ts +0 -1
  26. package/build/react-native.js +0 -1
  27. package/build/shim.d.ts +0 -1
  28. package/build/shim.js +0 -3
  29. package/build-deno/README.md +0 -13
  30. package/build-deno/browser.ts +0 -6
  31. package/build-deno/mod.ts +0 -2
  32. package/build-deno/node.ts +0 -24
  33. package/build-deno/packageInfo.ts +0 -3
  34. package/build-deno/react-native.ts +0 -2
  35. package/build-deno/shim.ts +0 -5
  36. package/build-tsc/browser.d.ts +0 -2
  37. package/build-tsc/node.d.ts +0 -2
  38. package/build-tsc/packageInfo.d.ts +0 -6
  39. package/build-tsc/react-native.d.ts +0 -1
  40. package/build-tsc/shim.d.ts +0 -1
  41. package/build-tsc-cjs/browser.js +0 -7
  42. package/build-tsc-cjs/node.js +0 -52
  43. package/build-tsc-cjs/packageInfo.js +0 -4
  44. package/build-tsc-cjs/react-native.js +0 -4
  45. package/build-tsc-cjs/shim.js +0 -5
  46. package/build-tsc-esm/browser.js +0 -3
  47. package/build-tsc-esm/node.js +0 -15
  48. package/build-tsc-esm/packageInfo.js +0 -1
  49. package/build-tsc-esm/react-native.js +0 -1
  50. package/build-tsc-esm/shim.js +0 -3
  51. package/src/browser.ts +0 -8
  52. package/src/mod.ts +0 -4
  53. package/src/node.ts +0 -31
  54. package/src/packageInfo.ts +0 -6
  55. package/src/react-native.ts +0 -4
  56. package/src/shim.ts +0 -7
  57. package/tsconfig.build.json +0 -14
  58. package/tsconfig.build.tsbuildinfo +0 -1
@@ -1,141 +0,0 @@
1
- {
2
- "author": "Dijital Kurdistan Tech Institute <dev@pezkuwichain.io>",
3
- "bugs": "https://github.com/pezkuwichain/pezkuwi-common/issues",
4
- "description": "A cross-environment fetch replacement",
5
- "engines": {
6
- "node": ">=18"
7
- },
8
- "homepage": "https://github.com/pezkuwichain/pezkuwi-common/tree/master/packages/x-fetch#readme",
9
- "license": "Apache-2.0",
10
- "name": "@pezkuwi/x-fetch",
11
- "repository": {
12
- "directory": "packages/x-fetch",
13
- "type": "git",
14
- "url": "https://github.com/pezkuwichain/pezkuwi-common.git"
15
- },
16
- "sideEffects": false,
17
- "type": "module",
18
- "version": "14.0.13",
19
- "main": "./cjs/node.js",
20
- "module": "./cjs/node.js",
21
- "browser": "./cjs/browser.js",
22
- "react-native": "./cjs/react-native.js",
23
- "types": "./cjs/node.d.ts",
24
- "exports": {
25
- "./cjs/package.json": "./cjs/package.json",
26
- "./cjs/*": "./cjs/*.js",
27
- ".": {
28
- "types": "./cjs/node.d.ts./cjs/node.js",
29
- "react-native": "./cjs/react-native.js./cjs/react-native.js",
30
- "browser": "./cjs/browser.js./cjs/browser.js",
31
- "node": "./cjs/node.js./cjs/node.js"
32
- },
33
- "./browser": {
34
- "module": {
35
- "types": "./browser.d.ts",
36
- "default": "./browser.js"
37
- },
38
- "require": {
39
- "types": "./cjs/browser.d.ts",
40
- "default": "./cjs/browser.js"
41
- },
42
- "default": {
43
- "types": "./browser.d.ts",
44
- "default": "./browser.js"
45
- }
46
- },
47
- "./node": {
48
- "module": {
49
- "types": "./node.d.ts",
50
- "default": "./node.js"
51
- },
52
- "require": {
53
- "types": "./cjs/node.d.ts",
54
- "default": "./cjs/node.js"
55
- },
56
- "default": {
57
- "types": "./node.d.ts",
58
- "default": "./node.js"
59
- }
60
- },
61
- "./package.json": {
62
- "require": "./cjs/package.json",
63
- "default": "./package.json"
64
- },
65
- "./packageInfo.js": {
66
- "module": {
67
- "types": "./packageInfo.d.ts",
68
- "default": "./packageInfo.js"
69
- },
70
- "require": {
71
- "types": "./cjs/packageInfo.d.ts",
72
- "default": "./cjs/packageInfo.js"
73
- },
74
- "default": {
75
- "types": "./packageInfo.d.ts",
76
- "default": "./packageInfo.js"
77
- }
78
- },
79
- "./packageInfo": {
80
- "module": {
81
- "types": "./packageInfo.d.ts",
82
- "default": "./packageInfo.js"
83
- },
84
- "require": {
85
- "types": "./cjs/packageInfo.d.ts",
86
- "default": "./cjs/packageInfo.js"
87
- },
88
- "default": {
89
- "types": "./packageInfo.d.ts",
90
- "default": "./packageInfo.js"
91
- }
92
- },
93
- "./react-native": {
94
- "module": {
95
- "types": "./react-native.d.ts",
96
- "default": "./react-native.js"
97
- },
98
- "require": {
99
- "types": "./cjs/react-native.d.ts",
100
- "default": "./cjs/react-native.js"
101
- },
102
- "default": {
103
- "types": "./react-native.d.ts",
104
- "default": "./react-native.js"
105
- }
106
- },
107
- "./shim.js": {
108
- "module": {
109
- "types": "./shim.d.ts",
110
- "default": "./shim.js"
111
- },
112
- "require": {
113
- "types": "./cjs/shim.d.ts",
114
- "default": "./cjs/shim.js"
115
- },
116
- "default": {
117
- "types": "./shim.d.ts",
118
- "default": "./shim.js"
119
- }
120
- },
121
- "./shim": {
122
- "module": {
123
- "types": "./shim.d.ts",
124
- "default": "./shim.js"
125
- },
126
- "require": {
127
- "types": "./cjs/shim.d.ts",
128
- "default": "./cjs/shim.js"
129
- },
130
- "default": {
131
- "types": "./shim.d.ts",
132
- "default": "./shim.js"
133
- }
134
- }
135
- },
136
- "dependencies": {
137
- "@pezkuwi/x-global": "14.0.12",
138
- "node-fetch": "^3.3.2",
139
- "tslib": "^2.8.0"
140
- }
141
- }
@@ -1,6 +0,0 @@
1
- export declare const packageInfo: {
2
- name: string;
3
- path: string;
4
- type: string;
5
- version: string;
6
- };
@@ -1 +0,0 @@
1
- export const packageInfo = { name: '@pezkuwi/x-fetch', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.13' };
@@ -1 +0,0 @@
1
- export * from './browser.js';
@@ -1 +0,0 @@
1
- export * from './browser.js';
package/build/shim.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/build/shim.js DELETED
@@ -1,3 +0,0 @@
1
- import { fetch } from '@pezkuwi/x-fetch';
2
- import { exposeGlobal } from '@pezkuwi/x-global';
3
- exposeGlobal('fetch', fetch);
@@ -1,13 +0,0 @@
1
- # @pezkuwi/x-fetch
2
-
3
- A cross-environment fetch.
4
-
5
- Install it via `yarn add @pezkuwi/x-fetch`
6
-
7
- ```js
8
- import { fetch } from 'https://deno.land/x/pezkuwi/x-fetch/mod.ts';
9
-
10
- ...
11
- const response = await fetch('https://example.com/something.json');
12
- const json = await response.json();
13
- ```
@@ -1,6 +0,0 @@
1
-
2
- import { xglobal } from 'https://deno.land/x/pezkuwi/x-global/mod.ts';
3
-
4
- export { packageInfo } from './packageInfo.ts';
5
-
6
- export const fetch = xglobal.fetch;
package/build-deno/mod.ts DELETED
@@ -1,2 +0,0 @@
1
-
2
- export * from './browser.ts';
@@ -1,24 +0,0 @@
1
-
2
- import { extractGlobal } from 'https://deno.land/x/pezkuwi/x-global/mod.ts';
3
-
4
- export { packageInfo } from './packageInfo.ts';
5
-
6
- const importFetch = import('https://esm.sh/node-fetch@3.3.2').catch(() => null);
7
-
8
- let modFn: typeof fetch | null = null;
9
-
10
- async function nodeFetch (...args: Parameters<typeof fetch>): Promise<Response> {
11
- if (!modFn) {
12
- const mod = await importFetch;
13
-
14
- if (!mod?.default) {
15
- throw new Error('Unable to import node-fetch in this environment');
16
- }
17
-
18
- modFn = mod.default as unknown as typeof fetch;
19
- }
20
-
21
- return modFn(...args);
22
- }
23
-
24
- export const fetch = /*#__PURE__*/ extractGlobal('fetch', nodeFetch);
@@ -1,3 +0,0 @@
1
-
2
-
3
- export const packageInfo = { name: '@pezkuwi/x-fetch', path: new URL(import.meta.url).pathname, type: 'deno', version: '14.0.13' };
@@ -1,2 +0,0 @@
1
-
2
- export * from './browser.ts';
@@ -1,5 +0,0 @@
1
-
2
- import { fetch } from 'https://deno.land/x/pezkuwi/x-fetch/mod.ts';
3
- import { exposeGlobal } from 'https://deno.land/x/pezkuwi/x-global/mod.ts';
4
-
5
- exposeGlobal('fetch', fetch);
@@ -1,2 +0,0 @@
1
- export { packageInfo } from './packageInfo.js';
2
- export declare const fetch: typeof globalThis.fetch;
@@ -1,2 +0,0 @@
1
- export { packageInfo } from './packageInfo.js';
2
- export declare const fetch: typeof globalThis.fetch;
@@ -1,6 +0,0 @@
1
- export declare const packageInfo: {
2
- name: string;
3
- path: string;
4
- type: string;
5
- version: string;
6
- };
@@ -1 +0,0 @@
1
- export * from './browser.js';
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetch = exports.packageInfo = void 0;
4
- const x_global_1 = require("@pezkuwi/x-global");
5
- var packageInfo_js_1 = require("./packageInfo.js");
6
- Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
7
- exports.fetch = x_global_1.xglobal.fetch;
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.fetch = exports.packageInfo = void 0;
37
- const x_global_1 = require("@pezkuwi/x-global");
38
- var packageInfo_js_1 = require("./packageInfo.js");
39
- Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
40
- const importFetch = Promise.resolve().then(() => __importStar(require('node-fetch'))).catch(() => null);
41
- let modFn = null;
42
- async function nodeFetch(...args) {
43
- if (!modFn) {
44
- const mod = await importFetch;
45
- if (!mod?.default) {
46
- throw new Error('Unable to import node-fetch in this environment');
47
- }
48
- modFn = mod.default;
49
- }
50
- return modFn(...args);
51
- }
52
- exports.fetch = (0, x_global_1.extractGlobal)('fetch', nodeFetch);
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.packageInfo = void 0;
4
- exports.packageInfo = { name: '@pezkuwi/x-fetch', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.13' };
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./browser.js"), exports);
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const x_fetch_1 = require("@pezkuwi/x-fetch");
4
- const x_global_1 = require("@pezkuwi/x-global");
5
- (0, x_global_1.exposeGlobal)('fetch', x_fetch_1.fetch);
@@ -1,3 +0,0 @@
1
- import { xglobal } from '@pezkuwi/x-global';
2
- export { packageInfo } from './packageInfo.js';
3
- export const fetch = xglobal.fetch;
@@ -1,15 +0,0 @@
1
- import { extractGlobal } from '@pezkuwi/x-global';
2
- export { packageInfo } from './packageInfo.js';
3
- const importFetch = import('node-fetch').catch(() => null);
4
- let modFn = null;
5
- async function nodeFetch(...args) {
6
- if (!modFn) {
7
- const mod = await importFetch;
8
- if (!mod?.default) {
9
- throw new Error('Unable to import node-fetch in this environment');
10
- }
11
- modFn = mod.default;
12
- }
13
- return modFn(...args);
14
- }
15
- export const fetch = /*#__PURE__*/ extractGlobal('fetch', nodeFetch);
@@ -1 +0,0 @@
1
- export const packageInfo = { name: '@pezkuwi/x-fetch', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.13' };
@@ -1 +0,0 @@
1
- export * from './browser.js';
@@ -1,3 +0,0 @@
1
- import { fetch } from '@pezkuwi/x-fetch';
2
- import { exposeGlobal } from '@pezkuwi/x-global';
3
- exposeGlobal('fetch', fetch);
package/src/browser.ts DELETED
@@ -1,8 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/x-fetch authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { xglobal } from '@pezkuwi/x-global';
5
-
6
- export { packageInfo } from './packageInfo.js';
7
-
8
- export const fetch = xglobal.fetch;
package/src/mod.ts DELETED
@@ -1,4 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/x-fetch authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export * from './browser.js';
package/src/node.ts DELETED
@@ -1,31 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/x-fetch authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { extractGlobal } from '@pezkuwi/x-global';
5
-
6
- export { packageInfo } from './packageInfo.js';
7
-
8
- // This is an ESM module, use the async import(...) syntax to pull it
9
- // in. Logically we would like it in nodeFetch(...) itself, however
10
- // while it is all-ok on Node itself, it does create issues in Jest,
11
- // possibly due to the Jest 28 need for --experimental-vm-modules
12
- const importFetch = import('node-fetch').catch(() => null);
13
-
14
- // keep track of the resolved import value
15
- let modFn: typeof fetch | null = null;
16
-
17
- async function nodeFetch (...args: Parameters<typeof fetch>): Promise<Response> {
18
- if (!modFn) {
19
- const mod = await importFetch;
20
-
21
- if (!mod?.default) {
22
- throw new Error('Unable to import node-fetch in this environment');
23
- }
24
-
25
- modFn = mod.default as unknown as typeof fetch;
26
- }
27
-
28
- return modFn(...args);
29
- }
30
-
31
- export const fetch = /*#__PURE__*/ extractGlobal('fetch', nodeFetch);
@@ -1,6 +0,0 @@
1
- // Copyright 2017-2026 @pezkuwi/x-fetch authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- // Do not edit, auto-generated by @pezkuwi/dev
5
-
6
- export const packageInfo = { name: '@pezkuwi/x-fetch', path: 'auto', type: 'auto', version: '14.0.13' };
@@ -1,4 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/x-fetch authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export * from './browser.js';
package/src/shim.ts DELETED
@@ -1,7 +0,0 @@
1
- // Copyright 2017-2025 @pezkuwi/x-fetch authors & contributors
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { fetch } from '@pezkuwi/x-fetch';
5
- import { exposeGlobal } from '@pezkuwi/x-global';
6
-
7
- exposeGlobal('fetch', fetch);
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "baseUrl": "..",
5
- "outDir": "./build",
6
- "rootDir": "./src"
7
- },
8
- "exclude": [
9
- "**/mod.ts"
10
- ],
11
- "references": [
12
- { "path": "../x-global/tsconfig.build.json" }
13
- ]
14
- }