@oceanprotocol/lib 9.0.0-next.1 → 9.0.0-next.11

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/README.md CHANGED
@@ -57,12 +57,34 @@ npm install @oceanprotocol/lib
57
57
  - Developers using this library should ensure their tsconfig.json includes the necessary options:
58
58
  ```
59
59
  {
60
- "moduleResolution": "node",
60
+ "moduleResolution": "bundler",
61
+ "module": "esnext",
61
62
  "esModuleInterop": true,
62
63
  "allowSyntheticDefaultImports": true
63
64
  }
64
65
  ```
65
- - If using Next.js, they may need "moduleResolution": "bundler" for better compatibility.
66
+ - `"moduleResolution": "nodenext"` works too. The older `"node"` (node10) mode was removed in
67
+ TypeScript 7, so don't use it — and it cannot resolve this package's `exports` map anyway.
68
+
69
+ ### ESM only
70
+
71
+ `@oceanprotocol/lib` ships as ES modules only — there is no CommonJS build, because most of
72
+ its runtime dependencies (the libp2p stack, `multiformats`, `uint8arrays`) are themselves
73
+ ESM-only. Import it:
74
+
75
+ ```js
76
+ import { ProviderInstance, ConfigHelper } from '@oceanprotocol/lib'
77
+ ```
78
+
79
+ From CommonJS code, use Node's built-in `require(esm)` support, available from **Node
80
+ 22.12**:
81
+
82
+ ```js
83
+ const { ConfigHelper } = require('@oceanprotocol/lib')
84
+ ```
85
+
86
+ On Node 22.0–22.11 this throws `ERR_REQUIRE_ESM`; use a dynamic `await import(...)`
87
+ instead, or move the calling module to ESM.
66
88
 
67
89
  ## 📖 Documentation
68
90