npm_typed

    Typed npm library bindings(40+) for js backend

    js
    npm
    react
    ai
    ffi
    Download zip
    Author
    Version
    0.1.16
    License
    MIT
    Last updated
    4 hours ago
    Downloads
    19K

    #mizchi/npm_typed

    Typed npm package bindings for MoonBit, built on top of mizchi/js.

    Inspired by DefinitelyTyped - the repository for high quality TypeScript type definitions. This project aims to be the MoonBit equivalent, providing type-safe FFI bindings for popular npm packages.

    Note: These bindings require installing the corresponding npm packages.

    # Example: Install React dependencies npm install react react-dom # Example: Install Hono npm install hono

    #Installation

    moon add mizchi/js moon add mizchi/npm_typed

    Add to your moon.pkg.json:

    { "import": [ "mizchi/js", "mizchi/js/core", "mizchi/npm_typed/react", "mizchi/npm_typed/hono" ] }

    #Available Packages

    #UI Frameworks

    PackagenpmStatusNote
    reactreact🧪 TestedCore React API
    react_element-🧪 TestedTyped HTML elements for React
    react_domreact-dom🧪 TestedReact DOM
    react_dom_clientreact-dom/client🧪 TestedClient-side rendering
    react_dom_serverreact-dom/server🧪 TestedServer-side rendering
    react_dom_staticreact-dom/static🤖 AI GeneratedStatic rendering
    react_routerreact-router🧪 TestedClient-side routing
    testing_library_react@testing-library/react🧪 TestedReact testing utilities
    preactpreact🧪 TestedLightweight React alternative
    testing_library_preact@testing-library/preact🤖 AI GeneratedPreact testing utilities
    inkink🧪 TestedReact for CLI apps
    ink_ui@inkjs/ui🧪 TestedInk UI components

    #Web Frameworks

    PackagenpmStatusNote
    honohono🧪 TestedFast web framework, middleware support
    better_authbetter-auth🤖 AI GeneratedAuthentication library
    helmethelmet🧪 TestedSecurity headers middleware

    #AI / LLM

    PackagenpmStatusNote
    aiai (Vercel AI SDK)🧪 TestedAI/LLM integration
    modelcontextprotocol@modelcontextprotocol/sdk🧪 TestedMCP server/client
    claude_code@anthropic-ai/claude-code🤖 AI GeneratedClaude Code SDK

    #Cloud Services

    PackagenpmStatusNote
    client_s3@aws-sdk/client-s3🧪 TestedS3-compatible storage (AWS, GCS, R2, MinIO)

    #Database

    PackagenpmStatusNote
    pglite@electric-sql/pglite🧪 TestedEmbedded PostgreSQL
    duckdb@duckdb/duckdb-wasm🤖 AI GeneratedAnalytical database
    drizzledrizzle-orm🤖 AI GeneratedTypeScript ORM (see limitations)
    pgpg🤖 AI GeneratedPostgreSQL client

    #Validation / Schema

    PackagenpmStatusNote
    zodzod🧪 TestedSchema validation
    ajvajv🧪 TestedJSON Schema validator

    #Build Tools

    PackagenpmStatusNote
    terserterser🧪 TestedJavaScript minifier
    vitevite🧪 TestedNext-gen build tool
    unpluginunplugin🤖 AI GeneratedUnified plugin system
    lighthouselighthouse🤖 AI GeneratedWeb performance auditing
    esbuildesbuild🧪 TestedFast bundler
    oxc_minifyoxc-minify🧪 TestedOxc minifier

    #Utilities

    PackagenpmStatusNote
    date_fnsdate-fns🧪 TestedDate manipulation
    semversemver🧪 TestedSemantic versioning
    chalkchalk🧪 TestedTerminal styling
    colorettecolorette🧪 TestedTerminal colors
    dotenvdotenv🧪 TestedEnvironment variables
    chokidarchokidar🧪 TestedFile watching
    yargsyargs🤖 AI GeneratedCLI argument parsing
    debugdebug🤖 AI GeneratedDebug logging
    josejose🧪 TestedJWT/JWE/JWS
    comlinkcomlink🤖 AI GeneratedWeb Worker RPC
    simple_gitsimple-git🤖 AI GeneratedGit operations
    ignoreignore🤖 AI Generated.gitignore parsing
    memfsmemfs🧪 TestedIn-memory file system
    minimatchminimatch🧪 TestedGlob matching
    execaexeca🧪 TestedProcess execution
    pinopino🧪 TestedFast logging
    magic_stringmagic-string🧪 TestedString manipulation

    #Testing / Development

    PackagenpmStatusNote
    vitestvitest🚧 PartialTest runner
    puppeteerpuppeteer🧪 TestedBrowser automation
    playwrightplaywright🧪 TestedBrowser automation
    playwright_test@playwright/test🤖 AI GeneratedPlaywright test framework
    jsdomjsdom🧪 TestedDOM implementation
    happy_domhappy-dom🧪 TestedFast DOM implementation
    global_jsdomglobal-jsdom🧪 TestedJSDOM for testing
    testing_library@testing-library/dom🧪 TestedDOM testing utilities
    mswmsw🧪 TestedMock Service Worker
    ink_testing_libraryink-testing-library🧪 TestedInk testing utilities

    #Parsing

    PackagenpmStatusNote
    htmlparser2htmlparser2🧪 TestedHTML/XML parser
    js_yamljs-yaml🤖 AI GeneratedYAML parser
    source_mapsource-map🧪 TestedSource map utilities
    error_stack_parsererror-stack-parser🧪 TestedStack trace parsing

    #Status Legend

    • 🧪 Tested: Comprehensive test coverage
    • 🚧 Partial: Core functionality implemented
    • 🤖 AI Generated: Needs testing

    #Can't find your library?

    You can easily add new bindings with AI assistance:

    ./_scripts/new-library.sh <package_name>

    See CONTRIBUTING.md for details. Most bindings in this repository were generated with AI agents.

    #Quick Start

    #React Example

    // moon.pkg.json: import mizchi/npm_typed/react, mizchi/npm_typed/react_element

    fn counter(_props : Unit) -> @react.Element {
    let (count, set_count) = @react.useState(0)
    @react_element.div([
    @react_element.span(["Count: \{count}"]),
    @react_element.button(on_click=fn(_) { set_count(count + 1) }, ["+"]),
    ])
    }

    #Hono Example

    // moon.pkg.json: import mizchi/npm_typed/hono

    async fn main {
    let app : @hono.Hono[@core.Any, @core.Any] = @hono.Hono::new()
    app.get("/", fn(c) { c.text("Hello, Hono!") }) |> ignore
    }

    #Zod Example

    // moon.pkg.json: import mizchi/npm_typed/zod

    fn main {
    let user_schema = @zod.object({
    "name": @zod.string(),
    "age": @zod.number().int(),
    })
    let data = @core.new_object()
    data["name"] = @core.any("Alice")
    data["age"] = @core.any(30)
    match user_schema.safeParse(data) {
    Ok(_) => println("Valid!")
    Err(_) => println("Invalid!")
    }
    }

    #Requirements

    This package requires:

    • MoonBit nightly 2025-12-09 or later for ESM #module directive support
    • mizchi/js v0.9.0 or later as a peer dependency

    #LICENSE

    MIT

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io