From 958dbb671e66980731789c086c9193c50d062725 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 10 Jun 2022 12:35:17 -0700 Subject: [PATCH 1/2] fix: patch mistaken overrides --- patches/bl++readable-stream+3.6.0.patch | 20 ++++++++++ patches/cosmjs-types++protobufjs+6.11.3.patch | 38 +++++++++++++++++++ patches/inquirer++rxjs+7.5.5.patch | 21 ++++++++++ 3 files changed, 79 insertions(+) create mode 100644 patches/bl++readable-stream+3.6.0.patch create mode 100644 patches/cosmjs-types++protobufjs+6.11.3.patch create mode 100644 patches/inquirer++rxjs+7.5.5.patch diff --git a/patches/bl++readable-stream+3.6.0.patch b/patches/bl++readable-stream+3.6.0.patch new file mode 100644 index 00000000000..2b1b1b88882 --- /dev/null +++ b/patches/bl++readable-stream+3.6.0.patch @@ -0,0 +1,20 @@ +diff --git a/node_modules/bl/node_modules/readable-stream/errors.js b/node_modules/bl/node_modules/readable-stream/errors.js +index 8471526..c1c08cf 100644 +--- a/node_modules/bl/node_modules/readable-stream/errors.js ++++ b/node_modules/bl/node_modules/readable-stream/errors.js +@@ -21,7 +21,14 @@ function createErrorType(code, message, Base) { + } + } + +- NodeError.prototype.name = Base.name; ++ Object.defineProperties(NodeError.prototype, { ++ name: { ++ value: Base.name, ++ writable: true, ++ enumerable: false, ++ configurable: true, ++ } ++ }) + NodeError.prototype.code = code; + + codes[code] = NodeError; diff --git a/patches/cosmjs-types++protobufjs+6.11.3.patch b/patches/cosmjs-types++protobufjs+6.11.3.patch new file mode 100644 index 00000000000..28fcf867fb6 --- /dev/null +++ b/patches/cosmjs-types++protobufjs+6.11.3.patch @@ -0,0 +1,38 @@ +diff --git a/node_modules/cosmjs-types/node_modules/protobufjs/src/util/minimal.js b/node_modules/cosmjs-types/node_modules/protobufjs/src/util/minimal.js +index 3c406de..fb88de4 100644 +--- a/node_modules/cosmjs-types/node_modules/protobufjs/src/util/minimal.js ++++ b/node_modules/cosmjs-types/node_modules/protobufjs/src/util/minimal.js +@@ -280,13 +280,26 @@ function newError(name) { + merge(this, properties); + } + +- (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError; +- +- Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } }); +- +- CustomError.prototype.toString = function toString() { +- return this.name + ": " + this.message; +- }; ++ CustomError.prototype = Object.create(Error.prototype, { ++ constructor: { ++ value: CustomError, ++ writable: true, ++ enumerable: false, ++ configurable: true, ++ }, ++ name: { ++ get() { return name; }, ++ set: undefined, ++ enumerable: false, ++ configurable: true, ++ }, ++ toString: { ++ value() { return this.name + ": " + this.message; }, ++ writable: true, ++ enumerable: false, ++ configurable: true, ++ }, ++ }); + + return CustomError; + } diff --git a/patches/inquirer++rxjs+7.5.5.patch b/patches/inquirer++rxjs+7.5.5.patch new file mode 100644 index 00000000000..acab134ba0a --- /dev/null +++ b/patches/inquirer++rxjs+7.5.5.patch @@ -0,0 +1,21 @@ +diff --git a/node_modules/inquirer/node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js b/node_modules/inquirer/node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js +index 98a6e52..2c8122e 100644 +--- a/node_modules/inquirer/node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js ++++ b/node_modules/inquirer/node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js +@@ -7,8 +7,14 @@ function createErrorClass(createImpl) { + instance.stack = new Error().stack; + }; + var ctorFunc = createImpl(_super); +- ctorFunc.prototype = Object.create(Error.prototype); +- ctorFunc.prototype.constructor = ctorFunc; ++ ctorFunc.prototype = Object.create(Error.prototype, { ++ constructor: { ++ value: ctorFunc, ++ writable: true, ++ enumerable: false, ++ configurable: true, ++ } ++ }); + return ctorFunc; + } + exports.createErrorClass = createErrorClass; From b1d765121c84c419633545114792e637e345078f Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Fri, 10 Jun 2022 14:03:13 -0700 Subject: [PATCH 2/2] fix: clarifying for review comment --- patches/bl++readable-stream+3.6.0.patch | 6 +++++- patches/cosmjs-types++protobufjs+6.11.3.patch | 14 +++++++++++++- patches/inquirer++rxjs+7.5.5.patch | 8 ++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/patches/bl++readable-stream+3.6.0.patch b/patches/bl++readable-stream+3.6.0.patch index 2b1b1b88882..ddcb98ef1b4 100644 --- a/patches/bl++readable-stream+3.6.0.patch +++ b/patches/bl++readable-stream+3.6.0.patch @@ -2,7 +2,7 @@ diff --git a/node_modules/bl/node_modules/readable-stream/errors.js b/node_modul index 8471526..c1c08cf 100644 --- a/node_modules/bl/node_modules/readable-stream/errors.js +++ b/node_modules/bl/node_modules/readable-stream/errors.js -@@ -21,7 +21,14 @@ function createErrorType(code, message, Base) { +@@ -21,7 +21,18 @@ function createErrorType(code, message, Base) { } } @@ -11,6 +11,10 @@ index 8471526..c1c08cf 100644 + name: { + value: Base.name, + writable: true, ++ // enumerable: true would accurately preserve the behavior of the ++ // original assignment, but I'm guessing that was not intentional. ++ // For an actual error subclass, this property would not ++ // be enumerable. + enumerable: false, + configurable: true, + } diff --git a/patches/cosmjs-types++protobufjs+6.11.3.patch b/patches/cosmjs-types++protobufjs+6.11.3.patch index 28fcf867fb6..394a8a0af15 100644 --- a/patches/cosmjs-types++protobufjs+6.11.3.patch +++ b/patches/cosmjs-types++protobufjs+6.11.3.patch @@ -2,7 +2,7 @@ diff --git a/node_modules/cosmjs-types/node_modules/protobufjs/src/util/minimal. index 3c406de..fb88de4 100644 --- a/node_modules/cosmjs-types/node_modules/protobufjs/src/util/minimal.js +++ b/node_modules/cosmjs-types/node_modules/protobufjs/src/util/minimal.js -@@ -280,13 +280,26 @@ function newError(name) { +@@ -280,13 +280,38 @@ function newError(name) { merge(this, properties); } @@ -17,6 +17,10 @@ index 3c406de..fb88de4 100644 + constructor: { + value: CustomError, + writable: true, ++ // enumerable: true would accurately preserve the behavior of the ++ // original assignment, but I'm guessing that was not intentional. ++ // For an actual error subclass, this property would not ++ // be enumerable. + enumerable: false, + configurable: true, + }, @@ -24,11 +28,19 @@ index 3c406de..fb88de4 100644 + get() { return name; }, + set: undefined, + enumerable: false, ++ // configurable: false would accurately preserve the behavior of ++ // the original, but I'm guessing that was not intentional. ++ // For an actual error subclass, this property would ++ // be configurable. + configurable: true, + }, + toString: { + value() { return this.name + ": " + this.message; }, + writable: true, ++ // enumerable: true would accurately preserve the behavior of the ++ // original assignment, but I'm guessing that was not intentional. ++ // For an actual error subclass, this property would not ++ // be enumerable. + enumerable: false, + configurable: true, + }, diff --git a/patches/inquirer++rxjs+7.5.5.patch b/patches/inquirer++rxjs+7.5.5.patch index acab134ba0a..15d98eeba20 100644 --- a/patches/inquirer++rxjs+7.5.5.patch +++ b/patches/inquirer++rxjs+7.5.5.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/inquirer/node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js b/node_modules/inquirer/node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js -index 98a6e52..2c8122e 100644 +index 98a6e52..af7d91a 100644 --- a/node_modules/inquirer/node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js +++ b/node_modules/inquirer/node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js -@@ -7,8 +7,14 @@ function createErrorClass(createImpl) { +@@ -7,8 +7,18 @@ function createErrorClass(createImpl) { instance.stack = new Error().stack; }; var ctorFunc = createImpl(_super); @@ -12,6 +12,10 @@ index 98a6e52..2c8122e 100644 + constructor: { + value: ctorFunc, + writable: true, ++ // enumerable: true would accurately preserve the behavior of the ++ // original assignment, but I'm guessing that was not intentional. ++ // For an actual error subclass, this property would not ++ // be enumerable. + enumerable: false, + configurable: true, + }