@batijs/cli 0.0.476 → 0.0.478

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 (129) hide show
  1. package/dist/boilerplates/@batijs/auth0/files/$.env.js +6 -5
  2. package/dist/boilerplates/@batijs/auth0/files/$README.md.js +3 -3
  3. package/dist/boilerplates/@batijs/auth0/files/$wrangler.toml.js +32 -0
  4. package/dist/boilerplates/@batijs/authjs/files/$package.json.js +7 -6
  5. package/dist/boilerplates/@batijs/authjs/files/server/authjs-handler.ts +42 -35
  6. package/dist/boilerplates/@batijs/authjs/types/server/authjs-handler.d.ts +8 -3
  7. package/dist/boilerplates/@batijs/aws/files/$README.md.js +3 -3
  8. package/dist/boilerplates/@batijs/aws/files/$package.json.js +10 -10
  9. package/dist/boilerplates/@batijs/aws/files/$tsconfig.json.js +3 -3
  10. package/dist/boilerplates/@batijs/biome/files/$package.json.js +4 -4
  11. package/dist/boilerplates/@batijs/cloudflare/files/$package.json.js +17 -26
  12. package/dist/boilerplates/@batijs/cloudflare/files/wrangler.toml +2 -3
  13. package/dist/boilerplates/@batijs/compiled/files/$package.json.js +5 -5
  14. package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +5 -5
  15. package/dist/boilerplates/@batijs/d1/files/$README.md.js +4 -4
  16. package/dist/boilerplates/@batijs/d1/files/$package.json.js +8 -8
  17. package/dist/boilerplates/@batijs/d1/files/$tsconfig.json.js +3 -3
  18. package/dist/boilerplates/@batijs/d1/files/database/d1/helpers.ts +3 -11
  19. package/dist/boilerplates/@batijs/d1-sqlite/files/$package.json.js +7 -7
  20. package/dist/boilerplates/@batijs/drizzle/files/$.env.js +3 -3
  21. package/dist/boilerplates/@batijs/drizzle/files/$README.md.js +3 -3
  22. package/dist/boilerplates/@batijs/drizzle/files/$package.json.js +8 -8
  23. package/dist/boilerplates/@batijs/eslint/files/$package.json.js +8 -8
  24. package/dist/boilerplates/@batijs/eslint/types/eslint.config.d.ts +1 -1
  25. package/dist/boilerplates/@batijs/express/files/$package.json.js +16 -29
  26. package/dist/boilerplates/@batijs/express/files/server/entry.ts +45 -0
  27. package/dist/boilerplates/@batijs/express/types/server/entry.d.ts +3 -0
  28. package/dist/boilerplates/@batijs/fastify/files/$package.json.js +18 -32
  29. package/dist/boilerplates/@batijs/fastify/files/server/entry.ts +52 -0
  30. package/dist/boilerplates/@batijs/fastify/types/server/entry.d.ts +4 -0
  31. package/dist/boilerplates/@batijs/google-analytics/files/$.env.js +3 -3
  32. package/dist/boilerplates/@batijs/h3/files/$package.json.js +21 -32
  33. package/dist/boilerplates/@batijs/h3/files/server/entry.ts +45 -0
  34. package/dist/boilerplates/@batijs/{express/types/express-entry.d.ts → h3/types/server/entry.d.ts} +1 -1
  35. package/dist/boilerplates/@batijs/hono/files/$package.json.js +23 -40
  36. package/dist/boilerplates/@batijs/hono/files/entry_aws_lambda.ts +2 -9
  37. package/dist/boilerplates/@batijs/hono/files/server/entry.ts +53 -0
  38. package/dist/boilerplates/@batijs/hono/types/server/entry.d.ts +4 -0
  39. package/dist/boilerplates/@batijs/mantine/files/$README.md.js +3 -3
  40. package/dist/boilerplates/@batijs/mantine/files/$package.json.js +12 -12
  41. package/dist/boilerplates/@batijs/photon/files/$README.md.js +29 -0
  42. package/dist/boilerplates/@batijs/photon/files/$package.json.js +109 -0
  43. package/dist/boilerplates/@batijs/photon/files/+photon.ts +7 -0
  44. package/dist/boilerplates/@batijs/photon/types/+photon.d.ts +4 -0
  45. package/dist/boilerplates/@batijs/pnpm/files/$pnpm-workspace.yaml.js +3 -3
  46. package/dist/boilerplates/@batijs/prettier/files/$package.json.js +4 -4
  47. package/dist/boilerplates/@batijs/prisma/files/$.env.js +3 -3
  48. package/dist/boilerplates/@batijs/prisma/files/$README.md.js +3 -3
  49. package/dist/boilerplates/@batijs/prisma/files/$package.json.js +6 -6
  50. package/dist/boilerplates/@batijs/react/files/$README.md.js +3 -3
  51. package/dist/boilerplates/@batijs/react/files/$package.json.js +16 -15
  52. package/dist/boilerplates/@batijs/react/files/$tsconfig.json.js +3 -3
  53. package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +5 -5
  54. package/dist/boilerplates/@batijs/react/files/pages/+config.ts +6 -1
  55. package/dist/boilerplates/@batijs/react/types/pages/+config.d.ts +63 -2
  56. package/dist/boilerplates/@batijs/react-sentry/files/$package.json.js +10 -10
  57. package/dist/boilerplates/@batijs/sentry/files/$.env.js +4 -4
  58. package/dist/boilerplates/@batijs/sentry/files/$README.md.js +3 -3
  59. package/dist/boilerplates/@batijs/sentry/files/$package.json.js +6 -6
  60. package/dist/boilerplates/@batijs/sentry/files/$vite.config.ts.js +7 -7
  61. package/dist/boilerplates/@batijs/sentry/files/pages/$+client.ts.js +9 -9
  62. package/dist/boilerplates/@batijs/shadcn-ui/files/$README.md.js +3 -3
  63. package/dist/boilerplates/@batijs/shadcn-ui/files/$package.json.js +7 -7
  64. package/dist/boilerplates/@batijs/shadcn-ui/files/$tsconfig.json.js +3 -3
  65. package/dist/boilerplates/@batijs/shadcn-ui/files/$vite.config.ts.js +5 -5
  66. package/dist/boilerplates/@batijs/shared/files/$README.md.js +9 -9
  67. package/dist/boilerplates/@batijs/shared/files/package.json +3 -3
  68. package/dist/boilerplates/@batijs/shared/files/vite.config.ts +1 -20
  69. package/dist/boilerplates/@batijs/shared-db/files/server/db-middleware.ts +21 -15
  70. package/dist/boilerplates/@batijs/shared-db/types/server/db-middleware.d.ts +2 -2
  71. package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +8 -14
  72. package/dist/boilerplates/@batijs/shared-server/files/server/create-todo-handler.ts +33 -34
  73. package/dist/boilerplates/@batijs/shared-server/types/server/create-todo-handler.d.ts +3 -4
  74. package/dist/boilerplates/@batijs/solid/files/$README.md.js +3 -3
  75. package/dist/boilerplates/@batijs/solid/files/$package.json.js +11 -10
  76. package/dist/boilerplates/@batijs/solid/files/$tsconfig.json.js +3 -3
  77. package/dist/boilerplates/@batijs/solid/files/$vite.config.ts.js +5 -5
  78. package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +6 -1
  79. package/dist/boilerplates/@batijs/solid/types/pages/+config.d.ts +70 -2
  80. package/dist/boilerplates/@batijs/solid-sentry/files/$package.json.js +7 -7
  81. package/dist/boilerplates/@batijs/sqlite/files/$.env.js +3 -3
  82. package/dist/boilerplates/@batijs/sqlite/files/$README.md.js +4 -3
  83. package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +7 -7
  84. package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +9 -9
  85. package/dist/boilerplates/@batijs/tailwindcss/files/$vite.config.ts.js +5 -5
  86. package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +9 -9
  87. package/dist/boilerplates/@batijs/telefunc/files/$vite.config.ts.js +5 -5
  88. package/dist/boilerplates/@batijs/telefunc/files/server/telefunc-handler.ts +34 -27
  89. package/dist/boilerplates/@batijs/telefunc/types/server/telefunc-handler.d.ts +2 -2
  90. package/dist/boilerplates/@batijs/trpc/files/$package.json.js +9 -9
  91. package/dist/boilerplates/@batijs/trpc/files/server/trpc-handler.ts +26 -18
  92. package/dist/boilerplates/@batijs/trpc/types/server/trpc-handler.d.ts +6 -1
  93. package/dist/boilerplates/@batijs/trpc/types/trpc/client.d.ts +1 -1
  94. package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +6 -6
  95. package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +21 -14
  96. package/dist/boilerplates/@batijs/ts-rest/types/server/ts-rest-handler.d.ts +2 -2
  97. package/dist/boilerplates/@batijs/vercel/files/$package.json.js +8 -9
  98. package/dist/boilerplates/@batijs/vercel/files/pages/$+config.ts.js +3 -3
  99. package/dist/boilerplates/@batijs/vue/files/$README.md.js +3 -3
  100. package/dist/boilerplates/@batijs/vue/files/$package.json.js +15 -14
  101. package/dist/boilerplates/@batijs/vue/files/$tsconfig.json.js +3 -3
  102. package/dist/boilerplates/@batijs/vue/files/$vite.config.ts.js +6 -6
  103. package/dist/boilerplates/@batijs/vue/files/pages/+config.ts +6 -1
  104. package/dist/boilerplates/@batijs/vue/types/pages/+config.d.ts +1 -2
  105. package/dist/boilerplates/@batijs/vue-sentry/files/$package.json.js +8 -8
  106. package/dist/boilerplates/boilerplates.json +20 -0
  107. package/dist/{chunk-2SZ4N3E5.js → chunk-LRTYGOU6.js} +83539 -83181
  108. package/dist/index.js +720 -659
  109. package/dist/jiti-ZW3ADF2F-7XIEJQMO.js +2982 -0
  110. package/dist/src-5HGZFBZ3-KQZBBJSW.js +468 -0
  111. package/package.json +10 -10
  112. package/dist/boilerplates/@batijs/cloudflare/files/$tsconfig.json.js +0 -19
  113. package/dist/boilerplates/@batijs/cloudflare/files/$vite.config.ts.js +0 -34
  114. package/dist/boilerplates/@batijs/express/files/express-entry.ts +0 -102
  115. package/dist/boilerplates/@batijs/fastify/files/fastify-entry.ts +0 -140
  116. package/dist/boilerplates/@batijs/fastify/types/fastify-entry.d.ts +0 -3
  117. package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +0 -144
  118. package/dist/boilerplates/@batijs/h3/types/h3-entry.d.ts +0 -4
  119. package/dist/boilerplates/@batijs/hono/files/$vite.config.ts.js +0 -36
  120. package/dist/boilerplates/@batijs/hono/files/hono-entry.node.ts +0 -31
  121. package/dist/boilerplates/@batijs/hono/files/hono-entry.ts +0 -74
  122. package/dist/boilerplates/@batijs/hono/types/hono-entry.d.ts +0 -6
  123. package/dist/boilerplates/@batijs/hono/types/hono-entry.node.d.ts +0 -1
  124. package/dist/boilerplates/@batijs/shared-server/files/server/vike-handler.ts +0 -20
  125. package/dist/boilerplates/@batijs/shared-server/types/server/vike-handler.d.ts +0 -2
  126. package/dist/boilerplates/@batijs/vercel/files/$tsconfig.json.js +0 -19
  127. package/dist/boilerplates/@batijs/vercel/files/$vite.config.ts.js +0 -27
  128. package/dist/jiti-W5Y5D52V-VBLACVBV.js +0 -30587
  129. package/dist/src-UAKFXUB2-DFO2P37K.js +0 -417
