axios 1.1.3 → 1.3.4

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.

Potentially problematic release.


This version of axios might be problematic. Click here for more details.

Files changed (48) hide show
  1. package/CHANGELOG.md +312 -75
  2. package/{UPGRADE_GUIDE.md → MIGRATION_GUIDE.md} +1 -1
  3. package/README.md +64 -25
  4. package/dist/axios.js +888 -582
  5. package/dist/axios.js.map +1 -1
  6. package/dist/axios.min.js +1 -1
  7. package/dist/axios.min.js.map +1 -1
  8. package/dist/browser/axios.cjs +3191 -0
  9. package/dist/browser/axios.cjs.map +1 -0
  10. package/dist/esm/axios.js +889 -626
  11. package/dist/esm/axios.js.map +1 -1
  12. package/dist/esm/axios.min.js +1 -1
  13. package/dist/esm/axios.min.js.map +1 -1
  14. package/dist/node/axios.cjs +1001 -575
  15. package/dist/node/axios.cjs.map +1 -1
  16. package/index.d.cts +528 -0
  17. package/index.d.ts +116 -56
  18. package/index.js +12 -3
  19. package/lib/adapters/adapters.js +59 -0
  20. package/lib/adapters/http.js +118 -57
  21. package/lib/adapters/xhr.js +7 -4
  22. package/lib/axios.js +13 -3
  23. package/lib/core/Axios.js +10 -8
  24. package/lib/core/AxiosError.js +1 -1
  25. package/lib/core/AxiosHeaders.js +102 -80
  26. package/lib/core/dispatchRequest.js +7 -2
  27. package/lib/core/mergeConfig.js +50 -46
  28. package/lib/defaults/index.js +2 -21
  29. package/lib/env/classes/FormData.js +2 -2
  30. package/lib/env/data.js +1 -1
  31. package/lib/helpers/HttpStatusCode.js +71 -0
  32. package/lib/helpers/ZlibHeaderTransformStream.js +28 -0
  33. package/lib/helpers/formDataToStream.js +111 -0
  34. package/lib/helpers/readBlob.js +15 -0
  35. package/lib/helpers/speedometer.js +1 -1
  36. package/lib/helpers/toFormData.js +5 -15
  37. package/lib/platform/browser/classes/Blob.js +3 -0
  38. package/lib/platform/browser/classes/FormData.js +1 -1
  39. package/lib/platform/browser/index.js +21 -0
  40. package/lib/utils.js +107 -9
  41. package/package.json +86 -14
  42. package/bin/ssl_hotfix.js +0 -22
  43. package/gulpfile.js +0 -88
  44. package/karma.conf.cjs +0 -250
  45. package/lib/adapters/index.js +0 -33
  46. package/rollup.config.js +0 -90
  47. package/tsconfig.json +0 -14
  48. package/tslint.json +0 -6
