Skip to content

Commit 6610c0b

Browse files
committed
Release v0.10.17
1 parent 7504ac8 commit 6610c0b

11 files changed

Lines changed: 37 additions & 26 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
## 0.10.17
6+
7+
- Update `oxc` to 0.17.0 and use the selector API for import discovery.
8+
59
## 0.10.16
610

711
- Update `oxc` to 0.16.0

lib/quickbeam/js.ex

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ defmodule QuickBEAM.JS do
3333

3434
def bundle(ts_dir, barrel) do
3535
barrel_source = File.read!(Path.join(ts_dir, barrel))
36-
{:ok, specifiers} = OXC.imports(barrel_source, barrel)
36+
{:ok, specifiers} = OXC.select(barrel_source, barrel, :import_specifiers)
3737

3838
import_names =
3939
specifiers
@@ -311,11 +311,16 @@ defmodule QuickBEAM.JS do
311311
# => {:ok, ["vue"]}
312312
"""
313313
@spec imports(String.t(), String.t()) :: {:ok, [String.t()]} | {:error, [String.t()]}
314-
defdelegate imports(source, filename), to: OXC
314+
def imports(source, filename), do: OXC.select(source, filename, :import_specifiers)
315315

316316
@doc "Like `imports/2` but raises on errors."
317317
@spec imports!(String.t(), String.t()) :: [String.t()]
318-
defdelegate imports!(source, filename), to: OXC
318+
def imports!(source, filename) do
319+
case imports(source, filename) do
320+
{:ok, imports} -> imports
321+
{:error, errors} -> raise OXC.Error, errors: errors
322+
end
323+
end
319324

320325
@doc """
321326
Bundle multiple TS/JS modules into a single self-executing script.

lib/quickbeam/js/bundler.ex

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,22 @@ defmodule QuickBEAM.JS.Bundler do
2525
end
2626

2727
defp collect_modules(entry_path, project_root) do
28-
case do_collect(entry_path, project_root, [], MapSet.new()) do
28+
case do_collect(entry_path, project_root, [], %{}) do
2929
{:ok, files, _seen} -> {:ok, Enum.reverse(files)}
3030
{:error, _} = error -> error
3131
end
3232
end
3333

34+
@spec do_collect(String.t(), String.t(), [{String.t(), String.t()}], %{String.t() => true}) ::
35+
{:ok, [{String.t(), String.t()}], %{String.t() => true}} | {:error, term()}
3436
defp do_collect(abs_path, project_root, files, seen) do
35-
if MapSet.member?(seen, abs_path) do
37+
if Map.has_key?(seen, abs_path) do
3638
{:ok, files, seen}
3739
else
3840
with {:ok, source} <- File.read(abs_path),
3941
{:ok, rewritten, resolved_paths} <- rewrite_and_resolve(source, abs_path, project_root) do
4042
label = relative_label(abs_path, project_root)
41-
seen = MapSet.put(seen, abs_path)
43+
seen = Map.put(seen, abs_path, true)
4244
files = [{label, rewritten} | files]
4345
collect_deps(resolved_paths, project_root, files, seen)
4446
else
@@ -48,6 +50,8 @@ defmodule QuickBEAM.JS.Bundler do
4850
end
4951
end
5052

53+
@spec collect_deps([String.t()], String.t(), [{String.t(), String.t()}], %{String.t() => true}) ::
54+
{:ok, [{String.t(), String.t()}], %{String.t() => true}} | {:error, term()}
5155
defp collect_deps([], _project_root, files, seen), do: {:ok, files, seen}
5256

5357
defp collect_deps([path | rest], project_root, files, seen) do

lib/quickbeam/script.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ defmodule QuickBEAM.Script do
2525
defp typescript?(path), do: String.ends_with?(path, ".ts") or String.ends_with?(path, ".tsx")
2626

2727
defp has_imports?(source, path) do
28-
case OXC.imports(source, Path.basename(path)) do
28+
case OXC.select(source, Path.basename(path), :import_specifiers) do
2929
{:ok, [_ | _]} -> true
3030
_ -> false
3131
end

