create-qwik 0.0.33 → 0.0.34-dev20220701233003

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 (93) hide show
  1. package/create-qwik +45 -45
  2. package/index.js +9 -9
  3. package/package.json +2 -2
  4. package/starters/apps/base/gitignore +4 -0
  5. package/starters/apps/base/package.json +8 -8
  6. package/starters/apps/base/src/entry.dev.tsx +1 -1
  7. package/starters/apps/{library → base}/src/entry.ssr.tsx +1 -1
  8. package/starters/apps/base/src/root.tsx +1 -1
  9. package/starters/apps/blank/package.json +18 -0
  10. package/starters/apps/{starter → blank}/src/components/app/app.tsx +0 -0
  11. package/starters/apps/{starter → blank}/src/components/logo/logo.tsx +0 -0
  12. package/starters/apps/blank/src/entry.express.tsx +52 -0
  13. package/starters/apps/{todo → blank}/src/entry.ssr.tsx +1 -1
  14. package/starters/apps/{starter-partytown → blank}/src/global.css +0 -0
  15. package/starters/apps/{starter → blank}/src/root.tsx +1 -1
  16. package/starters/apps/library/package.json +0 -1
  17. package/starters/apps/library/src/root.tsx +1 -1
  18. package/starters/apps/qwik-city/package.json +4 -2
  19. package/starters/apps/qwik-city/src/components/footer/footer.css +21 -4
  20. package/starters/apps/qwik-city/src/components/footer/footer.tsx +23 -9
  21. package/starters/apps/qwik-city/src/components/head/analytics.tsx +13 -0
  22. package/starters/apps/qwik-city/src/components/head/head.tsx +37 -0
  23. package/starters/apps/qwik-city/src/components/head/social.tsx +10 -0
  24. package/starters/apps/qwik-city/src/components/header/header.css +34 -2
  25. package/starters/apps/qwik-city/src/components/header/header.tsx +41 -13
  26. package/starters/apps/qwik-city/src/components/menu/menu.css +3 -0
  27. package/starters/apps/qwik-city/src/components/menu/menu.tsx +39 -0
  28. package/starters/apps/qwik-city/src/root.tsx +8 -22
  29. package/starters/apps/qwik-city/src/routes/__auth/_layout.tsx +17 -0
  30. package/starters/apps/qwik-city/src/routes/__auth/sign-in.tsx +29 -0
  31. package/starters/apps/qwik-city/src/routes/__auth/sign-up.tsx +33 -0
  32. package/starters/apps/qwik-city/src/routes/_layout.tsx +15 -0
  33. package/starters/apps/qwik-city/src/routes/about-us.tsx +21 -0
  34. package/starters/apps/qwik-city/src/routes/api/[org]/[user].json/index.ts +42 -0
  35. package/starters/apps/qwik-city/src/routes/api/_layout-foo/api.css +14 -0
  36. package/starters/apps/qwik-city/src/routes/api/_layout-foo/index.tsx +40 -0
  37. package/starters/apps/qwik-city/src/routes/api/data.json.ts +21 -0
  38. package/starters/apps/qwik-city/src/routes/api/index@foo.tsx +36 -0
  39. package/starters/apps/qwik-city/src/routes/blog/[...slug].tsx +13 -0
  40. package/starters/apps/qwik-city/src/routes/blog/_layout/index.tsx +21 -0
  41. package/starters/apps/qwik-city/src/routes/blog/index.md +7 -0
  42. package/starters/apps/qwik-city/src/routes/dashboard/_layout-dashboard.tsx +18 -0
  43. package/starters/apps/qwik-city/src/routes/dashboard/index.tsx +9 -0
  44. package/starters/apps/qwik-city/src/routes/dashboard/profile@dashboard.tsx +10 -0
  45. package/starters/apps/qwik-city/src/routes/dashboard/settings/index@dashboard.tsx +10 -0
  46. package/starters/apps/qwik-city/src/routes/docs/[category]/[id]/index.tsx +15 -0
  47. package/starters/apps/qwik-city/src/routes/docs/_layout/docs.css +9 -0
  48. package/starters/apps/qwik-city/src/routes/docs/_layout/index.tsx +25 -0
  49. package/starters/apps/qwik-city/src/routes/docs/_menu.md +9 -0
  50. package/starters/apps/qwik-city/src/{pages/index.mdx → routes/docs/getting-started.mdx} +1 -1
  51. package/starters/apps/qwik-city/src/routes/docs/index.tsx +18 -0
  52. package/starters/apps/qwik-city/src/routes/docs/introduction/index.md +7 -0
  53. package/starters/apps/qwik-city/src/routes/index.tsx +11 -0
  54. package/starters/apps/qwik-city/tsconfig.json +24 -0
  55. package/starters/apps/qwik-city/vite.config.ts +3 -7
  56. package/starters/features/prettier/package.json +1 -1
  57. package/starters/features/react/package.json +26 -0
  58. package/starters/{apps/qwik-city → features/react}/src/entry.ssr.tsx +3 -2
  59. package/starters/features/react/src/react/app.tsx +14 -0
  60. package/starters/servers/cloudflare-pages/functions/[[path]].ts +1 -1
  61. package/starters/servers/cloudflare-pages/src/entry.cloudflare.tsx +2 -2
  62. package/starters/servers/express/src/entry.express.tsx +5 -38
  63. package/starters/servers/netlify/package.json +1 -1
  64. package/starters/apps/qwik-city/src/components/app/app.tsx +0 -13
  65. package/starters/apps/qwik-city/src/components/page/page.tsx +0 -24
  66. package/starters/apps/qwik-city/src/components/sidebar/sidebar.css +0 -12
  67. package/starters/apps/qwik-city/src/components/sidebar/sidebar.tsx +0 -54
  68. package/starters/apps/qwik-city/src/entry.dev.tsx +0 -13
  69. package/starters/apps/qwik-city/src/layouts/default/default.css +0 -171
  70. package/starters/apps/qwik-city/src/layouts/default/default.tsx +0 -24
  71. package/starters/apps/qwik-city/src/layouts/not-found/not-found.css +0 -0
  72. package/starters/apps/qwik-city/src/layouts/not-found/not-found.tsx +0 -18
  73. package/starters/apps/qwik-city/src/pages/INDEX +0 -16
  74. package/starters/apps/qwik-city/src/pages/blog/progressive.mdx +0 -70
  75. package/starters/apps/qwik-city/src/pages/blog/reactivity.mdx +0 -155
  76. package/starters/apps/qwik-city/src/pages/blog/resumable.mdx +0 -107
  77. package/starters/apps/starter/package.json +0 -10
  78. package/starters/apps/starter/src/entry.ssr.tsx +0 -15
  79. package/starters/apps/starter/src/global.css +0 -3
  80. package/starters/apps/starter-partytown/package.json +0 -13
  81. package/starters/apps/starter-partytown/src/components/app/app.tsx +0 -89
  82. package/starters/apps/starter-partytown/src/entry.ssr.tsx +0 -16
  83. package/starters/apps/starter-partytown/src/root.tsx +0 -36
  84. package/starters/apps/todo/package.json +0 -7
  85. package/starters/apps/todo/src/components/app/app.tsx +0 -39
  86. package/starters/apps/todo/src/components/app/base.css +0 -141
  87. package/starters/apps/todo/src/components/app/index.css +0 -378
  88. package/starters/apps/todo/src/components/body/body.tsx +0 -16
  89. package/starters/apps/todo/src/components/footer/footer.tsx +0 -63
  90. package/starters/apps/todo/src/components/header/header.tsx +0 -40
  91. package/starters/apps/todo/src/components/item/item.tsx +0 -76
  92. package/starters/apps/todo/src/root.tsx +0 -15
  93. package/starters/apps/todo/src/state/state.ts +0 -29
