Skip to content
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

Replace fast-glob with a lighter tinyglobby #165

Merged
merged 9 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ module.exports = {
Type: `string|string[]`

Similar to [`mixinsDir`](#mixinsdir); except, you can provide
[fast-glob](https://github.com/mrmlnc/fast-glob) syntax to target or not target
[tinyglobby](https://github.com/SuperchupuDev/tinyglobby) syntax to target or not target
specific files.

```js
Expand Down
6 changes: 2 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
let { basename, extname, join, relative } = require('node:path')
let { readFileSync } = require('node:fs')
let { platform } = require('node:os')
let { parse } = require('postcss-js')
let sugarss = require('sugarss')
let vars = require('postcss-simple-vars')
let glob = require('fast-glob')
let { globSync } = require('tinyglobby')

let MIXINS_GLOB = '*.{js,cjs,mjs,json,css,sss,pcss}'
let IS_WIN = platform().includes('win32')

function addMixin(helpers, mixins, rule, file) {
let name = rule.params.split(/\s/, 1)[0]
Expand Down Expand Up @@ -48,7 +46,7 @@ function processModulesForHotReloadRecursively(module, helpers) {

function loadGlobalMixin(helpers, globs) {
let cwd = process.cwd()
let files = glob.sync(globs, { caseSensitiveMatch: IS_WIN })
let files = globSync(globs)
let mixins = {}
files.forEach(i => {
let ext = extname(i).toLowerCase()
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"postcss": "^8.2.14"
},
"dependencies": {
"fast-glob": "^3.3.2",
"postcss-js": "^4.0.1",
"postcss-simple-vars": "^7.0.1",
"sugarss": "^4.0.1"
"sugarss": "^4.0.1",
"tinyglobby": "^0.2.5"
},
"devDependencies": {
"@logux/eslint-config": "^53.0.1",
Expand All @@ -65,5 +65,6 @@
},
"clean-publish": {
"cleanDocs": true
}
},
"packageManager": "[email protected]+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1"
ziebam marked this conversation as resolved.
Show resolved Hide resolved
}
33 changes: 30 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading