Skip to content

Commit f50918d

Browse files
chore: switch from tiny-glob to tinyglobby (#93)
* chore: switch from tiny-glob to tinyglobby * try this * prettier * Update .changeset/small-emus-guess.md --------- Co-authored-by: Rich Harris <[email protected]> Co-authored-by: Rich Harris <[email protected]>
1 parent 7b5befe commit f50918d

File tree

7 files changed

+60
-48
lines changed

7 files changed

+60
-48
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/small-emus-guess.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'dts-buddy': patch
3+
---
4+
5+
feat: upgrade to tinyglobby

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,18 @@
1111
"dependencies": {
1212
"@jridgewell/source-map": "^0.3.5",
1313
"@jridgewell/sourcemap-codec": "^1.4.15",
14-
"globrex": "^0.1.2",
1514
"kleur": "^4.1.5",
1615
"locate-character": "^3.0.0",
1716
"magic-string": "^0.30.4",
1817
"sade": "^1.8.1",
19-
"tiny-glob": "^0.2.9",
18+
"tinyglobby": "^0.2.10",
2019
"ts-api-utils": "^1.0.3"
2120
},
2221
"peerDependencies": {
2322
"typescript": ">=5.0.4 <5.8"
2423
},
2524
"devDependencies": {
2625
"@changesets/cli": "^2.28.1",
27-
"@types/globrex": "^0.1.2",
2826
"@types/node": "^20.7.2",
2927
"@types/semver": "^7.5.3",
3028
"prettier": "^3.0.3",

pnpm-lock.yaml

Lines changed: 27 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/** @import { Binding, Declaration, Module, Namespace } from './types' */
22
import fs from 'node:fs';
33
import path from 'node:path';
4-
import glob from 'tiny-glob/sync.js';
5-
import globrex from 'globrex';
4+
import { globSync } from 'tinyglobby';
65
import ts from 'typescript';
76
import * as tsu from 'ts-api-utils';
87
import { getLocator } from 'locate-character';
@@ -158,10 +157,10 @@ export function get_input_files(cwd, include, exclude) {
158157
const included = new Set();
159158

160159
for (const pattern of include) {
161-
for (const file of glob(pattern, { cwd })) {
160+
for (const file of globSync(pattern, { cwd })) {
162161
const resolved = path.resolve(cwd, file);
163162
if (fs.statSync(resolved).isDirectory()) {
164-
for (const file of glob('**/*.{js,jsx,ts,tsx}', { cwd: resolved })) {
163+
for (const file of globSync('**/*.{js,jsx,ts,tsx}', { cwd: resolved, ignore: exclude })) {
165164
included.add(path.resolve(resolved, file));
166165
}
167166
} else {
@@ -170,14 +169,7 @@ export function get_input_files(cwd, include, exclude) {
170169
}
171170
}
172171

173-
let input = Array.from(included);
174-
175-
for (const pattern of exclude) {
176-
const { regex } = globrex(pattern, { globstar: true });
177-
input = input.filter((file) => !regex.test(file));
178-
}
179-
180-
return input.map((file) => path.resolve(file));
172+
return Array.from(included).map((file) => path.resolve(file));
181173
}
182174

183175
/**

test/test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs from 'node:fs';
2-
import glob from 'tiny-glob/sync.js';
2+
import { globSync } from 'tinyglobby';
33
import { test } from 'uvu';
44
import * as assert from 'uvu/assert';
55
import { createBundle } from '../src/index.js';
@@ -26,7 +26,7 @@ for (const sample of fs.readdirSync('test/samples')) {
2626
: {})
2727
};
2828

29-
for (const file of glob('**', { cwd: `${dir}/input`, filesOnly: true })) {
29+
for (const file of globSync('**', { cwd: `${dir}/input`, onlyFiles: true })) {
3030
const parts = file.split(/[\/\\]/);
3131
const basename = parts.pop();
3232

@@ -60,8 +60,8 @@ for (const sample of fs.readdirSync('test/samples')) {
6060
}
6161
}
6262

63-
const actual = glob('**', { cwd: `${dir}/actual`, filesOnly: true }).sort();
64-
const output = glob('**', { cwd: `${dir}/${output_dir}`, filesOnly: true }).sort();
63+
const actual = globSync('**', { cwd: `${dir}/actual`, onlyFiles: true }).sort();
64+
const output = globSync('**', { cwd: `${dir}/${output_dir}`, onlyFiles: true }).sort();
6565

6666
assert.equal(actual, output);
6767

0 commit comments

Comments
 (0)