Skip to content

Commit 500b9c1

Browse files
deps: bump it-glob from 2.0.7 to 3.0.1 (#231)
Bumps [it-glob](https://github.com/achingbrain/it) from 2.0.7 to 3.0.1. - [Release notes](https://github.com/achingbrain/it/releases) - [Commits](achingbrain/it@it-glob-2.0.7...it-glob-3.0.1) --- updated-dependencies: - dependency-name: it-glob dependency-type: direct:production update-type: version-update:semver-major ... --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Alex Potsides <[email protected]>
1 parent 632bee3 commit 500b9c1

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
"iso-url": "^1.2.1",
168168
"it-all": "^3.0.4",
169169
"it-first": "^3.0.4",
170-
"it-glob": "^2.0.6",
170+
"it-glob": "^3.0.1",
171171
"it-last": "^3.0.4",
172172
"it-map": "^3.0.5",
173173
"it-peekable": "^3.0.3",

src/lib/glob-source.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import fs from 'node:fs'
22
import fsp from 'node:fs/promises'
3+
import os from 'node:os'
34
import Path from 'node:path'
45
import { CodeError } from '@libp2p/interface'
56
import glob from 'it-glob'
67
import type { MtimeLike } from 'ipfs-unixfs'
8+
import type { Options as GlobOptions } from 'it-glob'
79

810
export interface GlobSourceOptions {
911
/**
@@ -58,15 +60,23 @@ export async function * globSource (cwd: string, pattern: string, options?: Glob
5860
cwd = Path.resolve(process.cwd(), cwd)
5961
}
6062

61-
const globOptions = Object.assign({}, {
62-
nodir: false,
63-
realpath: false,
63+
if (os.platform() === 'win32') {
64+
cwd = toPosix(cwd)
65+
}
66+
67+
const globOptions: GlobOptions = Object.assign({}, {
68+
onlyFiles: false,
6469
absolute: true,
6570
dot: Boolean(options.hidden),
66-
follow: options.followSymlinks ?? true
67-
})
71+
followSymbolicLinks: options.followSymlinks ?? true
72+
} satisfies GlobOptions)
6873

6974
for await (const p of glob(cwd, pattern, globOptions)) {
75+
// Workaround for https://github.com/micromatch/micromatch/issues/251
76+
if (Path.basename(p).startsWith('.') && options.hidden !== true) {
77+
continue
78+
}
79+
7080
const stat = await fsp.stat(p)
7181

7282
let mode = options.mode
@@ -82,7 +92,7 @@ export async function * globSource (cwd: string, pattern: string, options?: Glob
8292
}
8393

8494
yield {
85-
path: toPosix(p.replace(cwd, '')),
95+
path: p.replace(cwd, ''),
8696
content: stat.isFile() ? fs.createReadStream(p) : undefined,
8797
mode,
8898
mtime

0 commit comments

Comments
 (0)