{"_id":"bundle-runner","_rev":"2887385","name":"bundle-runner","description":"run webpack bundles in Node.js with optional VM sandboxing","dist-tags":{"latest":"0.0.1"},"maintainers":[{"name":"npm:pi0","email":""},{"name":"pi0","email":"pooya@pi0.ir"}],"time":{"modified":"2022-11-04T06:14:02.000Z","created":"2020-04-27T15:36:26.408Z","0.0.1":"2020-04-27T17:27:51.063Z","0.0.0":"2020-04-27T15:36:26.408Z"},"users":{},"repository":{"type":"git","url":"git+https://github.com/nuxt-contrib/bundle-runner.git"},"versions":{"0.0.1":{"name":"bundle-runner","version":"0.0.1","description":"run webpack bundles in Node.js with optional VM sandboxing","repository":{"type":"git","url":"git+https://github.com/nuxt-contrib/bundle-runner.git"},"license":"MIT","main":"./dist/bundle-runner.cjs.js","module":"./dist/bundle-runner.esm.js","types":"./types/index.d.ts","scripts":{"build":"yarn clean && rollup -c && yarn types","clean":"rm -rf ./dist ./types","lint":"eslint --ext .ts src","release":"yarn test && yarn build && standard-version && git push --follow-tags && npm publish","test":"yarn lint && yarn jest","types":"tsc --declarationDir types --declaration --emitDeclarationOnly"},"dependencies":{"source-map":"^0.7.3"},"devDependencies":{"@nuxtjs/eslint-config-typescript":"latest","@rollup/plugin-typescript":"latest","@types/jest":"latest","babel-jest":"latest","eslint":"latest","jest":"latest","rollup":"latest","rollup-plugin-babel":"latest","rollup-plugin-node-resolve":"latest","standard-version":"latest","ts-jest":"latest","tsdoc":"latest","typescript":"latest"},"gitHead":"a7cbe8980ea17abd9426acb10deb517c514dede7","bugs":{"url":"https://github.com/nuxt-contrib/bundle-runner/issues"},"homepage":"https://github.com/nuxt-contrib/bundle-runner#readme","_id":"bundle-runner@0.0.1","_nodeVersion":"12.16.2","_npmVersion":"6.14.4","dist":{"shasum":"d05ff2e3921e2ea3ec810d6b327eeb466ff4483b","size":5437,"noattachment":false,"key":"/bundle-runner/-/bundle-runner-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/bundle-runner/download/bundle-runner-0.0.1.tgz"},"maintainers":[{"name":"npm:pi0","email":""},{"name":"pi0","email":"pooya@pi0.ir"}],"_npmUser":{"name":"pi0","email":"pyapar@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bundle-runner_0.0.1_1588008470885_0.5615640440089742"},"_hasShrinkwrap":false,"publish_time":1588008471063,"_cnpm_publish_time":1588008471063,"_cnpmcore_publish_time":"2021-12-17T10:26:19.426Z"},"0.0.0":{"name":"bundle-runner","version":"0.0.0","description":"[![npm version][npm-version-src]][npm-version-href] [![npm downloads][npm-downloads-src]][npm-downloads-href] [![packagephobia][packagephobia-src]][packagephobia-href] [![Github Actions][github-actions-src]][github-actions-href] [![Codecov][codecov-src]][","repository":{"type":"git","url":"git+https://github.com/nuxt-contrib/bundle-runner.git"},"license":"MIT","main":"./dist/bundle-runner.cjs.js","module":"./dist/bundle-runner.esm.js","types":"./types/index.d.ts","scripts":{"build":"yarn clean && rollup -c && yarn types","clean":"rm -rf ./dist ./types","lint":"eslint --ext .ts src","release":"yarn test && yarn build && standard-version && git push --follow-tags && npm publish","test":"yarn lint && yarn jest","types":"tsc --declarationDir types --declaration --emitDeclarationOnly"},"devDependencies":{"@nuxtjs/eslint-config-typescript":"latest","@rollup/plugin-typescript":"latest","@types/jest":"latest","babel-jest":"latest","eslint":"latest","jest":"latest","rollup":"latest","rollup-plugin-babel":"latest","rollup-plugin-node-resolve":"latest","standard-version":"latest","ts-jest":"latest","tsdoc":"latest","typescript":"latest"},"gitHead":"35b745f6c64f24a3f00993b9e7d9b3619ac73392","bugs":{"url":"https://github.com/nuxt-contrib/bundle-runner/issues"},"homepage":"https://github.com/nuxt-contrib/bundle-runner#readme","_id":"bundle-runner@0.0.0","_nodeVersion":"12.16.2","_npmVersion":"6.14.4","dist":{"shasum":"83dd28736dab80005d52e3f7040ac31ce52f3bff","size":3947,"noattachment":false,"key":"/bundle-runner/-/bundle-runner-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/bundle-runner/download/bundle-runner-0.0.0.tgz"},"maintainers":[{"name":"npm:pi0","email":""},{"name":"pi0","email":"pooya@pi0.ir"}],"_npmUser":{"name":"pi0","email":"pyapar@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bundle-runner_0.0.0_1588001786276_0.0689141968647724"},"_hasShrinkwrap":false,"publish_time":1588001786408,"_cnpm_publish_time":1588001786408,"_cnpmcore_publish_time":"2021-12-17T10:26:19.650Z"}},"readme":"# Bundle Runner\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![Github Actions][github-actions-src]][github-actions-href]\n[![Codecov][codecov-src]][codecov-href]\n[![Dependencies][david-dm-src]][david-dm-href]\n\nThis package allows running a Webpack bundle in Node.js with optional sandboxed context. Useful for development, loading bundle from memory (HMR) and a consistent way of loading bundle between development and production environments.\n\n**✅ What sandboxing is for:**\n\n- Optional sandboxing using Node.js [VM](https://nodejs.org/api/vm.html)\n- Mitigate script evaluation side-effects to global object\n- Avoid unwanted shared state\n- Avoid memory leaks during HMR\n\n**❌ What sandboxing is not for:**\n\n- Fully avoid side effects of evaluation\n- A secure sandbox to run untrusted code\n- High performance\n\n## Install\n\n```sh\nyarn add bundle-runner\n\nnpm install bundle-runner\n```\n\n## Usage\n\n```ts\nimport { createBundle } from 'bundle-runner'\n\nconst { evaluateEntry } = createBundle('path/to/bundle.json')\n\nconst entry = evaluateEntry(context)\n```\n\n**`createBundle`**\n\n```ts\nfunction createBundle(bundle: Partial<Bundle> | string, options?: CreateBundleOptions): {\n    bundle: Bundle;\n    evaluateEntry: (context: object) => any;\n    evaluateModule: (filename: string, context: object) => any;\n    rewriteErrorTrace: (err: Error) => Promise<Error>;\n}\n```\n\n**`CreateBundleOptions`**\n\n```ts\ntype CreateBundleOptions = {\n    basedir?: string;\n    runInNewContext?: 'once' | boolean;\n    runningScriptOptions?: VM.RunningScriptOptions;\n}\n```\n\n### Bundle Format\n\nInput can be string (path to a `.js` file or `.json` file with bundle format) or directly bundle object with type of:\n\n```ts\ntype Bundle = {\n    basedir: string;\n    entry: string;\n    files: {\n        [filename: string]: string\n    };\n    maps: {\n        [filename: string]: string\n    };\n}\n```\n\n### SourceMap Support\n\nAfter creating bundle, a `rewriteErrorTrace` utility is exposed which you can use to rewrite traces:\n\n```ts\nconst { evaluateEntry, rewriteErrorTrace } = createBundle('path/to/bundle.json')\n\ntry {\n  const entry = evaluateEntry(context)\n  const app = await entry({})\n} catch (err) {\n  await rewriteErrorTrace(err)\n  throw err\n}\n```\n\n## Credits\n\nInspired by [vue-server-renderer](https://www.npmjs.com/package/vue-server-renderer) made by [Evan You](https://github.com/yyx990803).\n\n## License\n\nMIT\n\n<!-- Badges -->\n[npm-version-src]: https://img.shields.io/npm/v/bundle-runner?style=flat-square\n[npm-version-href]: https://npmjs.com/package/bundle-runner\n\n[npm-downloads-src]: https://img.shields.io/npm/dm/bundle-runner?style=flat-square\n[npm-downloads-href]: https://npmjs.com/package/bundle-runner\n\n[github-actions-src]: https://img.shields.io/github/workflow/status/nuxt-contrib/bundle-runner/test/master?style=flat-square\n[github-actions-href]: https://github.com/nuxt-contrib/bundle-runner/actions?query=workflow%3Atest\n\n[codecov-src]: https://img.shields.io/codecov/c/gh/nuxt-contrib/bundle-runner/master?style=flat-square\n[codecov-href]: https://codecov.io/gh/nuxt-contrib/bundle-runner\n\n[david-dm-src]: https://img.shields.io/david/nuxt-contrib/bundle-runner?style=flat-square\n[david-dm-href]: https://david-dm.org/nuxt-contrib/bundle-runner\n","_attachments":{},"homepage":"https://github.com/nuxt-contrib/bundle-runner#readme","bugs":{"url":"https://github.com/nuxt-contrib/bundle-runner/issues"},"license":"MIT"}