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
Copy file name to clipboardExpand all lines: rfcs/2024-05-19-on-demand-isolated-component.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,7 @@ For the purposes of reasoning about what may or may not be part of a component's
83
83
84
84
### Isolation
85
85
86
-
This techniques in this document are centered on making components out of [Wasm][wasm]. Therefor, when the term isolation is used, it mainly refers to the properties enabled by the Wasm runtime insofar as we may access it in a web browser. In a typical case, a Wasm module:
86
+
The techniques in this document are centered on making components out of [Wasm][wasm]. Therefor, when the term isolation is used, it mainly refers to the properties enabled by the Wasm runtime insofar as we may access it in a web browser. In a typical case, a Wasm module:
87
87
88
88
- Will have its own, unshared buffer of memory
89
89
- May only import objects, capabilities and metadata from "outside" the runtime when they are explicitly provided by its host
@@ -147,7 +147,7 @@ The response has `Content-Type: application/wasm` and the body is an octet strea
147
147
148
148
With the [Build Server](#build-server) in place - enabled by the [code transformation](#code-transformation) toolchains that are available today and maintained by the [Bytecode Alliance][bytecode-alliance] - we have the basic ingredients needed to assemble a low-friction workflow.
149
149
150
-
Web browsers do not currently support [Wasm Components][wasm-components]. Foretunately, Wasm Components can be expressed in terms of Core Wasm, so it is possible to polyfill support for Wasm Components in web browsers.
150
+
Web browsers do not currently support [Wasm Components][wasm-components]. Fortunately, Wasm Components can be expressed in terms of Core Wasm, so it is possible to polyfill support for Wasm Components in web browsers.
151
151
152
152
The [js-component-bindgen] Rust crate provides an API for transforming any valid Wasm Component into browser-compatible Core Wasm, including corresponding TypeScript definitions and high-level JavaScript bindings that export the component's API (as described in its [WIT][wit] definition). Conveniently, the [js-component-bindgen] crate can also be compiled to Wasm and run in a web browser.
153
153
@@ -165,7 +165,7 @@ The Service Worker intercepts `GET` requests to a well-known local path that is
165
165
4. Make a request to [`POST /api/v0/component`](#post-apiv0component) on a running [Build Server](#build-server) using the prepared request body
166
166
5. Make a request for the prepared [Wasm Component][wasm-components] using [`GET /api/v0/component/:id`](#get-apiv0componentid) on a running Build Server
167
167
6. Invoke the [`transpile`][js-component-bindgen-transpile] API provided by [js-component-bindgen] and cache the returned files at the appropriate paths
168
-
7. Create a wrapper ESM that imports the cached artifacts re-exports the component API
168
+
7. Create a wrapper ESM that imports the cached artifacts and re-exports the component API
169
169
8. Respond to the intercepted request with the generated wrapper module
170
170
171
171
## PAQ
@@ -180,6 +180,10 @@ Wasm Components in their raw form are portable. When we polyfill the component,
180
180
181
181
Additionally, once polyfilled the Wasm Component effectively consists of many files (the basic Hello World becomes 5 essential files, or 23 if you include all the TypeScript definition files). This makes them cumbersome to deliver as compared to a single Wasm Component.
182
182
183
+
**JavaScript Wasm Components inline a whole JS VM. Won't this take up a lot of space in cache?**
184
+
185
+
Yes. Each instance of the JS VM equals about 8MB of Wasm. There are strategies we might explore that may enable code-sharing under certain circumstances. But, for now this problem will remain unaddressed.
0 commit comments