{"_id":"@emmiep/babel-plugin-strip-parcel-hmr","_rev":"4-ccae6e25f5ce54bc0f347e87a7120f4b","name":"@emmiep/babel-plugin-strip-parcel-hmr","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@emmiep/babel-plugin-strip-parcel-hmr","version":"1.0.0","main":"src/plugin.js","author":{"name":"Emmie Päivärinta","email":"Emmie.Paivarinta@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/emmiep/babel-plugin-strip-parcel-hmr.git"},"keywords":["babel-plugin","parcel","hmr"],"scripts":{"prepublish":"run-p -nl test lint","test":"jest","lint":"eslint src/** __tests__/**","watch:test":"$npm_execpath test --watch"},"devDependencies":{"@emmiep/eslint-config":"^2.0.0","babel-core":"^6.26.0","eslint":"^4.19.1","jest":"^22.4.3","npm-run-all":"^4.1.2"},"description":"An experimental Babel plugin for removing [hot module replacement] (HMR) code from production bundles created with [Parcel].","licenseText":"Copyright 2018 Emmie Päivärinta\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"@emmiep/babel-plugin-strip-parcel-hmr@1.0.0","dist":{"shasum":"b2e61839b7cb195d04d877c91927fbcac675e547","tarball":"https://registry.npmjs.org/@emmiep/babel-plugin-strip-parcel-hmr/-/babel-plugin-strip-parcel-hmr-1.0.0.tgz","fileCount":32,"unpackedSize":12205,"integrity":"sha512-jQm2CoepvGGyW5eW4bacr1DPGT2lfZGoTVUETrdVwxLfSxrWOl//WX0NO2KOAezbBRysb0EdnSGmUeVY9Ncpqg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC100VcJt1ofUlQeGtucQpnnML4aX/fuB/Ucv52IAsj/AiEAjUzjv/dX7jHbEUtP1d6RpTraOVyzXrAq9f6d96bHwSk="}]},"maintainers":[{"name":"emmiep","email":"Emmie.Paivarinta@gmail.com"}],"_npmUser":{"name":"emmiep","email":"Emmie.Paivarinta@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-strip-parcel-hmr_1.0.0_1523030011423_0.7925554549046081"},"_hasShrinkwrap":false},"2.0.0":{"name":"@emmiep/babel-plugin-strip-parcel-hmr","version":"2.0.0","main":"src/plugin.js","author":{"name":"Emmie Päivärinta","email":"Emmie.Paivarinta@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/emmiep/babel-plugin-strip-parcel-hmr.git"},"keywords":["babel-plugin","parcel","hmr"],"scripts":{"prepublish":"run-p -nl test lint","test":"jest","lint":"eslint src/** __tests__/**","watch:test":"$npm_execpath test --watch"},"devDependencies":{"@emmiep/eslint-config":"^3.0.0","babel-core":"^6.26.0","eslint":"^4.19.1","jest":"^22.4.3","npm-run-all":"^4.1.2"},"description":"An experimental Babel plugin for removing [hot module replacement] (HMR) code from production bundles created with [Parcel].","licenseText":"Copyright 2018 Emmie Päivärinta\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"@emmiep/babel-plugin-strip-parcel-hmr@2.0.0","dist":{"shasum":"fff2b60d61e47fec832848e3c59b6a9213f063ec","tarball":"https://registry.npmjs.org/@emmiep/babel-plugin-strip-parcel-hmr/-/babel-plugin-strip-parcel-hmr-2.0.0.tgz","fileCount":38,"unpackedSize":22601,"integrity":"sha512-mkZ7w7FUUCuIZ5iqrQDJp/vIEwvKqA+Ct4O8isua1+yxiUIQh+51fAFFEVOKdavF1RUD8FC8VoMzOu+zAqN0Hg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDCvE6qRR5Si8R5EeZ0Fm0bkvp1fh1sItV8WRkNCTKX+AiEA7m+W2UA95roMetnQYY/ZUpEBJJ5K2Jg7bEwfxRbiLlo="}]},"maintainers":[{"name":"emmiep","email":"Emmie.Paivarinta@gmail.com"}],"_npmUser":{"name":"emmiep","email":"Emmie.Paivarinta@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-strip-parcel-hmr_2.0.0_1523359620838_0.25158396700509744"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-06T15:53:31.376Z","1.0.0":"2018-04-06T15:53:31.794Z","modified":"2022-06-12T17:33:29.255Z","2.0.0":"2018-04-10T11:27:00.896Z"},"maintainers":[{"name":"emmiep","email":"Emmie.Paivarinta@gmail.com"}],"description":"An experimental Babel plugin for removing [hot module replacement] (HMR) code from production bundles created with [Parcel].","keywords":["babel-plugin","parcel","hmr"],"repository":{"type":"git","url":"https://github.com/emmiep/babel-plugin-strip-parcel-hmr.git"},"author":{"name":"Emmie Päivärinta","email":"Emmie.Paivarinta@gmail.com"},"license":"MIT","readme":"# babel-plugin-strip-parcel-hmr\n\nAn experimental Babel plugin for removing [hot module replacement] (HMR) code from production bundles created with [Parcel].\n\nCurrently the following syntaxes are supported:\n\n* Tests in `if` and `else` statements\n* Tests in the ternary `?:` operator\n* Checking for HMR with `module.hot` and `module['hot']`\n* Checking for HMR with `typeof module.hot`\n* Checking for HMR with `'hot' in module`\n* Negating tests with `!`\n\n## Examples\n\n**In**\n\n```js\nif (module.hot) {\n  module.hot.accept(() => {\n    // update module\n  });\n}\n\nconst value = module.hot ? 'in development' : 'in production';\n\n// rest of the code here\n```\n\n**Out**\n\n```js\nconst value = 'in production';\n\n// rest of the code here\n```\n\n**In**\n\n```js\nif (!module.hot) {\n  // only when HMR is disabled\n}\n```\n\n**Out**\n\n```js\n{\n  // only when HMR is disabled\n}\n```\n\n## Installation\n\n```sh\nnpm install @emmiep/babel-plugin-strip-parcel-hmr\n```\n\n## Usage\n\n**.babelrc**\n\n```json\n{\n  \"env\": {\n    \"production\": {\n      \"plugins\": [\n        \"@emmiep/babel-plugin-strip-parcel-hmr\"\n      ]\n    }\n  }\n}\n```\n\nThe plugin would normally only be used for the `production` environment (which is automatically set when running [`parcel build`][parcel-production]) to preserve the HMR code during development.\nThis is accomplished by using the [`env` option][babel-env-option] in `.babelrc` as shown above.\n\n## Options\n\n**objectName**\n\n`string`, defaults to `module`.\n\nThe name of the global object containing a property (`propertyName`) used when checking if HMR is enabled.\n\n**propertyName**\n\n`string`, defaults to `hot`.\n\nThe name of the property used when checking if HMR is enabled.\n\n## Caveats\n\nCurrently Parcel is [not implementing tree-shaking][parcel-tree-shaking], which means functions only used during development for HMR will still be included in the production bundles unless they're defined inside if statements testing for HMR.\nFor instance any module imported using the ES6 `import` keyword will always be included in the production bundle.\n\n[hot module replacement]: https://parceljs.org/hmr.html\n[Parcel]: https://parceljs.org/\n[parcel-production]: https://parceljs.org/production.html\n[babel-env-option]: https://babeljs.io/docs/usage/babelrc/#env-option\n[parcel-tree-shaking]: https://github.com/parcel-bundler/parcel/issues/392\n\n","readmeFilename":"README.md"}