@napi-rs/cli 3.0.0-alpha.7 → 3.0.0-alpha.9

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/src/api/build.ts CHANGED
@@ -81,8 +81,8 @@ export async function buildProject(options: BuildOptions) {
81
81
  options.target
82
82
  ? parseTriple(options.target)
83
83
  : process.env.CARGO_BUILD_TARGET
84
- ? parseTriple(process.env.CARGO_BUILD_TARGET)
85
- : getSystemDefaultTarget(),
84
+ ? parseTriple(process.env.CARGO_BUILD_TARGET)
85
+ : getSystemDefaultTarget(),
86
86
  crateDir,
87
87
  resolvePath(options.outputDir ?? crateDir),
88
88
  options.targetDir ??
@@ -373,8 +373,8 @@ class Builder {
373
373
  process.platform === 'darwin'
374
374
  ? 'darwin'
375
375
  : process.platform === 'win32'
376
- ? 'windows'
377
- : 'linux'
376
+ ? 'windows'
377
+ : 'linux'
378
378
  Object.assign(this.envs, {
379
379
  CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: `${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/${hostPlatform}-x86_64/bin/${targetArch}-linux-android24-clang`,
380
380
  CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER: `${ANDROID_NDK_LATEST_HOME}/toolchains/llvm/prebuilt/${hostPlatform}-x86_64/bin/${targetArch}-linux-androideabi24-clang`,
@@ -559,10 +559,10 @@ class Builder {
559
559
  this.target.platform === 'darwin'
560
560
  ? `lib${cdyLib}.dylib`
561
561
  : this.target.platform === 'win32'
562
- ? `${cdyLib}.dll`
563
- : this.target.platform === 'wasi' || this.target.platform === 'wasm'
564
- ? `${cdyLib}.wasm`
565
- : `lib${cdyLib}.so`
562
+ ? `${cdyLib}.dll`
563
+ : this.target.platform === 'wasi' || this.target.platform === 'wasm'
564
+ ? `${cdyLib}.wasm`
565
+ : `lib${cdyLib}.so`
566
566
 
567
567
  let destName = this.config.binaryName
568
568
  // add platform suffix to binary name
@@ -597,6 +597,7 @@ class Builder {
597
597
 
598
598
  const { dts, exports } = await processTypeDef(
599
599
  this.envs.TYPE_DEF_TMP_PATH,
600
+ this.options.constEnum ?? true,
600
601
  !this.options.noDtsHeader
601
602
  ? this.options.dtsHeader ?? DEFAULT_TYPE_DEF_HEADER
602
603
  : '',
@@ -16,6 +16,7 @@ import { instantiateNapiModule as __emnapiInstantiateNapiModule } from '@emnapi/
16
16
  import { getDefaultContext as __emnapiGetDefaultContext } from '@emnapi/runtime'
17
17
 
18
18
  const __wasi = new __nodeWASI({
19
+ version: 'preview1',
19
20
  env: process.env,
20
21
  preopens: {
21
22
  '/': __nodePath.join(__nodeURL.fileURLToPath(import.meta.url), '..'),
@@ -543,6 +543,7 @@ jobs:
543
543
  with:
544
544
  node-version: 18
545
545
  cache: 'yarn'
546
+ registry-url: 'https://registry.npmjs.org'
546
547
 
547
548
  - name: 'Install dependencies'
548
549
  run: yarn install
@@ -561,19 +562,16 @@ jobs:
561
562
 
562
563
  - name: Publish
563
564
  run: |
564
- npm config set provenance true
565
565
  if git log -1 --pretty=%B | grep "^[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+$";
566
566
  then
567
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
568
- npm publish --access public
567
+ npm publish --access public --provenance
569
568
  elif git log -1 --pretty=%B | grep "^[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+";
570
569
  then
571
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
572
- npm publish --tag next --access public
570
+ npm publish --tag next --access public --provenance
573
571
  else
574
572
  echo "Not a release, skipping publish"
575
573
  fi
576
574
  env:
577
575
  GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
578
- NPM_TOKEN: \${{ secrets.NPM_TOKEN }}
576
+ NODE_AUTH_TOKEN: \${{ secrets.NPM_TOKEN }}
579
577
  `
@@ -1,7 +1,4 @@
1
- export const createLibRs = () => `#![deny(clippy::all)]
2
-
3
- #[macro_use]
4
- extern crate napi_derive;
1
+ export const createLibRs = () => `use napi_derive::napi;
5
2
 
6
3
  #[napi]
7
4
  pub fn sum(a: i32, b: i32) -> i32 {
package/src/def/build.ts CHANGED
@@ -47,6 +47,10 @@ export abstract class BaseBuildCommand extends Command {
47
47
  'Package name in generated js binding file. Only works with `--platform` flag',
48
48
  })
49
49
 
50
+ constEnum?: boolean = Option.Boolean('--const-enum', {
51
+ description: 'Whether generate const enum for typescript bindings',
52
+ })
53
+
50
54
  jsBinding?: string = Option.String('--js', {
51
55
  description:
52
56
  'Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output_dir`.',
@@ -133,6 +137,7 @@ export abstract class BaseBuildCommand extends Command {
133
137
  outputDir: this.outputDir,
134
138
  platform: this.platform,
135
139
  jsPackageName: this.jsPackageName,
140
+ constEnum: this.constEnum,
136
141
  jsBinding: this.jsBinding,
137
142
  noJsBinding: this.noJsBinding,
138
143
  dts: this.dts,
@@ -190,6 +195,10 @@ export interface BuildOptions {
190
195
  * Package name in generated js binding file. Only works with `--platform` flag
191
196
  */
192
197
  jsPackageName?: string
198
+ /**
199
+ * Whether generate const enum for typescript bindings
200
+ */
201
+ constEnum?: boolean
193
202
  /**
194
203
  * Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output_dir`.
195
204
  */
package/src/index.ts CHANGED
@@ -29,3 +29,5 @@ export class NapiCli {
29
29
  universalize = universalizeBinaries
30
30
  version = version
31
31
  }
32
+
33
+ export { parseTriple } from './utils/target.js'
@@ -616,3 +616,558 @@ Generated by [AVA](https://avajs.dev).
616
616
  }␊
617
617
  ␊
618
618
  `
619
+
620
+ ## should process type def with noConstEnum correctly
621
+
622
+ > Snapshot 1
623
+
624
+ `␊
625
+ export class ExternalObject<T> {␊
626
+ readonly '': {␊
627
+ readonly '': unique symbol␊
628
+ [K: symbol]: T␊
629
+ }␊
630
+ }␊
631
+ /**␊
632
+ * \`constructor\` option for \`struct\` requires all fields to be public,␊
633
+ * otherwise tag impl fn as constructor␊
634
+ * #[napi(constructor)]␊
635
+ */␊
636
+ export class Animal {␊
637
+ /** Kind of animal */␊
638
+ readonly kind: Kind␊
639
+ /** This is the constructor */␊
640
+ constructor(kind: Kind, name: string)␊
641
+ /** This is a factory method */␊
642
+ static withKind(kind: Kind): Animal␊
643
+ get name(): string␊
644
+ set name(name: string)␊
645
+ get type(): Kind␊
646
+ set type(kind: Kind)␊
647
+ /**␊
648
+ * This is a␊
649
+ * multi-line comment␊
650
+ * with an emoji 🚀␊
651
+ */␊
652
+ whoami(): string␊
653
+ /** This is static... */␊
654
+ static getDogKind(): Kind␊
655
+ /**␊
656
+ * Here are some characters and character sequences␊
657
+ * that should be escaped correctly:␊
658
+ * \\[]{}/\\:""{␊
659
+ * }␊
660
+ */␊
661
+ returnOtherClass(): Dog␊
662
+ returnOtherClassWithCustomConstructor(): Bird␊
663
+ overrideIndividualArgOnMethod(normalTy: string, overriddenTy: {n: string}): Bird␊
664
+ }␊
665
+ ␊
666
+ export class AnimalWithDefaultConstructor {␊
667
+ name: string␊
668
+ kind: number␊
669
+ constructor(name: string, kind: number)␊
670
+ }␊
671
+ ␊
672
+ export class AnotherClassForEither {␊
673
+ constructor()␊
674
+ }␊
675
+ ␊
676
+ export class AnotherCssStyleSheet {␊
677
+ get rules(): CssRuleList␊
678
+ }␊
679
+ export type AnotherCSSStyleSheet = AnotherCssStyleSheet␊
680
+ ␊
681
+ export class Asset {␊
682
+ constructor()␊
683
+ get filePath(): number␊
684
+ }␊
685
+ export type JsAsset = Asset␊
686
+ ␊
687
+ export class Assets {␊
688
+ constructor()␊
689
+ get(id: number): JsAsset | null␊
690
+ }␊
691
+ export type JsAssets = Assets␊
692
+ ␊
693
+ export class Bird {␊
694
+ name: string␊
695
+ constructor(name: string)␊
696
+ getCount(): number␊
697
+ getNameAsync(): Promise<string>␊
698
+ }␊
699
+ ␊
700
+ /** Smoking test for type generation */␊
701
+ export class Blake2BHasher {␊
702
+ static withKey(key: Blake2bKey): Blake2BHasher␊
703
+ update(data: Buffer): void␊
704
+ }␊
705
+ export type Blake2bHasher = Blake2BHasher␊
706
+ ␊
707
+ export class Blake2BKey {␊
708
+ ␊
709
+ }␊
710
+ export type Blake2bKey = Blake2BKey␊
711
+ ␊
712
+ export class ClassWithFactory {␊
713
+ name: string␊
714
+ static withName(name: string): ClassWithFactory␊
715
+ setName(name: string): this␊
716
+ }␊
717
+ ␊
718
+ export class Context {␊
719
+ maybeNeed?: boolean␊
720
+ buffer: Uint8Array␊
721
+ constructor()␊
722
+ static withData(data: string): Context␊
723
+ static withBuffer(buf: Uint8Array): Context␊
724
+ method(): string␊
725
+ }␊
726
+ ␊
727
+ export class CssRuleList {␊
728
+ getRules(): Array<string>␊
729
+ get parentStyleSheet(): CSSStyleSheet␊
730
+ get name(): string | null␊
731
+ }␊
732
+ export type CSSRuleList = CssRuleList␊
733
+ ␊
734
+ export class CssStyleSheet {␊
735
+ constructor(name: string, rules: Array<string>)␊
736
+ get rules(): CssRuleList␊
737
+ anotherCssStyleSheet(): AnotherCssStyleSheet␊
738
+ }␊
739
+ export type CSSStyleSheet = CssStyleSheet␊
740
+ ␊
741
+ export class CustomFinalize {␊
742
+ constructor(width: number, height: number)␊
743
+ }␊
744
+ ␊
745
+ export class Dog {␊
746
+ name: string␊
747
+ constructor(name: string)␊
748
+ }␊
749
+ ␊
750
+ export class Fib {␊
751
+ [Symbol.iterator](): Iterator<number, void, number>␊
752
+ constructor()␊
753
+ }␊
754
+ ␊
755
+ export class Fib2 {␊
756
+ [Symbol.iterator](): Iterator<number, void, number>␊
757
+ static create(seed: number): Fib2␊
758
+ }␊
759
+ ␊
760
+ export class Fib3 {␊
761
+ current: number␊
762
+ next: number␊
763
+ constructor(current: number, next: number)␊
764
+ [Symbol.iterator](): Iterator<number, void, number>␊
765
+ }␊
766
+ ␊
767
+ export class JsClassForEither {␊
768
+ constructor()␊
769
+ }␊
770
+ ␊
771
+ export class JsRemote {␊
772
+ name(): string␊
773
+ }␊
774
+ ␊
775
+ export class JsRepo {␊
776
+ constructor(dir: string)␊
777
+ remote(): JsRemote␊
778
+ }␊
779
+ ␊
780
+ export class NinjaTurtle {␊
781
+ name: string␊
782
+ static isInstanceOf(value: unknown): boolean␊
783
+ /** Create your ninja turtle! 🐢 */␊
784
+ static newRaph(): NinjaTurtle␊
785
+ getMaskColor(): string␊
786
+ getName(): string␊
787
+ returnThis(this: this): this␊
788
+ }␊
789
+ ␊
790
+ export class NotWritableClass {␊
791
+ name: string␊
792
+ constructor(name: string)␊
793
+ setName(name: string): void␊
794
+ }␊
795
+ ␊
796
+ export class Optional {␊
797
+ static optionEnd(required: string, optional?: string | undefined | null): string␊
798
+ static optionStart(optional: string | undefined | null, required: string): string␊
799
+ static optionStartEnd(optional1: string | undefined | null, required: string, optional2?: string | undefined | null): string␊
800
+ static optionOnly(optional?: string | undefined | null): string␊
801
+ }␊
802
+ ␊
803
+ export class Width {␊
804
+ value: number␊
805
+ constructor(value: number)␊
806
+ }␊
807
+ ␊
808
+ export interface A {␊
809
+ foo: number␊
810
+ }␊
811
+ ␊
812
+ export function acceptThreadsafeFunction(func: (err: Error | null, value: number) => any): void␊
813
+ ␊
814
+ export function acceptThreadsafeFunctionFatal(func: (value: number) => any): void␊
815
+ ␊
816
+ export function acceptThreadsafeFunctionTupleArgs(func: (err: Error | null, arg0: number, arg1: boolean, arg2: string) => any): void␊
817
+ ␊
818
+ export function add(a: number, b: number): number␊
819
+ ␊
820
+ export enum ALIAS {␊
821
+ A = 0,␊
822
+ B = 1␊
823
+ }␊
824
+ ␊
825
+ export interface AliasedStruct {␊
826
+ a: ALIAS␊
827
+ b: number␊
828
+ }␊
829
+ ␊
830
+ export interface AllOptionalObject {␊
831
+ name?: string␊
832
+ age?: number␊
833
+ }␊
834
+ ␊
835
+ export function appendBuffer(buf: Buffer): Buffer␊
836
+ ␊
837
+ export function arrayBufferPassThrough(buf: Uint8Array): Promise<Uint8Array>␊
838
+ ␊
839
+ export function asyncMultiTwo(arg: number): Promise<number>␊
840
+ ␊
841
+ export function asyncPlus100(p: Promise<number>): Promise<number>␊
842
+ ␊
843
+ export function asyncReduceBuffer(buf: Buffer): Promise<number>␊
844
+ ␊
845
+ export interface B {␊
846
+ bar: number␊
847
+ }␊
848
+ ␊
849
+ export function bigintAdd(a: bigint, b: bigint): bigint␊
850
+ ␊
851
+ export function bigintFromI128(): bigint␊
852
+ ␊
853
+ export function bigintFromI64(): bigint␊
854
+ ␊
855
+ export function bigintGetU64AsString(bi: bigint): string␊
856
+ ␊
857
+ export function bufferPassThrough(buf: Buffer): Promise<Buffer>␊
858
+ ␊
859
+ export interface C {␊
860
+ baz: number␊
861
+ }␊
862
+ ␊
863
+ export function callbackReturnPromise<T>(functionInput: () => T | Promise<T>, callback: (err: Error | null, result: T) => void): T | Promise<T>␊
864
+ ␊
865
+ export function callThreadsafeFunction(callback: (...args: any[]) => any): void␊
866
+ ␊
867
+ export function captureErrorInCallback(cb1: () => void, cb2: (arg0: Error) => void): void␊
868
+ ␊
869
+ export function chronoDateAdd1Minute(input: Date): Date␊
870
+ ␊
871
+ export function chronoDateToMillis(input: Date): number␊
872
+ ␊
873
+ export function concatLatin1(s: string): string␊
874
+ ␊
875
+ export function concatStr(s: string): string␊
876
+ ␊
877
+ export function concatUtf16(s: string): string␊
878
+ ␊
879
+ export function contains(source: string, target: string): boolean␊
880
+ ␊
881
+ export function convertU32Array(input: Uint32Array): Array<number>␊
882
+ ␊
883
+ export function createBigInt(): bigint␊
884
+ ␊
885
+ export function createBigIntI64(): bigint␊
886
+ ␊
887
+ export function createExternal(size: number): ExternalObject<number>␊
888
+ ␊
889
+ export function createExternalString(content: string): ExternalObject<string>␊
890
+ ␊
891
+ export function createExternalTypedArray(): Uint32Array␊
892
+ ␊
893
+ export function createObj(): object␊
894
+ ␊
895
+ export function createObjectWithClassField(): ObjectFieldClassInstance␊
896
+ ␊
897
+ export function createObjWithProperty(): { value: ArrayBuffer, get getter(): number }␊
898
+ ␊
899
+ export function createSymbol(): symbol␊
900
+ ␊
901
+ /** You could break the step and for an new continuous value. */␊
902
+ export enum CustomNumEnum {␊
903
+ One = 1,␊
904
+ Two = 2,␊
905
+ Three = 3,␊
906
+ Four = 4,␊
907
+ Six = 6,␊
908
+ Eight = 8,␊
909
+ Nine = 9,␊
910
+ Ten = 10␊
911
+ }␊
912
+ ␊
913
+ export function customStatusCode(): void␊
914
+ ␊
915
+ export interface Dates {␊
916
+ start: Date␊
917
+ end?: Date␊
918
+ }␊
919
+ ␊
920
+ export function dateToNumber(input: Date): number␊
921
+ ␊
922
+ /** This is a const */␊
923
+ export const DEFAULT_COST: number␊
924
+ ␊
925
+ export function derefUint8Array(a: Uint8Array, b: Uint8ClampedArray): number␊
926
+ ␊
927
+ export function either3(input: string | number | boolean): number␊
928
+ ␊
929
+ export function either4(input: string | number | boolean | Obj): number␊
930
+ ␊
931
+ export function eitherBoolOrFunction(input: boolean | ((...args: any[]) => any)): void␊
932
+ ␊
933
+ export function eitherFromObjects(input: A | B | C): string␊
934
+ ␊
935
+ export function eitherFromOption(): JsClassForEither | undefined␊
936
+ ␊
937
+ export function eitherStringOrNumber(input: string | number): number␊
938
+ ␊
939
+ export enum Empty {␊
940
+ ␊
941
+ }␊
942
+ ␊
943
+ export function enumToI32(e: CustomNumEnum): number␊
944
+ ␊
945
+ export function fibonacci(n: number): number␊
946
+ ␊
947
+ export function fnReceivedAliased(s: AliasedStruct, e: ALIAS): void␊
948
+ ␊
949
+ export function getBuffer(): Buffer␊
950
+ ␊
951
+ export function getCwd(callback: (arg0: string) => void): void␊
952
+ ␊
953
+ export function getEmptyBuffer(): Buffer␊
954
+ ␊
955
+ export function getExternal(external: ExternalObject<number>): number␊
956
+ ␊
957
+ export function getGlobal(): typeof global␊
958
+ ␊
959
+ export function getMapping(): Record<string, number>␊
960
+ ␊
961
+ export function getNestedNumArr(): number[][][]␊
962
+ ␊
963
+ export function getNull(): null␊
964
+ ␊
965
+ export function getNumArr(): number[]␊
966
+ ␊
967
+ /** Gets some numbers */␊
968
+ export function getNums(): Array<number>␊
969
+ ␊
970
+ export function getPackageJsonName(packageJson: PackageJson): string␊
971
+ ␊
972
+ export function getStrFromObject(): void␊
973
+ ␊
974
+ export function getterFromObj(): number␊
975
+ ␊
976
+ export function getUndefined(): void␊
977
+ ␊
978
+ export function getWords(): Array<string>␊
979
+ ␊
980
+ /** default enum values are continuos i32s start from 0 */␊
981
+ export enum Kind {␊
982
+ /** Barks */␊
983
+ Dog = 0,␊
984
+ /** Kills birds */␊
985
+ Cat = 1,␊
986
+ /** Tasty */␊
987
+ Duck = 2␊
988
+ }␊
989
+ ␊
990
+ export function listObjKeys(obj: object): Array<string>␊
991
+ ␊
992
+ export function mapOption(val?: number | undefined | null): number | null␊
993
+ ␊
994
+ export function mutateExternal(external: ExternalObject<number>, newVal: number): void␊
995
+ ␊
996
+ export function mutateTypedArray(input: Float32Array): void␊
997
+ ␊
998
+ export interface Obj {␊
999
+ v: string | number␊
1000
+ }␊
1001
+ ␊
1002
+ export interface ObjectFieldClassInstance {␊
1003
+ bird: Bird␊
1004
+ }␊
1005
+ ␊
1006
+ export interface ObjectOnlyFromJs {␊
1007
+ count: number␊
1008
+ callback: (err: Error | null, value: number) => any␊
1009
+ }␊
1010
+ ␊
1011
+ export function optionEnd(callback: (arg0: string, arg1?: string | undefined | null) => void): void␊
1012
+ ␊
1013
+ export function optionOnly(callback: (arg0?: string | undefined | null) => void): void␊
1014
+ ␊
1015
+ export function optionStart(callback: (arg0: string | undefined | null, arg1: string) => void): void␊
1016
+ ␊
1017
+ export function optionStartEnd(callback: (arg0: string | undefined | null, arg1: string, arg2?: string | undefined | null) => void): void␊
1018
+ ␊
1019
+ export function overrideIndividualArgOnFunction(notOverridden: string, f: () => string, notOverridden2: number): string␊
1020
+ ␊
1021
+ export function overrideIndividualArgOnFunctionWithCbArg(callback: (town: string, name?: string | undefined | null) => string, notOverridden: number): object␊
1022
+ ␊
1023
+ /** This is an interface for package.json */␊
1024
+ export interface PackageJson {␊
1025
+ name: string␊
1026
+ /** The version of the package */␊
1027
+ version: string␊
1028
+ dependencies?: Record<string, any>␊
1029
+ devDependencies?: Record<string, any>␊
1030
+ }␊
1031
+ ␊
1032
+ export function panic(): void␊
1033
+ ␊
1034
+ export function plusOne(this: Width): number␊
1035
+ ␊
1036
+ export function promiseInEither(input: number | Promise<number>): Promise<boolean>␊
1037
+ ␊
1038
+ /** napi = { version = 2, features = ["serde-json"] } */␊
1039
+ export function readFile(callback: (arg0: Error | undefined, arg1?: string | undefined | null) => void): void␊
1040
+ ␊
1041
+ export function readFileAsync(path: string): Promise<Buffer>␊
1042
+ ␊
1043
+ export function readPackageJson(): PackageJson␊
1044
+ ␊
1045
+ export function receiveAllOptionalObject(obj?: AllOptionalObject | undefined | null): void␊
1046
+ ␊
1047
+ export function receiveClassOrNumber(either: number | JsClassForEither): number␊
1048
+ ␊
1049
+ export function receiveDifferentClass(either: JsClassForEither | AnotherClassForEither): number␊
1050
+ ␊
1051
+ export function receiveMutClassOrNumber(either: number | JsClassForEither): number␊
1052
+ ␊
1053
+ export function receiveObjectOnlyFromJs(obj: { count: number, callback: (err: Error | null, count: number) => void }): void␊
1054
+ ␊
1055
+ export function receiveObjectWithClassField(object: ObjectFieldClassInstance): Bird␊
1056
+ ␊
1057
+ export function receiveStrictObject(strictObject: StrictObject): void␊
1058
+ ␊
1059
+ export function receiveString(s: string): string␊
1060
+ ␊
1061
+ export function returnEither(input: number): string | number␊
1062
+ ␊
1063
+ export function returnEitherClass(input: number): number | JsClassForEither␊
1064
+ ␊
1065
+ export function returnJsFunction(): (...args: any[]) => any␊
1066
+ ␊
1067
+ export function returnNull(): null␊
1068
+ ␊
1069
+ export function returnUndefined(): void␊
1070
+ ␊
1071
+ export function returnUndefinedIfInvalid(input: boolean): boolean␊
1072
+ ␊
1073
+ export function returnUndefinedIfInvalidPromise(input: Promise<boolean>): Promise<boolean>␊
1074
+ ␊
1075
+ export function roundtripStr(s: string): string␊
1076
+ ␊
1077
+ export function runScript(script: string): unknown␊
1078
+ ␊
1079
+ export function setSymbolInObj(symbol: symbol): object␊
1080
+ ␊
1081
+ export interface StrictObject {␊
1082
+ name: string␊
1083
+ }␊
1084
+ ␊
1085
+ export function sumMapping(nums: Record<string, number>): number␊
1086
+ ␊
1087
+ export function sumNums(nums: Array<number>): number␊
1088
+ ␊
1089
+ export function testSerdeRoundtrip(data: any): any␊
1090
+ ␊
1091
+ export function threadsafeFunctionClosureCapture(func: (...args: any[]) => any): void␊
1092
+ ␊
1093
+ export function threadsafeFunctionFatalMode(cb: (...args: any[]) => any): void␊
1094
+ ␊
1095
+ export function threadsafeFunctionFatalModeError(cb: (...args: any[]) => any): void␊
1096
+ ␊
1097
+ export function threadsafeFunctionThrowError(cb: (...args: any[]) => any): void␊
1098
+ ␊
1099
+ export function throwError(): void␊
1100
+ ␊
1101
+ export function toJsObj(): object␊
1102
+ ␊
1103
+ export function tsfnAsyncCall(func: (...args: any[]) => any): Promise<void>␊
1104
+ ␊
1105
+ export function tsfnCallWithCallback(func: (...args: any[]) => any): void␊
1106
+ ␊
1107
+ export function tsRename(a: { foo: number }): string[]␊
1108
+ ␊
1109
+ export interface TsTypeChanged {␊
1110
+ typeOverride: object␊
1111
+ typeOverrideOptional?: object␊
1112
+ }␊
1113
+ ␊
1114
+ export function validateArray(arr: Array<number>): number␊
1115
+ ␊
1116
+ export function validateBigint(input: bigint): bigint␊
1117
+ ␊
1118
+ export function validateBoolean(i: boolean): boolean␊
1119
+ ␊
1120
+ export function validateBuffer(b: Buffer): number␊
1121
+ ␊
1122
+ export function validateDate(d: Date): number␊
1123
+ ␊
1124
+ export function validateDateTime(d: Date): number␊
1125
+ ␊
1126
+ export function validateExternal(e: ExternalObject<number>): number␊
1127
+ ␊
1128
+ export function validateFunction(cb: () => number): number␊
1129
+ ␊
1130
+ export function validateHashMap(input: Record<string, number>): number␊
1131
+ ␊
1132
+ export function validateNull(i: null): boolean␊
1133
+ ␊
1134
+ export function validateNumber(i: number): number␊
1135
+ ␊
1136
+ export function validateOptional(input1?: string | undefined | null, input2?: boolean | undefined | null): boolean␊
1137
+ ␊
1138
+ export function validatePromise(p: Promise<number>): Promise<number>␊
1139
+ ␊
1140
+ export function validateString(s: string): string␊
1141
+ ␊
1142
+ export function validateSymbol(s: symbol): boolean␊
1143
+ ␊
1144
+ export function validateTypedArray(input: Uint8Array): number␊
1145
+ ␊
1146
+ export function validateUndefined(i: undefined): boolean␊
1147
+ ␊
1148
+ export function withAbortController(a: number, b: number, signal: AbortSignal): Promise<number>␊
1149
+ ␊
1150
+ export function withoutAbortController(a: number, b: number): Promise<number>␊
1151
+ ␊
1152
+ export function xxh64Alias(input: Buffer): bigint␊
1153
+ ␊
1154
+ export namespace xxh2 {␊
1155
+ export function xxh2Plus(a: number, b: number): number␊
1156
+ export function xxh3Xxh64Alias(input: Buffer): bigint␊
1157
+ }␊
1158
+ ␊
1159
+ export namespace xxh3 {␊
1160
+ /** Xxh3 class */␊
1161
+ export class Xxh3 {␊
1162
+ constructor()␊
1163
+ /** update */␊
1164
+ update(input: Buffer): void␊
1165
+ digest(): bigint␊
1166
+ }␊
1167
+ export const ALIGNMENT: number␊
1168
+ /** xxh128 function */␊
1169
+ export function xxh128(input: Buffer): bigint␊
1170
+ export function xxh3_64(input: Buffer): bigint␊
1171
+ }␊
1172
+ ␊
1173
+ `