Comments (9)
When you make the fix to kapsis can you please make a release, and set denim's dependency to that new version of kapsis? Also please then release a new version of denim. It's just easier to develop against specific versions than head.
from denim.
If you want to use the new High-level API {.export_napi}
there is no need to check for types. Consider the following:
init proc(module: Module) =
proc callNimFn(name: string): string {.export_napi} =
# `callNimFn` is not a real proc, here we'll use nnkProcDef to retrieve
# nnkFormalParams for creating the auto type checker.
# types supported (Nim > NAPI):
# string > napi_string
# int > napi_number
# object > napi_object
# array > napi_object (cuz it's an object that) here we use `napi_is_array`
# undefined > napi_undefined
# nil > napi_null
# symbol > napi_symbol
# func > napi_function
# external > napi_external
# varargs[string] > variable arguments (unstable)
# optional args should be called like (not implemented, yet):
# age: int = 21
# or
# age = 21
# the return type is not required. but is going to be used
# when generating the docblock comment for `@return {object}`
# args.get("name") is not implemented, yet
# so you will have to keep using `args` sequence.
return args[0].getStr
And yes, I will make expect
proc work with the old module.registerFn()
from denim.
Reinstalling denim should fix a little bug around getNimNapiType
from denim.
Note that you can npm install cmake-js -g
. Is faster than node-gyp
denim build src/myapp.nim --cmake --yes
Node-gyp gives an unhelpful error: Error: unhandled exception: field 'vStr' is not accessible for type 'Parameter' using 'ptype = LongFlag' [FieldDefect]
There is a little bug in kapsis cli. I will try fix this soon
from denim.
Will keep my README simple, with a minimal example.
Anything else will be in tests.
from denim.
Thanks. I'm trying cmake-js, it does seem faster on repeated calls. I'll wait for the fix to kapsis.
from denim.
Not quite ready for a release, but you can reinstall from head. Should work for now.
Also, check /tests for fully working examples.
from denim.
Just released 0.1.5
. Updated docs
from denim.
Works great, thanks!
from denim.
Related Issues (13)
- Build binding.gyp given a package name HOT 3
- node-gyp put node_api.h in an unexpected place
- denim -h doesn't do anything HOT 2
- Macros for cleaner export Nim code HOT 2
- Compiled binary segfaults when run HOT 6
- Can't use add-on in an external project HOT 3
- Frequent: SIGSEGV: Illegal storage access. (Attempt to read from nil?) HOT 2
- Nim exceptions break the node process HOT 3
- Calling callback JS functions in Nim HOT 3
- `export_napi` not works with variables since Nim 2.0 HOT 1
- Build for Windows? HOT 1
- Denim addon segfaults with Node, but works with Bun HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from denim.