Start renaming
This commit is contained in:
@@ -7,20 +7,22 @@ with workspace members in `packages/*` and `www/`.
|
||||
|
||||
### Packages
|
||||
|
||||
- **`packages/fresh/`** (`@fresh/core`): Core framework — routing, rendering,
|
||||
islands, build cache, middlewares, and client/server runtime.
|
||||
- **`packages/plugin-vite/`** (`@fresh/plugin-vite`): Vite integration plugin
|
||||
- **`packages/fresh/`** (`@paulaboks/sweet`): Core framework — routing,
|
||||
rendering, islands, build cache, middlewares, and client/server runtime.
|
||||
- **`packages/plugin-vite/`** (`@paulaboks/sweet-vite`): Vite integration plugin
|
||||
with dev server, SSR/client builds, and HMR.
|
||||
- **`packages/init/`** (`@fresh/init`): Project scaffolding
|
||||
(`deno run -Ar jsr:@fresh/init`).
|
||||
- **`packages/init/`** (`@paulaboks/sweet-init`): Project scaffolding
|
||||
(`deno run -Ar jsr:@paulaboks/sweet-init`).
|
||||
- **`packages/update/`** (`@fresh/update`): Automated Fresh 1.x to 2.x migration
|
||||
tool using ts-morph for AST transforms.
|
||||
- **`packages/build-id/`** (`@fresh/build-id`): Build/deployment ID generation.
|
||||
- **`packages/plugin-tailwindcss/`** (`@fresh/plugin-tailwind`): TailwindCSS v4
|
||||
plugin.
|
||||
- **`packages/plugin-tailwindcss-v3/`** (`@fresh/plugin-tailwind-v3`): Legacy
|
||||
- **`packages/build-id/`** (`@paulaboks/sweet-build-id`): Build/deployment ID
|
||||
generation.
|
||||
- **`packages/plugin-tailwindcss/`** (`@paulaboks/sweet-tailwind`): TailwindCSS
|
||||
v4 plugin.
|
||||
- **`packages/plugin-tailwindcss-v3/`** (`@paulaboks/sweet-tailwind-v3`): Legacy
|
||||
TailwindCSS v3 plugin.
|
||||
- **`packages/examples/`** (`@fresh/examples`): Example components for tests.
|
||||
- **`packages/examples/`** (`@paulaboks/sweet-examples`): Example components for
|
||||
tests.
|
||||
|
||||
### Other directories
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ You can scaffold a new project by running the Fresh init script. To scaffold a
|
||||
project run the following:
|
||||
|
||||
```sh
|
||||
deno run -Ar jsr:@fresh/init
|
||||
deno run -Ar jsr:@paulaboks/sweet-init
|
||||
```
|
||||
|
||||
Then navigate to the newly created project folder:
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
"imports": {
|
||||
"@deno/doc": "jsr:@deno/doc@^0.172.0",
|
||||
"@deno/esbuild-plugin": "jsr:@deno/esbuild-plugin@^1.2.0",
|
||||
"@fresh/build-id": "jsr:@fresh/build-id@^1.0.0",
|
||||
"@paulaboks/sweet-build-id": "jsr:@paulaboks/sweet-build-id@^1.0.0",
|
||||
"@std/cli": "jsr:@std/cli@^1.0.19",
|
||||
"@std/collections": "jsr:@std/collections@^1.1.2",
|
||||
"@std/dotenv": "jsr:@std/dotenv@^0.225.5",
|
||||
@@ -58,7 +58,7 @@
|
||||
"docsearch": "npm:@docsearch/js@^3.5.2",
|
||||
"esbuild": "npm:esbuild@0.25.7",
|
||||
"esbuild-wasm": "npm:esbuild-wasm@0.25.7",
|
||||
"fresh": "jsr:@fresh/core@^2.0.0",
|
||||
"sweet": "jsr:@paulaboks/sweet@^2.0.0",
|
||||
"mime-db": "npm:mime-db@^1.54.0",
|
||||
"preact": "npm:preact@^10.28.2",
|
||||
"preact-render-to-string": "npm:preact-render-to-string@^6.6.5",
|
||||
|
||||
@@ -76,12 +76,12 @@
|
||||
"npm:@preact/signals@2": "2.9.0_preact@10.29.1",
|
||||
"npm:@preact/signals@^2.2.1": "2.9.0_preact@10.29.1",
|
||||
"npm:@preact/signals@^2.5.1": "2.9.0_preact@10.29.1",
|
||||
"npm:@prefresh/vite@^2.4.8": "2.4.11_preact@10.29.1_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3",
|
||||
"npm:@radix-ui/themes@^3.2.1": "3.2.1_react@19.1.1_react-dom@19.1.1__react@19.1.1",
|
||||
"npm:@prefresh/vite@^2.4.8": "2.4.11_preact@10.29.1_vite@7.3.1",
|
||||
"npm:@radix-ui/themes@^3.2.1": "3.2.1_react@19.1.1_react-dom@19.1.1",
|
||||
"npm:@remix-run/node-fetch-server@0.12": "0.12.0",
|
||||
"npm:@supabase/postgrest-js@^1.21.4": "1.21.4",
|
||||
"npm:@tailwindcss/postcss@^4.1.10": "4.1.16",
|
||||
"npm:@tailwindcss/vite@^4.1.12": "4.1.16_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3_@types+node@24.9.2",
|
||||
"npm:@tailwindcss/vite@^4.1.12": "4.1.16_vite@7.3.1_@types+node@24.9.2",
|
||||
"npm:@types/babel__core@^7.20.5": "7.20.5",
|
||||
"npm:@types/mime-db@^1.43.6": "1.43.6",
|
||||
"npm:@types/node@^24.1.0": "24.9.2",
|
||||
@@ -122,8 +122,8 @@
|
||||
"npm:tailwindcss@^3.4.17": "3.4.18_postcss@8.5.6_jiti@1.21.7",
|
||||
"npm:tailwindcss@^4.1.10": "4.1.16",
|
||||
"npm:ts-morph@^27.0.2": "27.0.2",
|
||||
"npm:vite-plugin-inspect@^11.3.2": "11.3.3_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3_@types+node@24.9.2",
|
||||
"npm:vite-plugin-pwa@^1.0.3": "1.2.0_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3_workbox-build@7.4.0__@types+babel__core@7.20.5_workbox-window@7.4.0_@types+babel__core@7.20.5",
|
||||
"npm:vite-plugin-inspect@^11.3.2": "11.3.3_vite@7.3.1_@types+node@24.9.2",
|
||||
"npm:vite-plugin-pwa@^1.0.3": "1.2.0_vite@7.3.1_workbox-build@7.4.0_workbox-window@7.4.0_@types+babel__core@7.20.5",
|
||||
"npm:vite@^7.1.4": "7.3.1_@types+node@24.9.2_picomatch@4.0.3",
|
||||
"npm:vite@^7.3.1": "7.3.1_@types+node@24.9.2_picomatch@4.0.3"
|
||||
},
|
||||
@@ -1630,7 +1630,7 @@
|
||||
"@floating-ui/utils"
|
||||
]
|
||||
},
|
||||
"@floating-ui/react-dom@2.1.6_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@floating-ui/react-dom@2.1.6_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-4JX6rEatQEvlmgU80wZyq9RT96HZJa88q8hp0pBd+LrczeDI4o6uA2M+uvxngVHo4Ihr8uibXxH6+70zhAFrVw==",
|
||||
"dependencies": [
|
||||
"@floating-ui/dom",
|
||||
@@ -1740,7 +1740,7 @@
|
||||
"@prefresh/utils@1.2.1": {
|
||||
"integrity": "sha512-vq/sIuN5nYfYzvyayXI4C2QkprfNaHUQ9ZX+3xLD8nL3rWyzpxOm1+K7RtMbhd+66QcaISViK7amjnheQ/4WZw=="
|
||||
},
|
||||
"@prefresh/vite@2.4.11_preact@10.29.1_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3": {
|
||||
"@prefresh/vite@2.4.11_preact@10.29.1_vite@7.3.1": {
|
||||
"integrity": "sha512-/XjURQqdRiCG3NpMmWqE9kJwrg9IchIOWHzulCfqg2sRe/8oQ1g5De7xrk9lbqPIQLn7ntBkKdqWXIj4E9YXyg==",
|
||||
"dependencies": [
|
||||
"@babel/core",
|
||||
@@ -1761,7 +1761,7 @@
|
||||
"@radix-ui/primitive@1.1.3": {
|
||||
"integrity": "sha512-JTF99U/6XIjCBo0wqkU5sK10glYe27MRRsfwoiq5zzOEZLHU3A3KCMa5X/azekYRCJ0HlwI0crAXS/5dEHTzDg=="
|
||||
},
|
||||
"@radix-ui/react-accessible-icon@1.1.7_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-accessible-icon@1.1.7_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-XM+E4WXl0OqUJFovy6GjmxxFyx9opfCAIUku4dlKRd5YEPqt4kALOkQOp0Of6reHuUkJuiPBEc5k0o4z4lTC8A==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-visually-hidden",
|
||||
@@ -1769,7 +1769,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-accordion@1.2.12_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-accordion@1.2.12_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-T4nygeh9YE9dLRPhAHSeOZi7HBXo+0kYIPJXayZfvWOWA0+n3dESrZbjfDPUABkUNym6Hd+f2IR113To8D2GPA==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1785,7 +1785,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-alert-dialog@1.1.15_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-alert-dialog@1.1.15_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-oTVLkEw5GpdRe29BqJ0LSDFWI3qu0vR1M0mUkOQWDIUnY/QIkLpgDMWuKxP94c2NAC2LGcgVhG1ImF3jkZ5wXw==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1798,7 +1798,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-arrow@1.1.7_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-arrow@1.1.7_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-F+M1tLhO+mlQaOWspE8Wstg+z6PwxwRd8oQ8IXceWz92kfAmalTRf0EjrouQeo7QssEPfCn05B4Ihs1K9WQ/7w==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-primitive",
|
||||
@@ -1806,7 +1806,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-aspect-ratio@1.1.7_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-aspect-ratio@1.1.7_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-Yq6lvO9HQyPwev1onK1daHCHqXVLzPhSVjmsNjCa2Zcxy2f7uJD2itDtxknv6FzAKCwD1qQkeVDmX/cev13n/g==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-primitive",
|
||||
@@ -1814,7 +1814,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-avatar@1.1.10_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-avatar@1.1.10_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-V8piFfWapM5OmNCXTzVQY+E1rDa53zY+MQ4Y7356v4fFz6vqCyUtIz2rUD44ZEdwg78/jKmMJHj07+C/Z/rcog==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-context",
|
||||
@@ -1826,7 +1826,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-checkbox@1.3.3_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-checkbox@1.3.3_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-wBbpv+NQftHDdG86Qc0pIyXk5IR3tM8Vd0nWLKDcX8nNn4nXFOFwsKuqw2okA/1D/mpaAkmuyndrPJTYDNZtFw==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1841,7 +1841,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-collapsible@1.1.12_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-collapsible@1.1.12_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-Uu+mSh4agx2ib1uIGPP4/CKNULyajb3p92LsVXmH2EHVMTfZWpll88XJ0j4W0z3f8NK1eYl1+Mf/szHPmcHzyA==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1856,7 +1856,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-collection@1.1.7_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-collection@1.1.7_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-Fh9rGN0MoI4ZFUNyfFVNU4y9LUz93u9/0K+yLgA2bwRojxM8JU1DyvvMBabnZPBgMWREAJvU2jjVzq+LrFUglw==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-compose-refs",
|
||||
@@ -1873,7 +1873,7 @@
|
||||
"react"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-context-menu@2.2.16_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-context-menu@2.2.16_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-O8morBEW+HsVG28gYDZPTrT9UUovQUlJue5YO836tiTJhuIWBm/zQHc7j388sHWtdH/xUZurK9olD2+pcqx5ww==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1892,7 +1892,7 @@
|
||||
"react"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-dialog@1.1.15_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-dialog@1.1.15_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-TCglVRtzlffRNxRMEyR36DGBLJpeusFcgMVD9PZEzAKnUs1lKCgX5u9BmC2Yg+LL9MgZDugFFs1Vl+Jp4t/PGw==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1919,7 +1919,7 @@
|
||||
"react"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-dismissable-layer@1.1.11_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-dismissable-layer@1.1.11_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-Nqcp+t5cTB8BinFkZgXiMJniQH0PsUt2k51FUhbdfeKvc4ACcG2uQniY/8+h1Yv6Kza4Q7lD7PQV0z0oicE0Mg==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1931,7 +1931,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-dropdown-menu@2.1.16_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-dropdown-menu@2.1.16_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-1PLGQEynI/3OX/ftV54COn+3Sud/Mn8vALg2rWnBLnRaGtJDduNW/22XjlGgPdpcIbiQxjKtb7BkcjP00nqfJw==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1951,7 +1951,7 @@
|
||||
"react"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-focus-scope@1.1.7_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-focus-scope@1.1.7_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-t2ODlkXBQyn7jkl6TNaw/MtVEVvIGelJDCG41Okq/KwUsJBwQ4XVZsHAVUkK4mBv3ewiAS3PGuUWuY2BoK4ZUw==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-compose-refs",
|
||||
@@ -1961,7 +1961,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-form@0.1.8_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-form@0.1.8_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-QM70k4Zwjttifr5a4sZFts9fn8FzHYvQ5PiB19O2HsYibaHSVt9fH9rzB0XZo/YcM+b7t/p7lYCT/F5eOeF5yQ==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1974,7 +1974,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-hover-card@1.1.15_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-hover-card@1.1.15_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-qgTkjNT1CfKMoP0rcasmlH2r1DAiYicWsDsufxl940sT2wHNEWWv6FMWIQXWhVdmC1d/HYfbhQx60KYyAtKxjg==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -1997,7 +1997,7 @@
|
||||
"react"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-label@2.1.7_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-label@2.1.7_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-YT1GqPSL8kJn20djelMX7/cTRp/Y9w5IZHvfxQTVHrOqa2yMl7i/UfMqKRU5V7mEyKTrUVgJXhNQPVCG8PBLoQ==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-primitive",
|
||||
@@ -2005,7 +2005,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-menu@2.1.16_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-menu@2.1.16_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-72F2T+PLlphrqLcAotYPp0uJMr5SjP5SL01wfEspJbru5Zs5vQaSHb4VB3ZMJPimgHHCHG7gMOeOB9H3Hdmtxg==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2030,7 +2030,7 @@
|
||||
"react-remove-scroll"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-menubar@1.1.16_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-menubar@1.1.16_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-EB1FktTz5xRRi2Er974AUQZWg2yVBb1yjip38/lgwtCVRd3a+maUoGHN/xs9Yv8SY8QwbSEb+YrxGadVWbEutA==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2047,7 +2047,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-navigation-menu@1.2.14_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-navigation-menu@1.2.14_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-YB9mTFQvCOAQMHU+C/jVl96WmuWeltyUEpRJJky51huhds5W2FQr1J8D/16sQlf0ozxkPK8uF3niQMdUwZPv5w==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2068,7 +2068,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-one-time-password-field@0.1.8_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-one-time-password-field@0.1.8_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-ycS4rbwURavDPVjCb5iS3aG4lURFDILi6sKI/WITUMZ13gMmn/xGjpLoqBAalhJaDk8I3UbCM5GzKHrnzwHbvg==",
|
||||
"dependencies": [
|
||||
"@radix-ui/number",
|
||||
@@ -2087,7 +2087,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-password-toggle-field@0.1.3_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-password-toggle-field@0.1.3_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-/UuCrDBWravcaMix4TdT+qlNdVwOM1Nck9kWx/vafXsdfj1ChfhOdfi3cy9SGBpWgTXwYCuboT/oYpJy3clqfw==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2102,7 +2102,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-popover@1.1.15_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-popover@1.1.15_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-kr0X2+6Yy/vJzLYJUPCZEc8SfQcf+1COFoAqauJm74umQhta9M7lNJHP7QQS3vkvcGLQUbWpMzwrXYwrYztHKA==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2124,7 +2124,7 @@
|
||||
"react-remove-scroll"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-popper@1.2.8_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-popper@1.2.8_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-0NJQ4LFFUuWkE7Oxf0htBKS6zLkkjBH+hM1uk7Ng705ReR8m/uelduy1DBo0PyBXPKVnBA6YBlU94MBGXrSBCw==",
|
||||
"dependencies": [
|
||||
"@floating-ui/react-dom",
|
||||
@@ -2141,7 +2141,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-portal@1.1.9_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-portal@1.1.9_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-bpIxvq03if6UNwXZ+HTK71JLh4APvnXntDc6XOX8UVq4XQOVl7lwok0AvIl+b8zgCw3fSaVTZMpAPPagXbKmHQ==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-primitive",
|
||||
@@ -2150,7 +2150,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-presence@1.1.5_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-presence@1.1.5_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-/jfEwNDdQVBCNvjkGit4h6pMOzq8bHkopq458dPt2lMjx+eBQUohZNG9A7DtO/O5ukSbxuaNGXMjHicgwy6rQQ==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-compose-refs",
|
||||
@@ -2159,7 +2159,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-primitive@2.1.3_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-primitive@2.1.3_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-m9gTwRkhy2lvCPe6QJp4d3G1TYEUHn/FzJUtq9MjH46an1wJU+GdoGC5VLof8RX8Ft/DlpshApkhswDLZzHIcQ==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-slot",
|
||||
@@ -2167,7 +2167,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-progress@1.1.7_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-progress@1.1.7_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-vPdg/tF6YC/ynuBIJlk1mm7Le0VgW6ub6J2UWnTQ7/D23KXcPI1qy+0vBkgKgd38RCMJavBXpB83HPNFMTb0Fg==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-context",
|
||||
@@ -2176,7 +2176,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-radio-group@1.3.8_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-radio-group@1.3.8_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-VBKYIYImA5zsxACdisNQ3BjCBfmbGH3kQlnFVqlWU4tXwjy7cGX8ta80BcrO+WJXIn5iBylEH3K6ZTlee//lgQ==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2193,7 +2193,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-roving-focus@1.1.11_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-roving-focus@1.1.11_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-7A6S9jSgm/S+7MdtNDSb+IU859vQqJ/QAtcYQcfFC6W8RS4IxIZDldLR0xqCFZ6DCyrQLjLPsxtTNch5jVA4lA==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2209,7 +2209,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-scroll-area@1.2.10_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-scroll-area@1.2.10_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-tAXIa1g3sM5CGpVT0uIbUx/U3Gs5N8T52IICuCtObaos1S8fzsrPXG5WObkQN3S6NVl6wKgPhAIiBGbWnvc97A==",
|
||||
"dependencies": [
|
||||
"@radix-ui/number",
|
||||
@@ -2225,7 +2225,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-select@2.2.6_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-select@2.2.6_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-I30RydO+bnn2PQztvo25tswPH+wFBjehVGtmagkU78yMdwTwVf12wnAOF+AeP8S2N8xD+5UPbGhkUfPyvT+mwQ==",
|
||||
"dependencies": [
|
||||
"@radix-ui/number",
|
||||
@@ -2253,7 +2253,7 @@
|
||||
"react-remove-scroll"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-separator@1.1.7_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-separator@1.1.7_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-0HEb8R9E8A+jZjvmFCy/J4xhbXy3TV+9XSnGJ3KvTtjlIUy/YQ/p6UYZvi7YbeoeXdyU9+Y3scizK6hkY37baA==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-primitive",
|
||||
@@ -2261,7 +2261,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-slider@1.3.6_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-slider@1.3.6_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-JPYb1GuM1bxfjMRlNLE+BcmBC8onfCi60Blk7OBqi2MLTFdS+8401U4uFjnwkOr49BLmXxLC6JHkvAsx5OJvHw==",
|
||||
"dependencies": [
|
||||
"@radix-ui/number",
|
||||
@@ -2286,7 +2286,7 @@
|
||||
"react"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-switch@1.2.6_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-switch@1.2.6_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-bByzr1+ep1zk4VubeEVViV592vu2lHE2BZY5OnzehZqOOgogN80+mNtCqPkhn2gklJqOpxWgPoYTSnhBCqpOXQ==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2300,7 +2300,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-tabs@1.1.13_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-tabs@1.1.13_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-7xdcatg7/U+7+Udyoj2zodtI9H/IIopqo+YOIcZOq1nJwXWBZ9p8xiu5llXlekDbZkca79a/fozEYQXIA4sW6A==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2315,7 +2315,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-toast@1.2.15_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-toast@1.2.15_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-3OSz3TacUWy4WtOXV38DggwxoqJK4+eDkNMl5Z/MJZaoUPaP4/9lf81xXMe1I2ReTAptverZUpbPY4wWwWyL5g==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2334,7 +2334,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-toggle-group@1.1.11_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-toggle-group@1.1.11_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-5umnS0T8JQzQT6HbPyO7Hh9dgd82NmS36DQr+X/YJ9ctFNCiiQd6IJAYYZ33LUwm8M+taCz5t2ui29fHZc4Y6Q==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2348,7 +2348,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-toggle@1.1.10_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-toggle@1.1.10_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-lS1odchhFTeZv3xwHH31YPObmJn8gOg7Lq12inrr0+BH/l3Tsq32VfjqH1oh80ARM3mlkfMic15n0kg4sD1poQ==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2358,7 +2358,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-toolbar@1.1.11_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-toolbar@1.1.11_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-4ol06/1bLoFu1nwUqzdD4Y5RZ9oDdKeiHIsntug54Hcr1pgaHiPqHFEaXI1IFP/EsOfROQZ8Mig9VTIRza6Tjg==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2372,7 +2372,7 @@
|
||||
"react-dom"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-tooltip@1.2.8_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-tooltip@1.2.8_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-tY7sVt1yL9ozIxvmbtN5qtmH2krXcBCfjEiCgKGLqunJHvgvZG2Pcl2oQ3kbcZARb1BGEHdkLzcYGO8ynVlieg==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -2452,7 +2452,7 @@
|
||||
"react"
|
||||
]
|
||||
},
|
||||
"@radix-ui/react-visually-hidden@1.2.3_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/react-visually-hidden@1.2.3_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-pzJq12tEaaIhqjbzpCuv/OypJY/BPavOofm+dbab+MHLajy277+1lLm6JFcGgF5eskJ6mquGirhXY2GD/8u8Ug==",
|
||||
"dependencies": [
|
||||
"@radix-ui/react-primitive",
|
||||
@@ -2463,7 +2463,7 @@
|
||||
"@radix-ui/rect@1.1.1": {
|
||||
"integrity": "sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw=="
|
||||
},
|
||||
"@radix-ui/themes@3.2.1_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"@radix-ui/themes@3.2.1_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-WJL2YKAGItkunwm3O4cLTFKCGJTfAfF6Hmq7f5bCo1ggqC9qJQ/wfg/25AAN72aoEM1yqXZQ+pslsw48AFR0Xg==",
|
||||
"dependencies": [
|
||||
"@radix-ui/colors",
|
||||
@@ -2825,7 +2825,7 @@
|
||||
"tailwindcss@4.1.16"
|
||||
]
|
||||
},
|
||||
"@tailwindcss/vite@4.1.16_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3_@types+node@24.9.2": {
|
||||
"@tailwindcss/vite@4.1.16_vite@7.3.1_@types+node@24.9.2": {
|
||||
"integrity": "sha512-bbguNBcDxsRmi9nnlWJxhfDWamY3lmcyACHcdO1crxfzuLpOhHLLtEIN/nCbbAtj5rchUgQD17QVAKi1f7IsKg==",
|
||||
"dependencies": [
|
||||
"@tailwindcss/node",
|
||||
@@ -4837,7 +4837,7 @@
|
||||
"queue-microtask@1.2.3": {
|
||||
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="
|
||||
},
|
||||
"radix-ui@1.4.3_react@19.1.1_react-dom@19.1.1__react@19.1.1": {
|
||||
"radix-ui@1.4.3_react@19.1.1_react-dom@19.1.1": {
|
||||
"integrity": "sha512-aWizCQiyeAenIdUbqEpXgRA1ya65P13NKn/W8rWkcN0OPkRDxdBVLWnIEDsS2RpwCK2nobI7oMUSmexzTDyAmA==",
|
||||
"dependencies": [
|
||||
"@radix-ui/primitive",
|
||||
@@ -5650,7 +5650,7 @@
|
||||
"util-deprecate@1.0.2": {
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||
},
|
||||
"vite-dev-rpc@1.1.0_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3_@types+node@24.9.2": {
|
||||
"vite-dev-rpc@1.1.0_vite@7.3.1_@types+node@24.9.2": {
|
||||
"integrity": "sha512-pKXZlgoXGoE8sEKiKJSng4hI1sQ4wi5YT24FCrwrLt6opmkjlqPPVmiPWWJn8M8byMxRGzp1CrFuqQs4M/Z39A==",
|
||||
"dependencies": [
|
||||
"birpc",
|
||||
@@ -5658,13 +5658,13 @@
|
||||
"vite-hot-client"
|
||||
]
|
||||
},
|
||||
"vite-hot-client@2.1.0_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3_@types+node@24.9.2": {
|
||||
"vite-hot-client@2.1.0_vite@7.3.1_@types+node@24.9.2": {
|
||||
"integrity": "sha512-7SpgZmU7R+dDnSmvXE1mfDtnHLHQSisdySVR7lO8ceAXvM0otZeuQQ6C8LrS5d/aYyP/QZ0hI0L+dIPrm4YlFQ==",
|
||||
"dependencies": [
|
||||
"vite"
|
||||
]
|
||||
},
|
||||
"vite-plugin-inspect@11.3.3_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3_@types+node@24.9.2": {
|
||||
"vite-plugin-inspect@11.3.3_vite@7.3.1_@types+node@24.9.2": {
|
||||
"integrity": "sha512-u2eV5La99oHoYPHE6UvbwgEqKKOQGz86wMg40CCosP6q8BkB6e5xPneZfYagK4ojPJSj5anHCrnvC20DpwVdRA==",
|
||||
"dependencies": [
|
||||
"ansis",
|
||||
@@ -5679,7 +5679,7 @@
|
||||
"vite-dev-rpc"
|
||||
]
|
||||
},
|
||||
"vite-plugin-pwa@1.2.0_vite@7.3.1__@types+node@24.9.2__picomatch@4.0.3_workbox-build@7.4.0__@types+babel__core@7.20.5_workbox-window@7.4.0_@types+babel__core@7.20.5": {
|
||||
"vite-plugin-pwa@1.2.0_vite@7.3.1_workbox-build@7.4.0_workbox-window@7.4.0_@types+babel__core@7.20.5": {
|
||||
"integrity": "sha512-a2xld+SJshT9Lgcv8Ji4+srFJL4k/1bVbd1x06JIkvecpQkwkvCncD1+gSzcdm3s+owWLpMJerG3aN5jupJEVw==",
|
||||
"dependencies": [
|
||||
"debug",
|
||||
@@ -5985,10 +5985,10 @@
|
||||
"jsr:@astral/astral@~0.5.6",
|
||||
"jsr:@deno/doc@0.172",
|
||||
"jsr:@deno/esbuild-plugin@^1.2.0",
|
||||
"jsr:@fresh/build-id@1",
|
||||
"jsr:@fresh/core@2",
|
||||
"jsr:@marvinh-test/fresh-island@^0.0.3",
|
||||
"jsr:@matmen/imagescript@^1.3.0",
|
||||
"jsr:@paulaboks/sweet-build-id@1",
|
||||
"jsr:@paulaboks/sweet@2",
|
||||
"jsr:@std/async@^1.0.13",
|
||||
"jsr:@std/cli@^1.0.19",
|
||||
"jsr:@std/collections@^1.1.2",
|
||||
@@ -6042,7 +6042,7 @@
|
||||
},
|
||||
"packages/examples": {
|
||||
"dependencies": [
|
||||
"jsr:@fresh/core@2",
|
||||
"jsr:@paulaboks/sweet@2",
|
||||
"npm:@preact/signals@^2.2.1",
|
||||
"npm:preact@^10.27.0"
|
||||
]
|
||||
@@ -6079,8 +6079,8 @@
|
||||
"packages/plugin-vite": {
|
||||
"dependencies": [
|
||||
"jsr:@deno/loader@0.4",
|
||||
"jsr:@fresh/core@2",
|
||||
"jsr:@marvinh-test/import-json@^0.0.1",
|
||||
"jsr:@paulaboks/sweet@2",
|
||||
"npm:@babel/core@^7.28.0",
|
||||
"npm:@babel/preset-react@^7.27.1",
|
||||
"npm:@prefresh/vite@^2.4.8",
|
||||
|
||||
@@ -29,7 +29,7 @@ If you need a particular commit (for testing specific fixes or features):
|
||||
"update": "deno run -A -r jsr:@fresh/update ."
|
||||
},
|
||||
"imports": {
|
||||
- "$fresh/": "jsr:@fresh/core@^2.0.0",
|
||||
- "$fresh/": "jsr:@paulaboks/sweet@^2.0.0",
|
||||
+ "$fresh/": "https://raw.githubusercontent.com/denoland/fresh/your-commit-hash/",
|
||||
"preact": "npm:preact@^10.26.9",
|
||||
"@preact/signals": "npm:@preact/signals@^2.2.0"
|
||||
@@ -59,7 +59,7 @@ For testing your own fork or PR:
|
||||
### Using JSR
|
||||
|
||||
```sh Terminal
|
||||
deno run -A -r jsr:@fresh/init@2.0.0-alpha.35
|
||||
deno run -A -r jsr:@paulaboks/sweet-init@2.0.0-alpha.35
|
||||
```
|
||||
|
||||
### From local source
|
||||
|
||||
@@ -6,51 +6,51 @@ description: |
|
||||
This page lists all public exports from Fresh's entry points.
|
||||
|
||||
> [info]: You can also explore Fresh's full API documentation on JSR:
|
||||
> [`@fresh/core`](https://jsr.io/@fresh/core/doc)
|
||||
> [`@paulaboks/sweet`](https://jsr.io/@paulaboks/sweet/doc)
|
||||
|
||||
## `fresh`
|
||||
|
||||
The main entry point for server-side code.
|
||||
|
||||
```ts
|
||||
import { App, createDefine, HttpError, page, staticFiles } from "fresh";
|
||||
import { App, createDefine, HttpError, page, staticFiles } from "sweet";
|
||||
```
|
||||
|
||||
| Export | Kind | Description |
|
||||
| --------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------- |
|
||||
| [`App`](https://jsr.io/@fresh/core/doc/~/App) | Class | The main application class. See [App](/docs/concepts/app). |
|
||||
| [`staticFiles`](https://jsr.io/@fresh/core/doc/~/staticFiles) | Function | Middleware for serving static files. See [Static Files](/docs/concepts/static-files). |
|
||||
| [`createDefine`](https://jsr.io/@fresh/core/doc/~/createDefine) | Function | Create type-safe `define.*` helpers. See [Define Helpers](/docs/advanced/define). |
|
||||
| [`page`](https://jsr.io/@fresh/core/doc/~/page) | Function | Return data from a handler to a page component. See [Data Fetching](/docs/concepts/data-fetching). |
|
||||
| [`HttpError`](https://jsr.io/@fresh/core/doc/~/HttpError) | Class | Throw HTTP errors with status codes. See [Error Handling](/docs/advanced/error-handling). |
|
||||
| [`cors`](https://jsr.io/@fresh/core/doc/~/cors) | Function | CORS middleware. See [cors](/docs/plugins/cors). |
|
||||
| [`csrf`](https://jsr.io/@fresh/core/doc/~/csrf) | Function | CSRF protection middleware. See [csrf](/docs/plugins/csrf). |
|
||||
| [`csp`](https://jsr.io/@fresh/core/doc/~/csp) | Function | Content Security Policy middleware. See [csp](/docs/plugins/csp). |
|
||||
| [`trailingSlashes`](https://jsr.io/@fresh/core/doc/~/trailingSlashes) | Function | Trailing slash enforcement middleware. See [trailingSlashes](/docs/plugins/trailing-slashes). |
|
||||
| -------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------------- |
|
||||
| [`App`](https://jsr.io/@paulaboks/sweet/doc/~/App) | Class | The main application class. See [App](/docs/concepts/app). |
|
||||
| [`staticFiles`](https://jsr.io/@paulaboks/sweet/doc/~/staticFiles) | Function | Middleware for serving static files. See [Static Files](/docs/concepts/static-files). |
|
||||
| [`createDefine`](https://jsr.io/@paulaboks/sweet/doc/~/createDefine) | Function | Create type-safe `define.*` helpers. See [Define Helpers](/docs/advanced/define). |
|
||||
| [`page`](https://jsr.io/@paulaboks/sweet/doc/~/page) | Function | Return data from a handler to a page component. See [Data Fetching](/docs/concepts/data-fetching). |
|
||||
| [`HttpError`](https://jsr.io/@paulaboks/sweet/doc/~/HttpError) | Class | Throw HTTP errors with status codes. See [Error Handling](/docs/advanced/error-handling). |
|
||||
| [`cors`](https://jsr.io/@paulaboks/sweet/doc/~/cors) | Function | CORS middleware. See [cors](/docs/plugins/cors). |
|
||||
| [`csrf`](https://jsr.io/@paulaboks/sweet/doc/~/csrf) | Function | CSRF protection middleware. See [csrf](/docs/plugins/csrf). |
|
||||
| [`csp`](https://jsr.io/@paulaboks/sweet/doc/~/csp) | Function | Content Security Policy middleware. See [csp](/docs/plugins/csp). |
|
||||
| [`trailingSlashes`](https://jsr.io/@paulaboks/sweet/doc/~/trailingSlashes) | Function | Trailing slash enforcement middleware. See [trailingSlashes](/docs/plugins/trailing-slashes). |
|
||||
|
||||
**Types:**
|
||||
|
||||
| Export | Kind | Description |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------- |
|
||||
| [`Context`](https://jsr.io/@fresh/core/doc/~/Context) / [`FreshContext`](https://jsr.io/@fresh/core/doc/~/FreshContext) | Interface | The request context passed to all middlewares and handlers. |
|
||||
| [`PageProps`](https://jsr.io/@fresh/core/doc/~/PageProps) | Type | Props received by page components (`data`, `url`, `params`, `state`, etc.). |
|
||||
| [`Middleware`](https://jsr.io/@fresh/core/doc/~/Middleware) / [`MiddlewareFn`](https://jsr.io/@fresh/core/doc/~/MiddlewareFn) | Type | Middleware function type. |
|
||||
| [`HandlerFn`](https://jsr.io/@fresh/core/doc/~/HandlerFn) | Type | Single handler function type. |
|
||||
| [`HandlerByMethod`](https://jsr.io/@fresh/core/doc/~/HandlerByMethod) | Type | Object with per-method handler functions. |
|
||||
| [`RouteHandler`](https://jsr.io/@fresh/core/doc/~/RouteHandler) | Type | Union of `HandlerFn` and `HandlerByMethod`. |
|
||||
| [`PageResponse`](https://jsr.io/@fresh/core/doc/~/PageResponse) | Type | Return type of `page()`. |
|
||||
| [`RouteConfig`](https://jsr.io/@fresh/core/doc/~/RouteConfig) | Interface | Route configuration (`routeOverride`, `skipInheritedLayouts`, etc.). |
|
||||
| [`LayoutConfig`](https://jsr.io/@fresh/core/doc/~/LayoutConfig) | Interface | Layout configuration (`skipInheritedLayouts`, `skipAppWrapper`). |
|
||||
| [`Define`](https://jsr.io/@fresh/core/doc/~/Define) | Interface | Type of the object returned by `createDefine()`. |
|
||||
| [`FreshConfig`](https://jsr.io/@fresh/core/doc/~/FreshConfig) / [`ResolvedFreshConfig`](https://jsr.io/@fresh/core/doc/~/ResolvedFreshConfig) | Interface | App configuration types. |
|
||||
| [`ListenOptions`](https://jsr.io/@fresh/core/doc/~/ListenOptions) | Interface | Options for `app.listen()`. |
|
||||
| [`Island`](https://jsr.io/@fresh/core/doc/~/Island) | Type | Island component type. |
|
||||
| [`Method`](https://jsr.io/@fresh/core/doc/~/Method) | Type | HTTP method union type. |
|
||||
| [`RouteData`](https://jsr.io/@fresh/core/doc/~/RouteData) | Type | Data type returned by route handlers via `page()`. |
|
||||
| [`Lazy`](https://jsr.io/@fresh/core/doc/~/Lazy) / [`MaybeLazy`](https://jsr.io/@fresh/core/doc/~/MaybeLazy) | Type | Utility types for lazily-loaded routes and middleware. |
|
||||
| [`CORSOptions`](https://jsr.io/@fresh/core/doc/~/CORSOptions) | Interface | Options for `cors()`. |
|
||||
| [`CsrfOptions`](https://jsr.io/@fresh/core/doc/~/CsrfOptions) | Interface | Options for `csrf()`. |
|
||||
| [`CSPOptions`](https://jsr.io/@fresh/core/doc/~/CSPOptions) | Interface | Options for `csp()`. |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------------- |
|
||||
| [`Context`](https://jsr.io/@paulaboks/sweet/doc/~/Context) / [`FreshContext`](https://jsr.io/@paulaboks/sweet/doc/~/FreshContext) | Interface | The request context passed to all middlewares and handlers. |
|
||||
| [`PageProps`](https://jsr.io/@paulaboks/sweet/doc/~/PageProps) | Type | Props received by page components (`data`, `url`, `params`, `state`, etc.). |
|
||||
| [`Middleware`](https://jsr.io/@paulaboks/sweet/doc/~/Middleware) / [`MiddlewareFn`](https://jsr.io/@paulaboks/sweet/doc/~/MiddlewareFn) | Type | Middleware function type. |
|
||||
| [`HandlerFn`](https://jsr.io/@paulaboks/sweet/doc/~/HandlerFn) | Type | Single handler function type. |
|
||||
| [`HandlerByMethod`](https://jsr.io/@paulaboks/sweet/doc/~/HandlerByMethod) | Type | Object with per-method handler functions. |
|
||||
| [`RouteHandler`](https://jsr.io/@paulaboks/sweet/doc/~/RouteHandler) | Type | Union of `HandlerFn` and `HandlerByMethod`. |
|
||||
| [`PageResponse`](https://jsr.io/@paulaboks/sweet/doc/~/PageResponse) | Type | Return type of `page()`. |
|
||||
| [`RouteConfig`](https://jsr.io/@paulaboks/sweet/doc/~/RouteConfig) | Interface | Route configuration (`routeOverride`, `skipInheritedLayouts`, etc.). |
|
||||
| [`LayoutConfig`](https://jsr.io/@paulaboks/sweet/doc/~/LayoutConfig) | Interface | Layout configuration (`skipInheritedLayouts`, `skipAppWrapper`). |
|
||||
| [`Define`](https://jsr.io/@paulaboks/sweet/doc/~/Define) | Interface | Type of the object returned by `createDefine()`. |
|
||||
| [`FreshConfig`](https://jsr.io/@paulaboks/sweet/doc/~/FreshConfig) / [`ResolvedFreshConfig`](https://jsr.io/@paulaboks/sweet/doc/~/ResolvedFreshConfig) | Interface | App configuration types. |
|
||||
| [`ListenOptions`](https://jsr.io/@paulaboks/sweet/doc/~/ListenOptions) | Interface | Options for `app.listen()`. |
|
||||
| [`Island`](https://jsr.io/@paulaboks/sweet/doc/~/Island) | Type | Island component type. |
|
||||
| [`Method`](https://jsr.io/@paulaboks/sweet/doc/~/Method) | Type | HTTP method union type. |
|
||||
| [`RouteData`](https://jsr.io/@paulaboks/sweet/doc/~/RouteData) | Type | Data type returned by route handlers via `page()`. |
|
||||
| [`Lazy`](https://jsr.io/@paulaboks/sweet/doc/~/Lazy) / [`MaybeLazy`](https://jsr.io/@paulaboks/sweet/doc/~/MaybeLazy) | Type | Utility types for lazily-loaded routes and middleware. |
|
||||
| [`CORSOptions`](https://jsr.io/@paulaboks/sweet/doc/~/CORSOptions) | Interface | Options for `cors()`. |
|
||||
| [`CsrfOptions`](https://jsr.io/@paulaboks/sweet/doc/~/CsrfOptions) | Interface | Options for `csrf()`. |
|
||||
| [`CSPOptions`](https://jsr.io/@paulaboks/sweet/doc/~/CSPOptions) | Interface | Options for `csp()`. |
|
||||
|
||||
## `fresh/runtime`
|
||||
|
||||
@@ -65,34 +65,34 @@ import {
|
||||
HttpError,
|
||||
IS_BROWSER,
|
||||
Partial,
|
||||
} from "fresh/runtime";
|
||||
} from "sweet/runtime";
|
||||
```
|
||||
|
||||
| Export | Kind | Description |
|
||||
| --------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------- |
|
||||
| [`IS_BROWSER`](https://jsr.io/@fresh/core/doc/runtime/~/IS_BROWSER) | Constant | `true` in the browser, `false` on the server. Use to guard browser-only code. |
|
||||
| [`asset`](https://jsr.io/@fresh/core/doc/runtime/~/asset) | Function | Add cache-busting query params to asset URLs. See [Static Files](/docs/concepts/static-files). |
|
||||
| [`assetSrcSet`](https://jsr.io/@fresh/core/doc/runtime/~/assetSrcSet) | Function | Apply `asset()` to all URLs in a `srcset` string. |
|
||||
| [`Partial`](https://jsr.io/@fresh/core/doc/runtime/~/Partial) | Component | Mark a region for partial updates. See [Partials](/docs/advanced/partials). |
|
||||
| [`Head`](https://jsr.io/@fresh/core/doc/runtime/~/Head) | Component | Add elements to the document `<head>`. See [<head> element](/docs/advanced/head). |
|
||||
| [`HttpError`](https://jsr.io/@fresh/core/doc/runtime/~/HttpError) | Class | HTTP error class (re-exported from `fresh`). |
|
||||
| -------------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------- |
|
||||
| [`IS_BROWSER`](https://jsr.io/@paulaboks/sweet/doc/runtime/~/IS_BROWSER) | Constant | `true` in the browser, `false` on the server. Use to guard browser-only code. |
|
||||
| [`asset`](https://jsr.io/@paulaboks/sweet/doc/runtime/~/asset) | Function | Add cache-busting query params to asset URLs. See [Static Files](/docs/concepts/static-files). |
|
||||
| [`assetSrcSet`](https://jsr.io/@paulaboks/sweet/doc/runtime/~/assetSrcSet) | Function | Apply `asset()` to all URLs in a `srcset` string. |
|
||||
| [`Partial`](https://jsr.io/@paulaboks/sweet/doc/runtime/~/Partial) | Component | Mark a region for partial updates. See [Partials](/docs/advanced/partials). |
|
||||
| [`Head`](https://jsr.io/@paulaboks/sweet/doc/runtime/~/Head) | Component | Add elements to the document `<head>`. See [<head> element](/docs/advanced/head). |
|
||||
| [`HttpError`](https://jsr.io/@paulaboks/sweet/doc/runtime/~/HttpError) | Class | HTTP error class (re-exported from `fresh`). |
|
||||
|
||||
## `fresh/dev`
|
||||
|
||||
Development and build tools. Only used in `dev.ts` (legacy) or build scripts.
|
||||
|
||||
```ts
|
||||
import { Builder } from "fresh/dev";
|
||||
import { Builder } from "sweet/dev";
|
||||
```
|
||||
|
||||
| Export | Kind | Description |
|
||||
| --------------------------------------------------------- | ----- | ---------------------------------------------------------------------- |
|
||||
| [`Builder`](https://jsr.io/@fresh/core/doc/dev/~/Builder) | Class | Pre-Vite build system (legacy). See [Builder](/docs/advanced/builder). |
|
||||
| -------------------------------------------------------------- | ----- | ---------------------------------------------------------------------- |
|
||||
| [`Builder`](https://jsr.io/@paulaboks/sweet/doc/dev/~/Builder) | Class | Pre-Vite build system (legacy). See [Builder](/docs/advanced/builder). |
|
||||
|
||||
**Types:**
|
||||
|
||||
| Export | Kind | Description |
|
||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------- |
|
||||
| [`BuildOptions`](https://jsr.io/@fresh/core/doc/dev/~/BuildOptions) | Interface | Options for `new Builder()`. |
|
||||
| [`ResolvedBuildConfig`](https://jsr.io/@fresh/core/doc/dev/~/ResolvedBuildConfig) | Interface | Resolved build configuration. |
|
||||
| [`OnTransformArgs`](https://jsr.io/@fresh/core/doc/dev/~/OnTransformArgs) / [`OnTransformOptions`](https://jsr.io/@fresh/core/doc/dev/~/OnTransformOptions) / [`TransformFn`](https://jsr.io/@fresh/core/doc/dev/~/TransformFn) | Type | Build plugin hook types. |
|
||||
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------- |
|
||||
| [`BuildOptions`](https://jsr.io/@paulaboks/sweet/doc/dev/~/BuildOptions) | Interface | Options for `new Builder()`. |
|
||||
| [`ResolvedBuildConfig`](https://jsr.io/@paulaboks/sweet/doc/dev/~/ResolvedBuildConfig) | Interface | Resolved build configuration. |
|
||||
| [`OnTransformArgs`](https://jsr.io/@paulaboks/sweet/doc/dev/~/OnTransformArgs) / [`OnTransformOptions`](https://jsr.io/@paulaboks/sweet/doc/dev/~/OnTransformOptions) / [`TransformFn`](https://jsr.io/@paulaboks/sweet/doc/dev/~/TransformFn) | Type | Build plugin hook types. |
|
||||
|
||||
@@ -111,7 +111,7 @@ routes that return JSON, or pages that need a completely different HTML
|
||||
structure. Use `skipAppWrapper` in the route config:
|
||||
|
||||
```tsx routes/embed.tsx
|
||||
import { type RouteConfig } from "fresh";
|
||||
import { type RouteConfig } from "sweet";
|
||||
import { define } from "../utils.ts";
|
||||
|
||||
export const config: RouteConfig = {
|
||||
|
||||
@@ -11,7 +11,7 @@ The `Builder` class is used to generate production assets of your app. You'll
|
||||
typically find it being created inside your project's `dev.ts` file.
|
||||
|
||||
```ts dev.ts
|
||||
import { Builder } from "fresh/dev";
|
||||
import { Builder } from "sweet/dev";
|
||||
|
||||
const builder = new Builder({ target: "safari12" });
|
||||
|
||||
@@ -167,12 +167,12 @@ that.
|
||||
}
|
||||
```
|
||||
|
||||
2. Run `deno install jsr:@fresh/plugin-tailwind`
|
||||
2. Run `deno install jsr:@paulaboks/sweet-tailwind`
|
||||
3. Update `dev.ts`:
|
||||
|
||||
```diff dev.ts
|
||||
import { Builder } from "fresh/dev";
|
||||
+ import { tailwind } from "@fresh/plugin-tailwind";
|
||||
import { Builder } from "sweet/dev";
|
||||
+ import { tailwind } from "@paulaboks/sweet-tailwind";
|
||||
|
||||
const builder = new Builder();
|
||||
+ tailwind(builder);
|
||||
@@ -205,8 +205,8 @@ If you can't update to the current version of tailwindcss we have a dedicated
|
||||
decided on your own when it's best to update to v4.
|
||||
|
||||
```ts dev.ts
|
||||
import { Builder } from "fresh/dev";
|
||||
import { tailwind } from "@fresh/plugin-tailwind-v3";
|
||||
import { Builder } from "sweet/dev";
|
||||
import { tailwind } from "@paulaboks/sweet-tailwind-v3";
|
||||
|
||||
tailwind(builder, {});
|
||||
```
|
||||
|
||||
@@ -30,7 +30,7 @@ export async function otherMiddleware(ctx: Context<State>): Promise<Response> {
|
||||
With define helpers:
|
||||
|
||||
```ts util.ts
|
||||
import { createDefine } from "fresh";
|
||||
import { createDefine } from "sweet";
|
||||
|
||||
// Setup, do this once in a file and import it everywhere else.
|
||||
export const define = createDefine<{ foo: string }>();
|
||||
|
||||
@@ -21,7 +21,7 @@ Fresh supports two kind of error pages:
|
||||
To add an error page use [`app.onError()`](/docs/concepts/app#onerror).
|
||||
|
||||
```ts main.ts
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.onError("*", (ctx) => {
|
||||
@@ -77,13 +77,13 @@ If you need to bail out of execution and need to respond with a particular HTTP
|
||||
error code, you can use Fresh's `HttpError` class:
|
||||
|
||||
```ts
|
||||
import { HttpError } from "fresh";
|
||||
import { HttpError } from "sweet";
|
||||
```
|
||||
|
||||
`HttpError` takes a status code and an optional message:
|
||||
|
||||
```ts middleware/auth.ts
|
||||
import { HttpError } from "fresh";
|
||||
import { HttpError } from "sweet";
|
||||
|
||||
async function authMiddleware(ctx) {
|
||||
const user = ctx.state.user;
|
||||
@@ -106,7 +106,7 @@ When an `HttpError` is thrown, Fresh catches it and invokes the error handler.
|
||||
You can check the status code in your error handler:
|
||||
|
||||
```ts
|
||||
import { HttpError } from "fresh";
|
||||
import { HttpError } from "sweet";
|
||||
|
||||
app.onError("*", (ctx) => {
|
||||
if (ctx.error instanceof HttpError) {
|
||||
|
||||
@@ -44,7 +44,7 @@ For more complex scenarios, or to set page metadata from
|
||||
[islands](/docs/concepts/islands), Fresh ships with the `<Head>`-component.
|
||||
|
||||
```tsx routes/about.tsx
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export default define.page((ctx) => {
|
||||
return (
|
||||
@@ -66,7 +66,7 @@ component state changes, the document head is updated automatically:
|
||||
|
||||
```tsx islands/MetaUpdater.tsx
|
||||
import { useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export default function MetaUpdater() {
|
||||
const [title, setTitle] = useState("Welcome");
|
||||
|
||||
@@ -19,7 +19,7 @@ The quickest way to get started is to enable partials for every page in
|
||||
|
||||
```diff routes/_app.tsx
|
||||
import { define } from "../utils.ts";
|
||||
+ import { Partial } from "fresh/runtime";
|
||||
+ import { Partial } from "sweet/runtime";
|
||||
|
||||
export default define.page(function App({ Component }) {
|
||||
return (
|
||||
@@ -105,7 +105,7 @@ the sidebar might look like this respectively.
|
||||
|
||||
```tsx routes/partials/docs/[id].tsx
|
||||
import { define } from "../utils.ts";
|
||||
import { Partial } from "fresh/runtime";
|
||||
import { Partial } from "sweet/runtime";
|
||||
|
||||
// We only want to render the content, so disable
|
||||
// the `_app.tsx` template as well as any potentially
|
||||
|
||||
@@ -32,9 +32,9 @@ command.
|
||||
## Update Fresh
|
||||
|
||||
The easiest way to resolve most issues is to ensure that you're on the
|
||||
[latest version](https://jsr.io/@fresh/core/versions) of Fresh. We continuously
|
||||
work on Fresh and there is a good chance that the issue you're running into has
|
||||
already been resolved in the latest version of Fresh.
|
||||
[latest version](https://jsr.io/@paulaboks/sweet/versions) of Fresh. We
|
||||
continuously work on Fresh and there is a good chance that the issue you're
|
||||
running into has already been resolved in the latest version of Fresh.
|
||||
|
||||
## Don't use esm.sh
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ The Fresh Vite plugin can be configured in `vite.config.ts`:
|
||||
|
||||
```ts vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -49,7 +49,7 @@ generally come first:
|
||||
|
||||
```ts vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
|
||||
export default defineConfig({
|
||||
@@ -109,10 +109,10 @@ types so HMR and asset imports type-check:
|
||||
"start": "deno serve -A _fresh/server.js"
|
||||
},
|
||||
"imports": {
|
||||
"fresh": "jsr:@fresh/core@^2",
|
||||
"sweet": "jsr:@paulaboks/sweet@^2",
|
||||
"preact": "npm:preact@^10",
|
||||
"@preact/signals": "npm:@preact/signals@^2",
|
||||
+ "@fresh/plugin-vite": "jsr:@fresh/plugin-vite@^1",
|
||||
+ "@paulaboks/sweet-vite": "jsr:@paulaboks/sweet-vite@^1",
|
||||
+ "vite": "npm:vite@^7",
|
||||
+ "@types/babel__core": "npm:@types/babel__core@^7"
|
||||
},
|
||||
@@ -124,7 +124,7 @@ types so HMR and asset imports type-check:
|
||||
}
|
||||
```
|
||||
|
||||
If you were using `@fresh/plugin-tailwind` / `@fresh/plugin-tailwindcss-v3`,
|
||||
If you were using `@paulaboks/sweet-tailwind` / `@fresh/plugin-tailwindcss-v3`,
|
||||
remove those imports — Vite has a first-party Tailwind plugin (see step 4).
|
||||
|
||||
### 2. Replace `dev.ts` with `vite.config.ts`
|
||||
@@ -133,7 +133,7 @@ Delete `dev.ts` and create a `vite.config.ts` at the project root:
|
||||
|
||||
```ts vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [fresh()],
|
||||
@@ -188,7 +188,7 @@ Replace the Builder-side Tailwind plugin with the official Vite plugin:
|
||||
|
||||
```diff deno.json
|
||||
"imports": {
|
||||
- "@fresh/plugin-tailwind": "jsr:@fresh/plugin-tailwind@^1",
|
||||
- "@paulaboks/sweet-tailwind": "jsr:@paulaboks/sweet-tailwind@^1",
|
||||
- "@tailwindcss/postcss": "npm:@tailwindcss/postcss@^4",
|
||||
- "postcss": "npm:postcss@^8",
|
||||
+ "@tailwindcss/vite": "npm:@tailwindcss/vite@^4",
|
||||
@@ -198,7 +198,7 @@ Replace the Builder-side Tailwind plugin with the official Vite plugin:
|
||||
|
||||
```ts vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
|
||||
export default defineConfig({
|
||||
@@ -229,13 +229,13 @@ change.
|
||||
- [ ] `client.ts` created and imports your CSS
|
||||
- [ ] Stylesheet moved out of `static/` and the `<link>` removed from `_app.tsx`
|
||||
- [ ] `deno.json` tasks point at `vite` / `vite build`
|
||||
- [ ] `@fresh/plugin-vite`, `vite`, and `@types/babel__core` in `imports`
|
||||
- [ ] `@paulaboks/sweet-vite`, `vite`, and `@types/babel__core` in `imports`
|
||||
- [ ] `"vite/client"` in `compilerOptions.types`
|
||||
- [ ] Tailwind (if used) switched to `@tailwindcss/vite`
|
||||
|
||||
> [info]: If you get stuck, run `deno run -Ar jsr:@fresh/init` in a scratch
|
||||
> directory and diff the generated project against yours — the generator is the
|
||||
> source of truth for a working Vite-based Fresh setup.
|
||||
> [info]: If you get stuck, run `deno run -Ar jsr:@paulaboks/sweet-init` in a
|
||||
> scratch directory and diff the generated project against yours — the generator
|
||||
> is the source of truth for a working Vite-based Fresh setup.
|
||||
|
||||
## Debugging
|
||||
|
||||
@@ -250,7 +250,7 @@ To inspect plugin transformations, use
|
||||
|
||||
```ts vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
import inspect from "vite-plugin-inspect";
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
@@ -29,7 +29,7 @@ There are two main approaches depending on your use case.
|
||||
The simplest way to add a WebSocket endpoint:
|
||||
|
||||
```ts main.ts
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.ws("/ws", {
|
||||
|
||||
@@ -13,7 +13,7 @@ A handler fetches data and returns it with `page()`. The page component receives
|
||||
it in `props.data`:
|
||||
|
||||
```tsx routes/projects/[id].tsx
|
||||
import { HttpError, page } from "fresh";
|
||||
import { HttpError, page } from "sweet";
|
||||
import { define } from "@/utils.ts";
|
||||
|
||||
interface Data {
|
||||
@@ -60,7 +60,7 @@ For simpler cases, you can fetch data directly in an async component without a
|
||||
separate handler:
|
||||
|
||||
```tsx routes/projects/[id].tsx
|
||||
import { HttpError } from "fresh";
|
||||
import { HttpError } from "sweet";
|
||||
import { define } from "@/utils.ts";
|
||||
|
||||
export default define.page(async (ctx) => {
|
||||
@@ -97,7 +97,7 @@ export default define.middleware(async (ctx) => {
|
||||
```
|
||||
|
||||
```tsx routes/dashboard.tsx
|
||||
import { page } from "fresh";
|
||||
import { page } from "sweet";
|
||||
import { define } from "@/utils.ts";
|
||||
|
||||
export const handler = define.handlers({
|
||||
|
||||
@@ -11,7 +11,7 @@ in `vite.config.ts`). When you add a new file there, it will register a new
|
||||
route automatically.
|
||||
|
||||
```ts main.ts
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { App, staticFiles } from "sweet";
|
||||
|
||||
const app = new App({ basePath: "/foo" })
|
||||
.use(staticFiles())
|
||||
@@ -85,7 +85,7 @@ A custom [URL pattern][urlpattern] can be specified in the route configuration.
|
||||
This pattern will be used instead of the file path based pattern:
|
||||
|
||||
```ts routes/my-route.ts
|
||||
import { RouteConfig } from "fresh";
|
||||
import { RouteConfig } from "sweet";
|
||||
|
||||
export const config: RouteConfig = {
|
||||
routeOverride: "/x/:module@:version/:path*",
|
||||
|
||||
@@ -29,7 +29,7 @@ An island can be used anywhere like a regular Preact component. Fresh will take
|
||||
care of making it interactive on the client.
|
||||
|
||||
```tsx main.tsx
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import MyIsland from "./islands/my-island.tsx";
|
||||
|
||||
const app = new App()
|
||||
@@ -77,7 +77,7 @@ A powerful feature of Fresh is that you can pass server-rendered JSX to an
|
||||
island via props.
|
||||
|
||||
```tsx routes/index.tsx
|
||||
import { staticFiles } from "fresh";
|
||||
import { staticFiles } from "sweet";
|
||||
import MyIsland from "../islands/my-island.tsx";
|
||||
|
||||
const app = new App()
|
||||
@@ -126,7 +126,7 @@ constant from `fresh/runtime` to guard browser-only code. It is `false` on the
|
||||
server and `true` in the browser:
|
||||
|
||||
```tsx islands/my-island.tsx
|
||||
import { IS_BROWSER } from "fresh/runtime";
|
||||
import { IS_BROWSER } from "sweet/runtime";
|
||||
|
||||
export function MyIsland() {
|
||||
// Return any prerenderable JSX here which makes sense for your island
|
||||
@@ -150,7 +150,7 @@ Use an island to register and render custom elements:
|
||||
|
||||
```tsx islands/MyElement.tsx
|
||||
import { useEffect } from "preact/hooks";
|
||||
import { IS_BROWSER } from "fresh/runtime";
|
||||
import { IS_BROWSER } from "sweet/runtime";
|
||||
|
||||
export function MyElement() {
|
||||
useEffect(() => {
|
||||
@@ -182,7 +182,7 @@ inside an island:
|
||||
|
||||
```tsx islands/ThirdPartyElement.tsx
|
||||
import { useEffect } from "preact/hooks";
|
||||
import { IS_BROWSER } from "fresh/runtime";
|
||||
import { IS_BROWSER } from "sweet/runtime";
|
||||
|
||||
export function ShoelaceButton() {
|
||||
useEffect(() => {
|
||||
|
||||
@@ -103,7 +103,7 @@ full-screen dashboard, or a print view. Use `skipInheritedLayouts` in the route
|
||||
config to skip all layouts inherited from parent directories:
|
||||
|
||||
```tsx routes/login.tsx
|
||||
import { type RouteConfig } from "fresh";
|
||||
import { type RouteConfig } from "sweet";
|
||||
import { define } from "../utils.ts";
|
||||
|
||||
export const config: RouteConfig = {
|
||||
@@ -128,7 +128,7 @@ You can also skip inherited layouts from within a layout file itself. This is
|
||||
useful when a section of your site needs a completely different shell:
|
||||
|
||||
```tsx routes/admin/_layout.tsx
|
||||
import { type LayoutConfig } from "fresh";
|
||||
import { type LayoutConfig } from "sweet";
|
||||
import { define } from "../../utils.ts";
|
||||
|
||||
export const config: LayoutConfig = {
|
||||
|
||||
@@ -7,7 +7,7 @@ Routing defines which middlewares and routes should respond to a particular
|
||||
request.
|
||||
|
||||
```ts main.ts
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.get("/", () => new Response("hello")) // Responds to: GET /
|
||||
|
||||
@@ -10,7 +10,7 @@ disk for optimal performance with
|
||||
headers.
|
||||
|
||||
```ts main.ts
|
||||
import { staticFiles } from "fresh";
|
||||
import { staticFiles } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(staticFiles());
|
||||
@@ -55,7 +55,7 @@ first directory in the array takes precedence.
|
||||
|
||||
```ts vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -99,7 +99,7 @@ Use the `asset()` function to add caching headers manually. It will be served
|
||||
with a cache lifetime of one year.
|
||||
|
||||
```tsx routes/about.tsx
|
||||
import { asset } from "fresh/runtime";
|
||||
import { asset } from "sweet/runtime";
|
||||
|
||||
export default function About() {
|
||||
// Adding caching headers manually
|
||||
@@ -110,7 +110,7 @@ export default function About() {
|
||||
For `<img>` tags with a `srcset` attribute, use `assetSrcSet()`:
|
||||
|
||||
```tsx routes/gallery.tsx
|
||||
import { assetSrcSet } from "fresh/runtime";
|
||||
import { assetSrcSet } from "sweet/runtime";
|
||||
|
||||
export default function Gallery() {
|
||||
return (
|
||||
@@ -139,7 +139,7 @@ deno add -D npm:vite-imagetools
|
||||
|
||||
```ts vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
import { imagetools } from "vite-imagetools";
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
@@ -7,8 +7,9 @@ description: |
|
||||
|
||||
Fresh is organized as a monorepo with multiple packages:
|
||||
|
||||
- **`packages/fresh/`** - Core Fresh framework (`@fresh/core`)
|
||||
- **`packages/plugin-vite/`** - Vite integration plugin (`@fresh/plugin-vite`)
|
||||
- **`packages/fresh/`** - Core Fresh framework (`@paulaboks/sweet`)
|
||||
- **`packages/plugin-vite/`** - Vite integration plugin
|
||||
(`@paulaboks/sweet-vite`)
|
||||
- **`packages/plugin-tailwindcss/`** - Tailwind CSS v4 plugin
|
||||
- **`packages/plugin-tailwindcss-v3/`** - Tailwind CSS v3 plugin
|
||||
- **`packages/init/`** - Project scaffolding tool
|
||||
@@ -31,7 +32,7 @@ Run it before submitting any pull request.
|
||||
The repository uses Deno
|
||||
[workspaces](https://docs.deno.com/runtime/fundamentals/workspaces/) so all
|
||||
packages in `packages/` are automatically available to each other using their
|
||||
published names (`@fresh/core`, `@fresh/plugin-vite`, etc.).
|
||||
published names (`@paulaboks/sweet`, `@paulaboks/sweet-vite`, etc.).
|
||||
|
||||
## Development
|
||||
|
||||
@@ -56,8 +57,8 @@ the project's `deno.json`:
|
||||
```json deno.json
|
||||
{
|
||||
"imports": {
|
||||
"@fresh/core": "jsr:@fresh/core@^2.0.0",
|
||||
"@fresh/plugin-vite": "jsr:@fresh/plugin-vite@^1.0.0"
|
||||
"@paulaboks/sweet": "jsr:@paulaboks/sweet@^2.0.0",
|
||||
"@paulaboks/sweet-vite": "jsr:@paulaboks/sweet-vite@^1.0.0"
|
||||
},
|
||||
"links": [
|
||||
"../path/to/fresh/packages/fresh",
|
||||
|
||||
@@ -10,7 +10,7 @@ Deploy Fresh to Cloudflare Workers by following these instructions:
|
||||
|
||||
```diff vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
+ import { cloudflare } from "@cloudflare/vite-plugin";
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
@@ -55,7 +55,7 @@ export default define.middleware((ctx) => {
|
||||
Return different formats based on the `Accept` header:
|
||||
|
||||
```ts routes/api/users/[id].ts
|
||||
import { HttpError } from "fresh";
|
||||
import { HttpError } from "sweet";
|
||||
import { define } from "@/utils.ts";
|
||||
|
||||
export const handler = define.handlers({
|
||||
@@ -110,7 +110,7 @@ session example.
|
||||
Access URL search params from the context:
|
||||
|
||||
```ts routes/search.tsx
|
||||
import { page } from "fresh";
|
||||
import { page } from "sweet";
|
||||
import { define } from "@/utils.ts";
|
||||
|
||||
export const handler = define.handlers({
|
||||
@@ -141,7 +141,7 @@ export default define.middleware(async (ctx) => {
|
||||
Or set headers on a specific route using `page()`:
|
||||
|
||||
```ts
|
||||
import { page } from "fresh";
|
||||
import { page } from "sweet";
|
||||
|
||||
return page(data, {
|
||||
headers: { "Cache-Control": "public, max-age=3600" },
|
||||
|
||||
@@ -9,7 +9,7 @@ Let's set up your first Fresh project. To create a new project, run this
|
||||
command:
|
||||
|
||||
```sh Terminal
|
||||
deno run -Ar jsr:@fresh/init
|
||||
deno run -Ar jsr:@paulaboks/sweet-init
|
||||
```
|
||||
|
||||
This will spawn a short wizard that guides you through the setup, like the
|
||||
|
||||
@@ -10,7 +10,7 @@ Standards. It's designed for building high-quality, performant, and personalized
|
||||
web applications.
|
||||
|
||||
```tsx main.ts
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.get("/", () => new Response("hello world"))
|
||||
@@ -24,7 +24,7 @@ app.listen();
|
||||
Create a new Fresh app by running:
|
||||
|
||||
```sh Terminal
|
||||
deno run -Ar jsr:@fresh/init
|
||||
deno run -Ar jsr:@paulaboks/sweet-init
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
@@ -50,7 +50,7 @@ Fresh configuration to the [fresh vite plugin](/docs/advanced/vite).
|
||||
|
||||
```ts vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";
|
||||
import { fresh } from "@paulaboks/sweet-vite";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
|
||||
export default defineConfig({
|
||||
@@ -86,7 +86,7 @@ Similarly, configuration related to running Fresh in production can be passed to
|
||||
`new App()`:
|
||||
|
||||
```ts main.ts
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { App, staticFiles } from "sweet";
|
||||
|
||||
export const app = new App()
|
||||
// Add static file serving middleware
|
||||
@@ -158,11 +158,11 @@ accordingly.
|
||||
|
||||
## Update imports
|
||||
|
||||
Add `jsr:@fresh/plugin-vite` and `npm:vite` to `imports` in your `deno.json`
|
||||
Add `jsr:@paulaboks/sweet-vite` and `npm:vite` to `imports` in your `deno.json`
|
||||
file, either manually or with this command:
|
||||
|
||||
```shell
|
||||
deno install npm:vite jsr:@fresh/plugin-vite
|
||||
deno install npm:vite jsr:@paulaboks/sweet-vite
|
||||
```
|
||||
|
||||
This should be enough in most cases. If you still encounter problems, you may
|
||||
@@ -188,8 +188,8 @@ you can add if needed. This middleware can be used to ensure that URLs always
|
||||
have a trailing slash at the end or that they will never have one.
|
||||
|
||||
```diff main.ts
|
||||
- import { App, staticFiles } from "fresh";
|
||||
+ import { App, staticFiles, trailingSlashes } from "fresh";
|
||||
- import { App, staticFiles } from "sweet";
|
||||
+ import { App, staticFiles, trailingSlashes } from "sweet";
|
||||
|
||||
export const app = new App({ root: import.meta.url })
|
||||
.use(staticFiles())
|
||||
@@ -314,7 +314,8 @@ to [update the command](/docs/deployment/deno-compile) to generate the binary.
|
||||
If you run into problems with upgrading your app, first, try starting a new
|
||||
Fresh 2 project and looking at the new structure.
|
||||
|
||||
eg. `mkdir fresh2-demo && cd fresh2-demo && deno run -Ar jsr:@fresh/init`
|
||||
eg.
|
||||
`mkdir fresh2-demo && cd fresh2-demo && deno run -Ar jsr:@paulaboks/sweet-init`
|
||||
|
||||
### 2. Document
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ to HTTP requests. These allow the server to indicate which origins (domains,
|
||||
scheme or port) other than its own is permitted to load resources from.
|
||||
|
||||
```ts main.ts
|
||||
import { cors } from "fresh";
|
||||
import { cors } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(cors({
|
||||
@@ -24,5 +24,5 @@ const app = new App()
|
||||
|
||||
## Options
|
||||
|
||||
See the [API docs](https://jsr.io/@fresh/core/doc/~/cors) for a list of all
|
||||
See the [API docs](https://jsr.io/@paulaboks/sweet/doc/~/cors) for a list of all
|
||||
supported options
|
||||
|
||||
@@ -7,7 +7,7 @@ The `csp()` middleware can be used to add
|
||||
to HTTP requests. These restrict which resources a document is allowed to load.
|
||||
|
||||
```ts main.ts
|
||||
import { csp } from "fresh";
|
||||
import { csp } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(csp({
|
||||
@@ -32,7 +32,7 @@ This ensures only inline `<script>` and `<style>` tags rendered by Fresh are
|
||||
allowed to execute.
|
||||
|
||||
```ts main.ts
|
||||
import { csp } from "fresh";
|
||||
import { csp } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(csp({ useNonce: true }))
|
||||
@@ -70,5 +70,5 @@ When `useNonce` is enabled:
|
||||
|
||||
## Options
|
||||
|
||||
See the [API docs](https://jsr.io/@fresh/core/doc/~/csp) for a list of all
|
||||
See the [API docs](https://jsr.io/@paulaboks/sweet/doc/~/csp) for a list of all
|
||||
supported options.
|
||||
|
||||
@@ -12,7 +12,7 @@ and
|
||||
headers. Requests from untrusted origins are rejected.
|
||||
|
||||
```ts main.ts
|
||||
import { App, csrf } from "fresh";
|
||||
import { App, csrf } from "sweet";
|
||||
|
||||
const app = new App();
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ Since Fresh plugins are just middlewares and route handlers, creating a reusable
|
||||
plugin is as simple as exporting a function that returns a middleware:
|
||||
|
||||
```ts plugins/request-id.ts
|
||||
import type { MiddlewareFn } from "fresh";
|
||||
import type { MiddlewareFn } from "sweet";
|
||||
|
||||
export function requestId(): MiddlewareFn<{ requestId: string }> {
|
||||
return async (ctx) => {
|
||||
@@ -41,7 +41,7 @@ export function requestId(): MiddlewareFn<{ requestId: string }> {
|
||||
```
|
||||
|
||||
```ts main.ts
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import { requestId } from "./plugins/request-id.ts";
|
||||
|
||||
const app = new App()
|
||||
|
||||
@@ -7,7 +7,7 @@ It supports deny lists, allow lists, and CIDR subnet matching. Deny rules always
|
||||
take precedence over allow rules.
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
@@ -23,7 +23,7 @@ Block specific IPs or subnets. Any request from a matching address receives a
|
||||
403 Forbidden response:
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
@@ -37,7 +37,7 @@ When an allow list is provided, only matching IPs are permitted. All other
|
||||
addresses are blocked:
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
@@ -51,7 +51,7 @@ When both lists are provided, deny rules are checked first. An IP that appears
|
||||
in both lists is blocked:
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
@@ -68,7 +68,7 @@ By default, blocked requests receive a `403 Forbidden` response. Use the
|
||||
`onBlocked` callback to customize this:
|
||||
|
||||
```ts main.ts
|
||||
import { App, ipFilter } from "fresh";
|
||||
import { App, ipFilter } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(ipFilter({
|
||||
|
||||
@@ -7,7 +7,7 @@ end with a slash character or will never end with one. It redirects the user's
|
||||
request respectively.
|
||||
|
||||
```ts main.ts
|
||||
import { trailingSlashes } from "fresh";
|
||||
import { trailingSlashes } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(trailingSlashes("never"))
|
||||
@@ -17,7 +17,7 @@ const app = new App()
|
||||
Always append a trailing slash:
|
||||
|
||||
```ts main.ts
|
||||
import { trailingSlashes } from "fresh";
|
||||
import { trailingSlashes } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.use(trailingSlashes("always"))
|
||||
|
||||
@@ -16,7 +16,7 @@ test assumes the `State` object in `utils.ts` has `text` property.
|
||||
|
||||
```ts tests/middleware.test.ts
|
||||
import { expect } from "@std/expect";
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { define, type State } from "../utils.ts";
|
||||
|
||||
const middleware = define.middleware((ctx) => {
|
||||
@@ -49,7 +49,7 @@ Both the [app wrapper](/docs/advanced/app-wrapper) component and
|
||||
|
||||
```tsx tests/appWrapper.test.tsx
|
||||
import { expect } from "@std/expect";
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { define, type State } from "../utils.ts";
|
||||
|
||||
const AppWrapper = define.layout(function AppWrapper({ Component }) {
|
||||
@@ -84,7 +84,7 @@ Same can be done for layouts.
|
||||
|
||||
```tsx tests/layout.test.tsx
|
||||
import { expect } from "@std/expect";
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { define, type State } from "../utils.ts";
|
||||
|
||||
const MyLayout = define.layout(function MyLayout({ Component }) {
|
||||
@@ -119,7 +119,7 @@ handler:
|
||||
|
||||
```ts tests/routes.test.ts
|
||||
import { expect } from "@std/expect";
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { type State } from "../utils.ts";
|
||||
|
||||
// Import actual route handlers
|
||||
@@ -150,7 +150,7 @@ to use JSX:
|
||||
|
||||
```tsx tests/island-ssr.test.tsx
|
||||
import { expect } from "@std/expect";
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { useSignal } from "@preact/signals";
|
||||
import { type State } from "../utils.ts";
|
||||
import Counter from "../islands/Counter.tsx";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/build-id",
|
||||
"name": "@paulaboks/sweet-build-id",
|
||||
"version": "1.0.1",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
|
||||
@@ -8,9 +8,9 @@ Learn more about the Fresh framework here:
|
||||
## Usage: Island example
|
||||
|
||||
```tsx
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
// Import the island function
|
||||
import { DemoIsland } from "jsr:@fresh/examples/island";
|
||||
import { DemoIsland } from "jsr:@paulaboks/sweet-examples/island";
|
||||
|
||||
export const app = new App({ root: import.meta.url })
|
||||
.use(staticFiles());
|
||||
@@ -24,10 +24,10 @@ await app.listen();
|
||||
## Usage: App1 or App2 example
|
||||
|
||||
```tsx
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
// Import the example apps
|
||||
import { app1 } from "jsr:@fresh/examples/app1";
|
||||
import { app2 } from "jsr:@fresh/examples/app2";
|
||||
import { app1 } from "jsr:@paulaboks/sweet-examples/app1";
|
||||
import { app2 } from "jsr:@paulaboks/sweet-examples/app2";
|
||||
|
||||
export const app = new App({ root: import.meta.url })
|
||||
.use(staticFiles());
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "@fresh/examples",
|
||||
"name": "@paulaboks/sweet-examples",
|
||||
"version": "1.0.1",
|
||||
"license": "MIT",
|
||||
"imports": {
|
||||
"fresh": "jsr:@fresh/core@^2.0.0",
|
||||
"sweet": "jsr:@paulaboks/sweet@^2.0.0",
|
||||
"preact": "npm:preact@^10.27.0",
|
||||
"@preact/signals": "npm:@preact/signals@^2.2.1"
|
||||
},
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @module
|
||||
*/
|
||||
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { Doc } from "./shared.tsx";
|
||||
|
||||
/** App that renders a sample HTML document */
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @module
|
||||
*/
|
||||
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { Doc } from "./shared.tsx";
|
||||
|
||||
/** App that renders a sample HTML document */
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
*
|
||||
* @example
|
||||
* ```tsx
|
||||
* import { App } from "fresh";
|
||||
* import { DemoIsland } from "jsr:@fresh/examples/island";
|
||||
* import { App } from "sweet";
|
||||
* import { DemoIsland } from "jsr:@paulaboks/sweet-examples/island";
|
||||
*
|
||||
* const app = new App();
|
||||
*
|
||||
|
||||
@@ -8,17 +8,17 @@ web applications.
|
||||
|
||||
## Usage
|
||||
|
||||
Generate a new Fresh project with `@fresh/init`:
|
||||
Generate a new Fresh project with `@paulaboks/sweet-init`:
|
||||
|
||||
```sh
|
||||
deno run -Ar jsr:@fresh/init
|
||||
deno run -Ar jsr:@paulaboks/sweet-init
|
||||
```
|
||||
|
||||
Add middleware, routes, & endpoints as needed via the `routes/` folder or
|
||||
directly on the `App` instance.
|
||||
|
||||
```tsx
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
|
||||
const app = new App()
|
||||
.get("/", () => new Response("hello world"))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/core",
|
||||
"name": "@paulaboks/sweet",
|
||||
"version": "2.3.3",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { trace } from "@opentelemetry/api";
|
||||
|
||||
import { DENO_DEPLOYMENT_ID } from "@fresh/build-id";
|
||||
import { DENO_DEPLOYMENT_ID } from "@paulaboks/sweet-build-id";
|
||||
import * as colors from "@std/fmt/colors";
|
||||
import type { MaybeLazyMiddleware, Middleware } from "./middlewares/mod.ts";
|
||||
import {
|
||||
@@ -100,7 +100,7 @@ export function createOnListen(
|
||||
console.log();
|
||||
// deno-lint-ignore no-console
|
||||
console.log(
|
||||
colors.bgRgb8(colors.rgb8(" 🍋 Fresh ready ", 0), 121),
|
||||
colors.bgRgb8(colors.rgb8(" 🍬 Sweet ready ", 0), 121),
|
||||
);
|
||||
const sep = options.remoteAddress ? "" : "\n";
|
||||
const space = options.remoteAddress ? " " : "";
|
||||
|
||||
@@ -4,7 +4,7 @@ import { fsItemsToCommands, type FsRouteFile } from "./fs_routes.ts";
|
||||
import type { ServerIslandRegistry } from "./context.ts";
|
||||
import type { AnyComponent } from "preact";
|
||||
import { UniqueNamer } from "./utils.ts";
|
||||
import { setBuildId } from "@fresh/build-id";
|
||||
import { setBuildId } from "@paulaboks/sweet-build-id";
|
||||
|
||||
export interface FileSnapshot {
|
||||
name: string;
|
||||
|
||||
@@ -59,7 +59,7 @@ export interface WebSocketUpgradeOptions {
|
||||
}
|
||||
|
||||
/**
|
||||
* Side channel used by `@fresh/plugin-vite` (and any other adapter sitting on
|
||||
* Side channel used by `@paulaboks/sweet-vite` (and any other adapter sitting on
|
||||
* top of `node:http`) to hand a raw socket + buffered head to `ctx.upgrade()`.
|
||||
* `Deno.upgradeWebSocket()` normally pulls these off the request handled by
|
||||
* `Deno.serve`, but a request synthesized from `node:http` carries neither, so
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { expect } from "@std/expect";
|
||||
import { Context } from "./context.ts";
|
||||
import { App } from "fresh";
|
||||
import { asset } from "fresh/runtime";
|
||||
import { App } from "sweet";
|
||||
import { asset } from "sweet/runtime";
|
||||
import { FakeServer } from "./test_utils.ts";
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
import { parseHtml } from "../tests/test_utils.tsx";
|
||||
|
||||
Deno.test("FreshReqContext.prototype.redirect", () => {
|
||||
|
||||
@@ -34,7 +34,7 @@ export interface Define<State> {
|
||||
* returned from the handler is of the correct type:
|
||||
*
|
||||
* ```ts
|
||||
* import { page } from "fresh";
|
||||
* import { page } from "sweet";
|
||||
* import { define } from "../utils.ts";
|
||||
*
|
||||
* export const handler = define.handlers<{ slug: string }>({
|
||||
@@ -80,7 +80,7 @@ export interface Define<State> {
|
||||
* return type of the handler method.
|
||||
*
|
||||
* ```ts
|
||||
* import { page } from "fresh";
|
||||
* import { page } from "sweet";
|
||||
* import { define } from "../utils.ts";
|
||||
*
|
||||
* export const handler = define.handlers({
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
type FsRoute,
|
||||
MemoryBuildCache,
|
||||
} from "./dev_build_cache.ts";
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
import { updateCheck } from "./update_check.ts";
|
||||
import { devErrorOverlay } from "./middlewares/error_overlay/middleware.tsx";
|
||||
import { automaticWorkspaceFolders } from "./middlewares/automatic_workspace_folders.ts";
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as path from "@std/path";
|
||||
import { Builder, specToName } from "./builder.ts";
|
||||
import { App } from "../app.ts";
|
||||
import { DEV_ERROR_OVERLAY_URL } from "../constants.ts";
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
import { integrationTest, withTmpDir, writeFiles } from "../test_utils.ts";
|
||||
import {
|
||||
getStdOutput,
|
||||
@@ -285,7 +285,7 @@ integrationTest("Builder - write prod routePattern", async () => {
|
||||
|
||||
await writeFiles(tmp, {
|
||||
"routes/foo/index.ts": `export const handler = () => new Response("ok")`,
|
||||
"main.ts": `import { App } from "fresh";
|
||||
"main.ts": `import { App } from "sweet";
|
||||
export const app = new App().fsRoutes()`,
|
||||
});
|
||||
|
||||
@@ -317,7 +317,7 @@ integrationTest("Builder - file:// islands", async () => {
|
||||
"other/Foo.tsx": `export default () => <h1>ok</h1>;`,
|
||||
"routes/index.tsx": `import Foo from "../other/Foo.tsx";
|
||||
export default () => <Foo />;`,
|
||||
"main.ts": `import { App } from "fresh";
|
||||
"main.ts": `import { App } from "sweet";
|
||||
export const app = new App().fsRoutes()`,
|
||||
});
|
||||
|
||||
@@ -470,7 +470,7 @@ integrationTest(
|
||||
const tmp = _tmp.dir;
|
||||
|
||||
await writeFiles(tmp, {
|
||||
"main.ts": `import { App, staticFiles } from "fresh";
|
||||
"main.ts": `import { App, staticFiles } from "sweet";
|
||||
export const app = new App()
|
||||
.use(staticFiles());`,
|
||||
"static/foo.txt": "ok",
|
||||
@@ -559,7 +559,7 @@ integrationTest(
|
||||
const tmp = _tmp.dir;
|
||||
|
||||
await writeFiles(tmp, {
|
||||
"main.ts": `import { App, staticFiles } from "fresh";
|
||||
"main.ts": `import { App, staticFiles } from "sweet";
|
||||
export const app = new App()
|
||||
.use(staticFiles());`,
|
||||
"static_a/a.txt": "from a",
|
||||
@@ -598,7 +598,7 @@ integrationTest("Builder - custom server entry", async () => {
|
||||
const tmp = _tmp.dir;
|
||||
|
||||
await writeFiles(tmp, {
|
||||
"other.ts": `import { App, staticFiles } from "fresh";
|
||||
"other.ts": `import { App, staticFiles } from "sweet";
|
||||
export const app = new App()
|
||||
.get("/", () => new Response("ok"));`,
|
||||
});
|
||||
@@ -666,7 +666,7 @@ integrationTest({
|
||||
"other/Foo.tsx": `export default () => <h1>ok</h1>;`,
|
||||
"routes/index.tsx": `import Foo from "foo-island";
|
||||
export default () => <Foo />;`,
|
||||
"main.ts": `import { App } from "fresh";
|
||||
"main.ts": `import { App } from "sweet";
|
||||
export const app = new App().fsRoutes()`,
|
||||
"deno.json": JSON.stringify({
|
||||
imports: { "foo-island": "other/Foo.tsx" },
|
||||
@@ -702,7 +702,7 @@ integrationTest("Builder - source maps", async () => {
|
||||
await writeFiles(tmp, {
|
||||
"islands/Foo.tsx": `export const Foo = () => <h1>hello</h1>`,
|
||||
"routes/index.ts": `export const handler = () => new Response("ok")`,
|
||||
"main.ts": `import { App } from "fresh";
|
||||
"main.ts": `import { App } from "sweet";
|
||||
export const app = new App().fsRoutes()`,
|
||||
});
|
||||
|
||||
@@ -761,7 +761,7 @@ integrationTest("Builder - compile entry", async () => {
|
||||
jsxImportSource: "preact",
|
||||
},
|
||||
imports: {
|
||||
"fresh": "jsr:@fresh/core@*",
|
||||
"sweet": "jsr:@paulaboks/sweet@*",
|
||||
"preact": "npm:preact@*",
|
||||
"@preact/signals": "npm:@preact/signals@*",
|
||||
},
|
||||
@@ -769,7 +769,7 @@ integrationTest("Builder - compile entry", async () => {
|
||||
"islands/Foo.tsx": `export const Foo = () => <h1>hello</h1>`,
|
||||
"routes/index.ts": `export const handler = () => new Response("ok")`,
|
||||
"static/foo.txt": "ok",
|
||||
"main.ts": `import { App, staticFiles } from "fresh";
|
||||
"main.ts": `import { App, staticFiles } from "sweet";
|
||||
export const app = new App()
|
||||
.use(staticFiles())
|
||||
.fsRoutes();`,
|
||||
@@ -835,7 +835,7 @@ integrationTest("Builder - island that imports json entry", async () => {
|
||||
jsxImportSource: "preact",
|
||||
},
|
||||
imports: {
|
||||
"fresh": "jsr:@fresh/core@*",
|
||||
"sweet": "jsr:@paulaboks/sweet@*",
|
||||
"preact": "npm:preact@*",
|
||||
"@preact/signals": "npm:@preact/signals@*",
|
||||
"mime-db": "npm:mime-db@*",
|
||||
@@ -847,7 +847,7 @@ export const Foo = () => {
|
||||
return <h1>ok</h1>
|
||||
}`,
|
||||
"routes/index.ts": `export default () => <Foo />`,
|
||||
"main.ts": `import { App, staticFiles } from "fresh";
|
||||
"main.ts": `import { App, staticFiles } from "sweet";
|
||||
export const app = new App()
|
||||
.use(staticFiles())
|
||||
.fsRoutes();`,
|
||||
@@ -943,7 +943,7 @@ export default function Map() {
|
||||
}`,
|
||||
"routes/index.tsx": `import Map from "../islands/Map.tsx";
|
||||
export default () => <Map />;`,
|
||||
"main.ts": `import { App } from "fresh";
|
||||
"main.ts": `import { App } from "sweet";
|
||||
export const app = new App().fsRoutes();`,
|
||||
});
|
||||
|
||||
|
||||
@@ -530,7 +530,7 @@ export async function generateSnapshotServer(
|
||||
: "";
|
||||
|
||||
return `${EDIT_WARNING}
|
||||
import { IslandPreparer } from "fresh/internal";
|
||||
import { IslandPreparer } from "sweet/internal";
|
||||
${islandImports}
|
||||
${fsRouteImports}
|
||||
|
||||
@@ -615,7 +615,7 @@ export function generateServerEntry(
|
||||
}
|
||||
|
||||
return `${EDIT_WARNING}
|
||||
import { setBuildCache, ProdBuildCache, path } from "fresh/internal";
|
||||
import { setBuildCache, ProdBuildCache, path } from "sweet/internal";
|
||||
import * as snapshot from "${snapshotSpecifier}";
|
||||
import { app } from "${serverEntry}";
|
||||
|
||||
|
||||
@@ -170,12 +170,15 @@ function buildIdPlugin(buildId: string): EsbuildPlugin {
|
||||
return {
|
||||
name: "fresh-build-id",
|
||||
setup(build) {
|
||||
build.onResolve({ filter: /^(jsr:)?@fresh\/build-id/ }, (args) => {
|
||||
build.onResolve(
|
||||
{ filter: /^(jsr:)?@paulaboks\/sweet-build-id/ },
|
||||
(args) => {
|
||||
return {
|
||||
path: args.path,
|
||||
namespace: "fresh-internal-build-id",
|
||||
};
|
||||
});
|
||||
},
|
||||
);
|
||||
build.onLoad({
|
||||
filter: /.*/,
|
||||
namespace: "fresh-internal-build-id",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { globToRegExp, isGlob } from "@std/path";
|
||||
import type { FsAdapter } from "../fs.ts";
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
import { assetInternal } from "../runtime/shared_internal.ts";
|
||||
|
||||
export type TransformMode = "development" | "production";
|
||||
|
||||
@@ -36,14 +36,15 @@ function getHomeDir(): string | null {
|
||||
|
||||
function getFreshCacheDir(): string | null {
|
||||
const home = getHomeDir();
|
||||
if (home) return path.join(home, "fresh");
|
||||
if (home) return path.join(home, "sweet");
|
||||
return null;
|
||||
}
|
||||
|
||||
async function fetchLatestVersion(): Promise<string> {
|
||||
const res = await fetch("https://dl.deno.land/fresh/release-latest.txt");
|
||||
const res = await fetch("https://jsr.io/@paulaboks/sweet/meta.json");
|
||||
if (res.ok) {
|
||||
return (await res.text()).trim().replace(/^v/, "");
|
||||
const meta = (await res.json()) as { latest: string | null };
|
||||
if (meta.latest) return meta.latest;
|
||||
}
|
||||
|
||||
throw new Error(`Could not fetch latest version.`);
|
||||
@@ -128,11 +129,11 @@ export async function updateCheck(
|
||||
const latest = colors.bold(colors.rgb8(checkFile.latest_version, 121));
|
||||
// deno-lint-ignore no-console
|
||||
console.log(
|
||||
` Fresh ${latest} is available. You're on ${current}`,
|
||||
` Sweet ${latest} is available. You're on ${current}`,
|
||||
);
|
||||
// deno-lint-ignore no-console
|
||||
console.log(
|
||||
` To upgrade, run: deno run -A -r jsr:@fresh/update`,
|
||||
` To upgrade, bump the "sweet" version in your deno.json`,
|
||||
);
|
||||
// deno-lint-ignore no-console
|
||||
console.log();
|
||||
|
||||
@@ -10,7 +10,7 @@ export type { ErrorStatus };
|
||||
*
|
||||
* @example Basic usage
|
||||
* ```ts
|
||||
* import { App, HttpError } from "fresh";
|
||||
* import { App, HttpError } from "sweet";
|
||||
* import { expect } from "@std/expect";
|
||||
*
|
||||
* const app = new App()
|
||||
@@ -36,7 +36,7 @@ export class HttpError extends Error {
|
||||
*
|
||||
* @example Basic usage
|
||||
* ```ts
|
||||
* import { App, HttpError } from "fresh";
|
||||
* import { App, HttpError } from "sweet";
|
||||
* import { expect } from "@std/expect";
|
||||
*
|
||||
* const app = new App()
|
||||
|
||||
@@ -40,7 +40,7 @@ export type CORSOptions<State> = {
|
||||
* @example Basic usage
|
||||
* ```ts
|
||||
* // main.ts or routes/_middleware.ts
|
||||
* import { cors } from 'fresh';
|
||||
* import { cors } from 'sweet';
|
||||
*
|
||||
* export const handler = [
|
||||
* cors({ origin: '*' }), // Allow all origins
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Middleware } from "./mod.ts";
|
||||
import { ASSET_CACHE_BUST_KEY } from "../constants.ts";
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
import { tracer } from "../otel.ts";
|
||||
import { getBuildCache } from "../context.ts";
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { FakeServer, serveMiddleware } from "../test_utils.ts";
|
||||
import type { BuildCache, StaticFile } from "../build_cache.ts";
|
||||
import { expect } from "@std/expect";
|
||||
import { ASSET_CACHE_BUST_KEY } from "../constants.ts";
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
import type { Command } from "../commands.ts";
|
||||
import type { ServerIslandRegistry } from "../context.ts";
|
||||
import {
|
||||
|
||||
@@ -33,7 +33,7 @@ function reconnect() {
|
||||
if (backoffIdx === 0) {
|
||||
// deno-lint-ignore no-console
|
||||
console.log(
|
||||
`%c Fresh %c Connection closed. Trying to reconnect...`,
|
||||
`%c Sweet %c Connection closed. Trying to reconnect...`,
|
||||
"background-color: #86efac; color: black",
|
||||
"color: inherit",
|
||||
);
|
||||
@@ -85,7 +85,7 @@ function handleMessage(e: MessageEvent) {
|
||||
if (revision === 0) {
|
||||
// deno-lint-ignore no-console
|
||||
console.log(
|
||||
`%c Fresh %c Connected to development server.`,
|
||||
`%c Sweet %c Connected to development server.`,
|
||||
"background-color: #86efac; color: black",
|
||||
"color: inherit",
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
type InternalPreactOptions,
|
||||
OptionsType,
|
||||
} from "../shared_internal.ts";
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
import { renderToString } from "preact-render-to-string";
|
||||
import { useContext, useEffect } from "preact/hooks";
|
||||
import { HeadContext } from "../head.ts";
|
||||
|
||||
@@ -176,7 +176,7 @@ export function boot(
|
||||
: `partial "${root.name}"`;
|
||||
// deno-lint-ignore no-console
|
||||
console.error(
|
||||
`Fresh hydration error: the ${label} has invalid HTML nesting. ` +
|
||||
`Sweet hydration error: the ${label} has invalid HTML nesting. ` +
|
||||
`Its start and end markers were reparented by the browser into ` +
|
||||
`different DOM nodes. This is usually caused by placing a ` +
|
||||
`block-level element (like <div>) inside an inline element ` +
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
setActiveUrl,
|
||||
} from "../shared_internal.ts";
|
||||
import type { BuildCache } from "../../build_cache.ts";
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
import {
|
||||
DEV_ERROR_OVERLAY_URL,
|
||||
PARTIAL_SEARCH_PARAM,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ComponentChildren, VNode } from "preact";
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
import { assetInternal, assetSrcSetInternal } from "./shared_internal.ts";
|
||||
|
||||
export { HttpError } from "../error.ts";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import {
|
||||
ALL_ISLAND_DIR,
|
||||
assertNotSelector,
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "./test_utils.tsx";
|
||||
|
||||
import { FakeServer } from "../src/test_utils.ts";
|
||||
import { Partial } from "fresh/runtime";
|
||||
import { Partial } from "sweet/runtime";
|
||||
|
||||
const allIslandCache = await buildProd({ islandDir: ALL_ISLAND_DIR });
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ Deno.test("Docs Code example checks", async () => {
|
||||
const denoJson = {
|
||||
lock: false,
|
||||
imports: {
|
||||
fresh: `jsr:@fresh/core@${FRESH_VERSION}`,
|
||||
"@fresh/plugin-tailwind-v3":
|
||||
`jsr:@fresh/plugin-tailwind@^${twDenoJson.version}`,
|
||||
"@fresh/plugin-tailwind":
|
||||
`jsr:@fresh/plugin-tailwind@^${twDenoJson.version}`,
|
||||
fresh: `jsr:@paulaboks/sweet@${FRESH_VERSION}`,
|
||||
"@paulaboks/sweet-tailwind-v3":
|
||||
`jsr:@paulaboks/sweet-tailwind@^${twDenoJson.version}`,
|
||||
"@paulaboks/sweet-tailwind":
|
||||
`jsr:@paulaboks/sweet-tailwind@^${twDenoJson.version}`,
|
||||
preact: `npm:preact@^${PREACT_VERSION}`,
|
||||
"@deno/gfm": "jsr:@deno/gfm@^0.11.0",
|
||||
"@std/expect": "jsr:@std/expect@^1.0.16",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function DynamicMetaIsland() {
|
||||
const [count, setCount] = useState(0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function LinkIsland() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function MetaIsland() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function MultiHeadA() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function MultiHeadB() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function StyleIdIsland() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function TemplateIsland() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function TitleIsland() {
|
||||
const [s, set] = useState(0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PageProps } from "@fresh/core";
|
||||
import type { PageProps } from "@paulaboks/sweet";
|
||||
|
||||
export default function Page({ Component }: PageProps) {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect } from "preact/hooks";
|
||||
import { useSignal } from "@preact/signals";
|
||||
import { IS_BROWSER } from "fresh/runtime";
|
||||
import { IS_BROWSER } from "sweet/runtime";
|
||||
|
||||
export function NodeProcess() {
|
||||
const active = useSignal(false);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Partial } from "fresh/runtime";
|
||||
import { Partial } from "sweet/runtime";
|
||||
|
||||
export function PartialInIsland() {
|
||||
return (
|
||||
|
||||
@@ -5,7 +5,7 @@ import rootConfig from "../../../deno.json" with { type: "json" };
|
||||
import freshConfig from "../deno.json" with { type: "json" };
|
||||
|
||||
Deno.test("Fresh version consistency", () => {
|
||||
const freshImport: string = rootConfig.imports.fresh;
|
||||
const freshImport: string = rootConfig.imports.sweet;
|
||||
const rangeStr = freshImport.split("@").pop()!;
|
||||
const importRange = tryParseRange(rangeStr);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import { Head } from "sweet/runtime";
|
||||
import {
|
||||
buildProd,
|
||||
parseHtml,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import { BlockIsland } from "./fixtures_islands/BlockIsland.tsx";
|
||||
import { Counter } from "./fixtures_islands/Counter.tsx";
|
||||
import { IslandInIsland } from "./fixtures_islands/IslandInIsland.tsx";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* and has no element with `f-client-nav="true"`. The full Fresh client runtime
|
||||
* (fresh-runtime.js + inline boot script) must only appear when actually needed.
|
||||
*/
|
||||
import { App } from "fresh";
|
||||
import { App } from "sweet";
|
||||
import { signal } from "@preact/signals";
|
||||
import { Counter } from "./fixtures_islands/Counter.tsx";
|
||||
import { expect } from "@std/expect";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { App, staticFiles } from "fresh";
|
||||
import { Partial } from "fresh/runtime";
|
||||
import { App, staticFiles } from "sweet";
|
||||
import { Partial } from "sweet/runtime";
|
||||
import {
|
||||
ALL_ISLAND_DIR,
|
||||
assertMetaContent,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
This is a CLI tool to bootstrap a new Fresh project. To do so, run this command:
|
||||
|
||||
```sh
|
||||
deno run -Ar jsr:@fresh/init
|
||||
deno run -Ar jsr:@paulaboks/sweet-init
|
||||
```
|
||||
|
||||
Go to [https://usefresh.dev/](https://usefresh.dev/) for more information about
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/init",
|
||||
"name": "@paulaboks/sweet-init",
|
||||
"version": "2.3.3",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
|
||||
+29
-28
@@ -37,24 +37,24 @@ export const HELP_TEXT = `
|
||||
${
|
||||
colors.bgRgb8(
|
||||
colors.rgb8(
|
||||
` 🍋 @fresh/init${colors.rgb8(`@${initConfig.version}`, 248)} `,
|
||||
` 🍋 @paulaboks/sweet-init${colors.rgb8(`@${initConfig.version}`, 248)} `,
|
||||
0,
|
||||
),
|
||||
121,
|
||||
)
|
||||
}
|
||||
|
||||
Initialize a new Fresh project. This will create all the necessary files
|
||||
Initialize a new Sweet project. This will create all the necessary files
|
||||
for a new project.
|
||||
|
||||
To generate a project in the './foobar' subdirectory:
|
||||
${colors.rgb8("deno run -Ar jsr:@fresh/init ./foobar", 245)}
|
||||
${colors.rgb8("deno run -Ar jsr:@paulaboks/sweet-init ./foobar", 245)}
|
||||
|
||||
To generate a project in the current directory:
|
||||
${colors.rgb8("deno run -Ar jsr:@fresh/init .", 245)}
|
||||
${colors.rgb8("deno run -Ar jsr:@paulaboks/sweet-init .", 245)}
|
||||
|
||||
${colors.rgb8("USAGE:", 3)}
|
||||
${colors.rgb8("deno run -Ar jsr:@fresh/init [DIRECTORY]", 245)}
|
||||
${colors.rgb8("deno run -Ar jsr:@paulaboks/sweet-init [DIRECTORY]", 245)}
|
||||
|
||||
${colors.rgb8("OPTIONS:", 3)}
|
||||
${colors.rgb8("--force", 2)} Overwrite existing files
|
||||
@@ -89,7 +89,10 @@ export async function initProject(
|
||||
skipInstall?: boolean | null;
|
||||
} = {},
|
||||
): Promise<void> {
|
||||
const freshVersion = await getLatestVersion("@fresh/core", FRESH_VERSION);
|
||||
const freshVersion = await getLatestVersion(
|
||||
"@paulaboks/sweet",
|
||||
FRESH_VERSION,
|
||||
);
|
||||
|
||||
if (flags.help || flags.h) {
|
||||
console.log(HELP_TEXT);
|
||||
@@ -99,7 +102,7 @@ export async function initProject(
|
||||
console.log();
|
||||
console.log(
|
||||
colors.bgRgb8(
|
||||
colors.rgb8(" 🍋 Fresh: The next-gen web framework. ", 0),
|
||||
colors.rgb8(" 🍬 Sweet: The next-gen web framework. ", 0),
|
||||
121,
|
||||
),
|
||||
);
|
||||
@@ -171,7 +174,7 @@ export async function initProject(
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# Fresh build directory
|
||||
# Sweet build directory
|
||||
_fresh/
|
||||
# npm + other dependencies
|
||||
node_modules/
|
||||
@@ -395,7 +398,7 @@ import "./assets/styles.css";`,
|
||||
// Skip this and be silent if there is a network issue.
|
||||
}
|
||||
|
||||
const MAIN_TS = `import { App, staticFiles } from "fresh";
|
||||
const MAIN_TS = `import { App, staticFiles } from "sweet";
|
||||
import { define, type State } from "./utils.ts";
|
||||
|
||||
export const app = new App<State>();
|
||||
@@ -447,7 +450,7 @@ export function Button(props: ButtonProps) {
|
||||
}`;
|
||||
await writeFile("components/Button.tsx", COMPONENTS_BUTTON_TSX);
|
||||
|
||||
const UTILS_TS = `import { createDefine } from "fresh";
|
||||
const UTILS_TS = `import { createDefine } from "sweet";
|
||||
|
||||
// This specifies the type of "ctx.state" which is used to share
|
||||
// data among middlewares, layouts and routes.
|
||||
@@ -459,7 +462,7 @@ export const define = createDefine<State>();`;
|
||||
await writeFile("utils.ts", UTILS_TS);
|
||||
|
||||
const ROUTES_HOME = `import { useSignal } from "@preact/signals";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
import { define } from "../utils.ts";
|
||||
import Counter from "../islands/Counter.tsx";
|
||||
|
||||
@@ -471,7 +474,7 @@ export default define.page(function Home(ctx) {
|
||||
return (
|
||||
<div class="px-4 py-8 mx-auto fresh-gradient min-h-screen">
|
||||
<Head>
|
||||
<title>Fresh counter</title>
|
||||
<title>Sweet counter</title>
|
||||
</Head>
|
||||
<div class="max-w-screen-md mx-auto flex flex-col items-center justify-center">
|
||||
<img
|
||||
@@ -479,9 +482,9 @@ export default define.page(function Home(ctx) {
|
||||
src="/logo.svg"
|
||||
width="128"
|
||||
height="128"
|
||||
alt="the Fresh logo: a sliced lemon dripping with juice"
|
||||
alt="the Sweet logo"
|
||||
/>
|
||||
<h1 class="text-4xl font-bold">Welcome to Fresh</h1>
|
||||
<h1 class="text-4xl font-bold">Welcome to Sweet</h1>
|
||||
<p class="my-4">
|
||||
Try updating this message in the
|
||||
<code class="mx-2">./routes/index.tsx</code> file, and refresh.
|
||||
@@ -544,8 +547,8 @@ export default function Counter(props: CounterProps) {
|
||||
await writeFile("islands/Counter.tsx", ISLANDS_COUNTER_TSX);
|
||||
|
||||
const DEV_TS = `#!/usr/bin/env -S deno run -A --watch=static/,routes/
|
||||
${useTailwind ? `import { tailwind } from "@fresh/plugin-tailwind";\n` : ""}
|
||||
import { Builder } from "fresh/dev";
|
||||
${useTailwind ? `import { tailwind } from "@paulaboks/sweet-tailwind";\n` : ""}
|
||||
import { Builder } from "sweet/dev";
|
||||
|
||||
const builder = new Builder();
|
||||
${useTailwind ? "tailwind(builder);" : ""}
|
||||
@@ -566,7 +569,6 @@ if (Deno.args.includes("build")) {
|
||||
dev: "deno run -A --watch=static/,routes/ dev.ts",
|
||||
build: "deno run -A dev.ts build",
|
||||
start: "deno serve -A _fresh/server.js",
|
||||
update: "deno run -A -r jsr:@fresh/update .",
|
||||
},
|
||||
lint: {
|
||||
rules: {
|
||||
@@ -576,7 +578,7 @@ if (Deno.args.includes("build")) {
|
||||
exclude: ["**/_fresh/*"],
|
||||
imports: {
|
||||
"@/": "./",
|
||||
"fresh": `jsr:@fresh/core@^${freshVersion}`,
|
||||
"sweet": `jsr:@paulaboks/sweet@^${freshVersion}`,
|
||||
"preact": `npm:preact@^${PREACT_VERSION}`,
|
||||
"@preact/signals": `npm:@preact/signals@^${PREACT_SIGNALS_VERSION}`,
|
||||
} as Record<string, string>,
|
||||
@@ -609,12 +611,12 @@ if (Deno.args.includes("build")) {
|
||||
denoJson.tasks.build = "vite build";
|
||||
|
||||
const vitePluginVersion = await getLatestVersion(
|
||||
"@fresh/plugin-vite",
|
||||
"@paulaboks/sweet-vite",
|
||||
FRESH_VITE_PLUGIN,
|
||||
);
|
||||
|
||||
denoJson.imports["@fresh/plugin-vite"] =
|
||||
`jsr:@fresh/plugin-vite@^${vitePluginVersion}`;
|
||||
denoJson.imports["@paulaboks/sweet-vite"] =
|
||||
`jsr:@paulaboks/sweet-vite@^${vitePluginVersion}`;
|
||||
denoJson.imports["vite"] = "npm:vite@^7.1.3";
|
||||
denoJson.imports["@types/babel__core"] = "npm:@types/babel__core@^7.20.5";
|
||||
|
||||
@@ -625,8 +627,8 @@ if (Deno.args.includes("build")) {
|
||||
}
|
||||
} else if (useTailwind) {
|
||||
denoJson.imports["tailwindcss"] = `npm:tailwindcss@^${TAILWINDCSS_VERSION}`;
|
||||
denoJson.imports["@fresh/plugin-tailwind"] =
|
||||
`jsr:@fresh/plugin-tailwind@^${FRESH_TAILWIND_VERSION}`;
|
||||
denoJson.imports["@paulaboks/sweet-tailwind"] =
|
||||
`jsr:@paulaboks/sweet-tailwind@^${FRESH_TAILWIND_VERSION}`;
|
||||
denoJson.imports["@tailwindcss/postcss"] =
|
||||
`npm:@tailwindcss/postcss@^${TAILWINDCSS_POSTCSS_VERSION}`;
|
||||
denoJson.imports["postcss"] = `npm:postcss@^${POSTCSS_VERSION}`;
|
||||
@@ -636,23 +638,22 @@ if (Deno.args.includes("build")) {
|
||||
|
||||
if (useVite) {
|
||||
let viteConfig = `import { defineConfig } from "vite";
|
||||
import { fresh } from "@fresh/plugin-vite";\n`;
|
||||
import { sweet } from "@paulaboks/sweet-vite";\n`;
|
||||
|
||||
if (useTailwind) {
|
||||
viteConfig += `import tailwindcss from "@tailwindcss/vite";\n`;
|
||||
}
|
||||
|
||||
viteConfig += `\nexport default defineConfig({
|
||||
plugins: [fresh()${useTailwind ? ", tailwindcss()" : ""}],
|
||||
plugins: [sweet()${useTailwind ? ", tailwindcss()" : ""}],
|
||||
});`;
|
||||
|
||||
await writeFile("vite.config.ts", viteConfig);
|
||||
}
|
||||
|
||||
const README_MD = `# Fresh project
|
||||
const README_MD = `# Sweet project
|
||||
|
||||
Your new Fresh project is ready to go. You can follow the Fresh "Getting
|
||||
Started" guide here: https://usefresh.dev/docs/getting-started
|
||||
Your new Sweet project is ready to go.
|
||||
|
||||
### Usage
|
||||
|
||||
|
||||
@@ -80,6 +80,14 @@ async function patchProject(dir: string): Promise<void> {
|
||||
ignore,
|
||||
);
|
||||
|
||||
if (json.imports?.["@paulaboks/sweet-tailwind"]) {
|
||||
await copyRecursive(
|
||||
path.join(import.meta.dirname!, "..", "..", "plugin-tailwindcss"),
|
||||
path.join(linkedDir, "plugin-tailwindcss"),
|
||||
ignore,
|
||||
);
|
||||
}
|
||||
|
||||
json.workspace = ["./_linked/*"];
|
||||
json.exclude = [...json.exclude ?? [], "**/_linked/*"];
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { parseArgs } from "@std/cli/parse-args";
|
||||
import { initProject } from "./init.ts";
|
||||
import { InitError } from "./init.ts";
|
||||
|
||||
// Note: "deno run -Ar jsr:@fresh/init" is the recommended way to create a new project.
|
||||
// Note: "deno run -Ar jsr:@paulaboks/sweet-init" is the recommended way to create a new project.
|
||||
|
||||
const flags = parseArgs(Deno.args, {
|
||||
boolean: ["force", "tailwind", "vscode", "docker", "help", "builder"],
|
||||
|
||||
@@ -9,8 +9,8 @@ A Tailwind CSS v3 plugin to use in Fresh.
|
||||
|
||||
```ts
|
||||
// dev.ts
|
||||
import { Builder } from "fresh/dev";
|
||||
import { tailwind } from "@fresh/plugin-tailwind-v3";
|
||||
import { Builder } from "sweet/dev";
|
||||
import { tailwind } from "@paulaboks/sweet-tailwind-v3";
|
||||
|
||||
const builder = new Builder();
|
||||
tailwind(builder);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/plugin-tailwind-v3",
|
||||
"name": "@paulaboks/sweet-tailwind-v3",
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
"exports": "./src/mod.ts",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Builder, ResolvedBuildConfig } from "fresh/dev";
|
||||
import type { Builder, ResolvedBuildConfig } from "sweet/dev";
|
||||
import tailwindCss, { type Config } from "tailwindcss";
|
||||
import postcss from "postcss";
|
||||
import cssnano from "cssnano";
|
||||
|
||||
@@ -6,9 +6,9 @@ A Tailwind CSS plugin to use in Fresh.
|
||||
|
||||
```ts
|
||||
// dev.ts
|
||||
import { Builder } from "fresh/dev";
|
||||
import { Builder } from "sweet/dev";
|
||||
import { app } from "./main.ts";
|
||||
import { tailwind } from "@fresh/plugin-tailwind";
|
||||
import { tailwind } from "@paulaboks/sweet-tailwind";
|
||||
|
||||
const builder = new Builder();
|
||||
tailwind(builder, app);
|
||||
@@ -24,9 +24,9 @@ if (Deno.args.includes("build")) {
|
||||
|
||||
```ts
|
||||
// dev.ts
|
||||
import { Builder } from "fresh/dev";
|
||||
import { Builder } from "sweet/dev";
|
||||
import { app } from "./main.ts";
|
||||
import { tailwind } from "@fresh/plugin-tailwind";
|
||||
import { tailwind } from "@paulaboks/sweet-tailwind";
|
||||
|
||||
const builder = new Builder();
|
||||
tailwind(builder, app, {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@fresh/plugin-tailwind",
|
||||
"name": "@paulaboks/sweet-tailwind",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"exports": "./src/mod.ts"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Builder } from "fresh/dev";
|
||||
import type { Builder } from "sweet/dev";
|
||||
import twPostcss from "@tailwindcss/postcss";
|
||||
import postcss from "postcss";
|
||||
import type { TailwindPluginOptions } from "./types.ts";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { OnTransformOptions } from "fresh/dev";
|
||||
import type { OnTransformOptions } from "sweet/dev";
|
||||
|
||||
// based on the original code, this type is used to define options for the Tailwind plugin
|
||||
type PluginOptions = {
|
||||
|
||||
@@ -4,13 +4,13 @@ Vite plugin for [Fresh](https://usefresh.dev).
|
||||
|
||||
## Usage
|
||||
|
||||
1. Run `deno install jsr:@fresh/plugin-vite npm:vite`
|
||||
1. Run `deno install jsr:@paulaboks/sweet-vite npm:vite`
|
||||
2. Ensure that your `deno.json` has the `fresh` import mapping:
|
||||
|
||||
```json
|
||||
{
|
||||
"imports": {
|
||||
"fresh": "jsr:@fresh/core"
|
||||
"sweet": "jsr:@paulaboks/sweet"
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -19,7 +19,7 @@ Vite plugin for [Fresh](https://usefresh.dev).
|
||||
|
||||
```diff
|
||||
import { defineConfig } from "vite";
|
||||
+ import { fresh } from "@fresh/plugin-vite";
|
||||
+ import { fresh } from "@paulaboks/sweet-vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function HeadCounter() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
import { Head } from "sweet/runtime";
|
||||
|
||||
export function HeadMeta() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { App, staticFiles, trailingSlashes } from "fresh";
|
||||
import { App, staticFiles, trailingSlashes } from "sweet";
|
||||
|
||||
export const app = new App()
|
||||
.use(staticFiles())
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PageProps } from "fresh";
|
||||
import type { PageProps } from "sweet";
|
||||
import { AppNav } from "../islands/AppNav.tsx";
|
||||
|
||||
export default function App({ Component }: PageProps) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { BUILD_ID } from "@fresh/build-id";
|
||||
import { BUILD_ID } from "@paulaboks/sweet-build-id";
|
||||
|
||||
export const handler = () => new Response(BUILD_ID);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Middleware } from "@fresh/core";
|
||||
import type { Middleware } from "@paulaboks/sweet";
|
||||
|
||||
const middleware1: Middleware<{ text: string }> = async (ctx) => {
|
||||
ctx.state.text = "A";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { HandlerFn } from "@fresh/core";
|
||||
import type { HandlerFn } from "@paulaboks/sweet";
|
||||
|
||||
export const handler: HandlerFn<null, { text: string }> = (ctx) =>
|
||||
new Response(ctx.state.text);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user