Skip to content

Commit

Permalink
feat: dropped IE support (ActiveXObject), fixed XMLHttpRequest in Ele…
Browse files Browse the repository at this point in the history
…ctron (closes #1731),
  • Loading branch information
titanism committed Jun 24, 2022
1 parent 26c72d0 commit 715516d
Show file tree
Hide file tree
Showing 17 changed files with 6,502 additions and 1,851 deletions.
6 changes: 1 addition & 5 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# Browsers that we support

> 1%
last 2 versions
ie 9
defaults, not ie 11
2 changes: 1 addition & 1 deletion .dist.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"presets": [
["@babel/env", {
"targets": {
"browsers": [ "> 1%", "last 2 versions", "ie 9" ]
"browsers": [ "defaults, not ie 11" ]
}
}]
],
Expand Down
15 changes: 1 addition & 14 deletions .dist.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,8 @@
},
"settings": {
"polyfills": [
"Promise",
"Array.from",
"Symbol",
"Object.getOwnPropertySymbols",
"Object.setPrototypeOf",
"Set",
"Math.trunc",
"BigInt",
"Map",
"Reflect",
"WeakMap",
"WeakRef",
"WeakSet",
"Atomics",
"SharedArrayBuffer"
"BigInt"
]
}
}
5 changes: 1 addition & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,5 @@
"node/no-exports-assign": "off"
},
"globals": {
"ActiveXObject": "readonly"
}


}
}
4 changes: 2 additions & 2 deletions .lib.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
["@babel/env", {
"targets": {
"node": "6.4.0",
"browsers": [ "> 1%", "last 2 versions", "ie 9" ]
"browsers": [ "defaults, not ie 11" ]
}
}]
],
"sourceMaps": "inline"
}
}
1 change: 0 additions & 1 deletion .lib.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
{
"files": [ "lib/client.js" ],
"globals": {
"ActiveXObject": "readable"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion .test.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
["@babel/env", {
"targets": {
"node": "6.4.0",
"browsers": [ "> 1%", "last 2 versions", "ie 9" ]
"browsers": [ "defaults, not ie 11" ]
}
}]
],
Expand Down
6 changes: 3 additions & 3 deletions .xo-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ module.exports = {
],
},
],
'unicorn/prefer-optional-catch-binding': 'off',
'no-unused-vars': 'off'
},
globals: [
'ActiveXObject',
],
globals: [],
};
73 changes: 35 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ superagent.post('/api/pet').then(console.log).catch(console.error);

### Browser

**The browser-ready, minified version of `superagent` is only 6 KB (minified and gzipped)!**
**The browser-ready, minified version of `superagent` is only 50 KB (minified and gzipped).**

Browser-ready versions of this module are available via [jsdelivr][], [unpkg][], and also in the `node_modules/superagent/dist` folder in downloads of the `superagent` package.

Expand All @@ -83,7 +83,7 @@ Browser-ready versions of this module are available via [jsdelivr][], [unpkg][],
This is the solution for you if you're just using `<script>` tags everywhere!

```html
<script src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Promise,Symbol,Object.setPrototypeOf,Object.getOwnPropertySymbols,Set,Math.trunc,BigInt,Map,Reflect,WeakMap,WeakRef,WeakSet,BigInt,Map,Reflect,WeakMap,WeakRef,WeakSet"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=WeakRef,BigInt"></script>
<script src="https://cdn.jsdelivr.net/npm/superagent"></script>
<!-- if you wish to use unpkg.com instead: -->
<!-- <script src="https://unpkg.com/superagent"></script> -->
Expand Down Expand Up @@ -120,50 +120,49 @@ If you are using [browserify][], [webpack][], [rollup][], or another bundler, th
```

```sh
and_chr 71
and_ff 64
and_qq 1.2
and_uc 11.8
android 67
android 4.4.3-4.4.4
baidu 7.12
bb 10
bb 7
chrome 73
chrome 72
chrome 71
edge 18
edge 17
firefox 66
firefox 65
ie 11
ie 10
ie 9
ie_mob 11
ie_mob 10
ios_saf 12.0-12.1
ios_saf 11.3-11.4
and_chr 102
and_ff 101
and_qq 10.4
and_uc 12.12
android 101
chrome 103
chrome 102
chrome 101
chrome 100
edge 103
edge 102
edge 101
firefox 101
firefox 100
firefox 91
ios_saf 15.5
ios_saf 15.4
ios_saf 15.2-15.3
ios_saf 15.0-15.1
ios_saf 14.5-14.8
ios_saf 14.0-14.4
ios_saf 12.2-12.5
kaios 2.5
op_mini all
op_mob 46
op_mob 12.1
opera 58
opera 57
safari 12
safari 11.1
samsung 8.2
samsung 7.2-7.4
op_mob 64
opera 86
opera 85
safari 15.5
safari 15.4
samsung 17.0
samsung 16.0
```

### Required Browser Features

We recommend using <https://polyfill.io> (specifically with the bundle mentioned in [VanillaJS](#vanillajs) above):

```html
<script src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Promise,Symbol,Object.setPrototypeOf,Object.getOwnPropertySymbols,Set,Math.trunc,BigInt,Map,Reflect,WeakMap,WeakRef,WeakSet"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=WeakRef,BigInt"></script>
```

* IE 9-10 requires a polyfill for `Promise`, `Array.from`, `Symbol`, `Object.getOwnPropertySymbols`, and `Object.setPrototypeOf`
* IE 9 requires a polyfill for `window.FormData` (we recommend [formdata-polyfill][]), `Set`, `Math.trunc`, `BigInt`, `Map`, `Reflect`, `WeakMap`, `WeakRef`, and `WeakSet`
* WeakRef is not supported in Opera 85, iOS Safari 12.2-12.5
* BigInt is not supported in iOS Safari 12.2-12.5


## Plugins
Expand Down Expand Up @@ -261,8 +260,6 @@ Our breaking changes are mostly in rarely used functionality and from stricter e
[yarn]: https://yarnpkg.com/
[formdata-polyfill]: https://www.npmjs.com/package/formdata-polyfill
[jsdelivr]: https://www.jsdelivr.com/
[unpkg]: https://unpkg.com/
Expand Down
12 changes: 7 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -855,14 +855,16 @@ Libraries like [co](https://github.com/tj/co) or a web framework like [koa](http
const res = yield req;
```

Note that SuperAgent expects the global `Promise` object to be present. You'll need a polyfill to use promises in Internet Explorer or Node.js 0.10.
Note that SuperAgent expects the global `Promise` object to be present. You'll need to use v7 and a polyfill to use promises in Internet Explorer or Node.js 0.10.

We have dropped support in v8 for IE. You must add a polyfill for WeakRef and BigInt if you wish to support Opera 85, iOS Safari 12.2-12.5, for example using <https://polyfill.io>:

```html
<script src="https://polyfill.io/v3/polyfill.min.js?features=WeakRef,BigInt"></script>
```

## Browser and node versions

SuperAgent has two implementations: one for web browsers (using XHR) and one for Node.JS (using core http module). By default Browserify and WebPack will pick the browser version.

If want to use WebPack to compile code for Node.JS, you *must* specify [node target](https://webpack.github.io/docs/configuration.html#target) in its configuration.

### Using browser version in electron

[Electron](https://electron.atom.io/) developers report if you would prefer to use the browser version of SuperAgent instead of the Node version, you can `require('superagent/superagent')`. Your requests will now show up in the Chrome developer tools Network tab. Note this environment is not covered by automated test suite and not officially supported.
Loading

0 comments on commit 715516d

Please sign in to comment.