@aztec/native 3.0.0-nightly.20251118 → 3.0.0-nightly.20251119

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 +1 @@
1
- {"version":3,"file":"native_module.d.ts","sourceRoot":"","sources":["../src/native_module.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,UAAU,eAAe;IACvB,KAAK,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC;CAC3C;AA2BD,eAAO,MAAM,gBAAgB,EAAE,eAA4D,CAAC;AAC5F,eAAO,MAAM,eAAe,EAAE,eAA2D,CAAC;AAE1F;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAClE;;;;OAIG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAE/D;;;;OAIG;IACH,YAAY,CAAC,sBAAsB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5D;;;;OAIG;IACH,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAEpE;;;;;OAKG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAErF;;;;OAIG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC;;;OAGG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAElC;;;OAGG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH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AAI,CAAC,CAAC;IAElC;;;OAGG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,EAAE,CACxB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,GAAG,KAClB,OAAO,CAAC,MAAM,CAIC,CAAC;AACrB;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAErD,CAAC"}
@@ -1,20 +1,12 @@
1
+ import { findNapiBinary } from '@aztec/bb.js';
1
2
  import { createRequire } from 'module';
2
- import { dirname, join } from 'path';
3
- import { fileURLToPath } from 'url';
4
3
  function loadNativeModule() {
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = dirname(__filename);
7
- // Map Node.js platform/arch to build directory names
8
- const arch = process.arch === 'x64' ? 'amd64' : process.arch;
9
- const platform = process.platform === 'darwin' ? 'macos' : process.platform;
10
- const variant = `${arch}-${platform}`;
11
- const modulePath = join(__dirname, '..', 'build', variant, 'nodejs_module.node');
12
- try {
13
- const require = createRequire(import.meta.url);
14
- return require(modulePath);
15
- } catch (error) {
16
- throw new Error(`Failed to load native module for ${variant} from ${modulePath}. ` + `Supported: amd64-linux, arm64-linux, amd64-macos, arm64-macos. ` + `Error: ${error}`);
4
+ const require = createRequire(import.meta.url);
5
+ const napiPath = findNapiBinary();
6
+ if (!napiPath) {
7
+ throw new Error('NAPI binary not found for current platform.');
17
8
  }
9
+ return require(napiPath);
18
10
  }
19
11
  const nativeModule = loadNativeModule();
20
12
  export const NativeWorldState = nativeModule.WorldState;
package/package.json CHANGED
@@ -1,25 +1,22 @@
1
1
  {
2
2
  "name": "@aztec/native",
3
- "version": "3.0.0-nightly.20251118",
3
+ "version": "3.0.0-nightly.20251119",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js"
7
7
  },
8
8
  "scripts": {
9
- "build": "yarn clean && yarn generate && tsc -b",
9
+ "build": "yarn clean && tsc -b",
10
10
  "build:dev": "tsc -b --watch",
11
- "build:cpp": "PROJECT=$(pwd); cd $(git rev-parse --show-toplevel)/barretenberg/cpp; cmake --preset ${PRESET:-clang16-pic} && cmake --build --preset ${PRESET:-clang16-pic} --target nodejs_module && cd $PROJECT && yarn generate",
12
- "clean:cpp": "rm -rf $(git rev-parse --show-toplevel)/barretenberg/cpp/build-pic",
13
11
  "clean": "rm -rf ./dest .tsbuildinfo",
14
- "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
15
- "generate": "bash scripts/copy-modules.sh"
12
+ "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
16
13
  },
17
14
  "inherits": [
18
- "../package.common.json",
19
- "./package.local.json"
15
+ "../package.common.json"
20
16
  ],
21
17
  "dependencies": {
22
- "@aztec/foundation": "3.0.0-nightly.20251118",
18
+ "@aztec/bb.js": "3.0.0-nightly.20251119",
19
+ "@aztec/foundation": "3.0.0-nightly.20251119",
23
20
  "msgpackr": "^1.11.2"
24
21
  },
25
22
  "devDependencies": {
@@ -1,6 +1,6 @@
1
+ import { findNapiBinary } from '@aztec/bb.js';
2
+
1
3
  import { createRequire } from 'module';
2
- import { dirname, join } from 'path';
3
- import { fileURLToPath } from 'url';
4
4
 
5
5
  import type { MessageReceiver } from './msgpack_channel.js';
6
6
 
@@ -9,26 +9,12 @@ interface NativeClassCtor {
9
9
  }
10
10
 
11
11
  function loadNativeModule(): Record<string, NativeClassCtor> {
12
- const __filename = fileURLToPath(import.meta.url);
13
- const __dirname = dirname(__filename);
14
-
15
- // Map Node.js platform/arch to build directory names
16
- const arch = process.arch === 'x64' ? 'amd64' : process.arch;
17
- const platform = process.platform === 'darwin' ? 'macos' : process.platform;
18
- const variant = `${arch}-${platform}`;
19
-
20
- const modulePath = join(__dirname, '..', 'build', variant, 'nodejs_module.node');
21
-
22
- try {
23
- const require = createRequire(import.meta.url);
24
- return require(modulePath);
25
- } catch (error) {
26
- throw new Error(
27
- `Failed to load native module for ${variant} from ${modulePath}. ` +
28
- `Supported: amd64-linux, arm64-linux, amd64-macos, arm64-macos. ` +
29
- `Error: ${error}`,
30
- );
12
+ const require = createRequire(import.meta.url);
13
+ const napiPath = findNapiBinary();
14
+ if (!napiPath) {
15
+ throw new Error('NAPI binary not found for current platform.');
31
16
  }
17
+ return require(napiPath);
32
18
  }
33
19
 
34
20
  const nativeModule: Record<string, NativeClassCtor | Function> = loadNativeModule();