npm.io
0.1.2-rc.10 • Published 23h ago

@mbler/mcx-core

Licence
MIT
Version
0.1.2-rc.10
Deps
8
Size
255 kB
Vulns
0
Weekly
354
Stars
3

@mbler/mcx-core

The MCX DSL compiler — the core of the MCX ecosystem. Compiles .mcx source files into MCBE-compatible JSON components, UI forms, and event systems.

Pipeline

.mcx file → parser → AST → transform (Babel) → compiled JS → MCBE JSON

Features

  • MCX Parser — Parses .mcx source into a tokenized AST (tag, prop)
  • Transform Pipeline — Detects file type (event, ui, component, app) and generates compiled Babel AST
  • Component Compilation — Runs component scripts in a sandboxed VM, generates MCBE JSON, executes file edit operations
  • CJS Transform — Rewrites ESM imports to CommonJS require() for VM execution
  • Image Assets — Compiles PNG, JPG, SVG, GIF image references into MCBE texture assets
  • Rollup/Rolldown Plugin — Seamless .mcx file resolution and transformation in your build pipeline

Installation

pnpm add -D @mbler/mcx-core

Usage

Add the plugin to your Rollup or Rolldown config:

import { rollupPlugin } from '@mbler/mcx-core'

export default {
  plugins: [rollupPlugin({ moduleDir: './modules', tsconfigPath: './tsconfig.json' })],
}

For full documentation, visit the Docs.

License

MIT

Keywords