Skip to content

Commit

Permalink
Merge pull request #30407 from quarkusio/fix-bad-JS-identifier
Browse files Browse the repository at this point in the history
Fix invalid JavaScript identifier in DevUI sourceMaps
  • Loading branch information
cescoffier authored Jan 17, 2023
2 parents 69edabb + 5079fd0 commit 2264061
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ public Object apply(EvalContext ctx) {
String ctxName = ctx.getName();

List<Path> sourcesDir = DevConsoleManager.getHotReplacementContext().getSourcesDir();
if (ctxName.equals("sourcePackages")) {
if (ctxName.endsWith("sourcePackages")) {
if (disable) {
return Collections.emptyList(); // we need this here because the result needs to be iterable
}
Expand All @@ -938,12 +938,15 @@ public Object apply(EvalContext ctx) {
String lang = sourcePaths.getFileName().toString();
List<String> packages = sourcePackagesForRoot(sourcePaths);
if (!packages.isEmpty()) {
sourcePackagesByLang.put(lang, packages);
// The `replace` is used to avoid invalid JavaScript identifier (using `-`)
// It happens when using Gradle and extensions generating code (Avro, gRPC...)
// See https://github.com/quarkusio/quarkus/issues/30288.
sourcePackagesByLang.put(lang.replace("-", "_"), packages);
}
}
return sourcePackagesByLang;
}
if (ctxName.equals("locationPackages")) {
if (ctxName.endsWith("locationPackages")) {
if (disable) {
return Collections.emptyList(); // we need this here because the result needs to be iterable
}
Expand Down

0 comments on commit 2264061

Please sign in to comment.