@qwik.dev/router 2.0.0-alpha.1 → 2.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/lib/adapters/azure-swa/vite/index.cjs +3 -3
  2. package/lib/adapters/azure-swa/vite/index.d.ts +13 -13
  3. package/lib/adapters/bun-server/vite/index.cjs +3 -3
  4. package/lib/adapters/bun-server/vite/index.d.ts +14 -14
  5. package/lib/adapters/cloud-run/vite/index.cjs +3 -3
  6. package/lib/adapters/cloud-run/vite/index.d.ts +13 -13
  7. package/lib/adapters/cloudflare-pages/vite/index.cjs +3 -3
  8. package/lib/adapters/cloudflare-pages/vite/index.d.ts +27 -27
  9. package/lib/adapters/deno-server/vite/index.cjs +3 -3
  10. package/lib/adapters/deno-server/vite/index.d.ts +14 -14
  11. package/lib/adapters/netlify-edge/vite/index.cjs +3 -3
  12. package/lib/adapters/netlify-edge/vite/index.d.ts +44 -44
  13. package/lib/adapters/node-server/vite/index.cjs +3 -3
  14. package/lib/adapters/node-server/vite/index.d.ts +14 -14
  15. package/lib/adapters/shared/vite/index.cjs +10 -3
  16. package/lib/adapters/shared/vite/index.d.ts +114 -114
  17. package/lib/adapters/shared/vite/index.mjs +7 -0
  18. package/lib/adapters/static/vite/index.cjs +10 -3
  19. package/lib/adapters/static/vite/index.d.ts +10 -10
  20. package/lib/adapters/static/vite/index.mjs +7 -0
  21. package/lib/adapters/vercel-edge/vite/index.cjs +3 -3
  22. package/lib/adapters/vercel-edge/vite/index.d.ts +45 -45
  23. package/lib/index.d.ts +878 -801
  24. package/lib/index.qwik.cjs +84 -84
  25. package/lib/index.qwik.mjs +64 -64
  26. package/lib/middleware/aws-lambda/index.d.ts +48 -50
  27. package/lib/middleware/azure-swa/index.d.ts +28 -28
  28. package/lib/middleware/bun/index.d.ts +35 -35
  29. package/lib/middleware/cloudflare-pages/index.d.ts +35 -35
  30. package/lib/middleware/deno/index.d.ts +47 -47
  31. package/lib/middleware/firebase/index.d.ts +26 -26
  32. package/lib/middleware/netlify-edge/index.d.ts +27 -27
  33. package/lib/middleware/node/index.cjs +3 -3
  34. package/lib/middleware/node/index.d.ts +64 -66
  35. package/lib/middleware/request-handler/index.cjs +37 -38
  36. package/lib/middleware/request-handler/index.d.ts +676 -681
  37. package/lib/middleware/request-handler/index.mjs +34 -35
  38. package/lib/middleware/vercel-edge/index.d.ts +26 -26
  39. package/lib/service-worker.cjs +13 -263
  40. package/lib/service-worker.d.ts +15 -4
  41. package/lib/service-worker.mjs +13 -263
  42. package/lib/static/index.cjs +3 -3
  43. package/lib/static/index.d.ts +96 -98
  44. package/lib/static/node.cjs +3 -3
  45. package/lib/vite/index.cjs +129 -247
  46. package/lib/vite/index.d.ts +154 -154
  47. package/lib/vite/index.mjs +127 -245
  48. package/package.json +10 -9