lib/quickbeam/subtle_crypto.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ defmodule QuickBEAM.SubtleCrypto do
147147
aad = to_binary(Map.get(algo, "additionalData", []))
148148
tag_length = div(Map.get(algo, "tagLength", 128), 8)
149149
ct_len = byte_size(bytes) - tag_length
150-
<<ct::binary-size(ct_len), tag::binary-size(tag_length)>> = bytes
150+
<<ct::binary-size(^ct_len), tag::binary-size(^tag_length)>> = bytes
151151

152152
case :crypto.crypto_one_time_aead(aes_gcm_algo(key), key, iv, ct, aad, tag, false) do
153153
:error -> raise "Decryption failed"

lib/quickbeam/wasm/import_rewriter.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ defmodule QuickBEAM.WASM.ImportRewriter do
248248
defp parse_sections(<<id, rest::binary>>, acc) do
249249
with {size, rest} <- decode_u32(rest),
250250
true <- byte_size(rest) >= size,
251-
<<payload::binary-size(size), tail::binary>> <- rest do
251+
<<payload::binary-size(^size), tail::binary>> <- rest do
252252
parse_sections(tail, [{id, payload} | acc])
253253
else
254254
_ -> {:error, "truncated WASM section"}
@@ -314,23 +314,23 @@ defmodule QuickBEAM.WASM.ImportRewriter do
314314
defp take_limits_raw(<<0x00, rest::binary>> = data) do
315315
{_min, rest} = decode_u32(rest)
316316
consumed = byte_size(data) - byte_size(rest)
317-
<<raw::binary-size(consumed), tail::binary>> = data
317+
<<raw::binary-size(^consumed), tail::binary>> = data
318318
{raw, tail}
319319
end
320320

321321
defp take_limits_raw(<<0x01, rest::binary>> = data) do
322322
{_min, rest} = decode_u32(rest)
323323
{_max, rest} = decode_u32(rest)
324324
consumed = byte_size(data) - byte_size(rest)
325-
<<raw::binary-size(consumed), tail::binary>> = data
325+
<<raw::binary-size(^consumed), tail::binary>> = data
326326
{raw, tail}
327327
end
328328

329329
defp take_global_raw(<<_type, _mutable, rest::binary>> = data) do
330330
case :binary.match(rest, <<0x0B>>) do
331331
{expr_size, 1} ->
332332
raw_size = 2 + expr_size + 1
333-
<<raw::binary-size(raw_size), tail::binary>> = data
333+
<<raw::binary-size(^raw_size), tail::binary>> = data
334334
{raw, tail}
335335

336336
:nomatch ->

lib/quickbeam/wasm/parser.ex

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ defmodule QuickBEAM.WASM.Parser do
4848

4949
defp parse_sections(<<id, rest::binary>>, mod) do
5050
{size, rest} = decode_u32(rest)
51-
<<section_data::binary-size(size), rest::binary>> = rest
51+
<<section_data::binary-size(^size), rest::binary>> = rest
5252

5353
mod = parse_section(id, section_data, mod)
5454
parse_sections(rest, mod)
@@ -181,7 +181,7 @@ defmodule QuickBEAM.WASM.Parser do
181181

182182
defp parse_name_subsections(<<id, rest::binary>>, names) do
183183
{size, rest} = decode_u32(rest)
184-
<<subsection::binary-size(size), rest::binary>> = rest
184+
<<subsection::binary-size(^size), rest::binary>> = rest
185185

186186
names =
187187
case id do
@@ -382,29 +382,29 @@ defmodule QuickBEAM.WASM.Parser do
382382
defp decode_data_segment(<<0x00, rest::binary>>) do
383383
{offset, rest} = decode_expr(rest)
384384
{size, rest} = decode_u32(rest)
385-
<<bytes::binary-size(size), rest::binary>> = rest
385+
<<bytes::binary-size(^size), rest::binary>> = rest
386386
{%{memory_idx: 0, offset: offset, bytes: bytes}, rest}
387387
end
388388

