clawfire 0.6.16 → 0.6.17
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-FYHT3WN5.js → dev-server-6PFNZWAZ.js} +40 -0
- package/dist/dev.cjs +40 -0
- package/dist/dev.cjs.map +1 -1
- package/dist/dev.js +40 -0
- package/dist/dev.js.map +1 -1
- package/package.json +1 -1
- package/templates/starter/functions/package.json +0 -1
- package/templates/starter/functions/tsconfig.json +2 -2
package/dist/dev.js
CHANGED
|
@@ -3532,6 +3532,7 @@ var FirebaseSetup = class {
|
|
|
3532
3532
|
if (!existsSync6(pkgPath)) {
|
|
3533
3533
|
return { success: false, message: "functions/package.json not found." };
|
|
3534
3534
|
}
|
|
3535
|
+
this.ensureFunctionsCJS(functionsDir);
|
|
3535
3536
|
try {
|
|
3536
3537
|
await this.execTimeout("npm", ["install"], 12e4, functionsDir);
|
|
3537
3538
|
} catch (err) {
|
|
@@ -3554,6 +3555,45 @@ var FirebaseSetup = class {
|
|
|
3554
3555
|
return { success: false, message: `Functions build failed: ${msg}` };
|
|
3555
3556
|
}
|
|
3556
3557
|
}
|
|
3558
|
+
/**
|
|
3559
|
+
* Ensure functions/ uses CommonJS for Firebase Functions compatibility.
|
|
3560
|
+
* ESM + Firebase CLI analysis often fails. Auto-fix if needed.
|
|
3561
|
+
*/
|
|
3562
|
+
ensureFunctionsCJS(functionsDir) {
|
|
3563
|
+
const pkgPath = resolve5(functionsDir, "package.json");
|
|
3564
|
+
try {
|
|
3565
|
+
const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
3566
|
+
if (pkg.type === "module") {
|
|
3567
|
+
delete pkg.type;
|
|
3568
|
+
writeFileSync3(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf-8");
|
|
3569
|
+
console.log(' \x1B[32m\u2713\x1B[0m Auto-fixed: removed "type": "module" from functions/package.json');
|
|
3570
|
+
}
|
|
3571
|
+
} catch {
|
|
3572
|
+
}
|
|
3573
|
+
const tsconfigPath = resolve5(functionsDir, "tsconfig.json");
|
|
3574
|
+
try {
|
|
3575
|
+
if (existsSync6(tsconfigPath)) {
|
|
3576
|
+
let content = readFileSync4(tsconfigPath, "utf-8");
|
|
3577
|
+
const tsconfig = JSON.parse(content);
|
|
3578
|
+
let changed = false;
|
|
3579
|
+
const mod = (tsconfig.compilerOptions?.module || "").toLowerCase();
|
|
3580
|
+
if (mod === "esnext" || mod === "es2022" || mod === "es2020" || mod === "nodenext" || mod === "node16") {
|
|
3581
|
+
tsconfig.compilerOptions.module = "CommonJS";
|
|
3582
|
+
changed = true;
|
|
3583
|
+
}
|
|
3584
|
+
const res = (tsconfig.compilerOptions?.moduleResolution || "").toLowerCase();
|
|
3585
|
+
if (res === "bundler" || res === "nodenext" || res === "node16") {
|
|
3586
|
+
tsconfig.compilerOptions.moduleResolution = "node";
|
|
3587
|
+
changed = true;
|
|
3588
|
+
}
|
|
3589
|
+
if (changed) {
|
|
3590
|
+
writeFileSync3(tsconfigPath, JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
|
|
3591
|
+
console.log(" \x1B[32m\u2713\x1B[0m Auto-fixed: functions/tsconfig.json \u2192 CommonJS + node resolution");
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
} catch {
|
|
3595
|
+
}
|
|
3596
|
+
}
|
|
3557
3597
|
// ─── Service Enable ────────────────────────────────────────────────
|
|
3558
3598
|
enableService(service) {
|
|
3559
3599
|
const firebaseJsonPath = resolve5(this.projectDir, "firebase.json");
|