babelgate 1.1.0 → 1.1.1

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.
@@ -9,7 +9,7 @@ exports.resetConfig = resetConfig;
9
9
  const dotenv_1 = __importDefault(require("dotenv"));
10
10
  const model_map_1 = require("../utils/model-map");
11
11
  const errors_1 = require("../utils/errors");
12
- dotenv_1.default.config();
12
+ dotenv_1.default.config({ quiet: true });
13
13
  const VALID_PROVIDERS = ["openai", "gemini", "ollama", "anthropic"];
14
14
  function isValidProvider(value) {
15
15
  return VALID_PROVIDERS.includes(value.toLowerCase());
@@ -4,18 +4,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.logger = void 0;
7
+ exports.loggerOptions = loggerOptions;
7
8
  const pino_1 = __importDefault(require("pino"));
8
- const isProduction = process.env.NODE_ENV === "production";
9
- exports.logger = (0, pino_1.default)({
10
- level: process.env.LOG_LEVEL || (isProduction ? "info" : "debug"),
11
- transport: isProduction
12
- ? undefined
13
- : {
14
- target: "pino-pretty",
15
- options: {
16
- colorize: true,
17
- translateTime: "SYS:standard",
18
- ignore: "pid,hostname",
19
- },
20
- },
21
- });
9
+ function canResolvePinoPretty() {
10
+ try {
11
+ require.resolve("pino-pretty");
12
+ return true;
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }
18
+ function loggerOptions(env, canResolve) {
19
+ const isProduction = env.NODE_ENV === "production";
20
+ return {
21
+ level: env.LOG_LEVEL || (isProduction ? "info" : "debug"),
22
+ transport: !isProduction && canResolve()
23
+ ? {
24
+ target: "pino-pretty",
25
+ options: {
26
+ colorize: true,
27
+ translateTime: "SYS:standard",
28
+ ignore: "pid,hostname",
29
+ },
30
+ }
31
+ : undefined,
32
+ };
33
+ }
34
+ exports.logger = (0, pino_1.default)(loggerOptions(process.env, canResolvePinoPretty));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babelgate",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "bin": {
5
5
  "babelgate": "dist/cli.js"
6
6
  },
@@ -18,7 +18,8 @@
18
18
  "test": "vitest run",
19
19
  "record:streams": "ts-node -r dotenv/config scripts/record-streams.ts",
20
20
  "test:live": "vitest run --config vitest.live.config.ts",
21
- "test:watch": "vitest"
21
+ "test:watch": "vitest",
22
+ "prepublishOnly": "./scripts/check.sh"
22
23
  },
23
24
  "keywords": [],
24
25
  "author": "Dorrabb Khan",