dsh-plugin-toolkit 0.20.14 → 0.20.16
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 +29 -0
- package/README.md +2 -2
- package/lib/compat.mjs +17 -2
- package/lib/doctor.mjs +27 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
## 0.20.16
|
|
2
|
+
|
|
3
|
+
- **`doctor` names a root export that cannot be loaded.** A package whose
|
|
4
|
+
`exports["."]` (or `main`) named a missing file printed `ok` and exited `0`,
|
|
5
|
+
while the same package would fail when the loader imported it; a target that
|
|
6
|
+
was a directory crashed `doctor` with a raw `EISDIR` from `readFileSync`. The
|
|
7
|
+
`root export` check now asks the filesystem what the resolved path is and
|
|
8
|
+
reports a missing file, a directory, or an unreadable file as a named failure
|
|
9
|
+
before reading source. `verify --no-mount` stops at that same `doctor` check
|
|
10
|
+
instead of reaching pack or install. Four fixtures pin the behavior through
|
|
11
|
+
the shipped CLI: a string root, an `exports["."]` string and a conditions
|
|
12
|
+
object naming `missing.js`, and an export naming the `lib` directory all exit
|
|
13
|
+
`1` with a `root export:` line naming the target and no raw `EISDIR`, and
|
|
14
|
+
`verify --no-mount` on the same fixtures exits `1` at `stopped at doctor`
|
|
15
|
+
without a `pack:` failure, while the unmodified `init` scaffold still passes
|
|
16
|
+
both commands.
|
|
17
|
+
|
|
18
|
+
## 0.20.15
|
|
19
|
+
|
|
20
|
+
- **A strict comparison against a wildcard major matches nothing.** `audit
|
|
21
|
+
--remote <owner/repo> --host <version>` treated `>*`, `>x`, `<*` and `<x` as
|
|
22
|
+
"any version" and called every host compatible, while npm reads them as an
|
|
23
|
+
empty set that no release satisfies. The host-range parser now reports
|
|
24
|
+
`incompatible` for those spellings; the inclusive `>=*` and `<=*` forms still
|
|
25
|
+
span every stable host. Regression tests pin the parser, the printed CLI
|
|
26
|
+
verdict and the `--json` row, including the major-only `>1`/`<=1` boundary:
|
|
27
|
+
`>1` rejects 1.2.3 and `<=1` accepts it, in both the text line and
|
|
28
|
+
`compatibility`.
|
|
29
|
+
|
|
1
30
|
## 0.20.14
|
|
2
31
|
|
|
3
32
|
- **The `--jobs` benchmark asserts work, not wall-clock speed.** The throughput
|
package/README.md
CHANGED
|
@@ -683,9 +683,9 @@ the diff in the terminal.
|
|
|
683
683
|
| `patch file` | The path declared above must be a real file |
|
|
684
684
|
| `client entry` | If `dsh.client` is declared, the bundle has to be there |
|
|
685
685
|
| `files list` | Every path `package.json` points at (`exports`, patch, client) must be covered by `files` |
|
|
686
|
-
| `root export` | The loader imports the bare package name; if that module is the CLI
|
|
686
|
+
| `root export` | The loader imports the bare package name; if that module is missing, is a directory, is the CLI, or exports no `apply`, the row mounts nothing while the install reports success |
|
|
687
687
|
|
|
688
|
-
The `root export` check is a source check, not an install. `doctor` resolves the module the loader imports — `exports["."]` when it is a string or a conditions object (`default`, `import`, `require`, `node`, `module-sync`), otherwise `main` — then removes comments and the contents of string, template and regex literals
|
|
688
|
+
The `root export` check is a source check, not an install. `doctor` resolves the module the loader imports — `exports["."]` when it is a string or a conditions object (`default`, `import`, `require`, `node`, `module-sync`), otherwise `main` — then checks that the path is a readable regular file, removes comments and the contents of string, template and regex literals, and looks for a real export. A missing file, a directory and an unreadable file are reported as `root export` failures naming the target instead of being skipped or raising a raw `EISDIR`; on a directory the install would have failed at import too. It accepts `export function apply`, `export async function apply`, `export const apply = ...` (also `let` and `var`), `export { apply }` (including `export { helper as apply }`), `exports.apply = ...`, and an `apply` property in `module.exports = { ... }`. A comment such as `// TODO: export function apply() {}` is not an export, and `doctor` never imports or runs the plugin to decide. `verify --no-mount` runs `doctor` first, so it stops at that same check instead of packing a package whose root cannot load; `npm test` spawns the shipped CLI for both commands on the comment-only fixtures and the missing-file, missing-conditions-file, string-root missing-file and directory fixtures, requires every one to exit `1` with a `root export:` line and no raw `EISDIR`, and requires `verify` to report `stopped at doctor` rather than a `pack:` failure. The unmodified scaffold still passes both commands.
|
|
689
689
|
|
|
690
690
|
Exit code is `0` when the plugin can be installed and `1` when it cannot, so it drops into CI unchanged. `doctor --remote` and `audit --remote` run the same manifest and README checks (`name`, `version`, `engines.dsh`, `dsh field`, `files list`, `readme`) against the `package.json` and README GitHub serves, then check the files the manifest points at, so a bad package name or a README with no Requirements heading is reported before a clone or install. The `name` check is pinned at the process boundary: `npm test` expects the shipped CLI to reject a missing, empty and malformed name (`accepted=0/3`) and to accept a valid plain or scoped control.
|
|
691
691
|
|
package/lib/compat.mjs
CHANGED
|
@@ -120,6 +120,21 @@ function comparator(op, version) {
|
|
|
120
120
|
return { op, version };
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* A comparator set no version can satisfy. npm reads a strict comparison
|
|
125
|
+
* against a wildcard major (`>*`, `<*`, `>x`, `<x`) as `<0.0.0-0`: there is no
|
|
126
|
+
* boundary to start from, so the set is empty rather than unconstrained. An
|
|
127
|
+
* empty comparator array would mean "any version", which is the opposite
|
|
128
|
+
* answer and would call every host compatible.
|
|
129
|
+
*
|
|
130
|
+
* `<0.0.0` is enough to match nothing here: the parser only accepts versions at
|
|
131
|
+
* or above 0.0.0, and the pre-release rule already refuses to let a pre-release
|
|
132
|
+
* host satisfy a comparator that does not name a pre-release of its own tuple.
|
|
133
|
+
*/
|
|
134
|
+
function noVersion() {
|
|
135
|
+
return [comparator('<', full(0, 0, 0))];
|
|
136
|
+
}
|
|
137
|
+
|
|
123
138
|
function lowerBounds(partial, inclusive) {
|
|
124
139
|
const version = filled(partial);
|
|
125
140
|
if (inclusive === true) return [comparator('>=', version)];
|
|
@@ -199,9 +214,9 @@ function expandToken(token) {
|
|
|
199
214
|
}
|
|
200
215
|
if (operator === '=') return plainBounds(partial);
|
|
201
216
|
if (operator === '>=') return partial.major === null ? [] : [comparator('>=', filled(partial))];
|
|
202
|
-
if (operator === '>') return partial.major === null ?
|
|
217
|
+
if (operator === '>') return partial.major === null ? noVersion() : lowerBounds(partial, false);
|
|
203
218
|
if (operator === '<=') return partial.major === null ? [] : upperBounds(partial, true);
|
|
204
|
-
if (operator === '<') return partial.major === null ?
|
|
219
|
+
if (operator === '<') return partial.major === null ? noVersion() : upperBounds(partial, false);
|
|
205
220
|
return null;
|
|
206
221
|
}
|
|
207
222
|
|
package/lib/doctor.mjs
CHANGED
|
@@ -484,9 +484,34 @@ export function checkRootExport(dir, manifest) {
|
|
|
484
484
|
return `exports["."] points at the CLI (${entry}), so the loader's row has no plugin to apply; point it at the module that exports apply`;
|
|
485
485
|
}
|
|
486
486
|
|
|
487
|
+
// A root that cannot be loaded is the same failure as one that exports no
|
|
488
|
+
// apply: the loader imports the bare package name and the row mounts nothing.
|
|
489
|
+
// Missing files and directories are the two shapes a manifest actually ships
|
|
490
|
+
// by accident, and the directory case used to escape as a raw EISDIR. Ask
|
|
491
|
+
// the filesystem what the path is before reading it, so a directory, a
|
|
492
|
+
// broken symlink and an unreadable file all become a named check failure.
|
|
487
493
|
const file = path.resolve(dir, target);
|
|
488
|
-
|
|
489
|
-
|
|
494
|
+
let stat;
|
|
495
|
+
try {
|
|
496
|
+
stat = fs.statSync(file);
|
|
497
|
+
} catch (error) {
|
|
498
|
+
if (error?.code === 'ENOENT' || error?.code === 'ENOTDIR') {
|
|
499
|
+
return `the root export ${entry} does not exist, so the loader cannot import the package`;
|
|
500
|
+
}
|
|
501
|
+
return `the root export ${entry} cannot be read (${error?.code ?? 'filesystem error'}), so the loader cannot import the package`;
|
|
502
|
+
}
|
|
503
|
+
if (stat.isDirectory() === true) {
|
|
504
|
+
return `the root export ${entry} is a directory, not a module, so the loader cannot import it`;
|
|
505
|
+
}
|
|
506
|
+
if (stat.isFile() === false) {
|
|
507
|
+
return `the root export ${entry} is not a regular file, so the loader cannot import it`;
|
|
508
|
+
}
|
|
509
|
+
let source;
|
|
510
|
+
try {
|
|
511
|
+
source = fs.readFileSync(file, 'utf8');
|
|
512
|
+
} catch (error) {
|
|
513
|
+
return `the root export ${entry} cannot be read (${error?.code ?? 'filesystem error'}), so the loader cannot import it`;
|
|
514
|
+
}
|
|
490
515
|
if (exportsApply(source) === false) {
|
|
491
516
|
return `the root export ${entry} does not export apply, so the loader imports the package and mounts nothing`;
|
|
492
517
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-toolkit",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.16",
|
|
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": {
|