@batijs/cli 0.0.275 → 0.0.277

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 (65) hide show
  1. package/dist/boilerplates/@batijs/authjs/files/server/authjs-handler.ts +1 -0
  2. package/dist/boilerplates/@batijs/firebase-auth/files/server/firebase-auth-middleware.ts +1 -0
  3. package/dist/boilerplates/@batijs/hono/files/$package.json.js +5 -1
  4. package/dist/boilerplates/@batijs/lucia-auth/files/server/lucia-auth-handlers.ts +1 -0
  5. package/dist/boilerplates/@batijs/react/files/$README.md.js +1 -1
  6. package/dist/boilerplates/@batijs/react/files/$package.json.js +7 -20
  7. package/dist/boilerplates/@batijs/react/files/assets/logo.svg +62 -31
  8. package/dist/boilerplates/@batijs/react/files/{layouts/HeadDefault.tsx → pages/+Head.tsx} +2 -8
  9. package/dist/boilerplates/@batijs/react/files/pages/+config.ts +8 -4
  10. package/dist/boilerplates/@batijs/react/files/pages/star-wars/@id/+data.ts +11 -1
  11. package/dist/boilerplates/@batijs/react/files/pages/star-wars/index/+data.ts +11 -1
  12. package/dist/boilerplates/@batijs/react/types/pages/+config.d.ts +2 -3
  13. package/dist/boilerplates/@batijs/shared-no-db/files/database/todoItems.ts +10 -3
  14. package/dist/boilerplates/@batijs/shared-no-db/types/database/todoItems.d.ts +1 -5
  15. package/dist/boilerplates/@batijs/shared-server/files/server/create-todo-handler.ts +1 -0
  16. package/dist/boilerplates/@batijs/shared-server/files/server/vike-handler.ts +1 -0
  17. package/dist/boilerplates/@batijs/shared-todo/files/pages/todo/+config.ts +1 -3
  18. package/dist/boilerplates/@batijs/shared-todo/files/pages/todo/+data.ts +1 -1
  19. package/dist/boilerplates/@batijs/shared-todo/types/pages/todo/+config.d.ts +1 -2
  20. package/dist/boilerplates/@batijs/solid/files/$README.md.js +1 -1
  21. package/dist/boilerplates/@batijs/solid/files/$package.json.js +7 -20
  22. package/dist/boilerplates/@batijs/solid/files/assets/logo.svg +62 -31
  23. package/dist/boilerplates/@batijs/solid/files/{layouts/HeadDefault.tsx → pages/+Head.tsx} +1 -7
  24. package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +8 -4
  25. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+data.ts +11 -1
  26. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+data.ts +11 -1
  27. package/dist/boilerplates/@batijs/solid/types/pages/+config.d.ts +2 -3
  28. package/dist/boilerplates/@batijs/telefunc/files/pages/todo/TodoList.telefunc.ts +2 -2
  29. package/dist/boilerplates/@batijs/telefunc/files/server/telefunc-handler.ts +1 -0
  30. package/dist/boilerplates/@batijs/trpc/files/server/trpc-handler.ts +1 -0
  31. package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +1 -0
  32. package/dist/boilerplates/@batijs/vue/files/$README.md.js +1 -1
  33. package/dist/boilerplates/@batijs/vue/files/$package.json.js +0 -14
  34. package/dist/boilerplates/@batijs/vue/files/assets/logo.svg +62 -31
  35. package/dist/boilerplates/@batijs/vue/files/{layouts/HeadDefault.vue → pages/+Head.vue} +1 -3
  36. package/dist/boilerplates/@batijs/vue/files/pages/+config.ts +8 -4
  37. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/@id/+data.ts +11 -1
  38. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/index/+data.ts +11 -1
  39. package/dist/boilerplates/@batijs/vue/types/pages/+config.d.ts +2 -2
  40. package/dist/index.js +1 -1
  41. package/package.json +5 -5
  42. package/dist/boilerplates/@batijs/react/files/pages/star-wars/@id/+title.ts +0 -7
  43. package/dist/boilerplates/@batijs/react/files/pages/star-wars/index/+title.ts +0 -7
  44. package/dist/boilerplates/@batijs/react/types/pages/star-wars/@id/+title.d.ts +0 -3
  45. package/dist/boilerplates/@batijs/react/types/pages/star-wars/index/+title.d.ts +0 -3
  46. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/@id/+title.ts +0 -7
  47. package/dist/boilerplates/@batijs/solid/files/pages/star-wars/index/+title.ts +0 -7
  48. package/dist/boilerplates/@batijs/solid/types/pages/star-wars/@id/+title.d.ts +0 -3
  49. package/dist/boilerplates/@batijs/solid/types/pages/star-wars/index/+title.d.ts +0 -3
  50. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/@id/+title.ts +0 -7
  51. package/dist/boilerplates/@batijs/vue/files/pages/star-wars/index/+title.ts +0 -7
  52. package/dist/boilerplates/@batijs/vue/types/pages/star-wars/@id/+title.d.ts +0 -3
  53. package/dist/boilerplates/@batijs/vue/types/pages/star-wars/index/+title.d.ts +0 -3
  54. /package/dist/boilerplates/@batijs/auth0/files/{vike.d.ts → global.d.ts} +0 -0
  55. /package/dist/boilerplates/@batijs/d1/files/{vike.d.ts → global.d.ts} +0 -0
  56. /package/dist/boilerplates/@batijs/express/files/{vike.d.ts → global.d.ts} +0 -0
  57. /package/dist/boilerplates/@batijs/fastify/files/{vike.d.ts → global.d.ts} +0 -0
  58. /package/dist/boilerplates/@batijs/firebase-auth/files/{vike.d.ts → global.d.ts} +0 -0
  59. /package/dist/boilerplates/@batijs/h3/files/{vike.d.ts → global.d.ts} +0 -0
  60. /package/dist/boilerplates/@batijs/hono/files/{vike.d.ts → global.d.ts} +0 -0
  61. /package/dist/boilerplates/@batijs/lucia-auth/files/{vike.d.ts → global.d.ts} +0 -0
  62. /package/dist/boilerplates/@batijs/react/types/{layouts/HeadDefault.d.ts → pages/+Head.d.ts} +0 -0
  63. /package/dist/boilerplates/@batijs/shared-todo/files/{vike.d.ts → global.d.ts} +0 -0
  64. /package/dist/boilerplates/@batijs/solid/types/{layouts/HeadDefault.d.ts → pages/+Head.d.ts} +0 -0
  65. /package/dist/boilerplates/@batijs/telefunc/files/{vike.d.ts → global.d.ts} +0 -0
