Figure out a consistent globbing strategy
See original GitHub issueDescribe the problem
In #2247, we switched to using micromatch
(from globrex
) to determine which files are included/excluded when creating packages. But we’re still using globrex
via tiny-glob
here: https://github.com/sveltejs/kit/blob/aad27f4ed3a2a57f68c6cb55076b9d3132bcbaac/packages/kit/src/core/create_manifest_data/index.js#L50-L58
As a result, our inclusion/exclusion logic is inconsistent, and we’re bundling two libraries with overlapping functionality.
Describe the proposed solution
Personally I’d love to not use micromatch. It’s a very big library for constructing regexes. If we do need to provide the extra flexibility, then should we take a leaf out of uvu’s book and just accept regexes in the first place?
export default {
kit: {
package: {
exports: {
exclude: /^internal/
}
}
}
};
Alternatives considered
Instead of regexes, a function?
export default {
kit: {
package: {
exports: file => !file.startsWith('internal')
}
}
};
Importance
nice to have
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
glob-matching · GitHub Topics
Introduction to "globbing" or glob matching, a programming concept that allows "filepath expansion" and matching using wildcards. bash pattern guide regex glob ......
Read more >c# - glob pattern matching in .NET - Stack Overflow
My goal was to produce a library for .NET, with minimal dependencies, that doesn't use Regex, and outperforms Regex. You can find it...
Read more >glob - Rust - Docs.rs
API documentation for the Rust `glob` crate. ... For consistency across platforms, and for Windows support, this module is implemented entirely in Rust ......
Read more >Excel Wildcard Characters - Why Aren't You Using These?
To clean this data and make it consistent, we can use Find and Replace with Excel wildcard characters. Here is how to do...
Read more >micromatch - npm
Glob matching for javascript/node.js. A replacement and faster ... It's important to us that micromatch work consistently on all platforms.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Online docs could show some examples how to do basic exclusions and globbing with some battle tested library.
I can get behind using a function for exclusions, though it does make some simple things slightly more complicated. It also makes the method of matching very explicit for the developer, which is good. Globbing, for instance, is not always consistent between flavours/options.
@jiv-e GitHub pro tip: if you write the language name (e.g
javascript
) just after the opening triple backtick you get syntax highlighting!This: ```javascript const something = ‘a string’; ``` becomes:
makes it a little easier to read 😄
I haven’t tested your suggestion either, but it looks reasonable I think?