aboutsummaryrefslogtreecommitdiff
path: root/src/api
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-08-23 02:30:30 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-08-23 02:30:30 -0700
commitafb6684782ffb35f6c750a57426c79ac762acc7b (patch)
tree0789404c9356eba255600797e7cbd5f906521a48 /src/api
parent8c6700792666b1d7a128095cd5cff392df68375c (diff)
downloadbun-afb6684782ffb35f6c750a57426c79ac762acc7b.tar.gz
bun-afb6684782ffb35f6c750a57426c79ac762acc7b.tar.zst
bun-afb6684782ffb35f6c750a57426c79ac762acc7b.zip
Fix resolve bug with mixed-case node_modules
Former-commit-id: 5bdae0ee491e28b49ceed6136f04e0c1feddc808
Diffstat (limited to 'src/api')
-rw-r--r--src/api/demo/pages/index.tsx2
-rw-r--r--src/api/schema.d.ts1
-rw-r--r--src/api/schema.js10
-rw-r--r--src/api/schema.peechy3
-rw-r--r--src/api/schema.zig2913
5 files changed, 1531 insertions, 1398 deletions
diff --git a/src/api/demo/pages/index.tsx b/src/api/demo/pages/index.tsx
index 4d60b4084..6f09d0d52 100644
--- a/src/api/demo/pages/index.tsx
+++ b/src/api/demo/pages/index.tsx
@@ -1,6 +1,6 @@
import Head from "next/head";
import Image from "next/image";
-import styles from "../styles/Home.module.css";
+// import styles from "../styles/Home.module.css";
import "../lib/api.ts";
export default function Home() {
diff --git a/src/api/schema.d.ts b/src/api/schema.d.ts
index 666a0cbce..07f865983 100644
--- a/src/api/schema.d.ts
+++ b/src/api/schema.d.ts
@@ -326,6 +326,7 @@ type uint32 = number;
node_modules_bundle_path_server?: string;
framework?: FrameworkConfig;
router?: RouteConfig;
+ no_summary?: boolean;
}
export interface FileHandle {
diff --git a/src/api/schema.js b/src/api/schema.js
index 07f643a62..bc4430489 100644
--- a/src/api/schema.js
+++ b/src/api/schema.js
@@ -1071,6 +1071,10 @@ function decodeTransformOptions(bb) {
result["router"] = decodeRouteConfig(bb);
break;
+ case 23:
+ result["no_summary"] = !!bb.readByte();
+ break;
+
default:
throw new Error("Attempted to parse invalid message");
}
@@ -1239,6 +1243,12 @@ bb.writeByte(encoded);
bb.writeByte(22);
encodeRouteConfig(value, bb);
}
+
+ var value = message["no_summary"];
+ if (value != null) {
+ bb.writeByte(23);
+ bb.writeByte(value);
+ }
bb.writeByte(0);
}
diff --git a/src/api/schema.peechy b/src/api/schema.peechy
index 63c8501b2..0e0680b8d 100644
--- a/src/api/schema.peechy
+++ b/src/api/schema.peechy
@@ -36,7 +36,7 @@ smol JSXRuntime {
struct JSX {
string factory;
JSXRuntime runtime;
- string fragment;\
+ string fragment;
bool development;
// Probably react
@@ -229,6 +229,7 @@ message TransformOptions {
FrameworkConfig framework = 21;
RouteConfig router = 22;
+ bool no_summary = 23;
}
struct FileHandle {
diff --git a/src/api/schema.zig b/src/api/schema.zig
index 9219bcaa7..a01ba641a 100644
--- a/src/api/schema.zig
+++ b/src/api/schema.zig
@@ -1,3 +1,4 @@
+
const std = @import("std");
pub const Reader = struct {
@@ -281,1749 +282,1869 @@ 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 ResolveMode = enum(u8) {
- _none,
- /// disable
- disable,
+ /// css
+ css,
- /// lazy
- lazy,
+ /// file
+ file,
- /// dev
- dev,
+ /// json
+ json,
- /// bundle
- bundle,
+_,
- _,
+ 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,
+pub const ResolveMode = enum(u8) {
- /// node
- node,
+_none,
+ /// disable
+ disable,
- /// bun
- bun,
+ /// lazy
+ lazy,
- _,
+ /// dev
+ dev,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+ /// bundle
+ bundle,
- pub const CssInJsBehavior = enum(u8) {
- _none,
- /// facade
- facade,
+_,
- /// facade_onimportcss
- facade_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) {
- pub const JsxRuntime = enum(u8) {
- _none,
- /// automatic
- automatic,
+_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,
+
+};
- /// fragment
- fragment: []const u8,
+pub const CssInJsBehavior = enum(u8) {
- /// development
- development: bool = false,
+_none,
+ /// facade
+ facade,
- /// import_source
- import_source: []const u8,
+ /// facade_onimportcss
+ facade_onimportcss,
- /// react_fast_refresh
- react_fast_refresh: bool = false,
+_,
- pub fn decode(reader: anytype) anyerror!Jsx {
- var this = std.mem.zeroes(Jsx);
+ pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- 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 JsxRuntime = enum(u8) {
- pub const StringPointer = packed struct {
- /// offset
- offset: u32 = 0,
+_none,
+ /// automatic
+ automatic,
- /// length
- length: u32 = 0,
+ /// classic
+ classic,
- pub fn decode(reader: anytype) anyerror!StringPointer {
- var this = std.mem.zeroes(StringPointer);
+_,
- this.offset = try reader.readValue(u32);
- this.length = 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.writeInt(this.offset);
- try writer.writeInt(this.length);
- }
- };
+
+};
- pub const JavascriptBundledModule = struct {
- /// path
- path: StringPointer,
+pub const Jsx = struct {
+/// factory
+factory: []const u8,
- /// code
- code: StringPointer,
+/// runtime
+runtime: JsxRuntime,
- /// package_id
- package_id: u32 = 0,
+/// fragment
+fragment: []const u8,
- /// id
- id: u32 = 0,
+/// development
+development: bool = false,
- /// path_extname_length
- path_extname_length: u8 = 0,
+/// import_source
+import_source: []const u8,
- pub fn decode(reader: anytype) anyerror!JavascriptBundledModule {
- var this = std.mem.zeroes(JavascriptBundledModule);
+/// react_fast_refresh
+react_fast_refresh: bool = false,
- 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 fn decode(reader: anytype) anyerror!Jsx {
+ var this = std.mem.zeroes(Jsx);
- pub const JavascriptBundledPackage = struct {
- /// name
- name: StringPointer,
+ 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;
+}
- /// version
- version: 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)));
+}
- /// hash
- hash: u32 = 0,
+};
- /// modules_offset
- modules_offset: u32 = 0,
+pub const StringPointer = packed struct {
+/// offset
+offset: u32 = 0,
- /// modules_length
- modules_length: u32 = 0,
+/// length
+length: u32 = 0,
- 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 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.name);
- try writer.writeValue(this.version);
- try writer.writeInt(this.hash);
- try writer.writeInt(this.modules_offset);
- try writer.writeInt(this.modules_length);
- }
- };
+ this.offset = try reader.readValue(u32);
+ this.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.writeInt(this.offset);
+ try writer.writeInt(this.length);
+}
- /// packages
- packages: []const JavascriptBundledPackage,
+};
- /// etag
- etag: []const u8,
+pub const JavascriptBundledModule = struct {
+/// path
+path: StringPointer,
- /// generated_at
- generated_at: u32 = 0,
+/// code
+code: StringPointer,
- /// app_package_json_dependencies_hash
- app_package_json_dependencies_hash: []const u8,
+/// package_id
+package_id: u32 = 0,
- /// import_from_name
- import_from_name: []const u8,
+/// id
+id: u32 = 0,
- /// manifest_string
- manifest_string: []const u8,
+/// path_extname_length
+path_extname_length: u8 = 0,
- 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;
- }
+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.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);
- }
- };
+ 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 const JavascriptBundleContainer = struct {
- /// bundle_format_version
- bundle_format_version: ?u32 = null,
+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);
+}
- /// bundle
- bundle: ?JavascriptBundle = null,
+};
- /// framework
- framework: ?LoadedFramework = null,
+pub const JavascriptBundledPackage = struct {
+/// name
+name: StringPointer,
- /// routes
- routes: ?LoadedRouteConfig = null,
+/// version
+version: StringPointer,
- /// code_length
- code_length: ?u32 = null,
+/// hash
+hash: u32 = 0,
- pub fn decode(reader: anytype) anyerror!JavascriptBundleContainer {
- var this = std.mem.zeroes(JavascriptBundleContainer);
+/// modules_offset
+modules_offset: u32 = 0,
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+/// modules_length
+modules_length: u32 = 0,
- 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 fn decode(reader: anytype) anyerror!JavascriptBundledPackage {
+ var this = std.mem.zeroes(JavascriptBundledPackage);
- pub const ScanDependencyMode = enum(u8) {
- _none,
- /// app
- app,
+ 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;
+}
- /// all
- all,
+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 jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+pub const JavascriptBundle = struct {
+/// modules
+modules: []const JavascriptBundledModule,
- pub const ModuleImportType = enum(u8) {
- _none,
- /// import
- import,
+/// packages
+packages: []const JavascriptBundledPackage,
- /// require
- require,
+/// etag
+etag: []const u8,
- _,
+/// generated_at
+generated_at: u32 = 0,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+/// app_package_json_dependencies_hash
+app_package_json_dependencies_hash: []const u8,
- pub const ModuleImportRecord = struct {
- /// kind
- kind: ModuleImportType,
+/// import_from_name
+import_from_name: []const u8,
- /// path
- path: []const u8,
+/// manifest_string
+manifest_string: []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!JavascriptBundle {
+ var this = std.mem.zeroes(JavascriptBundle);
- this.kind = try reader.readValue(ModuleImportType);
- this.path = try reader.readValue([]const u8);
- this.dynamic = try reader.readValue(bool);
- 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.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.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 Module = struct {
- /// path
- path: []const u8,
+};
- /// imports
- imports: []const ModuleImportRecord,
+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;
+}
- pub fn decode(reader: anytype) anyerror!Module {
- var this = std.mem.zeroes(Module);
+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();
+}
- 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 ScanDependencyMode = enum(u8) {
- pub const StringMap = struct {
- /// keys
- keys: []const []const u8,
+_none,
+ /// app
+ app,
- /// values
- values: []const []const u8,
+ /// all
+ all,
- 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 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.writeArray([]const u8, this.keys);
- try writer.writeArray([]const u8, this.values);
- }
- };
+
+};
- pub const LoaderMap = struct {
- /// extensions
- extensions: []const []const u8,
+pub const ModuleImportType = enum(u8) {
- /// loaders
- loaders: []const Loader,
+_none,
+ /// import
+ import,
- pub fn decode(reader: anytype) anyerror!LoaderMap {
- var this = std.mem.zeroes(LoaderMap);
+ /// require
+ require,
- 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 fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
+ return try std.json.stringify(@tagName(self), opts, o);
+ }
- pub const DotEnvBehavior = enum(u32) {
- _none,
- /// disable
- disable,
+
+};
- /// prefix
- prefix,
+pub const ModuleImportRecord = struct {
+/// kind
+kind: ModuleImportType,
- /// load_all
- load_all,
+/// path
+path: []const u8,
- _,
+/// dynamic
+dynamic: bool = false,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
- pub const EnvConfig = struct {
- /// prefix
- prefix: ?[]const u8 = null,
+pub fn decode(reader: anytype) anyerror!ModuleImportRecord {
+ var this = std.mem.zeroes(ModuleImportRecord);
- /// defaults
- defaults: ?StringMap = null,
+ 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!EnvConfig {
- var this = std.mem.zeroes(EnvConfig);
+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)));
+}
- 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 const Module = struct {
+/// path
+path: []const u8,
- 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();
- }
- };
+/// imports
+imports: []const ModuleImportRecord,
- pub const LoadedEnvConfig = struct {
- /// dotenv
- dotenv: DotEnvBehavior,
- /// defaults
- defaults: StringMap,
+pub fn decode(reader: anytype) anyerror!Module {
+ var this = std.mem.zeroes(Module);
- /// prefix
- prefix: []const u8,
+ this.path = try reader.readValue([]const u8);
+ this.imports = try reader.readArray(ModuleImportRecord);
+ return this;
+}
- pub fn decode(reader: anytype) anyerror!LoadedEnvConfig {
- var this = std.mem.zeroes(LoadedEnvConfig);
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeValue(this.path);
+ try writer.writeArray(ModuleImportRecord, this.imports);
+}
- 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 StringMap = struct {
+/// keys
+keys: []const []const u8,
- pub const FrameworkConfig = struct {
- /// package
- package: ?[]const u8 = null,
+/// values
+values: []const []const u8,
- /// client
- client: ?[]const u8 = null,
- /// server
- server: ?[]const u8 = null,
+pub fn decode(reader: anytype) anyerror!StringMap {
+ var this = std.mem.zeroes(StringMap);
- /// development
- development: ?bool = null,
+ this.keys = try reader.readArray([]const u8);
+ this.values = try reader.readArray([]const u8);
+ return this;
+}
- /// client_env
- client_env: ?EnvConfig = null,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray([]const u8, this.keys);
+ try writer.writeArray([]const u8, this.values);
+}
- /// server_env
- server_env: ?EnvConfig = null,
+};
- /// client_css_in_js
- client_css_in_js: ?CssInJsBehavior = null,
+pub const LoaderMap = struct {
+/// extensions
+extensions: []const []const u8,
- pub fn decode(reader: anytype) anyerror!FrameworkConfig {
- var this = std.mem.zeroes(FrameworkConfig);
+/// loaders
+loaders: []const Loader,
- 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;
- },
+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 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,
+
+ /// prefix
+ prefix,
+
+ /// load_all
+ load_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.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();
- }
- };
+
+};
- pub const LoadedFramework = struct {
- /// entry_point
- entry_point: []const u8,
+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;
+}
- /// package
- package: []const u8,
+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();
+}
- /// development
- development: bool = false,
+};
- /// client
- client: bool = false,
+pub const LoadedEnvConfig = struct {
+/// dotenv
+dotenv: DotEnvBehavior,
- /// env
- env: LoadedEnvConfig,
+/// defaults
+defaults: StringMap,
- /// client_css_in_js
- client_css_in_js: CssInJsBehavior,
+/// prefix
+prefix: []const u8,
- pub fn decode(reader: anytype) anyerror!LoadedFramework {
- var this = std.mem.zeroes(LoadedFramework);
- 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 decode(reader: anytype) anyerror!LoadedEnvConfig {
+ var this = std.mem.zeroes(LoadedEnvConfig);
- 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);
- }
- };
+ this.dotenv = try reader.readValue(DotEnvBehavior);
+ this.defaults = try reader.readValue(StringMap);
+ this.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.writeEnum(this.dotenv);
+ try writer.writeValue(this.defaults);
+ try writer.writeValue(this.prefix);
+}
- /// extensions
- extensions: []const []const u8,
+};
- /// static_dir
- static_dir: []const u8,
+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,
+
+/// client_css_in_js
+client_css_in_js: ?CssInJsBehavior = 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);
+},
+ 7 => {
+ this.client_css_in_js = try reader.readValue(CssInJsBehavior);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// asset_prefix
- asset_prefix: []const u8,
+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();
+}
- 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 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,
- pub const RouteConfig = struct {
- /// dir
- dir: []const []const u8,
+/// development
+development: bool = false,
- /// extensions
- extensions: []const []const u8,
+/// client
+client: bool = false,
- /// static_dir
- static_dir: ?[]const u8 = null,
+/// env
+env: LoadedEnvConfig,
- /// asset_prefix
- asset_prefix: ?[]const u8 = null,
+/// client_css_in_js
+client_css_in_js: CssInJsBehavior,
- pub fn decode(reader: anytype) anyerror!RouteConfig {
- var this = std.mem.zeroes(RouteConfig);
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+pub fn decode(reader: anytype) anyerror!LoadedFramework {
+ var this = std.mem.zeroes(LoadedFramework);
- 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;
- }
+ 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.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 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 TransformOptions = struct {
- /// jsx
- jsx: ?Jsx = null,
+};
- /// tsconfig_override
- tsconfig_override: ?[]const u8 = null,
+pub const LoadedRouteConfig = struct {
+/// dir
+dir: []const u8,
- /// resolve
- resolve: ?ResolveMode = null,
+/// extensions
+extensions: []const []const u8,
- /// origin
- origin: ?[]const u8 = null,
+/// static_dir
+static_dir: []const u8,
- /// absolute_working_dir
- absolute_working_dir: ?[]const u8 = null,
+/// asset_prefix
+asset_prefix: []const u8,
- /// define
- define: ?StringMap = null,
- /// preserve_symlinks
- preserve_symlinks: ?bool = null,
+pub fn decode(reader: anytype) anyerror!LoadedRouteConfig {
+ var this = std.mem.zeroes(LoadedRouteConfig);
- /// entry_points
- entry_points: []const []const u8,
+ 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;
+}
- /// write
- write: ?bool = 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);
+}
- /// inject
- inject: []const []const u8,
+};
- /// output_dir
- output_dir: ?[]const u8 = null,
+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;
+}
- /// external
- external: []const []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();
+}
- /// loaders
- loaders: ?LoaderMap = null,
+};
- /// main_fields
- main_fields: []const []const u8,
+pub const TransformOptions = struct {
+/// jsx
+jsx: ?Jsx = null,
- /// platform
- platform: ?Platform = null,
+/// tsconfig_override
+tsconfig_override: ?[]const u8 = null,
- /// serve
- serve: ?bool = null,
+/// resolve
+resolve: ?ResolveMode = null,
- /// extension_order
- extension_order: []const []const u8,
+/// 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,
+
+/// no_summary
+no_summary: ?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);
+},
+ else => {
+ return error.InvalidMessage;
+ },
+ }
+ }
+unreachable;
+}
- /// generate_node_module_bundle
- generate_node_module_bundle: ?bool = 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)));
+}
+try writer.endMessage();
+}
- /// node_modules_bundle_path
- node_modules_bundle_path: ?[]const u8 = null,
+};
- /// node_modules_bundle_path_server
- node_modules_bundle_path_server: ?[]const u8 = null,
+pub const FileHandle = struct {
+/// path
+path: []const u8,
- /// framework
- framework: ?FrameworkConfig = null,
+/// size
+size: u32 = 0,
- /// router
- router: ?RouteConfig = null,
+/// fd
+fd: u32 = 0,
- pub fn decode(reader: anytype) anyerror!TransformOptions {
- var this = std.mem.zeroes(TransformOptions);
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+pub fn decode(reader: anytype) anyerror!FileHandle {
+ var this = std.mem.zeroes(FileHandle);
- 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;
- },
+ 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 TransformResponseStatus = enum(u32) {
+
+_none,
+ /// success
+ success,
+
+ /// fail
+ fail,
+
+_,
+
+ 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);
- }
- try writer.endMessage();
- }
- };
+
+};
- pub const FileHandle = struct {
- /// path
- path: []const u8,
+pub const OutputFile = struct {
+/// data
+data: []const u8,
- /// size
- size: u32 = 0,
+/// path
+path: []const u8,
- /// fd
- fd: u32 = 0,
- pub fn decode(reader: anytype) anyerror!FileHandle {
- var this = std.mem.zeroes(FileHandle);
+pub fn decode(reader: anytype) anyerror!OutputFile {
+ var this = std.mem.zeroes(OutputFile);
- this.path = try reader.readValue([]const u8);
- this.size = try reader.readValue(u32);
- this.fd = try reader.readValue(u32);
- return this;
- }
+ 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.writeValue(this.path);
- try writer.writeInt(this.size);
- try writer.writeInt(this.fd);
- }
- };
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(u8, this.data);
+ try writer.writeValue(this.path);
+}
+
+};
- pub const Transform = struct {
- /// handle
- handle: ?FileHandle = null,
+pub const TransformResponse = struct {
+/// status
+status: TransformResponseStatus,
- /// path
- path: ?[]const u8 = null,
+/// files
+files: []const OutputFile,
- /// contents
- contents: []const u8,
+/// errors
+errors: []const Message,
- /// loader
- loader: ?Loader = null,
- /// options
- options: ?TransformOptions = null,
+pub fn decode(reader: anytype) anyerror!TransformResponse {
+ var this = std.mem.zeroes(TransformResponse);
- pub fn decode(reader: anytype) anyerror!Transform {
- var this = std.mem.zeroes(Transform);
+ this.status = try reader.readValue(TransformResponseStatus);
+ this.files = try reader.readArray(OutputFile);
+ this.errors = try reader.readArray(Message);
+ return this;
+}
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+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);
+}
- 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;
- },
+};
+
+pub const MessageKind = enum(u32) {
+
+_none,
+ /// err
+ err,
+
+ /// warn
+ warn,
+
+ /// note
+ note,
+
+ /// 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.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 Location = struct {
+/// file
+file: []const u8,
- /// fail
- fail,
+/// namespace
+namespace: []const u8,
- _,
+/// line
+line: i32 = 0,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+/// column
+column: i32 = 0,
- pub const OutputFile = struct {
- /// data
- data: []const u8,
+/// line_text
+line_text: []const u8,
- /// path
- path: []const u8,
+/// suggestion
+suggestion: []const u8,
- pub fn decode(reader: anytype) anyerror!OutputFile {
- var this = std.mem.zeroes(OutputFile);
+/// offset
+offset: u32 = 0,
- 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!Location {
+ var this = std.mem.zeroes(Location);
- pub const TransformResponse = struct {
- /// status
- status: TransformResponseStatus,
+ 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;
+}
- /// files
- files: []const OutputFile,
+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);
+}
- /// errors
- errors: []const Message,
+};
- pub fn decode(reader: anytype) anyerror!TransformResponse {
- var this = std.mem.zeroes(TransformResponse);
+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;
+}
- this.status = try reader.readValue(TransformResponseStatus);
- this.files = try reader.readArray(OutputFile);
- this.errors = try reader.readArray(Message);
- return this;
- }
+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 {
- try writer.writeEnum(this.status);
- try writer.writeArray(OutputFile, this.files);
- try writer.writeArray(Message, this.errors);
- }
- };
+};
- pub const MessageKind = enum(u32) {
- _none,
- /// err
- err,
+pub const Message = struct {
+/// kind
+kind: MessageKind,
- /// warn
- warn,
+/// data
+data: MessageData,
- /// note
- note,
+/// notes
+notes: []const MessageData,
- /// debug
- debug,
- _,
+pub fn decode(reader: anytype) anyerror!Message {
+ var this = std.mem.zeroes(Message);
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+ this.kind = try reader.readValue(MessageKind);
+ this.data = try reader.readValue(MessageData);
+ this.notes = try reader.readArray(MessageData);
+ return this;
+}
- pub const Location = struct {
- /// file
- file: []const u8,
+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);
+}
- /// namespace
- namespace: []const u8,
+};
- /// line
- line: i32 = 0,
+pub const Log = struct {
+/// warnings
+warnings: u32 = 0,
- /// column
- column: i32 = 0,
+/// errors
+errors: u32 = 0,
- /// line_text
- line_text: []const u8,
+/// msgs
+msgs: []const Message,
- /// suggestion
- suggestion: []const u8,
- /// offset
- offset: u32 = 0,
+pub fn decode(reader: anytype) anyerror!Log {
+ var this = std.mem.zeroes(Log);
- pub fn decode(reader: anytype) anyerror!Location {
- var this = std.mem.zeroes(Location);
+ this.warnings = try reader.readValue(u32);
+ this.errors = try reader.readValue(u32);
+ this.msgs = try reader.readArray(Message);
+ return this;
+}
- 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.writeInt(this.warnings);
+ try writer.writeInt(this.errors);
+ try writer.writeArray(Message, this.msgs);
+}
- 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 MessageData = struct {
- /// text
- text: ?[]const u8 = null,
+pub const Reloader = enum(u8) {
- /// location
- location: ?Location = null,
+_none,
+ /// disable
+ disable,
- pub fn decode(reader: anytype) anyerror!MessageData {
- var this = std.mem.zeroes(MessageData);
+ /// live
+ live,
- while (true) {
- switch (try reader.readByte()) {
- 0 => {
- return this;
- },
+ /// fast_refresh
+ fast_refresh,
- 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 Message = struct {
- /// kind
- kind: MessageKind,
+pub const WebsocketMessageKind = enum(u8) {
- /// data
- data: MessageData,
+_none,
+ /// welcome
+ welcome,
- /// notes
- notes: []const MessageData,
+ /// file_change_notification
+ file_change_notification,
- pub fn decode(reader: anytype) anyerror!Message {
- var this = std.mem.zeroes(Message);
+ /// build_success
+ build_success,
- this.kind = try reader.readValue(MessageKind);
- this.data = try reader.readValue(MessageData);
- this.notes = try reader.readArray(MessageData);
- return this;
- }
+ /// build_fail
+ build_fail,
- 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);
- }
- };
+ /// manifest_success
+ manifest_success,
- pub const Log = struct {
- /// warnings
- warnings: u32 = 0,
+ /// manifest_fail
+ manifest_fail,
- /// errors
- errors: u32 = 0,
+_,
- /// msgs
- msgs: []const Message,
+ 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!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 const WebsocketCommandKind = enum(u8) {
- 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);
- }
- };
+_none,
+ /// build
+ build,
- pub const Reloader = enum(u8) {
- _none,
- /// disable
- disable,
+ /// manifest
+ manifest,
- /// live
- live,
+_,
- /// fast_refresh
- fast_refresh,
+ 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 WebsocketMessage = struct {
+/// timestamp
+timestamp: u32 = 0,
- pub const WebsocketMessageKind = enum(u8) {
- _none,
- /// welcome
- welcome,
+/// kind
+kind: WebsocketMessageKind,
- /// file_change_notification
- file_change_notification,
- /// build_success
- build_success,
+pub fn decode(reader: anytype) anyerror!WebsocketMessage {
+ var this = std.mem.zeroes(WebsocketMessage);
- /// build_fail
- build_fail,
+ this.timestamp = try reader.readValue(u32);
+ this.kind = try reader.readValue(WebsocketMessageKind);
+ return this;
+}
- /// manifest_success
- manifest_success,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.timestamp);
+ try writer.writeEnum(this.kind);
+}
- /// manifest_fail
- manifest_fail,
+};
- _,
+pub const WebsocketMessageWelcome = struct {
+/// epoch
+epoch: u32 = 0,
- pub fn jsonStringify(self: *const @This(), opts: anytype, o: anytype) !void {
- return try std.json.stringify(@tagName(self), opts, o);
- }
- };
+/// javascriptReloader
+javascript_reloader: Reloader,
- pub const WebsocketCommandKind = enum(u8) {
- _none,
- /// build
- build,
- /// manifest
- manifest,
+pub fn decode(reader: anytype) anyerror!WebsocketMessageWelcome {
+ var this = std.mem.zeroes(WebsocketMessageWelcome);
- _,
+ this.epoch = try reader.readValue(u32);
+ this.javascript_reloader = try reader.readValue(Reloader);
+ 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.writeInt(this.epoch);
+ try writer.writeEnum(this.javascript_reloader);
+}
- pub const WebsocketMessage = struct {
- /// timestamp
- timestamp: u32 = 0,
+};
- /// kind
- kind: WebsocketMessageKind,
+pub const WebsocketMessageFileChangeNotification = struct {
+/// id
+id: u32 = 0,
- pub fn decode(reader: anytype) anyerror!WebsocketMessage {
- var this = std.mem.zeroes(WebsocketMessage);
+/// loader
+loader: Loader,
- 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);
- }
- };
+pub fn decode(reader: anytype) anyerror!WebsocketMessageFileChangeNotification {
+ var this = std.mem.zeroes(WebsocketMessageFileChangeNotification);
- pub const WebsocketMessageWelcome = struct {
- /// epoch
- epoch: u32 = 0,
+ this.id = try reader.readValue(u32);
+ this.loader = try reader.readValue(Loader);
+ return this;
+}
- /// javascriptReloader
- javascript_reloader: Reloader,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+ try writer.writeEnum(this.loader);
+}
- pub fn decode(reader: anytype) anyerror!WebsocketMessageWelcome {
- var this = std.mem.zeroes(WebsocketMessageWelcome);
+};
- this.epoch = try reader.readValue(u32);
- this.javascript_reloader = try reader.readValue(Reloader);
- return this;
- }
+pub const WebsocketCommand = struct {
+/// kind
+kind: WebsocketCommandKind,
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.epoch);
- try writer.writeEnum(this.javascript_reloader);
- }
- };
+/// timestamp
+timestamp: u32 = 0,
- pub const WebsocketMessageFileChangeNotification = struct {
- /// id
- id: u32 = 0,
- /// loader
- loader: Loader,
+pub fn decode(reader: anytype) anyerror!WebsocketCommand {
+ var this = std.mem.zeroes(WebsocketCommand);
- pub fn decode(reader: anytype) anyerror!WebsocketMessageFileChangeNotification {
- var this = std.mem.zeroes(WebsocketMessageFileChangeNotification);
+ this.kind = try reader.readValue(WebsocketCommandKind);
+ this.timestamp = try reader.readValue(u32);
+ return this;
+}
- this.id = try reader.readValue(u32);
- this.loader = try reader.readValue(Loader);
- return this;
- }
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeEnum(this.kind);
+ try writer.writeInt(this.timestamp);
+}
- 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 const WebsocketCommandBuild = packed struct {
+/// id
+id: u32 = 0,
- /// timestamp
- timestamp: u32 = 0,
- pub fn decode(reader: anytype) anyerror!WebsocketCommand {
- var this = std.mem.zeroes(WebsocketCommand);
+pub fn decode(reader: anytype) anyerror!WebsocketCommandBuild {
+ var this = std.mem.zeroes(WebsocketCommandBuild);
- this.kind = try reader.readValue(WebsocketCommandKind);
- this.timestamp = try reader.readValue(u32);
- return this;
- }
+ this.id = 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 fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+}
- pub const WebsocketCommandBuild = packed struct {
- /// id
- id: u32 = 0,
+};
- pub fn decode(reader: anytype) anyerror!WebsocketCommandBuild {
- var this = std.mem.zeroes(WebsocketCommandBuild);
+pub const WebsocketCommandManifest = packed struct {
+/// id
+id: u32 = 0,
- this.id = try reader.readValue(u32);
- return this;
- }
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.id);
- }
- };
+pub fn decode(reader: anytype) anyerror!WebsocketCommandManifest {
+ var this = std.mem.zeroes(WebsocketCommandManifest);
- pub const WebsocketCommandManifest = packed struct {
- /// id
- id: u32 = 0,
+ this.id = try reader.readValue(u32);
+ return this;
+}
- pub fn decode(reader: anytype) anyerror!WebsocketCommandManifest {
- var this = std.mem.zeroes(WebsocketCommandManifest);
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeInt(this.id);
+}
- this.id = try reader.readValue(u32);
- return this;
- }
+};
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeInt(this.id);
- }
- };
+pub const WebsocketMessageBuildSuccess = struct {
+/// id
+id: u32 = 0,
- pub const WebsocketMessageBuildSuccess = struct {
- /// id
- id: u32 = 0,
+/// from_timestamp
+from_timestamp: u32 = 0,
- /// from_timestamp
- from_timestamp: u32 = 0,
+/// loader
+loader: Loader,
- /// loader
- loader: Loader,
+/// module_path
+module_path: []const u8,
- /// module_path
- module_path: []const u8,
+/// blob_length
+blob_length: u32 = 0,
- /// blob_length
- blob_length: u32 = 0,
- pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildSuccess {
- var this = std.mem.zeroes(WebsocketMessageBuildSuccess);
+pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildSuccess {
+ var this = std.mem.zeroes(WebsocketMessageBuildSuccess);
- 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.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 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,
+};
- /// from_timestamp
- from_timestamp: u32 = 0,
+pub const WebsocketMessageBuildFailure = struct {
+/// id
+id: u32 = 0,
- /// loader
- loader: Loader,
+/// from_timestamp
+from_timestamp: u32 = 0,
- /// module_path
- module_path: []const u8,
+/// loader
+loader: Loader,
- /// log
- log: Log,
+/// module_path
+module_path: []const u8,
- pub fn decode(reader: anytype) anyerror!WebsocketMessageBuildFailure {
- var this = std.mem.zeroes(WebsocketMessageBuildFailure);
+/// log
+log: Log,
- 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 fn decode(reader: anytype) anyerror!WebsocketMessageBuildFailure {
+ var this = std.mem.zeroes(WebsocketMessageBuildFailure);
- pub const DependencyManifest = struct {
- /// ids
- ids: []const u32,
+ 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 decode(reader: anytype) anyerror!DependencyManifest {
- var this = std.mem.zeroes(DependencyManifest);
+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);
+}
- this.ids = try reader.readArray(u32);
- return this;
- }
+};
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray(u32, this.ids);
- }
- };
+pub const DependencyManifest = struct {
+/// ids
+ids: []const u32,
- pub const FileList = struct {
- /// ptrs
- ptrs: []const StringPointer,
- /// files
- files: []const u8,
+pub fn decode(reader: anytype) anyerror!DependencyManifest {
+ var this = std.mem.zeroes(DependencyManifest);
- pub fn decode(reader: anytype) anyerror!FileList {
- var this = std.mem.zeroes(FileList);
+ this.ids = try reader.readArray(u32);
+ return this;
+}
- 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(u32, this.ids);
+}
- 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 const FileList = struct {
+/// ptrs
+ptrs: []const StringPointer,
- /// list
- list: FileList,
+/// files
+files: []const u8,
- 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 fn decode(reader: anytype) anyerror!FileList {
+ var this = std.mem.zeroes(FileList);
- pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
- try writer.writeArray(u32, this.id);
- try writer.writeValue(this.list);
- }
- };
+ this.ptrs = try reader.readArray(StringPointer);
+ this.files = try reader.readValue([]const u8);
+ return this;
+}
- pub const WebsocketCommandResolveIDs = struct {
- /// ptrs
- ptrs: []const StringPointer,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(StringPointer, this.ptrs);
+ try writer.writeValue(this.files);
+}
- /// files
- files: []const u8,
+};
- 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 const WebsocketMessageManifestSuccess = struct {
- /// id
- id: u32 = 0,
+pub fn decode(reader: anytype) anyerror!WebsocketMessageResolveIDs {
+ var this = std.mem.zeroes(WebsocketMessageResolveIDs);
- /// module_path
- module_path: []const u8,
+ this.id = try reader.readArray(u32);
+ this.list = try reader.readValue(FileList);
+ return this;
+}
- /// loader
- loader: Loader,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(u32, this.id);
+ try writer.writeValue(this.list);
+}
- /// manifest
- manifest: DependencyManifest,
+};
- pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestSuccess {
- var this = std.mem.zeroes(WebsocketMessageManifestSuccess);
+pub const WebsocketCommandResolveIDs = struct {
+/// ptrs
+ptrs: []const StringPointer,
- 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;
- }
+/// files
+files: []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);
- }
- };
- pub const WebsocketMessageManifestFailure = struct {
- /// id
- id: u32 = 0,
+pub fn decode(reader: anytype) anyerror!WebsocketCommandResolveIDs {
+ var this = std.mem.zeroes(WebsocketCommandResolveIDs);
- /// from_timestamp
- from_timestamp: u32 = 0,
+ this.ptrs = try reader.readArray(StringPointer);
+ this.files = try reader.readValue([]const u8);
+ return this;
+}
- /// loader
- loader: Loader,
+pub fn encode(this: *const @This(), writer: anytype) anyerror!void {
+ try writer.writeArray(StringPointer, this.ptrs);
+ try writer.writeValue(this.files);
+}
- /// log
- log: Log,
+};
- pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestFailure {
- var this = std.mem.zeroes(WebsocketMessageManifestFailure);
+pub const WebsocketMessageManifestSuccess = struct {
+/// id
+id: 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;
- }
+/// module_path
+module_path: []const u8,
+
+/// loader
+loader: Loader,
+
+/// manifest
+manifest: DependencyManifest,
+
+
+pub fn decode(reader: anytype) anyerror!WebsocketMessageManifestSuccess {
+ var this = std.mem.zeroes(WebsocketMessageManifestSuccess);
+
+ 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 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,
+
+/// from_timestamp
+from_timestamp: u32 = 0,
+
+/// loader
+loader: Loader,
+
+/// 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);
+}
- 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,