Merge pull request #465 from lightpanda-io/inspector-cache-debug
Some checks are pending
e2e-test / zig build release (push) Waiting to run
e2e-test / puppeteer-perf (push) Blocked by required conditions
e2e-test / demo-scripts (push) Blocked by required conditions
wpt / web platform tests (push) Waiting to run
wpt / perf-fmt (push) Blocked by required conditions
zig-test / zig build dev (push) Waiting to run
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions

don't generate debug js file on release
This commit is contained in:
Pierre Tachoire
2025-03-14 11:52:30 +01:00
committed by GitHub

View File

@@ -16,6 +16,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
const builtin = @import("builtin");
const std = @import("std"); const std = @import("std");
const cdp = @import("cdp.zig"); const cdp = @import("cdp.zig");
@@ -37,7 +38,7 @@ pub fn processMessage(cmd: anytype) !void {
fn sendInspector(cmd: anytype, action: anytype) !void { fn sendInspector(cmd: anytype, action: anytype) !void {
// save script in file at debug mode // save script in file at debug mode
if (std.log.defaultLogEnabled(.debug)) { if (builtin.mode == .Debug) {
try logInspector(cmd, action); try logInspector(cmd, action);
} }
@@ -108,7 +109,7 @@ fn logInspector(cmd: anytype, action: anytype) !void {
const id = cmd.input.id orelse return error.RequiredId; const id = cmd.input.id orelse return error.RequiredId;
const name = try std.fmt.allocPrint(cmd.arena, "id_{d}.js", .{id}); const name = try std.fmt.allocPrint(cmd.arena, "id_{d}.js", .{id});
var dir = try std.fs.cwd().makeOpenPath("zig-cache/tmp", .{}); var dir = try std.fs.cwd().makeOpenPath(".zig-cache/tmp", .{});
defer dir.close(); defer dir.close();
const f = try dir.createFile(name, .{}); const f = try dir.createFile(name, .{});