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/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-54RXFRNZ.js");
|
|
273
273
|
await startDevServer({
|
|
274
274
|
projectDir,
|
|
275
275
|
port,
|
|
@@ -2682,7 +2682,7 @@ function generateDashboardHtml(options) {
|
|
|
2682
2682
|
|
|
2683
2683
|
// src/dev/firebase-setup.ts
|
|
2684
2684
|
import { execFile as execFile2, spawn } from "child_process";
|
|
2685
|
-
import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "fs";
|
|
2685
|
+
import { existsSync as existsSync5, readFileSync as readFileSync4, writeFileSync as writeFileSync3, rmSync } from "fs";
|
|
2686
2686
|
import { resolve as resolve4, join as join3 } from "path";
|
|
2687
2687
|
import { tmpdir, platform, homedir } from "os";
|
|
2688
2688
|
var FirebaseSetup = class {
|
|
@@ -3159,6 +3159,14 @@ var FirebaseSetup = class {
|
|
|
3159
3159
|
return { success: false, message: "functions/package.json not found." };
|
|
3160
3160
|
}
|
|
3161
3161
|
this.ensureFunctionsCJS(functionsDir);
|
|
3162
|
+
const distDir = resolve4(functionsDir, "dist");
|
|
3163
|
+
if (existsSync5(distDir)) {
|
|
3164
|
+
try {
|
|
3165
|
+
rmSync(distDir, { recursive: true, force: true });
|
|
3166
|
+
console.log(" \x1B[32m\u2713\x1B[0m Cleaned functions/dist/");
|
|
3167
|
+
} catch {
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3162
3170
|
try {
|
|
3163
3171
|
await this.execTimeout("npm", ["install"], 12e4, functionsDir);
|
|
3164
3172
|
} catch (err) {
|
|
@@ -3175,11 +3183,41 @@ var FirebaseSetup = class {
|
|
|
3175
3183
|
await this.execTimeout("npx", ["tsc"], 6e4, functionsDir);
|
|
3176
3184
|
}
|
|
3177
3185
|
}
|
|
3178
|
-
return { success: true, message: "Functions built successfully." };
|
|
3179
3186
|
} catch (err) {
|
|
3180
3187
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
3181
3188
|
return { success: false, message: `Functions build failed: ${msg}` };
|
|
3182
3189
|
}
|
|
3190
|
+
const mainEntry = resolve4(functionsDir, "dist/index.js");
|
|
3191
|
+
if (!existsSync5(mainEntry)) {
|
|
3192
|
+
return { success: false, message: "Build produced no output (dist/index.js not found)." };
|
|
3193
|
+
}
|
|
3194
|
+
try {
|
|
3195
|
+
const firstLine = readFileSync4(mainEntry, "utf-8").split("\n")[0];
|
|
3196
|
+
const isESM = firstLine.startsWith("import ") || firstLine.startsWith("export ");
|
|
3197
|
+
if (isESM) {
|
|
3198
|
+
console.log(" \x1B[33m\u26A0\x1B[0m Warning: dist/index.js appears to be ESM, not CJS");
|
|
3199
|
+
} else {
|
|
3200
|
+
console.log(" \x1B[32m\u2713\x1B[0m Build output verified (CJS)");
|
|
3201
|
+
}
|
|
3202
|
+
} catch {
|
|
3203
|
+
}
|
|
3204
|
+
try {
|
|
3205
|
+
const verifyScript = [
|
|
3206
|
+
'process.env.FIREBASE_CONFIG=JSON.stringify({projectId:"verify"});',
|
|
3207
|
+
'process.env.GCLOUD_PROJECT="verify";',
|
|
3208
|
+
'try{require("./dist/index.js");console.log("OK")}',
|
|
3209
|
+
'catch(e){console.error("LOAD_ERROR:"+e.message);process.exit(1)}'
|
|
3210
|
+
].join("");
|
|
3211
|
+
await this.execTimeout("node", ["-e", verifyScript], 15e3, functionsDir);
|
|
3212
|
+
console.log(" \x1B[32m\u2713\x1B[0m Module load verification passed");
|
|
3213
|
+
} catch (verifyErr) {
|
|
3214
|
+
const msg = verifyErr instanceof Error ? verifyErr.message : "Unknown";
|
|
3215
|
+
const match = msg.match(/LOAD_ERROR:(.+?)(\n|$)/);
|
|
3216
|
+
const detail = match ? match[1].trim() : msg.substring(0, 300);
|
|
3217
|
+
console.log(` \x1B[31m\u2717\x1B[0m Module load failed: ${detail}`);
|
|
3218
|
+
return { success: false, message: `Functions built but failed to load: ${detail}` };
|
|
3219
|
+
}
|
|
3220
|
+
return { success: true, message: "Functions built successfully." };
|
|
3183
3221
|
}
|
|
3184
3222
|
/**
|
|
3185
3223
|
* Ensure functions/ uses CommonJS for Firebase Functions compatibility.
|
package/dist/dev.cjs
CHANGED
|
@@ -3571,6 +3571,14 @@ var FirebaseSetup = class {
|
|
|
3571
3571
|
return { success: false, message: "functions/package.json not found." };
|
|
3572
3572
|
}
|
|
3573
3573
|
this.ensureFunctionsCJS(functionsDir);
|
|
3574
|
+
const distDir = (0, import_node_path4.resolve)(functionsDir, "dist");
|
|
3575
|
+
if ((0, import_node_fs4.existsSync)(distDir)) {
|
|
3576
|
+
try {
|
|
3577
|
+
(0, import_node_fs4.rmSync)(distDir, { recursive: true, force: true });
|
|
3578
|
+
console.log(" \x1B[32m\u2713\x1B[0m Cleaned functions/dist/");
|
|
3579
|
+
} catch {
|
|
3580
|
+
}
|
|
3581
|
+
}
|
|
3574
3582
|
try {
|
|
3575
3583
|
await this.execTimeout("npm", ["install"], 12e4, functionsDir);
|
|
3576
3584
|
} catch (err) {
|
|
@@ -3587,11 +3595,41 @@ var FirebaseSetup = class {
|
|
|
3587
3595
|
await this.execTimeout("npx", ["tsc"], 6e4, functionsDir);
|
|
3588
3596
|
}
|
|
3589
3597
|
}
|
|
3590
|
-
return { success: true, message: "Functions built successfully." };
|
|
3591
3598
|
} catch (err) {
|
|
3592
3599
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
3593
3600
|
return { success: false, message: `Functions build failed: ${msg}` };
|
|
3594
3601
|
}
|
|
3602
|
+
const mainEntry = (0, import_node_path4.resolve)(functionsDir, "dist/index.js");
|
|
3603
|
+
if (!(0, import_node_fs4.existsSync)(mainEntry)) {
|
|
3604
|
+
return { success: false, message: "Build produced no output (dist/index.js not found)." };
|
|
3605
|
+
}
|
|
3606
|
+
try {
|
|
3607
|
+
const firstLine = (0, import_node_fs4.readFileSync)(mainEntry, "utf-8").split("\n")[0];
|
|
3608
|
+
const isESM = firstLine.startsWith("import ") || firstLine.startsWith("export ");
|
|
3609
|
+
if (isESM) {
|
|
3610
|
+
console.log(" \x1B[33m\u26A0\x1B[0m Warning: dist/index.js appears to be ESM, not CJS");
|
|
3611
|
+
} else {
|
|
3612
|
+
console.log(" \x1B[32m\u2713\x1B[0m Build output verified (CJS)");
|
|
3613
|
+
}
|
|
3614
|
+
} catch {
|
|
3615
|
+
}
|
|
3616
|
+
try {
|
|
3617
|
+
const verifyScript = [
|
|
3618
|
+
'process.env.FIREBASE_CONFIG=JSON.stringify({projectId:"verify"});',
|
|
3619
|
+
'process.env.GCLOUD_PROJECT="verify";',
|
|
3620
|
+
'try{require("./dist/index.js");console.log("OK")}',
|
|
3621
|
+
'catch(e){console.error("LOAD_ERROR:"+e.message);process.exit(1)}'
|
|
3622
|
+
].join("");
|
|
3623
|
+
await this.execTimeout("node", ["-e", verifyScript], 15e3, functionsDir);
|
|
3624
|
+
console.log(" \x1B[32m\u2713\x1B[0m Module load verification passed");
|
|
3625
|
+
} catch (verifyErr) {
|
|
3626
|
+
const msg = verifyErr instanceof Error ? verifyErr.message : "Unknown";
|
|
3627
|
+
const match = msg.match(/LOAD_ERROR:(.+?)(\n|$)/);
|
|
3628
|
+
const detail = match ? match[1].trim() : msg.substring(0, 300);
|
|
3629
|
+
console.log(` \x1B[31m\u2717\x1B[0m Module load failed: ${detail}`);
|
|
3630
|
+
return { success: false, message: `Functions built but failed to load: ${detail}` };
|
|
3631
|
+
}
|
|
3632
|
+
return { success: true, message: "Functions built successfully." };
|
|
3595
3633
|
}
|
|
3596
3634
|
/**
|
|
3597
3635
|
* Ensure functions/ uses CommonJS for Firebase Functions compatibility.
|