roxify 1.6.8 → 1.6.9

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.
@@ -1,21 +1,26 @@
1
1
  import { existsSync } from 'fs';
2
2
  import { createRequire } from 'module';
3
3
  import { arch, platform } from 'os';
4
- import { join, resolve } from 'path';
4
+ import { dirname, join, resolve } from 'path';
5
+ import { fileURLToPath } from 'url';
5
6
  function getNativeModule() {
6
7
  let moduleDir;
7
8
  let nativeRequire;
9
+ // In ESM, __dirname is not available — derive it from import.meta.url
10
+ // which always points to the actual file location on disk.
11
+ const esmFilename = fileURLToPath(import.meta.url);
12
+ const esmDirname = dirname(esmFilename);
8
13
  if (typeof __dirname !== 'undefined') {
9
14
  moduleDir = __dirname;
10
15
  nativeRequire = require;
11
16
  }
12
17
  else {
13
- moduleDir = process.cwd();
18
+ moduleDir = esmDirname;
14
19
  try {
15
20
  nativeRequire = require;
16
21
  }
17
22
  catch {
18
- nativeRequire = createRequire(process.cwd() + '/package.json');
23
+ nativeRequire = createRequire(esmFilename);
19
24
  }
20
25
  }
21
26
  function getNativePath() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roxify",
3
- "version": "1.6.8",
3
+ "version": "1.6.9",
4
4
  "type": "module",
5
5
  "description": "Ultra-lightweight PNG steganography with native Rust acceleration. Encode binary data into PNG images with zstd compression.",
6
6
  "main": "dist/index.js",
Binary file