dsh-unlag 1.9.40 → 1.9.42
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/index.js +25 -15
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -90,15 +90,26 @@ const DEFAULT_ROOTS = [join(homedir(), '.dsh', 'plugins')]
|
|
|
90
90
|
/** A turn that never goes idle must not turn this into an endless poll. */
|
|
91
91
|
const MAX_DEFERRALS = 40
|
|
92
92
|
const MAX_STARTUP_ROWS = 64
|
|
93
|
-
const MAX_STARTUP_ROW_CHARS = 4096
|
|
94
93
|
/**
|
|
95
|
-
* The
|
|
96
|
-
*
|
|
97
|
-
*
|
|
94
|
+
* The longest one startup address may be. The app folds a whole plugin set into one bundle address,
|
|
95
|
+
* and this profile's largest already measured 2.8 KB: one id list up to MAX_BUNDLE_IDS of normal
|
|
96
|
+
* plugin names is about 5 KB, so a bound below that would drop a sound address — and a script the
|
|
97
|
+
* check never reads is a script nothing proved would load in the next document.
|
|
98
98
|
*/
|
|
99
|
-
const
|
|
100
|
-
/**
|
|
101
|
-
|
|
99
|
+
const MAX_STARTUP_ROW_CHARS = 8192
|
|
100
|
+
/**
|
|
101
|
+
* The largest one startup script may be before a check refuses it. The app serves a whole profile as
|
|
102
|
+
* a few bundles, and those grow with every installed plugin: one profile's largest bundle measured
|
|
103
|
+
* 8.7 MB, which a smaller bound refused as if it were an attack and left the page unrebuildable.
|
|
104
|
+
* A body past this bound is a mistake or an attempt to make a check read (and compile) an unbounded
|
|
105
|
+
* amount of text inside the process that owns every running turn.
|
|
106
|
+
*/
|
|
107
|
+
const MAX_SCRIPT_BYTES = 64 * 1024 * 1024
|
|
108
|
+
/**
|
|
109
|
+
* The same bound for one whole startup list, so a list of large bodies cannot add up either. Only
|
|
110
|
+
* the compile happens under it: what a check keeps per body is the ids it names, never its text.
|
|
111
|
+
*/
|
|
112
|
+
const MAX_TOTAL_SCRIPT_BYTES = 128 * 1024 * 1024
|
|
102
113
|
|
|
103
114
|
/**
|
|
104
115
|
* The most plugin ids one bundle address may name. A real startup list is far below this; a made-up
|
|
@@ -1534,12 +1545,11 @@ export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_V
|
|
|
1534
1545
|
if (required.length > 0 && missing.length > 0) {
|
|
1535
1546
|
return { status: 'blocked', reason: 'register', detail: `${item.url} does not register ${missing.join(', ')}` }
|
|
1536
1547
|
}
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
})
|
|
1548
|
+
// Only what the cross-checks below need from this body is kept; the text itself is let go here,
|
|
1549
|
+
// so a list of large scripts costs one script of memory rather than the whole list.
|
|
1550
|
+
const record = { url: item.url, ids: item.ids, registered, required: requiredIds(text) }
|
|
1551
|
+
record.digest = createHash('sha256').update(bytes).digest('hex').slice(0, 16)
|
|
1552
|
+
bodies.push(record)
|
|
1543
1553
|
}
|
|
1544
1554
|
/**
|
|
1545
1555
|
* A body can read a plugin its own document does not list: the set changed after that document was
|
|
@@ -1548,10 +1558,10 @@ export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_V
|
|
|
1548
1558
|
* itself is that case, so the press is held rather than booting a page that dies half way.
|
|
1549
1559
|
*/
|
|
1550
1560
|
const available = new Set(listed)
|
|
1551
|
-
for (const body of bodies) for (const id of
|
|
1561
|
+
for (const body of bodies) for (const id of body.registered) available.add(id)
|
|
1552
1562
|
const absent = new Set()
|
|
1553
1563
|
for (const body of bodies) {
|
|
1554
|
-
for (const id of
|
|
1564
|
+
for (const id of body.required) {
|
|
1555
1565
|
if (available.has(id) || !entries.has(id)) continue
|
|
1556
1566
|
absent.add(id)
|
|
1557
1567
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.42",
|
|
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",
|