From 5f3012ae8f83d13db2239ebb29360ff09ebf881a Mon Sep 17 00:00:00 2001 From: Fayeed Pawaskar Date: Thu, 5 Oct 2023 16:12:26 +0530 Subject: [PATCH] removed unused patch --- patches/@achingbrain+ssdp+4.0.4.patch | 21 ---- ...0.patch => @holochain+client+0.12.5.patch} | 4 +- patches/ipfs-utils+9.0.7.patch | 114 ------------------ 3 files changed, 2 insertions(+), 137 deletions(-) delete mode 100644 patches/@achingbrain+ssdp+4.0.4.patch rename patches/{@holochain+client+0.12.0.patch => @holochain+client+0.12.5.patch} (91%) delete mode 100644 patches/ipfs-utils+9.0.7.patch diff --git a/patches/@achingbrain+ssdp+4.0.4.patch b/patches/@achingbrain+ssdp+4.0.4.patch deleted file mode 100644 index 76f8d5feb..000000000 --- a/patches/@achingbrain+ssdp+4.0.4.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/node_modules/@achingbrain/ssdp/dist/src/default-ssdp-options.js b/node_modules/@achingbrain/ssdp/dist/src/default-ssdp-options.js -index 41ac65e..8c63670 100644 ---- a/node_modules/@achingbrain/ssdp/dist/src/default-ssdp-options.js -+++ b/node_modules/@achingbrain/ssdp/dist/src/default-ssdp-options.js -@@ -1,9 +1,13 @@ - import { webcrypto as crypto } from 'crypto'; // remove when having crypto global --import { createRequire } from 'module'; -+// import { createRequire } from 'module'; - import mergeOptions from 'merge-options'; - import { defaultSocketOptions } from './default-socket-options.js'; --const req = createRequire(import.meta.url); --const { name, version } = req('../../package.json'); -+// const req = createRequire(import.meta.url); -+// const { name, version } = req('../../package.json'); -+const {name, version} = { -+ name: "@achingbrain/ssdp", -+ version: "4.0.1" -+}; - const DEFAULT_SSDP_SIGNATURE = `node.js/${process.version.substring(1)} UPnP/1.1 ${name}/${version}`; - export function defaultSsdpOptions(options) { - return mergeOptions(options ?? {}, { diff --git a/patches/@holochain+client+0.12.0.patch b/patches/@holochain+client+0.12.5.patch similarity index 91% rename from patches/@holochain+client+0.12.0.patch rename to patches/@holochain+client+0.12.5.patch index 598f6864a..fb0cfca3c 100644 --- a/patches/@holochain+client+0.12.0.patch +++ b/patches/@holochain+client+0.12.5.patch @@ -1,11 +1,11 @@ diff --git a/node_modules/@holochain/client/lib/api/zome-call-signing.js b/node_modules/@holochain/client/lib/api/zome-call-signing.js -index aaddf61..257781f 100644 +index aaddf61..fa20172 100644 --- a/node_modules/@holochain/client/lib/api/zome-call-signing.js +++ b/node_modules/@holochain/client/lib/api/zome-call-signing.js @@ -1,5 +1,7 @@ import nacl from "tweetnacl"; import { encodeHashToBase64 } from "../utils/base64.js"; -+import crypto from 'crypto'; ++import crypto from 'node:crypto'; + const signingCredentials = new Map(); /** diff --git a/patches/ipfs-utils+9.0.7.patch b/patches/ipfs-utils+9.0.7.patch deleted file mode 100644 index ed4198b46..000000000 --- a/patches/ipfs-utils+9.0.7.patch +++ /dev/null @@ -1,114 +0,0 @@ -diff --git a/node_modules/ipfs-utils/src/http/fetch.js b/node_modules/ipfs-utils/src/http/fetch.js -index 1a27129..b90b657 100644 ---- a/node_modules/ipfs-utils/src/http/fetch.js -+++ b/node_modules/ipfs-utils/src/http/fetch.js -@@ -1,22 +1,96 @@ - 'use strict' -+const { Request, Response, Headers, default: nativeFetch } = require('../fetch') -+// @ts-ignore -+const toStream = require('it-to-stream') -+const { Buffer } = require('buffer') -+/** -+ * @typedef {import('stream').Readable} NodeReadableStream -+ * -+ * @typedef {import('../types').FetchOptions} FetchOptions -+ * @typedef {import('../types').ProgressFn} ProgressFn -+ */ -+ -+/** -+ * @param {string|Request} url -+ * @param {FetchOptions} [options] -+ * @returns {Promise} -+ */ -+const fetch = (url, options = {}) => -+ // @ts-ignore -+ nativeFetch(url, withUploadProgress(options)) - - /** -- * @typedef {object} fetchImpl -- * @property {globalThis.fetch} fetchImpl.fetch -- * @property {globalThis.Request} fetchImpl.Request -- * @property {globalThis.Response} fetchImpl.Response -- * @property {globalThis.Headers} fetchImpl.Headers -+ * Takes fetch options and wraps request body to track upload progress if -+ * `onUploadProgress` is supplied. Otherwise returns options as is. -+ * -+ * @param {FetchOptions} options -+ * @returns {FetchOptions} - */ -+const withUploadProgress = (options) => { -+ const { onUploadProgress, body } = options -+ if (onUploadProgress && body) { -+ // This works around the fact that electron-fetch serializes `Uint8Array`s -+ // and `ArrayBuffer`s to strings. -+ const content = normalizeBody(body) - --let implName = './fetch.node' -+ // @ts-expect-error this is node-fetch -+ const rsp = new Response(content) -+ // @ts-expect-error this is node-fetch -+ const source = iterateBodyWithProgress(/** @type {NodeReadableStream} */(rsp.body), onUploadProgress) -+ return { -+ ...options, -+ body: toStream.readable(source) -+ } -+ } else { -+ return options -+ } -+} - --if (typeof XMLHttpRequest === 'function') { -- // Electron has `XMLHttpRequest` and should get the browser implementation -- // instead of node. -- implName = './fetch.browser' -+/** -+ * @param {BodyInit | NodeReadableStream} input -+ */ -+const normalizeBody = (input) => { -+ if (input instanceof ArrayBuffer) { -+ return Buffer.from(input) -+ } else if (ArrayBuffer.isView(input)) { -+ return Buffer.from(input.buffer, input.byteOffset, input.byteLength) -+ } else if (typeof input === 'string') { -+ return Buffer.from(input) -+ } -+ return input - } - --/** @type {fetchImpl} */ --const fetch = require(implName) -+/** -+ * Takes body from native-fetch response as body and `onUploadProgress` handler -+ * and returns async iterable that emits body chunks and emits -+ * `onUploadProgress`. -+ * -+ * @param {NodeReadableStream | null} body -+ * @param {ProgressFn} onUploadProgress -+ * @returns {AsyncIterable} -+ */ -+const iterateBodyWithProgress = async function * (body, onUploadProgress) { -+ if (body == null) { -+ onUploadProgress({ total: 0, loaded: 0, lengthComputable: true }) -+ } else if (Buffer.isBuffer(body)) { -+ const total = body.byteLength -+ const lengthComputable = true -+ yield body -+ onUploadProgress({ total, loaded: total, lengthComputable }) -+ } else { -+ const total = 0 -+ const lengthComputable = false -+ let loaded = 0 -+ for await (const chunk of body) { -+ loaded += chunk.byteLength -+ yield chunk -+ onUploadProgress({ total, loaded, lengthComputable }) -+ } -+ } -+} - --module.exports = fetch -+module.exports = { -+ fetch, -+ Request, -+ Headers -+}