feat: support kebab-case filenames for islands (#404)

This commit is contained in:
Stephen Delaney
2022-07-06 12:42:25 +02:00
committed by GitHub
parent 38c1a2f426
commit a7b198fdf4
5 changed files with 46 additions and 2 deletions
+2
View File
@@ -30,6 +30,7 @@ import * as $24 from "./routes/static.tsx";
import * as $25 from "./routes/wildcard.tsx";
import * as $$0 from "./islands/Counter.tsx";
import * as $$1 from "./islands/Test.tsx";
import * as $$2 from "./islands/kebab-case-counter-test.tsx";
const manifest = {
routes: {
@@ -63,6 +64,7 @@ const manifest = {
islands: {
"./islands/Counter.tsx": $$0,
"./islands/Test.tsx": $$1,
"./islands/kebab-case-counter-test.tsx": $$2,
},
baseUrl: import.meta.url,
};
@@ -0,0 +1,27 @@
/** @jsx h */
import { h } from "preact";
import { useState } from "preact/hooks";
import { IS_BROWSER } from "$fresh/runtime.ts";
interface KebabCaseFileNameTestProps {
start: number;
id: string;
}
export default function KebabCaseFileNameTest(
props: KebabCaseFileNameTestProps,
) {
const [count, setCount] = useState(props.start);
return (
<div id={props.id}>
<p>{count}</p>
<button
id={`b-${props.id}`}
onClick={() => setCount(count + 1)}
disabled={!IS_BROWSER}
>
+1
</button>
</div>
);
}
+2
View File
@@ -1,6 +1,7 @@
/** @jsx h */
import { h } from "preact";
import Counter from "../../islands/Counter.tsx";
import KebabCaseFileNameTest from "../../islands/kebab-case-counter-test.tsx";
import Test from "../../islands/Test.tsx";
export default function Home() {
@@ -8,6 +9,7 @@ export default function Home() {
<div>
<Counter id="counter1" start={3} />
<Counter id="counter2" start={10} />
<KebabCaseFileNameTest id="kebab-case-file-counter" start={5} />
<Test message="" />
</div>
);