@@ -2,6 +2,7 @@ import { Auth, type AuthConfig, createActionURL, setEnvDefaults } from "@auth/co
2
2
  import Auth0 from "@auth/core/providers/auth0";
3
3
  import CredentialsProvider from "@auth/core/providers/credentials";
4
4
  import type { Session } from "@auth/core/types";
5
+ // TODO: stop using universal-middleware and directly integrate server middlewares instead. (Bati generates boilerplates that use universal-middleware https://github.com/magne4000/universal-middleware to make Bati's internal logic easier. This is temporary and will be removed soon.)
5
6
  import type { Get, UniversalHandler, UniversalMiddleware } from "@universal-middleware/core";
6
7
 
7
8
  const env: Record<string, string | undefined> =
@@ -1,6 +1,7 @@
1
1
  import { parse, serialize } from "cookie";
2
2
  import { getAuth } from "firebase-admin/auth";
3
3
  import { firebaseAdmin } from "../libs/firebaseAdmin";
4
+ // TODO: stop using universal-middleware and directly integrate server middlewares instead. (Bati generates boilerplates that use universal-middleware https://github.com/magne4000/universal-middleware to make Bati's internal logic easier. This is temporary and will be removed soon.)
4
5
  import type { Get, UniversalHandler, UniversalMiddleware } from "@universal-middleware/core";
5
6
 
6
7
  export const firebaseAuthMiddleware: Get<[], UniversalMiddleware> = () => async (request, context) => {
@@ -118,7 +118,11 @@ async function getPackageJson(props) {
118
118
  }
119
119
  });
120
120
  return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
