Skip to content

First refactor of XML bundling in prep for browser separation#718

Merged
VisLab merged 5 commits into
hed-standard:mainfrom
VisLab:fix_actions
May 5, 2026
Merged

First refactor of XML bundling in prep for browser separation#718
VisLab merged 5 commits into
hed-standard:mainfrom
VisLab:fix_actions

Conversation

@VisLab
Copy link
Copy Markdown
Member

@VisLab VisLab commented May 4, 2026

No description provided.

VisLab added 3 commits May 4, 2026 10:10
- Replace __VITE_ENV__ with __IS_BROWSER__ esbuild define in config.js
  so localSchemaNames is empty in browser builds (all schemas load remotely)
- Add src/utils/files.browser.js: browser-safe file utilities using fetch
- Add browserFilesAlias esbuild plugin to redirect files.js in browser build
- Add src/bids/webAccessor.js: BidsWebAccessor for browser BIDS validation
  using File/FileList browser APIs instead of filesystem
- Export BidsWebAccessor from bids/index.js and root index.js
- Add 'browser' export condition in package.json pointing to dist/esm/index.js
- Add 'husky && npm run build' as prepare script to support GitHub installs
- Declare __IS_BROWSER__ as ESLint global in eslint.config.mjs
- Add BidsWebAccessor type declarations and tests to types/
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR prepares hed-validator for cleaner browser support by inlining bundled XML schemas into builds and introducing browser-specific BIDS file access, alongside build/export updates to better target browser bundlers.

Changes:

  • Inline bundled HED XML schemas via static imports (src/schema/config.js) so standard schemas are available offline in both Node and browser bundles.
  • Add a browser-oriented BIDS accessor (BidsWebAccessor) plus browser-safe file utilities and an esbuild alias to avoid importing node:fs/promises in browser builds.
  • Update public exports (runtime + types) and package export conditions to expose the new browser accessor.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
types/test.ts Extends the TypeScript type-test to exercise BidsWebAccessor usage.
types/index.d.ts Adds BidsWebAccessor type declarations to the public API surface.
src/utils/files.browser.js Introduces browser-safe file-reading utilities (no local FS; HTTPS via fetch).
src/schema/config.js Refactors bundled schema configuration to use static XML imports and a generated map/list.
src/bids/webAccessor.js Adds the browser BidsWebAccessor implementation for FileList/File[] inputs.
src/bids/index.js Re-exports BidsWebAccessor from the BIDS module entry point.
package.json Adds exports["."].browser condition and runs build during prepare.
index.js Re-exports BidsWebAccessor from the package root entry point.
esbuild.mjs Adds a browser alias plugin to redirect utils/files to utils/files.browser.js in browser builds.
.github/workflows/claude-code-review.yml Adds an automated Claude-based PR review workflow.

Comment thread src/bids/webAccessor.js Outdated
Comment thread src/bids/webAccessor.js
@VisLab VisLab merged commit 11012e5 into hed-standard:main May 5, 2026
17 checks passed
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