New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fmu

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fmu

Fast module utilities

0.0.1
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

A collection of JS module utilities written in Rust

Usage

The package is published to npm as a WebAssembly module. Install with:

$ npm install fmu
import { init, guessJsSyntax } from 'fmu'

// initialize wasm (MUST call this before any other APIs)
await init()

const code = `exports.foo = 'bar'`
console.log(await guessJsSyntax(code)) // "CJS"

Note: For Vite, you have to pass a custom URL to init(). For example:

import { init } from 'fmu'
import wasmUrl from 'fmu/wasm?url'
await init(wasmUrl)

See examples for usage n different setups.

Development

Follow the official guide to install Rust. Also install wasm-pack to build Rust files into WebAssembly.

# Build wasm for dev (e.g. testing examples)
$ npm run dev

# Build wasm for publishing
$ npm run build

# Run unit and integration tests
$ cargo test

Sponsors

Sponsors

License

MIT

Keywords

javascript

FAQs

Package last updated on 18 Jul 2022

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