Home / Function/ _isNext16Middleware() — ui Function Reference

_isNext16Middleware() — ui Function Reference

Architecture documentation for the _isNext16Middleware() function in update-files.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  4455fa61_3128_9c0a_fcab_27989c578bf7["_isNext16Middleware()"]
  3efb2c23_7931_d244_b4e1_85acab69298c["update-files.ts"]
  4455fa61_3128_9c0a_fcab_27989c578bf7 -->|defined in| 3efb2c23_7931_d244_b4e1_85acab69298c
  bc52ca78_0228_54e7_56b2_602b341e2ec4["updateFiles()"]
  bc52ca78_0228_54e7_56b2_602b341e2ec4 -->|calls| 4455fa61_3128_9c0a_fcab_27989c578bf7
  style 4455fa61_3128_9c0a_fcab_27989c578bf7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/shadcn/src/utils/updaters/update-files.ts lines 741–762

function _isNext16Middleware(
  filePath: string,
  projectInfo: ProjectInfo | null,
  config: Config
) {
  const isRootMiddleware =
    filePath === path.join(config.resolvedPaths.cwd, "middleware.ts") ||
    filePath === path.join(config.resolvedPaths.cwd, "middleware.js")

  const isNextJs =
    projectInfo?.framework.name === "next-app" ||
    projectInfo?.framework.name === "next-pages"

  if (!isRootMiddleware || !isNextJs || !projectInfo?.frameworkVersion) {
    return false
  }

  const majorVersion = parseInt(projectInfo.frameworkVersion.split(".")[0])
  const isNext16Plus = !isNaN(majorVersion) && majorVersion >= 16

  return isNext16Plus
}

Subdomains

Called By

Frequently Asked Questions

What does _isNext16Middleware() do?
_isNext16Middleware() is a function in the ui codebase, defined in packages/shadcn/src/utils/updaters/update-files.ts.
Where is _isNext16Middleware() defined?
_isNext16Middleware() is defined in packages/shadcn/src/utils/updaters/update-files.ts at line 741.
What calls _isNext16Middleware()?
_isNext16Middleware() is called by 1 function(s): updateFiles.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free