Skip to content

Commit

Permalink
feat(qwik): encode the manifest hash into the container. (#4647)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery authored Jun 29, 2023
1 parent 31140fb commit 7833c6f
Show file tree
Hide file tree
Showing 16 changed files with 120 additions and 100 deletions.
2 changes: 1 addition & 1 deletion packages/docs/src/routes/api/qwik-optimizer/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
}
],
"kind": "Interface",
"content": "```typescript\nexport interface QwikManifest \n```\n\n\n| Property | Modifiers | Type | Description |\n| --- | --- | --- | --- |\n| [bundles](#) | | { \\[fileName: string\\]: [QwikBundle](#qwikbundle)<!-- -->; } | |\n| [injections?](#) | | [GlobalInjections](#globalinjections)<!-- -->\\[\\] | _(Optional)_ |\n| [mapping](#) | | { \\[symbolName: string\\]: string; } | |\n| [options?](#) | | { target?: string; buildMode?: string; entryStrategy?: { \\[key: string\\]: any; }; } | _(Optional)_ |\n| [platform?](#) | | { \\[name: string\\]: string; } | _(Optional)_ |\n| [symbols](#) | | { \\[symbolName: string\\]: [QwikSymbol](#qwiksymbol)<!-- -->; } | |\n| [version](#) | | string | |",
"content": "```typescript\nexport interface QwikManifest \n```\n\n\n| Property | Modifiers | Type | Description |\n| --- | --- | --- | --- |\n| [bundles](#) | | { \\[fileName: string\\]: [QwikBundle](#qwikbundle)<!-- -->; } | |\n| [injections?](#) | | [GlobalInjections](#globalinjections)<!-- -->\\[\\] | _(Optional)_ |\n| [manifestHash](#) | | string | |\n| [mapping](#) | | { \\[symbolName: string\\]: string; } | |\n| [options?](#) | | { target?: string; buildMode?: string; entryStrategy?: { \\[key: string\\]: any; }; } | _(Optional)_ |\n| [platform?](#) | | { \\[name: string\\]: string; } | _(Optional)_ |\n| [symbols](#) | | { \\[symbolName: string\\]: [QwikSymbol](#qwiksymbol)<!-- -->; } | |\n| [version](#) | | string | |",
"editUrl": "https://github.com/BuilderIO/qwik/tree/main/packages/qwik/src/optimizer/src/types.ts",
"mdFile": "qwik.qwikmanifest.md"
},
Expand Down
19 changes: 10 additions & 9 deletions packages/docs/src/routes/api/qwik-optimizer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,16 @@ export interface QwikBundle
export interface QwikManifest
```

| Property | Modifiers | Type | Description |
| ---------------- | --------- | --------------------------------------------------------------------------------- | ------------ |
| [bundles](#) | | { [fileName: string]: [QwikBundle](#qwikbundle); } | |
| [injections?](#) | | [GlobalInjections](#globalinjections)[] | _(Optional)_ |
| [mapping](#) | | { [symbolName: string]: string; } | |
| [options?](#) | | { target?: string; buildMode?: string; entryStrategy?: { [key: string]: any; }; } | _(Optional)_ |
| [platform?](#) | | { [name: string]: string; } | _(Optional)_ |
| [symbols](#) | | { [symbolName: string]: [QwikSymbol](#qwiksymbol); } | |
| [version](#) | | string | |
| Property | Modifiers | Type | Description |
| ----------------- | --------- | --------------------------------------------------------------------------------- | ------------ |
| [bundles](#) | | { [fileName: string]: [QwikBundle](#qwikbundle); } | |
| [injections?](#) | | [GlobalInjections](#globalinjections)[] | _(Optional)_ |
| [manifestHash](#) | | string | |
| [mapping](#) | | { [symbolName: string]: string; } | |
| [options?](#) | | { target?: string; buildMode?: string; entryStrategy?: { [key: string]: any; }; } | _(Optional)_ |
| [platform?](#) | | { [name: string]: string; } | _(Optional)_ |
| [symbols](#) | | { [symbolName: string]: [QwikSymbol](#qwiksymbol); } | |
| [version](#) | | string | |

[Edit this section](https://github.com/BuilderIO/qwik/tree/main/packages/qwik/src/optimizer/src/types.ts)

Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/routes/api/qwik/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@
}
],
"kind": "Interface",
"content": "```typescript\nexport interface RenderSSROptions \n```\n\n\n| Property | Modifiers | Type | Description |\n| --- | --- | --- | --- |\n| [base?](#) | | string | _(Optional)_ |\n| [beforeClose?](#) | | (contexts: QContext\\[\\], containerState: ContainerState, containsDynamic: boolean, textNodes: Map&lt;string, string&gt;) =&gt; Promise&lt;[JSXNode](#jsxnode)<!-- -->&gt; | _(Optional)_ |\n| [beforeContent?](#) | | [JSXNode](#jsxnode)<!-- -->&lt;string&gt;\\[\\] | _(Optional)_ |\n| [containerAttributes](#) | | Record&lt;string, string&gt; | |\n| [containerTagName](#) | | string | |\n| [serverData?](#) | | Record&lt;string, any&gt; | _(Optional)_ |\n| [stream](#) | | [StreamWriter](#streamwriter) | |",
"content": "```typescript\nexport interface RenderSSROptions \n```\n\n\n| Property | Modifiers | Type | Description |\n| --- | --- | --- | --- |\n| [base?](#) | | string | _(Optional)_ |\n| [beforeClose?](#) | | (contexts: QContext\\[\\], containerState: ContainerState, containsDynamic: boolean, textNodes: Map&lt;string, string&gt;) =&gt; Promise&lt;[JSXNode](#jsxnode)<!-- -->&gt; | _(Optional)_ |\n| [beforeContent?](#) | | [JSXNode](#jsxnode)<!-- -->&lt;string&gt;\\[\\] | _(Optional)_ |\n| [containerAttributes](#) | | Record&lt;string, string&gt; | |\n| [containerTagName](#) | | string | |\n| [manifestHash](#) | | string | |\n| [serverData?](#) | | Record&lt;string, any&gt; | _(Optional)_ |\n| [stream](#) | | [StreamWriter](#streamwriter) | |",
"editUrl": "https://github.com/BuilderIO/qwik/tree/main/packages/qwik/src/core/render/ssr/render-ssr.ts",
"mdFile": "qwik.renderssroptions.md"
},
Expand Down
1 change: 1 addition & 0 deletions packages/docs/src/routes/api/qwik/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,7 @@ export interface RenderSSROptions
| [beforeContent?](#) | | [JSXNode](#jsxnode)&lt;string&gt;[] | _(Optional)_ |
| [containerAttributes](#) | | Record&lt;string, string&gt; | |
| [containerTagName](#) | | string | |
| [manifestHash](#) | | string | |
| [serverData?](#) | | Record&lt;string, any&gt; | _(Optional)_ |
| [stream](#) | | [StreamWriter](#streamwriter) | |
Expand Down
1 change: 1 addition & 0 deletions packages/qwik-city/buildtime/vite/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ export function ssrDevMiddleware(ctx: BuildContext, server: ViteDevServer) {
Object.assign(serverRequestEv.platform, ctx.opts.platform);

const manifest: QwikManifest = {
manifestHash: '',
symbols: {},
mapping: {},
bundles: {},
Expand Down
2 changes: 2 additions & 0 deletions packages/qwik/src/core/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ export interface RenderSSROptions {
// (undocumented)
containerTagName: string;
// (undocumented)
manifestHash: string;
// (undocumented)
serverData?: Record<string, any>;
// (undocumented)
stream: StreamWriter;
Expand Down
2 changes: 2 additions & 0 deletions packages/qwik/src/core/render/ssr/render-ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export interface RenderSSROptions {
containsDynamic: boolean,
textNodes: Map<string, string>
) => Promise<JSXNode>;
manifestHash: string;
}

export interface SSRContext {
Expand Down Expand Up @@ -163,6 +164,7 @@ export const _renderSSR = async (node: JSXNode, opts: RenderSSROptions) => {
'q:render': qRender,
'q:base': opts.base,
'q:locale': opts.serverData?.locale,
'q:manifest-hash': opts.manifestHash,
};
const children = root === 'html' ? [node] : [headNodes, node];
if (root !== 'html') {
Expand Down
Loading

0 comments on commit 7833c6f

Please sign in to comment.