isReactApiFile

tcmts.core.analyze.isReactApiFile · #bgtlub7o · term · runs on the server

uses node:path

The generated runtime of #tcm/react, as cache modules and re-analyzed definitions import it.

import type { AnalyzeHost } from "#codebase/tcmts/core/analyze";
import path_1 from "node:path";

export function isReactApiFile(spec: string, file: string, host: AnalyzeHost): boolean {
  return (
    /^\.\.?\//.test(spec) &&
    path_1.resolve(path_1.dirname(file), spec) === path_1.join(host.cacheDir, "tcm-react.js")
  );
}

uses