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

@import-meta-env/unplugin

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.1.10 to 0.2.0

27

dist/index.js

@@ -88,6 +88,10 @@ "use strict";

// package.json
var version = "0.1.10";
var version = "0.2.0";
// ../shared/constant.ts
var placeholder = "'__import_meta_env_placeholder__'";
var placeholder = `eval("var import_meta_env={};import_meta_env")`;
var createPlaceholderRegExp = (suffix) => new RegExp(
placeholder.replace(/\(/g, "\\(").replace(/\)/g, "\\)") + suffix,
"g"
);
var envFilePath = ".env";

@@ -220,3 +224,3 @@

code = code.replace(
new RegExp(`\\(${placeholder}\\).${key}`, "g"),
createPlaceholderRegExp(`.${key}`),
`import.meta.env.${key}`

@@ -236,3 +240,3 @@ );

code = code.replace(
new RegExp(`\\(${placeholder}\\).${prefix}`, "g"),
createPlaceholderRegExp(`.${prefix}`),
`import.meta.env.${prefix}`

@@ -242,8 +246,8 @@ );

code = code.replace(
new RegExp(`\\(${placeholder}\\)([^.])`, "g"),
`({...(${placeholder}),...import.meta.env})$1`
createPlaceholderRegExp("([^.])"),
`({...${placeholder},...import.meta.env})$1`
);
code = code.replace(
new RegExp(`\\(${placeholder}\\)$`, "g"),
`({...(${placeholder}),...import.meta.env})`
createPlaceholderRegExp("$"),
`({...${placeholder},...import.meta.env})`
);

@@ -301,3 +305,3 @@ return code;

if (id.includes("node_modules") === false) {
code = code.replace(/import\.meta\.env/g, `(${placeholder})`);
code = code.replace(/import\.meta\.env/g, placeholder);
if (meta.framework === "vite") {

@@ -397,6 +401,3 @@ if (viteConfig === void 0)

debug && console.debug("==================");
html = html.replace(
new RegExp(`\\(${placeholder}\\)`, "g"),
"import.meta.env"
);
html = html.replace(createPlaceholderRegExp(""), "import.meta.env");
debug && console.debug("=== index.html after ===");

@@ -403,0 +404,0 @@ debug && console.debug(html);

export declare const virtualFile = "import-meta-env";
export declare const placeholder = "'__import_meta_env_placeholder__'";
export declare const placeholder = "eval(\"var import_meta_env={};import_meta_env\")";
export declare const createPlaceholderRegExp: (suffix: string) => RegExp;
export declare const envFilePath = ".env";
{
"name": "@import-meta-env/unplugin",
"version": "0.1.10",
"version": "0.2.0",
"description": "Load environment variables into import.meta.env object",

@@ -42,13 +42,19 @@ "license": "MIT",

"devDependencies": {
"@types/node": "^17.0.8",
"@types/object-hash": "^2.2.1",
"rollup": "2.68.0",
"ts-node": "^10.5.0",
"typescript": "^4.5.4",
"vite": "^3.1.4",
"webpack": "^5.69.1"
"@types/node": "17.0.45",
"@types/object-hash": "2.2.1",
"rollup": "2.79.1",
"ts-node": "10.9.1",
"typescript": "4.8.4",
"vite": "3.1.7",
"webpack": "5.74.0"
},
"peerDependencies": {
"@import-meta-env/cli": "^0.2.0",
"dotenv": "^11.0.0 || ^12.0.4 || ^13.0.1 || ^14.3.2 || ^15.0.1 || ^16.0.0"
},
"peerDependenciesMeta": {
"@import-meta-env/cli": {
"optional": true
}
},
"dependencies": {

@@ -55,0 +61,0 @@ "object-hash": "^3.0.0",

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