Registry / devops / alloy-compiler

alloy-compiler

JSON →
library0.2.7jsnpmunverified

Compiler for Appcelerator Titanium Alloy components, enabling standalone compilation of controllers and views. Current version 0.2.7, updated periodically. Unlike the full Alloy CLI, this package can be integrated into custom build toolchains, including Webpack-based setups. It provides createCompiler and createCompileConfig functions for programmatic use, with support for platform-specific output and source maps. Requires Node >=10.

npm install alloy-compiler
INSTALL
IMPORT
SIG · ALLOY-COMPILER
A
alloy-compiler
devopsjavascriptv0.2.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createCompiler
const { createCompiler } = require('alloy-compiler');
import { createCompiler } from 'alloy-compiler';
Package uses CommonJS; ESM import may not work without transpilation.
createCompileConfig
const { createCompileConfig } = require('alloy-compiler');
const createCompileConfig = require('alloy-compiler').createCompileConfig;
Both are valid but destructuring is preferred.
compiler.compileComponent
const compiler = createCompiler(options); const result = compiler.compileComponent(options);
const { compileComponent } = require('alloy-compiler');
compileComponent is an instance method, not a static export.

Shows basic usage to compile an Alloy controller using createCompileConfig and createCompiler.

const { createCompiler, createCompileConfig } = require('alloy-compiler'); const compileConfig = createCompileConfig({ projectDir: '/path/to/project', alloyConfig: { platform: 'ios', deploytype: 'development' } }); const compiler = createCompiler({ compileConfig, webpack: false }); const result = compiler.compileComponent({ file: '/path/to/project/app/controllers/index.js' }); console.log(result.code);
Debug
Known issues
gotchaThe package uses CommonJS; direct ESM imports may fail in Node.js versions that support ES modules.
fix
Use require() or transpile with a bundler like Webpack.
affects: >=0.0.0
gotchacreateCompiler requires compileConfig option even if you pass webpack: true.
fix
Always provide compileConfig object with projectDir and alloyConfig.
affects: >=0.0.0
gotchacompileComponent expects file path; if the file does not exist and content is not provided, it will throw.
fix
Ensure the file exists or provide content option.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: createCompiler is not a function
Wrong import pattern (e.g., import instead of require for CommonJS module).
fix
Use const { createCompiler } = require('alloy-compiler');
TypeError: compiler.compileComponent is not a function
Attempted to import compileComponent directly from package instead of calling it on a compiler instance.
fix
First create compiler with createCompiler, then call compiler.compileComponent().
Error: "projectDir" is required
createCompileConfig or createCompiler called without projectDir in options.compileConfig.
fix
Add projectDir to the options object: { compileConfig: { projectDir: '/path' } }
Upgrade
Version history
0.2.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
36 hits · last 30 days
node
34
Amazon
1
OpenAI (training)
1
Resources
alloy-compiler — npm install alloy-compiler · libregistry