mhsdesign/polyfillneosuiguestframeapi

Installs: 667

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 1

Language:JavaScript

Type:neos-package

1.0.2 2022-04-06 10:41 UTC

This package is auto-updated.

Last update: 2024-04-06 15:29:22 UTC


README

Neos Ui

MhsDesign.PolyfillNeosUiGuestFrameApi

When Neos.Ui version greater or equal to 7.2 is installed, this package does 'nothing' ^^ (no js will be loaded)

Why do i need it

This package provides a polyfill to access the package '@neos-project/neos-ui-guest-frame' via the custom consumerApi solution of the Neos.Ui on earlier Ui versions.

Neos.Ui supports since FEATURE: Consumer Api for @neos-project/neos-ui-guest-frame #2945 the possibility to import from '@neos-project/neos-ui-guest-frame' in a custom extension.

The Feature was merged with https://github.com/neos/neos-ui/releases/tag/7.2.0 and can be used in a custom extension with "@neos-project/neos-ui-extensibility": "^7.2". But that will work only work when the extension is used with a Neos.Ui host with at least version 7.2 but not older.

This package serves as a polyfill for previous Neos.Ui Version (back to 5.3).

Implementation

The implementation is rather hacky as we need to implement in the Host Ui what will later be implemented here: https://github.com/neos/neos-ui/blob/master/packages/neos-ui/src/apiExposureMap.js#L148

So we intercept what is exported via the consumer API and add the exports of the '@neos-project/neos-ui-guest-frame' package.

Of course, this makes use of global javascript objects and functions internally used by the consumer api, but unless the implementation doesn't change (what is unlikely) for the past targeted Neos.Ui versions (5.3, 7.0, 7.1) that polyfill will continue to work. If something were to be changed, the javascript will tell you with nice crafted messages in the console ;)

When Neos.Ui version greater or equal to 7.2 is installed, this package does nothing ^^ (no js will be loaded)

Replace this package

If you dont want to include the polyfill, because you know you have at least ui 7.2 installed, then you can do a simple composer replace a la: https://github.com/neos/flow-development-collection/blob/d559aca053fd64a3b2d8ed3e3c19942f61f3b9ee/composer.json#L40