@snack-kit/lib 0.4.0 → 0.5.0

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/README.md CHANGED
@@ -101,6 +101,18 @@ Cancel(cancelId) // 取消单个请求
101
101
  CancelAll() // 取消所有进行中的请求
102
102
  ```
103
103
 
104
+ ### 直接使用 axios
105
+
106
+ http 模块同时导出了原始 axios 实例及其常用类型,无需单独安装 `axios`:
107
+
108
+ ```ts
109
+ import { axios } from '@snack-kit/lib/http'
110
+ import type { AxiosRequestConfig, AxiosResponse, AxiosInstance, AxiosError } from '@snack-kit/lib/http'
111
+
112
+ // 直接使用 axios 实例
113
+ const res = await axios.get('https://api.example.com/data')
114
+ ```
115
+
104
116
  ---
105
117
 
106
118
  ## Debugger 模块
@@ -235,6 +247,7 @@ MIT
235
247
 
236
248
  - **[http]** `Get` / `Post` / `Put` / `Patch` / `Del` 新增配置对象入参形式,`method` 由方法预置无需重复传入
237
249
  - **[http]** 新增导出类型 `HttpMethodConfig`(`Omit<HttpRequestConfig, 'method'>`)
250
+ - **[http]** 导出原始 `axios` 实例及 `AxiosRequestConfig` / `AxiosResponse` / `AxiosInstance` / `AxiosError` 类型,无需单独安装 `axios`
238
251
 
239
252
  ### 0.3.0
240
253
 
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var axios = require('axios');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var axios__default = /*#__PURE__*/_interopDefault(axios);
8
+
9
+
10
+
11
+ module.exports = axios__default.default;
12
+ //# sourceMappingURL=chunk-IMHC6CTK.cjs.map
13
+ //# sourceMappingURL=chunk-IMHC6CTK.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-BEL6AFK4.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-IMHC6CTK.cjs","sourcesContent":[]}
package/dist/cjs/http.cjs CHANGED
@@ -1,10 +1,18 @@
1
1
  'use strict';
2
2
 
3
- require('./chunk-YY5WQN7B.cjs');
3
+ var chunkIMHC6CTK_cjs = require('./chunk-IMHC6CTK.cjs');
4
4
  var chunkXEQEQWDB_cjs = require('./chunk-XEQEQWDB.cjs');
5
5
 
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
7
 
8
+ var chunkIMHC6CTK_cjs__default = /*#__PURE__*/_interopDefault(chunkIMHC6CTK_cjs);
7
9
 
10
+
11
+
12
+ Object.defineProperty(exports, "axios", {
13
+ enumerable: true,
14
+ get: function () { return chunkIMHC6CTK_cjs__default.default; }
15
+ });
8
16
  Object.defineProperty(exports, "Cancel", {
9
17
  enumerable: true,
10
18
  get: function () { return chunkXEQEQWDB_cjs.Cancel; }
@@ -1,13 +1,21 @@
1
1
  'use strict';
2
2
 
3
- require('./chunk-YY5WQN7B.cjs');
3
+ var chunkIMHC6CTK_cjs = require('./chunk-IMHC6CTK.cjs');
4
4
  var chunkZJMTV2GJ_cjs = require('./chunk-ZJMTV2GJ.cjs');
5
5
  var chunkXEQEQWDB_cjs = require('./chunk-XEQEQWDB.cjs');
6
6
  var chunkU6KYHCBL_cjs = require('./chunk-U6KYHCBL.cjs');
7
7
 
8
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
+
10
+ var chunkIMHC6CTK_cjs__default = /*#__PURE__*/_interopDefault(chunkIMHC6CTK_cjs);
11
+
8
12
  // package.json
9
- var version = "0.4.0";
13
+ var version = "0.5.0";
10
14
 
15
+ Object.defineProperty(exports, "axios", {
16
+ enumerable: true,
17
+ get: function () { return chunkIMHC6CTK_cjs__default.default; }
18
+ });
11
19
  Object.defineProperty(exports, "Debugger", {
12
20
  enumerable: true,
13
21
  get: function () { return chunkZJMTV2GJ_cjs.Debugger; }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../package.json"],"names":[],"mappings":";;;;;;;;AAEE,IAAA,OAAA,GAAW","file":"index.cjs","sourcesContent":["{\n \"name\": \"@snack-kit/lib\",\n \"version\": \"0.4.0\",\n \"description\": \"Enterprise-grade utility library\",\n \"keywords\": [],\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/types/index.d.ts\",\n \"import\": \"./dist/es/index.js\",\n \"require\": \"./dist/cjs/index.cjs\"\n },\n \"./http\": {\n \"types\": \"./dist/types/http.d.ts\",\n \"import\": \"./dist/es/http.js\",\n \"require\": \"./dist/cjs/http.cjs\"\n },\n \"./debugger\": {\n \"types\": \"./dist/types/debugger.d.ts\",\n \"import\": \"./dist/es/debugger.js\",\n \"require\": \"./dist/cjs/debugger.cjs\"\n },\n \"./utils\": {\n \"types\": \"./dist/types/utils.d.ts\",\n \"import\": \"./dist/es/utils.js\",\n \"require\": \"./dist/cjs/utils.cjs\"\n }\n },\n \"main\": \"./dist/cjs/index.cjs\",\n \"module\": \"./dist/es/index.js\",\n \"types\": \"./dist/types/index.d.ts\",\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"build:watch\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"docs\": \"typedoc && cp -r docs/demo docs/api/demo\",\n \"docs:watch\": \"typedoc --watch\",\n \"lint\": \"tsc --noEmit\",\n \"prepublishOnly\": \"npm run build\",\n \"release\": \"npm run build && npm publish --access public\"\n },\n \"devDependencies\": {\n \"@vitest/coverage-v8\": \"^2.0.0\",\n \"tsup\": \"^8.0.0\",\n \"typedoc\": \"^0.26.0\",\n \"typescript\": \"^5.5.3\",\n \"vitest\": \"^2.0.0\"\n },\n \"dependencies\": {\n \"axios\": \"^1.13.6\"\n }\n}\n"]}
1
+ {"version":3,"sources":["../../package.json"],"names":[],"mappings":";;;;;;;;;;;;AAEE,IAAA,OAAA,GAAW","file":"index.cjs","sourcesContent":["{\n \"name\": \"@snack-kit/lib\",\n \"version\": \"0.5.0\",\n \"description\": \"Enterprise-grade utility library\",\n \"keywords\": [],\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/types/index.d.ts\",\n \"import\": \"./dist/es/index.js\",\n \"require\": \"./dist/cjs/index.cjs\"\n },\n \"./http\": {\n \"types\": \"./dist/types/http.d.ts\",\n \"import\": \"./dist/es/http.js\",\n \"require\": \"./dist/cjs/http.cjs\"\n },\n \"./debugger\": {\n \"types\": \"./dist/types/debugger.d.ts\",\n \"import\": \"./dist/es/debugger.js\",\n \"require\": \"./dist/cjs/debugger.cjs\"\n },\n \"./utils\": {\n \"types\": \"./dist/types/utils.d.ts\",\n \"import\": \"./dist/es/utils.js\",\n \"require\": \"./dist/cjs/utils.cjs\"\n }\n },\n \"main\": \"./dist/cjs/index.cjs\",\n \"module\": \"./dist/es/index.js\",\n \"types\": \"./dist/types/index.d.ts\",\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"build:watch\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"docs\": \"typedoc && cp -r docs/demo docs/api/demo\",\n \"docs:watch\": \"typedoc --watch\",\n \"lint\": \"tsc --noEmit\",\n \"prepublishOnly\": \"npm run build\",\n \"release\": \"npm run build && npm publish --access public\"\n },\n \"devDependencies\": {\n \"@vitest/coverage-v8\": \"^2.0.0\",\n \"tsup\": \"^8.0.0\",\n \"typedoc\": \"^0.26.0\",\n \"typescript\": \"^5.5.3\",\n \"vitest\": \"^2.0.0\"\n },\n \"dependencies\": {\n \"axios\": \"^1.13.6\"\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from 'axios';
2
+ //# sourceMappingURL=chunk-MHCY2PIP.js.map
3
+ //# sourceMappingURL=chunk-MHCY2PIP.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-YY5WQN7B.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chunk-MHCY2PIP.js","sourcesContent":[]}
package/dist/es/http.js CHANGED
@@ -1,4 +1,4 @@
1
- import './chunk-BEL6AFK4.js';
1
+ export { default as axios } from './chunk-MHCY2PIP.js';
2
2
  export { Cancel, CancelAll, Context, Ctx, Del, Get, HttpContext, Origin, Patch, Post, Put, Request } from './chunk-YV6SGXUJ.js';
3
3
  //# sourceMappingURL=http.js.map
4
4
  //# sourceMappingURL=http.js.map
package/dist/es/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import './chunk-BEL6AFK4.js';
1
+ export { default as axios } from './chunk-MHCY2PIP.js';
2
2
  export { Debugger } from './chunk-4SGFAIRT.js';
3
3
  export { Cancel, CancelAll, Context, Ctx, DEBUGGER_ACTIVE_KEY, Del, Get, HttpContext, Origin, Patch, Post, Put, Request } from './chunk-YV6SGXUJ.js';
4
4
  export { CleanObject, Debounce, DeepClone, Delay, FormatDate, GetDateOffset, GetDayRange, GetURLParam, GetURLParams, IsArray, IsBoolean, IsEmail, IsEqual, IsFunction, IsInteger, IsIpv4, IsNull, IsNumber, IsObject, IsPhone, IsPositiveInteger, IsRealNumber, IsString, IsUrl, Minus, ObjectToQuery, Omit, Pick, QueryToObject, REGEX, Throttle, UUID, Unique, UniqueByKey } from './chunk-WJX5Q3WL.js';
5
5
 
6
6
  // package.json
7
- var version = "0.4.0";
7
+ var version = "0.5.0";
8
8
 
9
9
  export { version as VERSION };
10
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../package.json"],"names":[],"mappings":";;;;;;AAEE,IAAA,OAAA,GAAW","file":"index.js","sourcesContent":["{\n \"name\": \"@snack-kit/lib\",\n \"version\": \"0.4.0\",\n \"description\": \"Enterprise-grade utility library\",\n \"keywords\": [],\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/types/index.d.ts\",\n \"import\": \"./dist/es/index.js\",\n \"require\": \"./dist/cjs/index.cjs\"\n },\n \"./http\": {\n \"types\": \"./dist/types/http.d.ts\",\n \"import\": \"./dist/es/http.js\",\n \"require\": \"./dist/cjs/http.cjs\"\n },\n \"./debugger\": {\n \"types\": \"./dist/types/debugger.d.ts\",\n \"import\": \"./dist/es/debugger.js\",\n \"require\": \"./dist/cjs/debugger.cjs\"\n },\n \"./utils\": {\n \"types\": \"./dist/types/utils.d.ts\",\n \"import\": \"./dist/es/utils.js\",\n \"require\": \"./dist/cjs/utils.cjs\"\n }\n },\n \"main\": \"./dist/cjs/index.cjs\",\n \"module\": \"./dist/es/index.js\",\n \"types\": \"./dist/types/index.d.ts\",\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"build:watch\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"docs\": \"typedoc && cp -r docs/demo docs/api/demo\",\n \"docs:watch\": \"typedoc --watch\",\n \"lint\": \"tsc --noEmit\",\n \"prepublishOnly\": \"npm run build\",\n \"release\": \"npm run build && npm publish --access public\"\n },\n \"devDependencies\": {\n \"@vitest/coverage-v8\": \"^2.0.0\",\n \"tsup\": \"^8.0.0\",\n \"typedoc\": \"^0.26.0\",\n \"typescript\": \"^5.5.3\",\n \"vitest\": \"^2.0.0\"\n },\n \"dependencies\": {\n \"axios\": \"^1.13.6\"\n }\n}\n"]}
1
+ {"version":3,"sources":["../../package.json"],"names":[],"mappings":";;;;;;AAEE,IAAA,OAAA,GAAW","file":"index.js","sourcesContent":["{\n \"name\": \"@snack-kit/lib\",\n \"version\": \"0.5.0\",\n \"description\": \"Enterprise-grade utility library\",\n \"keywords\": [],\n \"license\": \"MIT\",\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/types/index.d.ts\",\n \"import\": \"./dist/es/index.js\",\n \"require\": \"./dist/cjs/index.cjs\"\n },\n \"./http\": {\n \"types\": \"./dist/types/http.d.ts\",\n \"import\": \"./dist/es/http.js\",\n \"require\": \"./dist/cjs/http.cjs\"\n },\n \"./debugger\": {\n \"types\": \"./dist/types/debugger.d.ts\",\n \"import\": \"./dist/es/debugger.js\",\n \"require\": \"./dist/cjs/debugger.cjs\"\n },\n \"./utils\": {\n \"types\": \"./dist/types/utils.d.ts\",\n \"import\": \"./dist/es/utils.js\",\n \"require\": \"./dist/cjs/utils.cjs\"\n }\n },\n \"main\": \"./dist/cjs/index.cjs\",\n \"module\": \"./dist/es/index.js\",\n \"types\": \"./dist/types/index.d.ts\",\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"build:watch\": \"tsup --watch\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"docs\": \"typedoc && cp -r docs/demo docs/api/demo\",\n \"docs:watch\": \"typedoc --watch\",\n \"lint\": \"tsc --noEmit\",\n \"prepublishOnly\": \"npm run build\",\n \"release\": \"npm run build && npm publish --access public\"\n },\n \"devDependencies\": {\n \"@vitest/coverage-v8\": \"^2.0.0\",\n \"tsup\": \"^8.0.0\",\n \"typedoc\": \"^0.26.0\",\n \"typescript\": \"^5.5.3\",\n \"vitest\": \"^2.0.0\"\n },\n \"dependencies\": {\n \"axios\": \"^1.13.6\"\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { d as HttpMethodConfig, f as HttpResult, e as HttpRequestConfig } from './context-C4dFUDbw.js';
2
2
  export { C as Context, a as ContextInfo, b as Ctx, H as HttpContext, c as HttpError, O as Origin, S as ServerItem } from './context-C4dFUDbw.js';
3
- import 'axios';
3
+ export { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, default as axios } from 'axios';
4
4
 
5
5
  /**
6
6
  * 取消指定 id 的请求并从注册表移除
@@ -1,9 +1,9 @@
1
1
  export { C as Context, a as ContextInfo, b as Ctx, D as DEBUGGER_ACTIVE_KEY, H as HttpContext, c as HttpError, d as HttpMethodConfig, e as HttpRequestConfig, f as HttpResult, O as Origin, S as ServerItem } from './context-C4dFUDbw.js';
2
2
  export { Cancel, CancelAll, Del, Get, Patch, Post, Put, Request } from './http.js';
3
+ export { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse, default as axios } from 'axios';
3
4
  export { Debugger, DebuggerOptions } from './debugger.js';
4
5
  export { CleanObject, Debounce, DeepClone, Delay, FormatDate, GetDateOffset, GetDayRange, GetURLParam, GetURLParams, IsArray, IsBoolean, IsEmail, IsEqual, IsFunction, IsInteger, IsIpv4, IsNull, IsNumber, IsObject, IsPhone, IsPositiveInteger, IsRealNumber, IsString, IsUrl, Minus, ObjectToQuery, Omit, Pick, QueryToObject, REGEX, Throttle, UUID, Unique, UniqueByKey } from './utils.js';
5
- import 'axios';
6
6
 
7
- var version = "0.4.0";
7
+ var version = "0.5.0";
8
8
 
9
9
  export { version as VERSION };
@@ -15629,6 +15629,7 @@ var SnackKit = (function (exports, crypto2, url, http, https, http2, util2, zlib
15629
15629
  exports.Post = Post;
15630
15630
  exports.Put = Put;
15631
15631
  exports.Request = Request;
15632
+ exports.axios = axios_default;
15632
15633
 
15633
15634
  return exports;
15634
15635