Repository navigation
Closed
Description
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
- Replace
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). - Add a second
pom.xmlinnpm/to generate the TypeScript parser via the same Java tool with-Dlanguage=TypeScript. - Point both generators at the shared
/antlrdir; remove theinit-npm/init-jvmcp scripts and the per-target.g4copies. - Rework root
package.jsonscripts toinit/init:jvm/init:npm/build:jvm/build:npm.
npm package — antlr4ts → antlr4 migration (the risky bit)
- Replace
antlr4ts0.5.0-alpha.4 with bundledantlr44.13.2 (bundleDependencies). - Rewrite
npm/src/index.tsandThrowingErrorListener.tsagainst the new runtime API; update__tests__/PageParserTest.ts. - Replace the
node patch(shelljs sed) post-processing withpatch-package+patches/antlr4+4.13.2.patch. - Move to ESM:
"type": "module",exportsmap,.jsimport suffixes,dist/output. - tsconfig:
target: es2022,module: node20,strict: true. - Move tests to top-level
test/dir; updatejestconfig.jsonregex todist/test/.*Test.js$. - ESLint v7 legacy
.eslintrc.js→ ESLint v10 flateslint.config.jswithtypescript-eslintv8. - Add
npm/.npmrcwithnode-options='--experimental-vm-modules'for Jest ESM.
jvm package
- Bump JUnit 5.1.0 → 5.14.3 (
junit-jupiter-engine→junit-jupiter). - Bump Maven plugins (compiler, surefire, jar, source, gpg, javadoc, dependency) to current versions.
-
<source>1.8</source><target>1.8</target>→<release>8</release>. - Add
antlr4as<scope>provided</scope>dep so generator JAR is on the classpath. - Replace
nexus-staging-maven-plugin(legacy OSSRH) withcentral-publishing-maven-plugin0.10.0 (Sonatype Central Portal). - Drop the
s01.oss.sonatype.org<repositories>block; addcentral-portal-snapshots.
CI / publishing
- Bump GitHub Actions: checkout v3→v6, setup-node v3→v6, setup-java v3→v5; Node 14→22; JDK 8→11.
- Drop
submodules: recursive(no submodules). - Two-step build in
Build.yml:npm run initthennpm run build. -
PublishMaven.yml:server-id: ossrh→centralto match the new publishing plugin. - Align
PublishNPM.ymlscript names with the new init/build layout.
Dev tooling (additive)
- Add
husky+lint-staged(root + per-package configs). - Add
prettier+prettier-plugin-java. - Add
.github/dependabot.ymlcovering/,/npm,/jvm, and github-actions. - Add a root
.gitignore(.metals/,.vscode/,.idea/,node_modules/).
Suggested PR ordering
- JVM pom modernisation + ANTLR 4.13.2 runtime — compiles independently.
- npm side: rewrite for
antlr4runtime + 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.
Metadata
Metadata
Assignees
Labels
No labels
Activity
build: Split grammars for per-target action injection
kjonescertinia commentedon May 17, 2026
Closed by the modernisation PR series:
exec-maven-plugin, JUnit 5.14.x,<release>8</release>, Sonatype Central publishing); npm rewrite onto bundledantlr44.13.2 with ESM/exports/ESLint v10 flat config andpatch-package; grammar split into shared/antlr+ per-target overlays.prettier-plugin-java, dependabot for/,/npm,/jvm, github-actions, and a root.gitignore.actions/checkoutv3→v6,setup-nodev3→v6,setup-javav3→v5 across all three workflows; droppedsubmodules: recursive; aligned both halves on2.0.0-beta.1(npm-friendly semver, matching the outline-parser bump).Deferred / out of scope: a one-off manual verification that
apex-lsbuilds against the2.0.0-beta.1artefacts before the first non-snapshot release.