You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.3 KiB

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
// See https://github.com/facebook/hermes/blob/master/tools/emhermesc/emhermesc.cpp
declare function cwrap(
'hermesCompileToBytecode',
string,
Array<string>,
): (number, number, string, number, number) => Buffer;
declare function cwrap(
'hermesCompileResult_getError',
string,
Array<string>,
): Buffer => ?Error;
declare function cwrap(
'hermesCompileResult_getBytecodeAddr',
string,
Array<string>,
): Buffer => number;
declare function cwrap(
'hermesCompileResult_getBytecodeSize',
string,
Array<string>,
): Buffer => number;
declare function cwrap(
'hermesCompileResult_free',
string,
Array<string>,
): Buffer => void;
declare function ccall(
'hermesGetProperties',
string,
Array<string>,
Array<string>,
): string;
type HermescInterface = {
cwrap: typeof cwrap,
ccall: typeof ccall,
_malloc: number => number,
HEAP8: Buffer,
_free: number => void,
};
declare function hermesc(options: {
noInitialRun: boolean,
noExitRuntime: boolean,
print: () => void,
printErr: () => void,
}): HermescInterface;
declare module.exports: typeof hermesc;