Peregrine targets

Peregrine targets provide access to the custom React hooks and talons used in UI components.

Accessing the Peregrine targets

Access these targets in your intercept files by calling targets.of('@magento/peregrine') on the TargetProvider object.

/* my-custom-interceptors.js */
module.exports = (targets) => {
  const peregrineTargets = targets.of("@magento/peregrine");
};

See the PWA Studio Target Experiments project repository for documented examples of extensions that use PWA Studio's extensibility framework.

Wrapper modules

You can extend the functionality of Peregrine's custom hooks and talons by applying wrapper modules.

The talon.wrapWith(module) method is similar to the interceptor pattern used in Magento backend plugins. Peregrine will dynamically inject the code from the passed module "around" the implementation of a talon, by passing the talon function through the wrapper function before exporting it.

See the Modify talon results tutorial for step-by-step instructions on working with wrapper modules.

Requirements

Wrapper modules for Peregrine must:

Extensions which use wrapper modules must also intercept the Buildpack specialFeatures target and set the feature flag esModule: true.

<!-- The reference doc content is generated automatically from the source code. To update this section, update the doc blocks in the source code -->

data-src=../../../includes/auto-generated/peregrine/lib/targets/peregrine-declare.md