@@ -0,0 +1,111 @@
1
+ import {TextEncoder} from 'util';
2
+ import {Readable} from 'stream';
3
+ import utils from "../utils.js";
4
+ import readBlob from "./readBlob.js";
5
+
6
+ const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
7
+
8
+ const textEncoder = new TextEncoder();
9
+
10
+ const CRLF = '\r\n';
11
+ const CRLF_BYTES = textEncoder.encode(CRLF);
12
+ const CRLF_BYTES_COUNT = 2;
13
+
14
+ class FormDataPart {
15
+ constructor(name, value) {
16
+ const {escapeName} = this.constructor;
17
+ const isStringValue = utils.isString(value);
18
+
19
+ let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
20
+ !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
21
+ }${CRLF}`;
22
+
23
+ if (isStringValue) {
24
+ value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
25
+ } else {
26
+ headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`
27
+ }
28
+
29
+ this.headers = textEncoder.encode(headers + CRLF);
30
+
31
+ this.contentLength = isStringValue ? value.byteLength : value.size;
32
+
33
+ this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
34
+
35
+ this.name = name;
36
+ this.value = value;
37
+ }
38
+
39
+ async *encode(){
40
+ yield this.headers;
41
+
42
+ const {value} = this;
43
+
44
+ if(utils.isTypedArray(value)) {
45
+ yield value;
46
+ } else {
47
+ yield* readBlob(value);
48
+ }
49
+
50
+ yield CRLF_BYTES;
51
+ }
52
+
53
+ static escapeName(name) {
54
+ return String(name).replace(/[\r\n"]/g, (match) => ({
55
+ '\r' : '%0D',
56
+ '\n' : '%0A',
57
+ '"' : '%22',
58
+ }[match]));
59
+ }
60
+ }
61
+
62
+ const formDataToStream = (form, headersHandler, options) => {
63
+ const {
64
+ tag = 'form-data-boundary',
65
+ size = 25,
66
+ boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
67
+ } = options || {};
68
+
69
+ if(!utils.isFormData(form)) {
70
+ throw TypeError('FormData instance required');
71
+ }
72
+
73
+ if (boundary.length < 1 || boundary.length > 70) {
74
+ throw Error('boundary must be 10-70 characters long')
75
+ }
76
+
77
+ const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
78
+ const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);
79
+ let contentLength = footerBytes.byteLength;
80
+
81
+ const parts = Array.from(form.entries()).map(([name, value]) => {
82
+ const part = new FormDataPart(name, value);
83
+ contentLength += part.size;
84
+ return part;
85
+ });
86
+
87
+ contentLength += boundaryBytes.byteLength * parts.length;
88
+
89
+ contentLength = utils.toFiniteNumber(contentLength);
90
+
91
+ const computedHeaders = {
92
+ 'Content-Type': `multipart/form-data; boundary=${boundary}`
93
+ }
94
+
95
+ if (Number.isFinite(contentLength)) {
96
+ computedHeaders['Content-Length'] = contentLength;
97
+ }
98
+
99
+ headersHandler && headersHandler(computedHeaders);
100
+
101
+ return Readable.from((async function *() {
102
+ for(const part of parts) {
103
+ yield boundaryBytes;
104
+ yield* part.encode();
105
+ }
106
+
107
+ yield footerBytes;
108
+ })());
109
+ };
110
+
111
+ export default formDataToStream;
@@ -0,0 +1,15 @@
1
+ const {asyncIterator} = Symbol;
2
+
3
+ const readBlob = async function* (blob) {
4
+ if (blob.stream) {
5
+ yield* blob.stream()
6
+ } else if (blob.arrayBuffer) {
7
+ yield await blob.arrayBuffer()
8
+ } else if (blob[asyncIterator]) {
9
+ yield* blob[asyncIterator]();
10
+ } else {
11
+ yield blob;
12
+ }
13
+ }
14
+
15
+ export default readBlob;
@@ -48,7 +48,7 @@ function speedometer(samplesCount, min) {
48
48
 
49
49
  const passed = startedAt && now - startedAt;
50
50
 
51
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
51
+ return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
52
52
  };
53
53
  }
54
54
 
@@ -2,7 +2,8 @@
2
2
 
3
3
  import utils from '../utils.js';
4
4
  import AxiosError from '../core/AxiosError.js';
5
- import envFormData from '../env/classes/FormData.js';
5
+ // temporary hotfix to avoid circular references until AxiosURLSearchParams is refactored
6
+ import PlatformFormData from '../platform/node/classes/FormData.js';
6
7
 
