Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions spec/exports_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";

import * as builderModule from "../src/fxb.js";

describe("builder exports", function () {
// 2026-10-11: The named constructor promised by the declarations must be available at runtime.
it("should export the same constructor as Builder and default", function () {
expect(builderModule.Builder).toBe(builderModule.default);
const builder = new builderModule.Builder();
expect(builder.build({ root: 'value' })).toEqual('<root>value</root>');
});
});
3 changes: 3 additions & 0 deletions src/fxb.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ export default function Builder(options) {
}
}

// 2026-10-11: Keep the declared named constructor available alongside the default export.
export { Builder };

/**
* Detect XML version from the ?xml declaration at the root of a plain-object input.
* Checks both attributesGroupName and flat attribute forms.
Expand Down