
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@holoscript/component
Advanced tools
HoloScript WASM Component for WASI Preview 3 Component Model.
This package provides HoloScript parsing, validation, and compilation as a portable WASM Component that can be instantiated from any language with Component Model support.
npm install @holoscript/component
import * as holoscript from '@holoscript/component';
// Parse HoloScript source
const source = `
composition "MyScene" {
object "Cube" @grabbable {
geometry: "cube"
position: [0, 1, 0]
}
}`;
const parseResult = holoscript.parser.parse(source);
if (parseResult.ok) {
console.log('Parsed:', parseResult.ok.name);
console.log('Objects:', parseResult.ok.objects.length);
}
// Validate
const validation = holoscript.validator.validate(source);
console.log('Valid:', validation.valid);
// Compile to Unity C#
const unityCode = holoscript.compiler.compile(source, 'unity-csharp');
console.log(unityCode.text);
// List available traits
const traits = holoscript.validator.listTraits();
console.log('Available traits:', traits.map((t) => t.name).join(', '));
from wasmtime import Engine, Store, Component, Linker
# Load the component
engine = Engine()
store = Store(engine)
component = Component.from_file(engine, 'holoscript.component.wasm')
# Create instance
linker = Linker(engine)
instance = linker.instantiate(store, component)
# Use parser
source = '''
composition "PyScene" {
object "Sphere" @physics {
geometry: "sphere"
position: [0, 2, 0]
}
}
'''
result = instance.exports['holoscript:core/parser'].parse(store, source)
print(f"Scene name: {result.ok.name}")
# List traits
traits = instance.exports['holoscript:core/validator'].list_traits(store)
print(f"Found {len(traits)} traits")
use wasmtime::*;
use wasmtime_wasi::preview2::*;
fn main() -> anyhow::Result<()> {
let engine = Engine::default();
let component = Component::from_file(&engine, "holoscript.component.wasm")?;
let linker = Linker::new(&engine);
let mut store = Store::new(&engine, WasiCtx::builder().build());
let instance = linker.instantiate(&mut store, &component)?;
// Call parser
let parser = instance.get_typed_func::<(String,), (ParseResult,)>(&mut store, "holoscript:core/parser#parse")?;
let source = r#"
composition "RustScene" {
object "Cube" { geometry: "cube" }
}
"#;
let (result,) = parser.call(&mut store, (source.to_string(),))?;
println!("Parsed scene: {}", result.ok.name);
Ok(())
}
The component exposes four interfaces defined in WIT:
parse(source: string) -> result<composition-node, list<diagnostic>> - Parse source to ASTparse-header(source: string) -> result<string, string> - Parse just the composition namevalidate(source: string) -> validation-result - Validate source codetrait-exists(name: string) -> bool - Check if a trait existsget-trait(name: string) -> option<trait-def> - Get trait definitionlist-traits() -> list<trait-def> - List all 2,000+ VR traitslist-traits-by-category(category: string) -> list<trait-def> - Filter by categorycompile(source: string, target: compile-target) -> compile-result - Compile to targetcompile-ast(ast: composition-node, target: compile-target) -> compile-result - Compile from ASTlist-targets() -> list<compile-target> - List available targetsSupported targets:
unity-csharp - Unity C# scriptsgodot-gdscript - Godot GDScriptaframe-html - A-Frame VR HTMLthreejs - Three.js JavaScriptbabylonjs - Babylon.js JavaScriptgltf-json - glTF 2.0 JSONglb-binary - GLB binarygenerate-object(description: string) -> result<string, string> - Generate object from NLgenerate-scene(description: string) -> result<string, string> - Generate scene from NLsuggest-traits(description: string) -> list<trait-def> - Suggest traits for descriptionwasm32-wasip1 target# Install Rust target
rustup target add wasm32-wasip1
# Install jco
npm install -g @bytecodealliance/jco
# Build the component
cargo build --release --target wasm32-wasip1
# Create component binary
wasm-tools component new target/wasm32-wasip1/release/holoscript_component.wasm \
--adapt wasi_snapshot_preview1.command.wasm \
-o dist/holoscript.component.wasm
# Generate JS bindings
jco transpile dist/holoscript.component.wasm -o dist --name holoscript
# Generate TypeScript types
jco types dist/holoscript.component.wasm -o dist/holoscript.d.ts
Or simply:
npm run build
# Rust tests
cargo test
# JavaScript tests (requires built component)
npm run test:js
MIT
FAQs
HoloScript WASM Component for WASI Preview 3
We found that @holoscript/component demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.