@@ -1,14 +1,25 @@
1
- import { jsx, jsxs, Fragment } from "@qwik.dev/core/jsx-runtime";
2
- import { createContextId, implicit$FirstArg, useContext, useVisibleTask$, noSerialize, useServerData, component$, untrack, $, sync$, Slot, withLocale, event$, useStyles$, useStore, useSignal, useContextProvider, useTask$, getLocale, jsx as jsx$1, SkipRender } from "@qwik.dev/core";
3
- import { isBrowser, isDev, isServer } from "@qwik.dev/core/build";
4
- import { _deserialize, _weakSerialize, _getContextElement, _waitUntilRendered, _getQContainerElement, _wrapProp, _getContextEvent, _serialize } from "@qwik.dev/core/internal";
1
+ import { jsx, Fragment, jsxs } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useErrorBoundary, useOnWindow, $, Slot, isBrowser, createContextId, implicit$FirstArg, useContext, useVisibleTask$, noSerialize, useServerData, useSignal, untrack, sync$, isDev, withLocale, event$, useStyles$, useStore, useContextProvider, useTask$, isServer, getLocale, jsx as jsx$1, SkipRender } from "@qwik.dev/core";
3
+ import { p } from "@qwik.dev/core/preloader";
4
+ import { _deserialize, _weakSerialize, _getContextElement, _waitUntilRendered, _getQContainerElement, _wrapStore, _getContextEvent, _serialize } from "@qwik.dev/core/internal";
5
5
  import * as qwikRouterConfig from "@qwik-router-config";
6
6
  import { z } from "zod";
7
7
  import { z as z2 } from "zod";
8
8
  import swRegister from "@qwik-router-sw-register";
9
+ const ErrorBoundary = component$((props) => {
10
+ const store2 = useErrorBoundary();
11
+ useOnWindow("qerror", $((e) => {
12
+ store2.error = e.detail.error;
13
+ }));
14
+ if (store2.error && props.fallback$) {
15
+ return /* @__PURE__ */ jsx(Fragment, {
16
+ children: props.fallback$(store2.error)
17
+ });
18
+ }
19
+ return /* @__PURE__ */ jsx(Slot, {});
20
+ });
9
21
  const MODULE_CACHE = /* @__PURE__ */ new WeakMap();
10
22
  const CLIENT_DATA_CACHE = /* @__PURE__ */ new Map();
11
- const PREFETCHED_NAVIGATE_PATHS = /* @__PURE__ */ new Set();
12
23
  const QACTION_KEY = "qaction";
13
24
  const QFN_KEY = "qfunc";
14
25
  const QDATA_KEY = "qdata";
@@ -46,15 +57,7 @@ const getClientNavPath = (props, baseUrl) => {
46
57
  }
47
58
  return null;
48
59
  };
