@batijs/cli 0.0.650 → 0.0.651

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 (93) hide show
  1. package/dist/boilerplates/@batijs/authjs/files/server/authjs-handler.ts +1 -1
  2. package/dist/boilerplates/@batijs/aws/files/cdk/bin/infrastructure.ts +1 -1
  3. package/dist/boilerplates/@batijs/better-auth/files/database/better-auth/migrate.ts +1 -3
  4. package/dist/boilerplates/@batijs/better-auth/files/database/drizzle/schema/auth.ts +5 -5
  5. package/dist/boilerplates/@batijs/better-auth/files/server/better-auth-handler.ts +2 -2
  6. package/dist/boilerplates/@batijs/better-auth/files/server/better-auth.ts +8 -8
  7. package/dist/boilerplates/@batijs/cloudflare/files/$vite.config.ts.js +9 -9
  8. package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +9 -9
  9. package/dist/boilerplates/@batijs/docker-compose/files/docker-compose.yml +6 -6
  10. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/db.ts +3 -3
  11. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/queries/todos.ts +10 -10
  12. package/dist/boilerplates/@batijs/drizzle/files/database/drizzle/schema/todos.ts +2 -2
  13. package/dist/boilerplates/@batijs/drizzle/files/drizzle.config.ts +3 -3
  14. package/dist/boilerplates/@batijs/drizzle/types/database/drizzle/queries/todos.d.mts +6 -6
  15. package/dist/boilerplates/@batijs/edgeone/files/$vite.config.ts.js +7 -7
  16. package/dist/boilerplates/@batijs/elysia/files/+server.ts +1 -1
  17. package/dist/boilerplates/@batijs/elysia/files/server/elysia.ts +9 -9
  18. package/dist/boilerplates/@batijs/eslint/files/eslint.config.ts +14 -14
  19. package/dist/boilerplates/@batijs/express/files/+server.ts +10 -10
  20. package/dist/boilerplates/@batijs/fastify/files/+server.ts +10 -10
  21. package/dist/boilerplates/@batijs/hono/files/+server.ts +2 -2
  22. package/dist/boilerplates/@batijs/hono/files/entry_aws_lambda.ts +1 -3
  23. package/dist/boilerplates/@batijs/hono/files/server/hono.ts +9 -9
  24. package/dist/boilerplates/@batijs/kysely/files/$vite.config.ts.js +9 -12
  25. package/dist/boilerplates/@batijs/kysely/files/database/kysely/db.ts +5 -5
  26. package/dist/boilerplates/@batijs/kysely/files/database/kysely/migrate.ts +2 -4
  27. package/dist/boilerplates/@batijs/kysely/files/database/kysely/migrations/001_create_todos_table.ts +2 -3
  28. package/dist/boilerplates/@batijs/kysely/files/database/kysely/queries/todos.ts +8 -8
  29. package/dist/boilerplates/@batijs/kysely/files/vite-plugin-input.ts +1 -2
  30. package/dist/boilerplates/@batijs/kysely/types/database/kysely/queries/todos.d.mts +8 -8
  31. package/dist/boilerplates/@batijs/netlify/files/$vite.config.ts.js +8 -8
  32. package/dist/boilerplates/@batijs/postgres/files/database/postgres/db.ts +1 -1
  33. package/dist/boilerplates/@batijs/postgres/files/database/postgres/schema/todos.ts +1 -1
  34. package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +7 -7
  35. package/dist/boilerplates/@batijs/react/files/pages/+Head.tsx +6 -6
  36. package/dist/boilerplates/@batijs/react/files/pages/+Layout.tsx +14 -14
  37. package/dist/boilerplates/@batijs/react/files/pages/+config.ts +3 -3
  38. package/dist/boilerplates/@batijs/react/files/pages/index/+Page.tsx +1 -1
  39. package/dist/boilerplates/@batijs/react/files/pages/index/Counter.tsx +3 -3
  40. package/dist/boilerplates/@batijs/react/files/pages/todo/TodoList.tsx +6 -6
  41. package/dist/boilerplates/@batijs/react-better-auth/files/pages/account/+Page.tsx +1 -1
  42. package/dist/boilerplates/@batijs/react-better-auth/files/pages/login/+Page.tsx +4 -4
  43. package/dist/boilerplates/@batijs/react-better-auth/files/pages/signup/+Page.tsx +4 -4
  44. package/dist/boilerplates/@batijs/sentry/files/$vite.config.ts.js +10 -10
  45. package/dist/boilerplates/@batijs/sentry/files/pages/$+client.ts.js +12 -18
  46. package/dist/boilerplates/@batijs/shadcn-ui/files/$vite.config.ts.js +5 -27
  47. package/dist/boilerplates/@batijs/shared/files/vite.config.ts +1 -1
  48. package/dist/boilerplates/@batijs/shared-db/files/server/db-middleware.ts +21 -21
  49. package/dist/boilerplates/@batijs/shared-db/types/server/db-middleware.d.mts +10 -10
  50. package/dist/boilerplates/@batijs/shared-env/files/server/env.ts +6 -4
  51. package/dist/boilerplates/@batijs/shared-env/files/server/load.ts +1 -1
  52. package/dist/boilerplates/@batijs/shared-env/types/server/env.d.mts +2 -2
  53. package/dist/boilerplates/@batijs/shared-server/files/server/create-todo-handler.ts +16 -16
  54. package/dist/boilerplates/@batijs/shared-server/types/server/create-todo-handler.d.mts +10 -10
  55. package/dist/boilerplates/@batijs/shared-todo/files/global.d.ts +11 -11
  56. package/dist/boilerplates/@batijs/shared-todo/files/pages/todo/+config.ts +1 -4
  57. package/dist/boilerplates/@batijs/shared-todo/files/pages/todo/+data.ts +5 -5
  58. package/dist/boilerplates/@batijs/solid/files/$vite.config.ts.js +7 -7
  59. package/dist/boilerplates/@batijs/solid/files/pages/+Head.tsx +3 -4
  60. package/dist/boilerplates/@batijs/solid/files/pages/+Layout.tsx +10 -10
  61. package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +3 -3
  62. package/dist/boilerplates/@batijs/solid/files/pages/index/Counter.tsx +2 -2
  63. package/dist/boilerplates/@batijs/solid/files/pages/todo/TodoList.tsx +6 -6
  64. package/dist/boilerplates/@batijs/solid-better-auth/files/pages/account/+Page.tsx +1 -1
  65. package/dist/boilerplates/@batijs/solid-better-auth/files/pages/login/+Page.tsx +4 -4
  66. package/dist/boilerplates/@batijs/solid-better-auth/files/pages/signup/+Page.tsx +4 -4
  67. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/db.ts +1 -1
  68. package/dist/boilerplates/@batijs/sqlite/files/database/sqlite/schema/todos.ts +1 -1
  69. package/dist/boilerplates/@batijs/tailwindcss/files/$vite.config.ts.js +7 -7
  70. package/dist/boilerplates/@batijs/tailwindcss/files/pages/tailwind.css +2 -2
  71. package/dist/boilerplates/@batijs/telefunc/files/$vite.config.ts.js +8 -8
  72. package/dist/boilerplates/@batijs/telefunc/files/global.d.ts +12 -12
  73. package/dist/boilerplates/@batijs/telefunc/files/pages/todo/TodoList.telefunc.ts +5 -5
  74. package/dist/boilerplates/@batijs/telefunc/files/server/telefunc-handler.ts +12 -12
  75. package/dist/boilerplates/@batijs/trpc/files/server/trpc-handler.ts +4 -4
  76. package/dist/boilerplates/@batijs/trpc/files/trpc/server.ts +15 -15
  77. package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +15 -15
  78. package/dist/boilerplates/@batijs/vercel/files/$vite.config.ts.js +8 -8
  79. package/dist/boilerplates/@batijs/vue/files/$vite.config.ts.js +7 -7
  80. package/dist/boilerplates/@batijs/vue/files/components/Content.vue +2 -2
  81. package/dist/boilerplates/@batijs/vue/files/components/Counter.vue +3 -3
  82. package/dist/boilerplates/@batijs/vue/files/components/Logo.vue +2 -2
  83. package/dist/boilerplates/@batijs/vue/files/components/Sidebar.vue +2 -2
  84. package/dist/boilerplates/@batijs/vue/files/pages/+Head.vue +2 -3
  85. package/dist/boilerplates/@batijs/vue/files/pages/+Layout.vue +3 -3
  86. package/dist/boilerplates/@batijs/vue/files/pages/+config.ts +3 -3
  87. package/dist/boilerplates/@batijs/vue/files/pages/+onCreateApp.ts +1 -1
  88. package/dist/boilerplates/@batijs/vue/files/pages/todo/TodoList.vue +8 -8
  89. package/dist/boilerplates/@batijs/vue-better-auth/files/pages/account/+Page.vue +1 -1
  90. package/dist/boilerplates/@batijs/vue-better-auth/files/pages/login/+Page.vue +3 -3
  91. package/dist/boilerplates/@batijs/vue-better-auth/files/pages/signup/+Page.vue +2 -2
  92. package/dist/index.js +40 -43
  93. package/package.json +5 -5
