diff --git a/package.json b/package.json index cf14ed68..4093df60 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "rollup": "^4.22.4", "rollup-plugin-dts": "^6.1.1", "scule": "^1.3.0", + "tinyglobby": "^0.2.2", "ufo": "^1.5.4", "untyped": "^1.4.2" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6b9ccaf9..f3186bb9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -74,6 +74,9 @@ importers: scule: specifier: ^1.3.0 version: 1.3.0 + tinyglobby: + specifier: ^0.2.2 + version: 0.2.6 ufo: specifier: ^1.5.4 version: 1.5.4 @@ -1988,6 +1991,10 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + pkg-types@1.2.0: resolution: {integrity: sha512-+ifYuSSqOQ8CqP4MbZA5hDpb97n3E8SVWdJe+Wms9kj745lmd3b7EZJiqvmLwAlmRfjrI7Hi5z3kdBJ93lFNPA==} @@ -2373,6 +2380,10 @@ packages: tinyexec@0.3.0: resolution: {integrity: sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==} + tinyglobby@0.2.6: + resolution: {integrity: sha512-NbBoFBpqfcgd1tCiO8Lkfdk+xrA7mlLR9zgvZcZWQQwU63XAfUePyd6wZBaU93Hqw347lHnwFzttAkemHzzz4g==} + engines: {node: '>=12.0.0'} + tinypool@1.0.1: resolution: {integrity: sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==} engines: {node: ^18.0.0 || >=20.0.0} @@ -3877,6 +3888,10 @@ snapshots: optionalDependencies: picomatch: 2.3.1 + fdir@6.3.0(picomatch@4.0.2): + optionalDependencies: + picomatch: 4.0.2 + file-entry-cache@8.0.0: dependencies: flat-cache: 4.0.1 @@ -4374,6 +4389,8 @@ snapshots: picomatch@2.3.1: {} + picomatch@4.0.2: {} + pkg-types@1.2.0: dependencies: confbox: 0.1.7 @@ -4748,6 +4765,11 @@ snapshots: tinyexec@0.3.0: {} + tinyglobby@0.2.6: + dependencies: + fdir: 6.3.0(picomatch@4.0.2) + picomatch: 4.0.2 + tinypool@1.0.1: {} tinyrainbow@1.2.0: {} diff --git a/src/build.ts b/src/build.ts index 16f8e5a2..8a09b18c 100644 --- a/src/build.ts +++ b/src/build.ts @@ -8,7 +8,7 @@ import { consola } from "consola"; import { defu } from "defu"; import { createHooks } from "hookable"; import prettyBytes from "pretty-bytes"; -import fg from "fast-glob"; +import { glob } from "tinyglobby"; import type { RollupOptions } from "rollup"; import { dumpObject, rmdir, resolvePreset, removeExtension } from "./utils"; import type { BuildContext, BuildConfig, BuildOptions } from "./types"; @@ -289,7 +289,7 @@ async function _build( consola.success(colors.green("Build succeeded for " + options.name)); // Find all dist files and add missing entries as chunks - const outFiles = await fg("**", { cwd: options.outDir }); + const outFiles = await glob(["**"], { cwd: options.outDir }); for (const file of outFiles) { let entry = ctx.buildEntries.find((e) => e.path === file); if (!entry) { diff --git a/src/builders/copy/index.ts b/src/builders/copy/index.ts index fe75353b..4985a9eb 100644 --- a/src/builders/copy/index.ts +++ b/src/builders/copy/index.ts @@ -1,6 +1,6 @@ import { promises as fsp } from "node:fs"; import { relative, resolve } from "pathe"; -import fg from "fast-glob"; +import { glob } from "tinyglobby"; import { symlink, rmdir, warn } from "../../utils"; import type { CopyBuildEntry, BuildContext } from "../../types"; import consola from "consola"; @@ -18,7 +18,10 @@ export async function copyBuild(ctx: BuildContext): Promise { await rmdir(distDir); await symlink(entry.input, distDir); } else { - const paths = await fg(entry.pattern || ["**"], { + const patterns = Array.isArray(entry.pattern) + ? entry.pattern + : [entry.pattern || "**"]; + const paths = await glob(patterns, { cwd: resolve(ctx.options.rootDir, entry.input), absolute: false, });