49
- const shouldPrefetchData = (clientNavPath, currentLoc) => {
50
- if (clientNavPath) {
51
- const prefetchUrl = toUrl(clientNavPath, currentLoc.url);
52
- const currentUrl = toUrl("", currentLoc.url);
53
- return !isSamePath(prefetchUrl, currentUrl);
54
- }
55
- return false;
56
- };
57
- const shouldPrefetchSymbols = (clientNavPath, currentLoc) => {
60
+ const shouldPreload = (clientNavPath, currentLoc) => {
58
61
  if (clientNavPath) {
59
62
  const prefetchUrl = toUrl(clientNavPath, currentLoc.url);
60
63
  const currentUrl = toUrl("", currentLoc.url);
@@ -104,16 +107,8 @@ const newScrollState = () => {
104
107
  const prefetchSymbols = (path) => {
105
108
  if (isBrowser) {
106
109
  path = path.endsWith("/") ? path : path + "/";
107
- if (!PREFETCHED_NAVIGATE_PATHS.has(path)) {
108
- PREFETCHED_NAVIGATE_PATHS.add(path);
109
- document.dispatchEvent(new CustomEvent("qprefetch", {
110
- detail: {
111
- links: [
112
- path
113
- ]
114
- }
115
- }));
116
- }
110
+ path = path.length > 1 && path.startsWith("/") ? path.slice(1) : path;
111
+ p(path, 0.8);
117
112
  }
118
113
  };
119
114
  const loadClientData = async (url, element, opts) => {
@@ -129,7 +124,7 @@ const loadClientData = async (url, element, opts) => {
129
124
  }
130
125
  let resolveFn;
131
126
  if (!qData) {
132
- const fetchOptions = getFetchOptions(opts?.action);
127
+ const fetchOptions = getFetchOptions(opts?.action, opts?.clearCache);
133
128
  if (opts?.action) {
134
129
  opts.action.data = void 0;
135
130
  }
@@ -185,16 +180,19 @@ const loadClientData = async (url, element, opts) => {
185
180
  return v;
186
181
  });
187
182
  };
188
- const getFetchOptions = (action) => {
183
+ const getFetchOptions = (action, noCache) => {
189
184
  const actionData = action?.data;
190
185
  if (!actionData) {
191
- return {
192
- cache: "no-cache",
193
- headers: {
194
- "Cache-Control": "no-cache",
195
- Pragma: "no-cache"
196
- }
197
- };
186
+ if (noCache) {
187
+ return {
188
+ cache: "no-cache",
189
+ headers: {
190
+ "Cache-Control": "no-cache",
191
+ Pragma: "no-cache"
192
+ }
193
+ };
194
+ }
195
+ return void 0;
198
196
  }
199
197
  if (actionData instanceof FormData) {
200
198
  return {
@@ -238,14 +236,15 @@ const Link = component$((props) => {
238
236
  const nav = useNavigate();
239
237
  const loc = useLocation();
240
238
  const originalHref = props.href;
239
+ const anchorRef = useSignal();
241
240
  const { onClick$, prefetch: prefetchProp, reload, replaceState, scroll, ...linkProps } = /* @__PURE__ */ (() => props)();
242
241
  const clientNavPath = untrack(() => getClientNavPath({
243
242
  ...linkProps,
244
243
  reload
245
244
  }, loc));
246
245
  linkProps.href = clientNavPath || originalHref;
247
- const prefetchData = untrack(() => !!clientNavPath && prefetchProp !== false && prefetchProp !== "js" && shouldPrefetchData(clientNavPath, loc) || void 0);
248
- const prefetch = untrack(() => prefetchData || !!clientNavPath && prefetchProp !== false && shouldPrefetchSymbols(clientNavPath, loc));
246
+ const prefetchData = untrack(() => !!clientNavPath && prefetchProp !== false && prefetchProp !== "js" || void 0);
247
+ const prefetch = untrack(() => prefetchData || !!clientNavPath && prefetchProp !== false && shouldPreload(clientNavPath, loc));
249
248
  const handlePrefetch = prefetch ? $((_, elm) => {
250
249
  if (navigator.connection?.saveData) {
251
250
  return;
@@ -268,11 +267,7 @@ const Link = component$((props) => {
268
267
  }) : void 0;
269
268
  const handleClick = clientNavPath ? $(async (event, elm) => {
270
269
  if (event.defaultPrevented) {
271
- if (elm.hasAttribute("q:nbs")) {
272
- await nav(location.href, {
273
- type: "popstate"
274
- });
275
- } else if (elm.href) {
270
+ if (elm.href) {
276
271
  elm.setAttribute("aria-pressed", "true");
277
272
  await nav(elm.href, {
278
273
  forceReload: reload,
@@ -283,7 +278,14 @@ const Link = component$((props) => {
283
278
  }
284
279
  }
285
280
  }) : void 0;
281
+ useVisibleTask$(({ track }) => {
282
+ track(() => loc.url.pathname);
283
+ if (!isDev && anchorRef.value) {
284
+ handlePrefetch?.(void 0, anchorRef.value);
285
+ }
286
+ });
286
287
  return /* @__PURE__ */ jsx("a", {
288
+ ref: anchorRef,
287
289
  "q:link": !!clientNavPath,
288
290
  ...linkProps,
289
291
  onClick$: [
@@ -300,11 +302,6 @@ const Link = component$((props) => {
300
302
  linkProps.onFocus$,
301
303
  handlePrefetch
302
304
  ],
303
- // Don't prefetch on visible in dev mode
304
- onQVisible$: [
305
- linkProps.onQVisible$,
306
- !isDev ? handlePrefetch : void 0
307
- ],
308
305
  children: /* @__PURE__ */ jsx(Slot, {})
309
306
  });
310
307
  });
@@ -597,7 +594,6 @@ const spaInit = event$((_, el) => {
597
594
  if (!win[spa] && !win[initPopstate] && !win[initAnchors] && !win[initVisibility] && !win[initScroll]) {
598
595
  const currentPath = location.pathname + location.search;
599
596
  const historyPatch = "_qRouterHistoryPatch";
600
- const bootstrap = "_qRouterBootstrap";
601
597
  const scrollEnabled = "_qRouterScrollEnabled";
602
598
  const debounceTimeout = "_qRouterScrollDebounce";
603
599
  const scrollHistory = "_qRouterScroll";
@@ -629,15 +625,16 @@ const spaInit = event$((_, el) => {
629
625
  clearTimeout(win[debounceTimeout]);
630
626
  if (currentPath !== location.pathname + location.search) {
631
627
  const getContainer = (el2) => el2.closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])");
632
- const link = getContainer(el)?.querySelector("a[q\\:link]");
633
- if (link) {
634
- const container = getContainer(link);
635
- const bootstrapLink = link.cloneNode();
636
- bootstrapLink.setAttribute("q:nbs", "");
637
- bootstrapLink.style.display = "none";
638
- container.appendChild(bootstrapLink);
639
- win[bootstrap] = bootstrapLink;
640
- bootstrapLink.click();
628
+ const container = getContainer(el);
629
+ const domContainer = container.qContainer;
630
+ const hostElement = domContainer.vNodeLocate(el);
631
+ const nav = domContainer?.resolveContext(hostElement, {
632
+ id: "qc--n"
633
+ });
634
+ if (nav) {
635
+ nav(location.href, {
636
+ type: "popstate"
637
+ });
641
638
  } else {
642
639
  location.reload();
643
640
  }
@@ -967,7 +964,9 @@ const QwikRouterProvider = component$((props) => {
967
964
  if (navigation.dest.search && !isRedirect) {
968
965
  trackUrl.search = navigation.dest.search;
969
966
  }
970
- routeLocation.prevUrl = prevUrl;
967
+ if (!isSamePath(trackUrl, prevUrl)) {
968
+ routeLocation.prevUrl = prevUrl;
969
+ }
971
970
  routeLocation.url = trackUrl;
972
971
  routeLocation.params = {
973
972
  ...params
@@ -1104,8 +1103,6 @@ const QwikRouterProvider = component$((props) => {
1104
1103
  });
1105
1104
  removeEventListener("scroll", win._qRouterInitScroll);
1106
1105
  win._qRouterInitScroll = void 0;
1107
- win._qRouterBootstrap?.remove();
1108
- win._qRouterBootstrap = void 0;
1109
1106
  spaInit.resolve();
1110
1107
  }
1111
1108
  if (navType !== "popstate") {
@@ -1405,9 +1402,9 @@ const routeLoaderQrl = (loaderQrl, ...rest) => {
1405
1402
  For more information check: https://qwik.dev/docs/route-loader/
1406
1403
 
1407
1404
  If your are managing reusable logic or a library it is essential that this function is re-exported from within 'layout.tsx' or 'index.tsx file of the existing route otherwise it will not run or throw exception.
1408
- For more information check: https://qwik.dev/docs/cookbook/re-exporting-loaders/`);
1405
+ For more information check: https://qwik.dev/docs/re-exporting-loaders/`);
1409
1406
  }
1410
- return _wrapProp(state, id);
1407
+ return _wrapStore(state, id);
1411
1408
  });
1412
1409
  }
1413
1410
  loader.__brand = "server_loader";
@@ -1585,6 +1582,7 @@ const serverQrl = (qrl, options) => {
1585
1582
  headers: {
1586
1583
  ...headers,
1587
1584
  "Content-Type": "application/qwik-json",
1585
+ Accept: "application/json, application/qwik-json, text/qwik-json-stream, text/plain",
1588
1586
  // Required so we don't call accidentally
1589
1587
  "X-QRL": qrlHash
1590
1588
  },
@@ -1616,19 +1614,19 @@ const serverQrl = (qrl, options) => {
1616
1614
  } else if (contentType === "application/qwik-json") {
1617
1615
  const str = await res.text();
1618
1616
  const [obj] = _deserialize(str, ctxElm ?? document.documentElement);
1619
- if (res.status === 500) {
1617
+ if (res.status >= 400) {
1620
1618
  throw obj;
1621
1619
  }
1622
1620
  return obj;
1623
1621
  } else if (contentType === "application/json") {
1624
1622
  const obj = await res.json();
1625
- if (res.status === 500) {
1623
+ if (res.status >= 400) {
1626
1624
  throw obj;
1627
1625
  }
1628
1626
  return obj;
1629
1627
  } else if (contentType === "text/plain" || contentType === "text/html") {
1630
1628
  const str = await res.text();
1631
- if (res.status === 500) {
1629
+ if (res.status >= 400) {
1632
1630
  throw str;
1633
1631
  }
1634
1632
  return str;
@@ -1696,7 +1694,8 @@ const deserializeStream = async function* (stream, ctxElm, abortSignal) {
1696
1694
  reader.releaseLock();
1697
1695
  }
1698
1696
  };
1699
- const ServiceWorkerRegister = (props) => jsx$1("script", {
1697
+ const ServiceWorkerRegister = (props) => /* @__PURE__ */ jsx("script", {
1698
+ type: "module",
1700
1699
  dangerouslySetInnerHTML: swRegister,
1701
1700
  nonce: props.nonce
1702
1701
  });
@@ -1821,6 +1820,7 @@ function omitProps(obj, keys) {
1821
1820
  return omittedObj;
1822
1821
  }
1823
1822
  export {
1823
+ ErrorBoundary,
1824
1824
  Form,
1825
1825
  Link,
1826
1826
  QWIK_CITY_SCROLLER,
@@ -1,50 +1,48 @@
1
- /// <reference types="node" />
2
-
3
- import { Http2ServerRequest } from 'http2';
4
- import { IncomingMessage } from 'http';
5
- import { NodeRequestNextFunction } from '@qwik.dev/router/middleware/node';
6
- import type { QwikCityPlan } from '@qwik.dev/router';
7
- import type { QwikManifest } from '@qwik.dev/core/optimizer';
8
- import type { QwikRouterConfig } from '@qwik.dev/router';
9
- import type { Render } from '@qwik.dev/core/server';
10
- import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
11
- import { ServerResponse } from 'http';
12
-
13
- declare interface AwsOpt {
14
- render: Render;
15
- manifest: QwikManifest;
16
- qwikRouterConfig: QwikRouterConfig;
17
- /** @deprecated Use `QwikRouterConfig` instead. Will be removed in V3 */
18
- qwikCityPlan?: QwikCityPlan;
19
- }
20
-
21
- /**
22
- * @deprecated Use `createQwikRouter` instead. Will be removed in V3
23
- * @public
24
- */
25
- export declare const createQwikCity: typeof createQwikRouter;
26
-
27
- /** @public */
28
- export declare function createQwikRouter(opts: AwsOpt): {
29
- fixPath: (pathT: string) => string;
30
- router: (req: IncomingMessage | Http2ServerRequest, res: ServerResponse<IncomingMessage>, next: NodeRequestNextFunction) => Promise<void>;
31
- staticFile: (req: IncomingMessage | Http2ServerRequest, res: ServerResponse<IncomingMessage>, next: (e?: any) => void) => Promise<void>;
32
- notFound: (req: IncomingMessage | Http2ServerRequest, res: ServerResponse<IncomingMessage>, next: (e: any) => void) => Promise<void>;
33
- handle: (req: any, res: any) => void;
34
- };
35
-
36
- /** @public */
37
- export declare interface PlatformAwsLambda extends Object {
38
- }
39
-
40
- /**
41
- * @deprecated Use `QwikRouterAwsLambdaOptions` instead. Will be removed in V3
42
- * @public
43
- */
44
- export declare type QwikCityAwsLambdaOptions = QwikRouterAwsLambdaOptions;
45
-
46
- /** @public */
47
- export declare interface QwikRouterAwsLambdaOptions extends ServerRenderOptions {
48
- }
49
-
50
- export { }
1
+ import { Http2ServerRequest } from 'http2';
2
+ import { IncomingMessage } from 'http';
3
+ import { NodeRequestNextFunction } from '@qwik.dev/router/middleware/node';
4
+ import type { QwikCityPlan } from '@qwik.dev/router';
5
+ import type { QwikManifest } from '@qwik.dev/core/optimizer';
6
+ import type { QwikRouterConfig } from '@qwik.dev/router';
7
+ import type { Render } from '@qwik.dev/core/server';
8
+ import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
9
+ import { ServerResponse } from 'http';
10
+
11
+ declare interface AwsOpt {
12
+ render: Render;
13
+ manifest?: QwikManifest;
14
+ qwikRouterConfig: QwikRouterConfig;
15
+ /** @deprecated Use `QwikRouterConfig` instead. Will be removed in V3 */
16
+ qwikCityPlan?: QwikCityPlan;
17
+ }
18
+
19
+ /**
20
+ * @deprecated Use `createQwikRouter` instead. Will be removed in V3
21
+ * @public
22
+ */
23
+ export declare const createQwikCity: typeof createQwikRouter;
24
+
25
+ /** @public */
26
+ export declare function createQwikRouter(opts: AwsOpt): {
27
+ fixPath: (pathT: string) => string;
28
+ router: (req: IncomingMessage | Http2ServerRequest, res: ServerResponse, next: NodeRequestNextFunction) => Promise<void>;
29
+ staticFile: (req: IncomingMessage | Http2ServerRequest, res: ServerResponse, next: (e?: any) => void) => Promise<void>;
30
+ notFound: (req: IncomingMessage | Http2ServerRequest, res: ServerResponse, next: (e: any) => void) => Promise<void>;
31
+ handle: (req: any, res: any) => void;
32
+ };
33
+
34
+ /** @public */
35
+ export declare interface PlatformAwsLambda extends Object {
36
+ }
37
+
38
+ /**
39
+ * @deprecated Use `QwikRouterAwsLambdaOptions` instead. Will be removed in V3
40
+ * @public
41
+ */
42
+ export declare type QwikCityAwsLambdaOptions = QwikRouterAwsLambdaOptions;
43
+
44
+ /** @public */
45
+ export declare interface QwikRouterAwsLambdaOptions extends ServerRenderOptions {
46
+ }
47
+
48
+ export { }
@@ -1,28 +1,28 @@
1
- import type { AzureFunction } from '@azure/functions';
2
- import type { Context } from '@azure/functions';
3
- import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
4
-
5
- /**
6
- * @deprecated Use `createQwikRouter` instead. Will be removed in V3
7
- * @public
8
- */
9
- export declare const createQwikCity: typeof createQwikRouter;
10
-
11
- /** @public */
12
- export declare function createQwikRouter(opts: QwikRouterAzureOptions): AzureFunction;
13
-
14
- /** @public */
15
- export declare interface PlatformAzure extends Partial<Context> {
16
- }
17
-
18
- /**
19
- * @deprecated Use `QwikRouterAzureOptions` instead. Will be removed in V3
20
- * @public
21
- */
22
- export declare type QwikCityAzureOptions = QwikRouterAzureOptions;
23
-
24
- /** @public */
25
- export declare interface QwikRouterAzureOptions extends ServerRenderOptions {
26
- }
27
-
28
- export { }
1
+ import type { AzureFunction } from '@azure/functions';
2
+ import type { Context } from '@azure/functions';
3
+ import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
4
+
5
+ /**
6
+ * @deprecated Use `createQwikRouter` instead. Will be removed in V3
7
+ * @public
8
+ */
9
+ export declare const createQwikCity: typeof createQwikRouter;
10
+
11
+ /** @public */
12
+ export declare function createQwikRouter(opts: QwikRouterAzureOptions): AzureFunction;
13
+
14
+ /** @public */
15
+ export declare interface PlatformAzure extends Partial<Context> {
16
+ }
17
+
18
+ /**
19
+ * @deprecated Use `QwikRouterAzureOptions` instead. Will be removed in V3
20
+ * @public
21
+ */
22
+ export declare type QwikCityAzureOptions = QwikRouterAzureOptions;
23
+
24
+ /** @public */
25
+ export declare interface QwikRouterAzureOptions extends ServerRenderOptions {
26
+ }
27
+
28
+ export { }
@@ -1,35 +1,35 @@
1
- import type { ClientConn } from '@qwik.dev/router/middleware/request-handler';
2
- import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
3
-
4
- /**
5
- * @deprecated Use `createQwikRouter` instead. Will be removed in V3
6
- * @public
7
- */
8
- export declare const createQwikCity: typeof createQwikRouter;
9
-
10
- /** @public */
11
- export declare function createQwikRouter(opts: QwikRouterBunOptions): {
12
- router: (request: Request) => Promise<Response | null>;
13
- notFound: (request: Request) => Promise<Response>;
14
- staticFile: (request: Request) => Promise<Response | null>;
15
- };
16
-
17
- /**
18
- * @deprecated Use `QwikRouterBunOptions` instead. Will be removed in V3
19
- * @public
20
- */
21
- export declare type QwikCityBunOptions = QwikRouterBunOptions;
22
-
23
- /** @public */
24
- export declare interface QwikRouterBunOptions extends ServerRenderOptions {
25
- /** Options for serving static files */
26
- static?: {
27
- /** The root folder for statics files. Defaults to /dist */
28
- root?: string;
29
- /** Set the Cache-Control header for all static files */
30
- cacheControl?: string;
31
- };
32
- getClientConn?: (request: Request) => ClientConn;
33
- }
34
-
35
- export { }
1
+ import type { ClientConn } from '@qwik.dev/router/middleware/request-handler';
2
+ import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
3
+
4
+ /**
5
+ * @deprecated Use `createQwikRouter` instead. Will be removed in V3
6
+ * @public
7
+ */
8
+ export declare const createQwikCity: typeof createQwikRouter;
9
+
10
+ /** @public */
11
+ export declare function createQwikRouter(opts: QwikRouterBunOptions): {
12
+ router: (request: Request) => Promise<Response | null>;
13
+ notFound: (request: Request) => Promise<Response>;
14
+ staticFile: (request: Request) => Promise<Response | null>;
15
+ };
16
+
17
+ /**
18
+ * @deprecated Use `QwikRouterBunOptions` instead. Will be removed in V3
19
+ * @public
20
+ */
21
+ export declare type QwikCityBunOptions = QwikRouterBunOptions;
22
+
23
+ /** @public */
24
+ export declare interface QwikRouterBunOptions extends ServerRenderOptions {
25
+ /** Options for serving static files */
26
+ static?: {
27
+ /** The root folder for statics files. Defaults to /dist */
28
+ root?: string;
29
+ /** Set the Cache-Control header for all static files */
30
+ cacheControl?: string;
31
+ };
32
+ getClientConn?: (request: Request) => ClientConn;
33
+ }
34
+
35
+ export { }
@@ -1,35 +1,35 @@
1
- import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
2
-
3
- /**
4
- * @deprecated Use `createQwikRouter` instead. Will be removed in V3
5
- * @public
6
- */
7
- export declare const createQwikCity: typeof createQwikRouter;
8
-
9
- /** @public */
10
- export declare function createQwikRouter(opts: QwikRouterCloudflarePagesOptions): (request: PlatformCloudflarePages['request'], env: PlatformCloudflarePages['env'] & {
11
- ASSETS: {
12
- fetch: (req: Request) => Response;
13
- };
14
- }, ctx: PlatformCloudflarePages['ctx']) => Promise<Response>;
15
-
16
- /** @public */
17
- export declare interface PlatformCloudflarePages {
18
- request: Request;
19
- env?: Record<string, any>;
20
- ctx: {
21
- waitUntil: (promise: Promise<any>) => void;
22
- };
23
- }
24
-
25
- /**
26
- * @deprecated Use `QwikRouterCloudflarePagesOptions` instead. Will be removed in V3
27
- * @public
28
- */
29
- export declare type QwikCityCloudflarePagesOptions = QwikRouterCloudflarePagesOptions;
30
-
31
- /** @public */
32
- export declare interface QwikRouterCloudflarePagesOptions extends ServerRenderOptions {
33
- }
34
-
35
- export { }
1
+ import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
2
+
3
+ /**
4
+ * @deprecated Use `createQwikRouter` instead. Will be removed in V3
5
+ * @public
6
+ */
7
+ export declare const createQwikCity: typeof createQwikRouter;
8
+
9
+ /** @public */
10
+ export declare function createQwikRouter(opts: QwikRouterCloudflarePagesOptions): (request: PlatformCloudflarePages["request"], env: PlatformCloudflarePages["env"] & {
11
+ ASSETS: {
12
+ fetch: (req: Request) => Response;
13
+ };
14
+ }, ctx: PlatformCloudflarePages["ctx"]) => Promise<Response>;
15
+
16
+ /** @public */
17
+ export declare interface PlatformCloudflarePages {
18
+ request: Request;
19
+ env?: Record<string, any>;
20
+ ctx: {
21
+ waitUntil: (promise: Promise<any>) => void;
22
+ };
23
+ }
24
+
25
+ /**
26
+ * @deprecated Use `QwikRouterCloudflarePagesOptions` instead. Will be removed in V3
27
+ * @public
28
+ */
29
+ export declare type QwikCityCloudflarePagesOptions = QwikRouterCloudflarePagesOptions;
30
+
31
+ /** @public */
32
+ export declare interface QwikRouterCloudflarePagesOptions extends ServerRenderOptions {
33
+ }
34
+
35
+ export { }
@@ -1,47 +1,47 @@
1
- import type { ClientConn } from '@qwik.dev/router/middleware/request-handler';
2
- import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
3
-
4
- /**
5
- * @deprecated Use `createQwikRouter` instead. Will be removed in V3
6
- * @public
7
- */
8
- export declare const createQwikCity: typeof createQwikRouter;
9
-
10
- /** @public */
11
- export declare function createQwikRouter(opts: QwikRouterDenoOptions): {
12
- router: (request: Request, info: ServeHandlerInfo) => Promise<Response | null>;
13
- notFound: (request: Request) => Promise<Response>;
14
- staticFile: (request: Request) => Promise<Response | null>;
15
- };
16
-
17
- /** @public */
18
- export declare interface NetAddr {
19
- transport: 'tcp' | 'udp';
20
- hostname: string;
21
- port: number;
22
- }
23
-
24
- /**
25
- * @deprecated Use `QwikRouterDenoOptions` instead. Will be removed in V3
26
- * @public
27
- */
28
- export declare type QwikCityDenoOptions = QwikRouterDenoOptions;
29
-
30
- /** @public */
31
- export declare interface QwikRouterDenoOptions extends ServerRenderOptions {
32
- /** Options for serving static files */
33
- static?: {
34
- /** The root folder for statics files. Defaults to /dist */
35
- root?: string;
36
- /** Set the Cache-Control header for all static files */
37
- cacheControl?: string;
38
- };
39
- getClientConn?: (request: Request, info: ServeHandlerInfo) => ClientConn;
40
- }
41
-
42
- /** @public */
43
- export declare interface ServeHandlerInfo {
44
- remoteAddr: NetAddr;
45
- }
46
-
47
- export { }
1
+ import type { ClientConn } from '@qwik.dev/router/middleware/request-handler';
2
+ import type { ServerRenderOptions } from '@qwik.dev/router/middleware/request-handler';
3
+
4
+ /**
5
+ * @deprecated Use `createQwikRouter` instead. Will be removed in V3
6
+ * @public
7
+ */
8
+ export declare const createQwikCity: typeof createQwikRouter;
9
+
10
+ /** @public */
11
+ export declare function createQwikRouter(opts: QwikRouterDenoOptions): {
12
+ router: (request: Request, info: ServeHandlerInfo) => Promise<Response | null>;
13
+ notFound: (request: Request) => Promise<Response>;
14
+ staticFile: (request: Request) => Promise<Response | null>;
15
+ };
16
+
17
+ /** @public */
18
+ export declare interface NetAddr {
19
+ transport: 'tcp' | 'udp';
20
+ hostname: string;
21
+ port: number;
22
+ }
23
+
24
+ /**
25
+ * @deprecated Use `QwikRouterDenoOptions` instead. Will be removed in V3
26
+ * @public
27
+ */
28
+ export declare type QwikCityDenoOptions = QwikRouterDenoOptions;
29
+
30
+ /** @public */
31
+ export declare interface QwikRouterDenoOptions extends ServerRenderOptions {
32
+ /** Options for serving static files */
33
+ static?: {
34
+ /** The root folder for statics files. Defaults to /dist */
35
+ root?: string;
36
+ /** Set the Cache-Control header for all static files */
37
+ cacheControl?: string;
38
+ };
39
+ getClientConn?: (request: Request, info: ServeHandlerInfo) => ClientConn;
40
+ }
41
+
42
+ /** @public */
43
+ export declare interface ServeHandlerInfo {
44
+ remoteAddr: NetAddr;
45
+ }
46
+
47
+ export { }