JSPM

  • Created
  • Published
  • Downloads 904
  • Score
    100M100P100Q101454F
  • License MIT

A Node.js regex-based transpiler of source code.

Package Exports

  • alamode

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (alamode) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

alamode

npm version

alamode is a RegExp-based transpiler of source code in Node.js. It is a fast, low-weight alternative to AST-based transpilers, such as @babel.

Table Of Contents

Installation

alamode can be either installed globally, or as a library. The library can be used either programmatically, or via package.json to refer to a binary in node_modules/.bin from a yarn or npm script.

Global

Install as a global binary from CLI and use to transpile source code files.

Installation Command Usage Command

npm i -g alamode
yarn build
/* project structure */
src
└── index.js
build
├── index.js
└── index.js.map

Dependency

Install as a dependency and use API to run programmatically in other Node.js software, or access the alamode binary via a yarn or npm script in package.json.

Installation Command Usage Command

yarn add -DE alamode


npm install alamode --save-dev
node build
/* build.js */
import alamode from 'alamode'

const src = 'src'
const output = 'build'

;(async () => {
  await alamode({
    src,
    output,
  })
})()
yarn build npm run build
// package.json
{
  "name": "project",
  "version": "1.0.0",
  "description": "Example.",
  "main": "build",
  "scripts": {
    "test": "zoroaster test/spec",
    "build": "alamode src -o build"
  },
  "files": [
    "build"
  ],
  "license": "MIT",
  "devDependencies": {},
  "dependencies": {}
}

Demo

In the demo below, a project's src directory is transpiled to replace import and export statements and placed in the build directory.

Using Package.json Script To Transpile
Transpiling a project's source code into build dir.

CLI

alamode src -o build

API

The package is available by importing its default function:

import alamode from 'alamode'

alamode(
  arg1: string,
  arg2?: boolean,
): void

Call this function to get the result you want.

/* yarn example/ */
import alamode from 'alamode'

(async () => {
  await alamode()
})()

(c) À La Mode 2018