7
8
  /**
8
9
  * Determines if the given thing is a array or js object.
@@ -59,17 +60,6 @@ const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
59
60
  return /^is[A-Z]/.test(prop);
60
61
  });
61
62
 
62
- /**
63
- * If the thing is a FormData object, return true, otherwise return false.
64
- *
65
- * @param {unknown} thing - The thing to check.
66
- *
67
- * @returns {boolean}
68
- */
69
- function isSpecCompliant(thing) {
70
- return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
71
- }
72
-
73
63
  /**
74
64
  * Convert a data object to FormData
75
65
  *
@@ -99,7 +89,7 @@ function toFormData(obj, formData, options) {
99
89
  }
100
90
 
101
91
  // eslint-disable-next-line no-param-reassign
102
- formData = formData || new (envFormData || FormData)();
92
+ formData = formData || new (PlatformFormData || FormData)();
103
93
 
104
94
  // eslint-disable-next-line no-param-reassign
105
95
  options = utils.toFlatObject(options, {
@@ -117,7 +107,7 @@ function toFormData(obj, formData, options) {
117
107
  const dots = options.dots;
118
108
  const indexes = options.indexes;
119
109
  const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
120
- const useBlob = _Blob && isSpecCompliant(formData);
110
+ const useBlob = _Blob && utils.isSpecCompliantForm(formData);
121
111
 
122
112
  if (!utils.isFunction(visitor)) {
123
113
  throw new TypeError('visitor must be a function');
@@ -162,7 +152,7 @@ function toFormData(obj, formData, options) {
162
152
  value = JSON.stringify(value);
163
153
  } else if (
164
154
  (utils.isArray(value) && isFlatArray(value)) ||
165
- (utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
155
+ ((utils.isFileList(value) || utils.endsWith(key, '[]')) && (arr = utils.toArray(value))
166
156
  )) {
167
157
  // eslint-disable-next-line no-param-reassign
168
158
  key = removeBrackets(key);
@@ -0,0 +1,3 @@
1
+ 'use strict'
2
+
3
+ export default typeof Blob !== 'undefined' ? Blob : null
@@ -1,3 +1,3 @@
1
1
  'use strict';
2
2
 
3
- export default FormData;
3
+ export default typeof FormData !== 'undefined' ? FormData : null;
@@ -1,5 +1,6 @@
1
1
  import URLSearchParams from './classes/URLSearchParams.js'
2
2
  import FormData from './classes/FormData.js'
3
+ import Blob from './classes/Blob.js'
3
4
 
4
5
  /**
5
6
  * Determine if we're running in a standard browser environment
@@ -31,6 +32,25 @@ const isStandardBrowserEnv = (() => {
31
32
  return typeof window !== 'undefined' && typeof document !== 'undefined';
32
33
  })();
33
34
 
35
+ /**
36
+ * Determine if we're running in a standard browser webWorker environment
37
+ *
38
+ * Although the `isStandardBrowserEnv` method indicates that
39
+ * `allows axios to run in a web worker`, the WebWorker will still be
40
+ * filtered out due to its judgment standard
41
+ * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
42
+ * This leads to a problem when axios post `FormData` in webWorker
43
+ */
44
+ const isStandardBrowserWebWorkerEnv = (() => {
45
+ return (
46
+ typeof WorkerGlobalScope !== 'undefined' &&
47
+ // eslint-disable-next-line no-undef
48
+ self instanceof WorkerGlobalScope &&
49
+ typeof self.importScripts === 'function'
50
+ );
51
+ })();
52
+
53
+
34
54
  export default {
35
55
  isBrowser: true,
36
56
  classes: {
@@ -39,5 +59,6 @@ export default {
39
59
  Blob
40
60
  },
41
61
  isStandardBrowserEnv,
62
+ isStandardBrowserWebWorkerEnv,
42
63
  protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
43
64
  };
package/lib/utils.js CHANGED
@@ -228,7 +228,7 @@ const trim = (str) => str.trim ?
228
228
  * @param {Function} fn The callback to invoke for each item
229
229
  *
230
230
  * @param {Boolean} [allOwnKeys = false]
231
- * @returns {void}
231
+ * @returns {any}
232
232
  */
233
233
  function forEach(obj, fn, {allOwnKeys = false} = {}) {
234
234
  // Don't bother if no value provided
@@ -263,6 +263,28 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
263
263
  }
264
264
  }
265
265
 
266
+ function findKey(obj, key) {
267
+ key = key.toLowerCase();
268
+ const keys = Object.keys(obj);
269
+ let i = keys.length;
270
+ let _key;
271
+ while (i-- > 0) {
272
+ _key = keys[i];
273
+ if (key === _key.toLowerCase()) {
274
+ return _key;
275
+ }
276
+ }
277
+ return null;
278
+ }
279
+
280
+ const _global = (() => {
281
+ /*eslint no-undef:0*/
282
+ if (typeof globalThis !== "undefined") return globalThis;
283
+ return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
284
+ })();
285
+
286
+ const isContextDefined = (context) => !isUndefined(context) && context !== _global;
287
+
266
288
  /**
267
289
  * Accepts varargs expecting each argument to be an object, then
268
290
  * immutably merges the properties of each object and returns result.
@@ -282,16 +304,18 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
282
304
  * @returns {Object} Result of all merge properties
283
305
  */
