Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Commit

Permalink
feat: Expand node-fetch polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
obany committed Jan 21, 2022
1 parent 18ddf1a commit 046f0dc
Show file tree
Hide file tree
Showing 21 changed files with 101 additions and 57 deletions.
58 changes: 29 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/workspaces",
"description": "IOTA JavaScript Library",
"version": "1.8.5",
"version": "1.8.6",
"keywords": [
"iota"
],
Expand Down
4 changes: 4 additions & 0 deletions packages/crypto/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.6

* Version alignment

## v1.8.5

* New ESM Packaging
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/crypto.js",
"description": "IOTA JavaScript Cryptography Library",
"version": "1.8.5",
"version": "1.8.6",
"keywords": [
"iota",
"client"
Expand All @@ -17,7 +17,7 @@
"license": "Apache-2.0",
"dependencies": {
"big-integer": "^1.6.51",
"@iota/util.js": "^1.8.5"
"@iota/util.js": "^1.8.6"
},
"scripts": {
"build-clean": "rimraf ./es/* ./typings/*",
Expand Down
4 changes: 4 additions & 0 deletions packages/iota/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.6

* Expand node-fetch polyfill

## v1.8.5

* New ESM Packaging
Expand Down
8 changes: 6 additions & 2 deletions packages/iota/dist/cjs/index-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
// SPDX-License-Identifier: Apache-2.0
// Fetch
if (globalThis && !globalThis.fetch) {
// eslint-disable-next-line @typescript-eslint/no-require-imports
globalThis.fetch = require$$0__default["default"];
// eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires
const fetch = require$$0__default["default"];
globalThis.Headers = fetch.Headers;
globalThis.Request = fetch.Request;
globalThis.Response = fetch.Response;
globalThis.fetch = fetch;
}

// Copyright 2020 IOTA Stiftung
Expand Down
2 changes: 1 addition & 1 deletion packages/iota/dist/cjs/index-node.min.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions packages/iota/dist/esm/polyfill-node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
// SPDX-License-Identifier: Apache-2.0
// Fetch
if (globalThis && !globalThis.fetch) {
// eslint-disable-next-line @typescript-eslint/no-require-imports
globalThis.fetch = (await import("node-fetch")).default;
// eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires
const fetch = (await import("node-fetch")).default;
globalThis.Headers = fetch.Headers;
globalThis.Request = fetch.Request;
globalThis.Response = fetch.Response;
globalThis.fetch = fetch;
}
10 changes: 7 additions & 3 deletions packages/iota/es/polyfill-node.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/iota/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/iota.js",
"description": "IOTA JavaScript Library",
"version": "1.8.5",
"version": "1.8.6",
"keywords": [
"iota",
"client"
Expand All @@ -18,8 +18,8 @@
"dependencies": {
"big-integer": "^1.6.51",
"node-fetch": "2.6.7",
"@iota/util.js": "^1.8.5",
"@iota/crypto.js": "^1.8.5"
"@iota/util.js": "^1.8.6",
"@iota/crypto.js": "^1.8.6"
},
"scripts": {
"build-clean": "rimraf ./es/* ./typings/*",
Expand Down
8 changes: 6 additions & 2 deletions packages/iota/src/polyfill-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

// Fetch
if (globalThis && !globalThis.fetch) {
// eslint-disable-next-line @typescript-eslint/no-require-imports
globalThis.fetch = require("node-fetch");
// eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires
const fetch = require("node-fetch");
globalThis.Headers = fetch.Headers;
globalThis.Request = fetch.Request;
globalThis.Response = fetch.Response;
globalThis.fetch = fetch;
}
4 changes: 4 additions & 0 deletions packages/mqtt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.6

* Version alignment

## v1.8.5

* New ESM Packaging
Expand Down
6 changes: 3 additions & 3 deletions packages/mqtt/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/mqtt.js",
"description": "IOTA JavaScript Library for Adding MQTT support",
"version": "1.8.5",
"version": "1.8.6",
"keywords": [
"iota",
"mqtt"
Expand Down Expand Up @@ -84,8 +84,8 @@
"typings"
],
"dependencies": {
"@iota/util.js": "^1.8.5",
"@iota/iota.js": "^1.8.5",
"@iota/util.js": "^1.8.6",
"@iota/iota.js": "^1.8.6",
"mqtt": "^4.3.4"
}
}
4 changes: 4 additions & 0 deletions packages/pow-neon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.6

* Version alignment

## v1.8.5

* New ESM Packaging
Expand Down
4 changes: 2 additions & 2 deletions packages/pow-neon/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/pow-neon.js",
"description": "IOTA JavaScript Library for Performing Multi-Threaded PoW on NodeJS",
"version": "1.8.5",
"version": "1.8.6",
"keywords": [
"iota",
"pow"
Expand Down Expand Up @@ -79,7 +79,7 @@
"copy-dist.js"
],
"dependencies": {
"@iota/iota.js": "^1.8.5",
"@iota/iota.js": "^1.8.6",
"neon-cli": "^0.9.1"
}
}
4 changes: 4 additions & 0 deletions packages/pow-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.6

* Version alignment

## v1.8.5

* New ESM Packaging
Expand Down
6 changes: 3 additions & 3 deletions packages/pow-node/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@iota/pow-node.js",
"description": "IOTA JavaScript Library for Performing Multi-Threaded PoW on NodeJS",
"version": "1.8.5",
"version": "1.8.6",
"keywords": [
"iota",
"pow"
Expand Down Expand Up @@ -66,7 +66,7 @@
"typings"
],
"dependencies": {
"@iota/crypto.js": "^1.8.5",
"@iota/iota.js": "^1.8.5"
"@iota/crypto.js": "^1.8.6",
"@iota/iota.js": "^1.8.6"
}
}
4 changes: 4 additions & 0 deletions packages/pow-wasm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.8.6

* Version alignment

## v1.8.5

* New ESM Packaging
Expand Down
Loading

0 comments on commit 046f0dc

Please sign in to comment.