create-qwik 2.0.0-beta.3 → 2.0.0-beta.31

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 (30) hide show
  1. package/create-qwik.mjs +3 -0
  2. package/dist/index.mjs +193 -0
  3. package/dist/starters/apps/base/.prettierignore +1 -1
  4. package/dist/starters/apps/base/gitignore +1 -0
  5. package/dist/starters/apps/base/package.json +10 -10
  6. package/dist/starters/apps/base/src/entry.preview.tsx +1 -3
  7. package/dist/starters/apps/base/src/entry.ssr.tsx +23 -23
  8. package/dist/starters/apps/base/tsconfig.json +2 -2
  9. package/dist/starters/apps/empty/src/root.tsx +20 -17
  10. package/dist/starters/apps/library/README.md +8 -0
  11. package/dist/starters/apps/library/package.json +17 -16
  12. package/dist/starters/apps/library/src/entry.ssr.tsx +24 -14
  13. package/dist/starters/apps/library/src/global.css +33 -0
  14. package/dist/starters/apps/library/src/root.tsx +25 -7
  15. package/dist/starters/apps/library/src/routes/index.tsx +19 -0
  16. package/dist/starters/apps/library/tsconfig.json +3 -3
  17. package/dist/starters/apps/library/tsconfig.types.json +15 -0
  18. package/dist/starters/apps/library/{vite.config.mts → vite.config.ts} +7 -4
  19. package/dist/starters/apps/playground/src/components/starter/header/header.tsx +1 -4
  20. package/dist/starters/apps/playground/src/root.tsx +20 -17
  21. package/dist/starters/apps/playground/src/routes/demo/flower/index.tsx +0 -1
  22. package/package.json +11 -7
  23. package/create-qwik.cjs +0 -3
  24. package/dist/index.cjs +0 -186
  25. package/dist/starters/apps/base/src/entry.dev.tsx +0 -17
  26. package/dist/starters/apps/empty/public/manifest.json +0 -9
  27. package/dist/starters/apps/empty/src/components/router-head/router-head.tsx +0 -32
  28. package/dist/starters/apps/library/src/entry.dev.tsx +0 -17
  29. package/dist/starters/apps/playground/src/components/router-head/router-head.tsx +0 -37
  30. /package/dist/starters/apps/base/{vite.config.mts → vite.config.ts} +0 -0
@@ -27,7 +27,7 @@ build
27
27
  .vscode
28
28
  .rollup.cache
29
29
  tsconfig.tsbuildinfo
30
- vite.config.mts
30
+ vite.config.ts
31
31
  *.spec.tsx
32
32
  *.spec.ts
33
33
  .netlify
@@ -7,6 +7,7 @@
7
7
  # Development
8
8
  node_modules
9
9
  .env
10
+ .planning
10
11
  *.local
11
12
 
12
13
  # Cache
@@ -16,18 +16,18 @@
16
16
  "qwik": "qwik"
17
17
  },
18
18
  "devDependencies": {
19
- "@qwik.dev/core": "^2.0.0-beta.3",
20
- "@qwik.dev/router": "^2.0.0-beta.3",
19
+ "@qwik.dev/core": "^2.0.0-beta.31",
20
+ "@qwik.dev/router": "^2.0.0-beta.31",
21
21
  "@eslint/js": "latest",
22
- "@types/node": "24.0.4",
23
- "typescript-eslint": "8.26.1",
24
- "eslint": "9.25.1",
25
- "eslint-plugin-qwik": "^2.0.0-beta.3",
26
- "globals": "16.0.0",
27
- "prettier": "3.5.3",
28
- "typescript": "5.8.3",
22
+ "@types/node": "24.10.0",
23
+ "typescript-eslint": "8.56.1",
24
+ "eslint": "10.0.2",
25
+ "eslint-plugin-qwik": "^2.0.0-beta.31",
26
+ "globals": "17.0.0",
27
+ "prettier": "3.7.4",
28
+ "typescript": "5.9.3",
29
29
  "typescript-plugin-css-modules": "latest",
30
- "vite": "7.0.0",
30
+ "vite": "7.3.1",
31
31
  "vite-tsconfig-paths": "^4.2.1"
32
32
  },
