Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
760 changes: 760 additions & 0 deletions .marko-run/routes.d.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/marko-run/data-loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Independent data sources are best kept as separate promises. Two `<await>` secti

## Rendering and Responses

The `next` function renders the page for `GET`, `HEAD`, and `POST` requests where applicable, or returns a `204` response when there is no page. A handler decides what to do with that result:
The `next` function renders the page for `GET`, `POST`, and `QUERY` requests where applicable, returns a `200` response for `HEAD` requests, or a `204` response when there is no page. A handler decides what to do with that result:
Comment thread
rturnq marked this conversation as resolved.

```ts
export const GET = Run.GET((ctx, next) => {
Expand Down
6 changes: 3 additions & 3 deletions docs/marko-run/file-based-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface Input {

### `+handler.*`

These files establish a route at the current directory path that can respond to any HTTP method: exported functions named `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `PATCH`, or `OPTIONS` handle requests with the matching method.
These files establish a route at the current directory path that can respond to any HTTP method: exported functions named `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `PATCH`, `OPTIONS`, or `QUERY` handle requests with the matching method.

Typically, these will be `.js` or `.ts` files, depending on the project. Like pages, only one handler file may exist for any served path.

Expand All @@ -54,7 +54,7 @@ export const POST = Run.POST({ json: ReminderSchema }, async (ctx) => {
Handler functions are synchronous or asynchronous functions that receive two arguments:

- `ctx` contains the WHATWG request object, path parameters, URL, route metadata, and the [validated body](./validation.md#request-bodies) (see [Context](./runtime.md#context))
- `next` renders the page for `GET`, `HEAD`, and `POST` requests where applicable, or returns a `204` response. Pass it an object to [make data available](./data-loading.md) to downstream handlers and the page.
- `next` renders the page for `GET`, `POST`, and `QUERY` requests where applicable, a `200` response for `HEAD` requests, or a `204` response for all other verbs. Pass it an object to [make data available](./data-loading.md) to downstream handlers and the page.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

> [!TIP]
> Configure the [`json` or `form` option](./validation.md#request-bodies) to read validated request body content with `await ctx.body`. Calling `ctx.request.json()` or `ctx.request.formData()` in a handler bypasses validation and any configured size limits. Using [`Response.json`](https://developer.mozilla.org/en-US/docs/Web/API/Response/json_static) makes it easy to return JSON encoded data.
Expand Down Expand Up @@ -112,7 +112,7 @@ export default Run.ALL(async (ctx, next) => {

These files represent static metadata to attach to the route. This metadata will be automatically provided as `ctx.meta` when the route is invoked. When the file is a non-JSON file, its default export will be used.

Metadata supports verb-specific overrides when it is an object (e.g. a JSON file or `export default { ... }`). Top-level keys that match one of `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `PATCH`, or `OPTIONS` are shallowly merged into the base object for requests of that method, overriding any existing values. These keys are excluded from the base object, and ignored when their value is not an object. For example, given a `+meta.json` file:
Metadata supports verb-specific overrides when it is an object (e.g. a JSON file or `export default { ... }`). Top-level keys that match one of `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `PATCH`, `OPTIONS`, or `QUERY` are shallowly merged into the base object for requests of that method, overriding any existing values. These keys are excluded from the base object, and ignored when their value is not an object. For example, given a `+meta.json` file:

```json
{
Expand Down
4 changes: 2 additions & 2 deletions docs/marko-run/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Handlers and middleware are written using the verb helpers defined on the global

## Verb Helpers

Each verb helper (`Run.GET`, `Run.HEAD`, `Run.POST`, `Run.PUT`, `Run.DELETE`, `Run.PATCH`, `Run.OPTIONS`, and `Run.ALL`) accepts a handler function or an array of handler functions, optionally preceded by validation options:
Each verb helper (`Run.GET`, `Run.HEAD`, `Run.POST`, `Run.PUT`, `Run.DELETE`, `Run.PATCH`, `Run.OPTIONS`, `Run.QUERY`, and `Run.ALL`) accepts a handler function or an array of handler functions, optionally preceded by validation options:
Comment thread
coderabbitai[bot] marked this conversation as resolved.

```ts
Run.POST(handler); // a handler function
Expand Down Expand Up @@ -58,7 +58,7 @@ Validators are lazy. `ctx.params` and `ctx.search` do not run their validators u

## Request Bodies

`POST`, `PUT`, and `PATCH` handlers declare how request bodies are read with the `json` and `form` options. When either is configured, `ctx.body` is a promise for the parsed and validated body. Otherwise `ctx.body` is `undefined`.
`POST`, `PUT`, `PATCH`, and `QUERY` handlers declare how request bodies are read with the `json` and `form` options. When either is configured, `ctx.body` is a promise for the parsed and validated body. Otherwise `ctx.body` is `undefined`.

```ts
import * as v from "valibot";
Expand Down
42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@
},
"devDependencies": {
"@codemirror/autocomplete": "^6.20.3",
"@codemirror/commands": "^6.10.4",
"@codemirror/commands": "^6.11.0",
"@codemirror/language": "^6.12.4",
"@codemirror/search": "^6.7.1",
"@codemirror/state": "^6.7.1",
"@codemirror/view": "^6.43.7",
"@codemirror/view": "^6.43.9",
"@fontsource/ubuntu": "^5.3.0",
"@fontsource/ubuntu-mono": "^5.3.0",
"@fortawesome/free-brands-svg-icons": "^7.3.1",
"@fortawesome/free-solid-svg-icons": "^7.3.1",
"@jridgewell/source-map": "^0.3.11",
"@marko/compiler": "^5.42.0",
"@marko/run": "^0.11.8",
"@marko/run-adapter-static": "^2.0.8",
"@marko/type-check": "^3.1.6",
"@marko/compiler": "^5.42.3",
"@marko/run": "^0.11.12",
"@marko/run-adapter-static": "^2.0.10",
"@marko/type-check": "^3.2.0",
"@resvg/resvg-js": "^2.6.2",
"@rollup/browser": "^4.62.3",
"@shikijs/langs": "^4.3.1",
"@rollup/browser": "^4.62.5",
"@shikijs/langs": "^4.4.3",
"@types/flexsearch": "^0.7.42",
"@types/hast": "^3.0.5",
"@types/node": "^26.1.2",
"@types/semver": "^7.7.1",
"@types/node": "^26.2.0",
"@types/semver": "^7.8.0",
"assert": "./shim/assert",
"autoprefixer": "^10.5.4",
"codemirror": "^6.0.2",
Expand All @@ -63,26 +63,26 @@
"lightningcss-wasm": "^1.33.0",
"lz-string": "^1.5.0",
"markdownlint-cli": "^0.49.1",
"marked": "^18.0.7",
"marko": "^6.3.35",
"marked": "^18.0.10",
"marko": "^6.3.45",
"path": "./shim/path",
"path-browserify": "^1.0.1",
"postcss": "^8.5.23",
"postcss-import": "^16.1.1",
"postcss-preset-env": "^11.3.2",
"postcss": "^8.5.26",
"postcss-import": "^16.2.0",
"postcss-preset-env": "^11.4.0",
"prettier": "^3.9.6",
"prettier-plugin-marko": "^4.1.0",
"prettier-plugin-packagejson": "^3.0.2",
"pretty-format": "^30.4.1",
"resolve-sync": "^1.2.2",
"sass-embedded": "^1.100.0",
"satori": "^0.29.0",
"sass-embedded": "^1.103.1",
"satori": "^0.29.1",
"semver": "^7.8.5",
"shiki": "^4.3.1",
"terser": "^5.49.0",
"shiki": "^4.4.3",
"terser": "^5.50.0",
"util": "./shim/util",
"vite": "^8.1.5",
"vitest": "^4.1.10",
"vite": "^8.2.2",
"vitest": "^4.1.11",
"writable-dom": "^1.0.6"
},
"packageManager": "pnpm@11.15.1"
Expand Down
Loading
Loading