Skip to content

Commit

Permalink
chore: switch to tinyglobby
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Feb 19, 2025
1 parent 4a57c82 commit 0458987
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
"escape-string-regexp": "^5.0.0",
"etag": "^1.8.1",
"fs-extra": "^11.3.0",
"globby": "^14.0.2",
"gzip-size": "^7.0.0",
"h3": "^1.15.0",
"hookable": "^5.5.3",
Expand Down Expand Up @@ -157,6 +156,7 @@
"serve-static": "^1.16.2",
"source-map": "^0.7.4",
"std-env": "^3.8.0",
"tinyglobby": "^0.2.11",
"ufo": "^1.5.4",
"ultrahtml": "^1.5.3",
"uncrypto": "^0.1.3",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/core/build/assets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { existsSync, promises as fsp } from "node:fs";
import { globby } from "globby";
import { glob } from "tinyglobby";
import { isDirectory, prettyPath } from "nitropack/kit";
import type { Nitro } from "nitropack/types";
import { join, relative, resolve } from "pathe";
Expand Down Expand Up @@ -31,7 +31,7 @@ export async function copyPublicAssets(nitro: Nitro) {
}),
].filter((p) => !PARENT_DIR_GLOB_RE.test(p));

const publicAssets = await globby(includePatterns, {
const publicAssets = await glob(includePatterns, {
cwd: srcDir,
absolute: false,
dot: true,
Expand Down
4 changes: 2 additions & 2 deletions src/core/scan.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { globby } from "globby";
import { glob } from "tinyglobby";
import type { Nitro } from "nitropack/types";
import { join, relative } from "pathe";
import { withBase, withLeadingSlash, withoutTrailingSlash } from "ufo";
Expand Down Expand Up @@ -156,7 +156,7 @@ async function scanDir(
dir: string,
name: string
): Promise<FileInfo[]> {
const fileNames = await globby(join(name, GLOB_SCAN_PATTERN), {
const fileNames = await glob(join(name, GLOB_SCAN_PATTERN), {
cwd: dir,
dot: true,
ignore: nitro.options.ignore,
Expand Down
4 changes: 2 additions & 2 deletions src/core/utils/compress.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { existsSync } from "node:fs";
import fsp from "node:fs/promises";
import zlib from "node:zlib";
import { globby } from "globby";
import { glob } from "tinyglobby";
import mime from "mime";
import type { Nitro } from "nitropack/types";
import { resolve } from "pathe";

export async function compressPublicAssets(nitro: Nitro) {
const publicFiles = await globby("**", {
const publicFiles = await glob("**", {
cwd: nitro.options.output.publicDir,
absolute: false,
dot: true,
Expand Down
4 changes: 2 additions & 2 deletions src/core/utils/fs-tree.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { promises as fsp } from "node:fs";
import { colors } from "consola/utils";
import { globby } from "globby";
import { glob } from "tinyglobby";
import { gzipSize } from "gzip-size";
import { dirname, relative, resolve } from "pathe";
import prettyBytes from "pretty-bytes";
Expand All @@ -15,7 +15,7 @@ export async function generateFSTree(
return;
}

const files = await globby("**/*.*", { cwd: dir, ignore: ["*.map"] });
const files = await glob("**/*.*", { cwd: dir, ignore: ["*.map"] });

const items: { file: string; path: string; size: number; gzip: number }[] =
[];
Expand Down
4 changes: 2 additions & 2 deletions src/presets/cloudflare/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { relative, dirname } from "node:path";
import { writeFile } from "nitropack/kit";
import { parseTOML } from "confbox";
import { defu } from "defu";
import { globby } from "globby";
import { glob } from "tinyglobby";
import { join, resolve } from "pathe";
import {
joinURL,
Expand Down Expand Up @@ -63,7 +63,7 @@ export async function writeCFRoutes(nitro: Nitro) {
);

// Unprefixed assets
const publicAssetFiles = await globby("**", {
const publicAssetFiles = await glob("**", {
cwd: nitro.options.output.dir,
absolute: false,
dot: true,
Expand Down
4 changes: 2 additions & 2 deletions src/rollup/plugins/dynamic-require.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { pathToFileURL } from "node:url";
import { globby } from "globby";
import { glob } from "tinyglobby";
import { genSafeVariableName } from "knitwork";
import { resolve } from "pathe";
import type { Plugin } from "rollup";
Expand Down Expand Up @@ -65,7 +65,7 @@ export function dynamicRequire({ dir, ignore, inline }: Options): Plugin {
Object.keys(r.files).filter((file) => !ignore.includes(file))
);
} catch {
files = await globby("**/*.{cjs,mjs,js}", {
files = await glob("**/*.{cjs,mjs,js}", {
cwd: dir,
absolute: false,
ignore,
Expand Down
4 changes: 2 additions & 2 deletions src/rollup/plugins/public-assets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { promises as fsp } from "node:fs";
import createEtag from "etag";
import { globby } from "globby";
import { glob } from "tinyglobby";
import mime from "mime";
import type { Nitro } from "nitropack/types";
import type { PublicAsset } from "nitropack/types";
Expand All @@ -26,7 +26,7 @@ export function publicAssets(nitro: Nitro): Plugin {
// #nitro-internal-virtual/public-assets-data
"#nitro-internal-virtual/public-assets-data": async () => {
const assets: Record<string, PublicAsset> = {};
const files = await globby("**", {
const files = await glob("**", {
cwd: nitro.options.output.publicDir,
absolute: false,
dot: true,
Expand Down
4 changes: 2 additions & 2 deletions src/rollup/plugins/server-assets.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { promises as fsp } from "node:fs";
import createEtag from "etag";
import { globby } from "globby";
import { glob } from "tinyglobby";
import mime from "mime";
import type { Nitro } from "nitropack/types";
import { resolve } from "pathe";
Expand Down Expand Up @@ -33,7 +33,7 @@ export function serverAssets(nitro: Nitro): Plugin {
// Scan all assets
const assets: Record<string, ResolvedAsset> = {};
for (const asset of nitro.options.serverAssets) {
const files = await globby(asset.pattern || "**/*", {
const files = await glob(asset.pattern || "**/*", {
cwd: asset.dir,
absolute: false,
ignore: asset.ignore,
Expand Down

0 comments on commit 0458987

Please sign in to comment.