-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(a3p-integration): Patch Hardened JS compatibility into n:upgrade-…
…next dependencies axios/axios#6264 protobufjs/protobuf.js#1742
- Loading branch information
Showing
4 changed files
with
278 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,12 +31,14 @@ | |
"lint-fix": "yarn lint:eslint --fix", | ||
"lint": "run-s --continue-on-error 'lint:*'", | ||
"lint:types": "tsc", | ||
"lint:eslint": "eslint ." | ||
"lint:eslint": "eslint .", | ||
"postinstall": "patch-package" | ||
}, | ||
"packageManager": "[email protected]", | ||
"devDependencies": { | ||
"eslint": "^8.57.0", | ||
"npm-run-all": "^4.1.5", | ||
"patch-package": "^8.0.0", | ||
"typescript": "^5.6.3" | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
a3p-integration/proposals/n:upgrade-next/patches/axios+1.7.7.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
diff --git a/node_modules/axios/dist/node/.axios.cjs.swp b/node_modules/axios/dist/node/.axios.cjs.swp | ||
new file mode 100644 | ||
index 0000000..a905990 | ||
Binary files /dev/null and b/node_modules/axios/dist/node/.axios.cjs.swp differ | ||
diff --git a/node_modules/axios/dist/node/axios.cjs b/node_modules/axios/dist/node/axios.cjs | ||
index db4997b..fb39f7e 100644 | ||
--- a/node_modules/axios/dist/node/axios.cjs | ||
+++ b/node_modules/axios/dist/node/axios.cjs | ||
@@ -371,9 +371,18 @@ function merge(/* obj1, obj2, obj3, ... */) { | ||
const extend = (a, b, thisArg, {allOwnKeys}= {}) => { | ||
forEach(b, (val, key) => { | ||
if (thisArg && isFunction(val)) { | ||
- a[key] = bind(val, thisArg); | ||
- } else { | ||
+ val = bind(val, thisArg); | ||
+ } | ||
+ const oldDesc = Object.getOwnPropertyDescriptor(a, key); | ||
+ if (oldDesc) { | ||
a[key] = val; | ||
+ } else { | ||
+ Object.defineProperty(a, key, { | ||
+ value: val, | ||
+ writable: true, | ||
+ enumerable: true, | ||
+ configurable: true | ||
+ }); | ||
} | ||
}, {allOwnKeys}); | ||
return a; | ||
@@ -404,7 +413,9 @@ const stripBOM = (content) => { | ||
*/ | ||
const inherits = (constructor, superConstructor, props, descriptors) => { | ||
constructor.prototype = Object.create(superConstructor.prototype, descriptors); | ||
- constructor.prototype.constructor = constructor; | ||
+ Object.defineProperty(constructor.prototype, 'constructor', { | ||
+ value: constructor | ||
+ }); | ||
Object.defineProperty(constructor, 'super', { | ||
value: superConstructor.prototype | ||
}); | ||
@@ -566,7 +577,7 @@ const isRegExp = kindOfTest('RegExp'); | ||
|
||
const reduceDescriptors = (obj, reducer) => { | ||
const descriptors = Object.getOwnPropertyDescriptors(obj); | ||
- const reducedDescriptors = {}; | ||
+ const reducedDescriptors = Object.create(null); | ||
|
||
forEach(descriptors, (descriptor, name) => { | ||
let ret; |
40 changes: 40 additions & 0 deletions
40
a3p-integration/proposals/n:upgrade-next/patches/protobufjs+6.11.4.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
diff --git a/node_modules/protobufjs/src/util/.minimal.js.swp b/node_modules/protobufjs/src/util/.minimal.js.swp | ||
new file mode 100644 | ||
index 0000000..8605a72 | ||
Binary files /dev/null and b/node_modules/protobufjs/src/util/.minimal.js.swp differ | ||
diff --git a/node_modules/protobufjs/src/util/minimal.js b/node_modules/protobufjs/src/util/minimal.js | ||
index 3c406de..564e5da 100644 | ||
--- a/node_modules/protobufjs/src/util/minimal.js | ||
+++ b/node_modules/protobufjs/src/util/minimal.js | ||
@@ -280,7 +280,30 @@ function newError(name) { | ||
merge(this, properties); | ||
} | ||
|
||
- (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError; | ||
+ CustomError.prototype = Object.create(Error.prototype, { | ||
+ constructor: { | ||
+ value: CustomError, | ||
+ writable: true, | ||
+ enumerable: false, | ||
+ configurable: true, | ||
+ }, | ||
+ name: { | ||
+ 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: false, | ||
+ configurable: true, | ||
+ }, | ||
+ }); | ||
|
||
Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } }); | ||
|
Oops, something went wrong.