Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Helzle <[email protected]>
  • Loading branch information
mhsdesign and Sebobo authored Apr 25, 2023
1 parent 456fc40 commit 39d316b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/neos-ui-extensibility-webpack-adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ yarn add -D @neos-project/neos-ui-extensibility-webpack-adapter
## Alternative: Esbuild, vanilla Webpack5 (or any buildsystem with alias resolution)
If you prefer a less opinionated and modern build stack - or better, just want to choose and fully configure the bundler yourself - visit [@neos-project/neos-ui-extensibility](https://github.com/neos/neos-ui/blob/8.3/packages/neos-ui-extensibility) to use the Neos UI plugin API directly.

Note that this adapter uses a build stack created some time ago (webpack4 + babel) and exists mostly for convenience/backwards-compatibility, but is not state of the art and might never be again. So in case you're thinking about patching a new loader/option into the `webpack.config.js` you might as well just use webpack directly or try out esbuild ;).
Note that this adapter uses a build stack created some time ago (Webpack4 + Babel) and exists mostly for convenience/backwards-compatibility, but is not state of the art and might never be again. So in case you're thinking about patching a new loader/option into the `webpack.config.js` you might as well just use Webpack directly or try out esbuild ;).

## Migrating from Neos =< 8.2 `@neos-project/neos-ui-extensibility`

Expand All @@ -32,7 +32,7 @@ This package provides an opinionated Webpack build stack to access the bespoken

All available aliases are listed here: [@neos-project/neos-ui-extensibility/extensibilityMap.json](https://github.com/neos/neos-ui/blob/8.3/packages/neos-ui-extensibility/extensibilityMap.json).
You only need to import the modules, and they will work as if you installed those packages.
So `import React from "react"` will import react at runtime from the Neos UI host and you don't need to install it. (Also the same instance is used, which is important)
So `import React from "react"` will import React at runtime from the Neos UI host and you don't need to install it. (Also the same instance is used, which is important)


## Usage / Technial Neos Ui plugin setup
Expand Down
8 changes: 4 additions & 4 deletions packages/neos-ui-extensibility/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ If you're here looking for the previously original shipped webpack build stack s

## Features

You don't need to recompile the Neos UI to integrate your own Plugins. Many Core functionalities are accessible through the `@neos-project/neos-ui-extensibility` API.
You don't need to recompile the Neos UI to integrate your own Plugins. Many core functionalities are accessible through the `@neos-project/neos-ui-extensibility` API.
This package provides the shims to access to the bespoken API and the alias map: `extensibilityMap.json` to be used for building a plugin.

All aliases are listed here: [@neos-project/neos-ui-extensibility/extensibilityMap.json](https://github.com/neos/neos-ui/blob/8.3/packages/neos-ui-extensibility/extensibilityMap.json).
Expand All @@ -22,10 +22,10 @@ So `import React from "react"` will import react at runtime from the Neos UI hos

## General usage and Concept

A Neos UI plugin must get access to certain important objects and methods like react, CKEditor, and also the bootstrap function.
A Neos UI plugin must get access to certain important objects and methods like React, CKEditor, and also the bootstrap function.

**Concept**
To access the same instance f.x. of React that the Neos UI Host is using, we technically want to do something like: `const {React} = window.NeosUiPluginApi`. The problem being: when we use 3rd party NPM packages in our plugin, they will import react as usual `import React from "react"` which will fail.
To access the same instance f.x. of React that the Neos UI Host is using, we technically want to do something like: `const {React} = window.NeosUiPluginApi`. The problem being: when we use 3rd party NPM packages in our plugin, they will import React as usual `import React from "react"` which will fail.
To solve this issue and also make creating plugins a bit more fancy ✨ we make use of your bundlers import alias feature.

The alias resolution will match any imported path against the `extensibilityMap.json` and redirect it to a shim. The shim will then access the Neos UI plugin API at runtime.
Expand Down Expand Up @@ -167,7 +167,7 @@ By convention your `src/index.js` will import the manifest:
import './manifest.js'
```

In the manifest `src/manifest.js` we will register our plugin with access to the globalRegistry:
In the manifest `src/manifest.js` we will register our plugin with access to the `globalRegistry`:
```js
import manifest from '@neos-project/neos-ui-extensibility';
Expand Down

0 comments on commit 39d316b

Please sign in to comment.