saropa_dart_utils changelog

Every saropa_dart_utils 2.x release, newest first. Tap a version to see its changes.

2.1.1

Locally built extension packages now include the scanner, so there is nothing to set up by hand. The Saropa Utils findings list now has its own icon in the Activity Bar instead of hiding inside the Explorer.

Fixed

  • Extension: local .vsix builds shipped without the scanner — extension/bin/<platform-arch>/ was only filled by the CI release workflow. vscode:prepublish now runs extension/scripts/bundle_scanner.py (npm run bundle-scanner), which compiles tool/scanner for the host platform and skips when a content hash of the scanner sources plus the dart --version text matches a sidecar .hash file next to the exe (mtime is no longer used, so deleted files and SDK upgrades trigger a rebuild). Covers npm run vsix* and the release script.
  • Extension: "Find opportunities" failed with Could not find package saropa_scan — the dart run saropa_scan:saropa_scan fallback ran in the workspace root, where the package cannot be resolved. With saropaUtils.scannerPath empty it now runs in <workspace>/tool/scanner when that folder has a pubspec.yaml (fallbackScannerCwd). If dart run still cannot find the package, the error now names the saropaUtils.scannerPath and saropaUtils.cli.path settings. The fallback folder is only used when its pubspec.yaml declares name: saropa_scan, so an unrelated tool/scanner package no longer hijacks the working directory.
  • Scanner: shared JSON readers jsonReq<T> / jsonOpt<T> (json_access.dart) — one lint-clean place for decoded-JSON map reads (require_null_safe_json_access). jsonReq checks containsKey then is T and throws a FormatException naming the key and actual type (was a bare TypeError); jsonOpt returns null on missing or wrong type. reverse_suggest.dart now uses jsonReq for its 17 former inline casts (replaces the private _req).
  • Scanner: all require_null_safe_json_access sites converted — every flagged literal-key m['k'] as T read across tool/scanner/lib now goes through the shared jsonReq/jsonOpt (map reads) or ArgResults.option()/.flag()/.multiOption() (CLI args). Behavior: a missing/mistyped required key now raises FormatException (was TypeError); config fields holding a wrong type fall back to their defaults instead of throwing; a CLI option with no value reads as an empty string instead of throwing.
  • Extension: every scanner command now shares one working-directory rule — "Find repeated code", fix, doctor, explain and exclude edits all pick the dart run folder through a single helper (resolveRunCwd), so none can drift from "Find opportunities". Installs built before this fix (such as the 2.1.0 VSIX) must be rebuilt and reinstalled to pick it up.
  • Extension: the scanner now sets itself up — when no scanner binary is bundled, on PATH or downloaded, the first scan in a trusted workspace asks "Set up scanner (compile from source shipped with the extension)?" and then compiles it with the local Dart SDK (dart pub get + dart compile exe) from <extension>/scanner-src, in a cancellable progress notification with a visible success or failure message. The binary is cached in extension storage (cli/built-<source hash>/) and rebuilt only when the bundled source changes; the answer is remembered per source. The build is tried before the GitHub download, so a missing scanner-v<version> release (404) no longer ends setup. When setup is impossible, the message names exactly what is missing (for example "Dart SDK not found on PATH") instead of failing with Could not find package saropa_scan. New handler saropaUtils.setupScanner re-runs setup and clears earlier "no" answers (pure logic in extension/src/cli/cli-build.ts, text in cli-setup-messages.ts via vscode.l10n.t).
  • Extension: security hardening of scanner build-from-source — a review of the first version found that an opened folder could influence what gets compiled and run. Now: (1) nothing is probed, offered or built until the workspace is trusted, and granting trust re-runs setup; (2) only the scanner source shipped inside the extension (<extension>/scanner-src) is ever built, never a workspace tool/scanner; when it is not bundled the message says "scanner source not bundled with this extension"; (3) the cache key is a SHA-256 of the source content (pubspec.yaml, pubspec.lock, lib/, bin/), so a same-version source with different code can neither reuse nor poison another build, and any source change rebuilds once; (4) the build runs in a private copy under extension storage, so nothing is written into a user repo or the extension folder; (5) each build uses its own random work dir and one atomic rename, and a finished build that another window may be running is never deleted; (6) consent is stored per source hash; (7) the compile output path is a short relative ASCII path, so a Flutter dart.bat accepts it even when the storage path has non-ASCII characters or (x86). Tests: extension/src/test/cli-build.test.ts, extension/src/test/cli-manager.test.ts.

