UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

22 lines (21 loc) 915 B
import path from "path"; var routeFileExtensionRe = /\.[jt]sx?$/; function isRouteFilePath(filePath) { return routeFileExtensionRe.test(filePath) && !filePath.endsWith(".d.ts"); } function isPathInsideDirectory(filePath, directory) { var relativePath = path.relative(path.resolve(directory), path.resolve(filePath)); return relativePath !== "" && !relativePath.startsWith("..") && !path.isAbsolute(relativePath); } function isRouteFileWatchEvent(param) { var { event, filePath, routerRoot, includeChangeEvents = false } = param; var isRouteFileEvent = event === "add" || event === "delete" || event === "unlink" || includeChangeEvents && event === "change"; return isRouteFileEvent && isPathInsideDirectory(filePath, routerRoot) && isRouteFilePath(filePath); } export { isPathInsideDirectory, isRouteFilePath, isRouteFileWatchEvent }; //# sourceMappingURL=routeFileWatch.native.js.map