Skip to content

Investigate dependencies of 11ty #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
43081j opened this issue Mar 5, 2025 · 16 comments
Open

Investigate dependencies of 11ty #164

43081j opened this issue Mar 5, 2025 · 16 comments
Labels
umbrella issue This issue contains a list of dependents of a package and tracks the progress in each

Comments

@43081j
Copy link
Collaborator

43081j commented Mar 5, 2025

https://github.com/11ty/eleventy/blob/main/package.json

Zach seems happy to do some maintenance here, so we should take a look.

Obvious ones:

  • rimraf (already done)
  • fast-glob, is-glob, etc (replace with tinyglobby)
  • chokidar (part of Update chokidar to @4 #138 )
  • ava (big change - but vitest would be better)

We are going to track this in an equivalent umbrella issue inside the eleventy repo. So do not make individual issues unless Zach decides to pull one out of the umbrella to focus on.

@43081j 43081j added the umbrella issue This issue contains a list of dependents of a package and tracks the progress in each label Mar 5, 2025
@pralkarz
Copy link

pralkarz commented Mar 5, 2025

  • graceful-fs can most likely be replaced with node:fs in modern versions. Depends on how they're using it though.
  • micromatch -> picomatch for deduping with tinyglobby
  • p-map -> should probably be inlined

@Krinkle
Copy link

Krinkle commented Mar 6, 2025

chokidar

You may want to consider switching to node-watch by @yuanchuan. I did this for QUnit back in 2018 and it helped us reduce dependencies from 142 to 9.

https://qunitjs.com/blog/2019/01/06/qunit-2-9-0/

qunitjs/qunit#1342 (comment)

Before: QUnit 2.8.0 has 142 dependencies.

After: QUnit 2.9.1 has 9 dependencies.

Before After
qunit-28 qunit-29

Pull request: qunitjs/qunit#1345

@Fuzzyma
Copy link
Collaborator

Fuzzyma commented Mar 6, 2025

@Krinkle what is the advantage over choking v4? It doesn't seem to support globs only filters. And filters don't cut it when watching directories because they will filter out subdirs that don't match the glob (even tho they could have files that do match the glob)

@43081j
Copy link
Collaborator Author

43081j commented Mar 6, 2025

Note that chokidar currently has 1 dependency. Times have changed since you switched 👀

I'm biased since I maintain it but I would just stick with it and benefit from the de-dupe

@Krinkle
Copy link

Krinkle commented Mar 7, 2025

what is the advantage over [chokidar] v4? It doesn't seem to support globs only filters. And filters don't cut it when watching directories because they will filter out subdirs that don't match the glob (even tho they could have files that do match the glob)

@Fuzzyma Filtering out one result and recursively skipping an entire directory, are two different things. I haven't tried it recently, but the readme sounds like Chokidar made the same decision as node-watch. https://github.com/paulmillr/chokidar/tree/4.0.3 reads:

v4 is out! It […] removes support for globs, […]

... except node-watch does still support the optmization to skip subtrees when desired. This becomes less relevant over time, but it's there today.

Note that chokidar currently has 1 dependency. Times have changed since you switched […]

@43081j I'm glad Chokidar was able to make such a drastic change. That benefits a huge portion of the ecosystem. Very nice!

Ultimately, I suppose the key question for this issue is: What does Eleventy actually need?

@Fuzzyma
Copy link
Collaborator

Fuzzyma commented Mar 7, 2025

Chokidar v4 also allows filtering via ignore and it will filter out any subtree you want.

However, this is unfortunately not a replacement for globs as i experienced painfully.

Not shooting against node-watch here. Just wanted to make sure that the capabilities are understood :)

// Edit: actually looked at the docs now and it seems that node-watch allows to skip items more granualy than chokidar by returning false / "skip"

@43081j
Copy link
Collaborator Author

43081j commented Mar 7, 2025

Let's find out what 11ty currently uses chokidar for and go from there

There's still opportunity to add new functionality to chokidar but I suspect 11ty won't need that

@43081j
Copy link
Collaborator Author

43081j commented Mar 18, 2025

also note 11ty/eleventy#3360 so nobody duplicates that work (rimraf was also removed recently from recursive-copy)

@outslept
Copy link

11ty/eleventy#3715 👀

@zachleat
Copy link

Shipped both of these PRs: https://github.com/11ty/eleventy/releases/tag/v3.1.0-alpha.1

They’ll roll up with v3.1.0 stable!

@43081j
Copy link
Collaborator Author

43081j commented Apr 14, 2025

awesome, thanks for updating us @zachleat

if there's more to be done, it'd be nice to get things moving again on this.

e.g. there's 2 dependencies to generate slugs, maybe we can unify down to one

edit: seems you deprecated slug filter already. maybe we can remove that one day? 👀

@outslept
Copy link

What about those ones?

  1. @eslint/eslintrc - given the simplicity of the configuration, we can simply shave it off and use the modern flat config approach directly
  1. cross-env — after searching through the main repo, I couldn't find any actual usage; looks like it's safe to remove.
  1. marked — I noticed that marked is only used in test files; if its usage is not critical, it might be possible (assuming API compatibility) to migrate these test cases to markdown-it and remove marked as a dependency altogether.
  2. minimist — possibly could be replaced with mri

@43081j
Copy link
Collaborator Author

43081j commented Apr 15, 2025

  1. good shout, both plugins ship flat configs now I think (eslint and prettier). it'd be a good clean up for maintainers at least
  2. maybe this suggests we should add knip to the repo if it hasn't been already, to detect unused dependencies
  3. since its a dev dependency, it probably doesn't matter much but would improve install time for maintainers
  4. good idea, would be interested in seeing if this is an easy move

in particular, 1 and 4 seem like easy wins. maybe if you want to have a stab at them, open a draft PR for each and we can help you out?

@outslept
Copy link

outslept commented Apr 15, 2025

[eleventy-img]


[eleventy-dev-server]


[eleventy-import]


[eleventy-plugin-template-languages]


[eleventy-fetch]


[eleventy]


@outslept
Copy link

  1. maybe this suggests we should add knip to the repo if it hasn't been already, to detect unused dependencies

I think at first, if Zach is willing, he can try to use this module globally installed and then it can be integrated as a dev dependency

@zachleat
Copy link

Pending here, with a few initial suggestions from the tool: 11ty/eleventy#3757

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
umbrella issue This issue contains a list of dependents of a package and tracks the progress in each
Projects
None yet
Development

No branches or pull requests

6 participants