Registry / web-framework / ember-cli-preprocess-registry

ember-cli-preprocess-registry

JSON →
library5.0.1jsnpmunverified

Ember CLI Preprocessor Registry (npm: `ember-cli-preprocess-registry`) is an internal utility package within the Ember CLI ecosystem, providing a centralized registry for managing various preprocessors for `css`, `template`, and `js` assets. It is currently at version 5.0.1 and primarily maintained as needed for Ember CLI development, without a strict independent release cadence. Its key differentiator is its deep integration into Ember CLI's build pipeline, offering a standard way for addons to register and interact with asset transformations via hooks like `setupPreprocessorRegistry`. This package is not typically consumed directly by end-user applications but is a core component for Ember CLI addons wishing to extend asset compilation.

npm install ember-cli-preprocess-registry
INSTALL
IMPORT
SIG · EMBER-CLI-PREPROCE
E
ember-cli-preprocess-registry
web-frameworkjavascriptv5.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

Registry
const Registry = require('ember-cli-preprocess-registry');
import { Registry } from 'ember-cli-preprocess-registry';
The package's primary export is the `Registry` class via CommonJS default export. While internals are ES6ified, direct consumption as ESM may require bundler/transpiler support as there's no explicit `exports` map for ESM in `package.json` v5.x.
Registry
import Registry from 'ember-cli-preprocess-registry';
const { Registry } = require('ember-cli-preprocess-registry');
For consumers in an ESM context, a default import usually works with CommonJS default exports, often facilitated by bundlers. However, most addon interactions occur via the `registry` object provided by Ember CLI's `setupPreprocessorRegistry` hook, not by directly importing this class.
registry (parameter)
module.exports = { name: 'my-addon', setupPreprocessorRegistry(type, registry) { if (type === 'parent') { registry.add('js', { name: 'my-js-preprocessor', toTree(tree) { return tree; } }); } } };
import { registry } from 'ember-cli-preprocess-registry'; // Incorrect way to obtain the registry instance for addon usage
Most Ember CLI addons interact with this package indirectly by receiving an instance of `Registry` (named `registry`) via the `setupPreprocessorRegistry` hook, rather than importing the `Registry` class directly. This is the primary pattern for extending Ember CLI's build process.

Demonstrates how an Ember CLI addon uses the `setupPreprocessorRegistry` hook to add a custom JavaScript preprocessor to the build pipeline.

module.exports = { name: 'special-js-sauce', setupPreprocessorRegistry(type, registry) { if (type !== 'parent') { return; } registry.add('js', { name: 'special-js-sauce-preprocessor', toTree(tree) { console.log('Processing JavaScript tree with special-js-sauce-preprocessor'); // In a real scenario, 'tree' would be a Broccoli node and processing // would return a new Broccoli node. For demonstration, we return it as is. return tree; } }); console.log('Registered special-js-sauce-preprocessor for type "js"'); const jsPlugins = registry.load('js'); console.log(`Current JS plugins: ${jsPlugins.map(p => p.name).join(', ')}`); } };
Debug
Known issues
breakingVersion 5.0.0 dropped support for Node.js versions older than 16. Ensure your Node.js environment meets the '16.* || >= 18' requirement.
fix
Upgrade your Node.js installation to version 16 or 18+.
affects: >=5.0.0
breakingIn version 5.0.0, the package was ES6ified, and support for legacy template plugins was entirely removed. Existing code relying on these deprecated template plugin types will break.
fix
Refactor template preprocessors to use modern Ember CLI plugin patterns. Legacy template plugins are no longer supported and must be rewritten.
affects: >=5.0.0
breakingThe `registry.remove()` method was broken in version 5.0.0, failing to remove plugins by name. This functionality was restored in v5.0.1. Addons relying on dynamically removing plugins by name would have experienced issues in v5.0.0.
fix
Ensure you are using `ember-cli-preprocess-registry@5.0.1` or later if your addon relies on removing plugins by name.
affects: =5.0.0
gotchaPlugins added to the registry must implement a `name` getter and a `toTree(tree)` method (for Broccoli-compatible plugins). Failing to provide these can lead to runtime errors within the Ember CLI build.
fix
Ensure your preprocessor plugin object includes a `name` property (getter) and a `toTree` method that accepts a Broccoli tree and returns a new/modified tree.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Node.js v14.x is not supported by ember-cli-preprocess-registry@5.x
Running an Ember CLI project with `ember-cli-preprocess-registry` version 5.x on an unsupported Node.js version (e.g., Node.js < 16).
fix
Upgrade your Node.js environment to version 16 or 18 and above. For example, use `nvm install 18 && nvm use 18`.
TypeError: Cannot read properties of undefined (reading 'add') at setupPreprocessorRegistry
Attempting to call `registry.add` or other methods on an undefined `registry` object, often due to an incorrect `type` check or a misconfigured addon.
fix
Verify that your `setupPreprocessorRegistry` hook correctly receives the `registry` argument and that any conditional logic for `type` allows the `registry` object to be used when appropriate (e.g., `if (type === 'parent')`).
Preprocessor plugin 'my-plugin' must define a `name` property.
A custom preprocessor plugin object passed to `registry.add` is missing the required `name` property.
fix
Add a `name` getter to your plugin object, e.g., `get name() { return 'my-plugin'; }`.
Upgrade
Version history
5.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
ember-cli-preprocess-registry — npm install ember-cli-preprocess-registry · libregistry