|
1 | | -<p align="center"> |
2 | | - <a href="https://merkur.js.org/docs/getting-started" title="Getting started"> |
3 | | - <img src="https://raw.githubusercontent.com/mjancarik/merkur/master/images/merkur-logo.png" width="100px" height="100px" alt="Merkur illustration"/> |
4 | | - </a> |
5 | | -</p> |
6 | | - |
7 | | -# Merkur |
| 1 | +# @merkur/preact |
8 | 2 |
|
9 | 3 | [](https://github.com/mjancarik/merkur/actions/workflows/ci.yml) |
10 | | -[](https://www.npmjs.com/package/@merkur/core) |
11 | | - |
| 4 | +[](https://www.npmjs.com/package/@merkur/preact) |
| 5 | + |
12 | 6 | [](https://github.com/prettier/prettier) |
13 | 7 |
|
14 | | -The [Merkur](https://merkur.js.org/) is tiny extensible javascript library for front-end microservices(micro frontends). It allows by default server side rendering for loading performance boost. You can connect it with other frameworks or languages because merkur defines easy API. You can use one of six predefined template's library [Preact](https://preactjs.com/), [µhtml](https://github.com/WebReflection/uhtml#readme), [Svelte](https://svelte.dev/) and [vanilla](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) but you can easily extend for others. |
15 | | - |
16 | | -## Features |
17 | | - - Flexible templating engine |
18 | | - - Usable with all tech stacks |
19 | | - - SSR-ready by default |
20 | | - - Easy extensible with plugins |
21 | | - - Tiny - 1 KB minified + gzipped |
| 8 | +Preact integration helpers for [Merkur](https://merkur.js.org/) widgets. Provides client and server entry points, rendering helpers, and CLI scaffolding support for Preact-based Merkur widgets. |
22 | 9 |
|
23 | | -## Getting started |
| 10 | +## Installation |
24 | 11 |
|
25 | 12 | ```bash |
26 | | -npx @merkur/create-widget <name> |
| 13 | +npm install @merkur/preact |
| 14 | +``` |
27 | 15 |
|
28 | | -cd name |
| 16 | +Peer dependencies required: |
29 | 17 |
|
30 | | -npm run dev // Point your browser at http://localhost:4444/ |
| 18 | +```bash |
| 19 | +npm install @merkur/core @merkur/plugin-component |
31 | 20 | ``` |
32 | | - |
33 | | -## Documentation |
34 | 21 |
|
35 | | -To check out [live demo](https://merkur.js.org/demo) and [docs](https://merkur.js.org/docs), visit [https://merkur.js.org](https://merkur.js.org). |
| 22 | +## Exports |
36 | 23 |
|
37 | | -## Contribution |
| 24 | +| Export | Description | |
| 25 | +|--------|-------------| |
| 26 | +| `@merkur/preact/client` | Client-side Preact rendering helpers | |
| 27 | +| `@merkur/preact/server` | Server-side rendering helpers (uses `preact-render-to-string`) | |
| 28 | +| `@merkur/preact/entries/client.js` | Preact client widget entry point | |
| 29 | +| `@merkur/preact/entries/server.js` | Preact server widget entry point | |
| 30 | +| `@merkur/preact/cli` | CLI helpers for widget scaffolding | |
38 | 31 |
|
39 | | -Contribute to this project via [Pull-Requests](https://github.com/mjancarik/merkur/pulls). |
| 32 | +## Documentation |
40 | 33 |
|
41 | | -We are using [Changesets](https://github.com/changesets/changesets) for versioning and releasing. To add a changeset describing your changes, run `npm run changeset` from the root of the monorepo. |
| 34 | +Full documentation and setup guide at [merkur.js.org](https://merkur.js.org/docs/getting-started). |
| 35 | + |
| 36 | +## Breaking Changes |
| 37 | + |
| 38 | +### v0.47.0 |
| 39 | + |
| 40 | +The `@merkur/preact/webpack` export (`applyBabelLoader`, `applyPreactConfig`) has been **removed**, along with the `@babel/preset-react`, `@merkur/tool-webpack`, and `babel-loader` peer dependencies. |
| 41 | + |
| 42 | +If your webpack config used these helpers, configure the Preact Babel preset manually: |
| 43 | + |
| 44 | +```javascript |
| 45 | +// webpack.config.js |
| 46 | +module.exports = { |
| 47 | + module: { |
| 48 | + rules: [ |
| 49 | + { |
| 50 | + test: /\.(js|ts|tsx|jsx|mjs)$/, |
| 51 | + exclude: /node_modules/, |
| 52 | + use: { |
| 53 | + loader: 'babel-loader', |
| 54 | + options: { |
| 55 | + presets: [ |
| 56 | + [ |
| 57 | + '@babel/preset-react', |
| 58 | + { runtime: 'automatic', importSource: 'preact' }, |
| 59 | + ], |
| 60 | + ], |
| 61 | + }, |
| 62 | + }, |
| 63 | + }, |
| 64 | + ], |
| 65 | + }, |
| 66 | +}; |
| 67 | +``` |
42 | 68 |
|
43 | | -> **Note:** The release process is documented in the [root README](https://github.com/mjancarik/merkur#release), which is the source of truth for all contribution and release guidelines. |
| 69 | +Alternatively, migrate to the Vite-based Storybook setup described in the [Storybook integration guide](https://merkur.js.org/docs/storybook-integration-into-merkur), which no longer requires webpack or Babel configuration. |
44 | 70 |
|
45 | | ---- |
| 71 | +## Contribution |
46 | 72 |
|
47 | | -Thank you to all the people who already contributed to Merkur! |
| 73 | +Contribute via [Pull-Requests](https://github.com/mjancarik/merkur/pulls). |
48 | 74 |
|
49 | | -<a href="https://github.com/mjancarik/merkur/graphs/contributors"> |
50 | | - <img src="https://contrib.rocks/image?repo=mjancarik/merkur" /> |
51 | | -</a> |
| 75 | +We use [Changesets](https://github.com/changesets/changesets) for versioning. Run `npm run changeset` from the monorepo root to add a changeset for your changes. |
0 commit comments