dsh-plugin-toolkit 0.20.16 → 0.20.18

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 CHANGED
@@ -1,3 +1,39 @@
1
+ ## 0.20.18
2
+
3
+ - **`verify` resolves the installed root the way the loader does.** It used to
4
+ import the file `main` named, so a tarball whose `exports` map had no `.`
5
+ entry passed `verify --no-mount` even though `import("<name>")` failed with
6
+ `ERR_PACKAGE_PATH_NOT_EXPORTED`. The installed copy is now imported by its
7
+ bare package name from a probe module beside it, so Node's own `exports`
8
+ resolution decides. The missing `.` entry is reported as a `root export`
9
+ failure and the command exits `1`; the same fixture with `exports["."]` exits
10
+ `0` and prints `imported its host half`. A package that declares neither
11
+ `exports` nor `main` still has no root module to import, so its success line
12
+ keeps saying the host import was skipped. Two checked-in fixtures
13
+ (`test/fixtures/verify-exports-no-dot` and `verify-exports-dot`) now pin both
14
+ sides through the shipped CLI process, including the exit code, so `npm test`
15
+ fails if the no-`.` tarball ever exits `0` again. The README states that the
16
+ bare specifier, not a file path, is what `verify` imports.
17
+
18
+ ## 0.20.17
19
+
20
+ - **`audit` reports a declared bundle whose folder is gone.** When a package
21
+ name stayed in `dsh.profile.bundles` but its `node_modules/<name>` folder had
22
+ been removed, the install scan never saw the package and `audit --home`
23
+ printed only its healthy siblings, so the command exited `0` and hid the
24
+ reason the loader could not mount it. The scan now starts from the profile's
25
+ declared bundles and prints a `missing` row with an `install` failure naming
26
+ the absent `node_modules/<name>` path; the valid siblings are still listed
27
+ and the command exits `1`. A package that is absent but undeclared is still
28
+ ignored, so ordinary dependencies do not appear. A regression test pins the
29
+ module result and the spawned CLI exit code in both directions: the declared
30
+ missing bundle exits `1`, and the same home with the name removed from the
31
+ profile exits `0` without printing it. A checked-in home at
32
+ `test/fixtures/missing-declared-bundle` also keeps the minimal case — one
33
+ declared name and no `node_modules` directory at all — reproducible through
34
+ `audit --home`, so the scan cannot fall back to "nothing installed" and exit
35
+ clean again.
36
+
1
37
  ## 0.20.16
2
38
 
3
39
  - **`doctor` names a root export that cannot be loaded.** A package whose
package/README.md CHANGED
@@ -80,7 +80,7 @@ npx dsh-plugin-toolkit@latest release . --pr --merge
80
80
 
