Skip to content

Commit

Permalink
Upgrades to dependencies and to node versions for testing. (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
qubyte committed Oct 28, 2020
1 parent 27cb0f4 commit 87c953c
Show file tree
Hide file tree
Showing 9 changed files with 1,557 additions and 3,575 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
"globals": {
"Promise": true,
"XMLHttpRequest": true
"XMLHttpRequest": true,
"globalThis": true
}
}
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ name: CI
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
jobs:
test-node:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [8, 10, 12]
node_version: [10, 12, 14]
steps:
- name: checkout
uses: actions/checkout@master
uses: actions/checkout@main
- name: use node ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
Expand All @@ -28,21 +28,21 @@ jobs:
bundler: [browserify, webpack, "webpack:node"]
steps:
- name: checkout
uses: actions/checkout@master
- name: use node 10
uses: actions/checkout@main
- name: use node 14
uses: actions/setup-node@v1
with:
node-version: 10.x
node-version: 14.x
- run: npm ci
- run: npm run test:${{ matrix.bundler }}
lint:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: use node 10
- name: use node 14
uses: actions/setup-node@v1
with:
node-version: 10.x
node-version: 14.x
- run: npm ci
- run: npm run lint
7 changes: 7 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# History

## 7.0.0

- Drops support for node 8. Adds node 14 to tests.
- Updates whatwg-fetch to ~3.4.1.
- Exposes `DOMException` from whatwg-fetch.
- Tests against webpack 5 and browserify 17.

## 6.1.0

- Adds a types field to package.json for TypeScript integration.
Expand Down
22 changes: 11 additions & 11 deletions fetch-browser.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
(function (self) {
(function (global) {
'use strict';

function fetchPonyfill(options) {
var Promise = options && options.Promise || self.Promise;
var XMLHttpRequest = options && options.XMLHttpRequest || self.XMLHttpRequest;
var global = self;
var Promise = options && options.Promise || global.Promise;
var XMLHttpRequest = options && options.XMLHttpRequest || global.XMLHttpRequest;

return (function () {
var self = Object.create(global, {
var globalThis = Object.create(global, {
fetch: {
value: undefined,
writable: true
Expand All @@ -17,10 +16,11 @@
// {{whatwgFetch}}

return {
fetch: self.fetch,
Headers: self.Headers,
Request: self.Request,
Response: self.Response
fetch: globalThis.fetch,
Headers: globalThis.Headers,
Request: globalThis.Request,
Response: globalThis.Response,
DOMException: globalThis.DOMException
};
}());
}
Expand All @@ -32,6 +32,6 @@
} else if (typeof exports === 'object') {
module.exports = fetchPonyfill;
} else {
self.fetchPonyfill = fetchPonyfill;
global.fetchPonyfill = fetchPonyfill;
}
}(typeof self !== 'undefined' ? self : typeof global !== 'undefined' ? global : this));
}(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof global !== 'undefined' ? global : this));
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ declare namespace fetchPonyfill {
Headers: typeof Headers;
Request: typeof Request;
Response: typeof Response;
DOMException: typeof DOMException;
}
}
Loading

0 comments on commit 87c953c

Please sign in to comment.