buddy-workbench 0.1.18 → 0.1.19

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": "buddy-workbench",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,6 +22,7 @@
22
22
  "version": "node -e \"const v=process.env.npm_package_version; const fs=require('fs'); ['ui/package.json', 'ui/package-lock.json'].forEach(p=>{if(fs.existsSync(p)){const j=JSON.parse(fs.readFileSync(p)); j.version=v; if(j.packages&&j.packages['']){j.packages[''].version=v;} fs.writeFileSync(p, JSON.stringify(j,null,2)+'\\n');}});\" && git add ui/package.json ui/package-lock.json"
23
23
  },
24
24
  "dependencies": {
25
+ "@jsquash/jpeg": "^1.6.0",
25
26
  "axios": "^1.7.9",
26
27
  "express": "^5.1.0"
27
28
  }
@@ -4,7 +4,7 @@ import { existsSync, mkdirSync, readFileSync, readdirSync, unlinkSync, writeFile
4
4
  import { dirname, join } from 'node:path';
5
5
  import { promisify } from 'node:util';
6
6
  import { fileURLToPath } from 'node:url';
7
- import encodeMozjpeg, { init as initMozjpeg } from '../../ui/node_modules/@jsquash/jpeg/encode.js';
7
+ import encodeMozjpeg, { init as initMozjpeg } from '@jsquash/jpeg/encode.js';
8
8
  import { paths } from '../config.js';
9
9
  import { readSettings } from '../repositories/settings.js';
10
10
 
@@ -16,7 +16,7 @@ let mozjpegWasmModule = null;
16
16
 
17
17
  async function compressMozjpeg(rgbaBuf, width, height, quality = 75) {
18
18
  if (!mozjpegWasmModule) {
19
- const wasmPath = fileURLToPath(import.meta.resolve('../../ui/node_modules/@jsquash/jpeg/codec/enc/mozjpeg_enc.wasm'));
19
+ const wasmPath = fileURLToPath(import.meta.resolve('../../ui/dist/assets/mozjpeg_enc-DO-zoExo.wasm'));
20
20
  mozjpegWasmModule = await WebAssembly.compile(readFileSync(wasmPath));
21
21
  await initMozjpeg(mozjpegWasmModule);
22
22
  }
@@ -20,11 +20,13 @@ export function countErrorBlocks(text, isStderr = false) {
20
20
  const lines = text.split(/\r?\n/);
21
21
  let count = 0;
22
22
  let inErrorBlock = false;
23
+ let lastWasNpmErr = false;
23
24
 
24
25
  for (const line of lines) {
25
26
  const trimmed = line.trim();
26
27
  if (!trimmed) {
27
28
  inErrorBlock = false;
29
+ lastWasNpmErr = false;
28
30
  continue;
29
31
  }
30
32
 
@@ -39,30 +41,35 @@ export function countErrorBlocks(text, isStderr = false) {
39
41
  /^(?:npm WARN|yarn warning|pnpm warning)/i.test(cleanLine) ||
40
42
  /^\s*\((?:node:\d+|node:|Use\b)/i.test(cleanLine) ||
41
43
  /^[ℹ✔]/u.test(cleanLine) ||
42
- /\b(?:compiled successfully|build completed|done in)\b/i.test(cleanLine);
44
+ /\b(?:compiled successfully|build completed|done in)\b/i.test(cleanLine) ||
45
+ /\[(?:built|emitted|code generated|rendered|orphan|hidden)\]/i.test(cleanLine) ||
46
+ /\bnamespace object\b/i.test(cleanLine);
43
47
 
44
48
  if (isNonErrorLine) {
45
49
  inErrorBlock = false;
50
+ lastWasNpmErr = false;
46
51
  continue;
47
52
  }
48
53
 
54
+ const isNpmErrLine = /^npm ERR!/i.test(cleanLine);
55
+
49
56
  const isNewHeader =
50
57
  /^(?:\[?(?:error|fatal|fail|failed)\]?|error:|uncaught|fatal:)/i.test(cleanLine) ||
51
58
  /^(?:TypeError|ReferenceError|SyntaxError|RangeError|EvalError|URIError|Error|UnhandledPromiseRejectionWarning|UnhandledPromiseRejection):/i.test(cleanLine) ||
52
- /^npm ERR! (?:code|syscall|path|errno)/i.test(cleanLine) ||
59
+ (isNpmErrLine && !lastWasNpmErr) ||
53
60
  /^\[vite\] Internal server error/i.test(cleanLine) ||
54
61
  /\bTS\d{4,5}\b/i.test(cleanLine) ||
55
62
  /\berror TS\d+/i.test(cleanLine) ||
56
63
  /^(?:\[TypeScript\]|TS ERROR)/i.test(cleanLine);
57
64
 
58
- if (isNewHeader) {
65
+ if (isNewHeader && !isNpmErrLine) {
59
66
  inErrorBlock = false;
60
67
  }
61
68
 
62
69
  const isErrorLine =
63
70
  isNewHeader ||
64
- /\b(error|failed|fatal|exception)\b/i.test(cleanLine) ||
65
- /^npm ERR!/i.test(cleanLine) ||
71
+ isNpmErrLine ||
72
+ /(?<![/\\.-])\b(error|failed|fatal|exception)\b(?![/\\.-])/i.test(cleanLine) ||
66
73
  /\bTS\d{4,5}\b/i.test(cleanLine) ||
67
74
  /^\s*at\s+[\w\d_$.<>]+\s+\(/i.test(line);
68
75
 
@@ -71,8 +78,10 @@ export function countErrorBlocks(text, isStderr = false) {
71
78
  count++;
72
79
  inErrorBlock = true;
73
80
  }
81
+ if (isNpmErrLine) lastWasNpmErr = true;
74
82
  } else {
75
83
  inErrorBlock = false;
84
+ lastWasNpmErr = false;
76
85
  }
77
86
  }
78
87