# @skypager/features-browser-vm

> a vm for running scripts in a jsdom context

Latest version **1.1.1** (published 2019-05-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @skypager/features-browser-vm
pnpm add @skypager/features-browser-vm
yarn add @skypager/features-browser-vm
bun add @skypager/features-browser-vm
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-05-24 |
| First published | 2019-02-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 29.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jon Soeder |
| Maintainers | soederpop |

## Links

- npm: https://www.npmjs.com/package/@skypager/features-browser-vm
- Homepage: https://skypager.io
- npm.io page: https://npm.io/package/@skypager/features-browser-vm

## Dependencies (1)

- [jsdom](https://npm.io/package/jsdom.md) ^13.2.0

## Recent versions

- 1.1.1 (latest) — 2019-05-24
- 1.0.1-alpha.1 (next) — 2019-05-15
- 0.3.2 (beta) — 2019-02-14
- 1.1.0 — 2019-05-24
- 1.0.1 — 2019-05-17
- 1.0.1-alpha.0 — 2019-05-15
- 0.4.0 — 2019-03-26
- 0.3.6 — 2019-03-13
- 0.3.3 — 2019-02-23
- 0.3.1 — 2019-02-14
- 0.3.0 — 2019-02-10
- 0.2.8 — 2019-02-10
- 0.2.7 — 2019-02-08
- 0.2.6 — 2019-02-08
- 0.2.4 — 2019-02-08
- … 1 more at https://npm.io/package/@skypager/features-browser-vm/versions

## README

# Browser VM

This feature makes it easy to take a chunk of javascript code as a string,
and run it as if it were inside of a browser using JSDOM.  You will get back the 
code, the result of the code, and the global context variable in a state after the script ran. 

```javascript
import runtime from '@skypager/node'
import '@skypager/features-browser-vm'

const browserVm = runtime.feature('browser-vm')

async function main() {
  const webpackBundledApp = await runtime.fsx.readFileAsync(runtime.resolve('build', 'app.js'))
  const { result, context } = await browserVm.runScript(webpackBundledApp)
  const { App } = context

  console.log('App Component', App)
}

main()
```

---
_Source: https://npm.io/package/@skypager/features-browser-vm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
