Add multi-format build targets, conditional exports map, and automatic headless entry point for Node.js#26
Open
mvanderkamp with Copilot wants to merge 1 commit into
Open
Add multi-format build targets, conditional exports map, and automatic headless entry point for Node.js#26mvanderkamp with Copilot wants to merge 1 commit into
mvanderkamp with Copilot wants to merge 1 commit into
Conversation
…ry point Agent-Logs-Url: https://github.com/mvanderkamp/westures/sessions/7aa07059-36ca-4eac-9a48-c037e5c1a03f Co-authored-by: mvanderkamp <40647401+mvanderkamp@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
mvanderkamp
April 11, 2026 18:37
View session
There was a problem hiding this comment.
Pull request overview
This PR modernizes the published package interface by adding multiple Parcel build targets (CJS/ESM/UMD), introducing a conditional exports map, and adding a Node-oriented headless entry point that overrides Region defaults. It also updates documentation and the changelog to reflect the new consumption patterns.
Changes:
- Add Parcel
targetsfor CJS (main), ESM (module), global/UMD (browser), and a custom Node headless CJS target. - Add
exportsconditional mapping to select bundles by environment. - Add
index.headless.jsentry and document install/import patterns inREADME.md, with a new changelog entry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| README.md | Adds “Installation & Import” docs and Node headless usage guidance. |
| package.json | Introduces multi-target outputs and a conditional exports map. |
| index.headless.js | Adds a headless Node entry that re-exports everything and overrides Region default options. |
| CHANGELOG.md | Adds a new 1.2.0 release entry describing these distribution changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+29
to
+35
| "exports": { | ||
| ".": { | ||
| "node": "./dist/westures.node.cjs.js", | ||
| "import": "./dist/westures.esm.js", | ||
| "require": "./dist/westures.cjs.js", | ||
| "browser": "./dist/westures.umd.js" | ||
| } |
Comment on lines
+25
to
+28
| "main": "dist/westures.cjs.js", | ||
| "module": "dist/westures.esm.js", | ||
| "browser": "dist/westures.umd.js", | ||
| "nodeHeadless": "dist/westures.node.cjs.js", |
Comment on lines
+15
to
+23
| const base = require('./index.js'); | ||
|
|
||
| class Region extends base.Region { | ||
| constructor(element, options = {}) { | ||
| super(element, { headless: true, ...options }); | ||
| } | ||
| } | ||
|
|
||
| module.exports = { ...base, Region }; |
Comment on lines
+124
to
+125
| // ES module in Node.js — same headless default | ||
| import { Region, Pan } from 'westures'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The package previously shipped a single
dist/index.jsCJS bundle with no exports map, no ESM target, and no ergonomic headless support for server-side consumers.Changes
package.json"main": "dist/index.js"with four Parcel 2 targets:"main"→dist/westures.cjs.js(CJS, Node ≥12)"module"→dist/westures.esm.js(ESM, tree-shaking)"browser"→dist/westures.umd.js(IIFE globalwindow.westures)"nodeHeadless"→dist/westures.node.cjs.js(headless CJS — required by Parcel as the output path for the custom target)"exports"conditional map;"node"condition is ordered first so all Node.js consumers (bothrequireandimport) receive the headless build automatically:"targets"block withoutputFormat,isLibrary,optimize, andenginesper target; thenodeHeadlesstarget overrides"source"to point atindex.headless.js.index.headless.js(new)Thin re-export of
index.jswith aRegionsubclass that defaultsheadless: true. Users can still opt out per-region with{ headless: false }.README.mdAdds an "Installation & Import" section documenting all three consumption patterns: bundler (ESM),
<script>tag (UMD), and Node.js headless (CJS).CHANGELOG.mdAdds v1.2.0 entry.