@@ -3,20 +3,21 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- MBs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ kUs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
11
11
  // ../../boilerplates/auth0/dist/files/$.env.js
12
12
  async function getEnv(props) {
13
+ if (props.meta.BATI.has("cloudflare")) return;
13
14
  const auth0ClientId = process.env.TEST_AUTH0_CLIENT_ID;
14
15
  const auth0ClientSecret = process.env.TEST_AUTH0_CLIENT_SECRET;
15
16
  const auth0BaseUrl = process.env.TEST_AUTH0_ISSUER_BASE_URL;
16
17
  let envContent = await props.readfile?.();
17
- envContent = MBs(envContent, "AUTH0_CLIENT_ID", auth0ClientId ?? "", "Auth0 Client ID");
18
- envContent = MBs(envContent, "AUTH0_CLIENT_SECRET", auth0ClientSecret ?? "", "Auth0 Client Secret");
19
- envContent = MBs(envContent, "AUTH0_ISSUER_BASE_URL", auth0BaseUrl ?? "", "Auth0 base URL");
18
+ envContent = kUs(envContent, "AUTH0_CLIENT_ID", auth0ClientId ?? "", "Auth0 Client ID");
19
+ envContent = kUs(envContent, "AUTH0_CLIENT_SECRET", auth0ClientSecret ?? "", "Auth0 Client Secret");
20
+ envContent = kUs(envContent, "AUTH0_ISSUER_BASE_URL", auth0BaseUrl ?? "", "Auth0 base URL");
20
21
  return envContent;
21
22
  }
