vite-plugin-environment
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -49,2 +49,2 @@ import { Plugin } from 'vite'; | ||
export default EnvironmentPlugin; | ||
export { EnvironmentPlugin as default }; |
@@ -1,3 +0,3 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/index.ts | ||
var _vite = require('vite'); | ||
// src/index.ts | ||
import { loadEnv } from "vite"; | ||
function defineEnvVars(env, defineOn, keys, defaultValues) { | ||
@@ -24,15 +24,15 @@ return keys.reduce((vars, key) => { | ||
function EnvironmentPlugin(vars, options = {}) { | ||
const {prefix = "", defineOn = "process.env", loadEnvFiles = true} = options; | ||
const { prefix = "", defineOn = "process.env", loadEnvFiles = true } = options; | ||
return { | ||
name: "process-env-variables", | ||
config({root = process.cwd()}, {mode}) { | ||
const env = loadEnvFiles ? _vite.loadEnv.call(void 0, mode, root, prefix) : loadProcessEnv(prefix); | ||
name: "vite-plugin-environment", | ||
config({ root = process.cwd() }, { mode }) { | ||
const env = loadEnvFiles ? loadEnv(mode, root, prefix) : loadProcessEnv(prefix); | ||
const keys = vars === "all" ? Object.keys(env) : Array.isArray(vars) ? vars : Object.keys(vars); | ||
const defaultValues = vars === "all" || Array.isArray(vars) ? {} : vars; | ||
return {define: defineEnvVars(env, defineOn, keys, defaultValues)}; | ||
return { define: defineEnvVars(env, defineOn, keys, defaultValues) }; | ||
} | ||
}; | ||
} | ||
exports.default = EnvironmentPlugin; | ||
export { | ||
EnvironmentPlugin as default | ||
}; |
142
package.json
{ | ||
"name": "vite-plugin-environment", | ||
"version": "1.0.1", | ||
"description": "Easily expose environment variables in Vite.js", | ||
"keywords": [ | ||
"env", | ||
"environment", | ||
"variables", | ||
"vite", | ||
"vite-plugin", | ||
"vitejs" | ||
], | ||
"main": "dist/index.js", | ||
"module": "dist/index.mjs", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"lint": "eslint .", | ||
"test": "jest", | ||
"dev": "npm run build -- --watch", | ||
"build": "tsup src/index.ts --dts --format cjs,esm", | ||
"clean": "rm -rf ./dist", | ||
"release": "node scripts/release", | ||
"_postinstall": "husky install", | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", | ||
"prepublishOnly": "pinst --disable && npm run build", | ||
"postpublish": "PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag v$PACKAGE_VERSION && git push --tags && pinst --enable" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ElMassimo/vite-plugin-environment" | ||
}, | ||
"homepage": "https://github.com/ElMassimo/vite-plugin-environment", | ||
"bugs": "https://github.com/ElMassimo/vite-plugin-environment/issues", | ||
"author": "Máximo Mussini <maximomussini@gmail.com>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@mussi/eslint-config": "^0.5", | ||
"@types/debug": "^4.1.5", | ||
"@types/jest": "^26.0.22", | ||
"@typescript-eslint/eslint-plugin": "^4.12.0", | ||
"conventional-changelog-cli": "^2.1.1", | ||
"eslint": "^7.17.0", | ||
"eslint-plugin-jest": "^24.3.5", | ||
"fast-glob": "^3.2.5", | ||
"husky": "^5.1.3", | ||
"jest": "^26.6.3", | ||
"lint-staged": "^10.5.4", | ||
"pinst": "^2.1.6", | ||
"rollup": "^2.36.1", | ||
"ts-jest": "^26.5.5", | ||
"ts-node": "^9.1.1", | ||
"tsup": "^3.11.0", | ||
"typescript": "^4.1.3", | ||
"vite": "^2.2.0" | ||
}, | ||
"peerDependencies": { | ||
"vite": "^2.0" | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts}": [ | ||
"eslint --fix" | ||
] | ||
} | ||
"name": "vite-plugin-environment", | ||
"version": "1.1.0", | ||
"description": "Easily expose environment variables in Vite.js", | ||
"keywords": [ | ||
"env", | ||
"environment", | ||
"variables", | ||
"vite", | ||
"vite-plugin", | ||
"vitejs" | ||
], | ||
"sideEffects": false, | ||
"files": [ | ||
"dist" | ||
], | ||
"type": "module", | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"require": "./dist/index.cjs", | ||
"import": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ElMassimo/vite-plugin-environment" | ||
}, | ||
"homepage": "https://github.com/ElMassimo/vite-plugin-environment", | ||
"bugs": "https://github.com/ElMassimo/vite-plugin-environment/issues", | ||
"author": "Máximo Mussini <maximomussini@gmail.com>", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@mussi/eslint-config": "^0.5", | ||
"@types/node": "^17.0.8", | ||
"@typescript-eslint/eslint-plugin": "^4.12.0", | ||
"conventional-changelog-cli": "^2.1.1", | ||
"cross-spawn": "^7.0.3", | ||
"enquirer": "^2.3.6", | ||
"eslint": "^7.17.0", | ||
"fast-glob": "^3.2", | ||
"husky": "^5.1.3", | ||
"lint-staged": "^10.5.4", | ||
"minimist": "^1.2.5", | ||
"picocolors": "^1.0.0", | ||
"pinst": "^2.1.6", | ||
"rollup": "^2.59", | ||
"semver": "^7.3.5", | ||
"tsup": "^5", | ||
"typescript": "^4.5", | ||
"vite": "^2.7", | ||
"vitest": "^0.0.132" | ||
}, | ||
"peerDependencies": { | ||
"vite": "^2.7" | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts}": [ | ||
"eslint --fix" | ||
] | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"@mussi/eslint-config" | ||
] | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"test": "vitest", | ||
"dev": "npm run build -- --watch", | ||
"build": "tsup src/index.ts --dts --format cjs,esm --clean", | ||
"release": "node scripts/release.cjs", | ||
"_postinstall": "husky install", | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s" | ||
} | ||
} |
@@ -23,2 +23,3 @@ <h2 align='center'><samp>vite-plugin-environment</samp></h2> | ||
[meta env]: https://vitejs.dev/guide/env-and-mode.html#env-files | ||
[vite-plugin-env-compatible]: https://github.com/IndexXuan/vite-plugin-env-compatible | ||
@@ -160,3 +161,3 @@ ## Why? 🤔 | ||
- [vite-plugin-env-compatible](vite-plugin-env-compatible): Convenient if you are porting a Vue CLI or create-react-app. | ||
- [vite-plugin-env-compatible]: Convenient if you are porting a Vue CLI or create-react-app. | ||
@@ -163,0 +164,0 @@ ## License |
13836
145
165
Yes
19
6