Skip to content

Commit

Permalink
fix: fixed linting, file size, and README updates for browser compat
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Jan 7, 2022
1 parent 42b2c67 commit 152fcbe
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .dist.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
}
}]
],
"sourceMaps": "inline"
"sourceMaps": "inline",
"comments": false
}
16 changes: 14 additions & 2 deletions .dist.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
"no-cond-assign": "off",
"no-redeclare": "off",
"node/no-exports-assign": "off",
"no-unsafe-finally": "off"
"no-unsafe-finally": "off",
"complexity": ["error", 10000],
"max-statements": "off",
"no-constant-condition": "off",
"no-control-regex": "off",
"no-fallthrough": "off",
"operator-linebreak": "off"
},
"globals": {
"regeneratorRuntime": "writable"
Expand All @@ -32,7 +38,13 @@
"Object.getOwnPropertySymbols",
"Object.setPrototypeOf",
"Set",
"Math.trunc"
"Math.trunc",
"BigInt",
"Map",
"Reflect",
"WeakMap",
"WeakRef",
"WeakSet"
]
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"></script>
<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://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 @@ -159,11 +159,11 @@ If you are using [browserify][], [webpack][], [rollup][], or another bundler, th
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"></script>
<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>
```

* 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`, and `Math.trunc`
* IE 9 requires a polyfill for `window.FormData` (we recommend [formdata-polyfill][]), `Set`, `Math.trunc`, `BigInt`, `Map`, `Reflect`, `WeakMap`, `WeakRef`, and `WeakSet`


## Plugins
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"browser": {
"./src/node/index.js": "./src/client.js",
"./lib/node/index.js": "./lib/client.js",
"./test/support/server.js": "./test/support/blank.js"
"./test/support/server.js": "./test/support/blank.js",
"semver": false
},
"bugs": {
"url": "https://github.com/visionmedia/superagent/issues"
Expand All @@ -16,9 +17,6 @@
"@commitlint/config-conventional"
]
},
"engines": {
"node": ">=6.4.0 <13|>=14"
},
"contributors": [
"Kornel Lesiński <kornel@geekhood.net>",
"Peter Lyons <pete@peterlyons.com>",
Expand Down Expand Up @@ -76,6 +74,9 @@
"xo": "^0.47.0",
"zuul": "^3.12.0"
},
"engines": {
"node": ">=6.4.0 <13|>=14"
},
"homepage": "https://github.com/visionmedia/superagent",
"husky": {
"hooks": {
Expand Down
4 changes: 2 additions & 2 deletions src/node/http2wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const tls = require('tls');
// eslint-disable-next-line node/no-deprecated-api
const { parse } = require('url');
const process = require('process');
const semver = require('semver');
const semverGte = require('semver/functions/gte');

let http2;

if (semver.gte(process.version, 'v10.10.0')) http2 = require('http2');
if (semverGte(process.version, 'v10.10.0')) http2 = require('http2');
else
throw new Error('superagent: this version of Node.js does not support http2');

Expand Down
4 changes: 2 additions & 2 deletions src/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const FormData = require('form-data');
const formidable = require('formidable');
const debug = require('debug')('superagent');
const CookieJar = require('cookiejar');
const semver = require('semver');
const semverGte = require('semver/functions/gte');
const safeStringify = require('fast-safe-stringify');

const utils = require('../utils');
Expand All @@ -27,7 +27,7 @@ const Response = require('./response');

let http2;

if (semver.gte(process.version, 'v10.10.0')) http2 = require('./http2wrapper');
if (semverGte(process.version, 'v10.10.0')) http2 = require('./http2wrapper');

function request(method, url) {
// callback
Expand Down

0 comments on commit 152fcbe

Please sign in to comment.