389389
defp decode_data_segment(<<0x01, rest::binary>>) do
390390
{size, rest} = decode_u32(rest)
391-
<<bytes::binary-size(size), rest::binary>> = rest
391+
<<bytes::binary-size(^size), rest::binary>> = rest
392392
{%{memory_idx: nil, offset: nil, bytes: bytes}, rest}
393393
end
394394

395395
defp decode_data_segment(<<0x02, rest::binary>>) do
396396
{mem_idx, rest} = decode_u32(rest)
397397
{offset, rest} = decode_expr(rest)
398398
{size, rest} = decode_u32(rest)
399-
<<bytes::binary-size(size), rest::binary>> = rest
399+
<<bytes::binary-size(^size), rest::binary>> = rest
400400
{%{memory_idx: mem_idx, offset: offset, bytes: bytes}, rest}
401401
end
402402

403403
# ── Code body decoder ──────────────────────────────────
404404

405405
defp decode_code_body(data) do
406406
{body_size, data} = decode_u32(data)
407-
<<body::binary-size(body_size), rest::binary>> = data
407+
<<body::binary-size(^body_size), rest::binary>> = data
408408
{locals, body} = decode_locals(body)
409409
opcodes = decode_instructions(body)
410410
{{locals, opcodes}, rest}
@@ -928,7 +928,7 @@ defmodule QuickBEAM.WASM.Parser do
928928

929929
defp decode_name(data) do
930930
{len, data} = decode_u32(data)
931-
<<name::binary-size(len), data::binary>> = data
931+
<<name::binary-size(^len), data::binary>> = data
932932
{name, data}
933933
end
934934
end

lib/quickbeam/web_socket.ex

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,6 @@ defmodule QuickBEAM.WebSocket do
281281

282282
# -- Close / send --
283283

284-
defp do_close(%{websocket: nil} = state, _code, _reason), do: {:ok, state}
285-
286284
defp do_close(state, code, reason) do
287285
frame = if code == 1000 and reason == "", do: :close, else: {:close, code, reason}
288286

mix.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
defmodule QuickBEAM.MixProject do
22
use Mix.Project
33

4-
@version "0.10.16"
4+
@version "0.10.17"
55

66
@source_url "https://github.com/elixir-volt/quickbeam"
77

@@ -70,7 +70,7 @@ defmodule QuickBEAM.MixProject do
7070
{:ex_dna, "~> 1.1", only: [:dev, :test], runtime: false},
7171
{:ex_slop, "~> 0.2", only: [:dev, :test], runtime: false},
7272
{:jason, "~> 1.4"},
73-
{:oxc, "~> 0.16.0"},
73+
{:oxc, "~> 0.17.0"},
7474
{:npm, "~> 0.7.4", optional: true},
7575
{:mint_web_socket, "~> 1.0"},
7676
{:nimble_pool, "~> 1.1"},

