beni 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d001f425802e3d32f1925d39b91e25caa45f1f31ac10ec431d8346c9375225b
4
- data.tar.gz: 57c6d9b1ee5681cfd525ece65d7aeeec42c6357f2676e32f4e1c7e88bd7dbc44
3
+ metadata.gz: ad43860a445c0a577ce897ef73bc51e77054fd9835b14a76344397efde74f127
4
+ data.tar.gz: 42295c6d061a683ea705b342cff9344a61d2048563823dd0c5e61eece42c2653
5
5
  SHA512:
6
- metadata.gz: c0ec83a8dd9f54de098411fccffe8c6c0d376508871b63e7af60fc67499fee987356ff57f1d302a50cde01617658cbe88ba8b037ad83ad9ef8e930f3dd1746c4
7
- data.tar.gz: 75e2f50847288286e67752e1a2535efb729f84a13a3528b61074d509cea511914fb1c81cf94c10f83d563d3fb28e779a39d3fdc592237f0bb6f92c1e161db361
6
+ metadata.gz: a9f7ce1cf61de249915a59b2709bce33830d000a80c8f7c3995a4338ad32414186d2af52e1dbc747b20f3b8813f13ea45247700ae72f1e25c286693d8438fdad
7
+ data.tar.gz: e8372bcf19c4adac1b1270f046fec7cb058bc9356e9b77ccdd07fe643789e1972a81c044b0326d5c6e46696f9635ff3225088298580d8bbe1a31bd566c3393ac
data/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.0](https://github.com/elct9620/beni/compare/v0.6.1...v0.7.0) (2026-06-14)
4
+
5
+
6
+ ### Features
7
+
8
+ * **beni:** add Error::new for handler-authored exceptions ([4842496](https://github.com/elct9620/beni/commit/48424965e4c771c2b9097e63ce973c42799a79a7))
9
+ * **beni:** convert an mruby string to owned bytes ([ec5e175](https://github.com/elct9620/beni/commit/ec5e1756d1c6bb7620403c0cf38fe61ac13ad5e4))
10
+ * **beni:** graduate array index-write and capacity/slice construction ([68af55d](https://github.com/elct9620/beni/commit/68af55d3330020356aaaf3c202f7e85c251c1aa8))
11
+ * **beni:** graduate module functions; record class-method alignment ([c7c6c47](https://github.com/elct9620/beni/commit/c7c6c472c05a09830e7d022b4a1bc27c267e773b))
12
+ * **beni:** graduate module inclusion onto the Module trait ([c751c3f](https://github.com/elct9620/beni/commit/c751c3f152a9f8384788e6fb4467cb2bf44effab))
13
+ * **beni:** graduate string append and owned-String conversion ([6035360](https://github.com/elct9620/beni/commit/60353601fd04f5d94524b5bb73ce80a304107ad8))
14
+ * **beni:** graduate the typed array's remove/extend/clear/dup surface ([842d4f2](https://github.com/elct9620/beni/commit/842d4f227be6ea0f71c09691d5ef1b3e0e439165))
15
+ * **beni:** graduate the typed hash's clear onto the Hash surface ([a1ef297](https://github.com/elct9620/beni/commit/a1ef297dab8e0463462f78849b099a8dde78ba8c))
16
+ * **beni:** graduate the typed hash's read, fetch, delete, and merge surface ([4af31f1](https://github.com/elct9620/beni/commit/4af31f1d2589c334c3c7204f74907c44c86d0b85))
17
+ * **beni:** graduate the typed string's dup and byte compare ([05ea9ef](https://github.com/elct9620/beni/commit/05ea9ef4793411c4f7ace2352b3a17e38075bae1))
18
+ * **beni:** graduate the typed value's inspect render ([e6f7bb0](https://github.com/elct9620/beni/commit/e6f7bb042aee9869b94aa338ab7346bd61f13822))
19
+ * **beni:** graduate the value reflection surface (class, is_a?, freeze) ([66f4dfd](https://github.com/elct9620/beni/commit/66f4dfd24daeb4d060ddb492da6533f640ac1a6f))
20
+ * **beni:** graduate value comparison (==, eql?, identity) ([f12c645](https://github.com/elct9620/beni/commit/f12c6459929c053e80efc9333139f3688bed42ec))
21
+ * **beni:** introduce RString and graduate string ops onto it ([d71c093](https://github.com/elct9620/beni/commit/d71c0939e9e3d6bd9a7f7577765bc03095eef489))
22
+ * **beni:** report an RString's byte length on the typed surface ([47c4b48](https://github.com/elct9620/beni/commit/47c4b4830d2a6419cc9fa59fcab35606c9b7b2f8))
23
+ * **coverage:** drop non-embedder macros, credit tag predicates ([5c6b656](https://github.com/elct9620/beni/commit/5c6b65670412eb4d7bb3c8e67d9c46c4d39e604a))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * **beni:** make data_reinit a safe no-op on a non-carrier value ([e5339f2](https://github.com/elct9620/beni/commit/e5339f22a0b8d253ff361a5764a51375f9edae2f))
29
+ * **beni:** normalize a symbol toolchain name like a target ([ff1beb7](https://github.com/elct9620/beni/commit/ff1beb746c44cf298a6c88e22b600b6a7a5774d9))
30
+ * **beni:** protect str_cat against a frozen receiver ([9b78cc3](https://github.com/elct9620/beni/commit/9b78cc3f51ae0f78115fd6b9285931d6e083c044))
31
+ * **beni:** protect the dispatching and mutating typed ops against raises ([8b83ab9](https://github.com/elct9620/beni/commit/8b83ab936d5f696e0fb58b343af7dedffd3776e0))
32
+ * **beni:** read a String subclass to_s result by tag ([66589b9](https://github.com/elct9620/beni/commit/66589b9ff21f57982250f9de5ec18ce3b13b534a))
33
+ * **beni:** route class obj_new through protect ([124cd29](https://github.com/elct9620/beni/commit/124cd29288ed4f5c42a151888350e248df48e58e))
34
+ * **beni:** route Hash::get through protect ([e0a9c92](https://github.com/elct9620/beni/commit/e0a9c92e42f06e9d09b977de4975c4c81dc4327e))
35
+ * **beni:** route value dup, clone, and string coercion through protect ([3ac8cc2](https://github.com/elct9620/beni/commit/3ac8cc2cb3bf8a4bc6a44d7ecad8b4f7cdcf9385))
36
+ * **beni:** route value iv_set and const_get through protect ([d46f18c](https://github.com/elct9620/beni/commit/d46f18cdcab51e8907123a405cf7225ee21f505c))
37
+ * **beni:** saturate the exception message length like the string factory ([11eb7b9](https://github.com/elct9620/beni/commit/11eb7b91bb7f3b935fbdd1e4ca5863b0d4ba8a8c))
38
+ * **coverage:** credit is_integer to integer_p, not fixnum_p ([32f064f](https://github.com/elct9620/beni/commit/32f064fe810b2181b826251b447dbfc16208cf31))
39
+ * **coverage:** label trait graduations by their trait ([be598c6](https://github.com/elct9620/beni/commit/be598c6b4e59a885a6eaae08ee64c3900c9cb198))
40
+
3
41
  ## [0.6.1](https://github.com/elct9620/beni/compare/v0.6.0...v0.6.1) (2026-06-11)
4
42
 
5
43
 
@@ -8,5 +8,10 @@ module Beni
8
8
  # +targets+ as the declared set (or +["host"]+), and +toolchains+ as
9
9
  # the reference-driven selection.
10
10
  class Configuration < Data.define(:vendor_dir, :build_config, :targets, :toolchains)
11
+ # mruby's selected version. Resolution always selects +mruby+ and
12
+ # leads the toolchain set with it, so it is the head's version.
13
+ def mruby_version
14
+ toolchains.first.version
15
+ end
11
16
  end
12
17
  end
@@ -39,15 +39,16 @@ module Beni
39
39
  # A top-level +toolchain <name>+ — always a definition, so the
40
40
  # block is part of the grammar and +mruby+ is never definable.
41
41
  def toolchain(name, &block)
42
- raise Error, "top-level `toolchain #{name.inspect}` must carry a definition block" unless block
43
- if name == "mruby"
42
+ key = name.to_s
43
+ raise Error, "top-level `toolchain #{key.inspect}` must carry a definition block" unless block
44
+ if key == "mruby"
44
45
  raise Error, "a toolchain definition never names \"mruby\" — select it with the `version` setting"
45
46
  end
46
47
 
47
- DSL.assert_known_toolchain!(name)
48
- raise Error, "duplicate toolchain definition #{name.inspect}" if @definitions.key?(name)
48
+ DSL.assert_known_toolchain!(key)
49
+ raise Error, "duplicate toolchain definition #{key.inspect}" if @definitions.key?(key)
49
50
 
50
- @definitions[name] = DefinitionContext.collect(name, &block)
51
+ @definitions[key] = DefinitionContext.collect(key, &block)
51
52
  end
52
53
 
53
54
  # Resolve the collected declarations (SPEC.md Behaviors: selection
@@ -21,14 +21,15 @@ module Beni
21
21
  end
22
22
 
23
23
  def toolchain(name, &block)
24
+ key = name.to_s
24
25
  if block
25
26
  raise Error,
26
- "`toolchain #{name.inspect}` inside a target block must not carry a block — " \
27
+ "`toolchain #{key.inspect}` inside a target block must not carry a block — " \
27
28
  "definitions live at the top level"
28
29
  end
29
- DSL.assert_known_toolchain!(name)
30
+ DSL.assert_known_toolchain!(key)
30
31
 
31
- @references << name unless @references.include?(name)
32
+ @references << key unless @references.include?(key)
32
33
  end
33
34
  end
34
35
  end
data/lib/beni/tasks.rb CHANGED
@@ -145,15 +145,9 @@ module Beni
145
145
  dest = configuration.build_config
146
146
  raise Error, "[beni] beni:config requires a `build_config` declaration naming the file to generate" unless dest
147
147
 
148
- BuildConfig.generate(dest, mruby_dir: builder.mruby_dir, version: mruby_version)
148
+ BuildConfig.generate(dest, mruby_dir: builder.mruby_dir, version: configuration.mruby_version)
149
149
  puts "[beni] generated #{dest} — edit it to define further targets"
150
150
  end
151
151
  end
152
-
153
- # mruby's selected version — always present, `mruby` is selected in
154
- # every resolution.
155
- def mruby_version
156
- configuration.toolchains.to_h { |toolchain| [toolchain.name, toolchain.version] }.fetch("mruby")
157
- end
158
152
  end
159
153
  end
data/lib/beni/vendor.rb CHANGED
@@ -50,18 +50,21 @@ module Beni
50
50
  # task-definition time: referencing wasi-sdk implies mruby.
51
51
  DEPENDENCIES = { "wasi-sdk" => %w[mruby] }.freeze
52
52
 
53
- # ---- Platform detection (wasi-sdk only; mruby tarball is host-agnostic).
54
- # +x86_64-linux+ is both the most common host triple and the safest
55
- # fallback for unrecognised ones, so we collapse both cases into the
56
- # +else+ branch rather than carrying an explicit +when+ that would
57
- # duplicate the default.
58
- WASI_SDK_PLATFORM =
59
- case RUBY_PLATFORM
53
+ # Map a host triple to the platform token wasi-sdk keys its per-platform
54
+ # tarballs by (wasi-sdk only; mruby's tarball is host-agnostic).
55
+ # +x86_64-linux+ is both the most common host and the safest fallback
56
+ # for unrecognised triples, so it is the +else+ branch.
57
+ def self.wasi_sdk_platform(platform = RUBY_PLATFORM)
58
+ case platform
60
59
  when /arm64-darwin|aarch64-darwin/ then "arm64-macos"
61
60
  when /x86_64-darwin/ then "x86_64-macos"
62
61
  when /aarch64-linux|arm64-linux/ then "arm64-linux"
63
62
  else "x86_64-linux"
64
63
  end
64
+ end
65
+
66
+ # The build platform's wasi-sdk token, resolved once at load.
67
+ WASI_SDK_PLATFORM = wasi_sdk_platform
65
68
 
66
69
  # Known toolchain names mapped to their factory methods — the name
67
70
  # domain the DSL validates against and +Beni::Tasks+ dispatches on.
data/lib/beni/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Beni
4
- VERSION = "0.6.1"
4
+ VERSION = "0.7.0"
5
5
  end
@@ -6,5 +6,7 @@ module Beni
6
6
  attr_reader toolchains: Array[SelectedToolchain]
7
7
 
8
8
  def initialize: (vendor_dir: String, build_config: String?, targets: Array[String], toolchains: Array[SelectedToolchain]) -> void
9
+
10
+ def mruby_version: () -> String
9
11
  end
10
12
  end
@@ -15,7 +15,7 @@ module Beni
15
15
 
16
16
  def target: (Symbol | String name) ?{ () [self: TargetContext] -> void } -> void
17
17
 
18
- def toolchain: (String name) ?{ () [self: DefinitionContext] -> void } -> void
18
+ def toolchain: (Symbol | String name) ?{ () [self: DefinitionContext] -> void } -> void
19
19
 
20
20
  def configuration: () -> Configuration
21
21
 
@@ -9,7 +9,7 @@ module Beni
9
9
 
10
10
  def initialize: () -> void
11
11
 
12
- def toolchain: (String name) ?{ () -> void } -> void
12
+ def toolchain: (Symbol | String name) ?{ () -> void } -> void
13
13
  end
14
14
  end
15
15
  end
data/sig/beni/tasks.rbs CHANGED
@@ -30,7 +30,5 @@ module Beni
30
30
  def define_clean_task: () -> void
31
31
 
32
32
  def define_config_task: () -> void
33
-
34
- def mruby_version: () -> String
35
33
  end
36
34
  end
data/sig/beni/vendor.rbs CHANGED
@@ -7,6 +7,8 @@ module Beni
7
7
  WASI_SDK_PLATFORM: String
8
8
  TOOLCHAIN_FACTORIES: Hash[String, Symbol]
9
9
 
10
+ def self.wasi_sdk_platform: (?String platform) -> String
11
+
10
12
  def self?.wasi_sdk: (vendor_dir: String, ?version: String?, ?sha256: String?) -> Toolchain
11
13
 
12
14
  def self?.mruby: (vendor_dir: String, ?version: String?, ?sha256: String?) -> Toolchain
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beni
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aotokitsuruya