cdk-common 2.0.1120 → 2.0.1122

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.
package/.jsii CHANGED
@@ -11796,6 +11796,6 @@
11796
11796
  "symbolId": "src/main:LambdaArmFunctionProps"
11797
11797
  }
11798
11798
  },
11799
- "version": "2.0.1120",
11800
- "fingerprint": "xCgxwP5ZrxnWC5vIO0x4RzWCHLfnPO3VMjbOdEmDUL0="
11799
+ "version": "2.0.1122",
11800
+ "fingerprint": "oO83xTt0PywgBmHrR+2c/v93+hzBDbBmyZXNoZr+1nU="
11801
11801
  }
package/lib/main.js CHANGED
@@ -41,5 +41,5 @@ class LambdaArmFunction extends constructs_1.Construct {
41
41
  }
42
42
  exports.LambdaArmFunction = LambdaArmFunction;
43
43
  _a = JSII_RTTI_SYMBOL_1;
44
- LambdaArmFunction[_a] = { fqn: "cdk-common.LambdaArmFunction", version: "2.0.1120" };
44
+ LambdaArmFunction[_a] = { fqn: "cdk-common.LambdaArmFunction", version: "2.0.1122" };
45
45
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsbUNBQW1DO0FBQ25DLGlEQUFpRDtBQUNqRCwyQ0FBdUM7QUFLdkMsTUFBYSxpQkFBa0IsU0FBUSxzQkFBUztJQUU5QyxZQUFZLEtBQWdCLEVBQUUsRUFBVSxFQUFFLEtBQTRCO1FBQ3BFLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLENBQUM7UUFFakIsSUFBSSxLQUFLLENBQUMsT0FBTyxLQUFLLE1BQU0sQ0FBQyxPQUFPLENBQUMsV0FBVyxFQUFFLENBQUM7WUFDakQsR0FBRyxDQUFDLFdBQVcsQ0FBQyxFQUF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HRoaXMsICdMYW1iZGFGdW5jdGlvbicsIHsgYXJjaGl0ZWN0dXJlOiBsYW1iZGEuQXJjaGl0ZWN0dXJlLkFSTV82NCwgLi4ucHJvcHMgfSk7XG4gIH1cbn0iXX0=
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sat, 01 Mar 2025 06:37:25 GMT
11
+ * Last updated: Mon, 03 Mar 2025 18:02:26 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -682,9 +682,10 @@ declare module "crypto" {
682
682
  */
683
683
  type: KeyObjectType;
684
684
  }
685
- type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305";
685
+ type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm";
686
686
  type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
687
687
  type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb";
688
+ type CipherChaCha20Poly1305Types = "chacha20-poly1305";
688
689
  type BinaryLike = string | NodeJS.ArrayBufferView;
689
690
  type CipherKey = BinaryLike | KeyObject;
