Support live-reload and fallback

Former-commit-id: c3f9d77391
This commit is contained in:
Jarred Sumner
2021-06-20 18:15:13 -07:00
parent 6fbfd69699
commit d09194f05a
18 changed files with 1524 additions and 996 deletions

View File

@@ -36,6 +36,11 @@ pub const NodeModuleBundle = struct {
pub const magic_bytes = "#!/usr/bin/env speedy\n\n";
threadlocal var jsbundle_prefix: [magic_bytes.len + 5]u8 = undefined;
// TODO: support preact-refresh, others by not hard coding
pub fn hasFastRefresh(this: *const NodeModuleBundle) bool {
return this.package_name_map.contains("react-refresh");
}
pub fn loadPackageMap(this: *NodeModuleBundle) !void {
this.package_name_map = PackageNameMap.init(this.allocator);
var ids = PackageIDMap.init(this.allocator);