Skip to content

Commit 30abc59

Browse files
authored
chore(dynamic-import-vars): switch to tinyglobby for fewer dependencies (#1780)
1 parent 4a2358a commit 30abc59

File tree

4 files changed

+37
-10
lines changed

4 files changed

+37
-10
lines changed

packages/dynamic-import-vars/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
"@rollup/pluginutils": "^5.0.1",
6767
"astring": "^1.8.5",
6868
"estree-walker": "^2.0.2",
69-
"fast-glob": "^3.2.12",
70-
"magic-string": "^0.30.3"
69+
"magic-string": "^0.30.3",
70+
"tinyglobby": "^0.2.8"
7171
},
7272
"devDependencies": {
7373
"acorn": "^8.8.0",

packages/dynamic-import-vars/src/dynamic-import-to-glob.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22

3-
import fastGlob from 'fast-glob';
3+
import { escapePath } from 'tinyglobby';
44

55
export class VariableDynamicImportError extends Error {}
66

@@ -12,7 +12,7 @@ function sanitizeString(str) {
1212
if (str.includes('*')) {
1313
throw new VariableDynamicImportError('A dynamic import cannot contain * characters.');
1414
}
15-
return fastGlob.escapePath(str);
15+
return escapePath(str);
1616
}
1717

1818
function templateLiteralToGlob(node) {

packages/dynamic-import-vars/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'path';
22

33
import { walk } from 'estree-walker';
44
import MagicString from 'magic-string';
5-
import fastGlob from 'fast-glob';
5+
import { globSync } from 'tinyglobby';
66
import { generate } from 'astring';
77

88
import { createFilter } from '@rollup/pluginutils';
@@ -50,7 +50,7 @@ function dynamicImportVariables({ include, exclude, warnOnError, errorWhenNoFile
5050
}
5151

5252
// execute the glob
53-
const result = fastGlob.sync(glob, { cwd: path.dirname(id) });
53+
const result = globSync(glob, { cwd: path.dirname(id), expandDirectories: false });
5454
const paths = result.map((r) =>
5555
r.startsWith('./') || r.startsWith('../') ? r : `./${r}`
5656
);

pnpm-lock.yaml

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

0 commit comments

Comments
 (0)