git-diff-view 0.0.10 → 0.0.13

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.
@@ -0,0 +1 @@
1
+ :root{--buncss-light:initial;--buncss-dark: ;color-scheme:light dark}@media (prefers-color-scheme:dark){:root{--buncss-light: ;--buncss-dark:initial}}body{background:var(--bg-color,#fff);margin:0;padding:20px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}@media (prefers-color-scheme:dark){body{background:#1a1a1a}}
package/index.ts CHANGED
@@ -68,10 +68,11 @@ const run = async (args: string[]) => {
68
68
  const diffData = JSON.stringify({ patch, theme });
69
69
 
70
70
  const scriptDir = dirname(SCRIPT_PATH).replace("file://", "");
71
- const distDir = join(scriptDir, "dist");
71
+ const isBundle = SCRIPT_PATH.includes("/dist/");
72
+ const distDir = isBundle ? scriptDir : join(scriptDir, "dist");
72
73
 
73
- const jsFile = Bun.file(join(distDir, "frontend.js"));
74
- const cssFile = Bun.file(join(distDir, "styles.css"));
74
+ const jsPath = join(distDir, "frontend.js");
75
+ const cssPath = join(distDir, "styles.css");
75
76
 
76
77
  const bgColor = dark ? "#1a1a1a" : "#ffffff";
77
78
  const html = `<!DOCTYPE html>
@@ -91,19 +92,34 @@ const run = async (args: string[]) => {
91
92
  const server = Bun.serve({
92
93
  port: 0,
93
94
  development: false,
94
- routes: {
95
- "/": new Response(html, {
96
- headers: { "Content-Type": "text/html" },
97
- }),
98
- "/frontend.js": new Response(jsFile, {
99
- headers: { "Content-Type": "application/javascript" },
100
- }),
101
- "/styles.css": new Response(cssFile, {
102
- headers: { "Content-Type": "text/css" },
103
- }),
104
- "/api/diff": new Response(diffData, {
105
- headers: { "Content-Type": "application/json" },
106
- }),
95
+ fetch(req) {
96
+ const url = new URL(req.url);
97
+
98
+ if (url.pathname === "/") {
99
+ return new Response(html, {
100
+ headers: { "Content-Type": "text/html" },
101
+ });
102
+ }
103
+
104
+ if (url.pathname === "/frontend.js") {
105
+ return new Response(Bun.file(jsPath), {
106
+ headers: { "Content-Type": "application/javascript" },
107
+ });
108
+ }
109
+
110
+ if (url.pathname === "/styles.css") {
111
+ return new Response(Bun.file(cssPath), {
112
+ headers: { "Content-Type": "text/css" },
113
+ });
114
+ }
115
+
116
+ if (url.pathname === "/api/diff") {
117
+ return new Response(diffData, {
118
+ headers: { "Content-Type": "application/json" },
119
+ });
120
+ }
121
+
122
+ return new Response("Not Found", { status: 404 });
107
123
  },
108
124
  });
109
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-diff-view",
3
- "version": "0.0.10",
3
+ "version": "0.0.13",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,20 +8,20 @@
8
8
  },
9
9
  "scripts": {
10
10
  "start": "bun run index.ts",
11
- "build": "bun build ./index.ts --outfile ./dist/cli.js --target node --minify && bun build ./frontend.tsx --outdir ./dist --minify && bun build ./styles.css --outdir ./dist --minify",
11
+ "build": "bun build ./index.ts --outfile ./dist/cli.js --target bun --minify && bun build ./frontend.tsx --outdir ./dist --minify && bun build ./styles.css --outdir ./dist --minify",
12
12
  "prepublishOnly": "bun run build"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/bun": "latest"
16
16
  },
17
17
  "peerDependencies": {
18
- "typescript": "^5"
18
+ "typescript": "^5.9.3"
19
19
  },
20
20
  "dependencies": {
21
- "@pierre/diffs": "^1.0.6",
22
- "@types/react": "^19.2.8",
21
+ "@pierre/diffs": "^1.0.10",
22
+ "@types/react": "^19.2.14",
23
23
  "@types/react-dom": "^19.2.3",
24
- "react": "^19.2.3",
25
- "react-dom": "^19.2.3"
24
+ "react": "^19.2.4",
25
+ "react-dom": "^19.2.4"
26
26
  }
27
27
  }