Skip to content

Commit 12be2e5

Browse files
update API's
1 parent adb1f82 commit 12be2e5

6 files changed

Lines changed: 67 additions & 14 deletions

File tree

packages/docs/src/routes/api/qwik-optimizer/api.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,20 @@
620620
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/types.ts",
621621
"mdFile": "qwik.sourcemapsoption.md"
622622
},
623+
{
624+
"name": "symbolMapper",
625+
"id": "symbolmapper",
626+
"hierarchy": [
627+
{
628+
"name": "symbolMapper",
629+
"id": "symbolmapper"
630+
}
631+
],
632+
"kind": "Variable",
633+
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nFor a given symbol (QRL such as `onKeydown$`<!-- -->) the server needs to know which bundle the symbol is in.\n\nNormally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.\n\nThis would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function above. For Vite the given path is fixed for a given symbol.\n\nWe export this symbolMapper function for systems that do not use Qwik's ssr dev server.\n\n\n```typescript\nsymbolMapper: ((symbolName: string, mapper: any, parent: string | undefined) => [string, string]) | undefined\n```",
634+
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/plugins/vite-dev-server.ts",
635+
"mdFile": "qwik.symbolmapper.md"
636+
},
623637
{
624638
"name": "SymbolMapper",
625639
"id": "symbolmapper",
@@ -630,7 +644,7 @@
630644
}
631645
],
632646
"kind": "TypeAlias",
633-
"content": "```typescript\nexport type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;\n```",
647+
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nFor a given symbol (QRL such as `onKeydown$`<!-- -->) the server needs to know which bundle the symbol is in.\n\nNormally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.\n\nThis would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function above. For Vite the given path is fixed for a given symbol.\n\nWe export this symbolMapper function for systems that do not use Qwik's ssr dev server.\n\n\n```typescript\nsymbolMapper: ((symbolName: string, mapper: any, parent: string | undefined) => [string, string]) | undefined\n```",
634648
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/types.ts",
635649
"mdFile": "qwik.symbolmapper.md"
636650
},

packages/docs/src/routes/api/qwik-optimizer/index.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,13 +2764,46 @@ export type SourceMapsOption = "external" | "inline" | undefined | null;
27642764

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

2767+
## symbolMapper
2768+
2769+
> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
2770+
2771+
For a given symbol (QRL such as `onKeydown$`) the server needs to know which bundle the symbol is in.
2772+
2773+
Normally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.
2774+
2775+
This would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function above. For Vite the given path is fixed for a given symbol.
2776+
2777+
We export this symbolMapper function for systems that do not use Qwik's ssr dev server.
2778+
2779+
```typescript
2780+
symbolMapper: ((
2781+
symbolName: string,
2782+
mapper: any,
2783+
parent: string | undefined,
2784+
) => [string, string]) | undefined;
2785+
```
2786+
2787+
[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/optimizer/src/plugins/vite-dev-server.ts)
2788+
27672789
## SymbolMapper
27682790

2791+
> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
2792+
2793+
For a given symbol (QRL such as `onKeydown$`) the server needs to know which bundle the symbol is in.
2794+
2795+
Normally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.
2796+
2797+
This would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function above. For Vite the given path is fixed for a given symbol.
2798+
2799+
We export this symbolMapper function for systems that do not use Qwik's ssr dev server.
2800+
27692801
```typescript
2770-
export type SymbolMapper = Record<
2771-
string,
2772-
readonly [symbol: string, chunk: string]
2773-
>;
2802+
symbolMapper: ((
2803+
symbolName: string,
2804+
mapper: any,
2805+
parent: string | undefined,
2806+
) => [string, string]) | undefined;
27742807
```
27752808

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

