Skip to content

Commit ef0faf1

Browse files
committed
add module description in readme
1 parent ca90413 commit ef0faf1

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,31 @@ TypeScript Development Kit for ZeroLedger Protocol - A comprehensive cryptograph
2525
npm install @zeroledger/vycrypt
2626
```
2727

28+
## Module Formats
29+
30+
This library supports both **CommonJS** and **ES Modules** formats for maximum compatibility:
31+
32+
- **CommonJS**: For Node.js environments and bundlers that prefer CommonJS
33+
- **ES Modules**: For modern bundlers and environments that support ES modules
34+
35+
The library automatically provides the appropriate format based on your import method:
36+
37+
```typescript
38+
// ES Modules (recommended for modern projects)
39+
import { encrypt, decrypt } from "@zeroledger/vycrypt";
40+
41+
// CommonJS (for legacy Node.js or specific bundler requirements)
42+
const { encrypt, decrypt } = require("@zeroledger/vycrypt");
43+
```
44+
45+
### Build Output
46+
47+
The library builds to two directories:
48+
- `cjs/` - CommonJS format with `.js` files
49+
- `esm/` - ES Modules format with `.js` files and `package.json`
50+
51+
Both formats include TypeScript declaration files (`.d.ts`) for full type support.
52+
2853
## API Reference
2954

3055
### Encryption & Decryption
@@ -247,6 +272,25 @@ npm install
247272
npm test
248273
```
249274

275+
### Building
276+
277+
To build both CommonJS and ES Module versions:
278+
279+
```bash
280+
npm run build
281+
```
282+
283+
This creates:
284+
- `cjs/` directory with CommonJS files
285+
- `esm/` directory with ES Module files
286+
- TypeScript declaration files (`.d.ts`) for both formats
287+
288+
### Type Checking
289+
290+
```bash
291+
npm run typecheck
292+
```
293+
250294
## License
251295

252296
SEE LICENSE IN LICENSE

0 commit comments

Comments
 (0)