UNPKG

@h3ravel/http

Version:

HTTP kernel, middleware pipeline, request/response classes for H3ravel.

35 lines (33 loc) 1.64 kB
const require_chunk = require('./chunk-BncF-t-1.cjs'); let node_url = require("node:url"); let node_process = require("node:process"); node_process = require_chunk.__toESM(node_process); let node_path = require("node:path"); node_path = require_chunk.__toESM(node_path); let node_fs = require("node:fs"); node_fs = require_chunk.__toESM(node_fs); let node_fs_promises = require("node:fs/promises"); node_fs_promises = require_chunk.__toESM(node_fs_promises); //#region ../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js async function findUp(name, { cwd = node_process.default.cwd(), type = "file", stopAt } = {}) { let directory = node_path.default.resolve(toPath(cwd) ?? ""); const { root } = node_path.default.parse(directory); stopAt = node_path.default.resolve(directory, toPath(stopAt ?? root)); const isAbsoluteName = node_path.default.isAbsolute(name); while (directory) { const filePath = isAbsoluteName ? name : node_path.default.join(directory, name); try { const stats = await node_fs_promises.default.stat(filePath); if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath; } catch {} if (directory === stopAt || directory === root) break; directory = node_path.default.dirname(directory); } } var toPath; var init_find_up_simple = require_chunk.__esm({ "../../node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js": (() => { toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, node_url.fileURLToPath)(urlOrPath) : urlOrPath; }) }); //#endregion init_find_up_simple(); exports.findUp = findUp;