Skip to content

fix(concertino): avoid browser import failure - #1246

Merged
mttrbrts merged 1 commit into
accordproject:mainfrom
Rishabh060105:Rishabh060105/issue-1245-concertino-browser-import
Jun 2, 2026
Merged

mttrbrts merged 1 commit into
accordproject:mainfrom
Rishabh060105:Rishabh060105/issue-1245-concertino-browser-import

Conversation

@Rishabh060105

@Rishabh060105 Rishabh060105 commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1245

Ensure @accordproject/concertino can be imported safely in browser and bundler environments by removing top-level filesystem access from the package entrypoint and compiling the AJV validator only when validation is requested.

Changes

  • Replace eager schema loading via fs.readFileSync(...) with a JSON module import and lazy validator initialization inside ConcertinoConverter.
  • Add regression coverage for lazy validator compilation and cached reuse, and enable resolveJsonModule for the concertino TypeScript build.

Flags

  • The package root no longer imports fs or path, which avoids browser bundler failures when consumers only need fromConcertoMetamodel or toConcertoMetamodel.
  • Validation-related work and any schema-compilation failures now move from ConcertinoConverter construction time to the first isValid() call.

Screenshots or Video

  • N/A

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from Rishabh060105:issue-1245-concertino-browser-import

Signed-off-by: Rishabh Jain <rishabhj2005@email.com>
@Rishabh060105

Copy link
Copy Markdown
Contributor Author

Hi @mttrbrts, The change removes the top-level fs/path schema read from the package root, imports the schema as JSON instead, and compiles the AJV validator lazily on the first isValid() call. fromConcertoMetamodel and toConcertoMetamodel remain unchanged in behaviour, and I added regression coverage to verify lazy compilation and validator reuse.

@mttrbrts
mttrbrts merged commit fe76cd8 into accordproject:main Jun 2, 2026
12 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.

concertino: fs.readFileSync at module load time breaks browser/bundler environments

2 participants