clawfire 0.6.9 → 0.6.11

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.
package/dist/dev.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as RouterOptions, C as ClawfireRouter } from './router-Cikk8Heq.cjs';
1
+ import { a as RouterOptions, C as ClawfireRouter } from './router-Cov-HiZ_.cjs';
2
2
  import { EventEmitter } from 'events';
3
- import './schema-BJsictSV.cjs';
3
+ import './schema-Ch0kYL-Z.cjs';
4
4
  import 'zod';
5
5
 
6
6
  interface DevServerOptions {
package/dist/dev.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { a as RouterOptions, C as ClawfireRouter } from './router-BVB_I-tu.js';
1
+ import { a as RouterOptions, C as ClawfireRouter } from './router-BEV6syvt.js';
2
2
  import { EventEmitter } from 'events';
3
- import './schema-BJsictSV.js';
3
+ import './schema-Ch0kYL-Z.js';
4
4
  import 'zod';
5
5
 
6
6
  interface DevServerOptions {
package/dist/dev.js CHANGED
@@ -3416,27 +3416,63 @@ var FirebaseSetup = class {
3416
3416
  return { success: true, message: `Synced ${lines.length} env vars to functions/.env`, count: lines.length };
3417
3417
  }
3418
3418
  /**
3419
- * Ensure firebase.json has functions configuration.
3419
+ * Ensure firebase.json is fully configured for deployment:
3420
+ * - functions config exists
3421
+ * - hosting has cleanUrls
3422
+ * - hosting has API rewrite (/api/** → api function) before catch-all
3423
+ *
3424
+ * Fixes existing configs created by older versions.
3420
3425
  */
3421
- ensureFunctionsConfig() {
3426
+ ensureDeployConfig() {
3422
3427
  const firebaseJsonPath = resolve5(this.projectDir, "firebase.json");
3423
3428
  if (!existsSync6(firebaseJsonPath)) {
3424
- return { success: false, message: "firebase.json not found." };
3429
+ return { success: false, message: "firebase.json not found.", changes: [] };
3425
3430
  }
3426
3431
  try {
3427
3432
  const config = JSON.parse(readFileSync4(firebaseJsonPath, "utf-8"));
3433
+ const changes = [];
3428
3434
  if (!config.functions) {
3429
3435
  config.functions = {
3430
3436
  source: "functions",
3431
3437
  runtime: "nodejs20",
3432
3438
  codebase: "clawfire"
3433
3439
  };
3440
+ changes.push("Added functions config");
3441
+ }
3442
+ if (config.hosting && !config.hosting.cleanUrls) {
3443
+ config.hosting.cleanUrls = true;
3444
+ changes.push("Added cleanUrls");
3445
+ }
3446
+ if (config.hosting) {
3447
+ if (!config.hosting.rewrites) {
3448
+ config.hosting.rewrites = [];
3449
+ }
3450
+ const rewrites = config.hosting.rewrites;
3451
+ const hasApiRewrite = rewrites.some(
3452
+ (r) => r.source === "/api/**" && r.function === "api"
3453
+ );
3454
+ if (!hasApiRewrite) {
3455
+ const apiRewrite = { source: "/api/**", function: "api" };
3456
+ const catchAllIndex = rewrites.findIndex((r) => r.source === "**");
3457
+ if (catchAllIndex >= 0) {
3458
+ rewrites.splice(catchAllIndex, 0, apiRewrite);
3459
+ } else {
3460
+ rewrites.push(apiRewrite);
3461
+ rewrites.push({ source: "**", destination: "/index.html" });
3462
+ }
3463
+ changes.push("Added API rewrite (/api/** \u2192 Cloud Function)");
3464
+ }
3465
+ }
3466
+ if (changes.length > 0) {
3434
3467
  writeFileSync3(firebaseJsonPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
3435
- return { success: true, message: "Functions config added to firebase.json." };
3436
3468
  }
3437
- return { success: true, message: "Functions config already present." };
3469
+ return {
3470
+ success: true,
3471
+ message: changes.length > 0 ? changes.join(", ") : "Deploy config up to date.",
3472
+ changes
3473
+ };
3438
3474
  } catch {
3439
- return { success: false, message: "Invalid firebase.json." };
3475
+ return { success: false, message: "Invalid firebase.json.", changes: [] };
3440
3476
  }
3441
3477
  }
3442
3478
  /**
@@ -4917,6 +4953,13 @@ ${liveReloadScript}
4917
4953
  }
4918
4954
  }
4919
4955
  }
4956
+ const deployConfig = this.firebaseSetup.ensureDeployConfig();
4957
+ if (deployConfig.success && deployConfig.changes.length > 0) {
4958
+ for (const change of deployConfig.changes) {
4959
+ console.log(` \x1B[32m\u2713\x1B[0m firebase.json: ${change}`);
4960
+ }
4961
+ steps.push(`firebase.json updated (${deployConfig.changes.length} fixes)`);
4962
+ }
4920
4963
  let deployFunctions = false;
4921
4964
  if (hasFunctions) {
4922
4965
  const syncResult = this.firebaseSetup.syncEnvToFunctions(firebaseConfig);
@@ -4926,10 +4969,6 @@ ${liveReloadScript}
4926
4969
  } else {
4927
4970
  console.log(` \x1B[33m\u26A0\x1B[0m Env sync: ${syncResult.message}`);
4928
4971
  }
4929
- const configResult = this.firebaseSetup.ensureFunctionsConfig();
4930
- if (configResult.success) {
4931
- console.log(` \x1B[32m\u2713\x1B[0m ${configResult.message}`);
4932
- }
4933
4972
  console.log(" Building functions...");
4934
4973
  const buildResult = await this.firebaseSetup.buildFunctions();
4935
4974
  if (buildResult.success) {