Skip to content

Commit 771df53

Browse files
committed
fix(a3p-integration): Patch Hardened JS compatibility into n:upgrade-next dependencies
axios/axios#6264 protobufjs/protobuf.js#1742
1 parent 7a56ca0 commit 771df53

File tree

4 files changed

+122
-2
lines changed

4 files changed

+122
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
diff --git a/dist/node/axios.cjs b/dist/node/axios.cjs
2+
index db4997bee1aa48aca215c6b2e7443292c94c086f..fb39f7e0046c66b1c0275c1a82ed49d3cc7cff83 100644
3+
--- a/dist/node/axios.cjs
4+
+++ b/dist/node/axios.cjs
5+
@@ -371,9 +371,18 @@ function merge(/* obj1, obj2, obj3, ... */) {
6+
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
7+
forEach(b, (val, key) => {
8+
if (thisArg && isFunction(val)) {
9+
- a[key] = bind(val, thisArg);
10+
- } else {
11+
+ val = bind(val, thisArg);
12+
+ }
13+
+ const oldDesc = Object.getOwnPropertyDescriptor(a, key);
14+
+ if (oldDesc) {
15+
a[key] = val;
16+
+ } else {
17+
+ Object.defineProperty(a, key, {
18+
+ value: val,
19+
+ writable: true,
20+
+ enumerable: true,
21+
+ configurable: true
22+
+ });
23+
}
24+
}, {allOwnKeys});
25+
return a;
26+
@@ -404,7 +413,9 @@ const stripBOM = (content) => {
27+
*/
28+
const inherits = (constructor, superConstructor, props, descriptors) => {
29+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
30+
- constructor.prototype.constructor = constructor;
31+
+ Object.defineProperty(constructor.prototype, 'constructor', {
32+
+ value: constructor
33+
+ });
34+
Object.defineProperty(constructor, 'super', {
35+
value: superConstructor.prototype
36+
});
37+
@@ -566,7 +577,7 @@ const isRegExp = kindOfTest('RegExp');
38+
39+
const reduceDescriptors = (obj, reducer) => {
40+
const descriptors = Object.getOwnPropertyDescriptors(obj);
41+
- const reducedDescriptors = {};
42+
+ const reducedDescriptors = Object.create(null);
43+
44+
forEach(descriptors, (descriptor, name) => {
45+
let ret;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
diff --git a/src/util/minimal.js b/src/util/minimal.js
2+
index 3c406dee753b5c6fb29dda2e64d4482e754e7873..564e5dadaa50e4ad05fc18b767ee276c99e9f0f9 100644
3+
--- a/src/util/minimal.js
4+
+++ b/src/util/minimal.js
5+
@@ -280,7 +280,30 @@ function newError(name) {
6+
merge(this, properties);
7+
}
8+
9+
- (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;
10+
+ CustomError.prototype = Object.create(Error.prototype, {
11+
+ constructor: {
12+
+ value: CustomError,
13+
+ writable: true,
14+
+ enumerable: false,
15+
+ configurable: true,
16+
+ },
17+
+ name: {
18+
+ get() { return name; },
19+
+ set: undefined,
20+
+ enumerable: false,
21+
+ // configurable: false would accurately preserve the behavior of
22+
+ // the original, but I'm guessing that was not intentional.
23+
+ // For an actual error subclass, this property would
24+
+ // be configurable.
25+
+ configurable: true,
26+
+ },
27+
+ toString: {
28+
+ value() { return this.name + ": " + this.message; },
29+
+ writable: true,
30+
+ enumerable: false,
31+
+ configurable: true,
32+
+ },
33+
+ });
34+
35+
Object.defineProperty(CustomError.prototype, "name", { get: function() { return name; } });
36+

a3p-integration/proposals/n:upgrade-next/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,9 @@
3838
"eslint": "^8.57.0",
3939
"npm-run-all": "^4.1.5",
4040
"typescript": "^5.6.3"
41+
},
42+
"resolutions": {
43+
"axios@npm:^1.6.0": "patch:axios@npm%3A1.7.7#~/.yarn/patches/axios-npm-1.7.7-cfbedc233d.patch",
44+
"protobufjs@npm:^6.8.8": "patch:protobufjs@npm%3A6.11.4#~/.yarn/patches/protobufjs-npm-6.11.4-af11968b80.patch"
4145
}
4246
}

a3p-integration/proposals/n:upgrade-next/yarn.lock

+37-2
Original file line numberDiff line numberDiff line change
@@ -1665,7 +1665,7 @@ __metadata:
16651665
languageName: node
16661666
linkType: hard
16671667

1668-
"axios@npm:^1.6.0":
1668+
"axios@npm:1.7.7":
16691669
version: 1.7.7
16701670
resolution: "axios@npm:1.7.7"
16711671
dependencies:
@@ -1676,6 +1676,17 @@ __metadata:
16761676
languageName: node
16771677
linkType: hard
16781678

1679+
"axios@patch:axios@npm%3A1.7.7#~/.yarn/patches/axios-npm-1.7.7-cfbedc233d.patch":
1680+
version: 1.7.7
1681+
resolution: "axios@patch:axios@npm%3A1.7.7#~/.yarn/patches/axios-npm-1.7.7-cfbedc233d.patch::version=1.7.7&hash=df7a05"
1682+
dependencies:
1683+
follow-redirects: "npm:^1.15.6"
1684+
form-data: "npm:^4.0.0"
1685+
proxy-from-env: "npm:^1.1.0"
1686+
checksum: 10c0/49964e1025a39e845ad1824cdf49f313202de26e55bbc4a67e81aaeaba78a8efcbfe3da42ca61c14fdbc249bdbd62b5478e9e54ea3456711d159ec068b12c392
1687+
languageName: node
1688+
linkType: hard
1689+
16791690
"balanced-match@npm:^1.0.0":
16801691
version: 1.0.2
16811692
resolution: "balanced-match@npm:1.0.2"
@@ -4671,7 +4682,7 @@ __metadata:
46714682
languageName: node
46724683
linkType: hard
46734684

4674-
"protobufjs@npm:^6.8.8":
4685+
"protobufjs@npm:6.11.4":
46754686
version: 6.11.4
46764687
resolution: "protobufjs@npm:6.11.4"
46774688
dependencies:
@@ -4695,6 +4706,30 @@ __metadata:
46954706
languageName: node
46964707
linkType: hard
46974708

4709+
"protobufjs@patch:protobufjs@npm%3A6.11.4#~/.yarn/patches/protobufjs-npm-6.11.4-af11968b80.patch":
4710+
version: 6.11.4
4711+
resolution: "protobufjs@patch:protobufjs@npm%3A6.11.4#~/.yarn/patches/protobufjs-npm-6.11.4-af11968b80.patch::version=6.11.4&hash=1644ab"
4712+
dependencies:
4713+
"@protobufjs/aspromise": "npm:^1.1.2"
4714+
"@protobufjs/base64": "npm:^1.1.2"
4715+
"@protobufjs/codegen": "npm:^2.0.4"
4716+
"@protobufjs/eventemitter": "npm:^1.1.0"
4717+
"@protobufjs/fetch": "npm:^1.1.0"
4718+
"@protobufjs/float": "npm:^1.0.2"
4719+
"@protobufjs/inquire": "npm:^1.1.0"
4720+
"@protobufjs/path": "npm:^1.1.2"
4721+
"@protobufjs/pool": "npm:^1.1.0"
4722+
"@protobufjs/utf8": "npm:^1.1.0"
4723+
"@types/long": "npm:^4.0.1"
4724+
"@types/node": "npm:>=13.7.0"
4725+
long: "npm:^4.0.0"
4726+
bin:
4727+
pbjs: bin/pbjs
4728+
pbts: bin/pbts
4729+
checksum: 10c0/fea6b3d00dbb564157b24c0f0f69dc777b22f30ffbe1fed67fb9a2ef05e6e99e8da6d1811bea650a315ec98d7512638d72317e41136522b94be4fb3c89d8d0ab
4730+
languageName: node
4731+
linkType: hard
4732+
46984733
"proxy-from-env@npm:^1.1.0":
46994734
version: 1.1.0
47004735
resolution: "proxy-from-env@npm:1.1.0"

0 commit comments

Comments
 (0)