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

yoga-wasm-web

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yoga-wasm-web

  • 0.3.0
  • npm
  • Socket score

Version published
Weekly downloads
300K
decreased by-58.74%
Maintainers
1
Weekly downloads
 
Created
Source

yoga-wasm-web

Yoga but in WebAssembly and ASM.js. This is an opinionated fork from pinqy520/yoga-layout-wasm with the following changes:

  • Stick to commit eea87c3 of Yoga, which supports gap.
  • Fix missing YGMeasureMode binding.
  • Fix missing YGUnit binding.
  • Set flag DYNAMIC_EXECUTION=0 for emcc to remove eval and Function executions.
  • Set flag TEXTDECODER=0.
  • Force the ENVIRONMENT to be web.
  • Add pre.js to set document as this.
  • Replace Rollup with esbuild for bundling.
  • Remove the asm.js build.
  • Enable LTO.
  • Enable SIMD128.

Install & Build

To develop this project locally, you need to clone the repo and fetch the yoga submodule first. Also, emcc is required to build this project too.

After that, install npm dependencies:

pnpm i

And run the build script:

pnpm build

WASM

To use the WASM build (take Node.js as an example):

import fs from 'fs'
import initYoga from 'yoga-wasm-web'

const yoga = await initYoga(
  fs.readFileSync('./node_modules/yoga-wasm-web/dist/yoga.wasm')
)

You can use other ways to provide the WASM binary too.

ASM.js

To use the ASM.js build:

import initYoga from 'yoga-wasm-web/asm'

const yoga = initYoga()

FAQs

Package last updated on 09 Jan 2023

Did you know?

Socket

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.

Install

Related posts

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