chore: version preact explicitly in import map (#258)
This allows users to control the `preact` version independently of fresh itself.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../../"
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.6.6",
|
||||
"preact/": "https://esm.sh/preact@10.6.6/",
|
||||
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.1.20?deps=preact@10.6.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/** @jsx h */
|
||||
import { h, IS_BROWSER, useState } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||
|
||||
interface CounterProps {
|
||||
start: number;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
|
||||
export default function Test(props: { message: string }) {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
|
||||
interface Props {
|
||||
params: Record<string, string | string[]>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, UnknownPageProps } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { UnknownPageProps } from "$fresh/runtime.ts";
|
||||
|
||||
export default function NotFoundPage({ url }: UnknownPageProps) {
|
||||
return <p>404 not found: {url.pathname}</p>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { ErrorPageProps, h } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { ErrorPageProps } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Error500Page({ error }: ErrorPageProps) {
|
||||
return <p>500 internal error: {(error as Error).message}</p>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** @jsx h */
|
||||
/** @jsxFrag Fragment */
|
||||
|
||||
import { AppProps, Fragment, h, Head } from "$fresh/runtime.ts";
|
||||
import { Fragment, h } from "preact";
|
||||
import { AppProps, Head } from "$fresh/runtime.ts";
|
||||
|
||||
export default function App(props: AppProps) {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { asset, h } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import Test from "../../islands/Test.tsx";
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, PageProps, RouteConfig } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { PageProps, RouteConfig } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Page(props: PageProps) {
|
||||
return <div>Book {props.params.id}</div>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, IS_BROWSER } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { IS_BROWSER } from "$fresh/runtime.ts";
|
||||
import Test from "../islands/Test.tsx";
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { HandlerContext } from "../../../server.ts";
|
||||
import { h } from "preact";
|
||||
import { HandlerContext } from "$fresh/server.ts";
|
||||
|
||||
export default function Page() {
|
||||
return <div>This is HTML</div>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, PageProps } from "$fresh/runtime.ts";
|
||||
import { HandlerContext, Handlers } from "../../../server.ts";
|
||||
import { h } from "preact";
|
||||
import { PageProps } from "$fresh/runtime.ts";
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
|
||||
interface Data extends Record<string, unknown> {
|
||||
info: string;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import Counter from "../../islands/Counter.tsx";
|
||||
|
||||
export default function Home() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, RouteConfig } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { RouteConfig } from "$fresh/runtime.ts";
|
||||
import { HandlerContext } from "../../../server.ts";
|
||||
|
||||
export const handler = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, PageProps } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { PageProps } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Home(props: PageProps) {
|
||||
return <div>{JSON.stringify(props)}</div>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { asset, h } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { asset } from "$fresh/runtime.ts";
|
||||
|
||||
export default function StaticPage() {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** @jsx h */
|
||||
|
||||
import { h, PageProps, RouteConfig } from "$fresh/runtime.ts";
|
||||
import { h } from "preact";
|
||||
import { PageProps, RouteConfig } from "$fresh/runtime.ts";
|
||||
|
||||
export default function WildcardPage({ params }: PageProps) {
|
||||
if (typeof params.path === "string") {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"imports": {
|
||||
"$fresh/": "../../"
|
||||
"$fresh/": "../../",
|
||||
"preact": "https://esm.sh/preact@10.6.6",
|
||||
"preact/": "https://esm.sh/preact@10.6.6/",
|
||||
"preact-render-to-string": "https://esm.sh/preact-render-to-string@5.1.20?deps=preact@10.6.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
/** @jsx h */
|
||||
import { h } from "$fresh/runtime.ts";
|
||||
|
||||
export default function Home(): null {
|
||||
throw new Error("boom!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user