{"_id":"realms-shim","_rev":"108543","name":"realms-shim","description":"Spec-compliant shim for Realms TC39 Proposal","dist-tags":{"latest":"1.2.2"},"maintainers":[{"name":"erights","email":"erights@gmail.com"},{"name":"katesills","email":"kate@agoric.com"},{"name":"michaelfig","email":"michael@fig.org"},{"name":"warner","email":"warner-npm@lothar.com"}],"time":{"modified":"2021-06-03T10:40:12.000Z","created":"2019-09-19T02:38:39.266Z","1.2.2":"2020-02-12T23:08:28.701Z","1.2.1":"2019-10-16T19:04:42.439Z","1.2.0":"2019-10-02T19:10:00.137Z","1.1.2":"2019-09-26T01:36:13.314Z","1.1.1":"2019-09-24T20:01:12.213Z","1.1.0":"2019-09-19T02:38:39.266Z"},"users":{},"author":{"name":"TC39 Open Source Contributors"},"repository":{"type":"git","url":"git+https://github.com/Agoric/realms-shim.git"},"versions":{"1.2.2":{"name":"realms-shim","version":"1.2.2","description":"Spec-compliant shim for Realms TC39 Proposal","main":"dist/realms-shim.cjs.js","module":"dist/realms-shim.esm.js","browser":"dist/realms-shim.umd.js","license":"Apache-2.0","author":{"name":"TC39 Open Source Contributors"},"keywords":["realms","ES8","ES2017","ECMAScript","ESNext","proposal"],"homepage":"https://github.com/Agoric/realms-shim#readme","bugs":{"url":"https://github.com/Agoric/realms-shim/issues"},"repository":{"type":"git","url":"git+https://github.com/Agoric/realms-shim.git"},"scripts":{"test":"npm run shim:test","build":"npm run shim:build","shim:lint":"eslint ./src ./test ./examples","shim:prettier":"prettier --config ./.prettierrc --write ./src/**/**/*.js ./test/**/**/*.js ./examples/**/**/*.js","shim:test":"tape -r esm './test/**/*.js'","shim:test-integration":"tape -r esm './test-integration/**/*.js'","shim:coverage":"nyc tape -r esm ./test/**/**/*.js","shim:coveralls":"nyc report --reporter=text-lcov | coveralls","shim:build":"npm run shim:build:dev && npm run shim:build:prod","shim:watch":"npm run shim:build:dev --watch","shim:build:dev":"rollup -c","shim:build:prod":"rollup -c --environment NODE_ENV:production"},"devDependencies":{"coveralls":"^3.0.6","eslint":"^6.4.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.3.0","eslint-plugin-import":"^2.18.2","eslint-plugin-prettier":"^3.1.1","esm":"^3.2.25","mixed-tape":"^1.0.2","nyc":"^14.1.1","prettier":"^1.18.2","rollup":"^1.21.4","rollup-plugin-babel-minify":"^9.1.0","sinon":"^7.5.0","tape":"^4.11.0"},"gitHead":"bb0cc3ca69c07e5511565966229545ea67d461a8","_id":"realms-shim@1.2.2","_nodeVersion":"13.4.0","_npmVersion":"6.13.4","dist":{"shasum":"bdf828ee316afa4c9ea2aab364d55b8ad7eb5904","size":185999,"noattachment":false,"key":"/realms-shim/-/realms-shim-1.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/realms-shim/download/realms-shim-1.2.2.tgz"},"maintainers":[{"name":"erights","email":"erights@gmail.com"},{"name":"katesills","email":"kate@agoric.com"},{"name":"michaelfig","email":"michael@fig.org"},{"name":"warner","email":"warner-npm@lothar.com"}],"_npmUser":{"name":"warner","email":"warner-npm@lothar.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/realms-shim_1.2.2_1581548908505_0.27817003001643603"},"_hasShrinkwrap":false,"publish_time":1581548908701,"_cnpm_publish_time":1581548908701},"1.2.1":{"name":"realms-shim","version":"1.2.1","description":"Spec-compliant shim for Realms TC39 Proposal","main":"dist/realms-shim.cjs.js","module":"dist/realms-shim.esm.js","browser":"dist/realms-shim.umd.js","license":"Apache-2.0","author":{"name":"TC39 Open Source Contributors"},"keywords":["realms","ES8","ES2017","ECMAScript","ESNext","proposal"],"homepage":"https://github.com/Agoric/realms-shim#readme","bugs":{"url":"https://github.com/Agoric/realms-shim/issues"},"repository":{"type":"git","url":"git+https://github.com/Agoric/realms-shim.git"},"scripts":{"test":"npm run shim:test","build":"npm run shim:build","shim:lint":"eslint ./src ./test ./examples","shim:prettier":"prettier --config ./.prettierrc --write ./src/**/**/*.js ./test/**/**/*.js ./examples/**/**/*.js","shim:test":"tape -r esm './test/**/*.js'","shim:test-integration":"tape -r esm './test-integration/**/*.js'","shim:coverage":"nyc tape -r esm ./test/**/**/*.js","shim:coveralls":"nyc report --reporter=text-lcov | coveralls","shim:build":"npm run shim:build:dev && npm run shim:build:prod","shim:watch":"npm run shim:build:dev --watch","shim:build:dev":"rollup -c","shim:build:prod":"rollup -c --environment NODE_ENV:production"},"devDependencies":{"coveralls":"^3.0.6","eslint":"^6.4.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.3.0","eslint-plugin-import":"^2.18.2","eslint-plugin-prettier":"^3.1.1","esm":"^3.2.25","mixed-tape":"^1.0.2","nyc":"^14.1.1","prettier":"^1.18.2","rollup":"^1.21.4","rollup-plugin-babel-minify":"^9.1.0","sinon":"^7.5.0","tape":"^4.11.0"},"gitHead":"7c4d47c9097ba189d3320057ccdf7d4383899014","_id":"realms-shim@1.2.1","_nodeVersion":"12.7.0","_npmVersion":"6.10.0","dist":{"shasum":"7d6afb2ad4007296b527a0b731fefd7b6620652d","size":185313,"noattachment":false,"key":"/realms-shim/-/realms-shim-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/realms-shim/download/realms-shim-1.2.1.tgz"},"maintainers":[{"name":"erights","email":"erights@gmail.com"},{"name":"katesills","email":"kate@agoric.com"},{"name":"michaelfig","email":"michael@fig.org"},{"name":"warner","email":"warner-npm@lothar.com"}],"_npmUser":{"name":"warner","email":"warner-npm@lothar.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/realms-shim_1.2.1_1571252682263_0.12292270517338544"},"_hasShrinkwrap":false,"publish_time":1571252682439,"_cnpm_publish_time":1571252682439},"1.2.0":{"name":"realms-shim","version":"1.2.0","description":"Spec-compliant shim for Realms TC39 Proposal","main":"dist/realms-shim.cjs.js","module":"dist/realms-shim.esm.js","browser":"dist/realms-shim.umd.js","license":"Apache-2.0","author":{"name":"TC39 Open Source Contributors"},"keywords":["realms","ES8","ES2017","ECMAScript","ESNext","proposal"],"homepage":"https://github.com/Agoric/realms-shim#readme","bugs":{"url":"https://github.com/Agoric/realms-shim/issues"},"repository":{"type":"git","url":"git+https://github.com/Agoric/realms-shim.git"},"scripts":{"test":"npm run shim:test","build":"npm run shim:build","shim:lint":"eslint ./src ./test ./examples","shim:prettier":"prettier --config ./.prettierrc --write ./src/**/**/*.js ./test/**/**/*.js ./examples/**/**/*.js","shim:test":"tape -r esm './test/**/*.js'","shim:test-integration":"tape -r esm './test-integration/**/*.js'","shim:coverage":"nyc tape -r esm ./test/**/**/*.js","shim:coveralls":"nyc report --reporter=text-lcov | coveralls","shim:build":"npm run shim:build:dev && npm run shim:build:prod","shim:watch":"npm run shim:build:dev --watch","shim:build:dev":"rollup -c","shim:build:prod":"rollup -c --environment NODE_ENV:production"},"devDependencies":{"coveralls":"^3.0.6","eslint":"^6.4.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.3.0","eslint-plugin-import":"^2.18.2","eslint-plugin-prettier":"^3.1.1","esm":"^3.2.25","mixed-tape":"^1.0.2","nyc":"^14.1.1","prettier":"^1.18.2","rollup":"^1.21.4","rollup-plugin-babel-minify":"^9.1.0","sinon":"^7.5.0","tape":"^4.11.0"},"gitHead":"ec253317c6e78a039f823f573376c4c09552330a","_id":"realms-shim@1.2.0","_nodeVersion":"12.7.0","_npmVersion":"6.10.0","dist":{"shasum":"455b5ecac711f8907cdd1e7a2bc6cb173f3a3f09","size":186430,"noattachment":false,"key":"/realms-shim/-/realms-shim-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/realms-shim/download/realms-shim-1.2.0.tgz"},"maintainers":[{"name":"erights","email":"erights@gmail.com"},{"name":"katesills","email":"kate@agoric.com"},{"name":"michaelfig","email":"michael@fig.org"},{"name":"warner","email":"warner-npm@lothar.com"}],"_npmUser":{"name":"warner","email":"warner-npm@lothar.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/realms-shim_1.2.0_1570043399905_0.018199315330110766"},"_hasShrinkwrap":false,"publish_time":1570043400137,"_cnpm_publish_time":1570043400137},"1.1.2":{"name":"realms-shim","version":"1.1.2","description":"Spec-compliant shim for Realms TC39 Proposal","main":"dist/realms-shim.cjs.js","module":"dist/realms-shim.esm.js","browser":"dist/realms-shim.umd.js","license":"Apache-2.0","author":{"name":"TC39 Open Source Contributors"},"keywords":["realms","ES8","ES2017","ECMAScript","ESNext","proposal"],"homepage":"https://github.com/Agoric/realms-shim#readme","bugs":{"url":"https://github.com/Agoric/realms-shim/issues"},"repository":{"type":"git","url":"git+https://github.com/Agoric/realms-shim.git"},"scripts":{"test":"npm run shim:test","build":"npm run shim:build","shim:lint":"eslint ./src ./test ./examples","shim:prettier":"prettier --config ./.prettierrc --write ./src/**/**/*.js ./test/**/**/*.js ./examples/**/**/*.js","shim:test":"tape -r esm ./test/**/**/*.js","shim:coverage":"nyc tape -r esm ./test/**/**/*.js","shim:coveralls":"nyc report --reporter=text-lcov | coveralls","shim:build":"npm run shim:build:dev && npm run shim:build:prod","shim:watch":"npm run shim:build:dev --watch","shim:build:dev":"rollup -c","shim:build:prod":"rollup -c --environment NODE_ENV:production"},"devDependencies":{"coveralls":"^3.0.6","eslint":"^6.4.0","eslint-config-airbnb-base":"^14.0.0","eslint-config-prettier":"^6.3.0","eslint-plugin-import":"^2.18.2","eslint-plugin-prettier":"^3.1.1","esm":"^3.2.25","nyc":"^14.1.1","prettier":"^1.18.2","rollup":"^1.21.4","rollup-plugin-babel-minify":"^9.1.0","rollup-plugin-strip-code":"^0.2.7","sinon":"^7.5.0","tape":"^4.11.0"},"gitHead":"357beba0387c0ac2c4ae20ec524e9dbb56ca0000","_id":"realms-shim@1.1.2","_nodeVersion":"12.7.0","_npmVersion":"6.10.0","dist":{"shasum":"3a6f438e38a31e9189fbb22f83226e0ab064d237","size":173416,"noattachment":false,"key":"/realms-shim/-/realms-shim-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/realms-shim/download/realms-shim-1.1.2.tgz"},"maintainers":[{"name":"erights","email":"erights@gmail.com"},{"name":"katesills","email":"kate@agoric.com"},{"name":"michaelfig","email":"michael@fig.org"},{"name":"warner","email":"warner-npm@lothar.com"}],"_npmUser":{"name":"warner","email":"warner-npm@lothar.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/realms-shim_1.1.2_1569461773153_0.8129534763054149"},"_hasShrinkwrap":false,"publish_time":1569461773314,"_cnpm_publish_time":1569461773314},"1.1.1":{"name":"realms-shim","version":"1.1.1","description":"Spec-compliant shim for Realms TC39 Proposal","main":"dist/realms-shim.cjs.js","module":"dist/realms-shim.esm.js","browser":"dist/realms-shim.umd.js","license":"Apache-2.0","author":{"name":"TC39 Open Source Contributors"},"keywords":["realms","ES8","ES2017","ECMAScript","ESNext","proposal"],"homepage":"https://github.com/Agoric/realms-shim#readme","bugs":{"url":"https://github.com/Agoric/realms-shim/issues"},"repository":{"type":"git","url":"git+https://github.com/Agoric/realms-shim.git"},"scripts":{"test":"npm run shim:test","build":"npm run shim:build","shim:lint":"eslint ./src ./test ./examples","shim:prettier":"prettier --config ./.prettierrc --write ./src/**/**/*.js ./test/**/**/*.js ./examples/**/**/*.js","shim:test":"tape -r esm ./test/**/**/*.js","shim:coverage":"nyc tape -r esm ./test/**/**/*.js","shim:coveralls":"nyc report --reporter=text-lcov | coveralls","shim:build":"npm run shim:build:dev && npm run shim:build:prod","shim:watch":"npm run shim:build:dev --watch","shim:build:dev":"rollup -c","shim:build:prod":"rollup -c --environment NODE_ENV:production"},"devDependencies":{"coveralls":"^3.0.3","eslint":"^5.15.3","eslint-config-airbnb-base":"^13.1.0","eslint-config-prettier":"^4.1.0","eslint-plugin-import":"^2.16.0","eslint-plugin-prettier":"^3.0.1","esm":"^3.2.18","nyc":"^14.0.0","prettier":"^1.16.4","rollup":"^1.6.0","rollup-plugin-babel-minify":"^8.0.0","rollup-plugin-strip-code":"^0.2.6","sinon":"^7.2.7","tape":"^4.10.1"},"gitHead":"324f90b0c378bd367be44d3449b60878061bd4b4","_id":"realms-shim@1.1.1","_nodeVersion":"12.7.0","_npmVersion":"6.10.0","dist":{"shasum":"10636998cb34f7071114523ac4865da51b8f6ac7","size":173418,"noattachment":false,"key":"/realms-shim/-/realms-shim-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/realms-shim/download/realms-shim-1.1.1.tgz"},"maintainers":[{"name":"erights","email":"erights@gmail.com"},{"name":"katesills","email":"kate@agoric.com"},{"name":"michaelfig","email":"michael@fig.org"},{"name":"warner","email":"warner-npm@lothar.com"}],"_npmUser":{"name":"warner","email":"warner-npm@lothar.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/realms-shim_1.1.1_1569355271953_0.014706826964234754"},"_hasShrinkwrap":false,"publish_time":1569355272213,"_cnpm_publish_time":1569355272213},"1.1.0":{"name":"realms-shim","version":"1.1.0","description":"Spec-compliant shim for Realms TC39 Proposal","main":"dist/realms-shim.cjs.js","module":"dist/realms-shim.esm.js","browser":"dist/realms-shim.umd.js","license":"Apache-2.0","author":{"name":"TC39 Open Source Contributors"},"keywords":["realms","ES8","ES2017","ECMAScript","ESNext","proposal"],"homepage":"https://github.com/Agoric/realms-shim#readme","bugs":{"url":"https://github.com/Agoric/realms-shim/issues"},"repository":{"type":"git","url":"git+https://github.com/Agoric/realms-shim.git"},"scripts":{"test":"npm run shim:test","build":"npm run shim:build","shim:lint":"eslint ./src ./test ./examples","shim:prettier":"prettier --config ./.prettierrc --write ./src/**/**/*.js ./test/**/**/*.js ./examples/**/**/*.js","shim:test":"tape -r esm ./test/**/**/*.js","shim:coverage":"nyc tape -r esm ./test/**/**/*.js","shim:coveralls":"nyc report --reporter=text-lcov | coveralls","shim:build":"npm run shim:build:dev && npm run shim:build:prod","shim:watch":"npm run shim:build:dev --watch","shim:build:dev":"cross-env NODE_ENV=development rollup -c rollup.config.js","shim:build:prod":"cross-env NODE_ENV=production rollup -c rollup.config.js"},"devDependencies":{"coveralls":"^3.0.3","cross-env":"^5.2.0","eslint":"^5.15.3","eslint-config-airbnb-base":"^13.1.0","eslint-config-prettier":"^4.1.0","eslint-plugin-import":"^2.16.0","eslint-plugin-prettier":"^3.0.1","esm":"^3.2.18","nyc":"^14.0.0","prettier":"^1.16.4","rollup":"^1.6.0","rollup-plugin-babel-minify":"^8.0.0","rollup-plugin-strip-code":"^0.2.6","sinon":"^7.2.7","tape":"^4.10.1"},"_id":"realms-shim@1.1.0","_nodeVersion":"12.4.0","_npmVersion":"6.11.3","dist":{"shasum":"88584404ec82106960d33396582b6fe50b6fc16c","size":124580,"noattachment":false,"key":"/realms-shim/-/realms-shim-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/realms-shim/download/realms-shim-1.1.0.tgz"},"maintainers":[{"name":"erights","email":"erights@gmail.com"},{"name":"katesills","email":"kate@agoric.com"},{"name":"michaelfig","email":"michael@fig.org"},{"name":"warner","email":"warner-npm@lothar.com"}],"_npmUser":{"name":"michaelfig","email":"michael@fig.org"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/realms-shim_1.1.0_1568860719142_0.15462135802207055"},"_hasShrinkwrap":false,"publish_time":1568860719266,"_cnpm_publish_time":1568860719266}},"readme":"# Realm Shim\n[![Build Status][circleci-svg]][circleci-url]\n[![Coverage Status][coveralls-svg]][coveralls-url]\n[![dependency status][deps-svg]][deps-url]\n[![dev dependency status][dev-deps-svg]][dev-deps-url]\n[![License][license-image]][license-url]\n\n\nThis folder contains a shim implementation of the [Realm API Proposal](https://github.com/tc39/proposal-realms/#ecmascript-spec-proposal-for-realms-api). \n\n## Limitations\n\nThe current implementation has 3 main limitations:\n\n* All code evaluated inside a Realm runs in strict mode.\n* Direct eval is not supported.\n* `let`, global function declarations and any other feature that relies on new bindings in global contour are not preserved between difference invocations of eval, instead we create a new contour everytime.\n\n## Building the Shim\n\n```bash\ngit clone https://github.com/Agoric/realms-shim.git\ncd realms-shim\nnpm install\nnpm run shim:build\n```\n\nThis will install the necessary dependencies and build the shim locally.\n\n## Playground\n\nTo open the playground example in your default browser:\n\n```bash\nnpm run shim:build\nopen examples/simple.html\n```\n\n## Usage\n\nTo use the shim in a webpage, build the shim, then:\n\n```html\n  <script src=\"../dist/realm-shim.min.js\"></script>\n  <script>\n    const r = new Realm();\n    [...]\n  </script>\n```\n\nTo use the shim with node:\n```js\n  const Realm = require('./realm-shim.min.js');\n  const r = new Realm();\n  [...]\n```\n\nYou can also use the ES6 module version of the Realms shim in Node.js via the package `esm`. To do that, launch node with esm via the \"require\" option:\n\n```bash\nnpm install esm\nnode -r esm main.js\n```\n\nAnd import the realm module in your code:\n\n```js\n  import Realm from './src/realm';\n  const r = new Realm();\n  [...]\n```\n\n## Examples\n\n### Example 1: Root Realm\n\nTo create a root realm with a new global and a fresh set of intrinsics:\n\n```js\nconst r = new Realm(); // root realm\nr.global === this; // false\nr.global.JSON === JSON; // false\n```\n\n### Example 2: Realm Compartment\n\nTo create a realm compartment with a new global and inherit the intrinsics from another realm:\n\n```js\nconst r1 = new Realm(); // root realm\nconst r2 = new r1.global.Realm({ intrinsics: 'inherit' }); // realm compartment\nr1.global === r2.global; // false\nr1.global.JSON === r2.global.JSON; // true\n```\n\n### Example 3: Realm Compartment from current Realm\n\nTo create a realm compartment with a new global and inherit the intrinsics from the current execution context:\n\n```js\nconst r = new Realm({ intrinsics: 'inherit' }); // realm compartment\nr.global === this; // false\nr.global.JSON === JSON; // true\n```\n\n\n## Bug Disclosure\n\nPlease help us practice coordinated security bug disclosure, by using the\ninstructions in\n[SECURITY.md](https://github.com/Agoric/realms-shim/blob/master/SECURITY.md)\nto report security-sensitive bugs privately.\n\nFor non-security bugs, please use the [regular Issues\npage](https://github.com/Agoric/realms-shim/issues).\n\n\n[circleci-svg]: https://circleci.com/gh/Agoric/realms-shim.svg?style=svg\n[circleci-url]: https://circleci.com/gh/Agoric/realms-shim\n[coveralls-svg]: https://coveralls.io/repos/github/Agoric/realms-shim/badge.svg\n[coveralls-url]: https://coveralls.io/github/Agoric/realms-shim\n[deps-svg]: https://david-dm.org/Agoric/realms-shim.svg\n[deps-url]: https://david-dm.org/Agoric/realms-shim\n[dev-deps-svg]: https://david-dm.org/Agoric/realms-shim/dev-status.svg\n[dev-deps-url]: https://david-dm.org/Agoric/realms-shim?type=dev\n[license-image]: https://img.shields.io/badge/License-Apache%202.0-blue.svg\n[license-url]: LICENSE\n","_attachments":{},"homepage":"https://github.com/Agoric/realms-shim#readme","bugs":{"url":"https://github.com/Agoric/realms-shim/issues"},"license":"Apache-2.0"}