README · Changelog · Development
Forked version of node-ffi-generate
changelog
Change summaries and notable excerpts from the commit log.
- e375b03 Revert to void pointers for recursive type definitions
- 2e5beae Do not register type js_voidPointer before js_void
- Target Node.js v12, v14, v16.
- Execution on v14, v16 may fail with
Check failed: result.second
due to bug #96 inffi-napi
.- One workaround is to ensure there is only a single copy of
ffi-napi
in thenode_modules
tree. - Inspect with
npm ls ffi-napi
.
- One workaround is to ensure there is only a single copy of
- Execution on v14, v16 may fail with
- The package name is now
@ffi-packager/ffi-generate
. - Switched to
async
/await
, in particular for the exportedasync generate(...)
function. - Exports in the generated code have changed.
- The
CONSTANTS
property was renamed toconstants
. - Exported functions under
{{module}}
property (defaulted to the value oflibrary
) was renamed tofunctions
. - All exported types were moved from the top-level scope to a
types
property.
- The
- Changed options for
generate(...)
and command line arguments forffi-generate
.- The
module
(-m
,--module
) option was removed.- Instead, the hardcoded property name
functions
is used. - This breaks previously generated code, which used either the name of the library (default) or a custom module name.
- Instead, the hardcoded property name
- The
file_only
(--file_only
) option was renamed tosingleFile
(--single-file
). - The
strict
flag was removed. It was unused anyhow. - The
--libclang
argument was removed.- It should be autodetected by
ffi-generate
by calling thellvm-config
tool (make sure it's on yourPATH
). - Can also be set using the
LD_LIBRARY_PATH
(orDYLD_LIBRARY_PATH
on macOS) environment variable.
- It should be autodetected by
- The
filename
option was renamed tofilepath
.
- The
- Enum numbers larger than the largest "safe" max/min integer number handleable by javascript are output as strings.
- Note that the determined "safe" range differs between
ffi-napi
's min/max and javascript'sNumber.*_SAFE_INTEGER
with a difference of +/- 1.
- Note that the determined "safe" range differs between
- Generated
typedef
output was simplified to be a javascript alias/variable reassignment. - The
union
support was fixed.- Now
union
is handled in a similar way tostruct
. - Output may differ from v1.0.0.
- Now
- Naming changes.
- Naming of anonymous types, functions, and properties changed.
- Base types and typedefs are recursed, with intermediate types output and aliased.
- "Javascript types" from
ref-napi
are now (directly) referenced only once, in variables prefixed withjs_
.
- See also changes in the expected test output in
test/
files.
- Output enum constants, even if they were not referenced by any function.
- Allow the
library
option to benull
.- This means that no dynamic library is loaded, and instead functions are mapped to what is available in the current process.
- Allows mapping functions to libraries which have already been loaded, either implicitly by the executing binary (such as
node
) or manually withFFI.DynamicLibrary(...)
.
- The generated code is partially sorted (constants, types, functions) to help with diffing between versions.
- Added a generated file header with some metadata.
- Improved documentation, example usage.
- Added
DEVELOP.md
. - Moved examples to the
examples/
directory.
- Added
- Reduced console output for non-debug situations.
- Debug output can easily be enabled; see
DEVELOP.md
.
- Debug output can easily be enabled; see
- Generated code is formatted using
prettier
.
- Internal code improvements.
- Code has been reformatted, cleaned up, modernized.
- Code partially split up to files and functions.
- Uses
class
statements rather than class-like functions.
- Added tests with a code coverage of 90% for branches, 95%+ for statements and lines, 100% for functions.
- Reports are generated when running code coverage tests, both on the command line and in the
coverage/
directory.
- Reports are generated when running code coverage tests, both on the command line and in the
- Tests, linting, and code coverage are checked with commit hooks.
- Regenerated the
ffi
layer innode-libclang
.- To avoid a circular dependency, the
dynamic-clang.js
file innode-liblang
is statically included in that package. - See
examples/libclang/
andtest/libclang/
.
- To avoid a circular dependency, the
- Workaround for
va_list
was both added and removed, as it is now handled by recursing deeper into base types.
Forked by Joel Purra for use in node-ffi-packager.
- a2cd667 Add information about the node-ffi-packager fork
- 8e3132a Use node-ffi-packager/node-libclang fork
- 60418ff Visit only canonical cursors
- bec83f6 Support enum values
- 2969398 Skip inline functions
- bc01b24 Use ffi-napi, ref-napi, and related Node.js NAPI packages
- 6ffa2c6 Add support for elaborated type
See commit log.
See commit log.
See commit log.
See commit log.
See commit log.
See commit log.
See commit log.
node-ffi-generate
Copyright © 2011, 2012, 2013, 2014 Timothy J Fontaine, © 2020, 2021 Joel Purra. Released under MIT License.