@better-auth/cli 1.4.0-beta.14 → 1.4.0-beta.15

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 (2) hide show
  1. package/dist/index.js +76 -0
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -324,6 +324,81 @@ const generateSchema = (opts) => {
324
324
  process.exit(1);
325
325
  };
326
326
 
327
+ //#endregion
328
+ //#region src/utils/add-cloudflare-modules.ts
329
+ const createModule = () => {
330
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(`
331
+ const createStub = (label) => {
332
+ const handler = {
333
+ get(_, prop) {
334
+ if (prop === "toString") return () => label;
335
+ if (prop === "valueOf") return () => label;
336
+ if (prop === Symbol.toPrimitive) return () => label;
337
+ if (prop === Symbol.toStringTag) return "Object";
338
+ if (prop === "then") return undefined;
339
+ return createStub(label + "." + String(prop));
340
+ },
341
+ apply(_, __, args) {
342
+ return createStub(label + "()")
343
+ },
344
+ construct() {
345
+ return createStub(label + "#instance");
346
+ },
347
+ };
348
+ const fn = () => createStub(label + "()");
349
+ return new Proxy(fn, handler);
350
+ };
351
+
352
+ class WorkerEntrypoint {
353
+ constructor(ctx, env) {
354
+ this.ctx = ctx;
355
+ this.env = env;
356
+ }
357
+ }
358
+
359
+ class DurableObject {
360
+ constructor(state, env) {
361
+ this.state = state;
362
+ this.env = env;
363
+ }
364
+ }
365
+
366
+ class RpcTarget {
367
+ constructor(value) {
368
+ this.value = value;
369
+ }
370
+ }
371
+
372
+ const RpcStub = RpcTarget;
373
+
374
+ const env = createStub("env");
375
+ const caches = createStub("caches");
376
+ const scheduler = createStub("scheduler");
377
+ const executionCtx = createStub("executionCtx");
378
+
379
+ export { DurableObject, RpcStub, RpcTarget, WorkerEntrypoint, caches, env, executionCtx, scheduler };
380
+
381
+ const defaultExport = {
382
+ DurableObject,
383
+ RpcStub,
384
+ RpcTarget,
385
+ WorkerEntrypoint,
386
+ caches,
387
+ env,
388
+ executionCtx,
389
+ scheduler,
390
+ };
391
+
392
+ export default defaultExport;
393
+ // jiti dirty hack: .unknown
394
+ `)}`;
395
+ };
396
+ const CLOUDFLARE_STUB_MODULE = createModule();
397
+ function addCloudflareModules(aliases, _cwd) {
398
+ if (!aliases["cloudflare:workers"]) aliases["cloudflare:workers"] = CLOUDFLARE_STUB_MODULE;
399
+ if (!aliases["cloudflare:test"]) aliases["cloudflare:test"] = CLOUDFLARE_STUB_MODULE;
400
+ }
401
+
327
402
  //#endregion
328
403
  //#region src/utils/add-svelte-kit-env-modules.ts
329
404
  /**
@@ -557,6 +632,7 @@ function getPathAliases(cwd) {
557
632
  try {
558
633
  const result = getPathAliasesRecursive(tsConfigPath);
559
634
  addSvelteKitEnvModules(result);
635
+ addCloudflareModules(result);
560
636
  return result;
561
637
  } catch (error) {
562
638
  console.error(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/cli",
3
- "version": "1.4.0-beta.14",
3
+ "version": "1.4.0-beta.15",
4
4
  "type": "module",
5
5
  "description": "The CLI for Better Auth",
6
6
  "module": "dist/index.js",
@@ -28,7 +28,7 @@
28
28
  "bin": "./dist/index.js",
29
29
  "devDependencies": {
30
30
  "@types/semver": "^7.7.1",
31
- "tsdown": "^0.15.10",
31
+ "tsdown": "^0.15.11",
32
32
  "tsx": "^4.20.6",
33
33
  "typescript": "^5.9.3"
34
34
  },
@@ -58,7 +58,7 @@
58
58
  "tinyexec": "^0.3.2",
59
59
  "yocto-spinner": "^0.2.3",
60
60
  "zod": "^4.1.5",
61
- "better-auth": "1.4.0-beta.14"
61
+ "better-auth": "1.4.0-beta.15"
62
62
  },
63
63
  "files": [
64
64
  "dist"