Skip to main content

Module discover

Module discover 

Source
Expand description

Canonical source-file discovery for extensions and BDD step files.

Both hosts (the MCP server’s plugin loader and the BDD runner’s extension/step discovery) must agree on which file extensions count as loadable source and must walk directories the same way — otherwise a .tsx extension visible to the test runner is invisible to the MCP server, which is exactly the inconsistency this module removes.

Constants§

SOURCE_EXTENSIONS
Extensions rolldown can bundle as an ESM entry. Superset of what either host accepted before: .cts/.cjs/.tsx/.jsx/.mts/ .mjs are all valid rolldown entries, so all hosts accept them.

Functions§

is_source_file
True when path has a bundleable source extension.
walk_source_files
Recursively collect every source file under dir (sorted, stable). A non-directory or unreadable entry yields an empty result rather than an error — discovery is best-effort; the caller surfaces “no files found” once, with context.