Skip to content

Commit

Permalink
feat: local dev pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Ringrose committed Jul 22, 2024
1 parent aac7f8b commit d8b589c
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 80 deletions.
180 changes: 145 additions & 35 deletions example/preactSSR/dist/pages/About.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions example/preactSSR/dist/pages/About.js.map

Large diffs are not rendered by default.

62 changes: 43 additions & 19 deletions example/preactSSR/dist/pages/Home.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions example/preactSSR/dist/pages/Home.js.map

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions example/preactSSR/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ router.get("/src/:dirname/:filename", cacher(), async (ctx) => {
const transformedFilename = ctx.params.filename.replace(".ts", ".js");
return (
await file(
new URL(
`https://raw.githubusercontent.com/sejori/peko/main/example/preactSSR/dist/${ctx.params.dirname}/${transformedFilename}`
),
ctx.state.env.ENVIRONMENT === "production"
? new URL(
`https://raw.githubusercontent.com/sejori/peko/main/example/preactSSR/dist/${ctx.params.dirname}/${transformedFilename}`
)
: new URL(
`./dist/${ctx.params.dirname}/${transformedFilename}`,
import.meta.url
),
{
headers: new Headers({
"Content-Type": "application/javascript",
Expand Down
2 changes: 1 addition & 1 deletion example/preactSSR/src/components/App.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useEffect } from "preact/hooks";
import { html } from "htm/preact";
import List from "./List.ts";
import { useLocalState } from "../hooks/localstate.ts";
import { useLocalState } from "../hooks/useLocalState.ts";

const App = () => {
const [dataArray, setDataArray] = useLocalState("dataArray");
Expand Down
File renamed without changes.
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
},
"type": "module",
"scripts": {
"build": "esbuild --bundle --minify --sourcemap --target=es2020 --platform=browser --format=esm --outdir=./example/preactSSR/dist/pages ./example/preactSSR/src/pages/*.ts",
"build": "esbuild --bundle --sourcemap --target=es2020 --platform=browser --format=esm --outdir=./example/preactSSR/dist/pages --external:esbuild --external:htm/preact --external:preact --external:preact/hooks --external:preact-render-to-string ./example/preactSSR/src/pages/*.ts",
"start": "deno run --allow-net --allow-read --allow-env --allow-run scripts/deno/main.ts",
"test": "deno test --allow-read --allow-net",
"profile:deno": "deno run --allow-read --allow-net scripts/deno/profile.ts",
"profile:bun": "bun run scripts/bun/profile.ts",
"profile:start:wrangler": "wrangler dev scripts/wrangler/testApp.ts",
"profile:wrangler": "node --loader ts-node/esm scripts/wrangler/profile.ts",
"start:dev:deno": "deno run -A --watch scripts/deno/main.ts",
"start:dev:bun": "bun run --watch scripts/bun/main.ts",
"start:dev:wrangler": "wrangler dev scripts/wrangler/main.ts"
"start:wrangler": "wrangler dev scripts/wrangler/testApp.ts",
"dev:build": "esbuild --bundle --sourcemap --target=es2020 --platform=browser --format=esm --outdir=./example/preactSSR/dist/pages --external:esbuild --external:htm/preact --external:preact --external:preact/hooks --external:preact-render-to-string --watch ./example/preactSSR/src/pages/*.ts",
"dev:deno": "deno run -A --watch scripts/deno/main.ts",
"dev:bun": "bun run --watch scripts/bun/main.ts",
"dev:wrangler": "wrangler dev scripts/wrangler/main.ts"
},
"repository": {
"type": "git",
Expand Down
9 changes: 0 additions & 9 deletions scripts/wrangler/testApp.ts

This file was deleted.

0 comments on commit d8b589c

Please sign in to comment.