bun-dev-server 0.0.9 → 0.1.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/bunClientHmr.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { type BunDevServerSocketConfig } from "./bunServeConfig";
2
2
 
3
3
  function hotReload() {
4
- if (window.BUN_HMR_INITED) {
4
+ if ((window as any).BUN_HMR_INITED) {
5
5
  return;
6
6
  }
7
- window.BUN_HMR_INITED = true;
7
+ (window as any).BUN_HMR_INITED = true;
8
8
  const hmrSock = new WebSocket("[REPLACE_ENDPOINT]");
9
9
  hmrSock.addEventListener("error", (err) => {
10
10
  console.error("HMR ERROR", err);
package/bunTSWatcher.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $, type Server, type Subprocess, resolve } from "bun";
2
2
  export async function startTSWatcher(server: Server, watchDir: URL) {
3
- let dstcwd: string | undefined;
3
+ let dstcwd = process.cwd();
4
4
  if (watchDir) {
5
5
  dstcwd = process.platform === "win32" ? watchDir.pathname.substring(1) : watchDir.pathname;
6
6
  }
@@ -10,7 +10,7 @@ export async function startTSWatcher(server: Server, watchDir: URL) {
10
10
  //const tsc = await $`bun run ${tscResolved} --noEmit --watch ${dstcwd}/*.ts`.quiet().arrayBuffer();
11
11
  let tsc: Subprocess | undefined;
12
12
  try {
13
- tsc = Bun.spawn(["tsc", "--watch", "--project", `${import.meta.dir}/tsconfig.json`], { stdout: "pipe", stderr: "pipe" });
13
+ tsc = Bun.spawn(["tsc", "--watch", "--project", `${process.cwd()}/tsconfig.json`], { stdout: "pipe", stderr: "pipe", cwd: dstcwd });
14
14
  } catch (e) {
15
15
  console.error("TSC not found have you installed it globally?");
16
16
  return;
package/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- /// <reference path="./@types/serve.ts" />
1
+ /// <reference path="./@types/fileTypes.d.ts" />
2
2
  import { render } from "ejs";
3
3
  import Bun, { $, ShellError } from "bun";
4
4
  import serveTemplate from "./serveOutputTemplate.ejs" with { type: "text" };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "git",
7
7
  "url": "https://github.com/SPWizard01/bun-dev-server"
8
8
  },
9
- "version": "0.0.9",
9
+ "version": "0.1.0",
10
10
  "module": "index.ts",
11
11
  "type": "module",
12
12
  "license": "MIT",
@@ -1,6 +0,0 @@
1
- declare global {
2
- interface Window {
3
- BUN_HMR_INITED: boolean;
4
- }
5
- }
6
- export {};
File without changes