From e2797567f28e2030d9fbe1d8e3cfeba53e44714d Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 18 Oct 2024 11:19:36 -0400 Subject: [PATCH] Continue to wire-up inlined overrides --- .../assert/overrides/call-bind/callBound.d.ts | 6 +- .../assert/overrides/call-bind/callBound.js | 5 +- packages/npm/assert/package.json | 2 +- .../deep-equal/overrides/call-bind/LICENSE | 21 ++++++ .../overrides/call-bind/LICENSE.original | 21 ++++++ .../overrides/call-bind/callBound.d.ts | 45 ++++++++++++ .../overrides/call-bind/callBound.js | 72 ++++++++++++------- .../deep-equal/overrides/call-bind/index.d.ts | 1 + .../deep-equal/overrides/call-bind/index.js | 1 + .../overrides/call-bind/package.json | 39 ++++++++++ .../overrides/get-intrinsic/LICENSE | 21 ++++++ .../overrides/get-intrinsic/LICENSE.original | 21 ++++++ .../overrides/get-intrinsic/index.d.ts | 5 ++ .../overrides/get-intrinsic/index.js | 4 +- .../overrides/get-intrinsic/package.json | 35 +++++++++ packages/npm/deep-equal/package.json | 10 +-- 16 files changed, 274 insertions(+), 35 deletions(-) create mode 100644 packages/npm/deep-equal/overrides/call-bind/LICENSE create mode 100644 packages/npm/deep-equal/overrides/call-bind/LICENSE.original create mode 100644 packages/npm/deep-equal/overrides/call-bind/callBound.d.ts create mode 100644 packages/npm/deep-equal/overrides/call-bind/index.d.ts create mode 100644 packages/npm/deep-equal/overrides/call-bind/index.js create mode 100644 packages/npm/deep-equal/overrides/call-bind/package.json create mode 100644 packages/npm/deep-equal/overrides/get-intrinsic/LICENSE create mode 100644 packages/npm/deep-equal/overrides/get-intrinsic/LICENSE.original create mode 100644 packages/npm/deep-equal/overrides/get-intrinsic/index.d.ts create mode 100644 packages/npm/deep-equal/overrides/get-intrinsic/package.json diff --git a/packages/npm/assert/overrides/call-bind/callBound.d.ts b/packages/npm/assert/overrides/call-bind/callBound.d.ts index 5876d704..a8f8bbf7 100644 --- a/packages/npm/assert/overrides/call-bind/callBound.d.ts +++ b/packages/npm/assert/overrides/call-bind/callBound.d.ts @@ -1,5 +1,9 @@ declare function callBoundIntrinsic( name: 'RegExp.prototype.test', allowMissing?: boolean -): (regex: RegExp, str: string) => boolean +): (regex: RegExp, str: string) => ReturnType +declare function callBoundIntrinsic( + name: string, + allowMissing?: boolean +): undefined export = callBoundIntrinsic diff --git a/packages/npm/assert/overrides/call-bind/callBound.js b/packages/npm/assert/overrides/call-bind/callBound.js index ce2fc965..5c7fdc54 100644 --- a/packages/npm/assert/overrides/call-bind/callBound.js +++ b/packages/npm/assert/overrides/call-bind/callBound.js @@ -1,7 +1,10 @@ 'use strict' +const { apply: ReflectApply } = Reflect +const { test: RegExpProtoTest } = RegExp.prototype + function regExpProtoTest(regex, str) { - return regex.test(str) + return ReflectApply(RegExpProtoTest, regex, [str]) } module.exports = function callBoundIntrinsic(name, _allowMissing) { diff --git a/packages/npm/assert/package.json b/packages/npm/assert/package.json index cfdd569f..32a257bb 100644 --- a/packages/npm/assert/package.json +++ b/packages/npm/assert/package.json @@ -53,7 +53,7 @@ "files": [ "*.d.ts", "**/*.js", - "!overrides/**/{*.d.ts,index.js}" + "!overrides/call-bind/{*.d.ts,index.js}" ], "socket": { "categories": [ diff --git a/packages/npm/deep-equal/overrides/call-bind/LICENSE b/packages/npm/deep-equal/overrides/call-bind/LICENSE new file mode 100644 index 00000000..602b3ece --- /dev/null +++ b/packages/npm/deep-equal/overrides/call-bind/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Socket Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/npm/deep-equal/overrides/call-bind/LICENSE.original b/packages/npm/deep-equal/overrides/call-bind/LICENSE.original new file mode 100644 index 00000000..48f05d01 --- /dev/null +++ b/packages/npm/deep-equal/overrides/call-bind/LICENSE.original @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/npm/deep-equal/overrides/call-bind/callBound.d.ts b/packages/npm/deep-equal/overrides/call-bind/callBound.d.ts new file mode 100644 index 00000000..1e367518 --- /dev/null +++ b/packages/npm/deep-equal/overrides/call-bind/callBound.d.ts @@ -0,0 +1,45 @@ +declare function callBoundIntrinsic( + name: 'Date.prototype.getTime', + allowMissing?: boolean +): (date: Date) => ReturnType +declare function callBoundIntrinsic( + name: 'Map.prototype.get', + allowMissing?: boolean +): (map: Map, key: any) => ReturnType +declare function callBoundIntrinsic( + name: 'Map.prototype.has', + allowMissing?: boolean +): (map: Map, key: any) => ReturnType +declare function callBoundIntrinsic( + name: 'Map.prototype.size', + allowMissing?: boolean +): (map: Map) => typeof Map.prototype.size +declare function callBoundIntrinsic( + name: 'Object.prototype.toString', + allowMissing?: boolean +): (obj: any) => ReturnType +declare function callBoundIntrinsic( + name: 'Set.prototype.add', + allowMissing?: boolean +): (set: Set, value: any) => ReturnType +declare function callBoundIntrinsic( + name: 'Set.prototype.delete', + allowMissing?: boolean +): (set: Set, value: any) => ReturnType +declare function callBoundIntrinsic( + name: 'Set.prototype.has', + allowMissing?: boolean +): (set: Set, value: any) => ReturnType +declare function callBoundIntrinsic( + name: 'Set.prototype.size', + allowMissing?: boolean +): (set: Set) => typeof Set.prototype.size +declare function callBoundIntrinsic( + name: 'SharedArrayBuffer.prototype.byteLength', + allowMissing?: boolean +): (sab: SharedArrayBuffer) => typeof SharedArrayBuffer.prototype.byteLength +declare function callBoundIntrinsic( + name: string, + allowMissing?: boolean +): undefined +export = callBoundIntrinsic diff --git a/packages/npm/deep-equal/overrides/call-bind/callBound.js b/packages/npm/deep-equal/overrides/call-bind/callBound.js index 08b2f59a..428914cf 100644 --- a/packages/npm/deep-equal/overrides/call-bind/callBound.js +++ b/packages/npm/deep-equal/overrides/call-bind/callBound.js @@ -1,63 +1,81 @@ 'use strict' +const { getTime: DateProtoGetTime } = Date.prototype +const { get: MapProtoGet, has: MapProtoHas } = Map.prototype +const MapProtoSizeGetter = Map.prototype.__lookupGetter__('size') const { toString: objToStr } = Object.prototype - -function noop() {} +const { apply: ReflectApply } = Reflect +const { + add: SetProtoAdd, + delete: SetProtoDelete, + has: SetProtoHas +} = Set.prototype +const SetProtoSizeGetter = Set.prototype.__lookupGetter__('size') +const SharedArrayBufferByteLengthGetter = + SharedArrayBuffer.prototype.__lookupGetter__('byteLength') function dateProtoGetTime(date) { - return date.getTime() -} - -function mapOrSetProtoDelete(mos, key) { - return mos.delete(key) + return ReflectApply(DateProtoGetTime, date, []) } -function mapOrSetProtoHas(mos, key) { - return mos.has(key) +function mapProtoGet(map, key) { + return ReflectApply(MapProtoGet, map, [key]) } -function mapOrSetProtoGet(mos, key) { - return mos.get(key) +function mapProtoHas(map, key) { + return ReflectApply(MapProtoHas, map, [key]) } -function mapOrSetProtoSize(mos) { - return mos.size +function mapProtoSize(map) { + return ReflectApply(MapProtoSizeGetter, map, []) } function objectProtoToString(object) { - return objToStr.call(object) + return ReflectApply(objToStr, object, []) } -function sabProtoByteLength(sab) { - return sab.byteLength +function sharedArrayBufferProtoByteLength(sab) { + return ReflectApply(SharedArrayBufferByteLengthGetter, sab, []) } function setProtoAdd(set, value) { - return set.add(value) + return ReflectApply(SetProtoAdd, set, [value]) +} + +function setProtoDelete(set, key) { + return ReflectApply(SetProtoDelete, set, [key]) +} + +function setProtoHas(set, key) { + return ReflectApply(SetProtoHas, set, [key]) +} + +function setProtoSize(set) { + return ReflectApply(SetProtoSizeGetter, set, []) } module.exports = function callBoundIntrinsic(name, _allowMissing) { switch (name) { case 'Date.prototype.getTime': return dateProtoGetTime - case 'Map.prototype.has': - return mapOrSetProtoHas case 'Map.prototype.get': - return mapOrSetProtoGet + return mapProtoGet + case 'Map.prototype.has': + return mapProtoHas case 'Map.prototype.size': - return mapOrSetProtoSize + return mapProtoSize case 'Object.prototype.toString': return objectProtoToString - case 'SharedArrayBuffer.prototype.byteLength': - return sabProtoByteLength case 'Set.prototype.add': return setProtoAdd case 'Set.prototype.delete': - return mapOrSetProtoDelete + return setProtoDelete case 'Set.prototype.has': - return mapOrSetProtoHas + return setProtoHas case 'Set.prototype.size': - return mapOrSetProtoSize + return setProtoSize + case 'SharedArrayBuffer.prototype.byteLength': + return sharedArrayBufferProtoByteLength } - return noop + return undefined } diff --git a/packages/npm/deep-equal/overrides/call-bind/index.d.ts b/packages/npm/deep-equal/overrides/call-bind/index.d.ts new file mode 100644 index 00000000..40a8c178 --- /dev/null +++ b/packages/npm/deep-equal/overrides/call-bind/index.d.ts @@ -0,0 +1 @@ +/* empty */ diff --git a/packages/npm/deep-equal/overrides/call-bind/index.js b/packages/npm/deep-equal/overrides/call-bind/index.js new file mode 100644 index 00000000..40a8c178 --- /dev/null +++ b/packages/npm/deep-equal/overrides/call-bind/index.js @@ -0,0 +1 @@ +/* empty */ diff --git a/packages/npm/deep-equal/overrides/call-bind/package.json b/packages/npm/deep-equal/overrides/call-bind/package.json new file mode 100644 index 00000000..27d1230b --- /dev/null +++ b/packages/npm/deep-equal/overrides/call-bind/package.json @@ -0,0 +1,39 @@ +{ + "name": "@socketregistry/deep-equal", + "version": "1.0.3-overrides-call-bind", + "license": "MIT", + "description": "Socket.dev optimized package override for deep-equal/call-bind", + "keywords": [ + "Socket.dev", + "package-overrides" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/SocketDev/socket-registry-js.git", + "directory": "packages/npm/deep-equal/overrides/call-bind" + }, + "exports": { + ".": { + "types": "./index.d.ts", + "default": "./index.js" + }, + "./callBound": { + "types": "./callBound.d.ts", + "default": "./callBound.js" + }, + "./package.json": "./package.json" + }, + "sideEffects": false, + "engines": { + "node": ">=18.20.4" + }, + "files": [ + "*.d.ts", + "*.js" + ], + "socket": { + "categories": [ + "cleanup" + ] + } +} diff --git a/packages/npm/deep-equal/overrides/get-intrinsic/LICENSE b/packages/npm/deep-equal/overrides/get-intrinsic/LICENSE new file mode 100644 index 00000000..602b3ece --- /dev/null +++ b/packages/npm/deep-equal/overrides/get-intrinsic/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Socket Inc + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/npm/deep-equal/overrides/get-intrinsic/LICENSE.original b/packages/npm/deep-equal/overrides/get-intrinsic/LICENSE.original new file mode 100644 index 00000000..48f05d01 --- /dev/null +++ b/packages/npm/deep-equal/overrides/get-intrinsic/LICENSE.original @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Jordan Harband + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/npm/deep-equal/overrides/get-intrinsic/index.d.ts b/packages/npm/deep-equal/overrides/get-intrinsic/index.d.ts new file mode 100644 index 00000000..0fc0850d --- /dev/null +++ b/packages/npm/deep-equal/overrides/get-intrinsic/index.d.ts @@ -0,0 +1,5 @@ +declare function GetIntrinsic( + name: '%Set%', + allowMissing?: boolean +): SetConstructor +declare function GetIntrinsic(name: string, allowMissing?: boolean): undefined diff --git a/packages/npm/deep-equal/overrides/get-intrinsic/index.js b/packages/npm/deep-equal/overrides/get-intrinsic/index.js index 26e48ab8..035be35c 100644 --- a/packages/npm/deep-equal/overrides/get-intrinsic/index.js +++ b/packages/npm/deep-equal/overrides/get-intrinsic/index.js @@ -1,5 +1,7 @@ 'use strict' +const SetCtor = Set + module.exports = function GetIntrinsic(name, _allowMissing) { - return name === '%Set%' ? Set : undefined + return name === '%Set%' ? SetCtor : undefined } diff --git a/packages/npm/deep-equal/overrides/get-intrinsic/package.json b/packages/npm/deep-equal/overrides/get-intrinsic/package.json new file mode 100644 index 00000000..a98f4823 --- /dev/null +++ b/packages/npm/deep-equal/overrides/get-intrinsic/package.json @@ -0,0 +1,35 @@ +{ + "name": "@socketregistry/deep-equal", + "version": "1.0.3-overrides-get-intrinsic", + "license": "MIT", + "description": "Socket.dev optimized package override for deep-equal/get-intrinsic", + "keywords": [ + "Socket.dev", + "package-overrides" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/SocketDev/socket-registry-js.git", + "directory": "packages/npm/deep-equal/overrides/get-intrinsic" + }, + "exports": { + ".": { + "types": "./index.d.ts", + "default": "./index.js" + }, + "./package.json": "./package.json" + }, + "sideEffects": false, + "engines": { + "node": ">=18.20.4" + }, + "files": [ + "*.d.ts", + "*.js" + ], + "socket": { + "categories": [ + "cleanup" + ] + } +} diff --git a/packages/npm/deep-equal/package.json b/packages/npm/deep-equal/package.json index b2900430..0bb88df4 100644 --- a/packages/npm/deep-equal/package.json +++ b/packages/npm/deep-equal/package.json @@ -1,6 +1,6 @@ { "name": "@socketregistry/deep-equal", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "description": "Socket.dev optimized package override for deep-equal", "keywords": [ @@ -57,9 +57,9 @@ }, "resolutions": { "array-buffer-byte-length": "npm:@socketregistry/array-buffer-byte-length@^1", - "call-bind": "file:./overrides/call-bind", + "call-bind": "npm:@socketregistry/deep-equal@1.0.3-overrides-call-bind", "es-get-iterator": "npm:@socketregistry/es-get-iterator@^1", - "get-intrinsic": "file:./overrides/get-intrinsic", + "get-intrinsic": "npm:@socketregistry/deep-equal@1.0.3-overrides-get-intrinsic", "is-arguments": "npm:@socketregistry/is-arguments@^1", "is-array-buffer": "npm:@socketregistry/is-array-buffer@^1", "is-date-object": "npm:@socketregistry/is-date-object@^1", @@ -81,7 +81,9 @@ "files": [ "*.d.{c,}ts", "*.{c,}js", - "**/*.js" + "**/*.js", + "!overrides/call-bind/{*.d.ts,index.js}", + "!overrides/get-intrinsic/*.d.ts" ], "socket": { "categories": [