22
23
  export {
@@ -3,14 +3,14 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- ZEs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ Wxs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
11
11
  // ../../boilerplates/auth0/dist/files/$README.md.js
12
12
  async function getReadme(props) {
13
- const content = await ZEs(props);
13
+ const content = await Wxs(props);
14
14
  const todo = `
15
15
  ## *Auth0*
16
16
  - Sign up or login to an Auth0 account, then go to [your Dashboard](https://manage.auth0.com/dashboard/)
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as createRequire_BATI_CLI } from 'module';
3
+ const require = createRequire_BATI_CLI(import.meta.url);
4
+
5
+ import "../../../../chunk-DHZ7AZKP.js";
6
+
7
+ // ../../boilerplates/auth0/dist/files/$wrangler.toml.js
8
+ async function getEnv(props) {
9
+ if (!props.meta.BATI.has("cloudflare")) return;
10
+ const content = await props.readfile?.();
11
+ if (!content) {
12
+ throw new Error("wrangler.toml should not be empty");
13
+ }
14
+ const auth0ClientId = process.env.TEST_AUTH0_CLIENT_ID;
15
+ const auth0ClientSecret = process.env.TEST_AUTH0_CLIENT_SECRET;
16
+ const auth0BaseUrl = process.env.TEST_AUTH0_ISSUER_BASE_URL;
17
+ const varsSnippet = `
18
+ # top level environment
19
+ [vars]
20
+ # Auth0 Client ID
21
+ AUTH0_CLIENT_ID = ${JSON.stringify(auth0ClientId ?? "")}
22
+ # Auth0 Client Secret
23
+ AUTH0_CLIENT_SECRET = ${JSON.stringify(auth0ClientSecret ?? "")}
24
+ # Auth0 base URL
25
+ AUTH0_ISSUER_BASE_URL = ${JSON.stringify(auth0BaseUrl ?? "")}
26
+ `;
27
+ return `${content}
28
+ ${varsSnippet}`;
29
+ }
30
+ export {
31
+ getEnv as default
32
+ };
@@ -3,8 +3,8 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- txs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ $xs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
@@ -50,10 +50,11 @@ var require_package = __commonJS({
50
50
  author: "",
51
51
  license: "MIT",
52
52
  devDependencies: {
53
- "@auth/core": "^0.40.0",
53
+ "@auth/core": "^0.41.0",
54
54
  "@batijs/compile": "workspace:*",
55
- "@types/node": "^20.19.9",
56
- "@universal-middleware/core": "^0.4.10"
55
+ "@cloudflare/workers-types": "^4.20251011.0",
56
+ "@types/node": "^20.19.21",
57
+ "@universal-middleware/core": "^0.4.11"
57
58
  },
58
59
  dependencies: {
59
60
  "@batijs/core": "workspace:*"
@@ -87,7 +88,7 @@ var require_package = __commonJS({
87
88
  }
88
89
  });
89
90
  async function getPackageJson(props) {
90
- const packageJson = await txs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
91
+ const packageJson = await $xs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
91
92
  return packageJson.addDependencies(["@auth/core", "@universal-middleware/core"]);
92
93
  }
93
94
  export {
@@ -1,31 +1,24 @@
1
+ //# BATI.has("cloudflare")
2
+ /// <reference types="@cloudflare/workers-types" />
3
+ import { env as cloudflareEnv } from "cloudflare:workers";
1
4
  import { Auth, type AuthConfig, createActionURL, setEnvDefaults } from "@auth/core";
2
5
  import Auth0 from "@auth/core/providers/auth0";
3
6
  import CredentialsProvider from "@auth/core/providers/credentials";
4
7
  import type { Session } from "@auth/core/types";
5
- // TODO: stop using universal-middleware and directly integrate server middlewares instead and/or use vike-server https://vike.dev/vike-server. (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.)
6
- import type { Get, UniversalHandler, UniversalMiddleware } from "@universal-middleware/core";
8
+ import { enhance, type UniversalHandler, type UniversalMiddleware } from "@universal-middleware/core";
7
9
 
8
- const env: Record<string, string | undefined> =
9
- typeof process?.env !== "undefined"
10
+ //# BATI.has("auth0")
11
+ const env: Record<string, string | undefined> = BATI.has("cloudflare")
12
+ ? (cloudflareEnv as Record<string, string | undefined>)
13
+ : typeof process?.env !== "undefined"
10
14
  ? process.env
11
15
  : import.meta && "env" in import.meta
12
16
  ? (import.meta as ImportMeta & { env: Record<string, string | undefined> }).env
13
17
  : {};
14
18
 
15
- if (!globalThis.crypto) {
16
- /**
17
- * Polyfill needed if Auth.js code runs on node18
18
- */
19
- Object.defineProperty(globalThis, "crypto", {
20
- value: await import("node:crypto").then((crypto) => crypto.webcrypto as Crypto),
21
- writable: false,
22
- configurable: true,
23
- });
24
- }
25
-
26
19
  const authjsConfig = {
27
20
  basePath: "/api/auth",
28
- trustHost: Boolean(env.AUTH_TRUST_HOST ?? env.VERCEL ?? env.NODE_ENV !== "production"),
21
+ trustHost: true,
29
22
  // TODO: Replace secret {@see https://authjs.dev/reference/core#secret}
30
23
  secret: "MY_SECRET",
31
24
  providers: [
@@ -70,33 +63,47 @@ export async function getSession(req: Request, config: Omit<AuthConfig, "raw">):
70
63
  const data = await response.json();
71
64
 
72
65
  if (!data || !Object.keys(data).length) return null;
73
- if (status === 200) return data;
74
- throw new Error(data.message);
66
+ if (status === 200) return data as Session;
67
+ throw new Error(typeof data === "object" && "message" in data ? (data.message as string) : undefined);
75
68
  }
76
69
 
77
70
  /**
78
71
  * Add Auth.js session to context
79
72
  * @link {@see https://authjs.dev/getting-started/session-management/get-session}
80
73
  **/
81
- export const authjsSessionMiddleware: Get<[], UniversalMiddleware> = () => async (request, context) => {
82
- try {
83
- return {
84
- ...context,
85
- session: await getSession(request, authjsConfig),
86
- };
87
- } catch (error) {
88
- console.debug("authjsSessionMiddleware:", error);
89
- return {
90
- ...context,
91
- session: null,
92
- };
93
- }
94
- };
74
+ export const authjsSessionMiddleware: UniversalMiddleware = enhance(
75
+ async (request, context) => {
76
+ try {
77
+ return {
78
+ ...context,
79
+ session: await getSession(request, authjsConfig),
80
+ };
81
+ } catch (error) {
82
+ console.debug("authjsSessionMiddleware:", error);
83
+ return {
84
+ ...context,
85
+ session: null,
86
+ };
87
+ }
88
+ },
89
+ {
90
+ name: "my-app:authjs-middleware",
91
+ immutable: false,
92
+ },
93
+ );
95
94
 
96
95
  /**
97
96
  * Auth.js route
98
97
  * @link {@see https://authjs.dev/getting-started/installation}
99
98
  **/
100
- export const authjsHandler = (() => async (request) => {
101
- return Auth(request, authjsConfig);
102
- }) satisfies Get<[], UniversalHandler>;
99
+ export const authjsHandler = enhance(
100
+ async (request) => {
101
+ return Auth(request, authjsConfig);
102
+ },
103
+ {
104
+ name: "my-app:authjs-handler",
105
+ path: "/api/auth/**",
106
+ method: ["GET", "POST"],
107
+ immutable: false,
108
+ },
109
+ ) satisfies UniversalHandler;
@@ -1,6 +1,6 @@
1
1
  import { type AuthConfig } from "@auth/core";
2
2
  import type { Session } from "@auth/core/types";
3
- import type { Get, UniversalMiddleware } from "@universal-middleware/core";
3
+ import { type UniversalMiddleware } from "@universal-middleware/core";
4
4
  /**
5
5
  * Retrieve Auth.js session from Request
6
6
  */
@@ -9,9 +9,14 @@ export declare function getSession(req: Request, config: Omit<AuthConfig, "raw">
9
9
  * Add Auth.js session to context
10
10
  * @link {@see https://authjs.dev/getting-started/session-management/get-session}
11
11
  **/
12
- export declare const authjsSessionMiddleware: Get<[], UniversalMiddleware>;
12
+ export declare const authjsSessionMiddleware: UniversalMiddleware;
13
13
  /**
14
14
  * Auth.js route
15
15
  * @link {@see https://authjs.dev/getting-started/installation}
16
16
  **/
17
- export declare const authjsHandler: () => (request: Request) => Promise<Response>;
17
+ export declare const authjsHandler: ((request: Request<unknown, CfProperties<unknown>>) => Promise<Response>) & import("@universal-middleware/core").WithUniversalSymbols<{
18
+ name: string;
19
+ path: string;
20
+ method: ("GET" | "POST")[];
21
+ immutable: false;
22
+ }>;
@@ -3,14 +3,14 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- ZEs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ Wxs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
11
11
  // ../../boilerplates/aws/dist/files/$README.md.js
12
12
  async function getReadme(props) {
13
- const content = await ZEs(props);
13
+ const content = await Wxs(props);
14
14
  const todo = `
15
15
  ## *AWS CDK Deployment*
16
16
 
@@ -3,8 +3,8 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- txs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ $xs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
@@ -51,17 +51,17 @@ var require_package = __commonJS({
51
51
  license: "MIT",
52
52
  devDependencies: {
53
53
  "@batijs/compile": "workspace:*",
54
- "@types/node": "^20.19.9",
54
+ "@types/node": "^20.19.21",
55
55
  "@types/which": "^3.0.4",
56
- "aws-cdk": "^2.1029.0",
57
- "aws-cdk-lib": "^2.214.0",
58
- cdk: "^2.1029.0",
56
+ "aws-cdk": "^2.1030.0",
57
+ "aws-cdk-lib": "^2.220.0",
58
+ cdk: "^2.1030.0",
59
59
  constructs: "^10.4.2",
60
- esbuild: "^0.25.9",
60
+ esbuild: "^0.25.11",
61
61
  "npm-run-all2": "^8.0.4",
62
62
  "source-map-support": "^0.5.21",
63
- tsx: "^4.20.5",
64
- typescript: "^5.9.2",
63
+ tsx: "^4.20.6",
64
+ typescript: "^5.9.3",
65
65
  vitest: "^3.2.4",
66
66
  which: "^5.0.0"
67
67
  },
@@ -111,7 +111,7 @@ var require_package = __commonJS({
111
111
  }
112
112
  });
113
113
  async function getPackageJson(props) {
114
- const packageJson = await txs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
114
+ const packageJson = await $xs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
115
115
  return packageJson.setScript("test", {
116
116
  value: "vitest",
117
117
  precedence: 0
@@ -3,14 +3,14 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- exs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ Jxs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
11
11
  // ../../boilerplates/aws/dist/files/$tsconfig.json.js
12
12
  async function getTsConfig(props) {
13
- const tsConfig = await exs(props);
13
+ const tsConfig = await Jxs(props);
14
14
  tsConfig.compilerOptions.types = [
15
15
  ...tsConfig.compilerOptions.types ?? [],
16
16
  "@types/node",
@@ -3,8 +3,8 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- txs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ $xs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
@@ -52,7 +52,7 @@ var require_package = __commonJS({
52
52
  devDependencies: {
53
53
  "@batijs/compile": "workspace:*",
54
54
  "@biomejs/biome": "2.2.3",
55
- "@types/node": "^20.19.9"
55
+ "@types/node": "^20.19.21"
56
56
  },
57
57
  dependencies: {
58
58
  "@batijs/core": "workspace:*"
@@ -69,7 +69,7 @@ var require_package = __commonJS({
69
69
  }
70
70
  });
71
71
  async function getPackageJson(props) {
72
- const packageJson = await txs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
72
+ const packageJson = await $xs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
73
73
  return packageJson.setScript("lint", {
74
74
  value: "biome lint --write .",
75
75
  precedence: 0
@@ -3,8 +3,8 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- txs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ $xs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
@@ -51,11 +51,10 @@ var require_package = __commonJS({
51
51
  license: "MIT",
52
52
  devDependencies: {
53
53
  "@batijs/compile": "workspace:*",
54
- "@cloudflare/workers-types": "^4.20250906.0",
55
- "@types/node": "^20.19.9",
56
- "npm-run-all2": "^8.0.4",
57
- "vike-cloudflare": "^0.1.7",
58
- wrangler: "^4.34.0"
54
+ "@cloudflare/workers-types": "^4.20251011.0",
55
+ "@photonjs/cloudflare": "^0.1.3",
56
+ "@types/node": "^20.19.21",
57
+ wrangler: "^4.43.0"
59
58
  },
60
59
  dependencies: {
61
60
  "@batijs/core": "workspace:*"
@@ -70,14 +69,14 @@ var require_package = __commonJS({
70
69
  enforce: "post"
71
70
  },
72
71
  exports: {
73
- "./test": {
74
- types: "./dist/types/test.d.ts"
72
+ "./cloudflare-entry": {
73
+ types: "./dist/types/cloudflare-entry.d.ts"
75
74
  }
76
75
  },
77
76
  typesVersions: {
78
77
  "*": {
79
- test: [
80
- "./dist/types/test.d.ts"
78
+ "cloudflare-entry": [
79
+ "./dist/types/cloudflare-entry.d.ts"
81
80
  ]
82
81
  }
83
82
  }
@@ -85,24 +84,16 @@ var require_package = __commonJS({
85
84
  }
86
85
  });
87
86
  async function getPackageJson(props) {
88
- const packageJson = await txs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
89
- return packageJson.setScript("preview:wrangler", {
90
- value: "wrangler pages dev",
91
- precedence: 40,
92
- warnIfReplaced: true
93
- }).setScript("preview", {
94
- value: "run-s build preview:wrangler",
95
- precedence: 40,
96
- warnIfReplaced: true
97
- }).setScript("deploy:wrangler", {
98
- value: "wrangler pages deploy",
99
- precedence: 40,
87
+ const packageJson = await $xs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
88
+ return packageJson.setScript("prod", {
89
+ value: "vike build && wrangler dev ./dist/server/index.js -c ./dist/server/wrangler.json",
90
+ precedence: 25,
100
91
  warnIfReplaced: true
101
92
  }).setScript("deploy", {
102
- value: props.meta.BATI.hasD1 ? "run-s build d1:deploy deploy:wrangler" : "run-s build deploy:wrangler",
103
- precedence: 40,
93
+ value: "vike build && wrangler deploy",
94
+ precedence: 25,
104
95
  warnIfReplaced: true
105
- }).addDevDependencies(["@cloudflare/workers-types"]).addDependencies(["vike-cloudflare"]).addDevDependencies(["wrangler"], ["preview:wrangler", "deploy:wrangler", "preview", "deploy"]).addDevDependencies(["npm-run-all2"], ["preview", "deploy"]);
96
+ }).addDevDependencies(["@cloudflare/workers-types", "wrangler"]).addDependencies(["@photonjs/cloudflare"]);
106
97
  }
107
98
  export {
108
99
  getPackageJson as default
@@ -1,4 +1,3 @@
1
1
  name = "my-app"
2
- compatibility_date = "2024-09-29"
3
- pages_build_output_dir = "./dist/cloudflare"
4
- compatibility_flags = [ "nodejs_compat" ]
2
+ compatibility_date = "2025-09-06"
3
+ main = "virtual:photon:cloudflare:server-entry"
@@ -3,8 +3,8 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- txs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ $xs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
@@ -51,8 +51,8 @@ var require_package = __commonJS({
51
51
  license: "MIT",
52
52
  devDependencies: {
53
53
  "@batijs/compile": "workspace:*",
54
- "@types/node": "^20.19.9",
55
- vite: "^7.1.4",
54
+ "@types/node": "^20.19.21",
55
+ vite: "^7.1.10",
56
56
  "vite-plugin-compiled-react": "^1.3.1"
57
57
  },
58
58
  dependencies: {
@@ -71,7 +71,7 @@ var require_package = __commonJS({
71
71
  }
72
72
  });
73
73
  async function getPackageJson(props) {
74
- const packageJson = await txs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
74
+ const packageJson = await $xs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
75
75
  return packageJson.addDevDependencies(["vite-plugin-compiled-react"]).addDependencies(["@compiled/react"]);
76
76
  }
77
77
  export {
@@ -3,16 +3,16 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- Zri,
7
- rxs
8
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ Kxs,
7
+ hni
8
+ } from "../../../../chunk-LRTYGOU6.js";
9
9
  import "../../../../chunk-IAWYWZSL.js";
10
10
  import "../../../../chunk-DHZ7AZKP.js";
11
11
 
12
12
  // ../../boilerplates/compiled/dist/files/$vite.config.ts.js
13
13
  async function getViteConfig(props) {
14
- const mod = await rxs(props);
15
- Zri(mod, {
14
+ const mod = await Kxs(props);
15
+ hni(mod, {
16
16
  from: "vite-plugin-compiled-react",
17
17
  constructor: "compiled",
18
18
  imported: "compiled",
@@ -3,14 +3,14 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- ZEs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ Wxs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
11
11
  // ../../boilerplates/d1/dist/files/$README.md.js
12
12
  async function getReadme(props) {
13
- const content = await ZEs(props);
13
+ const content = await Wxs(props);
14
14
  const todo = `
15
15
  ## *Cloudflare D1*
16
16
 
@@ -22,7 +22,7 @@ wrangler d1 create <your-db-name>
22
22
 
23
23
  Then, copy the output to \`wrangler.toml\`.
24
24
 
25
- Finally, update the \`d1:migrate\` script (in \`package.json\`) to replace \`YOUR_DATABASE_NAME\`, and execute it.
25
+ Finally, update the \`${props.meta.BATI.has("drizzle") ? "drizzle" : "d1"}:migrate\` script (in \`package.json\`) to replace \`YOUR_DATABASE_NAME\`, and execute it.
26
26
 
27
27
  > [!NOTE]
28
28
  > For reference, a good database name is:
@@ -3,8 +3,8 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- txs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ $xs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
@@ -51,11 +51,11 @@ var require_package = __commonJS({
51
51
  license: "MIT",
52
52
  devDependencies: {
53
53
  "@batijs/compile": "workspace:*",
54
- "@cloudflare/workers-types": "^4.20250906.0",
55
- "@types/node": "^20.19.9",
56
- "@universal-middleware/core": "^0.4.10",
57
- vike: "^0.4.239",
58
- wrangler: "^4.34.0"
54
+ "@cloudflare/workers-types": "^4.20251011.0",
55
+ "@types/node": "^20.19.21",
56
+ "@universal-middleware/core": "^0.4.11",
57
+ vike: "^0.4.242",
58
+ wrangler: "^4.43.0"
59
59
  },
60
60
  dependencies: {
61
61
  "@batijs/core": "workspace:*"
@@ -92,7 +92,7 @@ var require_package = __commonJS({
92
92
  }
93
93
  });
94
94
  async function getPackageJson(props) {
95
- const packageJson = await txs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
95
+ const packageJson = await $xs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
96
96
  return packageJson.addDevDependencies(["@universal-middleware/core"]);
97
97
  }
98
98
  export {
@@ -3,14 +3,14 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- exs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ Jxs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
11
11
  // ../../boilerplates/d1/dist/files/$tsconfig.json.js
12
12
  async function getTsConfig(props) {
13
- const tsConfig = await exs(props);
13
+ const tsConfig = await Jxs(props);
14
14
  tsConfig.compilerOptions.types = [...tsConfig.compilerOptions.types ?? [], "@cloudflare/workers-types"];
15
15
  return tsConfig;
16
16
  }
@@ -5,17 +5,9 @@ import type { RuntimeAdapter } from "@universal-middleware/core";
5
5
  * Retrieve Cloudflare `env.DB` from `universal-middleware` runtime
6
6
  */
7
7
  export async function getDbFromRuntime(runtime: RuntimeAdapter): Promise<D1Database> {
8
- if (runtime.runtime === "workerd") {
9
- // biome-ignore lint/style/noNonNullAssertion: always exists
10
- return runtime.env!.DB as D1Database;
8
+ if (runtime.runtime === "workerd" && runtime.env) {
9
+ return runtime.env.DB as D1Database;
11
10
  }
12
11
 
13
- if (process.env.NODE_ENV !== "production") {
14
- // When running on node, simulate Cloudflare environment with "wrangler"
15
- const { getPlatformProxy } = await import("wrangler");
16
- const { env } = await getPlatformProxy();
17
- return env.DB as D1Database;
18
- }
19
-
20
- throw new Error("Database not available in production build");
12
+ throw new Error("Database is not available");
21
13
  }
@@ -3,8 +3,8 @@ import { createRequire as createRequire_BATI_CLI } from 'module';
3
3
  const require = createRequire_BATI_CLI(import.meta.url);
4
4
 
5
5
  import {
6
- txs
7
- } from "../../../../chunk-2SZ4N3E5.js";
6
+ $xs
7
+ } from "../../../../chunk-LRTYGOU6.js";
8
8
  import "../../../../chunk-IAWYWZSL.js";
9
9
  import "../../../../chunk-DHZ7AZKP.js";
10
10
 
@@ -51,10 +51,10 @@ var require_package = __commonJS({
51
51
  license: "MIT",
52
52
  devDependencies: {
53
53
  "@batijs/compile": "workspace:*",
54
- "@cloudflare/workers-types": "^4.20250906.0",
55
- "@types/node": "^20.19.9",
56
- "@universal-middleware/core": "^0.4.10",
57
- vike: "^0.4.239"
54
+ "@cloudflare/workers-types": "^4.20251011.0",
55
+ "@types/node": "^20.19.21",
56
+ "@universal-middleware/core": "^0.4.11",
57
+ vike: "^0.4.242"
58
58
  },
59
59
  dependencies: {
60
60
  "@batijs/core": "workspace:*"
@@ -88,7 +88,7 @@ var require_package = __commonJS({
88
88
  }
89
89
  });
90
90
  async function getPackageJson(props) {
91
- const packageJson = await txs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
91
+ const packageJson = await $xs(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
92
92
  return packageJson.setScript("d1:migrate", {
93
93
  value: "wrangler d1 migrations apply YOUR_DATABASE_NAME --local",
94
94
  precedence: 0