keq 2.6.5 → 2.6.7
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/CHANGELOG.md +14 -0
- package/dist/esm/src/core.js +2 -2
- package/dist/esm/src/router/keq-pathname-route.js +2 -2
- package/dist/esm/src/util/clone-body.d.ts +1 -0
- package/dist/esm/src/util/{clone.js → clone-body.js} +3 -4
- package/dist/umd/src/core.js +3 -3
- package/dist/umd/src/router/keq-pathname-route.js +25 -2
- package/dist/umd/src/util/clone-body.d.ts +1 -0
- package/dist/umd/src/util/{clone.js → clone-body.js} +5 -6
- package/package.json +1 -1
- package/tsconfig.json +0 -1
- package/dist/esm/src/util/clone.d.ts +0 -1
- package/dist/umd/src/util/clone.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.6.7](https://github.com/keq-request/keq/compare/v2.6.6...v2.6.7) (2024-06-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Performance Improvements
|
|
9
|
+
|
|
10
|
+
* rename clone to cloneBody ([c008b50](https://github.com/keq-request/keq/commit/c008b50d2e627853a3451cdfa9ad5f49a4bc8f17))
|
|
11
|
+
|
|
12
|
+
## [2.6.6](https://github.com/keq-request/keq/compare/v2.6.5...v2.6.6) (2024-06-03)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* unable to package correctly in nuxt3 ([b5ce266](https://github.com/keq-request/keq/commit/b5ce2662d26b180add3496b27ba795f8416a0e58))
|
|
18
|
+
|
|
5
19
|
## [2.6.5](https://github.com/keq-request/keq/compare/v2.6.4...v2.6.5) (2024-06-03)
|
|
6
20
|
|
|
7
21
|
|
package/dist/esm/src/core.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mitt from 'mitt';
|
|
2
2
|
import { URL } from 'whatwg-url';
|
|
3
3
|
import { Exception } from './exception/exception.js';
|
|
4
|
-
import {
|
|
4
|
+
import { cloneBody } from './util/clone-body.js';
|
|
5
5
|
import { ABORT_PROPERTY, NEXT_INVOKED_PROPERTY, OUTPUT_PROPERTY } from './constant.js';
|
|
6
6
|
import { composeMiddleware } from './util/compose-middleware.js';
|
|
7
7
|
import { shadowClone } from './util/shadow-clone.js';
|
|
@@ -53,7 +53,7 @@ export class Core {
|
|
|
53
53
|
url: new URL(this.requestContext.url.href),
|
|
54
54
|
headers,
|
|
55
55
|
routeParams: shadowClone(this.requestContext.routeParams),
|
|
56
|
-
body:
|
|
56
|
+
body: cloneBody(this.requestContext.body),
|
|
57
57
|
cache: this.requestContext.cache,
|
|
58
58
|
credentials: this.requestContext.credentials,
|
|
59
59
|
integrity: this.requestContext.integrity,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cloneBody<T>(obj: T): T;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
2
1
|
import deepClone from 'clone';
|
|
3
2
|
import fromEntries from 'object.fromentries';
|
|
4
3
|
import { isBlob } from '../is/is-blob';
|
|
5
|
-
export function
|
|
4
|
+
export function cloneBody(obj) {
|
|
6
5
|
if (Array.isArray(obj)) {
|
|
7
|
-
return obj.map((item) => (isBlob(item) ? item :
|
|
6
|
+
return obj.map((item) => (isBlob(item) ? item : cloneBody(item)));
|
|
8
7
|
}
|
|
9
8
|
else if (obj === null) {
|
|
10
9
|
return null;
|
|
@@ -13,7 +12,7 @@ export function clone(obj) {
|
|
|
13
12
|
const entries = Object.entries(obj)
|
|
14
13
|
.map(([key, value]) => ([
|
|
15
14
|
key,
|
|
16
|
-
isBlob(value) ? value :
|
|
15
|
+
isBlob(value) ? value : cloneBody(value),
|
|
17
16
|
]));
|
|
18
17
|
return fromEntries(entries);
|
|
19
18
|
}
|
package/dist/umd/src/core.js
CHANGED
|
@@ -7,7 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
if (v !== undefined) module.exports = v;
|
|
8
8
|
}
|
|
9
9
|
else if (typeof define === "function" && define.amd) {
|
|
10
|
-
define(["require", "exports", "mitt", "whatwg-url", "./exception/exception.js", "./util/clone.js", "./constant.js", "./util/compose-middleware.js", "./util/shadow-clone.js"], factory);
|
|
10
|
+
define(["require", "exports", "mitt", "whatwg-url", "./exception/exception.js", "./util/clone-body.js", "./constant.js", "./util/compose-middleware.js", "./util/shadow-clone.js"], factory);
|
|
11
11
|
}
|
|
12
12
|
})(function (require, exports) {
|
|
13
13
|
"use strict";
|
|
@@ -16,7 +16,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
const mitt_1 = __importDefault(require("mitt"));
|
|
17
17
|
const whatwg_url_1 = require("whatwg-url");
|
|
18
18
|
const exception_js_1 = require("./exception/exception.js");
|
|
19
|
-
const
|
|
19
|
+
const clone_body_js_1 = require("./util/clone-body.js");
|
|
20
20
|
const constant_js_1 = require("./constant.js");
|
|
21
21
|
const compose_middleware_js_1 = require("./util/compose-middleware.js");
|
|
22
22
|
const shadow_clone_js_1 = require("./util/shadow-clone.js");
|
|
@@ -68,7 +68,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
68
68
|
url: new whatwg_url_1.URL(this.requestContext.url.href),
|
|
69
69
|
headers,
|
|
70
70
|
routeParams: (0, shadow_clone_js_1.shadowClone)(this.requestContext.routeParams),
|
|
71
|
-
body: (0,
|
|
71
|
+
body: (0, clone_body_js_1.cloneBody)(this.requestContext.body),
|
|
72
72
|
cache: this.requestContext.cache,
|
|
73
73
|
credentials: this.requestContext.credentials,
|
|
74
74
|
integrity: this.requestContext.integrity,
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
|
+
if (k2 === undefined) k2 = k;
|
|
3
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
6
|
+
}
|
|
7
|
+
Object.defineProperty(o, k2, desc);
|
|
8
|
+
}) : (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
o[k2] = m[k];
|
|
11
|
+
}));
|
|
12
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
13
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
14
|
+
}) : function(o, v) {
|
|
15
|
+
o["default"] = v;
|
|
16
|
+
});
|
|
17
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
18
|
+
if (mod && mod.__esModule) return mod;
|
|
19
|
+
var result = {};
|
|
20
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
21
|
+
__setModuleDefault(result, mod);
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
1
24
|
(function (factory) {
|
|
2
25
|
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
26
|
var v = factory(require, exports);
|
|
@@ -10,9 +33,9 @@
|
|
|
10
33
|
"use strict";
|
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
35
|
exports.keqPathnameRoute = void 0;
|
|
13
|
-
const
|
|
36
|
+
const m = __importStar(require("minimatch"));
|
|
14
37
|
function keqPathnameRoute(pathname) {
|
|
15
|
-
return (ctx) =>
|
|
38
|
+
return (ctx) => m.minimatch(ctx.request.url.pathname, pathname);
|
|
16
39
|
}
|
|
17
40
|
exports.keqPathnameRoute = keqPathnameRoute;
|
|
18
41
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cloneBody<T>(obj: T): T;
|
|
@@ -12,14 +12,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
})(function (require, exports) {
|
|
13
13
|
"use strict";
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
16
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
15
|
+
exports.cloneBody = void 0;
|
|
17
16
|
const clone_1 = __importDefault(require("clone"));
|
|
18
17
|
const object_fromentries_1 = __importDefault(require("object.fromentries"));
|
|
19
18
|
const is_blob_1 = require("../is/is-blob");
|
|
20
|
-
function
|
|
19
|
+
function cloneBody(obj) {
|
|
21
20
|
if (Array.isArray(obj)) {
|
|
22
|
-
return obj.map((item) => ((0, is_blob_1.isBlob)(item) ? item :
|
|
21
|
+
return obj.map((item) => ((0, is_blob_1.isBlob)(item) ? item : cloneBody(item)));
|
|
23
22
|
}
|
|
24
23
|
else if (obj === null) {
|
|
25
24
|
return null;
|
|
@@ -28,11 +27,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
27
|
const entries = Object.entries(obj)
|
|
29
28
|
.map(([key, value]) => ([
|
|
30
29
|
key,
|
|
31
|
-
(0, is_blob_1.isBlob)(value) ? value :
|
|
30
|
+
(0, is_blob_1.isBlob)(value) ? value : cloneBody(value),
|
|
32
31
|
]));
|
|
33
32
|
return (0, object_fromentries_1.default)(entries);
|
|
34
33
|
}
|
|
35
34
|
return (0, clone_1.default)(obj);
|
|
36
35
|
}
|
|
37
|
-
exports.
|
|
36
|
+
exports.cloneBody = cloneBody;
|
|
38
37
|
});
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function clone<T>(obj: T): T;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function clone<T>(obj: T): T;
|