diff --git a/.env b/.env index 365391b4..4fc6456a 100644 --- a/.env +++ b/.env @@ -1,5 +1,4 @@ -VERSION="3.0.1-beta.1" +VERSION="3.0.2-beta.1" MAJOR=3 MINOR=0 -PATCH=1 - +PATCH=2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 90fc5994..7ca04d0f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -405,12 +405,12 @@ jobs: working-directory: ${{env.RUST_RUNTIME_ROOT}} - name: Publish NodeJS Tools - run: npm publish "./bebop-tools-npm-${{ steps.dotenv.outputs.version }}/bebop-tools-v${{ steps.dotenv.outputs.version }}.tgz" --access public + run: npm publish "./bebop-tools-npm-${{ steps.dotenv.outputs.version }}/bebop-tools-v${{ steps.dotenv.outputs.version }}.tgz" --access public ${{ github.ref == 'refs/heads/vnext' && '--tag next' || '' }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} - name: Publish TypeScript Runtime - run: npm publish "./bebop-runtime-ts-${{ steps.dotenv.outputs.version }}/bebop-v${{ steps.dotenv.outputs.version }}.tgz" --access public + run: npm publish "./bebop-runtime-ts-${{ steps.dotenv.outputs.version }}/bebop-v${{ steps.dotenv.outputs.version }}.tgz" --access public ${{ github.ref == 'refs/heads/vnext' && '--tag next' || '' }} env: NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} @@ -449,7 +449,7 @@ jobs: tag_name: ${{ github.ref }} release_name: Bebop ${{ github.ref }} draft: false - prerelease: false + prerelease: ${{ github.ref == 'refs/heads/vnext' }} - name: Upload Compiler for Windows x64 uses: actions/upload-release-asset@v1 diff --git a/Core/CompilerHost.cs b/Core/CompilerHost.cs index ab7ebe28..c1946534 100644 --- a/Core/CompilerHost.cs +++ b/Core/CompilerHost.cs @@ -15,6 +15,7 @@ using Core.Logging; using Core.Meta; using Core.Meta.Decorators; +using Spectre.Console; namespace Core; @@ -127,8 +128,20 @@ public CompilerHostBuilder WithExtensions(Dictionary extensions) _extensionRuntime = new ExtensionRuntime(DotEnv.Generated.Environment.Version, DiagnosticLogger.Instance.Out, DiagnosticLogger.Instance.Error); foreach (var kv in extensions) { - var extension = _extensionRuntime.LoadExtension(kv.Key, kv.Value); - + Extension? extension; + try + { + extension = _extensionRuntime.LoadExtension(kv.Key, kv.Value); + } + catch (Exception e) when (e is ExtensionRuntimeException) + { + throw new CompilerException("Extension runtime encountered a fatal exception", e); + } + catch (Exception e) when (e is ExtensionException) + { + DiagnosticLogger.Instance.Error.MarkupInterpolated($"[maroon]Error loading extension {kv.Key}@{kv.Value}: {e.Message}[/]"); + continue; + } if (extension.Decorators is { Count: > 0 }) { foreach (var decorator in extension.Decorators) diff --git a/Core/Logging/DiagnosticLogger.Enhanced.cs b/Core/Logging/DiagnosticLogger.Enhanced.cs index 83ae1faa..08bf0c77 100644 --- a/Core/Logging/DiagnosticLogger.Enhanced.cs +++ b/Core/Logging/DiagnosticLogger.Enhanced.cs @@ -55,43 +55,55 @@ public void WriteTable(Table table) private void RenderEnhancedException(Exception ex, int errorCode) { - string code = Markup.Escape($"[BOP{errorCode}]"); + try + { + string code = Markup.Escape($"[BOP{errorCode}]"); - // Write error code and exception name - _err.Markup($"[red bold]Error {code}:[/] "); - _err.MarkupLine($"[white]{ex.Message}[/]"); + // Write error code and exception name + _err.Markup($"[maroon]Error {code}:[/] "); + _err.MarkupLine($"[white]{ex.Message}[/]"); - // Write file path if FileNotFoundException - if (ex is FileNotFoundException fileNotFoundException) - { - var filePath = new TextPath(fileNotFoundException?.FileName ?? "[unknown]") - { - StemStyle = Style.Parse("white"), - LeafStyle = Style.Parse("white") - }; - _err.WriteLine(); - _err.Write("File: "); - _err.Write(filePath); - _err.WriteLine(); - } - if (ex is { StackTrace: null } and { InnerException: not null }) - { - _err.WriteLine(); - _err.MarkupLine("[red bold]Inner Exception:[/]"); - if (_traceEnabled) + // Write file path if FileNotFoundException + if (ex is FileNotFoundException fileNotFoundException) { - _err.WriteException(ex.InnerException); + var filePath = new TextPath(fileNotFoundException?.FileName ?? "[unknown]") + { + StemStyle = Style.Parse("white"), + LeafStyle = Style.Parse("white") + }; + _err.WriteLine(); + _err.Write("File: "); + _err.Write(filePath); + _err.WriteLine(); } - else + if (ex is { StackTrace: null } and { InnerException: not null }) { - _err.MarkupLine($"[white]{ex.InnerException.Message}[/]"); + _err.WriteLine(); + _err.MarkupLine("[maroon]Inner Exception:[/]"); + if (_traceEnabled) + { + _err.WriteException(ex.InnerException); + } + else + { + _err.MarkupLine($"[white]{ex.InnerException.Message}[/]"); + } + } + if (_traceEnabled && !string.IsNullOrWhiteSpace(ex.StackTrace)) + { + // Write exception message + _err.WriteException(ex); } } - if (_traceEnabled && !string.IsNullOrWhiteSpace(ex.StackTrace)) + catch (Exception e) { - // Write exception message + _err.WriteLine($"{errorCode}:"); _err.WriteException(ex); + _err.WriteLine(); + _err.WriteLine("An error occurred while rendering the exception:"); + _err.WriteException(e); + return; } } diff --git a/extensions/chord.common/ChordManifestConverter.Validators.cs b/extensions/chord.common/ChordManifestConverter.Validators.cs index 8893da8c..48bc1608 100644 --- a/extensions/chord.common/ChordManifestConverter.Validators.cs +++ b/extensions/chord.common/ChordManifestConverter.Validators.cs @@ -104,7 +104,7 @@ internal static SemVersionRange ValidateVersionRange(string? version) throw new JsonException(message, new FormatException("Version range cannot be empty.")); if (version.Equals("*", StringComparison.OrdinalIgnoreCase)) throw new JsonException(message, new FormatException("Version range cannot be *.")); - if (!Semver.SemVersionRange.TryParseNpm(version, out var v)) + if (!Semver.SemVersionRange.TryParseNpm(version, true, out var v)) throw new JsonException(message, new FormatException("Version range is not in the correct SemVer/npm format.")); return v; }