Skip to content

Changelog

All notable changes to jscycles are listed here. The format follows Keep a Changelog, and the project uses Semantic Versioning (before 1.0, a minor version may break compatibility). Library and edge-case details are in the upgrade notes for 0.2 and 0.5.

  • jscycles::imports is split into jscycles::import (Import, ImportTarget, ExtractError) and jscycles::extract (ImportExtractor, ExtractionMode). Each error type is defined in the module that returns it; the crate root still re-exports them and the main types.
  • The Rust library API follows the Google Rust style guide’s API design rules for library code. This breaks library callers; the command and its JSON output are unchanged. The 0.5 upgrade notes list every change with its replacement. In short:
    • CycleDetector and PackageCycleDetector are replaced by functions in jscycles::cycles (file_cycles, package_cycles, and their try_ forms).
    • ScanReport::to_human and HumanFormatter::new take a ColorMode instead of a bool.
    • Workspace::get_package_path is now package_path.
    • TsConfig::discover reports a malformed nearest tsconfig.json as an error instead of returning None.
    • Config::extensions_for_package and ignore_for_package return borrowed slices.
    • The formatter traits are generic over the writer.
    • Public enums and result structs are #[non_exhaustive], with constructors for building them.
    • Builder setters are no longer const fn.
  • Config::load_or_default, which silently used defaults for an unreadable or invalid file. Use Config::try_load_or_default.
  • An embedding API: jscycles::Scan runs the complete analysis the command performs (discovery, workspaces, tsconfig aliases, package ownership and limits) and returns a ScanReport with the results, has_cycles(), the ignored tsconfig files, and the command’s JSON or human output. The command is now built on it, and a test checks that both give identical output. See embedding in Rust and the runnable check example.
  • A default cli feature for the command-line binary. Libraries can depend on jscycles with default-features = false and skip its argument parser.
  • Config, ScanConfig and DefaultsConfig implement Clone.
  • Package cycles no longer need a workspace. Every scanned package takes part, including the workspace root, packages that are not listed as workspace members, and repositories with several packages and no workspace configuration: an import that resolves to a file another package owns, by a relative path or a tsconfig alias, is an edge to that package. A loop through such packages was previously not reported. Bare names (@acme/core) are still package edges only for workspace members, since without a workspace they resolve through node_modules.

No change to analysis or output.

  • Release publishing to npm and crates.io runs from CI through trusted publishing, with no stored registry token. npm packages carry provenance.
  • The crate’s keywords are circular-imports and dependency-cycles (the 0.2.0 keyword was too long for crates.io, so 0.2.0 on crates.io was published from a commit that already contained this fix).

Many fixes in this release change which cycles are reported. Most reveal real cycles that 0.1 missed; some remove cycles 0.1 invented. Expect different results on the same repository, and compare before relying on them in CI.

  • npm distribution: npm install --save-dev jscycles installs the prebuilt binary for the current platform through optional dependencies, with no install script.
  • Linux release binaries are statically linked (musl), so they also run on Alpine and on distributions with an older glibc.
  • --skip-type-imports (and skip_type_imports in jscycles.yaml, globally or per package) leaves out imports TypeScript erases: import type, export type, type-position import(), and declaration files.
  • TypeScript extends arrays, and package bases resolved through exports, the tsconfig field or tsconfig.json, as TypeScript resolves them.
  • A warning on stderr when an automatically found tsconfig cannot be loaded, so path aliases no longer go missing silently.
  • A JSON Schema for jscycles.yaml (jscycles.schema.json) for editor completion and validation.
  • Resource limits under limits in jscycles.yaml (analysis limits).
  • Syntax errors name the file, line and column.
  • Package-cycle evidence (-v) shows the full imported specifier, such as (imports @myorg/utils/strings) instead of (imports /strings).
  • .mts, .cts, .mjs and .cjs files are scanned by default (the default extensions are now ts,tsx,mts,cts,js,jsx,mjs,cjs).
  • Each file belongs to its nearest package. A workspace root that is itself a package no longer repeats its members’ cycles.
  • Resolution follows TypeScript’s order, including declaration files and .jsx specifiers that prefer .tsx.
  • The parser is now WillBooster’s tree-sitter grammar forks, which accept valid syntax the upstream grammars rejected. A file with syntax errors stops the scan with exit status 2 rather than being analyzed partially.
  • Glob spellings such as ./x, x/ and absolute paths mean the same thing in scan.include, scan.exclude and ignore; on Windows .\x\ too.
  • Exclusions apply below the scanned directory only, so a checkout inside a build/ or node_modules/ directory (common in CI) is no longer skipped and reported clean.
  • Configuration, source and filesystem errors exit 2 instead of being ignored.
  • A scan that selects no package (no package.json with a name under the scanned paths, or none matching --only/--exclude) exits 2 instead of printing “No packages found.” and exiting 0, so a CI job started in the wrong directory no longer passes.
  • An import that resolves to a file in another workspace member, through a relative path (../../b/src/x) or a wildcard tsconfig alias, is a dependency on that member, as if imported by name. Cycles made of such imports were previously not reported. --outer now resolves imports to find them, so it reads tsconfig files too.
  • The human summary uses singular forms (“1 inter-package cycle”, “1 package”), and --inner uses the same wording as the default report.
  • Minimum supported Rust version is 1.93.0.
  • A UTF-8 byte-order mark in package.json, a tsconfig, jscycles.yaml, a source file or --stdin no longer fails the scan.
  • Directory specifiers (./dir/, ., ..) resolve only to the directory’s index file; a sibling dir.ts no longer creates invented cycles.
  • File symlinks are analyzed once, by the package that owns their target.
  • Workspace globs and include roots spelled with ./ no longer match nothing.
  • Windows: a paths target ending in / ("@x/*": ["src/*/"]) resolves the directory’s index, not a sibling <dir>.ts.
  • Windows: cycle members outside their package are shown as C:\..., not with the internal \\?\ prefix.
  • A jscycles.yaml parse error is shown on one line with its position and reason, instead of a source excerpt with literal \n sequences.
  • Faster workspace scanning and smaller, faster release builds.

Initial release.