vease 1.55.0-rc.4 → 1.55.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.
@@ -1,3 +1,4 @@
1
+ import { logBrowserConsole } from "../../../utils/browser_console.js";
1
2
  import { expect } from "@playwright/test";
2
3
  import { isWindows } from "std-env";
3
4
  import { consola } from "consola";
@@ -179,7 +180,7 @@ async function navigateToApp(mode, launchBrowser) {
179
180
  const browser = await launchBrowser();
180
181
  const page = await newBrowserPage(browser);
181
182
  page.on("console", (msg) => {
182
- consola.info(`Browser console: ${msg.text()}`);
183
+ logBrowserConsole(msg.type(), msg.text(), "Browser console: ");
183
184
  });
184
185
  if (mode === "BROWSER") {
185
186
  const nuxtPort = await runBrowser("preview:browser");
@@ -0,0 +1,28 @@
1
+ import { consola } from "consola";
2
+ //#region utils/browser_console.ts
3
+ const CONSOLA_BADGE = /^%c(?<badge>[^%]*)%c (?<text>.*)$/su;
4
+ const CONSOLA_STYLE = /\s*background: [^;]+;\s*border-radius: 0\.5em;\s*color: white;\s*font-weight: bold;\s*padding: 2px 0\.5em;\s*/gu;
5
+ const BROWSER_LEVELS = {
6
+ debug: "debug",
7
+ error: "error",
8
+ warning: "warn"
9
+ };
10
+ function isLogType(value) {
11
+ return value in consola.options.types;
12
+ }
13
+ function logBrowserConsole(level, message, prefix = "") {
14
+ const fallbackType = BROWSER_LEVELS[level] ?? "info";
15
+ const match = CONSOLA_BADGE.exec(message);
16
+ if (!match?.groups) {
17
+ consola[fallbackType](`${prefix}${message}`);
18
+ return;
19
+ }
20
+ const text = (match.groups.text ?? "").replaceAll(CONSOLA_STYLE, " ").trim();
21
+ const parts = (match.groups.badge ?? "").split(":");
22
+ const last = parts.at(-1) ?? "";
23
+ const type = isLogType(last) ? last : fallbackType;
24
+ const tag = (isLogType(last) ? parts.slice(0, -1) : parts).join(":");
25
+ (tag ? consola.withTag(tag) : consola)[type](`${prefix}${text}`);
26
+ }
27
+ //#endregion
28
+ export { logBrowserConsole };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vease",
3
- "version": "1.55.0-rc.4",
3
+ "version": "1.55.0",
4
4
  "description": "Desktop and cloud software for data visualization",
5
5
  "keywords": [
6
6
  "Desktop",
@@ -22,6 +22,8 @@
22
22
  "files": [
23
23
  "tests/e2e/utils",
24
24
  ".build/tests/e2e/utils",
25
+ "utils/browser_console.ts",
26
+ ".build/utils/browser_console.js",
25
27
  "vease_schemas.json",
26
28
  "vease_typed_schemas.js",
27
29
  "vease_typed_schemas.d.ts"
@@ -88,12 +90,12 @@
88
90
  "@ai-sdk/vue": "4.0.93",
89
91
  "@fontsource/michroma": "5.2.6",
90
92
  "@fontsource/roboto": "5.2.10",
91
- "@geode/cloud-api": "next",
92
- "@geode/opengeodeweb-back": "next",
93
- "@geode/opengeodeweb-front": "next",
94
- "@geode/opengeodeweb-viewer": "next",
95
- "@geode/vease-back": "next",
96
- "@geode/vease-viewer": "next",
93
+ "@geode/cloud-api": "latest",
94
+ "@geode/opengeodeweb-back": "latest",
95
+ "@geode/opengeodeweb-front": "latest",
96
+ "@geode/opengeodeweb-viewer": "latest",
97
+ "@geode/vease-back": "latest",
98
+ "@geode/vease-viewer": "latest",
97
99
  "@nuxtjs/mcp-toolkit": "0.18.1",
98
100
  "ai": "7.0.93",
99
101
  "bowser": "2.14.1",
@@ -20,6 +20,8 @@ import { runBrowser } from "@geode/opengeodeweb-front/server/utils/scripts.js";
20
20
  // Local imports
21
21
  // oxlint-disable-next-line no-relative-parent-imports
22
22
  import packageJson from "../../../package.json" with { type: "json" };
23
+ // oxlint-disable-next-line no-relative-parent-imports
24
+ import { logBrowserConsole } from "../../../utils/browser_console";
23
25
 
24
26
  // Constants
25
27
  const __dirname = import.meta.dirname;
@@ -239,7 +241,7 @@ async function navigateToApp(
239
241
  const browser = await launchBrowser();
240
242
  const page = await newBrowserPage(browser);
241
243
  page.on("console", (msg) => {
242
- consola.info(`Browser console: ${msg.text()}`);
244
+ logBrowserConsole(msg.type(), msg.text(), "Browser console: ");
243
245
  });
244
246
  if (mode === "BROWSER") {
245
247
  const nuxtPort = await runBrowser("preview:browser");
@@ -0,0 +1,37 @@
1
+ // Third party imports
2
+ import { type LogType, consola } from "consola";
3
+
4
+ // Consola's browser reporter logs `%c<tag:type>%c <text>` followed by CSS style arguments.
5
+ // Chromium forwards the raw format string with the arguments appended (Electron
6
+ // `console-message` event, Playwright `ConsoleMessage.text()`).
7
+ // Strip the styling and re-log through the terminal consola to keep its formatting.
8
+ const CONSOLA_BADGE = /^%c(?<badge>[^%]*)%c (?<text>.*)$/su;
9
+ const CONSOLA_STYLE =
10
+ /\s*background: [^;]+;\s*border-radius: 0\.5em;\s*color: white;\s*font-weight: bold;\s*padding: 2px 0\.5em;\s*/gu;
11
+ const BROWSER_LEVELS: Record<string, LogType> = {
12
+ debug: "debug",
13
+ error: "error",
14
+ warning: "warn",
15
+ };
16
+
17
+ function isLogType(value: string): value is LogType {
18
+ return value in consola.options.types;
19
+ }
20
+
21
+ function logBrowserConsole(level: string, message: string, prefix = ""): void {
22
+ const fallbackType = BROWSER_LEVELS[level] ?? "info";
23
+ const match = CONSOLA_BADGE.exec(message);
24
+ if (!match?.groups) {
25
+ consola[fallbackType](`${prefix}${message}`);
26
+ return;
27
+ }
28
+ const text = (match.groups.text ?? "").replaceAll(CONSOLA_STYLE, " ").trim();
29
+ // Badge is `tag:type`, `type` or `tag` (plain `log` type has no name)
30
+ const parts = (match.groups.badge ?? "").split(":");
31
+ const last = parts.at(-1) ?? "";
32
+ const type = isLogType(last) ? last : fallbackType;
33
+ const tag = (isLogType(last) ? parts.slice(0, -1) : parts).join(":");
34
+ (tag ? consola.withTag(tag) : consola)[type](`${prefix}${text}`);
35
+ }
36
+
37
+ export { logBrowserConsole };