Describe the problem
The following directory layout creates an endpoint for post.spec.js and post.md, and the only way to opt out is to make them private modules with an underscore/dot prefix:
src
└── routes
└── posts
├── post.md 👈 converted to endpoint!
├── post.spec.js 👈 converted to endpoint!
└── post.svelte
Some developers might require the exact layout/naming shown, where:
- The files are colocated
- The files have the same basename
Describe the proposed solution
Add a configuration option that excludes files.
For example, a kit.excludes config could accept an array of String, RegExp, or Function.
String - The basename of the file/directory is compared against the string, and it's excluded if matches.
RegExp - The basename of the file/directory is tested against the regular expression, and it's excluded if matches.
({ filepath, basename }) => boolean - The file/directory is excluded if the function returns true.
The default would be [^_.] to match the current behavior. This also would enable users to override the current behavior, allowing for underscore/dot-prefixed files to be included in routing.
Alternatives considered
- Use underscore/dot prefix to make the files private modules - Defeats requirement 1
- Store the files outside of
src/routes - Defeats requirement 2
Importance
nice to have
Additional Information
No response
Describe the problem
The following directory layout creates an endpoint for
post.spec.jsandpost.md, and the only way to opt out is to make them private modules with an underscore/dot prefix:Some developers might require the exact layout/naming shown, where:
Describe the proposed solution
Add a configuration option that excludes files.
For example, a
kit.excludesconfig could accept an array ofString,RegExp, orFunction.String- The basename of the file/directory is compared against the string, and it's excluded if matches.RegExp- The basename of the file/directory is tested against the regular expression, and it's excluded if matches.({ filepath, basename }) => boolean- The file/directory is excluded if the function returnstrue.The default would be
[^_.]to match the current behavior. This also would enable users to override the current behavior, allowing for underscore/dot-prefixed files to be included in routing.Alternatives considered
src/routes- Defeats requirement 2Importance
nice to have
Additional Information
No response