@batijs/cli 0.0.476 → 0.0.477

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 (131) 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/cloudflare-entry.ts +5 -0
  13. package/dist/boilerplates/@batijs/cloudflare/files/wrangler.toml +3 -2
  14. package/dist/boilerplates/@batijs/cloudflare/types/cloudflare-entry.d.ts +2 -0
  15. package/dist/boilerplates/@batijs/compiled/files/$package.json.js +5 -5
  16. package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +5 -5
  17. package/dist/boilerplates/@batijs/d1/files/$README.md.js +4 -4
  18. package/dist/boilerplates/@batijs/d1/files/$package.json.js +8 -8
  19. package/dist/boilerplates/@batijs/d1/files/$tsconfig.json.js +3 -3
  20. package/dist/boilerplates/@batijs/d1/files/database/d1/helpers.ts +3 -11
  21. package/dist/boilerplates/@batijs/d1-sqlite/files/$package.json.js +7 -7
  22. package/dist/boilerplates/@batijs/drizzle/files/$.env.js +3 -3
  23. package/dist/boilerplates/@batijs/drizzle/files/$README.md.js +3 -3
  24. package/dist/boilerplates/@batijs/drizzle/files/$package.json.js +8 -8
  25. package/dist/boilerplates/@batijs/eslint/files/$package.json.js +8 -8
  26. package/dist/boilerplates/@batijs/eslint/types/eslint.config.d.ts +1 -1
  27. package/dist/boilerplates/@batijs/express/files/$package.json.js +16 -29
  28. package/dist/boilerplates/@batijs/express/files/server/entry.ts +45 -0
  29. package/dist/boilerplates/@batijs/express/types/server/entry.d.ts +3 -0
  30. package/dist/boilerplates/@batijs/fastify/files/$package.json.js +18 -32
  31. package/dist/boilerplates/@batijs/fastify/files/server/entry.ts +52 -0
  32. package/dist/boilerplates/@batijs/fastify/types/server/entry.d.ts +4 -0
  33. package/dist/boilerplates/@batijs/google-analytics/files/$.env.js +3 -3
  34. package/dist/boilerplates/@batijs/h3/files/$package.json.js +21 -32
  35. package/dist/boilerplates/@batijs/h3/files/server/entry.ts +45 -0
  36. package/dist/boilerplates/@batijs/{express/types/express-entry.d.ts → h3/types/server/entry.d.ts} +1 -1
  37. package/dist/boilerplates/@batijs/hono/files/$package.json.js +23 -40
  38. package/dist/boilerplates/@batijs/hono/files/entry_aws_lambda.ts +2 -9
  39. package/dist/boilerplates/@batijs/hono/files/server/entry.ts +53 -0
  40. package/dist/boilerplates/@batijs/hono/types/server/entry.d.ts +4 -0
  41. package/dist/boilerplates/@batijs/mantine/files/$README.md.js +3 -3
  42. package/dist/boilerplates/@batijs/mantine/files/$package.json.js +12 -12
  43. package/dist/boilerplates/@batijs/photon/files/$README.md.js +29 -0
  44. package/dist/boilerplates/@batijs/photon/files/$package.json.js +109 -0
  45. package/dist/boilerplates/@batijs/photon/files/+photon.ts +7 -0
  46. package/dist/boilerplates/@batijs/photon/types/+photon.d.ts +4 -0
  47. package/dist/boilerplates/@batijs/pnpm/files/$pnpm-workspace.yaml.js +3 -3
  48. package/dist/boilerplates/@batijs/prettier/files/$package.json.js +4 -4
  49. package/dist/boilerplates/@batijs/prisma/files/$.env.js +3 -3
  50. package/dist/boilerplates/@batijs/prisma/files/$README.md.js +3 -3
  51. package/dist/boilerplates/@batijs/prisma/files/$package.json.js +6 -6
  52. package/dist/boilerplates/@batijs/react/files/$README.md.js +3 -3
  53. package/dist/boilerplates/@batijs/react/files/$package.json.js +16 -15
  54. package/dist/boilerplates/@batijs/react/files/$tsconfig.json.js +3 -3
  55. package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +5 -5
  56. package/dist/boilerplates/@batijs/react/files/pages/+config.ts +6 -1
  57. package/dist/boilerplates/@batijs/react/types/pages/+config.d.ts +63 -2
  58. package/dist/boilerplates/@batijs/react-sentry/files/$package.json.js +10 -10
  59. package/dist/boilerplates/@batijs/sentry/files/$.env.js +4 -4
  60. package/dist/boilerplates/@batijs/sentry/files/$README.md.js +3 -3
  61. package/dist/boilerplates/@batijs/sentry/files/$package.json.js +6 -6
  62. package/dist/boilerplates/@batijs/sentry/files/$vite.config.ts.js +7 -7
  63. package/dist/boilerplates/@batijs/sentry/files/pages/$+client.ts.js +9 -9
  64. package/dist/boilerplates/@batijs/shadcn-ui/files/$README.md.js +3 -3
  65. package/dist/boilerplates/@batijs/shadcn-ui/files/$package.json.js +7 -7
  66. package/dist/boilerplates/@batijs/shadcn-ui/files/$tsconfig.json.js +3 -3
  67. package/dist/boilerplates/@batijs/shadcn-ui/files/$vite.config.ts.js +5 -5
  68. package/dist/boilerplates/@batijs/shared/files/$README.md.js +9 -9
  69. package/dist/boilerplates/@batijs/shared/files/package.json +3 -3
  70. package/dist/boilerplates/@batijs/shared/files/vite.config.ts +1 -20
  71. package/dist/boilerplates/@batijs/shared-db/files/server/db-middleware.ts +21 -15
  72. package/dist/boilerplates/@batijs/shared-db/types/server/db-middleware.d.ts +2 -2
  73. package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +8 -14
  74. package/dist/boilerplates/@batijs/shared-server/files/server/create-todo-handler.ts +33 -34
  75. package/dist/boilerplates/@batijs/shared-server/types/server/create-todo-handler.d.ts +3 -4
  76. package/dist/boilerplates/@batijs/solid/files/$README.md.js +3 -3
  77. package/dist/boilerplates/@batijs/solid/files/$package.json.js +11 -10
  78. package/dist/boilerplates/@batijs/solid/files/$tsconfig.json.js +3 -3
  79. package/dist/boilerplates/@batijs/solid/files/$vite.config.ts.js +5 -5
  80. package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +6 -1
  81. package/dist/boilerplates/@batijs/solid/types/pages/+config.d.ts +70 -2
  82. package/dist/boilerplates/@batijs/solid-sentry/files/$package.json.js +7 -7
  83. package/dist/boilerplates/@batijs/sqlite/files/$.env.js +3 -3
  84. package/dist/boilerplates/@batijs/sqlite/files/$README.md.js +4 -3
  85. package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +7 -7
  86. package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +9 -9
  87. package/dist/boilerplates/@batijs/tailwindcss/files/$vite.config.ts.js +5 -5
  88. package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +9 -9
  89. package/dist/boilerplates/@batijs/telefunc/files/$vite.config.ts.js +5 -5
  90. package/dist/boilerplates/@batijs/telefunc/files/server/telefunc-handler.ts +34 -27
  91. package/dist/boilerplates/@batijs/telefunc/types/server/telefunc-handler.d.ts +2 -2
  92. package/dist/boilerplates/@batijs/trpc/files/$package.json.js +9 -9
  93. package/dist/boilerplates/@batijs/trpc/files/server/trpc-handler.ts +26 -18
  94. package/dist/boilerplates/@batijs/trpc/types/server/trpc-handler.d.ts +6 -1
  95. package/dist/boilerplates/@batijs/trpc/types/trpc/client.d.ts +1 -1
  96. package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +6 -6
  97. package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +21 -14
  98. package/dist/boilerplates/@batijs/ts-rest/types/server/ts-rest-handler.d.ts +2 -2
  99. package/dist/boilerplates/@batijs/vercel/files/$package.json.js +8 -9
  100. package/dist/boilerplates/@batijs/vercel/files/pages/$+config.ts.js +3 -3
  101. package/dist/boilerplates/@batijs/vue/files/$README.md.js +3 -3
  102. package/dist/boilerplates/@batijs/vue/files/$package.json.js +15 -14
  103. package/dist/boilerplates/@batijs/vue/files/$tsconfig.json.js +3 -3
  104. package/dist/boilerplates/@batijs/vue/files/$vite.config.ts.js +6 -6
  105. package/dist/boilerplates/@batijs/vue/files/pages/+config.ts +6 -1
  106. package/dist/boilerplates/@batijs/vue/types/pages/+config.d.ts +1 -2
  107. package/dist/boilerplates/@batijs/vue-sentry/files/$package.json.js +8 -8
  108. package/dist/boilerplates/boilerplates.json +20 -0
  109. package/dist/{chunk-2SZ4N3E5.js → chunk-KGXTM3D3.js} +83539 -83181
  110. package/dist/index.js +720 -659
  111. package/dist/jiti-ZW3ADF2F-7XIEJQMO.js +2982 -0
  112. package/dist/src-5HGZFBZ3-KQZBBJSW.js +468 -0
  113. package/package.json +10 -10
  114. package/dist/boilerplates/@batijs/cloudflare/files/$tsconfig.json.js +0 -19
  115. package/dist/boilerplates/@batijs/cloudflare/files/$vite.config.ts.js +0 -34
  116. package/dist/boilerplates/@batijs/express/files/express-entry.ts +0 -102
  117. package/dist/boilerplates/@batijs/fastify/files/fastify-entry.ts +0 -140
  118. package/dist/boilerplates/@batijs/fastify/types/fastify-entry.d.ts +0 -3
  119. package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +0 -144
  120. package/dist/boilerplates/@batijs/h3/types/h3-entry.d.ts +0 -4
  121. package/dist/boilerplates/@batijs/hono/files/$vite.config.ts.js +0 -36
  122. package/dist/boilerplates/@batijs/hono/files/hono-entry.node.ts +0 -31
  123. package/dist/boilerplates/@batijs/hono/files/hono-entry.ts +0 -74
  124. package/dist/boilerplates/@batijs/hono/types/hono-entry.d.ts +0 -6
  125. package/dist/boilerplates/@batijs/hono/types/hono-entry.node.d.ts +0 -1
  126. package/dist/boilerplates/@batijs/shared-server/files/server/vike-handler.ts +0 -20
  127. package/dist/boilerplates/@batijs/shared-server/types/server/vike-handler.d.ts +0 -2
  128. package/dist/boilerplates/@batijs/vercel/files/$tsconfig.json.js +0 -19
  129. package/dist/boilerplates/@batijs/vercel/files/$vite.config.ts.js +0 -27
  130. package/dist/jiti-W5Y5D52V-VBLACVBV.js +0 -30587
  131. package/dist/src-UAKFXUB2-DFO2P37K.js +0 -417
