mirror of
https://github.com/kou029w/_.git
synced 2025-02-02 15:18:37 +00:00
Compare commits
5 commits
455721a3a7
...
7082da5550
Author | SHA1 | Date | |
---|---|---|---|
|
7082da5550 | ||
07d437da3d | |||
6a43e9ddbe | |||
c5b6327a2e | |||
|
4c67666937 |
14 changed files with 9164 additions and 19 deletions
19
astro-fastify-ssg/package.json
Normal file
19
astro-fastify-ssg/package.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "@kou029w/astro-fastify-ssg",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "fastify start --log-level=info --debug --watch server.js -- --dev",
|
||||
"build": "astro build",
|
||||
"start": "fastify start server.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fastify/http-proxy": "^9.5.0",
|
||||
"@fastify/static": "^7.0.1",
|
||||
"astro": "^4.5.9",
|
||||
"fastify": "^4.26.2",
|
||||
"fastify-cli": "^6.1.1"
|
||||
}
|
||||
}
|
4440
astro-fastify-ssg/pnpm-lock.yaml
generated
Normal file
4440
astro-fastify-ssg/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
1
astro-fastify-ssg/public/public.txt
Normal file
1
astro-fastify-ssg/public/public.txt
Normal file
|
@ -0,0 +1 @@
|
|||
public
|
25
astro-fastify-ssg/server.js
Normal file
25
astro-fastify-ssg/server.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import fastifyStatic from "@fastify/static";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
/** @type {import("fastify").FastifyPluginAsync} */
|
||||
const app = async (fastify, opts) => {
|
||||
fastify.get("/hello", async () => "hello");
|
||||
|
||||
if (opts.dev) {
|
||||
const astro = await import("astro");
|
||||
const astroDevServer = await astro.dev({
|
||||
root: fileURLToPath(import.meta.resolve(".")),
|
||||
});
|
||||
await fastify.register(await import("@fastify/http-proxy"), {
|
||||
upstream: `http://localhost:${astroDevServer.address.port}`,
|
||||
});
|
||||
} else {
|
||||
await fastify.register(fastifyStatic, {
|
||||
root: fileURLToPath(import.meta.resolve("./dist")),
|
||||
});
|
||||
}
|
||||
|
||||
fastify.get("/world", async () => "world");
|
||||
};
|
||||
|
||||
export default app;
|
1
astro-fastify-ssg/src/env.d.ts
vendored
Normal file
1
astro-fastify-ssg/src/env.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="astro/client" />
|
1
astro-fastify-ssg/src/pages/index.md
Normal file
1
astro-fastify-ssg/src/pages/index.md
Normal file
|
@ -0,0 +1 @@
|
|||
**Hello, World!**
|
9
astro-fastify/astro.config.ts
Normal file
9
astro-fastify/astro.config.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { defineConfig } from "astro/config";
|
||||
import node from "@astrojs/node";
|
||||
|
||||
export default defineConfig({
|
||||
output: "server",
|
||||
adapter: node({
|
||||
mode: "middleware",
|
||||
}),
|
||||
});
|
21
astro-fastify/package.json
Normal file
21
astro-fastify/package.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "@kou029w/astro-fastify",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "fastify start --log-level=info --debug --watch server.js -- --dev",
|
||||
"build": "astro build",
|
||||
"start": "fastify start server.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/node": "^8.2.5",
|
||||
"@fastify/http-proxy": "^9.5.0",
|
||||
"@fastify/middie": "^8.3.0",
|
||||
"@fastify/static": "^7.0.1",
|
||||
"astro": "^4.5.9",
|
||||
"fastify": "^4.26.2",
|
||||
"fastify-cli": "^6.1.1"
|
||||
}
|
||||
}
|
4553
astro-fastify/pnpm-lock.yaml
generated
Normal file
4553
astro-fastify/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load diff
1
astro-fastify/public/public.txt
Normal file
1
astro-fastify/public/public.txt
Normal file
|
@ -0,0 +1 @@
|
|||
public
|
29
astro-fastify/server.js
Normal file
29
astro-fastify/server.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
import fastifyMiddie from "@fastify/middie";
|
||||
import fastifyStatic from "@fastify/static";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
/** @type {import("fastify").FastifyPluginAsync} */
|
||||
const app = async (fastify, opts) => {
|
||||
fastify.get("/hello", async () => "hello");
|
||||
|
||||
if (opts.dev) {
|
||||
const astro = await import("astro");
|
||||
const astroDevServer = await astro.dev({
|
||||
root: fileURLToPath(import.meta.resolve(".")),
|
||||
});
|
||||
await fastify.register(await import("@fastify/http-proxy"), {
|
||||
upstream: `http://localhost:${astroDevServer.address.port}`,
|
||||
});
|
||||
} else {
|
||||
await fastify.register(fastifyStatic, {
|
||||
root: fileURLToPath(import.meta.resolve("./dist/client")),
|
||||
});
|
||||
await fastify.register(fastifyMiddie);
|
||||
const astroServer = await import("./dist/server/entry.mjs");
|
||||
fastify.use(astroServer.handler);
|
||||
}
|
||||
|
||||
fastify.get("/world", async () => "world");
|
||||
};
|
||||
|
||||
export default app;
|
1
astro-fastify/src/env.d.ts
vendored
Normal file
1
astro-fastify/src/env.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="astro/client" />
|
9
astro-fastify/src/pages/index.ts
Normal file
9
astro-fastify/src/pages/index.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import type { APIRoute } from "astro";
|
||||
|
||||
export const GET: APIRoute = () => {
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
number: Math.random(),
|
||||
}),
|
||||
);
|
||||
};
|
|
@ -1474,10 +1474,15 @@ bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.4.0:
|
|||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828"
|
||||
integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==
|
||||
|
||||
bn.js@^5.1.1:
|
||||
version "5.1.3"
|
||||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b"
|
||||
integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==
|
||||
bn.js@^4.11.9:
|
||||
version "4.12.0"
|
||||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88"
|
||||
integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==
|
||||
|
||||
bn.js@^5.0.0, bn.js@^5.2.1:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70"
|
||||
integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==
|
||||
|
||||
brace-expansion@^1.1.7:
|
||||
version "1.1.11"
|
||||
|
@ -1510,7 +1515,7 @@ braces@~3.0.2:
|
|||
dependencies:
|
||||
fill-range "^7.0.1"
|
||||
|
||||
brorand@^1.0.1:
|
||||
brorand@^1.0.1, brorand@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
|
||||
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=
|
||||
|
@ -1546,7 +1551,7 @@ browserify-des@^1.0.0:
|
|||
inherits "^2.0.1"
|
||||
safe-buffer "^5.1.2"
|
||||
|
||||
browserify-rsa@^4.0.0, browserify-rsa@^4.0.1:
|
||||
browserify-rsa@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.0.1.tgz#21e0abfaf6f2029cf2fafb133567a701d4135524"
|
||||
integrity sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=
|
||||
|
@ -1554,20 +1559,28 @@ browserify-rsa@^4.0.0, browserify-rsa@^4.0.1:
|
|||
bn.js "^4.1.0"
|
||||
randombytes "^2.0.1"
|
||||
|
||||
browserify-sign@^4.0.0:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.1.tgz#eaf4add46dd54be3bb3b36c0cf15abbeba7956c3"
|
||||
integrity sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==
|
||||
browserify-rsa@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d"
|
||||
integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==
|
||||
dependencies:
|
||||
bn.js "^5.1.1"
|
||||
browserify-rsa "^4.0.1"
|
||||
bn.js "^5.0.0"
|
||||
randombytes "^2.0.1"
|
||||
|
||||
browserify-sign@^4.0.0:
|
||||
version "4.2.2"
|
||||
resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.2.tgz#e78d4b69816d6e3dd1c747e64e9947f9ad79bc7e"
|
||||
integrity sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==
|
||||
dependencies:
|
||||
bn.js "^5.2.1"
|
||||
browserify-rsa "^4.1.0"
|
||||
create-hash "^1.2.0"
|
||||
create-hmac "^1.1.7"
|
||||
elliptic "^6.5.3"
|
||||
elliptic "^6.5.4"
|
||||
inherits "^2.0.4"
|
||||
parse-asn1 "^5.1.5"
|
||||
readable-stream "^3.6.0"
|
||||
safe-buffer "^5.2.0"
|
||||
parse-asn1 "^5.1.6"
|
||||
readable-stream "^3.6.2"
|
||||
safe-buffer "^5.2.1"
|
||||
|
||||
browserify-zlib@^0.2.0:
|
||||
version "0.2.0"
|
||||
|
@ -2214,6 +2227,19 @@ elliptic@^6.5.3:
|
|||
minimalistic-assert "^1.0.0"
|
||||
minimalistic-crypto-utils "^1.0.0"
|
||||
|
||||
elliptic@^6.5.4:
|
||||
version "6.5.4"
|
||||
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb"
|
||||
integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==
|
||||
dependencies:
|
||||
bn.js "^4.11.9"
|
||||
brorand "^1.1.0"
|
||||
hash.js "^1.0.0"
|
||||
hmac-drbg "^1.0.1"
|
||||
inherits "^2.0.4"
|
||||
minimalistic-assert "^1.0.1"
|
||||
minimalistic-crypto-utils "^1.0.1"
|
||||
|
||||
emojis-list@^2.0.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389"
|
||||
|
@ -2640,7 +2666,7 @@ he@1.1.1:
|
|||
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
|
||||
integrity sha1-k0EP0hsAlzUVH4howvJx80J+I/0=
|
||||
|
||||
hmac-drbg@^1.0.0:
|
||||
hmac-drbg@^1.0.0, hmac-drbg@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
|
||||
integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=
|
||||
|
@ -3541,7 +3567,7 @@ parallel-transform@^1.1.0:
|
|||
inherits "^2.0.3"
|
||||
readable-stream "^2.1.5"
|
||||
|
||||
parse-asn1@^5.0.0, parse-asn1@^5.1.5:
|
||||
parse-asn1@^5.0.0, parse-asn1@^5.1.6:
|
||||
version "5.1.6"
|
||||
resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.6.tgz#385080a3ec13cb62a62d39409cb3e88844cdaed4"
|
||||
integrity sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==
|
||||
|
@ -3895,6 +3921,15 @@ readable-stream@^3.5.0, readable-stream@^3.6.0:
|
|||
string_decoder "^1.1.1"
|
||||
util-deprecate "^1.0.1"
|
||||
|
||||
readable-stream@^3.6.2:
|
||||
version "3.6.2"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
|
||||
integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
|
||||
dependencies:
|
||||
inherits "^2.0.3"
|
||||
string_decoder "^1.1.1"
|
||||
util-deprecate "^1.0.1"
|
||||
|
||||
readdirp@^2.2.1:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.2.1.tgz#0e87622a3325aa33e892285caf8b4e846529a525"
|
||||
|
@ -4060,7 +4095,7 @@ run-queue@^1.0.0, run-queue@^1.0.3:
|
|||
dependencies:
|
||||
aproba "^1.1.1"
|
||||
|
||||
safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0:
|
||||
safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0:
|
||||
version "5.2.1"
|
||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
|
||||
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
|
||||
|
|
Loading…
Add table
Reference in a new issue