From 6ee4084982c511d6fa9083da2e533a25231b82d6 Mon Sep 17 00:00:00 2001 From: ziebam Date: Sun, 8 Sep 2024 23:16:18 +0200 Subject: [PATCH 1/8] Replace `fast-glob` with `tinyglobby` `tinyglobby` uses `picomatch` under the hood which default to case-sensitive matching. Not sure what are the performance implications of performing such matching on Unix systems, but in case we want to preserve the distinction, an update in `tinyglobby` would be needed to expose the underlying `picomatch` options or add a new top-level one that'd control the `nocase` flag. --- index.js | 6 ++---- package.json | 7 ++++--- pnpm-lock.yaml | 33 ++++++++++++++++++++++++++++++--- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index a90e84e..74d200c 100644 --- a/index.js +++ b/index.js @@ -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] @@ -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() diff --git a/package.json b/package.json index e3bc8bc..6341bfa 100644 --- a/package.json +++ b/package.json @@ -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", @@ -65,5 +65,6 @@ }, "clean-publish": { "cleanDocs": true - } + }, + "packageManager": "pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6aec2e9..54735c0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ importers: .: dependencies: - fast-glob: - specifier: ^3.3.2 - version: 3.3.2 postcss-js: specifier: ^4.0.1 version: 4.0.1(postcss@8.4.38) @@ -20,6 +17,9 @@ importers: sugarss: specifier: ^4.0.1 version: 4.0.1(postcss@8.4.38) + tinyglobby: + specifier: ^0.2.5 + version: 0.2.5 devDependencies: '@logux/eslint-config': specifier: ^53.0.1 @@ -574,6 +574,14 @@ packages: fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} + fdir@6.3.0: + resolution: {integrity: sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + file-entry-cache@6.0.1: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} @@ -960,6 +968,10 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + possible-typed-array-names@1.0.0: resolution: {integrity: sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q==} engines: {node: '>= 0.4'} @@ -1126,6 +1138,10 @@ packages: text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + tinyglobby@0.2.5: + resolution: {integrity: sha512-Dlqgt6h0QkoHttG53/WGADNh9QhcjCAIZMTERAVhdpmIBEejSuLI9ZmGKWzB7tweBjlk30+s/ofi4SLmBeTYhw==} + engines: {node: '>=12.0.0'} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -1938,6 +1954,10 @@ snapshots: dependencies: reusify: 1.0.4 + fdir@6.3.0(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 + file-entry-cache@6.0.1: dependencies: flat-cache: 3.2.0 @@ -2316,6 +2336,8 @@ snapshots: picomatch@2.3.1: {} + picomatch@4.0.2: {} + possible-typed-array-names@1.0.0: {} postcss-js@4.0.1(postcss@8.4.38): @@ -2477,6 +2499,11 @@ snapshots: text-table@0.2.0: {} + tinyglobby@0.2.5: + dependencies: + fdir: 6.3.0(picomatch@4.0.2) + picomatch: 4.0.2 + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 From 36726e92b451a199ee1951bb93bac99530a13a71 Mon Sep 17 00:00:00 2001 From: ziebam Date: Sun, 8 Sep 2024 23:21:55 +0200 Subject: [PATCH 2/8] Update the README after changing the glob provider --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d5f3fb8..6e4d634 100644 --- a/README.md +++ b/README.md @@ -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 From f79fe7bd07c9367bba5fa3ed5f6ed4be71538496 Mon Sep 17 00:00:00 2001 From: ziebam Date: Mon, 9 Sep 2024 00:02:10 +0200 Subject: [PATCH 3/8] Remove `packageManager` from `package.json` --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 6341bfa..78fbdcc 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,5 @@ }, "clean-publish": { "cleanDocs": true - }, - "packageManager": "pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1" + } } From 2d67dcdcd202452fc768f4fd854451828488c6e5 Mon Sep 17 00:00:00 2001 From: ziebam Date: Mon, 9 Sep 2024 00:42:53 +0200 Subject: [PATCH 4/8] Reorder the import --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index a20db11..6ee7f14 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,9 @@ -let { globSync } = require('tinyglobby') let { readFileSync } = require('node:fs') let { basename, extname, join, relative } = require('node:path') let { parse } = require('postcss-js') let vars = require('postcss-simple-vars') let sugarss = require('sugarss') +let { globSync } = require('tinyglobby') let MIXINS_GLOB = '*.{js,cjs,mjs,json,css,sss,pcss}' From 3fe07bc4b18708b2b570e6e2ab19fe8cfd659b07 Mon Sep 17 00:00:00 2001 From: ziebam Date: Mon, 9 Sep 2024 01:13:36 +0200 Subject: [PATCH 5/8] Bump `tinyglobby` --- package.json | 5 +++-- pnpm-lock.yaml | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index fbf426f..43418bf 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "postcss-js": "^4.0.1", "postcss-simple-vars": "^7.0.1", "sugarss": "^4.0.1", - "tinyglobby": "^0.2.5" + "tinyglobby": "^0.2.6" }, "devDependencies": { "@logux/eslint-config": "^53.4.0", @@ -65,5 +65,6 @@ }, "clean-publish": { "cleanDocs": true - } + }, + "packageManager": "pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db1dfc7..fb62d58 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,8 +18,8 @@ importers: specifier: ^4.0.1 version: 4.0.1(postcss@8.4.45) tinyglobby: - specifier: ^0.2.5 - version: 0.2.5 + specifier: ^0.2.6 + version: 0.2.6 devDependencies: '@logux/eslint-config': specifier: ^53.4.0 @@ -1107,8 +1107,8 @@ packages: text-table@0.2.0: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} - tinyglobby@0.2.5: - resolution: {integrity: sha512-Dlqgt6h0QkoHttG53/WGADNh9QhcjCAIZMTERAVhdpmIBEejSuLI9ZmGKWzB7tweBjlk30+s/ofi4SLmBeTYhw==} + tinyglobby@0.2.6: + resolution: {integrity: sha512-NbBoFBpqfcgd1tCiO8Lkfdk+xrA7mlLR9zgvZcZWQQwU63XAfUePyd6wZBaU93Hqw347lHnwFzttAkemHzzz4g==} engines: {node: '>=12.0.0'} to-regex-range@5.0.1: @@ -2388,7 +2388,7 @@ snapshots: text-table@0.2.0: {} - tinyglobby@0.2.5: + tinyglobby@0.2.6: dependencies: fdir: 6.3.0(picomatch@4.0.2) picomatch: 4.0.2 From ad12e2fcc273229ca9e53da0c5a62757c88222ef Mon Sep 17 00:00:00 2001 From: ziebam Date: Mon, 9 Sep 2024 01:13:45 +0200 Subject: [PATCH 6/8] Fix test failures in CI and on Windows --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6ee7f14..d390aee 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ let { readFileSync } = require('node:fs') +let { platform } = require('node:os') let { basename, extname, join, relative } = require('node:path') let { parse } = require('postcss-js') let vars = require('postcss-simple-vars') @@ -6,6 +7,7 @@ let sugarss = require('sugarss') 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] @@ -46,7 +48,7 @@ function processModulesForHotReloadRecursively(module, helpers) { function loadGlobalMixin(helpers, globs) { let cwd = process.cwd() - let files = globSync(globs) + let files = globSync(globs, { caseSensitiveMatch: !IS_WIN }) let mixins = {} files.forEach(i => { let ext = extname(i).toLowerCase() From ed161f275f1d0d949a80dd9296d7731c4800f1bf Mon Sep 17 00:00:00 2001 From: ziebam Date: Mon, 9 Sep 2024 01:18:28 +0200 Subject: [PATCH 7/8] Always match case-insensitively --- index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.js b/index.js index d390aee..2eaf9d4 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,4 @@ let { readFileSync } = require('node:fs') -let { platform } = require('node:os') let { basename, extname, join, relative } = require('node:path') let { parse } = require('postcss-js') let vars = require('postcss-simple-vars') @@ -7,7 +6,6 @@ let sugarss = require('sugarss') 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] @@ -48,7 +46,7 @@ function processModulesForHotReloadRecursively(module, helpers) { function loadGlobalMixin(helpers, globs) { let cwd = process.cwd() - let files = globSync(globs, { caseSensitiveMatch: !IS_WIN }) + let files = globSync(globs, { caseSensitiveMatch: false }) let mixins = {} files.forEach(i => { let ext = extname(i).toLowerCase() From d2b99c74a2c8bdb222412d4a657c07ae9b82a717 Mon Sep 17 00:00:00 2001 From: ziebam Date: Mon, 9 Sep 2024 01:29:20 +0200 Subject: [PATCH 8/8] Remove `packageManager` again (sorry) --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 43418bf..44bc5d7 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,5 @@ }, "clean-publish": { "cleanDocs": true - }, - "packageManager": "pnpm@9.9.0+sha512.60c18acd138bff695d339be6ad13f7e936eea6745660d4cc4a776d5247c540d0edee1a563695c183a66eb917ef88f2b4feb1fc25f32a7adcadc7aaf3438e99c1" + } }