feat: support JSX automatic mode (#610)

This commit adds support for JSX automatic mode instead of the default
mode that requires the presence of the JSX pragma in each file.

This commit also adds the config file to the `fresh.gen.ts` manifest,
which is used to determine if the client emit should use automatic mode.

The minimum Deno version has also been bumped to 1.25.0.
This commit is contained in:
Luca Casonato
2022-08-26 11:03:00 +02:00
committed by GitHub
parent bbe4277acb
commit b12867a582
66 changed files with 374 additions and 213 deletions
+2 -3
View File
@@ -1,7 +1,6 @@
/** @jsx h */
import { h } from "preact";
import { JSX } from "preact";
export function RoundedButton(props: h.JSX.HTMLAttributes<HTMLButtonElement>) {
export function RoundedButton(props: JSX.HTMLAttributes<HTMLButtonElement>) {
return (
<button
style={{
-3
View File
@@ -1,6 +1,3 @@
/** @jsx h */
import { h } from "preact";
import {
CATEGORIES,
TableOfContentsCategory,
-3
View File
@@ -1,6 +1,3 @@
/** @jsx h */
import { h } from "preact";
export function NoBuild() {
return (
<svg
-3
View File
@@ -1,6 +1,3 @@
/** @jsx h */
import { h } from "preact";
const LINKS = [
{
title: "Source",
-3
View File
@@ -1,6 +1,3 @@
/** @jsx h */
import { h } from "preact";
export function IconMinus() {
return (
<svg
-3
View File
@@ -1,6 +1,3 @@
/** @jsx h */
import { h } from "preact";
export default function NavigationBar(props: { active: string }) {
const items = [
{
+5 -1
View File
@@ -2,5 +2,9 @@
"tasks": {
"start": "deno run -A --watch=static/,routes/ dev.ts"
},
"importMap": "./import_map.json"
"importMap": "./import_map.json",
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
}
}
+2
View File
@@ -2,6 +2,7 @@
// This file SHOULD be checked into source version control.
// This file is automatically updated during development when running `dev.ts`.
import config from "./deno.json" assert { type: "json" };
import * as $0 from "./routes/_404.tsx";
import * as $1 from "./routes/_500.tsx";
import * as $2 from "./routes/docs/[...slug].tsx";
@@ -27,6 +28,7 @@ const manifest = {
"./islands/LemonDrop.tsx": $$2,
},
baseUrl: import.meta.url,
config,
};
export default manifest;
+1 -2
View File
@@ -1,5 +1,4 @@
/** @jsx h */
import { ComponentChildren, h } from "preact";
import { ComponentChildren } from "preact";
import { useEffect, useState } from "preact/hooks";
import { IS_BROWSER } from "$fresh/runtime.ts";
import * as Icons from "../components/Icons.tsx";
-2
View File
@@ -1,5 +1,3 @@
/** @jsx h */
import { h } from "preact";
import { useState } from "preact/hooks";
import { IS_BROWSER } from "$fresh/runtime.ts";
import { RoundedButton } from "../components/Button.tsx";
-3
View File
@@ -1,6 +1,3 @@
/** @jsx h */
/** @jsxFrag Fragment */
import { Fragment, h } from "preact";
import { useEffect, useRef, useState } from "preact/hooks";
import { Spring, WaveTank } from "../components/WaveTank.ts";
+2 -5
View File
@@ -1,13 +1,10 @@
/** @jsx h */
/** @jsxFrag Fragment */
import { Fragment, h } from "preact";
import LemonDrop from "../islands/LemonDrop.tsx";
export function ServerCodePage(
props: { serverCode: number; codeDescription: string },
) {
return (
<Fragment>
<>
<section>
<div class="w-full flex justify-center items-center flex-col bg-green-300">
<LemonDrop />
@@ -26,7 +23,7 @@ export function ServerCodePage(
</p>
</div>
</section>
</Fragment>
</>
);
}
-3
View File
@@ -1,6 +1,3 @@
/** @jsx h */
/** @jsxFrag Fragment */
import { Fragment, h } from "preact";
import { Head } from "$fresh/runtime.ts";
import { Handlers, PageProps } from "$fresh/server.ts";
import { frontMatter, gfm } from "../../utils/markdown.ts";
+2 -5
View File
@@ -1,6 +1,3 @@
/** @jsx h */
/** @jsxFrag Fragment */
import { Fragment, h } from "preact";
import { asset, Head } from "$fresh/runtime.ts";
import { Handlers, PageProps } from "$fresh/server.ts";
import Counter from "../islands/Counter.tsx";
@@ -68,7 +65,7 @@ export default function MainPage(props: PageProps) {
function Hero() {
return (
<Fragment>
<>
<div class="flex justify-end items-center bg-green-300">
<a
href="/docs"
@@ -80,7 +77,7 @@ function Hero() {
<section class="w-full flex justify-center items-center flex-col bg-green-300">
<LemonDrop />
</section>
</Fragment>
</>
);
}