Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@import-meta-env/babel

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@import-meta-env/babel - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

8

package.json
{
"name": "@import-meta-env/babel",
"version": "0.1.5",
"version": "0.1.6",
"description": "Load environment variables into import.meta.env object",

@@ -21,6 +21,6 @@ "license": "MIT",

"devDependencies": {
"dotenv": "^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0"
"dotenv": "^8.6.0 || ^9.0.2 || ^10.0.0 || ^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0"
},
"peerDependencies": {
"dotenv": "^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0"
"dotenv": "^8.6.0 || ^9.0.2 || ^10.0.0 || ^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0"
},

@@ -36,3 +36,3 @@ "dependencies": {

},
"readme": "# @import-meta-env/babel\n\n[![CI](https://github.com/iendeavor/import-meta-env/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/iendeavor/import-meta-env/actions/workflows/ci.yml)\n[![NPM version](https://img.shields.io/npm/v/@import-meta-env/babel.svg)](https://www.npmjs.com/package/@import-meta-env/babel)\n[![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\n\nThis plugin is intended to provide a feature same as [@import-meta-env/unplugin](https://github.com/iendeavor/import-meta-env/tree/main/packages/unplugin) specific transformations when running the code in other environments, for example, running tests with a NodeJS based test runner or running @vue/cli@4 which needs to be transformed with babel.\n\n<br>\n\nThis project use [SemVer](https://semver.org/) for versioning. For the versions available, see the tags on this repository.\n\n## Quick Start\n\nInstall and register the plugin:\n\n```sh\n$ npm i @import-meta-env/babel\n```\n\n```js\n// babel.config.js\nmodule.exports = {\n plugins: [[\"module:@import-meta-env/babel\", { example: \".env.example\" }]],\n};\n```\n\nAdjust scripts in your package.json or elsewhere:\n\n```json\n{\n \"scripts\": {\n // If you have a `.env` file:\n \"test\": \"jest\",\n // If you don't have a `.env` file:\n \"test\": \"cross-env S3_BUCKET=YOURS3BUCKET jest\"\n }\n}\n```\n\nSee also:\n\n- [examples](https://github.com/iendeavor/import-meta-env/tree/main/packages/examples)\n- [@import-meta-env/cli](https://github.com/iendeavor/import-meta-env/tree/main/packages/cli) - A binary package is used to inject environment variables into those placeholders.\n- [@import-meta-env/unplugin](https://github.com/iendeavor/import-meta-env/tree/main/packages/unplugin) - Inject environment variables into the import.meta.env object after building the application instead of statically replacing it during production.\n\n## Plugin Options\n\n```js\n// babel.config.js\nmodule.exports = {\n plugins: [\n [\n \"module:@import-meta-env/babel\",\n /* Plugin options goes here */\n {\n env: \".env.example\",\n },\n ],\n ],\n};\n```\n\n```ts\ninterface PluginOptions {\n /**\n * The .env file path to load\n *\n * @default \".env\"\n */\n env?: string;\n\n /**\n * The .env example file path to load\n */\n example: string;\n\n /**\n * Explicity set whether to inline current environment variables into the code,\n * instead of inject environment variables via `import-meta-env` later.\n *\n * @default\n * process.env.NODE_ENV !== 'production'\n */\n shouldInlineEnv?: boolean;\n}\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details\n"
"readme": "# @import-meta-env/babel\n\n[Documentation](https://iendeavor.github.io/import-meta-env/)\n"
}
# @import-meta-env/babel
[![CI](https://github.com/iendeavor/import-meta-env/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/iendeavor/import-meta-env/actions/workflows/ci.yml)
[![NPM version](https://img.shields.io/npm/v/@import-meta-env/babel.svg)](https://www.npmjs.com/package/@import-meta-env/babel)
[![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
This plugin is intended to provide a feature same as [@import-meta-env/unplugin](https://github.com/iendeavor/import-meta-env/tree/main/packages/unplugin) specific transformations when running the code in other environments, for example, running tests with a NodeJS based test runner or running @vue/cli@4 which needs to be transformed with babel.
<br>
This project use [SemVer](https://semver.org/) for versioning. For the versions available, see the tags on this repository.
## Quick Start
Install and register the plugin:
```sh
$ npm i @import-meta-env/babel
```
```js
// babel.config.js
module.exports = {
plugins: [["module:@import-meta-env/babel", { example: ".env.example" }]],
};
```
Adjust scripts in your package.json or elsewhere:
```json
{
"scripts": {
// If you have a `.env` file:
"test": "jest",
// If you don't have a `.env` file:
"test": "cross-env S3_BUCKET=YOURS3BUCKET jest"
}
}
```
See also:
- [examples](https://github.com/iendeavor/import-meta-env/tree/main/packages/examples)
- [@import-meta-env/cli](https://github.com/iendeavor/import-meta-env/tree/main/packages/cli) - A binary package is used to inject environment variables into those placeholders.
- [@import-meta-env/unplugin](https://github.com/iendeavor/import-meta-env/tree/main/packages/unplugin) - Inject environment variables into the import.meta.env object after building the application instead of statically replacing it during production.
## Plugin Options
```js
// babel.config.js
module.exports = {
plugins: [
[
"module:@import-meta-env/babel",
/* Plugin options goes here */
{
env: ".env.example",
},
],
],
};
```
```ts
interface PluginOptions {
/**
* The .env file path to load
*
* @default ".env"
*/
env?: string;
/**
* The .env example file path to load
*/
example: string;
/**
* Explicity set whether to inline current environment variables into the code,
* instead of inject environment variables via `import-meta-env` later.
*
* @default
* process.env.NODE_ENV !== 'production'
*/
shouldInlineEnv?: boolean;
}
```
## License
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details
[Documentation](https://iendeavor.github.io/import-meta-env/)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc