New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@import-meta-env/typescript

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.1.0 to 0.2.0

bin/import-meta-env-typescript.js

67

dist/index.js

@@ -84,10 +84,5 @@ var __create = Object.create;

__export(src_exports, {
default: () => src_default
createDeclaration: () => create_declaration_default
});
// src/core/index.ts
var import_fs2 = require("fs");
var import_path2 = require("path");
var import_unplugin = require("unplugin");
// src/core/parse-env-example-keys.ts

@@ -101,3 +96,3 @@ var import_fs = require("fs");

if ((0, import_fs.existsSync)(path) === false) {
console.error((0, import_picocolors.red)("[import-meta-env] No .env.example file found."));
console.error((0, import_picocolors.red)("[@import-meta-env/typescript] No .env.example file found."));
return [];

@@ -111,39 +106,23 @@ }

// src/core/index.ts
var createPlugin = (0, import_unplugin.createUnplugin)((options) => {
return {
name: "@import-meta-env/typescript",
buildStart() {
const dts = (() => {
var _a;
const outDir = (_a = options == null ? void 0 : options.outDir) != null ? _a : ".";
return (0, import_path2.resolve)(process.cwd(), outDir, "import-meta-env.d.ts");
})();
if (dts === null)
return;
const envExampleKeys = parseEnvExampleKeys(options == null ? void 0 : options.example);
const content = [
"// Generated by '@import-meta-env/typescript'",
"",
"interface ImportMetaEnv {",
...envExampleKeys.map((key) => ` readonly ${key}: string;`),
"}",
"",
"interface ImportMeta {",
" readonly env: ImportMetaEnv;",
"}",
""
].join("\n");
const outputPath = (0, import_path2.resolve)(process.cwd(), dts);
(0, import_fs2.writeFileSync)(outputPath, content, "utf8");
}
};
// src/core/create-declaration.ts
var createDeclaration = (options) => {
const envExampleKeys = parseEnvExampleKeys(options.example);
return [
"// Generated by '@import-meta-env/typescript'",
"",
"interface ImportMetaEnv {",
...envExampleKeys.map((key) => ` readonly ${key}: string;`),
"}",
"",
"interface ImportMeta {",
" readonly env: ImportMetaEnv;",
"}",
""
].join("\n");
};
var create_declaration_default = createDeclaration;
module.exports = __toCommonJS(src_exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createDeclaration
});
var core_default = createPlugin;
// src/index.ts
var src_default = core_default;
module.exports = createPlugin;
createPlugin['default'] = createPlugin;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
{
"name": "@import-meta-env/typescript",
"version": "0.1.0",
"version": "0.2.0",
"description": "Automatically generate .d.ts from .env.example",
"license": "MIT",
"author": "Ernest",
"keywords": [
"typescript",
"unplugin",
"rollup-plugin",
"vite-plugin",
"webpack-plugin",
"twelve-factor",
"dotenv"
],
"bin": {
"import-meta-env-typescript": "bin/import-meta-env-typescript.js"
},
"files": [

@@ -20,3 +14,3 @@ "dist"

"main": "dist/index.js",
"types": "dist/index.d.ts",
"types": "dist/src/index.d.ts",
"engines": {

@@ -42,12 +36,12 @@ "node": ">= 14"

"dependencies": {
"picocolors": "^1.0.0",
"unplugin": "^0.3.2"
"commander": "^9.0.0",
"picocolors": "^1.0.0"
},
"scripts": {
"build": "rimraf dist bin && pnpm build-types && pnpm build-bundle",
"build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:unplugin --external:dotenv --external:webpack --outfile=dist/index.js && pnpm run patch-dist",
"build": "rimraf dist bin && pnpm build-types && pnpm build-bundle && pnpm build-bin",
"build-bin": "esbuild src/bin.ts --bundle --platform=node --target=node12 --external:dotenv --external:webpack --outfile=bin/import-meta-env-typescript.js && node ./scripts/patchBin.js",
"build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:dotenv --outfile=dist/index.js",
"build-types": "tsc -p . --emitDeclarationOnly --outDir dist",
"patch-dist": "node ./scripts/patchEsbuildDist.mjs",
"release": "standard-version -t typescript --preset=conventionalcommits --releaseCommitMessageFormat 'chore(release): @import-meta-env/typescript@{{currentTag}}' --path . && pnpm build"
}
}
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