clawfire 0.6.15 → 0.6.16

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/cli.js CHANGED
@@ -269,7 +269,7 @@ async function runDevServer() {
269
269
  const port = portArg ? parseInt(portArg.split("=")[1], 10) : 3e3;
270
270
  const apiPort = apiPortArg ? parseInt(apiPortArg.split("=")[1], 10) : 3456;
271
271
  const noHotReload = args.includes("--no-hot-reload");
272
- const { startDevServer } = await import("./dev-server-3SUUU4D2.js");
272
+ const { startDevServer } = await import("./dev-server-FYHT3WN5.js");
273
273
  await startDevServer({
274
274
  projectDir,
275
275
  port,
@@ -769,6 +769,7 @@ var PageCompiler = class {
769
769
  try {
770
770
  const compiled = this.compile(fullPath);
771
771
  let html = compiled.html;
772
+ html = this.sanitizeForProduction(html);
772
773
  if (scriptToInject) {
773
774
  if (html.includes("</body>")) {
774
775
  html = html.replace("</body>", scriptToInject + "\n</body>");
@@ -797,6 +798,18 @@ var PageCompiler = class {
797
798
  walk(this.pagesDir);
798
799
  return { pages, errors };
799
800
  }
801
+ // ─── Production Sanitization ─────────────────────────────────────
802
+ /**
803
+ * Remove dev-only content from production builds:
804
+ * - Sections wrapped in <!-- dev-only:start --> / <!-- dev-only:end -->
805
+ * - Links to http://localhost (API Playground, dev dashboard, etc.)
806
+ */
807
+ sanitizeForProduction(html) {
808
+ html = html.replace(/<!--\s*dev-only:start\s*-->[\s\S]*?<!--\s*dev-only:end\s*-->/g, "");
809
+ html = html.replace(/<a\s[^>]*href="http:\/\/localhost[^"]*"[^>]*>[\s\S]*?<\/a>/g, "");
810
+ html = html.replace(/\n{3,}/g, "\n\n");
811
+ return html;
812
+ }
800
813
  // ─── Internal Methods ────────────────────────────────────────────
801
814
  /**
802
815
  * Extract <!-- @key: value --> metadata from HTML.
@@ -4656,9 +4669,16 @@ ${liveReloadScript}
4656
4669
  console.log(" \x1B[32m\u2713\x1B[0m Functions deployed");
4657
4670
  steps.push("Functions deployed");
4658
4671
  } else {
4659
- blazeRequired = true;
4660
- console.log(" \x1B[33m\u26A0\x1B[0m Functions deploy failed (Blaze plan likely required)");
4661
- steps.push("Functions skipped (Blaze plan required)");
4672
+ const errMsg = (funcResult.message || "").toLowerCase();
4673
+ const isBillingError = ["billing", "blaze", "pay-as-you-go", "upgrade your project", "budget"].some((kw) => errMsg.includes(kw));
4674
+ if (isBillingError) {
4675
+ blazeRequired = true;
4676
+ console.log(" \x1B[33m\u26A0\x1B[0m Functions deploy failed (Blaze plan required)");
4677
+ steps.push("Functions skipped (Blaze plan required)");
4678
+ } else {
4679
+ console.log(` \x1B[31m\u2717\x1B[0m Functions deploy failed: ${funcResult.message}`);
4680
+ steps.push(`Functions deploy failed: ${funcResult.message}`);
4681
+ }
4662
4682
  }
4663
4683
  }
4664
4684
  clearFirebaseStatusCache();
package/dist/dev.cjs CHANGED
@@ -1181,6 +1181,7 @@ var PageCompiler = class {
1181
1181
  try {
1182
1182
  const compiled = this.compile(fullPath);
1183
1183
  let html = compiled.html;
1184
+ html = this.sanitizeForProduction(html);
1184
1185
  if (scriptToInject) {
1185
1186
  if (html.includes("</body>")) {
1186
1187
  html = html.replace("</body>", scriptToInject + "\n</body>");
@@ -1209,6 +1210,18 @@ var PageCompiler = class {
1209
1210
  walk(this.pagesDir);
1210
1211
  return { pages, errors };
1211
1212
  }
1213
+ // ─── Production Sanitization ─────────────────────────────────────
1214
+ /**
1215
+ * Remove dev-only content from production builds:
1216
+ * - Sections wrapped in <!-- dev-only:start --> / <!-- dev-only:end -->
1217
+ * - Links to http://localhost (API Playground, dev dashboard, etc.)
1218
+ */
1219
+ sanitizeForProduction(html) {
1220
+ html = html.replace(/<!--\s*dev-only:start\s*-->[\s\S]*?<!--\s*dev-only:end\s*-->/g, "");
1221
+ html = html.replace(/<a\s[^>]*href="http:\/\/localhost[^"]*"[^>]*>[\s\S]*?<\/a>/g, "");
1222
+ html = html.replace(/\n{3,}/g, "\n\n");
1223
+ return html;
1224
+ }
1212
1225
  // ─── Internal Methods ────────────────────────────────────────────
1213
1226
  /**
1214
1227
  * Extract <!-- @key: value --> metadata from HTML.
@@ -5068,9 +5081,16 @@ ${liveReloadScript}
5068
5081
  console.log(" \x1B[32m\u2713\x1B[0m Functions deployed");
5069
5082
  steps.push("Functions deployed");
5070
5083
  } else {
5071
- blazeRequired = true;
5072
- console.log(" \x1B[33m\u26A0\x1B[0m Functions deploy failed (Blaze plan likely required)");
5073
- steps.push("Functions skipped (Blaze plan required)");
5084
+ const errMsg = (funcResult.message || "").toLowerCase();
5085
+ const isBillingError = ["billing", "blaze", "pay-as-you-go", "upgrade your project", "budget"].some((kw) => errMsg.includes(kw));
5086
+ if (isBillingError) {
5087
+ blazeRequired = true;
5088
+ console.log(" \x1B[33m\u26A0\x1B[0m Functions deploy failed (Blaze plan required)");
5089
+ steps.push("Functions skipped (Blaze plan required)");
5090
+ } else {
5091
+ console.log(` \x1B[31m\u2717\x1B[0m Functions deploy failed: ${funcResult.message}`);
5092
+ steps.push(`Functions deploy failed: ${funcResult.message}`);
5093
+ }
5074
5094
  }
5075
5095
  }
5076
5096
  clearFirebaseStatusCache();