@lobb-js/studio 0.7.3 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobb-js/studio",
3
- "version": "0.7.3",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,11 +1,13 @@
1
1
  import { contextualLibAlias } from "./contextual-lib-alias.js";
2
2
  import { lobbWorkspaceOptimize } from "./monorepo-workspace.js";
3
3
  import { lobbExtensionsPlugin } from "./lobb-extensions.js";
4
+ import { lobbProxyPlugin } from "./lobb-proxy.js";
4
5
 
5
6
  export function lobbStudioPlugins() {
6
7
  return [
7
8
  contextualLibAlias(),
8
9
  lobbWorkspaceOptimize(),
9
10
  lobbExtensionsPlugin(),
11
+ lobbProxyPlugin(),
10
12
  ];
11
13
  }
@@ -0,0 +1,36 @@
1
+ import { createLogger } from "vite";
2
+
3
+ export function lobbProxyPlugin() {
4
+ return {
5
+ name: "lobb-proxy",
6
+ apply: "serve",
7
+ config() {
8
+ const port = parseInt(process.env.LOBB_PORT ?? "3000", 10);
9
+ const config = {
10
+ server: {
11
+ printUrls: false,
12
+ proxy: {
13
+ "/api": {
14
+ target: `http://localhost:${port}`,
15
+ changeOrigin: true,
16
+ ws: true,
17
+ },
18
+ },
19
+ },
20
+ };
21
+ if (process.env.LOBB_PORT) {
22
+ // Suppress Vite's startup banner — Lobb prints its own URL instead.
23
+ // ANSI codes are stripped before matching so color doesn't interfere.
24
+ const logger = createLogger();
25
+ const originalInfo = logger.info.bind(logger);
26
+ logger.info = (msg, options) => {
27
+ const plain = msg.replace(/\x1b\[[0-9;]*m/g, "");
28
+ if (plain.includes("ready in") || plain.trim().startsWith("➜")) return;
29
+ originalInfo(msg, options);
30
+ };
31
+ config.customLogger = logger;
32
+ }
33
+ return config;
34
+ },
35
+ };
36
+ }