step-node-agent 3.26.5 → 3.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (259) hide show
  1. package/node_modules/call-bind-apply-helpers/.eslintrc +1 -0
  2. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +7 -0
  3. package/node_modules/call-bind-apply-helpers/index.d.ts +38 -20
  4. package/node_modules/call-bind-apply-helpers/index.js +1 -1
  5. package/node_modules/call-bind-apply-helpers/package.json +8 -8
  6. package/node_modules/call-bind-apply-helpers/test/index.js +4 -4
  7. package/node_modules/{call-bind → call-bound}/.eslintrc +0 -3
  8. package/node_modules/{define-data-property → call-bound}/.github/FUNDING.yml +1 -1
  9. package/node_modules/call-bound/CHANGELOG.md +42 -0
  10. package/node_modules/{call-bind → call-bound}/LICENSE +1 -1
  11. package/node_modules/call-bound/README.md +53 -0
  12. package/node_modules/call-bound/index.d.ts +94 -0
  13. package/node_modules/call-bound/index.js +19 -0
  14. package/node_modules/{call-bind → call-bound}/package.json +23 -17
  15. package/node_modules/{call-bind/test/callBound.js → call-bound/test/index.js} +12 -5
  16. package/node_modules/call-bound/tsconfig.json +10 -0
  17. package/node_modules/dunder-proto/CHANGELOG.md +9 -0
  18. package/node_modules/dunder-proto/get.js +10 -3
  19. package/node_modules/dunder-proto/package.json +4 -4
  20. package/node_modules/dunder-proto/set.js +7 -1
  21. package/node_modules/dunder-proto/test/set.js +10 -1
  22. package/node_modules/es-object-atoms/.eslintrc +16 -0
  23. package/node_modules/{set-function-length → es-object-atoms}/.github/FUNDING.yml +1 -1
  24. package/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  25. package/node_modules/{has-property-descriptors → es-object-atoms}/LICENSE +1 -1
  26. package/node_modules/es-object-atoms/README.md +63 -0
  27. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  28. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  29. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  30. package/node_modules/es-object-atoms/ToObject.js +10 -0
  31. package/node_modules/es-object-atoms/index.d.ts +3 -0
  32. package/node_modules/es-object-atoms/index.js +4 -0
  33. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  34. package/node_modules/es-object-atoms/isObject.js +6 -0
  35. package/node_modules/es-object-atoms/package.json +80 -0
  36. package/node_modules/es-object-atoms/test/index.js +38 -0
  37. package/node_modules/es-object-atoms/tsconfig.json +6 -0
  38. package/node_modules/get-intrinsic/.eslintrc +4 -0
  39. package/node_modules/get-intrinsic/CHANGELOG.md +25 -0
  40. package/node_modules/get-intrinsic/index.js +25 -6
  41. package/node_modules/get-intrinsic/package.json +11 -9
  42. package/node_modules/get-proto/.eslintrc +10 -0
  43. package/node_modules/{call-bind → get-proto}/.github/FUNDING.yml +1 -1
  44. package/node_modules/get-proto/CHANGELOG.md +21 -0
  45. package/node_modules/{define-data-property → get-proto}/LICENSE +1 -1
  46. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  47. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  48. package/node_modules/get-proto/README.md +50 -0
  49. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  50. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  51. package/node_modules/get-proto/index.d.ts +5 -0
  52. package/node_modules/get-proto/index.js +27 -0
  53. package/node_modules/{has-property-descriptors → get-proto}/package.json +35 -31
  54. package/node_modules/get-proto/test/index.js +68 -0
  55. package/node_modules/get-proto/tsconfig.json +9 -0
  56. package/node_modules/is-core-module/CHANGELOG.md +13 -0
  57. package/node_modules/is-core-module/core.json +1 -0
  58. package/node_modules/is-core-module/package.json +3 -3
  59. package/node_modules/is-core-module/test/index.js +3 -0
  60. package/node_modules/math-intrinsics/.eslintrc +16 -0
  61. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  62. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  63. package/node_modules/{set-function-length → math-intrinsics}/LICENSE +1 -1
  64. package/node_modules/math-intrinsics/README.md +50 -0
  65. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  66. package/node_modules/math-intrinsics/abs.js +4 -0
  67. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  68. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  69. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  70. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  71. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  72. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  73. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  74. package/node_modules/math-intrinsics/floor.js +4 -0
  75. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  76. package/node_modules/math-intrinsics/isFinite.js +12 -0
  77. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  78. package/node_modules/math-intrinsics/isInteger.js +16 -0
  79. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  80. package/node_modules/math-intrinsics/isNaN.js +6 -0
  81. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  82. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  83. package/node_modules/math-intrinsics/max.d.ts +1 -0
  84. package/node_modules/math-intrinsics/max.js +4 -0
  85. package/node_modules/math-intrinsics/min.d.ts +1 -0
  86. package/node_modules/math-intrinsics/min.js +4 -0
  87. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  88. package/node_modules/math-intrinsics/mod.js +9 -0
  89. package/node_modules/math-intrinsics/package.json +86 -0
  90. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  91. package/node_modules/math-intrinsics/pow.js +4 -0
  92. package/node_modules/math-intrinsics/round.d.ts +1 -0
  93. package/node_modules/math-intrinsics/round.js +4 -0
  94. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  95. package/node_modules/math-intrinsics/sign.js +11 -0
  96. package/node_modules/math-intrinsics/test/index.js +192 -0
  97. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  98. package/node_modules/object-inspect/CHANGELOG.md +8 -0
  99. package/node_modules/object-inspect/index.js +10 -7
  100. package/node_modules/object-inspect/package.json +5 -4
  101. package/node_modules/object-inspect/test/values.js +50 -0
  102. package/node_modules/resolve/lib/core.json +4 -0
  103. package/node_modules/resolve/package.json +12 -9
  104. package/node_modules/side-channel/.eslintrc +1 -0
  105. package/node_modules/side-channel/CHANGELOG.md +15 -0
  106. package/node_modules/side-channel/README.md +60 -1
  107. package/node_modules/side-channel/index.d.ts +9 -22
  108. package/node_modules/side-channel/index.js +20 -106
  109. package/node_modules/side-channel/package.json +20 -19
  110. package/node_modules/side-channel/test/index.js +76 -55
  111. package/node_modules/side-channel/tsconfig.json +2 -43
  112. package/node_modules/side-channel-list/.editorconfig +9 -0
  113. package/node_modules/side-channel-list/.eslintrc +11 -0
  114. package/node_modules/{has-property-descriptors → side-channel-list}/.github/FUNDING.yml +1 -1
  115. package/node_modules/side-channel-list/CHANGELOG.md +15 -0
  116. package/node_modules/side-channel-list/LICENSE +21 -0
  117. package/node_modules/side-channel-list/README.md +62 -0
  118. package/node_modules/side-channel-list/index.d.ts +13 -0
  119. package/node_modules/side-channel-list/index.js +113 -0
  120. package/node_modules/side-channel-list/list.d.ts +14 -0
  121. package/node_modules/side-channel-list/package.json +77 -0
  122. package/node_modules/side-channel-list/test/index.js +104 -0
  123. package/node_modules/side-channel-map/.editorconfig +9 -0
  124. package/node_modules/side-channel-map/.eslintrc +11 -0
  125. package/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
  126. package/node_modules/side-channel-map/CHANGELOG.md +22 -0
  127. package/node_modules/side-channel-map/LICENSE +21 -0
  128. package/node_modules/side-channel-map/README.md +62 -0
  129. package/node_modules/side-channel-map/index.d.ts +15 -0
  130. package/node_modules/side-channel-map/index.js +68 -0
  131. package/node_modules/side-channel-map/package.json +80 -0
  132. package/node_modules/side-channel-map/test/index.js +114 -0
  133. package/node_modules/side-channel-map/tsconfig.json +9 -0
  134. package/node_modules/side-channel-weakmap/.editorconfig +9 -0
  135. package/node_modules/side-channel-weakmap/.eslintrc +12 -0
  136. package/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
  137. package/node_modules/side-channel-weakmap/.nycrc +13 -0
  138. package/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
  139. package/node_modules/side-channel-weakmap/LICENSE +21 -0
  140. package/node_modules/side-channel-weakmap/README.md +62 -0
  141. package/node_modules/side-channel-weakmap/index.d.ts +15 -0
  142. package/node_modules/side-channel-weakmap/index.js +84 -0
  143. package/node_modules/side-channel-weakmap/package.json +87 -0
  144. package/node_modules/side-channel-weakmap/test/index.js +114 -0
  145. package/node_modules/side-channel-weakmap/tsconfig.json +9 -0
  146. package/node_modules/yaml/README.md +27 -8
  147. package/node_modules/yaml/browser/dist/compose/resolve-props.js +1 -1
  148. package/node_modules/yaml/browser/dist/log.js +1 -4
  149. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +2 -11
  150. package/node_modules/yaml/browser/dist/util.js +1 -1
  151. package/node_modules/yaml/dist/compose/compose-collection.d.ts +4 -4
  152. package/node_modules/yaml/dist/compose/compose-doc.d.ts +6 -6
  153. package/node_modules/yaml/dist/compose/compose-node.d.ts +7 -7
  154. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +4 -4
  155. package/node_modules/yaml/dist/compose/composer.d.ts +7 -6
  156. package/node_modules/yaml/dist/compose/composer.js +2 -1
  157. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +5 -5
  158. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +5 -5
  159. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +5 -5
  160. package/node_modules/yaml/dist/compose/resolve-end.d.ts +2 -2
  161. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -7
  162. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +4 -4
  163. package/node_modules/yaml/dist/compose/resolve-props.d.ts +2 -2
  164. package/node_modules/yaml/dist/compose/resolve-props.js +1 -1
  165. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +1 -1
  166. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +1 -1
  167. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +2 -2
  168. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +3 -3
  169. package/node_modules/yaml/dist/doc/Document.d.ts +11 -11
  170. package/node_modules/yaml/dist/doc/anchors.d.ts +2 -2
  171. package/node_modules/yaml/dist/doc/createNode.d.ts +4 -4
  172. package/node_modules/yaml/dist/doc/directives.d.ts +1 -1
  173. package/node_modules/yaml/dist/index.d.ts +21 -18
  174. package/node_modules/yaml/dist/log.js +4 -2
  175. package/node_modules/yaml/dist/nodes/Alias.d.ts +9 -8
  176. package/node_modules/yaml/dist/nodes/Collection.d.ts +4 -4
  177. package/node_modules/yaml/dist/nodes/Node.d.ts +10 -10
  178. package/node_modules/yaml/dist/nodes/Pair.d.ts +9 -8
  179. package/node_modules/yaml/dist/nodes/Scalar.d.ts +4 -3
  180. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +10 -10
  181. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +10 -10
  182. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +3 -3
  183. package/node_modules/yaml/dist/nodes/identity.d.ts +7 -7
  184. package/node_modules/yaml/dist/nodes/toJS.d.ts +2 -2
  185. package/node_modules/yaml/dist/options.d.ts +10 -10
  186. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +4 -4
  187. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +1 -1
  188. package/node_modules/yaml/dist/parse/cst-visit.d.ts +2 -2
  189. package/node_modules/yaml/dist/parse/cst.d.ts +4 -3
  190. package/node_modules/yaml/dist/parse/lexer.d.ts +1 -1
  191. package/node_modules/yaml/dist/parse/parser.d.ts +4 -4
  192. package/node_modules/yaml/dist/parse/parser.js +2 -1
  193. package/node_modules/yaml/dist/public-api.d.ts +6 -5
  194. package/node_modules/yaml/dist/schema/Schema.d.ts +4 -4
  195. package/node_modules/yaml/dist/schema/common/map.d.ts +1 -1
  196. package/node_modules/yaml/dist/schema/common/null.d.ts +1 -1
  197. package/node_modules/yaml/dist/schema/common/seq.d.ts +1 -1
  198. package/node_modules/yaml/dist/schema/common/string.d.ts +1 -1
  199. package/node_modules/yaml/dist/schema/core/bool.d.ts +1 -1
  200. package/node_modules/yaml/dist/schema/core/float.d.ts +1 -1
  201. package/node_modules/yaml/dist/schema/core/int.d.ts +1 -1
  202. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -1
  203. package/node_modules/yaml/dist/schema/json/schema.d.ts +1 -1
  204. package/node_modules/yaml/dist/schema/tags.d.ts +2 -2
  205. package/node_modules/yaml/dist/schema/types.d.ts +8 -8
  206. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +1 -1
  207. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +6 -5
  208. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +1 -1
  209. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +1 -1
  210. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +1 -1
  211. package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +3 -3
  212. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +11 -17
  213. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +7 -7
  214. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -1
  215. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +9 -9
  216. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +1 -1
  217. package/node_modules/yaml/dist/stringify/stringify.d.ts +3 -3
  218. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +2 -2
  219. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +3 -3
  220. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +1 -1
  221. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +2 -2
  222. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +2 -2
  223. package/node_modules/yaml/dist/util.d.ts +16 -12
  224. package/node_modules/yaml/dist/util.js +2 -2
  225. package/node_modules/yaml/dist/visit.d.ts +7 -7
  226. package/node_modules/yaml/package.json +4 -4
  227. package/package.json +1 -1
  228. package/node_modules/call-bind/.eslintignore +0 -1
  229. package/node_modules/call-bind/CHANGELOG.md +0 -106
  230. package/node_modules/call-bind/README.md +0 -64
  231. package/node_modules/call-bind/callBound.js +0 -15
  232. package/node_modules/call-bind/index.js +0 -24
  233. package/node_modules/call-bind/test/index.js +0 -74
  234. package/node_modules/define-data-property/.eslintrc +0 -24
  235. package/node_modules/define-data-property/CHANGELOG.md +0 -70
  236. package/node_modules/define-data-property/README.md +0 -67
  237. package/node_modules/define-data-property/index.d.ts +0 -12
  238. package/node_modules/define-data-property/index.js +0 -56
  239. package/node_modules/define-data-property/package.json +0 -106
  240. package/node_modules/define-data-property/test/index.js +0 -392
  241. package/node_modules/define-data-property/tsconfig.json +0 -59
  242. package/node_modules/has-property-descriptors/.eslintrc +0 -13
  243. package/node_modules/has-property-descriptors/CHANGELOG.md +0 -35
  244. package/node_modules/has-property-descriptors/README.md +0 -43
  245. package/node_modules/has-property-descriptors/index.js +0 -22
  246. package/node_modules/has-property-descriptors/test/index.js +0 -57
  247. package/node_modules/set-function-length/.eslintrc +0 -27
  248. package/node_modules/set-function-length/CHANGELOG.md +0 -70
  249. package/node_modules/set-function-length/README.md +0 -56
  250. package/node_modules/set-function-length/env.d.ts +0 -9
  251. package/node_modules/set-function-length/env.js +0 -25
  252. package/node_modules/set-function-length/index.d.ts +0 -7
  253. package/node_modules/set-function-length/index.js +0 -42
  254. package/node_modules/set-function-length/package.json +0 -102
  255. /package/node_modules/{call-bind → call-bound}/.nycrc +0 -0
  256. /package/node_modules/{has-property-descriptors → get-proto}/.nycrc +0 -0
  257. /package/node_modules/{define-data-property → side-channel-list}/.nycrc +0 -0
  258. /package/node_modules/{set-function-length → side-channel-list}/tsconfig.json +0 -0
  259. /package/node_modules/{set-function-length → side-channel-map}/.nycrc +0 -0
