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/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-
|
|
272
|
+
const { startDevServer } = await import("./dev-server-6PFNZWAZ.js");
|
|
273
273
|
await startDevServer({
|
|
274
274
|
projectDir,
|
|
275
275
|
port,
|
|
@@ -3158,6 +3158,7 @@ var FirebaseSetup = class {
|
|
|
3158
3158
|
if (!existsSync5(pkgPath)) {
|
|
3159
3159
|
return { success: false, message: "functions/package.json not found." };
|
|
3160
3160
|
}
|
|
3161
|
+
this.ensureFunctionsCJS(functionsDir);
|
|
3161
3162
|
try {
|
|
3162
3163
|
await this.execTimeout("npm", ["install"], 12e4, functionsDir);
|
|
3163
3164
|
} catch (err) {
|
|
@@ -3180,6 +3181,45 @@ var FirebaseSetup = class {
|
|
|
3180
3181
|
return { success: false, message: `Functions build failed: ${msg}` };
|
|
3181
3182
|
}
|
|
3182
3183
|
}
|
|
3184
|
+
/**
|
|
3185
|
+
* Ensure functions/ uses CommonJS for Firebase Functions compatibility.
|
|
3186
|
+
* ESM + Firebase CLI analysis often fails. Auto-fix if needed.
|
|
3187
|
+
*/
|
|
3188
|
+
ensureFunctionsCJS(functionsDir) {
|
|
3189
|
+
const pkgPath = resolve4(functionsDir, "package.json");
|
|
3190
|
+
try {
|
|
3191
|
+
const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
3192
|
+
if (pkg.type === "module") {
|
|
3193
|
+
delete pkg.type;
|
|
3194
|
+
writeFileSync3(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf-8");
|
|
3195
|
+
console.log(' \x1B[32m\u2713\x1B[0m Auto-fixed: removed "type": "module" from functions/package.json');
|
|
3196
|
+
}
|
|
3197
|
+
} catch {
|
|
3198
|
+
}
|
|
3199
|
+
const tsconfigPath = resolve4(functionsDir, "tsconfig.json");
|
|
3200
|
+
try {
|
|
3201
|
+
if (existsSync5(tsconfigPath)) {
|
|
3202
|
+
let content = readFileSync4(tsconfigPath, "utf-8");
|
|
3203
|
+
const tsconfig = JSON.parse(content);
|
|
3204
|
+
let changed = false;
|
|
3205
|
+
const mod = (tsconfig.compilerOptions?.module || "").toLowerCase();
|
|
3206
|
+
if (mod === "esnext" || mod === "es2022" || mod === "es2020" || mod === "nodenext" || mod === "node16") {
|
|
3207
|
+
tsconfig.compilerOptions.module = "CommonJS";
|
|
3208
|
+
changed = true;
|
|
3209
|
+
}
|
|
3210
|
+
const res = (tsconfig.compilerOptions?.moduleResolution || "").toLowerCase();
|
|
3211
|
+
if (res === "bundler" || res === "nodenext" || res === "node16") {
|
|
3212
|
+
tsconfig.compilerOptions.moduleResolution = "node";
|
|
3213
|
+
changed = true;
|
|
3214
|
+
}
|
|
3215
|
+
if (changed) {
|
|
3216
|
+
writeFileSync3(tsconfigPath, JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
|
|
3217
|
+
console.log(" \x1B[32m\u2713\x1B[0m Auto-fixed: functions/tsconfig.json \u2192 CommonJS + node resolution");
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
} catch {
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3183
3223
|
// ─── Service Enable ────────────────────────────────────────────────
|
|
3184
3224
|
enableService(service) {
|
|
3185
3225
|
const firebaseJsonPath = resolve4(this.projectDir, "firebase.json");
|
package/dist/dev.cjs
CHANGED
|
@@ -3570,6 +3570,7 @@ var FirebaseSetup = class {
|
|
|
3570
3570
|
if (!(0, import_node_fs4.existsSync)(pkgPath)) {
|
|
3571
3571
|
return { success: false, message: "functions/package.json not found." };
|
|
3572
3572
|
}
|
|
3573
|
+
this.ensureFunctionsCJS(functionsDir);
|
|
3573
3574
|
try {
|
|
3574
3575
|
await this.execTimeout("npm", ["install"], 12e4, functionsDir);
|
|
3575
3576
|
} catch (err) {
|
|
@@ -3592,6 +3593,45 @@ var FirebaseSetup = class {
|
|
|
3592
3593
|
return { success: false, message: `Functions build failed: ${msg}` };
|
|
3593
3594
|
}
|
|
3594
3595
|
}
|
|
3596
|
+
/**
|
|
3597
|
+
* Ensure functions/ uses CommonJS for Firebase Functions compatibility.
|
|
3598
|
+
* ESM + Firebase CLI analysis often fails. Auto-fix if needed.
|
|
3599
|
+
*/
|
|
3600
|
+
ensureFunctionsCJS(functionsDir) {
|
|
3601
|
+
const pkgPath = (0, import_node_path4.resolve)(functionsDir, "package.json");
|
|
3602
|
+
try {
|
|
3603
|
+
const pkg = JSON.parse((0, import_node_fs4.readFileSync)(pkgPath, "utf-8"));
|
|
3604
|
+
if (pkg.type === "module") {
|
|
3605
|
+
delete pkg.type;
|
|
3606
|
+
(0, import_node_fs4.writeFileSync)(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf-8");
|
|
3607
|
+
console.log(' \x1B[32m\u2713\x1B[0m Auto-fixed: removed "type": "module" from functions/package.json');
|
|
3608
|
+
}
|
|
3609
|
+
} catch {
|
|
3610
|
+
}
|
|
3611
|
+
const tsconfigPath = (0, import_node_path4.resolve)(functionsDir, "tsconfig.json");
|
|
3612
|
+
try {
|
|
3613
|
+
if ((0, import_node_fs4.existsSync)(tsconfigPath)) {
|
|
3614
|
+
let content = (0, import_node_fs4.readFileSync)(tsconfigPath, "utf-8");
|
|
3615
|
+
const tsconfig = JSON.parse(content);
|
|
3616
|
+
let changed = false;
|
|
3617
|
+
const mod = (tsconfig.compilerOptions?.module || "").toLowerCase();
|
|
3618
|
+
if (mod === "esnext" || mod === "es2022" || mod === "es2020" || mod === "nodenext" || mod === "node16") {
|
|
3619
|
+
tsconfig.compilerOptions.module = "CommonJS";
|
|
3620
|
+
changed = true;
|
|
3621
|
+
}
|
|
3622
|
+
const res = (tsconfig.compilerOptions?.moduleResolution || "").toLowerCase();
|
|
3623
|
+
if (res === "bundler" || res === "nodenext" || res === "node16") {
|
|
3624
|
+
tsconfig.compilerOptions.moduleResolution = "node";
|
|
3625
|
+
changed = true;
|
|
3626
|
+
}
|
|
3627
|
+
if (changed) {
|
|
3628
|
+
(0, import_node_fs4.writeFileSync)(tsconfigPath, JSON.stringify(tsconfig, null, 2) + "\n", "utf-8");
|
|
3629
|
+
console.log(" \x1B[32m\u2713\x1B[0m Auto-fixed: functions/tsconfig.json \u2192 CommonJS + node resolution");
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
} catch {
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3595
3635
|
// ─── Service Enable ────────────────────────────────────────────────
|
|
3596
3636
|
enableService(service) {
|
|
3597
3637
|
const firebaseJsonPath = (0, import_node_path4.resolve)(this.projectDir, "firebase.json");
|