-
Notifications
You must be signed in to change notification settings - Fork 750
docs: comprehensive documentation audit, fixes, and website improvements #3712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 52 commits
c47329e
daead8b
f1fe5fa
1b22639
1fbed75
066622c
d08b293
12931a1
36d3d2f
be611a3
04aceb6
ecb7205
8731665
6398da6
40e1b47
7b69ec6
00a6228
b13260d
033022a
b3d32a2
a651250
ff62595
5a035f9
ebf194e
025b3c6
5b8af4c
37aaaed
272342a
3adb4cc
715a0fe
68bc424
8f16110
2c0491e
5dcb621
971ece9
542a082
09d1332
fd43eed
dc56896
7e9bff1
7ec338c
3ac8461
60502ed
6e1f660
badf670
0c74c35
1b9e184
a00673e
0e07166
cfad1d8
80ba463
394441f
92f0744
cb01272
1614706
6a1b507
4af0d2c
b560aa8
e136a75
d91adac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /** | ||
| * Verifies that all image references in documentation markdown files | ||
| * point to existing files in www/static/. | ||
| * | ||
| * Run: deno test -A docs/check_images_test.ts | ||
| */ | ||
| import { walk } from "jsr:@std/fs@1/walk"; | ||
| import { join, resolve } from "jsr:@std/path@1"; | ||
|
|
||
| const ROOT = resolve(import.meta.dirname!); | ||
| const PROJECT_ROOT = resolve(ROOT, ".."); | ||
| const DOCS_DIR = ROOT; | ||
| const STATIC_DIR = join(PROJECT_ROOT, "www", "static"); | ||
|
|
||
| const IMAGE_RE = /!\[.*?\]\(([^)]+)\)/g; | ||
|
|
||
| Deno.test("all doc image references point to existing files", async () => { | ||
| const errors: string[] = []; | ||
|
|
||
| for await ( | ||
| const entry of walk(DOCS_DIR, { | ||
| exts: [".md", ".mdx"], | ||
| includeDirs: false, | ||
| }) | ||
| ) { | ||
| const content = await Deno.readTextFile(entry.path); | ||
| const relativePath = entry.path.slice(PROJECT_ROOT.length); | ||
|
|
||
| for (const match of content.matchAll(IMAGE_RE)) { | ||
| const imgPath = match[1]; | ||
|
|
||
| // Skip external URLs | ||
| if (imgPath.startsWith("http://") || imgPath.startsWith("https://")) { | ||
| continue; | ||
| } | ||
|
|
||
| // Doc image paths like "/docs/foo.png" map to "www/static/docs/foo.png" | ||
| const fsPath = join(STATIC_DIR, imgPath); | ||
|
|
||
| try { | ||
| await Deno.stat(fsPath); | ||
| } catch { | ||
| errors.push(`${relativePath}: image not found: ${imgPath}`); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (errors.length > 0) { | ||
| throw new Error( | ||
| `Found ${errors.length} broken image reference(s):\n\n${ | ||
| errors.join("\n") | ||
| }`, | ||
| ); | ||
| } | ||
| }); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| description: | | ||
| Quick reference for all public exports from Fresh's entry points: fresh, fresh/runtime, and fresh/dev. | ||
| --- | ||
|
|
||
| This page lists all public exports from Fresh's entry points. | ||
|
|
||
| ## `fresh` | ||
|
|
||
| The main entry point for server-side code. | ||
|
|
||
| ```ts | ||
| import { App, createDefine, HttpError, page, staticFiles } from "fresh"; | ||
| ``` | ||
|
|
||
| | Export | Kind | Description | | ||
| | ----------------- | -------- | -------------------------------------------------------------------------------------------------- | | ||
| | `App` | Class | The main application class. See [App](/docs/concepts/app). | | ||
| | `staticFiles` | Function | Middleware for serving static files. See [Static Files](/docs/concepts/static-files). | | ||
| | `createDefine` | Function | Create type-safe `define.*` helpers. See [Define Helpers](/docs/advanced/define). | | ||
| | `page` | Function | Return data from a handler to a page component. See [Data Fetching](/docs/concepts/data-fetching). | | ||
| | `HttpError` | Class | Throw HTTP errors with status codes. See [Error Handling](/docs/advanced/error-handling). | | ||
| | `cors` | Function | CORS middleware. See [cors](/docs/plugins/cors). | | ||
| | `csrf` | Function | CSRF protection middleware. See [csrf](/docs/plugins/csrf). | | ||
| | `csp` | Function | Content Security Policy middleware. See [csp](/docs/plugins/csp). | | ||
| | `trailingSlashes` | Function | Trailing slash enforcement middleware. See [trailingSlashes](/docs/plugins/trailing-slashes). | | ||
|
|
||
| **Types:** | ||
|
|
||
| | Export | Description | | ||
| | ------------------------------------- | ------------------------------------------------------------------------------------ | | ||
| | `Context` / `FreshContext` | The request context passed to all middlewares and handlers. | | ||
| | `PageProps` | Props received by page components (includes `data`, `url`, `params`, `state`, etc.). | | ||
| | `Middleware` / `MiddlewareFn` | Middleware function type. | | ||
| | `HandlerFn` | Single handler function type. | | ||
| | `HandlerByMethod` | Object with per-method handler functions. | | ||
| | `RouteHandler` | Union of `HandlerFn` and `HandlerByMethod`. | | ||
| | `PageResponse` | Return type of `page()`. | | ||
| | `RouteConfig` | Route configuration (`routeOverride`, `skipInheritedLayouts`, etc.). | | ||
| | `LayoutConfig` | Layout configuration (`skipInheritedLayouts`, `skipAppWrapper`). | | ||
| | `Define` | Type of the object returned by `createDefine()`. | | ||
| | `FreshConfig` / `ResolvedFreshConfig` | App configuration types. | | ||
| | `ListenOptions` | Options for `app.listen()`. | | ||
| | `Island` | Island component type. | | ||
| | `Method` | HTTP method union type. | | ||
| | `RouteData` | Data type returned by route handlers via `page()`. | | ||
| | `Lazy` / `MaybeLazy` | Utility types for lazily-loaded routes and middleware. | | ||
| | `CORSOptions` | Options for `cors()`. | | ||
| | `CsrfOptions` | Options for `csrf()`. | | ||
| | `CSPOptions` | Options for `csp()`. | | ||
|
|
||
| ## `fresh/runtime` | ||
|
|
||
| Shared runtime utilities for both server and client code. Safe to import in | ||
| islands. | ||
|
|
||
| ```ts | ||
| import { | ||
| asset, | ||
| assetSrcSet, | ||
| Head, | ||
| HttpError, | ||
| IS_BROWSER, | ||
| Partial, | ||
| } from "fresh/runtime"; | ||
| ``` | ||
|
|
||
| | Export | Kind | Description | | ||
| | ------------- | --------- | ---------------------------------------------------------------------------------------------- | | ||
| | `IS_BROWSER` | Constant | `true` in the browser, `false` on the server. Use to guard browser-only code. | | ||
| | `asset` | Function | Add cache-busting query params to asset URLs. See [Static Files](/docs/concepts/static-files). | | ||
| | `assetSrcSet` | Function | Apply `asset()` to all URLs in a `srcset` string. | | ||
| | `Partial` | Component | Mark a region for partial updates. See [Partials](/docs/advanced/partials). | | ||
| | `Head` | Component | Add elements to the document `<head>`. See [Modifying head](/docs/advanced/head). | | ||
| | `HttpError` | Class | HTTP error class (re-exported from `fresh`). | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just tested on JSR repo, this doesnt seem to be available in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's just not released yet: #3080
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be part of2.2.2 release... I'll check what's going on
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ## `fresh/dev` | ||
|
|
||
| Development and build tools. Only used in `dev.ts` (legacy) or build scripts. | ||
|
|
||
| ```ts | ||
| import { Builder } from "fresh/dev"; | ||
| ``` | ||
|
|
||
| | Export | Kind | Description | | ||
| | --------- | ----- | ---------------------------------------------------------------------- | | ||
| | `Builder` | Class | Pre-Vite build system (legacy). See [Builder](/docs/advanced/builder). | | ||
|
|
||
| **Types:** | ||
|
|
||
| | Export | Description | | ||
| | -------------------------------------------------------- | ----------------------------- | | ||
| | `BuildOptions` | Options for `new Builder()`. | | ||
| | `ResolvedBuildConfig` | Resolved build configuration. | | ||
| | `OnTransformArgs` / `OnTransformOptions` / `TransformFn` | Build plugin hook types. | | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| --- | ||
| description: | | ||
| Fresh has built-in OpenTelemetry instrumentation for tracing requests through middleware, handlers, and rendering. | ||
| --- | ||
|
|
||
| Fresh automatically instruments key operations with | ||
| [OpenTelemetry](https://opentelemetry.io/) spans, giving you visibility into how | ||
| requests flow through your application. | ||
|
|
||
| ## What's instrumented | ||
|
|
||
| Fresh creates spans for: | ||
|
|
||
| - **Middleware execution** — each middleware in the chain | ||
| - **Route handler execution** — handler function calls | ||
| - **Rendering** — server-side page rendering | ||
| - **Static file serving** — file lookups and responses | ||
| - **Lazy route loading** — dynamic imports of route modules | ||
|
|
||
| ## Enabling tracing | ||
|
|
||
| Fresh uses the `@opentelemetry/api` package (the vendor-neutral API). Spans are | ||
| created automatically — you just need to provide an OpenTelemetry SDK and | ||
| exporter to collect them. | ||
|
|
||
| If no exporter is configured, the spans are silently discarded (no performance | ||
| overhead). | ||
|
|
||
| ### With Deno's built-in OpenTelemetry | ||
|
|
||
| Deno has | ||
| [built-in OpenTelemetry support](https://docs.deno.com/runtime/fundamentals/open_telemetry/). | ||
| Enable it with the `OTEL_DENO` environment variable: | ||
|
|
||
| ```sh Terminal | ||
| OTEL_DENO=true deno task start | ||
| ``` | ||
|
|
||
| This exports traces to an OTLP-compatible collector (configure the endpoint with | ||
| `OTEL_EXPORTER_OTLP_ENDPOINT`). | ||
|
|
||
| ### With Deno Deploy | ||
|
|
||
| [Deno Deploy](https://deno.com/deploy) collects Fresh traces automatically when | ||
| using the Fresh preset — no configuration needed. |
Uh oh!
There was an error while loading. Please reload this page.