packages/docs/src/routes/api/qwik/api.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@
17601760
}
17611761
],
17621762
"kind": "Function",
1763-
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nLoad the prefetch graph for the container.\n\nEach Qwik container needs to include its own prefetch graph.\n\n\n```typescript\nPrefetchGraph: (opts?: {\n base?: string;\n manifestHash?: string;\n manifestURL?: string;\n nonce?: string;\n}) => JSXNode<\"script\">\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\nopts\n\n\n</td><td>\n\n{ base?: string; manifestHash?: string; manifestURL?: string; nonce?: string; }\n\n\n</td><td>\n\n_(Optional)_ Options for the loading prefetch graph.\n\n- `base` - Base of the graph. For a default installation this will default to the q:base value `/build/`<!-- -->. But if more than one MFE is installed on the page, then each MFE needs to have its own base. - `manifestHash` - Hash of the manifest file to load. If not provided the hash will be extracted from the container attribute `q:manifest-hash` and assume the default build file `${base}/q-bundle-graph-${manifestHash}.json`<!-- -->. - `manifestURL` - URL of the manifest file to load if non-standard bundle graph location name.\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nJSXNode&lt;\"script\"&gt;",
1763+
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nLoad the prefetch graph for the container.\n\nEach Qwik container needs to include its own prefetch graph.\n\n\n```typescript\nPrefetchGraph: (opts?: {\n base?: string;\n manifestHash?: string;\n manifestURL?: string;\n nonce?: string;\n}) => JSXNode<\"script\">\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\nopts\n\n\n</td><td>\n\n{ base?: string; manifestHash?: string; manifestURL?: string; nonce?: string; }\n\n\n</td><td>\n\n_(Optional)_ Options for the loading prefetch graph.\n\n- `base` - Base of the graph. For a default installation this will default to the q:base value `/build/`<!-- -->. But if more than one MFE is installed on the page, then each MFE needs to have its own base. - `manifestHash` - Hash of the manifest file to load. If not provided the hash will be extracted from the container attribute `q:manifest-hash` and assume the default build file `${base}/q-bundle-graph-${manifestHash}.json`<!-- -->. - `manifestURL` - URL of the manifest file to load if non-standard bundle graph location name.\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\n[JSXNode](#jsxnode)<!-- -->&lt;\"script\"&gt;",
17641764
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/components/prefetch.ts",
17651765
"mdFile": "qwik.prefetchgraph.md"
17661766
},
@@ -1774,7 +1774,7 @@
17741774
}
17751775
],
17761776
"kind": "Function",
1777-
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nInstall a service worker which will prefetch the bundles.\n\nThere can only be one service worker per page. Because there can be many separate Qwik Containers on the page each container needs to load its prefetch graph using `PrefetchGraph` component.\n\n\n```typescript\nPrefetchServiceWorker: (opts: {\n base?: string;\n scope?: string;\n path?: string;\n verbose?: boolean;\n fetchBundleGraph?: boolean;\n nonce?: string;\n}) => JSXNode<'script'>\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\nopts\n\n\n</td><td>\n\n{ base?: string; scope?: string; path?: string; verbose?: boolean; fetchBundleGraph?: boolean; nonce?: string; }\n\n\n</td><td>\n\nOptions for the prefetch service worker.\n\n- `base` - Base URL for the service worker `import.meta.env.BASE_URL` or `/`<!-- -->. Default is `import.meta.env.BASE_URL` - `scope` - Base URL for when the service-worker will activate. Default is `/` - `path` - Path to the service worker. Default is `qwik-prefetch-service-worker.js` unless you pass a path that starts with a `/` then the base is ignored. Default is `qwik-prefetch-service-worker.js` - `verbose` - Verbose logging for the service worker installation. Default is `false` - `nonce` - Optional nonce value for security purposes, defaults to `undefined`<!-- -->.\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\nJSXNode&lt;'script'&gt;",
1777+
"content": "> This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.\n> \n\nInstall a service worker which will prefetch the bundles.\n\nThere can only be one service worker per page. Because there can be many separate Qwik Containers on the page each container needs to load its prefetch graph using `PrefetchGraph` component.\n\n\n```typescript\nPrefetchServiceWorker: (opts: {\n base?: string;\n scope?: string;\n path?: string;\n verbose?: boolean;\n fetchBundleGraph?: boolean;\n nonce?: string;\n}) => JSXNode<'script'>\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\nopts\n\n\n</td><td>\n\n{ base?: string; scope?: string; path?: string; verbose?: boolean; fetchBundleGraph?: boolean; nonce?: string; }\n\n\n</td><td>\n\nOptions for the prefetch service worker.\n\n- `base` - Base URL for the service worker `import.meta.env.BASE_URL` or `/`<!-- -->. Default is `import.meta.env.BASE_URL` - `scope` - Base URL for when the service-worker will activate. Default is `/` - `path` - Path to the service worker. Default is `qwik-prefetch-service-worker.js` unless you pass a path that starts with a `/` then the base is ignored. Default is `qwik-prefetch-service-worker.js` - `verbose` - Verbose logging for the service worker installation. Default is `false` - `nonce` - Optional nonce value for security purposes, defaults to `undefined`<!-- -->.\n\n\n</td></tr>\n</tbody></table>\n**Returns:**\n\n[JSXNode](#jsxnode)<!-- -->&lt;'script'&gt;",
17781778
"editUrl": "https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/components/prefetch.ts",
17791779
"mdFile": "qwik.prefetchserviceworker.md"
17801780
},

