@typed-assistant/builder 0.0.90 → 0.0.91

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @typed-assistant/builder
2
2
 
3
+ ## 0.0.91
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix security, reliability, and performance issues
8
+
9
+ - Fix XSS: pass `escapeXML: true` to ansi-to-html `Convert` constructor
10
+ - Fix regex injection: escape `entryFile` metacharacters before `RegExp`
11
+ - Fix crash: wrap `.gitignore` read in try/catch with fallback warning
12
+ - Fix error handling: normalize caught values to `Error` in `withErrorHandling` and `generateTypes`
13
+ - Fix preinstall: wrap in async IIFE so `Promise.all` is properly awaited
14
+ - Fix performance: replace listeners array with `Set` in `entityStore`
15
+ - Fix WebSocket: add exponential backoff (1s→30s cap) on reconnect
16
+ - Fix TS: import `JSX` type from react in `AppSection`
17
+
3
18
  ## 0.0.90
4
19
 
5
20
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typed-assistant/builder",
3
- "version": "0.0.90",
3
+ "version": "0.0.91",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/TypedAssistant/TypedAssistant.git",
@@ -38,9 +38,9 @@
38
38
  "ts-toolbelt": "^9.6.0",
39
39
  "typescript": "^5.4.0",
40
40
  "@typed-assistant/eslint-config": "0.0.11",
41
- "@typed-assistant/logger": "0.0.23",
41
+ "@typed-assistant/utils": "0.0.21",
42
42
  "@typed-assistant/typescript-config": "0.0.12",
43
- "@typed-assistant/utils": "0.0.20"
43
+ "@typed-assistant/logger": "0.0.23"
44
44
  },
45
45
  "scripts": {
46
46
  "lint": "tsc --noEmit && eslint ."
@@ -151,7 +151,8 @@ const checkProcesses = (
151
151
  const interval = setInterval(async () => {
152
152
  const ps = await $`ps -f`.text()
153
153
  logger.debug({ emoji: "šŸ”" }, `Checking processes...\n${ps}`)
154
- const matches = ps.match(new RegExp(`bun .+${entryFile}`, "gmi")) ?? []
154
+ const escapedEntryFile = entryFile.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
155
+ const matches = ps.match(new RegExp(`bun .+${escapedEntryFile}`, "gmi")) ?? []
155
156
 
156
157
  if (matches.length > 1) {
157
158
  multipleProcessesErrorCount++
@@ -208,9 +209,13 @@ const setupGitSync = async ({
208
209
  return setupGitPoller({ onChangesPulled })
209
210
  }
210
211
 
211
- const ig = ignore().add(
212
- `${readFileSync(join(process.cwd(), ".gitignore")).toString()}\n.git`,
213
- )
212
+ let gitignoreContent = ".git"
213
+ try {
214
+ gitignoreContent = `${readFileSync(join(process.cwd(), ".gitignore")).toString()}\n.git`
215
+ } catch {
216
+ logger.warn({ emoji: "āš ļø" }, "No .gitignore found, watching all files")
217
+ }
218
+ const ig = ignore().add(gitignoreContent)
214
219
  const shouldIgnoreFileOrFolder = (filename: string) =>
215
220
  ig.ignores(relative(process.cwd(), filename))
216
221
 
@@ -25,7 +25,7 @@ const cssOutputFile = join(
25
25
  `./build/output.css`,
26
26
  ) as `${string}/output.css`
27
27
 
28
- const convert = new Convert()
28
+ const convert = new Convert({ escapeXML: true })
29
29
  const decoder = new TextDecoder()
30
30
 
31
31
  const readers = {
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react"
1
+ import type { ReactNode, JSX } from "react"
2
2
  import { twMerge } from "tailwind-merge"
3
3
 
4
4
  export const AppSection = ({
@@ -12,12 +12,19 @@ export function useWS({
12
12
 
13
13
  useEffect(() => {
14
14
  let timeout: ReturnType<typeof setTimeout>
15
+ let retryCount = 0
16
+
17
+ ws.ws.onopen = function () {
18
+ retryCount = 0
19
+ }
15
20
 
16
21
  ws.ws.onclose = function () {
22
+ const delay = Math.min(1000 * 2 ** retryCount, 30000)
23
+ retryCount++
17
24
  timeout = setTimeout(() => {
18
25
  if (ws.ws.readyState === WebSocket.OPEN) return
19
26
  setWS(subscribe)
20
- }, 1000)
27
+ }, delay)
21
28
  }
22
29
 
23
30
  ws.ws.onmessage = function (event) {