Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
11f1984
feat(md): add Zig markdown parser with .md loader and Bun.Markdown API
Jarred-Sumner Jan 25, 2026
437cd0c
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 25, 2026
f52dab0
feat(md): split parser, add renderer abstraction, and Bun.Markdown.re…
Jarred-Sumner Jan 25, 2026
d08bb33
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 25, 2026
41020e9
feat(md): implement GFM disallowed raw HTML tag filter
Jarred-Sumner Jan 25, 2026
598c141
Merge branch 'main' into jarred/mdx
Jarred-Sumner Jan 25, 2026
8af45e1
refactor(md): rename API to Bun.markdown.html/render, add custom rend…
Jarred-Sumner Jan 25, 2026
343a83e
fix(md): GFM compatibility fixes, ban-words compliance, and type safety
Jarred-Sumner Jan 26, 2026
1d5d72f
feat(md): add TypeScript types and documentation for Bun.markdown API
Jarred-Sumner Jan 26, 2026
71819e2
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 26, 2026
96e8d07
refactor(md): idiomatic Zig cleanup and deduplication
Jarred-Sumner Jan 26, 2026
531dbef
Fix
Jarred-Sumner Jan 26, 2026
b0518cf
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 26, 2026
9b4e95d
feat(md): add heading_ids and autolink_headings renderer options
Jarred-Sumner Jan 26, 2026
47487bb
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 26, 2026
9500d75
feat(md): use camelCase for JavaScript API options
Jarred-Sumner Jan 26, 2026
4f9a815
fix(md): use bun.StringHashMapUnmanaged instead of std
Jarred-Sumner Jan 26, 2026
b2d4b76
fix(md): address code review feedback
Jarred-Sumner Jan 26, 2026
9d6f52e
docs(md): update options to camelCase and add headingIds/autolinkHead…
Jarred-Sumner Jan 26, 2026
aec9a1f
refactor(md): deduplicate entity/slug code between renderers
Jarred-Sumner Jan 26, 2026
bdd71d2
fix(md): assorted cleanups across renderer and types
Jarred-Sumner Jan 26, 2026
20f6901
fix(md): propagate errors through VTable and add stack overflow checks
Jarred-Sumner Jan 26, 2026
ae1a940
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 26, 2026
ebc2eb0
feat(md): add Bun.markdown.react() and Bun.markdown.render() APIs
Jarred-Sumner Jan 26, 2026
fe3e542
docs(md): update TypeScript types for render/react APIs
Jarred-Sumner Jan 26, 2026
c90018b
feat(md): react() returns a Fragment element, update types and docs
Jarred-Sumner Jan 26, 2026
76fabbc
feat(md): restore callback-based render(), default reactVersion to 19
Jarred-Sumner Jan 26, 2026
cfeb087
feat(md): add specific typed props for render callbacks and fuzzer tests
Jarred-Sumner Jan 26, 2026
fb7b08f
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 26, 2026
1c58726
refactor(md): split tests, bitset fast-path, HeadingIdTracker, metada…
Jarred-Sumner Jan 26, 2026
4725921
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 26, 2026
08dc571
fix(md): slug_counts memory safety, forward RenderOptions, move imports
Jarred-Sumner Jan 26, 2026
403be5f
Update WebKit (#26449)
dylan-conway Jan 26, 2026
3d1bec0
fix(napi): fix use-after-free in property names and external buffer l…
dylan-conway Jan 26, 2026
3dec010
fix(build-jsc): enable REMOTE_INSPECTOR for macOS release builds (#26…
sosukesuzuki Jan 26, 2026
244f447
fix(lint): remove unused variables in readline and ConsoleObject (#26…
sosukesuzuki Jan 26, 2026
2738c5b
docs(test): update static-initializers.test.ts comments to reflect mi…
robobun Jan 26, 2026
354aecf
Fix hash map use-after-free in macro (#26451)
kirillmarkelov Jan 26, 2026
03e3228
test: add JSC JIT stress tests from WebKit (#26380)
sosukesuzuki Jan 26, 2026
a3ffcd8
Add benchmark for `[...set]` (#26452)
sosukesuzuki Jan 26, 2026
26b5cae
feat: add native JSON5 parser (Bun.JSON5) (#26439)
dylan-conway Jan 26, 2026
5ca44d7
fix(http2): prevent extra empty DATA frame on write()+end() pattern (…
robobun Jan 26, 2026
6ae0390
feat(md): rename to unstable_markdown, restructure API args
Jarred-Sumner Jan 26, 2026
678281e
docs(md): add unstable API note, remove individual autolink/heading o…
Jarred-Sumner Jan 26, 2026
c8b67b5
merge: resolve conflicts with main (md loader entries)
Jarred-Sumner Jan 27, 2026
899d3d5
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 27, 2026
0578daf
rename Bun.unstable_markdown to Bun.markdown
dylan-conway Jan 29, 2026
d5cb86f
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 29, 2026
87ac50b
use arena
dylan-conway Jan 29, 2026
82cf6b3
add Parser.Error
dylan-conway Jan 29, 2026
36c428d
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 29, 2026
e2efc47
JSX.Element
dylan-conway Jan 29, 2026
e3810b3
Merge branch 'main' into jarred/mdx
dylan-conway Jan 29, 2026
ae37f72
Merge branch 'main' into jarred/mdx
dylan-conway Jan 29, 2026
c001356
introduce a jsx.d.ts which reaches for React's types when available, …
alii Jan 29, 2026
7bd8073
bump .stdDir() ban limit to 42
dylan-conway Jan 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions cmake/Sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
},
{
"output": "JavaScriptSources.txt",
"paths": [
"src/js/**/*.{js,ts}",
"src/install/PackageManager/scanner-entry.ts"
]
"paths": ["src/js/**/*.{js,ts}", "src/install/PackageManager/scanner-entry.ts"]
},
{
"output": "JavaScriptCodegenSources.txt",
Expand Down
1 change: 1 addition & 0 deletions src/api/schema.zig
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ pub const api = struct {
sqlite_embedded = 17,
html = 18,
yaml = 19,
md = 20,
_,
Comment on lines 345 to 348

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify loader enum values and C/C++ mapping consistency
rg -n "BunLoaderType|Loader.*enum|json5|md" -g '!**/third_party/**' | head -100

Repository: oven-sh/bun

Length of output: 11038


🏁 Script executed:

#!/bin/bash
# Search for Loader enum in schema.zig
echo "=== Loader enum in schema.zig ==="
rg -A 30 "pub const Loader.*enum" src/api/schema.zig

echo -e "\n=== C/C++ BunLoaderType ==="
find . -name "headers-handwritten.h" -o -name "*loader*.h" | head -20

echo -e "\n=== Search for BunLoaderType definition ==="
rg "BunLoaderType|enum.*Loader" -g "*.h" -g "*.hpp" 2>/dev/null | head -50

Repository: oven-sh/bun

Length of output: 2404


🏁 Script executed:

#!/bin/bash
# Get all BunLoaderType definitions from headers
echo "=== All BunLoaderType constants in headers-handwritten.h ==="
rg "const BunLoaderType.*=" src/bun.js/bindings/headers-handwritten.h -o | sort

echo -e "\n=== Check for json5 definition ==="
rg "json5|JSON5" src/bun.js/bindings/headers-handwritten.h

echo -e "\n=== Full loader section from headers ==="
rg -B 2 -A 25 "BunLoaderTypeNone" src/bun.js/bindings/headers-handwritten.h | head -60

Repository: oven-sh/bun

Length of output: 1783


🏁 Script executed:

#!/bin/bash
# Check for loader string mappings
echo "=== Search for loader string mappings ==="
rg -i "loaderToString|loader.*string|getLoaderName" -g "*.h" -g "*.cpp" -g "*.ts" -g "*.zig" 2>/dev/null | head -40

echo -e "\n=== Check what's between NAPI(11) and YAML(19) in C headers ==="
rg "BunLoaderType.*=" src/bun.js/bindings/headers-handwritten.h | grep -E "(12|13|14|15|16|17|18)"

echo -e "\n=== Check full zig enum for context on base64, dataurl, text, bunsh, sqlite ==="
sed -n '340,365p' src/api/schema.zig

Repository: oven-sh/bun

Length of output: 50367


🏁 Script executed:

#!/bin/bash
# Get complete loader section from headers
sed -n '/Must be kept in sync with bun.schema.api.Loader/,/pragma mark - Stream/p' src/bun.js/bindings/headers-handwritten.h

Repository: oven-sh/bun

Length of output: 773


Add missing loader type constants to C/C++ bindings and resolve numeric conflicts.

The Zig Loader enum and C/C++ BunLoaderType definitions are out of sync despite the explicit requirement in headers-handwritten.h. The C/C++ headers are missing constants for values 12–18 (base64, dataurl, text, bunsh, sqlite, sqlite_embedded, html), json5 is completely absent, and md has conflicting values (21 in Zig vs. 20 in C/C++). Add all missing BunLoaderType constants and ensure numeric values align precisely with the Zig enum.

🤖 Prompt for AI Agents
In `@src/api/schema.zig` around lines 345 - 348, The C/C++ binding enum
BunLoaderType in headers-handwritten.h is missing several members and has
numeric mismatches with the Zig Loader enum in src/api/schema.zig; add constants
for base64, dataurl, text, bunsh, sqlite, sqlite_embedded, html, and json5 with
the exact integer values that match the Zig Loader sequence (fill in values
12–18 for the missing ones and add json5 at its correct value), and update the
md constant to use the same numeric value as the Zig enum (ensure all
BunLoaderType numeric assignments mirror the Zig Loader order so there are no
conflicts between md and json5).


pub fn jsonStringify(self: @This(), writer: anytype) !void {
Expand Down
1 change: 1 addition & 0 deletions src/bake/DevServer/DirectoryWatchStore.zig
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pub fn trackResolutionFailure(store: *DirectoryWatchStore, import_source: []cons
.bunsh,
.sqlite,
.sqlite_embedded,
.md,
=> bun.debugAssert(false),
}

Expand Down
2 changes: 1 addition & 1 deletion src/bun.js/ModuleLoader.zig
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub fn transpileSourceCode(
}

switch (loader) {
.js, .jsx, .ts, .tsx, .json, .jsonc, .toml, .yaml, .text => {
.js, .jsx, .ts, .tsx, .json, .jsonc, .toml, .yaml, .text, .md => {
// Ensure that if there was an ASTMemoryAllocator in use, it's not used anymore.
var ast_scope = js_ast.ASTMemoryAllocator.Scope{};
ast_scope.enter();
Expand Down
1 change: 1 addition & 0 deletions src/bun.js/api.zig
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub const Subprocess = @import("./api/bun/subprocess.zig");
pub const Terminal = @import("./api/bun/Terminal.zig");
pub const HashObject = @import("./api/HashObject.zig");
pub const JSONCObject = @import("./api/JSONCObject.zig");
pub const MarkdownObject = @import("./api/MarkdownObject.zig");
pub const TOMLObject = @import("./api/TOMLObject.zig");
pub const UnsafeObject = @import("./api/UnsafeObject.zig");
pub const YAMLObject = @import("./api/YAMLObject.zig");
Expand Down
6 changes: 6 additions & 0 deletions src/bun.js/api/BunObject.zig
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub const BunObject = struct {
pub const SHA512 = toJSLazyPropertyCallback(Crypto.SHA512.getter);
pub const SHA512_256 = toJSLazyPropertyCallback(Crypto.SHA512_256.getter);
pub const JSONC = toJSLazyPropertyCallback(Bun.getJSONCObject);
pub const Markdown = toJSLazyPropertyCallback(Bun.getMarkdownObject);
pub const TOML = toJSLazyPropertyCallback(Bun.getTOMLObject);
pub const YAML = toJSLazyPropertyCallback(Bun.getYAMLObject);
pub const Transpiler = toJSLazyPropertyCallback(Bun.getTranspilerConstructor);
Expand Down Expand Up @@ -130,6 +131,7 @@ pub const BunObject = struct {
@export(&BunObject.SHA512, .{ .name = lazyPropertyCallbackName("SHA512") });
@export(&BunObject.SHA512_256, .{ .name = lazyPropertyCallbackName("SHA512_256") });
@export(&BunObject.JSONC, .{ .name = lazyPropertyCallbackName("JSONC") });
@export(&BunObject.Markdown, .{ .name = lazyPropertyCallbackName("Markdown") });
@export(&BunObject.TOML, .{ .name = lazyPropertyCallbackName("TOML") });
@export(&BunObject.YAML, .{ .name = lazyPropertyCallbackName("YAML") });
@export(&BunObject.Glob, .{ .name = lazyPropertyCallbackName("Glob") });
Expand Down Expand Up @@ -1265,6 +1267,9 @@ pub fn getHashObject(globalThis: *jsc.JSGlobalObject, _: *jsc.JSObject) jsc.JSVa
pub fn getJSONCObject(globalThis: *jsc.JSGlobalObject, _: *jsc.JSObject) jsc.JSValue {
return JSONCObject.create(globalThis);
}
pub fn getMarkdownObject(globalThis: *jsc.JSGlobalObject, _: *jsc.JSObject) jsc.JSValue {
return MarkdownObject.create(globalThis);
}
pub fn getTOMLObject(globalThis: *jsc.JSGlobalObject, _: *jsc.JSObject) jsc.JSValue {
return TOMLObject.create(globalThis);
}
Expand Down Expand Up @@ -2067,6 +2072,7 @@ const api = bun.api;
const FFIObject = bun.api.FFIObject;
const HashObject = bun.api.HashObject;
const JSONCObject = bun.api.JSONCObject;
const MarkdownObject = bun.api.MarkdownObject;
const TOMLObject = bun.api.TOMLObject;
const UnsafeObject = bun.api.UnsafeObject;
const YAMLObject = bun.api.YAMLObject;
Expand Down
Loading
Loading