@@ -0,0 +1,33 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+ import type { HeadComponent } from '@builder.io/qwik-city';
3
+
4
+ export default component$(() => {
5
+ return (
6
+ <Host>
7
+ <h1>Sign Up</h1>
8
+ <form>
9
+ <label>
10
+ <span>Username</span>
11
+ <input type="text" />
12
+ </label>
13
+ <label>
14
+ <span>Password</span>
15
+ <input type="password" />
16
+ </label>
17
+ <label>
18
+ <span>Re-entry Password</span>
19
+ <input type="password" />
20
+ </label>
21
+ <button>Create Account</button>
22
+ </form>
23
+ </Host>
24
+ );
25
+ });
26
+
27
+ export const head: HeadComponent = () => {
28
+ return (
29
+ <>
30
+ <title>Sign Up</title>
31
+ </>
32
+ );
33
+ };
@@ -0,0 +1,15 @@
1
+ import { component$, Host, Slot } from '@builder.io/qwik';
2
+ import Footer from '../components/footer/footer';
3
+ import Header from '../components/header/header';
4
+
5
+ export default component$(() => {
6
+ return (
7
+ <Host>
8
+ <Header />
9
+ <main>
10
+ <Slot />
11
+ </main>
12
+ <Footer />
13
+ </Host>
14
+ );
15
+ });
@@ -0,0 +1,21 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+ import type { HeadComponent } from '@builder.io/qwik-city';
3
+
4
+ export default component$(() => {
5
+ return (
6
+ <Host>
7
+ <h1>About Us</h1>
8
+ <p>
9
+ <a href="/">Home</a>
10
+ </p>
11
+ </Host>
12
+ );
13
+ });
14
+
15
+ export const head: HeadComponent = () => {
16
+ return (
17
+ <>
18
+ <title>About Us</title>
19
+ </>
20
+ );
21
+ };
@@ -0,0 +1,42 @@
1
+ import type { EndpointHandler } from '@builder.io/qwik-city';
2
+ import os from 'os';
3
+
4
+ export const get: EndpointHandler = ({ request, params }) => {
5
+ const data = {
6
+ timestamp: Date.now(),
7
+ method: request.method,
8
+ url: request.url,
9
+ params,
10
+ os: os.platform(),
11
+ arch: os.arch(),
12
+ node: process.versions.node,
13
+ };
14
+
15
+ const res = new Response(JSON.stringify(data, null, 2), {
16
+ headers: {
17
+ 'Content-Type': 'application/json',
18
+ },
19
+ });
20
+
21
+ return res;
22
+ };
23
+
24
+ export const post: EndpointHandler = async ({ request, params }) => {
25
+ const data = {
26
+ timestamp: Date.now(),
27
+ method: request.method,
28
+ url: request.url,
29
+ params,
30
+ os: os.platform(),
31
+ arch: os.arch(),
32
+ node: process.versions.node,
33
+ };
34
+
35
+ const res = new Response(JSON.stringify(data, null, 2), {
36
+ headers: {
37
+ 'Content-Type': 'application/json',
38
+ },
39
+ });
40
+
41
+ return res;
42
+ };
@@ -0,0 +1,14 @@
1
+ .api {
2
+ display: grid;
3
+ grid-template-columns: 200px 1fr;
4
+ padding: 0;
5
+ }
6
+
7
+ .api-menu {
8
+ background: #eee;
9
+ padding-left: 20px;
10
+ }
11
+
12
+ .api-content {
13
+ padding-left: 20px;
14
+ }
@@ -0,0 +1,40 @@
1
+ import { component$, Host, Slot, useScopedStyles$ } from '@builder.io/qwik';
2
+ import type { HeadComponent } from '@builder.io/qwik-city';
3
+ import Footer from '../../../components/footer/footer';
4
+ import Header from '../../../components/header/header';
5
+ import styles from './api.css?inline';
6
+
7
+ export default component$(() => {
8
+ useScopedStyles$(styles);
9
+
10
+ return (
11
+ <Host>
12
+ <Header fullWidth={true} />
13
+ <main class="api">
14
+ <aside class="api-menu">
15
+ <h2>API</h2>
16
+ <ul>
17
+ <li>
18
+ <a href="/api/builder.io/oss.json">Org/User</a>
19
+ </li>
20
+ <li>
21
+ <a href="/api/data.json">Data</a>
22
+ </li>
23
+ </ul>
24
+ </aside>
25
+ <section class="api-content">
26
+ <Slot />
27
+ </section>
28
+ </main>
29
+ <Footer />
30
+ </Host>
31
+ );
32
+ });
33
+
34
+ export const head: HeadComponent = ({ location }) => {
35
+ return (
36
+ <>
37
+ <title>API: {location.pathname}</title>
38
+ </>
39
+ );
40
+ };
@@ -0,0 +1,21 @@
1
+ import type { EndpointHandler } from '@builder.io/qwik-city';
2
+ import os from 'os';
3
+
4
+ export const get: EndpointHandler = ({ request }) => {
5
+ const data = {
6
+ timestamp: Date.now(),
7
+ method: request.method,
8
+ url: request.url,
9
+ os: os.platform(),
10
+ arch: os.arch(),
11
+ node: process.versions.node,
12
+ };
13
+
14
+ const res = new Response(JSON.stringify(data, null, 2), {
15
+ headers: {
16
+ 'Content-Type': 'application/json',
17
+ },
18
+ });
19
+
20
+ return res;
21
+ };
@@ -0,0 +1,36 @@
1
+ import { component$, Host, useClientEffect$, useStore } from '@builder.io/qwik';
2
+
3
+ export default component$(() => {
4
+ const store = useStore({ timestamp: 0, os: '', arch: '', node: '' });
5
+
6
+ useClientEffect$(async () => {
7
+ const url = `/api/builder.io/oss.json`;
8
+ const rsp = await fetch(url);
9
+ const data: any = await rsp.json();
10
+
11
+ store.timestamp = data.timestamp;
12
+ store.os = data.os;
13
+ store.arch = data.arch;
14
+ store.node = data.node;
15
+ });
16
+
17
+ return (
18
+ <Host>
19
+ <h1>Qwik City Test API!</h1>
20
+
21
+ <ul>
22
+ <li>
23
+ <a href="/api/builder.io/oss.json">/api/[org]/[user].json</a>
24
+ </li>
25
+ <li>
26
+ <a href="/api/data.json">/api/data.json</a>
27
+ </li>
28
+ </ul>
29
+
30
+ <p>Timestamp: {store.timestamp}</p>
31
+ <p>OS: {store.os}</p>
32
+ <p>Arch: {store.arch}</p>
33
+ <p>Node: {store.node}</p>
34
+ </Host>
35
+ );
36
+ });
@@ -0,0 +1,13 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+ import { useLocation } from '@builder.io/qwik-city';
3
+
4
+ export default component$(() => {
5
+ const { pathname, params } = useLocation();
6
+
7
+ return (
8
+ <Host>
9
+ <h1>Blog {pathname}</h1>
10
+ <p>Slug: {params.slug}</p>
11
+ </Host>
12
+ );
13
+ });
@@ -0,0 +1,21 @@
1
+ import { component$, Host, Slot } from '@builder.io/qwik';
2
+
3
+ export default component$(() => {
4
+ return (
5
+ <Host>
6
+ <section class="blog-content">
7
+ <Slot />
8
+ </section>
9
+ <aside class="blog-menu">
10
+ <ul>
11
+ <li>
12
+ <a href="/blog/how-to-use-a-toaster">How to use a toaster</a>
13
+ </li>
14
+ <li>
15
+ <a href="/blog/how-to-crack-an-egg">How to crack an egg</a>
16
+ </li>
17
+ </ul>
18
+ </aside>
19
+ </Host>
20
+ );
21
+ });
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: Welcome to our Blog!
3
+ ---
4
+
5
+ # Welcome to our Blog!
6
+
7
+ Enjoy.
@@ -0,0 +1,18 @@
1
+ import { component$, Host, Slot } from '@builder.io/qwik';
2
+ import Footer from '../../components/footer/footer';
3
+ import Header from '../../components/header/header';
4
+
5
+ export default component$(() => {
6
+ return (
7
+ <Host>
8
+ <Header />
9
+ <main class="dashboard">
10
+ <aside class="dashboard-menu">Dashboard Menu</aside>
11
+ <section class="dashboard-content">
12
+ <Slot />
13
+ </section>
14
+ </main>
15
+ <Footer />
16
+ </Host>
17
+ );
18
+ });
@@ -0,0 +1,9 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+
3
+ export default component$(() => {
4
+ return (
5
+ <Host>
6
+ <h1>Dashboard</h1>
7
+ </Host>
8
+ );
9
+ });
@@ -0,0 +1,10 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+
3
+ export default component$(() => {
4
+ return (
5
+ <Host>
6
+ <h1>Profile</h1>
7
+ <p>My Profile</p>
8
+ </Host>
9
+ );
10
+ });
@@ -0,0 +1,10 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+
3
+ export default component$(() => {
4
+ return (
5
+ <Host>
6
+ <h1>Settings</h1>
7
+ <p>My Settings</p>
8
+ </Host>
9
+ );
10
+ });
@@ -0,0 +1,15 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+ import { useLocation } from '@builder.io/qwik-city';
3
+
4
+ export default component$(() => {
5
+ const loc = useLocation();
6
+
7
+ return (
8
+ <Host>
9
+ <h1>Docs</h1>
10
+ <p>pathname: {loc.pathname}</p>
11
+ <p>category: {loc.params.category}</p>
12
+ <p>id: {loc.params.id}</p>
13
+ </Host>
14
+ );
15
+ });
@@ -0,0 +1,9 @@
1
+ .docs {
2
+ display: grid;
3
+ grid-template-columns: 200px 1fr;
4
+ padding: 0;
5
+ }
6
+
7
+ .docs-content {
8
+ padding-left: 20px;
9
+ }
@@ -0,0 +1,25 @@
1
+ import { component$, Host, Slot, useStyles$ } from '@builder.io/qwik';
2
+ import type { HeadComponent } from '@builder.io/qwik-city';
3
+ import { Menu } from '../../../components/menu/menu';
4
+ import styles from './docs.css?inline';
5
+
6
+ export default component$(() => {
7
+ useStyles$(styles);
8
+
9
+ return (
10
+ <Host class="docs">
11
+ <Menu />
12
+ <section class="docs-content">
13
+ <Slot />
14
+ </section>
15
+ </Host>
16
+ );
17
+ });
18
+
19
+ export const head: HeadComponent = ({ resolved }) => {
20
+ return (
21
+ <>
22
+ <title>Docs: {resolved.title}</title>
23
+ </>
24
+ );
25
+ };
@@ -0,0 +1,9 @@
1
+ # Docs
2
+
3
+ ## Getting Started
4
+
5
+ - [Introduction](introduction/index.md)
6
+
7
+ ## Components
8
+
9
+ - [Basics](/docs/components/basics)
@@ -2,7 +2,7 @@
2
2
  title: Welcome
