dsh-plugin-toolkit 0.3.2 → 0.3.3
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 +4 -0
- package/README.md +4 -0
- package/lib/testkit/load.mjs +18 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.3
|
|
4
|
+
|
|
5
|
+
- `mount` on a path that is missing, or that is a directory, now says what to pass instead of raising `ENOENT: no such file or directory, open '…'`. Found by running the three commands in a clean HOME with a fresh clone.
|
|
6
|
+
|
|
3
7
|
## 0.3.2
|
|
4
8
|
|
|
5
9
|
- `expectSnapshot(html, dir, name)`: the assertion form of `compare`, so a baseline test reads like a test and fails with the element that moved.
|
package/README.md
CHANGED
|
@@ -108,6 +108,10 @@ The host already swaps a rebuilt bundle without a page reload: it watches each p
|
|
|
108
108
|
npx dsh-plugin dev . --host http://127.0.0.1:54133
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+

|
|
112
|
+
|
|
113
|
+
*Recorded from a real run against the running app: the last line is the revision the app sent back on `/plugins/events`, not a message the tool printed on faith.*
|
|
114
|
+
|
|
111
115
|
```
|
|
112
116
|
demo-aiignore: /work/plugin/client.js -> ~/.dsh/profiles/desktop/node_modules/dsh-aiignore/client.js
|
|
113
117
|
initial: copied 163647 bytes at 1:18:43 AM
|
package/lib/testkit/load.mjs
CHANGED
|
@@ -8,6 +8,23 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import fs from 'node:fs';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Read the bundle, or say what is wrong with the path in the caller's words.
|
|
13
|
+
*
|
|
14
|
+
* A raw ENOENT is technically true and practically useless: the usual mistake is
|
|
15
|
+
* passing the plugin folder, or a path relative to the wrong directory.
|
|
16
|
+
*/
|
|
17
|
+
function readBundleSource(file) {
|
|
18
|
+
const resolved = String(file);
|
|
19
|
+
if (fs.existsSync(resolved) === false) {
|
|
20
|
+
throw new Error(`no such file: ${resolved} (mount takes the client bundle, e.g. ./client.js)`);
|
|
21
|
+
}
|
|
22
|
+
if (fs.statSync(resolved).isDirectory() === true) {
|
|
23
|
+
throw new Error(`${resolved} is a directory (mount takes the client bundle inside it, e.g. ${resolved}/client.js)`);
|
|
24
|
+
}
|
|
25
|
+
return fs.readFileSync(resolved, 'utf8');
|
|
26
|
+
}
|
|
27
|
+
|
|
11
28
|
export function createModuleLoader({ require: provide, onLoad } = {}) {
|
|
12
29
|
const loaded = [];
|
|
13
30
|
const loader = {
|
|
@@ -27,7 +44,7 @@ export function createModuleLoader({ require: provide, onLoad } = {}) {
|
|
|
27
44
|
}
|
|
28
45
|
|
|
29
46
|
export function loadBundle(file, options = {}) {
|
|
30
|
-
const source =
|
|
47
|
+
const source = readBundleSource(file);
|
|
31
48
|
const loader = createModuleLoader(options);
|
|
32
49
|
const context = { window: { __ModuleLoader__: loader }, __ModuleLoader__: loader, ...(options.globals ?? {}) };
|
|
33
50
|
// The bundle is an IIFE or a top-level statement list; the browser would run it
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-toolkit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Preflight, release and test DeepSeek Harness plugins: checks what the host needs, waits for npm to actually serve the version, and keeps the market index honest.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|