bini-server 1.0.1 → 1.0.2
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/cli.js +15 -3
- package/dist/index.js +15 -3
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -11,6 +11,21 @@ import { pathToFileURL } from "url";
|
|
|
11
11
|
import { pipeline } from "stream/promises";
|
|
12
12
|
import { createReadStream } from "fs";
|
|
13
13
|
import { loadEnv, detectEnvFiles } from "bini-env";
|
|
14
|
+
process.env.NODE_ENV = "production";
|
|
15
|
+
(function suppressDotenv() {
|
|
16
|
+
const _log = console.log.bind(console);
|
|
17
|
+
const _err = console.error.bind(console);
|
|
18
|
+
const isDotenv = (...args) => {
|
|
19
|
+
const msg = args.join(" ");
|
|
20
|
+
return msg.includes("[dotenv@") || msg.includes("[bini-env] Loaded");
|
|
21
|
+
};
|
|
22
|
+
console.log = (...args) => {
|
|
23
|
+
if (!isDotenv(...args)) _log(...args);
|
|
24
|
+
};
|
|
25
|
+
console.error = (...args) => {
|
|
26
|
+
if (!isDotenv(...args)) _err(...args);
|
|
27
|
+
};
|
|
28
|
+
})();
|
|
14
29
|
var DEFAULT_PORT = parseInt(process.env.PORT ?? "3000", 10);
|
|
15
30
|
var API_DIR = path.join(process.cwd(), process.env.BINI_API_DIR ?? "src/app/api");
|
|
16
31
|
var DIST_DIR = path.join(process.cwd(), process.env.BINI_DIST_DIR ?? "dist");
|
|
@@ -408,9 +423,6 @@ async function start() {
|
|
|
408
423
|
printBanner(port);
|
|
409
424
|
});
|
|
410
425
|
function shutdown() {
|
|
411
|
-
console.log(`
|
|
412
|
-
${C.YELLOW}\u26A0${C.RESET} Shutting down...
|
|
413
|
-
`);
|
|
414
426
|
server.close(() => process.exit(0));
|
|
415
427
|
setTimeout(() => process.exit(1), 1e4).unref();
|
|
416
428
|
}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,21 @@ import { pathToFileURL } from "url";
|
|
|
9
9
|
import { pipeline } from "stream/promises";
|
|
10
10
|
import { createReadStream } from "fs";
|
|
11
11
|
import { loadEnv, detectEnvFiles } from "bini-env";
|
|
12
|
+
process.env.NODE_ENV = "production";
|
|
13
|
+
(function suppressDotenv() {
|
|
14
|
+
const _log = console.log.bind(console);
|
|
15
|
+
const _err = console.error.bind(console);
|
|
16
|
+
const isDotenv = (...args) => {
|
|
17
|
+
const msg = args.join(" ");
|
|
18
|
+
return msg.includes("[dotenv@") || msg.includes("[bini-env] Loaded");
|
|
19
|
+
};
|
|
20
|
+
console.log = (...args) => {
|
|
21
|
+
if (!isDotenv(...args)) _log(...args);
|
|
22
|
+
};
|
|
23
|
+
console.error = (...args) => {
|
|
24
|
+
if (!isDotenv(...args)) _err(...args);
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
12
27
|
var DEFAULT_PORT = parseInt(process.env.PORT ?? "3000", 10);
|
|
13
28
|
var API_DIR = path.join(process.cwd(), process.env.BINI_API_DIR ?? "src/app/api");
|
|
14
29
|
var DIST_DIR = path.join(process.cwd(), process.env.BINI_DIST_DIR ?? "dist");
|
|
@@ -406,9 +421,6 @@ async function start() {
|
|
|
406
421
|
printBanner(port);
|
|
407
422
|
});
|
|
408
423
|
function shutdown() {
|
|
409
|
-
console.log(`
|
|
410
|
-
${C.YELLOW}\u26A0${C.RESET} Shutting down...
|
|
411
|
-
`);
|
|
412
424
|
server.close(() => process.exit(0));
|
|
413
425
|
setTimeout(() => process.exit(1), 1e4).unref();
|
|
414
426
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bini-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Zero-dependency production server for bini-router apps — static files, API routes, SPA fallback",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/node": "^25",
|
|
62
|
-
"bini-env" : "^1.0.
|
|
62
|
+
"bini-env" : "^1.0.8",
|
|
63
63
|
"tsup" : "^8",
|
|
64
64
|
"typescript" : "^5"
|
|
65
65
|
}
|