Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
ember-cli-preprocess-registry
Advanced tools
Preprocessor registry used internally by ember-cli.
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
FAQs
Preprocessor registry used internally by ember-cli.
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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.