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-compiler

v1.0.0

Published

Compiler for APEX mini-app platform - AXML templates, ACSS styles, and JavaScript bundling

Readme

@interswitch/apex-compiler

Compiler for APEX mini-app platform - handles AXML templates, ACSS styles, and JavaScript bundling.

Installation

npm install @interswitch/apex-compiler

Quick Start

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

const result = compile({
  axml: '<view class="container">Hello {{name}}</view>',
  acss: '.container { padding: 20rpx; }',
  js: 'Page({ data: { name: "World" } });',
  json: '{"navigationBarTitleText": "Home"}',
  filename: 'index',
  minify: true,
});

console.log(result.code);    // Compiled JavaScript
console.log(result.css);     // Compiled CSS
console.log(result.config);  // Page configuration

Features

AXML Template Compilation

  • Converts AXML templates to render functions
  • Supports mustache expressions {{...}}
  • Handles directives: a:if, a:elif, a:else, a:for, a:key
  • Supports event handlers: onTap, onChange, etc.
  • Custom component detection
import { compileTemplate, generateRenderFunction } from '@interswitch/apex-compiler';

const ast = compileTemplate('<view a:if="{{show}}">{{message}}</view>');
const { code } = generateRenderFunction(ast);

ACSS Style Compilation

  • Converts rpx units to responsive vw units
  • CSS nesting support
  • Auto vendor prefixing
  • Minification
import { compileStyles, transformRpx } from '@interswitch/apex-compiler';

const result = compileStyles(`
  .card {
    padding: 20rpx;

    .title {
      font-size: 32rpx;
    }
  }
`, { minify: true });

JavaScript Transformation

  • ES6+ transpilation
  • TypeScript support
  • Minification
  • Source map generation
import { transformScript } from '@interswitch/apex-compiler';

const result = transformScript(`
  Page({
    data: { count: 0 },
    increment() {
      this.setData({ count: this.data.count + 1 });
    }
  });
`, { minify: true });

API Reference

compile(options)

Main compilation function that handles all file types.

Options:

| Option | Type | Description | |--------|------|-------------| | axml | string | AXML template source | | acss | string | ACSS style source | | js | string | JavaScript source | | json | string | Page configuration JSON | | filename | string | File name for error reporting | | sourceMap | boolean | Generate source maps | | minify | boolean | Minify output | | isComponent | boolean | Is this a component (vs page) |

Returns:

interface CompileResult {
  code: string;           // Compiled JavaScript
  css?: string;           // Compiled CSS
  config: object;         // Page/component configuration
  map?: object;           // JavaScript source map
  cssMap?: object;        // CSS source map
  errors: CompileError[]; // Compilation errors
  warnings: CompileError[]; // Compilation warnings
  stats: {
    time: number;         // Compilation time (ms)
    originalSize: number; // Original size (bytes)
    compiledSize: number; // Compiled size (bytes)
  };
}

compileTemplate(source, options)

Parses AXML template into an AST.

generateRenderFunction(ast, options)

Generates render function from AXML AST.

compileStyles(source, options)

Compiles ACSS styles to CSS.

transformRpx(css, designWidth)

Converts rpx units to vw.

transformRpx('20rpx', 750); // '2.666667vw'

transformScript(source, options)

Transforms JavaScript/TypeScript code.

minifyCode(code, options)

Minifies JavaScript code.

AXML Syntax

Directives

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

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

<!-- Block element (no DOM output) -->
<block a:if="{{show}}">
  <view>A</view>
  <view>B</view>
</block>

Events

<button onTap="handleTap">Tap me</button>
<input onInput="handleInput" onChange="handleChange" />

Dynamic Attributes

<view class="{{className}}" style="{{styleObj}}">
  Dynamic styling
</view>

ACSS Syntax

rpx Units

rpx (responsive pixel) is automatically converted to vw:

/* Input */
.container {
  padding: 20rpx;
  font-size: 28rpx;
}

/* Output (750 design width) */
.container {
  padding: 2.666667vw;
  font-size: 3.733333vw;
}

CSS Nesting

.card {
  background: white;

  .title {
    font-weight: bold;
  }

  &:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }
}

Error Handling

const result = compile({
  axml: '<view>{{unclosed}',
  filename: 'broken',
});

if (result.errors.length > 0) {
  for (const error of result.errors) {
    console.error(`${error.file}:${error.line} - ${error.message}`);
  }
}

License

MIT