Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"exsolve": "^1.0.7",
"fetchdts": "^0.1.7",
"fs-extra": "^11.3.1",
"globby": "^14.1.0",
"gzip-size": "^7.0.0",
"h3": "2.0.0-beta.4",
"hookable": "^5.5.3",
Expand Down Expand Up @@ -109,6 +108,7 @@
"source-map": "^0.7.6",
"srvx": "^0.8.7",
"std-env": "^3.9.0",
"tinyglobby": "^0.2.15",
"ufo": "^1.6.1",
"ultrahtml": "^1.6.0",
"uncrypto": "^0.1.3",
Expand Down
25 changes: 17 additions & 8 deletions pnpm-lock.yaml

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

6 changes: 3 additions & 3 deletions src/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 "../utils/fs";
import type { Nitro } from "nitro/types";
import { join, relative, resolve } from "pathe";
Expand All @@ -19,7 +19,7 @@ export async function scanUnprefixedPublicAssets(nitro: Nitro) {
continue;
}
const includePatterns = getIncludePatterns(nitro, asset.dir);
const publicAssets = await globby(includePatterns, {
const publicAssets = await glob(includePatterns, {
cwd: asset.dir,
absolute: false,
dot: true,
Expand All @@ -40,7 +40,7 @@ export async function copyPublicAssets(nitro: Nitro) {
const dstDir = join(nitro.options.output.publicDir, asset.baseURL!);
if (await isDirectory(srcDir)) {
const includePatterns = getIncludePatterns(nitro, srcDir);
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/build/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 "nitro/types";
import type { PublicAsset } from "nitro/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/build/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 "nitro/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
4 changes: 2 additions & 2 deletions src/presets/cloudflare/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { writeFile } from "../_utils/fs";
import { parseTOML, parseJSONC } from "confbox";
import { readGitConfig, readPackageJSON, findNearestFile } from "pkg-types";
import { defu } from "defu";
import { globby } from "globby";
import { provider } from "std-env";
import { glob } from "tinyglobby";
import { join, resolve } from "pathe";
import {
joinURL,
Expand Down Expand Up @@ -70,7 +70,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/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 "nitro/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/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 "nitro/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/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
8 changes: 1 addition & 7 deletions test/fixture/nitro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,7 @@ export default defineNitroConfig({
dir: "files",
},
],
ignore: [
"api/**/_*",
"middleware/_ignored.ts",
"routes/_*.ts",
"**/_*.txt",
"!**/_unignored.txt",
],
ignore: ["api/**/_*", "middleware/_ignored.ts", "routes/_*.ts", "**/_*.txt"],
runtimeConfig: {
dynamic: "initial",
url: "https://{{APP_DOMAIN}}",
Expand Down
1 change: 0 additions & 1 deletion test/presets/cloudflare-pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe.skipIf(isWindows)("nitro:preset:cloudflare-pages", async () => {
"/_openapi.json.gz",
"/_scalar",
"/_swagger",
"/_unignored.txt",
"/favicon.ico",
"/foo.css",
"/foo.js",
Expand Down
9 changes: 0 additions & 9 deletions test/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,15 +586,6 @@ export function testNitro(
expect((await callHandler({ url: "/favicon.ico" })).status).toBe(200);
}
);

it.skipIf(ctx.isWorker || ctx.isDev)(
"public files can be un-ignored with patterns",
async () => {
expect((await callHandler({ url: "/_unignored.txt" })).status).toBe(
200
);
}
);
});

describe("headers", () => {
Expand Down
Loading