@@ -11,6 +11,7 @@
11
11
  "GetIntrinsic",
12
12
  ],
13
13
  }],
14
+ "no-extra-parens": 0,
14
15
  "no-magic-numbers": 0,
15
16
  },
16
17
  }
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [v1.0.2](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.1...v1.0.2) - 2025-02-12
9
+
10
+ ### Commits
11
+
12
+ - [types] improve inferred types [`e6f9586`](https://github.com/ljharb/call-bind-apply-helpers/commit/e6f95860a3c72879cb861a858cdfb8138fbedec1)
13
+ - [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`e43d540`](https://github.com/ljharb/call-bind-apply-helpers/commit/e43d5409f97543bfbb11f345d47d8ce4e066d8c1)
14
+
8
15
  ## [v1.0.1](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.0...v1.0.1) - 2024-12-08
9
16
 
10
17
  ### Commits
@@ -1,46 +1,64 @@
1
1
  type RemoveFromTuple<
2
- Tuple extends unknown[],
2
+ Tuple extends readonly unknown[],
3
3
  RemoveCount extends number,
4
4
  Index extends 1[] = []
5
5
  > = Index["length"] extends RemoveCount
6
6
  ? Tuple
7
- : Tuple extends [first: unknown, ...infer Rest]
7
+ : Tuple extends [infer First, ...infer Rest]
8
8
  ? RemoveFromTuple<Rest, RemoveCount, [...Index, 1]>
9
9
  : Tuple;
10
10
 
11
11
  type ConcatTuples<
12
- Prefix extends unknown[],
13
- Suffix extends unknown[]
12
+ Prefix extends readonly unknown[],
13
+ Suffix extends readonly unknown[]
14
14
  > = [...Prefix, ...Suffix];
15
15
 
16
- type ReplaceThis<T, NewThis> = T extends (this: infer OldThis, ...args: infer A) => infer R
17
- ? (this: NewThis, ...args: A) => R
16
+ type ExtractFunctionParams<T> = T extends (this: infer TThis, ...args: infer P extends readonly unknown[]) => infer R
17
+ ? { thisArg: TThis; params: P; returnType: R }
18
18
  : never;
19
19
 
20
20
  type BindFunction<
21
+ T extends (this: any, ...args: any[]) => any,
21
22
  TThis,
22
- T extends (this: TThis, ...args: any[]) => any, // Allow specific types to propagate
23
- TBoundArgs extends unknown[],
23
+ TBoundArgs extends readonly unknown[],
24
24
  ReceiverBound extends boolean
25
- > = ReceiverBound extends true
26
- ? (...args: RemoveFromTuple<Parameters<T>, TBoundArgs["length"] & number>) => ReturnType<ReplaceThis<T, TThis>>
27
- : (...args: ConcatTuples<[TThis], RemoveFromTuple<Parameters<T>, TBoundArgs["length"] & number>>) => ReturnType<T>;
25
+ > = ExtractFunctionParams<T> extends {
26
+ thisArg: infer OrigThis;
27
+ params: infer P extends readonly unknown[];
28
+ returnType: infer R;
29
+ }
30
+ ? ReceiverBound extends true
31
+ ? (...args: RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>) => R extends [OrigThis, ...infer Rest]
32
+ ? [TThis, ...Rest] // Replace `this` with `thisArg`
33
+ : R
34
+ : <U, RemainingArgs extends RemoveFromTuple<P, Extract<TBoundArgs["length"], number>>>(
35
+ thisArg: U,
36
+ ...args: RemainingArgs
37
+ ) => R extends [OrigThis, ...infer Rest]
38
+ ? [U, ...ConcatTuples<TBoundArgs, Rest>] // Preserve bound args in return type
39
+ : R
40
+ : never;
28
41
 
29
42
  declare function callBind<
30
- TThis,
31
- T extends (this: TThis, ...args: any[]) => any,
32
- TBoundArgs extends Partial<Parameters<T>>
43
+ const T extends (this: any, ...args: any[]) => any,
44
+ Extracted extends ExtractFunctionParams<T>,
45
+ const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[],
46
+ const TThis extends Extracted["thisArg"]
33
47
  >(
34
48
  args: [fn: T, thisArg: TThis, ...boundArgs: TBoundArgs]
35
- ): BindFunction<TThis, T, TBoundArgs, true>;
49
+ ): BindFunction<T, TThis, TBoundArgs, true>;
36
50
 
37
51
  declare function callBind<
38
- TThis,
39
- T extends (this: TThis, ...args: any[]) => any,
40
- TBoundArgs extends Partial<Parameters<T>>
52
+ const T extends (this: any, ...args: any[]) => any,
53
+ Extracted extends ExtractFunctionParams<T>,
54
+ const TBoundArgs extends Partial<Extracted["params"]> & readonly unknown[]
41
55
  >(
42
56
  args: [fn: T, ...boundArgs: TBoundArgs]
43
- ): BindFunction<TThis, T, TBoundArgs, false>;
57
+ ): BindFunction<T, Extracted["thisArg"], TBoundArgs, false>;
58
+
59
+ declare function callBind<const TArgs extends readonly unknown[]>(
60
+ args: [fn: Exclude<TArgs[0], Function>, ...rest: TArgs]
61
+ ): never;
44
62
 
