clawfire 0.6.17 → 0.6.19
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-MLT3ZO5A.js} +69 -30
- package/dist/dev.cjs +68 -29
- package/dist/dev.cjs.map +1 -1
- package/dist/dev.js +69 -30
- 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-MLT3ZO5A.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 {
|
|
@@ -3015,40 +3015,41 @@ var FirebaseSetup = class {
|
|
|
3015
3015
|
return { success: false, message: "Invalid firebase.json." };
|
|
3016
3016
|
}
|
|
3017
3017
|
const timeoutMs = targets.includes("functions") ? 3e5 : 12e4;
|
|
3018
|
+
const args = ["deploy", "--only", targets, "--json"];
|
|
3019
|
+
if (targets.includes("functions")) args.push("--force");
|
|
3018
3020
|
try {
|
|
3019
|
-
const output = await this.execTimeout(
|
|
3020
|
-
|
|
3021
|
-
["deploy", "--only", targets, "--json"],
|
|
3022
|
-
timeoutMs
|
|
3023
|
-
);
|
|
3024
|
-
let url = "";
|
|
3025
|
-
try {
|
|
3026
|
-
const data = JSON.parse(output);
|
|
3027
|
-
if (data?.result) {
|
|
3028
|
-
for (const key of Object.keys(data.result)) {
|
|
3029
|
-
if (key.startsWith("hosting") && typeof data.result[key] === "object") {
|
|
3030
|
-
url = data.result[key]?.url || data.result[key]?.site?.url || "";
|
|
3031
|
-
if (url) break;
|
|
3032
|
-
}
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
} catch {
|
|
3036
|
-
const urlMatch = output.match(/https:\/\/[a-z0-9-]+\.web\.app/i);
|
|
3037
|
-
if (urlMatch) url = urlMatch[0];
|
|
3038
|
-
}
|
|
3039
|
-
if (!url) {
|
|
3040
|
-
const state = this.loadState();
|
|
3041
|
-
if (state.projectId) {
|
|
3042
|
-
url = `https://${state.projectId}.web.app`;
|
|
3043
|
-
}
|
|
3044
|
-
}
|
|
3045
|
-
const label = targets.includes("functions") ? "Hosting + Functions" : "Hosting";
|
|
3046
|
-
return { success: true, url: url || void 0, message: `${label} deployed successfully!` };
|
|
3021
|
+
const output = await this.execTimeout("firebase", args, timeoutMs);
|
|
3022
|
+
return { success: true, url: this.extractDeployUrl(output), message: `${targets.includes("functions") ? "Functions" : "Hosting"} deployed successfully!` };
|
|
3047
3023
|
} catch (err) {
|
|
3048
3024
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
3025
|
+
if (msg.includes("successfully deployed") || msg.includes("Successful create operation") || msg.includes("Successful update operation")) {
|
|
3026
|
+
return { success: true, url: this.extractDeployUrl(msg), message: `${targets.includes("functions") ? "Functions" : "Hosting"} deployed successfully!` };
|
|
3027
|
+
}
|
|
3049
3028
|
return { success: false, message: `Deploy failed: ${msg}` };
|
|
3050
3029
|
}
|
|
3051
3030
|
}
|
|
3031
|
+
/** Extract hosting URL from deploy output */
|
|
3032
|
+
extractDeployUrl(output) {
|
|
3033
|
+
try {
|
|
3034
|
+
const data = JSON.parse(output);
|
|
3035
|
+
if (data?.result) {
|
|
3036
|
+
for (const key of Object.keys(data.result)) {
|
|
3037
|
+
if (key.startsWith("hosting") && typeof data.result[key] === "object") {
|
|
3038
|
+
const url = data.result[key]?.url || data.result[key]?.site?.url || "";
|
|
3039
|
+
if (url) return url;
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
}
|
|
3043
|
+
} catch {
|
|
3044
|
+
const urlMatch = output.match(/https:\/\/[a-z0-9-]+\.web\.app/i);
|
|
3045
|
+
if (urlMatch) return urlMatch[0];
|
|
3046
|
+
}
|
|
3047
|
+
const state = this.loadState();
|
|
3048
|
+
if (state.projectId) {
|
|
3049
|
+
return `https://${state.projectId}.web.app`;
|
|
3050
|
+
}
|
|
3051
|
+
return void 0;
|
|
3052
|
+
}
|
|
3052
3053
|
// ─── Full Deploy Pipeline ────────────────────────────────────────────
|
|
3053
3054
|
/**
|
|
3054
3055
|
* Sync environment variables to functions/.env for production.
|
|
@@ -3159,6 +3160,14 @@ var FirebaseSetup = class {
|
|
|
3159
3160
|
return { success: false, message: "functions/package.json not found." };
|
|
3160
3161
|
}
|
|
3161
3162
|
this.ensureFunctionsCJS(functionsDir);
|
|
3163
|
+
const distDir = resolve4(functionsDir, "dist");
|
|
3164
|
+
if (existsSync5(distDir)) {
|
|
3165
|
+
try {
|
|
3166
|
+
rmSync(distDir, { recursive: true, force: true });
|
|
3167
|
+
console.log(" \x1B[32m\u2713\x1B[0m Cleaned functions/dist/");
|
|
3168
|
+
} catch {
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3162
3171
|
try {
|
|
3163
3172
|
await this.execTimeout("npm", ["install"], 12e4, functionsDir);
|
|
3164
3173
|
} catch (err) {
|
|
@@ -3175,11 +3184,41 @@ var FirebaseSetup = class {
|
|
|
3175
3184
|
await this.execTimeout("npx", ["tsc"], 6e4, functionsDir);
|
|
3176
3185
|
}
|
|
3177
3186
|
}
|
|
3178
|
-
return { success: true, message: "Functions built successfully." };
|
|
3179
3187
|
} catch (err) {
|
|
3180
3188
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
3181
3189
|
return { success: false, message: `Functions build failed: ${msg}` };
|
|
3182
3190
|
}
|
|
3191
|
+
const mainEntry = resolve4(functionsDir, "dist/index.js");
|
|
3192
|
+
if (!existsSync5(mainEntry)) {
|
|
3193
|
+
return { success: false, message: "Build produced no output (dist/index.js not found)." };
|
|
3194
|
+
}
|
|
3195
|
+
try {
|
|
3196
|
+
const firstLine = readFileSync4(mainEntry, "utf-8").split("\n")[0];
|
|
3197
|
+
const isESM = firstLine.startsWith("import ") || firstLine.startsWith("export ");
|
|
3198
|
+
if (isESM) {
|
|
3199
|
+
console.log(" \x1B[33m\u26A0\x1B[0m Warning: dist/index.js appears to be ESM, not CJS");
|
|
3200
|
+
} else {
|
|
3201
|
+
console.log(" \x1B[32m\u2713\x1B[0m Build output verified (CJS)");
|
|
3202
|
+
}
|
|
3203
|
+
} catch {
|
|
3204
|
+
}
|
|
3205
|
+
try {
|
|
3206
|
+
const verifyScript = [
|
|
3207
|
+
'process.env.FIREBASE_CONFIG=JSON.stringify({projectId:"verify"});',
|
|
3208
|
+
'process.env.GCLOUD_PROJECT="verify";',
|
|
3209
|
+
'try{require("./dist/index.js");console.log("OK")}',
|
|
3210
|
+
'catch(e){console.error("LOAD_ERROR:"+e.message);process.exit(1)}'
|
|
3211
|
+
].join("");
|
|
3212
|
+
await this.execTimeout("node", ["-e", verifyScript], 15e3, functionsDir);
|
|
3213
|
+
console.log(" \x1B[32m\u2713\x1B[0m Module load verification passed");
|
|
3214
|
+
} catch (verifyErr) {
|
|
3215
|
+
const msg = verifyErr instanceof Error ? verifyErr.message : "Unknown";
|
|
3216
|
+
const match = msg.match(/LOAD_ERROR:(.+?)(\n|$)/);
|
|
3217
|
+
const detail = match ? match[1].trim() : msg.substring(0, 300);
|
|
3218
|
+
console.log(` \x1B[31m\u2717\x1B[0m Module load failed: ${detail}`);
|
|
3219
|
+
return { success: false, message: `Functions built but failed to load: ${detail}` };
|
|
3220
|
+
}
|
|
3221
|
+
return { success: true, message: "Functions built successfully." };
|
|
3183
3222
|
}
|
|
3184
3223
|
/**
|
|
3185
3224
|
* Ensure functions/ uses CommonJS for Firebase Functions compatibility.
|
package/dist/dev.cjs
CHANGED
|
@@ -3427,40 +3427,41 @@ var FirebaseSetup = class {
|
|
|
3427
3427
|
return { success: false, message: "Invalid firebase.json." };
|
|
3428
3428
|
}
|
|
3429
3429
|
const timeoutMs = targets.includes("functions") ? 3e5 : 12e4;
|
|
3430
|
+
const args = ["deploy", "--only", targets, "--json"];
|
|
3431
|
+
if (targets.includes("functions")) args.push("--force");
|
|
3430
3432
|
try {
|
|
3431
|
-
const output = await this.execTimeout(
|
|
3432
|
-
|
|
3433
|
-
["deploy", "--only", targets, "--json"],
|
|
3434
|
-
timeoutMs
|
|
3435
|
-
);
|
|
3436
|
-
let url = "";
|
|
3437
|
-
try {
|
|
3438
|
-
const data = JSON.parse(output);
|
|
3439
|
-
if (data?.result) {
|
|
3440
|
-
for (const key of Object.keys(data.result)) {
|
|
3441
|
-
if (key.startsWith("hosting") && typeof data.result[key] === "object") {
|
|
3442
|
-
url = data.result[key]?.url || data.result[key]?.site?.url || "";
|
|
3443
|
-
if (url) break;
|
|
3444
|
-
}
|
|
3445
|
-
}
|
|
3446
|
-
}
|
|
3447
|
-
} catch {
|
|
3448
|
-
const urlMatch = output.match(/https:\/\/[a-z0-9-]+\.web\.app/i);
|
|
3449
|
-
if (urlMatch) url = urlMatch[0];
|
|
3450
|
-
}
|
|
3451
|
-
if (!url) {
|
|
3452
|
-
const state = this.loadState();
|
|
3453
|
-
if (state.projectId) {
|
|
3454
|
-
url = `https://${state.projectId}.web.app`;
|
|
3455
|
-
}
|
|
3456
|
-
}
|
|
3457
|
-
const label = targets.includes("functions") ? "Hosting + Functions" : "Hosting";
|
|
3458
|
-
return { success: true, url: url || void 0, message: `${label} deployed successfully!` };
|
|
3433
|
+
const output = await this.execTimeout("firebase", args, timeoutMs);
|
|
3434
|
+
return { success: true, url: this.extractDeployUrl(output), message: `${targets.includes("functions") ? "Functions" : "Hosting"} deployed successfully!` };
|
|
3459
3435
|
} catch (err) {
|
|
3460
3436
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
3437
|
+
if (msg.includes("successfully deployed") || msg.includes("Successful create operation") || msg.includes("Successful update operation")) {
|
|
3438
|
+
return { success: true, url: this.extractDeployUrl(msg), message: `${targets.includes("functions") ? "Functions" : "Hosting"} deployed successfully!` };
|
|
3439
|
+
}
|
|
3461
3440
|
return { success: false, message: `Deploy failed: ${msg}` };
|
|
3462
3441
|
}
|
|
3463
3442
|
}
|
|
3443
|
+
/** Extract hosting URL from deploy output */
|
|
3444
|
+
extractDeployUrl(output) {
|
|
3445
|
+
try {
|
|
3446
|
+
const data = JSON.parse(output);
|
|
3447
|
+
if (data?.result) {
|
|
3448
|
+
for (const key of Object.keys(data.result)) {
|
|
3449
|
+
if (key.startsWith("hosting") && typeof data.result[key] === "object") {
|
|
3450
|
+
const url = data.result[key]?.url || data.result[key]?.site?.url || "";
|
|
3451
|
+
if (url) return url;
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3455
|
+
} catch {
|
|
3456
|
+
const urlMatch = output.match(/https:\/\/[a-z0-9-]+\.web\.app/i);
|
|
3457
|
+
if (urlMatch) return urlMatch[0];
|
|
3458
|
+
}
|
|
3459
|
+
const state = this.loadState();
|
|
3460
|
+
if (state.projectId) {
|
|
3461
|
+
return `https://${state.projectId}.web.app`;
|
|
3462
|
+
}
|
|
3463
|
+
return void 0;
|
|
3464
|
+
}
|
|
3464
3465
|
// ─── Full Deploy Pipeline ────────────────────────────────────────────
|
|
3465
3466
|
/**
|
|
3466
3467
|
* Sync environment variables to functions/.env for production.
|
|
@@ -3571,6 +3572,14 @@ var FirebaseSetup = class {
|
|
|
3571
3572
|
return { success: false, message: "functions/package.json not found." };
|
|
3572
3573
|
}
|
|
3573
3574
|
this.ensureFunctionsCJS(functionsDir);
|
|
3575
|
+
const distDir = (0, import_node_path4.resolve)(functionsDir, "dist");
|
|
3576
|
+
if ((0, import_node_fs4.existsSync)(distDir)) {
|
|
3577
|
+
try {
|
|
3578
|
+
(0, import_node_fs4.rmSync)(distDir, { recursive: true, force: true });
|
|
3579
|
+
console.log(" \x1B[32m\u2713\x1B[0m Cleaned functions/dist/");
|
|
3580
|
+
} catch {
|
|
3581
|
+
}
|
|
3582
|
+
}
|
|
3574
3583
|
try {
|
|
3575
3584
|
await this.execTimeout("npm", ["install"], 12e4, functionsDir);
|
|
3576
3585
|
} catch (err) {
|
|
@@ -3587,11 +3596,41 @@ var FirebaseSetup = class {
|
|
|
3587
3596
|
await this.execTimeout("npx", ["tsc"], 6e4, functionsDir);
|
|
3588
3597
|
}
|
|
3589
3598
|
}
|
|
3590
|
-
return { success: true, message: "Functions built successfully." };
|
|
3591
3599
|
} catch (err) {
|
|
3592
3600
|
const msg = err instanceof Error ? err.message : "Unknown error";
|
|
3593
3601
|
return { success: false, message: `Functions build failed: ${msg}` };
|
|
3594
3602
|
}
|
|
3603
|
+
const mainEntry = (0, import_node_path4.resolve)(functionsDir, "dist/index.js");
|
|
3604
|
+
if (!(0, import_node_fs4.existsSync)(mainEntry)) {
|
|
3605
|
+
return { success: false, message: "Build produced no output (dist/index.js not found)." };
|
|
3606
|
+
}
|
|
3607
|
+
try {
|
|
3608
|
+
const firstLine = (0, import_node_fs4.readFileSync)(mainEntry, "utf-8").split("\n")[0];
|
|
3609
|
+
const isESM = firstLine.startsWith("import ") || firstLine.startsWith("export ");
|
|
3610
|
+
if (isESM) {
|
|
3611
|
+
console.log(" \x1B[33m\u26A0\x1B[0m Warning: dist/index.js appears to be ESM, not CJS");
|
|
3612
|
+
} else {
|
|
3613
|
+
console.log(" \x1B[32m\u2713\x1B[0m Build output verified (CJS)");
|
|
3614
|
+
}
|
|
3615
|
+
} catch {
|
|
3616
|
+
}
|
|
3617
|
+
try {
|
|
3618
|
+
const verifyScript = [
|
|
3619
|
+
'process.env.FIREBASE_CONFIG=JSON.stringify({projectId:"verify"});',
|
|
3620
|
+
'process.env.GCLOUD_PROJECT="verify";',
|
|
3621
|
+
'try{require("./dist/index.js");console.log("OK")}',
|
|
3622
|
+
'catch(e){console.error("LOAD_ERROR:"+e.message);process.exit(1)}'
|
|
3623
|
+
].join("");
|
|
3624
|
+
await this.execTimeout("node", ["-e", verifyScript], 15e3, functionsDir);
|
|
3625
|
+
console.log(" \x1B[32m\u2713\x1B[0m Module load verification passed");
|
|
3626
|
+
} catch (verifyErr) {
|
|
3627
|
+
const msg = verifyErr instanceof Error ? verifyErr.message : "Unknown";
|
|
3628
|
+
const match = msg.match(/LOAD_ERROR:(.+?)(\n|$)/);
|
|
3629
|
+
const detail = match ? match[1].trim() : msg.substring(0, 300);
|
|
3630
|
+
console.log(` \x1B[31m\u2717\x1B[0m Module load failed: ${detail}`);
|
|
3631
|
+
return { success: false, message: `Functions built but failed to load: ${detail}` };
|
|
3632
|
+
}
|
|
3633
|
+
return { success: true, message: "Functions built successfully." };
|
|
3595
3634
|
}
|
|
3596
3635
|
/**
|
|
3597
3636
|
* Ensure functions/ uses CommonJS for Firebase Functions compatibility.
|