33
33
  "engines": {
@@ -10,12 +10,10 @@
10
10
  * - https://vitejs.dev/config/preview-options.html#preview-options
11
11
  *
12
12
  */
13
- import qwikRouterConfig from "@qwik-router-config";
14
13
  import { createQwikRouter } from "@qwik.dev/router/middleware/node";
15
- // make sure qwikRouterConfig is imported before entry
16
14
  import render from "./entry.ssr";
17
15
 
18
16
  /**
19
17
  * The default export is the QwikRouter adapter used by Vite preview.
20
18
  */
21
- export default createQwikRouter({ render, qwikRouterConfig });
19
+ export default createQwikRouter({ render });
@@ -1,31 +1,31 @@
1
1
  /**
2
2
  * WHAT IS THIS FILE?
3
3
  *
4
- * SSR entry point, in all cases the application is rendered outside the browser, this
5
- * entry point will be the common one.
6
- *
7
- * - Server (express, cloudflare...)
8
- * - npm run start
9
- * - npm run preview
10
- * - npm run build
4
+ * SSR renderer function, used by Qwik Router.
11
5
  *
6
+ * Note that this is the only place the Qwik renderer is called.
7
+ * On the client, containers resume and do not call render.
12
8
  */
13
- import {
14
- renderToStream,
15
- type RenderToStreamOptions,
16
- } from "@qwik.dev/core/server";
9
+ import { createRenderer } from "@qwik.dev/router";
17
10
  import Root from "./root";
18
11
 
19
- export default function (opts: RenderToStreamOptions) {
20
- return renderToStream(<Root />, {
21
- ...opts,
22
- // Use container attributes to set attributes on the html tag.
23
- containerAttributes: {
24
- lang: "en-us",
25
- ...opts.containerAttributes,
26
- },
27
- serverData: {
28
- ...opts.serverData,
12
+ export default createRenderer((opts) => {
13
+ return {
14
+ jsx: <Root />,
15
+ options: {
16
+ ...opts,
17
+ // Use container attributes to set attributes on the html tag.
18
+ containerAttributes: {
19
+ lang: "en-us",
20
+ ...opts.containerAttributes,
21
+ },
22
+ serverData: {
23
+ ...opts.serverData,
24
+ // These are the default values for the document head and are overridden by the `head` exports
25
+ // documentHead: {
26
+ // title: "My App",
27
+ // },
28
+ },
29
29
  },
30
- });
31
- }
30
+ };
31
+ });
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "allowJs": true,
4
- "target": "ES2017",
5
- "module": "ES2022",
4
+ "target": "es2020",
5
+ "module": "esnext",
6
6
  "lib": ["es2022", "DOM", "WebWorker", "DOM.Iterable"],
7
7
  "jsx": "react-jsx",
8
8
  "jsxImportSource": "@qwik.dev/core",
@@ -1,32 +1,35 @@
1
- import { component$, isDev } from "@qwik.dev/core";
2
- import { QwikRouterProvider, RouterOutlet } from "@qwik.dev/router";
3
- import { RouterHead } from "./components/router-head/router-head";
1
+ import { component$ } from "@qwik.dev/core";
2
+ import {
3
+ DocumentHeadTags,
4
+ RouterOutlet,
5
+ useLocation,
6
+ useQwikRouter,
7
+ } from "@qwik.dev/router";
4
8
 
5
9
  import "./global.css";
6
10
 
7
11
  export default component$(() => {
12
+ useQwikRouter();
13
+ const { url } = useLocation();
14
+
8
15
  /**
9
- * The root of a QwikRouter site always start with the <QwikRouterProvider> component,
10
- * immediately followed by the document's <head> and <body>.
11
- *
12
- * Don't remove the `<head>` and `<body>` elements.
16
+ * This is the root of a QwikRouter site. It contains the document's `<head>` and `<body>`. You can adjust them as you see fit.
13
17
  */
14
18
 
15
19
  return (
16
- <QwikRouterProvider>
20
+ <>
17
21
  <head>
18
22
  <meta charset="utf-8" />
19
- {!isDev && (
20
- <link
21
- rel="manifest"
22
- href={`${import.meta.env.BASE_URL}manifest.json`}
23
- />
24
- )}
25
- <RouterHead />
23
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
24
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
25
+
26
+ <DocumentHeadTags />
27
+
28
+ <link rel="canonical" href={url.href} />
26
29
  </head>
27
- <body lang="en">
30
+ <body>
28
31
  <RouterOutlet />
29
32
  </body>
30
- </QwikRouterProvider>
33
+ </>
31
34
  );
32
35
  });
@@ -45,3 +45,11 @@ The production build should generate the production build of your component libr
45
45
  ```
46
46
  npm run build
47
47
  ```
48
+
49
+ ## sideEffects: false
50
+
51
+ This package is configured with "sideEffects": false in its package.json.<br/>
52
+ This tells bundlers that the module [has no side effects](https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free) when imported.<br/>
53
+ Consequently, to maintain the integrity of tree-shaking optimizations, please ensure your code truly contains no side effects (such as modifying global variables or the DOM upon import).<br/>
54
+ If your module does introduce side effects, remove "sideEffects": false or specify the specific files with side effects.<br/>
55
+ Be sure to only remove it from the specific file where the global is being set. Finally, verify that your build continues to function as expected after making any adjustments to the sideEffects setting.
@@ -5,23 +5,22 @@
5
5
  "private": false,
6
6
  "main": "./lib/index.qwik.mjs",
7
7
  "qwik": "./lib/index.qwik.mjs",
8
- "types": "./lib-types/index.d.ts",
8
+ "types": "./lib/index.d.ts",
9
9
  "type": "module",
10
10
  "exports": {
11
11
  ".": {
12
+ "types": "./lib/index.d.ts",
12
13
  "import": "./lib/index.qwik.mjs",
13
- "require": "./lib/index.qwik.cjs",
14
- "types": "./lib-types/index.d.ts"
14
+ "require": "./lib/index.qwik.cjs"
15
15
  }
16
16
  },
17
17
  "files": [
18
- "lib",
19
- "lib-types"
18
+ "lib"
20
19
  ],
21
20
  "scripts": {
22
21
  "build": "qwik build",
23
22
  "build.lib": "vite build --mode lib",
24
- "build.types": "tsc --emitDeclarationOnly",
23
+ "build.types": "tsc -p tsconfig.types.json --emitDeclarationOnly --incremental false",
25
24
  "dev": "vite --mode ssr",
26
25
  "dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
27
26
  "fmt": "prettier --write .",
@@ -33,17 +32,18 @@
33
32
  "release": "np"
34
33
  },
35
34
  "devDependencies": {
36
- "@qwik.dev/core": "2.0.0-beta.3",
35
+ "@qwik.dev/core": "2.0.0-beta.31",
36
+ "@qwik.dev/router": "latest",
37
37
  "@eslint/js": "latest",
38
- "@types/node": "24.0.4",
39
- "typescript-eslint": "8.26.1",
40
- "eslint": "9.25.1",
41
- "eslint-plugin-qwik": "2.0.0-beta.3",
42
- "globals": "16.0.0",
38
+ "@types/node": "24.10.0",
39
+ "typescript-eslint": "8.56.1",
40
+ "eslint": "10.0.2",
41
+ "eslint-plugin-qwik": "2.0.0-beta.31",
42
+ "globals": "17.0.0",
43
43
  "np": "^8.0.4",
44
- "prettier": "3.5.3",
45
- "typescript": "5.8.3",
46
- "vite": "7.0.0",
44
+ "prettier": "3.7.4",
45
+ "typescript": "5.9.3",
46
+ "vite": "7.3.1",
47
47
  "vite-tsconfig-paths": "^4.2.1"
48
48
  },
49
49
  "__qwik__": {
@@ -52,5 +52,6 @@
52
52
  "docs": [
53
53
  "https://qwik.dev/docs/getting-started/"
54
54
  ]
55
- }
55
+ },
56
+ "sideEffects": false
56
57
  }
