File tree Expand file tree Collapse file tree 8 files changed +847
-29
lines changed
Expand file tree Collapse file tree 8 files changed +847
-29
lines changed Original file line number Diff line number Diff line change 16163rdlibs /LuaJIT /src /host /buildvm_arch.h
17173rdlibs /LuaJIT /src /host /minilua
18183rdlibs /LuaJIT /src /jit /vmdef.lua
19+
20+
21+ build /
22+ build * /
23+ binding /
24+
Original file line number Diff line number Diff line change 1- ## Node-luajit binding
1+
2+ ## Node-luajit binding
3+
4+ support npai version 6(node minimum version v10.20.0).
5+
6+ need lower version check the branch 8.x-10.x or 6.x.
7+
8+
29#### Cross platform. (win,mac,linux)[ x64]
310similar as ` https://github.com/brettlangdon/NodeLua `
411
@@ -12,6 +19,7 @@ similar as `https://github.com/brettlangdon/NodeLua`
12195 . add,linux auto compile luajit.[ 2018-01-29] http://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz
13206 . add, cjson compile and auto load. [ 2018-01-29] https://github.com/openresty/lua-cjson/archive/master.zip
14217 . > win64 need fix.
22+ 8 . support napi. support node 10.20.x-14.x [ 2021-01-06]
1523
1624
1725##Installation
@@ -23,7 +31,8 @@ npm install node-luajit --unsafe-perm
2331
2432```
2533
26- #### node 8.x 10.x:
34+ #### node napi
35+
2736Linux build luajit
2837```
2938git clone https://github.com/LuaJIT/LuaJIT.git
Original file line number Diff line number Diff line change 11{
22 "targets" : [
33 {
4- "target_name" : "node-luajit " ,
4+ "target_name" : "<(module_name) " ,
55 "variables" : {
66 "lua_include" : "" ,
77 "lib_dirs" : ""
8686 "3rdlibs/lua-cjson/lua_cjson.c" ,
8787 "3rdlibs/lua-cjson/strbuf.c"
8888 ],
89- "include_dirs" : [
90- "<!@(node -p \" require('node-addon-api').include\" )"
91- ],
92- 'defines' : [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
93- }
89+ "include_dirs" : [
90+ "<!@(node -p \" require('node-addon-api').include\" )"
91+ ],
92+ "dependencies" : [
93+ "<!(node -p \" require('node-addon-api').gyp\" )"
94+ ],
95+ "defines" : [
96+ "NAPI_VERSION=<(napi_build_version)" ,
97+ "NAPI_DISABLE_CPP_EXCEPTIONS" ,
98+ ]
99+ },
100+ {
101+ "target_name" : "action_after_build" ,
102+ "type" : "none" ,
103+ "dependencies" : [ "<(module_name)" ],
104+ "copies" : [
105+ {
106+ "files" : [ "<(PRODUCT_DIR)/<(module_name).node" ],
107+ "destination" : "<(module_path)"
108+ }
109+ ]
110+ }
94111 ]
95112}
Original file line number Diff line number Diff line change 11'use strict' ;
2- let nodelua = null ;
32let path = require ( 'path' ) ;
4- try {
5- nodelua = require ( './build/Release/node-luajit' ) ;
6- } catch ( e ) {
7- console . log ( '``` release load err:' , e ) ;
8- try {
9- nodelua = require ( './build/Debug/node-luajit' ) ;
10- } catch ( e ) {
11- nodelua = require ( '/Users/nuc/Library/Developer/Xcode/DerivedData/binding-ebwzqyofwzjwfzcrbpisobhcazli/Build/Products/Debug/node-luajit.node' )
12- }
13- }
3+ const binary = require ( 'node-pre-gyp' ) ;
4+ const binding_path = binary . find ( path . resolve ( path . join ( __dirname , 'package.json' ) ) ) ;
5+ const nodelua = require ( binding_path ) ;
146
157let MyCLua = nodelua [ 'MyLuaState' ] ;
168
You can’t perform that action at this time.
0 commit comments