-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from nakasyou/react-to-solid
React to solid
- Loading branch information
Showing
70 changed files
with
4,382 additions
and
1,238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"semi": false | ||
"semi": false, | ||
"singleQuote": true, | ||
"trailingComma": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
{ | ||
"deno.enable": false, | ||
"[astro]": { | ||
|
||
"editor.tabSize": 2 | ||
}, | ||
"[svelte]": { | ||
"editor.tabSize": 2 | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
import { defineConfig } from 'astro/config'; | ||
import deno from "@astrojs/deno"; | ||
|
||
import react from "@astrojs/react"; | ||
import { defineConfig, squooshImageService, passthroughImageService } from 'astro/config'; | ||
import tailwind from "@astrojs/tailwind"; | ||
import solidJs from "@astrojs/solid-js"; | ||
import svelte from "@astrojs/svelte"; | ||
import deno from './integrations/deno'; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
output: "server", | ||
adapter: deno(), | ||
integrations: [react(), tailwind()] | ||
integrations: [tailwind({ | ||
|
||
}), solidJs(), svelte()], | ||
image: { | ||
service: passthroughImageService() | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// REF: https://github.com/denoland/deno/tree/main/ext/node/polyfills | ||
export const compatibleNodeModules = [ | ||
"assert", | ||
"assert/strict", | ||
"async_hooks", | ||
"buffer", | ||
"child_process", | ||
"cluster", | ||
"console", | ||
"constants", | ||
"crypto", | ||
"dgram", | ||
"diagnostics_channel", | ||
"dns", | ||
"events", | ||
"fs", | ||
"fs/promises", | ||
"http", | ||
// 'http2', | ||
"https", | ||
"inspector", | ||
"module", | ||
"net", | ||
"os", | ||
"path", | ||
"path/posix", | ||
"path/win32", | ||
"perf_hooks", | ||
"process", | ||
"punycode", | ||
"querystring", | ||
"readline", | ||
"repl", | ||
"stream", | ||
"stream/promises", | ||
"stream/web", | ||
"string_decoder", | ||
"sys", | ||
"timers", | ||
"timers/promises", | ||
// 'tls', | ||
"trace_events", | ||
"tty", | ||
"url", | ||
"util", | ||
"util/types", | ||
// 'v8', | ||
// 'vm', | ||
// 'wasi', | ||
// 'webcrypto', | ||
"worker_threads", | ||
"zlib", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { type AstroConfig, type AstroIntegration } from "astro" | ||
import { fileURLToPath } from "url" | ||
import { compatibleNodeModules } from "./const/compatibleNodeModules" | ||
import { build } from 'esbuild' | ||
|
||
export default (): AstroIntegration => { | ||
let buildConfig: AstroConfig['build'] | ||
|
||
return { | ||
name: "deno-adapter", | ||
hooks: { | ||
"astro:config:done": ({ setAdapter, config }) => { | ||
buildConfig = config.build | ||
setAdapter({ | ||
name: "deno-adapter", | ||
serverEntrypoint: "./integrations/deno/server/server.ts", | ||
supportedAstroFeatures: { | ||
staticOutput: "stable", | ||
serverOutput: "stable", | ||
assets: { | ||
|
||
} | ||
}, | ||
}) | ||
}, | ||
"astro:build:done": async () => { | ||
const entryUrl = new URL(buildConfig.serverEntry, buildConfig.server) | ||
const entryPath = fileURLToPath(entryUrl) | ||
await build({ | ||
target: "esnext", | ||
platform: 'node', | ||
bundle: true, | ||
allowOverwrite: true, | ||
entryPoints: [entryPath], | ||
outfile: entryPath, | ||
format: "esm", | ||
external: [ | ||
...compatibleNodeModules.map((mod) => `node:${mod}`), | ||
"@astrojs/markdown-remark", | ||
], | ||
plugins: [], | ||
minify: false, | ||
alias: { | ||
'hono': 'https://deno.land/x/[email protected]/mod.ts', | ||
...Object.fromEntries(compatibleNodeModules.map(mod => [mod, `node:${mod}`])) | ||
} | ||
}) | ||
} | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// @ts-check | ||
// @ts-ignore | ||
import { Hono } from 'hono' | ||
import { App } from 'astro/app'; | ||
import path from 'node:path' | ||
|
||
declare global { | ||
const Deno: { | ||
readFile (path: string): Promise<Uint8Array> | ||
serve (handler: (req: Request) => Promise<Response> | Response): void | ||
} | ||
} | ||
|
||
const mimetypeMap: Record<string, string | undefined> = { | ||
'.js': 'text/javascript', | ||
'.html': 'text/html', | ||
'.svg': 'image/svg+xml' | ||
} | ||
export async function start (manifest: import('astro').SSRManifest) { | ||
const app = new App(manifest) | ||
|
||
const honoApp = new Hono() | ||
const setAsset = (assetData: { | ||
path: string | ||
filePath: string | ||
}) => { | ||
const ext = path.extname(assetData.path) | ||
const asset = { | ||
path: assetData.path, | ||
extname: ext, | ||
filePath: assetData.filePath, | ||
mimetype: mimetypeMap[ext] || '' | ||
} | ||
honoApp.all(asset.path, async (c) => { | ||
const file = await Deno.readFile(asset.filePath) | ||
const buff = file.buffer as ArrayBuffer | ||
|
||
if (asset.mimetype) { | ||
c.header('Content-Type', asset.mimetype) | ||
} | ||
return c.body(buff) | ||
}) | ||
} | ||
const indexHtmlRegExp = /^.*\/index\.html$/ | ||
const removeIndexHtmlRegExp = /\/index\.html$/ | ||
for (const asset of [...manifest.assets]) { | ||
setAsset({ | ||
path: asset, | ||
filePath: path.join('dist/client', asset) | ||
}) | ||
if (indexHtmlRegExp.test(asset)) { | ||
setAsset({ | ||
path: asset.replace(removeIndexHtmlRegExp, ''), | ||
filePath: path.join('dist/client', asset) | ||
}) | ||
} | ||
} | ||
honoApp.all('/*', async (c) => { | ||
const res = await app.render(c.req.raw) | ||
return res | ||
}) | ||
Deno.serve(honoApp.fetch); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
plugins: { | ||
'postcss-import': {}, | ||
'tailwindcss/nesting': {}, | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
export interface Props { | ||
alt: string | ||
src: ImageMetadata | ||
class?: string | ||
} | ||
--- | ||
<img src={Astro.props.src.src} class={Astro.props.class} alt={Astro.props.alt} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/// <reference path="../.astro/types.d.ts" /> | ||
/// <reference types="astro/client" /> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.