npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@qt-test/apex-dsl-compiler

v0.1.0

Published

AXML/ACSS DSL compiler for APEX mini-app platform

Readme

@interswitch/apex-compiler

AXML/ACSS compiler for APEX mini-app platform

This package compiles APEX DSL (AXML templates and ACSS styles) into JavaScript code that works with the APEX runtime.

Installation

npm install @interswitch/apex-compiler

Usage

Programmatic API

import { compile, compileAXML, compileACSS } from '@interswitch/apex-compiler';

// Compile a complete page/component
const result = compile({
  axml: '<view class="container"><text>{{message}}</text></view>',
  acss: '.container { padding: 20rpx; }',
  json: { component: true }
});

console.log(result.code);
console.log(result.styles);

// Compile AXML only
const template = compileAXML('<view a:for="{{items}}">{{item}}</view>');
console.log(template.render);

// Compile ACSS only
const styles = compileACSS('.btn { width: 200rpx; color: #333; }');
console.log(styles.css);

CLI

# Compile a single file
apexc compile pages/index/index.axml -o dist/

# Compile a directory
apexc compile src/ -o dist/

# Watch mode
apexc compile src/ -o dist/ --watch

AXML Syntax

Basic Elements

<!-- View container -->
<view class="container">
  <text>Hello World</text>
</view>

<!-- Data binding -->
<text>{{message}}</text>
<view class="item-{{index}}">{{item.name}}</view>

<!-- Attribute binding -->
<image src="{{imageUrl}}" mode="aspectFit" />

Directives

<!-- Conditional rendering -->
<view a:if="{{condition}}">Shown if true</view>
<view a:elif="{{other}}">Else if</view>
<view a:else>Else</view>

<!-- List rendering -->
<view a:for="{{items}}" a:for-item="item" a:for-index="idx">
  {{idx}}: {{item.name}}
</view>

<!-- Key for optimization -->
<view a:for="{{items}}" a:key="id">{{item.name}}</view>

Event Binding

<!-- Tap event -->
<button bindtap="handleTap">Click me</button>

<!-- With event object -->
<input bindinput="handleInput" />

<!-- Catch (stop propagation) -->
<view catchtap="handleTap">Won't bubble</view>

<!-- Pass data -->
<button bindtap="handleTap" data-id="{{item.id}}">{{item.name}}</button>

Built-in Components

<!-- View -->
<view class="container" style="padding: 10px;">Content</view>

<!-- Text -->
<text selectable="{{true}}">Selectable text</text>

<!-- Image -->
<image src="/images/logo.png" mode="aspectFit" lazy-load />

<!-- Button -->
<button type="primary" loading="{{isLoading}}">Submit</button>

<!-- Input -->
<input type="text" placeholder="Enter name" value="{{name}}" bindinput="onInput" />

<!-- Scroll View -->
<scroll-view scroll-y style="height: 300px;">
  <view a:for="{{items}}">{{item}}</view>
</scroll-view>

<!-- Swiper -->
<swiper autoplay circular>
  <swiper-item a:for="{{banners}}">
    <image src="{{item.url}}" />
  </swiper-item>
</swiper>

Templates & Slots

<!-- Define template -->
<template name="userCard">
  <view class="card">
    <text>{{name}}</text>
    <text>{{age}}</text>
  </view>
</template>

<!-- Use template -->
<template is="userCard" data="{{...user}}" />

<!-- Slots in components -->
<my-component>
  <view slot="header">Header content</view>
  <view>Default slot content</view>
  <view slot="footer">Footer content</view>
</my-component>

ACSS Syntax

ACSS is CSS with extensions for mini-app development.

RPX Units

/* rpx = responsive pixel, auto-scales with screen width */
/* 750rpx = full screen width on any device */
.container {
  width: 750rpx;
  padding: 20rpx;
  font-size: 28rpx;
}

Standard CSS

.button {
  background-color: #1890ff;
  color: white;
  border-radius: 8rpx;
  padding: 16rpx 32rpx;
}

.button:active {
  opacity: 0.8;
}

Import

@import './common.acss';
@import '/styles/theme.acss';

Variables (CSS Custom Properties)

:root {
  --primary-color: #1890ff;
  --text-color: #333;
}

.button {
  background: var(--primary-color);
  color: var(--text-color);
}

Compiler Output

Input

<!-- index.axml -->
<view class="page">
  <text class="title">{{title}}</text>
  <button bindtap="handleClick">Click</button>
</view>

Output (simplified)

export function render(_ctx) {
  return h('view', { class: 'page' }, [
    h('text', { class: 'title' }, [_ctx.title]),
    h('button', { bindtap: _ctx.handleClick }, ['Click'])
  ]);
}

Architecture

┌─────────────────────────────────────────────────────────┐
│                    Source Files                          │
│         (.axml, .acss, .json, .js)                      │
└─────────────────────────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                      Lexer                               │
│            (Tokenize source code)                        │
└─────────────────────────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                      Parser                              │
│         (Build Abstract Syntax Tree)                     │
└─────────────────────────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                    Transformer                           │
│    (Optimize, validate, transform AST)                   │
└─────────────────────────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                   Code Generator                         │
│          (Generate JavaScript output)                    │
└─────────────────────────────────────────────────────────┘
                          │
                          ▼
┌─────────────────────────────────────────────────────────┐
│                    Output Files                          │
│            (.js, .css, .json)                           │
└─────────────────────────────────────────────────────────┘

License

MIT