@napi-rs/cli 3.7.2 → 3.7.3
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/dist/cli.js +201 -52
- package/dist/index.cjs +200 -51
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +201 -52
- package/package.json +3 -3
- package/src/api/__tests__/__snapshots__/templates.spec.ts.md +353 -0
- package/src/api/__tests__/__snapshots__/templates.spec.ts.snap +0 -0
- package/src/api/__tests__/android-build.spec.ts +113 -0
- package/src/api/__tests__/artifacts.spec.ts +95 -0
- package/src/api/__tests__/build-regressions.spec.ts +128 -0
- package/src/api/__tests__/build.spec.ts +1020 -0
- package/src/api/__tests__/create-npm-dirs.spec.ts +561 -0
- package/src/api/__tests__/new-node-api-version.spec.ts +87 -0
- package/src/api/__tests__/new.spec.ts +527 -0
- package/src/api/__tests__/rename.spec.ts +181 -0
- package/src/api/__tests__/templates.spec.ts +164 -0
- package/src/api/__tests__/universalize.spec.ts +128 -0
- package/src/api/artifacts.ts +7 -16
- package/src/api/build.ts +346 -105
- package/src/api/new.ts +65 -1
- package/src/commands/__tests__/new.spec.ts +13 -0
- package/src/def/build.ts +6 -6
- package/src/utils/__tests__/__fixtures__/napi_type_def +202 -0
- package/src/utils/__tests__/__fixtures__/runtime_string_enum_flag +2 -0
- package/src/utils/__tests__/__snapshots__/config.spec.ts.md +97 -0
- package/src/utils/__tests__/__snapshots__/config.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/target.spec.ts.md +180 -0
- package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/typegen.spec.ts.md +1197 -0
- package/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/version.spec.ts.md +22 -0
- package/src/utils/__tests__/__snapshots__/version.spec.ts.snap +0 -0
- package/src/utils/__tests__/config.spec.ts +81 -0
- package/src/utils/__tests__/metadata.spec.ts +28 -0
- package/src/utils/__tests__/misc.spec.ts +56 -0
- package/src/utils/__tests__/target.spec.ts +19 -0
- package/src/utils/__tests__/typegen.spec.ts +85 -0
- package/src/utils/__tests__/version.spec.ts +7 -0
- package/src/utils/version.ts +2 -0
|
@@ -0,0 +1,1197 @@
|
|
|
1
|
+
# Snapshot report for `src/utils/__tests__/typegen.spec.ts`
|
|
2
|
+
|
|
3
|
+
The actual snapshot is saved in `typegen.spec.ts.snap`.
|
|
4
|
+
|
|
5
|
+
Generated by [AVA](https://avajs.dev).
|
|
6
|
+
|
|
7
|
+
## should ident string correctly
|
|
8
|
+
|
|
9
|
+
> original ident is 0
|
|
10
|
+
|
|
11
|
+
`␊
|
|
12
|
+
/**␊
|
|
13
|
+
* should keep␊
|
|
14
|
+
* class A {␊
|
|
15
|
+
* foo = () => {}␊
|
|
16
|
+
* bar = () => {}␊
|
|
17
|
+
* }␊
|
|
18
|
+
*/␊
|
|
19
|
+
class A {␊
|
|
20
|
+
foo() {␊
|
|
21
|
+
a = b␊
|
|
22
|
+
}␊
|
|
23
|
+
␊
|
|
24
|
+
bar = () => {␊
|
|
25
|
+
␊
|
|
26
|
+
}␊
|
|
27
|
+
boz = 1␊
|
|
28
|
+
}␊
|
|
29
|
+
␊
|
|
30
|
+
namespace B {␊
|
|
31
|
+
namespace C {␊
|
|
32
|
+
type D = A␊
|
|
33
|
+
}␊
|
|
34
|
+
}␊
|
|
35
|
+
`
|
|
36
|
+
|
|
37
|
+
> original ident is 2
|
|
38
|
+
|
|
39
|
+
`␊
|
|
40
|
+
/**␊
|
|
41
|
+
* should keep␊
|
|
42
|
+
* class A {␊
|
|
43
|
+
* foo = () => {}␊
|
|
44
|
+
* bar = () => {}␊
|
|
45
|
+
* }␊
|
|
46
|
+
*/␊
|
|
47
|
+
class A {␊
|
|
48
|
+
foo() {␊
|
|
49
|
+
a = b␊
|
|
50
|
+
}␊
|
|
51
|
+
␊
|
|
52
|
+
bar = () => {␊
|
|
53
|
+
␊
|
|
54
|
+
}␊
|
|
55
|
+
boz = 1␊
|
|
56
|
+
}␊
|
|
57
|
+
␊
|
|
58
|
+
namespace B {␊
|
|
59
|
+
namespace C {␊
|
|
60
|
+
type D = A␊
|
|
61
|
+
}␊
|
|
62
|
+
}␊
|
|
63
|
+
`
|
|
64
|
+
|
|
65
|
+
## should process type def correctly
|
|
66
|
+
|
|
67
|
+
> Snapshot 1
|
|
68
|
+
|
|
69
|
+
`/**␊
|
|
70
|
+
* \`constructor\` option for \`struct\` requires all fields to be public,␊
|
|
71
|
+
* otherwise tag impl fn as constructor␊
|
|
72
|
+
* #[napi(constructor)]␊
|
|
73
|
+
*/␊
|
|
74
|
+
export declare class Animal {␊
|
|
75
|
+
/** Kind of animal */␊
|
|
76
|
+
readonly kind: Kind␊
|
|
77
|
+
/** This is the constructor */␊
|
|
78
|
+
constructor(kind: Kind, name: string)␊
|
|
79
|
+
/** This is a factory method */␊
|
|
80
|
+
static withKind(kind: Kind): Animal␊
|
|
81
|
+
get name(): string␊
|
|
82
|
+
set name(name: string)␊
|
|
83
|
+
get type(): Kind␊
|
|
84
|
+
set type(kind: Kind)␊
|
|
85
|
+
/**␊
|
|
86
|
+
* This is a␊
|
|
87
|
+
* multi-line comment␊
|
|
88
|
+
* with an emoji 🚀␊
|
|
89
|
+
*/␊
|
|
90
|
+
whoami(): string␊
|
|
91
|
+
/** This is static... */␊
|
|
92
|
+
static getDogKind(): Kind␊
|
|
93
|
+
/**␊
|
|
94
|
+
* Here are some characters and character sequences␊
|
|
95
|
+
* that should be escaped correctly:␊
|
|
96
|
+
* \\[]{}/\\:""{␊
|
|
97
|
+
* }␊
|
|
98
|
+
*/␊
|
|
99
|
+
returnOtherClass(): Dog␊
|
|
100
|
+
returnOtherClassWithCustomConstructor(): Bird␊
|
|
101
|
+
overrideIndividualArgOnMethod(normalTy: string, overriddenTy: {n: string}): Bird␊
|
|
102
|
+
}␊
|
|
103
|
+
␊
|
|
104
|
+
export declare class AnimalWithDefaultConstructor {␊
|
|
105
|
+
name: string␊
|
|
106
|
+
kind: number␊
|
|
107
|
+
constructor(name: string, kind: number)␊
|
|
108
|
+
}␊
|
|
109
|
+
␊
|
|
110
|
+
export declare class AnotherClassForEither {␊
|
|
111
|
+
constructor()␊
|
|
112
|
+
}␊
|
|
113
|
+
␊
|
|
114
|
+
export declare class AnotherCssStyleSheet {␊
|
|
115
|
+
get rules(): CssRuleList␊
|
|
116
|
+
}␊
|
|
117
|
+
export type AnotherCSSStyleSheet = AnotherCssStyleSheet␊
|
|
118
|
+
␊
|
|
119
|
+
export declare class Asset {␊
|
|
120
|
+
constructor()␊
|
|
121
|
+
get filePath(): number␊
|
|
122
|
+
}␊
|
|
123
|
+
export type JsAsset = Asset␊
|
|
124
|
+
␊
|
|
125
|
+
export declare class Assets {␊
|
|
126
|
+
constructor()␊
|
|
127
|
+
get(id: number): JsAsset | null␊
|
|
128
|
+
}␊
|
|
129
|
+
export type JsAssets = Assets␊
|
|
130
|
+
␊
|
|
131
|
+
export declare class Bird {␊
|
|
132
|
+
name: string␊
|
|
133
|
+
constructor(name: string)␊
|
|
134
|
+
getCount(): number␊
|
|
135
|
+
getNameAsync(): Promise<string>␊
|
|
136
|
+
}␊
|
|
137
|
+
␊
|
|
138
|
+
/** Smoking test for type generation */␊
|
|
139
|
+
export declare class Blake2BHasher {␊
|
|
140
|
+
static withKey(key: Blake2bKey): Blake2BHasher␊
|
|
141
|
+
update(data: Buffer): void␊
|
|
142
|
+
}␊
|
|
143
|
+
export type Blake2bHasher = Blake2BHasher␊
|
|
144
|
+
␊
|
|
145
|
+
export declare class Blake2BKey {␊
|
|
146
|
+
␊
|
|
147
|
+
}␊
|
|
148
|
+
export type Blake2bKey = Blake2BKey␊
|
|
149
|
+
␊
|
|
150
|
+
export declare class ClassWithFactory {␊
|
|
151
|
+
name: string␊
|
|
152
|
+
static withName(name: string): ClassWithFactory␊
|
|
153
|
+
setName(name: string): this␊
|
|
154
|
+
}␊
|
|
155
|
+
␊
|
|
156
|
+
export declare class Context {␊
|
|
157
|
+
maybeNeed?: boolean␊
|
|
158
|
+
buffer: Uint8Array␊
|
|
159
|
+
constructor()␊
|
|
160
|
+
static withData(data: string): Context␊
|
|
161
|
+
static withBuffer(buf: Uint8Array): Context␊
|
|
162
|
+
method(): string␊
|
|
163
|
+
}␊
|
|
164
|
+
␊
|
|
165
|
+
export declare class CssRuleList {␊
|
|
166
|
+
getRules(): Array<string>␊
|
|
167
|
+
get parentStyleSheet(): CSSStyleSheet␊
|
|
168
|
+
get name(): string | null␊
|
|
169
|
+
}␊
|
|
170
|
+
export type CSSRuleList = CssRuleList␊
|
|
171
|
+
␊
|
|
172
|
+
export declare class CssStyleSheet {␊
|
|
173
|
+
constructor(name: string, rules: Array<string>)␊
|
|
174
|
+
get rules(): CssRuleList␊
|
|
175
|
+
anotherCssStyleSheet(): AnotherCssStyleSheet␊
|
|
176
|
+
}␊
|
|
177
|
+
export type CSSStyleSheet = CssStyleSheet␊
|
|
178
|
+
␊
|
|
179
|
+
export declare class CustomFinalize {␊
|
|
180
|
+
constructor(width: number, height: number)␊
|
|
181
|
+
}␊
|
|
182
|
+
␊
|
|
183
|
+
export declare class Dog {␊
|
|
184
|
+
name: string␊
|
|
185
|
+
constructor(name: string)␊
|
|
186
|
+
}␊
|
|
187
|
+
␊
|
|
188
|
+
export declare class Fib {␊
|
|
189
|
+
[Symbol.iterator](): Iterator<number, void, number>␊
|
|
190
|
+
constructor()␊
|
|
191
|
+
}␊
|
|
192
|
+
␊
|
|
193
|
+
export declare class Fib2 {␊
|
|
194
|
+
[Symbol.iterator](): Iterator<number, void, number>␊
|
|
195
|
+
static create(seed: number): Fib2␊
|
|
196
|
+
}␊
|
|
197
|
+
␊
|
|
198
|
+
export declare class Fib3 {␊
|
|
199
|
+
current: number␊
|
|
200
|
+
next: number␊
|
|
201
|
+
constructor(current: number, next: number)␊
|
|
202
|
+
[Symbol.iterator](): Iterator<number, void, number>␊
|
|
203
|
+
}␊
|
|
204
|
+
␊
|
|
205
|
+
export declare class JsClassForEither {␊
|
|
206
|
+
constructor()␊
|
|
207
|
+
}␊
|
|
208
|
+
␊
|
|
209
|
+
export declare class JsRemote {␊
|
|
210
|
+
name(): string␊
|
|
211
|
+
}␊
|
|
212
|
+
␊
|
|
213
|
+
export declare class JsRepo {␊
|
|
214
|
+
constructor(dir: string)␊
|
|
215
|
+
remote(): JsRemote␊
|
|
216
|
+
}␊
|
|
217
|
+
␊
|
|
218
|
+
export declare class NinjaTurtle {␊
|
|
219
|
+
name: string␊
|
|
220
|
+
static isInstanceOf(value: unknown): boolean␊
|
|
221
|
+
/** Create your ninja turtle! 🐢 */␊
|
|
222
|
+
static newRaph(): NinjaTurtle␊
|
|
223
|
+
getMaskColor(): string␊
|
|
224
|
+
getName(): string␊
|
|
225
|
+
returnThis(this: this): this␊
|
|
226
|
+
}␊
|
|
227
|
+
␊
|
|
228
|
+
export declare class NotWritableClass {␊
|
|
229
|
+
name: string␊
|
|
230
|
+
constructor(name: string)␊
|
|
231
|
+
setName(name: string): void␊
|
|
232
|
+
}␊
|
|
233
|
+
␊
|
|
234
|
+
export declare class Optional {␊
|
|
235
|
+
static optionEnd(required: string, optional?: string | undefined | null): string␊
|
|
236
|
+
static optionStart(optional: string | undefined | null, required: string): string␊
|
|
237
|
+
static optionStartEnd(optional1: string | undefined | null, required: string, optional2?: string | undefined | null): string␊
|
|
238
|
+
static optionOnly(optional?: string | undefined | null): string␊
|
|
239
|
+
}␊
|
|
240
|
+
␊
|
|
241
|
+
export declare class Width {␊
|
|
242
|
+
value: number␊
|
|
243
|
+
constructor(value: number)␊
|
|
244
|
+
}␊
|
|
245
|
+
␊
|
|
246
|
+
export interface A {␊
|
|
247
|
+
foo: number␊
|
|
248
|
+
}␊
|
|
249
|
+
␊
|
|
250
|
+
export declare function acceptThreadsafeFunction(func: (err: Error | null, value: number) => any): void␊
|
|
251
|
+
␊
|
|
252
|
+
export declare function acceptThreadsafeFunctionFatal(func: (value: number) => any): void␊
|
|
253
|
+
␊
|
|
254
|
+
export declare function acceptThreadsafeFunctionTupleArgs(func: (err: Error | null, arg0: number, arg1: boolean, arg2: string) => any): void␊
|
|
255
|
+
␊
|
|
256
|
+
export declare function add(a: number, b: number): number␊
|
|
257
|
+
␊
|
|
258
|
+
export declare const enum ALIAS {␊
|
|
259
|
+
A = 0,␊
|
|
260
|
+
B = 1␊
|
|
261
|
+
}␊
|
|
262
|
+
␊
|
|
263
|
+
export interface AliasedStruct {␊
|
|
264
|
+
a: ALIAS␊
|
|
265
|
+
b: number␊
|
|
266
|
+
}␊
|
|
267
|
+
␊
|
|
268
|
+
export interface AllOptionalObject {␊
|
|
269
|
+
name?: string␊
|
|
270
|
+
age?: number␊
|
|
271
|
+
}␊
|
|
272
|
+
␊
|
|
273
|
+
export declare function appendBuffer(buf: Buffer): Buffer␊
|
|
274
|
+
␊
|
|
275
|
+
export declare function arrayBufferPassThrough(buf: Uint8Array): Promise<Uint8Array>␊
|
|
276
|
+
␊
|
|
277
|
+
export declare function asyncMultiTwo(arg: number): Promise<number>␊
|
|
278
|
+
␊
|
|
279
|
+
export declare function asyncPlus100(p: Promise<number>): Promise<number>␊
|
|
280
|
+
␊
|
|
281
|
+
export declare function asyncReduceBuffer(buf: Buffer): Promise<number>␊
|
|
282
|
+
␊
|
|
283
|
+
export interface B {␊
|
|
284
|
+
bar: number␊
|
|
285
|
+
}␊
|
|
286
|
+
␊
|
|
287
|
+
export declare function bigintAdd(a: bigint, b: bigint): bigint␊
|
|
288
|
+
␊
|
|
289
|
+
export declare function bigintFromI128(): bigint␊
|
|
290
|
+
␊
|
|
291
|
+
export declare function bigintFromI64(): bigint␊
|
|
292
|
+
␊
|
|
293
|
+
export declare function bigintGetU64AsString(bi: bigint): string␊
|
|
294
|
+
␊
|
|
295
|
+
export declare function bufferPassThrough(buf: Buffer): Promise<Buffer>␊
|
|
296
|
+
␊
|
|
297
|
+
export interface C {␊
|
|
298
|
+
baz: number␊
|
|
299
|
+
}␊
|
|
300
|
+
␊
|
|
301
|
+
export declare function callbackReturnPromise<T>(functionInput: () => T | Promise<T>, callback: (err: Error | null, result: T) => void): T | Promise<T>␊
|
|
302
|
+
␊
|
|
303
|
+
export declare function callThreadsafeFunction(callback: (...args: any[]) => any): void␊
|
|
304
|
+
␊
|
|
305
|
+
export declare function captureErrorInCallback(cb1: () => void, cb2: (arg0: Error) => void): void␊
|
|
306
|
+
␊
|
|
307
|
+
export declare function chronoDateAdd1Minute(input: Date): Date␊
|
|
308
|
+
␊
|
|
309
|
+
export declare function chronoDateToMillis(input: Date): number␊
|
|
310
|
+
␊
|
|
311
|
+
export declare function concatLatin1(s: string): string␊
|
|
312
|
+
␊
|
|
313
|
+
export declare function concatStr(s: string): string␊
|
|
314
|
+
␊
|
|
315
|
+
export declare function concatUtf16(s: string): string␊
|
|
316
|
+
␊
|
|
317
|
+
export declare function contains(source: string, target: string): boolean␊
|
|
318
|
+
␊
|
|
319
|
+
export declare function convertU32Array(input: Uint32Array): Array<number>␊
|
|
320
|
+
␊
|
|
321
|
+
export declare function createBigInt(): bigint␊
|
|
322
|
+
␊
|
|
323
|
+
export declare function createBigIntI64(): bigint␊
|
|
324
|
+
␊
|
|
325
|
+
export declare function createExternal(size: number): ExternalObject<number>␊
|
|
326
|
+
␊
|
|
327
|
+
export declare function createExternalString(content: string): ExternalObject<string>␊
|
|
328
|
+
␊
|
|
329
|
+
export declare function createExternalTypedArray(): Uint32Array␊
|
|
330
|
+
␊
|
|
331
|
+
export declare function createObj(): object␊
|
|
332
|
+
␊
|
|
333
|
+
export declare function createObjectWithClassField(): ObjectFieldClassInstance␊
|
|
334
|
+
␊
|
|
335
|
+
export declare function createObjWithProperty(): { value: ArrayBuffer, get getter(): number }␊
|
|
336
|
+
␊
|
|
337
|
+
export declare function createSymbol(): symbol␊
|
|
338
|
+
␊
|
|
339
|
+
/** You could break the step and for an new continuous value. */␊
|
|
340
|
+
export declare const enum CustomNumEnum {␊
|
|
341
|
+
One = 1,␊
|
|
342
|
+
Two = 2,␊
|
|
343
|
+
Three = 3,␊
|
|
344
|
+
Four = 4,␊
|
|
345
|
+
Six = 6,␊
|
|
346
|
+
Eight = 8,␊
|
|
347
|
+
Nine = 9,␊
|
|
348
|
+
Ten = 10␊
|
|
349
|
+
}␊
|
|
350
|
+
␊
|
|
351
|
+
export declare function customStatusCode(): void␊
|
|
352
|
+
␊
|
|
353
|
+
export interface Dates {␊
|
|
354
|
+
start: Date␊
|
|
355
|
+
end?: Date␊
|
|
356
|
+
}␊
|
|
357
|
+
␊
|
|
358
|
+
export declare function dateToNumber(input: Date): number␊
|
|
359
|
+
␊
|
|
360
|
+
/** This is a const */␊
|
|
361
|
+
export const DEFAULT_COST: number␊
|
|
362
|
+
␊
|
|
363
|
+
export declare function derefUint8Array(a: Uint8Array, b: Uint8ClampedArray): number␊
|
|
364
|
+
␊
|
|
365
|
+
export declare function either3(input: string | number | boolean): number␊
|
|
366
|
+
␊
|
|
367
|
+
export declare function either4(input: string | number | boolean | Obj): number␊
|
|
368
|
+
␊
|
|
369
|
+
export declare function eitherBoolOrFunction(input: boolean | ((...args: any[]) => any)): void␊
|
|
370
|
+
␊
|
|
371
|
+
export declare function eitherFromObjects(input: A | B | C): string␊
|
|
372
|
+
␊
|
|
373
|
+
export declare function eitherFromOption(): JsClassForEither | undefined␊
|
|
374
|
+
␊
|
|
375
|
+
export declare function eitherStringOrNumber(input: string | number): number␊
|
|
376
|
+
␊
|
|
377
|
+
export declare const enum Empty {␊
|
|
378
|
+
␊
|
|
379
|
+
}␊
|
|
380
|
+
␊
|
|
381
|
+
export declare function enumToI32(e: CustomNumEnum): number␊
|
|
382
|
+
␊
|
|
383
|
+
export declare function fibonacci(n: number): number␊
|
|
384
|
+
␊
|
|
385
|
+
export declare function fnReceivedAliased(s: AliasedStruct, e: ALIAS): void␊
|
|
386
|
+
␊
|
|
387
|
+
export declare function getBuffer(): Buffer␊
|
|
388
|
+
␊
|
|
389
|
+
export declare function getCwd(callback: (arg0: string) => void): void␊
|
|
390
|
+
␊
|
|
391
|
+
export declare function getEmptyBuffer(): Buffer␊
|
|
392
|
+
␊
|
|
393
|
+
export declare function getExternal(external: ExternalObject<number>): number␊
|
|
394
|
+
␊
|
|
395
|
+
export declare function getGlobal(): typeof global␊
|
|
396
|
+
␊
|
|
397
|
+
export declare function getMapping(): Record<string, number>␊
|
|
398
|
+
␊
|
|
399
|
+
export declare function getNestedNumArr(): number[][][]␊
|
|
400
|
+
␊
|
|
401
|
+
export declare function getNull(): null␊
|
|
402
|
+
␊
|
|
403
|
+
export declare function getNumArr(): number[]␊
|
|
404
|
+
␊
|
|
405
|
+
/** Gets some numbers */␊
|
|
406
|
+
export declare function getNums(): Array<number>␊
|
|
407
|
+
␊
|
|
408
|
+
export declare function getPackageJsonName(packageJson: PackageJson): string␊
|
|
409
|
+
␊
|
|
410
|
+
export declare function getStrFromObject(): void␊
|
|
411
|
+
␊
|
|
412
|
+
export declare function getterFromObj(): number␊
|
|
413
|
+
␊
|
|
414
|
+
export declare function getUndefined(): void␊
|
|
415
|
+
␊
|
|
416
|
+
export declare function getWords(): Array<string>␊
|
|
417
|
+
␊
|
|
418
|
+
/** default enum values are continuos i32s start from 0 */␊
|
|
419
|
+
export declare const enum Kind {␊
|
|
420
|
+
/** Barks */␊
|
|
421
|
+
Dog = 0,␊
|
|
422
|
+
/** Kills birds */␊
|
|
423
|
+
Cat = 1,␊
|
|
424
|
+
/** Tasty */␊
|
|
425
|
+
Duck = 2␊
|
|
426
|
+
}␊
|
|
427
|
+
␊
|
|
428
|
+
export declare function listObjKeys(obj: object): Array<string>␊
|
|
429
|
+
␊
|
|
430
|
+
export declare function mapOption(val?: number | undefined | null): number | null␊
|
|
431
|
+
␊
|
|
432
|
+
export declare function mutateExternal(external: ExternalObject<number>, newVal: number): void␊
|
|
433
|
+
␊
|
|
434
|
+
export declare function mutateTypedArray(input: Float32Array): void␊
|
|
435
|
+
␊
|
|
436
|
+
export interface Obj {␊
|
|
437
|
+
v: string | number␊
|
|
438
|
+
}␊
|
|
439
|
+
␊
|
|
440
|
+
export interface ObjectFieldClassInstance {␊
|
|
441
|
+
bird: Bird␊
|
|
442
|
+
}␊
|
|
443
|
+
␊
|
|
444
|
+
export interface ObjectOnlyFromJs {␊
|
|
445
|
+
count: number␊
|
|
446
|
+
callback: (err: Error | null, value: number) => any␊
|
|
447
|
+
}␊
|
|
448
|
+
␊
|
|
449
|
+
export declare function optionEnd(callback: (arg0: string, arg1?: string | undefined | null) => void): void␊
|
|
450
|
+
␊
|
|
451
|
+
export declare function optionOnly(callback: (arg0?: string | undefined | null) => void): void␊
|
|
452
|
+
␊
|
|
453
|
+
export declare function optionStart(callback: (arg0: string | undefined | null, arg1: string) => void): void␊
|
|
454
|
+
␊
|
|
455
|
+
export declare function optionStartEnd(callback: (arg0: string | undefined | null, arg1: string, arg2?: string | undefined | null) => void): void␊
|
|
456
|
+
␊
|
|
457
|
+
export declare function overrideIndividualArgOnFunction(notOverridden: string, f: () => string, notOverridden2: number): string␊
|
|
458
|
+
␊
|
|
459
|
+
export declare function overrideIndividualArgOnFunctionWithCbArg(callback: (town: string, name?: string | undefined | null) => string, notOverridden: number): object␊
|
|
460
|
+
␊
|
|
461
|
+
/** This is an interface for package.json */␊
|
|
462
|
+
export interface PackageJson {␊
|
|
463
|
+
name: string␊
|
|
464
|
+
/** The version of the package */␊
|
|
465
|
+
version: string␊
|
|
466
|
+
dependencies?: Record<string, any>␊
|
|
467
|
+
devDependencies?: Record<string, any>␊
|
|
468
|
+
}␊
|
|
469
|
+
␊
|
|
470
|
+
export declare function panic(): void␊
|
|
471
|
+
␊
|
|
472
|
+
export declare function plusOne(this: Width): number␊
|
|
473
|
+
␊
|
|
474
|
+
export declare function promiseInEither(input: number | Promise<number>): Promise<boolean>␊
|
|
475
|
+
␊
|
|
476
|
+
/** napi = { version = 2, features = ["serde-json"] } */␊
|
|
477
|
+
export declare function readFile(callback: (arg0: Error | undefined, arg1?: string | undefined | null) => void): void␊
|
|
478
|
+
␊
|
|
479
|
+
export declare function readFileAsync(path: string): Promise<Buffer>␊
|
|
480
|
+
␊
|
|
481
|
+
export declare function readPackageJson(): PackageJson␊
|
|
482
|
+
␊
|
|
483
|
+
export declare function receiveAllOptionalObject(obj?: AllOptionalObject | undefined | null): void␊
|
|
484
|
+
␊
|
|
485
|
+
export declare function receiveClassOrNumber(either: number | JsClassForEither): number␊
|
|
486
|
+
␊
|
|
487
|
+
export declare function receiveDifferentClass(either: JsClassForEither | AnotherClassForEither): number␊
|
|
488
|
+
␊
|
|
489
|
+
export declare function receiveMutClassOrNumber(either: number | JsClassForEither): number␊
|
|
490
|
+
␊
|
|
491
|
+
export declare function receiveObjectOnlyFromJs(obj: { count: number, callback: (err: Error | null, count: number) => void }): void␊
|
|
492
|
+
␊
|
|
493
|
+
export declare function receiveObjectWithClassField(object: ObjectFieldClassInstance): Bird␊
|
|
494
|
+
␊
|
|
495
|
+
export declare function receiveStrictObject(strictObject: StrictObject): void␊
|
|
496
|
+
␊
|
|
497
|
+
export declare function receiveString(s: string): string␊
|
|
498
|
+
␊
|
|
499
|
+
export declare function returnEither(input: number): string | number␊
|
|
500
|
+
␊
|
|
501
|
+
export declare function returnEitherClass(input: number): number | JsClassForEither␊
|
|
502
|
+
␊
|
|
503
|
+
export declare function returnJsFunction(): (...args: any[]) => any␊
|
|
504
|
+
␊
|
|
505
|
+
export declare function returnNull(): null␊
|
|
506
|
+
␊
|
|
507
|
+
export declare function returnUndefined(): void␊
|
|
508
|
+
␊
|
|
509
|
+
export declare function returnUndefinedIfInvalid(input: boolean): boolean␊
|
|
510
|
+
␊
|
|
511
|
+
export declare function returnUndefinedIfInvalidPromise(input: Promise<boolean>): Promise<boolean>␊
|
|
512
|
+
␊
|
|
513
|
+
export declare function roundtripStr(s: string): string␊
|
|
514
|
+
␊
|
|
515
|
+
export declare function runScript(script: string): unknown␊
|
|
516
|
+
␊
|
|
517
|
+
export declare function setSymbolInObj(symbol: symbol): object␊
|
|
518
|
+
␊
|
|
519
|
+
export declare const enum Status {␊
|
|
520
|
+
Pristine = 'Pristine',␊
|
|
521
|
+
Loading = 'Loading',␊
|
|
522
|
+
Ready = 'Ready'␊
|
|
523
|
+
}␊
|
|
524
|
+
␊
|
|
525
|
+
export interface StrictObject {␊
|
|
526
|
+
name: string␊
|
|
527
|
+
}␊
|
|
528
|
+
␊
|
|
529
|
+
export declare function sumMapping(nums: Record<string, number>): number␊
|
|
530
|
+
␊
|
|
531
|
+
export declare function sumNums(nums: Array<number>): number␊
|
|
532
|
+
␊
|
|
533
|
+
export declare function testSerdeRoundtrip(data: any): any␊
|
|
534
|
+
␊
|
|
535
|
+
export declare function threadsafeFunctionClosureCapture(func: (...args: any[]) => any): void␊
|
|
536
|
+
␊
|
|
537
|
+
export declare function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void␊
|
|
538
|
+
␊
|
|
539
|
+
export declare function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void␊
|
|
540
|
+
␊
|
|
541
|
+
export declare function threadsafeFunctionThrowError(cb: (...args: any[]) => any): void␊
|
|
542
|
+
␊
|
|
543
|
+
export declare function throwError(): void␊
|
|
544
|
+
␊
|
|
545
|
+
export declare function toJsObj(): object␊
|
|
546
|
+
␊
|
|
547
|
+
export declare function tsfnAsyncCall(func: (...args: any[]) => any): Promise<void>␊
|
|
548
|
+
␊
|
|
549
|
+
export declare function tsfnCallWithCallback(func: (...args: any[]) => any): void␊
|
|
550
|
+
␊
|
|
551
|
+
export declare function tsRename(a: { foo: number }): string[]␊
|
|
552
|
+
␊
|
|
553
|
+
export interface TsTypeChanged {␊
|
|
554
|
+
typeOverride: object␊
|
|
555
|
+
typeOverrideOptional?: object␊
|
|
556
|
+
}␊
|
|
557
|
+
␊
|
|
558
|
+
export declare function validateArray(arr: Array<number>): number␊
|
|
559
|
+
␊
|
|
560
|
+
export declare function validateBigint(input: bigint): bigint␊
|
|
561
|
+
␊
|
|
562
|
+
export declare function validateBoolean(i: boolean): boolean␊
|
|
563
|
+
␊
|
|
564
|
+
export declare function validateBuffer(b: Buffer): number␊
|
|
565
|
+
␊
|
|
566
|
+
export declare function validateDate(d: Date): number␊
|
|
567
|
+
␊
|
|
568
|
+
export declare function validateDateTime(d: Date): number␊
|
|
569
|
+
␊
|
|
570
|
+
export declare function validateExternal(e: ExternalObject<number>): number␊
|
|
571
|
+
␊
|
|
572
|
+
export declare function validateFunction(cb: () => number): number␊
|
|
573
|
+
␊
|
|
574
|
+
export declare function validateHashMap(input: Record<string, number>): number␊
|
|
575
|
+
␊
|
|
576
|
+
export declare function validateNull(i: null): boolean␊
|
|
577
|
+
␊
|
|
578
|
+
export declare function validateNumber(i: number): number␊
|
|
579
|
+
␊
|
|
580
|
+
export declare function validateOptional(input1?: string | undefined | null, input2?: boolean | undefined | null): boolean␊
|
|
581
|
+
␊
|
|
582
|
+
export declare function validatePromise(p: Promise<number>): Promise<number>␊
|
|
583
|
+
␊
|
|
584
|
+
export declare function validateString(s: string): string␊
|
|
585
|
+
␊
|
|
586
|
+
export declare function validateSymbol(s: symbol): boolean␊
|
|
587
|
+
␊
|
|
588
|
+
export declare function validateTypedArray(input: Uint8Array): number␊
|
|
589
|
+
␊
|
|
590
|
+
export declare function validateUndefined(i: undefined): boolean␊
|
|
591
|
+
␊
|
|
592
|
+
export declare function withAbortController(a: number, b: number, signal: AbortSignal): Promise<number>␊
|
|
593
|
+
␊
|
|
594
|
+
export declare function withoutAbortController(a: number, b: number): Promise<number>␊
|
|
595
|
+
␊
|
|
596
|
+
export declare function xxh64Alias(input: Buffer): bigint␊
|
|
597
|
+
␊
|
|
598
|
+
export declare namespace xxh2 {␊
|
|
599
|
+
export function xxh2Plus(a: number, b: number): number␊
|
|
600
|
+
export function xxh3Xxh64Alias(input: Buffer): bigint␊
|
|
601
|
+
}␊
|
|
602
|
+
␊
|
|
603
|
+
export declare namespace xxh3 {␊
|
|
604
|
+
/** Xxh3 class */␊
|
|
605
|
+
export class Xxh3 {␊
|
|
606
|
+
constructor()␊
|
|
607
|
+
/** update */␊
|
|
608
|
+
update(input: Buffer): void␊
|
|
609
|
+
digest(): bigint␊
|
|
610
|
+
}␊
|
|
611
|
+
export const ALIGNMENT: number␊
|
|
612
|
+
/** xxh128 function */␊
|
|
613
|
+
export function xxh128(input: Buffer): bigint␊
|
|
614
|
+
export function xxh3_64(input: Buffer): bigint␊
|
|
615
|
+
}␊
|
|
616
|
+
`
|
|
617
|
+
|
|
618
|
+
## should process type def with noConstEnum correctly
|
|
619
|
+
|
|
620
|
+
> Snapshot 1
|
|
621
|
+
|
|
622
|
+
`/**␊
|
|
623
|
+
* \`constructor\` option for \`struct\` requires all fields to be public,␊
|
|
624
|
+
* otherwise tag impl fn as constructor␊
|
|
625
|
+
* #[napi(constructor)]␊
|
|
626
|
+
*/␊
|
|
627
|
+
export declare class Animal {␊
|
|
628
|
+
/** Kind of animal */␊
|
|
629
|
+
readonly kind: Kind␊
|
|
630
|
+
/** This is the constructor */␊
|
|
631
|
+
constructor(kind: Kind, name: string)␊
|
|
632
|
+
/** This is a factory method */␊
|
|
633
|
+
static withKind(kind: Kind): Animal␊
|
|
634
|
+
get name(): string␊
|
|
635
|
+
set name(name: string)␊
|
|
636
|
+
get type(): Kind␊
|
|
637
|
+
set type(kind: Kind)␊
|
|
638
|
+
/**␊
|
|
639
|
+
* This is a␊
|
|
640
|
+
* multi-line comment␊
|
|
641
|
+
* with an emoji 🚀␊
|
|
642
|
+
*/␊
|
|
643
|
+
whoami(): string␊
|
|
644
|
+
/** This is static... */␊
|
|
645
|
+
static getDogKind(): Kind␊
|
|
646
|
+
/**␊
|
|
647
|
+
* Here are some characters and character sequences␊
|
|
648
|
+
* that should be escaped correctly:␊
|
|
649
|
+
* \\[]{}/\\:""{␊
|
|
650
|
+
* }␊
|
|
651
|
+
*/␊
|
|
652
|
+
returnOtherClass(): Dog␊
|
|
653
|
+
returnOtherClassWithCustomConstructor(): Bird␊
|
|
654
|
+
overrideIndividualArgOnMethod(normalTy: string, overriddenTy: {n: string}): Bird␊
|
|
655
|
+
}␊
|
|
656
|
+
␊
|
|
657
|
+
export declare class AnimalWithDefaultConstructor {␊
|
|
658
|
+
name: string␊
|
|
659
|
+
kind: number␊
|
|
660
|
+
constructor(name: string, kind: number)␊
|
|
661
|
+
}␊
|
|
662
|
+
␊
|
|
663
|
+
export declare class AnotherClassForEither {␊
|
|
664
|
+
constructor()␊
|
|
665
|
+
}␊
|
|
666
|
+
␊
|
|
667
|
+
export declare class AnotherCssStyleSheet {␊
|
|
668
|
+
get rules(): CssRuleList␊
|
|
669
|
+
}␊
|
|
670
|
+
export type AnotherCSSStyleSheet = AnotherCssStyleSheet␊
|
|
671
|
+
␊
|
|
672
|
+
export declare class Asset {␊
|
|
673
|
+
constructor()␊
|
|
674
|
+
get filePath(): number␊
|
|
675
|
+
}␊
|
|
676
|
+
export type JsAsset = Asset␊
|
|
677
|
+
␊
|
|
678
|
+
export declare class Assets {␊
|
|
679
|
+
constructor()␊
|
|
680
|
+
get(id: number): JsAsset | null␊
|
|
681
|
+
}␊
|
|
682
|
+
export type JsAssets = Assets␊
|
|
683
|
+
␊
|
|
684
|
+
export declare class Bird {␊
|
|
685
|
+
name: string␊
|
|
686
|
+
constructor(name: string)␊
|
|
687
|
+
getCount(): number␊
|
|
688
|
+
getNameAsync(): Promise<string>␊
|
|
689
|
+
}␊
|
|
690
|
+
␊
|
|
691
|
+
/** Smoking test for type generation */␊
|
|
692
|
+
export declare class Blake2BHasher {␊
|
|
693
|
+
static withKey(key: Blake2bKey): Blake2BHasher␊
|
|
694
|
+
update(data: Buffer): void␊
|
|
695
|
+
}␊
|
|
696
|
+
export type Blake2bHasher = Blake2BHasher␊
|
|
697
|
+
␊
|
|
698
|
+
export declare class Blake2BKey {␊
|
|
699
|
+
␊
|
|
700
|
+
}␊
|
|
701
|
+
export type Blake2bKey = Blake2BKey␊
|
|
702
|
+
␊
|
|
703
|
+
export declare class ClassWithFactory {␊
|
|
704
|
+
name: string␊
|
|
705
|
+
static withName(name: string): ClassWithFactory␊
|
|
706
|
+
setName(name: string): this␊
|
|
707
|
+
}␊
|
|
708
|
+
␊
|
|
709
|
+
export declare class Context {␊
|
|
710
|
+
maybeNeed?: boolean␊
|
|
711
|
+
buffer: Uint8Array␊
|
|
712
|
+
constructor()␊
|
|
713
|
+
static withData(data: string): Context␊
|
|
714
|
+
static withBuffer(buf: Uint8Array): Context␊
|
|
715
|
+
method(): string␊
|
|
716
|
+
}␊
|
|
717
|
+
␊
|
|
718
|
+
export declare class CssRuleList {␊
|
|
719
|
+
getRules(): Array<string>␊
|
|
720
|
+
get parentStyleSheet(): CSSStyleSheet␊
|
|
721
|
+
get name(): string | null␊
|
|
722
|
+
}␊
|
|
723
|
+
export type CSSRuleList = CssRuleList␊
|
|
724
|
+
␊
|
|
725
|
+
export declare class CssStyleSheet {␊
|
|
726
|
+
constructor(name: string, rules: Array<string>)␊
|
|
727
|
+
get rules(): CssRuleList␊
|
|
728
|
+
anotherCssStyleSheet(): AnotherCssStyleSheet␊
|
|
729
|
+
}␊
|
|
730
|
+
export type CSSStyleSheet = CssStyleSheet␊
|
|
731
|
+
␊
|
|
732
|
+
export declare class CustomFinalize {␊
|
|
733
|
+
constructor(width: number, height: number)␊
|
|
734
|
+
}␊
|
|
735
|
+
␊
|
|
736
|
+
export declare class Dog {␊
|
|
737
|
+
name: string␊
|
|
738
|
+
constructor(name: string)␊
|
|
739
|
+
}␊
|
|
740
|
+
␊
|
|
741
|
+
export declare class Fib {␊
|
|
742
|
+
[Symbol.iterator](): Iterator<number, void, number>␊
|
|
743
|
+
constructor()␊
|
|
744
|
+
}␊
|
|
745
|
+
␊
|
|
746
|
+
export declare class Fib2 {␊
|
|
747
|
+
[Symbol.iterator](): Iterator<number, void, number>␊
|
|
748
|
+
static create(seed: number): Fib2␊
|
|
749
|
+
}␊
|
|
750
|
+
␊
|
|
751
|
+
export declare class Fib3 {␊
|
|
752
|
+
current: number␊
|
|
753
|
+
next: number␊
|
|
754
|
+
constructor(current: number, next: number)␊
|
|
755
|
+
[Symbol.iterator](): Iterator<number, void, number>␊
|
|
756
|
+
}␊
|
|
757
|
+
␊
|
|
758
|
+
export declare class JsClassForEither {␊
|
|
759
|
+
constructor()␊
|
|
760
|
+
}␊
|
|
761
|
+
␊
|
|
762
|
+
export declare class JsRemote {␊
|
|
763
|
+
name(): string␊
|
|
764
|
+
}␊
|
|
765
|
+
␊
|
|
766
|
+
export declare class JsRepo {␊
|
|
767
|
+
constructor(dir: string)␊
|
|
768
|
+
remote(): JsRemote␊
|
|
769
|
+
}␊
|
|
770
|
+
␊
|
|
771
|
+
export declare class NinjaTurtle {␊
|
|
772
|
+
name: string␊
|
|
773
|
+
static isInstanceOf(value: unknown): boolean␊
|
|
774
|
+
/** Create your ninja turtle! 🐢 */␊
|
|
775
|
+
static newRaph(): NinjaTurtle␊
|
|
776
|
+
getMaskColor(): string␊
|
|
777
|
+
getName(): string␊
|
|
778
|
+
returnThis(this: this): this␊
|
|
779
|
+
}␊
|
|
780
|
+
␊
|
|
781
|
+
export declare class NotWritableClass {␊
|
|
782
|
+
name: string␊
|
|
783
|
+
constructor(name: string)␊
|
|
784
|
+
setName(name: string): void␊
|
|
785
|
+
}␊
|
|
786
|
+
␊
|
|
787
|
+
export declare class Optional {␊
|
|
788
|
+
static optionEnd(required: string, optional?: string | undefined | null): string␊
|
|
789
|
+
static optionStart(optional: string | undefined | null, required: string): string␊
|
|
790
|
+
static optionStartEnd(optional1: string | undefined | null, required: string, optional2?: string | undefined | null): string␊
|
|
791
|
+
static optionOnly(optional?: string | undefined | null): string␊
|
|
792
|
+
}␊
|
|
793
|
+
␊
|
|
794
|
+
export declare class Width {␊
|
|
795
|
+
value: number␊
|
|
796
|
+
constructor(value: number)␊
|
|
797
|
+
}␊
|
|
798
|
+
␊
|
|
799
|
+
export interface A {␊
|
|
800
|
+
foo: number␊
|
|
801
|
+
}␊
|
|
802
|
+
␊
|
|
803
|
+
export declare function acceptThreadsafeFunction(func: (err: Error | null, value: number) => any): void␊
|
|
804
|
+
␊
|
|
805
|
+
export declare function acceptThreadsafeFunctionFatal(func: (value: number) => any): void␊
|
|
806
|
+
␊
|
|
807
|
+
export declare function acceptThreadsafeFunctionTupleArgs(func: (err: Error | null, arg0: number, arg1: boolean, arg2: string) => any): void␊
|
|
808
|
+
␊
|
|
809
|
+
export declare function add(a: number, b: number): number␊
|
|
810
|
+
␊
|
|
811
|
+
export declare enum ALIAS {␊
|
|
812
|
+
A = 0,␊
|
|
813
|
+
B = 1␊
|
|
814
|
+
}␊
|
|
815
|
+
␊
|
|
816
|
+
export interface AliasedStruct {␊
|
|
817
|
+
a: ALIAS␊
|
|
818
|
+
b: number␊
|
|
819
|
+
}␊
|
|
820
|
+
␊
|
|
821
|
+
export interface AllOptionalObject {␊
|
|
822
|
+
name?: string␊
|
|
823
|
+
age?: number␊
|
|
824
|
+
}␊
|
|
825
|
+
␊
|
|
826
|
+
export declare function appendBuffer(buf: Buffer): Buffer␊
|
|
827
|
+
␊
|
|
828
|
+
export declare function arrayBufferPassThrough(buf: Uint8Array): Promise<Uint8Array>␊
|
|
829
|
+
␊
|
|
830
|
+
export declare function asyncMultiTwo(arg: number): Promise<number>␊
|
|
831
|
+
␊
|
|
832
|
+
export declare function asyncPlus100(p: Promise<number>): Promise<number>␊
|
|
833
|
+
␊
|
|
834
|
+
export declare function asyncReduceBuffer(buf: Buffer): Promise<number>␊
|
|
835
|
+
␊
|
|
836
|
+
export interface B {␊
|
|
837
|
+
bar: number␊
|
|
838
|
+
}␊
|
|
839
|
+
␊
|
|
840
|
+
export declare function bigintAdd(a: bigint, b: bigint): bigint␊
|
|
841
|
+
␊
|
|
842
|
+
export declare function bigintFromI128(): bigint␊
|
|
843
|
+
␊
|
|
844
|
+
export declare function bigintFromI64(): bigint␊
|
|
845
|
+
␊
|
|
846
|
+
export declare function bigintGetU64AsString(bi: bigint): string␊
|
|
847
|
+
␊
|
|
848
|
+
export declare function bufferPassThrough(buf: Buffer): Promise<Buffer>␊
|
|
849
|
+
␊
|
|
850
|
+
export interface C {␊
|
|
851
|
+
baz: number␊
|
|
852
|
+
}␊
|
|
853
|
+
␊
|
|
854
|
+
export declare function callbackReturnPromise<T>(functionInput: () => T | Promise<T>, callback: (err: Error | null, result: T) => void): T | Promise<T>␊
|
|
855
|
+
␊
|
|
856
|
+
export declare function callThreadsafeFunction(callback: (...args: any[]) => any): void␊
|
|
857
|
+
␊
|
|
858
|
+
export declare function captureErrorInCallback(cb1: () => void, cb2: (arg0: Error) => void): void␊
|
|
859
|
+
␊
|
|
860
|
+
export declare function chronoDateAdd1Minute(input: Date): Date␊
|
|
861
|
+
␊
|
|
862
|
+
export declare function chronoDateToMillis(input: Date): number␊
|
|
863
|
+
␊
|
|
864
|
+
export declare function concatLatin1(s: string): string␊
|
|
865
|
+
␊
|
|
866
|
+
export declare function concatStr(s: string): string␊
|
|
867
|
+
␊
|
|
868
|
+
export declare function concatUtf16(s: string): string␊
|
|
869
|
+
␊
|
|
870
|
+
export declare function contains(source: string, target: string): boolean␊
|
|
871
|
+
␊
|
|
872
|
+
export declare function convertU32Array(input: Uint32Array): Array<number>␊
|
|
873
|
+
␊
|
|
874
|
+
export declare function createBigInt(): bigint␊
|
|
875
|
+
␊
|
|
876
|
+
export declare function createBigIntI64(): bigint␊
|
|
877
|
+
␊
|
|
878
|
+
export declare function createExternal(size: number): ExternalObject<number>␊
|
|
879
|
+
␊
|
|
880
|
+
export declare function createExternalString(content: string): ExternalObject<string>␊
|
|
881
|
+
␊
|
|
882
|
+
export declare function createExternalTypedArray(): Uint32Array␊
|
|
883
|
+
␊
|
|
884
|
+
export declare function createObj(): object␊
|
|
885
|
+
␊
|
|
886
|
+
export declare function createObjectWithClassField(): ObjectFieldClassInstance␊
|
|
887
|
+
␊
|
|
888
|
+
export declare function createObjWithProperty(): { value: ArrayBuffer, get getter(): number }␊
|
|
889
|
+
␊
|
|
890
|
+
export declare function createSymbol(): symbol␊
|
|
891
|
+
␊
|
|
892
|
+
/** You could break the step and for an new continuous value. */␊
|
|
893
|
+
export declare enum CustomNumEnum {␊
|
|
894
|
+
One = 1,␊
|
|
895
|
+
Two = 2,␊
|
|
896
|
+
Three = 3,␊
|
|
897
|
+
Four = 4,␊
|
|
898
|
+
Six = 6,␊
|
|
899
|
+
Eight = 8,␊
|
|
900
|
+
Nine = 9,␊
|
|
901
|
+
Ten = 10␊
|
|
902
|
+
}␊
|
|
903
|
+
␊
|
|
904
|
+
export declare function customStatusCode(): void␊
|
|
905
|
+
␊
|
|
906
|
+
export interface Dates {␊
|
|
907
|
+
start: Date␊
|
|
908
|
+
end?: Date␊
|
|
909
|
+
}␊
|
|
910
|
+
␊
|
|
911
|
+
export declare function dateToNumber(input: Date): number␊
|
|
912
|
+
␊
|
|
913
|
+
/** This is a const */␊
|
|
914
|
+
export const DEFAULT_COST: number␊
|
|
915
|
+
␊
|
|
916
|
+
export declare function derefUint8Array(a: Uint8Array, b: Uint8ClampedArray): number␊
|
|
917
|
+
␊
|
|
918
|
+
export declare function either3(input: string | number | boolean): number␊
|
|
919
|
+
␊
|
|
920
|
+
export declare function either4(input: string | number | boolean | Obj): number␊
|
|
921
|
+
␊
|
|
922
|
+
export declare function eitherBoolOrFunction(input: boolean | ((...args: any[]) => any)): void␊
|
|
923
|
+
␊
|
|
924
|
+
export declare function eitherFromObjects(input: A | B | C): string␊
|
|
925
|
+
␊
|
|
926
|
+
export declare function eitherFromOption(): JsClassForEither | undefined␊
|
|
927
|
+
␊
|
|
928
|
+
export declare function eitherStringOrNumber(input: string | number): number␊
|
|
929
|
+
␊
|
|
930
|
+
export declare enum Empty {␊
|
|
931
|
+
␊
|
|
932
|
+
}␊
|
|
933
|
+
␊
|
|
934
|
+
export declare function enumToI32(e: CustomNumEnum): number␊
|
|
935
|
+
␊
|
|
936
|
+
export declare function fibonacci(n: number): number␊
|
|
937
|
+
␊
|
|
938
|
+
export declare function fnReceivedAliased(s: AliasedStruct, e: ALIAS): void␊
|
|
939
|
+
␊
|
|
940
|
+
export declare function getBuffer(): Buffer␊
|
|
941
|
+
␊
|
|
942
|
+
export declare function getCwd(callback: (arg0: string) => void): void␊
|
|
943
|
+
␊
|
|
944
|
+
export declare function getEmptyBuffer(): Buffer␊
|
|
945
|
+
␊
|
|
946
|
+
export declare function getExternal(external: ExternalObject<number>): number␊
|
|
947
|
+
␊
|
|
948
|
+
export declare function getGlobal(): typeof global␊
|
|
949
|
+
␊
|
|
950
|
+
export declare function getMapping(): Record<string, number>␊
|
|
951
|
+
␊
|
|
952
|
+
export declare function getNestedNumArr(): number[][][]␊
|
|
953
|
+
␊
|
|
954
|
+
export declare function getNull(): null␊
|
|
955
|
+
␊
|
|
956
|
+
export declare function getNumArr(): number[]␊
|
|
957
|
+
␊
|
|
958
|
+
/** Gets some numbers */␊
|
|
959
|
+
export declare function getNums(): Array<number>␊
|
|
960
|
+
␊
|
|
961
|
+
export declare function getPackageJsonName(packageJson: PackageJson): string␊
|
|
962
|
+
␊
|
|
963
|
+
export declare function getStrFromObject(): void␊
|
|
964
|
+
␊
|
|
965
|
+
export declare function getterFromObj(): number␊
|
|
966
|
+
␊
|
|
967
|
+
export declare function getUndefined(): void␊
|
|
968
|
+
␊
|
|
969
|
+
export declare function getWords(): Array<string>␊
|
|
970
|
+
␊
|
|
971
|
+
/** default enum values are continuos i32s start from 0 */␊
|
|
972
|
+
export declare enum Kind {␊
|
|
973
|
+
/** Barks */␊
|
|
974
|
+
Dog = 0,␊
|
|
975
|
+
/** Kills birds */␊
|
|
976
|
+
Cat = 1,␊
|
|
977
|
+
/** Tasty */␊
|
|
978
|
+
Duck = 2␊
|
|
979
|
+
}␊
|
|
980
|
+
␊
|
|
981
|
+
export declare function listObjKeys(obj: object): Array<string>␊
|
|
982
|
+
␊
|
|
983
|
+
export declare function mapOption(val?: number | undefined | null): number | null␊
|
|
984
|
+
␊
|
|
985
|
+
export declare function mutateExternal(external: ExternalObject<number>, newVal: number): void␊
|
|
986
|
+
␊
|
|
987
|
+
export declare function mutateTypedArray(input: Float32Array): void␊
|
|
988
|
+
␊
|
|
989
|
+
export interface Obj {␊
|
|
990
|
+
v: string | number␊
|
|
991
|
+
}␊
|
|
992
|
+
␊
|
|
993
|
+
export interface ObjectFieldClassInstance {␊
|
|
994
|
+
bird: Bird␊
|
|
995
|
+
}␊
|
|
996
|
+
␊
|
|
997
|
+
export interface ObjectOnlyFromJs {␊
|
|
998
|
+
count: number␊
|
|
999
|
+
callback: (err: Error | null, value: number) => any␊
|
|
1000
|
+
}␊
|
|
1001
|
+
␊
|
|
1002
|
+
export declare function optionEnd(callback: (arg0: string, arg1?: string | undefined | null) => void): void␊
|
|
1003
|
+
␊
|
|
1004
|
+
export declare function optionOnly(callback: (arg0?: string | undefined | null) => void): void␊
|
|
1005
|
+
␊
|
|
1006
|
+
export declare function optionStart(callback: (arg0: string | undefined | null, arg1: string) => void): void␊
|
|
1007
|
+
␊
|
|
1008
|
+
export declare function optionStartEnd(callback: (arg0: string | undefined | null, arg1: string, arg2?: string | undefined | null) => void): void␊
|
|
1009
|
+
␊
|
|
1010
|
+
export declare function overrideIndividualArgOnFunction(notOverridden: string, f: () => string, notOverridden2: number): string␊
|
|
1011
|
+
␊
|
|
1012
|
+
export declare function overrideIndividualArgOnFunctionWithCbArg(callback: (town: string, name?: string | undefined | null) => string, notOverridden: number): object␊
|
|
1013
|
+
␊
|
|
1014
|
+
/** This is an interface for package.json */␊
|
|
1015
|
+
export interface PackageJson {␊
|
|
1016
|
+
name: string␊
|
|
1017
|
+
/** The version of the package */␊
|
|
1018
|
+
version: string␊
|
|
1019
|
+
dependencies?: Record<string, any>␊
|
|
1020
|
+
devDependencies?: Record<string, any>␊
|
|
1021
|
+
}␊
|
|
1022
|
+
␊
|
|
1023
|
+
export declare function panic(): void␊
|
|
1024
|
+
␊
|
|
1025
|
+
export declare function plusOne(this: Width): number␊
|
|
1026
|
+
␊
|
|
1027
|
+
export declare function promiseInEither(input: number | Promise<number>): Promise<boolean>␊
|
|
1028
|
+
␊
|
|
1029
|
+
/** napi = { version = 2, features = ["serde-json"] } */␊
|
|
1030
|
+
export declare function readFile(callback: (arg0: Error | undefined, arg1?: string | undefined | null) => void): void␊
|
|
1031
|
+
␊
|
|
1032
|
+
export declare function readFileAsync(path: string): Promise<Buffer>␊
|
|
1033
|
+
␊
|
|
1034
|
+
export declare function readPackageJson(): PackageJson␊
|
|
1035
|
+
␊
|
|
1036
|
+
export declare function receiveAllOptionalObject(obj?: AllOptionalObject | undefined | null): void␊
|
|
1037
|
+
␊
|
|
1038
|
+
export declare function receiveClassOrNumber(either: number | JsClassForEither): number␊
|
|
1039
|
+
␊
|
|
1040
|
+
export declare function receiveDifferentClass(either: JsClassForEither | AnotherClassForEither): number␊
|
|
1041
|
+
␊
|
|
1042
|
+
export declare function receiveMutClassOrNumber(either: number | JsClassForEither): number␊
|
|
1043
|
+
␊
|
|
1044
|
+
export declare function receiveObjectOnlyFromJs(obj: { count: number, callback: (err: Error | null, count: number) => void }): void␊
|
|
1045
|
+
␊
|
|
1046
|
+
export declare function receiveObjectWithClassField(object: ObjectFieldClassInstance): Bird␊
|
|
1047
|
+
␊
|
|
1048
|
+
export declare function receiveStrictObject(strictObject: StrictObject): void␊
|
|
1049
|
+
␊
|
|
1050
|
+
export declare function receiveString(s: string): string␊
|
|
1051
|
+
␊
|
|
1052
|
+
export declare function returnEither(input: number): string | number␊
|
|
1053
|
+
␊
|
|
1054
|
+
export declare function returnEitherClass(input: number): number | JsClassForEither␊
|
|
1055
|
+
␊
|
|
1056
|
+
export declare function returnJsFunction(): (...args: any[]) => any␊
|
|
1057
|
+
␊
|
|
1058
|
+
export declare function returnNull(): null␊
|
|
1059
|
+
␊
|
|
1060
|
+
export declare function returnUndefined(): void␊
|
|
1061
|
+
␊
|
|
1062
|
+
export declare function returnUndefinedIfInvalid(input: boolean): boolean␊
|
|
1063
|
+
␊
|
|
1064
|
+
export declare function returnUndefinedIfInvalidPromise(input: Promise<boolean>): Promise<boolean>␊
|
|
1065
|
+
␊
|
|
1066
|
+
export declare function roundtripStr(s: string): string␊
|
|
1067
|
+
␊
|
|
1068
|
+
export declare function runScript(script: string): unknown␊
|
|
1069
|
+
␊
|
|
1070
|
+
export declare function setSymbolInObj(symbol: symbol): object␊
|
|
1071
|
+
␊
|
|
1072
|
+
export type Status = 'Pristine'|␊
|
|
1073
|
+
'Loading'|␊
|
|
1074
|
+
'Ready';␊
|
|
1075
|
+
␊
|
|
1076
|
+
export interface StrictObject {␊
|
|
1077
|
+
name: string␊
|
|
1078
|
+
}␊
|
|
1079
|
+
␊
|
|
1080
|
+
export declare function sumMapping(nums: Record<string, number>): number␊
|
|
1081
|
+
␊
|
|
1082
|
+
export declare function sumNums(nums: Array<number>): number␊
|
|
1083
|
+
␊
|
|
1084
|
+
export declare function testSerdeRoundtrip(data: any): any␊
|
|
1085
|
+
␊
|
|
1086
|
+
export declare function threadsafeFunctionClosureCapture(func: (...args: any[]) => any): void␊
|
|
1087
|
+
␊
|
|
1088
|
+
export declare function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void␊
|
|
1089
|
+
␊
|
|
1090
|
+
export declare function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void␊
|
|
1091
|
+
␊
|
|
1092
|
+
export declare function threadsafeFunctionThrowError(cb: (...args: any[]) => any): void␊
|
|
1093
|
+
␊
|
|
1094
|
+
export declare function throwError(): void␊
|
|
1095
|
+
␊
|
|
1096
|
+
export declare function toJsObj(): object␊
|
|
1097
|
+
␊
|
|
1098
|
+
export declare function tsfnAsyncCall(func: (...args: any[]) => any): Promise<void>␊
|
|
1099
|
+
␊
|
|
1100
|
+
export declare function tsfnCallWithCallback(func: (...args: any[]) => any): void␊
|
|
1101
|
+
␊
|
|
1102
|
+
export declare function tsRename(a: { foo: number }): string[]␊
|
|
1103
|
+
␊
|
|
1104
|
+
export interface TsTypeChanged {␊
|
|
1105
|
+
typeOverride: object␊
|
|
1106
|
+
typeOverrideOptional?: object␊
|
|
1107
|
+
}␊
|
|
1108
|
+
␊
|
|
1109
|
+
export declare function validateArray(arr: Array<number>): number␊
|
|
1110
|
+
␊
|
|
1111
|
+
export declare function validateBigint(input: bigint): bigint␊
|
|
1112
|
+
␊
|
|
1113
|
+
export declare function validateBoolean(i: boolean): boolean␊
|
|
1114
|
+
␊
|
|
1115
|
+
export declare function validateBuffer(b: Buffer): number␊
|
|
1116
|
+
␊
|
|
1117
|
+
export declare function validateDate(d: Date): number␊
|
|
1118
|
+
␊
|
|
1119
|
+
export declare function validateDateTime(d: Date): number␊
|
|
1120
|
+
␊
|
|
1121
|
+
export declare function validateExternal(e: ExternalObject<number>): number␊
|
|
1122
|
+
␊
|
|
1123
|
+
export declare function validateFunction(cb: () => number): number␊
|
|
1124
|
+
␊
|
|
1125
|
+
export declare function validateHashMap(input: Record<string, number>): number␊
|
|
1126
|
+
␊
|
|
1127
|
+
export declare function validateNull(i: null): boolean␊
|
|
1128
|
+
␊
|
|
1129
|
+
export declare function validateNumber(i: number): number␊
|
|
1130
|
+
␊
|
|
1131
|
+
export declare function validateOptional(input1?: string | undefined | null, input2?: boolean | undefined | null): boolean␊
|
|
1132
|
+
␊
|
|
1133
|
+
export declare function validatePromise(p: Promise<number>): Promise<number>␊
|
|
1134
|
+
␊
|
|
1135
|
+
export declare function validateString(s: string): string␊
|
|
1136
|
+
␊
|
|
1137
|
+
export declare function validateSymbol(s: symbol): boolean␊
|
|
1138
|
+
␊
|
|
1139
|
+
export declare function validateTypedArray(input: Uint8Array): number␊
|
|
1140
|
+
␊
|
|
1141
|
+
export declare function validateUndefined(i: undefined): boolean␊
|
|
1142
|
+
␊
|
|
1143
|
+
export declare function withAbortController(a: number, b: number, signal: AbortSignal): Promise<number>␊
|
|
1144
|
+
␊
|
|
1145
|
+
export declare function withoutAbortController(a: number, b: number): Promise<number>␊
|
|
1146
|
+
␊
|
|
1147
|
+
export declare function xxh64Alias(input: Buffer): bigint␊
|
|
1148
|
+
␊
|
|
1149
|
+
export declare namespace xxh2 {␊
|
|
1150
|
+
export function xxh2Plus(a: number, b: number): number␊
|
|
1151
|
+
export function xxh3Xxh64Alias(input: Buffer): bigint␊
|
|
1152
|
+
}␊
|
|
1153
|
+
␊
|
|
1154
|
+
export declare namespace xxh3 {␊
|
|
1155
|
+
/** Xxh3 class */␊
|
|
1156
|
+
export class Xxh3 {␊
|
|
1157
|
+
constructor()␊
|
|
1158
|
+
/** update */␊
|
|
1159
|
+
update(input: Buffer): void␊
|
|
1160
|
+
digest(): bigint␊
|
|
1161
|
+
}␊
|
|
1162
|
+
export const ALIGNMENT: number␊
|
|
1163
|
+
/** xxh128 function */␊
|
|
1164
|
+
export function xxh128(input: Buffer): bigint␊
|
|
1165
|
+
export function xxh3_64(input: Buffer): bigint␊
|
|
1166
|
+
}␊
|
|
1167
|
+
`
|
|
1168
|
+
|
|
1169
|
+
## should process type def with noConstEnum and runtimeStringEnum correctly
|
|
1170
|
+
|
|
1171
|
+
> Snapshot 1
|
|
1172
|
+
|
|
1173
|
+
`export declare enum Priority {␊
|
|
1174
|
+
Low = 0,␊
|
|
1175
|
+
High = 1␊
|
|
1176
|
+
}␊
|
|
1177
|
+
␊
|
|
1178
|
+
export declare enum Status {␊
|
|
1179
|
+
Active = 'Active',␊
|
|
1180
|
+
Inactive = 'Inactive'␊
|
|
1181
|
+
}␊
|
|
1182
|
+
`
|
|
1183
|
+
|
|
1184
|
+
## runtimeStringEnum is a no-op when constEnum is set
|
|
1185
|
+
|
|
1186
|
+
> Snapshot 1
|
|
1187
|
+
|
|
1188
|
+
`export declare const enum Priority {␊
|
|
1189
|
+
Low = 0,␊
|
|
1190
|
+
High = 1␊
|
|
1191
|
+
}␊
|
|
1192
|
+
␊
|
|
1193
|
+
export declare const enum Status {␊
|
|
1194
|
+
Active = 'Active',␊
|
|
1195
|
+
Inactive = 'Inactive'␊
|
|
1196
|
+
}␊
|
|
1197
|
+
`
|