Context
apex-parser 5.x has moved to ANTLR 4.13.2 (Java) and the official antlr4 JS runtime (replacing the abandoned antlr4ts fork). Downstream consumers that pull both apex-parser and vf-parser now hit conflicting ANTLR runtimes — different Java versions, and on the JS side a different package altogether.
Possible end state is to merge the two libraries; this ticket scopes the modernisation of vf-parser's build system as a precursor so the merge is straightforward rather than a forced rewrite.
Scope
Build orchestration
npm package — antlr4ts → antlr4 migration (the risky bit)
jvm package
CI / publishing
Dev tooling (additive)
Suggested PR ordering
- JVM pom modernisation + ANTLR 4.13.2 runtime — compiles independently.
- npm side: rewrite for
antlr4 runtime + ESM/tsconfig/eslint modernisation (entangled, single PR).
- CI workflow bumps + Sonatype Central publishing switch.
- Husky/prettier/lint-staged/dependabot — purely additive.
Risk
The npm-side runtime swap (step 2) is a real rewrite, not a renumber — the generated TS classes have a different shape and the imports change substantially. Reference apex-parser/npm/src/{index,ApexErrorListener,ApexParserFactory}.ts as the template.
Context
apex-parser 5.x has moved to ANTLR 4.13.2 (Java) and the official
antlr4JS runtime (replacing the abandonedantlr4tsfork). Downstream consumers that pull both apex-parser and vf-parser now hit conflicting ANTLR runtimes — different Java versions, and on the JS side a different package altogether.Possible end state is to merge the two libraries; this ticket scopes the modernisation of vf-parser's build system as a precursor so the merge is straightforward rather than a forced rewrite.
Scope
Build orchestration
antlr4-maven-plugin(4.8-1) withexec-maven-plugindrivingorg.antlr.v4.Tool4.13.2, plusbuild-helper-maven-pluginto add generated sources (mirrorapex-parser/jvm/pom.xml).pom.xmlinnpm/to generate the TypeScript parser via the same Java tool with-Dlanguage=TypeScript./antlrdir; remove theinit-npm/init-jvmcp scripts and the per-target.g4copies.package.jsonscripts toinit/init:jvm/init:npm/build:jvm/build:npm.npm package —
antlr4ts→antlr4migration (the risky bit)antlr4ts0.5.0-alpha.4 with bundledantlr44.13.2 (bundleDependencies).npm/src/index.tsandThrowingErrorListener.tsagainst the new runtime API; update__tests__/PageParserTest.ts.node patch(shelljs sed) post-processing withpatch-package+patches/antlr4+4.13.2.patch."type": "module",exportsmap,.jsimport suffixes,dist/output.target: es2022,module: node20,strict: true.test/dir; updatejestconfig.jsonregex todist/test/.*Test.js$..eslintrc.js→ ESLint v10 flateslint.config.jswithtypescript-eslintv8.npm/.npmrcwithnode-options='--experimental-vm-modules'for Jest ESM.jvm package
junit-jupiter-engine→junit-jupiter).<source>1.8</source><target>1.8</target>→<release>8</release>.antlr4as<scope>provided</scope>dep so generator JAR is on the classpath.nexus-staging-maven-plugin(legacy OSSRH) withcentral-publishing-maven-plugin0.10.0 (Sonatype Central Portal).s01.oss.sonatype.org<repositories>block; addcentral-portal-snapshots.CI / publishing
submodules: recursive(no submodules).Build.yml:npm run initthennpm run build.PublishMaven.yml:server-id: ossrh→centralto match the new publishing plugin.PublishNPM.ymlscript names with the new init/build layout.Dev tooling (additive)
husky+lint-staged(root + per-package configs).prettier+prettier-plugin-java..github/dependabot.ymlcovering/,/npm,/jvm, and github-actions..gitignore(.metals/,.vscode/,.idea/,node_modules/).Suggested PR ordering
antlr4runtime + ESM/tsconfig/eslint modernisation (entangled, single PR).Risk
The npm-side runtime swap (step 2) is a real rewrite, not a renumber — the generated TS classes have a different shape and the imports change substantially. Reference
apex-parser/npm/src/{index,ApexErrorListener,ApexParserFactory}.tsas the template.