81
81
  ![Five steps, and the failure each one catches](https://raw.githubusercontent.com/WJDdidi-1/dsh-plugin-toolkit/main/docs/pipeline.svg)
82
82
 
83
- The order matters. Packing first means the check reads the file list npm will publish, not the folder you have. Installing the tarball means the root export is imported the way the loader imports it. Mounting means the client bundle is actually executed, in jsdom, with a host that records what it registered.
83
+ The order matters. Packing first means the check reads the file list npm will publish, not the folder you have. Installing the tarball means the root is imported by its bare specifier — the package name the loader uses — not by a file path taken from `main` or `exports["."]`. Node ignores `main` once `exports` exists, so a package whose `exports` map has no `"."` entry fails with `ERR_PACKAGE_PATH_NOT_EXPORTED` at that step even though the file is present. Mounting means the client bundle is actually executed, in jsdom, with a host that records what it registered.
84
84
 
85
85
  Each step exists because a plugin once got past the step before it and still installed into nothing.
86
86
 
@@ -324,6 +324,15 @@ damaged `package.json` in a package that is neither in `dsh.profile.bundles` nor
324
324
  readable enough to expose a `dsh` field is still an ordinary dependency and is
325
325
  skipped, so one broken transitive install does not fail every audit.
326
326
 
327
+ A declared bundle can also be missing entirely. If a name stays in
328
+ `dsh.profile.bundles` after its `node_modules/<name>` folder is removed (an
329
+ interrupted install, or a package deleted by hand), `audit` prints a `missing`
330
+ row with an `install` failure naming the absent folder and exits `1`, while
331
+ still listing the healthy plugins on the same run. An absent package that the
332
+ profile never declared is not an install record, so it is not invented in the
333
+ report; a regression test removes the name from the profile and requires the
334
+ shipped CLI to exit `0` without printing it.
335
+
327
336
  ## Edit a plugin that is already installed
328
337
 
329
338
  The host already swaps a rebuilt bundle without a page reload: it watches each plugin's entry artifact and reports a `rebuilt` frame on `/plugins/events`. `dev` puts the new file where the host is looking, then **proves** the frame arrived instead of asking you to check by eye.
@@ -683,9 +692,11 @@ the diff in the terminal.
683
692
  | `patch file` | The path declared above must be a real file |
684
693
  | `client entry` | If `dsh.client` is declared, the bundle has to be there |
685
694
  | `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 missing, is a directory, is the CLI, or exports no `apply`, the row mounts nothing while the install reports success |
695
+ | `root export` | The loader imports the bare package name; if that module is missing, is a directory, is the CLI, exports no `apply`, or the `exports` map has no `.` entry, the row mounts nothing while the install reports success |
696
+
697
+ 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.
687
698
 
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.
699
+ `verify --no-mount` does not reopen the path `doctor` read. It imports the installed package by its bare name, the way the loader does, so Node's `exports` resolution decides. An `exports` map with no `.` entry therefore fails with `ERR_PACKAGE_PATH_NOT_EXPORTED` even when `main` names a working file, and `verify` reports a `root export` failure naming the missing `.` export instead of passing. `verify --no-mount` still runs `doctor` first, so a root the source check already rejects stops at that same check instead of packing. `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
700
 
690
701
  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
702
 
@@ -914,7 +925,7 @@ ok packed 5 file(s), installed the tarball, mounted the panel
914
925
  My panel This panel came from dsh-plugin init. Clicks: 0
915
926
  ```
916
927
 
917
- It packs, installs that tarball into a throwaway directory, then mounts the bundle **from the installed copy**. A bundle that only inserts a subpath patch needs no root module; in that case 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:
928
+ 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. 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:
918
929
 
919
930
  ```sh
920
931
  $ npx dsh-plugin-toolkit verify .
package/lib/audit.mjs CHANGED
@@ -111,6 +111,22 @@ function unreadableInstalled({ dir, name, profile, manifestPath, message }) {
111
111
  };
112
112
  }
113
113
 
114
+ /**
115
+ * A name in `dsh.profile.bundles` with no folder to mount. Unlike an ordinary
116
+ * dependency, this one is a declared plugin: the loader will look for it on
117
+ * startup, so a missing install has to appear in the audit instead of vanishing
118
+ * with the folder.
119
+ */
120
+ function missingInstalled({ dir, name, profile }) {
121
+ return {
122
+ dir,
123
+ manifest: { name },
124
+ profile,
125
+ missing: true,
126
+ error: `${dir} is missing, so dsh.profile.bundles lists "${name}" but there is no node_modules/${name} folder to mount`,
127
+ };
128
+ }
129
+
114
130
  /** Every package folder inside every profile, scoped names included. */