@@ -1,21 +1,31 @@
1
1
  /**
2
2
  * WHAT IS THIS FILE?
3
3
  *
4
- * SSR entry point, in all cases the application is rendered outside the browser, this
5
- * entry point will be the common one.
6
- *
7
- * - Server (express, cloudflare...)
8
- * - npm run start
9
- * - npm run preview
10
- * - npm run build
4
+ * SSR renderer function, used by Qwik Router.
11
5
  *
6
+ * Note that this is the only place the Qwik renderer is called.
7
+ * On the client, containers resume and do not call render.
12
8
  */
13
- import {
14
- renderToStream,
15
- type RenderToStreamOptions,
16
- } from "@qwik.dev/core/server";
9
+ import { createRenderer } from "@qwik.dev/router";
17
10
  import Root from "./root";
18
11
 
19
- export default function (opts: RenderToStreamOptions) {
20
- return renderToStream(<Root />, opts);
21
- }
12
+ export default createRenderer((opts) => {
13
+ return {
14
+ jsx: <Root />,
15
+ options: {
16
+ ...opts,
17
+ // Use container attributes to set attributes on the html tag.
18
+ containerAttributes: {
19
+ lang: "en-us",
20
+ ...opts.containerAttributes,
21
+ },
22
+ serverData: {
23
+ ...opts.serverData,
24
+ // These are the default values for the document head and are overridden by the `head` exports
25
+ // documentHead: {
26
+ // title: "My App",
27
+ // },
28
+ },
29
+ },
30
+ };
31
+ });
@@ -0,0 +1,33 @@
1
+ /**
2
+ * WHAT IS THIS FILE?
3
+ *
4
+ * Globally applied styles. No matter which components are in the page or matching route,
5
+ * the styles in here will be applied to the Document, without any sort of CSS scoping.
6
+ *
7
+ */
8
+ html {
9
+ -webkit-text-size-adjust: 100%;
10
+ -moz-tab-size: 4;
11
+ -o-tab-size: 4;
12
+ tab-size: 4;
13
+ font-family:
14
+ ui-sans-serif,
15
+ system-ui,
16
+ -apple-system,
17
+ BlinkMacSystemFont,
18
+ "Segoe UI",
19
+ Roboto,
20
+ "Helvetica Neue",
21
+ Arial,
22
+ "Noto Sans",
23
+ sans-serif,
24
+ "Apple Color Emoji",
25
+ "Segoe UI Emoji",
26
+ "Segoe UI Symbol",
27
+ "Noto Color Emoji";
28
+ }
29
+
30
+ body {
31
+ padding: 0;
32
+ line-height: inherit;
33
+ }
@@ -1,17 +1,35 @@
1
- import { Counter } from "./components/counter/counter";
2
- import { Logo } from "./components/logo/logo";
1
+ import { component$ } from "@qwik.dev/core";
2
+ import {
3
+ DocumentHeadTags,
4
+ RouterOutlet,
5
+ useLocation,
6
+ useQwikRouter,
7
+ } from "@qwik.dev/router";
8
+
9
+ import "./global.css";
10
+
11
+ export default component$(() => {
12
+ useQwikRouter();
13
+ const { url } = useLocation();
14
+
15
+ /**
16
+ * This is the root of a QwikRouter site. It contains the document's `<head>` and `<body>`. You can adjust them as you see fit.
17
+ */
3
18
 
4
- export default () => {
5
19
  return (
6
20
  <>
7
21
  <head>
8
22
  <meta charset="utf-8" />
9
- <title>Qwik Blank App</title>
23
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
24
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
25
+
26
+ <DocumentHeadTags />
27
+
28
+ <link rel="canonical" href={url.href} />
10
29
  </head>
11
30
  <body>
12
- <Logo />
13
- <Counter />
31
+ <RouterOutlet />
14
32
  </body>
15
33
  </>
16
34
  );
17
- };
35
+ });
@@ -0,0 +1,19 @@
1
+ import { component$ } from "@qwik.dev/core";
2
+ import { Logo } from "../components/logo/logo";
3
+ import { Counter } from "../components/counter/counter";
4
+
5
+ export default component$(() => {
6
+ return (
7
+ <>
8
+ <h1>Qwik Library Starter</h1>
9
+ <p>
10
+ This is a playground meant for testing your library. Make your
11
+ components and export them from `src/index.ts`. This playground app will
12
+ not be bundled with your library. You can use the Router like a normal
13
+ Qwik app with the Qwik Router.
14
+ </p>
15
+ <Logo />
16
+ <Counter />
17
+ </>
18
+ );
19
+ });
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "allowJs": true,
4
- "target": "ES2017",
5
- "module": "ES2020",
4
+ "target": "es2020",
5
+ "module": "esnext",
6
6
  "lib": ["es2020", "DOM"],
