├── .editorconfig ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── README.md ├── __tests__ └── index.spec.js ├── helper ├── __tests__ │ └── index.spec.js ├── format.js ├── isMultiUpload.js └── isUploadFile.js ├── index.d.ts ├── index.js ├── jest.config.js ├── package.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | 9 | # https://github.com/vuejs/vetur/issues/1319 10 | # CRLF will cause some error 11 | end_of_line = lf 12 | insert_final_newline = true 13 | charset = utf-8 14 | indent_style = space 15 | indent_size = 2 16 | trim_trailing_whitespace = true 17 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | browser: true, 5 | es2020: true, 6 | node: true, 7 | jest: true, 8 | }, 9 | extends: ['eslint:recommended'], 10 | parserOptions: { 11 | ecmaVersion: 11, 12 | sourceType: 'module', 13 | }, 14 | rules: {}, 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | debug.log -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | semi: false 2 | singleQuote: true 3 | printWidth: 80 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 用于 uni-app 的 `axios` adapter 2 | 3 | 利用 `axios` params.adapter 增加了 uni-app 的 `uni.request` 和 `uni.uploadFile` 的适配器 4 | 5 | 基于原来的 `xhr.js` adapter 调整而来,保留了中止请求的 `cancelToken` 用法 6 | 7 | **欢迎 issue 和 pr** 8 | 9 | ## TODO 10 | 11 | - [ ] examples 12 | - [ ] 测试用例是模拟的,仅校验了配置数据格式,考虑用 uniapp 接口做测试。 [https://uniapp.dcloud.io/collocation/auto/quick-start](https://uniapp.dcloud.io/collocation/auto/quick-start) 13 | 14 | ## 安装 15 | 16 | Using npm: 17 | 18 | `$ npm install axios-adapter-uniapp` 19 | 20 | Using yarn: 21 | 22 | `$ yarn add axios-adapter-uniapp` 23 | 24 | 直接引用: 25 | 26 | 去[仓库](https://github.com/lcysgsg/axios-adapter-uniapp)复制 27 | 28 | ## 用法 29 | 30 | > 就是 axios , 具体看 axios 文档, 这里大概的列一下 31 | 32 | [axios](https://www.npmjs.com/package/axios) 33 | 34 | [uniapp request](https://uniapp.dcloud.io/api/request/request) 35 | 36 | [uniapp network-file](https://uniapp.dcloud.io/api/request/network-file) 37 | 38 | ### 适配了什么 39 | 40 | - `GET` 41 | - 兼容了字段 `data`, `data`(优先) 和 `params` 效果相同。 42 | - `POST` 43 | - 上传文件,要触发 `uni.uploadFile` 需要满足 2 个条件: 44 | - `POST` 45 | - `config.filePath && config.name` 或 `Array.isArray(config.files) && config.files.length > 0` 46 | - 取消请求,不能支持 uniapp 原先的方法——因为 `Promise`,支持使用 axios CancelToken 的用法 47 | 48 | ### 例子 49 | 50 | 例子都是 `config` 风格, 也是我推荐的(),链式也支持,更多例子可以看根目录下的 `__tests__/index.spec.js` 51 | 52 | ```js 53 | // '@/common/js/axios/index.js' 54 | 55 | import axios from 'axios' 56 | import axiosAdapterUniapp from 'axios-adapter-uniapp' 57 | 58 | const instance = axios.create({ 59 | baseURL: 'URL.com', 60 | adapter: axiosAdapterUniapp, 61 | }) 62 | 63 | // request拦截器 64 | instance.interceptors.request.use() 65 | 66 | // respone拦截器 67 | instance.interceptors.request.use() 68 | 69 | export default instance 70 | ``` 71 | 72 | `GET` 73 | 74 | ```js 75 | import axios from '@/common/js/axios/index.js' 76 | 77 | axios({ 78 | method: 'get', 79 | url: '/user', 80 | data: { 81 | id: 1, 82 | }, 83 | }) 84 | 85 | axios({ 86 | method: 'get', 87 | url: '/user', 88 | params: { 89 | id: 1, 90 | }, 91 | }) 92 | 93 | // 两者结果相同 => 94 | // URL.com/user?id=1 95 | ``` 96 | 97 | `POST` 98 | 99 | ```js 100 | import axios from '@/common/js/axios/index.js' 101 | 102 | axios({ 103 | method: 'post', 104 | url: '/user', 105 | data: { 106 | firstName: 'Fred', 107 | lastName: 'Flintstone', 108 | }, 109 | }) 110 | ``` 111 | 112 | `UPLOAD`,要触发 `uni.uploadFile` 需要满足 2 个条件: 113 | 114 | - `POST` 115 | - `config.filePath && config.name` 或 `Array.isArray(config.files) && config.files.length > 0` 116 | 117 | ```js 118 | import axios from '@/common/js/axios/index.js' 119 | 120 | axios({ 121 | method: 'post', 122 | url: '/avatar', 123 | filePath: uri, 124 | name: 'file', 125 | formData: { 126 | firstName: 'Fred', 127 | lastName: 'Flintstone', 128 | }, 129 | }) 130 | 131 | axios({ 132 | method: 'post', 133 | url: '/avatar', 134 | files: [ 135 | // 多文件上传有注意事项的,看uni文档 136 | { name: 'file', uri: uri }, 137 | ], 138 | formData: { 139 | firstName: 'Fred', 140 | lastName: 'Flintstone', 141 | }, 142 | }) 143 | ``` 144 | 145 | `CancelToken` 取消请求, [https://www.npmjs.com/package/axios#cancellation](https://www.npmjs.com/package/axios#cancellation) 146 | 147 | ```js 148 | import axios from '@/common/js/axios/index.js' 149 | 150 | const CancelToken = axios.CancelToken; 151 | const source = CancelToken.source(); 152 | 153 | axios({ 154 | ..., 155 | cancelToken: source.token 156 | }).catch(function (thrown) { 157 | if (axios.isCancel(thrown)) { 158 | console.log('Request canceled', thrown.message); 159 | } else { 160 | // handle error 161 | } 162 | }); 163 | 164 | // 或者 165 | 166 | const CancelToken = axios.CancelToken; 167 | let cancel; 168 | 169 | axios({ 170 | ..., 171 | cancelToken: new CancelToken(function executor(c) { 172 | // An executor function receives a cancel function as a parameter 173 | cancel = c; 174 | }) 175 | }); 176 | 177 | // cancel the request 178 | cancel(); 179 | ``` 180 | -------------------------------------------------------------------------------- /__tests__/index.spec.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios') 2 | const format = require('../helper/format') 3 | const isUploadFile = require('../helper/isUploadFile') 4 | 5 | function uniappAdapter_TEST(config = {}) { 6 | return new Promise(function dispatchUniApp(resolve, reject) { 7 | const uniConfig = format(config, resolve, reject) 8 | 9 | resolve(uniConfig) 10 | }) 11 | } 12 | const instance = axios.create({ 13 | baseURL: 'URL.com', 14 | adapter: uniappAdapter_TEST, 15 | }) 16 | 17 | test('校验 uniConfig', () => { 18 | let config 19 | 20 | config = { 21 | method: 'GET', 22 | } 23 | instance(config).then((res) => { 24 | expect(res.method).toBe('get') 25 | }) 26 | 27 | config = { 28 | method: 'POST', 29 | } 30 | instance(config).then((res) => { 31 | expect(res.method).toBe('post') 32 | }) 33 | 34 | config = { 35 | url: '/user', 36 | params: { 37 | a: 1, 38 | b: 2, 39 | }, 40 | } 41 | instance(config).then((res) => { 42 | expect(res.method).toBe('get') 43 | expect(res.url).toBe('URL.com/user?a=1&b=2') 44 | }) 45 | 46 | config = { 47 | method: 'post', 48 | url: '/user', 49 | params: { 50 | a: 1, 51 | b: 2, 52 | }, 53 | } 54 | instance(config).then((res) => { 55 | expect(res.method).toBe('post') 56 | expect(res.url).toBe('URL.com/user?a=1&b=2') 57 | }) 58 | 59 | config = { 60 | method: 'post', 61 | url: '/user', 62 | params: { 63 | a: 1, 64 | b: 2, 65 | }, 66 | data: { 67 | aa: 1, 68 | bb: 2, 69 | }, 70 | formData: { 71 | aa: 1, 72 | bb: 2, 73 | }, 74 | } 75 | instance(config).then((res) => { 76 | expect(res.data).toEqual({ 77 | aa: 1, 78 | bb: 2, 79 | }) 80 | expect(res.url).toBe('URL.com/user?a=1&b=2') 81 | }) 82 | }) 83 | 84 | test('request alias', () => { 85 | let config 86 | 87 | config = { 88 | params: { 89 | a: 1, 90 | b: 2, 91 | }, 92 | } 93 | instance.get('/user', config).then((res) => { 94 | expect(res.method).toBe('get') 95 | expect(res.url).toBe('URL.com/user?a=1&b=2') 96 | }) 97 | 98 | config = { 99 | data: { 100 | a: 3, 101 | b: 4, 102 | }, 103 | headers: { 104 | say: 'hi', 105 | }, 106 | } 107 | instance 108 | .post( 109 | '/user', 110 | { 111 | a: 1, 112 | b: 2, 113 | }, 114 | config 115 | ) 116 | .then((res) => { 117 | expect(res.headers.say).toEqual('hi') 118 | expect(res.data).toEqual({ 119 | a: 1, 120 | b: 2, 121 | }) 122 | }) 123 | }) 124 | 125 | test('upload', () => { 126 | let config = {} 127 | 128 | config = { 129 | method: 'post', 130 | url: '/upload', 131 | params: { 132 | a: 1, 133 | b: 2, 134 | }, 135 | data: { 136 | aa: 1, 137 | bb: 2, 138 | }, 139 | files: [{ name: 'file', uri: '/path' }], 140 | } 141 | instance(config).then((res) => { 142 | expect(isUploadFile(res)).toEqual(true) 143 | expect(res.formData).toEqual({ 144 | aa: 1, 145 | bb: 2, 146 | }) 147 | expect(res.url).toBe('URL.com/upload?a=1&b=2') 148 | }) 149 | 150 | config = { 151 | method: 'post', 152 | url: '/upload', 153 | params: { 154 | a: 1, 155 | b: 2, 156 | }, 157 | data: { 158 | aa: 1, 159 | bb: 2, 160 | }, 161 | filePath: '/path', 162 | name: 'file', 163 | } 164 | instance(config).then((res) => { 165 | expect(isUploadFile(res)).toEqual(true) 166 | expect(res.formData).toEqual({ 167 | aa: 1, 168 | bb: 2, 169 | }) 170 | expect(res.url).toBe('URL.com/upload?a=1&b=2') 171 | }) 172 | }) 173 | -------------------------------------------------------------------------------- /helper/__tests__/index.spec.js: -------------------------------------------------------------------------------- 1 | const isMultiUpload = require('../isMultiUpload') 2 | const isUploadFile = require('../isUploadFile') 3 | 4 | test('【helper】isMultiUpload', () => { 5 | let config 6 | 7 | config = { 8 | files: [], 9 | } 10 | expect(isMultiUpload(config)).toBe(false) 11 | 12 | config = { 13 | files: new Array(1), 14 | } 15 | expect(isMultiUpload(config)).toBe(true) 16 | }) 17 | 18 | test('【helper】isUploadFile ', () => { 19 | let config 20 | 21 | config = {} 22 | expect(isUploadFile(config)).toBe(false) 23 | 24 | config = { 25 | method: 'get' 26 | } 27 | expect(isUploadFile(config)).toBe(false) 28 | 29 | config = { 30 | method: 'post', 31 | } 32 | expect(isUploadFile(config)).toBe(false) 33 | 34 | config = { 35 | method: 'post', 36 | filePath: '/a', 37 | name: 'file', 38 | } 39 | expect(isUploadFile(config)).toBe(true) 40 | 41 | config = { 42 | method: 'post', 43 | files: new Array(1), 44 | } 45 | expect(isUploadFile(config)).toBe(true) 46 | }) 47 | -------------------------------------------------------------------------------- /helper/format.js: -------------------------------------------------------------------------------- 1 | // var utils = require("axios/lib/utils"); 2 | var settle = require('axios/lib/core/settle') 3 | // var cookies = require("axios/lib/helpers/cookies"); 4 | var buildURL = require('axios/lib/helpers/buildURL') 5 | var buildFullPath = require('axios/lib/core/buildFullPath') 6 | // var parseHeaders = require("axios/lib/helpers/parseHeaders"); 7 | // var isURLSameOrigin = require("axios/lib/helpers/isURLSameOrigin"); 8 | // var createError = require("axios/lib/core/createError"); 9 | const isUploadFile = require('./isUploadFile') 10 | 11 | module.exports = function format(config, resolve, reject) { 12 | const fullPath = buildFullPath(config.baseURL, config.url) 13 | const requestHeaders = config.headers 14 | 15 | const uniConfig = { 16 | ...config, 17 | url: buildURL(fullPath, config.params, config.paramsSerializer), 18 | 19 | // uniapp 用的是 header 20 | header: requestHeaders, 21 | } 22 | 23 | if (isUploadFile(config)) { 24 | delete requestHeaders['Content-Type'] // Let the browser set it 25 | if (config.formData) { 26 | uniConfig.formData = config.formData 27 | } else { 28 | // application/json 且 data isObject 时, 发送前会对 config.data 进行 JSON.stringify 处理 29 | // uniapp 内部会处理,即需要的就是 object, 所以需要提前 parse 30 | if (typeof config.data === 'string') { 31 | // 如果,config.data 数据格式不合适,还是选择报错 32 | uniConfig.formData = JSON.parse(config.data) 33 | } else { 34 | uniConfig.formData = config.data 35 | } 36 | } 37 | } else if (config.method === 'get') { 38 | // 兼容 get 时的 params 字段 39 | uniConfig.data = config.data ? config.data : config.params 40 | } else { 41 | uniConfig.data = config.data 42 | } 43 | 44 | // HTTP basic authentication 45 | if (config.auth) { 46 | var username = config.auth.username || '' 47 | var password = unescape(encodeURIComponent(config.auth.password)) || '' 48 | requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password) 49 | } 50 | 51 | uniConfig.complete = function (response) { 52 | // 暂时不明白为什么要判断 responseType === 'text',也许返回结果是有多种格式的,但是目前没碰到。 53 | // var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response; 54 | var result = { 55 | data: response.data, 56 | status: response.statusCode, 57 | statusText: response.errMsg, 58 | header: response.header, 59 | config: config, 60 | // request: request 61 | } 62 | 63 | settle(resolve, reject, result) 64 | } 65 | 66 | return uniConfig 67 | } 68 | -------------------------------------------------------------------------------- /helper/isMultiUpload.js: -------------------------------------------------------------------------------- 1 | module.exports = function isMultiUpload(config) { 2 | return Array.isArray(config.files) && config.files.length > 0 3 | } 4 | -------------------------------------------------------------------------------- /helper/isUploadFile.js: -------------------------------------------------------------------------------- 1 | const isMultiUpload = require('./isMultiUpload') 2 | 3 | module.exports = function isUploadFile(config) { 4 | if (config.method === 'post') { 5 | if (config.filePath && config.name) return true 6 | 7 | if (isMultiUpload(config)) return true 8 | } 9 | 10 | return false 11 | } 12 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | import type { AxiosPromise, AxiosRequestConfig } from 'axios' 2 | 3 | declare function uniappAdapter(config: AxiosRequestConfig): AxiosPromise 4 | 5 | export default uniappAdapter 6 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* global uni */ 2 | 'use strict' 3 | 4 | const isUploadFile = require('./helper/isUploadFile') 5 | const format = require('./helper/format') 6 | 7 | /** 8 | * 参数配置参考: 9 | * > axios https://www.npmjs.com/package/axios#request-config 10 | * > uniapp request https://uniapp.dcloud.io/api/request/request 11 | * > uniapp upload https://uniapp.dcloud.io/api/request/network-file 12 | * @param {object} config 13 | */ 14 | function uniappAdapter(config = {}) { 15 | return new Promise(function dispatchUniApp(resolve, reject) { 16 | const uniConfig = format(config, resolve, reject) 17 | 18 | let requestTask = null 19 | if (config.cancelToken) { 20 | // Handle cancellation 21 | config.cancelToken.promise.then(function onCanceled(cancel) { 22 | if (!requestTask) { 23 | return 24 | } 25 | 26 | requestTask.abort() 27 | reject(cancel) 28 | // Clean up request 29 | requestTask = null 30 | }) 31 | } 32 | 33 | // Send the request 34 | if (isUploadFile(config)) { 35 | requestTask = uni.uploadFile(uniConfig) 36 | } else { 37 | requestTask = uni.request(uniConfig) 38 | } 39 | }) 40 | } 41 | module.exports = uniappAdapter 42 | 43 | // Allow use of default import syntax in TypeScript 44 | module.exports.default = uniappAdapter 45 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // For a detailed explanation regarding each configuration property, visit: 2 | // https://jestjs.io/docs/en/configuration.html 3 | 4 | module.exports = { 5 | // All imported modules in your tests should be mocked automatically 6 | // automock: false, 7 | 8 | // Stop running tests after `n` failures 9 | // bail: 0, 10 | 11 | // The directory where Jest should store its cached dependency information 12 | // cacheDirectory: "C:\\Users\\Administrator\\AppData\\Local\\Temp\\jest", 13 | 14 | // Automatically clear mock calls and instances between every test 15 | clearMocks: true, 16 | 17 | // Indicates whether the coverage information should be collected while executing the test 18 | // collectCoverage: false, 19 | 20 | // An array of glob patterns indicating a set of files for which coverage information should be collected 21 | // collectCoverageFrom: undefined, 22 | 23 | // The directory where Jest should output its coverage files 24 | // coverageDirectory: undefined, 25 | 26 | // An array of regexp pattern strings used to skip coverage collection 27 | // coveragePathIgnorePatterns: [ 28 | // "\\\\node_modules\\\\" 29 | // ], 30 | 31 | // Indicates which provider should be used to instrument code for coverage 32 | // coverageProvider: "babel", 33 | 34 | // A list of reporter names that Jest uses when writing coverage reports 35 | // coverageReporters: [ 36 | // "json", 37 | // "text", 38 | // "lcov", 39 | // "clover" 40 | // ], 41 | 42 | // An object that configures minimum threshold enforcement for coverage results 43 | // coverageThreshold: undefined, 44 | 45 | // A path to a custom dependency extractor 46 | // dependencyExtractor: undefined, 47 | 48 | // Make calling deprecated APIs throw helpful error messages 49 | // errorOnDeprecated: false, 50 | 51 | // Force coverage collection from ignored files using an array of glob patterns 52 | // forceCoverageMatch: [], 53 | 54 | // A path to a module which exports an async function that is triggered once before all test suites 55 | // globalSetup: undefined, 56 | 57 | // A path to a module which exports an async function that is triggered once after all test suites 58 | // globalTeardown: undefined, 59 | 60 | // A set of global variables that need to be available in all test environments 61 | // globals: {}, 62 | 63 | // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. 64 | // maxWorkers: "50%", 65 | 66 | // An array of directory names to be searched recursively up from the requiring module's location 67 | // moduleDirectories: [ 68 | // "node_modules" 69 | // ], 70 | 71 | // An array of file extensions your modules use 72 | // moduleFileExtensions: [ 73 | // "js", 74 | // "json", 75 | // "jsx", 76 | // "ts", 77 | // "tsx", 78 | // "node" 79 | // ], 80 | 81 | // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module 82 | // moduleNameMapper: {}, 83 | 84 | // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader 85 | // modulePathIgnorePatterns: [], 86 | 87 | // Activates notifications for test results 88 | // notify: false, 89 | 90 | // An enum that specifies notification mode. Requires { notify: true } 91 | // notifyMode: "failure-change", 92 | 93 | // A preset that is used as a base for Jest's configuration 94 | // preset: undefined, 95 | 96 | // Run tests from one or more projects 97 | // projects: undefined, 98 | 99 | // Use this configuration option to add custom reporters to Jest 100 | // reporters: undefined, 101 | 102 | // Automatically reset mock state between every test 103 | // resetMocks: false, 104 | 105 | // Reset the module registry before running each individual test 106 | // resetModules: false, 107 | 108 | // A path to a custom resolver 109 | // resolver: undefined, 110 | 111 | // Automatically restore mock state between every test 112 | // restoreMocks: false, 113 | 114 | // The root directory that Jest should scan for tests and modules within 115 | // rootDir: undefined, 116 | 117 | // A list of paths to directories that Jest should use to search for files in 118 | // roots: [ 119 | // "" 120 | // ], 121 | 122 | // Allows you to use a custom runner instead of Jest's default test runner 123 | // runner: "jest-runner", 124 | 125 | // The paths to modules that run some code to configure or set up the testing environment before each test 126 | // setupFiles: [], 127 | 128 | // A list of paths to modules that run some code to configure or set up the testing framework before each test 129 | // setupFilesAfterEnv: [], 130 | 131 | // The number of seconds after which a test is considered as slow and reported as such in the results. 132 | // slowTestThreshold: 5, 133 | 134 | // A list of paths to snapshot serializer modules Jest should use for snapshot testing 135 | // snapshotSerializers: [], 136 | 137 | // The test environment that will be used for testing 138 | testEnvironment: "node", 139 | 140 | // Options that will be passed to the testEnvironment 141 | // testEnvironmentOptions: {}, 142 | 143 | // Adds a location field to test results 144 | // testLocationInResults: false, 145 | 146 | // The glob patterns Jest uses to detect test files 147 | // testMatch: [ 148 | // "**/__tests__/**/*.[jt]s?(x)", 149 | // "**/?(*.)+(spec|test).[tj]s?(x)" 150 | // ], 151 | 152 | // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped 153 | testPathIgnorePatterns: [ 154 | "\\\\node_modules\\\\" 155 | ], 156 | 157 | // The regexp pattern or array of patterns that Jest uses to detect test files 158 | // testRegex: [], 159 | 160 | // This option allows the use of a custom results processor 161 | // testResultsProcessor: undefined, 162 | 163 | // This option allows use of a custom test runner 164 | // testRunner: "jasmine2", 165 | 166 | // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href 167 | // testURL: "http://localhost", 168 | 169 | // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout" 170 | // timers: "real", 171 | 172 | // A map from regular expressions to paths to transformers 173 | // transform: undefined, 174 | 175 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation 176 | // transformIgnorePatterns: [ 177 | // "\\\\node_modules\\\\", 178 | // "\\.pnp\\.[^\\\\]+$" 179 | // ], 180 | 181 | // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them 182 | // unmockedModulePathPatterns: undefined, 183 | 184 | // Indicates whether each individual test should be reported during the run 185 | // verbose: undefined, 186 | 187 | // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode 188 | watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'], 189 | 190 | // Whether to use watchman for file crawling 191 | // watchman: true, 192 | }; 193 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "axios-adapter-uniapp", 3 | "version": "0.1.4", 4 | "description": "axios adapter for uni-app.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "jest", 8 | "prepublishOnly": "np --no-cleanup --yolo --no-publish --any-branch" 9 | }, 10 | "keywords": [ 11 | "axios", 12 | "uni-app", 13 | "adapter" 14 | ], 15 | "files": [ 16 | "helper", 17 | "index.js", 18 | "index.d.ts" 19 | ], 20 | "repository": { 21 | "type": "git", 22 | "url": "https://github.com/lcysgsg/axios-adapter-uniapp.git" 23 | }, 24 | "author": "lcysgsg", 25 | "license": "ISC", 26 | "dependencies": { 27 | "axios": "^0.27.2" 28 | }, 29 | "devDependencies": { 30 | "eslint": "^7.11.0", 31 | "jest": "^26.5.3", 32 | "np": "^7.6.2" 33 | } 34 | } 35 | --------------------------------------------------------------------------------