Commit 5f9f20e
authored
fix: native module resolution breaks validation loop for ha:pdf (#111)
* fix: native module resolution breaks validation loop for ha:pdf
The module resolution loop checked only Object.keys(newSources) to
decide whether to continue resolving. Native modules (like ha:ziplib)
have no .js source — only module.json metadata — so the loop broke
early with valid=false and an empty errors array, producing the
cryptic 'Validation failed: •' message.
Root cause: ha:pdf imports ha:ziplib (native). The resolution loop
loaded ziplib.json but not ziplib.js (doesn't exist). Since
newSources was empty, it broke out of the loop before passing the
JSON metadata to the validator. The validator then couldn't confirm
ziplib was resolved, returning valid=false with no errors.
Fix: check all three sources (newSources, newModuleJsons, newDtsSources)
before deciding nothing was found. This allows native module metadata
to flow through and lets the validator recognise them as resolved.
Applied to both register_handler and register_module validation loops.
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
* fix: address PR #111 review feedback — clarify comment wording
- Changed 'no ha:/host: prefix' to 'missing ha: or host: prefix'
to avoid confusion with the slash character
- Note: registerModuleImpl loop doesn't have the early-break pattern
so it was never affected by the bug (commit message corrected)
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>
---------
Signed-off-by: Simon Davies <simongdavies@users.noreply.github.com>1 parent c6ed248 commit 5f9f20e
1 file changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1220 | 1220 | | |
1221 | 1221 | | |
1222 | 1222 | | |
1223 | | - | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
1224 | 1230 | | |
1225 | 1231 | | |
1226 | 1232 | | |
| |||
1401 | 1407 | | |
1402 | 1408 | | |
1403 | 1409 | | |
1404 | | - | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
1405 | 1416 | | |
1406 | 1417 | | |
1407 | 1418 | | |
| |||
0 commit comments