From 8a1b50f9ba923c6fb3663310c49c2026cb9e4118 Mon Sep 17 00:00:00 2001 From: Robby6Strings Date: Sun, 14 Apr 2024 19:50:49 +1200 Subject: [PATCH] devtools now bundles kaioken - fixes issue between dev / deployment --- packages/devtools-host/src/App.tsx | 1 + packages/devtools-host/src/index.ts | 2 ++ packages/devtools-host/src/options.ts | 4 ++-- packages/devtools-host/src/store.ts | 2 ++ packages/devtools-host/src/types.d.ts | 7 ------- 5 files changed, 7 insertions(+), 9 deletions(-) delete mode 100644 packages/devtools-host/src/types.d.ts diff --git a/packages/devtools-host/src/App.tsx b/packages/devtools-host/src/App.tsx index a0d7c1c9..acffa144 100644 --- a/packages/devtools-host/src/App.tsx +++ b/packages/devtools-host/src/App.tsx @@ -1,3 +1,4 @@ +import { useRef, useEffect } from "kaioken" import { useDevtoolsStore } from "./store" function handleDragOver(e: DragEvent) { diff --git a/packages/devtools-host/src/index.ts b/packages/devtools-host/src/index.ts index d16e49bc..36b7c1df 100644 --- a/packages/devtools-host/src/index.ts +++ b/packages/devtools-host/src/index.ts @@ -1,5 +1,7 @@ +import { mount } from "kaioken" import App from "./App" import { type AnchorCorner, useDevtoolsStore } from "./store" +console.log("__dt") ;(() => { if ("window" in globalThis) { //@ts-ignore diff --git a/packages/devtools-host/src/options.ts b/packages/devtools-host/src/options.ts index e6a61008..66ee2083 100644 --- a/packages/devtools-host/src/options.ts +++ b/packages/devtools-host/src/options.ts @@ -11,7 +11,7 @@ export const options: BuildOptions = { target: "es2020", format: "esm", - external: ["kaioken"], + // external: ["kaioken"], write: false, } @@ -20,7 +20,7 @@ export function writeFile(content: string) { fs.mkdirSync("dist") fs.writeFileSync( "dist/index.js", - `export default \`${content.replace(/[`\\$]/g, "\\$&")}\``, + `export default \`(() => {\n${content.replace(/[`\\$]/g, "\\$&")}\n})()\``, { encoding: "utf-8", } diff --git a/packages/devtools-host/src/store.ts b/packages/devtools-host/src/store.ts index df4385b5..16bad5aa 100644 --- a/packages/devtools-host/src/store.ts +++ b/packages/devtools-host/src/store.ts @@ -1,3 +1,5 @@ +import { createStore } from "kaioken" + export type AnchorCorner = "br" | "bl" | "tl" | "tr" let initialCorner = "br" diff --git a/packages/devtools-host/src/types.d.ts b/packages/devtools-host/src/types.d.ts deleted file mode 100644 index b7339efa..00000000 --- a/packages/devtools-host/src/types.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import * as kaioken from "kaioken" -declare global { - const useRef: typeof kaioken.useRef - const useEffect: typeof kaioken.useEffect - const createStore: typeof kaioken.createStore - const mount: typeof kaioken.mount -}