github erkamyaman/rust-anything v3.4.0

42 minutes ago
  • PowerShell units (#209). analyze reads .psm1 modules, .ps1 scripts and .psd1 manifests,
    follows Import-Module, using module and dot-sourced files, and adds notes on implicit output
    and array unrolling, case-insensitive comparison and implicit conversions. bridge takes the
    functions a module exports (Export-ModuleMember, wildcards included) with [string], integer,
    [double], [bool]/[switch], array, [hashtable] and untyped parameters, and writes
    ps/<crate>.ps1: each function with its original param() block, calling the Rust library
    through P/Invoke methods that Reflection.Emit declares at load time, so only pwsh 7.4+ is
    needed on Windows, macOS and Linux. Filters, begin/process blocks, pipeline input,
    [scriptblock], [ref], $PSCmdlet and other .NET types stay in PowerShell with the reason.
    record, diff, bench and gate run a generated pwsh driver; a result is what
    $r = f ... holds, and Write-Host, warnings and non-terminating errors are recorded as
    output. enable dot-sources the wrapper after the module's last function, so its own callers
    get Rust too; disable restores the file byte for byte. doctor checks pwsh, and profile
    says to time one pwsh start first. Each call costs about 0.1 ms of PowerShell-side encoding on
    an Apple M4, more with arrays and hashtables: a port pays off only for functions that do more
    work than that, and never for the start-up of a shell per command.
  • Generated JSON dispatchers read $num markers (NaN, the infinities, -0) inside an optional list
    of floats (Option<Vec<f64>>), which failed with "invalid type: map, expected f64".
  • doctor checks that PHP has the FFI extension loaded (php -m), not only PHP 8.0+
    (#240). When FFI is missing, the PHP line says so with how to enable or install it, and stays
    optional so the report does not fail.
  • profile says when the time goes to child processes, not code (#208). Time under Node's
    execSync, execFileSync and spawnSync, and under Python's subprocess calls and
    os.system, is a new "Child processes" section and a child_processes field in --json
    (command, file, line, function, ms, share; left out when empty), with the advice to keep one
    long-lived process open, batch the commands, or call the API directly; child_pct gives the
    total. A hot function that waits gets its own child_pct, and from half its time that advice
    instead of "port it"; go passes over such a function, says why when --function names it,
    and stops when waiting is half the run or more (--function still names a function that does
    not itself mostly wait). A function's child_pct counts only waits known to happen under it:
    a helper shared by several callers, or a recursive call, does not pass its waits to every
    caller. child_pct for the run also counts waits that no user function owns (a library's
    timer callback); Python waits count only in the interpreter's own subprocess and os
    modules, not a dependency's file of the same name; go looks past the 25 rows the report
    shows; an executable named on its own (execFileSync("/opt/My Tools/worker"), an argv list)
    is shown whole.
  • profile and go judge each hot exported function with the rules bridge applies. A hot
    function bridge keeps in the source language (one taking a callback, typed in TypeScript or
    in a sibling .d.ts; a Python generator) was advised as "port it", and go picked it and
    stopped with "every export ... must stay in TypeScript/JavaScript" (or Python). profile now
    says why bridge keeps it (a new js_only field in --json), and go passes over it to the
    next hot function that can cross, or says none can. go --function f names bridge's reason for
    such a function and, when two hot functions share the name, takes the one that can cross; the
    functions go leaves in the original keep bridge's own reason in rust-anything.json
    instead of "not hot in the profiled run"; profile reads and judges each hot file once.
  • Python ports can raise the original's own exception classes: Err("sqlparse.exceptions.SQLParseError: msg")
    imports sqlparse.exceptions and raises SQLParseError("msg"), and any built-in exception goes by
    its name (Err("FileNotFoundError: msg")), not only the twelve the bindings matched before. A
    name that is no Exception subclass still gives ValueError with the whole message. diff
    compares exception classes, so a library with its own error class could not match before;
    diff now keeps the original's packages importable (put first on sys.path as record does,
    not imported), as they are in the app.
  • bridge no longer refuses a Java, Kotlin or C# file because of an overloaded method. Every
    overload of a name is kept in the original (the bindings name each export by its name
    alone), but the duplicate-name check counted each kept overload, so the unit failed with "pad
    is defined twice ... rename one of them" while analyze listed it as ready. An overload set
    kept in the original is now one name in one file, also when --keep names it; other kept
    functions that share a name still fail the check. C# blocked only the later overloads and
    offered the first one for porting; it now keeps them all, as Java and Kotlin do, so analyze
    stops counting it as bridgeable, and it tells overloads apart by class: Json.Parse and
    Xml.Parse in one file are no longer called overloads (bridge still refuses them as one name
    defined twice). The same overloaded name in two files of one unit is still refused.
  • Fixes from new contributors, each with a test:
    • /* inside a // comment no longer hides the Gradle dependencies after it (#222 by @XiaoBinGan).
    • The second <script> block of a .vue, .svelte or .astro file keeps its line numbers (#259 by @XiaoBinGan).
    • A huge RUST_ANYTHING_COMMAND_TIMEOUT, RUST_ANYTHING_CASE_TIMEOUT or fuzz --time is rejected or ignored
      instead of panicking (#254, #278 by @XiaoBinGan).
    • The coverage line never rounds 999 of 1000 lines up to 100% (#283 by @XiaoBinGan).
    • The card and clean print values just under a unit boundary in the next unit, such as 1.0 ms, not
      1000.0 µs (#221, #253 by @XiaoBinGan).
    • Plans and record say "1 line", "1 unit", "1 case" and "1 export" (#282 by @XiaoBinGan, #284 by @tridev-tej).
    • A wasm port switches on through its wrapper (#205 by @XiaoBinGan), and a Python float subclass is recorded as its
      float value (#203 by @fullfud).
  • Docs: every CLI flag and MCP parameter is described, and --help no longer calls the tool TypeScript-only
    (#228, #236, #250, #258 by @XiaoBinGan); the FAQ names the two timeout variables (#230 by @Kiranpjk); CONTRIBUTING
    lists every test file and what CI installs (#232 by @XiaoBinGan, #244 by @MikeFTV); the Spanish, Italian, French
    and German READMEs describe the PHP and C# unit bridges (#234, #235, #251, #252, #276, #277 by @XiaoBinGan).
  • Thanks to @OnurrUgur (#206, #211, #212, #255), @fullfud (#203, #207), @XiaoBinGan, @tridev-tej, @ege-arhan (#224),
    @Kiranpjk and @MikeFTV: 32 contributions from 7 people since 3.3.0.

Don't miss a new rust-anything release

NewReleases is sending notifications on new releases.