bini-env 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,218 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ default: () => biniEnvPlugin,
34
+ detectEnvFiles: () => detectEnvFiles,
35
+ formatEnvFilesForDisplay: () => formatEnvFilesForDisplay
36
+ });
37
+ module.exports = __toCommonJS(index_exports);
38
+ var import_fs = __toESM(require("fs"), 1);
39
+ var import_path = __toESM(require("path"), 1);
40
+ var BINI_LOGO = "\xDF";
41
+ var COLORS = {
42
+ CYAN: "\x1B[36m",
43
+ RESET: "\x1B[0m",
44
+ GREEN: "\x1B[32m",
45
+ YELLOW: "\x1B[33m",
46
+ DIM: "\x1B[2m"
47
+ };
48
+ function detectEnvFiles(projectRoot = process.cwd()) {
49
+ const nodeEnv = process.env.NODE_ENV || "development";
50
+ const envFiles = [
51
+ ".env.local",
52
+ `.env.${nodeEnv}.local`,
53
+ `.env.${nodeEnv}`,
54
+ ".env"
55
+ ];
56
+ const found = [];
57
+ for (const file of envFiles) {
58
+ const filePath = import_path.default.join(projectRoot, file);
59
+ if (import_fs.default.existsSync(filePath)) {
60
+ found.push({
61
+ name: file,
62
+ path: filePath
63
+ });
64
+ }
65
+ }
66
+ return found;
67
+ }
68
+ function formatEnvFilesForDisplay(envFiles) {
69
+ if (envFiles.length === 0) {
70
+ return "";
71
+ }
72
+ const envString = envFiles.map((f) => f.name).join(", ");
73
+ return `${COLORS.GREEN}\u2713${COLORS.RESET} Environments: ${envString}`;
74
+ }
75
+ function getModeLabel(command, isPreview = false) {
76
+ if (command === "build") {
77
+ return "(prod)";
78
+ } else if (command === "serve") {
79
+ if (isPreview) {
80
+ return "(preview)";
81
+ }
82
+ return "(dev)";
83
+ }
84
+ return "";
85
+ }
86
+ function clearLine() {
87
+ process.stdout.write("\x1B[2K\r");
88
+ }
89
+ function biniEnvPlugin(options = {}) {
90
+ const {
91
+ enabled = true,
92
+ clearViteHeader = true,
93
+ logo = BINI_LOGO,
94
+ showEnvironmentsInBuild = true
95
+ } = options;
96
+ let config;
97
+ let mode = "dev";
98
+ let isPreviewMode = false;
99
+ let serverStarted = false;
100
+ let previewStarted = false;
101
+ return {
102
+ name: "vite-plugin-bini-env",
103
+ // Apply plugin conditions
104
+ apply: "serve",
105
+ // Get resolved config
106
+ configResolved(resolvedConfig) {
107
+ config = resolvedConfig;
108
+ if (resolvedConfig.command === "build") {
109
+ mode = "prod";
110
+ } else if (resolvedConfig.command === "serve") {
111
+ isPreviewMode = process.env.VITE_PREVIEW === "true" || process.argv.includes("preview") || false;
112
+ mode = isPreviewMode ? "preview" : "dev";
113
+ }
114
+ },
115
+ // Configure server to modify the output
116
+ configureServer(server) {
117
+ if (!enabled) return;
118
+ const originalPrintUrls = server.printUrls;
119
+ server.printUrls = () => {
120
+ if (!serverStarted) {
121
+ serverStarted = true;
122
+ if (clearViteHeader) {
123
+ clearLine();
124
+ }
125
+ const modeLabel = getModeLabel("serve", isPreviewMode);
126
+ console.log(`
127
+ ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} ${modeLabel}`);
128
+ const found = detectEnvFiles(config.root);
129
+ if (found.length > 0) {
130
+ const envString = found.map((f) => f.name).join(", ");
131
+ console.log(` ${COLORS.GREEN}\u2713${COLORS.RESET} Environments: ${envString}`);
132
+ }
133
+ if (!clearViteHeader) {
134
+ originalPrintUrls.call(server);
135
+ } else {
136
+ const urls = server.resolvedUrls;
137
+ if (urls) {
138
+ if (urls.local.length > 0) {
139
+ console.log(` ${COLORS.GREEN}\u279C${COLORS.RESET} Local: ${COLORS.CYAN}${urls.local[0]}${COLORS.RESET}`);
140
+ }
141
+ if (urls.network.length > 0) {
142
+ console.log(` ${COLORS.GREEN}\u279C${COLORS.RESET} Network: ${COLORS.CYAN}${urls.network[0]}${COLORS.RESET}`);
143
+ }
144
+ }
145
+ }
146
+ }
147
+ };
148
+ },
149
+ // Handle preview mode
150
+ configurePreviewServer(server) {
151
+ if (!enabled) return;
152
+ isPreviewMode = true;
153
+ mode = "preview";
154
+ const originalPrintUrls = server.printUrls;
155
+ server.printUrls = () => {
156
+ if (!previewStarted) {
157
+ previewStarted = true;
158
+ if (clearViteHeader) {
159
+ clearLine();
160
+ }
161
+ console.log(`
162
+ ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} (preview)`);
163
+ const found = detectEnvFiles(config.root);
164
+ if (found.length > 0) {
165
+ const envString = found.map((f) => f.name).join(", ");
166
+ console.log(` ${COLORS.GREEN}\u2713${COLORS.RESET} Environments: ${envString}`);
167
+ }
168
+ if (!clearViteHeader) {
169
+ originalPrintUrls.call(server);
170
+ } else {
171
+ const urls = server.resolvedUrls;
172
+ if (urls) {
173
+ if (urls.local.length > 0) {
174
+ console.log(` ${COLORS.GREEN}\u279C${COLORS.RESET} Local: ${COLORS.CYAN}${urls.local[0]}${COLORS.RESET}`);
175
+ }
176
+ if (urls.network.length > 0) {
177
+ console.log(` ${COLORS.GREEN}\u279C${COLORS.RESET} Network: ${COLORS.CYAN}${urls.network[0]}${COLORS.RESET}`);
178
+ }
179
+ }
180
+ console.log("");
181
+ }
182
+ }
183
+ };
184
+ },
185
+ // Handle build
186
+ buildStart() {
187
+ if (enabled && showEnvironmentsInBuild && config?.command === "build") {
188
+ const found = detectEnvFiles(config.root);
189
+ if (found.length > 0) {
190
+ console.log(`
191
+ ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} (building)`);
192
+ const envString = found.map((f) => f.name).join(", ");
193
+ console.log(` ${COLORS.GREEN}\u2713${COLORS.RESET} Environments: ${envString}
194
+ `);
195
+ }
196
+ }
197
+ },
198
+ // Handle build completion
199
+ closeBundle() {
200
+ if (enabled && showEnvironmentsInBuild && config?.command === "build") {
201
+ console.log(`
202
+ ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} ${COLORS.GREEN}\u2713${COLORS.RESET} Build completed
203
+ `);
204
+ }
205
+ },
206
+ // Cleanup
207
+ buildEnd() {
208
+ serverStarted = false;
209
+ previewStarted = false;
210
+ }
211
+ };
212
+ }
213
+ // Annotate the CommonJS export names for ESM import in node:
214
+ 0 && (module.exports = {
215
+ detectEnvFiles,
216
+ formatEnvFilesForDisplay
217
+ });
218
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// src/index.ts\r\nimport fs from 'fs';\r\nimport path from 'path';\r\nimport type { Plugin, ResolvedConfig } from 'vite';\r\n\r\n// Types\r\nexport interface BiniEnvPluginOptions {\r\n /**\r\n * Enable/disable the plugin\r\n * @default true\r\n */\r\n enabled?: boolean;\r\n \r\n /**\r\n * Remove Vite's default header\r\n * @default true\r\n */\r\n clearViteHeader?: boolean;\r\n \r\n /**\r\n * Custom logo/text to display\r\n * @default 'ß'\r\n */\r\n logo?: string;\r\n \r\n /**\r\n * Show environments in production build\r\n * @default true\r\n */\r\n showEnvironmentsInBuild?: boolean;\r\n}\r\n\r\nexport interface DetectedEnvFile {\r\n name: string;\r\n path: string;\r\n}\r\n\r\n// Constants\r\nconst BINI_LOGO = 'ß';\r\n\r\n// Color definitions\r\nconst COLORS = {\r\n CYAN: '\\x1b[36m',\r\n RESET: '\\x1b[0m',\r\n GREEN: '\\x1b[32m',\r\n YELLOW: '\\x1b[33m',\r\n DIM: '\\x1b[2m'\r\n} as const;\r\n\r\n/**\r\n * Detect which .env files exist in project root\r\n */\r\nexport function detectEnvFiles(projectRoot: string = process.cwd()): DetectedEnvFile[] {\r\n const nodeEnv = process.env.NODE_ENV || 'development';\r\n\r\n // Check in priority order (what Next.js loads)\r\n const envFiles = [\r\n '.env.local',\r\n `.env.${nodeEnv}.local`,\r\n `.env.${nodeEnv}`,\r\n '.env'\r\n ];\r\n\r\n const found: DetectedEnvFile[] = [];\r\n\r\n for (const file of envFiles) {\r\n const filePath = path.join(projectRoot, file);\r\n if (fs.existsSync(filePath)) {\r\n found.push({\r\n name: file,\r\n path: filePath\r\n });\r\n }\r\n }\r\n\r\n return found;\r\n}\r\n\r\n/**\r\n * Format environment files for console display\r\n */\r\nexport function formatEnvFilesForDisplay(envFiles: DetectedEnvFile[]): string {\r\n if (envFiles.length === 0) {\r\n return '';\r\n }\r\n\r\n const envString = envFiles.map(f => f.name).join(', ');\r\n return `${COLORS.GREEN}✓${COLORS.RESET} Environments: ${envString}`;\r\n}\r\n\r\n/**\r\n * Get mode label based on command and mode\r\n */\r\nfunction getModeLabel(command: string, isPreview: boolean = false): string {\r\n if (command === 'build') {\r\n return '(prod)';\r\n } else if (command === 'serve') {\r\n if (isPreview) {\r\n return '(preview)';\r\n }\r\n return '(dev)';\r\n }\r\n return '';\r\n}\r\n\r\n/**\r\n * Clear the current line in console\r\n */\r\nfunction clearLine(): void {\r\n process.stdout.write('\\x1b[2K\\r');\r\n}\r\n\r\n/**\r\n * Main plugin function\r\n */\r\nexport default function biniEnvPlugin(options: BiniEnvPluginOptions = {}): Plugin {\r\n const {\r\n enabled = true,\r\n clearViteHeader = true,\r\n logo = BINI_LOGO,\r\n showEnvironmentsInBuild = true\r\n } = options;\r\n\r\n let config: ResolvedConfig;\r\n let mode: 'dev' | 'preview' | 'prod' = 'dev';\r\n let isPreviewMode = false;\r\n let serverStarted = false;\r\n let previewStarted = false;\r\n\r\n return {\r\n name: 'vite-plugin-bini-env',\r\n \r\n // Apply plugin conditions\r\n apply: 'serve',\r\n \r\n // Get resolved config\r\n configResolved(resolvedConfig: ResolvedConfig) {\r\n config = resolvedConfig;\r\n \r\n if (resolvedConfig.command === 'build') {\r\n mode = 'prod';\r\n } else if (resolvedConfig.command === 'serve') {\r\n isPreviewMode = process.env.VITE_PREVIEW === 'true' || \r\n process.argv.includes('preview') ||\r\n false;\r\n mode = isPreviewMode ? 'preview' : 'dev';\r\n }\r\n },\r\n\r\n // Configure server to modify the output\r\n configureServer(server) {\r\n if (!enabled) return;\r\n\r\n // Store original printUrls\r\n const originalPrintUrls = server.printUrls;\r\n \r\n // Override printUrls method\r\n server.printUrls = () => {\r\n if (!serverStarted) {\r\n serverStarted = true;\r\n \r\n if (clearViteHeader) {\r\n clearLine();\r\n }\r\n \r\n // SIMPLIFIED: Show only ß Bini.js (dev) without version\r\n const modeLabel = getModeLabel('serve', isPreviewMode);\r\n console.log(`\\n ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} ${modeLabel}`);\r\n\r\n // Show environments if found\r\n const found = detectEnvFiles(config.root);\r\n if (found.length > 0) {\r\n const envString = found.map(f => f.name).join(', ');\r\n console.log(` ${COLORS.GREEN}✓${COLORS.RESET} Environments: ${envString}`);\r\n }\r\n \r\n if (!clearViteHeader) {\r\n originalPrintUrls.call(server);\r\n } else {\r\n const urls = server.resolvedUrls;\r\n if (urls) {\r\n if (urls.local.length > 0) {\r\n console.log(` ${COLORS.GREEN}➜${COLORS.RESET} Local: ${COLORS.CYAN}${urls.local[0]}${COLORS.RESET}`);\r\n }\r\n if (urls.network.length > 0) {\r\n console.log(` ${COLORS.GREEN}➜${COLORS.RESET} Network: ${COLORS.CYAN}${urls.network[0]}${COLORS.RESET}`);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n },\r\n\r\n // Handle preview mode\r\n configurePreviewServer(server) {\r\n if (!enabled) return;\r\n \r\n isPreviewMode = true;\r\n mode = 'preview';\r\n \r\n const originalPrintUrls = server.printUrls;\r\n \r\n server.printUrls = () => {\r\n if (!previewStarted) {\r\n previewStarted = true;\r\n \r\n if (clearViteHeader) {\r\n clearLine();\r\n }\r\n \r\n // SIMPLIFIED: Show only ß Bini.js (preview) without version\r\n console.log(`\\n ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} (preview)`);\r\n\r\n const found = detectEnvFiles(config.root);\r\n if (found.length > 0) {\r\n const envString = found.map(f => f.name).join(', ');\r\n console.log(` ${COLORS.GREEN}✓${COLORS.RESET} Environments: ${envString}`);\r\n }\r\n \r\n if (!clearViteHeader) {\r\n originalPrintUrls.call(server);\r\n } else {\r\n const urls = server.resolvedUrls;\r\n if (urls) {\r\n if (urls.local.length > 0) {\r\n console.log(` ${COLORS.GREEN}➜${COLORS.RESET} Local: ${COLORS.CYAN}${urls.local[0]}${COLORS.RESET}`);\r\n }\r\n if (urls.network.length > 0) {\r\n console.log(` ${COLORS.GREEN}➜${COLORS.RESET} Network: ${COLORS.CYAN}${urls.network[0]}${COLORS.RESET}`);\r\n }\r\n }\r\n console.log('');\r\n }\r\n }\r\n };\r\n },\r\n\r\n // Handle build\r\n buildStart() {\r\n if (enabled && showEnvironmentsInBuild && config?.command === 'build') {\r\n const found = detectEnvFiles(config.root);\r\n if (found.length > 0) {\r\n // SIMPLIFIED: Show only ß Bini.js (building) without version\r\n console.log(`\\n ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} (building)`);\r\n const envString = found.map(f => f.name).join(', ');\r\n console.log(` ${COLORS.GREEN}✓${COLORS.RESET} Environments: ${envString}\\n`);\r\n }\r\n }\r\n },\r\n\r\n // Handle build completion\r\n closeBundle() {\r\n if (enabled && showEnvironmentsInBuild && config?.command === 'build') {\r\n // SIMPLIFIED: Show only ß Bini.js ✓ Build completed without version\r\n console.log(`\\n ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} ${COLORS.GREEN}✓${COLORS.RESET} Build completed\\n`);\r\n }\r\n },\r\n\r\n // Cleanup\r\n buildEnd() {\r\n serverStarted = false;\r\n previewStarted = false;\r\n }\r\n };\r\n}\r\n\r\n// Export types\r\nexport type { Plugin } from 'vite';"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gBAAe;AACf,kBAAiB;AAoCjB,IAAM,YAAY;AAGlB,IAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AACP;AAKO,SAAS,eAAe,cAAsB,QAAQ,IAAI,GAAsB;AACrF,QAAM,UAAU,QAAQ,IAAI,YAAY;AAGxC,QAAM,WAAW;AAAA,IACf;AAAA,IACA,QAAQ,OAAO;AAAA,IACf,QAAQ,OAAO;AAAA,IACf;AAAA,EACF;AAEA,QAAM,QAA2B,CAAC;AAElC,aAAW,QAAQ,UAAU;AAC3B,UAAM,WAAW,YAAAA,QAAK,KAAK,aAAa,IAAI;AAC5C,QAAI,UAAAC,QAAG,WAAW,QAAQ,GAAG;AAC3B,YAAM,KAAK;AAAA,QACT,MAAM;AAAA,QACN,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;AAKO,SAA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,IAAI,OAAO,KAAK,SAAI,OAAO,KAAK;AAAA,CAAoB;AAAA,MAClH;AAAA,IACF;AAAA;AAAA,IAGA,WAAW;AACT,sBAAgB;AAChB,uBAAiB;AAAA,IACnB;AAAA,EACF;AACF;","names":["path","fs"]}
@@ -0,0 +1,43 @@
1
+ import { Plugin } from 'vite';
2
+ export { Plugin } from 'vite';
3
+
4
+ interface BiniEnvPluginOptions {
5
+ /**
6
+ * Enable/disable the plugin
7
+ * @default true
8
+ */
9
+ enabled?: boolean;
10
+ /**
11
+ * Remove Vite's default header
12
+ * @default true
13
+ */
14
+ clearViteHeader?: boolean;
15
+ /**
16
+ * Custom logo/text to display
17
+ * @default 'ß'
18
+ */
19
+ logo?: string;
20
+ /**
21
+ * Show environments in production build
22
+ * @default true
23
+ */
24
+ showEnvironmentsInBuild?: boolean;
25
+ }
26
+ interface DetectedEnvFile {
27
+ name: string;
28
+ path: string;
29
+ }
30
+ /**
31
+ * Detect which .env files exist in project root
32
+ */
33
+ declare function detectEnvFiles(projectRoot?: string): DetectedEnvFile[];
34
+ /**
35
+ * Format environment files for console display
36
+ */
37
+ declare function formatEnvFilesForDisplay(envFiles: DetectedEnvFile[]): string;
38
+ /**
39
+ * Main plugin function
40
+ */
41
+ declare function biniEnvPlugin(options?: BiniEnvPluginOptions): Plugin;
42
+
43
+ export { type BiniEnvPluginOptions, type DetectedEnvFile, biniEnvPlugin as default, detectEnvFiles, formatEnvFilesForDisplay };
@@ -0,0 +1,43 @@
1
+ import { Plugin } from 'vite';
2
+ export { Plugin } from 'vite';
3
+
4
+ interface BiniEnvPluginOptions {
5
+ /**
6
+ * Enable/disable the plugin
7
+ * @default true
8
+ */
9
+ enabled?: boolean;
10
+ /**
11
+ * Remove Vite's default header
12
+ * @default true
13
+ */
14
+ clearViteHeader?: boolean;
15
+ /**
16
+ * Custom logo/text to display
17
+ * @default 'ß'
18
+ */
19
+ logo?: string;
20
+ /**
21
+ * Show environments in production build
22
+ * @default true
23
+ */
24
+ showEnvironmentsInBuild?: boolean;
25
+ }
26
+ interface DetectedEnvFile {
27
+ name: string;
28
+ path: string;
29
+ }
30
+ /**
31
+ * Detect which .env files exist in project root
32
+ */
33
+ declare function detectEnvFiles(projectRoot?: string): DetectedEnvFile[];
34
+ /**
35
+ * Format environment files for console display
36
+ */
37
+ declare function formatEnvFilesForDisplay(envFiles: DetectedEnvFile[]): string;
38
+ /**
39
+ * Main plugin function
40
+ */
41
+ declare function biniEnvPlugin(options?: BiniEnvPluginOptions): Plugin;
42
+
43
+ export { type BiniEnvPluginOptions, type DetectedEnvFile, biniEnvPlugin as default, detectEnvFiles, formatEnvFilesForDisplay };
package/dist/index.js ADDED
@@ -0,0 +1,182 @@
1
+ // src/index.ts
2
+ import fs from "fs";
3
+ import path from "path";
4
+ var BINI_LOGO = "\xDF";
5
+ var COLORS = {
6
+ CYAN: "\x1B[36m",
7
+ RESET: "\x1B[0m",
8
+ GREEN: "\x1B[32m",
9
+ YELLOW: "\x1B[33m",
10
+ DIM: "\x1B[2m"
11
+ };
12
+ function detectEnvFiles(projectRoot = process.cwd()) {
13
+ const nodeEnv = process.env.NODE_ENV || "development";
14
+ const envFiles = [
15
+ ".env.local",
16
+ `.env.${nodeEnv}.local`,
17
+ `.env.${nodeEnv}`,
18
+ ".env"
19
+ ];
20
+ const found = [];
21
+ for (const file of envFiles) {
22
+ const filePath = path.join(projectRoot, file);
23
+ if (fs.existsSync(filePath)) {
24
+ found.push({
25
+ name: file,
26
+ path: filePath
27
+ });
28
+ }
29
+ }
30
+ return found;
31
+ }
32
+ function formatEnvFilesForDisplay(envFiles) {
33
+ if (envFiles.length === 0) {
34
+ return "";
35
+ }
36
+ const envString = envFiles.map((f) => f.name).join(", ");
37
+ return `${COLORS.GREEN}\u2713${COLORS.RESET} Environments: ${envString}`;
38
+ }
39
+ function getModeLabel(command, isPreview = false) {
40
+ if (command === "build") {
41
+ return "(prod)";
42
+ } else if (command === "serve") {
43
+ if (isPreview) {
44
+ return "(preview)";
45
+ }
46
+ return "(dev)";
47
+ }
48
+ return "";
49
+ }
50
+ function clearLine() {
51
+ process.stdout.write("\x1B[2K\r");
52
+ }
53
+ function biniEnvPlugin(options = {}) {
54
+ const {
55
+ enabled = true,
56
+ clearViteHeader = true,
57
+ logo = BINI_LOGO,
58
+ showEnvironmentsInBuild = true
59
+ } = options;
60
+ let config;
61
+ let mode = "dev";
62
+ let isPreviewMode = false;
63
+ let serverStarted = false;
64
+ let previewStarted = false;
65
+ return {
66
+ name: "vite-plugin-bini-env",
67
+ // Apply plugin conditions
68
+ apply: "serve",
69
+ // Get resolved config
70
+ configResolved(resolvedConfig) {
71
+ config = resolvedConfig;
72
+ if (resolvedConfig.command === "build") {
73
+ mode = "prod";
74
+ } else if (resolvedConfig.command === "serve") {
75
+ isPreviewMode = process.env.VITE_PREVIEW === "true" || process.argv.includes("preview") || false;
76
+ mode = isPreviewMode ? "preview" : "dev";
77
+ }
78
+ },
79
+ // Configure server to modify the output
80
+ configureServer(server) {
81
+ if (!enabled) return;
82
+ const originalPrintUrls = server.printUrls;
83
+ server.printUrls = () => {
84
+ if (!serverStarted) {
85
+ serverStarted = true;
86
+ if (clearViteHeader) {
87
+ clearLine();
88
+ }
89
+ const modeLabel = getModeLabel("serve", isPreviewMode);
90
+ console.log(`
91
+ ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} ${modeLabel}`);
92
+ const found = detectEnvFiles(config.root);
93
+ if (found.length > 0) {
94
+ const envString = found.map((f) => f.name).join(", ");
95
+ console.log(` ${COLORS.GREEN}\u2713${COLORS.RESET} Environments: ${envString}`);
96
+ }
97
+ if (!clearViteHeader) {
98
+ originalPrintUrls.call(server);
99
+ } else {
100
+ const urls = server.resolvedUrls;
101
+ if (urls) {
102
+ if (urls.local.length > 0) {
103
+ console.log(` ${COLORS.GREEN}\u279C${COLORS.RESET} Local: ${COLORS.CYAN}${urls.local[0]}${COLORS.RESET}`);
104
+ }
105
+ if (urls.network.length > 0) {
106
+ console.log(` ${COLORS.GREEN}\u279C${COLORS.RESET} Network: ${COLORS.CYAN}${urls.network[0]}${COLORS.RESET}`);
107
+ }
108
+ }
109
+ }
110
+ }
111
+ };
112
+ },
113
+ // Handle preview mode
114
+ configurePreviewServer(server) {
115
+ if (!enabled) return;
116
+ isPreviewMode = true;
117
+ mode = "preview";
118
+ const originalPrintUrls = server.printUrls;
119
+ server.printUrls = () => {
120
+ if (!previewStarted) {
121
+ previewStarted = true;
122
+ if (clearViteHeader) {
123
+ clearLine();
124
+ }
125
+ console.log(`
126
+ ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} (preview)`);
127
+ const found = detectEnvFiles(config.root);
128
+ if (found.length > 0) {
129
+ const envString = found.map((f) => f.name).join(", ");
130
+ console.log(` ${COLORS.GREEN}\u2713${COLORS.RESET} Environments: ${envString}`);
131
+ }
132
+ if (!clearViteHeader) {
133
+ originalPrintUrls.call(server);
134
+ } else {
135
+ const urls = server.resolvedUrls;
136
+ if (urls) {
137
+ if (urls.local.length > 0) {
138
+ console.log(` ${COLORS.GREEN}\u279C${COLORS.RESET} Local: ${COLORS.CYAN}${urls.local[0]}${COLORS.RESET}`);
139
+ }
140
+ if (urls.network.length > 0) {
141
+ console.log(` ${COLORS.GREEN}\u279C${COLORS.RESET} Network: ${COLORS.CYAN}${urls.network[0]}${COLORS.RESET}`);
142
+ }
143
+ }
144
+ console.log("");
145
+ }
146
+ }
147
+ };
148
+ },
149
+ // Handle build
150
+ buildStart() {
151
+ if (enabled && showEnvironmentsInBuild && config?.command === "build") {
152
+ const found = detectEnvFiles(config.root);
153
+ if (found.length > 0) {
154
+ console.log(`
155
+ ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} (building)`);
156
+ const envString = found.map((f) => f.name).join(", ");
157
+ console.log(` ${COLORS.GREEN}\u2713${COLORS.RESET} Environments: ${envString}
158
+ `);
159
+ }
160
+ }
161
+ },
162
+ // Handle build completion
163
+ closeBundle() {
164
+ if (enabled && showEnvironmentsInBuild && config?.command === "build") {
165
+ console.log(`
166
+ ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} ${COLORS.GREEN}\u2713${COLORS.RESET} Build completed
167
+ `);
168
+ }
169
+ },
170
+ // Cleanup
171
+ buildEnd() {
172
+ serverStarted = false;
173
+ previewStarted = false;
174
+ }
175
+ };
176
+ }
177
+ export {
178
+ biniEnvPlugin as default,
179
+ detectEnvFiles,
180
+ formatEnvFilesForDisplay
181
+ };
182
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// src/index.ts\r\nimport fs from 'fs';\r\nimport path from 'path';\r\nimport type { Plugin, ResolvedConfig } from 'vite';\r\n\r\n// Types\r\nexport interface BiniEnvPluginOptions {\r\n /**\r\n * Enable/disable the plugin\r\n * @default true\r\n */\r\n enabled?: boolean;\r\n \r\n /**\r\n * Remove Vite's default header\r\n * @default true\r\n */\r\n clearViteHeader?: boolean;\r\n \r\n /**\r\n * Custom logo/text to display\r\n * @default 'ß'\r\n */\r\n logo?: string;\r\n \r\n /**\r\n * Show environments in production build\r\n * @default true\r\n */\r\n showEnvironmentsInBuild?: boolean;\r\n}\r\n\r\nexport interface DetectedEnvFile {\r\n name: string;\r\n path: string;\r\n}\r\n\r\n// Constants\r\nconst BINI_LOGO = 'ß';\r\n\r\n// Color definitions\r\nconst COLORS = {\r\n CYAN: '\\x1b[36m',\r\n RESET: '\\x1b[0m',\r\n GREEN: '\\x1b[32m',\r\n YELLOW: '\\x1b[33m',\r\n DIM: '\\x1b[2m'\r\n} as const;\r\n\r\n/**\r\n * Detect which .env files exist in project root\r\n */\r\nexport function detectEnvFiles(projectRoot: string = process.cwd()): DetectedEnvFile[] {\r\n const nodeEnv = process.env.NODE_ENV || 'development';\r\n\r\n // Check in priority order (what Next.js loads)\r\n const envFiles = [\r\n '.env.local',\r\n `.env.${nodeEnv}.local`,\r\n `.env.${nodeEnv}`,\r\n '.env'\r\n ];\r\n\r\n const found: DetectedEnvFile[] = [];\r\n\r\n for (const file of envFiles) {\r\n const filePath = path.join(projectRoot, file);\r\n if (fs.existsSync(filePath)) {\r\n found.push({\r\n name: file,\r\n path: filePath\r\n });\r\n }\r\n }\r\n\r\n return found;\r\n}\r\n\r\n/**\r\n * Format environment files for console display\r\n */\r\nexport function formatEnvFilesForDisplay(envFiles: DetectedEnvFile[]): string {\r\n if (envFiles.length === 0) {\r\n return '';\r\n }\r\n\r\n const envString = envFiles.map(f => f.name).join(', ');\r\n return `${COLORS.GREEN}✓${COLORS.RESET} Environments: ${envString}`;\r\n}\r\n\r\n/**\r\n * Get mode label based on command and mode\r\n */\r\nfunction getModeLabel(command: string, isPreview: boolean = false): string {\r\n if (command === 'build') {\r\n return '(prod)';\r\n } else if (command === 'serve') {\r\n if (isPreview) {\r\n return '(preview)';\r\n }\r\n return '(dev)';\r\n }\r\n return '';\r\n}\r\n\r\n/**\r\n * Clear the current line in console\r\n */\r\nfunction clearLine(): void {\r\n process.stdout.write('\\x1b[2K\\r');\r\n}\r\n\r\n/**\r\n * Main plugin function\r\n */\r\nexport default function biniEnvPlugin(options: BiniEnvPluginOptions = {}): Plugin {\r\n const {\r\n enabled = true,\r\n clearViteHeader = true,\r\n logo = BINI_LOGO,\r\n showEnvironmentsInBuild = true\r\n } = options;\r\n\r\n let config: ResolvedConfig;\r\n let mode: 'dev' | 'preview' | 'prod' = 'dev';\r\n let isPreviewMode = false;\r\n let serverStarted = false;\r\n let previewStarted = false;\r\n\r\n return {\r\n name: 'vite-plugin-bini-env',\r\n \r\n // Apply plugin conditions\r\n apply: 'serve',\r\n \r\n // Get resolved config\r\n configResolved(resolvedConfig: ResolvedConfig) {\r\n config = resolvedConfig;\r\n \r\n if (resolvedConfig.command === 'build') {\r\n mode = 'prod';\r\n } else if (resolvedConfig.command === 'serve') {\r\n isPreviewMode = process.env.VITE_PREVIEW === 'true' || \r\n process.argv.includes('preview') ||\r\n false;\r\n mode = isPreviewMode ? 'preview' : 'dev';\r\n }\r\n },\r\n\r\n // Configure server to modify the output\r\n configureServer(server) {\r\n if (!enabled) return;\r\n\r\n // Store original printUrls\r\n const originalPrintUrls = server.printUrls;\r\n \r\n // Override printUrls method\r\n server.printUrls = () => {\r\n if (!serverStarted) {\r\n serverStarted = true;\r\n \r\n if (clearViteHeader) {\r\n clearLine();\r\n }\r\n \r\n // SIMPLIFIED: Show only ß Bini.js (dev) without version\r\n const modeLabel = getModeLabel('serve', isPreviewMode);\r\n console.log(`\\n ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} ${modeLabel}`);\r\n\r\n // Show environments if found\r\n const found = detectEnvFiles(config.root);\r\n if (found.length > 0) {\r\n const envString = found.map(f => f.name).join(', ');\r\n console.log(` ${COLORS.GREEN}✓${COLORS.RESET} Environments: ${envString}`);\r\n }\r\n \r\n if (!clearViteHeader) {\r\n originalPrintUrls.call(server);\r\n } else {\r\n const urls = server.resolvedUrls;\r\n if (urls) {\r\n if (urls.local.length > 0) {\r\n console.log(` ${COLORS.GREEN}➜${COLORS.RESET} Local: ${COLORS.CYAN}${urls.local[0]}${COLORS.RESET}`);\r\n }\r\n if (urls.network.length > 0) {\r\n console.log(` ${COLORS.GREEN}➜${COLORS.RESET} Network: ${COLORS.CYAN}${urls.network[0]}${COLORS.RESET}`);\r\n }\r\n }\r\n }\r\n }\r\n };\r\n },\r\n\r\n // Handle preview mode\r\n configurePreviewServer(server) {\r\n if (!enabled) return;\r\n \r\n isPreviewMode = true;\r\n mode = 'preview';\r\n \r\n const originalPrintUrls = server.printUrls;\r\n \r\n server.printUrls = () => {\r\n if (!previewStarted) {\r\n previewStarted = true;\r\n \r\n if (clearViteHeader) {\r\n clearLine();\r\n }\r\n \r\n // SIMPLIFIED: Show only ß Bini.js (preview) without version\r\n console.log(`\\n ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} (preview)`);\r\n\r\n const found = detectEnvFiles(config.root);\r\n if (found.length > 0) {\r\n const envString = found.map(f => f.name).join(', ');\r\n console.log(` ${COLORS.GREEN}✓${COLORS.RESET} Environments: ${envString}`);\r\n }\r\n \r\n if (!clearViteHeader) {\r\n originalPrintUrls.call(server);\r\n } else {\r\n const urls = server.resolvedUrls;\r\n if (urls) {\r\n if (urls.local.length > 0) {\r\n console.log(` ${COLORS.GREEN}➜${COLORS.RESET} Local: ${COLORS.CYAN}${urls.local[0]}${COLORS.RESET}`);\r\n }\r\n if (urls.network.length > 0) {\r\n console.log(` ${COLORS.GREEN}➜${COLORS.RESET} Network: ${COLORS.CYAN}${urls.network[0]}${COLORS.RESET}`);\r\n }\r\n }\r\n console.log('');\r\n }\r\n }\r\n };\r\n },\r\n\r\n // Handle build\r\n buildStart() {\r\n if (enabled && showEnvironmentsInBuild && config?.command === 'build') {\r\n const found = detectEnvFiles(config.root);\r\n if (found.length > 0) {\r\n // SIMPLIFIED: Show only ß Bini.js (building) without version\r\n console.log(`\\n ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} (building)`);\r\n const envString = found.map(f => f.name).join(', ');\r\n console.log(` ${COLORS.GREEN}✓${COLORS.RESET} Environments: ${envString}\\n`);\r\n }\r\n }\r\n },\r\n\r\n // Handle build completion\r\n closeBundle() {\r\n if (enabled && showEnvironmentsInBuild && config?.command === 'build') {\r\n // SIMPLIFIED: Show only ß Bini.js ✓ Build completed without version\r\n console.log(`\\n ${COLORS.CYAN}${logo} Bini.js${COLORS.RESET} ${COLORS.GREEN}✓${COLORS.RESET} Build completed\\n`);\r\n }\r\n },\r\n\r\n // Cleanup\r\n buildEnd() {\r\n serverStarted = false;\r\n previewStarted = false;\r\n }\r\n };\r\n}\r\n\r\n// Export types\r\nexport type { Plugin } from 'vite';"],"mappings":";AACA,OAAO,QAAQ;AACf,OAAO,UAAU;AAoCjB,IAAM,YAAY;AAGlB,IAAM,SAAS;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AACP;AAKO,SAAS,eAAe,cAAsB,QAAQ,IAA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,IAAI;AAAA,IAAO,OAAO,IAAI,GAAG,IAAI,WAAW,OAAO,KAAK,aAAa;AACzE,gBAAM,YAAY,MAAM,IAAI,OAAK,EAAE,IAAI,EAAE,KAAK,IAAI;AAClD,kBAAQ,IAAI,KAAK,OAAO,KAAK,SAAI,OAAO,KAAK,kBAAkB,SAAS;AAAA,CAAI;AAAA,QAC9E;AAAA,MACF;AAAA,IACF;AAAA;AAAA,IAGA,cAAc;AACZ,UAAI,WAAW,2BAA2B,QAAQ,YAAY,SAAS;AAErE,gBAAQ,IAAI;AAAA,IAAO,OAAO,IAAI,GAAG,IAAI,WAAW,OAAO,KAAK,IAAI,OAAO,KAAK,SAAI,OAAO,KAAK;AAAA,CAAoB;AAAA,MAClH;AAAA,IACF;AAAA;AAAA,IAGA,WAAW;AACT,sBAAgB;AAChB,uBAAiB;AAAA,IACnB;AAAA,EACF;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "bini-env",
3
+ "version": "1.0.0",
4
+ "description": "Vite plugin for Bini.js environment display",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "keywords": [
21
+ "vite",
22
+ "vite-plugin",
23
+ "bini.js",
24
+ "bini",
25
+ "environment",
26
+ "env",
27
+ "dotenv"
28
+ ],
29
+ "author": "Bini.js Team",
30
+ "license": "MIT",
31
+ "peerDependencies": {
32
+ "vite": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^22.15.3",
36
+ "tsup": "^8.4.0",
37
+ "typescript": "^5.8.3",
38
+ "vite": "^6.3.4"
39
+ },
40
+ "tsup": {
41
+ "entry": [
42
+ "src/index.ts"
43
+ ],
44
+ "format": [
45
+ "cjs",
46
+ "esm"
47
+ ],
48
+ "dts": true,
49
+ "clean": true,
50
+ "splitting": false,
51
+ "sourcemap": true,
52
+ "minify": false
53
+ },
54
+ "engines": {
55
+ "node": ">=18.0.0"
56
+ },
57
+ "scripts": {
58
+ "build": "tsup",
59
+ "dev": "tsup --watch"
60
+ }
61
+ }