@capri-js/preact
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,18 @@ | ||
## @capri-js/preact [1.0.2](https://github.com/capri-js/capri/compare/@capri-js/preact@1.0.1...@capri-js/preact@1.0.2) (2022-06-01) | ||
### Bug Fixes | ||
* add island wrapper div ([5baff01](https://github.com/capri-js/capri/commit/5baff01fecd492a4e5daac690183531431d773a0)) | ||
* export types ([9377dbf](https://github.com/capri-js/capri/commit/9377dbf6cafe00e6e1de0137ddb525df40f603bc)) | ||
* make plugin options optional ([152d371](https://github.com/capri-js/capri/commit/152d3717bfa4ed4f43eb3c0683a12bb9d5ac7351)) | ||
### Dependencies | ||
* **@capri-js/vite-plugin:** upgraded to 1.0.2 | ||
## @capri-js/preact [1.0.1](https://github.com/capri-js/capri/compare/@capri-js/preact@1.0.0...@capri-js/preact@1.0.1) (2022-06-01) | ||
@@ -2,0 +19,0 @@ |
import { CapriAdapterPluginOptions } from "@capri-js/vite-plugin"; | ||
export { prerender } from "./prerender.js"; | ||
export default function (opts: CapriAdapterPluginOptions): import("vite").Plugin[]; | ||
export type { GetStaticPaths, RenderFunction, RenderResult, ServerEntry, } from "@capri-js/vite-plugin"; | ||
export default function (opts?: CapriAdapterPluginOptions): import("vite").Plugin[]; |
/// <reference types="vite-plugin-island/types" /> | ||
import capri from "@capri-js/vite-plugin"; | ||
export { prerender } from "./prerender.js"; | ||
export default function (opts) { | ||
export default function (opts = {}) { | ||
return capri({ | ||
@@ -6,0 +6,0 @@ ...opts, |
export function renderMarkerFragment(Component, props, scriptProps, json) { | ||
return (<> | ||
return ( | ||
// In order to hydrate a Preact component it must be the first child element. | ||
// To guarantee this, we wrap it in an extra div and set it to | ||
// `display: contents` in order to not affect the styling. | ||
<div data-island-root style={{ display: "contents" }}> | ||
<Component {...props}/> | ||
<script {...scriptProps} dangerouslySetInnerHTML={{ __html: json }}/> | ||
</>); | ||
</div>); | ||
} |
{ | ||
"name": "@capri-js/preact", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "", | ||
@@ -16,3 +16,3 @@ "author": "Felix Gnass <fgnass@gmail.com>", | ||
"dependencies": { | ||
"@capri-js/vite-plugin": "^1.0.1", | ||
"@capri-js/vite-plugin": "^1.0.2", | ||
"preact-iso": "^2.3.0" | ||
@@ -19,0 +19,0 @@ }, |
@@ -6,4 +6,10 @@ /// <reference types="vite-plugin-island/types" /> | ||
export { prerender } from "./prerender.js"; | ||
export type { | ||
GetStaticPaths, | ||
RenderFunction, | ||
RenderResult, | ||
ServerEntry, | ||
} from "@capri-js/vite-plugin"; | ||
export default function (opts: CapriAdapterPluginOptions) { | ||
export default function (opts: CapriAdapterPluginOptions = {}) { | ||
return capri({ | ||
@@ -10,0 +16,0 @@ ...opts, |
export function renderMarkerFragment(Component, props, scriptProps, json) { | ||
return ( | ||
<> | ||
// In order to hydrate a Preact component it must be the first child element. | ||
// To guarantee this, we wrap it in an extra div and set it to | ||
// `display: contents` in order to not affect the styling. | ||
<div data-island-root style={{ display: "contents" }}> | ||
<Component {...props} /> | ||
<script {...scriptProps} dangerouslySetInnerHTML={{ __html: json }} /> | ||
</> | ||
</div> | ||
); | ||
} |
5761
87
Updated@capri-js/vite-plugin@^1.0.2