Changed

  • Scanner: all int.parse/double.parse/DateTime.parse in tool/scanner/lib/src replaced with tryParse — (prefer_try_parse_for_dynamic_data). Rounding goes through one roundTo helper (src/round_to.dart); regex-matched digit groups skip/return null on overflow; ulf command options and corrupt lease/index JSON throw FormatException with a message; bench/corpus CLI args (bench/src/cli_args.dart) throw ArgumentError naming the flag and quoting the bad value, and their fallback applies only when the flag is absent. Valid input behaves as before.
  • CI: scanner source reaches the released VSIX — extension.yml and release-scanner.yml now run actions/setup-python before vsce package, so vscode:prepublish (python scripts/bundle_scanner.py) always runs and copies tool/scanner into extension/scanner-src even with SAROPA_SKIP_SCANNER_BUNDLE=1.
  • Extension: scanner source ships in the VSIX — bundle_scanner.py now always mirrors tool/scanner (pubspec.yaml, pubspec.lock, lib/, bin/) into extension/scanner-src (gitignored, included in the package), even when SAROPA_SKIP_SCANNER_BUNDLE=1 or no Dart SDK is present, so the extension can build the scanner from <extension>/scanner-src. assets/ is left out because the exe and source builds use the catalog embedded in lib/.
  • Extension: host-only exe bundling made explicit — bundle_scanner.py warns when tool/scanner has uncommitted changes (it builds the working tree), skips writing the host exe when SAROPA_VSCE_TARGET names a different platform, and prints which targets have no bundled exe. The vsce package steps in extension.yml and release-scanner.yml now set SAROPA_SKIP_SCANNER_BUNDLE=1, so the script docstring claim is true.
  • Extension: "Set Up Scanner" is now a declared command — saropaUtils.setupScanner (handler already existed) is contributed in package.json with title key command.setupScanner.title and sits in the findings view overflow menu (overflow@5), so the Command Palette and the view menu can re-run scanner setup. The manifest test now pins the Activity Bar container structure (viewsContainers.activitybar id saropaUtils, views.saropaUtils holds saropaUtils.findings) instead of the old Explorer placement.
  • Extension: more actions surfaced in the findings view — the empty-state welcome now offers Scan Workspace, Find opportunities, Find repeated code, Fix all safe, Check package versions, Open report and Open Settings (text in viewsWelcome.empty in package.nls.json). The view title bar now shows Scan Workspace, Find opportunities, Find repeated code and Fix all safe as icons ahead of Group by, Open report and Open Settings (navigation@1-@7). Overflow keeps Open HTML report, Refresh catalog, Show run log and Check package versions (overflow@1-@4). Rationale: scans were buried in overflow although they are the first thing a new user needs; package.json cannot hold comments, so the reasoning is recorded here. Each command already had a codicon, so no contributes.commands change.
  • Extension: findings view moved to its own Activity Bar container — saropaUtils.findings was a collapsed section under Explorer, easy to miss. It now lives in a dedicated saropaUtils container (contributes.viewsContainers.activitybar, title key viewContainer.saropaUtils.title, icon media/icon-activitybar.svg, a single-color currentColor SVG as the Activity Bar requires). The view keeps its id, name, saropaUtils.isDartProject gate and welcome text, so saropaUtils.findings.focus still works. "visibility": "collapsed" was dropped because a container's only view cannot be meaningfully collapsed.
2.1.0

Changelog links and the package homepage now point to saropa.com, and there is a new optional saropa_scan tool and "Saropa Utils" VS Code extension that find code you could replace with this library.