7
7
  "jsx": "react-jsx",
8
8
  "jsxImportSource": "@qwik.dev/core",
9
9
  "strict": true,
10
10
  "declaration": true,
11
- "declarationDir": "lib-types",
11
+ "declarationDir": "lib",
12
12
  "resolveJsonModule": true,
13
13
  "moduleResolution": "Bundler",
14
14
  "esModuleInterop": true,
@@ -0,0 +1,15 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "emitDeclarationOnly": true,
6
+ "declarationDir": "lib",
7
+ "noEmit": false
8
+ },
9
+ "exclude": [
10
+ "src/routes/**",
11
+ "src/root.tsx",
12
+ "src/entry.ssr.tsx",
13
+ "src/entry.dev.tsx"
14
+ ]
15
+ }
@@ -1,7 +1,8 @@
1
1
  import { qwikVite } from "@qwik.dev/core/optimizer";
2
+ import { qwikRouter } from "@qwik.dev/router/vite";
2
3
  import { defineConfig } from "vite";
3
- import tsconfigPaths from "vite-tsconfig-paths";
4
4
  import pkg from "./package.json";
5
+ import tsconfigPaths from "vite-tsconfig-paths";
5
6
 
6
7
  const { dependencies = {}, peerDependencies = {} } = pkg as any;