3
3
  ---
4
4
 
5
- import { Counter } from '../components/counter/counter';
5
+ import { Counter } from '~/components/counter/counter';
6
6
 
7
7
  # Welcome
8
8
 
@@ -0,0 +1,18 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+ import type { HeadComponent } from '@builder.io/qwik-city';
3
+
4
+ export default component$(() => {
5
+ return (
6
+ <Host>
7
+ <h1>Welcome to the Docs!</h1>
8
+ </Host>
9
+ );
10
+ });
11
+
12
+ export const head: HeadComponent = () => {
13
+ return (
14
+ <>
15
+ <title>Welcome!</title>
16
+ </>
17
+ );
18
+ };
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: Introduction
3
+ ---
4
+
5
+ # Introduction
6
+
7
+ Qwik is a new kind of web framework that can deliver instant loading web applications at any size or complexity. Your sites and apps can boot with less than 1kb of JS (_including_ your code, regardless of complexity), and achieve unheard of performance at scale.
@@ -0,0 +1,11 @@
1
+ import { component$, Host } from '@builder.io/qwik';
2
+
3
+ export default component$(() => {
4
+ return (
5
+ <Host>
6
+ <h1>Welcome to QwikCity</h1>
7
+
8
+ <p>The meta-framework for Qwik.</p>
9
+ </Host>
10
+ );
11
+ });
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "target": "ES2017",
5
+ "module": "ES2020",
6
+ "lib": ["es2020", "DOM"],
7
+ "jsx": "react-jsx",
8
+ "jsxImportSource": "@builder.io/qwik",
9
+ "strict": true,
10
+ "declaration": true,
11
+ "declarationDir": "lib/types",
12
+ "resolveJsonModule": true,
13
+ "moduleResolution": "node",
14
+ "esModuleInterop": true,
15
+ "skipLibCheck": true,
16
+ "incremental": true,
17
+ "isolatedModules": true,
18
+ "types": ["vite/client"],
19
+ "paths": {
20
+ "~/*": ["./src/*"]
21
+ }
22
+ },
23
+ "include": ["src"]
24
+ }
@@ -1,20 +1,16 @@
1
1
  import { defineConfig } from 'vite';