@@ -12,31 +12,31 @@ function getApp() {
12
12
  const app = new Hono();
13
13
 
14
14
  vike(app, [
15
- //# BATI.hasDbDemo
15
+ // $$.BATI.hasDbDemo
16
16
  // Make database available in Context as `context.db`
17
17
  dbMiddleware,
18
- //# BATI.has("authjs") || BATI.has("auth0")
18
+ // $$.BATI.has("authjs") || $$.BATI.has("auth0")
19
19
  // Append Auth.js session to context
20
20
  authjsSessionMiddleware,
21
- //# BATI.has("authjs") || BATI.has("auth0")
21
+ // $$.BATI.has("authjs") || $$.BATI.has("auth0")
22
22
  // Auth.js route. See https://authjs.dev/getting-started/installation
23
23
  authjsHandler,
24
- //# BATI.has("better-auth")
24
+ // $$.BATI.has("better-auth")
25
25
  // Append Better Auth user to context
26
26
  betterAuthSessionMiddleware,
27
- //# BATI.has("better-auth")
27
+ // $$.BATI.has("better-auth")
28
28
  // Better Auth route. See https://better-auth.com/docs/installation
29
29
  betterAuthHandler,
30
- //# BATI.has("trpc")
30
+ // $$.BATI.has("trpc")
31
31
  // tRPC route. See https://trpc.io/docs/server/adapters
32
32
  trpcHandler("/api/trpc"),
33
- //# BATI.has("telefunc")
33
+ // $$.BATI.has("telefunc")
34
34
  // Telefunc route. See https://telefunc.com
35
35
  telefuncHandler,
36
- //# BATI.has("ts-rest")
36
+ // $$.BATI.has("ts-rest")
37
37
  // ts-rest route. See https://ts-rest.com
38
38
  tsRestHandler,
39
- //# !BATI.has("telefunc") && !BATI.has("trpc") && !BATI.has("ts-rest")
39
+ // !$$.BATI.has("telefunc") && !$$.BATI.has("trpc") && !$$.BATI.has("ts-rest")
40
40
  createTodoHandler,
41
41
  ]);
42
42
 
@@ -1,20 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { addVitePlugin, loadAsMagicast } from "@batijs/core";
3
+ import { addVitePlugin, transformConfig } from "@batijs/core";
4
4
  //#region ../../boilerplates/kysely/dist/files/$vite.config.ts.mjs
5
- async function getViteConfig(props) {
5
+ function getViteConfig(props) {
6
6
  if (props.meta.BATI.hasD1) return;
7
- const mod = await loadAsMagicast(props);
8
- addVitePlugin(mod, {
9
- from: "./vite-plugin-input.js",
10
- constructor: "inputPlugin",
11
- imported: "inputPlugin",
12
- options: {
13
- name: "migrate",
14
- entry: "database/kysely/migrate.ts"
15
- }
7
+ return transformConfig(props, (root) => {
8
+ addVitePlugin(root, {
9
+ from: "./vite-plugin-input.js",
10
+ constructor: "inputPlugin",
11
+ named: true,
12
+ options: `{ name: "migrate", entry: "database/kysely/migrate.ts" }`
13
+ });
16
14
  });
17
- return mod.generate().code;
18
15
  }
19
16
  //#endregion
20
17
  export { getViteConfig as default };
@@ -1,6 +1,6 @@
1
- /*# BATI include-if-imported #*/
1
+ /* $$.keepFileIfImported */
2
2
 
3
- //# !BATI.hasD1
3
+ // !$$.BATI.hasD1
4
4
  import "@batijs/shared-env/server/load";
5
5
  import SQLite from "better-sqlite3";
6
6
  import { Kysely, SqliteDialect } from "kysely";
@@ -9,7 +9,7 @@ import { PostgresJSDialect } from "kysely-postgres-js";
9
9
  import postgres from "postgres";
10
10
  import type { Database } from "./types";
11
11
 
12
- //# BATI.has("sqlite") && !BATI.hasD1
12
+ // $$.BATI.has("sqlite") && !$$.BATI.hasD1
13
13
  export function dbKysely() {
14
14
  const dialect = new SqliteDialect({
15
15
  database: new SQLite(process.env.DATABASE_URL),
@@ -19,14 +19,14 @@ export function dbKysely() {
19
19
  });
20
20
  }
21
21
 
22
- //# BATI.hasD1
22
+ // $$.BATI.hasD1
23
23
  export function dbKyselyD1(d1: D1Database) {
24
24
  return new Kysely<Database>({
25
25
  dialect: new D1Dialect({ database: d1 }),
26
26
  });
27
27
  }
28
28
 
29
- //# BATI.has("postgres")
29
+ // $$.BATI.has("postgres")
30
30
  export function dbKyselyPostgres() {
31
31
  if (!process.env.DATABASE_URL) {
32
32
  throw new Error("Missing DATABASE_URL in .env file");
@@ -1,5 +1,4 @@
1
- /*{ @if (!it.BATI.hasD1) }*/
2
-
1
+ // $$.keepFileIf(!$$.BATI.hasD1)
3
2
  import * as fs from "node:fs/promises";
4
3
  import * as path from "node:path";
5
4
  import { dirname } from "node:path";
@@ -11,7 +10,7 @@ const __filename = fileURLToPath(import.meta.url);
11
10
  const __dirname = dirname(__filename);
12
11
 
13
12
  async function migrateToLatest() {
14
- const db = BATI.has("postgres") ? dbKyselyPostgres() : dbKysely();
13
+ const db = $$.BATI.has("postgres") ? dbKyselyPostgres() : dbKysely();
15
14
  const migrator = new Migrator({
16
15
  db,
17
16
  provider: new FileMigrationProvider({
@@ -43,4 +42,3 @@ async function migrateToLatest() {
43
42
  }
44
43
 
45
44
  await migrateToLatest();
46
- /*{ /if }*/
@@ -1,9 +1,9 @@
1
- /*{ @if (!it.BATI.hasD1) }*/
1
+ // $$.keepFileIf(!$$.BATI.hasD1)
2
2
  import type { Kysely } from "kysely";
3
3
  import type { Database } from "../types";
4
4
 
5
5
  export async function up(db: Kysely<Database>): Promise<void> {
6
- const withId = BATI.has("postgres")
6
+ const withId = $$.BATI.has("postgres")
7
7
  ? db.schema.createTable("todos").addColumn("id", "serial", (col) => col.primaryKey())
8
8
  : db.schema.createTable("todos").addColumn("id", "integer", (col) => col.primaryKey().autoIncrement());
9
9
  await withId.addColumn("text", "text", (col) => col.notNull()).execute();
@@ -12,4 +12,3 @@ export async function up(db: Kysely<Database>): Promise<void> {
12
12
  export async function down(db: Kysely<Database>): Promise<void> {
13
13
  await db.schema.dropTable("todos").execute();
14
14
  }
15
- /*{ /if }*/
@@ -1,10 +1,10 @@
1
1
  import type { dbKysely, dbKyselyD1, dbKyselyPostgres } from "../db";
2
2
 
3
3
  export async function insertTodo(
4
- db: BATI.If<{
5
- 'BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
6
- "!BATI.hasD1": ReturnType<typeof dbKysely>;
7
- "BATI.hasD1": ReturnType<typeof dbKyselyD1>;
4
+ db: $$.If<{
5
+ '$$.BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
6
+ "!$$.BATI.hasD1": ReturnType<typeof dbKysely>;
7
+ "$$.BATI.hasD1": ReturnType<typeof dbKyselyD1>;
8
8
  }>,
9
9
  text: string,
10
10
  ) {
@@ -12,10 +12,10 @@ export async function insertTodo(
12
12
  }
13
13
 
14
14
  export async function getAllTodos(
15
- db: BATI.If<{
16
- 'BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
17
- "!BATI.hasD1": ReturnType<typeof dbKysely>;
18
- "BATI.hasD1": ReturnType<typeof dbKyselyD1>;
15
+ db: $$.If<{
16
+ '$$.BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
17
+ "!$$.BATI.hasD1": ReturnType<typeof dbKysely>;
18
+ "$$.BATI.hasD1": ReturnType<typeof dbKyselyD1>;
19
19
  }>,
20
20
  ) {
21
21
  return await db.selectFrom("todos").selectAll().execute();
@@ -1,4 +1,4 @@
1
- /*{ @if (!it.BATI.hasD1) }*/
1
+ // $$.keepFileIf(!$$.BATI.hasD1)
2
2
  import type { Plugin } from "vite";
3
3
 
4
4
  /**
@@ -25,4 +25,3 @@ export function inputPlugin({ name, entry, env = "ssr" }: { name: string; entry:
25
25
  },
26
26
  };
27
27
  }
28
- /*{ /if }*/
@@ -1,18 +1,18 @@
1
1
  import { dbKysely, dbKyselyD1, dbKyselyPostgres } from "../db.mjs";
2
2
 
3
3
  //#region files/database/kysely/queries/todos.d.ts
4
- declare function insertTodo(db: BATI.If<{
5
- 'BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
6
- "!BATI.hasD1": ReturnType<typeof dbKysely>;
7
- "BATI.hasD1": ReturnType<typeof dbKyselyD1>;
4
+ declare function insertTodo(db: $$.If<{
5
+ '$$.BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
6
+ "!$$.BATI.hasD1": ReturnType<typeof dbKysely>;
7
+ "$$.BATI.hasD1": ReturnType<typeof dbKyselyD1>;
8
8
  }>, text: string): Promise<{
9
9
  id: number;
10
10
  text: string;
11
11
  }>;
12
- declare function getAllTodos(db: BATI.If<{
13
- 'BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
14
- "!BATI.hasD1": ReturnType<typeof dbKysely>;
15
- "BATI.hasD1": ReturnType<typeof dbKyselyD1>;
12
+ declare function getAllTodos(db: $$.If<{
13
+ '$$.BATI.has("postgres")': ReturnType<typeof dbKyselyPostgres>;
14
+ "!$$.BATI.hasD1": ReturnType<typeof dbKysely>;
15
+ "$$.BATI.hasD1": ReturnType<typeof dbKyselyD1>;
16
16
  }>): Promise<{
17
17
  id: number;
18
18
  text: string;
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { addVitePlugin, loadAsMagicast } from "@batijs/core";
3
+ import { addVitePlugin, transformConfig } from "@batijs/core";
4
4
  //#region ../../boilerplates/netlify/dist/files/$vite.config.ts.mjs
5
- async function getViteConfig(props) {
6
- const mod = await loadAsMagicast(props);
7
- addVitePlugin(mod, {
8
- from: "@netlify/vite-plugin",
9
- constructor: "netlify",
10
- options: { build: { enabled: true } }
5
+ function getViteConfig(props) {
6
+ return transformConfig(props, (root) => {
7
+ addVitePlugin(root, {
8
+ from: "@netlify/vite-plugin",
9
+ constructor: "netlify",
10
+ options: `{ build: { enabled: true } }`
11
+ });
11
12
  });
12
- return mod.generate().code;
13
13
  }
14
14
  //#endregion
15
15
  export { getViteConfig as default };
@@ -1,4 +1,4 @@
1
- /*# BATI include-if-imported #*/
1
+ /* $$.keepFileIfImported */
2
2
  import postgres from "postgres";
3
3
 
4
4
  let singleton: postgres.Sql | undefined;
@@ -1,4 +1,4 @@
1
- /*# BATI include-if-imported #*/
1
+ /* $$.keepFileIfImported */
2
2
  import "@batijs/shared-env/server/load";
3
3
  import { db } from "../db";
4
4
 
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { addVitePlugin, loadAsMagicast } from "@batijs/core";
3
+ import { addVitePlugin, transformConfig } from "@batijs/core";
4
4
  //#region ../../boilerplates/react/dist/files/$vite.config.ts.mjs
5
- async function getViteConfig(props) {
6
- const mod = await loadAsMagicast(props);
7
- addVitePlugin(mod, {
8
- from: "@vitejs/plugin-react",
9
- constructor: "react"
5
+ function getViteConfig(props) {
6
+ return transformConfig(props, (root) => {
7
+ addVitePlugin(root, {
8
+ from: "@vitejs/plugin-react",
9
+ constructor: "react"
10
+ });
10
11
  });
11
- return mod.generate().code;
12
12
  }
13
13
  //#endregion
14
14
  export { getViteConfig as default };
@@ -4,21 +4,21 @@ import { ColorSchemeScript } from "@mantine/core";
4
4
  import logoUrl from "../assets/logo.svg";
5
5
 
6
6
  export function Head() {
7
- if (BATI.has("plausible.io")) {
7
+ if ($$.BATI.has("plausible.io")) {
8
8
  return (
9
9
  <>
10
10
  <link rel="icon" href={logoUrl} />
11
- {BATI.has("mantine") ? <ColorSchemeScript /> : null}
11
+ {$$.BATI.has("mantine") ? <ColorSchemeScript /> : null}
12
12
  {/* See https://plausible.io/docs/plausible-script */}
13
13
  {/* TODO: update data-domain */}
14
14
  <script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
15
15
  </>
16
16
  );
17
- } else if (BATI.has("google-analytics")) {
17
+ } else if ($$.BATI.has("google-analytics")) {
18
18
  return (
19
19
  <>
20
20
  <link rel="icon" href={logoUrl} />
21
- {BATI.has("mantine") ? <ColorSchemeScript /> : null}
21
+ {$$.BATI.has("mantine") ? <ColorSchemeScript /> : null}
22
22
  <script
23
23
  async
24
24
  src={`https://www.googletagmanager.com/gtag/js?id=${import.meta.env.PUBLIC_ENV__GOOGLE_ANALYTICS}`}
@@ -36,11 +36,11 @@ export function Head() {
36
36
  </>
37
37
  );
38
38
  } else {
39
- if (BATI.has("mantine")) {
39
+ if ($$.BATI.has("mantine")) {
40
40
  return (
41
41
  <>
42
42
  <link rel="icon" href={logoUrl} />
43
- {BATI.has("mantine") ? <ColorSchemeScript /> : null}
43
+ {$$.BATI.has("mantine") ? <ColorSchemeScript /> : null}
44
44
  </>
45
45
  );
46
46
  } else {
@@ -1,5 +1,5 @@
1
1
  import "./Layout.css";
2
- //# BATI.has("tailwindcss")
2
+ // $$.BATI.has("tailwindcss")
3
3
  import "./tailwind.css";
4
4
  import { AuthNav } from "@batijs/react-better-auth/components/AuthNav";
5
5
  import logoUrl from "../assets/logo.svg";
@@ -8,15 +8,15 @@ import { Link } from "../components/Link";
8
8
  export default function Layout({ children }: { children: React.ReactNode }) {
9
9
  return (
10
10
  <div
11
- //# BATI.has("tailwindcss")
11
+ // $$.BATI.has("tailwindcss")
12
12
  className={"flex max-w-5xl m-auto"}
13
- //# BATI.has("compiled-css")
13
+ // $$.BATI.has("compiled-css")
14
14
  css={{
15
15
  display: "flex",
16
16
  maxWidth: 1024,
17
17
  margin: "auto",
18
18
  }}
19
- //# !BATI.has("tailwindcss") && !BATI.has("compiled-css")
19
+ // !$$.BATI.has("tailwindcss") && !$$.BATI.has("compiled-css")
20
20
  style={{
21
21
  display: "flex",
22
22
  maxWidth: 900,
@@ -28,7 +28,7 @@ export default function Layout({ children }: { children: React.ReactNode }) {
28
28
  <Link href="/">Welcome</Link>
29
29
  <Link href="/todo">Todo</Link>
30
30
  <Link href="/star-wars">Data Fetching</Link>
31
- {BATI.has("better-auth") ? <AuthNav /> : null}
31
+ {$$.BATI.has("better-auth") ? <AuthNav /> : null}
32
32
  </Sidebar>
33
33
  <Content>{children}</Content>
34
34
  </div>
@@ -39,9 +39,9 @@ function Sidebar({ children }: { children: React.ReactNode }) {
39
39
  return (
40
40
  <div
41
41
  id="sidebar"
42
- //# BATI.has("tailwindcss")
42
+ // $$.BATI.has("tailwindcss")
43
43
  className={"p-5 flex flex-col shrink-0 border-r-2 border-r-gray-200"}
44
- //# BATI.has("compiled-css")
44
+ // $$.BATI.has("compiled-css")
45
45
  css={{
46
46
  padding: 20,
47
47
  display: "flex",
@@ -50,7 +50,7 @@ function Sidebar({ children }: { children: React.ReactNode }) {
50
50
  lineHeight: "1.8em",
51
51
  borderRight: "2px solid #eee",
52
52
  }}
53
- //# !BATI.has("tailwindcss") && !BATI.has("compiled-css")
53
+ // !$$.BATI.has("tailwindcss") && !$$.BATI.has("compiled-css")
54
54
  style={{
55
55
  padding: 20,
56
56
  flexShrink: 0,
@@ -70,15 +70,15 @@ function Content({ children }: { children: React.ReactNode }) {
70
70
  <div id="page-container">
71
71
  <div
72
72
  id="page-content"
73
- //# BATI.has("tailwindcss")
73
+ // $$.BATI.has("tailwindcss")
74
74
  className={"p-5 pb-12 min-h-screen"}
75
- //# BATI.has("compiled-css")
75
+ // $$.BATI.has("compiled-css")
76
76
  css={{
77
77
  padding: 20,
78
78
  paddingBottom: 48,
79
79
  minHeight: "100vh",
80
80
  }}
81
- //# !BATI.has("tailwindcss") && !BATI.has("compiled-css")
81
+ // !$$.BATI.has("tailwindcss") && !$$.BATI.has("compiled-css")
82
82
  style={{
83
83
  padding: 20,
84
84
  paddingBottom: 50,
@@ -94,14 +94,14 @@ function Content({ children }: { children: React.ReactNode }) {
94
94
  function Logo() {
95
95
  return (
96
96
  <div
97
- //# BATI.has("tailwindcss")
97
+ // $$.BATI.has("tailwindcss")
98
98
  className={"p-5 mb-2"}
99
- //# BATI.has("compiled-css")
99
+ // $$.BATI.has("compiled-css")
100
100
  css={{
101
101
  padding: 20,
102
102
  marginBottom: 8,
103
103
  }}
104
- //# !BATI.has("tailwindcss") && !BATI.has("compiled-css")
104
+ // !$$.BATI.has("tailwindcss") && !$$.BATI.has("compiled-css")
105
105
  style={{
106
106
  marginTop: 20,
107
107
  marginBottom: 10,
@@ -9,14 +9,14 @@ const config: Config = {
9
9
  title: "My Vike App",
10
10
  description: "Demo showcasing Vike",
11
11
 
12
- //# BATI.has("auth0") || BATI.has("authjs") || BATI.has("better-auth")
12
+ // $$.BATI.has("auth0") || $$.BATI.has("authjs") || $$.BATI.has("better-auth")
13
13
  passToClient: ["user"],
14
14
  extends: [vikeReact],
15
15
 
16
- //# BATI.has("vercel")
16
+ // $$.BATI.has("vercel")
17
17
  prerender: true,
18
18
 
19
- //# BATI.hasUD && !BATI.hasServer
19
+ // $$.BATI.hasUD && !$$.BATI.hasServer
20
20
  // https://vike.dev/server
21
21
  server: true,
22
22
  };
@@ -4,7 +4,7 @@ export default function Page() {
4
4
  return (
5
5
  <>
6
6
  <h1
7
- //# BATI.has("compiled-css")
7
+ // $$.BATI.has("compiled-css")
8
8
  css={{ fontWeight: "700", fontSize: "1.875rem", paddingBottom: "1rem" }}
9
9
  >
10
10
  My Vike app
@@ -6,13 +6,13 @@ export function Counter() {
6
6
  return (
7
7
  <button
8
8
  type="button"
9
- //# BATI.has("tailwindcss")
9
+ // $$.BATI.has("tailwindcss")
10
10
  className={
11
- BATI.has("daisyui")
11
+ $$.BATI.has("daisyui")
12
12
  ? "btn"
13
13
  : "inline-block border border-black rounded bg-gray-200 px-2 py-1 text-xs font-medium uppercase leading-normal"
14
14
  }
15
- //# BATI.has("compiled-css")
15
+ // $$.BATI.has("compiled-css")
16
16
  css={{
17
17
  display: "inline-block",
18
18
  border: "1px solid black",
@@ -25,12 +25,12 @@ export function TodoList() {
25
25
  const text = newTodo;
26
26
  setTodoItems((prev) => [...prev, { text }]);
27
27
  setNewTodo("");
28
- if (BATI.hasServer) {
29
- if (BATI.has("telefunc")) {
28
+ if ($$.BATI.hasServer) {
29
+ if ($$.BATI.has("telefunc")) {
30
30
  await onNewTodo({ text });
31
- } else if (BATI.has("trpc")) {
31
+ } else if ($$.BATI.has("trpc")) {
32
32
  await trpc.onNewTodo.mutate(text);
33
- } else if (BATI.has("ts-rest")) {
33
+ } else if ($$.BATI.has("ts-rest")) {
34
34
  await client.createTodo({ body: { text } });
35
35
  } else {
36
36
  const response = await fetch("/api/todo/create", {
@@ -50,14 +50,14 @@ export function TodoList() {
50
50
  aria-label="New to-do"
51
51
  onChange={(ev) => setNewTodo(ev.target.value)}
52
52
  value={newTodo}
53
- //# BATI.has("tailwindcss")
53
+ // $$.BATI.has("tailwindcss")
54
54
  className={
55
55
  "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 w-full sm:w-auto p-2 mr-1 mb-1"
56
56
  }
57
57
  />
58
58
  <button
59
59
  type="submit"
60
- //# BATI.has("tailwindcss")
60
+ // $$.BATI.has("tailwindcss")
61
61
  className={
62
62
  "text-white bg-blue-700 hover:bg-blue-800 focus:ring-2 focus:outline-hidden focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto p-2"
63
63
  }
@@ -20,7 +20,7 @@ export default function Page() {
20
20
  await authClient.signOut();
21
21
  await navigate("/");
22
22
  }}
23
- //# BATI.has("tailwindcss")
23
+ // $$.BATI.has("tailwindcss")
24
24
  className={
25
25
  "text-white bg-blue-700 hover:bg-blue-800 focus:ring-2 focus:outline-hidden focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto p-2"
26
26
  }
@@ -32,7 +32,7 @@ export default function Page() {
32
32
  required
33
33
  value={email}
34
34
  onChange={(ev) => setEmail(ev.target.value)}
35
- //# BATI.has("tailwindcss")
35
+ // $$.BATI.has("tailwindcss")
36
36
  className={
37
37
  "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 w-full sm:w-auto p-2 mr-1 mb-1"
38
38
  }
@@ -46,7 +46,7 @@ export default function Page() {
46
46
  required
47
47
  value={password}
48
48
  onChange={(ev) => setPassword(ev.target.value)}
49
- //# BATI.has("tailwindcss")
49
+ // $$.BATI.has("tailwindcss")
50
50
  className={
51
51
  "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 w-full sm:w-auto p-2 mr-1 mb-1"
52
52
  }
@@ -54,7 +54,7 @@ export default function Page() {
54
54
  </p>
55
55
  <button
56
56
  type="submit"
57
- //# BATI.has("tailwindcss")
57
+ // $$.BATI.has("tailwindcss")
58
58
  className={
59
59
  "text-white bg-blue-700 hover:bg-blue-800 focus:ring-2 focus:outline-hidden focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto p-2"
60
60
  }
@@ -68,7 +68,7 @@ export default function Page() {
68
68
  onClick={async () => {
69
69
  await authClient.signIn.social({ provider: "github" });
70
70
  }}
71
- //# BATI.has("tailwindcss")
71
+ // $$.BATI.has("tailwindcss")
72
72
  className={
73
73
  "text-white bg-gray-800 hover:bg-gray-900 focus:ring-2 focus:outline-hidden focus:ring-gray-300 font-medium rounded-lg text-sm w-full sm:w-auto p-2"
74
74
  }
@@ -33,7 +33,7 @@ export default function Page() {
33
33
  required
34
34
  value={name}
35
35
  onChange={(ev) => setName(ev.target.value)}
36
- //# BATI.has("tailwindcss")
36
+ // $$.BATI.has("tailwindcss")
37
37
  className={
38
38
  "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 w-full sm:w-auto p-2 mr-1 mb-1"
39
39
  }
@@ -47,7 +47,7 @@ export default function Page() {
47
47
  required
48
48
  value={email}
49
49
  onChange={(ev) => setEmail(ev.target.value)}
50
- //# BATI.has("tailwindcss")
50
+ // $$.BATI.has("tailwindcss")
51
51
  className={
52
52
  "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 w-full sm:w-auto p-2 mr-1 mb-1"
53
53
  }
@@ -62,7 +62,7 @@ export default function Page() {
62
62
  minLength={8}
63
63
  value={password}
64
64
  onChange={(ev) => setPassword(ev.target.value)}
65
- //# BATI.has("tailwindcss")
65
+ // $$.BATI.has("tailwindcss")
66
66
  className={
67
67
  "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 w-full sm:w-auto p-2 mr-1 mb-1"
68
68
  }
@@ -70,7 +70,7 @@ export default function Page() {
70
70
  </p>
71
71
  <button
72
72
  type="submit"
73
- //# BATI.has("tailwindcss")
73
+ // $$.BATI.has("tailwindcss")
74
74
  className={
75
75
  "text-white bg-blue-700 hover:bg-blue-800 focus:ring-2 focus:outline-hidden focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto p-2"
76
76
  }
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { addVitePlugin, deepMergeObject, loadAsMagicast } from "@batijs/core";
3
+ import { addVitePlugin, defineConfigArg, mergeObject, transformConfig } from "@batijs/core";
4
4
  //#region ../../boilerplates/sentry/dist/files/$vite.config.ts.mjs
5
- async function getViteConfig(props) {
6
- const mod = await loadAsMagicast(props);
7
- addVitePlugin(mod, {
8
- from: "@sentry/vite-plugin",
9
- constructor: "sentryVitePlugin",
10
- imported: "sentryVitePlugin",
11
- options: { sourcemaps: { disable: false } }
5
+ function getViteConfig(props) {
6
+ return transformConfig(props, (root) => {
7
+ addVitePlugin(root, {
8
+ from: "@sentry/vite-plugin",
9
+ constructor: "sentryVitePlugin",
10
+ named: true,
11
+ options: `{ sourcemaps: { disable: false } }`
12
+ });
13
+ mergeObject(defineConfigArg(root), { build: { sourcemap: "true" } });
12
14
  });
13
- deepMergeObject(mod.exports.default.$args[0], { build: { sourcemap: true } });
14
- return mod.generate().code;
15
15
  }
16
16
  //#endregion
17
17
  export { getViteConfig as default };
@@ -1,23 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { builders, generateCode, loadAsMagicast, parseModule } from "@batijs/core";
3
+ import { transformConfig } from "@batijs/core";
4
4
  //#region ../../boilerplates/sentry/dist/files/pages/$+client.ts.mjs
5
- async function getViteConfig(props) {
6
- let mod;
7
- try {
8
- mod = await loadAsMagicast(props);
9
- } catch {
10
- mod = parseModule("");
11
- }
12
- if (!props.meta.BATI.has("vue")) {
13
- mod.imports.$prepend({
14
- from: "../sentry.browser.config",
15
- imported: "sentryBrowserConfig"
16
- });
17
- const c = generateCode(builders.functionCall("sentryBrowserConfig")).code;
18
- mod.$ast.body.splice(mod.$ast.body.length - 1, 0, c);
19
- }
20
- return mod.generate().code;
5
+ const IMPORT = `import { sentryBrowserConfig } from "../sentry.browser.config";`;
6
+ const CALL = `sentryBrowserConfig();`;
7
+ async function getClientEntry(props) {
8
+ if (props.meta.BATI.has("vue")) return void 0;
9
+ if ((await props.readfile?.() ?? "").trim() === "") return `${IMPORT}\n\n${CALL}\n`;
10
+ return transformConfig(props, (root) => {
11
+ root.ensureImport(IMPORT);
12
+ const exp = root.find("export_statement").first();
13
+ if (exp.size() > 0) exp.insertBefore(`${CALL}\n\n`);
14
+ });
21
15
  }
22
16
  //#endregion
23
- export { getViteConfig as default };
17
+ export { getClientEntry as default };