koffi 2.5.15 → 2.5.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,15 +4,16 @@
4
4
 
5
5
  ### Koffi 2.5
6
6
 
7
- #### Koffi 2.5.15 (2023-08-24)
7
+ #### Koffi 2.5.16 (2023-08-25)
8
8
 
9
9
  - Run Koffi tests through usual index.js entry point
10
-
11
- #### Koffi 2.5.14 (2023-08-23)
12
-
13
10
  - Fix DLL error when using Koffi from NW.js on Windows
14
11
  - Simplify NW.js Koffi example
15
12
 
13
+ ```{warning}
14
+ Pre-built binaries don't work correctly in Koffi 2.5.13 to 2.5.15, skip those versions.
15
+ ```
16
+
16
17
  #### Koffi 2.5.12 (2023-08-21)
17
18
 
18
19
  - Fix native module bundling for FreeBSD ARM64 and Linux RISC-V 64
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koffi",
3
- "version": "2.5.15",
4
- "stable": "2.5.15",
3
+ "version": "2.5.16",
4
+ "stable": "2.5.16",
5
5
  "description": "Fast and simple C FFI (foreign function interface) for Node.js",
6
6
  "keywords": [
7
7
  "foreign",
@@ -25,7 +25,7 @@
25
25
  "main": "src/index.js",
26
26
  "types": "src/index.d.ts",
27
27
  "scripts": {
28
- "install": "node src/cnoke/cnoke.js --prebuild -d src/koffi"
28
+ "install": "node src/cnoke/cnoke.js -p . -d src/koffi --prebuild"
29
29
  },
30
30
  "license": "MIT",
31
31
  "cnoke": {
@@ -77,7 +77,12 @@ async function main() {
77
77
  throw new Error(`Missing value for ${arg}`);
78
78
 
79
79
  config.project_dir = fs.realpathSync(value);
80
- } else if (arg == '-o' || arg == '--output') {
80
+ } else if (arg == '-p' || arg == '--package') {
81
+ if (value == null)
82
+ throw new Error(`Missing value for ${arg}`);
83
+
84
+ config.package_dir = fs.realpathSync(value);
85
+ } else if (arg == '-O' || arg == '--out') {
81
86
  if (value == null)
82
87
  throw new Error(`Missing value for ${arg}`);
83
88
 
@@ -153,9 +158,12 @@ Commands:
153
158
  clean Clean build files
154
159
 
155
160
  Options:
156
- -d, --directory <DIR> Change project directory
161
+ -d, --directory <DIR> Change source directory
157
162
  (default: current working directory)
158
- -O, --output <DIR> Change explicit output directory
163
+ -p, --package <DIR> Change package directory
164
+ (default: current working directory)
165
+
166
+ -O, --out <DIR> Set explicit output directory
159
167
  (default: ./build)
160
168
 
161
169
  -B, --config <CONFIG> Change build type: RelWithDebInfo, Debug, Release
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnoke",
3
- "version": "3.3.2",
3
+ "version": "4.0.1",
4
4
  "description": "Build native Node addons based on CMake, without extra dependency",
5
5
  "keywords": [
6
6
  "native",
@@ -36,6 +36,7 @@ function Builder(config = {}) {
36
36
 
37
37
  let app_dir = config.app_dir;
38
38
  let project_dir = config.project_dir;
39
+ let package_dir = config.package_dir;
39
40
 
40
41
  if (app_dir == null)
41
42
  app_dir = __dirname.replace(/\\/g, '/') + '/..';
@@ -43,6 +44,9 @@ function Builder(config = {}) {
43
44
  project_dir = process.cwd();
44
45
  app_dir = app_dir.replace(/\\/g, '/');
45
46
  project_dir = project_dir.replace(/\\/g, '/');
47
+ if (package_dir == null)
48
+ package_dir = project_dir;
49
+ package_dir = package_dir.replace(/\\/g, '/');
46
50
 
47
51
  let runtime_version = config.runtime_version;
48
52
  let arch = config.arch;
@@ -68,15 +72,14 @@ function Builder(config = {}) {
68
72
  let pkg = read_package_json();
69
73
 
70
74
  if (pkg.cnoke.output != null) {
71
- build_dir = pkg.cnoke.output;
75
+ build_dir = expand_path(pkg.cnoke.output);
72
76
 
73
77
  if (!tools.path_is_absolute(build_dir))
74
- build_dir = project_dir + '/' + build_dir;
78
+ build_dir = package_dir + '/' + build_dir;
75
79
  } else {
76
80
  build_dir = project_dir + '/build';
77
81
  }
78
82
  }
79
- build_dir = expand_path(build_dir);
80
83
  work_dir = build_dir + `/v${runtime_version}_${arch}`;
81
84
 
82
85
  let cmake_bin = null;
@@ -285,7 +288,7 @@ function Builder(config = {}) {
285
288
  archive_filename = url;
286
289
 
287
290
  if (!tools.path_is_absolute(archive_filename))
288
- archive_filename = path.join(project_dir, archive_filename);
291
+ archive_filename = path.join(package_dir, archive_filename);
289
292
 
290
293
  if (!fs.existsSync(archive_filename))
291
294
  throw new Error('Cannot find local prebuilt archive');
@@ -302,7 +305,7 @@ function Builder(config = {}) {
302
305
  let require_filename = expand_path(pkg.cnoke.require);
303
306
 
304
307
  if (!tools.path_is_absolute(require_filename))
305
- require_filename = path.join(project_dir, require_filename);
308
+ require_filename = path.join(package_dir, require_filename);
306
309
 
307
310
  if (fs.existsSync(require_filename)) {
308
311
  let proc = spawnSync(process.execPath, ['-e', 'require(process.argv[1])', require_filename]);
@@ -320,6 +323,21 @@ function Builder(config = {}) {
320
323
  tools.unlink_recursive(build_dir);
321
324
  };
322
325
 
326
+ function find_parent_directory(dirname, basename)
327
+ {
328
+ if (process.platform == 'win32')
329
+ dirname = dirname.replace(/\\/g, '/');
330
+
331
+ do {
332
+ if (fs.existsSync(dirname + '/' + basename))
333
+ return dirname;
334
+
335
+ dirname = path.dirname(dirname);
336
+ } while (!dirname.endsWith('/'));
337
+
338
+ return null;
339
+ }
340
+
323
341
  function get_cache_directory() {
324
342
  if (process.platform == 'win32') {
325
343
  let cache_dir = process.env['APPDATA'];
@@ -404,12 +422,14 @@ function Builder(config = {}) {
404
422
  function read_package_json() {
405
423
  let pkg = {};
406
424
 
407
- try {
408
- let json = fs.readFileSync(project_dir + '/package.json', { encoding: 'utf-8' });
409
- pkg = JSON.parse(json);
410
- } catch (err) {
411
- if (err.code != 'ENOENT')
412
- throw err;
425
+ if (package_dir != null) {
426
+ try {
427
+ let json = fs.readFileSync(package_dir + '/package.json', { encoding: 'utf-8' });
428
+ pkg = JSON.parse(json);
429
+ } catch (err) {
430
+ if (err.code != 'ENOENT')
431
+ throw err;
432
+ }
413
433
  }
414
434
 
415
435
  if (pkg.cnoke == null)
package/src/index.js CHANGED
@@ -378,8 +378,8 @@ var require_package = __commonJS({
378
378
  "build/dist/src/koffi/package.json"(exports2, module2) {
379
379
  module2.exports = {
380
380
  name: "koffi",
381
- version: "2.5.15",
382
- stable: "2.5.15",
381
+ version: "2.5.16",
382
+ stable: "2.5.16",
383
383
  description: "Fast and simple C FFI (foreign function interface) for Node.js",
384
384
  keywords: [
385
385
  "foreign",
package/koffi-2.5.15.tgz DELETED
Binary file