Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
alloy-compiler
Advanced tools
Compiler for Alloy components
This packages contains the standalone Alloy compiler. In most cases you should be using it in Webpack powered Alloy projects, you will only need it separately if you are writing build tools with very specific needs.
npm i alloy-compiler
const { createCompiler, createCompileConfig } = require('alloy-compiler');
Creates a new Alloy compiler instance.
const { createCompiler } = require('alloy-compiler');
const compiler = createCompiler({
compileConfig: {
projectDir: '/path/to/my/project',
alloyConfig: {
platform: 'ios',
deploytype: 'development'
}
},
webpack: true
});
Expects an options
object with the following properties:
compileConfig
object
Configuration that will be passed to the Alloy compiler.
You can either pass an object returned by createCompileConfig
or directly pass the same options accepted by that function. The config object will then be created from the passed options.
webpack
boolean
false
Whether or not to create a special compiler instance that creates optimized output Webpack.
Creates a new Alloy compile configuration based on the passed options.
const { createCompileConfig } = require('alloy-compiler');
const compileConfig = createCompileConfig({
projectDir: '/path/to/my/project',
alloyConfig: {
platform: 'ios',
deploytype: 'development'
}
});
Expects an options
object with the following properties:
projectDir
string
Path to the root directory of the Alloy project.
alloyConfig
object
Alloy configuration. Expects an object
with the following structure:
{
platform: string // 'ios' or 'android'
deploytype: string // 'development', 'test' or 'production'
}
logLevel
number
Log level for the internal logger.
buildLog
BuildLog
BuildLog
for the specified projectDir
Compiles the controller and view of an Alloy component.
Returns a result object with the following structure:
{
code: string,
map: object, // Source map
dependencies: array // List of dependencies used during compilation like view and style file
}
const { createCompiler } = require('alloy-compiler');
const compiler = createCompiler({
compileConfig: {
projectDir: '/path/to/my/project',
alloyConfig: {
platform: 'ios',
deploytype: 'development'
}
}
});
const result = compiler.compileComponent({
file: '/path/to/my/project/app/controllers/index.js'
});
Expects an options
object with the following properties:
file
string
Full path to the controller or view file that should be compiled. The compiler will automatically look for all possible associated files of the component (controller/view/style) and process them.
content
string
Content of file
, if already known. The compiler will automatically read the file
's content if this is omitted.
inputSourceMap
object
Input source map. The compiler will create a new source map if this is omitted.
FAQs
Compiler for Alloy components
We found that alloy-compiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.