axios 1.1.2 → 1.2.0-alpha.1

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.

package/package.json CHANGED
@@ -1,27 +1,33 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.1.2",
3
+ "version": "1.2.0-alpha.1",
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": "./index.js",
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:exports && npm run test:dtslint",
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",
27
33
  "start": "node ./sandbox/server.js",
@@ -52,6 +58,7 @@
52
58
  },
53
59
  "homepage": "https://axios-http.com",
54
60
  "devDependencies": {
61
+ "@babel/core": "^7.18.2",
55
62
  "@babel/preset-env": "^7.18.2",
56
63
  "@rollup/plugin-babel": "^5.3.1",
57
64
  "@rollup/plugin-commonjs": "^15.1.0",
@@ -93,7 +100,7 @@
93
100
  "sinon": "^4.5.0",
94
101
  "stream-throttle": "^0.1.3",
95
102
  "terser-webpack-plugin": "^4.2.3",
96
- "typescript": "^4.6.3",
103
+ "typescript": "^4.8.4",
97
104
  "url-search-params": "^0.10.0"
98
105
  },
99
106
  "browser": {
@@ -129,5 +136,6 @@
129
136
  "Yasu Flores (https://github.com/yasuf)",
130
137
  "Ben Carp (https://github.com/carpben)",
131
138
  "Daniel Lopretto (https://github.com/timemachine3030)"
132
- ]
139
+ ],
140
+ "sideEffects": false
133
141
  }
package/rollup.config.js CHANGED
@@ -5,20 +5,28 @@ import json from '@rollup/plugin-json';
5
5
  import { babel } from '@rollup/plugin-babel';
6
6
  import autoExternal from 'rollup-plugin-auto-external';
7
7
  import bundleSize from 'rollup-plugin-bundle-size'
8
+ import path from 'path';
8
9
 
9
10
  const lib = require("./package.json");
10
11
  const outputFileName = 'axios';
11
12
  const name = "axios";
12
- const input = './lib/axios.js';
13
+ const namedInput = './index.js';
14
+ const defaultInput = './lib/axios.js';
13
15
 
14
16
  const buildConfig = ({es5, browser = true, minifiedVersion = true, ...config}) => {
17
+ const {file} = config.output;
18
+ const ext = path.extname(file);
19
+ const basename = path.basename(file, ext);
20
+ const extArr = ext.split('.');
21
+ extArr.shift();
22
+
15
23
 
16
24
  const build = ({minified}) => ({
17
- input,
25
+ input: namedInput,
18
26
  ...config,
19
27
  output: {
20
28
  ...config.output,
21
- file: `${config.output.file}.${minified ? "min.js" : "js"}`
29
+ file: `${path.dirname(file)}/${basename}.${(minified ? ['min', ...extArr] : extArr).join('.')}`
22
30
  },
23
31
  plugins: [
24
32
  json(),
@@ -50,10 +58,24 @@ export default async () => {
50
58
  const banner = `// Axios v${lib.version} Copyright (c) ${year} ${lib.author} and contributors`;
51
59
 
52
60
  return [
61
+ // browser ESM bundle for CDN
53
62
  ...buildConfig({
63
+ input: namedInput,
64
+ output: {
65
+ file: `dist/esm/${outputFileName}.js`,
66
+ format: "esm",
67
+ preferConst: true,
68
+ exports: "named",
69
+ banner
70
+ }
71
+ }),
72
+
73
+ // Browser UMD bundle for CDN
74
+ ...buildConfig({
75
+ input: defaultInput,
54
76
  es5: true,
55
77
  output: {
56
- file: `dist/${outputFileName}`,
78
+ file: `dist/${outputFileName}.js`,
57
79
  name,
58
80
  format: "umd",
59
81
  exports: "default",
@@ -61,18 +83,23 @@ export default async () => {
61
83
  }
62
84
  }),
63
85
 
86
+ // Browser CJS bundle
64
87
  ...buildConfig({
88
+ input: defaultInput,
89
+ es5: false,
90
+ minifiedVersion: false,
65
91
  output: {
66
- file: `dist/esm/${outputFileName}`,
67
- format: "esm",
68
- preferConst: true,
69
- exports: "named",
92
+ file: `dist/browser/${name}.cjs`,
93
+ name,
94
+ format: "cjs",
95
+ exports: "default",
70
96
  banner
71
97
  }
72
98
  }),
73
- // Node.js commonjs build
99
+
100
+ // Node.js commonjs bundle
74
101
  {
75
- input,
102
+ input: defaultInput,
76
103
  output: {
77
104
  file: `dist/node/${name}.cjs`,
78
105
  format: "cjs",
package/tsconfig.json CHANGED
@@ -1,14 +1,9 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "es2015",
3
+ "module": "node16",
4
4
  "lib": ["dom", "es2015"],
5
5
  "types": [],
6
- "moduleResolution": "node",
7
6
  "strict": true,
8
- "noEmit": true,
9
- "baseUrl": ".",
10
- "paths": {
11
- "axios": ["."]
12
- }
7
+ "noEmit": true
13
8
  }
14
9
  }
package/tslint.json CHANGED
@@ -1,6 +1,11 @@
1
- {
1
+ {
2
2
  "extends": "dtslint/dtslint.json",
3
3
  "rules": {
4
4
  "no-unnecessary-generics": false
5
+ },
6
+ "linterOptions": {
7
+ "exclude": [
8
+ "test/module/**"
9
+ ]
5
10
  }
6
11
  }