| ... | ... | @@ -219,22 +219,29 @@ pub fn generateZirData(self: *Autodoc) !void { |
| 219 | 219 | (d.handle.openDir(self.doc_location.basename, .{}) catch unreachable) |
| 220 | 220 | else |
| 221 | 221 | (self.module.zig_cache_artifact_directory.handle.openDir(self.doc_location.basename, .{}) catch unreachable); |
| 222 | | const data_js_f = output_dir.createFile("data.js", .{}) catch unreachable; |
| 223 | | defer data_js_f.close(); |
| 224 | | const out = data_js_f.writer(); |
| 225 | | out.print( |
| 226 | | \\ /** @type {{DocData}} */ |
| 227 | | \\ var zigAnalysis= |
| 228 | | , .{}) catch unreachable; |
| 229 | | std.json.stringify( |
| 230 | | data, |
| 231 | | .{ |
| 232 | | .whitespace = .{}, |
| 233 | | .emit_null_optional_fields = false, |
| 234 | | }, |
| 235 | | out, |
| 236 | | ) catch unreachable; |
| 237 | | out.print(";", .{}) catch unreachable; |
| 222 | { |
| 223 | const data_js_f = output_dir.createFile("data.js", .{}) catch unreachable; |
| 224 | defer data_js_f.close(); |
| 225 | var buffer = std.io.bufferedWriter(data_js_f.writer()); |
| 226 | |
| 227 | const out = buffer.writer(); |
| 228 | out.print( |
| 229 | \\ /** @type {{DocData}} */ |
| 230 | \\ var zigAnalysis= |
| 231 | , .{}) catch unreachable; |
| 232 | std.json.stringify( |
| 233 | data, |
| 234 | .{ |
| 235 | .whitespace = .{}, |
| 236 | .emit_null_optional_fields = false, |
| 237 | }, |
| 238 | out, |
| 239 | ) catch unreachable; |
| 240 | out.print(";", .{}) catch unreachable; |
| 241 | |
| 242 | // last thing (that can fail) that we do is flush |
| 243 | buffer.flush() catch unreachable; |
| 244 | } |
| 238 | 245 | // copy main.js, index.html |
| 239 | 246 | const docs = try self.module.comp.zig_lib_directory.join(self.arena, &.{ "docs", std.fs.path.sep_str }); |
| 240 | 247 | var docs_dir = std.fs.openDirAbsolute(docs, .{}) catch unreachable; |