@lukoweb/apitogo 0.1.20 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cli/cli.js +96 -84
  2. package/dist/declarations/app/main.d.ts +4 -3
  3. package/dist/declarations/config/config.d.ts +1 -0
  4. package/dist/declarations/config/create-plugin.d.ts +2 -2
  5. package/dist/declarations/config/validators/ZudokuConfig.d.ts +2 -3
  6. package/dist/declarations/index.d.ts +7 -3
  7. package/dist/declarations/lib/components/PluginHeads.d.ts +2 -2
  8. package/dist/declarations/lib/components/Zudoku.d.ts +7 -1
  9. package/dist/declarations/lib/components/context/ZudokuContext.d.ts +1 -0
  10. package/dist/declarations/lib/components/context/ZudokuProvider.d.ts +3 -0
  11. package/dist/declarations/lib/components/index.d.ts +5 -0
  12. package/dist/declarations/lib/core/ZudokuContext.d.ts +5 -5
  13. package/dist/declarations/lib/core/plugins.d.ts +13 -13
  14. package/dist/declarations/lib/hooks/index.d.ts +1 -0
  15. package/dist/declarations/lib/hooks/useEvent.d.ts +4 -4
  16. package/dist/declarations/lib/plugins/api-catalog/index.d.ts +2 -2
  17. package/dist/declarations/lib/plugins/api-keys/index.d.ts +2 -2
  18. package/dist/declarations/lib/plugins/markdown/index.d.ts +2 -2
  19. package/dist/declarations/lib/plugins/openapi/index.d.ts +2 -2
  20. package/dist/declarations/lib/plugins/search-inkeep/index.d.ts +2 -2
  21. package/dist/declarations/lib/plugins/search-pagefind/index.d.ts +2 -2
  22. package/dist/declarations/lib/testing/index.d.ts +3 -2
  23. package/dist/declarations/lib/util/invariant.d.ts +6 -4
  24. package/package.json +1 -1
  25. package/src/app/main.tsx +14 -11
  26. package/src/config/config.ts +7 -0
  27. package/src/config/create-plugin.ts +3 -3
  28. package/src/config/validators/BuildSchema.ts +7 -2
  29. package/src/config/validators/ZudokuConfig.ts +2 -3
  30. package/src/index.ts +13 -3
  31. package/src/lib/authentication/providers/clerk.tsx +2 -2
  32. package/src/lib/components/PluginHeads.tsx +2 -2
  33. package/src/lib/components/Zudoku.tsx +13 -8
  34. package/src/lib/components/context/ZudokuContext.ts +15 -5
  35. package/src/lib/components/context/ZudokuProvider.tsx +7 -1
  36. package/src/lib/components/index.ts +9 -1
  37. package/src/lib/core/ZudokuContext.ts +8 -8
  38. package/src/lib/core/plugins.ts +13 -13
  39. package/src/lib/hooks/index.ts +2 -0
  40. package/src/lib/hooks/useEvent.ts +12 -12
  41. package/src/lib/plugins/api-catalog/index.tsx +2 -2
  42. package/src/lib/plugins/api-keys/index.tsx +2 -2
  43. package/src/lib/plugins/markdown/index.tsx +2 -2
  44. package/src/lib/plugins/openapi/Sidecar.tsx +4 -2
  45. package/src/lib/plugins/openapi/index.tsx +6 -3
  46. package/src/lib/plugins/search-inkeep/index.tsx +2 -2
  47. package/src/lib/plugins/search-pagefind/index.tsx +2 -2
  48. package/src/lib/testing/index.tsx +11 -2
  49. package/src/lib/util/invariant.ts +16 -6
  50. package/src/types.d.ts +6 -6
  51. package/src/vite/config.ts +24 -0
package/dist/cli/cli.js CHANGED
@@ -108,17 +108,17 @@ function invariant(condition, message, options) {
108
108
  return;
109
109
  }
110
110
  const provided = typeof message === "function" ? message() : message;
111
- throw new ZudokuError(provided ?? "Invariant failed", options);
111
+ throw new ApitogoError(provided ?? "Invariant failed", options);
112
112
  }
