Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ember-cli-preprocess-registry

ember-cli391.8kMIT5.0.1

Preprocessor registry used internally by ember-cli.

readme

ember-cli-preprocessor-registry

Used by Ember CLI to provide a registry of preprocessors. The main types used throughout the system are css, template, js.

Addon Usage

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....
      }
    });
  }
}

API

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.

Running Tests

npm install
npm test

changelog

v5.0.1 (2023-05-11)

:bug: Bug Fix

  • #118 Restore removing of plugins by name. This is extensively used by embroider and the addon ecosystem. (@kategengler)

Committers: 1

v5.0.0 (2023-04-05)

:boom: Breaking Change

  • #109 Drop support for Node < 16 (@kategengler)
  • #22 (@rwjblue)
    • ES6ify
    • Remove support for legacy template plugins (they already didn't work in ember-cli, so no need to keep support around internally).
    • Remove support for registry.add('<type>', '<some package name>') in favor of registry.add('<type>', instanceWithExpectedInterface);
    • Remove built-in default minify-css plugin. End users of ember-cli will need ember-cli-clean-css or alternatives.

:house: Internal

Committers: 2

v4.0.0

4.0 was yanked due to accidentally introducing a breaking change into ember-cli. Please see this issue for more information.

v3.3.0

Enhancement

  • #57 preprocessMinifyCss: Add processPlugins() as fallback for failing relativeRequire() (@Turbo87)

v3.2.2 (2019-02-27)

:bug: Bug Fix

Committers: 1

v3.2.1 (2019-02-21)

:bug: Bug Fix

Committers: 1

v3.2.0 (2019-02-08)

:house: Internal

Committers: 1

Changelog