{"version":3,"file":"typedoc.cjs","names":["cloneDeep","ZTypedocConfigBuilder","OutputDist","EntryPointIndex","typedoc","out","path","dist","bind","entry","glob","entryPoints","concat","index","entryPointStrategy","strategy","resolve","packages","excludeNotDocumented","categorizeByGroup","name","favicon","exclude","excludes","project","web","build","cloneDeep"],"sources":["../src/typedoc/typedoc-config-builder.mts"],"sourcesContent":["import { cloneDeep } from \"lodash-es\";\nimport type { EntryPointStrategy, TypeDocOptions } from \"typedoc\";\n\n/**\n * A builder for TypeDoc configurations.\n */\nexport class ZTypedocConfigBuilder {\n  public static readonly OutputDist = \"./dist\";\n  public static readonly EntryPointIndex = \"./src/index.mts\";\n\n  private typedoc: TypeDocOptions = {};\n\n  /**\n   * Sets the output directory for the documentation.\n   *\n   * @param path -\n   *        The output directory path.\n   * @returns\n   *        This object.\n   */\n  public out(path: string) {\n    this.typedoc.out = path;\n    return this;\n  }\n\n  /**\n   * Sets the output directory to \"./dist\".\n   *\n   * @returns\n   *        This object.\n   */\n  public dist = this.out.bind(this, ZTypedocConfigBuilder.OutputDist);\n\n  /**\n   * Adds a list of entry point glob to the existing entry points.\n   *\n   * @param glob -\n   *        The entry point glob pattern.\n   *\n   * @returns\n   *        This object.\n   */\n  public entry(glob: string) {\n    const entry = this.typedoc.entryPoints || [];\n    this.typedoc.entryPoints = entry.concat(glob);\n    return this;\n  }\n\n  /**\n   * Adds an entry point for './src/index.ts'.\n   *\n   * @returns\n   *        This object.\n   */\n  public index = this.entry.bind(this, ZTypedocConfigBuilder.EntryPointIndex);\n\n  /**\n   * Sets the entry point strategy.\n   *\n   * See {@link https://typedoc.org/api/enums/EntryPointStrategy.html | EntryPointStrategy}\n   * for more details.\n   *\n   * @param strategy -\n   *        The entry point strategy to use.\n   *\n   * @returns\n   *        This object.\n   */\n  public entryPointStrategy(strategy: EntryPointStrategy) {\n    this.typedoc.entryPointStrategy = strategy;\n    return this;\n  }\n\n  /**\n   * Sets the entry point strategy to \"resolve\".\n   *\n   * @returns\n   *        This object.\n   */\n  public resolve = this.entryPointStrategy.bind(this, \"resolve\");\n\n  /**\n   * Sets the entry point strategy to \"packages\".\n   *\n   * @returns\n   *        This object.\n   */\n  public packages = this.entryPointStrategy.bind(this, \"packages\");\n\n  /**\n   * Sets the excludeNotDocumented flag.\n   *\n   * @returns\n   *        This object.\n   */\n  public excludeNotDocumented() {\n    this.typedoc.excludeNotDocumented = true;\n    return this;\n  }\n\n  /**\n   * Sets the categorizeByGroup flag.\n   *\n   * @returns\n   *        This object.\n   */\n  public categorizeByGroup() {\n    this.typedoc.categorizeByGroup = true;\n    return this;\n  }\n\n  /**\n   * Sets the name of the project.\n   *\n   * @param name -\n   *        The name of the project.\n   *\n   * @returns\n   *        This object.\n   */\n  public name(name: string) {\n    this.typedoc.name = name;\n    return this;\n  }\n\n  /**\n   * Sets the favicon for the project.\n   *\n   * @param path -\n   *        The path to the favicon file.\n   *\n   * @returns\n   *        This object.\n   */\n  public favicon(path: string) {\n    this.typedoc.favicon = path;\n    return this;\n  }\n\n  /**\n   * Adds a single exclude glob to the existing excludes.\n   *\n   * @param glob -\n   *        The exclude glob pattern.\n   *\n   * @returns\n   *        This object.\n   */\n  public exclude(glob: string | string[]) {\n    const excludes = this.typedoc.exclude || [];\n    this.typedoc.exclude = excludes.concat(glob);\n    return this;\n  }\n\n  /**\n   * Sets the typedoc configuration to be used for an individual project.\n   *\n   * An individual project typedoc does not output any documentation by itself,\n   * but is part of a larger project that does.\n   *\n   * @returns\n   *        This object.\n   */\n  public project() {\n    return this.resolve().dist();\n  }\n\n  /**\n   * Sets the typedoc configuration to be used a web project that outputs\n   * final documentation for a monorepo of packages.\n   *\n   * Normally, your monorepo will have a single web or doc project that outputs\n   * the typescript for every package in the monorepo.  Use this configuration\n   * for that project.\n   *\n   * @returns\n   *        This object.\n   */\n  public web() {\n    return this.packages()\n      .excludeNotDocumented()\n      .categorizeByGroup()\n      .dist()\n      .exclude(\"./\");\n  }\n\n  /**\n   * Builds the final typedoc configuration object.\n   *\n   * @returns\n   *        The final typedoc configuration object.\n   */\n  public build() {\n    return cloneDeep(this.typedoc);\n  }\n}\n"],"mappings":";;;;;GAMA,IAAaC,wBAAb,MAAaA,sBAAAA;CACX,OAAuBC,aAAa;CACpC,OAAuBC,kBAAkB;CAEjCC,UAA0B,CAAC;;;;;;;;IAUnC,IAAWE,MAAc;EACvB,KAAKF,QAAQC,MAAMC;EACnB,OAAO;CACT;;;;;;IAQA,OAAc,KAAKD,IAAIG,KAAK,MAAMP,sBAAsBC,UAAU;;;;;;;;;IAWlE,MAAaQ,MAAc;EACzB,MAAMD,QAAQ,KAAKL,QAAQO,eAAe,CAAA;EAC1C,KAAKP,QAAQO,cAAcF,MAAMG,OAAOF,IAAAA;EACxC,OAAO;CACT;;;;;;IAQA,QAAe,KAAKD,MAAMD,KAAK,MAAMP,sBAAsBE,eAAe;;;;;;;;;;;;IAc1E,mBAA0BY,UAA8B;EACtD,KAAKX,QAAQU,qBAAqBC;EAClC,OAAO;CACT;;;;;;IAQA,UAAiB,KAAKD,mBAAmBN,KAAK,MAAM,SAAA;;;;;;IAQpD,WAAkB,KAAKM,mBAAmBN,KAAK,MAAM,UAAA;;;;;;IAQrD,uBAA8B;EAC5B,KAAKJ,QAAQc,uBAAuB;EACpC,OAAO;CACT;;;;;;IAQA,oBAA2B;EACzB,KAAKd,QAAQe,oBAAoB;EACjC,OAAO;CACT;;;;;;;;;IAWA,KAAYC,MAAc;EACxB,KAAKhB,QAAQgB,OAAOA;EACpB,OAAO;CACT;;;;;;;;;IAWA,QAAed,MAAc;EAC3B,KAAKF,QAAQiB,UAAUf;EACvB,OAAO;CACT;;;;;;;;;IAWA,QAAeI,MAAyB;EACtC,MAAMa,WAAW,KAAKnB,QAAQkB,WAAW,CAAA;EACzC,KAAKlB,QAAQkB,UAAUC,SAASX,OAAOF,IAAAA;EACvC,OAAO;CACT;;;;;;;;;IAWA,UAAiB;EACf,OAAO,KAAKM,QAAO,CAAA,CAAGT,KAAI;CAC5B;;;;;;;;;;;IAaA,MAAa;EACX,OAAO,KAAKU,SAAQ,CAAA,CACjBC,qBAAoB,CAAA,CACpBC,kBAAiB,CAAA,CACjBZ,KAAI,CAAA,CACJe,QAAQ,IAAA;CACb;;;;;;IAQA,QAAe;EACb,QAAA,GAAOtB,UAAAA,UAAAA,CAAU,KAAKI,OAAO;CAC/B;AACF"}