113
- var ZudokuError;
113
+ var ApitogoError;
114
114
  var init_invariant = __esm({
115
115
  "src/lib/util/invariant.ts"() {
116
- ZudokuError = class extends Error {
116
+ ApitogoError = class extends Error {
117
117
  developerHint;
118
118
  title;
119
119
  constructor(message, { developerHint, title, cause } = {}) {
120
120
  super(message, { cause });
121
- this.name = "ZudokuError";
121
+ this.name = "ApitogoError";
122
122
  this.title = title;
123
123
  this.developerHint = developerHint;
124
124
  }
@@ -3315,7 +3315,6 @@ var init_ZudokuConfig = __esm({
3315
3315
  logoUrl: z7.string(),
3316
3316
  dir: z7.enum(["ltr", "rtl"]).optional(),
3317
3317
  logo: LogoSchema,
3318
- showPoweredBy: z7.boolean().optional(),
3319
3318
  banner: z7.object({
3320
3319
  message: z7.custom(),
3321
3320
  color: z7.custom(
@@ -3822,7 +3821,7 @@ import {
3822
3821
  // package.json
3823
3822
  var package_default = {
3824
3823
  name: "@lukoweb/apitogo",
3825
- version: "0.1.20",
3824
+ version: "0.1.22",
3826
3825
  type: "module",
3827
3826
  sideEffects: [
3828
3827
  "**/*.css",
@@ -4203,14 +4202,27 @@ init_loader();
4203
4202
  init_ZudokuConfig();
4204
4203
  init_joinUrl();
4205
4204
 
4205
+ // src/vite/pagefind-dev-stub.ts
4206
+ import fs from "node:fs/promises";
4207
+ import path4 from "node:path";
4208
+ var NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
4209
+ async function ensurePagefindDevStub(publicDir) {
4210
+ const pagefindPath = path4.join(publicDir, "pagefind/pagefind.js");
4211
+ const exists = await fs.stat(pagefindPath).catch(() => false);
4212
+ if (!exists) {
4213
+ await fs.mkdir(path4.dirname(pagefindPath), { recursive: true });
4214
+ await fs.writeFile(pagefindPath, NOT_BUILT_YET);
4215
+ }
4216
+ }
4217
+
4206
4218
  // src/vite/package-root.ts
4207
4219
  init_file_exists();
4208
- import path4 from "node:path";
4220
+ import path5 from "node:path";
4209
4221
  var findPackageRoot = async (startDir) => {
4210
4222
  let dir = startDir;
4211
- while (dir !== path4.dirname(dir)) {
4212
- if (await fileExists(path4.join(dir, "package.json"))) return dir;
4213
- dir = path4.dirname(dir);
4223
+ while (dir !== path5.dirname(dir)) {
4224
+ if (await fileExists(path5.join(dir, "package.json"))) return dir;
4225
+ dir = path5.dirname(dir);
4214
4226
  }
4215
4227
  };
4216
4228
 
@@ -4221,7 +4233,7 @@ import react from "@vitejs/plugin-react";
4221
4233
  // src/vite/css/plugin.ts
4222
4234
  init_loader();
4223
4235
  init_plugin_theme();
4224
- import path5 from "node:path";
4236
+ import path6 from "node:path";
4225
4237
  import { isCSSRequest as isCSSRequest2 } from "vite";
4226
4238
 
4227
4239
  // src/vite/css/collect.ts
@@ -4256,7 +4268,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
4256
4268
  function vitePluginSsrCss(pluginOpts) {
4257
4269
  let server;
4258
4270
  const config2 = getCurrentConfig();
4259
- const virtualHref = path5.join(
4271
+ const virtualHref = path6.join(
4260
4272
  config2.basePath ?? "",
4261
4273
  `/@id/__x00__${VIRTUAL_ENTRY}?direct`
4262
4274
  );
@@ -4390,8 +4402,8 @@ var viteApiKeysPlugin = () => {
4390
4402
  var plugin_api_keys_default = viteApiKeysPlugin;
4391
4403
 
4392
4404
  // src/vite/plugin-api.ts
4393
- import fs2 from "node:fs/promises";
4394
- import path11 from "node:path";
4405
+ import fs3 from "node:fs/promises";
4406
+ import path12 from "node:path";
4395
4407
  import { deepEqual as deepEqual2 } from "fast-equals";
4396
4408
  import { runnerImport as runnerImport3 } from "vite";
4397
4409
  init_package_json();
@@ -4400,7 +4412,7 @@ init_loader();
4400
4412
  // src/config/validators/BuildSchema.ts
4401
4413
  init_file_exists();
4402
4414
  init_loader();
4403
- import path6 from "node:path";
4415
+ import path7 from "node:path";
4404
4416
  import { runnerImport as runnerImport2 } from "vite";
4405
4417
  import { z as z8 } from "zod";
4406
4418
  var BuildProcessorSchema = z8.custom((val) => typeof val === "function");
@@ -4415,7 +4427,12 @@ var BuildConfigSchema2 = z8.object({
4415
4427
  rehypePlugins: PluginConfigSchema.optional(),
4416
4428
  prerender: z8.object({ workers: z8.number().optional() }).optional()
4417
4429
  });
4418
- var zudokuBuildConfigFiles = [
4430
+ var buildConfigFiles = [
4431
+ "apitogo.build.js",
4432
+ "apitogo.build.jsx",
4433
+ "apitogo.build.ts",
4434
+ "apitogo.build.tsx",
4435
+ "apitogo.build.mjs",
4419
4436
  "zudoku.build.js",
4420
4437
  "zudoku.build.jsx",
4421
4438
  "zudoku.build.ts",
@@ -4423,8 +4440,8 @@ var zudokuBuildConfigFiles = [
4423
4440
  "zudoku.build.mjs"
4424
4441
  ];
4425
4442
  async function getBuildConfigFilePath(rootDir) {
4426
- for (const fileName of zudokuBuildConfigFiles) {
4427
- const filepath = path6.join(rootDir, fileName);
4443
+ for (const fileName of buildConfigFiles) {
4444
+ const filepath = path7.join(rootDir, fileName);
4428
4445
  if (await fileExists(filepath)) {
4429
4446
  return filepath;
4430
4447
  }
@@ -5419,8 +5436,8 @@ var createGraphQLServer = (options) => createYoga({ schema, batching: true, ...o
5419
5436
  var ensureArray = (value) => Array.isArray(value) ? value : [value];
5420
5437
 
5421
5438
  // src/vite/api/SchemaManager.ts
5422
- import fs from "node:fs/promises";
5423
- import path7 from "node:path";
5439
+ import fs2 from "node:fs/promises";
5440
+ import path8 from "node:path";
5424
5441
  import {
5425
5442
  $RefParser as $RefParser2
5426
5443
  } from "@apidevtools/json-schema-ref-parser";
@@ -5610,18 +5627,18 @@ var SchemaManager = class {
5610
5627
  ];
5611
5628
  }
5612
5629
  getPathForFile = (input, params) => {
5613
- const filePath = path7.resolve(this.config.__meta.rootDir, input);
5630
+ const filePath = path8.resolve(this.config.__meta.rootDir, input);
5614
5631
  const apis = ensureArray(this.config.apis ?? []);
5615
5632
  for (const apiConfig of apis) {
5616
5633
  if (!apiConfig || apiConfig.type !== "file" || !apiConfig.path) continue;
5617
5634
  const match = normalizeInputs(apiConfig.input).some(
5618
- (i) => path7.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
5635
+ (i) => path8.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
5619
5636
  );
5620
5637
  if (match) return apiConfig.path;
5621
5638
  }
5622
5639
  };
5623
5640
  processSchema = async (input) => {
5624
- const filePath = path7.resolve(this.config.__meta.rootDir, input.input);
5641
+ const filePath = path8.resolve(this.config.__meta.rootDir, input.input);
5625
5642
  const params = input.params;
5626
5643
  const configuredPath = this.getPathForFile(input.input, params);
5627
5644
  if (!configuredPath) {
@@ -5657,15 +5674,15 @@ var SchemaManager = class {
5657
5674
  const processedTime = Date.now();
5658
5675
  const code = generateCode(processedSchema, filePath);
5659
5676
  const prefixPath = slugify(configuredPath);
5660
- const processedFilePath = path7.posix.join(
5677
+ const processedFilePath = path8.posix.join(
5661
5678
  this.storeDir,
5662
- `${prefixPath}-${path7.basename(filePath)}${paramsSuffix(params)}.js`
5679
+ `${prefixPath}-${path8.basename(filePath)}${paramsSuffix(params)}.js`
5663
5680
  );
5664
5681
  const importKey = processedFilePath;
5665
- await fs.writeFile(processedFilePath, code);
5682
+ await fs2.writeFile(processedFilePath, code);
5666
5683
  const processedJsonPath = paramsSuffix(params) ? processedFilePath.replace(/\.js$/, ".json") : "";
5667
5684
  if (processedJsonPath) {
5668
- await fs.writeFile(
5685
+ await fs2.writeFile(
5669
5686
  processedJsonPath,
5670
5687
  JSON.stringify(processedSchema, null, 2)
5671
5688
  );
@@ -5708,7 +5725,7 @@ var SchemaManager = class {
5708
5725
  };
5709
5726
  getAllTrackedFiles = () => Array.from(this.referencedBy.keys());
5710
5727
  getFilesToReprocess = (changedFile) => {
5711
- const resolvedPath = path7.resolve(this.config.__meta.rootDir, changedFile);
5728
+ const resolvedPath = path8.resolve(this.config.__meta.rootDir, changedFile);
5712
5729
  const referencedBy = this.referencedBy.get(resolvedPath);
5713
5730
  if (!referencedBy) return [];
5714
5731
  const filesToProcess = referencedBy.size === 0 ? [resolvedPath] : Array.from(referencedBy);
@@ -5737,7 +5754,7 @@ var SchemaManager = class {
5737
5754
  version: "",
5738
5755
  path: input.path ?? "",
5739
5756
  label: input.label,
5740
- inputPath: path7.resolve(this.config.__meta.rootDir, input.input),
5757
+ inputPath: path8.resolve(this.config.__meta.rootDir, input.input),
5741
5758
  params: input.params,
5742
5759
  importKey: "",
5743
5760
  downloadUrl: "",
@@ -5780,7 +5797,7 @@ var SchemaManager = class {
5780
5797
  };
5781
5798
  createSchemaPath = (inputPath, versionPath, apiPath, params) => {
5782
5799
  const suffix = paramsSuffix(params);
5783
- const extension = suffix ? ".json" : path7.extname(inputPath);
5800
+ const extension = suffix ? ".json" : path8.extname(inputPath);
5784
5801
  return joinUrl(
5785
5802
  this.config.basePath,
5786
5803
  apiPath,
@@ -5803,7 +5820,7 @@ var SchemaManager = class {
5803
5820
  // src/vite/plugin-config-reload.ts
5804
5821
  init_logger();
5805
5822
  init_loader();
5806
- import path10 from "node:path";
5823
+ import path11 from "node:path";
5807
5824
  import colors3 from "picocolors";
5808
5825
 
5809
5826
  // src/vite/plugin-navigation.ts
@@ -5813,7 +5830,7 @@ import { stringify as stringify3 } from "javascript-stringify";
5813
5830
  import { isElement } from "react-is";
5814
5831
 
5815
5832
  // src/config/validators/NavigationSchema.ts
5816
- import path8 from "node:path";
5833
+ import path9 from "node:path";
5817
5834
  import { glob } from "glob";
5818
5835
  import { fromMarkdown } from "mdast-util-from-markdown";
5819
5836
  import { mdxFromMarkdown } from "mdast-util-mdx";
@@ -5864,7 +5881,7 @@ var extractRichH1 = (content) => {
5864
5881
  }
5865
5882
  };
5866
5883
  var isNavigationItem = (item) => item !== void 0;
5867
- var toPosixPath = (filePath) => filePath.split(path8.win32.sep).join(path8.posix.sep);
5884
+ var toPosixPath = (filePath) => filePath.split(path9.win32.sep).join(path9.posix.sep);
5868
5885
  var NavigationResolver = class {
5869
5886
  rootDir;
5870
5887
  globPatterns;
@@ -5997,13 +6014,13 @@ init_invariant();
5997
6014
 
5998
6015
  // src/vite/debug.ts
5999
6016
  import { mkdir, writeFile } from "node:fs/promises";
6000
- import path9 from "node:path";
6017
+ import path10 from "node:path";
6001
6018
  async function writePluginDebugCode(rootDir, pluginName, code, extension = "js") {
6002
6019
  if (process.env.ZUDOKU_BUILD_DEBUG) {
6003
- const debugDir = path9.join(rootDir, "dist", "debug");
6020
+ const debugDir = path10.join(rootDir, "dist", "debug");
6004
6021
  await mkdir(debugDir, { recursive: true });
6005
6022
  await writeFile(
6006
- path9.join(debugDir, `${pluginName}.${extension}`),
6023
+ path10.join(debugDir, `${pluginName}.${extension}`),
6007
6024
  typeof code === "string" ? code : code.join("\n")
6008
6025
  );
6009
6026
  }
@@ -6114,7 +6131,7 @@ var viteConfigReloadPlugin = () => ({
6114
6131
  });
6115
6132
  logger.info(
6116
6133
  colors3.blue(
6117
- `Config ${path10.basename(currentConfig.__meta.configPath)} changed. Reloading...`
6134
+ `Config ${path11.basename(currentConfig.__meta.configPath)} changed. Reloading...`
6118
6135
  ),
6119
6136
  { timestamp: true }
6120
6137
  );
@@ -6128,11 +6145,11 @@ var viteApiPlugin = async () => {
6128
6145
  const resolvedVirtualModuleId4 = `\0${virtualModuleId4}`;
6129
6146
  const initialConfig = getCurrentConfig();
6130
6147
  const zuploProcessors = ZuploEnv.isZuplo ? await runnerImport3(
6131
- path11.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
6148
+ path12.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
6132
6149
  ).then((m) => m.module.default(initialConfig.__meta.rootDir)) : [];
6133
6150
  const buildConfig = await getBuildConfig();
6134
6151
  const buildProcessors = buildConfig?.processors ?? [];
6135
- const tmpStoreDir = path11.posix.join(
6152
+ const tmpStoreDir = path12.posix.join(
6136
6153
  initialConfig.__meta.rootDir,
6137
6154
  "node_modules/.apitogo/processed"
6138
6155
  );
@@ -6145,8 +6162,8 @@ var viteApiPlugin = async () => {
6145
6162
  return {
6146
6163
  name: "zudoku-api-plugins",
6147
6164
  async buildStart() {
6148
- await fs2.rm(tmpStoreDir, { recursive: true, force: true });
6149
- await fs2.mkdir(tmpStoreDir, { recursive: true });
6165
+ await fs3.rm(tmpStoreDir, { recursive: true, force: true });
6166
+ await fs3.mkdir(tmpStoreDir, { recursive: true });
6150
6167
  await schemaManager.processAllSchemas();
6151
6168
  schemaManager.getAllTrackedFiles().forEach((file) => this.addWatchFile(file));
6152
6169
  },
@@ -6159,8 +6176,8 @@ var viteApiPlugin = async () => {
6159
6176
  const pathMap = schemaManager.getUrlToFilePathMap();
6160
6177
  const inputPath = pathMap.get(req.url);
6161
6178
  if (!inputPath) return next();
6162
- const content = await fs2.readFile(inputPath, "utf-8");
6163
- const mimeType = path11.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
6179
+ const content = await fs3.readFile(inputPath, "utf-8");
6180
+ const mimeType = path12.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
6164
6181
  res.setHeader("Content-Type", `${mimeType}; charset=utf-8`);
6165
6182
  return res.end(content);
6166
6183
  });
@@ -6347,10 +6364,10 @@ var viteApiPlugin = async () => {
6347
6364
  const pathMap = schemaManager.getUrlToFilePathMap();
6348
6365
  if (process.env.NODE_ENV !== "production") return;
6349
6366
  for (const [urlPath, inputPath] of pathMap) {
6350
- const content = await fs2.readFile(inputPath, "utf-8");
6351
- const outputPath = path11.join(config2.__meta.rootDir, "dist", urlPath);
6352
- await fs2.mkdir(path11.dirname(outputPath), { recursive: true });
6353
- await fs2.writeFile(outputPath, content, "utf-8");
6367
+ const content = await fs3.readFile(inputPath, "utf-8");
6368
+ const outputPath = path12.join(config2.__meta.rootDir, "dist", urlPath);
6369
+ await fs3.mkdir(path12.dirname(outputPath), { recursive: true });
6370
+ await fs3.writeFile(outputPath, content, "utf-8");
6354
6371
  }
6355
6372
  }
6356
6373
  };
@@ -6392,7 +6409,7 @@ var plugin_auth_default = viteAuthPlugin;
6392
6409
 
6393
6410
  // src/vite/plugin-component.ts
6394
6411
  init_loader();
6395
- import path12 from "node:path";
6412
+ import path13 from "node:path";
6396
6413
  var viteAliasPlugin = () => {
6397
6414
  return {
6398
6415
  name: "zudoku-component-plugin",
@@ -6420,7 +6437,7 @@ var viteAliasPlugin = () => {
6420
6437
  ];
6421
6438
  const aliases = replacements.map(([find, replacement]) => ({
6422
6439
  find,
6423
- replacement: path12.posix.join(config2.__meta.moduleDir, replacement)
6440
+ replacement: path13.posix.join(config2.__meta.moduleDir, replacement)
6424
6441
  }));
6425
6442
  return config2.__meta.mode === "internal" || config2.__meta.mode === "standalone" ? { resolve: { alias: aliases } } : void 0;
6426
6443
  }
@@ -6557,7 +6574,7 @@ var viteDocMetadataPlugin = () => ({
6557
6574
 
6558
6575
  // src/vite/plugin-docs.ts
6559
6576
  init_loader();
6560
- import path13 from "node:path";
6577
+ import path14 from "node:path";
6561
6578
  import { glob as glob3 } from "glob";
6562
6579
  import globParent from "glob-parent";
6563
6580
  init_ZudokuConfig();
@@ -6626,7 +6643,7 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
6626
6643
  if (process.env.NODE_ENV !== "development") {
6627
6644
  const draftStatuses = await Promise.all(
6628
6645
  globbedFiles.map(async (file) => {
6629
- const absolutePath = path13.resolve(config2.__meta.rootDir, file);
6646
+ const absolutePath = path14.resolve(config2.__meta.rootDir, file);
6630
6647
  const { data } = await readFrontmatter(absolutePath);
6631
6648
  return { file, isDraft: data.draft === true };
6632
6649
  })
@@ -6639,9 +6656,9 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
6639
6656
  if (draftFiles.has(file)) {
6640
6657
  continue;
6641
6658
  }
6642
- const relativePath = path13.posix.relative(parent, file);
6659
+ const relativePath = path14.posix.relative(parent, file);
6643
6660
  const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
6644
- const filePath = options.absolute ? path13.resolve(config2.__meta.rootDir, file) : file;
6661
+ const filePath = options.absolute ? path14.resolve(config2.__meta.rootDir, file) : file;
6645
6662
  fileMapping[routePath] = filePath;
6646
6663
  }
6647
6664
  }
@@ -6705,7 +6722,7 @@ var viteDocsPlugin = () => {
6705
6722
  const globbedDocuments = {};
6706
6723
  for (const [routePath, file] of Object.entries(fileMapping)) {
6707
6724
  const importPath = ensureLeadingSlash(
6708
- path13.posix.join(globImportBasePath, file)
6725
+ path14.posix.join(globImportBasePath, file)
6709
6726
  );
6710
6727
  globbedDocuments[routePath] = importPath;
6711
6728
  }
@@ -6733,7 +6750,7 @@ init_loader();
6733
6750
  init_ProtectedRoutesSchema();
6734
6751
  init_joinUrl();
6735
6752
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
6736
- import path14 from "node:path";
6753
+ import path15 from "node:path";
6737
6754
  import { matchPath } from "react-router";
6738
6755
  var processMarkdownFile = async (filePath) => {
6739
6756
  const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
@@ -6821,7 +6838,7 @@ var viteMarkdownExportPlugin = () => {
6821
6838
  if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
6822
6839
  return;
6823
6840
  }
6824
- const distDir = path14.join(
6841
+ const distDir = path15.join(
6825
6842
  config2.__meta.rootDir,
6826
6843
  "dist",
6827
6844
  config2.basePath ?? ""
@@ -6842,15 +6859,15 @@ var viteMarkdownExportPlugin = () => {
6842
6859
  content: finalMarkdown
6843
6860
  });
6844
6861
  const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
6845
- const outputPath = `${path14.join(distDir, ...segments)}.md`;
6846
- await mkdir2(path14.dirname(outputPath), { recursive: true });
6862
+ const outputPath = `${path15.join(distDir, ...segments)}.md`;
6863
+ await mkdir2(path15.dirname(outputPath), { recursive: true });
6847
6864
  await writeFile2(outputPath, finalMarkdown, "utf-8");
6848
6865
  } catch (error) {
6849
6866
  console.warn(`Failed to export markdown for ${routePath}:`, error);
6850
6867
  }
6851
6868
  }
6852
6869
  if (config2.docs?.llms?.llmsTxt || config2.docs?.llms?.llmsTxtFull) {
6853
- const markdownInfoPath = path14.join(
6870
+ const markdownInfoPath = path15.join(
6854
6871
  config2.__meta.rootDir,
6855
6872
  "node_modules/.apitogo/markdown-info.json"
6856
6873
  );
@@ -7002,9 +7019,9 @@ var remarkCodeTabs = () => (tree) => {
7002
7019
  };
7003
7020
 
7004
7021
  // src/vite/mdx/remark-inject-filepath.ts
7005
- import path15 from "node:path";
7022
+ import path16 from "node:path";
7006
7023
  var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
7007
- const relativePath = path15.relative(rootDir, vfile.path).split(path15.sep).join(path15.posix.sep);
7024
+ const relativePath = path16.relative(rootDir, vfile.path).split(path16.sep).join(path16.posix.sep);
7008
7025
  tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
7009
7026
  };
7010
7027
 
@@ -7091,18 +7108,18 @@ var remarkLastModified = () => {
7091
7108
  };
7092
7109
 
7093
7110
  // src/vite/mdx/remark-link-rewrite.ts
7094
- import path16 from "node:path";
7111
+ import path17 from "node:path";
7095
7112
  import { visit as visit5 } from "unist-util-visit";
7096
7113
  var remarkLinkRewrite = (basePath = "") => (tree) => {
7097
7114
  visit5(tree, "link", (node) => {
7098
7115
  if (!node.url) return;
7099
7116
  if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
7100
7117
  node.url = node.url.replace(/\\/g, "/");
7101
- const base = path16.posix.join(basePath);
7118
+ const base = path17.posix.join(basePath);
7102
7119
  if (basePath && node.url.startsWith(base)) {
7103
7120
  node.url = node.url.slice(base.length);
7104
7121
  } else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
7105
- node.url = path16.posix.join("..", node.url);
7122
+ node.url = path17.posix.join("..", node.url);
7106
7123
  }
7107
7124
  node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
7108
7125
  });
@@ -7323,21 +7340,6 @@ var plugin_mdx_default = viteMdxPlugin;
7323
7340
  // src/vite/plugin-search.ts
7324
7341
  init_loader();
7325
7342
  import path18 from "node:path";
7326
-
7327
- // src/vite/pagefind-dev-stub.ts
7328
- import fs3 from "node:fs/promises";
7329
- import path17 from "node:path";
7330
- var NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
7331
- async function ensurePagefindDevStub(publicDir) {
7332
- const pagefindPath = path17.join(publicDir, "pagefind/pagefind.js");
7333
- const exists = await fs3.stat(pagefindPath).catch(() => false);
7334
- if (!exists) {
7335
- await fs3.mkdir(path17.dirname(pagefindPath), { recursive: true });
7336
- await fs3.writeFile(pagefindPath, NOT_BUILT_YET);
7337
- }
7338
- }
7339
-
7340
- // src/vite/plugin-search.ts
7341
7343
  var viteSearchPlugin = () => {
7342
7344
  const virtualModuleId4 = "virtual:zudoku-search-plugin";
7343
7345
  const resolvedVirtualModuleId4 = `\0${virtualModuleId4}`;
@@ -7492,6 +7494,11 @@ function vitePlugin() {
7492
7494
  }
7493
7495
 
7494
7496
  // src/vite/config.ts
7497
+ var resolveMergedPublicDir = (rootDir, merged) => {
7498
+ if (merged.publicDir === false) return void 0;
7499
+ const rel = typeof merged.publicDir === "string" ? merged.publicDir : "public";
7500
+ return path19.resolve(rootDir, rel);
7501
+ };
7495
7502
  var getAppClientEntryPath = () => path19.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
7496
7503
  var getAppServerEntryPath = () => path19.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
7497
7504
  var hasLoggedCdnInfo = false;
@@ -7659,6 +7666,10 @@ async function getViteConfig(dir, configEnv) {
7659
7666
  });
7660
7667
  }
7661
7668
  }
7669
+ const publicDir = resolveMergedPublicDir(dir, mergedViteConfig);
7670
+ if (publicDir && (configEnv.mode === "development" || config2.search?.type === "pagefind")) {
7671
+ await ensurePagefindDevStub(publicDir);
7672
+ }
7662
7673
  return mergedViteConfig;
7663
7674
  }
7664
7675
 
@@ -9450,9 +9461,10 @@ var titleCase = (value) => value.split(/[-_\s]+/).filter(Boolean).map((part) =>
9450
9461
  var docSortRank = (docPath) => {
9451
9462
  const lastSegment = docPath.split("/").at(-1) ?? docPath;
9452
9463
  if (lastSegment === "introduction") return 0;
9453
- if (lastSegment === "getting-started") return 1;
9454
- if (lastSegment === "index") return 2;
9455
- return 3;
9464
+ if (lastSegment === "example") return 1;
9465
+ if (lastSegment === "getting-started") return 2;
9466
+ if (lastSegment === "index") return 3;
9467
+ return 4;
9456
9468
  };
9457
9469
  var sortDocPaths = (docPaths) => [...docPaths].sort((a, b) => {
9458
9470
  const rankDiff = docSortRank(a) - docSortRank(b);
@@ -10017,7 +10029,7 @@ ${colors10.gray("Upgrade to receive the latest features and fixes.")}`
10017
10029
  }
10018
10030
  async function getLatestVersion() {
10019
10031
  const response = await fetch(
10020
- "https://api.github.com/repos/zuplo/zudoku/releases?per_page=1"
10032
+ "https://api.github.com/repos/lukoweb/apitogo-doc-tool/releases?per_page=1"
10021
10033
  );
10022
10034
  if (response.status === 200) {
10023
10035
  const result = await response.json();
@@ -10112,7 +10124,7 @@ var warnPackageVersionMismatch = () => {
10112
10124
  const pkgManager = getPkgManager();
10113
10125
  const message = `${colors11.yellow("React version mismatch detected!")}
10114
10126
 
10115
- Zudoku requires specific versions of React
10127
+ APIToGo requires specific versions of React
10116
10128
  and React DOM to function correctly.
10117
10129
 
10118
10130
  Installed: ${colors11.bold(`react@${installed.react}, react-dom@${installed["react-dom"]}`)}
@@ -1,12 +1,13 @@
1
1
  import type { RouteObject } from "react-router";
2
2
  import type { HighlighterCore } from "shiki";
3
3
  import "virtual:zudoku-theme.css";
4
- import type { ZudokuConfig } from "../config/config.js";
4
+ import type { ApitogoConfig } from "../config/config.js";
5
5
  import "./main.css";
6
6
  import "./polyfills.js";
7
7
  import type { ZudokuContextOptions } from "../lib/core/ZudokuContext.js";
8
8
  export declare const shikiReady: Promise<HighlighterCore>;
9
- export declare const convertZudokuConfigToOptions: (config: ZudokuConfig) => ZudokuContextOptions;
9
+ export declare const convertApitogoConfigToOptions: (config: ApitogoConfig) => ZudokuContextOptions;
10
+ export declare const convertZudokuConfigToOptions: (config: ApitogoConfig) => ZudokuContextOptions;
10
11
  export declare const getRoutesByOptions: (options: ZudokuContextOptions, enableStatusPages?: boolean) => ({
11
12
  errorElement: import("react/jsx-runtime").JSX.Element;
12
13
  caseSensitive?: boolean | undefined;
@@ -98,4 +99,4 @@ export declare const getRoutesByOptions: (options: ZudokuContextOptions, enableS
98
99
  ErrorBoundary?: (() => Promise<import("react").ComponentType<{}> | null | undefined>) | undefined;
99
100
  }) | import("react-router").LazyRouteFunction<RouteObject>;
100
101
  })[];
101
- export declare const getRoutesByConfig: (config: ZudokuConfig) => RouteObject[];
102
+ export declare const getRoutesByConfig: (config: ApitogoConfig) => RouteObject[];
@@ -1,6 +1,7 @@
1
1
  import type { ConfigWithMeta } from "./loader.js";
2
2
  import type { BuildConfig } from "./validators/BuildSchema.js";
3
3
  import type { AuthenticationConfig, ZudokuConfig } from "./validators/ZudokuConfig.js";
4
+ export type ApitogoBuildConfig = BuildConfig;
4
5
  export type ZudokuBuildConfig = BuildConfig;
5
6
  export type LoadedConfig = ConfigWithMeta;
6
7
  export type { ZudokuConfig as ApitogoConfig };
@@ -1,2 +1,2 @@
1
- import { type ZudokuPlugin } from "../lib/core/plugins.js";
2
- export declare const createPlugin: <TOptions extends unknown[]>(factory: (...options: TOptions) => ZudokuPlugin) => ((...options: TOptions) => ZudokuPlugin);
1
+ import { type ApitogoPlugin } from "../lib/core/plugins.js";
2
+ export declare const createPlugin: <TOptions extends unknown[]>(factory: (...options: TOptions) => ApitogoPlugin) => ((...options: TOptions) => ApitogoPlugin);
@@ -5,7 +5,7 @@ import { z } from "zod";
5
5
  import type { UseAuthReturn } from "../../lib/authentication/hook.js";
6
6
  import type { AuthState } from "../../lib/authentication/state.js";
7
7
  import type { SlotType } from "../../lib/components/context/SlotProvider.js";
8
- import type { ZudokuPlugin } from "../../lib/core/plugins.js";
8
+ import type { ApitogoPlugin } from "../../lib/core/plugins.js";
9
9
  import type { ZudokuContext } from "../../lib/core/ZudokuContext.js";
10
10
  import type { FilterCatalogItemsFn } from "../../lib/plugins/api-catalog/index.js";
11
11
  import type { ApiConsumer } from "../../lib/plugins/api-keys/index.js";
@@ -420,7 +420,7 @@ export declare const ZudokuConfig: z.ZodObject<{
420
420
  render: z.ZodOptional<z.ZodCustom<ComponentType<ExposedComponentProps>, ComponentType<ExposedComponentProps>>>;
421
421
  prose: z.ZodOptional<z.ZodBoolean>;
422
422
  }, z.core.$strip>>>;
423
- plugins: z.ZodOptional<z.ZodArray<z.ZodCustom<ZudokuPlugin, ZudokuPlugin>>>;
423
+ plugins: z.ZodOptional<z.ZodArray<z.ZodCustom<ApitogoPlugin, ApitogoPlugin>>>;
424
424
  build: z.ZodOptional<z.ZodCustom<{
425
425
  remarkPlugins?: Options["remarkPlugins"];
426
426
  rehypePlugins?: Options["rehypePlugins"];
@@ -464,7 +464,6 @@ export declare const ZudokuConfig: z.ZodObject<{
464
464
  href: z.ZodOptional<z.ZodString>;
465
465
  reloadDocument: z.ZodOptional<z.ZodBoolean>;
466
466
  }, z.core.$strip>>;
467
- showPoweredBy: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
468
467
  banner: z.ZodOptional<z.ZodObject<{
469
468
  message: z.ZodCustom<NonNullable<ReactNode>, NonNullable<ReactNode>>;
470
469
  color: z.ZodOptional<z.ZodCustom<"info" | (string & {}) | "note" | "tip" | "caution" | "danger", "info" | (string & {}) | "note" | "tip" | "caution" | "danger">>;
@@ -1,10 +1,14 @@
1
- export type { ApitogoConfig, ZudokuBuildConfig } from "./config/config.js";
1
+ export type { ApitogoBuildConfig, ApitogoConfig, ZudokuBuildConfig, } from "./config/config.js";
2
2
  export { createPlugin } from "./config/create-plugin.js";
3
3
  export type { InputNavigation as Navigation } from "./config/validators/InputNavigationSchema.js";
4
4
  export type { SlotType } from "./lib/components/context/SlotProvider.js";
5
5
  export { type CustomSlotNames, Slot, type SlotName, } from "./lib/components/Slot.js";
6
- export type { ApiIdentityPlugin, AuthenticationPlugin, CommonPlugin, NavigationPlugin, ProfileMenuPlugin, ProfileNavigationItem, RouteObject, SearchProviderPlugin, TransformConfigContext, ZudokuPlugin, } from "./lib/core/plugins.js";
7
- export { type ApiIdentity, ZudokuContext } from "./lib/core/ZudokuContext.js";
6
+ export type { ApiIdentityPlugin, AuthenticationPlugin, CommonPlugin, NavigationPlugin, ProfileMenuPlugin, ProfileNavigationItem, RouteObject, SearchProviderPlugin, TransformConfigContext, ApitogoPlugin, } from "./lib/core/plugins.js";
7
+ export type { ApiIdentity, ApitogoEvents } from "./lib/core/ZudokuContext.js";
8
+ export type { ZudokuContextOptions } from "./lib/core/ZudokuContext.js";
9
+ export type { ZudokuContextOptions as ApitogoContextOptions } from "./lib/core/ZudokuContext.js";
10
+ export { ZudokuContext } from "./lib/core/ZudokuContext.js";
11
+ export { ZudokuContext as ApitogoContext } from "./lib/core/ZudokuContext.js";
8
12
  export { useEvent } from "./lib/hooks/index.js";
9
13
  export type { MDXImport } from "./lib/plugins/markdown/index.js";
10
14
  export { defaultLanguages } from "./lib/shiki.js";
@@ -1,6 +1,6 @@
1
1
  import type { Location } from "react-router";
2
- import { type ZudokuPlugin } from "../core/plugins.js";
2
+ import { type ApitogoPlugin } from "../core/plugins.js";
3
3
  export declare const PluginHeads: ({ plugins, location, }: {
4
- plugins: ZudokuPlugin[];
4
+ plugins: ApitogoPlugin[];
5
5
  location: Location;
6
6
  }) => import("react/jsx-runtime").JSX.Element[];
@@ -1,9 +1,15 @@
1
1
  import { type PropsWithChildren } from "react";
2
2
  import { type ZudokuContextOptions } from "../core/ZudokuContext.js";
3
+ declare const Apitogo: {
4
+ (props: PropsWithChildren<ZudokuContextOptions & {
5
+ env?: Record<string, string>;
6
+ }>): import("react/jsx-runtime").JSX.Element;
7
+ displayName: string;
8
+ };
3
9
  declare const Zudoku: {
4
10
  (props: PropsWithChildren<ZudokuContextOptions & {
5
11
  env?: Record<string, string>;
6
12
  }>): import("react/jsx-runtime").JSX.Element;
7
13
  displayName: string;
8
14
  };
9
- export { Zudoku };
15
+ export { Apitogo, Zudoku };
@@ -1,4 +1,5 @@
1
1
  import type { NavigationItem } from "../../../config/validators/NavigationSchema.js";
2
+ export declare const useApitogo: () => import("../../core/ZudokuContext.js").ZudokuContext;
2
3
  export declare const useZudoku: () => import("../../core/ZudokuContext.js").ZudokuContext;
3
4
  export declare const useApiIdentities: () => import("@tanstack/react-query").UseQueryResult<import("../../core/ZudokuContext.js").ApiIdentity[], Error>;
4
5
  export declare const useCurrentNavigation: () => {
@@ -3,3 +3,6 @@ import type { ZudokuContext } from "../../core/ZudokuContext.js";
3
3
  export declare const ZudokuProvider: ({ children, context, }: PropsWithChildren<{
4
4
  context: ZudokuContext;
5
5
  }>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const ApitogoProvider: ({ children, context, }: PropsWithChildren<{
7
+ context: ZudokuContext;
8
+ }>) => import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,7 @@ export { Helmet as Head } from "@zudoku/react-helmet-async";
2
2
  export { Link } from "react-router";
3
3
  export { Button } from "../ui/Button.js";
4
4
  export { Callout } from "../ui/Callout.js";
5
+ export { ApitogoError } from "../util/invariant.js";
5
6
  export { ZudokuError } from "../util/invariant.js";
6
7
  export { ClientOnly } from "./ClientOnly.js";
7
8
  export { Heading } from "./Heading.js";
@@ -10,9 +11,13 @@ export { Search } from "./Search.js";
10
11
  export { type CustomSlotNames, Slot } from "./Slot.js";
11
12
  export { Spinner } from "./Spinner.js";
12
13
  export { Typography } from "./Typography.js";
14
+ export { Apitogo } from "./Zudoku.js";
13
15
  export { Zudoku } from "./Zudoku.js";
16
+ export { ApitogoProvider } from "./context/ZudokuProvider.js";
17
+ export { ZudokuProvider } from "./context/ZudokuProvider.js";
14
18
  export { useMDXComponents } from "@mdx-js/react";
15
19
  export { useTheme } from "next-themes";
16
20
  export { useAuth } from "../authentication/hook.js";
17
21
  export { CACHE_KEYS, useCache } from "./cache.js";
22
+ export { useApitogo } from "./context/ZudokuContext.js";
18
23
  export { useZudoku } from "./context/ZudokuContext.js";