First refactor of XML bundling in prep for browser separation#718
Merged
Conversation
- 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/
…into fix_actions
Contributor
There was a problem hiding this comment.
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 importingnode:fs/promisesin 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. |
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.
No description provided.