From ea6113354a7c60e08df7186cc5b46eef6668d59f Mon Sep 17 00:00:00 2001 From: Nanaloveyuki Date: Fri, 17 Jul 2026 19:04:17 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20support=20MoonBit=200.10.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/async_basic/moon.pkg | 4 +--- examples/basic/moon.pkg | 4 +--- examples/config_build/moon.pkg | 4 +--- examples/console_basic/moon.pkg | 4 +--- examples/file_rotation/moon.pkg | 4 +--- examples/presets/moon.pkg | 4 +--- examples/style_tags/moon.pkg | 4 +--- examples/text_formatter/moon.pkg | 4 +--- src/config_model/config.mbt | 8 ++++---- src/formatting/formatter.mbt | 4 ++-- 10 files changed, 14 insertions(+), 30 deletions(-) diff --git a/examples/async_basic/moon.pkg b/examples/async_basic/moon.pkg index a0318ec..b0612ca 100644 --- a/examples/async_basic/moon.pkg +++ b/examples/async_basic/moon.pkg @@ -6,6 +6,4 @@ import { supported_targets = "+native" -options( - is_main: true, -) +pkgtype(kind: "executable") diff --git a/examples/basic/moon.pkg b/examples/basic/moon.pkg index 05f243c..6629859 100644 --- a/examples/basic/moon.pkg +++ b/examples/basic/moon.pkg @@ -2,6 +2,4 @@ import { "Nanaloveyuki/BitLogger/src" @lib, } -options( - "is-main": true, -) +pkgtype(kind: "executable") diff --git a/examples/config_build/moon.pkg b/examples/config_build/moon.pkg index 05f243c..6629859 100644 --- a/examples/config_build/moon.pkg +++ b/examples/config_build/moon.pkg @@ -2,6 +2,4 @@ import { "Nanaloveyuki/BitLogger/src" @lib, } -options( - "is-main": true, -) +pkgtype(kind: "executable") diff --git a/examples/console_basic/moon.pkg b/examples/console_basic/moon.pkg index 05f243c..6629859 100644 --- a/examples/console_basic/moon.pkg +++ b/examples/console_basic/moon.pkg @@ -2,6 +2,4 @@ import { "Nanaloveyuki/BitLogger/src" @lib, } -options( - "is-main": true, -) +pkgtype(kind: "executable") diff --git a/examples/file_rotation/moon.pkg b/examples/file_rotation/moon.pkg index 05f243c..6629859 100644 --- a/examples/file_rotation/moon.pkg +++ b/examples/file_rotation/moon.pkg @@ -2,6 +2,4 @@ import { "Nanaloveyuki/BitLogger/src" @lib, } -options( - "is-main": true, -) +pkgtype(kind: "executable") diff --git a/examples/presets/moon.pkg b/examples/presets/moon.pkg index 05f243c..6629859 100644 --- a/examples/presets/moon.pkg +++ b/examples/presets/moon.pkg @@ -2,6 +2,4 @@ import { "Nanaloveyuki/BitLogger/src" @lib, } -options( - "is-main": true, -) +pkgtype(kind: "executable") diff --git a/examples/style_tags/moon.pkg b/examples/style_tags/moon.pkg index 05f243c..6629859 100644 --- a/examples/style_tags/moon.pkg +++ b/examples/style_tags/moon.pkg @@ -2,6 +2,4 @@ import { "Nanaloveyuki/BitLogger/src" @lib, } -options( - "is-main": true, -) +pkgtype(kind: "executable") diff --git a/examples/text_formatter/moon.pkg b/examples/text_formatter/moon.pkg index 05f243c..6629859 100644 --- a/examples/text_formatter/moon.pkg +++ b/examples/text_formatter/moon.pkg @@ -2,6 +2,4 @@ import { "Nanaloveyuki/BitLogger/src" @lib, } -options( - "is-main": true, -) +pkgtype(kind: "executable") diff --git a/src/config_model/config.mbt b/src/config_model/config.mbt index af9baa6..ac3f43b 100644 --- a/src/config_model/config.mbt +++ b/src/config_model/config.mbt @@ -42,7 +42,7 @@ pub fn TextFormatterConfig::new( style_markup? : @formatting.StyleMarkupMode = @formatting.StyleMarkupMode::Full, target_style_markup? : @formatting.StyleMarkupMode = @formatting.StyleMarkupMode::Disabled, fields_style_markup? : @formatting.StyleMarkupMode = @formatting.StyleMarkupMode::Disabled, - style_tags? : Map[String, @formatting.TextStyle] = {}, + style_tags? : Map[String, @formatting.TextStyle] = Map([]), ) -> TextFormatterConfig { { show_timestamp, @@ -380,7 +380,7 @@ fn parse_text_formatter_config( get_string(obj, "fields_style_markup", default="disabled"), ), style_tags=match obj.get("style_tags") { - None => {} + None => Map([]) Some(inner) => parse_style_tags_config(inner) }, ) @@ -407,7 +407,7 @@ fn parse_style_tags_config( value : @json_parser.JsonValue, ) -> Map[String, @formatting.TextStyle] raise ConfigError { let obj = expect_object(value, "text_formatter.style_tags") - let style_tags : Map[String, @formatting.TextStyle] = {} + let style_tags : Map[String, @formatting.TextStyle] = Map([]) for name, item in obj { style_tags[name] = parse_text_style_config( item, @@ -584,7 +584,7 @@ fn text_style_config_to_json( fn style_tags_config_to_json( style_tags : Map[String, @formatting.TextStyle], ) -> @json_parser.JsonValue { - let obj : Map[String, @json_parser.JsonValue] = {} + let obj : Map[String, @json_parser.JsonValue] = Map([]) for name, style in style_tags { obj[name] = text_style_config_to_json(style) } diff --git a/src/formatting/formatter.mbt b/src/formatting/formatter.mbt index de265a8..cb9377c 100644 --- a/src/formatting/formatter.mbt +++ b/src/formatting/formatter.mbt @@ -55,7 +55,7 @@ fn normalize_style_tag_name(name : String) -> String { ///| pub fn style_tag_registry() -> StyleTagRegistry { - { entries: {} } + { entries: Map([]) } } ///| @@ -1015,7 +1015,7 @@ fn level_ansi_code(level : @core.Level) -> String { ///| fn fields_to_json(fields : Array[@core.Field]) -> Json { - let obj : Map[String, Json] = {} + let obj : Map[String, Json] = Map([]) for item in fields { obj[item.key] = Json::string(item.value) }