diff --git a/flake.nix b/flake.nix index 4b73e17bc068a0c005e38a0f3e277b2d57aebf5b..ece9aca47dae0c9161b47672b88e8792508bc604 100644 --- a/flake.nix +++ b/flake.nix @@ -3,31 +3,34 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; utils.url = "github:numtide/flake-utils"; }; - outputs = inputs: inputs.utils.lib.eachDefaultSystem (system: - with inputs.nixpkgs.legacyPackages.${system}; { - devShells.default = pkgs.mkShell { - buildInputs = [ - # clover sitegen v3 - pkgs.nodejs_24 # runtime - pkgs.deno # formatter - pkgs.python3 # for font subsetting + outputs = + inputs: + inputs.utils.lib.eachDefaultSystem ( + system: with inputs.nixpkgs.legacyPackages.${system}; { + devShells.default = pkgs.mkShell { + buildInputs = [ + # clover sitegen v3 + pkgs.nodejs_24 # runtime + pkgs.deno # formatter + pkgs.python3 # for font subsetting - # paperclover.net - (pkgs.ffmpeg.override { - withOpus = true; - withSvtav1 = true; - withJxl = true; - withWebp = true; - }) - pkgs.rsync - ]; - }; - devShells.min = pkgs.mkShell { - buildInputs = [ - pkgs.nodejs_24 # runtime - pkgs.deno # formatter - pkgs.rsync - ]; - }; - }); + # paperclover.net + (pkgs.ffmpeg.override { + withOpus = true; + withSvtav1 = true; + withJxl = true; + withWebp = true; + }) + pkgs.rsync + ]; + }; + devShells.min = pkgs.mkShell { + buildInputs = [ + pkgs.nodejs_24 # runtime + pkgs.deno # formatter + pkgs.rsync + ]; + }; + } + ); } diff --git a/framework/bundle.ts b/framework/bundle.ts index 37daa2b5fc586683159816df1aab079613fd326d..4bcb159db5479c5889308463700115b49cf0f52b 100644 --- a/framework/bundle.ts +++ b/framework/bundle.ts @@ -178,7 +178,7 @@ export async function bundleServerJavaScript({ `export const metaTemplate = {`, ` base: new URL(${JSON.stringify(metaTemplate.base)}),`, ...Object.entries(metaTemplate) - .filter(([k]) => k !== 'base') + .filter(([k]) => k !== "base") .map(([k, v]) => ` ${JSON.stringify(k)}: ${JSON.stringify(v)},`), `};`, ].join("\n"), diff --git a/framework/generate.ts b/framework/generate.ts index c9737e8bb17f9934343e15e9472ef35d151bef22..cc84babad77393de76a428f820b6be3634f9a1c2 100644 --- a/framework/generate.ts +++ b/framework/generate.ts @@ -237,10 +237,12 @@ export async function preparePage( // -- metadata -- const renderedMetaPromise = Promise.resolve( typeof metadata === "function" ? metadata({ ssr: true }) : metadata, - ).then((m) => meta.render({ - canonical: item.id, - ...m, - }, metaTemplate)); + ).then((m) => + meta.render({ + canonical: item.id, + ...m, + }, metaTemplate) + ); // -- html -- let page = render.element(Page); diff --git a/framework/lib/assets.ts b/framework/lib/assets.ts index fa5338df254446950959c8253577b71edabd6224..0d2b7393e5bc14f211c3516f7673559f9f5ea130 100644 --- a/framework/lib/assets.ts +++ b/framework/lib/assets.ts @@ -82,7 +82,7 @@ export async function serveAsset( c: Context, id: Key, status: StatusCode = 200, - cache: CacheMode = 'auto', + cache: CacheMode = "auto", ) { return assetInner( c, @@ -177,11 +177,11 @@ function respondWithBufferAndViews( if (!Object.keys(headers).some((x) => x.toLowerCase() === "cache-control")) { if (cache === "auto") { if (status < 200 || status >= 300) { - cache = 'no-cache'; - } else if (headers['content-type']?.includes('text/html')) { - cache = 'temporary'; + cache = "no-cache"; + } else if (headers["content-type"]?.includes("text/html")) { + cache = "temporary"; } else { - cache = 'long-term'; + cache = "long-term"; } } if (cache === "no-cache") { diff --git a/framework/lib/sitegen.ts b/framework/lib/sitegen.ts index e51e5fc19f0d39d1bbf5e82383ef66df640e11c0..6f1bd0312f683b16373dad0126d622cd329ee85e 100644 --- a/framework/lib/sitegen.ts +++ b/framework/lib/sitegen.ts @@ -48,7 +48,7 @@ export interface Font { } export type FontVars = Record; export type FontVariableAxis = number | [min: number, max: number]; -export type FontRange = string | number | { start: number, end: number }; +export type FontRange = string | number | { start: number; end: number }; export const userData = render.userData(() => { throw new Error("This function can only be used in a page (static or view)"); diff --git a/framework/lib/subprocess.ts b/framework/lib/subprocess.ts index 2d183de6923d8b0fe2dced3266ff2352c30c28fa..c767ef5785ca9c1047d21d80b0ff5a65ad42d2f0 100644 --- a/framework/lib/subprocess.ts +++ b/framework/lib/subprocess.ts @@ -11,5 +11,5 @@ export const exec: typeof execFileRaw = (( throw e; })) as any; -import * as util from 'node:util'; -import * as child_process from 'node:child_process'; +import * as util from "node:util"; +import * as child_process from "node:child_process"; diff --git a/framework/watch.ts b/framework/watch.ts index 453dbceb8fc6f73277b95bfa4e6b30913e22f76c..c048d223586500ba48db2755cc6d843268b1bc4d 100644 --- a/framework/watch.ts +++ b/framework/watch.ts @@ -25,7 +25,7 @@ function serve() { "--development", ], { stdio: "inherit", - execArgv: ['--no-warnings'], + execArgv: ["--no-warnings"], }); subprocess.on("close", onSubprocessClose); } diff --git a/readme.md b/readme.md index efa3901f7f79ba33f5ab9382191e8a4836fc08ca..8a23afc637f80d96feb0b45d1084020e6a367a03 100644 --- a/readme.md +++ b/readme.md @@ -12,7 +12,8 @@ that assist building websites. these tools power . components, ``, and custom extensions. - **Incremental static site generator and build system.** - Build both development and production sites on startup start. Incremental - generator rebuilds changed pages; Build system state survives coding sessions. + generator rebuilds changed pages; Build system state survives coding + sessions. - Multiple backend support. - (TODO) Tests, Lints, and Type-checking is run alongside, and only re-runs checks when the files change. For example, changing a component re-tests diff --git a/run.js b/run.js index 8e46ce1a0fefe0ace88def876df7c7569549f877..f74beabb6fa79f25bc3b2cb51ab9ca6914a5687a 100644 --- a/run.js +++ b/run.js @@ -27,8 +27,8 @@ try { const brand = process.versions.bun ? `bun ${process.versions.bun}` : process.versions.deno - ? `deno ${process.versions.deno}` - : null; + ? `deno ${process.versions.deno}` + : null; const brandText = brand ? ` (${brand})` : ""; globalThis.console.error( `sitegen depends on a node.js v24. your runtime is missing features.\n` + @@ -91,7 +91,7 @@ if (process.argv[1].startsWith(import.meta.filename.slice(0, -".js".length))) { ); } else { console.warn( - hot.load("path").relative('.', found), + hot.load("path").relative(".", found), 'does not export a "main" function', ); } diff --git a/src/site.ts b/src/site.ts index 6bb7d5288562ba6cf7a7bf7db4677558d106cb6a..d8cfc0f8d2d686e1ed04bd0e2d5e4dc4fc838a8f 100644 --- a/src/site.ts +++ b/src/site.ts @@ -92,7 +92,10 @@ export const fonts: sg.Font[] = [ name: "AT Name Sans Display Hairline", sources: [ "ATNameSansDisplay-Hairline.woff2", - path.join(fontRoot, "/ArrowType/AT Name Sans Display/ATNameSansDisplay-Hairline.woff2"), + path.join( + fontRoot, + "/ArrowType/AT Name Sans Display/ATNameSansDisplay-Hairline.woff2", + ), ], subsets: [ {