Skip to content

Commit 0df2fca

Browse files
committed
fix: fix globby types resolution
closes google#779
1 parent d08be43 commit 0df2fca

File tree

5 files changed

+22
-15
lines changed

5 files changed

+22
-15
lines changed

src/goods.ts

-10
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import { type Duration, isString, parseDuration } from './util.js'
1919
import {
2020
chalk,
2121
minimist,
22-
globbyModule,
23-
GlobbyOptions,
2422
nodeFetch,
2523
RequestInfo,
2624
RequestInit,
@@ -35,14 +33,6 @@ export function updateArgv(args: string[]) {
3533
;(global as any).argv = argv
3634
}
3735

38-
export const globby = Object.assign(function globby(
39-
patterns: string | readonly string[],
40-
options?: GlobbyOptions
41-
) {
42-
return globbyModule.globby(patterns, options)
43-
}, globbyModule) as (typeof globbyModule)['globby'] & typeof globbyModule
44-
export const glob = globby
45-
4636
export function sleep(duration: Duration) {
4737
return new Promise((resolve) => {
4838
setTimeout(resolve, parseDuration(duration))

src/index.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ import { ProcessPromise } from './core.js'
1616

1717
export * from './core.js'
1818
export * from './goods.js'
19-
export { minimist, chalk, fs, which, YAML, ps } from './vendor.js'
19+
export {
20+
minimist,
21+
chalk,
22+
fs,
23+
which,
24+
YAML,
25+
ps,
26+
glob,
27+
glob as globby,
28+
} from './vendor.js'
2029

2130
export { type Duration, quote, quotePowerShell } from './util.js'
2231

src/vendor.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
import {
16+
convertPathToPattern,
1617
globby,
1718
globbySync,
1819
globbyStream,
@@ -21,7 +22,9 @@ import {
2122
isGitIgnoredSync,
2223
isGitIgnored,
2324
isDynamicPattern,
25+
type Options as GlobbyOptions,
2426
} from 'globby'
27+
2528
import * as yaml from 'yaml'
2629
import * as _fs from 'fs-extra'
2730
import type { fetch } from 'node-fetch-native'
@@ -33,6 +36,7 @@ export type RequestInfo = Parameters<typeof fetch>[0]
3336
export type RequestInit = Parameters<typeof fetch>[1]
3437

3538
export const globbyModule = {
39+
convertPathToPattern,
3640
globby,
3741
globbySync,
3842
globbyStream,
@@ -43,6 +47,13 @@ export const globbyModule = {
4347
isDynamicPattern,
4448
}
4549

50+
export const glob = Object.assign(function globby(
51+
patterns: string | readonly string[],
52+
options?: GlobbyOptions
53+
) {
54+
return globbyModule.globby(patterns, options)
55+
}, globbyModule) as (typeof globbyModule)['globby'] & typeof globbyModule
56+
4657
export const YAML: {
4758
parse(text: string): any
4859
stringify(object: any): string
@@ -51,7 +62,6 @@ export const YAML: {
5162
export const fs: typeof import('fs-extra') = _fs
5263

5364
export { depseekSync as depseek } from 'depseek'
54-
export { type Options as GlobbyOptions } from 'globby'
5565
export { default as chalk, type ChalkInstance } from 'chalk'
5666
export { default as which } from 'which'
5767
export { default as minimist } from 'minimist'

test-d/globals.test-d.ts

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import assert from 'node:assert'
1616
import { expectType } from 'tsd'
1717
import 'zx/globals'
1818

19-
glob
20-
2119
let p = $`cmd`
2220
assert(p instanceof ProcessPromise)
2321
expectType<ProcessPromise>(p)

test/fixtures/js-project/package-lock.json

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

0 commit comments

Comments
 (0)