Skip to content

feat: route loaders serialization #7466

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

Draft
wants to merge 12 commits into
base: build/v2
Choose a base branch
from
Draft
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default tseslint.config(
},
},
{
files: ['packages/docs/**/*.{ts,tsx}'],
files: ['packages/docs/demo/**/*.{ts,tsx}'],
rules: {
'no-console': 'off',
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
"build.cli": "tsx --require ./scripts/runBefore.ts scripts/index.ts --cli --dev",
"build.cli.prod": "tsx --require ./scripts/runBefore.ts scripts/index.ts --cli",
"build.core": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --qwik --insights --qwikrouter --api --platform-binding",
"build.router": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --qwikrouter --api",
"build.eslint": "tsx --require ./scripts/runBefore.ts scripts/index.ts --eslint",
"build.full": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --qwik --insights --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding --wasm",
"build.local": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --qwik --insights --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding-wasm-copy",
Expand Down
48 changes: 3 additions & 45 deletions packages/docs/src/routes/api/qwik/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,6 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts",
"mdFile": "core.computedfn.md"
},
{
"name": "ComputedReturnType",
"id": "computedreturntype",
"hierarchy": [
{
"name": "ComputedReturnType",
"id": "computedreturntype"
}
],
"kind": "TypeAlias",
"content": "```typescript\nexport type ComputedReturnType<T> = T extends Promise<infer T> ? ReadonlySignal<T> : ReadonlySignal<T>;\n```\n**References:** [ReadonlySignal](#readonlysignal)",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts",
"mdFile": "core.computedreturntype.md"
},
{
"name": "ComputedSignal",
"id": "computedsignal",
Expand Down Expand Up @@ -686,20 +672,6 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/jsx-runtime.ts",
"mdFile": "core.h.md"
},
{
"name": "HTMLElementAttrs",
"id": "htmlelementattrs",
"hierarchy": [
{
"name": "HTMLElementAttrs",
"id": "htmlelementattrs"
}
],
"kind": "Interface",
"content": "```typescript\nexport interface HTMLElementAttrs extends HTMLAttributesBase, FilterBase<HTMLElement> \n```\n**Extends:** HTMLAttributesBase, FilterBase&lt;HTMLElement&gt;",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts",
"mdFile": "core.htmlelementattrs.md"
},
{
"name": "implicit$FirstArg",
"id": "implicit_firstarg",
Expand Down Expand Up @@ -1332,7 +1304,7 @@
}
],
"kind": "TypeAlias",
"content": "The DOM props without plain handlers, for use inside functions\n\n\n```typescript\nexport type QwikHTMLElements = {\n [tag in keyof HTMLElementTagNameMap]: Augmented<HTMLElementTagNameMap[tag], SpecialAttrs[tag]> & HTMLElementAttrs & QwikAttributes<HTMLElementTagNameMap[tag]>;\n};\n```\n**References:** [HTMLElementAttrs](#htmlelementattrs)<!-- -->, [QwikAttributes](#qwikattributes)",
"content": "The DOM props without plain handlers, for use inside functions\n\n\n```typescript\nexport type QwikHTMLElements = {\n [tag in keyof HTMLElementTagNameMap]: Augmented<HTMLElementTagNameMap[tag], SpecialAttrs[tag]> & HTMLElementAttrs & QwikAttributes<HTMLElementTagNameMap[tag]>;\n};\n```\n**References:** [QwikAttributes](#qwikattributes)",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts",
"mdFile": "core.qwikhtmlelements.md"
},
Expand Down Expand Up @@ -1472,7 +1444,7 @@
}
],
"kind": "TypeAlias",
"content": "The SVG props without plain handlers, for use inside functions\n\n\n```typescript\nexport type QwikSVGElements = {\n [K in keyof Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>]: SVGProps<SVGElementTagNameMap[K]>;\n};\n```\n**References:** [SVGProps](#svgprops)",
"content": "The SVG props without plain handlers, for use inside functions\n\n\n```typescript\nexport type QwikSVGElements = {\n [K in keyof Omit<SVGElementTagNameMap, keyof HTMLElementTagNameMap>]: SVGProps<SVGElementTagNameMap[K]>;\n};\n```",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts",
"mdFile": "core.qwiksvgelements.md"
},
Expand Down Expand Up @@ -2022,20 +1994,6 @@
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts",
"mdFile": "core.svgattributes.md"
},
{
"name": "SVGProps",
"id": "svgprops",
"hierarchy": [
{
"name": "SVGProps",
"id": "svgprops"
}
],
"kind": "Interface",
"content": "```typescript\nexport interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T> \n```\n**Extends:** [SVGAttributes](#svgattributes)<!-- -->, [QwikAttributes](#qwikattributes)<!-- -->&lt;T&gt;",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts",
"mdFile": "core.svgprops.md"
},
{
"name": "sync$",
"id": "sync_",
Expand Down Expand Up @@ -2144,7 +2102,7 @@
}
],
"kind": "Function",
"content": "Creates a computed signal which is calculated from the given function. A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated, and if the result changed, all tasks which are tracking the signal will be re-run and all components that read the signal will be re-rendered.\n\nThe function must be synchronous and must not have any side effects.\n\n\n```typescript\nuseComputed$: <T>(qrl: ComputedFn<T>) => ComputedReturnType<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nqrl\n\n\n</td><td>\n\n[ComputedFn](#computedfn)<!-- -->&lt;T&gt;\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\n[ComputedReturnType](#computedreturntype)<!-- -->&lt;T&gt;",
"content": "Creates a computed signal which is calculated from the given function. A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated, and if the result changed, all tasks which are tracking the signal will be re-run and all components that read the signal will be re-rendered.\n\nThe function must be synchronous and must not have any side effects.\n\n\n```typescript\nuseComputed$: <T>(qrl: ComputedFn<T>) => ComputedReturnType<T>\n```\n\n\n<table><thead><tr><th>\n\nParameter\n\n\n</th><th>\n\nType\n\n\n</th><th>\n\nDescription\n\n\n</th></tr></thead>\n<tbody><tr><td>\n\nqrl\n\n\n</td><td>\n\n[ComputedFn](#computedfn)<!-- -->&lt;T&gt;\n\n\n</td><td>\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nComputedReturnType&lt;T&gt;",
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts",
"mdFile": "core.usecomputed_.md"
},
Expand Down
37 changes: 2 additions & 35 deletions packages/docs/src/routes/api/qwik/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,6 @@ export type ComputedFn<T> = () => T;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts)

