diff options
author | 2021-08-19 00:44:44 -0700 | |
---|---|---|
committer | 2021-08-19 00:44:44 -0700 | |
commit | c92c7beececaabbfd449af62511857c694ec8f87 (patch) | |
tree | b034bad73d00f2022ccbeee2d72a95f77bce3b3a /src/api/schema.zig | |
parent | 0ba399d8edc3020824338bd6ea0da758b27793e7 (diff) | |
download | bun-c92c7beececaabbfd449af62511857c694ec8f87.tar.gz bun-c92c7beececaabbfd449af62511857c694ec8f87.tar.zst bun-c92c7beececaabbfd449af62511857c694ec8f87.zip |
Log level + onimportcss
Former-commit-id: 12ba9b9bc288573e3a5099adfa14c486c4cc980c
Diffstat (limited to 'src/api/schema.zig')
-rw-r--r-- | src/api/schema.zig | 2870 |
1 files changed, 1396 insertions, 1474 deletions
diff --git a/src/api/schema.zig b/src/api/schema.zig index 69a77082a..9219bcaa7 100644 --- a/src/api/schema.zig +++ b/src/api/schema.zig @@ -1,4 +1,3 @@ - const std = @import("std"); pub const Reader = struct { @@ -282,1826 +281,1749 @@ 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, -pub const Api = struct { - -pub const Loader = enum(u8) { - -_none, - /// jsx - jsx, - - /// js - js, - - /// ts - ts, - - /// tsx - tsx, - - /// css - css, - - /// file - file, - - /// json - json, - -_, - - pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { - return try std.json.stringify(@tagName(self), opts, o); - } - - -}; - -pub const ResolveMode = enum(u8) { - -_none, - /// disable - disable, + /// tsx + tsx, - /// lazy - lazy, + /// css + css, - /// dev - dev, + /// file + file, - /// bundle - bundle, + /// json + json, -_, + _, - 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) { + pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; -_none, - /// browser - browser, + pub const ResolveMode = enum(u8) { + _none, + /// disable + disable, - /// node - node, + /// lazy + lazy, - /// bun - bun, + /// dev + dev, -_, + /// bundle + bundle, - pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { - return try std.json.stringify(@tagName(self), opts, o); - } + _, - -}; - -pub const JsxRuntime = enum(u8) { + pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; -_none, - /// automatic - automatic, + pub const Platform = enum(u8) { + _none, + /// browser + browser, - /// classic - classic, + /// node + node, -_, + /// bun + bun, - 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 jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; -/// runtime -runtime: JsxRuntime, + pub const CssInJsBehavior = enum(u8) { + _none, + /// facade + facade, -/// fragment -fragment: []const u8, + /// facade_onimportcss + facade_onimportcss, -/// development -development: bool = false, + _, -/// import_source -import_source: []const u8, + pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; -/// react_fast_refresh -react_fast_refresh: bool = false, + pub const JsxRuntime = enum(u8) { + _none, + /// automatic + automatic, + /// classic + classic, -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 jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; -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))); -} + pub const Jsx = struct { + /// factory + factory: []const u8, -}; + /// runtime + runtime: JsxRuntime, -pub const StringPointer = packed struct { -/// offset -offset: u32 = 0, + /// fragment + fragment: []const u8, -/// length -length: u32 = 0, + /// development + development: bool = false, + /// import_source + import_source: []const u8, -pub fn decode(reader: anytype) anyerror!StringPointer { - var this = std.mem.zeroes(StringPointer); + /// react_fast_refresh + react_fast_refresh: bool = false, - this.offset = try reader.readValue(u32); - this.length = try reader.readValue(u32); - return this; -} + pub fn decode(reader: anytype) anyerror!Jsx { + var this = std.mem.zeroes(Jsx); -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeInt(this.offset); - try writer.writeInt(this.length); -} + 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 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))); + } + }; -pub const JavascriptBundledModule = struct { -/// path -path: StringPointer, + pub const StringPointer = packed struct { + /// offset + offset: u32 = 0, -/// code -code: StringPointer, + /// length + length: u32 = 0, -/// package_id -package_id: u32 = 0, + pub fn decode(reader: anytype) anyerror!StringPointer { + var this = std.mem.zeroes(StringPointer); -/// id -id: u32 = 0, + this.offset = try reader.readValue(u32); + this.length = try reader.readValue(u32); + return this; + } -/// path_extname_length -path_extname_length: u8 = 0, + pub fn encode(this: *const @This(), writer: anytype) anyerror!void { + try writer.writeInt(this.offset); + try writer.writeInt(this.length); + } + }; + pub const JavascriptBundledModule = struct { + /// path + path: StringPointer, -pub fn decode(reader: anytype) anyerror!JavascriptBundledModule { - var this = std.mem.zeroes(JavascriptBundledModule); + /// code + code: StringPointer, - 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; -} + /// package_id + package_id: u32 = 0, -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); -} + /// id + id: u32 = 0, -}; + /// path_extname_length + path_extname_length: u8 = 0, -pub const JavascriptBundledPackage = struct { -/// name -name: StringPointer, + pub fn decode(reader: anytype) anyerror!JavascriptBundledModule { + var this = std.mem.zeroes(JavascriptBundledModule); -/// version -version: StringPointer, + 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; + } -/// hash -hash: u32 = 0, + 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); + } + }; -/// modules_offset -modules_offset: u32 = 0, + pub const JavascriptBundledPackage = struct { + /// name + name: StringPointer, -/// modules_length -modules_length: u32 = 0, + /// version + version: StringPointer, + /// hash + hash: u32 = 0, -pub fn decode(reader: anytype) anyerror!JavascriptBundledPackage { - var this = std.mem.zeroes(JavascriptBundledPackage); + /// modules_offset + modules_offset: u32 = 0, - 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; -} + /// modules_length + modules_length: u32 = 0, -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 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; + } -pub const JavascriptBundle = struct { -/// modules -modules: []const JavascriptBundledModule, + 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); + } + }; -/// 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, + /// manifest_string + manifest_string: []const u8, -pub fn decode(reader: anytype) anyerror!JavascriptBundle { - var this = std.mem.zeroes(JavascriptBundle); + pub fn decode(reader: anytype) anyerror!JavascriptBundle { + var this = std.mem.zeroes(JavascriptBundle); - 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; -} + 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 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 const JavascriptBundleContainer = struct { + /// bundle_format_version + bundle_format_version: ?u32 = null, -pub const JavascriptBundleContainer = struct { -/// bundle_format_version -bundle_format_version: ?u32 = null, - -/// bundle -bundle: ?JavascriptBundle = null, - -/// framework -framework: ?LoadedFramework = null, - -/// routes -routes: ?LoadedRouteConfig = 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.bundle = try reader.readValue(JavascriptBundle); -}, - 3 => { - this.framework = try reader.readValue(LoadedFramework); -}, - 4 => { - this.routes = try reader.readValue(LoadedRouteConfig); -}, - 5 => { - this.code_length = try reader.readValue(u32); -}, - else => { - return error.InvalidMessage; - }, - } - } -unreachable; -} + /// bundle + bundle: ?JavascriptBundle = 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.bundle) |bundle| { - try writer.writeFieldID(2); - try writer.writeValue(bundle); -} -if (this.framework) |framework| { - try writer.writeFieldID(3); - try writer.writeValue(framework); -} -if (this.routes) |routes| { - try writer.writeFieldID(4); - try writer.writeValue(routes); -} -if (this.code_length) |code_length| { - try writer.writeFieldID(5); - try writer.writeInt(code_length); -} -try writer.endMessage(); -} + /// framework + framework: ?LoadedFramework = null, -}; - -pub const ScanDependencyMode = enum(u8) { + /// routes + routes: ?LoadedRouteConfig = null, -_none, - /// app - app, + /// code_length + code_length: ?u32 = null, - /// all - all, + pub fn decode(reader: anytype) anyerror!JavascriptBundleContainer { + var this = std.mem.zeroes(JavascriptBundleContainer); -_, + while (true) { + switch (try reader.readByte()) { + 0 => { + return this; + }, - pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { - return try std.json.stringify(@tagName(self), opts, o); + 1 => { + this.bundle_format_version = try reader.readValue(u32); + }, + 2 => { + this.bundle = try reader.readValue(JavascriptBundle); + }, + 3 => { + this.framework = try reader.readValue(LoadedFramework); + }, + 4 => { + this.routes = try reader.readValue(LoadedRouteConfig); + }, + 5 => { + this.code_length = try reader.readValue(u32); + }, + else => { + return error.InvalidMessage; + }, } + } + 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.bundle) |bundle| { + try writer.writeFieldID(2); + try writer.writeValue(bundle); + } + if (this.framework) |framework| { + try writer.writeFieldID(3); + try writer.writeValue(framework); + } + if (this.routes) |routes| { + try writer.writeFieldID(4); + try writer.writeValue(routes); + } + if (this.code_length) |code_length| { + try writer.writeFieldID(5); + try writer.writeInt(code_length); + } + try writer.endMessage(); + } + }; -pub const ModuleImportType = enum(u8) { + pub const ScanDependencyMode = enum(u8) { + _none, + /// app + app, -_none, - /// import - import, + /// all + all, - /// require - require, + _, -_, + 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 ModuleImportType = enum(u8) { + _none, + /// import + import, - -}; + /// require + require, -pub const ModuleImportRecord = struct { -/// kind -kind: ModuleImportType, + _, -/// path -path: []const u8, + pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; -/// dynamic -dynamic: bool = false, + pub const ModuleImportRecord = struct { + /// kind + kind: ModuleImportType, + /// path + path: []const u8, -pub fn decode(reader: anytype) anyerror!ModuleImportRecord { - var this = std.mem.zeroes(ModuleImportRecord); + /// dynamic + dynamic: bool = false, - this.kind = try reader.readValue(ModuleImportType); - this.path = try reader.readValue([]const u8); - this.dynamic = try reader.readValue(bool); - return this; -} + pub fn decode(reader: anytype) anyerror!ModuleImportRecord { + var this = std.mem.zeroes(ModuleImportRecord); -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))); -} + 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 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); -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; + } - 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 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); + pub const LoaderMap = struct { + /// extensions + extensions: []const []const u8, - this.keys = try reader.readArray([]const u8); - this.values = try reader.readArray([]const u8); - return this; -} + /// loaders + loaders: []const Loader, -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!LoaderMap { + var this = std.mem.zeroes(LoaderMap); -}; + this.extensions = try reader.readArray([]const u8); + this.loaders = try reader.readArray(Loader); + 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.extensions); + try writer.writeArray(Loader, this.loaders); + } + }; -/// loaders -loaders: []const Loader, + pub const DotEnvBehavior = enum(u32) { + _none, + /// disable + disable, + /// prefix + prefix, -pub fn decode(reader: anytype) anyerror!LoaderMap { - var this = std.mem.zeroes(LoaderMap); + /// load_all + load_all, - this.extensions = try reader.readArray([]const u8); - this.loaders = try reader.readArray(Loader); - return this; -} + _, -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) { + pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; -_none, - /// disable - disable, + pub const EnvConfig = struct { + /// prefix + prefix: ?[]const u8 = null, - /// prefix - prefix, + /// defaults + defaults: ?StringMap = null, - /// load_all - load_all, + pub fn decode(reader: anytype) anyerror!EnvConfig { + var this = std.mem.zeroes(EnvConfig); -_, + while (true) { + switch (try reader.readByte()) { + 0 => { + return this; + }, - pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { - return try std.json.stringify(@tagName(self), opts, o); + 1 => { + this.prefix = try reader.readValue([]const u8); + }, + 2 => { + this.defaults = try reader.readValue(StringMap); + }, + else => { + return error.InvalidMessage; + }, } + } + unreachable; + } - -}; - -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; -} - -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, - -/// defaults -defaults: StringMap, - -/// prefix -prefix: []const u8, - - -pub fn decode(reader: anytype) anyerror!LoadedEnvConfig { - var this = std.mem.zeroes(LoadedEnvConfig); - - this.dotenv = try reader.readValue(DotEnvBehavior); - this.defaults = try reader.readValue(StringMap); - this.prefix = try reader.readValue([]const u8); - return this; -} - -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); -} - -}; - -pub const FrameworkConfig = struct { -/// package -package: ?[]const u8 = null, - -/// client -client: ?[]const u8 = null, - -/// server -server: ?[]const u8 = null, - -/// development -development: ?bool = null, - -/// client_env -client_env: ?EnvConfig = null, - -/// server_env -server_env: ?EnvConfig = 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([]const u8); -}, - 3 => { - this.server = try reader.readValue([]const u8); -}, - 4 => { - this.development = try reader.readValue(bool); -}, - 5 => { - this.client_env = try reader.readValue(EnvConfig); -}, - 6 => { - this.server_env = try reader.readValue(EnvConfig); -}, - else => { - return error.InvalidMessage; - }, - } - } -unreachable; -} - -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.development) |development| { - try writer.writeFieldID(4); - try writer.writeInt(@intCast(u8, @boolToInt(development))); -} -if (this.client_env) |client_env| { - try writer.writeFieldID(5); - try writer.writeValue(client_env); -} -if (this.server_env) |server_env| { - try writer.writeFieldID(6); - try writer.writeValue(server_env); -} -try writer.endMessage(); -} + 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 LoadedFramework = struct { -/// entry_point -entry_point: []const u8, + /// defaults + defaults: StringMap, -/// package -package: []const u8, + /// prefix + prefix: []const u8, -/// development -development: bool = false, + pub fn decode(reader: anytype) anyerror!LoadedEnvConfig { + var this = std.mem.zeroes(LoadedEnvConfig); -/// client -client: bool = false, + this.dotenv = try reader.readValue(DotEnvBehavior); + this.defaults = try reader.readValue(StringMap); + this.prefix = try reader.readValue([]const u8); + return this; + } -/// env -env: LoadedEnvConfig, + 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); + } + }; + pub const FrameworkConfig = struct { + /// package + package: ?[]const u8 = null, -pub fn decode(reader: anytype) anyerror!LoadedFramework { - var this = std.mem.zeroes(LoadedFramework); + /// client + client: ?[]const u8 = null, - this.entry_point = try reader.readValue([]const u8); - this.package = try reader.readValue([]const u8); - this.development = try reader.readValue(bool); - this.client = try reader.readValue(bool); - this.env = try reader.readValue(LoadedEnvConfig); - return this; -} + /// server + server: ?[]const u8 = null, -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeValue(this.entry_point); - try writer.writeValue(this.package); - try writer.writeInt(@intCast(u8, @boolToInt(this.development))); - try writer.writeInt(@intCast(u8, @boolToInt(this.client))); - try writer.writeValue(this.env); -} + /// development + development: ?bool = null, -}; + /// client_env + client_env: ?EnvConfig = null, -pub const LoadedRouteConfig = struct { -/// dir -dir: []const u8, + /// server_env + server_env: ?EnvConfig = null, -/// extensions -extensions: []const []const u8, + /// client_css_in_js + client_css_in_js: ?CssInJsBehavior = null, -/// static_dir -static_dir: []const u8, + pub fn decode(reader: anytype) anyerror!FrameworkConfig { + var this = std.mem.zeroes(FrameworkConfig); -/// asset_prefix -asset_prefix: []const u8, + while (true) { + switch (try reader.readByte()) { + 0 => { + return this; + }, + 1 => { + this.package = try reader.readValue([]const u8); + }, + 2 => { + this.client = try reader.readValue([]const u8); + }, + 3 => { + this.server = try reader.readValue([]const u8); + }, + 4 => { + this.development = try reader.readValue(bool); + }, + 5 => { + this.client_env = try reader.readValue(EnvConfig); + }, + 6 => { + this.server_env = try reader.readValue(EnvConfig); + }, + 7 => { + this.client_css_in_js = try reader.readValue(CssInJsBehavior); + }, + else => { + return error.InvalidMessage; + }, + } + } + unreachable; + } -pub fn decode(reader: anytype) anyerror!LoadedRouteConfig { - var this = std.mem.zeroes(LoadedRouteConfig); + 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.development) |development| { + try writer.writeFieldID(4); + try writer.writeInt(@intCast(u8, @boolToInt(development))); + } + if (this.client_env) |client_env| { + try writer.writeFieldID(5); + try writer.writeValue(client_env); + } + if (this.server_env) |server_env| { + try writer.writeFieldID(6); + try writer.writeValue(server_env); + } + if (this.client_css_in_js) |client_css_in_js| { + try writer.writeFieldID(7); + try writer.writeEnum(client_css_in_js); + } + try writer.endMessage(); + } + }; - 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 LoadedFramework = struct { + /// entry_point + entry_point: []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); -} + /// package + package: []const u8, -}; + /// development + development: bool = false, -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; -} + /// client + client: bool = false, -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(); -} + /// env + env: LoadedEnvConfig, -}; + /// client_css_in_js + client_css_in_js: CssInJsBehavior, -pub const TransformOptions = struct { -/// jsx -jsx: ?Jsx = null, + pub fn decode(reader: anytype) anyerror!LoadedFramework { + var this = std.mem.zeroes(LoadedFramework); -/// tsconfig_override -tsconfig_override: ?[]const u8 = null, - -/// resolve -resolve: ?ResolveMode = null, - -/// origin -origin: ?[]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, - - -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); -}, - else => { - return error.InvalidMessage; - }, - } - } -unreachable; -} + this.entry_point = try reader.readValue([]const u8); + this.package = try reader.readValue([]const u8); + this.development = try reader.readValue(bool); + this.client = try reader.readValue(bool); + this.env = try reader.readValue(LoadedEnvConfig); + this.client_css_in_js = try reader.readValue(CssInJsBehavior); + return this; + } -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); -} -try writer.endMessage(); -} + pub fn encode(this: *const @This(), writer: anytype) anyerror!void { + try writer.writeValue(this.entry_point); + try writer.writeValue(this.package); + try writer.writeInt(@intCast(u8, @boolToInt(this.development))); + try writer.writeInt(@intCast(u8, @boolToInt(this.client))); + try writer.writeValue(this.env); + try writer.writeEnum(this.client_css_in_js); + } + }; -}; + pub const LoadedRouteConfig = struct { + /// dir + dir: []const u8, -pub const FileHandle = struct { -/// path -path: []const u8, + /// extensions + extensions: []const []const u8, -/// size -size: u32 = 0, + /// static_dir + static_dir: []const u8, -/// fd -fd: u32 = 0, + /// asset_prefix + asset_prefix: []const u8, + pub fn decode(reader: anytype) anyerror!LoadedRouteConfig { + var this = std.mem.zeroes(LoadedRouteConfig); -pub fn decode(reader: anytype) anyerror!FileHandle { - var this = std.mem.zeroes(FileHandle); + 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; + } - 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.dir); + try writer.writeArray([]const u8, this.extensions); + try writer.writeValue(this.static_dir); + try writer.writeValue(this.asset_prefix); + } + }; -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 RouteConfig = struct { + /// dir + dir: []const []const u8, -}; + /// extensions + extensions: []const []const u8, -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; -} + /// static_dir + static_dir: ?[]const u8 = null, -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(); -} + /// asset_prefix + asset_prefix: ?[]const u8 = null, -}; + pub fn decode(reader: anytype) anyerror!RouteConfig { + var this = std.mem.zeroes(RouteConfig); -pub const TransformResponseStatus = enum(u32) { + while (true) { + switch (try reader.readByte()) { + 0 => { + return this; + }, -_none, - /// success - success, + 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; + } - /// fail - fail, + 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 const TransformOptions = struct { + /// jsx + jsx: ?Jsx = null, - pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { - return try std.json.stringify(@tagName(self), opts, o); - } + /// tsconfig_override + tsconfig_override: ?[]const u8 = null, - -}; + /// resolve + resolve: ?ResolveMode = null, -pub const OutputFile = struct { -/// data -data: []const u8, + /// origin + origin: ?[]const u8 = null, -/// path -path: []const u8, + /// absolute_working_dir + absolute_working_dir: ?[]const u8 = null, + /// define + define: ?StringMap = null, -pub fn decode(reader: anytype) anyerror!OutputFile { - var this = std.mem.zeroes(OutputFile); + /// preserve_symlinks + preserve_symlinks: ?bool = null, - this.data = try reader.readArray(u8); - this.path = try reader.readValue([]const u8); - return this; -} + /// entry_points + entry_points: []const []const u8, -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeArray(u8, this.data); - try writer.writeValue(this.path); -} + /// write + write: ?bool = null, -}; + /// inject + inject: []const []const u8, -pub const TransformResponse = struct { -/// status -status: TransformResponseStatus, + /// output_dir + output_dir: ?[]const u8 = null, -/// files -files: []const OutputFile, + /// external + external: []const []const u8, -/// errors -errors: []const Message, + /// loaders + loaders: ?LoaderMap = null, + /// main_fields + main_fields: []const []const u8, -pub fn decode(reader: anytype) anyerror!TransformResponse { - var this = std.mem.zeroes(TransformResponse); + /// platform + platform: ?Platform = null, - this.status = try reader.readValue(TransformResponseStatus); - this.files = try reader.readArray(OutputFile); - this.errors = try reader.readArray(Message); - return this; -} + /// serve + serve: ?bool = 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); -} + /// extension_order + extension_order: []const []const u8, -}; + /// generate_node_module_bundle + generate_node_module_bundle: ?bool = null, -pub const MessageKind = enum(u32) { + /// node_modules_bundle_path + node_modules_bundle_path: ?[]const u8 = null, -_none, - /// err - err, + /// node_modules_bundle_path_server + node_modules_bundle_path_server: ?[]const u8 = null, - /// warn - warn, + /// framework + framework: ?FrameworkConfig = null, - /// note - note, + /// router + router: ?RouteConfig = null, - /// debug - debug, + pub fn decode(reader: anytype) anyerror!TransformOptions { + var this = std.mem.zeroes(TransformOptions); -_, + while (true) { + switch (try reader.readByte()) { + 0 => { + return this; + }, - pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { - return try std.json.stringify(@tagName(self), opts, o); + 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); + }, + else => { + return error.InvalidMessage; + }, } + } + unreachable; + } - -}; - -pub const Location = struct { -/// file -file: []const u8, - -/// namespace -namespace: []const u8, + 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); + } + try writer.endMessage(); + } + }; -/// line -line: i32 = 0, + pub const FileHandle = struct { + /// path + path: []const u8, -/// column -column: i32 = 0, + /// size + size: u32 = 0, -/// line_text -line_text: []const u8, + /// fd + fd: u32 = 0, -/// suggestion -suggestion: []const u8, + pub fn decode(reader: anytype) anyerror!FileHandle { + var this = std.mem.zeroes(FileHandle); -/// offset -offset: u32 = 0, + 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 fn decode(reader: anytype) anyerror!Location { - var this = std.mem.zeroes(Location); + pub const Transform = struct { + /// handle + handle: ?FileHandle = 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; -} + /// path + path: ?[]const u8 = 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); -} + /// contents + contents: []const u8, -}; + /// loader + loader: ?Loader = null, -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; -} + /// options + options: ?TransformOptions = null, -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 decode(reader: anytype) anyerror!Transform { + var this = std.mem.zeroes(Transform); -}; + while (true) { + switch (try reader.readByte()) { + 0 => { + return this; + }, -pub const Message = struct { -/// kind -kind: MessageKind, + 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; + } -/// data -data: MessageData, + 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(); + } + }; -/// notes -notes: []const MessageData, + pub const TransformResponseStatus = enum(u32) { + _none, + /// success + success, + /// fail + fail, -pub fn decode(reader: anytype) anyerror!Message { - var this = std.mem.zeroes(Message); + _, - this.kind = try reader.readValue(MessageKind); - this.data = try reader.readValue(MessageData); - this.notes = try reader.readArray(MessageData); - return this; -} + pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeEnum(this.kind); - try writer.writeValue(this.data); - try writer.writeArray(MessageData, this.notes); -} + pub const OutputFile = struct { + /// data + data: []const u8, -}; + /// path + path: []const u8, -pub const Log = struct { -/// warnings -warnings: u32 = 0, + pub fn decode(reader: anytype) anyerror!OutputFile { + var this = std.mem.zeroes(OutputFile); -/// errors -errors: u32 = 0, + this.data = try reader.readArray(u8); + this.path = try reader.readValue([]const u8); + return this; + } -/// msgs -msgs: []const Message, + pub fn encode(this: *const @This(), writer: anytype) anyerror!void { + try writer.writeArray(u8, this.data); + try writer.writeValue(this.path); + } + }; + pub const TransformResponse = struct { + /// status + status: TransformResponseStatus, -pub fn decode(reader: anytype) anyerror!Log { - var this = std.mem.zeroes(Log); + /// files + files: []const OutputFile, - this.warnings = try reader.readValue(u32); - this.errors = try reader.readValue(u32); - this.msgs = try reader.readArray(Message); - return this; -} + /// errors + errors: []const Message, -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 decode(reader: anytype) anyerror!TransformResponse { + var this = std.mem.zeroes(TransformResponse); -}; + this.status = try reader.readValue(TransformResponseStatus); + this.files = try reader.readArray(OutputFile); + this.errors = try reader.readArray(Message); + return this; + } -pub const Reloader = enum(u8) { + 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); + } + }; -_none, - /// disable - disable, + pub const MessageKind = enum(u32) { + _none, + /// err + err, - /// live - live, + /// warn + warn, - /// fast_refresh - fast_refresh, + /// note + note, -_, + /// debug + debug, - 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 WebsocketMessageKind = enum(u8) { + pub const Location = struct { + /// file + file: []const u8, -_none, - /// welcome - welcome, + /// namespace + namespace: []const u8, - /// file_change_notification - file_change_notification, + /// line + line: i32 = 0, - /// build_success - build_success, + /// column + column: i32 = 0, - /// build_fail - build_fail, + /// line_text + line_text: []const u8, - /// manifest_success - manifest_success, + /// suggestion + suggestion: []const u8, - /// manifest_fail - manifest_fail, + /// offset + offset: u32 = 0, -_, + pub fn decode(reader: anytype) anyerror!Location { + var this = std.mem.zeroes(Location); - pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { - return try std.json.stringify(@tagName(self), opts, o); - } + 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; + } - -}; + 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 const WebsocketCommandKind = enum(u8) { + pub const MessageData = struct { + /// text + text: ?[]const u8 = null, -_none, - /// build - build, + /// location + location: ?Location = null, - /// manifest - manifest, + pub fn decode(reader: anytype) anyerror!MessageData { + var this = std.mem.zeroes(MessageData); -_, + while (true) { + switch (try reader.readByte()) { + 0 => { + return this; + }, - pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { - return try std.json.stringify(@tagName(self), opts, o); + 1 => { + this.text = try reader.readValue([]const u8); + }, + 2 => { + this.location = try reader.readValue(Location); + }, + 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 const WebsocketMessage = struct { -/// timestamp -timestamp: u32 = 0, + pub const Message = struct { + /// kind + kind: MessageKind, -/// kind -kind: WebsocketMessageKind, + /// data + data: MessageData, + /// notes + notes: []const MessageData, -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; -} - -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeInt(this.timestamp); - try writer.writeEnum(this.kind); -} + this.kind = try reader.readValue(MessageKind); + this.data = try reader.readValue(MessageData); + this.notes = try reader.readArray(MessageData); + return this; + } -}; + pub fn encode(this: *const @This(), writer: anytype) anyerror!void { + try writer.writeEnum(this.kind); + try writer.writeValue(this.data); + try writer.writeArray(MessageData, this.notes); + } + }; -pub const WebsocketMessageWelcome = struct { -/// epoch -epoch: u32 = 0, + pub const Log = struct { + /// warnings + warnings: u32 = 0, -/// javascriptReloader -javascript_reloader: Reloader, + /// errors + errors: u32 = 0, + /// msgs + msgs: []const Message, -pub fn decode(reader: anytype) anyerror!WebsocketMessageWelcome { - var this = std.mem.zeroes(WebsocketMessageWelcome); + pub fn decode(reader: anytype) anyerror!Log { + var this = std.mem.zeroes(Log); - this.epoch = try reader.readValue(u32); - this.javascript_reloader = try reader.readValue(Reloader); - return this; -} + this.warnings = try reader.readValue(u32); + this.errors = try reader.readValue(u32); + this.msgs = try reader.readArray(Message); + return this; + } -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeInt(this.epoch); - try writer.writeEnum(this.javascript_reloader); -} + 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 const Reloader = enum(u8) { + _none, + /// disable + disable, -pub const WebsocketMessageFileChangeNotification = struct { -/// id -id: u32 = 0, + /// live + live, -/// loader -loader: Loader, + /// fast_refresh + fast_refresh, + _, -pub fn decode(reader: anytype) anyerror!WebsocketMessageFileChangeNotification { - var this = std.mem.zeroes(WebsocketMessageFileChangeNotification); + pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; - this.id = try reader.readValue(u32); - this.loader = try reader.readValue(Loader); - return this; -} + pub const WebsocketMessageKind = enum(u8) { + _none, + /// welcome + welcome, -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeInt(this.id); - try writer.writeEnum(this.loader); -} + /// file_change_notification + file_change_notification, -}; + /// build_success + build_success, -pub const WebsocketCommand = struct { -/// kind -kind: WebsocketCommandKind, + /// build_fail + build_fail, -/// timestamp -timestamp: u32 = 0, + /// manifest_success + manifest_success, + /// manifest_fail + manifest_fail, -pub fn decode(reader: anytype) anyerror!WebsocketCommand { - var this = std.mem.zeroes(WebsocketCommand); + _, - this.kind = try reader.readValue(WebsocketCommandKind); - this.timestamp = try reader.readValue(u32); - return this; -} + pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void { + return try std.json.stringify(@tagName(self), opts, o); + } + }; -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeEnum(this.kind); - try writer.writeInt(this.timestamp); -} + pub const WebsocketCommandKind = enum(u8) { + _none, + /// build + build, -}; + /// manifest + manifest, -pub const WebsocketCommandBuild = packed struct { -/// id -id: 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!WebsocketCommandBuild { - var this = std.mem.zeroes(WebsocketCommandBuild); + pub const WebsocketMessage = struct { + /// timestamp + timestamp: u32 = 0, - this.id = try reader.readValue(u32); - return this; -} + /// kind + kind: WebsocketMessageKind, -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeInt(this.id); -} + pub fn decode(reader: anytype) anyerror!WebsocketMessage { + var this = std.mem.zeroes(WebsocketMessage); -}; + this.timestamp = try reader.readValue(u32); + this.kind = try reader.readValue(WebsocketMessageKind); + return this; + } -pub const WebsocketCommandManifest = packed struct { -/// id -id: u32 = 0, + 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 fn decode(reader: anytype) anyerror!WebsocketCommandManifest { - var this = std.mem.zeroes(WebsocketCommandManifest); + /// javascriptReloader + javascript_reloader: Reloader, - this.id = try reader.readValue(u32); - 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.id); -} + this.epoch = try reader.readValue(u32); + this.javascript_reloader = try reader.readValue(Reloader); + return this; + } -}; + pub fn encode(this: *const @This(), writer: anytype) anyerror!void { + try writer.writeInt(this.epoch); + try writer.writeEnum(this.javascript_reloader); + } + }; -pub const WebsocketMessageBuildSuccess = struct { -/// id -id: u32 = 0, + pub const WebsocketMessageFileChangeNotification = struct { + /// id + id: u32 = 0, -/// from_timestamp -from_timestamp: u32 = 0, + /// loader + loader: Loader, -/// loader -loader: Loader, + pub fn decode(reader: anytype) anyerror!WebsocketMessageFileChangeNotification { + var this = std.mem.zeroes(WebsocketMessageFileChangeNotification); -/// module_path -module_path: []const u8, + this.id = try reader.readValue(u32); + this.loader = try reader.readValue(Loader); + return this; + } -/// blob_length -blob_length: u32 = 0, + pub fn encode(this: *const @This(), writer: anytype) anyerror!void { + try writer.writeInt(this.id); + try writer.writeEnum(this.loader); + } + }; + pub const WebsocketCommand = struct { + /// kind + kind: WebsocketCommandKind, -pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildSuccess { - var this = std.mem.zeroes(WebsocketMessageBuildSuccess); + /// timestamp + timestamp: u32 = 0, - 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 decode(reader: anytype) anyerror!WebsocketCommand { + var this = std.mem.zeroes(WebsocketCommand); -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); -} + 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.writeEnum(this.kind); + try writer.writeInt(this.timestamp); + } + }; -pub const WebsocketMessageBuildFailure = struct { -/// id -id: u32 = 0, + pub const WebsocketCommandBuild = packed struct { + /// id + id: u32 = 0, -/// from_timestamp -from_timestamp: u32 = 0, + pub fn decode(reader: anytype) anyerror!WebsocketCommandBuild { + var this = std.mem.zeroes(WebsocketCommandBuild); -/// loader -loader: Loader, + this.id = try reader.readValue(u32); + return this; + } -/// module_path -module_path: []const u8, + pub fn encode(this: *const @This(), writer: anytype) anyerror!void { + try writer.writeInt(this.id); + } + }; -/// log -log: Log, + pub const WebsocketCommandManifest = packed struct { + /// id + id: u32 = 0, + pub fn decode(reader: anytype) anyerror!WebsocketCommandManifest { + var this = std.mem.zeroes(WebsocketCommandManifest); -pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildFailure { - var this = std.mem.zeroes(WebsocketMessageBuildFailure); + this.id = try reader.readValue(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.log = try reader.readValue(Log); - 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.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 WebsocketMessageBuildSuccess = struct { + /// id + id: u32 = 0, -}; + /// from_timestamp + from_timestamp: u32 = 0, -pub const DependencyManifest = struct { -/// ids -ids: []const u32, + /// loader + loader: Loader, + /// module_path + module_path: []const u8, -pub fn decode(reader: anytype) anyerror!DependencyManifest { - var this = std.mem.zeroes(DependencyManifest); + /// blob_length + blob_length: u32 = 0, - this.ids = try reader.readArray(u32); - return this; -} + pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildSuccess { + var this = std.mem.zeroes(WebsocketMessageBuildSuccess); -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeArray(u32, this.ids); -} + 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.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 FileList = struct { -/// ptrs -ptrs: []const StringPointer, + pub const WebsocketMessageBuildFailure = struct { + /// id + id: u32 = 0, -/// files -files: []const u8, + /// from_timestamp + from_timestamp: u32 = 0, + /// loader + loader: Loader, -pub fn decode(reader: anytype) anyerror!FileList { - var this = std.mem.zeroes(FileList); + /// module_path + module_path: []const u8, - this.ptrs = try reader.readArray(StringPointer); - this.files = try reader.readValue([]const u8); - return this; -} + /// log + log: Log, -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!WebsocketMessageBuildFailure { + var this = std.mem.zeroes(WebsocketMessageBuildFailure); -}; + 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 WebsocketMessageResolveIDs = struct { -/// id -id: []const u32, + 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); + } + }; -/// list -list: FileList, + pub const DependencyManifest = struct { + /// ids + ids: []const u32, + pub fn decode(reader: anytype) anyerror!DependencyManifest { + var this = std.mem.zeroes(DependencyManifest); -pub fn decode(reader: anytype) anyerror!WebsocketMessageResolveIDs { - var this = std.mem.zeroes(WebsocketMessageResolveIDs); + this.ids = try reader.readArray(u32); + return this; + } - 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.ids); + } + }; -pub fn encode(this: *const @This(), writer: anytype) anyerror!void { - try writer.writeArray(u32, this.id); - try writer.writeValue(this.list); -} + pub const FileList = struct { + /// ptrs + ptrs: []const StringPointer, -}; + /// files + files: []const u8, -pub const WebsocketCommandResolveIDs = struct { -/// ptrs -ptrs: []const StringPointer, + pub fn decode(reader: anytype) anyerror!FileList { + var this = std.mem.zeroes(FileList); -/// files -files: []const u8, + 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!WebsocketCommandResolveIDs { - var this = std.mem.zeroes(WebsocketCommandResolveIDs); + pub const WebsocketMessageResolveIDs = struct { + /// id + id: []const u32, - this.ptrs = try reader.readArray(StringPointer); - this.files = try reader.readValue([]const u8); - return this; -} + /// list + list: FileList, -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!WebsocketMessageResolveIDs { + var this = std.mem.zeroes(WebsocketMessageResolveIDs); -}; + this.id = try reader.readArray(u32); + this.list = try reader.readValue(FileList); + return this; + } -pub const WebsocketMessageManifestSuccess = struct { -/// id -id: u32 = 0, + pub fn encode(this: *const @This(), writer: anytype) anyerror!void { + try writer.writeArray(u32, this.id); + try writer.writeValue(this.list); + } + }; -/// module_path -module_path: []const u8, + pub const WebsocketCommandResolveIDs = struct { + /// ptrs + ptrs: []const StringPointer, -/// loader -loader: Loader, + /// files + files: []const u8, -/// manifest -manifest: DependencyManifest, + pub fn decode(reader: anytype) anyerror!WebsocketCommandResolveIDs { + var this = std.mem.zeroes(WebsocketCommandResolveIDs); + this.ptrs = try reader.readArray(StringPointer); + this.files = try reader.readValue([]const u8); + return this; + } -pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestSuccess { - var this = std.mem.zeroes(WebsocketMessageManifestSuccess); + 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.module_path = try reader.readValue([]const u8); - this.loader = try reader.readValue(Loader); - this.manifest = try reader.readValue(DependencyManifest); - return this; -} + pub const WebsocketMessageManifestSuccess = struct { + /// id + id: u32 = 0, -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); -} + /// module_path + module_path: []const u8, -}; + /// loader + loader: Loader, -pub const WebsocketMessageManifestFailure = struct { -/// id -id: u32 = 0, + /// manifest + manifest: DependencyManifest, -/// from_timestamp -from_timestamp: u32 = 0, + pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestSuccess { + var this = std.mem.zeroes(WebsocketMessageManifestSuccess); -/// loader -loader: Loader, + 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; + } -/// log -log: Log, + 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); + } + }; + pub const WebsocketMessageManifestFailure = struct { + /// id + id: u32 = 0, -pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestFailure { - var this = std.mem.zeroes(WebsocketMessageManifestFailure); + /// from_timestamp + from_timestamp: u32 = 0, - 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; -} + /// loader + loader: Loader, -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); -} + /// log + log: 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, |