diff options
| author | Luke Hoersten <[email protected]> | 2026-06-14 18:42:29 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2026-06-14 18:42:29 -0500 |
| commit | 731040bcf844c4ad88dca1ada2f84c2e400d3c87 (patch) | |
| tree | 8a0b06bce2cd819b77d5ba372cbf30cd5aeb5c63 /scrypted/package.json | |
| parent | d2608f76820eee161622faee764c81e87c40d2da (diff) | |
scrypted: rewrite top to use globals — Scripts plugin can't resolve @scrypted/sdk import
The Scripts plugin sandbox (in @scrypted/core) doesn't resolve ESM
imports of npm modules — saving the script with `import sdk, {...} from
'@scrypted/sdk'` produced:
Error: Cannot find module '@scrypted/sdk'
...
at t.scryptedEval (.../scrypted-eval.ts:102:29)
Fix: destructure runtime values from the `sdk` global the plugin
injects, use `require('dns').promises` for the Node mDNS lookup, and
declare runtime type aliases as `any` so the file still parses on a
machine without @scrypted/sdk installed locally.
Also drop the `as ScryptedInterface` cast in handleCameraEvent — it was
the only place an SDK enum was used as a type rather than a value, and
just storing the string is fine.
Editor-only diagnostics (NodeJS namespace, Buffer) remain — they
resolve in the Scrypted Node runtime and only show up in clangd/tsc
without @types/node locally.
Diffstat (limited to 'scrypted/package.json')
0 files changed, 0 insertions, 0 deletions
