{"_id":"@0kzh/babel-plugin-transform-vite-meta-env","name":"@0kzh/babel-plugin-transform-vite-meta-env","dist-tags":{"latest":"0.0.0-semantically-released"},"versions":{"0.0.0-semantically-released":{"name":"@0kzh/babel-plugin-transform-vite-meta-env","version":"0.0.0-semantically-released","description":"babel plugin that emulates vite's import.meta.env functionality","main":"lib/index.js","typings":"lib/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OpenSourceRaidGuild/babel-vite.git"},"keywords":["babel","vite","plugin","import","meta","env"],"author":{"name":"Michael Peyper","email":"mpeyper7@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/OpenSourceRaidGuild/babel-vite/issues"},"homepage":"https://github.com/OpenSourceRaidGuild/babel-vite#readme","scripts":{"build":"kcd-scripts build --out-dir lib","test":"kcd-scripts test"},"devDependencies":{"@babel/core":"^7.13.8","@types/babel-plugin-tester":"^9.0.1","babel-plugin-tester":"^10.0.0","kcd-scripts":"^12.0.0","typescript":"^4.2.2"},"dependencies":{"@babel/runtime":"^7.13.9","@types/babel__core":"^7.1.12"},"_id":"@0kzh/babel-plugin-transform-vite-meta-env@0.0.0-semantically-released","_nodeVersion":"16.0.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-YHblZzU+Yy6UWWyY4VpDS8Yn4vecNjAlsUcLrAVrBARFUeNqlq/vk38ivwdMCsxwrdj12djdSjIKv7pSwPbBYw==","shasum":"432aba7969bdec0a956eff91b8db36d9935bf916","tarball":"https://registry.npmjs.org/@0kzh/babel-plugin-transform-vite-meta-env/-/babel-plugin-transform-vite-meta-env-0.0.0-semantically-released.tgz","fileCount":8,"unpackedSize":15952,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC2oKzDQ7Yh/2hpeBhF1+cSNic0ccB+HDSv/weC9A3IjAIgXMNeI5IYFXPGoe2sg26Z1LA+Bft6/x5Yhk2tysYW4OM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjxuicACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqtgA//fq8pgNC4IsMv5ItQcCS/SpoYp4rV9LmocMKeclAusMXMaASd\r\nD5B/1zoIL+0KylphbsuTag49AT5J+qgnuWS1rYuLgzkrTQvowvsFURar5FCY\r\nE8w4IEBvWwRCYF05nlApVUmP5/dQAh/iauU5AJ8GGT7rQgdaZ8CXInfvEMwD\r\nJEDOx0qm6vM0qAD34malipXbg1PiQoKo+YDNrO9x+TjGB1ZBx+nli2OaiRUe\r\nKUyYO0CrOZtdyc6EhNy4QOdOkSrON4iXG/1uTho4HMLxRfr4kwdGGTjdUS3o\r\nF/ow45wrON8rmBInnXf+Epz1/zQI53p0/uTYMr513fMqeiHnzfncsTyJ7kZU\r\nNlMbomPo/FsqqbBJWlKAkSA9/ANxvH+U6LoyLAhGn/blYyJFlGVhAJJd+gUr\r\nh7velInS+sMCU5qp8nxt5C03376Be+W0byxH7k65r1mseU+ILL1fRgIHirKb\r\nAPlop/+y21R6ZudTNYnsVjSaswJ8v+Bi+E368hQcRf70bx9bnmOJTHIs0jV+\r\nf6qN7YnvKNAQBL7smA864pgFeOp9sZJo75b33fyj8Wm2Re40uQY/HFpp7SIU\r\neevFH+TxuIDpReVRYQ152j0vDPcyPG66vg4x9AWodIQgCie0ZVTPLxCf3zHQ\r\nEd9mx7r0pja/Il1tn0gR+uOxE4BKSFvr4cY=\r\n=0LU/\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"0kzh","email":"me@kelvinzhang.ca"},"directories":{},"maintainers":[{"name":"0kzh","email":"me@kelvinzhang.ca"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-vite-meta-env_0.0.0-semantically-released_1673980060633_0.1556569485732071"},"_hasShrinkwrap":false}},"time":{"created":"2023-01-17T18:27:40.583Z","0.0.0-semantically-released":"2023-01-17T18:27:40.818Z","modified":"2023-01-17T18:27:40.949Z"},"maintainers":[{"name":"0kzh","email":"me@kelvinzhang.ca"}],"description":"babel plugin that emulates vite's import.meta.env functionality","homepage":"https://github.com/OpenSourceRaidGuild/babel-vite#readme","keywords":["babel","vite","plugin","import","meta","env"],"repository":{"type":"git","url":"git+https://github.com/OpenSourceRaidGuild/babel-vite.git"},"author":{"name":"Michael Peyper","email":"mpeyper7@gmail.com"},"bugs":{"url":"https://github.com/OpenSourceRaidGuild/babel-vite/issues"},"license":"MIT","readme":"# babel-plugin-transform-vite-meta-env\n\n<!-- prettier-ignore-start -->\n[![Build Status](https://img.shields.io/github/workflow/status/OpenSourceRaidGuild/babel-vite/validate?logo=github&style=flat-square)](https://github.com/OpenSourceRaidGuild/babel-vite/actions?query=workflow%3Avalidate)\n[![codecov](https://img.shields.io/codecov/c/github/OpenSourceRaidGuild/babel-vite.svg?style=flat-square)](https://codecov.io/gh/OpenSourceRaidGuild/babel-vite)\n[![version](https://img.shields.io/npm/v/babel-plugin-transform-vite-meta-env.svg?style=flat-square)](https://www.npmjs.com/package/babel-plugin-transform-vite-meta-env)\n[![downloads](https://img.shields.io/npm/dm/babel-plugin-transform-vite-meta-env.svg?style=flat-square)](http://www.npmtrends.com/babel-plugin-transform-vite-meta-env)\n[![MIT License](https://img.shields.io/npm/l/babel-plugin-transform-vite-meta-env.svg?style=flat-square)](https://github.com/OpenSourceRaidGuild/babel-vite/blob/master/LICENSE.md)\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n[![Code of Conduct](https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square)](https://github.com/OpenSourceRaidGuild/babel-vite/blob/master/CODE_OF_CONDUCT.md)\n[![Discord](https://img.shields.io/discord/808364903822917662.svg?color=7389D8&labelColor=6A7EC2&logo=discord&logoColor=ffffff&style=flat-square)](https://discord.gg/grS89HWeYh)\n\n[![Watch on GitHub](https://img.shields.io/github/watchers/OpenSourceRaidGuild/babel-vite.svg?style=social)](https://github.com/OpenSourceRaidGuild/babel-vite/watchers)\n[![Star on GitHub](https://img.shields.io/github/stars/OpenSourceRaidGuild/babel-vite.svg?style=social)](https://github.com/OpenSourceRaidGuild/babel-vite/stargazers)\n[![Tweet](https://img.shields.io/twitter/url/https/github.com/OpenSourceRaidGuild/babel-vite.svg?style=social)](https://twitter.com/intent/tweet?text=Check%20out%20babel-plugin-transform-vite-meta-env%20by%20OpenSourceRaidGuild%20https%3A%2F%2Fgithub.com%2FOpenSourceRaidGuild%2Fbabel-vite%20%F0%9F%91%8D)\n<!-- prettier-ignore-end -->\n\n> Please note: this plugin is intended to provide an approximation of some of Vite specific\n> transformations when running the code in non-Vite environment, for example, running tests with a\n> NodeJS based test runner.\n>\n> **The functionality within these transformations should not be relied upon in production.**\n\n## Example\n\n**In**\n\n```\nconst mode = import.meta.env.MODE;\nconst baseUrl = import.meta.env.BASE_URL;\nconst nodeEnv = import.meta.env.NODE_ENV;\nconst dev = import.meta.env.DEV;\nconst prod = import.meta.env.PROD;\nconst viteVar = import.meta.env.VITE_VAR;\nconst other = import.meta.env.OTHER;\nconst env = import.meta.env;\n```\n\n**Out**\n\n```\nconst mode = process.env.MODE;\nconst baseUrl = '/';\nconst nodeEnv = process.env.NODE_ENV || 'test';\nconst dev = process.env.NODE_ENV !== 'production';\nconst prod = process.env.NODE_ENV === 'production';\nconst viteVar = process.env.VITE_VAR;\nconst other = {\n  ...Object.fromEntries(Object.entries(process.env).filter(([k]) => /^VITE_/.test(k))),\n  NODE_ENV: process.env.NODE_ENV || 'test',\n  MODE: process.env.NODE_ENV || 'test',\n  BASE_URL: '/',\n  DEV: process.env.NODE_ENV !== 'production',\n  PROD: process.env.NODE_ENV === 'production'\n}.OTHER;\nconst env = {\n  ...Object.fromEntries(Object.entries(process.env).filter(([k]) => /^VITE_/.test(k))),\n  NODE_ENV: process.env.NODE_ENV || 'test',\n  MODE: process.env.NODE_ENV || 'test',\n  BASE_URL: '/',\n  DEV: process.env.NODE_ENV !== 'production',\n  PROD: process.env.NODE_ENV === 'production'\n};\n```\n\n## Installation\n\n```sh\nnpm install --save-dev babel-plugin-transform-vite-meta-env\n```\n\n## Usage\n\n### With a configuration file (Recommended)\n\n```json\n{\n  \"plugins\": [\"babel-plugin-transform-vite-meta-env\"]\n}\n```\n\n### Via CLI\n\n```sh\nbabel --plugins babel-plugin-transform-vite-meta-env script.js\n```\n\n### Via Node API\n\n```javascript\nrequire('@babel/core').transformSync('code', {\n  plugins: ['babel-plugin-transform-vite-meta-env']\n})\n```\n","readmeFilename":"README.md"}