45
- export as namespace callBind;
63
+ // export as namespace callBind;
46
64
  export = callBind;
@@ -6,7 +6,7 @@ var $TypeError = require('es-errors/type');
6
6
  var $call = require('./functionCall');
7
7
  var $actualApply = require('./actualApply');
8
8
 
9
- /** @type {import('.')} */
9
+ /** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
10
10
  module.exports = function callBindBasic(args) {
11
11
  if (args.length < 1 || typeof args[0] !== 'function') {
12
12
  throw new $TypeError('a function is required');
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "call-bind-apply-helpers",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Helper functions around Function call/apply/bind, for use in `call-bind`",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -41,24 +41,24 @@
41
41
  "function-bind": "^1.1.2"
42
42
  },
43
43
  "devDependencies": {
44
- "@arethetypeswrong/cli": "^0.17.1",
44
+ "@arethetypeswrong/cli": "^0.17.3",
45
45
  "@ljharb/eslint-config": "^21.1.1",
46
- "@ljharb/tsconfig": "^0.2.2",
46
+ "@ljharb/tsconfig": "^0.2.3",
47
47
  "@types/for-each": "^0.3.3",
48
48
  "@types/function-bind": "^1.1.10",
49
49
  "@types/object-inspect": "^1.13.0",
50
- "@types/tape": "^5.6.5",
50
+ "@types/tape": "^5.8.1",
51
51
  "auto-changelog": "^2.5.0",
52
52
  "encoding": "^0.1.13",
53
- "es-value-fixtures": "^1.5.0",
53
+ "es-value-fixtures": "^1.7.1",
54
54
  "eslint": "=8.8.0",
55
55
  "evalmd": "^0.0.19",
56
- "for-each": "^0.3.3",
57
- "has-strict-mode": "^1.0.1",
56
+ "for-each": "^0.3.5",
57
+ "has-strict-mode": "^1.1.0",
58
58
  "in-publish": "^2.0.1",
59
59
  "npmignore": "^0.3.1",
60
60
  "nyc": "^10.3.2",
61
- "object-inspect": "^1.13.3",
61
+ "object-inspect": "^1.13.4",
62
62
  "safe-publish-latest": "^2.0.0",
63
63
  "tape": "^5.9.0",
64
64
  "typescript": "next"
@@ -19,7 +19,7 @@ test('callBindBasic', function (t) {
19
19
  });
20
20
 
21
21
  var sentinel = { sentinel: true };
22
- /** @type {<T>(this: T, a: number, b: number) => [T | undefined, number, number]} */
22
+ /** @type {<T, A extends number, B extends number>(this: T, a: A, b: B) => [T | undefined, A, B]} */
23
23
  var func = function (a, b) {
24
24
  // eslint-disable-next-line no-invalid-this
25
25
  return [!hasStrictMode && this === global ? undefined : this, a, b];
@@ -28,10 +28,10 @@ test('callBindBasic', function (t) {
28
28
 
29
29
  /** type {(thisArg: unknown, a: number, b: number) => [unknown, number, number]} */
30
30
  var bound = callBind([func]);
31
- /** type {((a: number, b: number) => [sentinel, typeof a, typeof b])} */
31
+ /** type {((a: number, b: number) => [typeof sentinel, typeof a, typeof b])} */
32
32
  var boundR = callBind([func, sentinel]);
33
- /** type {((b: number) => [sentinel, number, typeof b])} */
34
- var boundArg = callBind([func, sentinel, 1]);
33
+ /** type {((b: number) => [typeof sentinel, number, typeof b])} */
34
+ var boundArg = callBind([func, sentinel, /** @type {const} */ (1)]);
35
35
 
36
36
  // @ts-expect-error
37
37
  t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with no args');
@@ -4,13 +4,10 @@
4
4
  "extends": "@ljharb",
5
5
 
6
6
  "rules": {
7
- "func-name-matching": 0,
8
- "id-length": 0,
9
7
  "new-cap": [2, {
10
8
  "capIsNewExceptions": [
11
9
  "GetIntrinsic",
12
10
  ],
13
11
  }],
14
- "no-magic-numbers": 0,
15
12
  },
16
13
  }
@@ -4,7 +4,7 @@ github: [ljharb]
4
4
  patreon: # Replace with a single Patreon username
5
5
  open_collective: # Replace with a single Open Collective username
6
6
  ko_fi: # Replace with a single Ko-fi username
7
- tidelift: npm/define-data-property
7
+ tidelift: npm/call-bound
8
8
  community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
9
  liberapay: # Replace with a single Liberapay username
10
10
  issuehunt: # Replace with a single IssueHunt username
@@ -0,0 +1,42 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [v1.0.4](https://github.com/ljharb/call-bound/compare/v1.0.3...v1.0.4) - 2025-03-03
9
+
10
+ ### Commits
11
+
12
+ - [types] improve types [`e648922`](https://github.com/ljharb/call-bound/commit/e6489222a9e54f350fbf952ceabe51fd8b6027ff)
13
+ - [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`a42a5eb`](https://github.com/ljharb/call-bound/commit/a42a5ebe6c1b54fcdc7997c7dc64fdca9e936719)
14
+ - [Deps] update `call-bind-apply-helpers`, `get-intrinsic` [`f529eac`](https://github.com/ljharb/call-bound/commit/f529eac132404c17156bbc23ab2297a25d0f20b8)
15
+
16
+ ## [v1.0.3](https://github.com/ljharb/call-bound/compare/v1.0.2...v1.0.3) - 2024-12-15
17
+
18
+ ### Commits
19
+
20
+ - [Refactor] use `call-bind-apply-helpers` instead of `call-bind` [`5e0b134`](https://github.com/ljharb/call-bound/commit/5e0b13496df14fb7d05dae9412f088da8d3f75be)
21
+ - [Deps] update `get-intrinsic` [`41fc967`](https://github.com/ljharb/call-bound/commit/41fc96732a22c7b7e8f381f93ccc54bb6293be2e)
22
+ - [readme] fix example [`79a0137`](https://github.com/ljharb/call-bound/commit/79a0137723f7c6d09c9c05452bbf8d5efb5d6e49)
23
+ - [meta] add `sideEffects` flag [`08b07be`](https://github.com/ljharb/call-bound/commit/08b07be7f1c03f67dc6f3cdaf0906259771859f7)
24
+
25
+ ## [v1.0.2](https://github.com/ljharb/call-bound/compare/v1.0.1...v1.0.2) - 2024-12-10
26
+
27
+ ### Commits
28
+
29
+ - [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `gopd` [`e6a5ffe`](https://github.com/ljharb/call-bound/commit/e6a5ffe849368fe4f74dfd6cdeca1b9baa39e8d5)
30
+ - [Deps] update `call-bind`, `get-intrinsic` [`2aeb5b5`](https://github.com/ljharb/call-bound/commit/2aeb5b521dc2b2683d1345c753ea1161de2d1c14)
31
+ - [types] improve return type [`1a0c9fe`](https://github.com/ljharb/call-bound/commit/1a0c9fe3114471e7ca1f57d104e2efe713bb4871)
32
+
33
+ ## v1.0.1 - 2024-12-05
34
+
35
+ ### Commits
36
+
37
+ - Initial implementation, tests, readme, types [`6d94121`](https://github.com/ljharb/call-bound/commit/6d94121a9243602e506334069f7a03189fe3363d)
38
+ - Initial commit [`0eae867`](https://github.com/ljharb/call-bound/commit/0eae867334ea025c33e6e91cdecfc9df96680cf9)
39
+ - npm init [`71b2479`](https://github.com/ljharb/call-bound/commit/71b2479c6723e0b7d91a6b663613067e98b7b275)
40
+ - Only apps should have lockfiles [`c3754a9`](https://github.com/ljharb/call-bound/commit/c3754a949b7f9132b47e2d18c1729889736741eb)
41
+ - [actions] skip `npm ls` in node &lt; 10 [`74275a5`](https://github.com/ljharb/call-bound/commit/74275a5186b8caf6309b6b97472bdcb0df4683a8)
42
+ - [Dev Deps] add missing peer dep [`1354de8`](https://github.com/ljharb/call-bound/commit/1354de8679413e4ae9c523d85f76fa7a5e032d97)
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Jordan Harband
3
+ Copyright (c) 2024 Jordan Harband
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,53 @@
1
+ # call-bound <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
+
3
+ [![github actions][actions-image]][actions-url]
4
+ [![coverage][codecov-image]][codecov-url]
5
+ [![dependency status][deps-svg]][deps-url]
6
+ [![dev dependency status][dev-deps-svg]][dev-deps-url]
7
+ [![License][license-image]][license-url]
8
+ [![Downloads][downloads-image]][downloads-url]
9
+
10
+ [![npm badge][npm-badge-png]][package-url]
11
+
12
+ Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`.
13
+
14
+ ## Getting started
15
+
16
+ ```sh
17
+ npm install --save call-bound
18
+ ```
19
+
20
+ ## Usage/Examples
21
+
22
+ ```js
23
+ const assert = require('assert');
24
+ const callBound = require('call-bound');
25
+
26
+ const slice = callBound('Array.prototype.slice');
27
+
28
+ delete Function.prototype.call;
29
+ delete Function.prototype.bind;
30
+ delete Array.prototype.slice;
31
+
32
+ assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]);
33
+ ```
34
+
35
+ ## Tests
36
+
37
+ Clone the repo, `npm install`, and run `npm test`
38
+
39
+ [package-url]: https://npmjs.org/package/call-bound
40
+ [npm-version-svg]: https://versionbadg.es/ljharb/call-bound.svg
41
+ [deps-svg]: https://david-dm.org/ljharb/call-bound.svg
42
+ [deps-url]: https://david-dm.org/ljharb/call-bound
43
+ [dev-deps-svg]: https://david-dm.org/ljharb/call-bound/dev-status.svg
44
+ [dev-deps-url]: https://david-dm.org/ljharb/call-bound#info=devDependencies
45
+ [npm-badge-png]: https://nodei.co/npm/call-bound.png?downloads=true&stars=true
46
+ [license-image]: https://img.shields.io/npm/l/call-bound.svg
47
+ [license-url]: LICENSE
48
+ [downloads-image]: https://img.shields.io/npm/dm/call-bound.svg
49
+ [downloads-url]: https://npm-stat.com/charts.html?package=call-bound
50
+ [codecov-image]: https://codecov.io/gh/ljharb/call-bound/branch/main/graphs/badge.svg
51
+ [codecov-url]: https://app.codecov.io/gh/ljharb/call-bound/
52
+ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bound
53
+ [actions-url]: https://github.com/ljharb/call-bound/actions
@@ -0,0 +1,94 @@
1
+ type Intrinsic = typeof globalThis;
2
+
3
+ type IntrinsicName = keyof Intrinsic | `%${keyof Intrinsic}%`;
4
+
5
+ type IntrinsicPath = IntrinsicName | `${StripPercents<IntrinsicName>}.${string}` | `%${StripPercents<IntrinsicName>}.${string}%`;
6
+
7
+ type AllowMissing = boolean;
8
+
9
+ type StripPercents<T extends string> = T extends `%${infer U}%` ? U : T;
10
+
11
+ type BindMethodPrecise<F> =
12
+ F extends (this: infer This, ...args: infer Args) => infer R
13
+ ? (obj: This, ...args: Args) => R
14
+ : F extends {
15
+ (this: infer This1, ...args: infer Args1): infer R1;
16
+ (this: infer This2, ...args: infer Args2): infer R2
17
+ }
18
+ ? {
19
+ (obj: This1, ...args: Args1): R1;
20
+ (obj: This2, ...args: Args2): R2
21
+ }
22
+ : never
23
+
24
+ // Extract method type from a prototype
25
+ type GetPrototypeMethod<T extends keyof typeof globalThis, M extends string> =
26
+ (typeof globalThis)[T] extends { prototype: any }
27
+ ? M extends keyof (typeof globalThis)[T]['prototype']
28
+ ? (typeof globalThis)[T]['prototype'][M]
29
+ : never
30
+ : never
31
+
32
+ // Get static property/method
33
+ type GetStaticMember<T extends keyof typeof globalThis, P extends string> =
34
+ P extends keyof (typeof globalThis)[T] ? (typeof globalThis)[T][P] : never
35
+
36
+ // Type that maps string path to actual bound function or value with better precision
37
+ type BoundIntrinsic<S extends string> =
38
+ S extends `${infer Obj}.prototype.${infer Method}`
39
+ ? Obj extends keyof typeof globalThis
40
+ ? BindMethodPrecise<GetPrototypeMethod<Obj, Method & string>>
41
+ : unknown
42
+ : S extends `${infer Obj}.${infer Prop}`
43
+ ? Obj extends keyof typeof globalThis
44
+ ? GetStaticMember<Obj, Prop & string>
45
+ : unknown
46
+ : unknown
47
+
48
+ declare function arraySlice<T>(array: readonly T[], start?: number, end?: number): T[];
49
+ declare function arraySlice<T>(array: ArrayLike<T>, start?: number, end?: number): T[];
50
+ declare function arraySlice<T>(array: IArguments, start?: number, end?: number): T[];
51
+
52
+ // Special cases for methods that need explicit typing
53
+ interface SpecialCases {
54
+ '%Object.prototype.isPrototypeOf%': (thisArg: {}, obj: unknown) => boolean;
55
+ '%String.prototype.replace%': {
56
+ (str: string, searchValue: string | RegExp, replaceValue: string): string;
57
+ (str: string, searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string
58
+ };
59
+ '%Object.prototype.toString%': (obj: {}) => string;
60
+ '%Object.prototype.hasOwnProperty%': (obj: {}, v: PropertyKey) => boolean;
61
+ '%Array.prototype.slice%': typeof arraySlice;
62
+ '%Array.prototype.map%': <T, U>(array: readonly T[], callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any) => U[];
63
+ '%Array.prototype.filter%': <T>(array: readonly T[], predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any) => T[];
64
+ '%Array.prototype.indexOf%': <T>(array: readonly T[], searchElement: T, fromIndex?: number) => number;
65
+ '%Function.prototype.apply%': <T, A extends any[], R>(fn: (...args: A) => R, thisArg: any, args: A) => R;
66
+ '%Function.prototype.call%': <T, A extends any[], R>(fn: (...args: A) => R, thisArg: any, ...args: A) => R;
67
+ '%Function.prototype.bind%': <T, A extends any[], R>(fn: (...args: A) => R, thisArg: any, ...args: A) => (...remainingArgs: A) => R;
68
+ '%Promise.prototype.then%': {
69
+ <T, R>(promise: Promise<T>, onfulfilled: (value: T) => R | PromiseLike<R>): Promise<R>;
70
+ <T, R>(promise: Promise<T>, onfulfilled: ((value: T) => R | PromiseLike<R>) | undefined | null, onrejected: (reason: any) => R | PromiseLike<R>): Promise<R>;
71
+ };
72
+ '%RegExp.prototype.test%': (regexp: RegExp, str: string) => boolean;
73
+ '%RegExp.prototype.exec%': (regexp: RegExp, str: string) => RegExpExecArray | null;
74
+ '%Error.prototype.toString%': (error: Error) => string;
75
+ '%TypeError.prototype.toString%': (error: TypeError) => string;
76
+ '%String.prototype.split%': (
77
+ obj: unknown,
78
+ splitter: string | RegExp | {
79
+ [Symbol.split](string: string, limit?: number): string[];
80
+ },
81
+ limit?: number | undefined
82
+ ) => string[];
83
+ }
84
+
85
+ /**
86
+ * Returns a bound function for a prototype method, or a value for a static property.
87
+ *
88
+ * @param name - The name of the intrinsic (e.g. 'Array.prototype.slice')
89
+ * @param {AllowMissing} [allowMissing] - Whether to allow missing intrinsics (default: false)
90
+ */
91
+ declare function callBound<K extends keyof SpecialCases | StripPercents<keyof SpecialCases>, S extends IntrinsicPath>(name: K, allowMissing?: AllowMissing): SpecialCases[`%${StripPercents<K>}%`];
92
+ declare function callBound<K extends keyof SpecialCases | StripPercents<keyof SpecialCases>, S extends IntrinsicPath>(name: S, allowMissing?: AllowMissing): BoundIntrinsic<S>;
93
+
94
+ export = callBound;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ var GetIntrinsic = require('get-intrinsic');
4
+
5
+ var callBindBasic = require('call-bind-apply-helpers');
6
+
7
+ /** @type {(thisArg: string, searchString: string, position?: number) => number} */
8
+ var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
9
+
10
+ /** @type {import('.')} */
11
+ module.exports = function callBoundIntrinsic(name, allowMissing) {
12
+ /* eslint no-extra-parens: 0 */
13
+
14
+ var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
15
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
16
+ return callBindBasic(/** @type {const} */ ([intrinsic]));
17
+ }
18
+ return intrinsic;
19
+ };
@@ -1,19 +1,20 @@
1
1
  {
2
- "name": "call-bind",
3
- "version": "1.0.8",
4
- "description": "Robustly `.call.bind()` a function",
2
+ "name": "call-bound",
3
+ "version": "1.0.4",
4
+ "description": "Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`.",
5
5
  "main": "index.js",
6
6
  "exports": {
7
7
  ".": "./index.js",
8
- "./callBound": "./callBound.js",
9
8
  "./package.json": "./package.json"
10
9
  },
10
+ "sideEffects": false,
11
11
  "scripts": {
12
12
  "prepack": "npmignore --auto --commentLines=auto",
13
13
  "prepublish": "not-in-publish || npm run prepublishOnly",
14
14
  "prepublishOnly": "safe-publish-latest",
15
+ "prelint": "evalmd README.md",
15
16
  "lint": "eslint --ext=.js,.mjs .",
16
- "postlint": "evalmd README.md",
17
+ "postlint": "tsc -p . && attw -P",
17
18
  "pretest": "npm run lint",
18
19
  "tests-only": "nyc tape 'test/**/*.js'",
19
20
  "test": "npm run tests-only",
@@ -23,7 +24,7 @@
23
24
  },
24
25
  "repository": {
25
26
  "type": "git",
26
- "url": "git+https://github.com/ljharb/call-bind.git"
27
+ "url": "git+https://github.com/ljharb/call-bound.git"
27
28
  },
28
29
  "keywords": [
29
30
  "javascript",
@@ -46,30 +47,35 @@
46
47
  },
47
48
  "license": "MIT",
48
49
  "bugs": {
49
- "url": "https://github.com/ljharb/call-bind/issues"
50
+ "url": "https://github.com/ljharb/call-bound/issues"
50
51
  },
51
- "homepage": "https://github.com/ljharb/call-bind#readme",
52
+ "homepage": "https://github.com/ljharb/call-bound#readme",
52
53
  "dependencies": {
53
- "call-bind-apply-helpers": "^1.0.0",
54
- "es-define-property": "^1.0.0",
55
- "get-intrinsic": "^1.2.4",
56
- "set-function-length": "^1.2.2"
54
+ "call-bind-apply-helpers": "^1.0.2",
55
+ "get-intrinsic": "^1.3.0"
57
56
  },
58
57
  "devDependencies": {
58
+ "@arethetypeswrong/cli": "^0.17.4",
59
59
  "@ljharb/eslint-config": "^21.1.1",
60
+ "@ljharb/tsconfig": "^0.3.0",
61
+ "@types/call-bind": "^1.0.5",
62
+ "@types/get-intrinsic": "^1.2.3",
63
+ "@types/tape": "^5.8.1",
60
64
  "auto-changelog": "^2.5.0",
61
65
  "encoding": "^0.1.13",
62
- "es-value-fixtures": "^1.5.0",
66
+ "es-value-fixtures": "^1.7.1",
63
67
  "eslint": "=8.8.0",
64
68
  "evalmd": "^0.0.19",
65
- "for-each": "^0.3.3",
66
- "has-strict-mode": "^1.0.1",
69
+ "for-each": "^0.3.5",
70
+ "gopd": "^1.2.0",
71
+ "has-strict-mode": "^1.1.0",
67
72
  "in-publish": "^2.0.1",
68
73
  "npmignore": "^0.3.1",
69
74
  "nyc": "^10.3.2",
70
- "object-inspect": "^1.13.3",
75
+ "object-inspect": "^1.13.4",
71
76
  "safe-publish-latest": "^2.0.0",
72
- "tape": "^5.9.0"
77
+ "tape": "^5.9.0",
78
+ "typescript": "next"
73
79
  },
74
80
  "testling": {
75
81
  "files": "test/index.js"
@@ -2,7 +2,9 @@
2
2
 
3
3
  var test = require('tape');
4
4
 
5
- var callBound = require('../callBound');
5
+ var callBound = require('../');
6
+
7
+ /** @template {true} T @template U @typedef {T extends U ? T : never} AssertType */
6
8
 
7
9
  test('callBound', function (t) {
8
10
  // static primitive
@@ -23,18 +25,23 @@ test('callBound', function (t) {
23
25
  t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself');
24
26
  t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself');
25
27
 
28
+ var x = callBound('Object.prototype.toString');
29
+ var y = callBound('%Object.prototype.toString%');
30
+
26
31
  // prototype function
27
- t.notEqual(callBound('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString does not yield itself');
28
- t.notEqual(callBound('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% does not yield itself');
29
- t.equal(callBound('Object.prototype.toString')(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original');
30
- t.equal(callBound('%Object.prototype.toString%')(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original');
32
+ t.notEqual(x, Object.prototype.toString, 'Object.prototype.toString does not yield itself');
33
+ t.notEqual(y, Object.prototype.toString, '%Object.prototype.toString% does not yield itself');
34
+ t.equal(x(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original');
35
+ t.equal(y(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original');
31
36
 
32
37
  t['throws'](
38
+ // @ts-expect-error
33
39
  function () { callBound('does not exist'); },
34
40
  SyntaxError,
35
41
  'nonexistent intrinsic throws'
36
42
  );
37
43
  t['throws'](
44
+ // @ts-expect-error
38
45
  function () { callBound('does not exist', true); },
39
46
  SyntaxError,
40
47
  'allowMissing arg still throws for unknown intrinsic'
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "@ljharb/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "ESNext",
5
+ "lib": ["es2024"],
6
+ },
7
+ "exclude": [
8
+ "coverage",
9
+ ],
10
+ }
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [v1.0.1](https://github.com/es-shims/dunder-proto/compare/v1.0.0...v1.0.1) - 2024-12-16
9
+
10
+ ### Commits
11
+
12
+ - [Fix] do not crash when `--disable-proto=throw` [`6c367d9`](https://github.com/es-shims/dunder-proto/commit/6c367d919bc1604778689a297bbdbfea65752847)
13
+ - [Tests] ensure noproto tests only use the current version of dunder-proto [`b02365b`](https://github.com/es-shims/dunder-proto/commit/b02365b9cf889c4a2cac7be0c3cfc90a789af36c)
14
+ - [Dev Deps] update `@arethetypeswrong/cli`, `@types/tape` [`e3c5c3b`](https://github.com/es-shims/dunder-proto/commit/e3c5c3bd81cf8cef7dff2eca19e558f0e307f666)
15
+ - [Deps] update `call-bind-apply-helpers` [`19f1da0`](https://github.com/es-shims/dunder-proto/commit/19f1da028b8dd0d05c85bfd8f7eed2819b686450)
16
+
8
17
  ## v1.0.0 - 2024-12-06
9
18
 
10
19
  ### Commits
@@ -3,11 +3,18 @@
3
3
  var callBind = require('call-bind-apply-helpers');
4
4
  var gOPD = require('gopd');
5
5
 
6
- // eslint-disable-next-line no-extra-parens, no-proto
7
- var hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
6
+ var hasProtoAccessor;
7
+ try {
8
+ // eslint-disable-next-line no-extra-parens, no-proto
9
+ hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
10
+ } catch (e) {
11
+ if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
12
+ throw e;
13
+ }
14
+ }
8
15
 
9
16
  // eslint-disable-next-line no-extra-parens
10
- var desc = hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
17
+ var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
11
18
 
12
19
  var $Object = Object;
13
20
  var $getPrototypeOf = $Object.getPrototypeOf;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dunder-proto",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "If available, the `Object.prototype.__proto__` accessor and mutator, call-bound",
5
5
  "main": false,
6
6
  "exports": {
@@ -34,15 +34,15 @@
34
34
  },
35
35
  "homepage": "https://github.com/es-shims/dunder-proto#readme",
36
36
  "dependencies": {
37
- "call-bind-apply-helpers": "^1.0.0",
37
+ "call-bind-apply-helpers": "^1.0.1",
38
38
  "es-errors": "^1.3.0",
39
39
  "gopd": "^1.2.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@arethetypeswrong/cli": "^0.17.0",
42
+ "@arethetypeswrong/cli": "^0.17.1",
43
43
  "@ljharb/eslint-config": "^21.1.1",
44
44
  "@ljharb/tsconfig": "^0.2.2",
45
- "@types/tape": "^5.6.5",
45
+ "@types/tape": "^5.7.0",
46
46
  "auto-changelog": "^2.5.0",
47
47
  "encoding": "^0.1.13",
48
48
  "eslint": "=8.8.0",
@@ -6,7 +6,13 @@ var $TypeError = require('es-errors/type');
6
6
 
7
7
  /** @type {{ __proto__?: object | null }} */
8
8
  var obj = {};
9
- obj.__proto__ = null; // eslint-disable-line no-proto
9
+ try {
10
+ obj.__proto__ = null; // eslint-disable-line no-proto
11
+ } catch (e) {
12
+ if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
13
+ throw e;
14
+ }
15
+ }
10
16
 
11
17
  var hasProtoMutator = !('toString' in obj);
12
18