2
2
  import { qwikVite } from '@builder.io/qwik/optimizer';
3
3
  import { qwikCity } from '@builder.io/qwik-city/vite';
4
- import { resolve } from 'path';
4
+ import tsconfigPaths from 'vite-tsconfig-paths';
5
5
  /* VITE_IMPORTS */
6
6
 
7
7
  export default defineConfig(() => {
8
8
  return {
9
9
  /* VITE_CONFIG */
10
10
  plugins: [
11
- qwikCity({
12
- pagesDir: resolve('src', 'pages'),
13
- layouts: {
14
- default: resolve('src', 'layouts', 'default', 'default.tsx'),
15
- },
16
- }),
11
+ qwikCity(),
17
12
  qwikVite(/* VITE_QWIK */),
13
+ tsconfigPaths(),
18
14
  /* VITE_PLUGINS */
19
15
  ],
20
16
  };
@@ -5,6 +5,6 @@
5
5
  "fmt.check": "prettier --check ."
6
6
  },
7
7
  "devDependencies": {
8
- "prettier": "2.6.2"
8
+ "prettier": "2.7.1"
9
9
  }
10
10
  }
@@ -0,0 +1,26 @@
1
+ {
2
+ "description": "Prettier code formatter.",
3
+ "scripts": {
4
+ "fmt": "prettier --write .",
5
+ "fmt.check": "prettier --check ."
6
+ },
7
+ "devDependencies": {
8
+ "@builder.io/qwik-react": "0.0.4",
9
+ "@emotion/react": "11.9.3",
10
+ "@emotion/server": "11.4.0",
11
+ "@emotion/styled": "11.9.3",
12
+ "@mui/material": "5.8.6",
13
+ "@types/react": "18.0.14",
14
+ "@types/react-dom": "18.0.5",
15
+ "react": "18.2.0",
16
+ "react-dom": "18.2.0"
17
+ },
18
+ "__qwik__": {
19
+ "priority": -1,
20
+ "vite": {
21
+ "VITE_IMPORTS": "import { qwikReact } from '@builder.io/qwik-react';",
22
+ "VITE_CONFIG": "",
23
+ "VITE_PLUGINS": "qwikReact(),"
24
+ }
25
+ }
26
+ }
@@ -1,6 +1,7 @@
1
- import { renderToString, RenderOptions } from '@builder.io/qwik/server';
1
+ import type { RenderOptions } from '@builder.io/qwik/server';
2
+ import { renderToString } from '@builder.io/qwik-react';
2
3
  import { manifest } from '@qwik-client-manifest';
