@uni-helper/axios-adapter 1.5.3 → 1.16.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.
@@ -0,0 +1,7 @@
1
+ //#region src/types.d.ts
2
+ interface Options {}
3
+ interface UserOptions extends Partial<Options> {}
4
+ interface UnpluginOptions {}
5
+ interface UserUnpluginOptions extends Partial<UnpluginOptions> {}
6
+ //#endregion
7
+ export { UserUnpluginOptions as n, UserOptions as t };
@@ -0,0 +1,27 @@
1
+ const require_chunk = require("./chunk-CKQMccvm.cjs");
2
+ let node_process = require("node:process");
3
+ node_process = require_chunk.__toESM(node_process, 1);
4
+ let local_pkg = require("local-pkg");
5
+ //#region src/unplugin.ts
6
+ const unplugin$1 = (0, require("unplugin").createUnplugin)((_options = {}) => {
7
+ const hasFormDataPolyfill = (0, local_pkg.isPackageExists)("miniprogram-formdata");
8
+ const hasBlobPolyfill = (0, local_pkg.isPackageExists)("miniprogram-blob");
9
+ return {
10
+ name: "unplugin-uni-axios-adapter",
11
+ enforce: "pre",
12
+ transform(code, id) {
13
+ if (node_process.default.env.UNI_PLATFORM?.includes("mp")) {
14
+ if (id.includes("/form-data/lib/browser.js")) return { code: code.replace("window", "globalThis") };
15
+ if (id.includes("/axios/lib/platform/browser/classes/FormData.js")) return { code: `${hasFormDataPolyfill ? "import FormData from 'miniprogram-formdata';" : "class FormData {};"}\nexport default FormData;` };
16
+ if (id.includes("/axios/lib/platform/browser/classes/Blob.js")) return { code: `${hasBlobPolyfill ? "import Blob from 'miniprogram-blob';" : "class Blob {};"}\nexport default Blob;` };
17
+ }
18
+ }
19
+ };
20
+ });
21
+ //#endregion
22
+ Object.defineProperty(exports, "unplugin", {
23
+ enumerable: true,
24
+ get: function() {
25
+ return unplugin$1;
26
+ }
27
+ });
@@ -0,0 +1,21 @@
1
+ import process from "node:process";
2
+ import { isPackageExists } from "local-pkg";
3
+ import { createUnplugin } from "unplugin";
4
+ //#region src/unplugin.ts
5
+ const unplugin = createUnplugin((_options = {}) => {
6
+ const hasFormDataPolyfill = isPackageExists("miniprogram-formdata");
7
+ const hasBlobPolyfill = isPackageExists("miniprogram-blob");
8
+ return {
9
+ name: "unplugin-uni-axios-adapter",
10
+ enforce: "pre",
11
+ transform(code, id) {
12
+ if (process.env.UNI_PLATFORM?.includes("mp")) {
13
+ if (id.includes("/form-data/lib/browser.js")) return { code: code.replace("window", "globalThis") };
14
+ if (id.includes("/axios/lib/platform/browser/classes/FormData.js")) return { code: `${hasFormDataPolyfill ? "import FormData from 'miniprogram-formdata';" : "class FormData {};"}\nexport default FormData;` };
15
+ if (id.includes("/axios/lib/platform/browser/classes/Blob.js")) return { code: `${hasBlobPolyfill ? "import Blob from 'miniprogram-blob';" : "class Blob {};"}\nexport default Blob;` };
16
+ }
17
+ }
18
+ };
19
+ });
20
+ //#endregion
21
+ export { unplugin as t };
package/dist/vite.cjs CHANGED
@@ -1,8 +1,4 @@
1
- 'use strict';
2
-
3
- var chunkIWHKX3RU_cjs = require('./chunk-IWHKX3RU.cjs');
4
-
5
- // src/vite.ts
6
- var vite_default = chunkIWHKX3RU_cjs.unplugin.vite;
7
-
1
+ //#region src/vite.ts
2
+ var vite_default = require("./unplugin-B0XXJPh7.cjs").unplugin.vite;
3
+ //#endregion
8
4
  module.exports = vite_default;
package/dist/vite.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import * as vite from 'vite';
2
- import { a as UserUnpluginOptions } from './types-76de936f.js';
1
+ import { n as UserUnpluginOptions } from "./types-BSLo1MIA.cjs";
2
+ import * as _$vite from "vite";
3
3
 