## ComputedReturnType

```typescript
export type ComputedReturnType<T> =
T extends Promise<infer T> ? ReadonlySignal<T> : ReadonlySignal<T>;
```

**References:** [ReadonlySignal](#readonlysignal)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts)

## ComputedSignal

A computed signal is a signal which is calculated from other signals. When the signals change, the computed signal is recalculated, and if the result changed, all tasks which are tracking the signal will be re-run and all components that read the signal will be re-rendered.
Expand Down Expand Up @@ -1344,16 +1333,6 @@ any[]

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/jsx-runtime.ts)

## HTMLElementAttrs

```typescript
export interface HTMLElementAttrs extends HTMLAttributesBase, FilterBase<HTMLElement>
```

**Extends:** HTMLAttributesBase, FilterBase&lt;HTMLElement&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## implicit$FirstArg

Create a `____$(...)` convenience method from `___(...)`.
Expand Down Expand Up @@ -2597,7 +2576,7 @@ export type QwikHTMLElements = {
};
```

**References:** [HTMLElementAttrs](#htmlelementattrs), [QwikAttributes](#qwikattributes)
**References:** [QwikAttributes](#qwikattributes)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

Expand Down Expand Up @@ -2795,8 +2774,6 @@ export type QwikSVGElements = {
};
```

**References:** [SVGProps](#svgprops)

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## QwikSymbolEvent
Expand Down Expand Up @@ -8132,16 +8109,6 @@ _(Optional)_

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## SVGProps

```typescript
export interface SVGProps<T extends Element> extends SVGAttributes, QwikAttributes<T>
```

**Extends:** [SVGAttributes](#svgattributes), [QwikAttributes](#qwikattributes)&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/shared/jsx/types/jsx-generated.ts)

## sync$

Extract function into a synchronously loadable QRL.
Expand Down Expand Up @@ -8481,7 +8448,7 @@ qrl
</tbody></table>
**Returns:**

[ComputedReturnType](#computedreturntype)&lt;T&gt;
ComputedReturnType&lt;T&gt;

[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/use/use-computed.ts)

Expand Down
3 changes: 2 additions & 1 deletion packages/qwik-router/src/buildtime/vite/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { getExtension, normalizePath } from '../../utils/fs';
import { updateBuildContext } from '../build';
import type { BuildContext, BuildRoute } from '../types';
import { formatError } from './format-error';
import { RequestEvShareServerTiming } from '../../middleware/request-handler/request-event';

export function ssrDevMiddleware(ctx: BuildContext, server: ViteDevServer) {
const matchRouteRequest = (pathname: string) => {
Expand Down Expand Up @@ -188,7 +189,7 @@ export function ssrDevMiddleware(ctx: BuildContext, server: ViteDevServer) {
res.setHeader('Set-Cookie', cookieHeaders);
}

const serverTiming = requestEv.sharedMap.get('@serverTiming') as
const serverTiming = requestEv.sharedMap.get(RequestEvShareServerTiming) as
| [string, number][]
| undefined;
if (serverTiming) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export { getErrorHtml, ServerError } from './error-handler';
export { mergeHeadersCookies } from './cookie';
export { AbortMessage, RedirectMessage } from './redirect-handler';
export { requestHandler } from './request-handler';
export { RequestEvShareQData } from './request-event';
export { _TextEncoderStream_polyfill } from './polyfill';
export type {
CacheControl,
Expand Down
Loading
Loading