Skip to content

Add ignorePattern to FilesystemLoader - #977

Merged
parlough merged 5 commits into
schultek:mainfrom
muhammad-musa-ml:filesystem-loader-ignore-pattern
Nov 18, 2026
Merged

parlough merged 5 commits into
schultek:mainfrom
muhammad-musa-ml:filesystem-loader-ignore-pattern

Conversation

@muhammad-musa-ml

Copy link
Copy Markdown
Contributor

Description

Adds an ignorePattern option to FilesystemLoader (#789). A file is skipped when the pattern matches at the start of its path relative to the content directory, written with forward slashes (the convention keepSuffixPattern uses). For example, RegExp(r'(.*/)?README\.md$') skips every README.md.

  • It applies when files are loaded and when a file is added while serving.
  • An ignored file can still be read as a partial.
  • The second commit fixes a gap next to it: invalidateFile only acted on files that have a page source, so editing a partial excluded by filterExtensions or ignorePattern left the pages that read it stale until the next reload. It now invalidates them. It is a separate commit if you would rather split it out.

Tests are new cases in filesystem_loader_test.dart, in posix and Windows style. I ran them on Dart 3.12.2 (I don't have 3.13 here) in a trimmed workspace. On my Windows machine 8 existing tests in that file already fail on main, and 4 of my posix-style ones fail the same way, because the watcher test gets Windows-style paths. In a throwaway copy where the watcher uses p.posix, all 33 tests in the file pass. I haven't run them on Linux.

Not included: GithubLoader has no ignorePattern.

Fixes #789

Type of Change

  • ✨ New feature or improvement

Ready Checklist

  • I've read the Contribution Guide.
  • In case this PR changes one of the core packages, I've modified the respective CHANGELOG.md file using
    the semantic_changelog format.
  • I updated/added relevant documentation (doc comments with ///).
  • I added myself to the AUTHORS file (optional, if you want to).

A file is not loaded as a page when the pattern matches at the start of its
path. The path is relative to the content directory and uses forward slashes
on every platform. RegExp(r'(.*/)?README\.md$') skips every README.md and
RegExp(r'drafts/.*') skips the files below the top-level drafts folder.

loadPageSources and addFile both apply the pattern, so a file created while
serving does not become a page either. As with filterExtensions, an ignored
file can still be read as a partial, and adding one invalidates the pages
that read it, so they are rebuilt.

Refs schultek#789
invalidateFile only acted on files that have a page source, so editing a
partial excluded by filterExtensions or ignorePattern left the pages that
read it stale until the next reload. It now invalidates those pages, as
addFile and removeFile already do. Pages that did not read the partial are
left alone.

Refs schultek#789
Add the option to the FilesystemLoader entry of the route loading page, and
two lines to the jaspr_content changelog.

Refs schultek#789
@docs-page

docs-page Bot commented Nov 9, 2026

Copy link
Copy Markdown

To preview the documentation for this pull request, visit the following URL:

docs.jaspr.site/~977

Documentation is deployed and generated using docs.page

@schultek
schultek requested review from parlough and a balanced review from Copilot November 12, 2026 11:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues requiring changes to the filesystem path-filtering update.

No open issues 🎉

What changed in this PR

Adds configurable path filtering to FilesystemLoader, addressing #789 while keeping ignored files available as partials.

Changes:

  • Adds ignorePattern matching against forward-slash relative paths during initial loading and file-add events.
  • Fixes dependent-page invalidation when ignored or extension-filtered partials change.
  • Adds POSIX- and Windows-style tests, API documentation, and release notes.
File Description
packages/​jaspr_content/​test/​route_loaders/​filesystem_loader_test.dart Tests path filtering, watcher events, and partial dependency invalidation.
packages/​jaspr_content/​lib/​src/​route_loader/​filesystem_loader.dart Implements ignorePattern and invalidation for partials without page sources.
packages/​jaspr_content/​CHANGELOG.md Records the new option and partial invalidation fix.
docs/​content/​concepts/​route_loading.mdx Documents path filtering with a README exclusion example.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Package Version Report

The following packages have been updated:
jaspr_test : 0.24.0-beta.1 -> 0.24.0-beta.2
jaspr : 0.24.0-beta.1 -> 0.24.0-beta.2
jaspr_builder : 0.24.0-beta.1 -> 0.24.0-beta.2
jaspr_cli : 0.24.0-beta.1 -> 0.24.0-beta.2
jaspr_content : 0.6.0-beta.0 -> 0.6.0-beta.1

@schultek schultek left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Waiting for a review from @parlough as creator of the issue.

@parlough parlough left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this! Looks good to me.

@parlough
parlough merged commit b366224 into schultek:main Nov 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[content] Add more flexible mechanism for FilesystemLoader to ignore paths

4 participants