newpr 1.0.7 → 1.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "newpr",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "description": "AI-powered large PR review tool - understand PRs with 1000+ lines of changes",
5
5
  "module": "src/cli/index.ts",
6
6
  "type": "module",
@@ -94,7 +94,7 @@ function MediaEmbed({ src }: { src: string }) {
94
94
  );
95
95
  }
96
96
 
97
- const ANCHOR_RE = /\[\[(group|file):([^\]]+)\]\]/g;
97
+ const ANCHOR_RE = /\[\[(group|file):(.*?)\]\]/g;
98
98
 
99
99
  const BOLD_CJK_RE = /\*\*(.+?)\*\*/g;
100
100
 
@@ -131,16 +131,14 @@ function replaceLineAnchors(text: string): string {
131
131
  result += text.slice(i, start);
132
132
 
133
133
  const idStart = start + OPEN.length;
134
- const closeBracket = text.indexOf("]", idStart);
135
- if (closeBracket === -1) {
134
+ const closeBrackets = text.indexOf("]]", idStart);
135
+ if (closeBrackets === -1) {
136
136
  result += text.slice(start);
137
137
  break;
138
138
  }
139
139
 
140
- const id = text.slice(idStart, closeBracket);
141
- let afterClose = closeBracket + 1;
142
-
143
- if (text[afterClose] === "]") afterClose++;
140
+ const id = text.slice(idStart, closeBrackets);
141
+ let afterClose = closeBrackets + 2;
144
142
 
145
143
  let label: string | null = null;
146
144
  if (text[afterClose] === "(") {
@@ -157,8 +155,6 @@ function replaceLineAnchors(text: string): string {
157
155
  }
158
156
  }
159
157
 
160
- if (text[afterClose] === "]") afterClose++;
161
-
162
158
  const encoded = encodeURIComponent(id);
163
159
  if (label) {
164
160
  result += `<span data-line-ref="${encoded}">${inlineMarkdownToHtml(label)}</span>`;
package/src/web/server.ts CHANGED
@@ -17,17 +17,30 @@ interface WebServerOptions {
17
17
 
18
18
  function getCssPaths() {
19
19
  const webDir = import.meta.dir;
20
- const packageRoot = join(webDir, "..", "..");
20
+
21
+ let bin: string;
22
+ try {
23
+ const resolved = import.meta.resolve("@tailwindcss/cli/package.json");
24
+ const cliDir = resolved.replace(/^file:\/\//, "").replace(/\/package\.json$/, "");
25
+ bin = join(cliDir, "dist", "index.mjs");
26
+ } catch {
27
+ const packageRoot = join(webDir, "..", "..");
28
+ bin = join(packageRoot, "node_modules", ".bin", "tailwindcss");
29
+ }
30
+
21
31
  return {
22
32
  input: join(webDir, "styles", "globals.css"),
23
33
  output: join(webDir, "styles", "built.css"),
24
- bin: join(packageRoot, "node_modules", ".bin", "tailwindcss"),
34
+ bin,
25
35
  };
26
36
  }
27
37
 
28
38
  async function buildCss(bin: string, input: string, output: string): Promise<void> {
39
+ const args = bin.endsWith(".mjs") || bin.endsWith(".js")
40
+ ? ["bun", bin, "-i", input, "-o", output, "--minify"]
41
+ : [bin, "-i", input, "-o", output, "--minify"];
29
42
  const proc = Bun.spawn(
30
- [bin, "-i", input, "-o", output, "--minify"],
43
+ args,
31
44
  { cwd: process.cwd(), stderr: "pipe", stdout: "pipe" },
32
45
  );
33
46
  const exitCode = await proc.exited;