Commit ece1809
Zachary Whitley
feat(jco): let createJcoPolyfill accept a caller-supplied policy
Previously createJcoPolyfill hard-coded `policy: new AllowAllPolicy()`
via `Omit<PolyfillConfig, 'policy'>` on its signature. That blocked
the natural way to inject env vars / args / preopens into a jco-mode
polyfill — composing with createCliPolicy({env, args}).
This is a small API completion, not a behaviour change: when no
policy is supplied the default is still AllowAllPolicy. The jco
resource bridge (buildJcoImports — already producing InputStream /
OutputStream class constructors with prototype methods) is untouched.
Enables:
const polyfill = createJcoPolyfill({
policy: createCliPolicy({ env: process.env, args: ... })
})
Use case: downstream wrappers (e.g. datafission's
tools/browser-demo/wasi-polyfill-shim) that need to expose a
preview2-shim-shaped surface (camelCase methods + resource classes
on streams) backed by wasi-polyfill, with env captured at init.1 parent 0531cbb commit ece1809
1 file changed
Lines changed: 16 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
337 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
338 | 339 | | |
339 | | - | |
340 | | - | |
341 | | - | |
| 340 | + | |
| 341 | + | |
342 | 342 | | |
343 | | - | |
344 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
345 | 346 | | |
346 | | - | |
347 | | - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
348 | 353 | | |
349 | 354 | | |
350 | | - | |
| 355 | + | |
351 | 356 | | |
352 | 357 | | |
353 | | - | |
| 358 | + | |
354 | 359 | | |
355 | 360 | | |
356 | 361 | | |
| |||
0 commit comments