Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@capri-js/preact

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capri-js/preact - npm Package Compare versions

Comparing version 3.1.3 to 4.0.0-next.1

lib/island.server.d.ts

5

lib/hydrate.d.ts

@@ -1,3 +0,2 @@

import { HydrationAdapter } from "capri/vite-plugin";
declare const adapter: HydrationAdapter;
export default adapter;
import { ComponentType } from "preact";
export default function hydrate(component: ComponentType, props: Record<string, unknown>, element: Element): void;

16

lib/hydrate.js
import { h, hydrate as hydrateComponent } from "preact";
const adapter = {
hydrate(component, props, element) {
return hydrateComponent(h(component, props), element.parentElement);
},
renderChildren() {
return h("capri-children", {
export default function hydrate(component, props, element) {
const children = element.querySelector("capri-children");
if (children) {
props.children = h("capri-children", {
style: { display: "contents" },
dangerouslySetInnerHTML: { __html: "" },
});
},
};
export default adapter;
}
return hydrateComponent(h(component, props), element.parentElement);
}

@@ -1,8 +0,2 @@

import { IslandOptions } from "capri";
import { ComponentType } from "preact";
export type { RenderFunction } from "capri";
export { prerender as renderToString } from "preact-iso";
export declare function island<T extends ComponentType<any>>(component: T, options?: IslandOptions): T;
export declare function lagoon<T extends ComponentType<any>>(factory: () => Promise<{
default: T;
}>): (props: any) => import("preact").VNode<any>;
import { CapriAdapterPluginOptions } from "capri/vite-plugin";
export default function (opts?: CapriAdapterPluginOptions): import("vite").Plugin[];

@@ -1,20 +0,17 @@

import { createIslandComponent } from "capri";
import { h } from "preact";
import { lazy } from "preact-iso";
export { prerender as renderToString } from "preact-iso";
export function island(component, options = {}) {
return createIslandComponent(component, options, ({ props, children, scriptProps, scriptContent }) => {
const wrappedChildren = children &&
h("capri-children", { style: { display: "contents" } }, children);
return h("capri-island", { style: { display: "contents" } }, h(component, props, wrappedChildren), h("script", {
...scriptProps,
dangerouslySetInnerHTML: { __html: scriptContent },
}));
import { capri } from "capri/vite-plugin";
export default function (opts = {}) {
const resolve = (f) => new URL(f, import.meta.url).pathname;
return capri({
...opts,
adapter: {
hydrate: resolve("./hydrate.js"),
island: {
server: resolve("./island.server.jsx"),
},
lagoon: {
server: resolve("./lagoon.server.jsx"),
client: resolve("./lagoon.client.jsx"),
},
},
});
}
export function lagoon(factory) {
const Comp = lazy(factory);
return (props) => {
return h("capri-lagoon", { style: { display: "contents" } }, h(Comp, props));
};
}
{
"name": "@capri-js/preact",
"version": "3.1.3",
"version": "4.0.0-next.1",
"description": "",

@@ -19,10 +19,6 @@ "author": "Felix Gnass <fgnass@gmail.com>",

".": {
"browser": "./lib/browser.js",
"default": "./lib/index.js"
},
"./vite-plugin": {
"default": "./lib/vite-plugin.js"
},
"./hydrate": {
"default": "./lib/hydrate.js"
"./server": {
"default": "./lib/server.js"
}

@@ -35,7 +31,4 @@ },

],
"vite-plugin": [
"lib/vite-plugin.d.ts"
],
"hydrate": [
"lib/hydrate.d.ts"
"server": [
"lib/server.d.ts"
]

@@ -45,3 +38,3 @@ }

"dependencies": {
"capri": "^3.3.0",
"capri": "^4.0.0-next.1",
"preact-iso": "^2.3.0"

@@ -48,0 +41,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc