dsh-plugin-toolkit 0.20.30 → 0.20.31
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 +20 -0
- package/README.md +1 -1
- package/lib/cli.mjs +22 -1
- package/lib/verify.mjs +16 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 0.20.31
|
|
2
|
+
|
|
3
|
+
- **`index --index` with no path is a usage error, not a silent default.** A
|
|
4
|
+
bare `--index` used to store `undefined`, so the command read
|
|
5
|
+
`./market/index.json` and could exit `0` on an index the caller never named;
|
|
6
|
+
a CI step could therefore go green against the wrong file. The flag parser
|
|
7
|
+
now records the missing value separately, and the CLI exits `2` with
|
|
8
|
+
`--index` named before any index is read. A named path, whether
|
|
9
|
+
`--index market/index.json` or the positional form, still audits that file.
|
|
10
|
+
|
|
11
|
+
- **`verify` also awaits an async client `apply()` on its boot probe.** The
|
|
12
|
+
host half was made safe first; the mounted path then handed the client face a
|
|
13
|
+
bare context without waiting for the returned promise. A client `async
|
|
14
|
+
apply()` that rejected on that context escaped the probe, so the process died
|
|
15
|
+
with an unhandled rejection and a stack trace instead of naming the failure.
|
|
16
|
+
The probe now awaits the same way as the host, so the rejection is a `boot`
|
|
17
|
+
failure naming the error. An async client fixture pins the process boundary,
|
|
18
|
+
and a non-`Error` rejection now reports its value instead of `undefined` or a
|
|
19
|
+
second TypeError from reading `.message`.
|
|
20
|
+
|
|
1
21
|
## 0.20.30
|
|
2
22
|
|
|
3
23
|
- **The compatibility sample is the shipped CLI's output, not a library
|
package/README.md
CHANGED
|
@@ -948,7 +948,7 @@ ok packed 5 file(s), installed the tarball, mounted the panel
|
|
|
948
948
|
My panel This panel came from dsh-plugin init. Clicks: 0
|
|
949
949
|
```
|
|
950
950
|
|
|
951
|
-
It packs, installs that tarball into a throwaway directory, then mounts the bundle **from the installed copy**. The host half is imported by the package's bare name, exactly as the loader imports it, so an `exports` map with no `.` entry fails with `ERR_PACKAGE_PATH_NOT_EXPORTED` even when `main` names a working file; `verify --no-mount` reports that as a `root export` failure naming the missing `.` export. The host half is also called and awaited, so an `async apply()` that rejects is reported as a `host apply` failure instead of printing the success line and then crashing with an unhandled rejection. A package that declares neither `exports` nor `main` has no root module at all; there is nothing to import, and the success line says it skipped the host import instead of claiming one ran. When the `files` list drops the panel:
|
|
951
|
+
It packs, installs that tarball into a throwaway directory, then mounts the bundle **from the installed copy**. The host half is imported by the package's bare name, exactly as the loader imports it, so an `exports` map with no `.` entry fails with `ERR_PACKAGE_PATH_NOT_EXPORTED` even when `main` names a working file; `verify --no-mount` reports that as a `root export` failure naming the missing `.` export. The host half is also called and awaited, so an `async apply()` that rejects is reported as a `host apply` failure instead of printing the success line and then crashing with an unhandled rejection; the client half's boot probe is awaited the same way, so an async `apply()` that rejects on the bare context is a `boot` failure. A package that declares neither `exports` nor `main` has no root module at all; there is nothing to import, and the success line says it skipped the host import instead of claiming one ran. When the `files` list drops the panel:
|
|
952
952
|
|
|
953
953
|
```sh
|
|
954
954
|
$ npx dsh-plugin-toolkit verify .
|
package/lib/cli.mjs
CHANGED
|
@@ -132,7 +132,19 @@ function flags(argv) {
|
|
|
132
132
|
parsed.patch = next === undefined || next.startsWith('--') === true ? '' : argv[++index];
|
|
133
133
|
}
|
|
134
134
|
else if (token === '--log') parsed.log = argv[++index];
|
|
135
|
-
else if (token === '--index')
|
|
135
|
+
else if (token === '--index') {
|
|
136
|
+
// A bare `--index` is a missing path, not a request for the default. The
|
|
137
|
+
// `index` command used to fall back to ./market/index.json and exit 0,
|
|
138
|
+
// so a CI step could go green on a different index than the one it
|
|
139
|
+
// named. Remember the missing value apart from the path itself, so the
|
|
140
|
+
// command can stop before reading any index.
|
|
141
|
+
const next = argv[index + 1];
|
|
142
|
+
if (next === undefined || next.startsWith('--') === true) {
|
|
143
|
+
parsed.indexMissing = true;
|
|
144
|
+
} else {
|
|
145
|
+
parsed.index = argv[++index];
|
|
146
|
+
}
|
|
147
|
+
}
|
|
136
148
|
else if (token === '--tag-prefix') parsed.tagPrefix = argv[++index];
|
|
137
149
|
else if (token === '--budget') {
|
|
138
150
|
// A budget of `8m`, `0`, or `-1` is not a wait, and by the time the
|
|
@@ -255,6 +267,15 @@ export async function run(argv, io = console, deps = {}) {
|
|
|
255
267
|
return 0;
|
|
256
268
|
}
|
|
257
269
|
|
|
270
|
+
// `--index` names the file to audit or update. Without a value the `index`
|
|
271
|
+
// command used to read ./market/index.json and exit 0, which let a CI step
|
|
272
|
+
// pass against an index the caller never named. Reject the usage error here,
|
|
273
|
+
// before any command can read or write an index.
|
|
274
|
+
if (options.indexMissing === true || (options.index !== undefined && String(options.index).trim() === '')) {
|
|
275
|
+
io.error('dsh-plugin --index needs a path to an index file, for example: dsh-plugin index market/index.json');
|
|
276
|
+
return 2;
|
|
277
|
+
}
|
|
278
|
+
|
|
258
279
|
// `--host` means a URL for a local audit and a DSH version for a remote one,
|
|
259
280
|
// so a bare flag must stop before either reads anything. Otherwise the audit
|
|
260
281
|
// silently omits the compatibility answer the user asked for.
|
package/lib/verify.mjs
CHANGED
|
@@ -80,6 +80,16 @@ function undeclaredContext() {
|
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* A rejected `apply()` is not required to reject with an Error. Reading
|
|
85
|
+
* `.message` off a string (or `null`) either reports `undefined` or throws a
|
|
86
|
+
* second TypeError inside the handler, which hides the plugin's own reason.
|
|
87
|
+
*/
|
|
88
|
+
function failureText(error) {
|
|
89
|
+
if (error instanceof Error) return error.message;
|
|
90
|
+
return String(error);
|
|
91
|
+
}
|
|
92
|
+
|
|
83
93
|
/**
|
|
84
94
|
* A declared path can be a pattern: `exports["./locale/*.json"]` names a folder
|
|
85
95
|
* of files, and `npm pack` lists the files it actually shipped. Exact set
|
|
@@ -292,7 +302,7 @@ async function inspectScratch({ dir, mount, report, packed, scratch }) {
|
|
|
292
302
|
stage: 'install',
|
|
293
303
|
failures: [{
|
|
294
304
|
check: 'host apply',
|
|
295
|
-
message: `apply() throws when a service it never declared is read, which fails the row (a rejecting async apply is awaited the same way): ${error
|
|
305
|
+
message: `apply() throws when a service it never declared is read, which fails the row (a rejecting async apply is awaited the same way): ${failureText(error)}`,
|
|
296
306
|
}],
|
|
297
307
|
files: packed.files,
|
|
298
308
|
};
|
|
@@ -332,9 +342,12 @@ async function inspectScratch({ dir, mount, report, packed, scratch }) {
|
|
|
332
342
|
faceProblems.push('the client module declares no inject list, so the loader calls apply() before its services exist');
|
|
333
343
|
}
|
|
334
344
|
try {
|
|
335
|
-
|
|
345
|
+
// An async client `apply()` rejects after the call returns, exactly like
|
|
346
|
+
// the host half. Awaiting it here keeps a late rejection inside this
|
|
347
|
+
// probe instead of letting it kill the process after the success line.
|
|
348
|
+
await face.apply(absentContext());
|
|
336
349
|
} catch (error) {
|
|
337
|
-
faceProblems.push(`apply() throws when the services are absent, which fails the web boot: ${error
|
|
350
|
+
faceProblems.push(`apply() throws when the services are absent, which fails the web boot (a rejecting async apply is awaited the same way): ${failureText(error)}`);
|
|
338
351
|
}
|
|
339
352
|
await panel.unmount();
|
|
340
353
|
if (faceProblems.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-toolkit",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.31",
|
|
4
4
|
"description": "Preflight, release and test DeepSeek Harness plugins: check a folder or any GitHub repository, wait for npm to actually serve the version, and keep the market index honest.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|