@lukoweb/apitogo 0.1.17 → 0.1.19

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.
package/dist/cli/cli.js CHANGED
@@ -131,7 +131,7 @@ import { stat } from "node:fs/promises";
131
131
  var fileExists;
132
132
  var init_file_exists = __esm({
133
133
  "src/config/file-exists.ts"() {
134
- fileExists = (path33) => stat(path33).then(() => true).catch(() => false);
134
+ fileExists = (path35) => stat(path35).then(() => true).catch(() => false);
135
135
  }
136
136
  });
137
137
 
@@ -208,7 +208,7 @@ var init_shiki = __esm({
208
208
  warnedLanguages.add(lang);
209
209
  console.warn(
210
210
  `Language "${lang}" is not loaded for syntax highlighting. Add it to \`syntaxHighlighting.languages\` in your config. Falling back to plain text.
211
- See https://zudoku.dev/docs/markdown/code-blocks#configuration`
211
+ See https://docs.apitogo.com/docs/markdown/code-blocks#configuration`
212
212
  );
213
213
  };
214
214
  parseMetaString = (str) => {
@@ -3590,7 +3590,7 @@ __export(llms_exports, {
3590
3590
  generateLlmsTxtFiles: () => generateLlmsTxtFiles
3591
3591
  });
3592
3592
  import { writeFile as writeFile4 } from "node:fs/promises";
3593
- import path20 from "node:path";
3593
+ import path22 from "node:path";
3594
3594
  import colors6 from "picocolors";
3595
3595
  async function generateLlmsTxtFiles({
3596
3596
  markdownFileInfos,
@@ -3625,7 +3625,7 @@ async function generateLlmsTxtFiles({
3625
3625
  }
3626
3626
  }
3627
3627
  const llmsTxt2 = llmsTxtParts.join("\n");
3628
- await writeFile4(path20.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
3628
+ await writeFile4(path22.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
3629
3629
  if (process.env.APITOGO_JSON_ONLY !== "1") {
3630
3630
  console.log(colors6.blue("\u2713 generated llms.txt"));
3631
3631
  }
@@ -3653,7 +3653,7 @@ ${info.content}
3653
3653
  }
3654
3654
  const llmsFull = llmsFullParts.join("\n");
3655
3655
  await writeFile4(
3656
- path20.join(baseOutputDir, "llms-full.txt"),
3656
+ path22.join(baseOutputDir, "llms-full.txt"),
3657
3657
  llmsFull,
3658
3658
  "utf-8"
3659
3659
  );
@@ -3674,11 +3674,11 @@ import { hideBin } from "yargs/helpers";
3674
3674
  import yargs from "yargs/yargs";
3675
3675
 
3676
3676
  // src/cli/build/handler.ts
3677
- import path24 from "node:path";
3677
+ import path26 from "node:path";
3678
3678
 
3679
3679
  // src/vite/build.ts
3680
3680
  import { mkdir as mkdir5, readFile as readFile3, rename, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
3681
- import path22 from "node:path";
3681
+ import path24 from "node:path";
3682
3682
  import { build as esbuild } from "esbuild";
3683
3683
  import { build as viteBuild, mergeConfig as mergeConfig3 } from "vite";
3684
3684
 
@@ -3811,7 +3811,7 @@ init_invariant();
3811
3811
  init_joinUrl();
3812
3812
 
3813
3813
  // src/vite/config.ts
3814
- import path17 from "node:path";
3814
+ import path19 from "node:path";
3815
3815
  import dotenv from "dotenv";
3816
3816
  import colors4 from "picocolors";
3817
3817
  import {
@@ -3822,7 +3822,7 @@ import {
3822
3822
  // package.json
3823
3823
  var package_default = {
3824
3824
  name: "@lukoweb/apitogo",
3825
- version: "0.1.17",
3825
+ version: "0.1.19",
3826
3826
  type: "module",
3827
3827
  sideEffects: [
3828
3828
  "**/*.css",
@@ -4533,14 +4533,14 @@ var flattenAllOf = (schema2) => {
4533
4533
  };
4534
4534
 
4535
4535
  // src/lib/util/traverse.ts
4536
- var traverse = (specification, transform, path33 = []) => {
4537
- const transformed = transform(specification, path33);
4536
+ var traverse = (specification, transform, path35 = []) => {
4537
+ const transformed = transform(specification, path35);
4538
4538
  if (typeof transformed !== "object" || transformed === null) {
4539
4539
  return transformed;
4540
4540
  }
4541
4541
  const result = Array.isArray(transformed) ? [] : {};
4542
4542
  for (const [key, value] of Object.entries(transformed)) {
4543
- const currentPath = [...path33, key];
4543
+ const currentPath = [...path35, key];
4544
4544
  if (Array.isArray(value)) {
4545
4545
  result[key] = value.map(
4546
4546
  (item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
@@ -4568,9 +4568,9 @@ var resolveLocalRef = (schema2, ref) => {
4568
4568
  if (schemaCache?.has(ref)) {
4569
4569
  return schemaCache.get(ref);
4570
4570
  }
4571
- const path33 = ref.split("/").slice(1);
4571
+ const path35 = ref.split("/").slice(1);
4572
4572
  let current = schema2;
4573
- for (const segment of path33) {
4573
+ for (const segment of path35) {
4574
4574
  if (!current || typeof current !== "object") {
4575
4575
  current = null;
4576
4576
  }
@@ -4589,7 +4589,7 @@ var dereference = async (schema2, resolvers = []) => {
4589
4589
  }
4590
4590
  const cloned = structuredClone(schema2);
4591
4591
  const visited = /* @__PURE__ */ new Set();
4592
- const resolve = async (current, path33) => {
4592
+ const resolve = async (current, path35) => {
4593
4593
  if (isIndexableObject(current)) {
4594
4594
  if (visited.has(current)) {
4595
4595
  return CIRCULAR_REF;
@@ -4597,7 +4597,7 @@ var dereference = async (schema2, resolvers = []) => {
4597
4597
  visited.add(current);
4598
4598
  if (Array.isArray(current)) {
4599
4599
  for (let index = 0; index < current.length; index++) {
4600
- current[index] = await resolve(current[index], `${path33}/${index}`);
4600
+ current[index] = await resolve(current[index], `${path35}/${index}`);
4601
4601
  }
4602
4602
  } else {
4603
4603
  if ("$ref" in current && typeof current.$ref === "string") {
@@ -4608,13 +4608,13 @@ var dereference = async (schema2, resolvers = []) => {
4608
4608
  for (const resolver of resolvers) {
4609
4609
  const resolved = await resolver($ref);
4610
4610
  if (resolved) {
4611
- result2 = await resolve(resolved, path33);
4611
+ result2 = await resolve(resolved, path35);
4612
4612
  break;
4613
4613
  }
4614
4614
  }
4615
4615
  if (result2 === void 0) {
4616
4616
  const resolved = await resolveLocalRef(cloned, $ref);
4617
- result2 = await resolve(resolved, path33);
4617
+ result2 = await resolve(resolved, path35);
4618
4618
  }
4619
4619
  if (hasSiblings) {
4620
4620
  if (result2 === CIRCULAR_REF) {
@@ -4627,7 +4627,7 @@ var dereference = async (schema2, resolvers = []) => {
4627
4627
  return result2;
4628
4628
  }
4629
4629
  for (const key in current) {
4630
- current[key] = await resolve(current[key], `${path33}/${key}`);
4630
+ current[key] = await resolve(current[key], `${path35}/${key}`);
4631
4631
  }
4632
4632
  }
4633
4633
  visited.delete(current);
@@ -4666,9 +4666,9 @@ var upgradeSchema = (schema2) => {
4666
4666
  }
4667
4667
  return sub;
4668
4668
  });
4669
- schema2 = traverse(schema2, (sub, path33) => {
4669
+ schema2 = traverse(schema2, (sub, path35) => {
4670
4670
  if (sub.example !== void 0) {
4671
- if (isSchemaPath(path33 ?? [])) {
4671
+ if (isSchemaPath(path35 ?? [])) {
4672
4672
  sub.examples = [sub.example];
4673
4673
  } else {
4674
4674
  sub.examples = {
@@ -4681,11 +4681,11 @@ var upgradeSchema = (schema2) => {
4681
4681
  }
4682
4682
  return sub;
4683
4683
  });
4684
- schema2 = traverse(schema2, (schema3, path33) => {
4684
+ schema2 = traverse(schema2, (schema3, path35) => {
4685
4685
  if (schema3.type === "object" && schema3.properties !== void 0) {
4686
- const parentPath = path33?.slice(0, -1);
4686
+ const parentPath = path35?.slice(0, -1);
4687
4687
  const isMultipart = parentPath?.some((segment, index) => {
4688
- return segment === "content" && path33?.[index + 1] === "multipart/form-data";
4688
+ return segment === "content" && path35?.[index + 1] === "multipart/form-data";
4689
4689
  });
4690
4690
  if (isMultipart) {
4691
4691
  const entries = Object.entries(schema3.properties);
@@ -4699,8 +4699,8 @@ var upgradeSchema = (schema2) => {
4699
4699
  }
4700
4700
  return schema3;
4701
4701
  });
4702
- schema2 = traverse(schema2, (schema3, path33) => {
4703
- if (path33?.includes("content") && path33.includes("application/octet-stream")) {
4702
+ schema2 = traverse(schema2, (schema3, path35) => {
4703
+ if (path35?.includes("content") && path35.includes("application/octet-stream")) {
4704
4704
  return {};
4705
4705
  }
4706
4706
  if (schema3.type === "string" && schema3.format === "binary") {
@@ -4726,11 +4726,11 @@ var upgradeSchema = (schema2) => {
4726
4726
  }
4727
4727
  return sub;
4728
4728
  });
4729
- schema2 = traverse(schema2, (schema3, path33) => {
4729
+ schema2 = traverse(schema2, (schema3, path35) => {
4730
4730
  if (schema3.type === "string" && schema3.format === "byte") {
4731
- const parentPath = path33?.slice(0, -1);
4731
+ const parentPath = path35?.slice(0, -1);
4732
4732
  const contentMediaType = parentPath?.find(
4733
- (_, index) => path33?.[index - 1] === "content"
4733
+ (_, index) => path35?.[index - 1] === "content"
4734
4734
  );
4735
4735
  return {
4736
4736
  type: "string",
@@ -4742,7 +4742,7 @@ var upgradeSchema = (schema2) => {
4742
4742
  });
4743
4743
  return schema2;
4744
4744
  };
4745
- function isSchemaPath(path33) {
4745
+ function isSchemaPath(path35) {
4746
4746
  const schemaLocations = [
4747
4747
  ["components", "schemas"],
4748
4748
  "properties",
@@ -4755,10 +4755,10 @@ function isSchemaPath(path33) {
4755
4755
  ];
4756
4756
  return schemaLocations.some((location) => {
4757
4757
  if (Array.isArray(location)) {
4758
- return location.every((segment, index) => path33[index] === segment);
4758
+ return location.every((segment, index) => path35[index] === segment);
4759
4759
  }
4760
- return path33.includes(location);
4761
- }) || path33.includes("schema") || path33.some((segment) => segment.endsWith("Schema"));
4760
+ return path35.includes(location);
4761
+ }) || path35.includes("schema") || path35.some((segment) => segment.endsWith("Schema"));
4762
4762
  }
4763
4763
 
4764
4764
  // src/lib/oas/parser/index.ts
@@ -4840,13 +4840,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
4840
4840
  "anyOf",
4841
4841
  "oneOf"
4842
4842
  ]);
4843
- var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path33 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
4843
+ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path35 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
4844
4844
  if (obj === null || typeof obj !== "object") return obj;
4845
4845
  const refPath = obj.__$ref;
4846
4846
  const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
4847
4847
  if (isCircular) {
4848
4848
  if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
4849
- const circularProp = path33.find((p) => !OPENAPI_PROPS.has(p)) || path33[0];
4849
+ const circularProp = path35.find((p) => !OPENAPI_PROPS.has(p)) || path35[0];
4850
4850
  return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
4851
4851
  }
4852
4852
  if (refs.has(obj)) return refs.get(obj);
@@ -4856,7 +4856,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
4856
4856
  value,
4857
4857
  currentPath,
4858
4858
  refs,
4859
- [...path33, key],
4859
+ [...path35, key],
4860
4860
  currentRefPaths
4861
4861
  );
4862
4862
  const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
@@ -4891,7 +4891,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
4891
4891
  var getAllTags = (schema2) => {
4892
4892
  const rootTags = schema2.tags ?? [];
4893
4893
  const operations = Object.values(schema2.paths ?? {}).flatMap(
4894
- (path33) => HttpMethods.map((k) => path33?.[k]).filter((op) => op != null)
4894
+ (path35) => HttpMethods.map((k) => path35?.[k]).filter((op) => op != null)
4895
4895
  );
4896
4896
  const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
4897
4897
  const hasUntaggedOperations = operations.some(
@@ -4946,7 +4946,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
4946
4946
  var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
4947
4947
  var getAllOperations = (paths) => {
4948
4948
  const operations = Object.entries(paths ?? {}).flatMap(
4949
- ([path33, value]) => HttpMethods.flatMap((method) => {
4949
+ ([path35, value]) => HttpMethods.flatMap((method) => {
4950
4950
  if (!value?.[method]) return [];
4951
4951
  const operation = value[method];
4952
4952
  const pathParameters = value.parameters ?? [];
@@ -4966,7 +4966,7 @@ var getAllOperations = (paths) => {
4966
4966
  return {
4967
4967
  ...operation,
4968
4968
  method,
4969
- path: path33,
4969
+ path: path35,
4970
4970
  parameters,
4971
4971
  servers,
4972
4972
  tags: operation.tags ?? []
@@ -5324,8 +5324,8 @@ var Schema = builder.objectRef("Schema").implement({
5324
5324
  }),
5325
5325
  paths: t.field({
5326
5326
  type: [PathItem],
5327
- resolve: (root) => Object.entries(root.paths ?? {}).map(([path33, value]) => ({
5328
- path: path33,
5327
+ resolve: (root) => Object.entries(root.paths ?? {}).map(([path35, value]) => ({
5328
+ path: path35,
5329
5329
  // biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
5330
5330
  methods: Object.keys(value)
5331
5331
  }))
@@ -5472,7 +5472,7 @@ init_joinUrl();
5472
5472
 
5473
5473
  // src/vite/api/schema-codegen.ts
5474
5474
  var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
5475
- var getSegmentsFromPath = (path33) => path33.split("/").slice(1).map(unescapeJsonPointer);
5475
+ var getSegmentsFromPath = (path35) => path35.split("/").slice(1).map(unescapeJsonPointer);
5476
5476
  var createLocalRefMap = (obj) => {
5477
5477
  const refMap = /* @__PURE__ */ new Map();
5478
5478
  const siblingsMap = /* @__PURE__ */ new Map();
@@ -5503,16 +5503,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
5503
5503
  /"__refMap\+Siblings:(.*?)"/g,
5504
5504
  (_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
5505
5505
  );
5506
- var lookup = (schema2, path33, filePath) => {
5507
- const parts = getSegmentsFromPath(path33);
5506
+ var lookup = (schema2, path35, filePath) => {
5507
+ const parts = getSegmentsFromPath(path35);
5508
5508
  let val = schema2;
5509
5509
  for (const part of parts) {
5510
5510
  while (val.$ref?.startsWith("#/")) {
5511
- val = val.$ref === path33 ? val : lookup(schema2, val.$ref, filePath);
5511
+ val = val.$ref === path35 ? val : lookup(schema2, val.$ref, filePath);
5512
5512
  }
5513
5513
  if (val[part] === void 0) {
5514
5514
  throw new Error(
5515
- `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path33}`
5515
+ `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path35}`
5516
5516
  );
5517
5517
  }
5518
5518
  val = val[part];
@@ -5757,8 +5757,8 @@ var SchemaManager = class {
5757
5757
  }
5758
5758
  }
5759
5759
  };
5760
- getLatestSchema = (path33) => this.processedSchemas[path33]?.at(0);
5761
- getSchemasForPath = (path33) => this.processedSchemas[path33];
5760
+ getLatestSchema = (path35) => this.processedSchemas[path35]?.at(0);
5761
+ getSchemasForPath = (path35) => this.processedSchemas[path35];
5762
5762
  getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
5763
5763
  getUrlToFilePathMap = () => {
5764
5764
  const map = /* @__PURE__ */ new Map();
@@ -5911,7 +5911,7 @@ var NavigationResolver = class {
5911
5911
  );
5912
5912
  if (!foundMatches) {
5913
5913
  throw new Error(
5914
- `File not found for document '${filePath}'. Navigation items of type 'doc' must point to a valid .md or .mdx file. Do you mean 'link' or 'custom-page'? Check navigation configuration documentation for more information: https://zudoku.dev/docs/configuration/navigation`
5914
+ `File not found for document '${filePath}'. Navigation items of type 'doc' must point to a valid .md or .mdx file. Do you mean 'link' or 'custom-page'? Check navigation configuration documentation for more information: https://docs.apitogo.com/docs/configuration/navigation`
5915
5915
  );
5916
5916
  }
5917
5917
  const { data, content } = await readFrontmatter(foundMatches);
@@ -7322,15 +7322,41 @@ var plugin_mdx_default = viteMdxPlugin;
7322
7322
 
7323
7323
  // src/vite/plugin-search.ts
7324
7324
  init_loader();
7325
+ 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
7325
7341
  var viteSearchPlugin = () => {
7326
7342
  const virtualModuleId4 = "virtual:zudoku-search-plugin";
7327
7343
  const resolvedVirtualModuleId4 = `\0${virtualModuleId4}`;
7344
+ let resolvedViteConfig;
7328
7345
  return {
7329
7346
  name: "zudoku-search-plugin",
7347
+ async configResolved(config2) {
7348
+ resolvedViteConfig = config2;
7349
+ if (config2.publicDir && getCurrentConfig()?.search?.type === "pagefind") {
7350
+ await ensurePagefindDevStub(config2.publicDir);
7351
+ }
7352
+ },
7330
7353
  resolveId(id) {
7331
7354
  if (id === virtualModuleId4) {
7332
7355
  return resolvedVirtualModuleId4;
7333
7356
  }
7357
+ if (id === "/pagefind/pagefind.js" && resolvedViteConfig?.publicDir) {
7358
+ return path18.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
7359
+ }
7334
7360
  },
7335
7361
  async load(id) {
7336
7362
  if (id !== resolvedVirtualModuleId4) return;
@@ -7466,8 +7492,8 @@ function vitePlugin() {
7466
7492
  }
7467
7493
 
7468
7494
  // src/vite/config.ts
7469
- var getAppClientEntryPath = () => path17.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
7470
- var getAppServerEntryPath = () => path17.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
7495
+ var getAppClientEntryPath = () => path19.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
7496
+ var getAppServerEntryPath = () => path19.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
7471
7497
  var hasLoggedCdnInfo = false;
7472
7498
  var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
7473
7499
  var defineEnvVars = (vars) => Object.fromEntries(
@@ -7497,7 +7523,7 @@ async function getViteConfig(dir, configEnv) {
7497
7523
  );
7498
7524
  if (ZuploEnv.isZuplo) {
7499
7525
  dotenv.config({
7500
- path: path17.resolve(config2.__meta.rootDir, "../.env.zuplo"),
7526
+ path: path19.resolve(config2.__meta.rootDir, "../.env.zuplo"),
7501
7527
  quiet: true
7502
7528
  });
7503
7529
  }
@@ -7554,8 +7580,8 @@ async function getViteConfig(dir, configEnv) {
7554
7580
  ssr: configEnv.isSsrBuild,
7555
7581
  sourcemap: true,
7556
7582
  target: "es2022",
7557
- outDir: path17.resolve(
7558
- path17.join(
7583
+ outDir: path19.resolve(
7584
+ path19.join(
7559
7585
  dir,
7560
7586
  "dist",
7561
7587
  config2.basePath ?? "",
@@ -7574,7 +7600,7 @@ async function getViteConfig(dir, configEnv) {
7574
7600
  },
7575
7601
  experimental: {
7576
7602
  renderBuiltUrl(filename) {
7577
- if (cdnUrl?.base && [".js", ".css"].includes(path17.extname(filename))) {
7603
+ if (cdnUrl?.base && [".js", ".css"].includes(path19.extname(filename))) {
7578
7604
  return joinUrl(cdnUrl.base, filename);
7579
7605
  }
7580
7606
  if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
@@ -7587,7 +7613,7 @@ async function getViteConfig(dir, configEnv) {
7587
7613
  esbuildOptions: {
7588
7614
  target: "es2022"
7589
7615
  },
7590
- entries: [path17.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
7616
+ entries: [path19.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
7591
7617
  exclude: ["@lukoweb/apitogo"],
7592
7618
  include: [
7593
7619
  "react-dom/client",
@@ -7686,7 +7712,7 @@ init_package_json();
7686
7712
  init_joinUrl();
7687
7713
  import assert from "node:assert";
7688
7714
  import { cp, mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
7689
- import path18 from "node:path";
7715
+ import path20 from "node:path";
7690
7716
  var pkgJson = getZudokuPackageJson();
7691
7717
  function generateOutput({
7692
7718
  config: config2,
@@ -7743,9 +7769,9 @@ async function writeOutput(dir, {
7743
7769
  rewrites
7744
7770
  }) {
7745
7771
  const output = generateOutput({ config: config2, redirects, rewrites });
7746
- const outputDir = process.env.VERCEL ? path18.join(dir, ".vercel/output") : path18.join(dir, "dist/.output");
7772
+ const outputDir = process.env.VERCEL ? path20.join(dir, ".vercel/output") : path20.join(dir, "dist/.output");
7747
7773
  await mkdir3(outputDir, { recursive: true });
7748
- const outputFile = path18.join(outputDir, "config.json");
7774
+ const outputFile = path20.join(outputDir, "config.json");
7749
7775
  await writeFile3(outputFile, JSON.stringify(output, null, 2), "utf-8");
7750
7776
  if (process.env.VERCEL) {
7751
7777
  console.log("Wrote Vercel output to", outputDir);
@@ -7757,7 +7783,7 @@ init_logger();
7757
7783
  init_file_exists();
7758
7784
  import { readFile as readFile2, rm } from "node:fs/promises";
7759
7785
  import os from "node:os";
7760
- import path21 from "node:path";
7786
+ import path23 from "node:path";
7761
7787
  import { pathToFileURL } from "node:url";
7762
7788
  import { createIndex } from "pagefind";
7763
7789
  import colors7 from "picocolors";
@@ -7799,7 +7825,7 @@ function throttle(fn) {
7799
7825
  init_joinUrl();
7800
7826
  import { createWriteStream, existsSync } from "node:fs";
7801
7827
  import { mkdir as mkdir4 } from "node:fs/promises";
7802
- import path19 from "node:path";
7828
+ import path21 from "node:path";
7803
7829
  import colors5 from "picocolors";
7804
7830
  import { SitemapStream } from "sitemap";
7805
7831
  async function generateSitemap({
@@ -7813,11 +7839,11 @@ async function generateSitemap({
7813
7839
  return;
7814
7840
  }
7815
7841
  const sitemap = new SitemapStream({ hostname: config2.siteUrl });
7816
- const outputDir = path19.resolve(baseOutputDir, config2.outDir ?? "");
7842
+ const outputDir = path21.resolve(baseOutputDir, config2.outDir ?? "");
7817
7843
  if (!existsSync(outputDir)) {
7818
7844
  await mkdir4(outputDir, { recursive: true });
7819
7845
  }
7820
- const sitemapOutputPath = path19.join(outputDir, "sitemap.xml");
7846
+ const sitemapOutputPath = path21.join(outputDir, "sitemap.xml");
7821
7847
  const writeStream = createWriteStream(sitemapOutputPath);
7822
7848
  sitemap.pipe(writeStream);
7823
7849
  let lastmod;
@@ -7847,14 +7873,14 @@ async function generateSitemap({
7847
7873
 
7848
7874
  // src/vite/prerender/utils.ts
7849
7875
  init_joinUrl();
7850
- var resolveRoutePath = (path33) => {
7851
- const segments = path33.split("/");
7876
+ var resolveRoutePath = (path35) => {
7877
+ const segments = path35.split("/");
7852
7878
  if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
7853
7879
  return void 0;
7854
7880
  }
7855
7881
  return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
7856
7882
  };
7857
- var isSkipped = (path33) => path33.includes("*") || /^\d+$/.test(path33);
7883
+ var isSkipped = (path35) => path35.includes("*") || /^\d+$/.test(path35);
7858
7884
  var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
7859
7885
  if (route.path && isSkipped(route.path)) return [];
7860
7886
  const routePath = route.path ? resolveRoutePath(route.path) : void 0;
@@ -7903,12 +7929,12 @@ var prerender = async ({
7903
7929
  serverConfigFilename,
7904
7930
  writeRedirects = true
7905
7931
  }) => {
7906
- const distDir = path21.join(dir, "dist", basePath);
7932
+ const distDir = path23.join(dir, "dist", basePath);
7907
7933
  const serverConfigPath = pathToFileURL(
7908
- path21.join(distDir, "server", serverConfigFilename)
7934
+ path23.join(distDir, "server", serverConfigFilename)
7909
7935
  ).href;
7910
7936
  const entryServerPath = pathToFileURL(
7911
- path21.join(distDir, "server/entry.server.js")
7937
+ path23.join(distDir, "server/entry.server.js")
7912
7938
  ).href;
7913
7939
  const rawConfig = await import(serverConfigPath).then(
7914
7940
  (m) => m.default
@@ -7993,7 +8019,7 @@ var prerender = async ({
7993
8019
  })
7994
8020
  );
7995
8021
  const pagefindWriteResult = await pagefindIndex?.writeFiles({
7996
- outputPath: path21.join(distDir, "pagefind")
8022
+ outputPath: path23.join(distDir, "pagefind")
7997
8023
  });
7998
8024
  const seconds = ((performance.now() - start) / 1e3).toFixed(1);
7999
8025
  const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
@@ -8025,7 +8051,7 @@ var prerender = async ({
8025
8051
  const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
8026
8052
  const docsConfig = DocsConfigSchema2.parse(config2.docs);
8027
8053
  const llmsConfig = docsConfig.llms ?? {};
8028
- const markdownInfoPath = path21.join(
8054
+ const markdownInfoPath = path23.join(
8029
8055
  dir,
8030
8056
  "node_modules/.apitogo/markdown-info.json"
8031
8057
  );
@@ -8116,7 +8142,7 @@ async function runBuild(options) {
8116
8142
  html,
8117
8143
  basePath: config2.basePath
8118
8144
  });
8119
- await rm2(path22.join(clientOutDir, "index.html"), { force: true });
8145
+ await rm2(path24.join(clientOutDir, "index.html"), { force: true });
8120
8146
  } else {
8121
8147
  await runPrerender({
8122
8148
  dir,
@@ -8140,7 +8166,7 @@ var runPrerender = async (options) => {
8140
8166
  serverConfigFilename,
8141
8167
  writeRedirects: process.env.VERCEL === void 0
8142
8168
  });
8143
- const indexHtml = path22.join(clientOutDir, "index.html");
8169
+ const indexHtml = path24.join(clientOutDir, "index.html");
8144
8170
  if (!workerResults.find((r) => r.outputPath === indexHtml)) {
8145
8171
  await writeFile5(indexHtml, html, "utf-8");
8146
8172
  }
@@ -8150,15 +8176,15 @@ var runPrerender = async (options) => {
8150
8176
  for (const statusPage of statusPages) {
8151
8177
  await rename(
8152
8178
  statusPage,
8153
- path22.join(dir, DIST_DIR, path22.basename(statusPage))
8179
+ path24.join(dir, DIST_DIR, path24.basename(statusPage))
8154
8180
  );
8155
8181
  }
8156
8182
  await rm2(serverOutDir, { recursive: true, force: true });
8157
8183
  if (process.env.VERCEL) {
8158
- await mkdir5(path22.join(dir, ".vercel/output/static"), { recursive: true });
8184
+ await mkdir5(path24.join(dir, ".vercel/output/static"), { recursive: true });
8159
8185
  await rename(
8160
- path22.join(dir, DIST_DIR),
8161
- path22.join(dir, ".vercel/output/static")
8186
+ path24.join(dir, DIST_DIR),
8187
+ path24.join(dir, ".vercel/output/static")
8162
8188
  );
8163
8189
  }
8164
8190
  await writeOutput(dir, {
@@ -8168,7 +8194,7 @@ var runPrerender = async (options) => {
8168
8194
  });
8169
8195
  if (ZuploEnv.isZuplo && issuer) {
8170
8196
  await writeFile5(
8171
- path22.join(dir, DIST_DIR, ".output/zuplo.json"),
8197
+ path24.join(dir, DIST_DIR, ".output/zuplo.json"),
8172
8198
  JSON.stringify({ issuer }, null, 2),
8173
8199
  "utf-8"
8174
8200
  );
@@ -8180,10 +8206,10 @@ var runPrerender = async (options) => {
8180
8206
  };
8181
8207
  var bundleSSREntry = async (options) => {
8182
8208
  const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
8183
- const tempEntryPath = path22.join(dir, "__ssr-entry.ts");
8209
+ const tempEntryPath = path24.join(dir, "__ssr-entry.ts");
8184
8210
  const packageRoot = getZudokuRootDir();
8185
8211
  const templateContent = await readFile3(
8186
- path22.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
8212
+ path24.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
8187
8213
  "utf-8"
8188
8214
  );
8189
8215
  const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
@@ -8198,9 +8224,9 @@ var bundleSSREntry = async (options) => {
8198
8224
  platform: adapter === "node" ? "node" : "neutral",
8199
8225
  target: "es2022",
8200
8226
  format: "esm",
8201
- outfile: path22.join(serverOutDir, "entry.js"),
8227
+ outfile: path24.join(serverOutDir, "entry.js"),
8202
8228
  external: ["./entry.server.js", `./${serverConfigFilename}`],
8203
- nodePaths: [path22.join(packageRoot, "node_modules")],
8229
+ nodePaths: [path24.join(packageRoot, "node_modules")],
8204
8230
  banner: { js: "// Bundled SSR entry" }
8205
8231
  });
8206
8232
  } finally {
@@ -8254,11 +8280,11 @@ function textOrJson(text) {
8254
8280
  init_package_json();
8255
8281
 
8256
8282
  // src/cli/preview/handler.ts
8257
- import path23 from "node:path";
8283
+ import path25 from "node:path";
8258
8284
  import { preview as vitePreview } from "vite";
8259
8285
  var DEFAULT_PREVIEW_PORT = 4e3;
8260
8286
  async function preview(argv) {
8261
- const dir = path23.resolve(process.cwd(), argv.dir);
8287
+ const dir = path25.resolve(process.cwd(), argv.dir);
8262
8288
  const viteConfig = await getViteConfig(dir, {
8263
8289
  command: "serve",
8264
8290
  mode: "production",
@@ -8299,7 +8325,7 @@ async function build(argv) {
8299
8325
  printDiagnosticsToConsole("");
8300
8326
  printDiagnosticsToConsole("");
8301
8327
  }
8302
- const dir = path24.resolve(process.cwd(), argv.dir);
8328
+ const dir = path26.resolve(process.cwd(), argv.dir);
8303
8329
  try {
8304
8330
  await runBuild({
8305
8331
  dir,
@@ -8459,7 +8485,7 @@ var build_default = {
8459
8485
  // src/cli/configure-github-workflow/handler.ts
8460
8486
  import { constants } from "node:fs";
8461
8487
  import { access, mkdir as mkdir6, writeFile as writeFile6 } from "node:fs/promises";
8462
- import path25 from "node:path";
8488
+ import path27 from "node:path";
8463
8489
  var APITOGO_DEPLOY_WORKFLOW_YAML = `name: Build and Deploy
8464
8490
 
8465
8491
  on:
@@ -8552,9 +8578,9 @@ jobs:
8552
8578
  run: apitogo deploy --deployment-token="$APITOGO_TOKEN" --json-only
8553
8579
  `;
8554
8580
  async function configureGithubWorkflow(argv) {
8555
- const dir = path25.resolve(process.cwd(), argv.dir);
8556
- const workflowDir = path25.join(dir, ".github", "workflows");
8557
- const workflowPath = path25.join(workflowDir, "apitogo-deploy.yml");
8581
+ const dir = path27.resolve(process.cwd(), argv.dir);
8582
+ const workflowDir = path27.join(dir, ".github", "workflows");
8583
+ const workflowPath = path27.join(workflowDir, "apitogo-deploy.yml");
8558
8584
  try {
8559
8585
  try {
8560
8586
  await access(workflowPath, constants.F_OK);
@@ -8620,15 +8646,15 @@ function applyJsonOnlyDeployQuietMode() {
8620
8646
 
8621
8647
  // src/cli/deploy/handler.ts
8622
8648
  import { access as access2, readFile as readFile4 } from "node:fs/promises";
8623
- import path26 from "node:path";
8649
+ import path28 from "node:path";
8624
8650
  import { create as createTar } from "tar";
8625
8651
  var DEPLOY_ENDPOINT = "https://deployserver.apitogo.com/deploy";
8626
8652
  var DEPLOY_API_KEY = "qRVLTP22TFStdN6";
8627
8653
  var ARCHIVE_NAME = "dist.tgz";
8628
8654
  var createDeploymentArchive = async (dir) => {
8629
- const distDir = path26.join(dir, "dist");
8655
+ const distDir = path28.join(dir, "dist");
8630
8656
  await access2(distDir);
8631
- const archivePath = path26.join(dir, ARCHIVE_NAME);
8657
+ const archivePath = path28.join(dir, ARCHIVE_NAME);
8632
8658
  await createTar(
8633
8659
  {
8634
8660
  cwd: dir,
@@ -8642,7 +8668,7 @@ var createDeploymentArchive = async (dir) => {
8642
8668
  };
8643
8669
  async function deploy(argv) {
8644
8670
  await build({ ...argv, preview: void 0 });
8645
- const dir = path26.resolve(process.cwd(), argv.dir);
8671
+ const dir = path28.resolve(process.cwd(), argv.dir);
8646
8672
  const deploymentToken = argv.deploymentToken?.trim() || process.env.npm_config_deployment_token?.trim();
8647
8673
  const env = argv.env?.trim() || process.env.npm_config_env?.trim() || "production";
8648
8674
  try {
@@ -8655,7 +8681,7 @@ async function deploy(argv) {
8655
8681
  const archivePath = await createDeploymentArchive(dir);
8656
8682
  if (!isJsonOnlyDeployEnv()) {
8657
8683
  printDiagnosticsToConsole(
8658
- `Uploading ${path26.basename(archivePath)} to ${env}...`
8684
+ `Uploading ${path28.basename(archivePath)} to ${env}...`
8659
8685
  );
8660
8686
  }
8661
8687
  const archiveBuffer = await readFile4(archivePath);
@@ -8663,7 +8689,7 @@ async function deploy(argv) {
8663
8689
  formData.append(
8664
8690
  "file",
8665
8691
  new Blob([archiveBuffer], { type: "application/gzip" }),
8666
- path26.basename(archivePath)
8692
+ path28.basename(archivePath)
8667
8693
  );
8668
8694
  formData.append("deploymentToken", deploymentToken);
8669
8695
  formData.append("env", env);
@@ -8748,14 +8774,14 @@ var deploy_default = {
8748
8774
 
8749
8775
  // src/cli/dev/handler.ts
8750
8776
  init_joinUrl();
8751
- import path29 from "node:path";
8777
+ import path31 from "node:path";
8752
8778
 
8753
8779
  // src/vite/dev-server.ts
8754
8780
  init_logger();
8755
- import fs3 from "node:fs/promises";
8781
+ import fs4 from "node:fs/promises";
8756
8782
  import http from "node:http";
8757
8783
  import https from "node:https";
8758
- import path28 from "node:path";
8784
+ import path30 from "node:path";
8759
8785
  import { createHttpTerminator } from "http-terminator";
8760
8786
  import {
8761
8787
  createServer as createViteServer,
@@ -8788,7 +8814,7 @@ init_loader();
8788
8814
  // src/vite/pagefind-dev-index.ts
8789
8815
  init_invariant();
8790
8816
  init_joinUrl();
8791
- import path27 from "node:path";
8817
+ import path29 from "node:path";
8792
8818
  import { createIndex as createIndex2 } from "pagefind";
8793
8819
  import { isRunnableDevEnvironment } from "vite";
8794
8820
  async function* buildPagefindDevIndex(vite, config2) {
@@ -8841,7 +8867,7 @@ async function* buildPagefindDevIndex(vite, config2) {
8841
8867
  path: urlPath
8842
8868
  };
8843
8869
  }
8844
- const outputPath = path27.join(vite.config.publicDir, "pagefind");
8870
+ const outputPath = path29.join(vite.config.publicDir, "pagefind");
8845
8871
  await pagefindIndex.writeFiles({ outputPath });
8846
8872
  yield { type: "complete", success: true, indexed };
8847
8873
  }
@@ -8860,9 +8886,9 @@ var DevServer = class {
8860
8886
  this.protocol = "https";
8861
8887
  const { dir } = this.options;
8862
8888
  const [key, cert, ca] = await Promise.all([
8863
- fs3.readFile(path28.resolve(dir, config2.https.key)),
8864
- fs3.readFile(path28.resolve(dir, config2.https.cert)),
8865
- config2.https.ca ? fs3.readFile(path28.resolve(dir, config2.https.ca)) : void 0
8889
+ fs4.readFile(path30.resolve(dir, config2.https.key)),
8890
+ fs4.readFile(path30.resolve(dir, config2.https.cert)),
8891
+ config2.https.ca ? fs4.readFile(path30.resolve(dir, config2.https.ca)) : void 0
8866
8892
  ]);
8867
8893
  return https.createServer({ key, cert, ca });
8868
8894
  }
@@ -8878,6 +8904,13 @@ var DevServer = class {
8878
8904
  this.options.argPort ?? config2.port ?? DEFAULT_DEV_PORT
8879
8905
  );
8880
8906
  const server = await this.createNodeServer(config2);
8907
+ if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
8908
+ const publicRoot = path30.resolve(
8909
+ this.options.dir,
8910
+ typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
8911
+ );
8912
+ await ensurePagefindDevStub(publicRoot);
8913
+ }
8881
8914
  const mergedViteConfig = mergeConfig4(viteConfig, {
8882
8915
  server: {
8883
8916
  hmr: { server }
@@ -8889,7 +8922,7 @@ var DevServer = class {
8889
8922
  // built-in transform middleware which would treat the path as a static asset.
8890
8923
  name: "apitogo:entry-client",
8891
8924
  configureServer(server2) {
8892
- const entryPath = path28.posix.join(
8925
+ const entryPath = path30.posix.join(
8893
8926
  server2.config.base,
8894
8927
  "/__z/entry.client.tsx"
8895
8928
  );
@@ -8961,16 +8994,8 @@ var DevServer = class {
8961
8994
  printDiagnosticsToConsole(
8962
8995
  `Server-side rendering ${this.options.ssr ? "enabled" : "disabled"}`
8963
8996
  );
8964
- if (config2.search?.type === "pagefind") {
8965
- const pagefindPath = path28.join(
8966
- vite.config.publicDir,
8967
- "pagefind/pagefind.js"
8968
- );
8969
- const exists = await fs3.stat(pagefindPath).catch(() => false);
8970
- if (!exists) {
8971
- await fs3.mkdir(path28.dirname(pagefindPath), { recursive: true });
8972
- await fs3.writeFile(pagefindPath, 'throw new Error("NOT_BUILT_YET");');
8973
- }
8997
+ if (config2.search?.type === "pagefind" && vite.config.publicDir) {
8998
+ await ensurePagefindDevStub(vite.config.publicDir);
8974
8999
  }
8975
9000
  vite.middlewares.use(async (req, res) => {
8976
9001
  const url = req.originalUrl ?? req.url ?? "/";
@@ -9062,7 +9087,7 @@ init_package_json();
9062
9087
  async function dev(argv) {
9063
9088
  const packageJson2 = getZudokuPackageJson();
9064
9089
  process.env.NODE_ENV = "development";
9065
- const dir = path29.resolve(process.cwd(), argv.dir);
9090
+ const dir = path31.resolve(process.cwd(), argv.dir);
9066
9091
  const server = new DevServer({
9067
9092
  dir,
9068
9093
  argPort: argv.port,
@@ -9146,14 +9171,14 @@ var dev_default = {
9146
9171
 
9147
9172
  // src/cli/make-config/handler.ts
9148
9173
  import { readFile as readFile6, writeFile as writeFile8 } from "node:fs/promises";
9149
- import path31 from "node:path";
9174
+ import path33 from "node:path";
9150
9175
  import { glob as glob5 } from "glob";
9151
9176
 
9152
9177
  // src/cli/make-config/scaffold-project.ts
9153
9178
  init_package_json();
9154
9179
  import { access as access3, readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
9155
9180
  import { constants as constants2 } from "node:fs";
9156
- import path30 from "node:path";
9181
+ import path32 from "node:path";
9157
9182
  import { glob as glob4 } from "glob";
9158
9183
  var OPENAPI_GLOBS = [
9159
9184
  "apis/openapi.json",
@@ -9213,9 +9238,9 @@ var findMatchingCurly = (source, startIndex) => {
9213
9238
  }
9214
9239
  throw new Error("Could not find matching closing brace for object.");
9215
9240
  };
9216
- var toPosix = (p) => p.split(path30.sep).join("/");
9241
+ var toPosix = (p) => p.split(path32.sep).join("/");
9217
9242
  var sanitizePackageName = (dir) => {
9218
- const base = path30.basename(path30.resolve(dir));
9243
+ const base = path32.basename(path32.resolve(dir));
9219
9244
  const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
9220
9245
  return s || "apitogo-site";
9221
9246
  };
@@ -9225,7 +9250,7 @@ var apitogoVersionRange = () => {
9225
9250
  };
9226
9251
  async function findOpenApiSpecPath(dir) {
9227
9252
  for (const rel of OPENAPI_GLOBS) {
9228
- const full = path30.join(dir, rel);
9253
+ const full = path32.join(dir, rel);
9229
9254
  try {
9230
9255
  await access3(full, constants2.R_OK);
9231
9256
  return toPosix(rel);
@@ -9240,7 +9265,7 @@ async function findOpenApiSpecPath(dir) {
9240
9265
  return extra[0] ? toPosix(extra[0]) : null;
9241
9266
  }
9242
9267
  async function ensurePackageJson(dir) {
9243
- const pkgPath = path30.join(dir, "package.json");
9268
+ const pkgPath = path32.join(dir, "package.json");
9244
9269
  const apitogoVer = apitogoVersionRange();
9245
9270
  const baseDeps = {
9246
9271
  react: ">=19.0.0",
@@ -9301,7 +9326,7 @@ async function ensurePackageJson(dir) {
9301
9326
  return false;
9302
9327
  }
9303
9328
  async function ensureTsconfigJson(dir) {
9304
- const tsPath = path30.join(dir, "tsconfig.json");
9329
+ const tsPath = path32.join(dir, "tsconfig.json");
9305
9330
  try {
9306
9331
  await access3(tsPath, constants2.R_OK);
9307
9332
  return false;
@@ -9383,7 +9408,7 @@ var CONFIG_FILENAMES = [
9383
9408
  ];
9384
9409
  var DEFAULT_NEW_CONFIG_FILENAME = "apitogo.config.tsx";
9385
9410
  var createTreeNode = () => ({ docs: [], children: /* @__PURE__ */ new Map() });
9386
- var toPosixPath2 = (value) => value.split(path31.sep).join(path31.posix.sep);
9411
+ var toPosixPath2 = (value) => value.split(path33.sep).join(path33.posix.sep);
9387
9412
  var toRoutePath = (relativeFile, pagesDir) => {
9388
9413
  const relativeNoExt = relativeFile.replace(/\.mdx?$/, "");
9389
9414
  const withoutPagesPrefix = relativeNoExt.replace(
@@ -9628,7 +9653,7 @@ export default config;
9628
9653
  };
9629
9654
  var findExistingConfigPath = async (dir) => {
9630
9655
  for (const filename of CONFIG_FILENAMES) {
9631
- const fullPath = path31.join(dir, filename);
9656
+ const fullPath = path33.join(dir, filename);
9632
9657
  try {
9633
9658
  await readFile6(fullPath, "utf8");
9634
9659
  return fullPath;
@@ -9638,7 +9663,7 @@ var findExistingConfigPath = async (dir) => {
9638
9663
  return null;
9639
9664
  };
9640
9665
  async function makeConfig(argv) {
9641
- const dir = path31.resolve(process.cwd(), argv.dir);
9666
+ const dir = path33.resolve(process.cwd(), argv.dir);
9642
9667
  const pagesDir = toPosixPath2(
9643
9668
  argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
9644
9669
  );
@@ -9655,7 +9680,7 @@ async function makeConfig(argv) {
9655
9680
  let configPath = await findExistingConfigPath(dir);
9656
9681
  let createdNew = false;
9657
9682
  if (!configPath) {
9658
- configPath = path31.join(dir, DEFAULT_NEW_CONFIG_FILENAME);
9683
+ configPath = path33.join(dir, DEFAULT_NEW_CONFIG_FILENAME);
9659
9684
  await writeFile8(
9660
9685
  configPath,
9661
9686
  buildNewConfigContents(pagesDir, openApiSpecPath),
@@ -9696,7 +9721,7 @@ async function makeConfig(argv) {
9696
9721
  await writeFile8(configPath, withRedirects, "utf8");
9697
9722
  const action = createdNew ? "Initialized" : "Updated";
9698
9723
  printResultToConsole(
9699
- `${action} ${path31.basename(configPath)} from ${pagesDir}/ (navigation and redirects; other top-level settings preserved unless newly scaffolded).`
9724
+ `${action} ${path33.basename(configPath)} from ${pagesDir}/ (navigation and redirects; other top-level settings preserved unless newly scaffolded).`
9700
9725
  );
9701
9726
  if (createdPackageJson) {
9702
9727
  printDiagnosticsToConsole(
@@ -9805,12 +9830,12 @@ function box(message, {
9805
9830
 
9806
9831
  // src/cli/common/xdg/lib.ts
9807
9832
  import { homedir } from "node:os";
9808
- import path32 from "node:path";
9833
+ import path34 from "node:path";
9809
9834
  function defineDirectoryWithFallback(xdgName, fallback) {
9810
9835
  if (process.env[xdgName]) {
9811
9836
  return process.env[xdgName];
9812
9837
  } else {
9813
- return path32.join(homedir(), fallback);
9838
+ return path34.join(homedir(), fallback);
9814
9839
  }
9815
9840
  }
9816
9841
  var XDG_CONFIG_HOME = defineDirectoryWithFallback(
@@ -9825,15 +9850,15 @@ var XDG_STATE_HOME = defineDirectoryWithFallback(
9825
9850
  "XDG_DATA_HOME",
9826
9851
  ".local/state"
9827
9852
  );
9828
- var ZUDOKU_XDG_CONFIG_HOME = path32.join(
9853
+ var ZUDOKU_XDG_CONFIG_HOME = path34.join(
9829
9854
  XDG_CONFIG_HOME,
9830
9855
  CLI_XDG_FOLDER_NAME
9831
9856
  );
9832
- var ZUDOKU_XDG_DATA_HOME = path32.join(
9857
+ var ZUDOKU_XDG_DATA_HOME = path34.join(
9833
9858
  XDG_DATA_HOME,
9834
9859
  CLI_XDG_FOLDER_NAME
9835
9860
  );
9836
- var ZUDOKU_XDG_STATE_HOME = path32.join(
9861
+ var ZUDOKU_XDG_STATE_HOME = path34.join(
9837
9862
  XDG_STATE_HOME,
9838
9863
  CLI_XDG_FOLDER_NAME
9839
9864
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",
@@ -221,7 +221,7 @@ export class NavigationResolver {
221
221
 
222
222
  if (!foundMatches) {
223
223
  throw new Error(
224
- `File not found for document '${filePath}'. Navigation items of type 'doc' must point to a valid .md or .mdx file. Do you mean 'link' or 'custom-page'? Check navigation configuration documentation for more information: https://zudoku.dev/docs/configuration/navigation`,
224
+ `File not found for document '${filePath}'. Navigation items of type 'doc' must point to a valid .md or .mdx file. Do you mean 'link' or 'custom-page'? Check navigation configuration documentation for more information: https://docs.apitogo.com/docs/configuration/navigation`,
225
225
  );
226
226
  }
227
227
 
package/src/lib/shiki.ts CHANGED
@@ -57,7 +57,7 @@ const warnUnloadedLanguage = (lang: string, highlighter: HighlighterCore) => {
57
57
  console.warn(
58
58
  `Language "${lang}" is not loaded for syntax highlighting. ` +
59
59
  `Add it to \`syntaxHighlighting.languages\` in your config. Falling back to plain text.\n` +
60
- `See https://zudoku.dev/docs/markdown/code-blocks#configuration`,
60
+ `See https://docs.apitogo.com/docs/markdown/code-blocks#configuration`,
61
61
  );
62
62
  };
63
63
 
@@ -24,6 +24,7 @@ import {
24
24
  } from "./config.js";
25
25
  import { getDevHtml } from "./html.js";
26
26
  import { buildPagefindDevIndex } from "./pagefind-dev-index.js";
27
+ import { ensurePagefindDevStub } from "./pagefind-dev-stub.js";
27
28
 
28
29
  const DEFAULT_DEV_PORT = 3000;
29
30
 
@@ -75,6 +76,16 @@ export class DevServer {
75
76
 
76
77
  const server = await this.createNodeServer(config);
77
78
 
79
+ if (config.search?.type === "pagefind" && viteConfig.publicDir !== false) {
80
+ const publicRoot = path.resolve(
81
+ this.options.dir,
82
+ typeof viteConfig.publicDir === "string"
83
+ ? viteConfig.publicDir
84
+ : "public",
85
+ );
86
+ await ensurePagefindDevStub(publicRoot);
87
+ }
88
+
78
89
  const mergedViteConfig = mergeConfig(viteConfig, {
79
90
  server: {
80
91
  hmr: { server },
@@ -179,16 +190,8 @@ export class DevServer {
179
190
  `Server-side rendering ${this.options.ssr ? "enabled" : "disabled"}`,
180
191
  );
181
192
 
182
- if (config.search?.type === "pagefind") {
183
- const pagefindPath = path.join(
184
- vite.config.publicDir,
185
- "pagefind/pagefind.js",
186
- );
187
- const exists = await fs.stat(pagefindPath).catch(() => false);
188
- if (!exists) {
189
- await fs.mkdir(path.dirname(pagefindPath), { recursive: true });
190
- await fs.writeFile(pagefindPath, 'throw new Error("NOT_BUILT_YET");');
191
- }
193
+ if (config.search?.type === "pagefind" && vite.config.publicDir) {
194
+ await ensurePagefindDevStub(vite.config.publicDir);
192
195
  }
193
196
 
194
197
  vite.middlewares.use(async (req, res) => {
@@ -0,0 +1,17 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+
4
+ const NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
5
+
6
+ /**
7
+ * Writes a minimal `pagefind.js` under the Vite public dir so dev-time
8
+ * `import("/pagefind/pagefind.js")` resolves and the real index can be built later.
9
+ */
10
+ export async function ensurePagefindDevStub(publicDir: string): Promise<void> {
11
+ const pagefindPath = path.join(publicDir, "pagefind/pagefind.js");
12
+ const exists = await fs.stat(pagefindPath).catch(() => false);
13
+ if (!exists) {
14
+ await fs.mkdir(path.dirname(pagefindPath), { recursive: true });
15
+ await fs.writeFile(pagefindPath, NOT_BUILT_YET);
16
+ }
17
+ }
@@ -1,16 +1,34 @@
1
- import type { Plugin } from "vite";
1
+ import path from "node:path";
2
+ import type { Plugin, ResolvedConfig } from "vite";
2
3
  import { getCurrentConfig } from "../config/loader.js";
4
+ import { ensurePagefindDevStub } from "./pagefind-dev-stub.js";
3
5
 
4
6
  export const viteSearchPlugin = (): Plugin => {
5
7
  const virtualModuleId = "virtual:zudoku-search-plugin";
6
8
  const resolvedVirtualModuleId = `\0${virtualModuleId}`;
9
+ let resolvedViteConfig: ResolvedConfig | undefined;
7
10
 
8
11
  return {
9
12
  name: "zudoku-search-plugin",
13
+ async configResolved(config) {
14
+ resolvedViteConfig = config;
15
+ if (
16
+ config.publicDir &&
17
+ getCurrentConfig()?.search?.type === "pagefind"
18
+ ) {
19
+ await ensurePagefindDevStub(config.publicDir);
20
+ }
21
+ },
10
22
  resolveId(id) {
11
23
  if (id === virtualModuleId) {
12
24
  return resolvedVirtualModuleId;
13
25
  }
26
+ if (
27
+ id === "/pagefind/pagefind.js" &&
28
+ resolvedViteConfig?.publicDir
29
+ ) {
30
+ return path.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
31
+ }
14
32
  },
15
33
  async load(id) {
16
34
  if (id !== resolvedVirtualModuleId) return;