Skip to content

feat: add headless option to build() - #172

Merged
TooTallNate merged 4 commits into
masterfrom
clutz/add-headless-option
Nov 6, 2026
Merged

TooTallNate merged 4 commits into
masterfrom
clutz/add-headless-option

Conversation

@clutz-bot

@clutz-bot clutz-bot Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Adds a headless option to BuildOptions that omits the XML declaration (<?xml ...?>) and DOCTYPE from the output. Useful for embedding plist fragments.

Works in both Node.js (xmlbuilder) and browser (native) code paths.

Supersedes #159 — implements the alternative API suggested in the code review comments (implementation-agnostic BuildOptions property instead of exposing xmlbuilder-specific types).

Usage

import { build } from 'plist';

build({ foo: 'bar' }, { headless: true });
// <plist version="1.0">
//   <dict>
//     <key>foo</key>
//     <string>bar</string>
//   </dict>
// </plist>

Adds a 'headless' option to BuildOptions that, when set to true, omits
the XML declaration and DOCTYPE from the output. This is useful for
embedding plist fragments.

Works in both the Node.js (xmlbuilder) and browser (native) code paths.

Supersedes #159
@vercel

vercel Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
plist-playground Ready Ready Preview Nov 6, 2026 7:41pm UTC

@changeset-bot

changeset-bot Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1c4d557

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
plist Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dnicolson

Copy link
Copy Markdown
Contributor

This approach seems overly restrictive, as it only exposes the headless xmlbuilder create option. It’s also unclear what problem this is intended to solve.

The advantage of #159 is that it supports all xmlbuilder.CreateOptions settings while remaining a non-breaking change, since it only adds an optional parameter. It also enables use of the invalidCharReplacement option, which is not currently configurable.

@TooTallNate

Copy link
Copy Markdown
Owner

@dnicolson did you see this comment?

@dnicolson

Copy link
Copy Markdown
Contributor

@TooTallNate I did, but it was largely contradicted by the next comment.

@dnicolson

Copy link
Copy Markdown
Contributor

This headless option could be added on top of #181. This PR incorrectly passes headless to both xmlbuilder.create() and doc.end(), but the latter expects the type xmlbuilder.XMLToStringOptions.

@TooTallNate
TooTallNate merged commit 821e16c into master Nov 6, 2026
7 checks passed
@TooTallNate
TooTallNate deleted the clutz/add-headless-option branch November 6, 2026 19:42

This branch was successfully deployed

1 active deployment
Preview — 1c4d557a Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants