Skip to content

Commit 58d9f37

Browse files
authored
Replace globby with tinyglobby (#372)
* Replace `globby` with `tinyglobby` * Update references in the README
1 parent 8d8bb51 commit 58d9f37

File tree

11 files changed

+48
-16
lines changed

11 files changed

+48
-16
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ If you use Size Limit to track the size of CSS files, make sure to set
582582
inserts `style-loader` runtime (≈2 kB) into the bundle.
583583
584584
[Statoscope docs]: https://github.com/statoscope/statoscope/tree/master/packages/webpack-plugin#optionsreports-report
585-
[pattern]: https://github.com/sindresorhus/globby#globbing-patterns
585+
[pattern]: https://github.com/SuperchupuDev/tinyglobby
586586
587587
## Analyze with `--why`
588588
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/size-limit/get-config.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import bytes from 'bytes-iec'
2-
import { globby } from 'globby'
32
import { lilconfig } from 'lilconfig'
43
import { createRequire } from 'node:module'
54
import { dirname, isAbsolute, join, relative } from 'node:path'
65
import { fileURLToPath, pathToFileURL } from 'node:url'
6+
import { glob } from 'tinyglobby'
77

88
import { SizeLimitError } from './size-limit-error.js'
99

@@ -154,7 +154,8 @@ export default async function getConfig(plugins, process, args, pkg) {
154154
result.config.map(async check => {
155155
let processed = { ...check }
156156
if (check.path) {
157-
processed.files = await globby(check.path, { cwd: config.cwd })
157+
let patterns = Array.isArray(check.path) ? check.path : [check.path]
158+
processed.files = await glob(patterns, { cwd: config.cwd })
158159
} else if (!check.entry) {
159160
if (pkg.packageJson.main) {
160161
processed.files = [

packages/size-limit/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export interface Check {
7474
/**
7575
* Relative paths to files. The only mandatory option.
7676
* It could be a path `"index.js"`, a
77-
* {@link https://github.com/sindresorhus/globby#globbing-patterns pattern}
77+
* {@link https://github.com/SuperchupuDev/tinyglobby pattern}
7878
* `"dist/app-*.js"` or an array
7979
* `["index.js", "dist/app-*.js", "!dist/app-exclude.js"]`.
8080
*/

packages/size-limit/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
"dependencies": {
2727
"bytes-iec": "^3.1.1",
2828
"chokidar": "^3.6.0",
29-
"globby": "^14.0.1",
3029
"jiti": "^1.21.0",
3130
"lilconfig": "^3.1.1",
3231
"nanospinner": "^1.1.0",
33-
"picocolors": "^1.0.1"
32+
"picocolors": "^1.0.1",
33+
"tinyglobby": "^0.2.6"
3434
},
3535
"devDependencies": {
3636
"@size-limit/esbuild": "workspace:*",

packages/size-limit/test/__snapshots__/run.test.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ exports[`supports import and ignore for esbuild and gzip 1`] = `
369369

370370
exports[`supports path without dot 1`] = `
371371
"
372-
[42m[30mPackage size is 77 B less than limit[39m[49m
372+
[42m[30mPackage size is 73 B less than limit[39m[49m
373373
Size limit: 200 B
374-
Size: [32m[1m123 B[22m[39m [90mwith all dependencies, minified and brotlied[39m
374+
Size: [32m[1m127 B[22m[39m [90mwith all dependencies, minified and brotlied[39m
375375
376376
"
377377
`;

packages/size-limit/test/get-config.test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ it('creates config by CLI arguments', async () => {
5454
})
5555
})
5656

57-
it('supports globby and main field', async () => {
58-
expect(await check('globby')).toEqual({
57+
it('supports tinyglobby and main field', async () => {
58+
expect(await check('tinyglobby')).toEqual({
5959
checks: [
6060
{
61-
files: [fixture('globby', 'a1.js'), fixture('globby', 'a2.js')],
61+
files: [fixture('tinyglobby', 'a1.js'), fixture('tinyglobby', 'a2.js')],
6262
limit: '1 kB',
6363
name: 'a',
6464
path: ['a*.js'],
6565
sizeLimit: 1000
6666
},
6767
{
68-
files: [fixture('globby', 'b1.js')],
68+
files: [fixture('tinyglobby', 'b1.js')],
6969
name: 'b'
7070
}
7171
],
7272
configPath: 'package.json',
73-
cwd: fixture('globby')
73+
cwd: fixture('tinyglobby')
7474
})
7575
})
7676

pnpm-lock.yaml

+34-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)