4
- declare const _default: (options: UserUnpluginOptions) => vite.Plugin | vite.Plugin[];
5
-
6
- export { _default as default };
4
+ //#region src/vite.d.ts
5
+ declare const _default: (options: UserUnpluginOptions) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
6
+ export = _default;
package/dist/vite.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import * as vite from 'vite';
2
- import { a as UserUnpluginOptions } from './types-76de936f.js';
1
+ import { n as UserUnpluginOptions } from "./types-C-Kh3_5J.js";
2
+ import * as _$vite from "vite";
3
3
 
4
- declare const _default: (options: UserUnpluginOptions) => vite.Plugin | vite.Plugin[];
5
-
6
- export { _default as default };
4
+ //#region src/vite.d.ts
5
+ declare const _default: (options: UserUnpluginOptions) => _$vite.Plugin<any> | _$vite.Plugin<any>[];
6
+ //#endregion
7
+ export { _default as default };
package/dist/vite.js CHANGED
@@ -1,6 +1,5 @@
1
- import { unplugin } from './chunk-MB4L234N.js';
2
-
3
- // src/vite.ts
1
+ import { t as unplugin } from "./unplugin-GFuC6tIl.js";
2
+ //#region src/vite.ts
4
3
  var vite_default = unplugin.vite;
5
-
4
+ //#endregion
6
5
  export { vite_default as default };
package/dist/webpack.cjs CHANGED
@@ -1,8 +1,4 @@
1
- 'use strict';
2
-
3
- var chunkIWHKX3RU_cjs = require('./chunk-IWHKX3RU.cjs');
4
-
5
- // src/webpack.ts
6
- var webpack_default = chunkIWHKX3RU_cjs.unplugin.webpack;
7
-
1
+ //#region src/webpack.ts
2
+ var webpack_default = require("./unplugin-B0XXJPh7.cjs").unplugin.webpack;
3
+ //#endregion
8
4
  module.exports = webpack_default;
@@ -1,5 +1,5 @@
1
- import { a as UserUnpluginOptions } from './types-76de936f.js';
1
+ import { n as UserUnpluginOptions } from "./types-BSLo1MIA.cjs";
2
2
 
3
+ //#region src/webpack.d.ts
3
4
  declare const _default: (options: UserUnpluginOptions) => WebpackPluginInstance;
4
-
5
- export { _default as default };
5
+ export = _default;
package/dist/webpack.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { a as UserUnpluginOptions } from './types-76de936f.js';
1
+ import { n as UserUnpluginOptions } from "./types-C-Kh3_5J.js";
2
2
 
3
+ //#region src/webpack.d.ts
3
4
  declare const _default: (options: UserUnpluginOptions) => WebpackPluginInstance;
4
-
5
- export { _default as default };
5
+ //#endregion
6
+ export { _default as default };
package/dist/webpack.js CHANGED
@@ -1,6 +1,5 @@
1
- import { unplugin } from './chunk-MB4L234N.js';
2
-
3
- // src/webpack.ts
1
+ import { t as unplugin } from "./unplugin-GFuC6tIl.js";
2
+ //#region src/webpack.ts
4
3
  var webpack_default = unplugin.webpack;
5
-
4
+ //#endregion
6
5
  export { webpack_default as default };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@uni-helper/axios-adapter",
3
3
  "type": "module",
4
- "version": "1.5.3",
5
- "packageManager": "pnpm@8.9.2",
4
+ "version": "1.16.0",
6
5
  "description": "The Axios adapter for uniapp",
7
6
  "author": {
8
7
  "name": "kejunmao",
@@ -61,30 +60,29 @@
61
60
  "dist"
62
61
  ],
63
62
  "peerDependencies": {
64
- "axios": "^1.5.0"
63
+ "axios": "^1.16.0",
64
+ "vite": "^5.0.0"
65
65
  },
66
66
  "dependencies": {
67
- "local-pkg": "^0.5.0",
68
- "unplugin": "^1.4.0"
67
+ "local-pkg": "^1.1.2",
68
+ "unplugin": "^2.3.11"
69
69
  },
