step-node-agent 3.26.5-customized-j → 3.27.0
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/node_modules/call-bind-apply-helpers/.eslintrc +1 -0
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +7 -0
- package/node_modules/call-bind-apply-helpers/index.d.ts +38 -20
- package/node_modules/call-bind-apply-helpers/index.js +1 -1
- package/node_modules/call-bind-apply-helpers/package.json +8 -8
- package/node_modules/call-bind-apply-helpers/test/index.js +4 -4
- package/node_modules/call-bound/CHANGELOG.md +8 -0
- package/node_modules/call-bound/index.d.ts +91 -10
- package/node_modules/call-bound/index.js +4 -3
- package/node_modules/call-bound/package.json +10 -10
- package/node_modules/call-bound/test/index.js +11 -4
- package/node_modules/call-bound/tsconfig.json +2 -1
- package/node_modules/get-intrinsic/.eslintrc +4 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +8 -0
- package/node_modules/get-intrinsic/index.js +1 -0
- package/node_modules/get-intrinsic/package.json +8 -8
- package/node_modules/object-inspect/CHANGELOG.md +8 -0
- package/node_modules/object-inspect/index.js +10 -7
- package/node_modules/object-inspect/package.json +5 -4
- package/node_modules/object-inspect/test/values.js +50 -0
- package/package.json +1 -1
|
@@ -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 [
|
|
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
|
|
17
|
-
?
|
|
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
|
-
|
|
23
|
-
TBoundArgs extends unknown[],
|
|
23
|
+
TBoundArgs extends readonly unknown[],
|
|
24
24
|
ReceiverBound extends boolean
|
|
25
|
-
> =
|
|
26
|
-
|
|
27
|
-
:
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
TBoundArgs extends Partial<
|
|
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<
|
|
49
|
+
): BindFunction<T, TThis, TBoundArgs, true>;
|
|
36
50
|
|
|
37
51
|
declare function callBind<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
TBoundArgs extends Partial<
|
|
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<
|
|
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.
|
|
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.
|
|
44
|
+
"@arethetypeswrong/cli": "^0.17.3",
|
|
45
45
|
"@ljharb/eslint-config": "^21.1.1",
|
|
46
|
-
"@ljharb/tsconfig": "^0.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.
|
|
50
|
+
"@types/tape": "^5.8.1",
|
|
51
51
|
"auto-changelog": "^2.5.0",
|
|
52
52
|
"encoding": "^0.1.13",
|
|
53
|
-
"es-value-fixtures": "^1.
|
|
53
|
+
"es-value-fixtures": "^1.7.1",
|
|
54
54
|
"eslint": "=8.8.0",
|
|
55
55
|
"evalmd": "^0.0.19",
|
|
56
|
-
"for-each": "^0.3.
|
|
57
|
-
"has-strict-mode": "^1.0
|
|
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.
|
|
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:
|
|
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');
|
|
@@ -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
|
-
|
|
1
|
+
type Intrinsic = typeof globalThis;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
name: string,
|
|
5
|
-
allowMissing?: false
|
|
6
|
-
): ReturnType<typeof callBind>;
|
|
3
|
+
type IntrinsicName = keyof Intrinsic | `%${keyof Intrinsic}%`;
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
name: string,
|
|
10
|
-
allowMissing: true
|
|
11
|
-
): undefined | ReturnType<typeof callBind>;
|
|
5
|
+
type IntrinsicPath = IntrinsicName | `${StripPercents<IntrinsicName>}.${string}` | `%${StripPercents<IntrinsicName>}.${string}%`;
|
|
12
6
|
|
|
13
|
-
|
|
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
|
-
|
|
13
|
-
|
|
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
|
+
"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.
|
|
55
|
-
"get-intrinsic": "^1.
|
|
54
|
+
"call-bind-apply-helpers": "^1.0.2",
|
|
55
|
+
"get-intrinsic": "^1.3.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@arethetypeswrong/cli": "^0.17.
|
|
58
|
+
"@arethetypeswrong/cli": "^0.17.4",
|
|
59
59
|
"@ljharb/eslint-config": "^21.1.1",
|
|
60
|
-
"@ljharb/tsconfig": "^0.
|
|
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.
|
|
63
|
+
"@types/tape": "^5.8.1",
|
|
64
64
|
"auto-changelog": "^2.5.0",
|
|
65
65
|
"encoding": "^0.1.13",
|
|
66
|
-
"es-value-fixtures": "^1.
|
|
66
|
+
"es-value-fixtures": "^1.7.1",
|
|
67
67
|
"eslint": "=8.8.0",
|
|
68
68
|
"evalmd": "^0.0.19",
|
|
69
|
-
"for-each": "^0.3.
|
|
69
|
+
"for-each": "^0.3.5",
|
|
70
70
|
"gopd": "^1.2.0",
|
|
71
|
-
"has-strict-mode": "^1.0
|
|
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.
|
|
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(
|
|
28
|
-
t.notEqual(
|
|
29
|
-
t.equal(
|
|
30
|
-
t.equal(
|
|
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'
|
|
@@ -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.3.0](https://github.com/ljharb/get-intrinsic/compare/v1.2.7...v1.3.0) - 2025-02-22
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [Dev Deps] update `es-abstract`, `es-value-fixtures`, `for-each`, `object-inspect` [`9b61553`](https://github.com/ljharb/get-intrinsic/commit/9b61553c587f1c1edbd435597e88c7d387da97dd)
|
|
13
|
+
- [Deps] update `call-bind-apply-helpers`, `es-object-atoms`, `get-proto` [`a341fee`](https://github.com/ljharb/get-intrinsic/commit/a341fee0f39a403b0f0069e82c97642d5eb11043)
|
|
14
|
+
- [New] add `Float16Array` [`de22116`](https://github.com/ljharb/get-intrinsic/commit/de22116b492fb989a0341bceb6e573abfaed73dc)
|
|
15
|
+
|
|
8
16
|
## [v1.2.7](https://github.com/ljharb/get-intrinsic/compare/v1.2.6...v1.2.7) - 2025-01-02
|
|
9
17
|
|
|
10
18
|
### Commits
|
|
@@ -90,6 +90,7 @@ var INTRINSICS = {
|
|
|
90
90
|
'%Error%': $Error,
|
|
91
91
|
'%eval%': eval, // eslint-disable-line no-eval
|
|
92
92
|
'%EvalError%': $EvalError,
|
|
93
|
+
'%Float16Array%': typeof Float16Array === 'undefined' ? undefined : Float16Array,
|
|
93
94
|
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
|
94
95
|
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
|
95
96
|
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "get-intrinsic",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Get and robustly cache all JS language-level intrinsics at first require time",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://github.com/ljharb/get-intrinsic#readme",
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"call-bind-apply-helpers": "^1.0.
|
|
47
|
+
"call-bind-apply-helpers": "^1.0.2",
|
|
48
48
|
"es-define-property": "^1.0.1",
|
|
49
49
|
"es-errors": "^1.3.0",
|
|
50
|
-
"es-object-atoms": "^1.
|
|
50
|
+
"es-object-atoms": "^1.1.1",
|
|
51
51
|
"function-bind": "^1.1.2",
|
|
52
|
-
"get-proto": "^1.0.
|
|
52
|
+
"get-proto": "^1.0.1",
|
|
53
53
|
"gopd": "^1.2.0",
|
|
54
54
|
"has-symbols": "^1.1.0",
|
|
55
55
|
"hasown": "^2.0.2",
|
|
@@ -60,18 +60,18 @@
|
|
|
60
60
|
"auto-changelog": "^2.5.0",
|
|
61
61
|
"call-bound": "^1.0.3",
|
|
62
62
|
"encoding": "^0.1.13",
|
|
63
|
-
"es-abstract": "^1.23.
|
|
64
|
-
"es-value-fixtures": "^1.
|
|
63
|
+
"es-abstract": "^1.23.9",
|
|
64
|
+
"es-value-fixtures": "^1.7.1",
|
|
65
65
|
"eslint": "=8.8.0",
|
|
66
66
|
"evalmd": "^0.0.19",
|
|
67
|
-
"for-each": "^0.3.
|
|
67
|
+
"for-each": "^0.3.5",
|
|
68
68
|
"make-async-function": "^1.0.0",
|
|
69
69
|
"make-async-generator-function": "^1.0.0",
|
|
70
70
|
"make-generator-function": "^2.0.0",
|
|
71
71
|
"mock-property": "^1.1.0",
|
|
72
72
|
"npmignore": "^0.3.1",
|
|
73
73
|
"nyc": "^10.3.2",
|
|
74
|
-
"object-inspect": "^1.13.
|
|
74
|
+
"object-inspect": "^1.13.4",
|
|
75
75
|
"safe-publish-latest": "^2.0.0",
|
|
76
76
|
"tape": "^5.9.0"
|
|
77
77
|
},
|
|
@@ -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.13.4](https://github.com/inspect-js/object-inspect/compare/v1.13.3...v1.13.4) - 2025-02-04
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [Fix] avoid being fooled by a `Symbol.toStringTag` [`fa5870d`](https://github.com/inspect-js/object-inspect/commit/fa5870da468a525d2f20193700f70752f506cbf7)
|
|
13
|
+
- [Tests] fix tests in node v6.0 - v6.4 [`2abfe1b`](https://github.com/inspect-js/object-inspect/commit/2abfe1bc3c69f9293c07c5cd65a9d7d87a628b84)
|
|
14
|
+
- [Dev Deps] update `es-value-fixtures`, `for-each`, `has-symbols` [`3edfb01`](https://github.com/inspect-js/object-inspect/commit/3edfb01cc8cce220fba0dfdfe2dc8bc955758cdd)
|
|
15
|
+
|
|
8
16
|
## [v1.13.3](https://github.com/inspect-js/object-inspect/compare/v1.13.2...v1.13.3) - 2024-11-09
|
|
9
17
|
|
|
10
18
|
### Commits
|
|
@@ -287,13 +287,16 @@ function quote(s) {
|
|
|
287
287
|
return $replace.call(String(s), /"/g, '"');
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
function
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
function
|
|
294
|
-
function
|
|
295
|
-
function
|
|
296
|
-
function
|
|
290
|
+
function canTrustToString(obj) {
|
|
291
|
+
return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined'));
|
|
292
|
+
}
|
|
293
|
+
function isArray(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); }
|
|
294
|
+
function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); }
|
|
295
|
+
function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); }
|
|
296
|
+
function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); }
|
|
297
|
+
function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); }
|
|
298
|
+
function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); }
|
|
299
|
+
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); }
|
|
297
300
|
|
|
298
301
|
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
299
302
|
function isSymbol(obj) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "object-inspect",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.4",
|
|
4
4
|
"description": "string representations of objects in node and the browser",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"auto-changelog": "^2.5.0",
|
|
11
11
|
"core-js": "^2.6.12",
|
|
12
12
|
"error-cause": "^1.0.8",
|
|
13
|
-
"es-value-fixtures": "^1.
|
|
13
|
+
"es-value-fixtures": "^1.7.1",
|
|
14
14
|
"eslint": "=8.8.0",
|
|
15
|
-
"for-each": "^0.3.
|
|
15
|
+
"for-each": "^0.3.4",
|
|
16
16
|
"functions-have-names": "^1.2.3",
|
|
17
17
|
"glob": "=10.3.7",
|
|
18
18
|
"globalthis": "^1.0.4",
|
|
19
|
-
"has-symbols": "^1.0
|
|
19
|
+
"has-symbols": "^1.1.0",
|
|
20
20
|
"has-tostringtag": "^1.0.2",
|
|
21
21
|
"in-publish": "^2.0.1",
|
|
22
22
|
"jackspeak": "=2.1.1",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"nyc": "^10.3.2",
|
|
27
27
|
"safe-publish-latest": "^2.0.0",
|
|
28
28
|
"safer-buffer": "^2.1.2",
|
|
29
|
+
"semver": "^6.3.1",
|
|
29
30
|
"string.prototype.repeat": "^1.0.0",
|
|
30
31
|
"tape": "^5.9.0"
|
|
31
32
|
},
|
|
@@ -5,6 +5,8 @@ var test = require('tape');
|
|
|
5
5
|
var mockProperty = require('mock-property');
|
|
6
6
|
var hasSymbols = require('has-symbols/shams')();
|
|
7
7
|
var hasToStringTag = require('has-tostringtag/shams')();
|
|
8
|
+
var forEach = require('for-each');
|
|
9
|
+
var semver = require('semver');
|
|
8
10
|
|
|
9
11
|
test('values', function (t) {
|
|
10
12
|
t.plan(1);
|
|
@@ -209,3 +211,51 @@ test('RegExps', function (t) {
|
|
|
209
211
|
|
|
210
212
|
t.end();
|
|
211
213
|
});
|
|
214
|
+
|
|
215
|
+
test('Proxies', { skip: typeof Proxy !== 'function' || !hasToStringTag }, function (t) {
|
|
216
|
+
var target = { proxy: true };
|
|
217
|
+
var fake = new Proxy(target, { has: function () { return false; } });
|
|
218
|
+
|
|
219
|
+
// needed to work around a weird difference in node v6.0 - v6.4 where non-present properties are not logged
|
|
220
|
+
var isNode60 = semver.satisfies(process.version, '6.0 - 6.4');
|
|
221
|
+
|
|
222
|
+
forEach([
|
|
223
|
+
'Boolean',
|
|
224
|
+
'Number',
|
|
225
|
+
'String',
|
|
226
|
+
'Symbol',
|
|
227
|
+
'Date'
|
|
228
|
+
], function (tag) {
|
|
229
|
+
target[Symbol.toStringTag] = tag;
|
|
230
|
+
|
|
231
|
+
t.equal(
|
|
232
|
+
inspect(fake),
|
|
233
|
+
'{ ' + (isNode60 ? '' : 'proxy: true, ') + '[Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
|
|
234
|
+
'Proxy for + ' + tag + ' shows as the target, which has no slots'
|
|
235
|
+
);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
t.end();
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
test('fakers', { skip: !hasToStringTag }, function (t) {
|
|
242
|
+
var target = { proxy: false };
|
|
243
|
+
|
|
244
|
+
forEach([
|
|
245
|
+
'Boolean',
|
|
246
|
+
'Number',
|
|
247
|
+
'String',
|
|
248
|
+
'Symbol',
|
|
249
|
+
'Date'
|
|
250
|
+
], function (tag) {
|
|
251
|
+
target[Symbol.toStringTag] = tag;
|
|
252
|
+
|
|
253
|
+
t.equal(
|
|
254
|
+
inspect(target),
|
|
255
|
+
'{ proxy: false, [Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
|
|
256
|
+
'Object pretending to be ' + tag + ' does not trick us'
|
|
257
|
+
);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
t.end();
|
|
261
|
+
});
|