utils-lib-js 1.0.11 → 1.0.13

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.
@@ -39,8 +39,8 @@ var __rest = this && this.__rest || function (s, e) {
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
40
  exports.Request = void 0;
41
41
  var index_js_1 = require("./index.js");
42
- var node_http_1 = require("node:http");
43
- var node_url_1 = require("node:url");
42
+ var http_1 = require("http");
43
+ var url_1 = require("url");
44
44
  var Interceptors = function () {
45
45
  function Interceptors() {}
46
46
  Interceptors.prototype.use = function (type, fn) {
@@ -169,7 +169,7 @@ var RequestInit = function (_super) {
169
169
  _this.initHttpParams = function (url, opts) {
170
170
  var _a, _b;
171
171
  var params = _this.initAbort(_this.initDefaultParams(url, opts));
172
- var options = (0, node_url_1.parse)(params.url, true);
172
+ var options = (0, url_1.parse)(params.url, true);
173
173
  return (_b = (_a = _this.reqFn) === null || _a === void 0 ? void 0 : _a.call(_this, __assign(__assign({}, params), options))) !== null && _b !== void 0 ? _b : params;
174
174
  };
175
175
  return _this;
@@ -211,7 +211,7 @@ var Request = function (_super) {
211
211
  reject = _a.reject;
212
212
  var params = _this.initHttpParams(_url, _opts);
213
213
  var signal = params.signal;
214
- var req = (0, node_http_1.request)(params, function (response) {
214
+ var req = (0, http_1.request)(params, function (response) {
215
215
  if (response.statusCode >= 200 && response.statusCode < 300) {
216
216
  var data_1 = "";
217
217
  response.setEncoding('utf8');
@@ -51,7 +51,7 @@ export declare type IRequestParams<T> = T | IObject<any> | null;
51
51
  export declare type IUrl = string;
52
52
  export declare type IEnv = 'Window' | 'Node';
53
53
  export declare type IDataType = "text" | "json" | "blob" | "formData" | "arrayBuffer";
54
- export declare type IRequestMethods = "GET" | "POST" | "DELETE" | "PUT" | "OPTION";
54
+ export declare type IRequestMethods = "GET" | "POST" | "DELETE" | "PUT" | "OPTION" | "HEAD" | "PATCH";
55
55
  export declare type IRequestBody = IRequestParams<BodyInit>;
56
56
  export declare type IRequestHeaders = IRequestParams<HeadersInit>;
57
57
  export declare type IRequestBaseFn = (url: IUrl, opts: IRequestOptions) => Promise<any>;
@@ -35,8 +35,8 @@ var __rest = this && this.__rest || function (s, e) {
35
35
  return t;
36
36
  };
37
37
  import { urlJoin, defer, jsonToString } from "./index.js";
38
- import { request } from "node:http";
39
- import { parse } from "node:url";
38
+ import { request } from "http";
39
+ import { parse } from "url";
40
40
  var Interceptors = function () {
41
41
  function Interceptors() {}
42
42
  Interceptors.prototype.use = function (type, fn) {
@@ -51,7 +51,7 @@ export declare type IRequestParams<T> = T | IObject<any> | null;
51
51
  export declare type IUrl = string;
52
52
  export declare type IEnv = 'Window' | 'Node';
53
53
  export declare type IDataType = "text" | "json" | "blob" | "formData" | "arrayBuffer";
54
- export declare type IRequestMethods = "GET" | "POST" | "DELETE" | "PUT" | "OPTION";
54
+ export declare type IRequestMethods = "GET" | "POST" | "DELETE" | "PUT" | "OPTION" | "HEAD" | "PATCH";
55
55
  export declare type IRequestBody = IRequestParams<BodyInit>;
56
56
  export declare type IRequestHeaders = IRequestParams<HeadersInit>;
57
57
  export declare type IRequestBaseFn = (url: IUrl, opts: IRequestOptions) => Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utils-lib-js",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "JavaScript工具函数,封装的一些常用的js函数",
5
5
  "main": "./dist/common/index.js",
6
6
  "types": "./dist/common/index.d.ts",
@@ -33,11 +33,8 @@
33
33
  ],
34
34
  "author": "",
35
35
  "license": "ISC",
36
- "dependencies": {
37
- "event-message-center": "^1.0.16"
38
- },
39
36
  "devDependencies": {
40
- "@types/node": "^18.7.1",
37
+ "@types/node": "^18.7.15",
41
38
  "babel-cli": "^6.26.0"
42
39
  }
43
40
  }
package/pnpm-lock.yaml CHANGED
@@ -1,17 +1,19 @@
1
1
  lockfileVersion: 5.4
2
2
 
3
3
  specifiers:
4
+ '@types/node': ^18.7.15
4
5
  babel-cli: ^6.26.0
5
- event-message-center: ^1.0.16
6
-
7
- dependencies:
8
- event-message-center: 1.0.16
9
6
 
10
7
  devDependencies:
8
+ '@types/node': 18.7.15
11
9
  babel-cli: 6.26.0
12
10
 
13
11
  packages:
14
12
 
13
+ /@types/node/18.7.15:
14
+ resolution: {integrity: sha512-XnjpaI8Bgc3eBag2Aw4t2Uj/49lLBSStHWfqKvIuXD7FIrZyMLWp8KuAFHAqxMZYTF9l08N1ctUn9YNybZJVmQ==}
15
+ dev: true
16
+
15
17
  /ansi-regex/2.1.1:
16
18
  resolution: {integrity: sha512-TIGnTpdo+E3+pCyAluZvtED5p5wCqLdezCyhPZzKPcxvFplEt4i+W7OONCKgeZFT3+y5NZZfOOS/Bdcanm1MYA==}
17
19
  engines: {node: '>=0.10.0'}
@@ -389,7 +391,7 @@ packages:
389
391
 
390
392
  /core-js/2.6.12:
391
393
  resolution: {integrity: sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==}
392
- deprecated: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
394
+ deprecated: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
393
395
  requiresBuild: true
394
396
  dev: true
395
397
 
@@ -452,10 +454,6 @@ packages:
452
454
  engines: {node: '>=0.10.0'}
453
455
  dev: true
454
456
 
455
- /event-message-center/1.0.16:
456
- resolution: {integrity: sha512-K4wmY3Do7/xXIME6fYIZx0vHSr7Drd3mWsTSYc/XzBhl1EZSx45LngldH+4r7gIY3nfR5TqWRwYbghsMc8kLqg==}
457
- dev: false
458
-
459
457
  /expand-brackets/0.1.5:
460
458
  resolution: {integrity: sha512-hxx03P2dJxss6ceIeri9cmYOT4SRs3Zk3afZwWpOsRqLqprhTR8u++SlC+sFGsQr7WGFPdMF7Gjc1njDLDK6UA==}
461
459
  engines: {node: '>=0.10.0'}