284
306
  function merge(/* obj1, obj2, obj3, ... */) {
307
+ const {caseless} = isContextDefined(this) && this || {};
285
308
  const result = {};
286
309
  const assignValue = (val, key) => {
287
- if (isPlainObject(result[key]) && isPlainObject(val)) {
288
- result[key] = merge(result[key], val);
310
+ const targetKey = caseless && findKey(result, key) || key;
311
+ if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
312
+ result[targetKey] = merge(result[targetKey], val);
289
313
  } else if (isPlainObject(val)) {
290
- result[key] = merge({}, val);
314
+ result[targetKey] = merge({}, val);
291
315
  } else if (isArray(val)) {
292
- result[key] = val.slice();
316
+ result[targetKey] = val.slice();
293
317
  } else {
294
- result[key] = val;
318
+ result[targetKey] = val;
295
319
  }
296
320
  }
297
321
 
@@ -488,7 +512,7 @@ const matchAll = (regExp, str) => {
488
512
  const isHTMLForm = kindOfTest('HTMLFormElement');
489
513
 
490
514
  const toCamelCase = str => {
491
- return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,
515
+ return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
492
516
  function replacer(m, p1, p2) {
493
517
  return p1.toUpperCase() + p2;
494
518
  }
@@ -527,6 +551,11 @@ const reduceDescriptors = (obj, reducer) => {
527
551
 
528
552
  const freezeMethods = (obj) => {
529
553
  reduceDescriptors(obj, (descriptor, name) => {
554
+ // skip restricted props in strict mode
555
+ if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
556
+ return false;
557
+ }
558
+
530
559
  const value = obj[name];
531
560
 
532
561
  if (!isFunction(value)) return;
@@ -540,7 +569,7 @@ const freezeMethods = (obj) => {
540
569
 
541
570
  if (!descriptor.set) {
542
571
  descriptor.set = () => {
543
- throw Error('Can not read-only method \'' + name + '\'');
572
+ throw Error('Can not rewrite read-only method \'' + name + '\'');
544
573
  };
545
574
  }
546
575
  });
@@ -567,6 +596,68 @@ const toFiniteNumber = (value, defaultValue) => {
567
596
  return Number.isFinite(value) ? value : defaultValue;
568
597
  }
569
598
 
599
+ const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
600
+
601
+ const DIGIT = '0123456789';
602
+
603
+ const ALPHABET = {
604
+ DIGIT,
605
+ ALPHA,
606
+ ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
607
+ }
608
+
609
+ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
610
+ let str = '';
611
+ const {length} = alphabet;
612
+ while (size--) {
613
+ str += alphabet[Math.random() * length|0]
614
+ }
615
+
616
+ return str;
617
+ }
618
+
619
+ /**
620
+ * If the thing is a FormData object, return true, otherwise return false.
621
+ *
622
+ * @param {unknown} thing - The thing to check.
623
+ *
624
+ * @returns {boolean}
625
+ */
626
+ function isSpecCompliantForm(thing) {
627
+ return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
628
+ }
629
+
630
+ const toJSONObject = (obj) => {
631
+ const stack = new Array(10);
632
+
633
+ const visit = (source, i) => {
634
+
635
+ if (isObject(source)) {
636
+ if (stack.indexOf(source) >= 0) {
637
+ return;
638
+ }
639
+
640
+ if(!('toJSON' in source)) {
641
+ stack[i] = source;
642
+ const target = isArray(source) ? [] : {};
643
+
644
+ forEach(source, (value, key) => {
645
+ const reducedValue = visit(value, i + 1);
646
+ !isUndefined(reducedValue) && (target[key] = reducedValue);
647
+ });
648
+
649
+ stack[i] = undefined;
650
+
651
+ return target;
652
+ }
653
+ }
654
+
655
+ return source;
656
+ }
657
+
658
+ return visit(obj, 0);
659
+ }
660
+
570
661
  export default {
571
662
  isArray,
572
663
  isArrayBuffer,
@@ -609,5 +700,12 @@ export default {
609
700
  toObjectSet,
610
701
  toCamelCase,
611
702
  noop,
612
- toFiniteNumber
703
+ toFiniteNumber,
704
+ findKey,
705
+ global: _global,
706
+ isContextDefined,
707
+ ALPHABET,
708
+ generateString,
709
+ isSpecCompliantForm,
710
+ toJSONObject
613
711
  };
package/package.json CHANGED
@@ -1,38 +1,54 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.1.3",
3
+ "version": "1.3.4",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": {
8
+ "types": {
9
+ "require": "./index.d.cts",
10
+ "default": "./index.d.ts"
11
+ },
8
12
  "browser": {
9
- "require": "./dist/node/axios.cjs",
13
+ "require": "./dist/browser/axios.cjs",
10
14
  "default": "./index.js"
11
15
  },
12
16
  "default": {
13
17
  "require": "./dist/node/axios.cjs",
14
18
  "default": "./index.js"
15
19
  }
16
- }
20
+ },
21
+ "./package.json": "./package.json"
17
22
  },
18
23
  "type": "module",
19
24
  "types": "index.d.ts",
20
25
  "scripts": {
21
- "test": "npm run test:eslint && npm run test:mocha && npm run test:karma && npm run test:dtslint",
26
+ "test": "npm run test:eslint && npm run test:mocha && npm run test:karma && npm run test:dtslint && npm run test:exports",
22
27
  "test:eslint": "node bin/ssl_hotfix.js eslint lib/**/*.js",
23
28
  "test:dtslint": "node bin/ssl_hotfix.js dtslint",
24
29
  "test:mocha": "node bin/ssl_hotfix.js mocha test/unit/**/*.js --timeout 30000 --exit",
30
+ "test:exports": "node bin/ssl_hotfix.js mocha test/module/test.js --timeout 30000 --exit",
25
31
  "test:karma": "node bin/ssl_hotfix.js cross-env LISTEN_ADDR=:: karma start karma.conf.cjs --single-run",
26
32
  "test:karma:server": "node bin/ssl_hotfix.js cross-env karma start karma.conf.cjs",
33
+ "test:build:version": "node ./bin/check-build-version.js",
27
34
  "start": "node ./sandbox/server.js",
28
- "preversion": "gulp version && npm test",
35
+ "preversion": "gulp version",
29
36
  "version": "npm run build && git add dist && git add package.json",
30
- "prepublishOnly": "npm test",
37
+ "prepublishOnly": "npm run test:build:version",
31
38
  "postpublish": "git push && git push --tags",
32
39
  "build": "gulp clear && cross-env NODE_ENV=production rollup -c -m",
33
40
  "examples": "node ./examples/server.js",
34
41
  "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
35
- "fix": "eslint --fix lib/**/*.js"
42
+ "fix": "eslint --fix lib/**/*.js",
43
+ "prepare": "husky install && npm run prepare:hooks",
44
+ "prepare:hooks": "npx husky set .husky/commit-msg \"npx commitlint --edit $1\"",
45
+ "release:dry": "release-it --dry-run --no-npm",
46
+ "release:info": "release-it --release-version",
47
+ "release:beta:no-npm": "release-it --preRelease=beta --no-npm",
48
+ "release:beta": "release-it --preRelease=beta",
49
+ "release:no-npm": "release-it --no-npm",
50
+ "release:changelog:fix": "node ./bin/injectContributorsList.js && git add CHANGELOG.md",
51
+ "release": "release-it"
36
52
  },
37
53
  "repository": {
38
54
  "type": "git",
@@ -54,13 +70,18 @@
54
70
  "devDependencies": {
55
71
  "@babel/core": "^7.18.2",
56
72
  "@babel/preset-env": "^7.18.2",
73
+ "@commitlint/cli": "^17.3.0",
74
+ "@commitlint/config-conventional": "^17.3.0",
75
+ "@release-it/conventional-changelog": "^5.1.1",
57
76
  "@rollup/plugin-babel": "^5.3.1",
58
77
  "@rollup/plugin-commonjs": "^15.1.0",
59
78
  "@rollup/plugin-json": "^4.1.0",
60
79
  "@rollup/plugin-multi-entry": "^4.0.0",
61
80
  "@rollup/plugin-node-resolve": "^9.0.0",
62
81
  "abortcontroller-polyfill": "^1.7.3",
82
+ "auto-changelog": "^2.4.0",
63
83
  "body-parser": "^1.20.0",
84
+ "chalk": "^5.2.0",
64
85
  "coveralls": "^3.1.1",
65
86
  "cross-env": "^7.0.3",
66
87
  "dev-null": "^0.1.1",
@@ -68,10 +89,14 @@
68
89
  "es6-promise": "^4.2.8",
69
90
  "eslint": "^8.17.0",
70
91
  "express": "^4.18.1",
92
+ "formdata-node": "^5.0.0",
71
93
  "formidable": "^2.0.1",
72
94
  "fs-extra": "^10.1.0",
73
95
  "get-stream": "^3.0.0",
74
96
  "gulp": "^4.0.2",
97
+ "gzip-size": "^7.0.0",
98
+ "handlebars": "^4.7.7",
99
+ "husky": "^8.0.2",
75
100
  "istanbul-instrumenter-loader": "^3.0.1",
76
101
  "jasmine-core": "^2.4.1",
77
102
  "karma": "^6.3.17",
@@ -84,22 +109,26 @@
84
109
  "karma-sauce-launcher": "^4.3.6",
85
110
  "karma-sinon": "^1.0.5",
86
111
  "karma-sourcemap-loader": "^0.3.8",
87
- "minimist": "^1.2.6",
112
+ "minimist": "^1.2.7",
88
113
  "mocha": "^10.0.0",
89
114
  "multer": "^1.4.4",
115
+ "pretty-bytes": "^6.0.0",
116
+ "release-it": "^15.5.1",
90
117
  "rollup": "^2.67.0",
91
118
  "rollup-plugin-auto-external": "^2.0.0",
92
119
  "rollup-plugin-bundle-size": "^1.0.3",
93
120
  "rollup-plugin-terser": "^7.0.2",
94
121
  "sinon": "^4.5.0",
95
122
  "stream-throttle": "^0.1.3",
123
+ "string-replace-async": "^3.0.2",
96
124
  "terser-webpack-plugin": "^4.2.3",
97
- "typescript": "^4.6.3",
125
+ "typescript": "^4.8.4",
98
126
  "url-search-params": "^0.10.0"
99
127
  },
100
128
  "browser": {
101
- "./lib/adapters/http.js": "./lib/adapters/xhr.js",
102
- "./lib/platform/node/index.js": "./lib/platform/browser/index.js"
129
+ "./lib/adapters/http.js": "./lib/helpers/null.js",
130
+ "./lib/platform/node/index.js": "./lib/platform/browser/index.js",
131
+ "./lib/platform/node/classes/FormData.js": "./lib/helpers/null.js"
103
132
  },
104
133
  "jsdelivr": "dist/axios.min.js",
105
134
  "unpkg": "dist/axios.min.js",
@@ -128,7 +157,50 @@
128
157
  "Rikki Gibson (https://github.com/RikkiGibson)",
129
158
  "Remco Haszing (https://github.com/remcohaszing)",
130
159
  "Yasu Flores (https://github.com/yasuf)",
131
- "Ben Carp (https://github.com/carpben)",
132
- "Daniel Lopretto (https://github.com/timemachine3030)"
133
- ]
160
+ "Ben Carp (https://github.com/carpben)"
161
+ ],
162
+ "sideEffects": false,
163
+ "release-it": {
164
+ "git": {
165
+ "commitMessage": "chore(release): v${version}",
166
+ "push": true,
167
+ "commit": true,
168
+ "tag": true,
169
+ "requireCommits": false,
170
+ "requireCleanWorkingDir": false
171
+ },
172
+ "github": {
173
+ "release": true,
174
+ "draft": true
175
+ },
176
+ "npm": {
177
+ "publish": false,
178
+ "ignoreVersion": false
179
+ },
180
+ "plugins": {
181
+ "@release-it/conventional-changelog": {
182
+ "preset": "angular",
183
+ "infile": "CHANGELOG.md",
184
+ "header": "# Changelog"
185
+ }
186
+ },
187
+ "hooks": {
188
+ "before:init": "npm test",
189
+ "after:bump": "gulp version --bump ${version} && npm run build && npm run test:build:version && git add ./dist && git add ./package-lock.json",
190
+ "before:release": "npm run release:changelog:fix",
191
+ "after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
192
+ }
193
+ },
194
+ "commitlint": {
195
+ "rules": {
196
+ "header-max-length": [
197
+ 2,
198
+ "always",
199
+ 130
200
+ ]
201
+ },
202
+ "extends": [
203
+ "@commitlint/config-conventional"
204
+ ]
205
+ }
134
206
  }
package/bin/ssl_hotfix.js DELETED
@@ -1,22 +0,0 @@
1
- import {spawn} from 'child_process';
2
-
3
- const args = process.argv.slice(2);
4
-
5
- console.log(`Running ${args.join(' ')} on ${process.version}\n`);
6
-
7
- const match = /v(\d+)/.exec(process.version);
8
-
9
- const isHotfixNeeded = match && match[1] > 16;
10
-
11
- isHotfixNeeded && console.warn('Setting --openssl-legacy-provider as ssl hotfix');
12
-
13
- const test = spawn('cross-env',
14
- isHotfixNeeded ? ['NODE_OPTIONS=--openssl-legacy-provider', ...args] : args, {
15
- shell: true,
16
- stdio: 'inherit'
17
- }
18
- );
19
-
20
- test.on('exit', function (code) {
21
- process.exit(code)
22
- })