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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-qwik",
3
- "version": "0.0.39-dev20220722190315",
3
+ "version": "0.0.39-dev20220801194759",
4
4
  "description": "Interactive CLI and API for generating Qwik projects.",
5
5
  "bin": "create-qwik",
6
6
  "main": "index.js",
@@ -15,12 +15,12 @@
15
15
  "typecheck": "tsc --incremental --noEmit"
16
16
  },
17
17
  "devDependencies": {
18
- "@builder.io/qwik": "0.0.39-dev20220722190315",
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-dev20220722190315",
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
- render(document, <Root />);
13
+ export default function (opts: RenderOptions) {
14
+ return render(document, <Root />, opts);
15
+ }
@@ -1,14 +1,14 @@
1
- import { renderToString, RenderOptions } from '@builder.io/qwik/server';
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 render(opts?: RenderOptions) {
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 renderToString(<Root />, {
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 { render } from './entry.ssr';
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
- res.send(result.html);
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 { renderToString, RenderOptions } from '@builder.io/qwik/server';
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 render(opts?: RenderOptions) {
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 renderToString(<Root />, {
11
+ return renderToStream(<Root />, {
12
12
  manifest,
13
13
  ...opts,
14
14
  });
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "type": "module",
16
16
  "devDependencies": {
17
- "@builder.io/qwik-city": "0.0.25",
17
+ "@builder.io/qwik-city": "0.0.26",
18
18
  "vite-tsconfig-paths": "3.5.0"
19
19
  }
20
20
  }
@@ -6,7 +6,7 @@ import './global.css';
6
6
 
7
7
  export default () => {
8
8
  return (
9
- <Html lang="en">
9
+ <Html lang="en" dir="ltr">
10
10
  <Head />
11
11
  <Body />
12
12
  </Html>
@@ -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<EndpointData>();
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<EndpointData>();
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(404);
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 render(opts: RenderOptions) {
6
+ export default function (opts: RenderOptions) {
7
7
  return renderToString(<Root />, {
8
8
  manifest,
9
9
  ...opts,
@@ -1,4 +1,4 @@
1
- import { render } from './entry.ssr';
1
+ import render from './entry.ssr';
2
2
 
3
3
  /**
4
4
  * Cloudflare Pages Request Handler
@@ -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 { render } from './entry.ssr';
6
+ import render from './entry.ssr';
7
7
 
8
8
  const app = express();
9
9
 
@@ -1,4 +1,4 @@
1
- import { render } from './entry.ssr';
1
+ import render from './entry.ssr';
2
2
 
3
3
  const handler = async (request: Request) => {
4
4
  try {