export-runtime 0.0.11 → 0.0.13

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/handler.js +8 -6
  2. package/package.json +1 -1
package/handler.js CHANGED
@@ -194,13 +194,13 @@ export const createHandler = (moduleMap, generatedTypes, minifiedCore, coreId, m
194
194
  case "signIn.social": {
195
195
  // Return the OAuth URL for client to redirect to
196
196
  const callbackUrl = options?.callbackUrl || "/";
197
- const authUrl = `${baseUrl}/api/auth/signin/${provider}?callbackUrl=${encodeURIComponent(callbackUrl)}`;
197
+ const authUrl = `${baseUrl}/_auth/signin/${provider}?callbackUrl=${encodeURIComponent(callbackUrl)}`;
198
198
  return { type: "result", value: { redirectUrl: authUrl } };
199
199
  }
200
200
  case "signIn.email": {
201
201
  // Forward to better-auth via internal fetch
202
202
  try {
203
- const response = await fetch(`${baseUrl}/api/auth/signin/email`, {
203
+ const response = await fetch(`${baseUrl}/_auth/signin/email`, {
204
204
  method: "POST",
205
205
  headers: { "Content-Type": "application/json" },
206
206
  body: JSON.stringify({ email, password }),
@@ -216,7 +216,7 @@ export const createHandler = (moduleMap, generatedTypes, minifiedCore, coreId, m
216
216
  }
217
217
  case "signUp.email": {
218
218
  try {
219
- const response = await fetch(`${baseUrl}/api/auth/signup/email`, {
219
+ const response = await fetch(`${baseUrl}/_auth/signup/email`, {
220
220
  method: "POST",
221
221
  headers: { "Content-Type": "application/json" },
222
222
  body: JSON.stringify({ email, password, name }),
@@ -234,7 +234,7 @@ export const createHandler = (moduleMap, generatedTypes, minifiedCore, coreId, m
234
234
  // Clear session via better-auth
235
235
  if (wsSession?.token) {
236
236
  try {
237
- await fetch(`${baseUrl}/api/auth/signout`, {
237
+ await fetch(`${baseUrl}/_auth/signout`, {
238
238
  method: "POST",
239
239
  headers: {
240
240
  "Content-Type": "application/json",
@@ -339,7 +339,8 @@ export const createHandler = (moduleMap, generatedTypes, minifiedCore, coreId, m
339
339
  server.accept();
340
340
 
341
341
  if (isShared && env?.SHARED_EXPORT) {
342
- const room = url.searchParams.get("room") || "default";
342
+ // ?shared or ?shared= uses default room, ?shared=<id> uses specified room
343
+ const room = url.searchParams.get("shared") || "default";
343
344
  const stub = env.SHARED_EXPORT.get(env.SHARED_EXPORT.idFromName(room));
344
345
  wireWebSocket(server, stub, env);
345
346
  } else {
@@ -354,7 +355,8 @@ export const createHandler = (moduleMap, generatedTypes, minifiedCore, coreId, m
354
355
  const pathname = url.pathname;
355
356
 
356
357
  // Auth routes (handled by better-auth)
357
- if (authConfig && pathname.startsWith("/api/auth/")) {
358
+ // Using /_auth/ to avoid collision with user routes (src/_auth/ is ignored)
359
+ if (authConfig && pathname.startsWith("/_auth/")) {
358
360
  return handleAuthRoute(request, env, authConfig);
359
361
  }
360
362
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "export-runtime",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "Cloudflare Workers ESM Export Framework Runtime",
5
5
  "keywords": [
6
6
  "cloudflare",