Added

  • Release script: the test step now runs only tests affected since the last release (full suite on config/helper/barrel changes or unmapped files), in parallel batches with live progress; new --full-tests and --test-workers N flags
  • Release script: never prompts (no input(), no [y/N], no retry/abort/ignore menus). A failing step is recorded and every independent step still runs; steps that depend on a failed one are skipped with the reason, and a final summary lists OK/WARN/FAILED/SKIPPED with exact re-run commands (exit code stays non-zero on any failure). Former prompts are now flags or automatic rules: --audit-only, --skip-audit, --strict-audit, --bump patch|minor|major, --allow-missing-intro. The "Saropa Utils" extension is built to one path, extension/saropa-utils-<version>.vsix (gitignored, printed in the output and summary), that exact file is published with vsce publish --packagePath, and the upload runs in parallel with the pub.dev wait (output prefixed [ext]) unless --skip-extension, so it may go live before pub.dev finishes; both results are reported separately
  • Extension: the README/CHANGELOG copy bundled in the extension drops SVG images from untrusted hosts (the coverage badge), which vsce package rejects; the root README keeps them
  • Release script: the documentation step skips dart doc when no doc input changed since the last successful run and shows live progress; new --full-docs flag
  • Optional saropa_scan tool in the repository (not part of the published package): finds hand-written code that a saropa_dart_utils call replaces, finds repeated code worth extracting (useful with or without this package), and applies fixes with undo. A companion VS Code extension, "Saropa Utils", shows both results and can suggest adding or upgrading saropa_dart_utils. See the README section "Finding opportunities with saropa_scan"
  • "Saropa Utils" VS Code extension now has its own store icon (a dart in a target, in the same style as the other Saropa extensions) and a matching sidebar glyph
  • "Saropa Utils" VS Code extension version now matches the package version (2.1.0), is kept equal by a manifest test, and no longer has its own README or changelog (its docs are the "VS Code extension" section of README.md and the Extension: entries here)
  • Extension: findings view in the Explorer (groupable by util member, rule, folder or kind) with two peer groups, "saropa_dart_utils opportunities" and "Repeated code"; Problems panel entries with quick fixes (replace, replace all in file or workspace for safe fixes, ignore a rule here); status bar (12 utils · 5 repeated); Report screen with two peer sections, filters, adoption trend and JSON, Markdown or CSV export; "Doctor" and "Explain This Finding"; "Add to Exclude List" and "Edit Exclude List"; scan on save for the saved file
  • Extension: version sync detects saropa_dart_utils in every pubspec (hosted, path, git, dev dependency, override, pub workspaces, melos) with the resolved version from pubspec.lock, compares it with the scanner catalog version, and offers "Add saropa_dart_utils" / "Upgrade to <version>" / "Not now" / "Don't ask again for this workspace" (once per session per workspace, trusted workspaces only; the exact dart/flutter pub command is shown in a modal and runs in a visible task terminal). Opt-in versionCheck.pubDev adds one cached daily pub.dev lookup; no telemetry
  • Extension: findings that need a newer saropa_dart_utils are marked "needs upgrade to >= x" and offer "Upgrade package then replace"
  • Extension: scanner discovery via cli.path, bundled platform binary, PATH, cached download, verified on-demand download (URL, size and SHA-256 shown; checked before first run), then dart run; one scan at a time per window, polite mode (--priority low --jobs auto --lock wait), exit code 75 backoff, scans wait while the machine is busy, child processes are killed as a group on cancel or window close
  • Extension: versioned API (apiVersion 1, with getUtilsVersionInfo() and optional needsUpgrade / root on findings) for other Saropa extensions; limited support for untrusted workspaces; settings cli.path, politeMode, scanOnSave.includeRepeatedCode, versionNudge.enabled, versionCheck.pubDev