115
131
  export function listInstalled({ home = DEFAULT_HOME } = {}) {
116
132
  const root = resolvePath(home);
@@ -119,81 +135,99 @@ export function listInstalled({ home = DEFAULT_HOME } = {}) {
119
135
  const found = [];
120
136
  for (const profile of fs.readdirSync(profiles).sort()) {
121
137
  const modules = path.join(profiles, profile, 'node_modules');
122
- if (fs.existsSync(modules) === false) continue;
123
- const declared = new Set(readProfileBundles({ home, profile }).bundles);
124
- for (const entry of fs.readdirSync(modules).sort()) {
125
- if (entry.startsWith('.') === true) continue;
126
- const candidates = entry.startsWith('@')
127
- ? fs
128
- .readdirSync(path.join(modules, entry))
129
- .sort()
130
- .map((name) => ({ dir: path.join(modules, entry, name), name: `${entry}/${name}` }))
131
- : [{ dir: path.join(modules, entry), name: entry }];
132
- for (const { dir, name } of candidates) {
133
- // A broken package.json is only evidence of a plugin when the profile
134
- // says it mounts that name. Without that record an ordinary dependency
135
- // whose install was interrupted must stay out of the audit, or one bad
136
- // transitive package would turn every profile red.
137
- const listedInProfile = declared.has(name) === true;
138
- const manifestPath = path.join(dir, 'package.json');
139
- if (fs.existsSync(manifestPath) === false) {
140
- if (listedInProfile === true) {
141
- found.push(
142
- unreadableInstalled({
143
- dir,
144
- name,
145
- profile,
146
- manifestPath,
147
- message: `${manifestPath} is missing, so the installed copy has no manifest to read`,
148
- }),
149
- );
138
+ // Read the declarations before looking at node_modules: a declared bundle
139
+ // whose folder is gone is exactly the case this scan must not omit.
140
+ const declared = new Set(
141
+ readProfileBundles({ home, profile }).bundles.filter((name) => typeof name === 'string' && name.trim() !== ''),
142
+ );
143
+ const present = new Set();
144
+ if (fs.existsSync(modules) === true) {
145
+ for (const entry of fs.readdirSync(modules).sort()) {
146
+ if (entry.startsWith('.') === true) continue;
147
+ const candidates = entry.startsWith('@')
148
+ ? fs
149
+ .readdirSync(path.join(modules, entry))
150
+ .sort()
151
+ .map((name) => ({ dir: path.join(modules, entry, name), name: `${entry}/${name}` }))
152
+ : [{ dir: path.join(modules, entry), name: entry }];
153
+ for (const { dir, name } of candidates) {
154
+ if (declared.has(name) === true) present.add(name);
155
+ // A broken package.json is only evidence of a plugin when the profile
156
+ // says it mounts that name. Without that record an ordinary dependency
157
+ // whose install was interrupted must stay out of the audit, or one bad
158
+ // transitive package would turn every profile red.
159
+ const listedInProfile = declared.has(name) === true;
160
+ const manifestPath = path.join(dir, 'package.json');
161
+ if (fs.existsSync(manifestPath) === false) {
162
+ if (listedInProfile === true) {
163
+ found.push(
164
+ unreadableInstalled({
165
+ dir,
166
+ name,
167
+ profile,
168
+ manifestPath,
169
+ message: `${manifestPath} is missing, so the installed copy has no manifest to read`,
170
+ }),
171
+ );
172
+ }
173
+ continue;
150
174
  }
151
- continue;
152
- }
153
- let manifest;
154
- try {
155
- // Strip the BOM the same way doctor does: a manifest saved by Notepad
156
- // is still readable, and treating it as unreadable would be a false
157
- // alarm in the other direction.
158
- const text = String(fs.readFileSync(manifestPath, 'utf8')).replace(/^\uFEFF/u, '').trim();
159
- manifest = JSON.parse(text);
160
- } catch (error) {
161
- // A package.json that is listed in the profile but does not parse is
162
- // still an installed plugin, and "it does not parse" is exactly what
163
- // the author needs to hear.
164
- if (listedInProfile === true) {
165
- found.push(
166
- unreadableInstalled({
167
- dir,
168
- name,
169
- profile,
170
- manifestPath,
171
- message: `${manifestPath} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
172
- }),
173
- );
175
+ let manifest;
176
+ try {
177
+ // Strip the BOM the same way doctor does: a manifest saved by Notepad
178
+ // is still readable, and treating it as unreadable would be a false
179
+ // alarm in the other direction.
180
+ const text = String(fs.readFileSync(manifestPath, 'utf8')).replace(/^\uFEFF/u, '').trim();
181
+ manifest = JSON.parse(text);
182
+ } catch (error) {
183
+ // A package.json that is listed in the profile but does not parse is
184
+ // still an installed plugin, and "it does not parse" is exactly what
185
+ // the author needs to hear.
186
+ if (listedInProfile === true) {
187
+ found.push(
188
+ unreadableInstalled({
189
+ dir,
190
+ name,
191
+ profile,
192
+ manifestPath,
193
+ message: `${manifestPath} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
194
+ }),
195
+ );
196
+ }
197
+ continue;
174
198
  }
175
- continue;
176
- }
177
- if (manifest === null || typeof manifest !== 'object' || Array.isArray(manifest) === true) {
178
- if (listedInProfile === true) {
179
- found.push(
180
- unreadableInstalled({
181
- dir,
182
- name,
183
- profile,
184
- manifestPath,
185
- message: `${manifestPath} is readable JSON but not a package object, so its dsh field cannot be checked`,
186
- }),
187
- );
199
+ if (manifest === null || typeof manifest !== 'object' || Array.isArray(manifest) === true) {
200
+ if (listedInProfile === true) {
201
+ found.push(
202
+ unreadableInstalled({
203
+ dir,
204
+ name,
205
+ profile,
206
+ manifestPath,
207
+ message: `${manifestPath} is readable JSON but not a package object, so its dsh field cannot be checked`,
208
+ }),
209
+ );
210
+ }
211
+ continue;
188
212
  }
189
- continue;
213
+ // Only packages that declare themselves as plugins. node_modules is full
214
+ // of ordinary dependencies, and auditing those is noise.
215
+ if (manifest.dsh === undefined) continue;
216
+ found.push({ dir, manifest, profile });
190
217
  }
191
- // Only packages that declare themselves as plugins. node_modules is full
192
- // of ordinary dependencies, and auditing those is noise.
193
- if (manifest.dsh === undefined) continue;
194
- found.push({ dir, manifest, profile });
195
218
  }
196
219
  }
220
+
221
+ // A name can stay in `dsh.profile.bundles` after its folder is removed (an
222
+ // interrupted install, a deleted package). The loader still tries to mount
223
+ // it, so the audit reports the missing install instead of leaving only the
224
+ // healthy siblings visible.
225
+ for (const name of declared) {
226
+ if (present.has(name) === true) continue;
227
+ const dir = path.join(modules, name);
228
+ if (fs.existsSync(dir) === true) continue;
229
+ found.push(missingInstalled({ dir, name, profile }));
230
+ }
197
231
  }
198
232
  return found;
199
233
  }
@@ -737,9 +771,13 @@ export async function audit({
737
771
  }
738
772
 
739
773
  const profileFiles = new Map();
740
- const rows = installed.map(({ dir, manifest, profile, manifestPath, unreadable = false, error }) => {
774
+ const rows = installed.map(({ dir, manifest, profile, manifestPath, unreadable = false, missing = false, error }) => {
741
775
  let failures;
742
- if (unreadable === true) {
776
+ if (missing === true) {
777
+ // The folder is gone, so there is no manifest for doctor to read. The
778
+ // profile record is the evidence, and the row must name the absent path.
779
+ failures = [{ check: 'install', message: error }];
780
+ } else if (unreadable === true) {
743
781
  // doctor would throw on the same file; keep the read error the install
744
782
  // scan already recorded so the row names the unreadable package.json.
745
783
  failures = [{ check: 'manifest', message: error }];
@@ -752,7 +790,12 @@ export async function audit({
752
790
  }
753
791
  const loaded = graph?.ok === true ? graph.ids.has(manifest.name) : null;
754
792
  let explanation = null;
755
- if (unreadable === true) {
793
+ if (missing === true) {
794
+ explanation = {
795
+ reason: `dsh.profile.bundles lists it, but ${dir} is missing, so there is no installed copy to mount`,
796
+ action: `reinstall ${manifest.name} (for example \`dsh plugin add ${manifest.name}\`), then restart the app`,
797
+ };
798
+ } else if (unreadable === true) {
756
799
  explanation = {
757
800
  reason: `${manifestPath} is unreadable, so the loader cannot tell what to mount`,
758
801
  action: `reinstall ${manifest.name} so its package.json is written completely`,
@@ -778,6 +821,7 @@ export async function audit({
778
821
  ...split(failures),
779
822
  loaded,
780
823
  unreadable: unreadable === true,
824
+ missing: missing === true,
781
825
  reason: explanation?.reason ?? null,
782
826
  action: explanation?.action ?? null,
783
827
  };
@@ -787,11 +831,21 @@ export async function audit({
787
831
  const detailIndent = ' '.repeat(width + 24);
788
832
  for (const row of rows) {
789
833
  const state =
790
- row.unreadable === true ? 'unreadable' : row.loaded === null ? '?' : row.loaded === true ? 'loaded' : 'not loaded';
791
- const reason = row.loaded === false || row.unreadable === true ? ` — ${row.reason}` : '';
834
+ row.missing === true
835
+ ? 'missing'
836
+ : row.unreadable === true
837
+ ? 'unreadable'
838
+ : row.loaded === null
839
+ ? '?'
840
+ : row.loaded === true
841
+ ? 'loaded'
842
+ : 'not loaded';
843
+ const reason = row.missing === true || row.loaded === false || row.unreadable === true ? ` — ${row.reason}` : '';
792
844
  io.log(`${row.name.padEnd(width)} ${String(row.version).padEnd(8)} ${state.padEnd(10)} ${describe(row)}${reason}`);
793
845
  for (const failure of row.failures) io.log(`${' '.repeat(width + 22)}${failure.check}: ${failure.message}`);
794
- if (row.loaded === false || row.unreadable === true) io.log(`${detailIndent}fix: ${row.action}`);
846
+ if (row.missing === true || row.loaded === false || row.unreadable === true) {
847
+ io.log(`${detailIndent}fix: ${row.action}`);
848
+ }
795
849
  }
796
850
 
797
851
  const failed = rows.filter((row) => row.hard.length > 0);
package/lib/verify.mjs CHANGED
@@ -170,6 +170,23 @@ export async function verify({ dir, mount = true }) {
170
170
  }
171
171
  }
172
172
 
173
+ /**
174
+ * Import the installed package exactly as the loader does: `import(name)` from
175
+ * a module that sits beside the installed copy. Resolving the bare specifier
176
+ * here, rather than reading `main` or `exports["."]` ourselves, means Node's
177
+ * own rules decide whether the root is importable. That is what catches an
178
+ * `exports` map with no `.` entry: Node ignores `main` once `exports` exists,
179
+ * so the bare import fails with ERR_PACKAGE_PATH_NOT_EXPORTED while the file
180
+ * `main` names is still present.
181
+ */
182
+ async function importInstalledRoot(name, scratch) {
183
+ const { pathToFileURL } = await import('node:url');
184
+ const probe = path.join(scratch, 'install', 'verify-root.mjs');
185
+ fs.writeFileSync(probe, `export default await import(${JSON.stringify(name)});\n`);
186
+ const loaded = await import(pathToFileURL(probe).href);
187
+ return loaded.default;
188
+ }
189
+
173
190
  /**
174
191
  * The part of `verify` that needs the installed copy. It runs inside the
175
192
  * scratch directory's try/finally, so every stage here is cleaned up whether
@@ -207,40 +224,52 @@ async function inspectScratch({ dir, mount, report, packed, scratch }) {
207
224
  // the same import here is the only way to know the row will have an apply —
208
225
  // 0.8.0 shipped a package whose root export was the CLI, installed cleanly,
209
226
  // and mounted nothing.
227
+ //
228
+ // Importing the file `main` names would be a different question. Node ignores
229
+ // `main` as soon as a package has an `exports` map, so a map with no `.` entry
230
+ // fails `import(name)` with ERR_PACKAGE_PATH_NOT_EXPORTED even when `main`
231
+ // points at a working module. The probe module below lives beside the
232
+ // installed package, so the bare specifier is resolved by the same algorithm
233
+ // the loader uses, not by the toolkit's own location.
210
234
  const rootFile = rootEntry(report.manifest);
235
+ const declaredRoot =
236
+ (report.manifest.exports !== undefined && report.manifest.exports !== null) ||
237
+ typeof report.manifest.main === 'string';
211
238
  let hostFace = null;
212
- // A bundle that inserts a subpath plugin needs no root module, so there is
213
- // nothing to import. The success line must not claim it imported a host half
214
- // that was skipped.
239
+ // A bundle that inserts a subpath plugin and declares no root at all needs no
240
+ // root module, so there is nothing to import. The success line must not claim
241
+ // it imported a host half that was skipped.
215
242
  let hostImported = false;
216
- if (rootFile !== null) {
217
- const absolute = path.join(installed, rootFile);
218
- if (fs.existsSync(absolute) === false) {
219
- return {
220
- ok: false,
221
- stage: 'install',
222
- failures: [{ check: 'root export', message: `the tarball does not ship ${rootFile}, which package.json points the loader at` }],
223
- files: packed.files,
224
- };
225
- }
243
+ if (declaredRoot === true) {
244
+ let loaded;
226
245
  try {
227
- const { pathToFileURL } = await import('node:url');
228
- const loaded = await import(pathToFileURL(absolute).href);
229
- hostFace = loaded;
230
- hostImported = true;
231
- if (typeof loaded.apply !== 'function') {
246
+ loaded = await importInstalledRoot(report.manifest.name, scratch);
247
+ } catch (error) {
248
+ if (error?.code === 'ERR_PACKAGE_PATH_NOT_EXPORTED') {
232
249
  return {
233
250
  ok: false,
234
251
  stage: 'install',
235
- failures: [{ check: 'root export', message: `the installed ${rootFile} exports no apply, so the loader's row mounts nothing` }],
252
+ failures: [{
253
+ check: 'root export',
254
+ message: 'the installed package has no exports["."], so importing its bare name fails with ERR_PACKAGE_PATH_NOT_EXPORTED; add a "." entry that names the module exporting apply',
255
+ }],
236
256
  files: packed.files,
237
257
  };
238
258
  }
239
- } catch (error) {
240
259
  return {
241
260
  ok: false,
242
261
  stage: 'install',
243
- failures: [{ check: 'root export', message: `the installed ${rootFile} does not import: ${error.message}` }],
262
+ failures: [{ check: 'root export', message: `the installed ${rootFile ?? report.manifest.name} does not import: ${error.message}` }],
263
+ files: packed.files,
264
+ };
265
+ }
266
+ hostFace = loaded;
267
+ hostImported = true;
268
+ if (typeof loaded.apply !== 'function') {
269
+ return {
270
+ ok: false,
271
+ stage: 'install',
272
+ failures: [{ check: 'root export', message: `the installed ${rootFile ?? report.manifest.name} exports no apply, so the loader's row mounts nothing` }],
244
273
  files: packed.files,
245
274
  };
246
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-toolkit",
3
- "version": "0.20.16",
3
+ "version": "0.20.18",
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": {