70
70
  "devDependencies": {
71
- "@antfu/eslint-config": "1.0.0-beta.28",
72
- "@dcloudio/types": "^3.3.3",
73
- "@types/node": "^20.6.0",
74
- "axios": "^1.5.0",
75
- "bumpp": "^9.2.0",
76
- "eslint": "^8.49.0",
77
- "msw": "^2.0.0",
78
- "pnpm": "^8.7.5",
79
- "rimraf": "^5.0.1",
80
- "tsup": "^7.2.0",
81
- "typescript": "^5.2.2",
82
- "vite": "^4.4.9",
83
- "vitest": "^0.34.4"
71
+ "@antfu/eslint-config": "^8.2.0",
72
+ "@dcloudio/types": "^3.4.31",
73
+ "@types/node": "^24.12.2",
74
+ "axios": "^1.16.0",
75
+ "bumpp": "^11.0.1",
76
+ "eslint": "^10.3.0",
77
+ "msw": "^2.14.3",
78
+ "tsdown": "^0.22.0",
79
+ "typescript": "^5.9.3",
80
+ "vite": "^5.4.21",
81
+ "vitest": "^3.2.4"
84
82
  },
85
83
  "scripts": {
86
- "build": "tsup",
87
- "dev": "tsup --watch",
84
+ "build": "tsdown",
85
+ "dev": "tsdown --watch",
88
86
  "play": "npm -C playground run dev:h5",
89
87
  "release": "bumpp",
90
88
  "test": "vitest",
@@ -1,43 +0,0 @@
1
- 'use strict';
2
-
3
- var process = require('process');
4
- var unplugin$1 = require('unplugin');
5
- var localPkg = require('local-pkg');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
-
9
- var process__default = /*#__PURE__*/_interopDefault(process);
10
-
11
- // src/unplugin.ts
12
- var unplugin = unplugin$1.createUnplugin((_options = {}) => {
13
- const hasFormDataPolyfill = localPkg.isPackageExists("miniprogram-formdata");
14
- const hasBlobPolyfill = localPkg.isPackageExists("miniprogram-blob");
15
- return {
16
- name: "unplugin-uni-axios-adapter",
17
- enforce: "pre",
18
- transform(code, id) {
19
- var _a;
20
- if ((_a = process__default.default.env.UNI_PLATFORM) == null ? void 0 : _a.includes("mp")) {
21
- if (id.includes("/form-data/lib/browser.js")) {
22
- return {
23
- code: code.replace("window", "globalThis")
24
- };
25
- }
26
- if (id.includes("/axios/lib/platform/browser/classes/FormData.js")) {
27
- return {
28
- code: `${hasFormDataPolyfill ? "import FormData from 'miniprogram-formdata';" : "class FormData {};"}
29
- export default FormData;`
30
- };
31
- }
32
- if (id.includes("/axios/lib/platform/browser/classes/Blob.js")) {
33
- return {
34
- code: `${hasBlobPolyfill ? "import Blob from 'miniprogram-blob';" : "class Blob {};"}
35
- export default Blob;`
36
- };
37
- }
38
- }
39
- }
40
- };
41
- });
42
-
43
- exports.unplugin = unplugin;
@@ -1,37 +0,0 @@
1
- import process from 'process';
2
- import { createUnplugin } from 'unplugin';
3
- import { isPackageExists } from 'local-pkg';
4
-
5
- // src/unplugin.ts
6
- var unplugin = createUnplugin((_options = {}) => {
7
- const hasFormDataPolyfill = isPackageExists("miniprogram-formdata");
8
- const hasBlobPolyfill = isPackageExists("miniprogram-blob");
9
- return {
10
- name: "unplugin-uni-axios-adapter",
11
- enforce: "pre",
12
- transform(code, id) {
13
- var _a;
14
- if ((_a = process.env.UNI_PLATFORM) == null ? void 0 : _a.includes("mp")) {
15
- if (id.includes("/form-data/lib/browser.js")) {
16
- return {
17
- code: code.replace("window", "globalThis")
18
- };
19
- }
20
- if (id.includes("/axios/lib/platform/browser/classes/FormData.js")) {
21
- return {
22
- code: `${hasFormDataPolyfill ? "import FormData from 'miniprogram-formdata';" : "class FormData {};"}
23
- export default FormData;`
24
- };
25
- }
26
- if (id.includes("/axios/lib/platform/browser/classes/Blob.js")) {
27
- return {
28
- code: `${hasBlobPolyfill ? "import Blob from 'miniprogram-blob';" : "class Blob {};"}
29
- export default Blob;`
30
- };
31
- }
32
- }
33
- }
34
- };
35
- });
36
-
37
- export { unplugin };
@@ -1,10 +0,0 @@
1
- interface Options {
2
- }
3
- interface UserOptions extends Partial<Options> {
4
- }
5
- interface UnpluginOptions {
6
- }
7
- interface UserUnpluginOptions extends Partial<UnpluginOptions> {
8
- }
9
-
10
- export { UserOptions as U, UserUnpluginOptions as a };