121
- devDependencies: ["@hono/vite-dev-server", "@types/node", "@types/aws-lambda"],
121
+ devDependencies: [
122
+ "@hono/vite-dev-server",
123
+ "@types/node",
124
+ ...props.meta.BATI.has("aws") ? ["@types/aws-lambda"] : []
125
+ ],
122
126
  dependencies: [
123
127
  "@hono/node-server",
124
128
  "@universal-middleware/hono",
@@ -13,6 +13,7 @@ import { parse, serialize } from "cookie";
13
13
  import * as drizzleQueries from "@batijs/drizzle/database/drizzle/queries/lucia-auth";
14
14
  import * as sqliteQueries from "@batijs/sqlite/database/sqlite/queries/lucia-auth";
15
15
  import * as d1Queries from "@batijs/d1-sqlite/database/d1/queries/lucia-auth";
16
+ // TODO: stop using universal-middleware and directly integrate server middlewares instead. (Bati generates boilerplates that use universal-middleware https://github.com/magne4000/universal-middleware to make Bati's internal logic easier. This is temporary and will be removed soon.)
16
17
  import { type Get, type UniversalHandler, type UniversalMiddleware } from "@universal-middleware/core";
17
18
 
18
19
  /**
@@ -34,7 +34,7 @@ SSR is enabled by default. You can [disable it](https://vike.dev/ssr) for all yo
34
34
 
35
35
  ### HTML Streaming
36
36
 
37
- You can enable/disable [HTML streaming](https://vike.dev/streaming) for all your pages, or only for some pages while still using it for others.`;
37
+ You can enable/disable [HTML streaming](https://vike.dev/stream) for all your pages, or only for some pages while still using it for others.`;
38
38
  content.addAbout(about);
39
39
  return content.finalize();
40
40
  }
@@ -50,7 +50,6 @@ var require_package = __commonJS({
50
50
  "@types/react": "^18.3.6",
51
51
  "@types/react-dom": "^18.3.0",
52
52
  "@vitejs/plugin-react": "^4.3.1",
53
- "cross-fetch": "^4.0.0",
54
53
  react: "^18.3.1",
55
54
  "react-dom": "^18.3.1",
56
55
  tailwindcss: "^3.4.11",
@@ -75,12 +74,12 @@ var require_package = __commonJS({
75
74
  "./components/Link": {
76
75
  types: "./dist/types/components/Link.d.ts"
77
76
  },
78
- "./layouts/HeadDefault": {
79
- types: "./dist/types/layouts/HeadDefault.d.ts"
80
- },
81
77
  "./layouts/LayoutDefault": {
82
78
  types: "./dist/types/layouts/LayoutDefault.d.ts"
83
79
  },
80
+ "./pages/+Head": {
81
+ types: "./dist/types/pages/+Head.d.ts"
82
+ },
84
83
  "./pages/+config": {
85
84
  types: "./dist/types/pages/+config.d.ts"
86
85
  },
@@ -108,18 +107,12 @@ var require_package = __commonJS({
108
107
  "./pages/star-wars/@id/+Page": {
109
108
  types: "./dist/types/pages/star-wars/@id/+Page.d.ts"
110
109
  },
111
- "./pages/star-wars/@id/+title": {
112
- types: "./dist/types/pages/star-wars/@id/+title.d.ts"
113
- },
114
110
  "./pages/star-wars/index/+data": {
115
111
  types: "./dist/types/pages/star-wars/index/+data.d.ts"
116
112
  },
117
113
  "./pages/star-wars/index/+Page": {
118
114
  types: "./dist/types/pages/star-wars/index/+Page.d.ts"
119
115
  },
120
- "./pages/star-wars/index/+title": {
121
- types: "./dist/types/pages/star-wars/index/+title.d.ts"
122
- },
123
116
  "./pages/todo/TodoList": {
124
117
  types: "./dist/types/pages/todo/TodoList.d.ts"
125
118
  },
@@ -132,12 +125,12 @@ var require_package = __commonJS({
132
125
  "components/Link": [
133
126
  "./dist/types/components/Link.d.ts"
134
127
  ],
135
- "layouts/HeadDefault": [
136
- "./dist/types/layouts/HeadDefault.d.ts"
137
- ],
138
128
  "layouts/LayoutDefault": [
139
129
  "./dist/types/layouts/LayoutDefault.d.ts"
140
130
  ],
131
+ "pages/+Head": [
132
+ "./dist/types/pages/+Head.d.ts"
133
+ ],
141
134
  "pages/+config": [
142
135
  "./dist/types/pages/+config.d.ts"
143
136
  ],
@@ -165,18 +158,12 @@ var require_package = __commonJS({
165
158
  "pages/star-wars/@id/+Page": [
166
159
  "./dist/types/pages/star-wars/@id/+Page.d.ts"
167
160
  ],
168
- "pages/star-wars/@id/+title": [
169
- "./dist/types/pages/star-wars/@id/+title.d.ts"
170
- ],
171
161
  "pages/star-wars/index/+data": [
172
162
  "./dist/types/pages/star-wars/index/+data.d.ts"
173
163
  ],
174
164
  "pages/star-wars/index/+Page": [
175
165
  "./dist/types/pages/star-wars/index/+Page.d.ts"
176
166
  ],
177
- "pages/star-wars/index/+title": [
178
- "./dist/types/pages/star-wars/index/+title.d.ts"
179
- ],
180
167
  "pages/todo/TodoList": [
181
168
  "./dist/types/pages/todo/TodoList.d.ts"
182
169
  ],
@@ -195,7 +182,7 @@ async function getPackageJson(props) {
195
182
  const packageJson = await loadAsJson(props);
196
183
  return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
197
184
  devDependencies: ["vite", "@types/react", "@types/react-dom"],
198
- dependencies: ["@vitejs/plugin-react", "cross-fetch", "react", "react-dom", "vike", "vike-react"]
185
+ dependencies: ["@vitejs/plugin-react", "react", "react-dom", "vike", "vike-react"]
199
186
  });
200
187
  }
201
188
  export {
@@ -1,36 +1,67 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg width="175" height="175" fill="none" version="1.1" viewBox="0 0 175 175" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
3
- <metadata>
4
- <rdf:RDF>
5
- <cc:Work rdf:about="">
6
- <dc:format>image/svg+xml</dc:format>
7
- <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
8
- <dc:title/>
9
- </cc:Work>
10
- </rdf:RDF>
11
- </metadata>
1
+ <svg class="hammer" width="41.217" height="41.217" version="1.1" viewBox="-50 -50 41.217 41.217" xmlns="http://www.w3.org/2000/svg">
12
2
  <defs>
13
- <linearGradient id="linearGradient880" x1="108.64" x2="115.51" y1="88.726" y2="136.2" gradientTransform="matrix(1.0498 0 0 1.0498 -2.9171 -2.9658)" gradientUnits="userSpaceOnUse">
14
- <stop stop-color="#ffea83" offset="0"/>
15
- <stop stop-color="#FFDD35" offset=".083333"/>
16
- <stop stop-color="#FFA800" offset="1"/>
17
- </linearGradient>
18
- <linearGradient id="paint2_linear" x1="48.975" x2="61.299" y1="3.9232" y2="158.04" gradientTransform="translate(-2.832e-5)" gradientUnits="userSpaceOnUse">
19
- <stop stop-color="#FFEA83" offset="0"/>
20
- <stop stop-color="#FFDD35" offset=".083333"/>
21
- <stop stop-color="#FFA800" offset="1"/>
22
- </linearGradient>
23
- <linearGradient id="paint0_linear-6" x1="-1.4492" x2="116.62" y1="-5.8123" y2="137.08" gradientTransform="translate(-2.832e-5)" gradientUnits="userSpaceOnUse">
24
- <stop stop-color="#41D1FF" offset="0"/>
25
- <stop stop-color="#BD34FE" offset="1"/>
3
+ <mask id="mask111">
4
+ <rect x="-19.21" y="-25.7" width="46.217" height="41.217" fill="url(#linearGradient115)"/>
5
+ </mask>
6
+ <linearGradient id="linearGradient115" x1="-25.395" x2="-25.395" y1="-9.3005" y2="-18.03" gradientTransform="matrix(1.0589 0 0 .94436 30.79 24.3)" gradientUnits="userSpaceOnUse">
7
+ <stop offset="0"/>
8
+ <stop stop-color="#fff" offset="1"/>
26
9
  </linearGradient>
27
10
  </defs>
28
- <circle cx="87.5" cy="87.5" r="87.5" fill="#c4c4c4"/>
29
- <circle cx="87.5" cy="87.5" r="87.5" fill="url(#paint0_linear-6)"/>
30
- <g transform="translate(632.92 54.355)" fill="#d38787" stroke-width="1.0614">
31
- <path d="m-549.75 68.457c-5.7533-3.1217-6.1166-5.2295-6.1166-35.489 0-30.458 0.35464-32.448 6.3339-35.54 3.9943-2.0655 24.279-2.2805 26.735-0.28333 0.89718 0.72974 6.7203 6.6637 12.94 13.187l11.309 11.86v19.575c0 18.473-0.12956 19.74-2.3011 22.5-4.0223 5.1136-7.558 5.8565-27.65 5.8099-14.15-0.03287-19.008-0.40294-21.25-1.6191zm42.473-6.3594c2.27-1.59 2.359-2.2909 2.359-18.575v-16.923h-6.9521c-12.443 0-16.4-4.0845-16.4-16.93v-7.4828h-8.9464c-6.7178 0-9.3619 0.41549-10.614 1.668-2.5031 2.5031-2.5031 55.724 0 58.228 2.4502 2.4502 37.058 2.4636 40.553 0.01609zm-1.8867-42.165c0-0.16422-2.8659-3.1346-6.3686-6.6008l-6.3686-6.3022v4.9328c0 6.3185 1.8955 8.2687 8.0366 8.2687 2.5854 0 4.7007-0.13434 4.7007-0.29859zm-57.57 44.279c-5.6185-3.0486-6.1166-5.593-6.1166-31.243 0-18.891 0.31331-24.063 1.6101-26.571 1.809-3.4981 6.5048-6.3339 10.489-6.3339 2.4847 0 2.5814 0.19984 1.541 3.1843-0.61054 1.7514-1.7457 3.1843-2.5226 3.1843-0.77686 0-2.1631 0.75059-3.0805 1.668-2.4923 2.4923-2.4923 47.244 0 49.736 0.91739 0.9174 2.3036 1.668 3.0805 1.668 0.77688 0 1.912 1.4329 2.5226 3.1843 1.0562 3.0298 0.97108 3.1822-1.7537 3.1418-1.575-0.02331-4.1713-0.75194-5.7694-1.6191zm-16.983-4.2458c-5.4392-2.9512-6.1166-5.9415-6.1166-26.997 0-15.096 0.345-19.878 1.6101-22.325 1.7476-3.3796 6.4758-6.3339 10.137-6.3339 1.8666 0 2.1789 0.44955 1.6594 2.3882-0.35184 1.3135-0.64655 2.7465-0.65453 3.1843-8e-3 0.43784-0.69682 0.79608-1.5308 0.79608-0.83399 0-2.2669 0.75059-3.1843 1.668-2.4767 2.4767-2.4767 38.768 0 41.244 0.91741 0.91739 2.2946 1.668 3.0605 1.668 1.196 0 2.6402 2.995 2.6871 5.5726 0.0241 1.3294-4.5804 0.80962-7.6676-0.8655z" style="mix-blend-mode:lighten"/>
32
- <path d="m-552.2 68.911c-5.7533-3.1217-6.1166-5.2295-6.1166-35.489 0-30.458 0.35463-32.448 6.3339-35.54 3.9943-2.0655 24.279-2.2805 26.735-0.28333 0.89718 0.72974 6.7203 6.6637 12.94 13.187l11.309 11.86v19.575c0 18.473-0.12957 19.74-2.3011 22.5-4.0223 5.1136-7.558 5.8565-27.65 5.8099-14.15-0.03287-19.008-0.40294-21.25-1.6191zm42.473-6.3594c2.27-1.59 2.359-2.2909 2.359-18.575v-16.923h-6.952c-12.443 0-16.4-4.0845-16.4-16.93v-7.4828h-8.9464c-6.7179 0-9.3619 0.41549-10.614 1.668-2.5031 2.5031-2.5031 55.724 0 58.228 2.4502 2.4502 37.058 2.4636 40.553 0.01609zm-1.8867-42.165c0-0.16422-2.8659-3.1346-6.3686-6.6008l-6.3686-6.3022v4.9328c0 6.3185 1.8955 8.2688 8.0366 8.2688 2.5854 0 4.7007-0.13434 4.7007-0.29859zm-57.57 44.279c-5.6185-3.0486-6.1166-5.593-6.1166-31.243 0-18.891 0.31331-24.063 1.6101-26.571 1.809-3.4981 6.5048-6.3339 10.489-6.3339 2.4847 0 2.5814 0.19984 1.541 3.1843-0.61054 1.7514-1.7457 3.1843-2.5226 3.1843-0.77687 0-2.1631 0.75059-3.0805 1.668-2.4923 2.4923-2.4923 47.244 0 49.736 0.91741 0.91739 2.3036 1.668 3.0805 1.668 0.77686 0 1.912 1.4329 2.5226 3.1843 1.0562 3.0298 0.97107 3.1822-1.7537 3.1418-1.575-0.02331-4.1713-0.75194-5.7694-1.6191zm-16.983-4.2458c-5.4392-2.9512-6.1166-5.9415-6.1166-26.997 0-15.096 0.34502-19.878 1.6101-22.325 1.7476-3.3796 6.4758-6.3339 10.137-6.3339 1.8666 0 2.1789 0.44955 1.6594 2.3882-0.35182 1.3135-0.64653 2.7465-0.65452 3.1843-8e-3 0.43784-0.69683 0.79608-1.5308 0.79608-0.83397 0-2.2669 0.75059-3.1843 1.668-2.4767 2.4767-2.4767 38.768 0 41.245 0.9174 0.91739 2.2946 1.668 3.0605 1.668 1.196 0 2.6402 2.995 2.6871 5.5726 0.0241 1.3294-4.5804 0.80962-7.6676-0.8655z" fill-opacity=".47466" style="mix-blend-mode:lighten"/>
11
+ <g transform="translate(-33.29,-24.3)" mask="url(#mask111)">
12
+ <g stroke-linecap="round" stroke-linejoin="round">
13
+ <path d="m-8.511-10.449 1.126 4.064 2.707-2.765z" fill="#ababab"/>
14
+ <path d="m-2.273-24.496-6.238 14.047 3.833 1.299 6.238-14.048z" fill="#949494"/>
15
+ <path d="m-2.273-24.496 3.465-1.204.368 2.502z" fill="#ababab"/>
16
+ <path d="m17.511 4.674-2.707 2.766-22.189-13.825 2.707-2.765z" fill="#949494"/>
17
+ </g>
18
+ <g stroke="#878787">
19
+ <path d="m-9.045 20.369-1.169 2.634" stroke-width="9.6"/>
20
+ <path d="m-12.418 23.191c-1.85-1.153-2.326-2.132-1.086-2.238 1.239-.106 3.642.709 5.493 1.862s2.326 2.132 1.087 2.238c-1.24.106-3.643-.709-5.494-1.862" fill="#878787" stroke-linecap="round" stroke-linejoin="round"/>
21
+ <path d="m-11.248 20.557c1.851 1.153 4.254 1.968 5.493 1.862 1.24-.106.764-1.085-1.086-2.238-1.851-1.153-4.254-1.968-5.494-1.862-1.239.106-.764 1.085 1.087 2.238" fill="#878787" stroke-linecap="round" stroke-linejoin="round"/>
22
+ </g>
23
+ <g stroke-linecap="round" stroke-linejoin="round">
24
+ <path d="m-16.71-9.748 8.199-.701 1.126 4.064-8.199.701z" fill="#949494"/>
25
+ <path d="m23.749-9.373-6.238 14.047-22.189-13.824 6.238-14.048z" fill="#757575"/>
26
+ <path d="m10.271-16.073 3.751 3.534c.062.058.083.156.052.238l-1.95 5.128c-.046.121-.18.153-.268.065l-1.024-1.03c-.095-.096-.242-.048-.275.091l-.516 2.152c-.034.145-.191.19-.284.082 0 0-.606-.696-.606-.696-.094-.108-.25-.063-.285.082l-.803 3.384c-.05.212-.317.178-.336-.043l-.014-.147s.058-9.892.058-9.892c.001-.165.165-.253.277-.148l1.077 1.009c.101.095.25.034.274-.111l.597-3.587c.025-.146.174-.206.275-.111z" fill="#fbbf28" stroke="#fbbf28" stroke-width=".6"/>
27
+ </g>
28
+ <g stroke="#808080">
29
+ <path d="m-8.362 18.833-.39.878" stroke-width="9.1"/>
30
+ <path d="m-10.956 19.899c-1.85-1.153-2.326-2.132-1.086-2.238 1.239-.106 3.642.708 5.493 1.861s2.326 2.132 1.087 2.238c-1.24.106-3.643-.708-5.494-1.861" fill="#808080" stroke-linecap="round" stroke-linejoin="round" stroke-width=".5"/>
31
+ <path d="m-10.566 19.021c1.851 1.153 4.254 1.967 5.494 1.861 1.239-.106.764-1.085-1.087-2.238s-4.254-1.967-5.494-1.861c-1.239.106-.764 1.085 1.087 2.238" fill="#808080" stroke-linecap="round" stroke-linejoin="round" stroke-width=".5"/>
32
+ </g>
33
+ <path d="m-16.71-9.748 8.199-.701 6.238-14.047-8.199.701z" fill="#757575" stroke-linecap="round" stroke-linejoin="round"/>
34
+ <path d="m-1.754 3.951-6.511 14.662" stroke="#91512b" stroke-width="8.6"/>
35
+ <g stroke-linecap="round" stroke-linejoin="round">
36
+ <path d="m-10.468 18.801c-1.851-1.153-2.327-2.132-1.087-2.238 1.239-.106 3.643.709 5.493 1.862 1.851 1.153 2.327 2.132 1.087 2.238-1.239.106-3.643-.708-5.493-1.862" fill="#91512b"/>
37
+ <path d="m-3.958 4.139c1.851 1.153 4.254 1.968 5.494 1.862 1.239-.106.764-1.086-1.087-2.239s-4.254-1.967-5.493-1.861c-1.24.106-.764 1.085 1.086 2.238" fill="#91512b"/>
38
+ <path d="m1.192-25.7.368 2.502 22.189 13.825-.368-2.503z" fill="#949494"/>
39
+ <path d="m-10.472-23.795 8.199-.701 3.465-1.204-8.199.701z" fill="#949494"/>
40
+ </g>
41
+ <g stroke="#6e6e6e">
42
+ <path d="m-.487 1.097-1.17 2.634" stroke-width="9.1"/>
43
+ <path d="m-3.86 3.92c-1.851-1.153-2.326-2.132-1.087-2.238s3.643.708 5.493 1.861c1.851 1.153 2.327 2.132 1.087 2.238-1.239.106-3.643-.708-5.493-1.861" fill="#6e6e6e" stroke-linecap="round" stroke-linejoin="round" stroke-width=".5"/>
44
+ <path d="m-2.691 1.286c1.851 1.153 4.254 1.967 5.494 1.861 1.239-.106.764-1.085-1.087-2.238s-4.254-1.967-5.493-1.861c-1.24.106-.764 1.085 1.086 2.238" fill="#6e6e6e" stroke-linecap="round" stroke-linejoin="round" stroke-width=".5"/>
45
+ </g>
46
+ <g stroke-linecap="round" stroke-linejoin="round">
47
+ <path d="m18.269 6.236-3.465 1.204 2.707-2.766z" fill="#ababab"/>
48
+ <path d="m14.804 7.44-8.199.701-22.189-13.825 8.199-.701z" fill="#757575"/>
49
+ <path d="m-16.71-9.748 1.126 4.064-.367-2.502z" fill="#ababab"/>
50
+ <path d="m24.507-7.812-6.238 14.048-.758-1.562 6.238-14.047z" fill="#949494"/>
51
+ <path d="m-10.472-23.795-6.238 14.047.759 1.562 6.237-14.048z" fill="#949494"/>
52
+ <path d="m24.507-7.812-1.126-4.064.368 2.503z" fill="#ababab"/>
53
+ <path d="m23.381-11.876-8.199.701-22.189-13.824 8.199-.701z" fill="#757575"/>
54
+ <path d="m-10.472-23.795 3.465-1.204-2.707 2.765z" fill="#ababab"/>
55
+ <path d="m18.269 6.236-8.199.701-3.465 1.204 8.199-.701z" fill="#949494"/>
56
+ <path d="m-15.951-8.186.367 2.502 22.189 13.825-.367-2.503z" fill="#949494"/>
57
+ <path d="m18.269 6.236-8.199.701 6.238-14.048 8.199-.701z" fill="#757575"/>
58
+ <path d="m-9.714-22.234-6.237 14.048 22.189 13.824 6.237-14.047z" fill="#757575"/>
59
+ <path d="m2.545-12.79-4.583-1.659c-.076-.027-.156.008-.195.085 0 0-2.463 4.808-2.463 4.808-.058.114-.005.263.107.298l1.296.416c.122.039.171.21.093.321 0 0-1.205 1.722-1.205 1.722-.081.116-.024.294.105.325l.827.196c.128.031.186.209.104.325 0 0-1.899 2.701-1.899 2.701-.118.169.056.41.22.304l.11-.07 6.849-5.661c.115-.095.083-.304-.054-.354l-1.312-.48c-.123-.045-.165-.224-.078-.331 0 0 2.157-2.615 2.157-2.615.087-.106.045-.286-.079-.331z" fill="#fbbf28" stroke="#fbbf28" stroke-width=".6"/>
60
+ <path d="m24.507-7.812-8.199.701-1.126-4.064 8.199-.701z" fill="#949494"/>
61
+ <path d="m15.182-11.175-2.707 2.766-22.189-13.825 2.707-2.765z" fill="#949494"/>
62
+ <path d="m10.07 6.937-3.465 1.204-.367-2.503z" fill="#ababab"/>
63
+ <path d="m16.308-7.111-6.238 14.048-3.832-1.299 6.237-14.047z" fill="#949494"/>
64
+ <path d="m16.308-7.111-1.126-4.064-2.707 2.766z" fill="#ababab"/>
65
+ </g>
33
66
  </g>
34
- <path d="m128.48 88.913-24.027 4.6784c-0.39475 0.07685-0.68766 0.40944-0.71076 0.80849l-1.4782 24.805c-0.0347 0.58371 0.50497 1.0372 1.0792 0.90602l6.6886-1.5338c0.62676-0.14383 1.1916 0.40419 1.0635 1.0299l-1.9874 9.6702c-0.13438 0.65091 0.48084 1.2073 1.1202 1.0142l4.1322-1.2472c0.64041-0.19317 1.2556 0.36535 1.1202 1.0162l-3.158 15.191c-0.19842 0.95011 1.074 1.4677 1.6042 0.653l0.35485-0.54382 19.578-38.827c0.32755-0.64985-0.23727-1.391-0.95641-1.2535l-6.8849 1.3207c-0.6467 0.12389-1.1979-0.47453-1.0152-1.1034l4.4944-15.482c0.18266-0.63012-0.36955-1.2295-1.0173-1.1034z" fill="url(#linearGradient880)" stroke-width="1.0498"/>
35
- <rect x="3" y="3" width="169" height="169" rx="84.5" stroke="url(#paint2_linear)" stroke-width="6" style="mix-blend-mode:soft-light"/>
36
67
  </svg>
@@ -1,16 +1,14 @@
1
+ // https://vike.dev/Head
2
+
1
3
  import React from "react";
2
4
  import logoUrl from "../assets/logo.svg";
3
5
  //# BATI.has("mantine")
4
6
  import { ColorSchemeScript } from "@mantine/core";
5
7
 
6
- // Default <head> (can be overridden by pages)
7
-
8
8
  export default function HeadDefault() {
9
9
  if (BATI.has("plausible.io")) {
10
10
  return (
11
11
  <>
12
- <meta name="viewport" content="width=device-width, initial-scale=1" />
13
- <meta name="description" content="Demo showcasing Vike" />
14
12
  <link rel="icon" href={logoUrl} />
15
13
  {BATI.has("mantine") ? <ColorSchemeScript /> : null}
16
14
  {/* See https://plausible.io/docs/plausible-script */}