7
8
  const makeRegex = (dep) => new RegExp(`^${dep}(/.*)?$`);
@@ -10,10 +11,12 @@ const excludeAll = (obj) => Object.keys(obj).map(makeRegex);
10
11
  export default defineConfig(() => {
11
12
  return {
12
13
  build: {
14
+ outDir: "lib",
13
15
  target: "es2020",
14
16
  lib: {
15
- entry: "./src/index.ts",
16
- formats: ["es", "cjs"],
17
+ entry: "./src/index",
18
+ formats: ["es", "cjs"] as const,
19
+ // This adds .qwik so all files are processed by the optimizer
17
20
  fileName: (format, entryName) =>
18
21
  `${entryName}.qwik.${format === "es" ? "mjs" : "cjs"}`,
19
22
  },
@@ -30,6 +33,6 @@ export default defineConfig(() => {
30
33
  ],
31
34
  },
32
35
  },
33
- plugins: [qwikVite(), tsconfigPaths({ root: "." })],
36
+ plugins: [qwikVite(), qwikRouter(), tsconfigPaths({ root: "." })],
34
37
  };
35
38
  });
@@ -13,10 +13,7 @@ export default component$(() => {
13
13
  </div>
14
14
  <ul>
15
15
  <li>
16
- <a
17
- href="https://qwik.dev/docs/components/overview/"
18
- target="_blank"
19
- >
16
+ <a href="https://qwik.dev/docs/core/overview/" target="_blank">
20
17
  Docs
21
18
  </a>
22
19
  </li>
@@ -1,32 +1,35 @@
1
- import { component$, isDev } from "@qwik.dev/core";
2
- import { QwikRouterProvider, RouterOutlet } from "@qwik.dev/router";
3
- import { RouterHead } from "./components/router-head/router-head";
1
+ import { component$ } from "@qwik.dev/core";
2
+ import {
3
+ DocumentHeadTags,
4
+ RouterOutlet,
5
+ useLocation,
6
+ useQwikRouter,
7
+ } from "@qwik.dev/router";
4
8
 
5
9
  import "./global.css";
6
10
 
7
11
  export default component$(() => {
12
+ useQwikRouter();
13
+ const { url } = useLocation();
14
+
8
15
  /**
9
- * The root of a QwikRouter site always start with the <QwikRouterProvider> component,
10
- * immediately followed by the document's <head> and <body>.
11
- *
12
- * Don't remove the `<head>` and `<body>` elements.
16
+ * This is the root of a QwikRouter site. It contains the document's `<head>` and `<body>`. You can adjust them as you see fit.
13
17
  */
14
18
 
15
19
  return (
16
- <QwikRouterProvider>
20
+ <>
17
21
  <head>
18
22
  <meta charset="utf-8" />
19
- {!isDev && (
20
- <link
21
- rel="manifest"
22
- href={`${import.meta.env.BASE_URL}manifest.json`}
23
- />
24
- )}
25
- <RouterHead />
23
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
24
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
25
+
26
+ <DocumentHeadTags />
27
+
28
+ <link rel="canonical" href={url.href} />
26
29
  </head>
27
- <body lang="en">
30
+ <body>
28
31
  <RouterOutlet />
29
32
  </body>
30
- </QwikRouterProvider>
33
+ </>
31
34
  );
32
35
  });
@@ -16,7 +16,6 @@ export default component$(() => {
16
16
  number: 20,
17
17
  });
18
18
 
19
- // eslint-disable-next-line qwik/no-use-visible-task
20
19
  useVisibleTask$(({ cleanup }) => {
21
20
  const timeout = setTimeout(() => (state.count = 1), 500);
22
21
  cleanup(() => clearTimeout(timeout));
package/package.json CHANGED
@@ -1,13 +1,16 @@
1
1
  {
2
2
  "name": "create-qwik",
3
3
  "description": "Interactive CLI for create Qwik projects and adding features.",
4
- "version": "2.0.0-beta.3",
4
+ "version": "2.0.0-beta.31",
5
5
  "author": "Qwik Team",
6
- "bin": "./create-qwik.cjs",
6
+ "bin": "./create-qwik.mjs",
7
7
  "bugs": "https://github.com/QwikDev/qwik/issues",
8
+ "dependencies": {
9
+ "execa": "9.6.1"
10
+ },
8
11
  "devDependencies": {
9
- "@clack/prompts": "0.7.0",
10
- "@types/yargs": "17.0.32",
12
+ "@clack/prompts": "0.11.0",
13
+ "@types/yargs": "17.0.35",
11
14
  "kleur": "4.1.5",
12
15
  "yargs": "17.7.2"
13
16
  },
@@ -20,7 +23,7 @@
20
23
  "engines-annotation": "Mostly required by sharp which needs a Node-API v9 compatible runtime",
21
24
  "files": [
22
25
  "README.md",
23
- "create-qwik.cjs",
26
+ "create-qwik.mjs",
24
27
  "dist"
25
28
  ],
26
29
  "homepage": "https://qwik.dev/",
@@ -31,10 +34,11 @@
31
34
  "template"
32
35
  ],
33
36
  "license": "MIT",
34
- "main": "./dist/index.cjs",
37
+ "main": "./dist/index.mjs",
35
38
  "repository": {
36
39
  "type": "git",
37
40
  "url": "https://github.com/QwikDev/qwik.git",
38
41
  "directory": "packages/create-qwik"
39
- }
42
+ },
43
+ "type": "module"
40
44
  }
package/create-qwik.cjs DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- const createQwik = require('./dist/index.cjs');
3
- createQwik.runCli();