aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-10-05 03:11:35 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-10-05 03:11:35 -0700
commitdfe74cb5c485f14793499d05539aac17f50822d9 (patch)
tree7804ed7d59d563ae347767f7940d1a7490e91d93
parent00e7b7c3d53e41ff3df264bfe382a8fa70bb0b9d (diff)
downloadbun-dfe74cb5c485f14793499d05539aac17f50822d9.tar.gz
bun-dfe74cb5c485f14793499d05539aac17f50822d9.tar.zst
bun-dfe74cb5c485f14793499d05539aac17f50822d9.zip
Add `BUN_DISABLE_ANALYTICS` flag to disable analytics and automatically disable analytics when running inside `hyperfine`
-rw-r--r--src/analytics/analytics.zig5
-rw-r--r--src/analytics/analytics_thread.zig11
-rw-r--r--src/analytics/schema.peechy3
-rw-r--r--src/api/schema.zig3920
-rw-r--r--src/bundler.zig3
-rw-r--r--src/env_loader.zig2
6 files changed, 2048 insertions, 1896 deletions
diff --git a/src/analytics/analytics.zig b/src/analytics/analytics.zig
index 042f9040d..beeddb34b 100644
--- a/src/analytics/analytics.zig
+++ b/src/analytics/analytics.zig
@@ -393,6 +393,9 @@ pub const Analytics = struct {
/// machine_id
machine_id: Uint64,
+ /// session_id
+ session_id: u32 = 0,
+
/// platform
platform: Platform,
@@ -406,6 +409,7 @@ pub const Analytics = struct {
var this = std.mem.zeroes(EventListHeader);
this.machine_id = try reader.readValue(Uint64);
+ this.session_id = try reader.readValue(u32);
this.platform = try reader.readValue(Platform);
this.build_id = try reader.readValue(u32);
this.session_length = try reader.readValue(u32);
@@ -414,6 +418,7 @@ pub const Analytics = struct {
pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
try writer.writeValue(this.machine_id);
+ try writer.writeInt(this.session_id);
try writer.writeValue(this.platform);
try writer.writeInt(this.build_id);
try writer.writeInt(this.session_length);
diff --git a/src/analytics/analytics_thread.zig b/src/analytics/analytics_thread.zig
index 0b986af18..2f4998c66 100644
--- a/src/analytics/analytics_thread.zig
+++ b/src/analytics/analytics_thread.zig
@@ -17,6 +17,8 @@ pub const EventName = enum(u8) {
http_build,
};
+var random: std.rand.DefaultPrng = undefined;
+
const platform_arch = if (Environment.isAarch64) Analytics.Architecture.arm else Analytics.Architecture.x64;
pub const Event = struct {
@@ -60,6 +62,7 @@ pub const GenerateHeader = struct {
.machine_id = GenerateMachineID.forMac() catch Analytics.Uint64{},
.platform = GeneratePlatform.forMac(),
.build_id = comptime @truncate(u32, Global.build_id),
+ .session_id = random.random.int(u32),
};
}
@@ -68,6 +71,7 @@ pub const GenerateHeader = struct {
.machine_id = GenerateMachineID.forLinux() catch Analytics.Uint64{},
.platform = GeneratePlatform.forLinux(),
.build_id = comptime @truncate(u32, Global.build_id),
+ .session_id = random.random.int(u32),
};
}
@@ -166,6 +170,7 @@ pub fn enqueue(comptime name: EventName) void {
if (!has_loaded) {
defer has_loaded = true;
+
event_queue = EventQueue.init(std.heap.c_allocator);
spawn() catch |err| {
if (comptime isDebug) {
@@ -218,8 +223,6 @@ pub const EventList = struct {
out_buffer: MutableString,
in_buffer: std.ArrayList(u8),
- var random: std.rand.DefaultPrng = undefined;
-
pub fn init() EventList {
random = std.rand.DefaultPrng.init(@intCast(u64, std.time.milliTimestamp()));
return EventList{
@@ -249,6 +252,7 @@ pub const EventList = struct {
}
pub var is_stuck = false;
+ var stuck_count: u8 = 0;
fn _flush(this: *EventList) !void {
this.in_buffer.clearRetainingCapacity();
@@ -327,6 +331,9 @@ pub const EventList = struct {
}
@atomicStore(bool, &is_stuck, retry_remaining == 0, .Release);
+ stuck_count += @intCast(u8, @boolToInt(retry_remaining == 0));
+ stuck_count *= @intCast(u8, @boolToInt(retry_remaining == 0));
+ disabled = disabled or stuck_count > 4;
this.in_buffer.clearRetainingCapacity();
this.out_buffer.reset();
diff --git a/src/analytics/schema.peechy b/src/analytics/schema.peechy
index ec1233c40..4ae230fa4 100644
--- a/src/analytics/schema.peechy
+++ b/src/analytics/schema.peechy
@@ -33,9 +33,10 @@ struct Uint64 {
struct EventListHeader {
Uint64 machine_id;
+ uint32 session_id;
Platform platform;
uint32 build_id;
- uint32 session_length;
+ uint32 session_length;
}
struct EventHeader {
diff --git a/src/api/schema.zig b/src/api/schema.zig
index 24b3f405e..8c4f608d8 100644
--- a/src/api/schema.zig
+++ b/src/api/schema.zig
@@ -1,3 +1,4 @@
+
const std = @import("std");
pub const Reader = struct {
@@ -281,2362 +282,2495 @@ pub fn Writer(comptime WritableStream: type) type {
pub const ByteWriter = Writer(*std.io.FixedBufferStream([]u8));
pub const FileWriter = Writer(std.fs.File);
-pub const Api = struct {
- pub const Loader = enum(u8) {
- _none,
- /// jsx
- jsx,
- /// js
- js,
- /// ts
- ts,
- /// tsx
- tsx,
+pub const Api = struct {
- /// css
- css,
+pub const Loader = enum(u8) {
- /// file
- file,
+_none,
+ /// jsx
+ jsx,
- /// json
- json,
+ /// js
+ js,
- _,
+ /// ts
+ ts,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+ /// tsx
+ tsx,
- pub const FrameworkEntryPointType = enum(u8) {
- _none,
- /// client
- client,
+ /// css
+ css,
- /// server
- server,
+ /// file
+ file,
- /// fallback
- fallback,
+ /// json
+ json,
- _,
+_,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- pub const StackFrameScope = enum(u8) {
- _none,
- /// Eval
- eval,
+
+};
- /// Module
- module,
+pub const FrameworkEntryPointType = enum(u8) {
- /// Function
- function,
+_none,
+ /// client
+ client,
- /// Global
- global,
+ /// server
+ server,
- /// Wasm
- wasm,
+ /// fallback
+ fallback,
- /// Constructor
- constructor,
+_,
- _,
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+
+};
- pub const StackFrame = struct {
- /// function_name
- function_name: []const u8,
+pub const StackFrameScope = enum(u8) {
- /// file
- file: []const u8,
+_none,
+ /// Eval
+ eval,
- /// position
- position: StackFramePosition,
+ /// Module
+ module,
- /// scope
- scope: StackFrameScope,
+ /// Function
+ function,
- pub fn decode(reader: anytype) anyerror!StackFrame {
- var this = std.mem.zeroes(StackFrame);
+ /// Global
+ global,
- this.function_name = try reader.readValue([]const u8);
- this.file = try reader.readValue([]const u8);
- this.position = try reader.readValue(StackFramePosition);
- this.scope = try reader.readValue(StackFrameScope);
- return this;
- }
+ /// Wasm
+ wasm,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeValue(this.function_name);
- try writer.writeValue(this.file);
- try writer.writeValue(this.position);
- try writer.writeEnum(this.scope);
- }
- };
+ /// Constructor
+ constructor,
- pub const StackFramePosition = packed struct {
- /// source_offset
- source_offset: i32 = 0,
+_,
- /// line
- line: i32 = 0,
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- /// line_start
- line_start: i32 = 0,
+
+};
- /// line_stop
- line_stop: i32 = 0,
+pub const StackFrame = struct {
+/// function_name
+function_name: []const u8,
- /// column_start
- column_start: i32 = 0,
+/// file
+file: []const u8,
- /// column_stop
- column_stop: i32 = 0,
+/// position
+position: StackFramePosition,
- /// expression_start
- expression_start: i32 = 0,
+/// scope
+scope: StackFrameScope,
- /// expression_stop
- expression_stop: i32 = 0,
- pub fn decode(reader: anytype) anyerror!StackFramePosition {
- var this = std.mem.zeroes(StackFramePosition);
+pub fn decode(reader: anytype) anyerror!StackFrame {
+ var this = std.mem.zeroes(StackFrame);
- this.source_offset = try reader.readValue(i32);
- this.line = try reader.readValue(i32);
- this.line_start = try reader.readValue(i32);
- this.line_stop = try reader.readValue(i32);
- this.column_start = try reader.readValue(i32);
- this.column_stop = try reader.readValue(i32);
- this.expression_start = try reader.readValue(i32);
- this.expression_stop = try reader.readValue(i32);
- return this;
- }
+ this.function_name = try reader.readValue([]const u8);
+ this.file = try reader.readValue([]const u8);
+ this.position = try reader.readValue(StackFramePosition);
+ this.scope = try reader.readValue(StackFrameScope);
+ return this;
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.source_offset);
- try writer.writeInt(this.line);
- try writer.writeInt(this.line_start);
- try writer.writeInt(this.line_stop);
- try writer.writeInt(this.column_start);
- try writer.writeInt(this.column_stop);
- try writer.writeInt(this.expression_start);
- try writer.writeInt(this.expression_stop);
- }
- };
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.function_name);
+ try writer.writeValue(this.file);
+ try writer.writeValue(this.position);
+ try writer.writeEnum(this.scope);
+}
- pub const SourceLine = struct {
- /// line
- line: i32 = 0,
+};
- /// text
- text: []const u8,
+pub const StackFramePosition = packed struct {
+/// source_offset
+source_offset: i32 = 0,
- pub fn decode(reader: anytype) anyerror!SourceLine {
- var this = std.mem.zeroes(SourceLine);
+/// line
+line: i32 = 0,
- this.line = try reader.readValue(i32);
- this.text = try reader.readValue([]const u8);
- return this;
- }
+/// line_start
+line_start: i32 = 0,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.line);
- try writer.writeValue(this.text);
- }
- };
+/// line_stop
+line_stop: i32 = 0,
- pub const StackTrace = struct {
- /// source_lines
- source_lines: []const SourceLine,
+/// column_start
+column_start: i32 = 0,
- /// frames
- frames: []const StackFrame,
+/// column_stop
+column_stop: i32 = 0,
- pub fn decode(reader: anytype) anyerror!StackTrace {
- var this = std.mem.zeroes(StackTrace);
+/// expression_start
+expression_start: i32 = 0,
- this.source_lines = try reader.readArray(SourceLine);
- this.frames = try reader.readArray(StackFrame);
- return this;
- }
+/// expression_stop
+expression_stop: i32 = 0,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray(SourceLine, this.source_lines);
- try writer.writeArray(StackFrame, this.frames);
- }
- };
- pub const JsException = struct {
- /// name
- name: ?[]const u8 = null,
+pub fn decode(reader: anytype) anyerror!StackFramePosition {
+ var this = std.mem.zeroes(StackFramePosition);
+
+ this.source_offset = try reader.readValue(i32);
+ this.line = try reader.readValue(i32);
+ this.line_start = try reader.readValue(i32);
+ this.line_stop = try reader.readValue(i32);
+ this.column_start = try reader.readValue(i32);
+ this.column_stop = try reader.readValue(i32);
+ this.expression_start = try reader.readValue(i32);
+ this.expression_stop = try reader.readValue(i32);
+ return this;
+}
+
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.source_offset);
+ try writer.writeInt(this.line);
+ try writer.writeInt(this.line_start);
+ try writer.writeInt(this.line_stop);
+ try writer.writeInt(this.column_start);
+ try writer.writeInt(this.column_stop);
+ try writer.writeInt(this.expression_start);
+ try writer.writeInt(this.expression_stop);
+}
- /// message
- message: ?[]const u8 = null,
+};
- /// runtime_type
- runtime_type: ?u16 = null,
+pub const SourceLine = struct {
+/// line
+line: i32 = 0,
- /// code
- code: ?u8 = null,
+/// text
+text: []const u8,
- /// stack
- stack: ?StackTrace = null,
- pub fn decode(reader: anytype) anyerror!JsException {
- var this = std.mem.zeroes(JsException);
+pub fn decode(reader: anytype) anyerror!SourceLine {
+ var this = std.mem.zeroes(SourceLine);
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+ this.line = try reader.readValue(i32);
+ this.text = try reader.readValue([]const u8);
+ return this;
+}
- 1 => {
- this.name = try reader.readValue([]const u8);
- },
- 2 => {
- this.message = try reader.readValue([]const u8);
- },
- 3 => {
- this.runtime_type = try reader.readValue(u16);
- },
- 4 => {
- this.code = try reader.readValue(u8);
- },
- 5 => {
- this.stack = try reader.readValue(StackTrace);
- },
- else => {
- return error.InvalidMessage;
- },
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.line);
+ try writer.writeValue(this.text);
+}
+
+};
+
+pub const StackTrace = struct {
+/// source_lines
+source_lines: []const SourceLine,
+
+/// frames
+frames: []const StackFrame,
+
+
+pub fn decode(reader: anytype) anyerror!StackTrace {
+ var this = std.mem.zeroes(StackTrace);
+
+ this.source_lines = try reader.readArray(SourceLine);
+ this.frames = try reader.readArray(StackFrame);
+ return this;
+}
+
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(SourceLine, this.source_lines);
+ try writer.writeArray(StackFrame, this.frames);
+}
+
+};
+
+pub const JsException = struct {
+/// name
+name: ?[]const u8 = null,
+
+/// message
+message: ?[]const u8 = null,
+
+/// runtime_type
+runtime_type: ?u16 = null,
+
+/// code
+code: ?u8 = null,
+
+/// stack
+stack: ?StackTrace = null,
+
+
+pub fn decode(reader: anytype) anyerror!JsException {
+ var this = std.mem.zeroes(JsException);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.name = try reader.readValue([]const u8);
+},
+ 2 => {
+ this.message = try reader.readValue([]const u8);
+},
+ 3 => {
+ this.runtime_type = try reader.readValue(u16);
+},
+ 4 => {
+ this.code = try reader.readValue(u8);
+},
+ 5 => {
+ this.stack = try reader.readValue(StackTrace);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
+
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.name) |name| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(name);
+}
+if (this.message) |message| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(message);
+}
+if (this.runtime_type) |runtime_type| {
+ try writer.writeFieldID(3);
+ try writer.writeInt(runtime_type);
+}
+if (this.code) |code| {
+ try writer.writeFieldID(4);
+ try writer.writeInt(code);
+}
+if (this.stack) |stack| {
+ try writer.writeFieldID(5);
+ try writer.writeValue(stack);
+}
+try writer.endMessage();
+}
+
+};
+
+pub const FallbackStep = enum(u8) {
+
+_none,
+ /// ssr_disabled
+ ssr_disabled,
+
+ /// create_vm
+ create_vm,
+
+ /// configure_router
+ configure_router,
+
+ /// configure_defines
+ configure_defines,
+
+ /// resolve_entry_point
+ resolve_entry_point,
+
+ /// load_entry_point
+ load_entry_point,
+
+ /// eval_entry_point
+ eval_entry_point,
+
+ /// fetch_event_handler
+ fetch_event_handler,
+
+_,
+
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
}
- }
- unreachable;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.name) |name| {
- try writer.writeFieldID(1);
- try writer.writeValue(name);
- }
- if (this.message) |message| {
- try writer.writeFieldID(2);
- try writer.writeValue(message);
- }
- if (this.runtime_type) |runtime_type| {
- try writer.writeFieldID(3);
- try writer.writeInt(runtime_type);
- }
- if (this.code) |code| {
- try writer.writeFieldID(4);
- try writer.writeInt(code);
- }
- if (this.stack) |stack| {
- try writer.writeFieldID(5);
- try writer.writeValue(stack);
- }
- try writer.endMessage();
- }
- };
+
+};
- pub const FallbackStep = enum(u8) {
- _none,
- /// ssr_disabled
- ssr_disabled,
+pub const Problems = struct {
+/// code
+code: u16 = 0,
- /// create_vm
- create_vm,
+/// name
+name: []const u8,
- /// configure_router
- configure_router,
+/// exceptions
+exceptions: []const JsException,
- /// configure_defines
- configure_defines,
+/// build
+build: Log,
- /// resolve_entry_point
- resolve_entry_point,
- /// load_entry_point
- load_entry_point,
+pub fn decode(reader: anytype) anyerror!Problems {
+ var this = std.mem.zeroes(Problems);
- /// eval_entry_point
- eval_entry_point,
+ this.code = try reader.readValue(u16);
+ this.name = try reader.readValue([]const u8);
+ this.exceptions = try reader.readArray(JsException);
+ this.build = try reader.readValue(Log);
+ return this;
+}
- /// fetch_event_handler
- fetch_event_handler,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.code);
+ try writer.writeValue(this.name);
+ try writer.writeArray(JsException, this.exceptions);
+ try writer.writeValue(this.build);
+}
- _,
+};
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+pub const Router = struct {
+/// routes
+routes: []const []const u8,
- pub const Problems = struct {
- /// code
- code: u16 = 0,
+/// route
+route: i32 = 0,
- /// name
- name: []const u8,
+/// params
+params: StringMap,
- /// exceptions
- exceptions: []const JsException,
- /// build
- build: Log,
+pub fn decode(reader: anytype) anyerror!Router {
+ var this = std.mem.zeroes(Router);
- pub fn decode(reader: anytype) anyerror!Problems {
- var this = std.mem.zeroes(Problems);
+ this.routes = try reader.readArray([]const u8);
+ this.route = try reader.readValue(i32);
+ this.params = try reader.readValue(StringMap);
+ return this;
+}
- this.code = try reader.readValue(u16);
- this.name = try reader.readValue([]const u8);
- this.exceptions = try reader.readArray(JsException);
- this.build = try reader.readValue(Log);
- return this;
- }
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray([]const u8, this.routes);
+ try writer.writeInt(this.route);
+ try writer.writeValue(this.params);
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.code);
- try writer.writeValue(this.name);
- try writer.writeArray(JsException, this.exceptions);
- try writer.writeValue(this.build);
- }
- };
+};
- pub const Router = struct {
- /// routes
- routes: []const []const u8,
+pub const FallbackMessageContainer = struct {
+/// message
+message: ?[]const u8 = null,
+
+/// router
+router: ?Router = null,
+
+/// reason
+reason: ?FallbackStep = null,
+
+/// problems
+problems: ?Problems = null,
+
+/// cwd
+cwd: ?[]const u8 = null,
+
+
+pub fn decode(reader: anytype) anyerror!FallbackMessageContainer {
+ var this = std.mem.zeroes(FallbackMessageContainer);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.message = try reader.readValue([]const u8);
+},
+ 2 => {
+ this.router = try reader.readValue(Router);
+},
+ 3 => {
+ this.reason = try reader.readValue(FallbackStep);
+},
+ 4 => {
+ this.problems = try reader.readValue(Problems);
+},
+ 5 => {
+ this.cwd = try reader.readValue([]const u8);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// route
- route: i32 = 0,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.message) |message| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(message);
+}
+if (this.router) |router| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(router);
+}
+if (this.reason) |reason| {
+ try writer.writeFieldID(3);
+ try writer.writeEnum(reason);
+}
+if (this.problems) |problems| {
+ try writer.writeFieldID(4);
+ try writer.writeValue(problems);
+}
+if (this.cwd) |cwd| {
+ try writer.writeFieldID(5);
+ try writer.writeValue(cwd);
+}
+try writer.endMessage();
+}
- /// params
- params: StringMap,
+};
- pub fn decode(reader: anytype) anyerror!Router {
- var this = std.mem.zeroes(Router);
+pub const ResolveMode = enum(u8) {
- this.routes = try reader.readArray([]const u8);
- this.route = try reader.readValue(i32);
- this.params = try reader.readValue(StringMap);
- return this;
- }
+_none,
+ /// disable
+ disable,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray([]const u8, this.routes);
- try writer.writeInt(this.route);
- try writer.writeValue(this.params);
- }
- };
+ /// lazy
+ lazy,
- pub const FallbackMessageContainer = struct {
- /// message
- message: ?[]const u8 = null,
+ /// dev
+ dev,
- /// router
- router: ?Router = null,
+ /// bundle
+ bundle,
- /// reason
- reason: ?FallbackStep = null,
+_,
- /// problems
- problems: ?Problems = null,
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- /// cwd
- cwd: ?[]const u8 = null,
+
+};
- pub fn decode(reader: anytype) anyerror!FallbackMessageContainer {
- var this = std.mem.zeroes(FallbackMessageContainer);
+pub const Platform = enum(u8) {
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+_none,
+ /// browser
+ browser,
- 1 => {
- this.message = try reader.readValue([]const u8);
- },
- 2 => {
- this.router = try reader.readValue(Router);
- },
- 3 => {
- this.reason = try reader.readValue(FallbackStep);
- },
- 4 => {
- this.problems = try reader.readValue(Problems);
- },
- 5 => {
- this.cwd = try reader.readValue([]const u8);
- },
- else => {
- return error.InvalidMessage;
- },
+ /// node
+ node,
+
+ /// bun
+ bun,
+
+_,
+
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
}
- }
- unreachable;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.message) |message| {
- try writer.writeFieldID(1);
- try writer.writeValue(message);
- }
- if (this.router) |router| {
- try writer.writeFieldID(2);
- try writer.writeValue(router);
- }
- if (this.reason) |reason| {
- try writer.writeFieldID(3);
- try writer.writeEnum(reason);
- }
- if (this.problems) |problems| {
- try writer.writeFieldID(4);
- try writer.writeValue(problems);
- }
- if (this.cwd) |cwd| {
- try writer.writeFieldID(5);
- try writer.writeValue(cwd);
- }
- try writer.endMessage();
- }
- };
+
+};
- pub const ResolveMode = enum(u8) {
- _none,
- /// disable
- disable,
+pub const CssInJsBehavior = enum(u8) {
- /// lazy
- lazy,
+_none,
+ /// facade
+ facade,
- /// dev
- dev,
+ /// facade_onimportcss
+ facade_onimportcss,
- /// bundle
- bundle,
+ /// auto_onimportcss
+ auto_onimportcss,
- _,
+_,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- pub const Platform = enum(u8) {
- _none,
- /// browser
- browser,
+
+};
- /// node
- node,
+pub const JsxRuntime = enum(u8) {
- /// bun
- bun,
+_none,
+ /// automatic
+ automatic,
- _,
+ /// classic
+ classic,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+_,
- pub const CssInJsBehavior = enum(u8) {
- _none,
- /// facade
- facade,
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- /// facade_onimportcss
- facade_onimportcss,
+
+};
- /// auto_onimportcss
- auto_onimportcss,
+pub const Jsx = struct {
+/// factory
+factory: []const u8,
- _,
+/// runtime
+runtime: JsxRuntime,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+/// fragment
+fragment: []const u8,
- pub const JsxRuntime = enum(u8) {
- _none,
- /// automatic
- automatic,
+/// development
+development: bool = false,
- /// classic
- classic,
+/// import_source
+import_source: []const u8,
- _,
+/// react_fast_refresh
+react_fast_refresh: bool = false,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
- pub const Jsx = struct {
- /// factory
- factory: []const u8,
+pub fn decode(reader: anytype) anyerror!Jsx {
+ var this = std.mem.zeroes(Jsx);
- /// runtime
- runtime: JsxRuntime,
+ this.factory = try reader.readValue([]const u8);
+ this.runtime = try reader.readValue(JsxRuntime);
+ this.fragment = try reader.readValue([]const u8);
+ this.development = try reader.readValue(bool);
+ this.import_source = try reader.readValue([]const u8);
+ this.react_fast_refresh = try reader.readValue(bool);
+ return this;
+}
- /// fragment
- fragment: []const u8,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.factory);
+ try writer.writeEnum(this.runtime);
+ try writer.writeValue(this.fragment);
+ try writer.writeInt(@intCast(u8, @boolToInt(this.development)));
+ try writer.writeValue(this.import_source);
+ try writer.writeInt(@intCast(u8, @boolToInt(this.react_fast_refresh)));
+}
- /// development
- development: bool = false,
+};
- /// import_source
- import_source: []const u8,
+pub const StringPointer = packed struct {
+/// offset
+offset: u32 = 0,
- /// react_fast_refresh
- react_fast_refresh: bool = false,
+/// length
+length: u32 = 0,
- pub fn decode(reader: anytype) anyerror!Jsx {
- var this = std.mem.zeroes(Jsx);
- this.factory = try reader.readValue([]const u8);
- this.runtime = try reader.readValue(JsxRuntime);
- this.fragment = try reader.readValue([]const u8);
- this.development = try reader.readValue(bool);
- this.import_source = try reader.readValue([]const u8);
- this.react_fast_refresh = try reader.readValue(bool);
- return this;
- }
+pub fn decode(reader: anytype) anyerror!StringPointer {
+ var this = std.mem.zeroes(StringPointer);
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeValue(this.factory);
- try writer.writeEnum(this.runtime);
- try writer.writeValue(this.fragment);
- try writer.writeInt(@intCast(u8, @boolToInt(this.development)));
- try writer.writeValue(this.import_source);
- try writer.writeInt(@intCast(u8, @boolToInt(this.react_fast_refresh)));
- }
- };
+ this.offset = try reader.readValue(u32);
+ this.length = try reader.readValue(u32);
+ return this;
+}
- pub const StringPointer = packed struct {
- /// offset
- offset: u32 = 0,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.offset);
+ try writer.writeInt(this.length);
+}
- /// length
- length: u32 = 0,
+};
- pub fn decode(reader: anytype) anyerror!StringPointer {
- var this = std.mem.zeroes(StringPointer);
+pub const JavascriptBundledModule = struct {
+/// path
+path: StringPointer,
- this.offset = try reader.readValue(u32);
- this.length = try reader.readValue(u32);
- return this;
- }
+/// code
+code: StringPointer,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.offset);
- try writer.writeInt(this.length);
- }
- };
+/// package_id
+package_id: u32 = 0,
- pub const JavascriptBundledModule = struct {
- /// path
- path: StringPointer,
+/// id
+id: u32 = 0,
- /// code
- code: StringPointer,
+/// path_extname_length
+path_extname_length: u8 = 0,
- /// package_id
- package_id: u32 = 0,
- /// id
- id: u32 = 0,
+pub fn decode(reader: anytype) anyerror!JavascriptBundledModule {
+ var this = std.mem.zeroes(JavascriptBundledModule);
- /// path_extname_length
- path_extname_length: u8 = 0,
+ this.path = try reader.readValue(StringPointer);
+ this.code = try reader.readValue(StringPointer);
+ this.package_id = try reader.readValue(u32);
+ this.id = try reader.readValue(u32);
+ this.path_extname_length = try reader.readValue(u8);
+ return this;
+}
- pub fn decode(reader: anytype) anyerror!JavascriptBundledModule {
- var this = std.mem.zeroes(JavascriptBundledModule);
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.path);
+ try writer.writeValue(this.code);
+ try writer.writeInt(this.package_id);
+ try writer.writeInt(this.id);
+ try writer.writeInt(this.path_extname_length);
+}
- this.path = try reader.readValue(StringPointer);
- this.code = try reader.readValue(StringPointer);
- this.package_id = try reader.readValue(u32);
- this.id = try reader.readValue(u32);
- this.path_extname_length = try reader.readValue(u8);
- return this;
- }
+};
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeValue(this.path);
- try writer.writeValue(this.code);
- try writer.writeInt(this.package_id);
- try writer.writeInt(this.id);
- try writer.writeInt(this.path_extname_length);
- }
- };
+pub const JavascriptBundledPackage = struct {
+/// name
+name: StringPointer,
- pub const JavascriptBundledPackage = struct {
- /// name
- name: StringPointer,
+/// version
+version: StringPointer,
- /// version
- version: StringPointer,
+/// hash
+hash: u32 = 0,
- /// hash
- hash: u32 = 0,
+/// modules_offset
+modules_offset: u32 = 0,
- /// modules_offset
- modules_offset: u32 = 0,
+/// modules_length
+modules_length: u32 = 0,
- /// modules_length
- modules_length: u32 = 0,
- pub fn decode(reader: anytype) anyerror!JavascriptBundledPackage {
- var this = std.mem.zeroes(JavascriptBundledPackage);
+pub fn decode(reader: anytype) anyerror!JavascriptBundledPackage {
+ var this = std.mem.zeroes(JavascriptBundledPackage);
- this.name = try reader.readValue(StringPointer);
- this.version = try reader.readValue(StringPointer);
- this.hash = try reader.readValue(u32);
- this.modules_offset = try reader.readValue(u32);
- this.modules_length = try reader.readValue(u32);
- return this;
- }
+ this.name = try reader.readValue(StringPointer);
+ this.version = try reader.readValue(StringPointer);
+ this.hash = try reader.readValue(u32);
+ this.modules_offset = try reader.readValue(u32);
+ this.modules_length = try reader.readValue(u32);
+ return this;
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeValue(this.name);
- try writer.writeValue(this.version);
- try writer.writeInt(this.hash);
- try writer.writeInt(this.modules_offset);
- try writer.writeInt(this.modules_length);
- }
- };
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.name);
+ try writer.writeValue(this.version);
+ try writer.writeInt(this.hash);
+ try writer.writeInt(this.modules_offset);
+ try writer.writeInt(this.modules_length);
+}
- pub const JavascriptBundle = struct {
- /// modules
- modules: []const JavascriptBundledModule,
+};
- /// packages
- packages: []const JavascriptBundledPackage,
+pub const JavascriptBundle = struct {
+/// modules
+modules: []const JavascriptBundledModule,
- /// etag
- etag: []const u8,
+/// packages
+packages: []const JavascriptBundledPackage,
- /// generated_at
- generated_at: u32 = 0,
+/// etag
+etag: []const u8,
- /// app_package_json_dependencies_hash
- app_package_json_dependencies_hash: []const u8,
+/// generated_at
+generated_at: u32 = 0,
- /// import_from_name
- import_from_name: []const u8,
+/// app_package_json_dependencies_hash
+app_package_json_dependencies_hash: []const u8,
- /// manifest_string
- manifest_string: []const u8,
+/// import_from_name
+import_from_name: []const u8,
- pub fn decode(reader: anytype) anyerror!JavascriptBundle {
- var this = std.mem.zeroes(JavascriptBundle);
+/// manifest_string
+manifest_string: []const u8,
- this.modules = try reader.readArray(JavascriptBundledModule);
- this.packages = try reader.readArray(JavascriptBundledPackage);
- this.etag = try reader.readArray(u8);
- this.generated_at = try reader.readValue(u32);
- this.app_package_json_dependencies_hash = try reader.readArray(u8);
- this.import_from_name = try reader.readArray(u8);
- this.manifest_string = try reader.readArray(u8);
- return this;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray(JavascriptBundledModule, this.modules);
- try writer.writeArray(JavascriptBundledPackage, this.packages);
- try writer.writeArray(u8, this.etag);
- try writer.writeInt(this.generated_at);
- try writer.writeArray(u8, this.app_package_json_dependencies_hash);
- try writer.writeArray(u8, this.import_from_name);
- try writer.writeArray(u8, this.manifest_string);
- }
- };
+pub fn decode(reader: anytype) anyerror!JavascriptBundle {
+ var this = std.mem.zeroes(JavascriptBundle);
- pub const JavascriptBundleContainer = struct {
- /// bundle_format_version
- bundle_format_version: ?u32 = null,
+ this.modules = try reader.readArray(JavascriptBundledModule);
+ this.packages = try reader.readArray(JavascriptBundledPackage);
+ this.etag = try reader.readArray(u8);
+ this.generated_at = try reader.readValue(u32);
+ this.app_package_json_dependencies_hash = try reader.readArray(u8);
+ this.import_from_name = try reader.readArray(u8);
+ this.manifest_string = try reader.readArray(u8);
+ return this;
+}
- /// routes
- routes: ?LoadedRouteConfig = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(JavascriptBundledModule, this.modules);
+ try writer.writeArray(JavascriptBundledPackage, this.packages);
+ try writer.writeArray(u8, this.etag);
+ try writer.writeInt(this.generated_at);
+ try writer.writeArray(u8, this.app_package_json_dependencies_hash);
+ try writer.writeArray(u8, this.import_from_name);
+ try writer.writeArray(u8, this.manifest_string);
+}
- /// framework
- framework: ?LoadedFramework = null,
+};
- /// bundle
- bundle: ?JavascriptBundle = null,
+pub const JavascriptBundleContainer = struct {
+/// bundle_format_version
+bundle_format_version: ?u32 = null,
+
+/// routes
+routes: ?LoadedRouteConfig = null,
+
+/// framework
+framework: ?LoadedFramework = null,
+
+/// bundle
+bundle: ?JavascriptBundle = null,
+
+/// code_length
+code_length: ?u32 = null,
+
+
+pub fn decode(reader: anytype) anyerror!JavascriptBundleContainer {
+ var this = std.mem.zeroes(JavascriptBundleContainer);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.bundle_format_version = try reader.readValue(u32);
+},
+ 2 => {
+ this.routes = try reader.readValue(LoadedRouteConfig);
+},
+ 3 => {
+ this.framework = try reader.readValue(LoadedFramework);
+},
+ 4 => {
+ this.bundle = try reader.readValue(JavascriptBundle);
+},
+ 5 => {
+ this.code_length = try reader.readValue(u32);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// code_length
- code_length: ?u32 = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.bundle_format_version) |bundle_format_version| {
+ try writer.writeFieldID(1);
+ try writer.writeInt(bundle_format_version);
+}
+if (this.routes) |routes| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(routes);
+}
+if (this.framework) |framework| {
+ try writer.writeFieldID(3);
+ try writer.writeValue(framework);
+}
+if (this.bundle) |bundle| {
+ try writer.writeFieldID(4);
+ try writer.writeValue(bundle);
+}
+if (this.code_length) |code_length| {
+ try writer.writeFieldID(5);
+ try writer.writeInt(code_length);
+}
+try writer.endMessage();
+}
- pub fn decode(reader: anytype) anyerror!JavascriptBundleContainer {
- var this = std.mem.zeroes(JavascriptBundleContainer);
+};
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+pub const ScanDependencyMode = enum(u8) {
- 1 => {
- this.bundle_format_version = try reader.readValue(u32);
- },
- 2 => {
- this.routes = try reader.readValue(LoadedRouteConfig);
- },
- 3 => {
- this.framework = try reader.readValue(LoadedFramework);
- },
- 4 => {
- this.bundle = try reader.readValue(JavascriptBundle);
- },
- 5 => {
- this.code_length = try reader.readValue(u32);
- },
- else => {
- return error.InvalidMessage;
- },
+_none,
+ /// app
+ app,
+
+ /// all
+ all,
+
+_,
+
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
}
- }
- unreachable;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.bundle_format_version) |bundle_format_version| {
- try writer.writeFieldID(1);
- try writer.writeInt(bundle_format_version);
- }
- if (this.routes) |routes| {
- try writer.writeFieldID(2);
- try writer.writeValue(routes);
- }
- if (this.framework) |framework| {
- try writer.writeFieldID(3);
- try writer.writeValue(framework);
- }
- if (this.bundle) |bundle| {
- try writer.writeFieldID(4);
- try writer.writeValue(bundle);
- }
- if (this.code_length) |code_length| {
- try writer.writeFieldID(5);
- try writer.writeInt(code_length);
- }
- try writer.endMessage();
- }
- };
+
+};
- pub const ScanDependencyMode = enum(u8) {
- _none,
- /// app
- app,
+pub const ModuleImportType = enum(u8) {
- /// all
- all,
+_none,
+ /// import
+ import,
- _,
+ /// require
+ require,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+_,
- pub const ModuleImportType = enum(u8) {
- _none,
- /// import
- import,
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- /// require
- require,
+
+};
- _,
+pub const ModuleImportRecord = struct {
+/// kind
+kind: ModuleImportType,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+/// path
+path: []const u8,
- pub const ModuleImportRecord = struct {
- /// kind
- kind: ModuleImportType,
+/// dynamic
+dynamic: bool = false,
- /// path
- path: []const u8,
- /// dynamic
- dynamic: bool = false,
+pub fn decode(reader: anytype) anyerror!ModuleImportRecord {
+ var this = std.mem.zeroes(ModuleImportRecord);
- pub fn decode(reader: anytype) anyerror!ModuleImportRecord {
- var this = std.mem.zeroes(ModuleImportRecord);
+ this.kind = try reader.readValue(ModuleImportType);
+ this.path = try reader.readValue([]const u8);
+ this.dynamic = try reader.readValue(bool);
+ return this;
+}
- this.kind = try reader.readValue(ModuleImportType);
- this.path = try reader.readValue([]const u8);
- this.dynamic = try reader.readValue(bool);
- return this;
- }
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeEnum(this.kind);
+ try writer.writeValue(this.path);
+ try writer.writeInt(@intCast(u8, @boolToInt(this.dynamic)));
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeEnum(this.kind);
- try writer.writeValue(this.path);
- try writer.writeInt(@intCast(u8, @boolToInt(this.dynamic)));
- }
- };
+};
- pub const Module = struct {
- /// path
- path: []const u8,
+pub const Module = struct {
+/// path
+path: []const u8,
- /// imports
- imports: []const ModuleImportRecord,
+/// imports
+imports: []const ModuleImportRecord,
- pub fn decode(reader: anytype) anyerror!Module {
- var this = std.mem.zeroes(Module);
- this.path = try reader.readValue([]const u8);
- this.imports = try reader.readArray(ModuleImportRecord);
- return this;
- }
+pub fn decode(reader: anytype) anyerror!Module {
+ var this = std.mem.zeroes(Module);
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeValue(this.path);
- try writer.writeArray(ModuleImportRecord, this.imports);
- }
- };
+ this.path = try reader.readValue([]const u8);
+ this.imports = try reader.readArray(ModuleImportRecord);
+ return this;
+}
+
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.path);
+ try writer.writeArray(ModuleImportRecord, this.imports);
+}
- pub const StringMap = struct {
- /// keys
- keys: []const []const u8,
+};
- /// values
- values: []const []const u8,
+pub const StringMap = struct {
+/// keys
+keys: []const []const u8,
- pub fn decode(reader: anytype) anyerror!StringMap {
- var this = std.mem.zeroes(StringMap);
+/// values
+values: []const []const u8,
- this.keys = try reader.readArray([]const u8);
- this.values = try reader.readArray([]const u8);
- return this;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray([]const u8, this.keys);
- try writer.writeArray([]const u8, this.values);
- }
- };
+pub fn decode(reader: anytype) anyerror!StringMap {
+ var this = std.mem.zeroes(StringMap);
+
+ this.keys = try reader.readArray([]const u8);
+ this.values = try reader.readArray([]const u8);
+ return this;
+}
- pub const LoaderMap = struct {
- /// extensions
- extensions: []const []const u8,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray([]const u8, this.keys);
+ try writer.writeArray([]const u8, this.values);
+}
- /// loaders
- loaders: []const Loader,
+};
- pub fn decode(reader: anytype) anyerror!LoaderMap {
- var this = std.mem.zeroes(LoaderMap);
+pub const LoaderMap = struct {
+/// extensions
+extensions: []const []const u8,
- this.extensions = try reader.readArray([]const u8);
- this.loaders = try reader.readArray(Loader);
- return this;
- }
+/// loaders
+loaders: []const Loader,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray([]const u8, this.extensions);
- try writer.writeArray(Loader, this.loaders);
- }
- };
- pub const DotEnvBehavior = enum(u32) {
- _none,
- /// disable
- disable,
+pub fn decode(reader: anytype) anyerror!LoaderMap {
+ var this = std.mem.zeroes(LoaderMap);
- /// prefix
- prefix,
+ this.extensions = try reader.readArray([]const u8);
+ this.loaders = try reader.readArray(Loader);
+ return this;
+}
- /// load_all
- load_all,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray([]const u8, this.extensions);
+ try writer.writeArray(Loader, this.loaders);
+}
- _,
+};
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+pub const DotEnvBehavior = enum(u32) {
- pub const EnvConfig = struct {
- /// prefix
- prefix: ?[]const u8 = null,
+_none,
+ /// disable
+ disable,
- /// defaults
- defaults: ?StringMap = null,
+ /// prefix
+ prefix,
- pub fn decode(reader: anytype) anyerror!EnvConfig {
- var this = std.mem.zeroes(EnvConfig);
+ /// load_all
+ load_all,
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+_,
- 1 => {
- this.prefix = try reader.readValue([]const u8);
- },
- 2 => {
- this.defaults = try reader.readValue(StringMap);
- },
- else => {
- return error.InvalidMessage;
- },
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
}
- }
- unreachable;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.prefix) |prefix| {
- try writer.writeFieldID(1);
- try writer.writeValue(prefix);
- }
- if (this.defaults) |defaults| {
- try writer.writeFieldID(2);
- try writer.writeValue(defaults);
- }
- try writer.endMessage();
- }
- };
+
+};
- pub const LoadedEnvConfig = struct {
- /// dotenv
- dotenv: DotEnvBehavior,
+pub const EnvConfig = struct {
+/// prefix
+prefix: ?[]const u8 = null,
+
+/// defaults
+defaults: ?StringMap = null,
+
+
+pub fn decode(reader: anytype) anyerror!EnvConfig {
+ var this = std.mem.zeroes(EnvConfig);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.prefix = try reader.readValue([]const u8);
+},
+ 2 => {
+ this.defaults = try reader.readValue(StringMap);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// defaults
- defaults: StringMap,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.prefix) |prefix| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(prefix);
+}
+if (this.defaults) |defaults| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(defaults);
+}
+try writer.endMessage();
+}
- /// prefix
- prefix: []const u8,
+};
- pub fn decode(reader: anytype) anyerror!LoadedEnvConfig {
- var this = std.mem.zeroes(LoadedEnvConfig);
+pub const LoadedEnvConfig = struct {
+/// dotenv
+dotenv: DotEnvBehavior,
- this.dotenv = try reader.readValue(DotEnvBehavior);
- this.defaults = try reader.readValue(StringMap);
- this.prefix = try reader.readValue([]const u8);
- return this;
- }
+/// defaults
+defaults: StringMap,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeEnum(this.dotenv);
- try writer.writeValue(this.defaults);
- try writer.writeValue(this.prefix);
- }
- };
+/// prefix
+prefix: []const u8,
- pub const FrameworkConfig = struct {
- /// package
- package: ?[]const u8 = null,
- /// client
- client: ?FrameworkEntryPointMessage = null,
+pub fn decode(reader: anytype) anyerror!LoadedEnvConfig {
+ var this = std.mem.zeroes(LoadedEnvConfig);
- /// server
- server: ?FrameworkEntryPointMessage = null,
+ this.dotenv = try reader.readValue(DotEnvBehavior);
+ this.defaults = try reader.readValue(StringMap);
+ this.prefix = try reader.readValue([]const u8);
+ return this;
+}
- /// fallback
- fallback: ?FrameworkEntryPointMessage = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeEnum(this.dotenv);
+ try writer.writeValue(this.defaults);
+ try writer.writeValue(this.prefix);
+}
- /// development
- development: ?bool = null,
+};
- /// client_css_in_js
- client_css_in_js: ?CssInJsBehavior = null,
+pub const FrameworkConfig = struct {
+/// package
+package: ?[]const u8 = null,
+
+/// client
+client: ?FrameworkEntryPointMessage = null,
+
+/// server
+server: ?FrameworkEntryPointMessage = null,
+
+/// fallback
+fallback: ?FrameworkEntryPointMessage = null,
+
+/// development
+development: ?bool = null,
+
+/// client_css_in_js
+client_css_in_js: ?CssInJsBehavior = null,
+
+/// display_name
+display_name: ?[]const u8 = null,
+
+/// overrideModules
+override_modules: ?StringMap = null,
+
+
+pub fn decode(reader: anytype) anyerror!FrameworkConfig {
+ var this = std.mem.zeroes(FrameworkConfig);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.package = try reader.readValue([]const u8);
+},
+ 2 => {
+ this.client = try reader.readValue(FrameworkEntryPointMessage);
+},
+ 3 => {
+ this.server = try reader.readValue(FrameworkEntryPointMessage);
+},
+ 4 => {
+ this.fallback = try reader.readValue(FrameworkEntryPointMessage);
+},
+ 5 => {
+ this.development = try reader.readValue(bool);
+},
+ 6 => {
+ this.client_css_in_js = try reader.readValue(CssInJsBehavior);
+},
+ 7 => {
+ this.display_name = try reader.readValue([]const u8);
+},
+ 8 => {
+ this.override_modules = try reader.readValue(StringMap);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// display_name
- display_name: ?[]const u8 = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.package) |package| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(package);
+}
+if (this.client) |client| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(client);
+}
+if (this.server) |server| {
+ try writer.writeFieldID(3);
+ try writer.writeValue(server);
+}
+if (this.fallback) |fallback| {
+ try writer.writeFieldID(4);
+ try writer.writeValue(fallback);
+}
+if (this.development) |development| {
+ try writer.writeFieldID(5);
+ try writer.writeInt(@intCast(u8, @boolToInt(development)));
+}
+if (this.client_css_in_js) |client_css_in_js| {
+ try writer.writeFieldID(6);
+ try writer.writeEnum(client_css_in_js);
+}
+if (this.display_name) |display_name| {
+ try writer.writeFieldID(7);
+ try writer.writeValue(display_name);
+}
+if (this.override_modules) |override_modules| {
+ try writer.writeFieldID(8);
+ try writer.writeValue(override_modules);
+}
+try writer.endMessage();
+}
- /// overrideModules
- override_modules: ?StringMap = null,
+};
- pub fn decode(reader: anytype) anyerror!FrameworkConfig {
- var this = std.mem.zeroes(FrameworkConfig);
+pub const FrameworkEntryPoint = struct {
+/// kind
+kind: FrameworkEntryPointType,
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+/// path
+path: []const u8,
- 1 => {
- this.package = try reader.readValue([]const u8);
- },
- 2 => {
- this.client = try reader.readValue(FrameworkEntryPointMessage);
- },
- 3 => {
- this.server = try reader.readValue(FrameworkEntryPointMessage);
- },
- 4 => {
- this.fallback = try reader.readValue(FrameworkEntryPointMessage);
- },
- 5 => {
- this.development = try reader.readValue(bool);
- },
- 6 => {
- this.client_css_in_js = try reader.readValue(CssInJsBehavior);
- },
- 7 => {
- this.display_name = try reader.readValue([]const u8);
- },
- 8 => {
- this.override_modules = try reader.readValue(StringMap);
- },
- else => {
- return error.InvalidMessage;
- },
- }
- }
- unreachable;
- }
+/// env
+env: LoadedEnvConfig,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.package) |package| {
- try writer.writeFieldID(1);
- try writer.writeValue(package);
- }
- if (this.client) |client| {
- try writer.writeFieldID(2);
- try writer.writeValue(client);
- }
- if (this.server) |server| {
- try writer.writeFieldID(3);
- try writer.writeValue(server);
- }
- if (this.fallback) |fallback| {
- try writer.writeFieldID(4);
- try writer.writeValue(fallback);
- }
- if (this.development) |development| {
- try writer.writeFieldID(5);
- try writer.writeInt(@intCast(u8, @boolToInt(development)));
- }
- if (this.client_css_in_js) |client_css_in_js| {
- try writer.writeFieldID(6);
- try writer.writeEnum(client_css_in_js);
- }
- if (this.display_name) |display_name| {
- try writer.writeFieldID(7);
- try writer.writeValue(display_name);
- }
- if (this.override_modules) |override_modules| {
- try writer.writeFieldID(8);
- try writer.writeValue(override_modules);
- }
- try writer.endMessage();
- }
- };
- pub const FrameworkEntryPoint = struct {
- /// kind
- kind: FrameworkEntryPointType,
+pub fn decode(reader: anytype) anyerror!FrameworkEntryPoint {
+ var this = std.mem.zeroes(FrameworkEntryPoint);
- /// path
- path: []const u8,
+ this.kind = try reader.readValue(FrameworkEntryPointType);
+ this.path = try reader.readValue([]const u8);
+ this.env = try reader.readValue(LoadedEnvConfig);
+ return this;
+}
- /// env
- env: LoadedEnvConfig,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeEnum(this.kind);
+ try writer.writeValue(this.path);
+ try writer.writeValue(this.env);
+}
- pub fn decode(reader: anytype) anyerror!FrameworkEntryPoint {
- var this = std.mem.zeroes(FrameworkEntryPoint);
+};
- this.kind = try reader.readValue(FrameworkEntryPointType);
- this.path = try reader.readValue([]const u8);
- this.env = try reader.readValue(LoadedEnvConfig);
- return this;
- }
+pub const FrameworkEntryPointMap = struct {
+/// client
+client: ?FrameworkEntryPoint = null,
+
+/// server
+server: ?FrameworkEntryPoint = null,
+
+/// fallback
+fallback: ?FrameworkEntryPoint = null,
+
+
+pub fn decode(reader: anytype) anyerror!FrameworkEntryPointMap {
+ var this = std.mem.zeroes(FrameworkEntryPointMap);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.client = try reader.readValue(FrameworkEntryPoint);
+},
+ 2 => {
+ this.server = try reader.readValue(FrameworkEntryPoint);
+},
+ 3 => {
+ this.fallback = try reader.readValue(FrameworkEntryPoint);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeEnum(this.kind);
- try writer.writeValue(this.path);
- try writer.writeValue(this.env);
- }
- };
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.client) |client| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(client);
+}
+if (this.server) |server| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(server);
+}
+if (this.fallback) |fallback| {
+ try writer.writeFieldID(3);
+ try writer.writeValue(fallback);
+}
+try writer.endMessage();
+}
- pub const FrameworkEntryPointMap = struct {
- /// client
- client: ?FrameworkEntryPoint = null,
+};
- /// server
- server: ?FrameworkEntryPoint = null,
+pub const FrameworkEntryPointMessage = struct {
+/// path
+path: ?[]const u8 = null,
+
+/// env
+env: ?EnvConfig = null,
+
+
+pub fn decode(reader: anytype) anyerror!FrameworkEntryPointMessage {
+ var this = std.mem.zeroes(FrameworkEntryPointMessage);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.path = try reader.readValue([]const u8);
+},
+ 2 => {
+ this.env = try reader.readValue(EnvConfig);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// fallback
- fallback: ?FrameworkEntryPoint = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.path) |path| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(path);
+}
+if (this.env) |env| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(env);
+}
+try writer.endMessage();
+}
- pub fn decode(reader: anytype) anyerror!FrameworkEntryPointMap {
- var this = std.mem.zeroes(FrameworkEntryPointMap);
+};
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+pub const LoadedFramework = struct {
+/// package
+package: []const u8,
- 1 => {
- this.client = try reader.readValue(FrameworkEntryPoint);
- },
- 2 => {
- this.server = try reader.readValue(FrameworkEntryPoint);
- },
- 3 => {
- this.fallback = try reader.readValue(FrameworkEntryPoint);
- },
- else => {
- return error.InvalidMessage;
- },
- }
- }
- unreachable;
- }
+/// display_name
+display_name: []const u8,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.client) |client| {
- try writer.writeFieldID(1);
- try writer.writeValue(client);
- }
- if (this.server) |server| {
- try writer.writeFieldID(2);
- try writer.writeValue(server);
- }
- if (this.fallback) |fallback| {
- try writer.writeFieldID(3);
- try writer.writeValue(fallback);
- }
- try writer.endMessage();
- }
- };
+/// development
+development: bool = false,
- pub const FrameworkEntryPointMessage = struct {
- /// path
- path: ?[]const u8 = null,
+/// entry_points
+entry_points: FrameworkEntryPointMap,
- /// env
- env: ?EnvConfig = null,
+/// client_css_in_js
+client_css_in_js: CssInJsBehavior,
- pub fn decode(reader: anytype) anyerror!FrameworkEntryPointMessage {
- var this = std.mem.zeroes(FrameworkEntryPointMessage);
+/// overrideModules
+override_modules: StringMap,
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
- 1 => {
- this.path = try reader.readValue([]const u8);
- },
- 2 => {
- this.env = try reader.readValue(EnvConfig);
- },
- else => {
- return error.InvalidMessage;
- },
- }
- }
- unreachable;
- }
+pub fn decode(reader: anytype) anyerror!LoadedFramework {
+ var this = std.mem.zeroes(LoadedFramework);
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.path) |path| {
- try writer.writeFieldID(1);
- try writer.writeValue(path);
- }
- if (this.env) |env| {
- try writer.writeFieldID(2);
- try writer.writeValue(env);
- }
- try writer.endMessage();
- }
- };
+ this.package = try reader.readValue([]const u8);
+ this.display_name = try reader.readValue([]const u8);
+ this.development = try reader.readValue(bool);
+ this.entry_points = try reader.readValue(FrameworkEntryPointMap);
+ this.client_css_in_js = try reader.readValue(CssInJsBehavior);
+ this.override_modules = try reader.readValue(StringMap);
+ return this;
+}
- pub const LoadedFramework = struct {
- /// package
- package: []const u8,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.package);
+ try writer.writeValue(this.display_name);
+ try writer.writeInt(@intCast(u8, @boolToInt(this.development)));
+ try writer.writeValue(this.entry_points);
+ try writer.writeEnum(this.client_css_in_js);
+ try writer.writeValue(this.override_modules);
+}
- /// display_name
- display_name: []const u8,
+};
- /// development
- development: bool = false,
+pub const LoadedRouteConfig = struct {
+/// dir
+dir: []const u8,
- /// entry_points
- entry_points: FrameworkEntryPointMap,
+/// extensions
+extensions: []const []const u8,
- /// client_css_in_js
- client_css_in_js: CssInJsBehavior,
+/// static_dir
+static_dir: []const u8,
- /// overrideModules
- override_modules: StringMap,
+/// asset_prefix
+asset_prefix: []const u8,
- pub fn decode(reader: anytype) anyerror!LoadedFramework {
- var this = std.mem.zeroes(LoadedFramework);
- this.package = try reader.readValue([]const u8);
- this.display_name = try reader.readValue([]const u8);
- this.development = try reader.readValue(bool);
- this.entry_points = try reader.readValue(FrameworkEntryPointMap);
- this.client_css_in_js = try reader.readValue(CssInJsBehavior);
- this.override_modules = try reader.readValue(StringMap);
- return this;
- }
+pub fn decode(reader: anytype) anyerror!LoadedRouteConfig {
+ var this = std.mem.zeroes(LoadedRouteConfig);
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeValue(this.package);
- try writer.writeValue(this.display_name);
- try writer.writeInt(@intCast(u8, @boolToInt(this.development)));
- try writer.writeValue(this.entry_points);
- try writer.writeEnum(this.client_css_in_js);
- try writer.writeValue(this.override_modules);
- }
- };
+ this.dir = try reader.readValue([]const u8);
+ this.extensions = try reader.readArray([]const u8);
+ this.static_dir = try reader.readValue([]const u8);
+ this.asset_prefix = try reader.readValue([]const u8);
+ return this;
+}
- pub const LoadedRouteConfig = struct {
- /// dir
- dir: []const u8,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.dir);
+ try writer.writeArray([]const u8, this.extensions);
+ try writer.writeValue(this.static_dir);
+ try writer.writeValue(this.asset_prefix);
+}
- /// extensions
- extensions: []const []const u8,
+};
- /// static_dir
- static_dir: []const u8,
+pub const RouteConfig = struct {
+/// dir
+dir: []const []const u8,
+
+/// extensions
+extensions: []const []const u8,
+
+/// static_dir
+static_dir: ?[]const u8 = null,
+
+/// asset_prefix
+asset_prefix: ?[]const u8 = null,
+
+
+pub fn decode(reader: anytype) anyerror!RouteConfig {
+ var this = std.mem.zeroes(RouteConfig);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.dir = try reader.readArray([]const u8);
+},
+ 2 => {
+ this.extensions = try reader.readArray([]const u8);
+},
+ 3 => {
+ this.static_dir = try reader.readValue([]const u8);
+},
+ 4 => {
+ this.asset_prefix = try reader.readValue([]const u8);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// asset_prefix
- asset_prefix: []const u8,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.dir) |dir| {
+ try writer.writeFieldID(1);
+ try writer.writeArray([]const u8, dir);
+}
+if (this.extensions) |extensions| {
+ try writer.writeFieldID(2);
+ try writer.writeArray([]const u8, extensions);
+}
+if (this.static_dir) |static_dir| {
+ try writer.writeFieldID(3);
+ try writer.writeValue(static_dir);
+}
+if (this.asset_prefix) |asset_prefix| {
+ try writer.writeFieldID(4);
+ try writer.writeValue(asset_prefix);
+}
+try writer.endMessage();
+}
- pub fn decode(reader: anytype) anyerror!LoadedRouteConfig {
- var this = std.mem.zeroes(LoadedRouteConfig);
+};
- this.dir = try reader.readValue([]const u8);
- this.extensions = try reader.readArray([]const u8);
- this.static_dir = try reader.readValue([]const u8);
- this.asset_prefix = try reader.readValue([]const u8);
- return this;
- }
+pub const TransformOptions = struct {
+/// jsx
+jsx: ?Jsx = null,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeValue(this.dir);
- try writer.writeArray([]const u8, this.extensions);
- try writer.writeValue(this.static_dir);
- try writer.writeValue(this.asset_prefix);
- }
- };
+/// tsconfig_override
+tsconfig_override: ?[]const u8 = null,
- pub const RouteConfig = struct {
- /// dir
- dir: []const []const u8,
+/// resolve
+resolve: ?ResolveMode = null,
- /// extensions
- extensions: []const []const u8,
+/// origin
+origin: ?[]const u8 = null,
- /// static_dir
- static_dir: ?[]const u8 = null,
+/// absolute_working_dir
+absolute_working_dir: ?[]const u8 = null,
+
+/// define
+define: ?StringMap = null,
+
+/// preserve_symlinks
+preserve_symlinks: ?bool = null,
+
+/// entry_points
+entry_points: []const []const u8,
+
+/// write
+write: ?bool = null,
+
+/// inject
+inject: []const []const u8,
+
+/// output_dir
+output_dir: ?[]const u8 = null,
+
+/// external
+external: []const []const u8,
+
+/// loaders
+loaders: ?LoaderMap = null,
+
+/// main_fields
+main_fields: []const []const u8,
+
+/// platform
+platform: ?Platform = null,
+
+/// serve
+serve: ?bool = null,
+
+/// extension_order
+extension_order: []const []const u8,
+
+/// generate_node_module_bundle
+generate_node_module_bundle: ?bool = null,
+
+/// node_modules_bundle_path
+node_modules_bundle_path: ?[]const u8 = null,
+
+/// node_modules_bundle_path_server
+node_modules_bundle_path_server: ?[]const u8 = null,
+
+/// framework
+framework: ?FrameworkConfig = null,
+
+/// router
+router: ?RouteConfig = null,
+
+/// no_summary
+no_summary: ?bool = null,
+
+/// disable_hmr
+disable_hmr: ?bool = null,
+
+
+pub fn decode(reader: anytype) anyerror!TransformOptions {
+ var this = std.mem.zeroes(TransformOptions);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.jsx = try reader.readValue(Jsx);
+},
+ 2 => {
+ this.tsconfig_override = try reader.readValue([]const u8);
+},
+ 3 => {
+ this.resolve = try reader.readValue(ResolveMode);
+},
+ 4 => {
+ this.origin = try reader.readValue([]const u8);
+},
+ 5 => {
+ this.absolute_working_dir = try reader.readValue([]const u8);
+},
+ 6 => {
+ this.define = try reader.readValue(StringMap);
+},
+ 7 => {
+ this.preserve_symlinks = try reader.readValue(bool);
+},
+ 8 => {
+ this.entry_points = try reader.readArray([]const u8);
+},
+ 9 => {
+ this.write = try reader.readValue(bool);
+},
+ 10 => {
+ this.inject = try reader.readArray([]const u8);
+},
+ 11 => {
+ this.output_dir = try reader.readValue([]const u8);
+},
+ 12 => {
+ this.external = try reader.readArray([]const u8);
+},
+ 13 => {
+ this.loaders = try reader.readValue(LoaderMap);
+},
+ 14 => {
+ this.main_fields = try reader.readArray([]const u8);
+},
+ 15 => {
+ this.platform = try reader.readValue(Platform);
+},
+ 16 => {
+ this.serve = try reader.readValue(bool);
+},
+ 17 => {
+ this.extension_order = try reader.readArray([]const u8);
+},
+ 18 => {
+ this.generate_node_module_bundle = try reader.readValue(bool);
+},
+ 19 => {
+ this.node_modules_bundle_path = try reader.readValue([]const u8);
+},
+ 20 => {
+ this.node_modules_bundle_path_server = try reader.readValue([]const u8);
+},
+ 21 => {
+ this.framework = try reader.readValue(FrameworkConfig);
+},
+ 22 => {
+ this.router = try reader.readValue(RouteConfig);
+},
+ 23 => {
+ this.no_summary = try reader.readValue(bool);
+},
+ 24 => {
+ this.disable_hmr = try reader.readValue(bool);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// asset_prefix
- asset_prefix: ?[]const u8 = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.jsx) |jsx| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(jsx);
+}
+if (this.tsconfig_override) |tsconfig_override| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(tsconfig_override);
+}
+if (this.resolve) |resolve| {
+ try writer.writeFieldID(3);
+ try writer.writeEnum(resolve);
+}
+if (this.origin) |origin| {
+ try writer.writeFieldID(4);
+ try writer.writeValue(origin);
+}
+if (this.absolute_working_dir) |absolute_working_dir| {
+ try writer.writeFieldID(5);
+ try writer.writeValue(absolute_working_dir);
+}
+if (this.define) |define| {
+ try writer.writeFieldID(6);
+ try writer.writeValue(define);
+}
+if (this.preserve_symlinks) |preserve_symlinks| {
+ try writer.writeFieldID(7);
+ try writer.writeInt(@intCast(u8, @boolToInt(preserve_symlinks)));
+}
+if (this.entry_points) |entry_points| {
+ try writer.writeFieldID(8);
+ try writer.writeArray([]const u8, entry_points);
+}
+if (this.write) |write| {
+ try writer.writeFieldID(9);
+ try writer.writeInt(@intCast(u8, @boolToInt(write)));
+}
+if (this.inject) |inject| {
+ try writer.writeFieldID(10);
+ try writer.writeArray([]const u8, inject);
+}
+if (this.output_dir) |output_dir| {
+ try writer.writeFieldID(11);
+ try writer.writeValue(output_dir);
+}
+if (this.external) |external| {
+ try writer.writeFieldID(12);
+ try writer.writeArray([]const u8, external);
+}
+if (this.loaders) |loaders| {
+ try writer.writeFieldID(13);
+ try writer.writeValue(loaders);
+}
+if (this.main_fields) |main_fields| {
+ try writer.writeFieldID(14);
+ try writer.writeArray([]const u8, main_fields);
+}
+if (this.platform) |platform| {
+ try writer.writeFieldID(15);
+ try writer.writeEnum(platform);
+}
+if (this.serve) |serve| {
+ try writer.writeFieldID(16);
+ try writer.writeInt(@intCast(u8, @boolToInt(serve)));
+}
+if (this.extension_order) |extension_order| {
+ try writer.writeFieldID(17);
+ try writer.writeArray([]const u8, extension_order);
+}
+if (this.generate_node_module_bundle) |generate_node_module_bundle| {
+ try writer.writeFieldID(18);
+ try writer.writeInt(@intCast(u8, @boolToInt(generate_node_module_bundle)));
+}
+if (this.node_modules_bundle_path) |node_modules_bundle_path| {
+ try writer.writeFieldID(19);
+ try writer.writeValue(node_modules_bundle_path);
+}
+if (this.node_modules_bundle_path_server) |node_modules_bundle_path_server| {
+ try writer.writeFieldID(20);
+ try writer.writeValue(node_modules_bundle_path_server);
+}
+if (this.framework) |framework| {
+ try writer.writeFieldID(21);
+ try writer.writeValue(framework);
+}
+if (this.router) |router| {
+ try writer.writeFieldID(22);
+ try writer.writeValue(router);
+}
+if (this.no_summary) |no_summary| {
+ try writer.writeFieldID(23);
+ try writer.writeInt(@intCast(u8, @boolToInt(no_summary)));
+}
+if (this.disable_hmr) |disable_hmr| {
+ try writer.writeFieldID(24);
+ try writer.writeInt(@intCast(u8, @boolToInt(disable_hmr)));
+}
+try writer.endMessage();
+}
- pub fn decode(reader: anytype) anyerror!RouteConfig {
- var this = std.mem.zeroes(RouteConfig);
+};
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+pub const FileHandle = struct {
+/// path
+path: []const u8,
- 1 => {
- this.dir = try reader.readArray([]const u8);
- },
- 2 => {
- this.extensions = try reader.readArray([]const u8);
- },
- 3 => {
- this.static_dir = try reader.readValue([]const u8);
- },
- 4 => {
- this.asset_prefix = try reader.readValue([]const u8);
- },
- else => {
- return error.InvalidMessage;
- },
- }
- }
- unreachable;
- }
+/// size
+size: u32 = 0,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.dir) |dir| {
- try writer.writeFieldID(1);
- try writer.writeArray([]const u8, dir);
- }
- if (this.extensions) |extensions| {
- try writer.writeFieldID(2);
- try writer.writeArray([]const u8, extensions);
- }
- if (this.static_dir) |static_dir| {
- try writer.writeFieldID(3);
- try writer.writeValue(static_dir);
- }
- if (this.asset_prefix) |asset_prefix| {
- try writer.writeFieldID(4);
- try writer.writeValue(asset_prefix);
- }
- try writer.endMessage();
- }
- };
+/// fd
+fd: u32 = 0,
+
+
+pub fn decode(reader: anytype) anyerror!FileHandle {
+ var this = std.mem.zeroes(FileHandle);
+
+ this.path = try reader.readValue([]const u8);
+ this.size = try reader.readValue(u32);
+ this.fd = try reader.readValue(u32);
+ return this;
+}
+
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.path);
+ try writer.writeInt(this.size);
+ try writer.writeInt(this.fd);
+}
+
+};
+
+pub const Transform = struct {
+/// handle
+handle: ?FileHandle = null,
+
+/// path
+path: ?[]const u8 = null,
+
+/// contents
+contents: []const u8,
+
+/// loader
+loader: ?Loader = null,
+
+/// options
+options: ?TransformOptions = null,
+
+
+pub fn decode(reader: anytype) anyerror!Transform {
+ var this = std.mem.zeroes(Transform);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.handle = try reader.readValue(FileHandle);
+},
+ 2 => {
+ this.path = try reader.readValue([]const u8);
+},
+ 3 => {
+ this.contents = try reader.readArray(u8);
+},
+ 4 => {
+ this.loader = try reader.readValue(Loader);
+},
+ 5 => {
+ this.options = try reader.readValue(TransformOptions);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
+
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.handle) |handle| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(handle);
+}
+if (this.path) |path| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(path);
+}
+if (this.contents) |contents| {
+ try writer.writeFieldID(3);
+ try writer.writeArray(u8, contents);
+}
+if (this.loader) |loader| {
+ try writer.writeFieldID(4);
+ try writer.writeEnum(loader);
+}
+if (this.options) |options| {
+ try writer.writeFieldID(5);
+ try writer.writeValue(options);
+}
+try writer.endMessage();
+}
- pub const TransformOptions = struct {
- /// jsx
- jsx: ?Jsx = null,
+};
- /// tsconfig_override
- tsconfig_override: ?[]const u8 = null,
+pub const TransformResponseStatus = enum(u32) {
- /// resolve
- resolve: ?ResolveMode = null,
+_none,
+ /// success
+ success,
- /// origin
- origin: ?[]const u8 = null,
+ /// fail
+ fail,
- /// absolute_working_dir
- absolute_working_dir: ?[]const u8 = null,
+_,
- /// define
- define: ?StringMap = null,
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- /// preserve_symlinks
- preserve_symlinks: ?bool = null,
+
+};
- /// entry_points
- entry_points: []const []const u8,
+pub const OutputFile = struct {
+/// data
+data: []const u8,
- /// write
- write: ?bool = null,
+/// path
+path: []const u8,
- /// inject
- inject: []const []const u8,
- /// output_dir
- output_dir: ?[]const u8 = null,
+pub fn decode(reader: anytype) anyerror!OutputFile {
+ var this = std.mem.zeroes(OutputFile);
- /// external
- external: []const []const u8,
+ this.data = try reader.readArray(u8);
+ this.path = try reader.readValue([]const u8);
+ return this;
+}
- /// loaders
- loaders: ?LoaderMap = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(u8, this.data);
+ try writer.writeValue(this.path);
+}
- /// main_fields
- main_fields: []const []const u8,
+};
- /// platform
- platform: ?Platform = null,
+pub const TransformResponse = struct {
+/// status
+status: TransformResponseStatus,
- /// serve
- serve: ?bool = null,
+/// files
+files: []const OutputFile,
- /// extension_order
- extension_order: []const []const u8,
+/// errors
+errors: []const Message,
- /// generate_node_module_bundle
- generate_node_module_bundle: ?bool = null,
- /// node_modules_bundle_path
- node_modules_bundle_path: ?[]const u8 = null,
+pub fn decode(reader: anytype) anyerror!TransformResponse {
+ var this = std.mem.zeroes(TransformResponse);
- /// node_modules_bundle_path_server
- node_modules_bundle_path_server: ?[]const u8 = null,
+ this.status = try reader.readValue(TransformResponseStatus);
+ this.files = try reader.readArray(OutputFile);
+ this.errors = try reader.readArray(Message);
+ return this;
+}
- /// framework
- framework: ?FrameworkConfig = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeEnum(this.status);
+ try writer.writeArray(OutputFile, this.files);
+ try writer.writeArray(Message, this.errors);
+}
- /// router
- router: ?RouteConfig = null,
+};
- /// no_summary
- no_summary: ?bool = null,
+pub const MessageLevel = enum(u32) {
- /// disable_hmr
- disable_hmr: ?bool = null,
+_none,
+ /// err
+ err,
- pub fn decode(reader: anytype) anyerror!TransformOptions {
- var this = std.mem.zeroes(TransformOptions);
+ /// warn
+ warn,
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+ /// note
+ note,
- 1 => {
- this.jsx = try reader.readValue(Jsx);
- },
- 2 => {
- this.tsconfig_override = try reader.readValue([]const u8);
- },
- 3 => {
- this.resolve = try reader.readValue(ResolveMode);
- },
- 4 => {
- this.origin = try reader.readValue([]const u8);
- },
- 5 => {
- this.absolute_working_dir = try reader.readValue([]const u8);
- },
- 6 => {
- this.define = try reader.readValue(StringMap);
- },
- 7 => {
- this.preserve_symlinks = try reader.readValue(bool);
- },
- 8 => {
- this.entry_points = try reader.readArray([]const u8);
- },
- 9 => {
- this.write = try reader.readValue(bool);
- },
- 10 => {
- this.inject = try reader.readArray([]const u8);
- },
- 11 => {
- this.output_dir = try reader.readValue([]const u8);
- },
- 12 => {
- this.external = try reader.readArray([]const u8);
- },
- 13 => {
- this.loaders = try reader.readValue(LoaderMap);
- },
- 14 => {
- this.main_fields = try reader.readArray([]const u8);
- },
- 15 => {
- this.platform = try reader.readValue(Platform);
- },
- 16 => {
- this.serve = try reader.readValue(bool);
- },
- 17 => {
- this.extension_order = try reader.readArray([]const u8);
- },
- 18 => {
- this.generate_node_module_bundle = try reader.readValue(bool);
- },
- 19 => {
- this.node_modules_bundle_path = try reader.readValue([]const u8);
- },
- 20 => {
- this.node_modules_bundle_path_server = try reader.readValue([]const u8);
- },
- 21 => {
- this.framework = try reader.readValue(FrameworkConfig);
- },
- 22 => {
- this.router = try reader.readValue(RouteConfig);
- },
- 23 => {
- this.no_summary = try reader.readValue(bool);
- },
- 24 => {
- this.disable_hmr = try reader.readValue(bool);
- },
- else => {
- return error.InvalidMessage;
- },
+ /// debug
+ debug,
+
+_,
+
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
}
- }
- unreachable;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.jsx) |jsx| {
- try writer.writeFieldID(1);
- try writer.writeValue(jsx);
- }
- if (this.tsconfig_override) |tsconfig_override| {
- try writer.writeFieldID(2);
- try writer.writeValue(tsconfig_override);
- }
- if (this.resolve) |resolve| {
- try writer.writeFieldID(3);
- try writer.writeEnum(resolve);
- }
- if (this.origin) |origin| {
- try writer.writeFieldID(4);
- try writer.writeValue(origin);
- }
- if (this.absolute_working_dir) |absolute_working_dir| {
- try writer.writeFieldID(5);
- try writer.writeValue(absolute_working_dir);
- }
- if (this.define) |define| {
- try writer.writeFieldID(6);
- try writer.writeValue(define);
- }
- if (this.preserve_symlinks) |preserve_symlinks| {
- try writer.writeFieldID(7);
- try writer.writeInt(@intCast(u8, @boolToInt(preserve_symlinks)));
- }
- if (this.entry_points) |entry_points| {
- try writer.writeFieldID(8);
- try writer.writeArray([]const u8, entry_points);
- }
- if (this.write) |write| {
- try writer.writeFieldID(9);
- try writer.writeInt(@intCast(u8, @boolToInt(write)));
- }
- if (this.inject) |inject| {
- try writer.writeFieldID(10);
- try writer.writeArray([]const u8, inject);
- }
- if (this.output_dir) |output_dir| {
- try writer.writeFieldID(11);
- try writer.writeValue(output_dir);
- }
- if (this.external) |external| {
- try writer.writeFieldID(12);
- try writer.writeArray([]const u8, external);
- }
- if (this.loaders) |loaders| {
- try writer.writeFieldID(13);
- try writer.writeValue(loaders);
- }
- if (this.main_fields) |main_fields| {
- try writer.writeFieldID(14);
- try writer.writeArray([]const u8, main_fields);
- }
- if (this.platform) |platform| {
- try writer.writeFieldID(15);
- try writer.writeEnum(platform);
- }
- if (this.serve) |serve| {
- try writer.writeFieldID(16);
- try writer.writeInt(@intCast(u8, @boolToInt(serve)));
- }
- if (this.extension_order) |extension_order| {
- try writer.writeFieldID(17);
- try writer.writeArray([]const u8, extension_order);
- }
- if (this.generate_node_module_bundle) |generate_node_module_bundle| {
- try writer.writeFieldID(18);
- try writer.writeInt(@intCast(u8, @boolToInt(generate_node_module_bundle)));
- }
- if (this.node_modules_bundle_path) |node_modules_bundle_path| {
- try writer.writeFieldID(19);
- try writer.writeValue(node_modules_bundle_path);
- }
- if (this.node_modules_bundle_path_server) |node_modules_bundle_path_server| {
- try writer.writeFieldID(20);
- try writer.writeValue(node_modules_bundle_path_server);
- }
- if (this.framework) |framework| {
- try writer.writeFieldID(21);
- try writer.writeValue(framework);
- }
- if (this.router) |router| {
- try writer.writeFieldID(22);
- try writer.writeValue(router);
- }
- if (this.no_summary) |no_summary| {
- try writer.writeFieldID(23);
- try writer.writeInt(@intCast(u8, @boolToInt(no_summary)));
- }
- if (this.disable_hmr) |disable_hmr| {
- try writer.writeFieldID(24);
- try writer.writeInt(@intCast(u8, @boolToInt(disable_hmr)));
- }
- try writer.endMessage();
- }
- };
+
+};
- pub const FileHandle = struct {
- /// path
- path: []const u8,
+pub const Location = struct {
+/// file
+file: []const u8,
- /// size
- size: u32 = 0,
+/// namespace
+namespace: []const u8,
- /// fd
- fd: u32 = 0,
+/// line
+line: i32 = 0,
- pub fn decode(reader: anytype) anyerror!FileHandle {
- var this = std.mem.zeroes(FileHandle);
+/// column
+column: i32 = 0,
- this.path = try reader.readValue([]const u8);
- this.size = try reader.readValue(u32);
- this.fd = try reader.readValue(u32);
- return this;
- }
+/// line_text
+line_text: []const u8,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeValue(this.path);
- try writer.writeInt(this.size);
- try writer.writeInt(this.fd);
- }
- };
+/// suggestion
+suggestion: []const u8,
- pub const Transform = struct {
- /// handle
- handle: ?FileHandle = null,
+/// offset
+offset: u32 = 0,
- /// path
- path: ?[]const u8 = null,
- /// contents
- contents: []const u8,
+pub fn decode(reader: anytype) anyerror!Location {
+ var this = std.mem.zeroes(Location);
- /// loader
- loader: ?Loader = null,
+ this.file = try reader.readValue([]const u8);
+ this.namespace = try reader.readValue([]const u8);
+ this.line = try reader.readValue(i32);
+ this.column = try reader.readValue(i32);
+ this.line_text = try reader.readValue([]const u8);
+ this.suggestion = try reader.readValue([]const u8);
+ this.offset = try reader.readValue(u32);
+ return this;
+}
- /// options
- options: ?TransformOptions = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.file);
+ try writer.writeValue(this.namespace);
+ try writer.writeInt(this.line);
+ try writer.writeInt(this.column);
+ try writer.writeValue(this.line_text);
+ try writer.writeValue(this.suggestion);
+ try writer.writeInt(this.offset);
+}
- pub fn decode(reader: anytype) anyerror!Transform {
- var this = std.mem.zeroes(Transform);
+};
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+pub const MessageData = struct {
+/// text
+text: ?[]const u8 = null,
+
+/// location
+location: ?Location = null,
+
+
+pub fn decode(reader: anytype) anyerror!MessageData {
+ var this = std.mem.zeroes(MessageData);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.text = try reader.readValue([]const u8);
+},
+ 2 => {
+ this.location = try reader.readValue(Location);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- 1 => {
- this.handle = try reader.readValue(FileHandle);
- },
- 2 => {
- this.path = try reader.readValue([]const u8);
- },
- 3 => {
- this.contents = try reader.readArray(u8);
- },
- 4 => {
- this.loader = try reader.readValue(Loader);
- },
- 5 => {
- this.options = try reader.readValue(TransformOptions);
- },
- else => {
- return error.InvalidMessage;
- },
- }
- }
- unreachable;
- }
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.text) |text| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(text);
+}
+if (this.location) |location| {
+ try writer.writeFieldID(2);
+ try writer.writeValue(location);
+}
+try writer.endMessage();
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.handle) |handle| {
- try writer.writeFieldID(1);
- try writer.writeValue(handle);
- }
- if (this.path) |path| {
- try writer.writeFieldID(2);
- try writer.writeValue(path);
- }
- if (this.contents) |contents| {
- try writer.writeFieldID(3);
- try writer.writeArray(u8, contents);
- }
- if (this.loader) |loader| {
- try writer.writeFieldID(4);
- try writer.writeEnum(loader);
- }
- if (this.options) |options| {
- try writer.writeFieldID(5);
- try writer.writeValue(options);
- }
- try writer.endMessage();
- }
- };
+};
- pub const TransformResponseStatus = enum(u32) {
- _none,
- /// success
- success,
+pub const MessageMeta = struct {
+/// resolve
+resolve: ?[]const u8 = null,
+
+/// build
+build: ?bool = null,
+
+
+pub fn decode(reader: anytype) anyerror!MessageMeta {
+ var this = std.mem.zeroes(MessageMeta);
+
+ while(true) {
+ switch (try reader.readByte()) {
+ 0 => { return this; },
+
+ 1 => {
+ this.resolve = try reader.readValue([]const u8);
+},
+ 2 => {
+ this.build = try reader.readValue(bool);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// fail
- fail,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+if (this.resolve) |resolve| {
+ try writer.writeFieldID(1);
+ try writer.writeValue(resolve);
+}
+if (this.build) |build| {
+ try writer.writeFieldID(2);
+ try writer.writeInt(@intCast(u8, @boolToInt(build)));
+}
+try writer.endMessage();
+}
- _,
+};
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+pub const Message = struct {
+/// level
+level: MessageLevel,
- pub const OutputFile = struct {
- /// data
- data: []const u8,
+/// data
+data: MessageData,
- /// path
- path: []const u8,
+/// notes
+notes: []const MessageData,
- pub fn decode(reader: anytype) anyerror!OutputFile {
- var this = std.mem.zeroes(OutputFile);
+/// on
+on: MessageMeta,
- this.data = try reader.readArray(u8);
- this.path = try reader.readValue([]const u8);
- return this;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray(u8, this.data);
- try writer.writeValue(this.path);
- }
- };
+pub fn decode(reader: anytype) anyerror!Message {
+ var this = std.mem.zeroes(Message);
- pub const TransformResponse = struct {
- /// status
- status: TransformResponseStatus,
+ this.level = try reader.readValue(MessageLevel);
+ this.data = try reader.readValue(MessageData);
+ this.notes = try reader.readArray(MessageData);
+ this.on = try reader.readValue(MessageMeta);
+ return this;
+}
- /// files
- files: []const OutputFile,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeEnum(this.level);
+ try writer.writeValue(this.data);
+ try writer.writeArray(MessageData, this.notes);
+ try writer.writeValue(this.on);
+}
- /// errors
- errors: []const Message,
+};
- pub fn decode(reader: anytype) anyerror!TransformResponse {
- var this = std.mem.zeroes(TransformResponse);
+pub const Log = struct {
+/// warnings
+warnings: u32 = 0,
- this.status = try reader.readValue(TransformResponseStatus);
- this.files = try reader.readArray(OutputFile);
- this.errors = try reader.readArray(Message);
- return this;
- }
+/// errors
+errors: u32 = 0,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeEnum(this.status);
- try writer.writeArray(OutputFile, this.files);
- try writer.writeArray(Message, this.errors);
- }
- };
+/// msgs
+msgs: []const Message,
- pub const MessageLevel = enum(u32) {
- _none,
- /// err
- err,
- /// warn
- warn,
+pub fn decode(reader: anytype) anyerror!Log {
+ var this = std.mem.zeroes(Log);
- /// note
- note,
+ this.warnings = try reader.readValue(u32);
+ this.errors = try reader.readValue(u32);
+ this.msgs = try reader.readArray(Message);
+ return this;
+}
- /// debug
- debug,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.warnings);
+ try writer.writeInt(this.errors);
+ try writer.writeArray(Message, this.msgs);
+}
- _,
+};
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+pub const Reloader = enum(u8) {
- pub const Location = struct {
- /// file
- file: []const u8,
+_none,
+ /// disable
+ disable,
- /// namespace
- namespace: []const u8,
+ /// live
+ live,
- /// line
- line: i32 = 0,
+ /// fast_refresh
+ fast_refresh,
- /// column
- column: i32 = 0,
+_,
- /// line_text
- line_text: []const u8,
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- /// suggestion
- suggestion: []const u8,
+
+};
- /// offset
- offset: u32 = 0,
+pub const WebsocketMessageKind = enum(u8) {
- pub fn decode(reader: anytype) anyerror!Location {
- var this = std.mem.zeroes(Location);
+_none,
+ /// welcome
+ welcome,
- this.file = try reader.readValue([]const u8);
- this.namespace = try reader.readValue([]const u8);
- this.line = try reader.readValue(i32);
- this.column = try reader.readValue(i32);
- this.line_text = try reader.readValue([]const u8);
- this.suggestion = try reader.readValue([]const u8);
- this.offset = try reader.readValue(u32);
- return this;
- }
+ /// file_change_notification
+ file_change_notification,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeValue(this.file);
- try writer.writeValue(this.namespace);
- try writer.writeInt(this.line);
- try writer.writeInt(this.column);
- try writer.writeValue(this.line_text);
- try writer.writeValue(this.suggestion);
- try writer.writeInt(this.offset);
- }
- };
+ /// build_success
+ build_success,
- pub const MessageData = struct {
- /// text
- text: ?[]const u8 = null,
+ /// build_fail
+ build_fail,
- /// location
- location: ?Location = null,
+ /// manifest_success
+ manifest_success,
- pub fn decode(reader: anytype) anyerror!MessageData {
- var this = std.mem.zeroes(MessageData);
+ /// manifest_fail
+ manifest_fail,
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+_,
- 1 => {
- this.text = try reader.readValue([]const u8);
- },
- 2 => {
- this.location = try reader.readValue(Location);
- },
- else => {
- return error.InvalidMessage;
- },
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
}
- }
- unreachable;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.text) |text| {
- try writer.writeFieldID(1);
- try writer.writeValue(text);
- }
- if (this.location) |location| {
- try writer.writeFieldID(2);
- try writer.writeValue(location);
- }
- try writer.endMessage();
- }
- };
+
+};
- pub const MessageMeta = struct {
- /// resolve
- resolve: ?[]const u8 = null,
+pub const WebsocketCommandKind = enum(u8) {
- /// build
- build: ?bool = null,
+_none,
+ /// build
+ build,
- pub fn decode(reader: anytype) anyerror!MessageMeta {
- var this = std.mem.zeroes(MessageMeta);
+ /// manifest
+ manifest,
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+_,
- 1 => {
- this.resolve = try reader.readValue([]const u8);
- },
- 2 => {
- this.build = try reader.readValue(bool);
- },
- else => {
- return error.InvalidMessage;
- },
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
}
- }
- unreachable;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- if (this.resolve) |resolve| {
- try writer.writeFieldID(1);
- try writer.writeValue(resolve);
- }
- if (this.build) |build| {
- try writer.writeFieldID(2);
- try writer.writeInt(@intCast(u8, @boolToInt(build)));
- }
- try writer.endMessage();
- }
- };
+
+};
- pub const Message = struct {
- /// level
- level: MessageLevel,
+pub const WebsocketMessage = struct {
+/// timestamp
+timestamp: u32 = 0,
- /// data
- data: MessageData,
+/// kind
+kind: WebsocketMessageKind,
- /// notes
- notes: []const MessageData,
- /// on
- on: MessageMeta,
+pub fn decode(reader: anytype) anyerror!WebsocketMessage {
+ var this = std.mem.zeroes(WebsocketMessage);
- pub fn decode(reader: anytype) anyerror!Message {
- var this = std.mem.zeroes(Message);
+ this.timestamp = try reader.readValue(u32);
+ this.kind = try reader.readValue(WebsocketMessageKind);
+ return this;
+}
- this.level = try reader.readValue(MessageLevel);
- this.data = try reader.readValue(MessageData);
- this.notes = try reader.readArray(MessageData);
- this.on = try reader.readValue(MessageMeta);
- return this;
- }
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.timestamp);
+ try writer.writeEnum(this.kind);
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeEnum(this.level);
- try writer.writeValue(this.data);
- try writer.writeArray(MessageData, this.notes);
- try writer.writeValue(this.on);
- }
- };
+};
- pub const Log = struct {
- /// warnings
- warnings: u32 = 0,
+pub const WebsocketMessageWelcome = struct {
+/// epoch
+epoch: u32 = 0,
- /// errors
- errors: u32 = 0,
+/// javascriptReloader
+javascript_reloader: Reloader,
- /// msgs
- msgs: []const Message,
+/// cwd
+cwd: []const u8,
- pub fn decode(reader: anytype) anyerror!Log {
- var this = std.mem.zeroes(Log);
- this.warnings = try reader.readValue(u32);
- this.errors = try reader.readValue(u32);
- this.msgs = try reader.readArray(Message);
- return this;
- }
+pub fn decode(reader: anytype) anyerror!WebsocketMessageWelcome {
+ var this = std.mem.zeroes(WebsocketMessageWelcome);
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.warnings);
- try writer.writeInt(this.errors);
- try writer.writeArray(Message, this.msgs);
- }
- };
+ this.epoch = try reader.readValue(u32);
+ this.javascript_reloader = try reader.readValue(Reloader);
+ this.cwd = try reader.readValue([]const u8);
+ return this;
+}
- pub const Reloader = enum(u8) {
- _none,
- /// disable
- disable,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.epoch);
+ try writer.writeEnum(this.javascript_reloader);
+ try writer.writeValue(this.cwd);
+}
- /// live
- live,
+};
- /// fast_refresh
- fast_refresh,
+pub const WebsocketMessageFileChangeNotification = struct {
+/// id
+id: u32 = 0,
- _,
+/// loader
+loader: Loader,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
- pub const WebsocketMessageKind = enum(u8) {
- _none,
- /// welcome
- welcome,
+pub fn decode(reader: anytype) anyerror!WebsocketMessageFileChangeNotification {
+ var this = std.mem.zeroes(WebsocketMessageFileChangeNotification);
- /// file_change_notification
- file_change_notification,
+ this.id = try reader.readValue(u32);
+ this.loader = try reader.readValue(Loader);
+ return this;
+}
- /// build_success
- build_success,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+ try writer.writeEnum(this.loader);
+}
- /// build_fail
- build_fail,
+};
- /// manifest_success
- manifest_success,
+pub const WebsocketCommand = struct {
+/// kind
+kind: WebsocketCommandKind,
- /// manifest_fail
- manifest_fail,
+/// timestamp
+timestamp: u32 = 0,
- _,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+pub fn decode(reader: anytype) anyerror!WebsocketCommand {
+ var this = std.mem.zeroes(WebsocketCommand);
- pub const WebsocketCommandKind = enum(u8) {
- _none,
- /// build
- build,
+ this.kind = try reader.readValue(WebsocketCommandKind);
+ this.timestamp = try reader.readValue(u32);
+ return this;
+}
- /// manifest
- manifest,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeEnum(this.kind);
+ try writer.writeInt(this.timestamp);
+}
- _,
+};
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+pub const WebsocketCommandBuild = packed struct {
+/// id
+id: u32 = 0,
- pub const WebsocketMessage = struct {
- /// timestamp
- timestamp: u32 = 0,
- /// kind
- kind: WebsocketMessageKind,
+pub fn decode(reader: anytype) anyerror!WebsocketCommandBuild {
+ var this = std.mem.zeroes(WebsocketCommandBuild);
- pub fn decode(reader: anytype) anyerror!WebsocketMessage {
- var this = std.mem.zeroes(WebsocketMessage);
+ this.id = try reader.readValue(u32);
+ return this;
+}
- this.timestamp = try reader.readValue(u32);
- this.kind = try reader.readValue(WebsocketMessageKind);
- return this;
- }
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.timestamp);
- try writer.writeEnum(this.kind);
- }
- };
+};
- pub const WebsocketMessageWelcome = struct {
- /// epoch
- epoch: u32 = 0,
+pub const WebsocketCommandManifest = packed struct {
+/// id
+id: u32 = 0,
- /// javascriptReloader
- javascript_reloader: Reloader,
- /// cwd
- cwd: []const u8,
+pub fn decode(reader: anytype) anyerror!WebsocketCommandManifest {
+ var this = std.mem.zeroes(WebsocketCommandManifest);
- pub fn decode(reader: anytype) anyerror!WebsocketMessageWelcome {
- var this = std.mem.zeroes(WebsocketMessageWelcome);
+ this.id = try reader.readValue(u32);
+ return this;
+}
- this.epoch = try reader.readValue(u32);
- this.javascript_reloader = try reader.readValue(Reloader);
- this.cwd = try reader.readValue([]const u8);
- return this;
- }
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.epoch);
- try writer.writeEnum(this.javascript_reloader);
- try writer.writeValue(this.cwd);
- }
- };
+};
- pub const WebsocketMessageFileChangeNotification = struct {
- /// id
- id: u32 = 0,
+pub const WebsocketMessageBuildSuccess = struct {
+/// id
+id: u32 = 0,
- /// loader
- loader: Loader,
+/// from_timestamp
+from_timestamp: u32 = 0,
- pub fn decode(reader: anytype) anyerror!WebsocketMessageFileChangeNotification {
- var this = std.mem.zeroes(WebsocketMessageFileChangeNotification);
+/// loader
+loader: Loader,
- this.id = try reader.readValue(u32);
- this.loader = try reader.readValue(Loader);
- return this;
- }
+/// module_path
+module_path: []const u8,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.id);
- try writer.writeEnum(this.loader);
- }
- };
+/// blob_length
+blob_length: u32 = 0,
- pub const WebsocketCommand = struct {
- /// kind
- kind: WebsocketCommandKind,
- /// timestamp
- timestamp: u32 = 0,
+pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildSuccess {
+ var this = std.mem.zeroes(WebsocketMessageBuildSuccess);
- pub fn decode(reader: anytype) anyerror!WebsocketCommand {
- var this = std.mem.zeroes(WebsocketCommand);
+ this.id = try reader.readValue(u32);
+ this.from_timestamp = try reader.readValue(u32);
+ this.loader = try reader.readValue(Loader);
+ this.module_path = try reader.readValue([]const u8);
+ this.blob_length = try reader.readValue(u32);
+ return this;
+}
- this.kind = try reader.readValue(WebsocketCommandKind);
- this.timestamp = try reader.readValue(u32);
- return this;
- }
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+ try writer.writeInt(this.from_timestamp);
+ try writer.writeEnum(this.loader);
+ try writer.writeValue(this.module_path);
+ try writer.writeInt(this.blob_length);
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeEnum(this.kind);
- try writer.writeInt(this.timestamp);
- }
- };
+};
- pub const WebsocketCommandBuild = packed struct {
- /// id
- id: u32 = 0,
+pub const WebsocketMessageBuildFailure = struct {
+/// id
+id: u32 = 0,
- pub fn decode(reader: anytype) anyerror!WebsocketCommandBuild {
- var this = std.mem.zeroes(WebsocketCommandBuild);
+/// from_timestamp
+from_timestamp: u32 = 0,
- this.id = try reader.readValue(u32);
- return this;
- }
+/// loader
+loader: Loader,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.id);
- }
- };
+/// module_path
+module_path: []const u8,
- pub const WebsocketCommandManifest = packed struct {
- /// id
- id: u32 = 0,
+/// log
+log: Log,
- pub fn decode(reader: anytype) anyerror!WebsocketCommandManifest {
- var this = std.mem.zeroes(WebsocketCommandManifest);
- this.id = try reader.readValue(u32);
- return this;
- }
+pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildFailure {
+ var this = std.mem.zeroes(WebsocketMessageBuildFailure);
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.id);
- }
- };
+ this.id = try reader.readValue(u32);
+ this.from_timestamp = try reader.readValue(u32);
+ this.loader = try reader.readValue(Loader);
+ this.module_path = try reader.readValue([]const u8);
+ this.log = try reader.readValue(Log);
+ return this;
+}
- pub const WebsocketMessageBuildSuccess = struct {
- /// id
- id: u32 = 0,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+ try writer.writeInt(this.from_timestamp);
+ try writer.writeEnum(this.loader);
+ try writer.writeValue(this.module_path);
+ try writer.writeValue(this.log);
+}
- /// from_timestamp
- from_timestamp: u32 = 0,
+};
- /// loader
- loader: Loader,
+pub const DependencyManifest = struct {
+/// ids
+ids: []const u32,
- /// module_path
- module_path: []const u8,
- /// blob_length
- blob_length: u32 = 0,
+pub fn decode(reader: anytype) anyerror!DependencyManifest {
+ var this = std.mem.zeroes(DependencyManifest);
- pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildSuccess {
- var this = std.mem.zeroes(WebsocketMessageBuildSuccess);
+ this.ids = try reader.readArray(u32);
+ return this;
+}
- this.id = try reader.readValue(u32);
- this.from_timestamp = try reader.readValue(u32);
- this.loader = try reader.readValue(Loader);
- this.module_path = try reader.readValue([]const u8);
- this.blob_length = try reader.readValue(u32);
- return this;
- }
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(u32, this.ids);
+}
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.id);
- try writer.writeInt(this.from_timestamp);
- try writer.writeEnum(this.loader);
- try writer.writeValue(this.module_path);
- try writer.writeInt(this.blob_length);
- }
- };
+};
- pub const WebsocketMessageBuildFailure = struct {
- /// id
- id: u32 = 0,
+pub const FileList = struct {
+/// ptrs
+ptrs: []const StringPointer,
- /// from_timestamp
- from_timestamp: u32 = 0,
+/// files
+files: []const u8,
- /// loader
- loader: Loader,
- /// module_path
- module_path: []const u8,
+pub fn decode(reader: anytype) anyerror!FileList {
+ var this = std.mem.zeroes(FileList);
- /// log
- log: Log,
+ this.ptrs = try reader.readArray(StringPointer);
+ this.files = try reader.readValue([]const u8);
+ return this;
+}
- pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildFailure {
- var this = std.mem.zeroes(WebsocketMessageBuildFailure);
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(StringPointer, this.ptrs);
+ try writer.writeValue(this.files);
+}
- this.id = try reader.readValue(u32);
- this.from_timestamp = try reader.readValue(u32);
- this.loader = try reader.readValue(Loader);
- this.module_path = try reader.readValue([]const u8);
- this.log = try reader.readValue(Log);
- return this;
- }
+};
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.id);
- try writer.writeInt(this.from_timestamp);
- try writer.writeEnum(this.loader);
- try writer.writeValue(this.module_path);
- try writer.writeValue(this.log);
- }
- };
+pub const WebsocketMessageResolveIDs = struct {
+/// id
+id: []const u32,
- pub const DependencyManifest = struct {
- /// ids
- ids: []const u32,
+/// list
+list: FileList,
- pub fn decode(reader: anytype) anyerror!DependencyManifest {
- var this = std.mem.zeroes(DependencyManifest);
- this.ids = try reader.readArray(u32);
- return this;
- }
+pub fn decode(reader: anytype) anyerror!WebsocketMessageResolveIDs {
+ var this = std.mem.zeroes(WebsocketMessageResolveIDs);
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray(u32, this.ids);
- }
- };
+ this.id = try reader.readArray(u32);
+ this.list = try reader.readValue(FileList);
+ return this;
+}
- pub const FileList = struct {
- /// ptrs
- ptrs: []const StringPointer,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(u32, this.id);
+ try writer.writeValue(this.list);
+}
- /// files
- files: []const u8,
+};
- pub fn decode(reader: anytype) anyerror!FileList {
- var this = std.mem.zeroes(FileList);
+pub const WebsocketCommandResolveIDs = struct {
+/// ptrs
+ptrs: []const StringPointer,
- this.ptrs = try reader.readArray(StringPointer);
- this.files = try reader.readValue([]const u8);
- return this;
- }
+/// files
+files: []const u8,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray(StringPointer, this.ptrs);
- try writer.writeValue(this.files);
- }
- };
- pub const WebsocketMessageResolveIDs = struct {
- /// id
- id: []const u32,
+pub fn decode(reader: anytype) anyerror!WebsocketCommandResolveIDs {
+ var this = std.mem.zeroes(WebsocketCommandResolveIDs);
- /// list
- list: FileList,
+ this.ptrs = try reader.readArray(StringPointer);
+ this.files = try reader.readValue([]const u8);
+ return this;
+}
- pub fn decode(reader: anytype) anyerror!WebsocketMessageResolveIDs {
- var this = std.mem.zeroes(WebsocketMessageResolveIDs);
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(StringPointer, this.ptrs);
+ try writer.writeValue(this.files);
+}
- this.id = try reader.readArray(u32);
- this.list = try reader.readValue(FileList);
- return this;
- }
+};
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray(u32, this.id);
- try writer.writeValue(this.list);
- }
- };
+pub const WebsocketMessageManifestSuccess = struct {
+/// id
+id: u32 = 0,
- pub const WebsocketCommandResolveIDs = struct {
- /// ptrs
- ptrs: []const StringPointer,
+/// module_path
+module_path: []const u8,
- /// files
- files: []const u8,
+/// loader
+loader: Loader,
- pub fn decode(reader: anytype) anyerror!WebsocketCommandResolveIDs {
- var this = std.mem.zeroes(WebsocketCommandResolveIDs);
+/// manifest
+manifest: DependencyManifest,
- this.ptrs = try reader.readArray(StringPointer);
- this.files = try reader.readValue([]const u8);
- return this;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray(StringPointer, this.ptrs);
- try writer.writeValue(this.files);
- }
- };
+pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestSuccess {
+ var this = std.mem.zeroes(WebsocketMessageManifestSuccess);
- pub const WebsocketMessageManifestSuccess = struct {
- /// id
- id: u32 = 0,
+ this.id = try reader.readValue(u32);
+ this.module_path = try reader.readValue([]const u8);
+ this.loader = try reader.readValue(Loader);
+ this.manifest = try reader.readValue(DependencyManifest);
+ return this;
+}
- /// module_path
- module_path: []const u8,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+ try writer.writeValue(this.module_path);
+ try writer.writeEnum(this.loader);
+ try writer.writeValue(this.manifest);
+}
- /// loader
- loader: Loader,
+};
- /// manifest
- manifest: DependencyManifest,
+pub const WebsocketMessageManifestFailure = struct {
+/// id
+id: u32 = 0,
- pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestSuccess {
- var this = std.mem.zeroes(WebsocketMessageManifestSuccess);
+/// from_timestamp
+from_timestamp: u32 = 0,
- this.id = try reader.readValue(u32);
- this.module_path = try reader.readValue([]const u8);
- this.loader = try reader.readValue(Loader);
- this.manifest = try reader.readValue(DependencyManifest);
- return this;
- }
+/// loader
+loader: Loader,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.id);
- try writer.writeValue(this.module_path);
- try writer.writeEnum(this.loader);
- try writer.writeValue(this.manifest);
- }
- };
+/// log
+log: Log,
- pub const WebsocketMessageManifestFailure = struct {
- /// id
- id: u32 = 0,
- /// from_timestamp
- from_timestamp: u32 = 0,
+pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestFailure {
+ var this = std.mem.zeroes(WebsocketMessageManifestFailure);
- /// loader
- loader: Loader,
+ this.id = try reader.readValue(u32);
+ this.from_timestamp = try reader.readValue(u32);
+ this.loader = try reader.readValue(Loader);
+ this.log = try reader.readValue(Log);
+ return this;
+}
- /// log
- log: Log,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+ try writer.writeInt(this.from_timestamp);
+ try writer.writeEnum(this.loader);
+ try writer.writeValue(this.log);
+}
- pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestFailure {
- var this = std.mem.zeroes(WebsocketMessageManifestFailure);
+};
- this.id = try reader.readValue(u32);
- this.from_timestamp = try reader.readValue(u32);
- this.loader = try reader.readValue(Loader);
- this.log = try reader.readValue(Log);
- return this;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.id);
- try writer.writeInt(this.from_timestamp);
- try writer.writeEnum(this.loader);
- try writer.writeValue(this.log);
- }
- };
};
+
const ExamplePackedStruct = packed struct {
len: u32 = 0,
offset: u32 = 0,
diff --git a/src/bundler.zig b/src/bundler.zig
index 8409f30e9..f2487502f 100644
--- a/src/bundler.zig
+++ b/src/bundler.zig
@@ -183,6 +183,7 @@ pub const Bundler = struct {
loader.* = DotEnv.Loader.init(map, allocator);
break :brk loader;
};
+ DotEnv.instance = env_loader;
// var pool = try allocator.create(ThreadPool);
// try pool.init(ThreadPool.InitConfig{
// .allocator = allocator,
@@ -249,6 +250,8 @@ pub const Bundler = struct {
Analytics.is_ci = true;
}
}
+
+ Analytics.disabled = Analytics.disabled or this.env.map.get("HYPERFINE_RANDOMIZED_ENVIRONMENT_OFFSET") != null;
}
// This must be run after a framework is configured, if a framework is enabled
diff --git a/src/env_loader.zig b/src/env_loader.zig
index 19b135e94..3be39003b 100644
--- a/src/env_loader.zig
+++ b/src/env_loader.zig
@@ -666,6 +666,8 @@ pub const Map = struct {
}
};
+pub var instance: ?*Loader = null;
+
const expectString = std.testing.expectEqualStrings;
const expect = std.testing.expect;
test "DotEnv Loader" {