mix.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
"nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"},
2828
"npm": {:hex, :npm, "0.7.4", "a8cc2e760a30789e6b590257cfae9384fd1de470dab8ef62a7b35859587f34b7", [:mix], [{:hex_solver, "~> 0.2", [hex: :hex_solver, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:npm_semver, "~> 0.1.0", [hex: :npm_semver, repo: "hexpm", optional: false]}, {:req, "~> 0.5", [hex: :req, repo: "hexpm", optional: false]}], "hexpm", "ee265d380c19dbb9d1bba50458e1938711569a195423e6cfbf9ef7c3b8d7658a"},
2929
"npm_semver": {:hex, :npm_semver, "0.1.0", "3ab2c2a151d8c87c364209b2ca1a4fd2ab98507ed61afbd1ea12c1826e67200a", [:mix], [{:hex_solver, "~> 0.2", [hex: :hex_solver, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "77afbc4c523c19a572325190bc4c968ec027e1c6ef8538bcddacf835966072fa"},
30-
"oxc": {:hex, :oxc, "0.16.0", "2ded8e2aa0313107d22efad05cf75eabe39f6a35ce3a03fa8b4de1b0997f3614", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:rustler, "~> 0.36", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "25cdedc3b51d2e33ec4b8137aab8e993aa8dc133bf58a7ab5994438dfd527b1a"},
30+
"oxc": {:hex, :oxc, "0.17.0", "23f6bd5b1f0915dcc20ab9b5261b84f624edad76db153ef4c3f9fa67b9bd2bec", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:rustler, "~> 0.36", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "b53d1b5287936a775df94e7cdc4bb39f46da9b3a3d74d0e30edd6a5f95dfdba7"},
3131
"pegasus": {:hex, :pegasus, "0.2.6", "b4af6522326fbb2ffd1bb706e78ec05854fbcb4b03a7fe08f8db2e9de1d0be67", [:mix], [{:nimble_parsec, "~> 1.2", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0ac159f0ccab7967cf90208327cc8a35788874814c8d78e19d47104d3fc049b9"},
3232
"plug": {:hex, :plug, "1.19.2", "e4950525b22c6789dfb38a3f95d47171ba159da3fc5a33be9643b43d5e8adb98", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b6fce20a56af5e60fa5dfecf3f907bb98ec981be43c79a3809a499bc3d133de0"},
3333
"plug_crypto": {:hex, :plug_crypto, "2.1.1", "19bda8184399cb24afa10be734f84a16ea0a2bc65054e23a62bb10f06bc89491", [:mix], [], "hexpm", "6470bce6ffe41c8bd497612ffde1a7e4af67f36a15eea5f921af71cf3e11247c"},
3434
"protoss": {:hex, :protoss, "1.1.0", "853533313989751c7da5b0e1ce71501a23f3dc41f128709478af40daccc6e959", [:mix], [], "hexpm", "c2f874383dd047fcfdf467b814dd33a208a4d24a467aef90d86185b41a0752ad"},
3535
"quickjs_ex": {:hex, :quickjs_ex, "0.3.1", "4357d7636a2f811ed879ae4cd6a47b3b24125a794238c1838307ebb61343d1c2", [:mix], [{:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.8", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "e49dc454b2e2e527742c576b57cc19a1da857e62fdbd377725aae44bad585e46"},
3636
"req": {:hex, :req, "0.5.17", "0096ddd5b0ed6f576a03dde4b158a0c727215b15d2795e59e0916c6971066ede", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.17", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "0b8bc6ffdfebbc07968e59d3ff96d52f2202d0536f10fef4dc11dc02a2a43e39"},
37-
"rustler": {:hex, :rustler, "0.37.3", "5f4e6634d43b26f0a69834dd1d3ed4e1710b022a053bf4a670220c9540c92602", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "a6872c6f53dcf00486d1e7f9e046e20e01bf1654bdacc4193016c2e8002b32a2"},
37+
"rustler": {:hex, :rustler, "0.38.0", "7a8906998ff0d28e3021c0a73264abcda719bda344b2e58307c6805b0f87c9b4", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "704c03c1bf66be12b031c5a389347b91c81c5cb819a24b068b0de36fe4a5652a"},
3838
"rustler_precompiled": {:hex, :rustler_precompiled, "0.9.0", "3a052eda09f3d2436364645cc1f13279cf95db310eb0c17b0d8f25484b233aa0", [:mix], [{:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: true]}], "hexpm", "471d97315bd3bf7b64623418b3693eedd8e47de3d1cb79a0ac8f9da7d770d94c"},
3939
"statistex": {:hex, :statistex, "1.1.0", "7fec1eb2f580a0d2c1a05ed27396a084ab064a40cfc84246dbfb0c72a5c761e5", [:mix], [], "hexpm", "f5950ea26ad43246ba2cce54324ac394a4e7408fdcf98b8e230f503a0cba9cf5"},
4040
"telemetry": {:hex, :telemetry, "1.4.2", "a0cb522801dffb1c49fe6e30561badffc7b6d0e180db1300df759faa22062855", [:rebar3], [], "hexpm", "928f6495066506077862c0d1646609eed891a4326bee3126ba54b60af61febb1"},

0 commit comments

Comments
 (0)