@napi-rs/cli 3.0.0-alpha.8 → 3.0.0-alpha.80

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