Skip to content

Commit e2be678

Browse files
authored
Update to globby v12 (#87)
1 parent f2b3321 commit e2be678

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

glob-pattern.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'node:path';
22
import fs from 'node:fs';
3-
import glob from 'globby';
3+
import {globbySync, isDynamicPattern} from 'globby';
44
import junk from 'junk';
55

66
export default class GlobPattern {
@@ -16,7 +16,7 @@ export default class GlobPattern {
1616
this.options = options;
1717

1818
if (
19-
!glob.hasMagic(pattern)
19+
!isDynamicPattern(pattern)
2020
&& fs.existsSync(pattern)
2121
&& fs.lstatSync(pattern).isDirectory()
2222
) {
@@ -30,7 +30,7 @@ export default class GlobPattern {
3030

3131
get normalizedPath() {
3232
const segments = this.originalPath.split('/');
33-
const magicIndex = segments.findIndex(item => item ? glob.hasMagic(item) : false);
33+
const magicIndex = segments.findIndex(item => item ? isDynamicPattern(item) : false);
3434
const normalized = segments.slice(0, magicIndex).join('/');
3535

3636
if (normalized) {
@@ -41,11 +41,11 @@ export default class GlobPattern {
4141
}
4242

4343
hasMagic() {
44-
return glob.hasMagic(this.options.flat ? this.path : this.originalPath);
44+
return isDynamicPattern(this.options.flat ? this.path : this.originalPath);
4545
}
4646

4747
getMatches() {
48-
let matches = glob.sync(this.path, {
48+
let matches = globbySync(this.path, {
4949
...this.options,
5050
dot: true,
5151
absolute: true,

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {GlobbyOptions as GlobOptions} from 'globby';
1+
import {Options as GlobOptions} from 'globby';
22
import {Options as CpFileOptions} from 'cp-file';
33

44
export interface Entry {

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import pMap from 'p-map';
55
import arrify from 'arrify';
66
import cpFile from 'cp-file';
77
import pFilter from 'p-filter';
8-
import glob from 'globby';
8+
import {isDynamicPattern} from 'globby';
99
import CpyError from './cpy-error.js';
1010
import GlobPattern from './glob-pattern.js';
1111

@@ -162,7 +162,7 @@ export default function cpy(
162162
);
163163
}
164164

165-
if (matches.length === 0 && !glob.hasMagic(pattern.originalPath)) {
165+
if (matches.length === 0 && !isDynamicPattern(pattern.originalPath)) {
166166
throw new CpyError(
167167
`Cannot copy \`${pattern.originalPath}\`: the file doesn't exist`,
168168
);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"dependencies": {
4848
"arrify": "^3.0.0",
4949
"cp-file": "^9.1.0",
50-
"globby": "^11.0.4",
50+
"globby": "^12.0.0",
5151
"junk": "^3.1.0",
5252
"nested-error-stacks": "^2.1.0",
5353
"p-filter": "^2.1.0",
@@ -60,6 +60,6 @@
6060
"tempy": "^1.0.1",
6161
"tsd": "^0.17.0",
6262
"typescript": "^4.3.5",
63-
"xo": "^0.41.0"
63+
"xo": "^0.42.0"
6464
}
6565
}

0 commit comments

Comments
 (0)