diff --git a/README.md b/README.md index a245a19e..72ceb778 100644 --- a/README.md +++ b/README.md @@ -582,7 +582,7 @@ If you use Size Limit to track the size of CSS files, make sure to set inserts `style-loader` runtime (≈2 kB) into the bundle. [Statoscope docs]: https://github.com/statoscope/statoscope/tree/master/packages/webpack-plugin#optionsreports-report -[pattern]: https://github.com/sindresorhus/globby#globbing-patterns +[pattern]: https://github.com/SuperchupuDev/tinyglobby ## Analyze with `--why` diff --git a/fixtures/globby/a1.js b/fixtures/tinyglobby/a1.js similarity index 100% rename from fixtures/globby/a1.js rename to fixtures/tinyglobby/a1.js diff --git a/fixtures/globby/a2.js b/fixtures/tinyglobby/a2.js similarity index 100% rename from fixtures/globby/a2.js rename to fixtures/tinyglobby/a2.js diff --git a/fixtures/globby/b1.js b/fixtures/tinyglobby/b1.js similarity index 100% rename from fixtures/globby/b1.js rename to fixtures/tinyglobby/b1.js diff --git a/fixtures/globby/package.json b/fixtures/tinyglobby/package.json similarity index 100% rename from fixtures/globby/package.json rename to fixtures/tinyglobby/package.json diff --git a/packages/size-limit/get-config.js b/packages/size-limit/get-config.js index f55aeb0e..ca1cbb1c 100644 --- a/packages/size-limit/get-config.js +++ b/packages/size-limit/get-config.js @@ -1,9 +1,9 @@ import bytes from 'bytes-iec' -import { globby } from 'globby' import { lilconfig } from 'lilconfig' import { createRequire } from 'node:module' import { dirname, isAbsolute, join, relative } from 'node:path' import { fileURLToPath, pathToFileURL } from 'node:url' +import { glob } from 'tinyglobby' import { SizeLimitError } from './size-limit-error.js' @@ -154,7 +154,8 @@ export default async function getConfig(plugins, process, args, pkg) { result.config.map(async check => { let processed = { ...check } if (check.path) { - processed.files = await globby(check.path, { cwd: config.cwd }) + let patterns = Array.isArray(check.path) ? check.path : [check.path] + processed.files = await glob(patterns, { cwd: config.cwd }) } else if (!check.entry) { if (pkg.packageJson.main) { processed.files = [ diff --git a/packages/size-limit/index.d.ts b/packages/size-limit/index.d.ts index a58530cb..7c1bf9f9 100644 --- a/packages/size-limit/index.d.ts +++ b/packages/size-limit/index.d.ts @@ -74,7 +74,7 @@ export interface Check { /** * Relative paths to files. The only mandatory option. * It could be a path `"index.js"`, a - * {@link https://github.com/sindresorhus/globby#globbing-patterns pattern} + * {@link https://github.com/SuperchupuDev/tinyglobby pattern} * `"dist/app-*.js"` or an array * `["index.js", "dist/app-*.js", "!dist/app-exclude.js"]`. */ diff --git a/packages/size-limit/package.json b/packages/size-limit/package.json index af37ae7e..90bbf91a 100644 --- a/packages/size-limit/package.json +++ b/packages/size-limit/package.json @@ -26,11 +26,11 @@ "dependencies": { "bytes-iec": "^3.1.1", "chokidar": "^3.6.0", - "globby": "^14.0.1", "jiti": "^1.21.0", "lilconfig": "^3.1.1", "nanospinner": "^1.1.0", - "picocolors": "^1.0.1" + "picocolors": "^1.0.1", + "tinyglobby": "^0.2.6" }, "devDependencies": { "@size-limit/esbuild": "workspace:*", diff --git a/packages/size-limit/test/__snapshots__/run.test.js.snap b/packages/size-limit/test/__snapshots__/run.test.js.snap index 9bb7e6b4..d1563c66 100644 --- a/packages/size-limit/test/__snapshots__/run.test.js.snap +++ b/packages/size-limit/test/__snapshots__/run.test.js.snap @@ -369,9 +369,9 @@ exports[`supports import and ignore for esbuild and gzip 1`] = ` exports[`supports path without dot 1`] = ` " - Package size is 77 B less than limit + Package size is 73 B less than limit Size limit: 200 B - Size: 123 B with all dependencies, minified and brotlied + Size: 127 B with all dependencies, minified and brotlied " `; diff --git a/packages/size-limit/test/get-config.test.js b/packages/size-limit/test/get-config.test.js index fb627b1c..0b287cb1 100644 --- a/packages/size-limit/test/get-config.test.js +++ b/packages/size-limit/test/get-config.test.js @@ -54,23 +54,23 @@ it('creates config by CLI arguments', async () => { }) }) -it('supports globby and main field', async () => { - expect(await check('globby')).toEqual({ +it('supports tinyglobby and main field', async () => { + expect(await check('tinyglobby')).toEqual({ checks: [ { - files: [fixture('globby', 'a1.js'), fixture('globby', 'a2.js')], + files: [fixture('tinyglobby', 'a1.js'), fixture('tinyglobby', 'a2.js')], limit: '1 kB', name: 'a', path: ['a*.js'], sizeLimit: 1000 }, { - files: [fixture('globby', 'b1.js')], + files: [fixture('tinyglobby', 'b1.js')], name: 'b' } ], configPath: 'package.json', - cwd: fixture('globby') + cwd: fixture('tinyglobby') }) }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 34333d3f..1629fa3a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -163,9 +163,6 @@ importers: chokidar: specifier: ^3.6.0 version: 3.6.0 - globby: - specifier: ^14.0.1 - version: 14.0.1 jiti: specifier: ^1.21.0 version: 1.21.0 @@ -178,6 +175,9 @@ importers: picocolors: specifier: ^1.0.1 version: 1.0.1 + tinyglobby: + specifier: ^0.2.6 + version: 0.2.6 devDependencies: '@size-limit/esbuild': specifier: workspace:* @@ -607,6 +607,7 @@ packages: '@humanwhocodes/config-array@0.13.0': resolution: {integrity: sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==} engines: {node: '>=10.10.0'} + deprecated: Use @eslint/config-array instead '@humanwhocodes/module-importer@1.0.1': resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} @@ -614,6 +615,7 @@ packages: '@humanwhocodes/object-schema@2.0.3': resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} + deprecated: Use @eslint/object-schema instead '@humanwhocodes/retry@0.2.4': resolution: {integrity: sha512-Ttl/jHpxfS3st5sxwICYfk4pOH0WrLI1SpW283GgQL7sCWU7EHIOhX4b4fkIxr3tkfzwg8+FNojtzsIEE7Ecgg==} @@ -1724,6 +1726,14 @@ packages: fd-slicer@1.1.0: resolution: {integrity: sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==} + fdir@6.3.0: + resolution: {integrity: sha512-QOnuT+BOtivR77wYvCWHfGt9s4Pz1VIMbD463vegT5MLqNXy8rYFT/lPVEqf/bhYeT6qmqrNHhsX+rWwe3rOCQ==} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + file-entry-cache@8.0.0: resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} engines: {node: '>=16.0.0'} @@ -1815,6 +1825,7 @@ packages: glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Glob versions prior to v9 are no longer supported globals@14.0.0: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} @@ -1913,6 +1924,7 @@ packages: inflight@1.0.6: resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -2377,6 +2389,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'} + pkg-types@1.1.1: resolution: {integrity: sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==} @@ -2903,6 +2919,10 @@ packages: tinybench@2.8.0: resolution: {integrity: sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==} + tinyglobby@0.2.6: + resolution: {integrity: sha512-NbBoFBpqfcgd1tCiO8Lkfdk+xrA7mlLR9zgvZcZWQQwU63XAfUePyd6wZBaU93Hqw347lHnwFzttAkemHzzz4g==} + engines: {node: '>=12.0.0'} + tinypool@0.8.4: resolution: {integrity: sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==} engines: {node: '>=14.0.0'} @@ -4795,6 +4815,10 @@ snapshots: dependencies: pend: 1.2.0 + fdir@6.3.0(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 + file-entry-cache@8.0.0: dependencies: flat-cache: 4.0.1 @@ -5443,6 +5467,8 @@ snapshots: picomatch@2.3.1: {} + picomatch@4.0.2: {} + pkg-types@1.1.1: dependencies: confbox: 0.1.7 @@ -5998,6 +6024,11 @@ snapshots: tinybench@2.8.0: {} + tinyglobby@0.2.6: + dependencies: + fdir: 6.3.0(picomatch@4.0.2) + picomatch: 4.0.2 + tinypool@0.8.4: {} tinyspy@2.2.1: {}