# ses-cjs

> A CommonJS-compatible wrapper for SES (Secure ECMAScript), providing safe access to `Compartment`, `lockdown`, and `harden` while preserving native test assertions.

This package wraps `ses@0.13.1` and works in both **Node 16+** and **browser environments (via bundlers like Webpack)**. It safely loads SES globals *once* and avoids polluting the global `assert` used by test frameworks.

---

## 🚀 Install

```bash
npm install ses-cjs
````

---

## 🔧 Usage

```js
const getSES = require('ses-cjs')

;(async () => {
  const {
    Compartment,
    lockdown,
    silentLockdown,
    harden,
    assert,     // native assert (preserved)
    sesAssert,  // SES's hardened assert
  } = await getSES()

  silentLockdown()

  const c = new Compartment()
  console.log(c.evaluate('1 + 2')) // 3
})()
```

---

## 🔒 Features

* ✅ Lazy-loads SES only once
* ✅ Preserves global `assert` for testing frameworks
* ✅ Exposes `silentLockdown()` to suppress noisy console logs
* ✅ Safe for Node & browser use
* ✅ Based on `ses@0.13.1` (last version compatible with Node 16)

---

## 📄 License

MIT
