clawfire 0.6.17 → 0.6.18
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 +1 -1
- package/dist/{dev-server-6PFNZWAZ.js → dev-server-54RXFRNZ.js} +40 -2
- package/dist/dev.cjs +39 -1
- package/dist/dev.cjs.map +1 -1
- package/dist/dev.js +40 -2
- package/dist/dev.js.map +1 -1
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -3056,7 +3056,7 @@ function generateDashboardHtml(options) {
|
|
|
3056
3056
|
|
|
3057
3057
|
// src/dev/firebase-setup.ts
|
|
3058
3058
|
import { execFile as execFile2, spawn } from "child_process";
|
|
3059
|
-
import { existsSync as existsSync6, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
3059
|
+
import { existsSync as existsSync6, readFileSync as readFileSync4, writeFileSync as writeFileSync3, rmSync } from "fs";
|
|
3060
3060
|
import { resolve as resolve5, join as join4 } from "path";
|
|
3061
3061
|
import { tmpdir, platform, homedir } from "os";
|
|
3062
3062
|
var FirebaseSetup = class {
|
|
@@ -3533,6 +3533,14 @@ var FirebaseSetup = class {
|
|
|
3533
3533
|
return { success: false, message: "functions/package.json not found." };
|
|
3534
3534
|
}
|
|
3535
3535
|
this.ensureFunctionsCJS(functionsDir);
|
|
3536
|
+
const distDir = resolve5(functionsDir, "dist");
|
|
3537
|
+
if (existsSync6(distDir)) {
|
|
3538
|
+
try {
|
|
3539
|
+
rmSync(distDir, { recursive: true, force: true });
|
|
3540
|
+
console.log(" \x1B[32m\u2713\x1B[0m Cleaned functions/dist/");
|
|
3541
|
+
} catch {
|
|
3542
|
+
}
|
|
3543
|
+
}
|
|
3536
3544
|
try {
|
|
3537
3545
|
await this.execTimeout("npm", ["install"], 12e4, functionsDir);
|
|
3538
3546
|
} catch (err) {
|
|
@@ -3549,11 +3557,41 @@ var FirebaseSetup = class {
|
|
|
3549
3557
|
await this.execTimeout("npx", ["tsc"], 6e4, functionsDir);
|
|
3550
3558
|
}
|
|
3551
3559
|
}
|
|
3552
|
-
return { success: true, message: "Functions built successfully." };
|
|
3553
3560
|
} catch (err) {
|
|
3554
3561
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
3555
3562
|
return { success: false, message: `Functions build failed: ${msg}` };
|
|
3556
3563
|
}
|
|
3564
|
+
const mainEntry = resolve5(functionsDir, "dist/index.js");
|
|
3565
|
+
if (!existsSync6(mainEntry)) {
|
|
3566
|
+
return { success: false, message: "Build produced no output (dist/index.js not found)." };
|
|
3567
|
+
}
|
|
3568
|
+
try {
|
|
3569
|
+
const firstLine = readFileSync4(mainEntry, "utf-8").split("\n")[0];
|
|
3570
|
+
const isESM = firstLine.startsWith("import ") || firstLine.startsWith("export ");
|
|
3571
|
+
if (isESM) {
|
|
3572
|
+
console.log(" \x1B[33m\u26A0\x1B[0m Warning: dist/index.js appears to be ESM, not CJS");
|
|
3573
|
+
} else {
|
|
3574
|
+
console.log(" \x1B[32m\u2713\x1B[0m Build output verified (CJS)");
|
|
3575
|
+
}
|
|
3576
|
+
} catch {
|
|
3577
|
+
}
|
|
3578
|
+
try {
|
|
3579
|
+
const verifyScript = [
|
|
3580
|
+
'process.env.FIREBASE_CONFIG=JSON.stringify({projectId:"verify"});',
|
|
3581
|
+
'process.env.GCLOUD_PROJECT="verify";',
|
|
3582
|
+
'try{require("./dist/index.js");console.log("OK")}',
|
|
3583
|
+
'catch(e){console.error("LOAD_ERROR:"+e.message);process.exit(1)}'
|
|
3584
|
+
].join("");
|
|
3585
|
+
await this.execTimeout("node", ["-e", verifyScript], 15e3, functionsDir);
|
|
3586
|
+
console.log(" \x1B[32m\u2713\x1B[0m Module load verification passed");
|
|
3587
|
+
} catch (verifyErr) {
|
|
3588
|
+
const msg = verifyErr instanceof Error ? verifyErr.message : "Unknown";
|
|
3589
|
+
const match = msg.match(/LOAD_ERROR:(.+?)(\n|$)/);
|
|
3590
|
+
const detail = match ? match[1].trim() : msg.substring(0, 300);
|
|
3591
|
+
console.log(` \x1B[31m\u2717\x1B[0m Module load failed: ${detail}`);
|
|
3592
|
+
return { success: false, message: `Functions built but failed to load: ${detail}` };
|
|
3593
|
+
}
|
|
3594
|
+
return { success: true, message: "Functions built successfully." };
|
|
3557
3595
|
}
|
|
3558
3596
|
/**
|
|
3559
3597
|
* Ensure functions/ uses CommonJS for Firebase Functions compatibility.
|