@@ -21,8 +19,6 @@ export default function HeadDefault() {
21
19
  } else if (BATI.has("google-analytics")) {
22
20
  return (
23
21
  <>
24
- <meta name="viewport" content="width=device-width, initial-scale=1" />
25
- <meta name="description" content="Demo showcasing Vike" />
26
22
  <link rel="icon" href={logoUrl} />
27
23
  {BATI.has("mantine") ? <ColorSchemeScript /> : null}
28
24
  <script
@@ -43,8 +39,6 @@ export default function HeadDefault() {
43
39
  } else {
44
40
  return (
45
41
  <>
46
- <meta name="viewport" content="width=device-width, initial-scale=1" />
47
- <meta name="description" content="Demo showcasing Vike" />
48
42
  <link rel="icon" href={logoUrl} />
49
43
  {BATI.has("mantine") ? <ColorSchemeScript /> : null}
50
44
  </>
@@ -1,15 +1,19 @@
1
1
  import vikeReact from "vike-react/config";
2
2
  import type { Config } from "vike/types";
3
- import Head from "../layouts/HeadDefault.js";
4
3
  import Layout from "../layouts/LayoutDefault.js";
5
4
 
6
5
  // Default config (can be overridden by pages)
6
+ // https://vike.dev/config
7
+
7
8
  export default {
9
+ // https://vike.dev/Layout
8
10
  Layout,
9
- Head,
11
+
12
+ // https://vike.dev/head-tags
13
+ title: "My Vike App",
14
+ description: "Demo showcasing Vike",
15
+
10
16
  //# BATI.has("auth0") || BATI.has("firebase-auth") || BATI.has("authjs") || BATI.has("lucia-auth")
11
17
  passToClient: ["user"],
12
- // <title>
13
- title: "My Vike App",
14
18
  extends: vikeReact,
15
19
  } satisfies Config;
@@ -1,17 +1,27 @@
1
1
  // https://vike.dev/data
2
2
 
3
- import fetch from "cross-fetch";
4
3
  import type { PageContextServer } from "vike/types";
5
4
  import type { MovieDetails } from "../types.js";
5
+ import { useConfig } from "vike-react/useConfig";
6
6
 
7
7
  export type Data = Awaited<ReturnType<typeof data>>;
8
8
 
9
9
  export const data = async (pageContext: PageContextServer) => {
10
+ // https://vike.dev/useConfig
11
+ const config = useConfig();
12
+
10
13
  const response = await fetch(`https://brillout.github.io/star-wars/api/films/${pageContext.routeParams.id}.json`);
11
14
  let movie = (await response.json()) as MovieDetails;
15
+
16
+ config({
17
+ // Set <title>
18
+ title: movie.title,
19
+ });
20
+
12
21
  // We remove data we don't need because the data is passed to
13
22
  // the client; we should minimize what is sent over the network.
14
23
  movie = minimize(movie);
24
+
15
25
  return movie;
16
26
  };
17
27
 
@@ -1,16 +1,26 @@
1
1
  // https://vike.dev/data
2
2
 
3
- import fetch from "cross-fetch";
4
3
  import type { Movie, MovieDetails } from "../types.js";
4
+ import { useConfig } from "vike-react/useConfig";
5
5
 
6
6
  export type Data = Awaited<ReturnType<typeof data>>;
7
7
 
8
8
  export const data = async () => {
9
+ // https://vike.dev/useConfig
10
+ const config = useConfig();
11
+
9
12
  const response = await fetch("https://brillout.github.io/star-wars/api/films.json");
10
13
  const moviesData = (await response.json()) as MovieDetails[];
14
+
15
+ config({
16
+ // Set <title>
17
+ title: `${moviesData.length} Star Wars Movies`,
18
+ });
19
+
11
20
  // We remove data we don't need because the data is passed to the client; we should
12
21
  // minimize what is sent over the network.
13
22
  const movies = minimize(moviesData);
23
+
14
24
  return movies;
15
25
  };
16
26
 
@@ -1,10 +1,9 @@
1
- import Head from "../layouts/HeadDefault.js";
2
1
  import Layout from "../layouts/LayoutDefault.js";
3
2
  declare const _default: {
4
3
  Layout: typeof Layout;
5
- Head: typeof Head;
6
- passToClient: string[];
7
4
  title: string;
5
+ description: string;
6
+ passToClient: string[];
8
7
  extends: {
9
8
  name: string;
10
9
  require: {
@@ -2,9 +2,16 @@ interface TodoItem {
2
2
  text: string;
3
3
  }
4
4
 
5
- const todos = {
6
- todo: [{ text: "Buy milk" }, { text: "Buy strawberries" }],
7
- };
5
+ const todosDefault = [{ text: "Buy milk" }, { text: "Buy strawberries" }];
6
+
7
+ const database =
8
+ // We create an in-memory database.
9
+ // - We use globalThis so that the database isn't reset upon HMR.
10
+ // - The database is reset when restarting the server, use a proper database (SQLite/PostgreSQL/...) if you want persistent data.
11
+ // biome-ignore lint:
12
+ ((globalThis as unknown as { __database: { todos: TodoItem[] } }).__database ??= { todos: todosDefault });
13
+
14
+ const { todos } = database;
8
15
 
9
16
  export { todos };
10
17
  export type { TodoItem };
@@ -1,10 +1,6 @@
1
1
  interface TodoItem {
2
2
  text: string;
3
3
  }
4
- declare const todos: {
5
- todo: {
6
- text: string;
7
- }[];
8
- };
4
+ declare const todos: TodoItem[];
9
5
  export { todos };
10
6
  export type { TodoItem };
@@ -1,4 +1,5 @@
1
1
  /*# BATI include-if-imported #*/
2
+ // TODO: stop using universal-middleware and directly integrate server middlewares instead. (Bati generates boilerplates that use universal-middleware https://github.com/magne4000/universal-middleware to make Bati's internal logic easier. This is temporary and will be removed soon.)
2
3
  import type { Get, UniversalHandler } from "@universal-middleware/core";
3
4
  import * as drizzleQueries from "@batijs/drizzle/database/drizzle/queries/todos";
4
5
  import * as sqliteQueries from "@batijs/sqlite/database/sqlite/queries/todos";
@@ -1,6 +1,7 @@
1
1
  /*# BATI include-if-imported #*/
2
2
  /// <reference lib="webworker" />
3
3
  import { renderPage } from "vike/server";
4
+ // TODO: stop using universal-middleware and directly integrate server middlewares instead. (Bati generates boilerplates that use universal-middleware https://github.com/magne4000/universal-middleware to make Bati's internal logic easier. This is temporary and will be removed soon.)
4
5
  import type { Get, UniversalHandler } from "@universal-middleware/core";
5
6
 
6
7
  export const vikeHandler: Get<[], UniversalHandler> = () => async (request, context, runtime) => {
@@ -1,5 +1,3 @@
1
- const config = {
1
+ export const config = {
2
2
  prerender: false,
3
3
  };
4
-
5
- export default config;
@@ -23,6 +23,6 @@ export default async function data(_pageContext: PageContextServer): Promise<Dat
23
23
 
24
24
  return { todo };
25
25
  } else {
26
- return todos;
26
+ return { todo: todos };
27
27
  }
28
28
  }
@@ -1,4 +1,3 @@
1
- declare const config: {
1
+ export declare const config: {
2
2
  prerender: boolean;
3
3
  };
4
- export default config;
@@ -34,7 +34,7 @@ SSR is enabled by default. You can [disable it](https://vike.dev/ssr) for all yo
34
34
 
35
35
  ### HTML Streaming
36
36
 
37
- You can enable/disable [HTML streaming](https://vike.dev/streaming) for all your pages, or only for some pages while still using it for others.`;
37
+ You can enable/disable [HTML streaming](https://vike.dev/stream) for all your pages, or only for some pages while still using it for others.`;
38
38
  content.addAbout(about);
39
39
  return content.finalize();
40
40
  }
@@ -43,7 +43,6 @@ var require_package = __commonJS({
43
43
  devDependencies: {
44
44
  "@batijs/compile": "workspace:*",
45
45
  "@types/node": "^18.19.14",
46
- "cross-fetch": "^4.0.0",
47
46
  "solid-js": "^1.8.22",
48
47
  tailwindcss: "^3.4.11",
49
48
  typescript: "^5.6.2",
@@ -67,12 +66,12 @@ var require_package = __commonJS({
67
66
  "./components/Link": {
68
67
  types: "./dist/types/components/Link.d.ts"
69
68
  },
70
- "./layouts/HeadDefault": {
71
- types: "./dist/types/layouts/HeadDefault.d.ts"
72
- },
73
69
  "./layouts/LayoutDefault": {
74
70
  types: "./dist/types/layouts/LayoutDefault.d.ts"
75
71
  },
72
+ "./pages/+Head": {
73
+ types: "./dist/types/pages/+Head.d.ts"
74
+ },
76
75
  "./pages/+config": {
77
76
  types: "./dist/types/pages/+config.d.ts"
78
77
  },
@@ -100,18 +99,12 @@ var require_package = __commonJS({
100
99
  "./pages/star-wars/@id/+Page": {
101
100
  types: "./dist/types/pages/star-wars/@id/+Page.d.ts"
102
101
  },
103
- "./pages/star-wars/@id/+title": {
104
- types: "./dist/types/pages/star-wars/@id/+title.d.ts"
105
- },
106
102
  "./pages/star-wars/index/+data": {
107
103
  types: "./dist/types/pages/star-wars/index/+data.d.ts"
108
104
  },
109
105
  "./pages/star-wars/index/+Page": {
110
106
  types: "./dist/types/pages/star-wars/index/+Page.d.ts"
111
107
  },
112
- "./pages/star-wars/index/+title": {
113
- types: "./dist/types/pages/star-wars/index/+title.d.ts"
114
- },
115
108
  "./pages/todo/TodoList": {
116
109
  types: "./dist/types/pages/todo/TodoList.d.ts"
117
110
  },
@@ -124,12 +117,12 @@ var require_package = __commonJS({
124
117
  "components/Link": [
125
118
  "./dist/types/components/Link.d.ts"
126
119
  ],
127
- "layouts/HeadDefault": [
128
- "./dist/types/layouts/HeadDefault.d.ts"
129
- ],
130
120
  "layouts/LayoutDefault": [
131
121
  "./dist/types/layouts/LayoutDefault.d.ts"
132
122
  ],
123
+ "pages/+Head": [
124
+ "./dist/types/pages/+Head.d.ts"
125
+ ],
133
126
  "pages/+config": [
134
127
  "./dist/types/pages/+config.d.ts"
135
128
  ],
@@ -157,18 +150,12 @@ var require_package = __commonJS({
157
150
  "pages/star-wars/@id/+Page": [
158
151
  "./dist/types/pages/star-wars/@id/+Page.d.ts"
159
152
  ],
160
- "pages/star-wars/@id/+title": [
161
- "./dist/types/pages/star-wars/@id/+title.d.ts"
162
- ],
163
153
  "pages/star-wars/index/+data": [
164
154
  "./dist/types/pages/star-wars/index/+data.d.ts"
165
155
  ],
166
156
  "pages/star-wars/index/+Page": [
167
157
  "./dist/types/pages/star-wars/index/+Page.d.ts"
168
158
  ],
169
- "pages/star-wars/index/+title": [
170
- "./dist/types/pages/star-wars/index/+title.d.ts"
171
- ],
172
159
  "pages/todo/TodoList": [
173
160
  "./dist/types/pages/todo/TodoList.d.ts"
174
161
  ],
@@ -187,7 +174,7 @@ async function getPackageJson(props) {
187
174
  const packageJson = await loadAsJson(props);
188
175
  return addDependency(packageJson, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default), {
189
176
  devDependencies: ["vite"],
190
- dependencies: ["cross-fetch", "solid-js", "vike-solid", "vike"]
177
+ dependencies: ["solid-js", "vike-solid", "vike"]
191
178
  });
192
179
  }
193
180
  export {