You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.**Should timers be globals or imports?** — Currently `setTimeout` is a global. Keep as global for compatibility?
220
220
2.**Version in URL?** — `host://fs@1` for future breaking changes?
221
221
3.**Capability detection?** — `import { available } from "host://fs"` to check if host provides it?
222
+
223
+
## Implementation Notes
224
+
225
+
### Current Status
226
+
227
+
The `host://` import scheme is now fully implemented:
228
+
229
+
1.**Bundler recognizes `host://` URLs** — Handled in `load_module.rs`
230
+
2.**Host modules resolve to runtime bootstrap** — Each namespace maps to pre-loaded runtime code
231
+
3.**Backward compatibility preserved** — Old `"funee"` imports still work (re-export from host modules)
232
+
233
+
### How It Works
234
+
235
+
1. When the bundler encounters `import { readFile } from "host://fs"`, it recognizes the `host://` scheme
236
+
2. Instead of fetching from network, it resolves to the corresponding host module definition
237
+
3. The host module exports functions that call into Rust ops via deno_core's op system
238
+
4. The runtime bootstrap pre-loads all host module definitions before user code runs
239
+
240
+
### File Structure
241
+
242
+
```
243
+
funee-lib/
244
+
host/
245
+
fs.ts # host://fs → re-exports from bootstrap
246
+
http.ts # host://http → re-exports from bootstrap
247
+
server.ts # host://http/server → re-exports from bootstrap
248
+
process.ts # host://process → re-exports from bootstrap
249
+
time.ts # host://time → re-exports from bootstrap
250
+
watch.ts # host://watch → re-exports from bootstrap
251
+
crypto.ts # host://crypto → re-exports from bootstrap
252
+
console.ts # host://console → re-exports from bootstrap
253
+
```
254
+
255
+
### Testing
256
+
257
+
All `host://` imports are covered by self-hosted tests in `tests/self-hosted/`. These tests use the actual runtime and verify that host functions work correctly.
0 commit comments