690
691
  interface CipherCCMOptions extends stream.TransformOptions {
@@ -696,6 +697,10 @@ declare module "crypto" {
696
697
  interface CipherOCBOptions extends stream.TransformOptions {
697
698
  authTagLength: number;
698
699
  }
700
+ interface CipherChaCha20Poly1305Options extends stream.TransformOptions {
701
+ /** @default 16 */
702
+ authTagLength?: number | undefined;
703
+ }
699
704
  /**
700
705
  * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and
701
706
  * initialization vector (`iv`).
@@ -744,6 +749,12 @@ declare module "crypto" {
744
749
  iv: BinaryLike,
745
750
  options?: CipherGCMOptions,
746
751
  ): CipherGCM;
752
+ function createCipheriv(
753
+ algorithm: CipherChaCha20Poly1305Types,
754
+ key: CipherKey,
755
+ iv: BinaryLike,
756
+ options?: CipherChaCha20Poly1305Options,
757
+ ): CipherChaCha20Poly1305;
747
758
  function createCipheriv(
748
759
  algorithm: string,
749
760
  key: CipherKey,
@@ -943,6 +954,15 @@ declare module "crypto" {
943
954
  ): this;
944
955
  getAuthTag(): Buffer;
945
956
  }
957
+ interface CipherChaCha20Poly1305 extends Cipher {
958
+ setAAD(
959
+ buffer: NodeJS.ArrayBufferView,
960
+ options: {
961
+ plaintextLength: number;
962
+ },
963
+ ): this;
964
+ getAuthTag(): Buffer;
965
+ }
946
966
  /**
947
967
  * Creates and returns a `Decipher` object that uses the given `algorithm`, `key` and initialization vector (`iv`).
948
968
  *
@@ -990,6 +1010,12 @@ declare module "crypto" {
990
1010
  iv: BinaryLike,
991
1011
  options?: CipherGCMOptions,
992
1012
  ): DecipherGCM;
1013
+ function createDecipheriv(
1014
+ algorithm: CipherChaCha20Poly1305Types,
1015
+ key: CipherKey,
1016
+ iv: BinaryLike,
1017
+ options?: CipherChaCha20Poly1305Options,
1018
+ ): DecipherChaCha20Poly1305;
993
1019
  function createDecipheriv(
994
1020
  algorithm: string,
995
1021
  key: CipherKey,
@@ -1175,6 +1201,15 @@ declare module "crypto" {
1175
1201
  },
1176
1202
  ): this;
1177
1203
  }
1204
+ interface DecipherChaCha20Poly1305 extends Decipher {
1205
+ setAuthTag(buffer: NodeJS.ArrayBufferView): this;
1206
+ setAAD(
1207
+ buffer: NodeJS.ArrayBufferView,
1208
+ options: {
1209
+ plaintextLength: number;
1210
+ },
1211
+ ): this;
1212
+ }
1178
1213
  interface PrivateKeyInput {
1179
1214
  key: string | Buffer;
1180
1215
  format?: KeyFormat | undefined;
@@ -325,9 +325,9 @@ declare module "module" {
325
325
  }
326
326
  interface ResolveFnOutput {
327
327
  /**
328
- * A hint to the load hook (it might be ignored)
328
+ * A hint to the load hook (it might be ignored); can be an intermediary value.
329
329
  */
330
- format?: ModuleFormat | null | undefined;
330
+ format?: string | null | undefined;
331
331
  /**
332
332
  * The import attributes to use when caching the module (optional; if excluded the input will be used)
333
333
  */
@@ -365,9 +365,9 @@ declare module "module" {
365
365
  */
366
366
  conditions: string[];
367
367
  /**
368
- * The format optionally supplied by the `resolve` hook chain
368
+ * The format optionally supplied by the `resolve` hook chain (can be an intermediary value).
369
369
  */
370
- format: ModuleFormat | null | undefined;
370
+ format: string | null | undefined;
371
371
  /**
372
372
  * An object whose key-value pairs represent the assertions for the module to import
373
373
  */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.13.8",
3
+ "version": "22.13.9",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -215,6 +215,6 @@
215
215
  "undici-types": "~6.20.0"
216
216
  },
217
217
  "peerDependencies": {},
218
- "typesPublisherContentHash": "5bedf97bc7316e968d26ed4056ab5980a72db818c2493f707d9cc1f728b11c88",
218
+ "typesPublisherContentHash": "2b83897c50ee990a9f146cb799600cf7a81a0c37cd361aa688bb2c576b847048",
219
219
  "typeScriptVersion": "5.0"
220
220
  }
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sat, 01 Mar 2025 06:37:25 GMT
11
+ * Last updated: Mon, 03 Mar 2025 18:02:26 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -682,9 +682,10 @@ declare module "crypto" {
682
682
  */
683
683
  type: KeyObjectType;
684
684
  }
685
- type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305";
685
+ type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm";
686
686
  type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
687
687
  type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb";
688
+ type CipherChaCha20Poly1305Types = "chacha20-poly1305";
688
689
  type BinaryLike = string | NodeJS.ArrayBufferView;
689
690
  type CipherKey = BinaryLike | KeyObject;
690
691
  interface CipherCCMOptions extends stream.TransformOptions {
@@ -696,6 +697,10 @@ declare module "crypto" {
696
697
  interface CipherOCBOptions extends stream.TransformOptions {
697
698
  authTagLength: number;
698
699
  }
700
+ interface CipherChaCha20Poly1305Options extends stream.TransformOptions {
701
+ /** @default 16 */
702
+ authTagLength?: number | undefined;
703
+ }
699
704
  /**
700
705
  * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and
701
706
  * initialization vector (`iv`).
@@ -744,6 +749,12 @@ declare module "crypto" {
744
749
  iv: BinaryLike,
745
750
  options?: CipherGCMOptions,
746
751
  ): CipherGCM;
752
+ function createCipheriv(
753
+ algorithm: CipherChaCha20Poly1305Types,
754
+ key: CipherKey,
755
+ iv: BinaryLike,
756
+ options?: CipherChaCha20Poly1305Options,
757
+ ): CipherChaCha20Poly1305;
747
758
  function createCipheriv(
748
759
  algorithm: string,
749
760
  key: CipherKey,
@@ -943,6 +954,15 @@ declare module "crypto" {
943
954
  ): this;
944
955
  getAuthTag(): Buffer;
945
956
  }
957
+ interface CipherChaCha20Poly1305 extends Cipher {
958
+ setAAD(
959
+ buffer: NodeJS.ArrayBufferView,
960
+ options: {
961
+ plaintextLength: number;
962
+ },
963
+ ): this;
964
+ getAuthTag(): Buffer;
965
+ }
946
966
  /**
947
967
  * Creates and returns a `Decipher` object that uses the given `algorithm`, `key` and initialization vector (`iv`).
948
968
  *
@@ -990,6 +1010,12 @@ declare module "crypto" {
990
1010
  iv: BinaryLike,
991
1011
  options?: CipherGCMOptions,
992
1012
  ): DecipherGCM;
1013
+ function createDecipheriv(
1014
+ algorithm: CipherChaCha20Poly1305Types,
1015
+ key: CipherKey,
1016
+ iv: BinaryLike,
1017
+ options?: CipherChaCha20Poly1305Options,
1018
+ ): DecipherChaCha20Poly1305;
993
1019
  function createDecipheriv(
994
1020
  algorithm: string,
995
1021
  key: CipherKey,
@@ -1175,6 +1201,15 @@ declare module "crypto" {
1175
1201
  },
1176
1202
  ): this;
1177
1203
  }
1204
+ interface DecipherChaCha20Poly1305 extends Decipher {
1205
+ setAuthTag(buffer: NodeJS.ArrayBufferView): this;
1206
+ setAAD(
1207
+ buffer: NodeJS.ArrayBufferView,
1208
+ options: {
1209
+ plaintextLength: number;
1210
+ },
1211
+ ): this;
1212
+ }
1178
1213
  interface PrivateKeyInput {
1179
1214
  key: string | Buffer;
1180
1215
  format?: KeyFormat | undefined;
@@ -325,9 +325,9 @@ declare module "module" {
325
325
  }
326
326
  interface ResolveFnOutput {
327
327
  /**
328
- * A hint to the load hook (it might be ignored)
328
+ * A hint to the load hook (it might be ignored); can be an intermediary value.
329
329
  */
330
- format?: ModuleFormat | null | undefined;
330
+ format?: string | null | undefined;
331
331
  /**
332
332
  * The import attributes to use when caching the module (optional; if excluded the input will be used)
333
333
  */
@@ -365,9 +365,9 @@ declare module "module" {
365
365
  */
366
366
  conditions: string[];
367
367
  /**
368
- * The format optionally supplied by the `resolve` hook chain
368
+ * The format optionally supplied by the `resolve` hook chain (can be an intermediary value).
369
369
  */
370
- format: ModuleFormat | null | undefined;
370
+ format: string | null | undefined;
371
371
  /**
372
372
  * An object whose key-value pairs represent the assertions for the module to import
373
373
  */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "22.13.8",
3
+ "version": "22.13.9",
4
4
  "description": "TypeScript definitions for node",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -215,6 +215,6 @@
215
215
  "undici-types": "~6.20.0"
216
216
  },
217
217
  "peerDependencies": {},
218
- "typesPublisherContentHash": "5bedf97bc7316e968d26ed4056ab5980a72db818c2493f707d9cc1f728b11c88",
218
+ "typesPublisherContentHash": "2b83897c50ee990a9f146cb799600cf7a81a0c37cd361aa688bb2c576b847048",
219
219
  "typeScriptVersion": "5.0"
220
220
  }
@@ -5,6 +5,14 @@ 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.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
+
8
16
  ## [v1.0.3](https://github.com/ljharb/call-bound/compare/v1.0.2...v1.0.3) - 2024-12-15
9
17
 
10
18
  ### Commits
@@ -1,13 +1,94 @@
1
- import callBind from 'call-bind-apply-helpers';
1
+ type Intrinsic = typeof globalThis;
2
2
 
3
- declare function callBoundIntrinsic(
4
- name: string,
5
- allowMissing?: false
6
- ): ReturnType<typeof callBind>;
3
+ type IntrinsicName = keyof Intrinsic | `%${keyof Intrinsic}%`;
7
4
 
8
- declare function callBoundIntrinsic(
9
- name: string,
10
- allowMissing: true
11
- ): undefined | ReturnType<typeof callBind>;
5
+ type IntrinsicPath = IntrinsicName | `${StripPercents<IntrinsicName>}.${string}` | `%${StripPercents<IntrinsicName>}.${string}%`;
12
6
 
13
- export = callBoundIntrinsic;
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;
@@ -9,10 +9,11 @@ var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
9
9
 
10
10
  /** @type {import('.')} */
11
11
  module.exports = function callBoundIntrinsic(name, allowMissing) {
12
- // eslint-disable-next-line no-extra-parens
13
- var intrinsic = /** @type {Parameters<typeof callBindBasic>[0][0]} */ (GetIntrinsic(name, !!allowMissing));
12
+ /* eslint no-extra-parens: 0 */
13
+
14
+ var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
14
15
  if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
15
- return callBindBasic([intrinsic]);
16
+ return callBindBasic(/** @type {const} */ ([intrinsic]));
16
17
  }
17
18
  return intrinsic;
18
19
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "call-bound",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Robust call-bound JavaScript intrinsics, using `call-bind` and `get-intrinsic`.",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -51,28 +51,28 @@
51
51
  },
52
52
  "homepage": "https://github.com/ljharb/call-bound#readme",
53
53
  "dependencies": {
54
- "call-bind-apply-helpers": "^1.0.1",
55
- "get-intrinsic": "^1.2.6"
54
+ "call-bind-apply-helpers": "^1.0.2",
55
+ "get-intrinsic": "^1.3.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@arethetypeswrong/cli": "^0.17.1",
58
+ "@arethetypeswrong/cli": "^0.17.4",
59
59
  "@ljharb/eslint-config": "^21.1.1",
60
- "@ljharb/tsconfig": "^0.2.2",
60
+ "@ljharb/tsconfig": "^0.3.0",
61
61
  "@types/call-bind": "^1.0.5",
62
62
  "@types/get-intrinsic": "^1.2.3",
63
- "@types/tape": "^5.6.5",
63
+ "@types/tape": "^5.8.1",
64
64
  "auto-changelog": "^2.5.0",
65
65
  "encoding": "^0.1.13",
66
- "es-value-fixtures": "^1.5.0",
66
+ "es-value-fixtures": "^1.7.1",
67
67
  "eslint": "=8.8.0",
68
68
  "evalmd": "^0.0.19",
69
- "for-each": "^0.3.3",
69
+ "for-each": "^0.3.5",
70
70
  "gopd": "^1.2.0",
71
- "has-strict-mode": "^1.0.1",
71
+ "has-strict-mode": "^1.1.0",
72
72
  "in-publish": "^2.0.1",
73
73
  "npmignore": "^0.3.1",
74
74
  "nyc": "^10.3.2",
75
- "object-inspect": "^1.13.3",
75
+ "object-inspect": "^1.13.4",
76
76
  "safe-publish-latest": "^2.0.0",
77
77
  "tape": "^5.9.0",
78
78
  "typescript": "next"
@@ -4,6 +4,8 @@ var test = require('tape');
4
4
 
5
5
  var callBound = require('../');
6
6
 
7
+ /** @template {true} T @template U @typedef {T extends U ? T : never} AssertType */
8
+
7
9
  test('callBound', function (t) {
8
10
  // static primitive
9
11
  t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself');
@@ -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'
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "extends": "@ljharb/tsconfig",
3
3
  "compilerOptions": {
4
- "target": "es2021",
4
+ "target": "ESNext",
5
+ "lib": ["es2024"],
5
6
  },
6
7
  "exclude": [
7
8
  "coverage",
package/package.json CHANGED
@@ -55,7 +55,7 @@
55
55
  "jsii-docgen": "^10.5.0",
56
56
  "jsii-pacmak": "^1.108.0",
57
57
  "jsii-rosetta": "5.3.x",
58
- "projen": "0.91.13",
58
+ "projen": "0.91.14",
59
59
  "ts-jest": "^27",
60
60
  "typescript": "^5"
61
61
  },
@@ -88,7 +88,7 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "version": "2.0.1120",
91
+ "version": "2.0.1122",
92
92
  "jest": {
93
93
  "coverageProvider": "v8",
94
94
  "testMatch": [