Compare commits
No commits in common. "4e6e11d2e483e2057f533343ecfb33c29cdc32b5" and "7de82dd3fb758ba4cb50140037155cf41cb6567c" have entirely different histories.
4e6e11d2e4
...
7de82dd3fb
18 changed files with 479 additions and 501 deletions
19
README.md
19
README.md
|
|
@ -1,9 +1,20 @@
|
|||
# websnacks: Minimal Dependency Server-Side JSX for Static Sites
|
||||
|
||||
[](https://www.npmjs.com/package/@websnacksjs/websnacks "NPM release")
|
||||
[](https://www.mozilla.org/en-US/MPL/2.0/FAQ/ "License info")
|
||||
[](https://git.theinnerlimit.ch/websnacksjs/websnacks/actions?workflow=ci.yml "CI status for main branch")
|
||||

|
||||
<div>
|
||||
|
||||
[](https://www.npmjs.com/package/@websnacksjs/websnacks "NPM release")
|
||||
[](https://www.mozilla.org/en-US/MPL/2.0/FAQ/ "License info")
|
||||
[](https://github.com/websnacksjs/websnacks/actions?query=branch%3Amainline "Build status for mainline branch")
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
[](https://david-dm.org/websnacksjs/websnacks "Dependency status")
|
||||
[](https://david-dm.org/websnacksjs/websnacks?type=optional "Optional dependency status")
|
||||
[](https://david-dm.org/websnacksjs/websnacks?type=dev "Dev dependency status")
|
||||
|
||||
</div>
|
||||
|
||||
Develop fully static websites using typesafe JSX templates on the server without the complex build system and dependency management of server-side rendered React frameworks.
|
||||
|
||||
|
|
|
|||
19
biome.json
19
biome.json
|
|
@ -1,21 +1,16 @@
|
|||
{
|
||||
"$schema": "https://biomejs.dev/schemas/2.4.14/schema.json",
|
||||
"files": {
|
||||
"includes": ["**", "!dist", "!node_modules", "!.temp"]
|
||||
},
|
||||
"assist": {
|
||||
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
|
||||
"organizeImports": {
|
||||
"enabled": true,
|
||||
"actions": {
|
||||
"source": {
|
||||
"organizeImports": "on"
|
||||
}
|
||||
}
|
||||
"ignore": ["dist", "node_modules", ".temp"]
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": true
|
||||
"enabled": true,
|
||||
"ignore": ["dist", "node_modules", ".temp"]
|
||||
},
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"ignore": ["dist", "node_modules", ".temp"],
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"style": {
|
||||
|
|
@ -28,7 +23,7 @@
|
|||
},
|
||||
"overrides": [
|
||||
{
|
||||
"includes": ["test/**"],
|
||||
"include": ["test"],
|
||||
"linter": {
|
||||
"rules": {
|
||||
"a11y": {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
import { stylesheet } from "typestyle";
|
||||
import {
|
||||
type Component,
|
||||
// biome-ignore lint/correctness/noUnusedImports: required to support JSX
|
||||
createElement,
|
||||
} from "websnacks";
|
||||
import { type Component, createElement } from "websnacks";
|
||||
|
||||
const styles = stylesheet({
|
||||
header: {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
import { normalize } from "csstips";
|
||||
import { stylesheet } from "typestyle";
|
||||
import {
|
||||
type Component,
|
||||
// biome-ignore lint/correctness/noUnusedImports: required to support JSX
|
||||
createElement,
|
||||
} from "websnacks";
|
||||
import { type Component, createElement } from "websnacks";
|
||||
|
||||
import { stylesheetPath } from "../config";
|
||||
import { Header } from "./header";
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
import { stylesheet } from "typestyle";
|
||||
import {
|
||||
type Component,
|
||||
// biome-ignore lint/correctness/noUnusedImports: required to support JSX
|
||||
createElement,
|
||||
} from "websnacks";
|
||||
import { type Component, createElement } from "websnacks";
|
||||
|
||||
const styles = stylesheet({
|
||||
navbar: {
|
||||
|
|
|
|||
2
examples/personal-site/package-lock.json
generated
2
examples/personal-site/package-lock.json
generated
|
|
@ -20,7 +20,7 @@
|
|||
"websnacks": "bin/websnacks.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.4.14",
|
||||
"@biomejs/biome": "1.8.3",
|
||||
"@types/node": "~18",
|
||||
"@types/ws": "^7.4.0",
|
||||
"ts-node": "^10.9.2",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
import {
|
||||
type Component,
|
||||
// biome-ignore lint/correctness/noUnusedImports: required to support JSX
|
||||
createElement,
|
||||
} from "websnacks";
|
||||
import { type Component, createElement } from "websnacks";
|
||||
|
||||
import { Layout } from "../components/layout";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
import { stylesheet } from "typestyle";
|
||||
import {
|
||||
type Component,
|
||||
// biome-ignore lint/correctness/noUnusedImports: required to support JSX
|
||||
createElement,
|
||||
} from "websnacks";
|
||||
import { type Component, createElement } from "websnacks";
|
||||
|
||||
import { Layout } from "../components/layout";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import type { Config } from "websnacks";
|
|||
|
||||
import { stylesheetPath } from "./config";
|
||||
|
||||
const _config: Config = {
|
||||
const config: Config = {
|
||||
// Watch additional files and folders for changes when the dev server is
|
||||
// running.
|
||||
watch: ["components/", "config.ts"],
|
||||
|
|
|
|||
113
package-lock.json
generated
113
package-lock.json
generated
|
|
@ -12,9 +12,9 @@
|
|||
"websnacks": "bin/websnacks.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.4.14",
|
||||
"@biomejs/biome": "1.8.3",
|
||||
"@types/node": "~18",
|
||||
"@types/ws": "^8.18.1",
|
||||
"@types/ws": "^7.4.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "~4.9.5"
|
||||
},
|
||||
|
|
@ -22,16 +22,16 @@
|
|||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"node-watch": "^0.7.4",
|
||||
"ws": "^8.20.0"
|
||||
"node-watch": "^0.7.1",
|
||||
"ws": "^7.4.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/biome": {
|
||||
"version": "2.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.4.14.tgz",
|
||||
"integrity": "sha512-TmAvxOEgrpLypzVGJ8FulIZnlyA9TxrO1hyqYrCz9r+bwma9xXxuLA5IuYnj55XQneFx460KjRbx6SWGLkg3bQ==",
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.8.3.tgz",
|
||||
"integrity": "sha512-/uUV3MV+vyAczO+vKrPdOW0Iaet7UnJMU4bNMinggGJTAnBPjCoLEYcyYtYHNnUNYlv4xZMH6hVIQCAozq8d5w==",
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"hasInstallScript": true,
|
||||
"bin": {
|
||||
"biome": "bin/biome"
|
||||
},
|
||||
|
|
@ -43,25 +43,24 @@
|
|||
"url": "https://opencollective.com/biome"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@biomejs/cli-darwin-arm64": "2.4.14",
|
||||
"@biomejs/cli-darwin-x64": "2.4.14",
|
||||
"@biomejs/cli-linux-arm64": "2.4.14",
|
||||
"@biomejs/cli-linux-arm64-musl": "2.4.14",
|
||||
"@biomejs/cli-linux-x64": "2.4.14",
|
||||
"@biomejs/cli-linux-x64-musl": "2.4.14",
|
||||
"@biomejs/cli-win32-arm64": "2.4.14",
|
||||
"@biomejs/cli-win32-x64": "2.4.14"
|
||||
"@biomejs/cli-darwin-arm64": "1.8.3",
|
||||
"@biomejs/cli-darwin-x64": "1.8.3",
|
||||
"@biomejs/cli-linux-arm64": "1.8.3",
|
||||
"@biomejs/cli-linux-arm64-musl": "1.8.3",
|
||||
"@biomejs/cli-linux-x64": "1.8.3",
|
||||
"@biomejs/cli-linux-x64-musl": "1.8.3",
|
||||
"@biomejs/cli-win32-arm64": "1.8.3",
|
||||
"@biomejs/cli-win32-x64": "1.8.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-darwin-arm64": {
|
||||
"version": "2.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.4.14.tgz",
|
||||
"integrity": "sha512-XvgoE9XOawUOQPdmvs4J7wPhi/DLwSCGks3AlPJDmh34O0awRTqCED1HRcRDdpf1Zrp4us4MGOOdIxNpbqNF5Q==",
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.8.3.tgz",
|
||||
"integrity": "sha512-9DYOjclFpKrH/m1Oz75SSExR8VKvNSSsLnVIqdnKexj6NwmiMlKk94Wa1kZEdv6MCOHGHgyyoV57Cw8WzL5n3A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
|
|
@ -71,14 +70,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-darwin-x64": {
|
||||
"version": "2.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.4.14.tgz",
|
||||
"integrity": "sha512-jE7hKBCFhOx3uUh+ZkWBfOHxAcILPfhFplNkuID/eZeSTLHzfZzoZxW8fbqY9xXRnPi7jGNAf1iPVR+0yWsM/Q==",
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.8.3.tgz",
|
||||
"integrity": "sha512-UeW44L/AtbmOF7KXLCoM+9PSgPo0IDcyEUfIoOXYeANaNXXf9mLUwV1GeF2OWjyic5zj6CnAJ9uzk2LT3v/wAw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
|
|
@ -88,14 +86,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-linux-arm64": {
|
||||
"version": "2.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.4.14.tgz",
|
||||
"integrity": "sha512-2TELhZnW5RSLL063l9rc5xLpA0ZIw0Ccwy/0q384rvNAgFw3yI76bd59547yxowdQr5MNPET/xDLrLuvgSeeWQ==",
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.8.3.tgz",
|
||||
"integrity": "sha512-fed2ji8s+I/m8upWpTJGanqiJ0rnlHOK3DdxsyVLZQ8ClY6qLuPc9uehCREBifRJLl/iJyQpHIRufLDeotsPtw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
|
|
@ -105,14 +102,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-linux-arm64-musl": {
|
||||
"version": "2.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.4.14.tgz",
|
||||
"integrity": "sha512-/z+6gqAqqUQTHazwStxSXKHg9b8UvqBmDFRp+c4wYbq2KXhELQDon9EoC9RpmQ8JWkqQx/lIUy/cs+MhzDZp6A==",
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.8.3.tgz",
|
||||
"integrity": "sha512-9yjUfOFN7wrYsXt/T/gEWfvVxKlnh3yBpnScw98IF+oOeCYb5/b/+K7YNqKROV2i1DlMjg9g/EcN9wvj+NkMuQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
|
|
@ -122,14 +118,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-linux-x64": {
|
||||
"version": "2.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.4.14.tgz",
|
||||
"integrity": "sha512-zHrlQZDBDUz4OLAraYpWKcnLS6HOewBFWYOzY91d1ZjdqZwibOyb6BEu6WuWLugyo0P3riCmsbV9UqV1cSXwQg==",
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-1.8.3.tgz",
|
||||
"integrity": "sha512-I8G2QmuE1teISyT8ie1HXsjFRz9L1m5n83U1O6m30Kw+kPMPSKjag6QGUn+sXT8V+XWIZxFFBoTDEDZW2KPDDw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
|
|
@ -139,14 +134,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-linux-x64-musl": {
|
||||
"version": "2.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.4.14.tgz",
|
||||
"integrity": "sha512-R6BWgJdQOwW9ulJatuTVrQkjnODjqHZkKNOqb1sz++3Noe5LYd0i3PchnOBUCYAPHoPWHhjJqbdZlHEu0hpjdA==",
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.8.3.tgz",
|
||||
"integrity": "sha512-UHrGJX7PrKMKzPGoEsooKC9jXJMa28TUSMjcIlbDnIO4EAavCoVmNQaIuUSH0Ls2mpGMwUIf+aZJv657zfWWjA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
|
|
@ -156,14 +150,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-win32-arm64": {
|
||||
"version": "2.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.4.14.tgz",
|
||||
"integrity": "sha512-M3EH5hqOI/F/FUA2u4xcLoUgmxd218mvuj/6JL7Hv2toQvr2/AdOvKSpGkoRuWFCtQPVa+ZqkEV3Q5xBA9+XSA==",
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.8.3.tgz",
|
||||
"integrity": "sha512-J+Hu9WvrBevfy06eU1Na0lpc7uR9tibm9maHynLIoAjLZpQU3IW+OKHUtyL8p6/3pT2Ju5t5emReeIS2SAxhkQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
|
|
@ -173,14 +166,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@biomejs/cli-win32-x64": {
|
||||
"version": "2.4.14",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.4.14.tgz",
|
||||
"integrity": "sha512-WL0EG5qE+EAKomGXbf2g6VnSKJhTL3tXC0QRzWRwA5VpjxNYa6H4P7ZWfymbGE4IhZZQi1KXQ2R0YjwInmz2fA==",
|
||||
"version": "1.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-1.8.3.tgz",
|
||||
"integrity": "sha512-/PJ59vA1pnQeKahemaQf4Nyj7IKUvGQSc3Ze1uIGi+Wvr1xF7rGobSrAAG01T/gUDG21vkDsZYM03NAmPiVkqg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
|
|
@ -260,11 +252,10 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@types/ws": {
|
||||
"version": "8.18.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz",
|
||||
"integrity": "sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==",
|
||||
"version": "7.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.0.tgz",
|
||||
"integrity": "sha512-Y29uQ3Uy+58bZrFLhX36hcI3Np37nqWE7ky5tjiDoy1GDZnIwVxS0CgF+s+1bXMzjKBFy+fqaRfb708iNzdinw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
|
|
@ -321,10 +312,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/node-watch": {
|
||||
"version": "0.7.4",
|
||||
"resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.4.tgz",
|
||||
"integrity": "sha512-RinNxoz4W1cep1b928fuFhvAQ5ag/+1UlMDV7rbyGthBIgsiEouS4kvRayvvboxii4m8eolKOIBo3OjDqbc+uQ==",
|
||||
"license": "MIT",
|
||||
"version": "0.7.1",
|
||||
"resolved": "https://registry.npmjs.org/node-watch/-/node-watch-0.7.1.tgz",
|
||||
"integrity": "sha512-UWblPYuZYrkCQCW5PxAwYSxaELNBLUckrTBBk8xr1/bUgyOkYYTsUcV4e3ytcazFEOyiRyiUrsG37pu6I0I05g==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
|
|
@ -411,17 +401,16 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.20.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.20.0.tgz",
|
||||
"integrity": "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==",
|
||||
"license": "MIT",
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz",
|
||||
"integrity": "sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
"node": ">=8.3.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
"utf-8-validate": "^5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@
|
|||
"test:e2e": "cd test && ts-node --script-mode ./run-e2e.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "2.4.14",
|
||||
"@biomejs/biome": "1.8.3",
|
||||
"@types/node": "~18",
|
||||
"@types/ws": "^8.18.1",
|
||||
"@types/ws": "^7.4.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "~4.9.5"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"node-watch": "^0.7.4",
|
||||
"ws": "^8.20.0"
|
||||
"node-watch": "^0.7.1",
|
||||
"ws": "^7.4.3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ const copyStaticAssets = async ({
|
|||
}: ConfigPaths): Promise<void> => {
|
||||
try {
|
||||
await fs.access(staticAssetsDir);
|
||||
} catch (_error) {
|
||||
} catch (error) {
|
||||
// Static assets folder doesn't exist, so no-op.
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { existsSync, promises as fs, watch } from "node:fs";
|
||||
import { promises as fs, existsSync, watch } from "node:fs";
|
||||
import * as http from "node:http";
|
||||
import * as path from "node:path";
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ const startHttpServer = async (publicDir: string): Promise<http.Server> => {
|
|||
let contents: Buffer | string;
|
||||
try {
|
||||
contents = await fs.readFile(path.join(publicDir, reqPath));
|
||||
} catch (_error) {
|
||||
} catch (error) {
|
||||
console.error(`unable to load file ${reqPath}`);
|
||||
res.writeHead(404);
|
||||
res.end();
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export const loadConfig = async (rootDir: string): Promise<Config> => {
|
|||
decacheModule(configPath);
|
||||
// TODO: validate user config.
|
||||
userConfig = await import(configPath);
|
||||
} catch (_error) {
|
||||
} catch (error) {
|
||||
// Use default config;
|
||||
}
|
||||
const outDir = path.join(rootDir, "public");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
export { Component, Fragment, HTMLElement } from "./component";
|
||||
export { defineConfig, UserConfig as Config } from "./config";
|
||||
export { HTMLElement, Component, Fragment } from "./component";
|
||||
export { UserConfig as Config, defineConfig } from "./config";
|
||||
export { createElement } from "./create-element";
|
||||
export * from "./jsx";
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import { promises as fs } from "node:fs";
|
|||
import * as path from "node:path";
|
||||
|
||||
import {
|
||||
npmCmd,
|
||||
runCommand,
|
||||
WEBSNACKS_BIN_PATH,
|
||||
WEBSNACKS_REPO_ROOT,
|
||||
npmCmd,
|
||||
runCommand,
|
||||
withTempDir,
|
||||
} from "../helpers/e2e";
|
||||
import { testSuite } from "../lib";
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import { promises as fs } from "node:fs";
|
|||
import * as path from "node:path";
|
||||
|
||||
import {
|
||||
npmCmd,
|
||||
runCommand,
|
||||
WEBSNACKS_BIN_PATH,
|
||||
WEBSNACKS_REPO_ROOT,
|
||||
npmCmd,
|
||||
runCommand,
|
||||
wait,
|
||||
withTempDir,
|
||||
} from "../helpers/e2e";
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { type Component, createElement, Fragment } from "../../dist";
|
||||
import { type Component, Fragment, createElement } from "../../dist";
|
||||
import { renderPage } from "../../dist/render";
|
||||
import { testSuite } from "../lib";
|
||||
|
||||
|
|
@ -118,6 +118,7 @@ testSuite("renderPage", ({ test, expect }) => {
|
|||
const html = renderPage(
|
||||
<html>
|
||||
<div
|
||||
// biome-ignore lint/security/noDangerouslySetInnerHtml: explicit test
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: "<div>red alert!</div>",
|
||||
}}
|
||||
|
|
@ -134,6 +135,8 @@ testSuite("renderPage", ({ test, expect }) => {
|
|||
renderPage(
|
||||
<html>
|
||||
<div
|
||||
// biome-ignore lint/security/noDangerouslySetInnerHtml: explicit test
|
||||
// biome-ignore lint/security/noDangerouslySetInnerHtmlWithChildren: explicit test
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: "<div>set phasers to kill</div>",
|
||||
}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue