Skip to content

v2.75.0: AdonisJS plugin + Glimmer multi-template + vitest auto-mock + Istanbul coverage fixes

Choose a tag to compare

@BartWaardenburg BartWaardenburg released this 16 May 08:45
· 1975 commits to main since this release
v2.75.0
195102a

Highlights

  • AdonisJS plugin (v5/v6/v7) ships under the framework category, taking the built-in plugin count from 94 to 95. Fallow now understands AdonisJS folder conventions, both rc shapes (.adonisrc.json and adonisrc.ts), the @ioc: virtual import prefix, and the assembler-hook arrays under defineConfig. Real-project validation on six AdonisJS playgrounds and starter kits cuts unused_files from 19/15/18/13/42/34 down to 2/0/0/0/3/1.
  • Three correctness fixes for Glimmer .gts parsing, vitest vi.mock() resolution, and Istanbul coverage matching on multiline typed async arrows.

Added

  • AdonisJS plugin (v5/v6/v7) added under the framework category. Covers controllers, models, middleware, validators, services, providers, preloads, commands, configs, contracts, database migrations / seeders / factories, the bootstrap files (server.{ts,js}, ace, bin/**/*.{ts,js}), the @ioc: virtual import prefix in v5, and the framework-managed peer packages that ship via the runtime container. resolve_config understands both rc shapes:

    • .adonisrc.json (v5): parses preloads, providers, commands, aceProviders (string and { file, environment } forms), aliases, metaFiles[].pattern, and types[].
    • adonisrc.ts (v6/v7): walks defineConfig({...}) for thunk-wrapped lazy imports plus the assembler hook arrays under hooks.*, applies directories.* overrides as entry patterns, and reads the project's package.json#imports for the resolver's path-alias table.

    Real-project validation (release build, total_issues / unused_files):

    Project Before After
    AdonisJS 6 playground (graphql) 68 / 42 17 / 3
    AdonisJS 6 playground (openapi) 55 / 34 14 / 1
    web-starter-kit 32 / 19 11 / 2
    api-starter-kit 27 / 15 9 / 0
    inertia-starter-kit 32 / 18 10 / 0
    slim-starter-kit 22 / 13 9 / 0

    Zero regression on zod, preact, vite, next.js. As part of the change, fallow-extract exposes three shared dynamic-import peel helpers (extract_import_expression, extract_import_from_return_body, extract_import_from_callable) so the v6/v7 rc parser and existing visitor sites share one canonical peel path. (PR #364. Thanks @AlphaLawless for the patch.)

Fixed

  • .gts files with multiple <template> blocks now extract imports and exports correctly. The Glimmer <template> stripper blanked every block to spaces, which works for class-body templates (an empty class body is valid) but produces const x = ; for module-level template expressions, a TypeScript syntax error that caused oxc to bail and drop every import in the file. Real Ember/Glimmer route templates that combine an inline TemplateOnlyComponent with a class-body template silently parsed as zero-edge files, and every component they referenced was reported as unused-file. The stripper now detects expression position (previous non-whitespace byte is =, ,, (, ?, or :) and replaces the block with a byte-length-preserving parenthesized template literal so the surrounding statement stays syntactically valid. Class-body templates retain the existing blank-out behavior. CACHE_VERSION bumped 77 to 78 so the fix takes effect on warm caches. (Closes #375. Thanks @ShockwaVee for the report.)

  • vi.mock() without a factory no longer surfaces a phantom unresolved-import pointing at a __mocks__/ path the user never wrote. Fallow synthesises a <dir>/__mocks__/<file> dynamic import next to every vi.mock('./foo') call so vitest's optional manual-mock convention credits the sibling when it does exist. When the sibling did NOT exist on disk, the synthesised path flowed through to unresolved-imports as if the user had typed it, producing findings like @/utils/__mocks__/exportElementAsPng for projects that rely on vitest's in-memory auto-mocking. The synthesised entry is now marked speculative and the resolver drops it silently when the target cannot be found; the credit path is unchanged (a __mocks__/<file> that DOES exist on disk is still credited as referenced). CACHE_VERSION bumped 76 to 77 so the change takes effect on warm caches. (Closes #377 and #378. Thanks @cloud-walker for the report.)

  • Istanbul --coverage now matches functions written as multiline typed async arrows. Istanbul producers (Jest, nyc, c8, babel-plugin-istanbul) are inconsistent about FnEntry.line: some emit the declaration line, others the body start. Fallow extracts function positions at the declaration, so multiline TS signatures like export const elementsFrom = async (...): Promise<T> => {...} lost their coverage match whenever the producer pointed line at the body. The loader now indexes both the producer's effective line and the declaration start as aliases so lookups by declaration position resolve through the exact and name-fuzzy paths, and the anonymous-by-position fallback is guarded by a column-distance cap so the new aliases never credit unrelated functions sitting above a multiline arrow. (Closes #370. Thanks @Guria for the report.)

Full Changelog: v2.74.0...v2.75.0