@lukoweb/apitogo 0.1.19 → 0.1.21

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
@@ -3822,7 +3822,7 @@ import {
3822
3822
  // package.json
3823
3823
  var package_default = {
3824
3824
  name: "@lukoweb/apitogo",
3825
- version: "0.1.19",
3825
+ version: "0.1.21",
3826
3826
  type: "module",
3827
3827
  sideEffects: [
3828
3828
  "**/*.css",
@@ -4203,14 +4203,27 @@ init_loader();
4203
4203
  init_ZudokuConfig();
4204
4204
  init_joinUrl();
4205
4205
 
4206
+ // src/vite/pagefind-dev-stub.ts
4207
+ import fs from "node:fs/promises";
4208
+ import path4 from "node:path";
4209
+ var NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
4210
+ async function ensurePagefindDevStub(publicDir) {
4211
+ const pagefindPath = path4.join(publicDir, "pagefind/pagefind.js");
4212
+ const exists = await fs.stat(pagefindPath).catch(() => false);
4213
+ if (!exists) {
4214
+ await fs.mkdir(path4.dirname(pagefindPath), { recursive: true });
4215
+ await fs.writeFile(pagefindPath, NOT_BUILT_YET);
4216
+ }
4217
+ }
4218
+
4206
4219
  // src/vite/package-root.ts
4207
4220
  init_file_exists();
4208
- import path4 from "node:path";
4221
+ import path5 from "node:path";
4209
4222
  var findPackageRoot = async (startDir) => {
4210
4223
  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);
4224
+ while (dir !== path5.dirname(dir)) {
4225
+ if (await fileExists(path5.join(dir, "package.json"))) return dir;
4226
+ dir = path5.dirname(dir);
4214
4227
  }
4215
4228
  };
4216
4229
 
@@ -4221,7 +4234,7 @@ import react from "@vitejs/plugin-react";
4221
4234
  // src/vite/css/plugin.ts
4222
4235
  init_loader();
4223
4236
  init_plugin_theme();
4224
- import path5 from "node:path";
4237
+ import path6 from "node:path";
4225
4238
  import { isCSSRequest as isCSSRequest2 } from "vite";
4226
4239
 
4227
4240
  // src/vite/css/collect.ts
@@ -4256,7 +4269,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
4256
4269
  function vitePluginSsrCss(pluginOpts) {
4257
4270
  let server;
4258
4271
  const config2 = getCurrentConfig();
4259
- const virtualHref = path5.join(
4272
+ const virtualHref = path6.join(
4260
4273
  config2.basePath ?? "",
4261
4274
  `/@id/__x00__${VIRTUAL_ENTRY}?direct`
4262
4275
  );
@@ -4390,8 +4403,8 @@ var viteApiKeysPlugin = () => {
4390
4403
  var plugin_api_keys_default = viteApiKeysPlugin;
4391
4404
 
4392
4405
  // src/vite/plugin-api.ts
4393
- import fs2 from "node:fs/promises";
4394
- import path11 from "node:path";
4406
+ import fs3 from "node:fs/promises";
4407
+ import path12 from "node:path";
4395
4408
  import { deepEqual as deepEqual2 } from "fast-equals";
4396
4409
  import { runnerImport as runnerImport3 } from "vite";
4397
4410
  init_package_json();
@@ -4400,7 +4413,7 @@ init_loader();
4400
4413
  // src/config/validators/BuildSchema.ts
4401
4414
  init_file_exists();
4402
4415
  init_loader();
4403
- import path6 from "node:path";
4416
+ import path7 from "node:path";
4404
4417
  import { runnerImport as runnerImport2 } from "vite";
4405
4418
  import { z as z8 } from "zod";
4406
4419
  var BuildProcessorSchema = z8.custom((val) => typeof val === "function");
@@ -4424,7 +4437,7 @@ var zudokuBuildConfigFiles = [
4424
4437
  ];
4425
4438
  async function getBuildConfigFilePath(rootDir) {
4426
4439
  for (const fileName of zudokuBuildConfigFiles) {
4427
- const filepath = path6.join(rootDir, fileName);
4440
+ const filepath = path7.join(rootDir, fileName);
4428
4441
  if (await fileExists(filepath)) {
4429
4442
  return filepath;
4430
4443
  }
@@ -5419,8 +5432,8 @@ var createGraphQLServer = (options) => createYoga({ schema, batching: true, ...o
5419
5432
  var ensureArray = (value) => Array.isArray(value) ? value : [value];
5420
5433
 
5421
5434
  // src/vite/api/SchemaManager.ts
5422
- import fs from "node:fs/promises";
5423
- import path7 from "node:path";
5435
+ import fs2 from "node:fs/promises";
5436
+ import path8 from "node:path";
5424
5437
  import {
5425
5438
  $RefParser as $RefParser2
5426
5439
  } from "@apidevtools/json-schema-ref-parser";
@@ -5610,18 +5623,18 @@ var SchemaManager = class {
5610
5623
  ];
5611
5624
  }
5612
5625
  getPathForFile = (input, params) => {
5613
- const filePath = path7.resolve(this.config.__meta.rootDir, input);
5626
+ const filePath = path8.resolve(this.config.__meta.rootDir, input);
5614
5627
  const apis = ensureArray(this.config.apis ?? []);
5615
5628
  for (const apiConfig of apis) {
5616
5629
  if (!apiConfig || apiConfig.type !== "file" || !apiConfig.path) continue;
5617
5630
  const match = normalizeInputs(apiConfig.input).some(
5618
- (i) => path7.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
5631
+ (i) => path8.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
5619
5632
  );
5620
5633
  if (match) return apiConfig.path;
5621
5634
  }
5622
5635
  };
5623
5636
  processSchema = async (input) => {
5624
- const filePath = path7.resolve(this.config.__meta.rootDir, input.input);
5637
+ const filePath = path8.resolve(this.config.__meta.rootDir, input.input);
5625
5638
  const params = input.params;
5626
5639
  const configuredPath = this.getPathForFile(input.input, params);
5627
5640
  if (!configuredPath) {
@@ -5657,15 +5670,15 @@ var SchemaManager = class {
5657
5670
  const processedTime = Date.now();
5658
5671
  const code = generateCode(processedSchema, filePath);
5659
5672
  const prefixPath = slugify(configuredPath);
5660
- const processedFilePath = path7.posix.join(
5673
+ const processedFilePath = path8.posix.join(
5661
5674
  this.storeDir,
5662
- `${prefixPath}-${path7.basename(filePath)}${paramsSuffix(params)}.js`
5675
+ `${prefixPath}-${path8.basename(filePath)}${paramsSuffix(params)}.js`
5663
5676
  );
5664
5677
  const importKey = processedFilePath;
5665
- await fs.writeFile(processedFilePath, code);
5678
+ await fs2.writeFile(processedFilePath, code);
5666
5679
  const processedJsonPath = paramsSuffix(params) ? processedFilePath.replace(/\.js$/, ".json") : "";
5667
5680
  if (processedJsonPath) {
5668
- await fs.writeFile(
5681
+ await fs2.writeFile(
5669
5682
  processedJsonPath,
5670
5683
  JSON.stringify(processedSchema, null, 2)
5671
5684
  );
@@ -5708,7 +5721,7 @@ var SchemaManager = class {
5708
5721
  };
5709
5722
  getAllTrackedFiles = () => Array.from(this.referencedBy.keys());
5710
5723
  getFilesToReprocess = (changedFile) => {
5711
- const resolvedPath = path7.resolve(this.config.__meta.rootDir, changedFile);
5724
+ const resolvedPath = path8.resolve(this.config.__meta.rootDir, changedFile);
5712
5725
  const referencedBy = this.referencedBy.get(resolvedPath);
5713
5726
  if (!referencedBy) return [];
5714
5727
  const filesToProcess = referencedBy.size === 0 ? [resolvedPath] : Array.from(referencedBy);
@@ -5737,7 +5750,7 @@ var SchemaManager = class {
5737
5750
  version: "",
5738
5751
  path: input.path ?? "",
5739
5752
  label: input.label,
5740
- inputPath: path7.resolve(this.config.__meta.rootDir, input.input),
5753
+ inputPath: path8.resolve(this.config.__meta.rootDir, input.input),
5741
5754
  params: input.params,
5742
5755
  importKey: "",
5743
5756
  downloadUrl: "",
@@ -5780,7 +5793,7 @@ var SchemaManager = class {
5780
5793
  };
5781
5794
  createSchemaPath = (inputPath, versionPath, apiPath, params) => {
5782
5795
  const suffix = paramsSuffix(params);
5783
- const extension = suffix ? ".json" : path7.extname(inputPath);
5796
+ const extension = suffix ? ".json" : path8.extname(inputPath);
5784
5797
  return joinUrl(
5785
5798
  this.config.basePath,
5786
5799
  apiPath,
@@ -5803,7 +5816,7 @@ var SchemaManager = class {
5803
5816
  // src/vite/plugin-config-reload.ts
5804
5817
  init_logger();
5805
5818
  init_loader();
5806
- import path10 from "node:path";
5819
+ import path11 from "node:path";
5807
5820
  import colors3 from "picocolors";
5808
5821
 
5809
5822
  // src/vite/plugin-navigation.ts
@@ -5813,7 +5826,7 @@ import { stringify as stringify3 } from "javascript-stringify";
5813
5826
  import { isElement } from "react-is";
5814
5827
 
5815
5828
  // src/config/validators/NavigationSchema.ts
5816
- import path8 from "node:path";
5829
+ import path9 from "node:path";
5817
5830
  import { glob } from "glob";
5818
5831
  import { fromMarkdown } from "mdast-util-from-markdown";
5819
5832
  import { mdxFromMarkdown } from "mdast-util-mdx";
@@ -5864,7 +5877,7 @@ var extractRichH1 = (content) => {
5864
5877
  }
5865
5878
  };
5866
5879
  var isNavigationItem = (item) => item !== void 0;
5867
- var toPosixPath = (filePath) => filePath.split(path8.win32.sep).join(path8.posix.sep);
5880
+ var toPosixPath = (filePath) => filePath.split(path9.win32.sep).join(path9.posix.sep);
5868
5881
  var NavigationResolver = class {
5869
5882
  rootDir;
5870
5883
  globPatterns;
@@ -5997,13 +6010,13 @@ init_invariant();
5997
6010
 
5998
6011
  // src/vite/debug.ts
5999
6012
  import { mkdir, writeFile } from "node:fs/promises";
6000
- import path9 from "node:path";
6013
+ import path10 from "node:path";
6001
6014
  async function writePluginDebugCode(rootDir, pluginName, code, extension = "js") {
6002
6015
  if (process.env.ZUDOKU_BUILD_DEBUG) {
6003
- const debugDir = path9.join(rootDir, "dist", "debug");
6016
+ const debugDir = path10.join(rootDir, "dist", "debug");
6004
6017
  await mkdir(debugDir, { recursive: true });
6005
6018
  await writeFile(
6006
- path9.join(debugDir, `${pluginName}.${extension}`),
6019
+ path10.join(debugDir, `${pluginName}.${extension}`),
6007
6020
  typeof code === "string" ? code : code.join("\n")
6008
6021
  );
6009
6022
  }
@@ -6114,7 +6127,7 @@ var viteConfigReloadPlugin = () => ({
6114
6127
  });
6115
6128
  logger.info(
6116
6129
  colors3.blue(
6117
- `Config ${path10.basename(currentConfig.__meta.configPath)} changed. Reloading...`
6130
+ `Config ${path11.basename(currentConfig.__meta.configPath)} changed. Reloading...`
6118
6131
  ),
6119
6132
  { timestamp: true }
6120
6133
  );
@@ -6128,11 +6141,11 @@ var viteApiPlugin = async () => {
6128
6141
  const resolvedVirtualModuleId4 = `\0${virtualModuleId4}`;
6129
6142
  const initialConfig = getCurrentConfig();
6130
6143
  const zuploProcessors = ZuploEnv.isZuplo ? await runnerImport3(
6131
- path11.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
6144
+ path12.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
6132
6145
  ).then((m) => m.module.default(initialConfig.__meta.rootDir)) : [];
6133
6146
  const buildConfig = await getBuildConfig();
6134
6147
  const buildProcessors = buildConfig?.processors ?? [];
6135
- const tmpStoreDir = path11.posix.join(
6148
+ const tmpStoreDir = path12.posix.join(
6136
6149
  initialConfig.__meta.rootDir,
6137
6150
  "node_modules/.apitogo/processed"
6138
6151
  );
@@ -6145,8 +6158,8 @@ var viteApiPlugin = async () => {
6145
6158
  return {
6146
6159
  name: "zudoku-api-plugins",
6147
6160
  async buildStart() {
6148
- await fs2.rm(tmpStoreDir, { recursive: true, force: true });
6149
- await fs2.mkdir(tmpStoreDir, { recursive: true });
6161
+ await fs3.rm(tmpStoreDir, { recursive: true, force: true });
6162
+ await fs3.mkdir(tmpStoreDir, { recursive: true });
6150
6163
  await schemaManager.processAllSchemas();
6151
6164
  schemaManager.getAllTrackedFiles().forEach((file) => this.addWatchFile(file));
6152
6165
  },
@@ -6159,8 +6172,8 @@ var viteApiPlugin = async () => {
6159
6172
  const pathMap = schemaManager.getUrlToFilePathMap();
6160
6173
  const inputPath = pathMap.get(req.url);
6161
6174
  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";
6175
+ const content = await fs3.readFile(inputPath, "utf-8");
6176
+ const mimeType = path12.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
6164
6177
  res.setHeader("Content-Type", `${mimeType}; charset=utf-8`);
6165
6178
  return res.end(content);
6166
6179
  });
@@ -6347,10 +6360,10 @@ var viteApiPlugin = async () => {
6347
6360
  const pathMap = schemaManager.getUrlToFilePathMap();
6348
6361
  if (process.env.NODE_ENV !== "production") return;
6349
6362
  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");
6363
+ const content = await fs3.readFile(inputPath, "utf-8");
6364
+ const outputPath = path12.join(config2.__meta.rootDir, "dist", urlPath);
6365
+ await fs3.mkdir(path12.dirname(outputPath), { recursive: true });
6366
+ await fs3.writeFile(outputPath, content, "utf-8");
6354
6367
  }
6355
6368
  }
6356
6369
  };
@@ -6392,7 +6405,7 @@ var plugin_auth_default = viteAuthPlugin;
6392
6405
 
6393
6406
  // src/vite/plugin-component.ts
6394
6407
  init_loader();
6395
- import path12 from "node:path";
6408
+ import path13 from "node:path";
6396
6409
  var viteAliasPlugin = () => {
6397
6410
  return {
6398
6411
  name: "zudoku-component-plugin",
@@ -6420,7 +6433,7 @@ var viteAliasPlugin = () => {
6420
6433
  ];
6421
6434
  const aliases = replacements.map(([find, replacement]) => ({
6422
6435
  find,
6423
- replacement: path12.posix.join(config2.__meta.moduleDir, replacement)
6436
+ replacement: path13.posix.join(config2.__meta.moduleDir, replacement)
6424
6437
  }));
6425
6438
  return config2.__meta.mode === "internal" || config2.__meta.mode === "standalone" ? { resolve: { alias: aliases } } : void 0;
6426
6439
  }
@@ -6557,7 +6570,7 @@ var viteDocMetadataPlugin = () => ({
6557
6570
 
6558
6571
  // src/vite/plugin-docs.ts
6559
6572
  init_loader();
6560
- import path13 from "node:path";
6573
+ import path14 from "node:path";
6561
6574
  import { glob as glob3 } from "glob";
6562
6575
  import globParent from "glob-parent";
6563
6576
  init_ZudokuConfig();
@@ -6626,7 +6639,7 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
6626
6639
  if (process.env.NODE_ENV !== "development") {
6627
6640
  const draftStatuses = await Promise.all(
6628
6641
  globbedFiles.map(async (file) => {
6629
- const absolutePath = path13.resolve(config2.__meta.rootDir, file);
6642
+ const absolutePath = path14.resolve(config2.__meta.rootDir, file);
6630
6643
  const { data } = await readFrontmatter(absolutePath);
6631
6644
  return { file, isDraft: data.draft === true };
6632
6645
  })
@@ -6639,9 +6652,9 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
6639
6652
  if (draftFiles.has(file)) {
6640
6653
  continue;
6641
6654
  }
6642
- const relativePath = path13.posix.relative(parent, file);
6655
+ const relativePath = path14.posix.relative(parent, file);
6643
6656
  const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
6644
- const filePath = options.absolute ? path13.resolve(config2.__meta.rootDir, file) : file;
6657
+ const filePath = options.absolute ? path14.resolve(config2.__meta.rootDir, file) : file;
6645
6658
  fileMapping[routePath] = filePath;
6646
6659
  }
6647
6660
  }
@@ -6705,7 +6718,7 @@ var viteDocsPlugin = () => {
6705
6718
  const globbedDocuments = {};
6706
6719
  for (const [routePath, file] of Object.entries(fileMapping)) {
6707
6720
  const importPath = ensureLeadingSlash(
6708
- path13.posix.join(globImportBasePath, file)
6721
+ path14.posix.join(globImportBasePath, file)
6709
6722
  );
6710
6723
  globbedDocuments[routePath] = importPath;
6711
6724
  }
@@ -6733,7 +6746,7 @@ init_loader();
6733
6746
  init_ProtectedRoutesSchema();
6734
6747
  init_joinUrl();
6735
6748
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
6736
- import path14 from "node:path";
6749
+ import path15 from "node:path";
6737
6750
  import { matchPath } from "react-router";
6738
6751
  var processMarkdownFile = async (filePath) => {
6739
6752
  const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
@@ -6821,7 +6834,7 @@ var viteMarkdownExportPlugin = () => {
6821
6834
  if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
6822
6835
  return;
6823
6836
  }
6824
- const distDir = path14.join(
6837
+ const distDir = path15.join(
6825
6838
  config2.__meta.rootDir,
6826
6839
  "dist",
6827
6840
  config2.basePath ?? ""
@@ -6842,15 +6855,15 @@ var viteMarkdownExportPlugin = () => {
6842
6855
  content: finalMarkdown
6843
6856
  });
6844
6857
  const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
6845
- const outputPath = `${path14.join(distDir, ...segments)}.md`;
6846
- await mkdir2(path14.dirname(outputPath), { recursive: true });
6858
+ const outputPath = `${path15.join(distDir, ...segments)}.md`;
6859
+ await mkdir2(path15.dirname(outputPath), { recursive: true });
6847
6860
  await writeFile2(outputPath, finalMarkdown, "utf-8");
6848
6861
  } catch (error) {
6849
6862
  console.warn(`Failed to export markdown for ${routePath}:`, error);
6850
6863
  }
6851
6864
  }
6852
6865
  if (config2.docs?.llms?.llmsTxt || config2.docs?.llms?.llmsTxtFull) {
6853
- const markdownInfoPath = path14.join(
6866
+ const markdownInfoPath = path15.join(
6854
6867
  config2.__meta.rootDir,
6855
6868
  "node_modules/.apitogo/markdown-info.json"
6856
6869
  );
@@ -7002,9 +7015,9 @@ var remarkCodeTabs = () => (tree) => {
7002
7015
  };
7003
7016
 
7004
7017
  // src/vite/mdx/remark-inject-filepath.ts
7005
- import path15 from "node:path";
7018
+ import path16 from "node:path";
7006
7019
  var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
7007
- const relativePath = path15.relative(rootDir, vfile.path).split(path15.sep).join(path15.posix.sep);
7020
+ const relativePath = path16.relative(rootDir, vfile.path).split(path16.sep).join(path16.posix.sep);
7008
7021
  tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
7009
7022
  };
7010
7023
 
@@ -7091,18 +7104,18 @@ var remarkLastModified = () => {
7091
7104
  };
7092
7105
 
7093
7106
  // src/vite/mdx/remark-link-rewrite.ts
7094
- import path16 from "node:path";
7107
+ import path17 from "node:path";
7095
7108
  import { visit as visit5 } from "unist-util-visit";
7096
7109
  var remarkLinkRewrite = (basePath = "") => (tree) => {
7097
7110
  visit5(tree, "link", (node) => {
7098
7111
  if (!node.url) return;
7099
7112
  if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
7100
7113
  node.url = node.url.replace(/\\/g, "/");
7101
- const base = path16.posix.join(basePath);
7114
+ const base = path17.posix.join(basePath);
7102
7115
  if (basePath && node.url.startsWith(base)) {
7103
7116
  node.url = node.url.slice(base.length);
7104
7117
  } else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
7105
- node.url = path16.posix.join("..", node.url);
7118
+ node.url = path17.posix.join("..", node.url);
7106
7119
  }
7107
7120
  node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
7108
7121
  });
@@ -7323,21 +7336,6 @@ var plugin_mdx_default = viteMdxPlugin;
7323
7336
  // src/vite/plugin-search.ts
7324
7337
  init_loader();
7325
7338
  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
7339
  var viteSearchPlugin = () => {
7342
7340
  const virtualModuleId4 = "virtual:zudoku-search-plugin";
7343
7341
  const resolvedVirtualModuleId4 = `\0${virtualModuleId4}`;
@@ -7492,6 +7490,11 @@ function vitePlugin() {
7492
7490
  }
7493
7491
 
7494
7492
  // src/vite/config.ts
7493
+ var resolveMergedPublicDir = (rootDir, merged) => {
7494
+ if (merged.publicDir === false) return void 0;
7495
+ const rel = typeof merged.publicDir === "string" ? merged.publicDir : "public";
7496
+ return path19.resolve(rootDir, rel);
7497
+ };
7495
7498
  var getAppClientEntryPath = () => path19.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
7496
7499
  var getAppServerEntryPath = () => path19.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
7497
7500
  var hasLoggedCdnInfo = false;
@@ -7659,6 +7662,12 @@ async function getViteConfig(dir, configEnv) {
7659
7662
  });
7660
7663
  }
7661
7664
  }
7665
+ if (config2.search?.type === "pagefind") {
7666
+ const publicDir = resolveMergedPublicDir(dir, mergedViteConfig);
7667
+ if (publicDir) {
7668
+ await ensurePagefindDevStub(publicDir);
7669
+ }
7670
+ }
7662
7671
  return mergedViteConfig;
7663
7672
  }
7664
7673
 
@@ -8247,6 +8256,7 @@ var VERSION_CHECK_FILE = "version.json";
8247
8256
  var SENTRY_DSN = void 0;
8248
8257
  var MAX_WAIT_PENDING_TIME_MS = 1e3;
8249
8258
  var POST_HOG_CAPTURE_KEY = void 0;
8259
+ var DEPLOY_SERVER_API_KEY = "qRVLTP22TFStdN6";
8250
8260
 
8251
8261
  // src/cli/common/output.ts
8252
8262
  function printDiagnosticsToConsole(message) {
@@ -8495,11 +8505,12 @@ on:
8495
8505
  pull_request:
8496
8506
  branches:
8497
8507
  - main
8508
+ types: [opened, synchronize, reopened, closed]
8498
8509
  workflow_dispatch:
8499
8510
 
8500
8511
  jobs:
8501
8512
  preview:
8502
- if: github.event_name == 'pull_request'
8513
+ if: github.event_name == 'pull_request' && github.event.action != 'closed'
8503
8514
  runs-on: ubuntu-latest
8504
8515
 
8505
8516
  environment:
@@ -8546,6 +8557,23 @@ jobs:
8546
8557
 
8547
8558
  echo "url=$URL" >> "$GITHUB_OUTPUT"
8548
8559
 
8560
+ cleanup-preview:
8561
+ if: github.event_name == 'pull_request' && github.event.action == 'closed'
8562
+ runs-on: ubuntu-latest
8563
+
8564
+ steps:
8565
+ - name: Install APIToGo CLI
8566
+ run: npm install -g @lukoweb/apitogo@latest
8567
+
8568
+ - name: Remove preview deployment
8569
+ env:
8570
+ APITOGO_TOKEN: \${{ secrets.APITOGO_TOKEN }}
8571
+ shell: bash
8572
+ run: |
8573
+ ENV_NAME=preview-pr-\${{ github.event.pull_request.number }}
8574
+
8575
+ apitogo remove --deployment-token="$APITOGO_TOKEN" --env=$ENV_NAME --json-only
8576
+
8549
8577
  production:
8550
8578
  if: github.event_name == 'push' && github.ref == 'refs/heads/main'
8551
8579
  runs-on: ubuntu-latest
@@ -8626,11 +8654,18 @@ var configure_github_workflow_default = {
8626
8654
  init_logger();
8627
8655
  function isDeployJsonOnlyArgv() {
8628
8656
  const args = process.argv;
8629
- const deployIdx = args.indexOf("deploy");
8630
- if (deployIdx === -1) {
8657
+ let cmdIdx = -1;
8658
+ for (const cmd of ["deploy", "remove"]) {
8659
+ const i = args.indexOf(cmd);
8660
+ if (i !== -1) {
8661
+ cmdIdx = i;
8662
+ break;
8663
+ }
8664
+ }
8665
+ if (cmdIdx === -1) {
8631
8666
  return false;
8632
8667
  }
8633
- return args.slice(deployIdx).some((a) => a === "--json-only" || a.startsWith("--json-only="));
8668
+ return args.slice(cmdIdx).some((a) => a === "--json-only" || a.startsWith("--json-only="));
8634
8669
  }
8635
8670
  function isJsonOnlyDeployEnv() {
8636
8671
  return process.env.APITOGO_JSON_ONLY === "1";
@@ -8648,8 +8683,7 @@ function applyJsonOnlyDeployQuietMode() {
8648
8683
  import { access as access2, readFile as readFile4 } from "node:fs/promises";
8649
8684
  import path28 from "node:path";
8650
8685
  import { create as createTar } from "tar";
8651
- var DEPLOY_ENDPOINT = "https://deployserver.apitogo.com/deploy";
8652
- var DEPLOY_API_KEY = "qRVLTP22TFStdN6";
8686
+ var DEPLOY_ENDPOINT = "https://deploy-server-dotnet2-b3fkcaaraydbckfe.canadacentral-01.azurewebsites.net/deploy";
8653
8687
  var ARCHIVE_NAME = "dist.tgz";
8654
8688
  var createDeploymentArchive = async (dir) => {
8655
8689
  const distDir = path28.join(dir, "dist");
@@ -8700,7 +8734,7 @@ async function deploy(argv) {
8700
8734
  const response = await fetch(deployUrl, {
8701
8735
  method: "POST",
8702
8736
  headers: {
8703
- "x-api-key": DEPLOY_API_KEY
8737
+ "x-api-key": DEPLOY_SERVER_API_KEY
8704
8738
  },
8705
8739
  body: formData
8706
8740
  });
@@ -9170,14 +9204,15 @@ var dev_default = {
9170
9204
  };
9171
9205
 
9172
9206
  // src/cli/make-config/handler.ts
9173
- import { readFile as readFile6, writeFile as writeFile8 } from "node:fs/promises";
9207
+ import { constants as constants3 } from "node:fs";
9208
+ import { access as access4, mkdir as mkdir7, readFile as readFile6, writeFile as writeFile8 } from "node:fs/promises";
9174
9209
  import path33 from "node:path";
9175
9210
  import { glob as glob5 } from "glob";
9176
9211
 
9177
9212
  // src/cli/make-config/scaffold-project.ts
9178
9213
  init_package_json();
9179
- import { access as access3, readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
9180
9214
  import { constants as constants2 } from "node:fs";
9215
+ import { access as access3, readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
9181
9216
  import path32 from "node:path";
9182
9217
  import { glob as glob4 } from "glob";
9183
9218
  var OPENAPI_GLOBS = [
@@ -9305,7 +9340,9 @@ async function ensurePackageJson(dir) {
9305
9340
  try {
9306
9341
  pkg = JSON.parse(raw);
9307
9342
  } catch {
9308
- throw new Error("package.json exists but is not valid JSON; fix or remove it and run again.");
9343
+ throw new Error(
9344
+ "package.json exists but is not valid JSON; fix or remove it and run again."
9345
+ );
9309
9346
  }
9310
9347
  pkg.scripts = {
9311
9348
  ...typeof pkg.scripts === "object" && pkg.scripts !== null ? pkg.scripts : {}
@@ -9651,6 +9688,17 @@ const config: ApitogoConfig = {
9651
9688
  export default config;
9652
9689
  `;
9653
9690
  };
9691
+ var ensureApitogoDeployWorkflow = async (dir) => {
9692
+ const workflowPath = path33.join(dir, ".github", "workflows", "apitogo-deploy.yml");
9693
+ try {
9694
+ await access4(workflowPath, constants3.F_OK);
9695
+ return false;
9696
+ } catch {
9697
+ }
9698
+ await mkdir7(path33.join(dir, ".github", "workflows"), { recursive: true });
9699
+ await writeFile8(workflowPath, APITOGO_DEPLOY_WORKFLOW_YAML, "utf8");
9700
+ return true;
9701
+ };
9654
9702
  var findExistingConfigPath = async (dir) => {
9655
9703
  for (const filename of CONFIG_FILENAMES) {
9656
9704
  const fullPath = path33.join(dir, filename);
@@ -9672,7 +9720,9 @@ async function makeConfig(argv) {
9672
9720
  const createdPackageJson = await ensurePackageJson(dir);
9673
9721
  const createdTsconfig = await ensureTsconfigJson(dir);
9674
9722
  if (createdPackageJson) {
9675
- printDiagnosticsToConsole("Created package.json with dev, build, and preview scripts.");
9723
+ printDiagnosticsToConsole(
9724
+ "Created package.json with dev, build, and preview scripts."
9725
+ );
9676
9726
  }
9677
9727
  if (createdTsconfig) {
9678
9728
  printDiagnosticsToConsole("Created tsconfig.json.");
@@ -9723,6 +9773,12 @@ async function makeConfig(argv) {
9723
9773
  printResultToConsole(
9724
9774
  `${action} ${path33.basename(configPath)} from ${pagesDir}/ (navigation and redirects; other top-level settings preserved unless newly scaffolded).`
9725
9775
  );
9776
+ const createdWorkflow = await ensureApitogoDeployWorkflow(dir);
9777
+ if (createdWorkflow) {
9778
+ printDiagnosticsToConsole(
9779
+ "Created .github/workflows/apitogo-deploy.yml (preview + production; removes preview when a PR is closed)."
9780
+ );
9781
+ }
9726
9782
  if (createdPackageJson) {
9727
9783
  printDiagnosticsToConsole(
9728
9784
  "Next: run npm install (or pnpm install / yarn) in this directory, then npm run dev."
@@ -9778,6 +9834,84 @@ var previewCommand = {
9778
9834
  };
9779
9835
  var preview_default = previewCommand;
9780
9836
 
9837
+ // src/cli/remove/handler.ts
9838
+ var REMOVE_ENDPOINT = "https://deploy-server-dotnet2-b3fkcaaraydbckfe.canadacentral-01.azurewebsites.net/remove";
9839
+ async function remove(argv) {
9840
+ const deploymentToken = argv.deploymentToken?.trim() || process.env.npm_config_deployment_token?.trim();
9841
+ const env = argv.env?.trim() || process.env.npm_config_env?.trim() || "production";
9842
+ try {
9843
+ if (!deploymentToken) {
9844
+ throw new Error("A deployment token is required.");
9845
+ }
9846
+ if (!isJsonOnlyDeployEnv()) {
9847
+ printDiagnosticsToConsole(`Removing deployment from ${env}...`);
9848
+ }
9849
+ const formData = new FormData();
9850
+ formData.append("deploymentToken", deploymentToken);
9851
+ formData.append("env", env);
9852
+ const removeUrl = new URL(REMOVE_ENDPOINT);
9853
+ if (argv.jsonOnly) {
9854
+ removeUrl.searchParams.set("jsonOnly", "true");
9855
+ }
9856
+ const response = await fetch(removeUrl, {
9857
+ method: "POST",
9858
+ headers: {
9859
+ "x-api-key": DEPLOY_SERVER_API_KEY
9860
+ },
9861
+ body: formData
9862
+ });
9863
+ const responseText = await response.text();
9864
+ if (!response.ok) {
9865
+ throw new Error(
9866
+ `Remove failed with ${response.status}: ${JSON.stringify(textOrJson(responseText))}`
9867
+ );
9868
+ }
9869
+ if (isJsonOnlyDeployEnv()) {
9870
+ const parsed = responseText.trim() ? textOrJson(responseText) : {};
9871
+ console.log(JSON.stringify(parsed));
9872
+ return;
9873
+ }
9874
+ printResultToConsole(`Removal request sent to ${removeUrl.href}`);
9875
+ if (responseText.trim()) {
9876
+ printDiagnosticsToConsole(
9877
+ JSON.stringify(textOrJson(responseText), null, 2)
9878
+ );
9879
+ }
9880
+ } catch (error) {
9881
+ const message = error instanceof Error ? error.message : String(error);
9882
+ if (isJsonOnlyDeployEnv()) {
9883
+ printJsonOnlyErrorAndExit(message);
9884
+ } else {
9885
+ await printCriticalFailureToConsoleAndExit(message);
9886
+ }
9887
+ }
9888
+ }
9889
+
9890
+ // src/cli/cmds/remove.ts
9891
+ var remove_default = {
9892
+ desc: "Remove a deployment from the target environment",
9893
+ command: "remove",
9894
+ builder: (yargs2) => yargs2.option("deployment-token", {
9895
+ type: "string",
9896
+ describe: "Deployment token sent to the remove endpoint"
9897
+ }).option("env", {
9898
+ type: "string",
9899
+ describe: "Target environment name sent to the remove API (e.g. production, preview, preview-a, preview-b)",
9900
+ default: "production"
9901
+ }).option("json-only", {
9902
+ type: "boolean",
9903
+ describe: "JSON-only output on stdout; adds ?jsonOnly=true to the remove request",
9904
+ default: false
9905
+ }),
9906
+ handler: async (argv) => {
9907
+ if (argv.jsonOnly) {
9908
+ applyJsonOnlyDeployQuietMode();
9909
+ }
9910
+ await captureEvent({ argv, event: "apitogo remove" });
9911
+ await remove(argv);
9912
+ }
9913
+ };
9914
+
9781
9915
  // src/cli/common/outdated.ts
9782
9916
  import { existsSync as existsSync2, mkdirSync } from "node:fs";
9783
9917
  import { readFile as readFile7, writeFile as writeFile9 } from "node:fs/promises";
@@ -10022,7 +10156,7 @@ var cli = yargs(hideBin(process.argv)).option("zuplo", {
10022
10156
  process.env.ZUPLO = "1";
10023
10157
  printDiagnosticsToConsole("Running in Zuplo mode");
10024
10158
  }
10025
- }).middleware(warnPackageVersionMismatch).command(build_default).command(configure_github_workflow_default).command(dev_default).command(deploy_default).command(preview_default).command(make_config_default).demandCommand().strictCommands().version(packageJson?.version).fail(false).help();
10159
+ }).middleware(warnPackageVersionMismatch).command(build_default).command(configure_github_workflow_default).command(dev_default).command(deploy_default).command(remove_default).command(preview_default).command(make_config_default).demandCommand().strictCommands().version(packageJson?.version).fail(false).help();
10026
10160
  try {
10027
10161
  void warnIfOutdatedVersion(packageJson?.version);
10028
10162
  await cli.argv;