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:
Luca Casonato
2022-06-20 12:37:24 +02:00
committed by GitHub
parent 3e001fe242
commit cbbf616a74
55 changed files with 108 additions and 125 deletions
+4 -1
View File
@@ -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"
}
}
+3 -1
View File
@@ -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 -2
View File
@@ -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 -2
View File
@@ -1,6 +1,5 @@
/** @jsx h */
import { h } from "$fresh/runtime.ts";
import { h } from "preact";
interface Props {
params: Record<string, string | string[]>;
+2 -2
View File
@@ -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>;
+2 -2
View File
@@ -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>;
+2 -2
View File
@@ -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 -2
View File
@@ -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() {
+2 -2
View File
@@ -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>;
+2 -2
View File
@@ -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() {
+2 -3
View File
@@ -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>;
+3 -3
View File
@@ -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 -2
View File
@@ -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() {
+2 -2
View File
@@ -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 = {
+2 -2
View File
@@ -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>;
+2 -2
View File
@@ -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 (
+2 -2
View File
@@ -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") {
+4 -1
View File
@@ -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"
}
}
-3
View File
@@ -1,6 +1,3 @@
/** @jsx h */
import { h } from "$fresh/runtime.ts";
export default function Home(): null {
throw new Error("boom!");
}