@ahoo-wang/fetcher 1.3.1 → 1.3.3
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/LICENSE +1 -1
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/index.es.js +7 -7
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/timeout.d.ts +8 -7
- package/dist/timeout.d.ts.map +1 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright [
|
|
189
|
+
Copyright [2025] [ahoo wang <ahoowang@qq.com>]
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ The lightweight core that powers the entire Fetcher ecosystem. Ultra-lightweight
|
|
|
12
12
|
|
|
13
13
|
## 🌟 Features
|
|
14
14
|
|
|
15
|
-
- **⚡ Ultra-Lightweight**: Only
|
|
15
|
+
- **⚡ Ultra-Lightweight**: Only 3KiB min+gzip
|
|
16
16
|
- **🧭 Path & Query Parameters**: Built-in support for path (`{id}`/`:id`) and query parameters
|
|
17
17
|
- **🔗 Interceptor System**: Request, response, and error interceptors for middleware patterns
|
|
18
18
|
- **⏱️ Timeout Control**: Configurable request timeouts with proper error handling
|
package/README.zh-CN.md
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -16,7 +16,7 @@ function _(r, e, t) {
|
|
|
16
16
|
return encodeURIComponent(i);
|
|
17
17
|
}) : r;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function q(r, e) {
|
|
20
20
|
const t = [];
|
|
21
21
|
let s;
|
|
22
22
|
for (; (s = e.exec(r)) !== null; )
|
|
@@ -48,7 +48,7 @@ const a = class a {
|
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
50
|
extractPathParams(e) {
|
|
51
|
-
return
|
|
51
|
+
return q(
|
|
52
52
|
e,
|
|
53
53
|
a.PATH_PARAM_REGEX
|
|
54
54
|
);
|
|
@@ -120,7 +120,7 @@ const L = new T(), h = class h {
|
|
|
120
120
|
* ```
|
|
121
121
|
*/
|
|
122
122
|
extractPathParams(e) {
|
|
123
|
-
return
|
|
123
|
+
return q(
|
|
124
124
|
e,
|
|
125
125
|
h.PATH_PARAM_REGEX
|
|
126
126
|
);
|
|
@@ -257,7 +257,7 @@ function G(r, e) {
|
|
|
257
257
|
}
|
|
258
258
|
async function M(r) {
|
|
259
259
|
const e = r.url, t = r.timeout, s = r;
|
|
260
|
-
if (!t)
|
|
260
|
+
if (r.signal || !t)
|
|
261
261
|
return fetch(e, s);
|
|
262
262
|
const n = new AbortController(), i = {
|
|
263
263
|
...s,
|
|
@@ -267,8 +267,8 @@ async function M(r) {
|
|
|
267
267
|
const c = new Promise((se, N) => {
|
|
268
268
|
o = setTimeout(() => {
|
|
269
269
|
o && clearTimeout(o);
|
|
270
|
-
const
|
|
271
|
-
n.abort(
|
|
270
|
+
const g = new y(r);
|
|
271
|
+
n.abort(g), N(g);
|
|
272
272
|
}, t);
|
|
273
273
|
});
|
|
274
274
|
try {
|
|
@@ -1075,7 +1075,7 @@ export {
|
|
|
1075
1075
|
M as timeoutFetch,
|
|
1076
1076
|
p as toSorted,
|
|
1077
1077
|
L as uriTemplateResolver,
|
|
1078
|
-
|
|
1078
|
+
q as urlTemplateRegexExtract,
|
|
1079
1079
|
_ as urlTemplateRegexResolve
|
|
1080
1080
|
};
|
|
1081
1081
|
//# sourceMappingURL=index.es.js.map
|