@@ -0,0 +1,468 @@
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 {
6
+ n
7
+ } from "./chunk-IAWYWZSL.js";
8
+ import "./chunk-DHZ7AZKP.js";
9
+
10
+ // ../core/dist/src-5HGZFBZ3.js
11
+ import { createRequire as BATI_core_createRequire } from "module";
12
+ import { fileURLToPath as BATI_fileURLToPath } from "url";
13
+ import { dirname as BATI_dirname } from "path";
14
+ import E from "path";
15
+ import X from "fs/promises";
16
+ import { fileURLToPath as g } from "url";
17
+ var require2 = BATI_core_createRequire(import.meta.url);
18
+ var __filename = BATI_fileURLToPath(import.meta.url);
19
+ var __dirname = BATI_dirname(__filename);
20
+ function o(s) {
21
+ if (!s || !(s instanceof URL) && typeof s != "string") throw new TypeError("Path must be a non-empty string or URL.");
22
+ }
23
+ function M(s) {
24
+ if (typeof s != "string" && !(s instanceof ArrayBuffer) && !ArrayBuffer.isView(s)) throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.");
25
+ }
26
+ function U(s) {
27
+ if (s instanceof Uint8Array) return s;
28
+ if (typeof s == "string") return C.encode(s);
29
+ if (s instanceof ArrayBuffer) return new Uint8Array(s);
30
+ if (ArrayBuffer.isView(s)) {
31
+ let t = s.buffer.slice(s.byteOffset, s.byteOffset + s.byteLength);
32
+ return new Uint8Array(t);
33
+ }
34
+ throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.");
35
+ }
36
+ var L;
37
+ var C;
38
+ var T;
39
+ var A;
40
+ var b;
41
+ var x;
42
+ var y;
43
+ var N = n(() => {
44
+ "use strict";
45
+ L = new TextDecoder(), C = new TextEncoder(), T = class extends Error {
46
+ constructor(t) {
47
+ super(`Method "${t}" does not exist on impl.`);
48
+ }
49
+ }, A = class extends Error {
50
+ constructor(t) {
51
+ super(`Method "${t}" is not supported on this impl.`);
52
+ }
53
+ }, b = class extends Error {
54
+ constructor() {
55
+ super("Implementation already set.");
56
+ }
57
+ };
58
+ x = class {
59
+ type;
60
+ data;
61
+ timestamp = Date.now();
62
+ constructor(t, e) {
63
+ this.type = t, this.data = e;
64
+ }
65
+ }, y = class {
66
+ #t;
67
+ #e;
68
+ #s = /* @__PURE__ */ new Map();
69
+ constructor({ impl: t }) {
70
+ this.#t = t, this.#e = t;
71
+ }
72
+ #i(t, ...e) {
73
+ for (let r of this.#s.values()) r.push(new x("call", { methodName: t, args: e }));
74
+ }
75
+ logStart(t) {
76
+ if (!t || typeof t != "string") throw new TypeError("Log name must be a non-empty string.");
77
+ if (this.#s.has(t)) throw new Error(`Log "${t}" already exists.`);
78
+ this.#s.set(t, []);
79
+ }
80
+ logEnd(t) {
81
+ if (this.#s.has(t)) {
82
+ let e = this.#s.get(t);
83
+ return this.#s.delete(t), e;
84
+ }
85
+ throw new Error(`Log "${t}" does not exist.`);
86
+ }
87
+ isBaseImpl() {
88
+ return this.#e === this.#t;
89
+ }
90
+ setImpl(t) {
91
+ if (this.#i("implSet", t), this.#e !== this.#t) throw new b();
92
+ this.#e = t;
93
+ }
94
+ resetImpl() {
95
+ this.#i("implReset"), this.#e = this.#t;
96
+ }
97
+ #o(t) {
98
+ if (typeof this.#e[t] != "function") throw new T(t);
99
+ }
100
+ #a(t, e) {
101
+ if (typeof this.#e[t] != "function") throw new A(e);
102
+ }
103
+ #r(t, ...e) {
104
+ return this.#i(t, ...e), this.#o(t), this.#e[t](...e);
105
+ }
106
+ #n(t, ...e) {
107
+ return this.#o(t), this.#e[t](...e);
108
+ }
109
+ #c(t, e, ...r) {
110
+ return this.#i(e, ...r), this.#a(t, e), this.#e[t](...r);
111
+ }
112
+ async text(t) {
113
+ o(t);
114
+ let e = await this.#c("bytes", "text", t);
115
+ return e ? L.decode(e) : void 0;
116
+ }
117
+ async json(t) {
118
+ o(t);
119
+ let e = await this.#c("bytes", "json", t);
120
+ return e ? JSON.parse(L.decode(e)) : void 0;
121
+ }
122
+ async arrayBuffer(t) {
123
+ return o(t), (await this.#c("bytes", "arrayBuffer", t))?.buffer;
124
+ }
125
+ async bytes(t) {
126
+ return o(t), this.#r("bytes", t);
127
+ }
128
+ async write(t, e) {
129
+ o(t), M(e), this.#i("write", t, e);
130
+ let r = U(e);
131
+ return this.#n("write", t, r);
132
+ }
133
+ async append(t, e) {
134
+ o(t), M(e), this.#i("append", t, e);
135
+ let r = U(e);
136
+ return this.#n("append", t, r);
137
+ }
138
+ async isFile(t) {
139
+ return o(t), this.#r("isFile", t);
140
+ }
141
+ async isDirectory(t) {
142
+ return o(t), this.#r("isDirectory", t);
143
+ }
144
+ async createDirectory(t) {
145
+ return o(t), this.#r("createDirectory", t);
146
+ }
147
+ async delete(t) {
148
+ return o(t), this.#r("delete", t);
149
+ }
150
+ async deleteAll(t) {
151
+ return o(t), this.#r("deleteAll", t);
152
+ }
153
+ async *list(t) {
154
+ o(t), yield* await this.#r("list", t);
155
+ }
156
+ async *walk(t, { directoryFilter: e = () => true, entryFilter: r = () => true } = {}) {
157
+ o(t), this.#i("walk", t, { directoryFilter: e, entryFilter: r });
158
+ let n2 = async function* (i, { directoryFilter: h, entryFilter: a, parentPath: f = "", depth: S = 1 }) {
159
+ let I;
160
+ try {
161
+ I = await this.#n("list", i);
162
+ } catch (u) {
163
+ if (u.code === "ENOENT") return;
164
+ throw u;
165
+ }
166
+ for await (let u of I) {
167
+ let p = { path: u.name, depth: S, ...u };
168
+ f && (p.path = `${f}/${p.path}`);
169
+ let w = a(p);
170
+ if (w.then && (w = await w), w && (yield p), u.isDirectory) {
171
+ let d = h(p);
172
+ if (d.then && (d = await d), !d) continue;
173
+ let z = i instanceof URL ? new URL(u.name, i.href.endsWith("/") ? i.href : `${i.href}/`) : `${i.endsWith("/") ? i : `${i}/`}${u.name}`;
174
+ yield* n2(z, { directoryFilter: h, entryFilter: a, parentPath: p.path, depth: S + 1 });
175
+ }
176
+ }
177
+ }.bind(this);
178
+ yield* n2(t, { directoryFilter: e, entryFilter: r });
179
+ }
180
+ async size(t) {
181
+ return o(t), this.#r("size", t);
182
+ }
183
+ async lastModified(t) {
184
+ return o(t), this.#r("lastModified", t);
185
+ }
186
+ async copy(t, e) {
187
+ return o(t), o(e), this.#r("copy", t, e);
188
+ }
189
+ async copyAll(t, e) {
190
+ return o(t), o(e), this.#r("copyAll", t, e);
191
+ }
192
+ async move(t, e) {
193
+ return o(t), o(e), this.#r("move", t, e);
194
+ }
195
+ async moveAll(t, e) {
196
+ return o(t), o(e), this.#r("moveAll", t, e);
197
+ }
198
+ };
199
+ });
200
+ var O = n(() => {
201
+ "use strict";
202
+ });
203
+ var F = n(() => {
204
+ "use strict";
205
+ });
206
+ var R = n(() => {
207
+ "use strict";
208
+ N();
209
+ O();
210
+ F();
211
+ });
212
+ function c(s) {
213
+ globalThis?.process?.env.DEBUG === "@hwc/retry" && console.debug(s);
214
+ }
215
+ function _(s, t) {
216
+ let e = Date.now() - s.lastAttempt, r = Math.max(s.lastAttempt - s.timestamp, 1), n2 = Math.min(r * 1.2, t);
217
+ return e >= n2;
218
+ }
219
+ function W(s, t) {
220
+ return s.age > t;
221
+ }
222
+ function Y() {
223
+ if (Promise.withResolvers) return Promise.withResolvers();
224
+ let s, t, e = new Promise((r, n2) => {
225
+ s = r, t = n2;
226
+ });
227
+ if (s === void 0 || t === void 0) throw new Error("Promise executor did not initialize resolve or reject.");
228
+ return { promise: e, resolve: s, reject: t };
229
+ }
230
+ var k;
231
+ var m;
232
+ var B = n(() => {
233
+ "use strict";
234
+ k = class {
235
+ id = Math.random().toString(36).slice(2);
236
+ fn;
237
+ error;
238
+ timestamp = Date.now();
239
+ lastAttempt = this.timestamp;
240
+ resolve;
241
+ reject;
242
+ signal;
243
+ constructor(t, e, r, n2, i) {
244
+ this.fn = t, this.error = e, this.timestamp = Date.now(), this.lastAttempt = Date.now(), this.resolve = r, this.reject = n2, this.signal = i;
245
+ }
246
+ get age() {
247
+ return Date.now() - this.timestamp;
248
+ }
249
+ }, m = class {
250
+ #t = [];
251
+ #e = [];
252
+ #s = 0;
253
+ #i;
254
+ #o;
255
+ #a;
256
+ #r;
257
+ #n;
258
+ constructor(t, { timeout: e = 6e4, maxDelay: r = 100, concurrency: n2 = 1e3 } = {}) {
259
+ if (typeof t != "function") throw new Error("Missing function to check errors");
260
+ this.#r = t, this.#i = e, this.#o = r, this.#n = n2;
261
+ }
262
+ get retrying() {
263
+ return this.#t.length;
264
+ }
265
+ get pending() {
266
+ return this.#e.length;
267
+ }
268
+ get working() {
269
+ return this.#s;
270
+ }
271
+ #c(t, { signal: e, promise: r, resolve: n2, reject: i }) {
272
+ let h;
273
+ try {
274
+ h = t();
275
+ } catch (a) {
276
+ return i(new Error(`Synchronous error: ${a.message}`, { cause: a })), r;
277
+ }
278
+ return !h || typeof h.then != "function" ? (i(new Error("Result is not a promise.")), r) : (this.#s++, r.finally(() => {
279
+ this.#s--, this.#h();
280
+ }).catch(() => {
281
+ }), Promise.resolve(h).then((a) => {
282
+ c("Function called successfully without retry."), n2(a);
283
+ }).catch((a) => {
284
+ if (!this.#r(a)) {
285
+ i(a);
286
+ return;
287
+ }
288
+ let f = new k(t, a, n2, i, e);
289
+ c(`Function failed, queuing for retry with task ${f.id}.`), this.#t.push(f), e?.addEventListener("abort", () => {
290
+ c(`Task ${f.id} was aborted due to AbortSignal.`), i(e.reason);
291
+ }), this.#l();
292
+ }), r);
293
+ }
294
+ retry(t, { signal: e } = {}) {
295
+ e?.throwIfAborted();
296
+ let { promise: r, resolve: n2, reject: i } = Y();
297
+ return this.#e.push(() => this.#c(t, { signal: e, promise: r, resolve: n2, reject: i })), this.#h(), r;
298
+ }
299
+ #u() {
300
+ this.pending && this.#h(), this.retrying && this.#l();
301
+ }
302
+ #h() {
303
+ c(`Processing pending tasks: ${this.pending} pending, ${this.working} working.`);
304
+ let t = this.#n - this.working;
305
+ if (t <= 0) return;
306
+ let e = Math.min(this.pending, t);
307
+ for (let r = 0; r < e; r++) this.#e.shift()?.();
308
+ c(`Processed pending tasks: ${this.pending} pending, ${this.working} working.`);
309
+ }
310
+ #l() {
311
+ clearTimeout(this.#a), this.#a = void 0, c(`Processing retry queue: ${this.retrying} retrying, ${this.working} working.`);
312
+ let t = () => {
313
+ this.#a = setTimeout(() => this.#u(), 0);
314
+ }, e = this.#t.shift();
315
+ if (!e) {
316
+ c("Queue is empty, exiting."), this.pending && t();
317
+ return;
318
+ }
319
+ if (W(e, this.#i)) {
320
+ c(`Task ${e.id} was abandoned due to timeout.`), e.reject(e.error), t();
321
+ return;
322
+ }
323
+ if (!_(e, this.#o)) {
324
+ c(`Task ${e.id} is not ready to retry, skipping.`), this.#t.push(e), t();
325
+ return;
326
+ }
327
+ e.lastAttempt = Date.now(), Promise.resolve(e.fn()).then((r) => {
328
+ c(`Task ${e.id} succeeded after ${e.age}ms.`), e.resolve(r);
329
+ }).catch((r) => {
330
+ if (!this.#r(r)) {
331
+ c(`Task ${e.id} failed with non-retryable error: ${r.message}.`), e.reject(r);
332
+ return;
333
+ }
334
+ e.lastAttempt = Date.now(), this.#t.push(e), c(`Task ${e.id} failed, requeueing to try again.`);
335
+ }).finally(() => {
336
+ this.#u();
337
+ });
338
+ }
339
+ };
340
+ });
341
+ var V;
342
+ var $;
343
+ var v;
344
+ var D;
345
+ var at;
346
+ var j = n(() => {
347
+ "use strict";
348
+ R();
349
+ B();
350
+ V = /* @__PURE__ */ new Set(["ENFILE", "EMFILE"]), $ = class {
351
+ name;
352
+ isFile;
353
+ isDirectory;
354
+ isSymlink;
355
+ constructor(t) {
356
+ this.name = t.name, this.isFile = t.isFile(), this.isDirectory = t.isDirectory(), this.isSymlink = t.isSymbolicLink();
357
+ }
358
+ }, v = class {
359
+ #t;
360
+ #e;
361
+ constructor({ fsp: t = X } = {}) {
362
+ this.#t = t, this.#e = new m((e) => V.has(e.code));
363
+ }
364
+ bytes(t) {
365
+ return this.#e.retry(() => this.#t.readFile(t)).then((e) => new Uint8Array(e.buffer)).catch((e) => {
366
+ if (e.code !== "ENOENT") throw e;
367
+ });
368
+ }
369
+ async write(t, e) {
370
+ let r = Buffer.from(e);
371
+ return this.#e.retry(() => this.#t.writeFile(t, r)).catch((n2) => {
372
+ if (n2.code === "ENOENT") {
373
+ let i = E.dirname(t instanceof URL ? g(t) : t);
374
+ return this.#t.mkdir(i, { recursive: true }).then(() => this.#t.writeFile(t, r));
375
+ }
376
+ throw n2;
377
+ });
378
+ }
379
+ async append(t, e) {
380
+ let r = Buffer.from(e);
381
+ return this.#e.retry(() => this.#t.appendFile(t, r)).catch((n2) => {
382
+ if (n2.code === "ENOENT") {
383
+ let i = E.dirname(t instanceof URL ? g(t) : t);
384
+ return this.#t.mkdir(i, { recursive: true }).then(() => this.#t.appendFile(t, r));
385
+ }
386
+ throw n2;
387
+ });
388
+ }
389
+ isFile(t) {
390
+ return this.#t.stat(t).then((e) => e.isFile()).catch((e) => {
391
+ if (e.code === "ENOENT") return false;
392
+ throw e;
393
+ });
394
+ }
395
+ isDirectory(t) {
396
+ return this.#t.stat(t).then((e) => e.isDirectory()).catch((e) => {
397
+ if (e.code === "ENOENT") return false;
398
+ throw e;
399
+ });
400
+ }
401
+ async createDirectory(t) {
402
+ await this.#t.mkdir(t, { recursive: true });
403
+ }
404
+ delete(t) {
405
+ return this.#t.rm(t).then(() => true).catch((e) => {
406
+ if (e.code === "ERR_FS_EISDIR") return this.#t.rmdir(t).then(() => true);
407
+ if (e.code === "ENOENT") return false;
408
+ throw e;
409
+ });
410
+ }
411
+ deleteAll(t) {
412
+ return this.#t.rm(t, { recursive: true }).then(() => true).catch((e) => {
413
+ if (e.code === "ENOENT") return false;
414
+ throw e;
415
+ });
416
+ }
417
+ async *list(t) {
418
+ let e = await this.#t.readdir(t, { withFileTypes: true });
419
+ for (let r of e) yield new $(r);
420
+ }
421
+ size(t) {
422
+ return this.#t.stat(t).then((e) => e.size).catch((e) => {
423
+ if (e.code !== "ENOENT") throw e;
424
+ });
425
+ }
426
+ lastModified(t) {
427
+ return this.#t.stat(t).then((e) => e.mtime).catch((e) => {
428
+ if (e.code !== "ENOENT") throw e;
429
+ });
430
+ }
431
+ copy(t, e) {
432
+ return this.#t.copyFile(t, e);
433
+ }
434
+ async copyAll(t, e) {
435
+ if (await this.isFile(t)) return this.copy(t, e);
436
+ let r = t instanceof URL ? g(t) : t, n2 = e instanceof URL ? g(e) : e;
437
+ await this.createDirectory(e);
438
+ for await (let i of this.list(t)) {
439
+ let h = E.join(r, i.name), a = E.join(n2, i.name);
440
+ i.isDirectory ? await this.copyAll(h, a) : await this.copy(h, a);
441
+ }
442
+ }
443
+ move(t, e) {
444
+ return this.#t.stat(t).then((r) => {
445
+ if (r.isDirectory()) throw new Error(`EISDIR: illegal operation on a directory, move '${t}' -> '${e}'`);
446
+ return this.#t.rename(t, e);
447
+ });
448
+ }
449
+ async moveAll(t, e) {
450
+ return this.#t.rename(t, e);
451
+ }
452
+ }, D = class extends y {
453
+ constructor({ fsp: t } = {}) {
454
+ super({ impl: new v({ fsp: t }) });
455
+ }
456
+ }, at = new D();
457
+ });
458
+ var K = n(() => {
459
+ j();
460
+ R();
461
+ });
462
+ K();
463
+ export {
464
+ y as Hfs,
465
+ D as NodeHfs,
466
+ v as NodeHfsImpl,
467
+ at as hfs
468
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/cli",
3
- "version": "0.0.476",
3
+ "version": "0.0.477",
4
4
  "type": "module",
5
5
  "keywords": [],
6
6
  "description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
@@ -8,24 +8,24 @@
8
8
  "repository": "https://github.com/vikejs/bati",
9
9
  "license": "MIT",
10
10
  "devDependencies": {
11
- "@inquirer/prompts": "^7.8.4",
12
- "@types/node": "^20.19.9",
11
+ "@inquirer/prompts": "^7.9.0",
12
+ "@types/node": "^20.19.21",
13
13
  "@types/which": "^3.0.4",
14
14
  "citty": "^0.1.6",
15
15
  "colorette": "^2.0.20",
16
- "esbuild": "^0.25.9",
16
+ "esbuild": "^0.25.11",
17
17
  "execa": "^9.6.0",
18
18
  "sift": "^17.1.3",
19
19
  "tsup": "^8.5.0",
20
- "typescript": "^5.9.2",
20
+ "typescript": "^5.9.3",
21
21
  "unplugin-purge-polyfills": "^0.1.0",
22
- "vite": "^7.1.4",
23
- "@batijs/build": "0.0.476",
24
- "@batijs/compile": "0.0.476"
22
+ "vite": "^7.1.10",
23
+ "@batijs/build": "0.0.477",
24
+ "@batijs/compile": "0.0.477"
25
25
  },
26
26
  "dependencies": {
27
- "@batijs/features": "0.0.476",
28
- "@batijs/core": "0.0.476"
27
+ "@batijs/core": "0.0.477",
28
+ "@batijs/features": "0.0.477"
29
29
  },
30
30
  "bin": "./cli.js",
31
31
  "exports": {
@@ -1,19 +0,0 @@
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 {
6
- exs
7
- } from "../../../../chunk-2SZ4N3E5.js";
8
- import "../../../../chunk-IAWYWZSL.js";
9
- import "../../../../chunk-DHZ7AZKP.js";
10
-
11
- // ../../boilerplates/cloudflare/dist/files/$tsconfig.json.js
12
- async function getTsConfig(props) {
13
- const tsConfig = await exs(props);
14
- tsConfig.compilerOptions.types = [...tsConfig.compilerOptions.types ?? [], "vike-cloudflare/types"];
15
- return tsConfig;
16
- }
17
- export {
18
- getTsConfig as default
19
- };
@@ -1,34 +0,0 @@
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 {
6
- Zri,
7
- rxs
8
- } from "../../../../chunk-2SZ4N3E5.js";
9
- import "../../../../chunk-IAWYWZSL.js";
10
- import "../../../../chunk-DHZ7AZKP.js";
11
-
12
- // ../../boilerplates/cloudflare/dist/files/$vite.config.ts.js
13
- async function getViteConfig(props) {
14
- const mod = await rxs(props);
15
- let options;
16
- if (props.meta.BATI.has("hono")) {
17
- options = {
18
- server: {
19
- kind: "hono",
20
- entry: "hono-entry.ts"
21
- }
22
- };
23
- }
24
- Zri(mod, {
25
- from: "vike-cloudflare",
26
- constructor: "pages",
27
- imported: "pages",
28
- options
29
- });
30
- return mod.generate().code;
31
- }
32
- export {
33
- getViteConfig as default
34
- };
@@ -1,102 +0,0 @@
1
- // BATI.has("auth0") || BATI.hasDatabase
2
- import "dotenv/config";
3
- import { dirname } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import { authjsHandler, authjsSessionMiddleware } from "@batijs/authjs/server/authjs-handler";
6
- import { dbMiddleware } from "@batijs/shared-db/server/db-middleware";
7
- import { createTodoHandler } from "@batijs/shared-server/server/create-todo-handler";
8
- import { vikeHandler } from "@batijs/shared-server/server/vike-handler";
9
- import { telefuncHandler } from "@batijs/telefunc/server/telefunc-handler";
10
- import { trpcHandler } from "@batijs/trpc/server/trpc-handler";
11
- import { tsRestHandler } from "@batijs/ts-rest/server/ts-rest-handler";
12
- import { createHandler, createMiddleware } from "@universal-middleware/express";
13
- import express from "express";
14
- import { createDevMiddleware } from "vike";
15
-
16
- const __filename = fileURLToPath(import.meta.url);
17
- const __dirname = dirname(__filename);
18
- const root = __dirname;
19
- const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
20
- const hmrPort = process.env.HMR_PORT ? parseInt(process.env.HMR_PORT, 10) : 24678;
21
-
22
- export default (await startServer()) as unknown;
23
-
24
- async function startServer() {
25
- const app = express();
26
-
27
- if (process.env.NODE_ENV === "production") {
28
- app.use(express.static(`${root}/dist/client`));
29
- } else {
30
- // Instantiate Vite's development server and integrate its middleware to our server.
31
- // ⚠️ We should instantiate it *only* in development. (It isn't needed in production
32
- // and would unnecessarily bloat our server in production.)
33
- const viteDevMiddleware = (
34
- await createDevMiddleware({
35
- root,
36
- viteConfig: {
37
- server: { hmr: { port: hmrPort } },
38
- },
39
- })
40
- ).devMiddleware;
41
- app.use(viteDevMiddleware);
42
- }
43
-
44
- if (BATI.hasDatabase) {
45
- /**
46
- * Make database available in Context as `context.db`
47
- */
48
- app.use(createMiddleware(dbMiddleware)());
49
- }
50
-
51
- if (BATI.has("authjs") || BATI.has("auth0")) {
52
- /**
53
- * Append Auth.js session to context
54
- **/
55
- app.use(createMiddleware(authjsSessionMiddleware)());
56
-
57
- /**
58
- * Auth.js route
59
- * @link {@see https://authjs.dev/getting-started/installation}
60
- **/
61
- app.all("/api/auth/*auth", createHandler(authjsHandler)());
62
- }
63
-
64
- if (BATI.has("trpc")) {
65
- /**
66
- * tRPC route
67
- *
68
- * @link {@see https://trpc.io/docs/server/adapters/fetch}
69
- **/
70
- app.use("/api/trpc", createHandler(trpcHandler)("/api/trpc"));
71
- }
72
-
73
- if (BATI.has("telefunc")) {
74
- /**
75
- * Telefunc route
76
- *
77
- * @link {@see https://telefunc.com}
78
- **/
79
- app.post("/_telefunc", createHandler(telefuncHandler)());
80
- }
81
-
82
- if (BATI.has("ts-rest")) {
83
- app.all("/api/*api", createHandler(tsRestHandler)());
84
- }
85
-
86
- if (!BATI.has("telefunc") && !BATI.has("trpc") && !BATI.has("ts-rest")) {
87
- app.post("/api/todo/create", createHandler(createTodoHandler)());
88
- }
89
-
90
- /**
91
- * Vike route
92
- *
93
- * @link {@see https://vike.dev}
94
- **/
95
- app.all("{*vike}", createHandler(vikeHandler)());
96
-
97
- app.listen(port, () => {
98
- console.log(`Server listening on http://localhost:${port}`);
99
- });
100
-
101
- return app;
102
- }