Changed

  • Extension: renamed from "Saropa Dart Scanner" to "Saropa Utils" (id saropa.saropa-utils); commands, views, context keys and settings use the saropaUtils. prefix. Settings still written under saropaScanner.* are read as a fallback when the new key was never set (user settings only for machine-scoped keys); old command ids are not aliased
  • Extension: "Find opportunities to use saropa_dart_utils" is the first command, "Find repeated code" its peer, "Scan Workspace (both)" runs both; default grouping is by util member; scan on save runs only the fast utils scan (scanOnSave.includeRepeatedCode turns repeated-code analysis on); the Report leads with "N opportunities to use saropa_dart_utils"
  • Release [log] links in CHANGELOG.md and CHANGELOG_HISTORY.md open the saropa.com changelog pages instead of GitHub, and CHANGELOG.md links to the full release history
  • Package homepage is now https://saropa.com/developers/
  • allSettled, retryTimes, Base64Utils.compressText / decompressText and the JsonUtils decode helpers report failures through dart:developer log() with the error and stack trace attached, instead of printing them with debugPrint
  • README shows code-card screenshots for String, DateTime, List, Number, Map and Async, and its examples use the real toUnique() and AsyncSemaphoreUtils names
  • README examples use real API names (addNotNull, isCaseSensitive, intToHex(), firstCharacter(), CommonRandom) and correct output comments; every README code block was compiled and run

Fixed

  • Extension: activation no longer crashes in a real Extension Host (a variable was used before it was declared)
  • Extension (Windows): command paths such as C:\Program Files (x86)\... or containing %, !, ^, {} are accepted (no shell is used); the legacy dart fallback works under Flutter (dart.exe on PATH, then the Flutter SDK's dart.exe, else dart.bat through cmd.exe with every token allowlist-checked); the busy-machine check works (CPU usage is sampled, since os.loadavg() is always 0); process-tree kill uses taskkill /T /F; Path is found when the env var is not spelled PATH
  • Extension: exclude globs match case-insensitively on Windows and macOS; quick fixes insert text with the document's line ending (CRLF files no longer get bare LF); workspace-relative paths compare drive letters and case correctly on Windows
  • Extension: packaging scripts vsix:win32-x64, vsix:linux-x64, vsix:linux-arm64, vsix:darwin-x64, vsix:darwin-arm64 and vsix:universal
  • parseRrule rejects out-of-range UNTIL date or time fields with a FormatException instead of rolling over into a different date
  • timebox no longer leaks an unhandled async error on timeout or when the wrapped function throws

Security

  • Extension: changedSince, fix.git, fix.commitPer, fix.comment and cli.path are machine-scoped so a repository cannot set them; changedSince must be a plain git ref (no leading -) and is passed as --changed-since=<ref>, exclude globs as --exclude=<glob>, and a file path starting with - is prefixed with ./
2.0.0

The library now uses the material_ui package instead of flutter/material, so date range, time of day and color extensions accept material_ui types.

Added

  • String.preventOrphansLastGap({int minWrapChars = 4}): fuses only the last gap with a non-breaking space when the last word or the one before it is shorter than minWrapChars; preventOrphans is unchanged
  • StreamDebounceUtils: stream-based debounce transformer for event streams

Changed

  • Imports package:material_ui/material_ui.dart instead of package:flutter/material.dart; DateTimeRange, TimeOfDay, Color and MaterialColor extensions now use the material_ui types
  • Minimum Flutter is now 3.47.0 and minimum Dart is now 3.13.0

Breaking

  • Extensions no longer accept the types from package:flutter/material.dart; they take the material_ui types
  • Minimum Flutter 3.47.0 / Dart 3.13.0

Migration

  • Replace package:flutter/material.dart imports with package:material_ui/material_ui.dart and add material_ui: ^1.11.0 to your dependencies
  • Upgrade to Flutter 3.47.0+ / Dart 3.13.0+
  • Apps still on package:flutter/material.dart should stay on 1.6.x

Fixed

  • Suppressed 10 unused_result analyzer false positives where @useResult-annotated members are correctly consumed in compound boolean expressions (&&/||) but the Dart analyzer does not track usage through boolean operators
  • Updated VS Code dart.analysisExcludedFolders to include all folders listed in analysis_options.yaml excludes (.dart_tool, .github, .vscode, assets, build, example, scripts, tool) plus coverage and doc

Source: the saropa_dart_utils changelog on GitHub.

From the makers of Saropa Contacts

A private contacts manager with offline emergency info, free on Android and iPhone.