3
- import { Root } from './root';
4
+ import Root from './root';
4
5
 
5
6
  export function render(opts: RenderOptions) {
6
7
  return renderToString(<Root />, {
@@ -0,0 +1,14 @@
1
+ /** @jsxImportSource react */
2
+
3
+ import { qwikify$ } from '@builder.io/qwik-react';
4
+ import { Button } from '@mui/material';
5
+
6
+ export function ReactCmp() {
7
+ return (
8
+ <>
9
+ <Button>Button</Button>
10
+ </>
11
+ );
12
+ }
13
+
14
+ export const ReactRoot = qwikify$(ReactCmp);
@@ -2,4 +2,4 @@
2
2
 
3
3
  // Cloudflare Pages Functions
4
4
  // https://developers.cloudflare.com/pages/platform/functions/
5
- export { onRequestGet } from '../server/entry.cloudflare.js';
5
+ export { onRequest } from '../server/entry.cloudflare.js';
@@ -3,7 +3,7 @@ import { render } from './entry.ssr';
3
3
  /**
4
4
  * Cloudflare Pages Request Handler
5
5
  */
6
- export const onRequestGet = async ({ request, next, waitUntil }: any) => {
6
+ export const onRequest: PagesFunction = async ({ request, next, waitUntil }) => {
7
7
  try {
8
8
  const url = new URL(request.url);
9
9
 
@@ -13,7 +13,7 @@ export const onRequestGet = async ({ request, next, waitUntil }: any) => {
13
13
  }
14
14
 
15
15
  // Do not using caching during development
16
- const useCache = url.hostname !== 'localhost';
16
+ const useCache = url.hostname !== 'localhost' && request.method === 'GET';
17
17
 
18
18
  // Early return from cache
19
19
  const cache = await caches.open('custom:qwik');
@@ -1,51 +1,18 @@
1
1
  import express from 'express';
2
2
  import { join } from 'path';
3
+ import cityPlan from '@qwik-city-plan';
4
+ import { qwikCity } from '@builder.io/qwik-city/adaptors/express';
3
5
  import { render } from './entry.ssr';
4
6
 
5
- /**
6
- * Create an express server
7
- * https://expressjs.com/
8
- */
9
7
  const app = express();
10
8
 
11
- /**
12
- * Serve static client build files,
13
- * hashed filenames, immutable cache-control
14
- */
15
9
  app.use(
16
- '/build',
17
- express.static(join(__dirname, '..', 'dist', 'build'), {
18
- immutable: true,
19
- maxAge: '1y',
10
+ qwikCity(render, {
11
+ ...cityPlan,
12
+ staticDir: join(__dirname, '..', 'dist'),
20
13
  })
21
14
  );
22
15
 
23
- /**
24
- * Serve static public files at the root
25
- */
26
- app.use(express.static(join(__dirname, '..', 'dist'), { index: false }));
27
-
28
- /**
29
- * Server-Side Render Qwik application
30
- */
31
- app.get('/*', async (req, res, next) => {
32
- try {
33
- // Render the Root component to a string
34
- const result = await render({
35
- url: req.url,
36
- });
37
-
38
- // respond with SSR'd HTML
39
- res.send(result.html);
40
- } catch (e) {
41
- // Error while server-side rendering
42
- next(e);
43
- }
44
- });
45
-
46
- /**
47
- * Start the express server
48
- */
49
16
  app.listen(8080, () => {
50
17
  /* eslint-disable */
51
18
  console.log(`http://localhost:8080/`);
@@ -5,7 +5,7 @@
5
5
  "build.ssr": "vite build --ssr src/entry.netlify.ts"
6
6
  },
7
7
  "devDependencies": {
8
- "@netlify/vite-plugin-netlify-edge": "^1.1.0"
8
+ "@netlify/vite-plugin-netlify-edge": "1.1.0"
9
9
  },
10
10
  "__qwik__": {
11
11
  "priority": -1,
@@ -1,13 +0,0 @@
1
- import { component$, Host } from '@builder.io/qwik';
2
- import { Page } from '../page/page';
3
- import { useQwikCity } from '@builder.io/qwik-city';
4
-
5
- export const App = component$(() => {
6
- useQwikCity();
7
-
8
- return (
9
- <Host>
10
- <Page />
11
- </Host>
12
- );
13
- });