packages/docs/src/routes/api/qwik/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3625,7 +3625,7 @@ _(Optional)_ Options for the loading prefetch graph.
36253625
</tbody></table>
36263626
**Returns:**
36273627
3628-
JSXNode&lt;"script"&gt;
3628+
[JSXNode](#jsxnode)&lt;"script"&gt;
36293629
36303630
[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/components/prefetch.ts)
36313631
@@ -3679,7 +3679,7 @@ Options for the prefetch service worker.
36793679
</tbody></table>
36803680
**Returns:**
36813681
3682-
JSXNode&lt;'script'&gt;
3682+
[JSXNode](#jsxnode)&lt;'script'&gt;
36833683
36843684
[Edit this section](https://github.com/QwikDev/qwik/tree/main/packages/qwik/src/core/components/prefetch.ts)
36853685

packages/qwik/src/optimizer/src/api.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ export type SourceMapsOption = 'external' | 'inline' | undefined | null;
378378
// @public (undocumented)
379379
export type SymbolMapper = Record<string, readonly [symbol: string, chunk: string]>;
380380

381+
// @alpha
382+
export let symbolMapper: ((symbolName: string, mapper: any, parent: string | undefined) => [string, string]) | undefined;
383+
381384
// @public (undocumented)
382385
export type SymbolMapperFn = (symbolName: string, mapper: SymbolMapper | undefined, parent?: string) => readonly [symbol: string, chunk: string] | undefined;
383386

packages/qwik/src/optimizer/src/plugins/vite-dev-server.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,18 @@ function createSymbolMapper(
6464
}
6565

6666
/**
67-
* ```
68-
* For a given symbol (QRL such as `onKeydown$`) the server needs to know which bundle the symbol is in.
67+
* For a given symbol (QRL such as `onKeydown$`) the server needs to know which bundle the symbol is
68+
* in.
6969
*
70-
* Normally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full client build.
70+
* Normally this is provided by Qwik's `q-manifest` . But `q-manifest` only exists after a full
71+
* client build.
7172
*
72-
* This would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL using the symbolMapper function above. For Vite the given path is fixed for a given symbol.
73+
* This would be a problem in dev mode. So in dev mode the symbol is mapped to the expected URL
74+
* using the symbolMapper function above. For Vite the given path is fixed for a given symbol.
7375
*
7476
* We export this symbolMapper function for systems that do not use Qwik's ssr dev server.
75-
* ```
77+
*
78+
* @alpha
7679
*/
7780
export let symbolMapper:
7881
| ((symbolName: string, mapper: any, parent: string | undefined) => [string, string])

0 commit comments

Comments
 (0)