{"_id":"bundle-runner","_rev":"2-be7483cc239f65827dbc9c0977b3d0f7","name":"bundle-runner","dist-tags":{"latest":"0.0.1"},"versions":{"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":{"integrity":"sha512-5DSoNvUsmZQ447GGzwZUBfnO6bFgD5EVNO1dqB2PZQskBGx4Jf/LZ/v5ov/uTGJrqwRsgZjeYDxD26staRezww==","shasum":"83dd28736dab80005d52e3f7040ac31ce52f3bff","tarball":"https://registry.npmjs.org/bundle-runner/-/bundle-runner-0.0.0.tgz","fileCount":10,"unpackedSize":15938,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJepvv6CRA9TVsSAnZWagAA+X4P/jtlCK27MCzRmemjACxi\n3LYG8VFEaiYc0JNxLNo0lCTMTR51em5uhtUZD2piLTRq42p+L8omPF83QYN2\nnZHxjfurJmPkLEnUXjDymhv8EfpA6ALBHyZy+fryPHKCrsK9uYqn8nabwNQs\nmyX8JLgTeuAaM/jbdC7EpQd7z4g6tChvspP5EKOTFffNBJDaVVOTNCXVII3O\ncGGXbRcbpt7sDwnGNNKCS7eyzg+94U5xOeakwvFtABdTplkr4yPFxPIDuW6x\nWyEP75d5cZsPR9M1/VQWiRKcBeVVEL0nb59cc3u6X/KJw3MmvKmTBKKjzhJi\n5VVzC/fWuWnBr4tzcyFDGT7ZELsPhgK7DwoRuqN9/EOcJ4a552FHgcA20yWY\nCDJSeasBH4s2+wbmhbYC/NE7Bx9qcghxncgQQbQd4s/whoyUgDlxw/vdQdMO\nAL1YfM7pz3J6/Mr7HPshLj4lUDoydd7RtfKjp/dooVvqnawdJj3ppHcTZRpN\nlszDWmRv/a9xlcuz7PkTgoeUwj/cVGOYfnPkGozTksidCh6yxlx+LsBiRZhx\nKZY3TlZ9pZeuebFxqrIJS8+eMsASoSFRLq/Yr8bAZz/KyiZIb9DayLLVrz1g\nvBNw+r2ZMIDzQHjbtaB9+gu2WVVVpSXALH2EZaa6+Bgttp3KCPqCSyq6O1IG\nPmUA\r\n=avjh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDqmPLgUkk7VnEG6jlH/OSiqJudvm44PlSNtjOpZNr3uAiAv1S+LQdVR7WLzzuA4yCOp1rlfFCPdfjmgV4OD0CsPOA=="}]},"maintainers":[{"name":"pi0","email":"pyapar@gmail.com"}],"_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},"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":{"integrity":"sha512-xevhXw77nJ7wjCRTyo1JYumUNUiZmD0CJEummyLUJbdhub4bZWuplS+Y7nlMq5V9sKJQW+dV/LZR/SlxS5f4LQ==","shasum":"d05ff2e3921e2ea3ec810d6b327eeb466ff4483b","tarball":"https://registry.npmjs.org/bundle-runner/-/bundle-runner-0.0.1.tgz","fileCount":12,"unpackedSize":22078,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJepxYXCRA9TVsSAnZWagAACdMP/11W8jhgozqR9K5ABboJ\n8+L/7VLzR+94usx0veTEzomaZXRvDA2r/QNhZBCyZY1ln7YOskXTewqFnLu3\nmu7kpjHpyY+FUob0zRdLlruSd3LQU56E3Zo5MQe5y32lg4klqdboVGzdE90/\nrAqrfKOULrHImtPXsWrDkZNdOonsu92QWP6veYuGB5oN8PGscLzLUBYcHM/T\nZZxAdPT4ZtbjhgdRxutBvqxA3KfiIkauRABgLt3QygQ1ZsiYIjaP2MH7/iJo\nAjz0qiatHC0E1AMM3qRxHE1HlgYipWZmMC8UYxFSBKiJsFB32iIUflGpFjJT\nCBBV/DIaKL1BUHfWef7OOEu1WfoptGLE/6RK7joMvQnQxZb1Oq3glkuoDZQj\nit55lBKXaOnQgrVZJgpT5vjRHP/h2ontQ7LLZ6phcmwKuLkxOp3jsoGxFEW+\nICMo5Q+VMcc1Xo9rjPcBYWBaFlj8/4xlvvsXnjkXWRNC1xSBkXMvSH51Wv1K\nT9UldRe9DN5VUWCVL7g1aYreYVb5y+X7nk732WOsw58ZrP1I2MmJGvEsklr5\nZyqQrhoRc38IJO3e6RXlWiWLJdXfhr1pqztgrzHg+kI/rMagqHBU+k/xe0hU\nJfbEWlb6AXWHunXviKkm69xdt6ieys5wmz+QGx4/ZyYPEth0JQ5xVAGbE0QE\nBMAv\r\n=jYU2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA4aRB9CUEZvM/DP3FLU8CcWQGnc71otDb+dNN3f2J3DAiB9lgYrfWW4BjXyY/Q87LacBf4Qpb6MSZNZqm1jONI8fQ=="}]},"maintainers":[{"name":"pi0","email":"pyapar@gmail.com"}],"_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}},"time":{"created":"2020-04-27T15:36:26.276Z","0.0.0":"2020-04-27T15:36:26.408Z","modified":"2022-04-12T04:45:31.747Z","0.0.1":"2020-04-27T17:27:51.063Z"},"maintainers":[{"name":"pi0","email":"pyapar@gmail.com"}],"description":"run webpack bundles in Node.js with optional VM sandboxing","homepage":"https://github.com/nuxt-contrib/bundle-runner#readme","repository":{"type":"git","url":"git+https://github.com/nuxt-contrib/bundle-runner.git"},"bugs":{"url":"https://github.com/nuxt-contrib/bundle-runner/issues"},"license":"MIT","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","readmeFilename":"README.md"}