# commonjs-editor

> Edit and execute top-level files of CommonJS modules in browsers

Latest version **0.0.7** (published 2017-10-07) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install commonjs-editor
pnpm add commonjs-editor
yarn add commonjs-editor
bun add commonjs-editor
```

Provides the command `commonjs-editor`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2017-10-07 |
| First published | 2017-09-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Laurent Christophe |
| Maintainers | lachrist |
| Keywords | CommonJS, Editor, Ace, Cloud9 |

## Links

- npm: https://www.npmjs.com/package/commonjs-editor
- Repository: https://github.com/lachrist/commonjs-editor
- Homepage: https://github.com/lachrist/commonjs-editor#readme
- Issues: https://github.com/lachrist/commonjs-editor/issues
- npm.io page: https://npm.io/package/commonjs-editor

## Dependencies (3)

- [brace](https://npm.io/package/brace.md) 0.10.0
- [resolve](https://npm.io/package/resolve.md) 1.4.0
- [browserify](https://npm.io/package/browserify.md) 14.4.0

## Alternatives

- [ext-list](https://npm.io/package/ext-list.md) — 6.3M weekly downloads
- [@lexical/selection](https://npm.io/package/@lexical/selection.md) — 3.8M weekly downloads
- [@lexical/text](https://npm.io/package/@lexical/text.md) — 3.6M weekly downloads
- [@lexical/clipboard](https://npm.io/package/@lexical/clipboard.md) — 3.0M weekly downloads
- [@tiptap/extension-mention](https://npm.io/package/@tiptap/extension-mention.md) — 3.0M weekly downloads

## Recent versions

- 0.0.7 (latest) — 2017-10-07
- 0.0.6 — 2017-10-07
- 0.0.5 — 2017-10-07
- 0.0.4 — 2017-10-07
- 0.0.1 — 2017-10-05
- 0.0.0 — 2017-09-26

## README

# commonjs-editor

Edit and execute top-level files of CommonJS modules in browsers.
Usage [here](demo/), live demo [here](https://cdn.rawgit.com/lachrist/commonjs-editor/069b24dc/demo/index.html).
CommonjsEditor is powered by [browserify](http://browserify.org) and [c9.ace.io](https://ace.c9.io).
Node-inspired variables accessible inside the editor:
* `global`: the global object.
* `require`: for importing CommonJS modules.
* `module`: for redefining the entire export.
* `exports`: for exporting a particular field.
* `__filename`: relative to `options.basedir`.
* `__dirname`: relative to `options.basedir`.
* `process`: if defined: `process.argv[1] = __filename`.
* `Buffer`: only available when `Buffer` or `require("buffer")` is present.

## `Playground`

### `playground.path :: string`

* `playground :: commonjs-editor.Playground`

### `playground.modules :: [string]`

* `playground :: commonjs-editor.Playground`

### `playground.initial :: string`

* `playground :: commonjs-editor.Playground`

### `playground.require :: string`

* `playground :: commonjs-editor.Playground`

## `require("commonjs-editor/playground")(path, options, callback)`

* `path :: string`
* `options :: browserify.Options`
* `callback(error, playground)`
  * `error :: Error`
  * `playground :: commonjs-editor.Playground`

## `editor = require("commonjs-editor")(container, playground)`

* `container :: dom.Element`
* `playground :: commonjs-editor.Playground`
* `editor :: c9.ace.io.Editor`
  * `bundle = getBundle()`

---
_Source: https://npm.io/package/commonjs-editor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
