cdk-docker-image-deployment 0.0.1033 → 0.0.1035
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 +3 -3
- package/lib/destination.js +1 -1
- package/lib/docker-image-deployment.js +1 -1
- package/lib/source.js +1 -1
- package/node_modules/which-typed-array/CHANGELOG.md +14 -0
- package/node_modules/which-typed-array/README.md +0 -2
- package/node_modules/which-typed-array/index.d.ts +288 -11
- package/node_modules/which-typed-array/index.js +6 -7
- package/node_modules/which-typed-array/package.json +12 -11
- package/package.json +3 -3
- package/node_modules/which-typed-array/eslint.config.mjs +0 -12
- package/node_modules/which-typed-array/test/index.js +0 -105
package/.jsii
CHANGED
|
@@ -2988,7 +2988,7 @@
|
|
|
2988
2988
|
"stability": "stable"
|
|
2989
2989
|
},
|
|
2990
2990
|
"homepage": "https://github.com/cdklabs/cdk-docker-image-deployment#readme",
|
|
2991
|
-
"jsiiVersion": "5.9.
|
|
2991
|
+
"jsiiVersion": "5.9.54 (build 042bc62)",
|
|
2992
2992
|
"keywords": [
|
|
2993
2993
|
"cdk"
|
|
2994
2994
|
],
|
|
@@ -3560,6 +3560,6 @@
|
|
|
3560
3560
|
"symbolId": "src/source:SourceContext"
|
|
3561
3561
|
}
|
|
3562
3562
|
},
|
|
3563
|
-
"version": "0.0.
|
|
3564
|
-
"fingerprint": "
|
|
3563
|
+
"version": "0.0.1035",
|
|
3564
|
+
"fingerprint": "hMWv08hRIfrszk9e56MMklwj+9vIg84Ub+jQ5iqJqdw="
|
|
3565
3565
|
}
|
package/lib/destination.js
CHANGED
|
@@ -16,7 +16,7 @@ const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
class Destination {
|
|
19
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "cdk-docker-image-deployment.Destination", version: "0.0.
|
|
19
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "cdk-docker-image-deployment.Destination", version: "0.0.1035" };
|
|
20
20
|
/**
|
|
21
21
|
* Uses an ECR repository in the same account as the stack as the destination for the image.
|
|
22
22
|
*/
|
|
@@ -47,7 +47,7 @@ const constructs_1 = require("constructs");
|
|
|
47
47
|
* `DockerImageDeployment` pushes an image from a local or external source to a specified external destination
|
|
48
48
|
*/
|
|
49
49
|
class DockerImageDeployment extends constructs_1.Construct {
|
|
50
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "cdk-docker-image-deployment.DockerImageDeployment", version: "0.0.
|
|
50
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "cdk-docker-image-deployment.DockerImageDeployment", version: "0.0.1035" };
|
|
51
51
|
cb;
|
|
52
52
|
constructor(scope, id, props) {
|
|
53
53
|
super(scope, id);
|
package/lib/source.js
CHANGED
|
@@ -60,7 +60,7 @@ const ecr_assets = __importStar(require("aws-cdk-lib/aws-ecr-assets"));
|
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
62
|
class Source {
|
|
63
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "cdk-docker-image-deployment.Source", version: "0.0.
|
|
63
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "cdk-docker-image-deployment.Source", version: "0.0.1035" };
|
|
64
64
|
/**
|
|
65
65
|
* Uses a local image built from a Dockerfile in a local directory as the source.
|
|
66
66
|
*
|
|
@@ -5,6 +5,20 @@ 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.1.24](https://github.com/inspect-js/which-typed-array/compare/v1.1.23...v1.1.24) - 2026-09-18
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [types] fix the types for good, hopefully [`d746946`](https://github.com/inspect-js/which-typed-array/commit/d746946a8a76dc6e58302de53856aff304dbdb98)
|
|
13
|
+
|
|
14
|
+
## [v1.1.23](https://github.com/inspect-js/which-typed-array/compare/v1.1.22...v1.1.23) - 2026-09-16
|
|
15
|
+
|
|
16
|
+
### Commits
|
|
17
|
+
|
|
18
|
+
- [types] handle a consumer `lib` that lacks `Float16Array` [`7fd78fb`](https://github.com/inspect-js/which-typed-array/commit/7fd78fb1f90d00d1e340457c7e6a00492c1c5e79)
|
|
19
|
+
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `auto-changelog`, `eslint`, `tape` [`885ae7d`](https://github.com/inspect-js/which-typed-array/commit/885ae7d6888b21bcacaae883f86861258196888d)
|
|
20
|
+
- [readme] remove dead badges [`67844dd`](https://github.com/inspect-js/which-typed-array/commit/67844dd30a89dddfc98172672af6372ae2e74d13)
|
|
21
|
+
|
|
8
22
|
## [v1.1.22](https://github.com/inspect-js/which-typed-array/compare/v1.1.21...v1.1.22) - 2026-06-05
|
|
9
23
|
|
|
10
24
|
### Commits
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[![github actions][actions-image]][actions-url]
|
|
4
4
|
[![coverage][codecov-image]][codecov-url]
|
|
5
|
-
[![dependency status][deps-svg]][deps-url]
|
|
6
|
-
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
|
7
5
|
[![License][license-image]][license-url]
|
|
8
6
|
[![Downloads][downloads-image]][downloads-url]
|
|
9
7
|
|
|
@@ -4,32 +4,309 @@
|
|
|
4
4
|
* @param {unknown} value The potential collection
|
|
5
5
|
* @returns {TypedArrayName | false | null} 'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Int16Array' | 'Uint16Array' | 'Int32Array' | 'Uint32Array' | 'Float32Array' | 'Float64Array' | 'BigInt64Array' | 'BigUint64Array' | false | null
|
|
6
6
|
*/
|
|
7
|
-
declare function whichTypedArray<T>(
|
|
8
|
-
|
|
7
|
+
declare function whichTypedArray<T>(
|
|
8
|
+
value: T & whichTypedArray.TypedArray,
|
|
9
|
+
): whichTypedArray.WhichTypedArray<T>;
|
|
10
|
+
declare function whichTypedArray<T>(
|
|
11
|
+
value: unknown,
|
|
12
|
+
): false | null | whichTypedArray.TypedArrayName;
|
|
9
13
|
|
|
10
14
|
import TAs from 'available-typed-arrays';
|
|
11
15
|
|
|
16
|
+
/** the names the consumer's `lib` declares a global for, so there is a type to compare against */
|
|
17
|
+
type DeclaredName = whichTypedArray.TypedArrayName & keyof typeof globalThis;
|
|
18
|
+
|
|
19
|
+
/** the names it does not (eg, `Float16Array` under `lib: es2020`), which are still possible at runtime */
|
|
20
|
+
type UndeclaredName = Exclude<whichTypedArray.TypedArrayName, keyof typeof globalThis>;
|
|
21
|
+
|
|
22
|
+
type Instance<Name extends DeclaredName> = typeof globalThis[Name]['prototype'];
|
|
23
|
+
|
|
24
|
+
type IsAny<T> = 0 extends (1 & T) ? true : false;
|
|
25
|
+
|
|
26
|
+
type RequiredKeys<T> = {
|
|
27
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? never : K
|
|
28
|
+
}[keyof T];
|
|
29
|
+
|
|
30
|
+
/** the key types of `T`'s index signatures, found by `{}` having them covered already */
|
|
31
|
+
type IndexKeys<T> = {
|
|
32
|
+
[K in keyof T]-?: {} extends Record<K, never> ? K : never
|
|
33
|
+
}[keyof T];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The keys of `T` that can be read off a value by name. An index signature is not a
|
|
37
|
+
* named member, but a `string`-keyed one cannot be told apart here from the named
|
|
38
|
+
* string members beside it, so it is left in and they are taken at face value.
|
|
39
|
+
*/
|
|
40
|
+
type NamedKeys<T> = Exclude<keyof T, Exclude<IndexKeys<T>, string>>;
|
|
41
|
+
|
|
42
|
+
/** `Object`'s members are on every object type, even though `keyof` does not list them */
|
|
43
|
+
type Apparent<T, K> = K extends keyof T
|
|
44
|
+
? T[K]
|
|
45
|
+
: K extends keyof Object
|
|
46
|
+
? Object[K]
|
|
47
|
+
: unknown;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The typed arrays' symbol-keyed member whose value is a string, which is
|
|
51
|
+
* `Symbol.toStringTag` in a `lib` that declares symbols and `never` in one that
|
|
52
|
+
* does not (`lib: es5`). Deriving it this way leaves the tag comparisons below
|
|
53
|
+
* with no information to go on, rather than naming `Symbol` in a `lib` without it.
|
|
54
|
+
*/
|
|
55
|
+
type TagKey = {
|
|
56
|
+
[K in keyof whichTypedArray.TypedArray & symbol]: whichTypedArray.TypedArray[K] extends string ? K : never
|
|
57
|
+
}[keyof whichTypedArray.TypedArray & symbol];
|
|
58
|
+
|
|
59
|
+
/** `unknown` when `T` says nothing about its own tag, which rules no name out */
|
|
60
|
+
type TagOf<T> = [TagKey] extends [never]
|
|
61
|
+
? unknown
|
|
62
|
+
: TagKey extends keyof T
|
|
63
|
+
? T[TagKey & keyof T]
|
|
64
|
+
: unknown;
|
|
65
|
+
|
|
66
|
+
/** one value can carry both tags when either is assignable to the other */
|
|
67
|
+
type TagsMeet<A, B> = IsAny<A> extends true
|
|
68
|
+
? true
|
|
69
|
+
: IsAny<B> extends true
|
|
70
|
+
? true
|
|
71
|
+
: [Extract<A, B>] extends [never]
|
|
72
|
+
? ([Extract<B, A>] extends [never] ? false : true)
|
|
73
|
+
: true;
|
|
74
|
+
|
|
75
|
+
/** how many levels of members `Related` walks before it stops looking for a conflict */
|
|
76
|
+
type Prev = [
|
|
77
|
+
never,
|
|
78
|
+
0,
|
|
79
|
+
1,
|
|
80
|
+
2,
|
|
81
|
+
3,
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
type Depth = 0 | 1 | 2 | 3 | 4;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* A rough stand-in for the comparability check TypeScript itself runs to decide
|
|
88
|
+
* whether `x === someTypedArray` is worth allowing. One value can be a `Source` and
|
|
89
|
+
* a `Target` at once if the two already share a constituent, or if neither is an
|
|
90
|
+
* object type and one is assignable to the other; failing that, `D` more levels of
|
|
91
|
+
* members and signatures are compared, in this direction only - `Meets` runs both.
|
|
92
|
+
*
|
|
93
|
+
* It is a heuristic, not that check, and it leans towards saying the two can meet.
|
|
94
|
+
* A conflict further down than `D` levels is not looked for, so a name can be left
|
|
95
|
+
* in that no value could produce. It also drops names TypeScript would have allowed:
|
|
96
|
+
* a `Source` that carries a call signature, or a member declared with its own type
|
|
97
|
+
* parameters, meets nothing, and only the last signature of an overloaded member is
|
|
98
|
+
* compared.
|
|
99
|
+
*
|
|
100
|
+
* `Stale` marks a comparison standing in for a name this `lib` has no type for, where
|
|
101
|
+
* a member the `lib` has never heard of is weaker evidence (see `GatedOn`).
|
|
102
|
+
*/
|
|
103
|
+
type Related<Source, Target, D extends Depth, Stale extends boolean> = IsAny<Source> extends true
|
|
104
|
+
? true
|
|
105
|
+
: IsAny<Target> extends true
|
|
106
|
+
? true
|
|
107
|
+
: [Extract<Source, Target>] extends [never]
|
|
108
|
+
? (Widens<Source, Target> extends true ? true : Deeply<Source, Target, D, Stale>)
|
|
109
|
+
: true;
|
|
110
|
+
|
|
111
|
+
/** neither side being an object type, one value fits both when either is assignable to the other */
|
|
112
|
+
type Widens<Source, Target> = [Source] extends [object]
|
|
113
|
+
? false
|
|
114
|
+
: [Target] extends [object]
|
|
115
|
+
? false
|
|
116
|
+
: ([Extract<Target, Source>] extends [never] ? false : true);
|
|
117
|
+
|
|
118
|
+
/** a union on either side only needs one part that can meet one part of the other */
|
|
119
|
+
type Deeply<Source, Target, D extends Depth, Stale extends boolean> = [D] extends [0]
|
|
120
|
+
? true
|
|
121
|
+
: true extends (Source extends unknown
|
|
122
|
+
? (Target extends unknown ? Structurally<Source, Target, D, Stale> : never)
|
|
123
|
+
: never)
|
|
124
|
+
? true
|
|
125
|
+
: false;
|
|
126
|
+
|
|
127
|
+
type Structurally<Source, Target, D extends Depth, Stale extends boolean> = [Source] extends [(...args: infer SP) => infer SR]
|
|
128
|
+
? ([Target] extends [(...args: infer TP) => infer TR]
|
|
129
|
+
? (Related<SR, TR, Prev[D], Stale> extends true ? ParamsRelated<SP, TP, Prev[D], Stale> : false)
|
|
130
|
+
: false)
|
|
131
|
+
: [Target] extends [Function]
|
|
132
|
+
? false
|
|
133
|
+
: [Source] extends [object]
|
|
134
|
+
? ([Target] extends [object] ? Membered<Source, Target, D, Stale> : false)
|
|
135
|
+
: false;
|
|
136
|
+
|
|
137
|
+
/** each pair of parameters only has to meet, in either direction, as with an overridden method */
|
|
138
|
+
type ParamsRelated<SP extends readonly unknown[], TP extends readonly unknown[], D extends Depth, Stale extends boolean> = false extends {
|
|
139
|
+
[K in keyof SP]: K extends keyof TP ? Related<SP[K], TP[K & keyof TP], D, Stale> : true
|
|
140
|
+
}[number]
|
|
141
|
+
? false
|
|
142
|
+
: true;
|
|
143
|
+
|
|
144
|
+
type Membered<Source, Target, D extends Depth, Stale extends boolean> = GatedOn<Source, Target, D, Stale> extends true
|
|
145
|
+
? (TagsMeet<TagOf<Source>, TagOf<Target>> extends true ? EachMember<Source, Target, D, Stale> : false)
|
|
146
|
+
: false;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Whether a member `Target` requires but `Source` lacks counts against the two
|
|
150
|
+
* meeting. At the top of a comparison it does. Below that, in a comparison standing
|
|
151
|
+
* in for a name this `lib` has no type for, one side is the `lib`'s own type for a
|
|
152
|
+
* typed array or one of its members, and a member missing from that is as easily an
|
|
153
|
+
* older `lib`'s gap as a real conflict, so it is not counted - which is how such a
|
|
154
|
+
* name survives an input written in terms of a newer member, as
|
|
155
|
+
* `{ buffer: { byteLength: number } & { resizable: boolean } }` is.
|
|
156
|
+
*/
|
|
157
|
+
type GatedOn<Source, Target, D extends Depth, Stale extends boolean> = [Stale, D] extends [true, 0 | 1 | 2 | 3]
|
|
158
|
+
? true
|
|
159
|
+
: Compatible<Source, Target, Stale>;
|
|
160
|
+
|
|
161
|
+
/** the members of `Target` that `Source`, or `Object` behind it, also has */
|
|
162
|
+
type SharedKeys<Source, Target> = keyof Target & (keyof Source | keyof Object);
|
|
163
|
+
|
|
164
|
+
type EachMember<Source, Target, D extends Depth, Stale extends boolean> = false extends {
|
|
165
|
+
[K in SharedKeys<Source, Target>]: Related<Apparent<Source, K>, Target[K], Prev[D], Stale>
|
|
166
|
+
}[SharedKeys<Source, Target>]
|
|
167
|
+
? false
|
|
168
|
+
: true;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* `Source` has something to offer for every member `Target` requires. `Target`'s
|
|
172
|
+
* optional members are left out on purpose: one value can be a `Source` and a
|
|
173
|
+
* `Target` at once while having none of them.
|
|
174
|
+
*/
|
|
175
|
+
type Compatible<Source, Target, Stale extends boolean> = [Exclude<RequiredKeys<Target>, NamedKeys<Source> | keyof Object>] extends [never]
|
|
176
|
+
? IndexesCovered<Source, Target, Stale>
|
|
177
|
+
: false;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Each index signature `Target` has needs one on `Source` with the same keys, or a
|
|
181
|
+
* value type of `any`, which anything satisfies. Numeric-string keys are the
|
|
182
|
+
* exception: they reach a `number` index signature, so `Source` having one of those
|
|
183
|
+
* covers them, as long as what it holds can be what `Target` asks for.
|
|
184
|
+
*/
|
|
185
|
+
type IndexesCovered<Source, Target, Stale extends boolean> = [{
|
|
186
|
+
[K in IndexKeys<Target>]: IsAny<Target[K & keyof Target]> extends true
|
|
187
|
+
? never
|
|
188
|
+
: (K extends IndexKeys<Source>
|
|
189
|
+
? never
|
|
190
|
+
: (string extends K
|
|
191
|
+
? K
|
|
192
|
+
: (`${number}` extends K
|
|
193
|
+
? (Related<Source[number & keyof Source], Target[K & keyof Target], 1, Stale> extends true ? never : K)
|
|
194
|
+
: K)))
|
|
195
|
+
}[IndexKeys<Target>]] extends [never]
|
|
196
|
+
? true
|
|
197
|
+
: false;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* `T` is not assignable to a plain copy of its own members, which is what a
|
|
201
|
+
* `private`, `protected` or `#private` member does to a class, and what a call or
|
|
202
|
+
* construct signature does to any type - none of which a typed array has, so nothing
|
|
203
|
+
* outside that class can be one.
|
|
204
|
+
*/
|
|
205
|
+
type IsNominal<T> = {
|
|
206
|
+
[K in keyof T]: T[K]
|
|
207
|
+
} extends T
|
|
208
|
+
? false
|
|
209
|
+
: true;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Whether a `T` and an `I` look like they could be one value. A nominal `T` only
|
|
213
|
+
* gets the one direction: nothing outside its class can be a `T`, but a `T` whose
|
|
214
|
+
* members are all there can still be a typed array.
|
|
215
|
+
*/
|
|
216
|
+
type Meets<T, I, Nominal, Stale extends boolean> = Related<T, I, 4, Stale> extends true
|
|
217
|
+
? true
|
|
218
|
+
: (Nominal extends true ? false : Related<I, T, 4, Stale>);
|
|
219
|
+
|
|
220
|
+
type MayBe<T, Name extends DeclaredName> = TagsMeet<TagOf<Instance<Name>>, TagOf<T>> extends true
|
|
221
|
+
? Meets<T, Instance<Name>, IsNominal<T>, false>
|
|
222
|
+
: false;
|
|
223
|
+
|
|
224
|
+
type PossibleNames<T> = {
|
|
225
|
+
[Name in DeclaredName]: MayBe<T, Name> extends true ? Name : never
|
|
226
|
+
}[DeclaredName];
|
|
227
|
+
|
|
228
|
+
/** the members the typed arrays this `lib` declares actually have */
|
|
229
|
+
type KnownKey = keyof Object | {
|
|
230
|
+
[Name in DeclaredName]: keyof Instance<Name>
|
|
231
|
+
}[DeclaredName];
|
|
232
|
+
|
|
233
|
+
type UnknownKeys<T> = Exclude<RequiredKeys<T>, KnownKey>;
|
|
234
|
+
|
|
235
|
+
type WithoutUnknown<T> = Pick<T, Exclude<keyof T, UnknownKeys<T>>>;
|
|
236
|
+
|
|
237
|
+
/** of those, the ones holding data rather than a method */
|
|
238
|
+
type UnknownDataKeys<T> = {
|
|
239
|
+
[K in UnknownKeys<T>]: T[K & keyof T] extends Function ? never : K
|
|
240
|
+
}[UnknownKeys<T>];
|
|
241
|
+
|
|
242
|
+
type MeetsAny<T, Nominal> = true extends {
|
|
243
|
+
[Name in DeclaredName]: Meets<T, Instance<Name>, Nominal, true>
|
|
244
|
+
}[DeclaredName]
|
|
245
|
+
? true
|
|
246
|
+
: false;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* An undeclared name has no type in this `lib`, so there is nothing to compare `T`
|
|
250
|
+
* to: the declared typed arrays stand in for it, with the members `T` requires that
|
|
251
|
+
* none of them has set aside, so that a `T` asking for a member only a newer `lib`
|
|
252
|
+
* knows about - `at` under `lib: es2020` - can still be the name that `lib` lacks.
|
|
253
|
+
*
|
|
254
|
+
* Setting a member aside loses whatever it said, and a member the `lib` has not heard
|
|
255
|
+
* of further down is not counted either (see `GatedOn`), so this is looser than the
|
|
256
|
+
* test for a declared name. A member that is data rather than a method is kept as
|
|
257
|
+
* evidence, on the guess that a newer `lib` mostly adds methods; that guess, and the
|
|
258
|
+
* stand-in itself, are why an undeclared name is the one that survives most often -
|
|
259
|
+
* `DataView`, whose own methods are all set aside, keeps one.
|
|
260
|
+
*/
|
|
261
|
+
type MayBeUndeclared<T> = IsAny<T> extends true
|
|
262
|
+
? true
|
|
263
|
+
: [unknown] extends [T]
|
|
264
|
+
? true
|
|
265
|
+
: [T] extends [Function]
|
|
266
|
+
? false
|
|
267
|
+
: [T] extends [object]
|
|
268
|
+
? ([UnknownDataKeys<T>] extends [never] ? MeetsAny<WithoutUnknown<T>, IsNominal<T>> : false)
|
|
269
|
+
: false;
|
|
270
|
+
|
|
271
|
+
/** a specific tag names the typed array outright; a `string` tag leaves it to the members */
|
|
272
|
+
type PossibleUndeclaredNames<T> = [UndeclaredName] extends [never]
|
|
273
|
+
? never
|
|
274
|
+
: string extends TagOf<T>
|
|
275
|
+
? (MayBeUndeclared<T> extends true ? UndeclaredName : never)
|
|
276
|
+
: Extract<UndeclaredName, TagOf<T>>;
|
|
277
|
+
|
|
12
278
|
declare namespace whichTypedArray {
|
|
13
279
|
export type TypedArrayName = ReturnType<typeof TAs>[number];
|
|
14
280
|
|
|
15
|
-
|
|
281
|
+
// a consumer's `lib` may not declare every name (eg, `Float16Array`), so only look up the globals it has
|
|
282
|
+
export type TypedArrayConstructor = typeof globalThis[TypedArrayName & keyof typeof globalThis];
|
|
16
283
|
|
|
17
284
|
export type TypedArray = TypedArrayConstructor['prototype'];
|
|
18
285
|
|
|
19
286
|
/**
|
|
20
287
|
* Distributes over `T`, so a subset of typed arrays maps to the matching
|
|
21
288
|
* subset of names (`Int8Array | Uint8Array` -> `'Int8Array' | 'Uint8Array'`,
|
|
22
|
-
* never a float16 or bigint name)
|
|
289
|
+
* never a float16 or bigint name), and a `T` that is not definitely a typed
|
|
290
|
+
* array also gets `false | null`.
|
|
291
|
+
*
|
|
292
|
+
* For everything else - `object`, `ArrayBufferView`, `{ length: 0 }`, a
|
|
293
|
+
* duck-typed stand-in - it keeps the names that `T`'s own members do not rule
|
|
294
|
+
* out, so comparing the result to one of those names is usually not reported as a
|
|
295
|
+
* comparison that can never be true. The rule behind that is a heuristic (see
|
|
296
|
+
* `Related`), so it can keep a name no value of `T` could produce, and a `T` whose
|
|
297
|
+
* conflict with a name is buried deeply enough will keep that name too. A name
|
|
298
|
+
* this `lib` has no type for (see `MayBeUndeclared`) is kept more readily still.
|
|
23
299
|
*
|
|
24
300
|
* Derived entirely from `TypedArrayName`, so a new entry in `available-typed-arrays` flows through with no other change here.
|
|
25
301
|
*/
|
|
26
|
-
export type WhichTypedArray<T> =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
302
|
+
export type WhichTypedArray<T> = T extends unknown
|
|
303
|
+
?
|
|
304
|
+
| PossibleNames<T>
|
|
305
|
+
| PossibleUndeclaredNames<T>
|
|
306
|
+
| ([T] extends [TypedArray]
|
|
307
|
+
? (IsAny<T> extends true ? false | null : never)
|
|
308
|
+
: false | null)
|
|
309
|
+
: never;
|
|
33
310
|
}
|
|
34
311
|
|
|
35
312
|
export = whichTypedArray;
|
|
@@ -56,7 +56,7 @@ if (hasToStringTag && gOPD && getProto) {
|
|
|
56
56
|
var arr = new g[typedArray]();
|
|
57
57
|
var fn = arr.slice || arr.set;
|
|
58
58
|
if (fn) {
|
|
59
|
-
var bound = /** @type {BoundSlice | BoundSet} */ (
|
|
59
|
+
var bound = /** @type {typeof BoundSlice | typeof BoundSet} */ (
|
|
60
60
|
// @ts-expect-error TODO FIXME
|
|
61
61
|
callBind(fn)
|
|
62
62
|
);
|
|
@@ -111,11 +111,8 @@ function isTATag(tag) {
|
|
|
111
111
|
return $indexOf(typedArrays, tag) > -1;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
|
|
116
|
-
* @param {unknown} value
|
|
117
|
-
*/
|
|
118
|
-
module.exports = function whichTypedArray(value) {
|
|
114
|
+
/** @type {(value: unknown) => ReturnType<typeof import('.')>} */
|
|
115
|
+
function whichTypedArray(value) {
|
|
119
116
|
if (!value || typeof value !== 'object') {
|
|
120
117
|
return false;
|
|
121
118
|
}
|
|
@@ -132,4 +129,6 @@ module.exports = function whichTypedArray(value) {
|
|
|
132
129
|
}
|
|
133
130
|
if (!gOPD) { return null; } // unknown engine
|
|
134
131
|
return tryTypedArrays(value);
|
|
135
|
-
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
module.exports = whichTypedArray;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "which-typed-array",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.24",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Jordan Harband",
|
|
6
6
|
"email": "ljharb@gmail.com",
|
|
@@ -31,9 +31,10 @@
|
|
|
31
31
|
"test:harmony": "nyc node --harmony --es-staging test",
|
|
32
32
|
"posttest": "npx npm@'>=10.2' audit --production",
|
|
33
33
|
"lint": "eslint .",
|
|
34
|
-
"postlint": "tsc -p . && attw -P",
|
|
34
|
+
"postlint": "tsc -p . && tsc -p test/es2020 && attw -P",
|
|
35
35
|
"version": "auto-changelog && git add CHANGELOG.md",
|
|
36
|
-
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
|
36
|
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
|
|
37
|
+
"dependencies": "node -p \"process.env.npm_command\" | npx \"dt-clean@^1.2.2\" --auto"
|
|
37
38
|
},
|
|
38
39
|
"repository": {
|
|
39
40
|
"type": "git",
|
|
@@ -69,18 +70,16 @@
|
|
|
69
70
|
"has-tostringtag": "^1.0.2"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
|
-
"@arethetypeswrong/cli": "^0.18.
|
|
73
|
-
"@ljharb/eslint-config": "^22.2.
|
|
73
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
74
|
+
"@ljharb/eslint-config": "^22.2.4",
|
|
74
75
|
"@ljharb/tsconfig": "^0.3.2",
|
|
75
76
|
"@types/call-bind": "^1.0.5",
|
|
76
|
-
"@types/for-each": "^0.3.3",
|
|
77
|
-
"@types/gopd": "^1.0.3",
|
|
78
77
|
"@types/is-callable": "^1.1.2",
|
|
79
78
|
"@types/make-arrow-function": "^1.2.2",
|
|
80
79
|
"@types/make-generator-function": "^2.0.3",
|
|
81
|
-
"@types/
|
|
82
|
-
"auto-changelog": "^2.6.
|
|
83
|
-
"eslint": "^10.
|
|
80
|
+
"@types/node": "^22.20.3",
|
|
81
|
+
"auto-changelog": "^2.6.1",
|
|
82
|
+
"eslint": "^10.10.0",
|
|
84
83
|
"in-publish": "^2.0.1",
|
|
85
84
|
"is-callable": "^1.2.7",
|
|
86
85
|
"jiti": "^0.0.0",
|
|
@@ -89,7 +88,7 @@
|
|
|
89
88
|
"npmignore": "^0.3.5",
|
|
90
89
|
"nyc": "^10.3.2",
|
|
91
90
|
"safe-publish-latest": "^2.0.0",
|
|
92
|
-
"tape": "^5.
|
|
91
|
+
"tape": "^5.10.2",
|
|
93
92
|
"typescript": "next"
|
|
94
93
|
},
|
|
95
94
|
"testling": {
|
|
@@ -124,6 +123,8 @@
|
|
|
124
123
|
"publishConfig": {
|
|
125
124
|
"ignore": [
|
|
126
125
|
".github/workflows",
|
|
126
|
+
"eslint.config.mjs",
|
|
127
|
+
"test",
|
|
127
128
|
"types.d.ts"
|
|
128
129
|
]
|
|
129
130
|
}
|
package/package.json
CHANGED
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@typescript-eslint/eslint-plugin": "^8",
|
|
46
46
|
"@typescript-eslint/parser": "^8",
|
|
47
47
|
"aws-cdk-lib": "2.24.0",
|
|
48
|
-
"commit-and-tag-version": "^
|
|
48
|
+
"commit-and-tag-version": "^13",
|
|
49
49
|
"constructs": "10.5.1",
|
|
50
50
|
"esbuild": "^0.28.2",
|
|
51
51
|
"eslint": "^9",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"jsii-docgen": "^10.5.0",
|
|
59
59
|
"jsii-pacmak": "^1.140.0",
|
|
60
60
|
"jsii-rosetta": "~5.9.0",
|
|
61
|
-
"projen": "^0.103.
|
|
61
|
+
"projen": "^0.103.27",
|
|
62
62
|
"ts-jest": "^27",
|
|
63
63
|
"ts-node": "^10.9.2",
|
|
64
64
|
"typescript": "^4.9.5"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"version": "0.0.
|
|
88
|
+
"version": "0.0.1035",
|
|
89
89
|
"jest": {
|
|
90
90
|
"coverageProvider": "v8",
|
|
91
91
|
"testMatch": [
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var test = require('tape');
|
|
4
|
-
var whichTypedArray = require('../');
|
|
5
|
-
var isCallable = require('is-callable');
|
|
6
|
-
var hasToStringTag = require('has-tostringtag/shams')();
|
|
7
|
-
var generators = require('make-generator-function')();
|
|
8
|
-
var arrows = require('make-arrow-function').list();
|
|
9
|
-
var forEach = require('for-each');
|
|
10
|
-
|
|
11
|
-
var typedArrayNames = [
|
|
12
|
-
'Int8Array',
|
|
13
|
-
'Uint8Array',
|
|
14
|
-
'Uint8ClampedArray',
|
|
15
|
-
'Int16Array',
|
|
16
|
-
'Uint16Array',
|
|
17
|
-
'Int32Array',
|
|
18
|
-
'Uint32Array',
|
|
19
|
-
'Float32Array',
|
|
20
|
-
'Float64Array',
|
|
21
|
-
'BigInt64Array',
|
|
22
|
-
'BigUint64Array'
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
test('not arrays', function (t) {
|
|
26
|
-
t.test('non-number/string primitives', function (st) {
|
|
27
|
-
// @ts-expect-error
|
|
28
|
-
st.equal(false, whichTypedArray(), 'undefined is not typed array');
|
|
29
|
-
st.equal(false, whichTypedArray(null), 'null is not typed array');
|
|
30
|
-
st.equal(false, whichTypedArray(false), 'false is not typed array');
|
|
31
|
-
st.equal(false, whichTypedArray(true), 'true is not typed array');
|
|
32
|
-
st.end();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
t.equal(false, whichTypedArray({}), 'object is not typed array');
|
|
36
|
-
t.equal(false, whichTypedArray(/a/g), 'regex literal is not typed array');
|
|
37
|
-
t.equal(false, whichTypedArray(new RegExp('a', 'g')), 'regex object is not typed array');
|
|
38
|
-
t.equal(false, whichTypedArray(new Date()), 'new Date() is not typed array');
|
|
39
|
-
|
|
40
|
-
t.test('numbers', function (st) {
|
|
41
|
-
st.equal(false, whichTypedArray(42), 'number is not typed array');
|
|
42
|
-
st.equal(false, whichTypedArray(Object(42)), 'number object is not typed array');
|
|
43
|
-
st.equal(false, whichTypedArray(NaN), 'NaN is not typed array');
|
|
44
|
-
st.equal(false, whichTypedArray(Infinity), 'Infinity is not typed array');
|
|
45
|
-
st.end();
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
t.test('strings', function (st) {
|
|
49
|
-
st.equal(false, whichTypedArray('foo'), 'string primitive is not typed array');
|
|
50
|
-
st.equal(false, whichTypedArray(Object('foo')), 'string object is not typed array');
|
|
51
|
-
st.end();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
t.end();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('Functions', function (t) {
|
|
58
|
-
t.equal(false, whichTypedArray(function () {}), 'function is not typed array');
|
|
59
|
-
t.end();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test('Generators', { skip: generators.length === 0 }, function (t) {
|
|
63
|
-
forEach(generators, function (genFn) {
|
|
64
|
-
t.equal(false, whichTypedArray(genFn), 'generator function ' + genFn + ' is not typed array');
|
|
65
|
-
});
|
|
66
|
-
t.end();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('Arrow functions', { skip: arrows.length === 0 }, function (t) {
|
|
70
|
-
forEach(arrows, function (arrowFn) {
|
|
71
|
-
t.equal(false, whichTypedArray(arrowFn), 'arrow function ' + arrowFn + ' is not typed array');
|
|
72
|
-
});
|
|
73
|
-
t.end();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test('@@toStringTag', { skip: !hasToStringTag }, function (t) {
|
|
77
|
-
forEach(typedArrayNames, function (typedArray) {
|
|
78
|
-
// @ts-expect-error TODO: fix
|
|
79
|
-
if (typeof global[typedArray] === 'function') {
|
|
80
|
-
// @ts-expect-error TODO: fix
|
|
81
|
-
var fakeTypedArray = [];
|
|
82
|
-
// @ts-expect-error TODO: fix
|
|
83
|
-
fakeTypedArray[Symbol.toStringTag] = typedArray;
|
|
84
|
-
// @ts-expect-error TODO: fix
|
|
85
|
-
t.equal(false, whichTypedArray(fakeTypedArray), 'faked ' + typedArray + ' is not typed array');
|
|
86
|
-
} else {
|
|
87
|
-
t.comment('# SKIP ' + typedArray + ' is not supported');
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
t.end();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
test('Typed Arrays', function (t) {
|
|
94
|
-
forEach(typedArrayNames, function (typedArray) {
|
|
95
|
-
// @ts-expect-error TODO: fix
|
|
96
|
-
/** @type {import('../').TypedArrayConstructor} */ var TypedArray = global[typedArray];
|
|
97
|
-
if (isCallable(TypedArray)) {
|
|
98
|
-
var arr = new TypedArray(10);
|
|
99
|
-
t.equal(whichTypedArray(arr), typedArray, 'new ' + typedArray + '(10) is typed array of type ' + typedArray);
|
|
100
|
-
} else {
|
|
101
|
-
t.comment('# SKIP ' + typedArray + ' is not supported');
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
t.end();
|
|
105
|
-
});
|