@nomicfoundation/edr 0.21.0 → 0.22.1

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.
Files changed (3) hide show
  1. package/index.d.ts +77 -56
  2. package/index.js +160 -82
  3. package/package.json +10 -10
package/index.d.ts CHANGED
@@ -1,12 +1,19 @@
1
1
  /* auto-generated by NAPI-RS */
2
2
  /* eslint-disable */
3
+
4
+ /**
5
+ * Which binding artifact the generated loader actually loaded: `'native'` for
6
+ * a native addon, otherwise the `platformArchABI` of the WASI flavor. Every
7
+ * flavor napi-rs can build is listed, because `NAPI_RS_NATIVE_LIBRARY_PATH`
8
+ * can point the loader at a WASI artifact this package does not build itself.
9
+ */
10
+ export declare const __napiBindingTarget: 'native' | 'wasm32-wasi' | 'wasm32-wasip1'
11
+
3
12
  /**
4
13
  * Opaque handle to the `Bytecode` struct.
5
14
  * Only used on the JS side by the `VmTraceDecoder` class.
6
15
  */
7
- export declare class BytecodeWrapper {
8
-
9
- }
16
+ export declare class BytecodeWrapper {}
10
17
 
11
18
  export declare class ContractDecoder {
12
19
  /** Creates an empty instance. */
@@ -82,9 +89,7 @@ export declare class Provider {
82
89
  setVerboseTracing(verboseTracing: boolean): Promise<void>
83
90
  }
84
91
 
85
- export declare class ProviderFactory {
86
-
87
- }
92
+ export declare class ProviderFactory {}
88
93
 
89
94
  export declare class RawTrace {
90
95
  get trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
@@ -115,9 +120,7 @@ export declare class ReturnData {
115
120
  decodePanic(): bigint
116
121
  }
117
122
 
118
- export declare class SolidityTestRunnerFactory {
119
-
120
- }
123
+ export declare class SolidityTestRunnerFactory {}
121
124
 
122
125
  /** See [`edr_solidity_tests::result::TestResult`] */
123
126
  export declare class TestResult {
@@ -278,7 +281,7 @@ export declare enum CachedChains {
278
281
  /** Cache all chains */
279
282
  All = 0,
280
283
  /** Don't cache anything */
281
- None = 1
284
+ None = 1,
282
285
  }
283
286
 
284
287
  /** What endpoints to enable caching for */
@@ -286,7 +289,7 @@ export declare enum CachedEndpoints {
286
289
  /** Cache all endpoints */
287
290
  All = 0,
288
291
  /** Only cache non-local host endpoints */
289
- Remote = 1
292
+ Remote = 1,
290
293
  }
291
294
 
292
295
  export interface CallFailedErrorStackTraceEntry {
@@ -308,7 +311,7 @@ export declare enum CallKind {
308
311
  /** Regular call that may not change state. */
309
312
  StaticCall = 3,
310
313
  /** Contract creation. */
311
- Create = 4
314
+ Create = 4,
312
315
  }
313
316
 
314
317
  export interface CallOutput {
@@ -383,7 +386,7 @@ export declare enum CheatcodeErrorCode {
383
386
  /** The specified cheatcode is not supported. */
384
387
  UnsupportedCheatcode = 'UnsupportedCheatcode',
385
388
  /** The specified cheatcode is missing. */
386
- MissingCheatcode = 'MissingCheatcode'
389
+ MissingCheatcode = 'MissingCheatcode',
387
390
  }
388
391
 
389
392
  /** Error returned by a cheatcode in Solidity tests. */
@@ -426,10 +429,10 @@ export declare enum CollectStackTraces {
426
429
  * Not all tests can be re-executed since certain cheatcodes contain
427
430
  * non-deterministic side-effects.
428
431
  */
429
- OnFailure = 1
432
+ OnFailure = 1,
430
433
  }
431
434
 
432
- export const CONSTRUCTOR_FUNCTION_NAME: string
435
+ export declare const CONSTRUCTOR_FUNCTION_NAME: string
433
436
 
434
437
  export interface ContractCallRunOutOfGasError {
435
438
  type: StackTraceEntryType.CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR
@@ -463,7 +466,7 @@ export declare enum ContractFunctionType {
463
466
  RECEIVE = 3,
464
467
  GETTER = 4,
465
468
  MODIFIER = 5,
466
- FREE_FUNCTION = 6
469
+ FREE_FUNCTION = 6,
467
470
  }
468
471
 
469
472
  export interface ContractGasReport {
@@ -488,7 +491,7 @@ export interface CounterExampleSequence {
488
491
  }
489
492
 
490
493
  /** The instrumentation coverage library file name. */
491
- export const COVERAGE_LIBRARY_FILE_NAME: string
494
+ export declare const COVERAGE_LIBRARY_FILE_NAME: string
492
495
 
493
496
  export interface CreateOutput {
494
497
  /** Return value */
@@ -578,7 +581,7 @@ export declare enum ExceptionalHalt {
578
581
  /** Error on created contract that begins with EF */
579
582
  CreateContractStartingWithEF = 12,
580
583
  /** EIP-3860: Limit and meter initcode. Initcode size limit exceeded. */
581
- CreateInitCodeSizeLimit = 13
584
+ CreateInitCodeSizeLimit = 13,
582
585
  }
583
586
 
584
587
  /** Ethereum execution log. */
@@ -615,10 +618,10 @@ export declare enum ExitCode {
615
618
  /** Create collision. */
616
619
  CREATE_COLLISION = 7,
617
620
  /** Unknown halt reason. */
618
- UNKNOWN_HALT_REASON = 8
621
+ UNKNOWN_HALT_REASON = 8,
619
622
  }
620
623
 
621
- export const FALLBACK_FUNCTION_NAME: string
624
+ export declare const FALLBACK_FUNCTION_NAME: string
622
625
 
623
626
  export interface FallbackNotPayableAndNoReceiveErrorStackTraceEntry {
624
627
  type: StackTraceEntryType.FALLBACK_NOT_PAYABLE_AND_NO_RECEIVE_ERROR
@@ -677,7 +680,7 @@ export declare enum FsAccessPermission {
677
680
  /** Allows reading all files in the directory and its subdirectories */
678
681
  ReadDirectory = 4,
679
682
  /** Allows writing all files in the directory and its subdirectories */
680
- DangerouslyWriteDirectory = 5
683
+ DangerouslyWriteDirectory = 5,
681
684
  }
682
685
 
683
686
  export interface FunctionGasReport {
@@ -782,7 +785,7 @@ export declare enum GasEstimationMode {
782
785
  * Estimates the minimum gas required for the top-level call to succeed
783
786
  * without any internal sub-call running out of gas.
784
787
  */
785
- NoInternalOutOfGas = 1
788
+ NoInternalOutOfGas = 1,
786
789
  }
787
790
 
788
791
  export interface GasReport {
@@ -804,10 +807,10 @@ export interface GasReportConfig {
804
807
  export declare enum GasReportExecutionStatus {
805
808
  Success = 0,
806
809
  Revert = 1,
807
- Halt = 2
810
+ Halt = 2,
808
811
  }
809
812
 
810
- export const GENERIC_CHAIN_TYPE: string
813
+ export declare const GENERIC_CHAIN_TYPE: string
811
814
 
812
815
  export declare function genericChainProviderFactory(): ProviderFactory
813
816
 
@@ -872,7 +875,7 @@ export declare enum IncludeTraces {
872
875
  */
873
876
  Failing = 1,
874
877
  /** Traces will be included for all test results or executed transactions. */
875
- All = 2
878
+ All = 2,
876
879
  }
877
880
 
878
881
  /** A directive-level inline-config problem, located at the offending directive. */
@@ -924,8 +927,7 @@ export interface InlineConfigDirectiveLocation {
924
927
  * over its `kind` tag — mirroring the Rust-side `InlineConfigError` enum so
925
928
  * consumers can map each problem onto their own error types.
926
929
  */
927
- export type InlineConfigDirectiveProblem =
928
- InlineConfigInvalidSyntax | InlineConfigUnsupportedProfile | InlineConfigInvalidKey | InlineConfigInvalidKeyForTestType | InlineConfigInvalidValue | InlineConfigDuplicateKey
930
+ export type InlineConfigDirectiveProblem = InlineConfigInvalidSyntax | InlineConfigUndeclaredProfile | InlineConfigInvalidKey | InlineConfigInvalidKeyForTestType | InlineConfigInvalidValue | InlineConfigDuplicateKey
929
931
 
930
932
  /**
931
933
  * The same key was specified more than once for the same function or
@@ -946,8 +948,7 @@ export interface InlineConfigDuplicateKey {
946
948
  * rejected `runSolidityTests` promise as the `inlineConfigErrors` array on the
947
949
  * thrown error.
948
950
  */
949
- export type InlineConfigError =
950
- InlineConfigSourceError | InlineConfigDirectiveError
951
+ export type InlineConfigError = InlineConfigSourceError | InlineConfigDirectiveError
951
952
 
952
953
  /** An unknown configuration key was used. */
953
954
  export interface InlineConfigInvalidKey {
@@ -1029,15 +1030,16 @@ export interface InlineConfigSourceFileNotFound {
1029
1030
  * A source-level problem, as a discriminated union over its `kind` tag. These
1030
1031
  * cannot be pinned to a single directive line, so they carry no line.
1031
1032
  */
1032
- export type InlineConfigSourceProblem =
1033
- InlineConfigInvalidSolcVersion | InlineConfigSourceFileNotFound | InlineConfigDirectiveLocation
1033
+ export type InlineConfigSourceProblem = InlineConfigInvalidSolcVersion | InlineConfigSourceFileNotFound | InlineConfigDirectiveLocation
1034
1034
 
1035
- /** A profile other than `default` was used. */
1036
- export interface InlineConfigUnsupportedProfile {
1035
+ /** A directive named a profile the project does not declare. */
1036
+ export interface InlineConfigUndeclaredProfile {
1037
1037
  /** Enum tag for JS. */
1038
- kind: "InlineConfigUnsupportedProfile"
1039
- /** The unsupported profile name. */
1038
+ kind: "InlineConfigUndeclaredProfile"
1039
+ /** The undeclared profile name, exactly as written. */
1040
1040
  profile: string
1041
+ /** The profiles the project declares, sorted. */
1042
+ declaredProfiles: Array<string>
1041
1043
  }
1042
1044
 
1043
1045
  export interface InstrumentationMetadata {
@@ -1179,7 +1181,7 @@ export interface InvariantTestKind {
1179
1181
  */
1180
1182
  export declare function keccak256(data: Uint8Array): Uint8Array
1181
1183
 
1182
- export const L1_CHAIN_TYPE: string
1184
+ export declare const L1_CHAIN_TYPE: string
1183
1185
 
1184
1186
  export declare function l1GenesisState(hardfork: L1Hardfork): Array<AccountOverride>
1185
1187
 
@@ -1214,7 +1216,7 @@ export declare enum L1Hardfork {
1214
1216
  /** Osaka */
1215
1217
  Osaka = 19,
1216
1218
  /** Amsterdam */
1217
- Amsterdam = 20
1219
+ Amsterdam = 20,
1218
1220
  }
1219
1221
 
1220
1222
  /**
@@ -1272,7 +1274,7 @@ export interface LoggerConfig {
1272
1274
  /** Kind marker for log traces. */
1273
1275
  export declare enum LogKind {
1274
1276
  /** Single kind of log. */
1275
- Log = 5
1277
+ Log = 5,
1276
1278
  }
1277
1279
 
1278
1280
  /** Object representing an event log in an execution trace. */
@@ -1299,7 +1301,7 @@ export declare enum MineOrdering {
1299
1301
  /** Insertion order */
1300
1302
  Fifo = 'Fifo',
1301
1303
  /** Effective miner fee */
1302
- Priority = 'Priority'
1304
+ Priority = 'Priority',
1303
1305
  }
1304
1306
 
1305
1307
  /** Configuration for the provider's miner. */
@@ -1341,7 +1343,7 @@ export interface ObservabilityConfig {
1341
1343
  includeCallTraces?: IncludeTraces
1342
1344
  }
1343
1345
 
1344
- export const OP_CHAIN_TYPE: string
1346
+ export declare const OP_CHAIN_TYPE: string
1345
1347
 
1346
1348
  export declare function opGenesisState(hardfork: OpHardfork): Array<AccountOverride>
1347
1349
 
@@ -1354,7 +1356,7 @@ export declare enum OpHardfork {
1354
1356
  Fjord = 104,
1355
1357
  Granite = 105,
1356
1358
  Holocene = 106,
1357
- Isthmus = 107
1359
+ Isthmus = 107,
1358
1360
  }
1359
1361
 
1360
1362
  /**
@@ -1398,7 +1400,7 @@ export interface PathPermission {
1398
1400
  path: string
1399
1401
  }
1400
1402
 
1401
- export const PRECOMPILE_FUNCTION_NAME: string
1403
+ export declare const PRECOMPILE_FUNCTION_NAME: string
1402
1404
 
1403
1405
  export interface PrecompileErrorStackTraceEntry {
1404
1406
  type: StackTraceEntryType.PRECOMPILE_ERROR
@@ -1482,18 +1484,22 @@ export interface ProviderConfig {
1482
1484
  *
1483
1485
  * Integer values should be larger than zero.
1484
1486
  *
1485
- * When `false`, enforcement of the transaction gas cap is disabled and
1486
- * transactions with any `gas` value are accepted by the mempool and
1487
- * executed without REVM's transaction gas cap check.
1487
+ * Before Amsterdam it bounds a transaction's `gas`. From Amsterdam
1488
+ * ([EIP-8037]) it bounds execution gas only: `gas` may exceed it, up to
1489
+ * the protocol's `TX_MAX_TOTAL_GAS_LIMIT` (2^32 - 1), which this
1490
+ * option does not affect.
1491
+ *
1492
+ * When `false`, the cap is not enforced.
1488
1493
  *
1489
1494
  * When not set, a hardfork-specific default value will be used.
1490
1495
  *
1491
1496
  * [EIP-7825]: https://eips.ethereum.org/EIPS/eip-7825
1497
+ * [EIP-8037]: https://eips.ethereum.org/EIPS/eip-8037
1492
1498
  */
1493
1499
  transactionGasCap?: bigint | false
1494
1500
  }
1495
1501
 
1496
- export const RECEIVE_FUNCTION_NAME: string
1502
+ export declare const RECEIVE_FUNCTION_NAME: string
1497
1503
 
1498
1504
  export interface ReturndataSizeErrorStackTraceEntry {
1499
1505
  type: StackTraceEntryType.RETURNDATA_SIZE_ERROR
@@ -1526,11 +1532,9 @@ export interface RevertResult {
1526
1532
  */
1527
1533
  export declare function secp256k1PublicKeyFromSecretKey(secretKey: Uint8Array): Uint8Array
1528
1534
 
1529
- export type SolidityStackTrace =
1530
- Array<SolidityStackTraceEntry>
1535
+ export type SolidityStackTrace = Array<SolidityStackTraceEntry>
1531
1536
 
1532
- export type SolidityStackTraceEntry =
1533
- CallstackEntryStackTraceEntry | UnrecognizedCreateCallstackEntryStackTraceEntry | UnrecognizedContractCallstackEntryStackTraceEntry | PrecompileErrorStackTraceEntry | RevertErrorStackTraceEntry | PanicErrorStackTraceEntry | CustomErrorStackTraceEntry | FunctionNotPayableErrorStackTraceEntry | InvalidParamsErrorStackTraceEntry | FallbackNotPayableErrorStackTraceEntry | FallbackNotPayableAndNoReceiveErrorStackTraceEntry | UnrecognizedFunctionWithoutFallbackErrorStackTraceEntry | MissingFallbackOrReceiveErrorStackTraceEntry | ReturndataSizeErrorStackTraceEntry | NonContractAccountCalledErrorStackTraceEntry | CallFailedErrorStackTraceEntry | DirectLibraryCallErrorStackTraceEntry | UnrecognizedCreateErrorStackTraceEntry | UnrecognizedContractErrorStackTraceEntry | OtherExecutionErrorStackTraceEntry | UnmappedSolc063RevertErrorStackTraceEntry | ContractTooLargeErrorStackTraceEntry | InternalFunctionCallStackEntry | ContractCallRunOutOfGasError | CheatcodeErrorStackTraceEntry
1537
+ export type SolidityStackTraceEntry = CallstackEntryStackTraceEntry | UnrecognizedCreateCallstackEntryStackTraceEntry | UnrecognizedContractCallstackEntryStackTraceEntry | PrecompileErrorStackTraceEntry | RevertErrorStackTraceEntry | PanicErrorStackTraceEntry | CustomErrorStackTraceEntry | FunctionNotPayableErrorStackTraceEntry | InvalidParamsErrorStackTraceEntry | FallbackNotPayableErrorStackTraceEntry | FallbackNotPayableAndNoReceiveErrorStackTraceEntry | UnrecognizedFunctionWithoutFallbackErrorStackTraceEntry | MissingFallbackOrReceiveErrorStackTraceEntry | ReturndataSizeErrorStackTraceEntry | NonContractAccountCalledErrorStackTraceEntry | CallFailedErrorStackTraceEntry | DirectLibraryCallErrorStackTraceEntry | UnrecognizedCreateErrorStackTraceEntry | UnrecognizedContractErrorStackTraceEntry | OtherExecutionErrorStackTraceEntry | UnmappedSolc063RevertErrorStackTraceEntry | ContractTooLargeErrorStackTraceEntry | InternalFunctionCallStackEntry | ContractCallRunOutOfGasError | CheatcodeErrorStackTraceEntry
1534
1538
 
1535
1539
  /** The result of a Solidity test run. */
1536
1540
  export interface SolidityTestResult {
@@ -1781,6 +1785,23 @@ export interface SolidityTestRunnerConfigArgs {
1781
1785
  * do.
1782
1786
  */
1783
1787
  importMappings?: Record<string, string>
1788
+ /**
1789
+ * The Solidity test profile this run was started with.
1790
+ *
1791
+ * An inline-config directive prefixed with a profile name
1792
+ * (`forge-config: ci.fuzz.runs = 8`) applies only under that profile; an
1793
+ * unprefixed one applies under every profile, and the prefixed one wins
1794
+ * where both set the same key. Defaults to `default`.
1795
+ */
1796
+ testProfile?: string
1797
+ /**
1798
+ * Every Solidity test profile the project declares.
1799
+ *
1800
+ * A prefix naming a profile that is not declared is an error, so a
1801
+ * mistyped one fails whichever profile is selected. `default` is always
1802
+ * declared. Defaults to `["default"]`.
1803
+ */
1804
+ declaredTestProfiles?: Array<string>
1784
1805
  }
1785
1806
 
1786
1807
  export interface SourceReference {
@@ -1825,7 +1846,7 @@ export declare enum StackTraceEntryType {
1825
1846
  CONTRACT_TOO_LARGE_ERROR = 21,
1826
1847
  INTERNAL_FUNCTION_CALLSTACK_ENTRY = 22,
1827
1848
  CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR = 23,
1828
- CHEATCODE_ERROR = 24
1849
+ CHEATCODE_ERROR = 24,
1829
1850
  }
1830
1851
 
1831
1852
  export declare function stackTraceEntryTypeToString(val: StackTraceEntryType): string
@@ -1873,7 +1894,7 @@ export declare enum SuccessReason {
1873
1894
  /** The opcode `RETURN` was called */
1874
1895
  Return = 1,
1875
1896
  /** The opcode `SELFDESTRUCT` was called */
1876
- SelfDestruct = 2
1897
+ SelfDestruct = 2,
1877
1898
  }
1878
1899
 
1879
1900
  /** The result when the EVM terminates successfully. */
@@ -1927,7 +1948,7 @@ export declare enum TestStatus {
1927
1948
  /** Test failure */
1928
1949
  Failure = 'Failure',
1929
1950
  /** Test skipped */
1930
- Skipped = 'Skipped'
1951
+ Skipped = 'Skipped',
1931
1952
  }
1932
1953
 
1933
1954
  /** Tracing config for Solidity stack trace generation. */
@@ -1996,16 +2017,16 @@ export interface UnexpectedError {
1996
2017
  errorMessage: string
1997
2018
  }
1998
2019
 
1999
- export const UNKNOWN_FUNCTION_NAME: string
2020
+ export declare const UNKNOWN_FUNCTION_NAME: string
2000
2021
 
2001
2022
  export interface UnmappedSolc063RevertErrorStackTraceEntry {
2002
2023
  type: StackTraceEntryType.UNMAPPED_SOLC_0_6_3_REVERT_ERROR
2003
2024
  sourceReference?: SourceReference
2004
2025
  }
2005
2026
 
2006
- export const UNRECOGNIZED_CONTRACT_NAME: string
2027
+ export declare const UNRECOGNIZED_CONTRACT_NAME: string
2007
2028
 
2008
- export const UNRECOGNIZED_FUNCTION_NAME: string
2029
+ export declare const UNRECOGNIZED_FUNCTION_NAME: string
2009
2030
 
2010
2031
  export interface UnrecognizedContractCallstackEntryStackTraceEntry {
2011
2032
  type: StackTraceEntryType.UNRECOGNIZED_CONTRACT_CALLSTACK_ENTRY
package/index.js CHANGED
@@ -1,10 +1,13 @@
1
- // prettier-ignore
2
1
  /* eslint-disable */
3
2
  // @ts-nocheck
4
3
  /* auto-generated by NAPI-RS */
5
4
 
6
5
  const { readFileSync } = require('fs')
7
6
  let nativeBinding = null
7
+ // Which artifact actually loaded. The WASI fallback chain overwrites it with
8
+ // the flavor it resolved; the late native retry below leaves it alone because
9
+ // it only runs while no WASI candidate has been loaded.
10
+ let __napiLoadedBindingTarget = 'native'
8
11
  const loadErrors = []
9
12
 
10
13
  const isMusl = () => {
@@ -63,7 +66,16 @@ const isMuslFromChildProcess = () => {
63
66
  function requireNative() {
64
67
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
65
68
  try {
66
- return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
69
+ const overrideBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH)
70
+ // The override may be a generated WASI loader, which already reports its
71
+ // own flavor. Adopt it: `module.exports` aliases this object, so claiming
72
+ // 'native' would both misreport the artifact and overwrite the loader's
73
+ // marker through the alias.
74
+ __napiLoadedBindingTarget =
75
+ overrideBinding && typeof overrideBinding.__napiBindingTarget === 'string'
76
+ ? overrideBinding.__napiBindingTarget
77
+ : 'native'
78
+ return overrideBinding
67
79
  } catch (err) {
68
80
  loadErrors.push(err)
69
81
  }
@@ -77,8 +89,8 @@ function requireNative() {
77
89
  try {
78
90
  const binding = require('@nomicfoundation/edr-android-arm64')
79
91
  const bindingPackageVersion = require('@nomicfoundation/edr-android-arm64/package.json').version
80
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
81
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
92
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
93
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
82
94
  }
83
95
  return binding
84
96
  } catch (e) {
@@ -93,8 +105,8 @@ function requireNative() {
93
105
  try {
94
106
  const binding = require('@nomicfoundation/edr-android-arm-eabi')
95
107
  const bindingPackageVersion = require('@nomicfoundation/edr-android-arm-eabi/package.json').version
96
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
97
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
108
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
109
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
98
110
  }
99
111
  return binding
100
112
  } catch (e) {
@@ -107,36 +119,36 @@ function requireNative() {
107
119
  if (process.arch === 'x64') {
108
120
  if ((process.config && process.config.variables && process.config.variables.shlib_suffix === 'dll.a') || (process.config && process.config.variables && process.config.variables.node_target_type === 'shared_library')) {
109
121
  try {
110
- return require('./edr.win32-x64-gnu.node')
111
- } catch (e) {
112
- loadErrors.push(e)
113
- }
114
- try {
115
- const binding = require('@nomicfoundation/edr-win32-x64-gnu')
116
- const bindingPackageVersion = require('@nomicfoundation/edr-win32-x64-gnu/package.json').version
117
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
118
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122
+ return require('./edr.win32-x64-gnu.node')
123
+ } catch (e) {
124
+ loadErrors.push(e)
125
+ }
126
+ try {
127
+ const binding = require('@nomicfoundation/edr-win32-x64-gnu')
128
+ const bindingPackageVersion = require('@nomicfoundation/edr-win32-x64-gnu/package.json').version
129
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
131
+ }
132
+ return binding
133
+ } catch (e) {
134
+ loadErrors.push(e)
119
135
  }
120
- return binding
121
- } catch (e) {
122
- loadErrors.push(e)
123
- }
124
136
  } else {
125
137
  try {
126
- return require('./edr.win32-x64-msvc.node')
127
- } catch (e) {
128
- loadErrors.push(e)
129
- }
130
- try {
131
- const binding = require('@nomicfoundation/edr-win32-x64-msvc')
132
- const bindingPackageVersion = require('@nomicfoundation/edr-win32-x64-msvc/package.json').version
133
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
134
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
138
+ return require('./edr.win32-x64-msvc.node')
139
+ } catch (e) {
140
+ loadErrors.push(e)
141
+ }
142
+ try {
143
+ const binding = require('@nomicfoundation/edr-win32-x64-msvc')
144
+ const bindingPackageVersion = require('@nomicfoundation/edr-win32-x64-msvc/package.json').version
145
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
147
+ }
148
+ return binding
149
+ } catch (e) {
150
+ loadErrors.push(e)
135
151
  }
136
- return binding
137
- } catch (e) {
138
- loadErrors.push(e)
139
- }
140
152
  }
141
153
  } else if (process.arch === 'ia32') {
142
154
  try {
@@ -147,8 +159,8 @@ function requireNative() {
147
159
  try {
148
160
  const binding = require('@nomicfoundation/edr-win32-ia32-msvc')
149
161
  const bindingPackageVersion = require('@nomicfoundation/edr-win32-ia32-msvc/package.json').version
150
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
162
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
164
  }
153
165
  return binding
154
166
  } catch (e) {
@@ -163,8 +175,8 @@ function requireNative() {
163
175
  try {
164
176
  const binding = require('@nomicfoundation/edr-win32-arm64-msvc')
165
177
  const bindingPackageVersion = require('@nomicfoundation/edr-win32-arm64-msvc/package.json').version
166
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
167
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
178
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
179
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
168
180
  }
169
181
  return binding
170
182
  } catch (e) {
@@ -182,8 +194,8 @@ function requireNative() {
182
194
  try {
183
195
  const binding = require('@nomicfoundation/edr-darwin-universal')
184
196
  const bindingPackageVersion = require('@nomicfoundation/edr-darwin-universal/package.json').version
185
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
186
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
197
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
199
  }
188
200
  return binding
189
201
  } catch (e) {
@@ -198,8 +210,8 @@ function requireNative() {
198
210
  try {
199
211
  const binding = require('@nomicfoundation/edr-darwin-x64')
200
212
  const bindingPackageVersion = require('@nomicfoundation/edr-darwin-x64/package.json').version
201
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
202
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
213
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
214
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
215
  }
204
216
  return binding
205
217
  } catch (e) {
@@ -214,8 +226,8 @@ function requireNative() {
214
226
  try {
215
227
  const binding = require('@nomicfoundation/edr-darwin-arm64')
216
228
  const bindingPackageVersion = require('@nomicfoundation/edr-darwin-arm64/package.json').version
217
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
218
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
229
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
230
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
219
231
  }
220
232
  return binding
221
233
  } catch (e) {
@@ -234,8 +246,8 @@ function requireNative() {
234
246
  try {
235
247
  const binding = require('@nomicfoundation/edr-freebsd-x64')
236
248
  const bindingPackageVersion = require('@nomicfoundation/edr-freebsd-x64/package.json').version
237
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
238
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
249
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
250
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
251
  }
240
252
  return binding
241
253
  } catch (e) {
@@ -250,8 +262,8 @@ function requireNative() {
250
262
  try {
251
263
  const binding = require('@nomicfoundation/edr-freebsd-arm64')
252
264
  const bindingPackageVersion = require('@nomicfoundation/edr-freebsd-arm64/package.json').version
253
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
254
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
265
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
255
267
  }
256
268
  return binding
257
269
  } catch (e) {
@@ -271,8 +283,8 @@ function requireNative() {
271
283
  try {
272
284
  const binding = require('@nomicfoundation/edr-linux-x64-musl')
273
285
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-x64-musl/package.json').version
274
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
275
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
286
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
288
  }
277
289
  return binding
278
290
  } catch (e) {
@@ -287,8 +299,8 @@ function requireNative() {
287
299
  try {
288
300
  const binding = require('@nomicfoundation/edr-linux-x64-gnu')
289
301
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-x64-gnu/package.json').version
290
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
291
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
302
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
303
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
292
304
  }
293
305
  return binding
294
306
  } catch (e) {
@@ -305,8 +317,8 @@ function requireNative() {
305
317
  try {
306
318
  const binding = require('@nomicfoundation/edr-linux-arm64-musl')
307
319
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-arm64-musl/package.json').version
308
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
309
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
320
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
321
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
322
  }
311
323
  return binding
312
324
  } catch (e) {
@@ -321,8 +333,8 @@ function requireNative() {
321
333
  try {
322
334
  const binding = require('@nomicfoundation/edr-linux-arm64-gnu')
323
335
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-arm64-gnu/package.json').version
324
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
325
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
336
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
337
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
326
338
  }
327
339
  return binding
328
340
  } catch (e) {
@@ -339,8 +351,8 @@ function requireNative() {
339
351
  try {
340
352
  const binding = require('@nomicfoundation/edr-linux-arm-musleabihf')
341
353
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-arm-musleabihf/package.json').version
342
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
343
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
354
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
355
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
356
  }
345
357
  return binding
346
358
  } catch (e) {
@@ -355,8 +367,8 @@ function requireNative() {
355
367
  try {
356
368
  const binding = require('@nomicfoundation/edr-linux-arm-gnueabihf')
357
369
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-arm-gnueabihf/package.json').version
358
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
359
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
370
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
371
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
372
  }
361
373
  return binding
362
374
  } catch (e) {
@@ -373,8 +385,8 @@ function requireNative() {
373
385
  try {
374
386
  const binding = require('@nomicfoundation/edr-linux-loong64-musl')
375
387
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-loong64-musl/package.json').version
376
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
377
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
388
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
390
  }
379
391
  return binding
380
392
  } catch (e) {
@@ -389,8 +401,8 @@ function requireNative() {
389
401
  try {
390
402
  const binding = require('@nomicfoundation/edr-linux-loong64-gnu')
391
403
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-loong64-gnu/package.json').version
392
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
393
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
404
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
394
406
  }
395
407
  return binding
396
408
  } catch (e) {
@@ -407,8 +419,8 @@ function requireNative() {
407
419
  try {
408
420
  const binding = require('@nomicfoundation/edr-linux-riscv64-musl')
409
421
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-riscv64-musl/package.json').version
410
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
411
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
422
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
423
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
412
424
  }
413
425
  return binding
414
426
  } catch (e) {
@@ -423,8 +435,8 @@ function requireNative() {
423
435
  try {
424
436
  const binding = require('@nomicfoundation/edr-linux-riscv64-gnu')
425
437
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-riscv64-gnu/package.json').version
426
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
427
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
438
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
439
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
440
  }
429
441
  return binding
430
442
  } catch (e) {
@@ -440,8 +452,8 @@ function requireNative() {
440
452
  try {
441
453
  const binding = require('@nomicfoundation/edr-linux-ppc64-gnu')
442
454
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-ppc64-gnu/package.json').version
443
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
455
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
456
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
445
457
  }
446
458
  return binding
447
459
  } catch (e) {
@@ -456,8 +468,8 @@ function requireNative() {
456
468
  try {
457
469
  const binding = require('@nomicfoundation/edr-linux-s390x-gnu')
458
470
  const bindingPackageVersion = require('@nomicfoundation/edr-linux-s390x-gnu/package.json').version
459
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
471
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
472
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
461
473
  }
462
474
  return binding
463
475
  } catch (e) {
@@ -476,8 +488,8 @@ function requireNative() {
476
488
  try {
477
489
  const binding = require('@nomicfoundation/edr-openharmony-arm64')
478
490
  const bindingPackageVersion = require('@nomicfoundation/edr-openharmony-arm64/package.json').version
479
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
480
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
491
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
492
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
481
493
  }
482
494
  return binding
483
495
  } catch (e) {
@@ -492,8 +504,8 @@ function requireNative() {
492
504
  try {
493
505
  const binding = require('@nomicfoundation/edr-openharmony-x64')
494
506
  const bindingPackageVersion = require('@nomicfoundation/edr-openharmony-x64/package.json').version
495
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
496
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
507
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
508
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
497
509
  }
498
510
  return binding
499
511
  } catch (e) {
@@ -508,8 +520,8 @@ function requireNative() {
508
520
  try {
509
521
  const binding = require('@nomicfoundation/edr-openharmony-arm')
510
522
  const bindingPackageVersion = require('@nomicfoundation/edr-openharmony-arm/package.json').version
511
- if (bindingPackageVersion !== '0.21.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
512
- throw new Error(`Native binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
523
+ if (bindingPackageVersion !== '0.22.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
524
+ throw new Error(`Native binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
513
525
  }
514
526
  return binding
515
527
  } catch (e) {
@@ -550,7 +562,7 @@ function createLoadErrorChain(errors) {
550
562
  //
551
563
  // NAPI_RS_WASI_FLAVOR selects one exact generated flavor and implies strict
552
564
  // WASI loading. It never crosses into another flavor or falls back to native.
553
- const __napiWasiFlavors = ["wasm32-wasi"]
565
+ const __napiWasiFlavors = ['wasm32-wasi']
554
566
  const __napiWasiFlavor = process.env.NAPI_RS_WASI_FLAVOR
555
567
  const __napiWasiFlavorRequested =
556
568
  typeof __napiWasiFlavor === 'string' && __napiWasiFlavor.length > 0
@@ -619,15 +631,16 @@ if (!nativeBinding || forceWasi) {
619
631
  }
620
632
  return null
621
633
  }
622
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
634
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
623
635
  let candidateError = null
624
636
  let candidateFailed = false
625
637
  try {
626
- candidateError = __napiWasiResolveCandidate('./edr.wasi.cjs', false, ["./edr.wasm32-wasi.debug.wasm","./edr.wasm32-wasi.wasm"])
638
+ candidateError = __napiWasiResolveCandidate('./edr.wasi.cjs', false, ['./edr.wasm32-wasi.debug.wasm', './edr.wasm32-wasi.wasm'])
627
639
  candidateFailed = candidateError !== null
628
640
  if (!candidateFailed) {
629
641
  wasiBinding = require('./edr.wasi.cjs')
630
642
  nativeBinding = wasiBinding
643
+ __napiLoadedBindingTarget = 'wasm32-wasi'
631
644
  wasiBindingLoaded = true
632
645
  }
633
646
  } catch (err) {
@@ -639,7 +652,7 @@ if (!nativeBinding || forceWasi) {
639
652
  loadErrors.push(candidateError)
640
653
  }
641
654
  }
642
- if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === "wasm32-wasi")) {
655
+ if (!wasiBindingLoaded && (!__napiWasiFlavorRequested || __napiWasiFlavor === 'wasm32-wasi')) {
643
656
  let candidateError = null
644
657
  let candidateFailed = false
645
658
  try {
@@ -648,12 +661,13 @@ if (!nativeBinding || forceWasi) {
648
661
  if (!candidateFailed) {
649
662
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
650
663
  const bindingPackageVersion = require('@nomicfoundation/edr-wasm32-wasi/package.json').version
651
- if (bindingPackageVersion !== '0.21.0') {
652
- throw new Error(`WASI binding package version mismatch, expected 0.21.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
664
+ if (bindingPackageVersion !== '0.22.1') {
665
+ throw new Error(`WASI binding package version mismatch, expected 0.22.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
653
666
  }
654
667
  }
655
668
  wasiBinding = require('@nomicfoundation/edr-wasm32-wasi')
656
669
  nativeBinding = wasiBinding
670
+ __napiLoadedBindingTarget = 'wasm32-wasi'
657
671
  wasiBindingLoaded = true
658
672
  }
659
673
  } catch (err) {
@@ -699,6 +713,70 @@ if (!nativeBinding) {
699
713
  throw new Error(`Failed to load native binding`)
700
714
  }
701
715
 
716
+ function __napiStampBindingTarget(exportsObject, target) {
717
+ if (
718
+ Object.prototype.hasOwnProperty.call(exportsObject, '__napiBindingTarget')
719
+ ) {
720
+ if (exportsObject.__napiBindingTarget === target) {
721
+ // Already ours: the root entry aliases the object it loaded, so a WASI
722
+ // fallback candidate — or a `NAPI_RS_NATIVE_LIBRARY_PATH` override that
723
+ // is a generated loader — arrives already stamped with this same value.
724
+ return target
725
+ }
726
+ const error = new Error(
727
+ '`__napiBindingTarget` is reserved by the generated binding loader, but the loaded binding already exports it. Rename the export, e.g. #[napi(js_name = "...")].',
728
+ )
729
+ error.code = 'ERR_NAPI_BINDING_TARGET_CONFLICT'
730
+ throw error
731
+ }
732
+ if (!Object.isExtensible(exportsObject)) {
733
+ // A `#[napi(module_exports)]` hook may seal or freeze this object
734
+ // (`Object::seal` / `Object::freeze`). Reporting the artifact is metadata,
735
+ // never a reason to fail an otherwise successful load, so the stamp is
736
+ // skipped. What a consumer still sees then follows the entry point: the
737
+ // browser and deferred loaders declare `__napiBindingTarget` at module
738
+ // level and go on reporting it, while the CommonJS entries hand back this
739
+ // very object as `module.exports`, so there the value is absent.
740
+ return target
741
+ }
742
+ try {
743
+ // [[Define]], not [[Set]]: an ordinary assignment walks the prototype
744
+ // chain, so an inherited accessor could swallow the value or throw and
745
+ // fail an otherwise successful load. The descriptor is what a successful
746
+ // assignment would have produced.
747
+ Object.defineProperty(exportsObject, '__napiBindingTarget', {
748
+ configurable: true,
749
+ enumerable: true,
750
+ value: target,
751
+ writable: true,
752
+ })
753
+ } catch {
754
+ // Same rule as the non-extensible skip above: reporting the artifact is
755
+ // metadata, never a reason to fail an otherwise successful load. An exotic
756
+ // object (a Proxy whose defineProperty trap refuses) is skipped, not
757
+ // thrown over.
758
+ }
759
+ // The CommonJS loaders assign this return value so `cjs-module-lexer` — and
760
+ // therefore Node's CJS -> ESM named export detection — can see
761
+ // `__napiBindingTarget` statically.
762
+ return target
763
+ }
764
+ // Stamp before the alias, not after. The guard only reads `nativeBinding`
765
+ // (`hasOwnProperty` plus a comparison), which is safe against any addon
766
+ // accessor; an assignment is not, because a `#[napi(module_exports)]` hook can
767
+ // expose a getter reporting this very value and a setter that throws. So the
768
+ // assignment lands on the loader's own `module.exports`, still the original
769
+ // object here, and the alias below replaces it.
770
+ //
771
+ // The assignment is what keeps the marker a statically visible CommonJS export:
772
+ // `cjs-module-lexer` is Node's CJS -> ESM named export detection, it cannot see
773
+ // a bare call, and the later `module.exports = nativeBinding` does not undo the
774
+ // detection. The assignment itself always succeeds — its target is this
775
+ // loader's own, still extensible `module.exports` — and the alias below then
776
+ // discards the value it wrote. What a consumer reads is whatever the guard put
777
+ // on `nativeBinding`, so on a frozen binding, where the guard skips, the
778
+ // linked import resolves to `undefined`.
779
+ module.exports.__napiBindingTarget = __napiStampBindingTarget(nativeBinding, __napiLoadedBindingTarget)
702
780
  module.exports = nativeBinding
703
781
  module.exports.BytecodeWrapper = nativeBinding.BytecodeWrapper
704
782
  module.exports.ContractDecoder = nativeBinding.ContractDecoder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nomicfoundation/edr",
3
- "version": "0.21.0",
3
+ "version": "0.22.1",
4
4
  "devDependencies": {
5
5
  "@napi-rs/cli": "^3.7.0",
6
6
  "@nomicfoundation/ethereumjs-util": "^9.0.4",
@@ -9,8 +9,8 @@
9
9
  "@types/chai-as-promised": "^7.1.8",
10
10
  "@types/mocha": ">=9.1.0",
11
11
  "@types/node": "^22.0.0",
12
- "@typescript-eslint/eslint-plugin": "8.69.0",
13
- "@typescript-eslint/parser": "8.69.0",
12
+ "@typescript-eslint/eslint-plugin": "8.70.0",
13
+ "@typescript-eslint/parser": "8.70.0",
14
14
  "chai": "^4.3.6",
15
15
  "chai-as-promised": "^7.1.1",
16
16
  "chalk": "^2.4.2",
@@ -59,13 +59,13 @@
59
59
  },
60
60
  "types": "index.d.ts",
61
61
  "optionalDependencies": {
62
- "@nomicfoundation/edr-darwin-arm64": "0.21.0",
63
- "@nomicfoundation/edr-darwin-x64": "0.21.0",
64
- "@nomicfoundation/edr-linux-arm64-gnu": "0.21.0",
65
- "@nomicfoundation/edr-linux-arm64-musl": "0.21.0",
66
- "@nomicfoundation/edr-linux-x64-gnu": "0.21.0",
67
- "@nomicfoundation/edr-linux-x64-musl": "0.21.0",
68
- "@nomicfoundation/edr-win32-x64-msvc": "0.21.0"
62
+ "@nomicfoundation/edr-darwin-arm64": "0.22.1",
63
+ "@nomicfoundation/edr-darwin-x64": "0.22.1",
64
+ "@nomicfoundation/edr-linux-arm64-gnu": "0.22.1",
65
+ "@nomicfoundation/edr-linux-arm64-musl": "0.22.1",
66
+ "@nomicfoundation/edr-linux-x64-gnu": "0.22.1",
67
+ "@nomicfoundation/edr-linux-x64-musl": "0.22.1",
68
+ "@nomicfoundation/edr-win32-x64-msvc": "0.22.1"
69
69
  },
70
70
  "scripts": {
71
71
  "artifacts": "napi artifacts",