1 | /// <reference types="node"/>
|
2 |
|
3 | /**
|
4 | * The main `bindings()` function loads the compiled bindings for a given module.
|
5 | * It uses V8's Error API to determine the parent filename that this function is
|
6 | * being invoked from, which is then used to find the root directory.
|
7 | */
|
8 | declare function bindings(mod: string | bindings.Options): any;
|
9 | declare namespace bindings {
|
10 | interface Options {
|
11 | /** @default process.env.NODE_BINDINGS_ARROW || ' → ' */
|
12 | arrow?: string | undefined;
|
13 | /** @default process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' */
|
14 | compiled?: string | undefined;
|
15 | /** @default process.platform */
|
16 | platform?: NodeJS.Platform | undefined;
|
17 | /** @default process.arch */
|
18 | arch?: string | undefined;
|
19 | /** @default `node-v${process.versions.modules}-${process.platform}-${process.arch}` */
|
20 | nodePreGyp?: string | undefined;
|
21 | /** @default process.versions.node */
|
22 | version?: string | undefined;
|
23 | /** @default 'bindings.node' */
|
24 | bindings?: string | undefined;
|
25 | /* @default exports.getRoot(exports.getFileName()) */
|
26 | module_root?: string | undefined;
|
27 | /* @default (build/|out/)?(Debug|Release|default) and others */
|
28 | try?: ReadonlyArray<readonly string[]> | undefined;
|
29 | }
|
30 |
|
31 | /**
|
32 | * Gets the filename of the JavaScript file that invokes this function.
|
33 | * Used to help find the root directory of a module.
|
34 | * Optionally accepts an filename argument to skip when searching for the invoking filename
|
35 | */
|
36 | function getFileName(calling_file?: string): string;
|
37 |
|
38 | /**
|
39 | * Gets the root directory of a module, given an arbitrary filename
|
40 | * somewhere in the module tree. The "root directory" is the directory
|
41 | * containing the `package.json` file.
|
42 | *
|
43 | * In: /home/nate/node-native-module/lib/index.js
|
44 | * Out: /home/nate/node-native-module
|
45 | */
|
46 | function getRoot(file: string): string;
|
47 | }
|
48 |
|
49 | export = bindings;
|