process-envify
Advanced tools
+1
-3
@@ -1,4 +0,2 @@ | ||
| declare const _default: (data: Record<string, unknown>, opts?: { | ||
| useImportMeta?: boolean; | ||
| }) => Record<string, unknown>; | ||
| declare const _default: (data: Record<string, unknown>) => Record<string, unknown>; | ||
| export default _default; |
@@ -1,8 +0,8 @@ | ||
| const i = (t, l = {}) => { | ||
| const s = {}, n = Object.keys(t), r = Object.values(t); | ||
| for (let e = 0, u = n.length; e < u; e += 1) { | ||
| const o = n[e], c = JSON.stringify(r[e]); | ||
| l.useImportMeta ? s[`{"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true}.${o}`] = c : s[`process.env.${o}`] = c; | ||
| const i = (s) => { | ||
| const t = {}, n = Object.keys(s), c = Object.values(s); | ||
| for (let e = 0, o = n.length; e < o; e += 1) { | ||
| const l = n[e], r = JSON.stringify(c[e]); | ||
| t[`process.env.${l}`] = r; | ||
| } | ||
| return s; | ||
| return t; | ||
| }; | ||
@@ -9,0 +9,0 @@ export { |
@@ -1,1 +0,1 @@ | ||
| (function(n,e){typeof exports=="object"&&typeof module<"u"?module.exports=e():typeof define=="function"&&define.amd?define(e):(n=typeof globalThis<"u"?globalThis:n||self,n.ProcessEnvify=e())})(this,function(){"use strict";return(e,u={})=>{const s={},o=Object.keys(e),c=Object.values(e);for(let t=0,d=o.length;t<d;t+=1){const i=o[t],f=JSON.stringify(c[t]);u.useImportMeta?s[`{"BASE_URL":"/","MODE":"production","DEV":false,"PROD":true}.${i}`]=f:s[`process.env.${i}`]=f}return s}}); | ||
| (function(n,e){typeof exports=="object"&&typeof module<"u"?module.exports=e():typeof define=="function"&&define.amd?define(e):(n=typeof globalThis<"u"?globalThis:n||self,n.ProcessEnvify=e())})(this,function(){"use strict";return e=>{const t={},i=Object.keys(e),o=Object.values(e);for(let s=0,f=i.length;s<f;s+=1){const c=i[s],u=JSON.stringify(o[s]);t[`process.env.${c}`]=u}return t}}); |
+1
-2
| { | ||
| "name": "process-envify", | ||
| "version": "1.0.6", | ||
| "version": "2.0.0", | ||
| "description": "A process env helper for injecting strings.", | ||
@@ -29,3 +29,2 @@ "main": "./dist/process-envify.umd.cjs", | ||
| "process.env", | ||
| "import.meta", | ||
| "Vite", | ||
@@ -32,0 +31,0 @@ "Vue CLI", |
+3
-9
@@ -20,5 +20,2 @@ # process-envify [](https://travis-ci.org/Vanilla-IceCream/process-envify) [](https://coveralls.io/github/Vanilla-IceCream/process-envify?branch=master) | ||
| const getBookName = () => process.env.BOOK_NAME; | ||
| // useImportMeta: true | ||
| const getBookName = () => import.meta.env.BOOK_NAME; | ||
| ``` | ||
@@ -38,5 +35,5 @@ | ||
| ### Vite (`vite.config.js`) | ||
| ### Vite (`vite.config.ts`) | ||
| ```js | ||
| ```ts | ||
| import { defineConfig } from 'vite'; | ||
@@ -46,6 +43,3 @@ import envify from 'process-envify'; | ||
| export default defineConfig({ | ||
| define: envify( | ||
| { BOOK_NAME: 'ECMAScript: Up and Running' }, | ||
| { useImportMeta: true }, | ||
| ), | ||
| define: envify({ BOOK_NAME: 'ECMAScript: Up and Running' }), | ||
| }); | ||
@@ -52,0 +46,0 @@ ``` |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
6348
-5.55%18
-10%168
-3.45%