dsh-unlag 1.9.13 → 1.9.15

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.
Files changed (3) hide show
  1. package/README.md +2 -1
  2. package/index.js +9 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -68,7 +68,8 @@ dsh plugin install dsh-unlag
68
68
  ## 排错
69
69
 
70
70
  - 日志:`~/.dsh/unlag-reload.log`,换代码/跳过/被拦各一行,含原因。
71
- - 状态:`GET /dsh-unlag/state` → `{"plugins":true,"page":true,"shim":{...}}`。
71
+ - 状态:`GET /dsh-unlag/state` → `{"version":"1.9.14","code":"<index.js 写入时间>","plugins":true,"page":true,"shim":{...}}`。`code` 用来分清「版本号没刷」和「旧代码真的还在跑」。
72
+ - 重建后的日志带起页面代次:`interface rebuilt; the page runs the plugins as served now (page <rev>)`,据此判断新文档加载的是新脚本还是旧脚本。
72
73
 
73
74
  ## 测试
74
75
 
package/index.js CHANGED
@@ -48,7 +48,7 @@ const VERSION = (() => {
48
48
  })()
49
49
 
50
50
  /**
51
- * When this file was last written. The version alone can name a package whose host half was never
51
+ * When this file was last written. The version alone can name a package whose host half was never // ui-copy-ignore
52
52
  * reloaded — the loader keeps a module it already loaded — and this is what tells the two apart.
53
53
  */
54
54
  const CODE_STAMP = (() => {
@@ -83,6 +83,8 @@ const TEST_PATH = /(^|\/)(test|tests|__tests__|__mocks__)(\/|$)|[.-](test|spec)\
83
83
  const DEFAULT_ROOTS = [join(homedir(), '.dsh', 'plugins')]
84
84
  /** A turn that never goes idle must not turn this into an endless poll. */
85
85
  const MAX_DEFERRALS = 40
86
+ const MAX_STARTUP_ROWS = 64
87
+ const MAX_STARTUP_ROW_CHARS = 4096
86
88
  const MIN_INTERVAL_MS = 1500
87
89
  /** The route the app publishes client bundles under; the same key the module table registers. */
88
90
  const BUNDLE_ROUTE = '/plugins'
@@ -1323,9 +1325,14 @@ export async function verifyStartupRows(graph, fetchBody, rows) {
1323
1325
  .filter((row) => typeof row?.id === 'string' && row.id !== '')
1324
1326
  .map((row) => [row.id, row]),
1325
1327
  )
1328
+ // A startup list is a handful of addresses. Anything past that bound is not a list this app could
1329
+ // boot from, and reading it would turn one request into unbounded work on the process that owns
1330
+ // every running turn.
1331
+ const offered = Array.isArray(rows) ? rows.slice(0, MAX_STARTUP_ROWS) : []
1326
1332
  const wanted = []
1327
- for (const row of Array.isArray(rows) ? rows : []) {
1333
+ for (const row of offered) {
1328
1334
  if (typeof row !== 'string' || row === '') continue
1335
+ if (row.length > MAX_STARTUP_ROW_CHARS) continue
1329
1336
  const path = row.includes('://') ? row.replace(/^[a-z]+:\/\/[^/]+/iu, '') : row
1330
1337
  const url = path.startsWith('/') ? path : `/${path.replace(/^\.?\//u, '')}`
1331
1338
  const request = bundleRequest(url)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.13",
3
+ "version": "1.9.15",
4
4
  "type": "module",
5
5
  "description": "A press applies plugin edits right away and brings a laggy interface back; automatic reloading stays off unless you turn it on, so the press is the only trigger, and nothing restarts.",
6
6
  "license": "MIT",