
Security News
Risky Biz Podcast: Making Reachability Analysis Work in Real-World Codebases
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
ember-cli-preprocess-registry
Advanced tools
The ember-cli-preprocess-registry package provides a registry for managing preprocessors in Ember CLI. It allows you to register and manage preprocessors for various types of files, such as JavaScript, CSS, and templates, enabling custom transformations and optimizations during the build process.
Registering a preprocessor
This feature allows you to register a custom preprocessor for JavaScript files. The `add` method takes the type of file ('js' in this case), an object with the preprocessor's name, file extension, and a `toTree` function that defines the transformation logic.
const PreprocessRegistry = require('ember-cli-preprocess-registry');
let registry = new PreprocessRegistry();
registry.add('js', {
name: 'my-js-preprocessor',
ext: 'js',
toTree(tree) {
// Custom transformation logic
return tree;
}
});
Using a preprocessor
This feature demonstrates how to use a registered preprocessor. After registering a CSS preprocessor, you can load it using the `load` method, which applies the preprocessor's transformation logic to the provided tree.
const PreprocessRegistry = require('ember-cli-preprocess-registry');
let registry = new PreprocessRegistry();
registry.add('css', {
name: 'my-css-preprocessor',
ext: 'css',
toTree(tree) {
// Custom transformation logic
return tree;
}
});
let cssTree = registry.load('css', someCssTree);
broccoli-persistent-filter is a Broccoli plugin that provides a base class for creating persistent filters. It allows you to create custom filters that can transform files in a Broccoli tree. Unlike ember-cli-preprocess-registry, which is specific to Ember CLI, broccoli-persistent-filter is a more general-purpose tool for creating file transformations in Broccoli.
ember-cli-htmlbars is an Ember CLI plugin that provides a preprocessor for compiling Handlebars templates. It is specifically designed for handling Handlebars templates in Ember applications, whereas ember-cli-preprocess-registry provides a more general framework for managing various types of preprocessors.
ember-cli-babel is an Ember CLI plugin that integrates Babel for transpiling JavaScript files. It allows you to use the latest JavaScript features in your Ember applications. While ember-cli-preprocess-registry provides a way to register and manage custom preprocessors, ember-cli-babel focuses specifically on JavaScript transpilation using Babel.
Used by Ember CLI to provide a registry of preprocessors. The main types
used throughout the system are css
, template
, js
.
You can access both your own addon's and your parent's (whichever item is including you)
registry via the setupPreprocessorRegistry
hook in your addon's index.js
.
Example:
module.exports = {
name: 'special-js-sauce',
setupPreprocessorRegistry(type, registry) {
if (type !== 'parent') { return; }
registry.add('js', {
name: 'special-js-sauce-preprocessor',
toTree() {
// do your thing here....
}
});
}
}
Registry.prototype.add(type: String, plugin: Plugin)
Adds the provided plugin to the registry for the type specified.
Example:
class SpecialSauce {
get name() { return 'special-sauce'; }
toTree(tree) {
// return new tree after processing
}
}
registry.add('js', new SpecialSauce);
Registry.prototype.load(type: String): Plugin[]
Returns an array of all plugins that are registered for a given type.
Registry.prototype.extensionsForType(type: String): string[]
Returns an array of all known extensions for a given type.
Registry.prototype.remove(type: String, plugin: Plugin)
Removes the provided plugin from the specified type listing.
npm install
npm test
v5.0.0 (2023-04-05)
minify-css
plugin. End users of ember-cli will need ember-cli-clean-css
or alternatives.FAQs
Preprocessor registry used internally by ember-cli.
The npm package ember-cli-preprocess-registry receives a total of 159,635 weekly downloads. As such, ember-cli-preprocess-registry popularity was classified as popular.
We found that ember-cli-preprocess-registry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.