Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bytecodealliance/componentize-js

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bytecodealliance/componentize-js - npm Package Compare versions

Comparing version 0.10.5 to 0.11.0

lib/starlingmonkey_embedding.debug.wasm

2

package.json
{
"name": "@bytecodealliance/componentize-js",
"version": "0.10.5",
"version": "0.11.0",
"homepage": "https://github.com/bytecodealliance/componentize-js#readme",

@@ -5,0 +5,0 @@ "type": "module",

@@ -103,2 +103,19 @@ <div align="center">

### Async Support
To support asynchronous operations, all functions may optionally be written as sync or async functions, even though they will always be turned into sync component functions.
For example, to use `fetch` which requires async calls, we can write the same example component using an async function:
```js
export async function sayHello (name) {
const text = await (await fetch(`http://localhost:8080/${name}`)).text();
console.log(text);
}
```
ComponentizeJS will automatically resolve promises returned by functions to syncify their return values, running the event loop within the JS component to resolution.
This asynchrony is only supported for exported functions - imported functions can only be synchronous pending component-model-level async support.
### CLI

@@ -129,9 +146,9 @@

* `'clocks'`: Support for clocks and duration polls, depends on `wasi:clocks` and `wasi:io`. **When disabled, using any timer functions like setTimeout or setInterval will panic.**
* `'http'`: Support for outbound HTTP via the `fetch` global in JS.
Setting `disableFeatures: ['random', 'stdio', 'clocks']` will disable all features creating a minimal "pure component", that does not depend on any WASI APIs at all and just the target world.
Setting `disableFeatures: ['random', 'stdio', 'clocks', 'http']` will disable all features creating a minimal "pure component", that does not depend on any WASI APIs at all and just the target world.
Note that pure components **will not report errors and will instead trap**, so that this should only be enabled after very careful testing.
Note that features explicitly imported by the target world cannot be disabled - if you target a component to a world
that imports `wasi:clocks`, then `disableFeatures: ['clocks']` will not be supported.
Note that features explicitly imported by the target world cannot be disabled - if you target a component to a world that imports `wasi:clocks`, then `disableFeatures: ['clocks']` will not be supported.

@@ -152,4 +169,3 @@ ## Using StarlingMonkey's `fetch-event`

preview2Adapter?: string,
disableFeatures?: ('stdio' | 'random' | 'clocks')[],
enableFeatures?: ('http')[],
disableFeatures?: ('stdio' | 'random' | 'clocks' | 'http')[],
}): {

@@ -156,0 +172,0 @@ component: Uint8Array,

@@ -69,3 +69,2 @@ import wizer from '@bytecodealliance/wizer';

// we never disable a feature that is already in the target world usage

@@ -82,3 +81,3 @@ const features = [];

}
if (enableFeatures.includes('http')) {
if (!disableFeatures.includes('http')) {
features.push('http');

@@ -99,3 +98,2 @@ }

if (DEBUG_BINDINGS) {

@@ -102,0 +100,0 @@ console.log('--- JS Source ---');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc