create-qwik 0.0.39-dev20220722190315 → 0.0.39-dev20220801194759
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.
- package/package.json +1 -1
- package/starters/apps/base/package.json +2 -2
- package/starters/apps/base/src/entry.dev.tsx +4 -2
- package/starters/apps/base/src/entry.ssr.tsx +3 -3
- package/starters/apps/blank/src/entry.express.tsx +8 -2
- package/starters/apps/blank/src/entry.ssr.tsx +3 -3
- package/starters/apps/qwik-city/package.json +1 -1
- package/starters/apps/qwik-city/src/root.tsx +1 -1
- package/starters/apps/qwik-city/src/routes/blog/[...slug].tsx +1 -1
- package/starters/apps/qwik-city/src/routes/products/[id].tsx +2 -2
- package/starters/features/react/src/entry.ssr.tsx +1 -1
- package/starters/features/tailwindcss/{postcss.config.js → postcss.config.cjs} +0 -0
- package/starters/features/tailwindcss/{tailwind.config.js → tailwind.config.cjs} +0 -0
- package/starters/servers/cloudflare-pages/src/entry.cloudflare.tsx +1 -1
- package/starters/servers/express/src/entry.express.tsx +1 -1
- package/starters/servers/netlify/src/entry.netlify.ts +1 -1
package/package.json
CHANGED
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"typecheck": "tsc --incremental --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@builder.io/qwik": "0.0.39-
|
|
18
|
+
"@builder.io/qwik": "0.0.39-dev20220801194759",
|
|
19
19
|
"@types/eslint": "8.4.5",
|
|
20
20
|
"@types/node": "latest",
|
|
21
21
|
"@typescript-eslint/eslint-plugin": "5.30.7",
|
|
22
22
|
"@typescript-eslint/parser": "5.30.7",
|
|
23
|
-
"eslint-plugin-qwik": "0.0.39-
|
|
23
|
+
"eslint-plugin-qwik": "0.0.39-dev20220801194759",
|
|
24
24
|
"eslint": "8.20.0",
|
|
25
25
|
"node-fetch": "3.2.9",
|
|
26
26
|
"typescript": "4.7.4",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { render } from '@builder.io/qwik';
|
|
1
|
+
import { render, RenderOptions } from '@builder.io/qwik';
|
|
2
2
|
import Root from './root';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -10,4 +10,6 @@ import Root from './root';
|
|
|
10
10
|
* - More code is transferred to the browser than in SSR mode.
|
|
11
11
|
* - Optimizer/Serialization/Deserialization code is not exercised!
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
export default function (opts: RenderOptions) {
|
|
14
|
+
return render(document, <Root />, opts);
|
|
15
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
|
|
2
2
|
import { manifest } from '@qwik-client-manifest';
|
|
3
3
|
import Root from './root';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Server-Side Render method to be called by a server.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export default function (opts: RenderToStreamOptions) {
|
|
9
9
|
// Render the Root component to a string
|
|
10
10
|
// Pass in the manifest that was generated from the client build
|
|
11
|
-
return
|
|
11
|
+
return renderToStream(<Root />, {
|
|
12
12
|
manifest,
|
|
13
13
|
...opts,
|
|
14
14
|
});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
-
import {
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import render from './entry.ssr';
|
|
5
|
+
|
|
6
|
+
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* Create an express server
|
|
@@ -32,11 +35,14 @@ app.get('/*', async (req, res, next) => {
|
|
|
32
35
|
try {
|
|
33
36
|
// Render the Root component to a string
|
|
34
37
|
const result = await render({
|
|
38
|
+
stream: res,
|
|
35
39
|
url: req.url,
|
|
36
40
|
});
|
|
37
41
|
|
|
38
42
|
// respond with SSR'd HTML
|
|
39
|
-
|
|
43
|
+
if ('html' in result) {
|
|
44
|
+
res.send((result as any).html);
|
|
45
|
+
}
|
|
40
46
|
} catch (e) {
|
|
41
47
|
// Error while server-side rendering
|
|
42
48
|
next(e);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { renderToStream, RenderToStreamOptions } from '@builder.io/qwik/server';
|
|
2
2
|
import { manifest } from '@qwik-client-manifest';
|
|
3
3
|
import Root from './root';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Server-Side Render method to be called by a server.
|
|
7
7
|
*/
|
|
8
|
-
export function
|
|
8
|
+
export default function (opts: RenderToStreamOptions) {
|
|
9
9
|
// Render the Root component to a string
|
|
10
10
|
// Pass in the manifest that was generated from the client build
|
|
11
|
-
return
|
|
11
|
+
return renderToStream(<Root />, {
|
|
12
12
|
manifest,
|
|
13
13
|
...opts,
|
|
14
14
|
});
|
|
@@ -2,7 +2,7 @@ import { component$, Host, Resource } from '@builder.io/qwik';
|
|
|
2
2
|
import { useEndpoint, DocumentHead, EndpointHandler } from '@builder.io/qwik-city';
|
|
3
3
|
|
|
4
4
|
export default component$(() => {
|
|
5
|
-
const resource = useEndpoint<
|
|
5
|
+
const resource = useEndpoint<typeof onGet>();
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
8
|
<Host>
|
|
@@ -6,7 +6,7 @@ export default component$(() => {
|
|
|
6
6
|
const { params, pathname } = useLocation();
|
|
7
7
|
const store = useStore({ productFetchData: '' });
|
|
8
8
|
|
|
9
|
-
const resource = useEndpoint<
|
|
9
|
+
const resource = useEndpoint<typeof onGet>();
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
12
|
<Host>
|
|
@@ -99,7 +99,7 @@ export const onGet: EndpointHandler<EndpointData> = async ({ params, response })
|
|
|
99
99
|
if (!productPrice) {
|
|
100
100
|
// Product data not found
|
|
101
101
|
// but the data is still given to the renderer to decide what to do
|
|
102
|
-
response.status
|
|
102
|
+
response.status = 404;
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -3,7 +3,7 @@ import { renderToString } from '@builder.io/qwik-react';
|
|
|
3
3
|
import { manifest } from '@qwik-client-manifest';
|
|
4
4
|
import Root from './root';
|
|
5
5
|
|
|
6
|
-
export function
|
|
6
|
+
export default function (opts: RenderOptions) {
|
|
7
7
|
return renderToString(<Root />, {
|
|
8
8
|
manifest,
|
|
9
9
|
...opts,
|
|
File without changes
|
|
File without changes
|
|
@@ -3,7 +3,7 @@ import { fileURLToPath } from 'url';
|
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import cityPlan from '@qwik-city-plan';
|
|
5
5
|
import { qwikCity } from '@builder.io/qwik-city/middleware/express';
|
|
6
|
-
import
|
|
6
|
+
import render from './entry.ssr';
|
|
7
7
|
|
|
8
8
|
const app = express();
|
|
9
9
|
|