dsh-plugin-toolkit 0.20.15 → 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 +17 -0
- package/README.md +2 -2
- package/lib/doctor.mjs +27 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
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
|
+
|
|
1
18
|
## 0.20.15
|
|
2
19
|
|
|
3
20
|
- **A strict comparison against a wildcard major matches nothing.** `audit
|
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/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": {
|