question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Figure out a consistent globbing strategy

See original GitHub issue

Describe 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jiv-ecommented, Sep 13, 2021

Online docs could show some examples how to do basic exclusions and globbing with some battle tested library.

1reaction
Karlinatorcommented, Sep 12, 2021

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:

const something = 'a string';

makes it a little easier to read 😄

I haven’t tested your suggestion either, but it looks reasonable I think?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found