bootstrapTypeScript,
- boolean productionMode) {
- if (productionMode) {
- return;
- }
- String lines = """
- //@ts-ignore
- if (import.meta.env.DEV) {
- import("Frontend/generated/jar-resources/dev-tools-database.js");
- }
- """;
-
- bootstrapTypeScript.addAll(Arrays.asList(lines.split("\n")));
- }
-
-}
diff --git a/packages/java/hilla-dev-mode/src/main/resources/META-INF/resources/frontend/dev-tools-database.ts b/packages/java/hilla-dev-mode/src/main/resources/META-INF/resources/frontend/dev-tools-database.ts
deleted file mode 100644
index 747f2e31..00000000
--- a/packages/java/hilla-dev-mode/src/main/resources/META-INF/resources/frontend/dev-tools-database.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import { LitElement, type TemplateResult, html } from 'lit';
-import { loginUsingUrl, waitForConsole } from './h2-util';
-import type {
- DevToolsInterface,
- DevToolsPlugin,
- MessageHandler,
- ServerMessage,
-} from 'Frontend/generated/jar-resources/vaadin-dev-tools/vaadin-dev-tools';
-
-let devTools: DevToolsInterface;
-
-type H2Data = {
- path: string;
- jdbcUrl: string;
-};
-export class DevToolsDatabase extends LitElement implements MessageHandler {
- declare h2path?: string;
-
- declare h2jdbcUrl?: string;
-
- static properties = { h2path: { type: String }, h2jdbcUrl: { type: String } };
-
- connectedCallback(): void {
- super.connectedCallback();
- this.style.width = '100%';
- }
-
- handleMessage(message: ServerMessage): boolean {
- if (message.command === 'devtools-database-init') {
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- const data = message.data.h2 as H2Data | undefined;
- if (data) {
- this.h2path = data.path;
- this.h2jdbcUrl = data.jdbcUrl;
- }
- return true;
- }
- return false;
- }
-
- render(): TemplateResult {
- return html`
- ${!this.h2path
- ? 'H2 is not in use'
- : ''}
-
`;
- }
-
- async openH2Console(): Promise {
- const h2Window = window.open(this.h2path)!;
- await waitForConsole(h2Window);
- loginUsingUrl(h2Window, this.h2jdbcUrl);
- }
-}
-
-const plugin: DevToolsPlugin = {
- init(devToolsInterface: DevToolsInterface): void {
- devTools = devToolsInterface;
- devTools.addTab('Database', 'devtools-database');
- },
-};
-
-// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
-(window as any).Vaadin.devToolsPlugins.push(plugin);
-
-customElements.define('devtools-database', DevToolsDatabase);
diff --git a/packages/java/hilla-dev-mode/src/main/resources/META-INF/resources/frontend/h2-util.ts b/packages/java/hilla-dev-mode/src/main/resources/META-INF/resources/frontend/h2-util.ts
deleted file mode 100644
index e60a6147..00000000
--- a/packages/java/hilla-dev-mode/src/main/resources/META-INF/resources/frontend/h2-util.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-export async function waitForConsole(h2Win: Window): Promise {
- const isLoaded = (): boolean => {
- return !!h2Win.document.querySelector("[name='url']");
- };
- let resolve;
- const promise = new Promise((r) => {
- resolve = r;
- });
- const intervalId = setInterval(() => {
- if (isLoaded()) {
- clearInterval(intervalId);
- resolve!();
- }
- }, 10);
- return promise;
-}
-
-export function loginUsingUrl(h2Window: Window, jdbcUrl: string | undefined) {
- const h2Document = h2Window.document;
- (h2Document.querySelector("[name='url']") as any).value = jdbcUrl;
- (h2Document.querySelector("[type='submit']") as HTMLElement).click();
-}
diff --git a/packages/java/hilla-dev-mode/src/main/resources/META-INF/services/com.vaadin.base.devserver.DevToolsMessageHandler b/packages/java/hilla-dev-mode/src/main/resources/META-INF/services/com.vaadin.base.devserver.DevToolsMessageHandler
deleted file mode 100644
index b31b186d..00000000
--- a/packages/java/hilla-dev-mode/src/main/resources/META-INF/services/com.vaadin.base.devserver.DevToolsMessageHandler
+++ /dev/null
@@ -1 +0,0 @@
-com.vaadin.hilla.devmode.devtools.DevToolsDatabase