@lukoweb/apitogo 0.1.67 → 0.1.69

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 (59) hide show
  1. package/dist/cli/cli.js +552 -380
  2. package/dist/declarations/lib/plugins/openapi/processors/injectApitogoGatewayServer.d.ts +6 -0
  3. package/docs/components/playground.mdx +6 -8
  4. package/docs/components/slot.mdx +2 -2
  5. package/docs/concepts/auth-provider-api-identities.md +8 -12
  6. package/docs/configuration/ai-assistants.md +3 -3
  7. package/docs/configuration/api-catalog.md +4 -4
  8. package/docs/configuration/api-reference.md +11 -11
  9. package/docs/configuration/authentication-auth0.md +8 -1
  10. package/docs/configuration/authentication-azure-ad.md +8 -1
  11. package/docs/configuration/authentication-clerk.md +8 -1
  12. package/docs/configuration/authentication-firebase.md +8 -1
  13. package/docs/configuration/authentication-pingfederate.md +8 -1
  14. package/docs/configuration/authentication-supabase.md +10 -3
  15. package/docs/configuration/authentication.md +96 -195
  16. package/docs/configuration/build-configuration.mdx +2 -2
  17. package/docs/configuration/docs.md +10 -10
  18. package/docs/configuration/footer.mdx +84 -180
  19. package/docs/configuration/llms.md +1 -1
  20. package/docs/configuration/make-config.mdx +12 -5
  21. package/docs/configuration/manifest.md +4 -14
  22. package/docs/configuration/navigation.mdx +2 -2
  23. package/docs/configuration/overview.md +95 -310
  24. package/docs/configuration/protected-routes.md +3 -3
  25. package/docs/configuration/search.md +4 -3
  26. package/docs/configuration/site.md +5 -5
  27. package/docs/configuration/slots.mdx +1 -1
  28. package/docs/custom-plugins.md +1 -1
  29. package/docs/customization/colors-theme.mdx +8 -8
  30. package/docs/customization/fonts.md +4 -4
  31. package/docs/deploy/apitogo.md +18 -12
  32. package/docs/deploy/cloudflare-pages.md +0 -1
  33. package/docs/deploy/direct-upload.md +0 -1
  34. package/docs/deploy/github-pages.md +1 -2
  35. package/docs/deploy/vercel.md +2 -3
  36. package/docs/deployment.md +11 -10
  37. package/docs/extending/events.md +1 -1
  38. package/docs/guides/custom-pages.md +4 -8
  39. package/docs/guides/environment-variables.md +41 -49
  40. package/docs/guides/managing-api-keys-and-identities.md +40 -115
  41. package/docs/guides/navigation-rules.mdx +1 -1
  42. package/docs/guides/processors.mdx +2 -2
  43. package/docs/guides/transforming-examples.md +1 -1
  44. package/docs/markdown/code-blocks.md +2 -2
  45. package/docs/markdown/mdx.md +1 -1
  46. package/docs/mcp/go-live.md +100 -0
  47. package/docs/mcp/overview.md +76 -0
  48. package/docs/mcp/setup.md +173 -0
  49. package/docs/mcp/shape.md +76 -0
  50. package/docs/mcp/tools.md +102 -0
  51. package/docs/plugins.md +20 -1
  52. package/docs/quickstart.md +49 -54
  53. package/docs/writing.mdx +1 -1
  54. package/package.json +1 -1
  55. package/src/lib/authentication/components/ProductionUnlockPage.tsx +4 -5
  56. package/src/lib/plugins/openapi/processors/injectApitogoGatewayServer.ts +30 -0
  57. package/src/vite/plugin-api.ts +6 -1
  58. package/src/vite/plugin-config.ts +3 -0
  59. package/docs/guides/navigation-migration.md +0 -87
package/dist/cli/cli.js CHANGED
@@ -10,18 +10,18 @@ var __export = (target, all) => {
10
10
 
11
11
  // src/cli/common/package-json.ts
12
12
  import { readFileSync } from "node:fs";
13
- import path from "node:path";
13
+ import path2 from "node:path";
14
14
  import { fileURLToPath } from "node:url";
15
15
  var getPackageJsonPath, getPackageJson, getZudokuPackageJson, getZudokuRootDir;
16
16
  var init_package_json = __esm({
17
17
  "src/cli/common/package-json.ts"() {
18
18
  getPackageJsonPath = (pkg) => fileURLToPath(import.meta.resolve(`${pkg}/package.json`)).replaceAll(
19
- path.sep,
20
- path.posix.sep
19
+ path2.sep,
20
+ path2.posix.sep
21
21
  );
22
22
  getPackageJson = (pkgPath) => JSON.parse(readFileSync(pkgPath, "utf-8"));
23
23
  getZudokuPackageJson = () => getPackageJson(getPackageJsonPath("@lukoweb/apitogo"));
24
- getZudokuRootDir = () => path.dirname(getPackageJsonPath("@lukoweb/apitogo"));
24
+ getZudokuRootDir = () => path2.dirname(getPackageJsonPath("@lukoweb/apitogo"));
25
25
  }
26
26
  });
27
27
 
@@ -664,12 +664,12 @@ var init_apitogo_config_core = __esm({
664
664
 
665
665
  // src/config/apitogo-config-loader.node.ts
666
666
  import { existsSync, readFileSync as readFileSync2 } from "node:fs";
667
- import path2 from "node:path";
667
+ import path3 from "node:path";
668
668
  function loadApitogoConfig(rootDir = process.cwd()) {
669
- const configPath = path2.join(path2.resolve(rootDir), APITOGO_CONFIG_FILENAME);
669
+ const configPath = path3.join(path3.resolve(rootDir), APITOGO_CONFIG_FILENAME);
670
670
  if (!existsSync(configPath)) {
671
671
  throw new Error(
672
- `Missing ${APITOGO_CONFIG_FILENAME} in ${path2.resolve(rootDir)}`
672
+ `Missing ${APITOGO_CONFIG_FILENAME} in ${path3.resolve(rootDir)}`
673
673
  );
674
674
  }
675
675
  const raw = readFileSync2(configPath, "utf8");
@@ -744,7 +744,7 @@ import { stat } from "node:fs/promises";
744
744
  var fileExists;
745
745
  var init_file_exists = __esm({
746
746
  "src/config/file-exists.ts"() {
747
- fileExists = (path40) => stat(path40).then(() => true).catch(() => false);
747
+ fileExists = (path41) => stat(path41).then(() => true).catch(() => false);
748
748
  }
749
749
  });
750
750
 
@@ -986,7 +986,7 @@ var init_landing_manifest = __esm({
986
986
  });
987
987
 
988
988
  // src/config/local-manifest.ts
989
- import path3 from "node:path";
989
+ import path4 from "node:path";
990
990
  import { z as z4 } from "zod";
991
991
  function isPricingEnabled(manifest) {
992
992
  return manifest?.pricing?.enabled === true;
@@ -1036,8 +1036,8 @@ function resolveManifestEnv(viteMode) {
1036
1036
  return viteMode === "production" ? "production" : "development";
1037
1037
  }
1038
1038
  function manifestPathsForEnv(rootDir, _env) {
1039
- const resolvedRoot = path3.resolve(rootDir);
1040
- const configPath = path3.join(resolvedRoot, APITOGO_CONFIG_FILENAME);
1039
+ const resolvedRoot = path4.resolve(rootDir);
1040
+ const configPath = path4.join(resolvedRoot, APITOGO_CONFIG_FILENAME);
1041
1041
  return {
1042
1042
  basePath: configPath,
1043
1043
  overridePath: configPath,
@@ -1709,7 +1709,7 @@ var init_shadcn_registry = __esm({
1709
1709
 
1710
1710
  // src/vite/plugin-theme.ts
1711
1711
  import { createRequire } from "node:module";
1712
- import path4 from "node:path";
1712
+ import path5 from "node:path";
1713
1713
  import { normalizeTheme } from "shiki";
1714
1714
  var THEME_VARIABLES, uncamelize, processColorValue, generateCss, generateRegistryCss, processCustomCss, MAIN_REPLACE, DEFAULT_THEME_REPLACE, GOOGLE_FONTS, getGoogleFontUrl, processFont, processFontConfig, DEFAULT_FONT_SANS, DEFAULT_FONT_MONO, DEFAULT_FONT_HEADING, processFonts, MODULE_SOURCE_PACKAGES, resolveModuleSourceDirs, virtualModuleId, resolvedVirtualModuleId, viteThemePlugin;
1715
1715
  var init_plugin_theme = __esm({
@@ -1888,7 +1888,7 @@ var init_plugin_theme = __esm({
1888
1888
  resolveModuleSourceDirs = (config2) => {
1889
1889
  if (config2.__meta.mode === "internal") {
1890
1890
  return MODULE_SOURCE_PACKAGES.map(
1891
- (pkg) => path4.join(
1891
+ (pkg) => path5.join(
1892
1892
  config2.__meta.moduleDir,
1893
1893
  "..",
1894
1894
  pkg.replace("@lukoweb/apitogo-", ""),
@@ -1897,12 +1897,12 @@ var init_plugin_theme = __esm({
1897
1897
  );
1898
1898
  }
1899
1899
  const require2 = createRequire(
1900
- path4.join(config2.__meta.rootDir, "package.json")
1900
+ path5.join(config2.__meta.rootDir, "package.json")
1901
1901
  );
1902
1902
  const dirs = [];
1903
1903
  for (const pkg of MODULE_SOURCE_PACKAGES) {
1904
1904
  try {
1905
- dirs.push(path4.dirname(require2.resolve(pkg)));
1905
+ dirs.push(path5.dirname(require2.resolve(pkg)));
1906
1906
  } catch {
1907
1907
  }
1908
1908
  }
@@ -2028,7 +2028,7 @@ ${rootVars.join("\n")}
2028
2028
  ...config2.__meta.dependencies,
2029
2029
  ...config2.__pluginDirs ?? [],
2030
2030
  ...resolveModuleSourceDirs(config2)
2031
- ].map((file) => path4.relative(path4.dirname(id), file))
2031
+ ].map((file) => path5.relative(path5.dirname(id), file))
2032
2032
  );
2033
2033
  const code = [...files].map((file) => `@source "${file}";`);
2034
2034
  code.push("@theme inline {");
@@ -4319,7 +4319,7 @@ __export(ZudokuConfig_exports, {
4319
4319
  ZudokuConfig: () => ZudokuConfig,
4320
4320
  validateConfig: () => validateConfig
4321
4321
  });
4322
- import colors from "picocolors";
4322
+ import colors2 from "picocolors";
4323
4323
  import { isValidElement as isValidElement2 } from "react";
4324
4324
  import { z as z9 } from "zod";
4325
4325
  function validateConfig(config2, configPath) {
@@ -4331,8 +4331,8 @@ function validateConfig(config2, configPath) {
4331
4331
  ${z9.prettifyError(validationResult.error)}`
4332
4332
  );
4333
4333
  }
4334
- console.log(colors.yellow("Validation errors:"));
4335
- console.log(colors.yellow(z9.prettifyError(validationResult.error)));
4334
+ console.log(colors2.yellow("Validation errors:"));
4335
+ console.log(colors2.yellow(z9.prettifyError(validationResult.error)));
4336
4336
  }
4337
4337
  }
4338
4338
  var ThemeSchema, ApiCatalogCategorySchema, LanguageOption, AiAssistantCustomSchema, AiAssistantPresets, AiAssistantsSchema, ApiOptionsSchema, ApiConfigSchema, VersionConfigSchema, ApiSchema, ApiKeysSchema, LogoSchema, FooterSocialIcons, FooterSocialSchema, FooterSchema, SiteMapSchema, DEFAULT_DOCS_FILES, LlmsConfigSchema, DocsConfigSchema, Redirect, SearchSchema, AuthenticationSchema, MetadataSchema, FontConfigSchema, FontsConfigSchema, CssObject, ThemeConfigSchema, SiteSchema, PlacementPosition, HeaderConfigSchema, ApiCatalogSchema, CdnUrlSchema, BaseConfigSchema, ZudokuConfig;
@@ -4870,8 +4870,8 @@ var init_ZudokuConfig = __esm({
4870
4870
 
4871
4871
  // src/config/loader.ts
4872
4872
  import { stat as stat2 } from "node:fs/promises";
4873
- import path5 from "node:path";
4874
- import colors2 from "picocolors";
4873
+ import path6 from "node:path";
4874
+ import colors3 from "picocolors";
4875
4875
  import {
4876
4876
  runnerImport,
4877
4877
  loadEnv as viteLoadEnv
@@ -4890,7 +4890,7 @@ function mergeJsonConfigWithRuntimeOverrides(fileConfig, importedConfig) {
4890
4890
  }
4891
4891
  async function getConfigFilePath(rootDir) {
4892
4892
  for (const fileName of zudokuConfigFiles) {
4893
- const filepath = path5.join(rootDir, fileName);
4893
+ const filepath = path6.join(rootDir, fileName);
4894
4894
  if (await fileExists(filepath)) {
4895
4895
  return filepath;
4896
4896
  }
@@ -5053,7 +5053,7 @@ async function loadZudokuConfig(configEnv, rootDir) {
5053
5053
  };
5054
5054
  if (!process.env.APITOGO_JSON_ONLY) {
5055
5055
  logger.info(
5056
- colors2.cyan(`loaded config file `) + colors2.dim(config.__meta.configPath),
5056
+ colors3.cyan(`loaded config file `) + colors3.dim(config.__meta.configPath),
5057
5057
  { timestamp: true }
5058
5058
  );
5059
5059
  }
@@ -5122,8 +5122,8 @@ __export(llms_exports, {
5122
5122
  generateLlmsTxtFiles: () => generateLlmsTxtFiles
5123
5123
  });
5124
5124
  import { writeFile as writeFile4 } from "node:fs/promises";
5125
- import path27 from "node:path";
5126
- import colors6 from "picocolors";
5125
+ import path28 from "node:path";
5126
+ import colors7 from "picocolors";
5127
5127
  async function generateLlmsTxtFiles({
5128
5128
  markdownFileInfos,
5129
5129
  outputUrls,
@@ -5157,9 +5157,9 @@ async function generateLlmsTxtFiles({
5157
5157
  }
5158
5158
  }
5159
5159
  const llmsTxt2 = llmsTxtParts.join("\n");
5160
- await writeFile4(path27.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
5160
+ await writeFile4(path28.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
5161
5161
  if (process.env.APITOGO_JSON_ONLY !== "1") {
5162
- console.log(colors6.blue("\u2713 generated llms.txt"));
5162
+ console.log(colors7.blue("\u2713 generated llms.txt"));
5163
5163
  }
5164
5164
  }
5165
5165
  if (llmsTxtFull) {
@@ -5185,12 +5185,12 @@ ${info.content}
5185
5185
  }
5186
5186
  const llmsFull = llmsFullParts.join("\n");
5187
5187
  await writeFile4(
5188
- path27.join(baseOutputDir, "llms-full.txt"),
5188
+ path28.join(baseOutputDir, "llms-full.txt"),
5189
5189
  llmsFull,
5190
5190
  "utf-8"
5191
5191
  );
5192
5192
  if (process.env.APITOGO_JSON_ONLY !== "1") {
5193
- console.log(colors6.blue("\u2713 generated llms-full.txt"));
5193
+ console.log(colors7.blue("\u2713 generated llms-full.txt"));
5194
5194
  }
5195
5195
  }
5196
5196
  }
@@ -5205,12 +5205,299 @@ import * as Sentry2 from "@sentry/node";
5205
5205
  import { hideBin } from "yargs/helpers";
5206
5206
  import yargs from "yargs/yargs";
5207
5207
 
5208
+ // src/cli/common/analytics/lib.ts
5209
+ import { PostHog } from "posthog-node";
5210
+
5211
+ // src/cli/common/constants.ts
5212
+ var CLI_XDG_FOLDER_NAME = "apitogo";
5213
+ var VERSION_CHECK_FILE = "version.json";
5214
+ var SENTRY_DSN = void 0;
5215
+ var MAX_WAIT_PENDING_TIME_MS = 1e3;
5216
+ var POST_HOG_CAPTURE_KEY = void 0;
5217
+ var DEPLOY_SERVER_API_KEY = "qRVLTP22TFStdN6";
5218
+
5219
+ // src/cli/common/machine-id/lib.ts
5220
+ import { execSync } from "node:child_process";
5221
+ import { createHash } from "node:crypto";
5222
+ var win32RegBinPath = {
5223
+ skipped: "",
5224
+ native: "%windir%\\System32",
5225
+ mixed: "%windir%\\sysnative\\cmd.exe /c %windir%\\System32"
5226
+ };
5227
+ var guid = {
5228
+ darwin: "ioreg -rd1 -c IOPlatformExpertDevice",
5229
+ win32: `${win32RegBinPath[isWindowsProcessMixedOrNativeArchitecture()]}\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`,
5230
+ linux: "( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :"
5231
+ };
5232
+ function isWindowsProcessMixedOrNativeArchitecture() {
5233
+ if (process.platform !== "win32") {
5234
+ return "skipped";
5235
+ }
5236
+ if (process.arch === "ia32" && process.env.PROCESSOR_ARCHITEW6432) {
5237
+ return "mixed";
5238
+ }
5239
+ return "native";
5240
+ }
5241
+ function hash(guid2) {
5242
+ return createHash("sha256").update(guid2).digest("hex");
5243
+ }
5244
+ function expose(result) {
5245
+ switch (process.platform) {
5246
+ case "darwin":
5247
+ return result.split("IOPlatformUUID")[1].split("\n")[0].replace(/=|\s+]"/gi, "").toLowerCase();
5248
+ case "win32":
5249
+ return result.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi, "").toLowerCase();
5250
+ case "linux":
5251
+ return result.toString().replace(/\r+|\n+|\s+/gi, "").toLowerCase();
5252
+ case "freebsd":
5253
+ return result.toString().replace(/\r+|\n+|\s+/gi, "").toLowerCase();
5254
+ default:
5255
+ throw new Error(`Unsupported platform: ${process.platform}`);
5256
+ }
5257
+ }
5258
+ function machineId() {
5259
+ switch (process.platform) {
5260
+ case "darwin":
5261
+ case "win32":
5262
+ case "linux":
5263
+ return hash(expose(execSync(guid[process.platform]).toString()));
5264
+ default:
5265
+ return "e16fc483-5593-4d71-b485-a6533693da9b";
5266
+ }
5267
+ }
5268
+
5269
+ // src/cli/common/analytics/lib.ts
5270
+ var _postHog;
5271
+ function init() {
5272
+ if (process.env.ZUDOKU_DO_NOT_TRACK || !POST_HOG_CAPTURE_KEY) {
5273
+ return void 0;
5274
+ }
5275
+ _postHog = new PostHog(POST_HOG_CAPTURE_KEY, {
5276
+ host: "https://app.posthog.com",
5277
+ flushAt: 1,
5278
+ flushInterval: 1
5279
+ });
5280
+ return _postHog;
5281
+ }
5282
+ async function captureEvent({
5283
+ event,
5284
+ properties,
5285
+ groups,
5286
+ sendFeatureFlags,
5287
+ timestamp,
5288
+ disableGeoip
5289
+ }) {
5290
+ if (_postHog === void 0) {
5291
+ init();
5292
+ }
5293
+ if (_postHog) {
5294
+ properties = properties ?? {};
5295
+ properties.$set_once = properties.$set_once ?? {};
5296
+ if (process.env.CI) {
5297
+ properties.ci = process.env.CI;
5298
+ }
5299
+ _postHog.capture({
5300
+ distinctId: machineId(),
5301
+ event,
5302
+ properties,
5303
+ groups,
5304
+ sendFeatureFlags,
5305
+ timestamp,
5306
+ disableGeoip
5307
+ });
5308
+ }
5309
+ }
5310
+ async function shutdownAnalytics() {
5311
+ return _postHog?.shutdown();
5312
+ }
5313
+
5314
+ // src/cli/apply/handler.ts
5315
+ import { access } from "node:fs/promises";
5316
+ import { spawn } from "node:child_process";
5317
+ import path from "node:path";
5318
+
5319
+ // src/cli/common/output.ts
5320
+ import * as Sentry from "@sentry/node";
5321
+ import colors from "picocolors";
5322
+ function printDiagnosticsToConsole(message) {
5323
+ console.error(colors.bold(colors.blue(message)));
5324
+ }
5325
+ function printWarningToConsole(message) {
5326
+ console.error(message);
5327
+ }
5328
+ async function printCriticalFailureToConsoleAndExit(message) {
5329
+ console.error(colors.bold(colors.red(message)));
5330
+ await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
5331
+ process.exit(1);
5332
+ });
5333
+ }
5334
+ function printJsonOnlyErrorAndExit(message) {
5335
+ console.log(JSON.stringify({ error: message }));
5336
+ process.exit(1);
5337
+ }
5338
+ function printResultToConsole(message) {
5339
+ console.log(colors.bold(colors.green(message)));
5340
+ }
5341
+ function textOrJson(text) {
5342
+ try {
5343
+ return JSON.parse(text);
5344
+ } catch {
5345
+ return text;
5346
+ }
5347
+ }
5348
+
5349
+ // src/cli/apply/handler.ts
5350
+ async function pathExists(candidate) {
5351
+ try {
5352
+ await access(candidate);
5353
+ return true;
5354
+ } catch {
5355
+ return false;
5356
+ }
5357
+ }
5358
+ async function resolveApitogoApplyCommand() {
5359
+ const mcpPath = process.env.APITOGO_MCP_PATH?.trim();
5360
+ if (mcpPath) {
5361
+ const applyJs = path.join(mcpPath, "dist", "cli", "apply.js");
5362
+ if (await pathExists(applyJs)) {
5363
+ return {
5364
+ command: process.execPath,
5365
+ argsPrefix: [applyJs],
5366
+ note: `Using local apitogo-apply from APITOGO_MCP_PATH=${mcpPath}`
5367
+ };
5368
+ }
5369
+ throw new Error(
5370
+ `APITOGO_MCP_PATH is set (${mcpPath}) but dist/cli/apply.js was not found. Run npm run build in the MCP checkout.`
5371
+ );
5372
+ }
5373
+ return {
5374
+ command: "npx",
5375
+ argsPrefix: ["--yes", "--package=@lukoweb/apitogo-mcp", "apitogo-apply"],
5376
+ note: "Using npx @lukoweb/apitogo-mcp (set APITOGO_MCP_PATH for a local checkout)"
5377
+ };
5378
+ }
5379
+ function buildApplyArgs(argv) {
5380
+ const dir = path.resolve(process.cwd(), argv.dir);
5381
+ const args = [dir];
5382
+ if (argv.projectId?.trim()) {
5383
+ args.push("--project-id", argv.projectId.trim());
5384
+ }
5385
+ if (argv.projectName?.trim()) {
5386
+ args.push("--project-name", argv.projectName.trim());
5387
+ }
5388
+ if (argv.platformPlan?.trim()) {
5389
+ args.push("--platform-plan", argv.platformPlan.trim());
5390
+ }
5391
+ if (argv.skipBackend) {
5392
+ args.push("--skip-backend");
5393
+ }
5394
+ if (argv.forceBackendRedeploy) {
5395
+ args.push("--force-backend-redeploy");
5396
+ }
5397
+ if (argv.forceSiteRedeploy) {
5398
+ args.push("--force-site-redeploy");
5399
+ }
5400
+ if (argv.resumeFrom?.trim()) {
5401
+ args.push("--resume-from", argv.resumeFrom.trim());
5402
+ }
5403
+ if (argv.wait === false) {
5404
+ args.push("--no-wait");
5405
+ }
5406
+ if (argv.json) {
5407
+ args.push("--json");
5408
+ }
5409
+ return args;
5410
+ }
5411
+ async function apply(argv) {
5412
+ let resolved;
5413
+ try {
5414
+ resolved = await resolveApitogoApplyCommand();
5415
+ } catch (error) {
5416
+ printCriticalFailureToConsoleAndExit(
5417
+ error instanceof Error ? error.message : String(error)
5418
+ );
5419
+ return;
5420
+ }
5421
+ if (resolved.note && !argv.json) {
5422
+ printDiagnosticsToConsole(resolved.note);
5423
+ }
5424
+ const childArgs = [...resolved.argsPrefix, ...buildApplyArgs(argv)];
5425
+ const exitCode = await new Promise((resolvePromise) => {
5426
+ const child = spawn(resolved.command, childArgs, {
5427
+ stdio: "inherit",
5428
+ env: process.env,
5429
+ shell: process.platform === "win32"
5430
+ });
5431
+ child.on("error", (error) => {
5432
+ printCriticalFailureToConsoleAndExit(
5433
+ `Failed to start apitogo-apply: ${error.message}`
5434
+ );
5435
+ resolvePromise(1);
5436
+ });
5437
+ child.on("close", (code) => {
5438
+ resolvePromise(code ?? 1);
5439
+ });
5440
+ });
5441
+ if (exitCode !== 0) {
5442
+ process.exit(exitCode);
5443
+ }
5444
+ }
5445
+
5446
+ // src/cli/cmds/apply.ts
5447
+ var apply_default = {
5448
+ desc: "Apply apitogo.config.json to the APItoGo platform (gateway, portal, backend, site)",
5449
+ command: "apply",
5450
+ builder: (yargs2) => yargs2.option("dir", {
5451
+ type: "string",
5452
+ describe: "Site directory containing apitogo.config.json",
5453
+ default: ".",
5454
+ normalize: true
5455
+ }).option("project-id", {
5456
+ type: "string",
5457
+ describe: "Override project GUID"
5458
+ }).option("project-name", {
5459
+ type: "string",
5460
+ describe: "Display name when creating a project"
5461
+ }).option("platform-plan", {
5462
+ type: "string",
5463
+ describe: "Platform hosting tier",
5464
+ choices: ["free", "starter", "professional"]
5465
+ }).option("skip-backend", {
5466
+ type: "boolean",
5467
+ describe: "Skip backend redeploy when healthy",
5468
+ default: false
5469
+ }).option("force-backend-redeploy", {
5470
+ type: "boolean",
5471
+ describe: "Force backend package + deploy",
5472
+ default: false
5473
+ }).option("force-site-redeploy", {
5474
+ type: "boolean",
5475
+ describe: "Force site build + deploy",
5476
+ default: false
5477
+ }).option("resume-from", {
5478
+ type: "string",
5479
+ describe: "Resume publish ledger from step id"
5480
+ }).option("wait", {
5481
+ type: "boolean",
5482
+ describe: "Wait for long-running jobs",
5483
+ default: true
5484
+ }).option("json", {
5485
+ type: "boolean",
5486
+ describe: "Print raw JSON result only",
5487
+ default: false
5488
+ }),
5489
+ handler: async (argv) => {
5490
+ await captureEvent({ argv, event: "apitogo apply" });
5491
+ await apply(argv);
5492
+ }
5493
+ };
5494
+
5208
5495
  // src/cli/build/handler.ts
5209
- import path31 from "node:path";
5496
+ import path32 from "node:path";
5210
5497
 
5211
5498
  // src/vite/build.ts
5212
5499
  import { mkdir as mkdir5, readFile as readFile3, rename, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
5213
- import path29 from "node:path";
5500
+ import path30 from "node:path";
5214
5501
  import { build as esbuild } from "esbuild";
5215
5502
  import { build as viteBuild, mergeConfig as mergeConfig3 } from "vite";
5216
5503
 
@@ -5346,9 +5633,9 @@ init_invariant();
5346
5633
  init_joinUrl();
5347
5634
 
5348
5635
  // src/vite/config.ts
5349
- import path24 from "node:path";
5636
+ import path25 from "node:path";
5350
5637
  import dotenv from "dotenv";
5351
- import colors4 from "picocolors";
5638
+ import colors5 from "picocolors";
5352
5639
  import {
5353
5640
  loadConfigFromFile,
5354
5641
  mergeConfig as mergeConfig2
@@ -5357,7 +5644,7 @@ import {
5357
5644
  // package.json
5358
5645
  var package_default = {
5359
5646
  name: "@lukoweb/apitogo",
5360
- version: "0.1.67",
5647
+ version: "0.1.69",
5361
5648
  type: "module",
5362
5649
  sideEffects: [
5363
5650
  "**/*.css",
@@ -5778,24 +6065,24 @@ async function loadDevPortalViteDefines(rootDir, mode) {
5778
6065
 
5779
6066
  // src/vite/package-root.ts
5780
6067
  init_file_exists();
5781
- import path6 from "node:path";
6068
+ import path7 from "node:path";
5782
6069
  var findPackageRoot = async (startDir) => {
5783
6070
  let dir = startDir;
5784
- while (dir !== path6.dirname(dir)) {
5785
- if (await fileExists(path6.join(dir, "package.json"))) return dir;
5786
- dir = path6.dirname(dir);
6071
+ while (dir !== path7.dirname(dir)) {
6072
+ if (await fileExists(path7.join(dir, "package.json"))) return dir;
6073
+ dir = path7.dirname(dir);
5787
6074
  }
5788
6075
  };
5789
6076
 
5790
6077
  // src/vite/pagefind-dev-stub.ts
5791
6078
  import fs from "node:fs/promises";
5792
- import path7 from "node:path";
6079
+ import path8 from "node:path";
5793
6080
  var NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
5794
6081
  async function ensurePagefindDevStub(publicDir) {
5795
- const pagefindPath = path7.join(publicDir, "pagefind/pagefind.js");
6082
+ const pagefindPath = path8.join(publicDir, "pagefind/pagefind.js");
5796
6083
  const exists = await fs.stat(pagefindPath).catch(() => false);
5797
6084
  if (!exists) {
5798
- await fs.mkdir(path7.dirname(pagefindPath), { recursive: true });
6085
+ await fs.mkdir(path8.dirname(pagefindPath), { recursive: true });
5799
6086
  await fs.writeFile(pagefindPath, NOT_BUILT_YET);
5800
6087
  }
5801
6088
  }
@@ -5807,7 +6094,7 @@ import react from "@vitejs/plugin-react";
5807
6094
  // src/vite/css/plugin.ts
5808
6095
  init_loader();
5809
6096
  init_plugin_theme();
5810
- import path8 from "node:path";
6097
+ import path9 from "node:path";
5811
6098
  import { isCSSRequest as isCSSRequest2 } from "vite";
5812
6099
 
5813
6100
  // src/vite/css/collect.ts
@@ -5842,7 +6129,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
5842
6129
  function vitePluginSsrCss(pluginOpts) {
5843
6130
  let server;
5844
6131
  const config2 = getCurrentConfig();
5845
- const virtualHref = path8.join(
6132
+ const virtualHref = path9.join(
5846
6133
  config2.basePath ?? "",
5847
6134
  `/@id/__x00__${VIRTUAL_ENTRY}?direct`
5848
6135
  );
@@ -5979,7 +6266,7 @@ var plugin_api_keys_default = viteApiKeysPlugin;
5979
6266
 
5980
6267
  // src/vite/plugin-api.ts
5981
6268
  import fs3 from "node:fs/promises";
5982
- import path14 from "node:path";
6269
+ import path15 from "node:path";
5983
6270
  import { deepEqual as deepEqual2 } from "fast-equals";
5984
6271
  import { runnerImport as runnerImport3 } from "vite";
5985
6272
  init_package_json();
@@ -5988,7 +6275,7 @@ init_loader();
5988
6275
  // src/config/validators/BuildSchema.ts
5989
6276
  init_file_exists();
5990
6277
  init_loader();
5991
- import path9 from "node:path";
6278
+ import path10 from "node:path";
5992
6279
  import { runnerImport as runnerImport2 } from "vite";
5993
6280
  import { z as z10 } from "zod";
5994
6281
  var BuildProcessorSchema = z10.custom((val) => typeof val === "function");
@@ -6017,7 +6304,7 @@ var buildConfigFiles = [
6017
6304
  ];
6018
6305
  async function getBuildConfigFilePath(rootDir) {
6019
6306
  for (const fileName of buildConfigFiles) {
6020
- const filepath = path9.join(rootDir, fileName);
6307
+ const filepath = path10.join(rootDir, fileName);
6021
6308
  if (await fileExists(filepath)) {
6022
6309
  return filepath;
6023
6310
  }
@@ -6126,14 +6413,14 @@ var flattenAllOf = (schema2) => {
6126
6413
  };
6127
6414
 
6128
6415
  // src/lib/util/traverse.ts
6129
- var traverse = (specification, transform, path40 = []) => {
6130
- const transformed = transform(specification, path40);
6416
+ var traverse = (specification, transform, path41 = []) => {
6417
+ const transformed = transform(specification, path41);
6131
6418
  if (typeof transformed !== "object" || transformed === null) {
6132
6419
  return transformed;
6133
6420
  }
6134
6421
  const result = Array.isArray(transformed) ? [] : {};
6135
6422
  for (const [key, value] of Object.entries(transformed)) {
6136
- const currentPath = [...path40, key];
6423
+ const currentPath = [...path41, key];
6137
6424
  if (Array.isArray(value)) {
6138
6425
  result[key] = value.map(
6139
6426
  (item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
@@ -6161,9 +6448,9 @@ var resolveLocalRef = (schema2, ref) => {
6161
6448
  if (schemaCache?.has(ref)) {
6162
6449
  return schemaCache.get(ref);
6163
6450
  }
6164
- const path40 = ref.split("/").slice(1);
6451
+ const path41 = ref.split("/").slice(1);
6165
6452
  let current = schema2;
6166
- for (const segment of path40) {
6453
+ for (const segment of path41) {
6167
6454
  if (!current || typeof current !== "object") {
6168
6455
  current = null;
6169
6456
  }
@@ -6182,7 +6469,7 @@ var dereference = async (schema2, resolvers = []) => {
6182
6469
  }
6183
6470
  const cloned = structuredClone(schema2);
6184
6471
  const visited = /* @__PURE__ */ new Set();
6185
- const resolve = async (current, path40) => {
6472
+ const resolve = async (current, path41) => {
6186
6473
  if (isIndexableObject(current)) {
6187
6474
  if (visited.has(current)) {
6188
6475
  return CIRCULAR_REF;
@@ -6190,7 +6477,7 @@ var dereference = async (schema2, resolvers = []) => {
6190
6477
  visited.add(current);
6191
6478
  if (Array.isArray(current)) {
6192
6479
  for (let index = 0; index < current.length; index++) {
6193
- current[index] = await resolve(current[index], `${path40}/${index}`);
6480
+ current[index] = await resolve(current[index], `${path41}/${index}`);
6194
6481
  }
6195
6482
  } else {
6196
6483
  if ("$ref" in current && typeof current.$ref === "string") {
@@ -6201,13 +6488,13 @@ var dereference = async (schema2, resolvers = []) => {
6201
6488
  for (const resolver of resolvers) {
6202
6489
  const resolved = await resolver($ref);
6203
6490
  if (resolved) {
6204
- result2 = await resolve(resolved, path40);
6491
+ result2 = await resolve(resolved, path41);
6205
6492
  break;
6206
6493
  }
6207
6494
  }
6208
6495
  if (result2 === void 0) {
6209
6496
  const resolved = await resolveLocalRef(cloned, $ref);
6210
- result2 = await resolve(resolved, path40);
6497
+ result2 = await resolve(resolved, path41);
6211
6498
  }
6212
6499
  if (hasSiblings) {
6213
6500
  if (result2 === CIRCULAR_REF) {
@@ -6220,7 +6507,7 @@ var dereference = async (schema2, resolvers = []) => {
6220
6507
  return result2;
6221
6508
  }
6222
6509
  for (const key in current) {
6223
- current[key] = await resolve(current[key], `${path40}/${key}`);
6510
+ current[key] = await resolve(current[key], `${path41}/${key}`);
6224
6511
  }
6225
6512
  }
6226
6513
  visited.delete(current);
@@ -6259,9 +6546,9 @@ var upgradeSchema = (schema2) => {
6259
6546
  }
6260
6547
  return sub;
6261
6548
  });
6262
- schema2 = traverse(schema2, (sub, path40) => {
6549
+ schema2 = traverse(schema2, (sub, path41) => {
6263
6550
  if (sub.example !== void 0) {
6264
- if (isSchemaPath(path40 ?? [])) {
6551
+ if (isSchemaPath(path41 ?? [])) {
6265
6552
  sub.examples = [sub.example];
6266
6553
  } else {
6267
6554
  sub.examples = {
@@ -6274,11 +6561,11 @@ var upgradeSchema = (schema2) => {
6274
6561
  }
6275
6562
  return sub;
6276
6563
  });
6277
- schema2 = traverse(schema2, (schema3, path40) => {
6564
+ schema2 = traverse(schema2, (schema3, path41) => {
6278
6565
  if (schema3.type === "object" && schema3.properties !== void 0) {
6279
- const parentPath = path40?.slice(0, -1);
6566
+ const parentPath = path41?.slice(0, -1);
6280
6567
  const isMultipart = parentPath?.some((segment, index) => {
6281
- return segment === "content" && path40?.[index + 1] === "multipart/form-data";
6568
+ return segment === "content" && path41?.[index + 1] === "multipart/form-data";
6282
6569
  });
6283
6570
  if (isMultipart) {
6284
6571
  const entries = Object.entries(schema3.properties);
@@ -6292,8 +6579,8 @@ var upgradeSchema = (schema2) => {
6292
6579
  }
6293
6580
  return schema3;
6294
6581
  });
6295
- schema2 = traverse(schema2, (schema3, path40) => {
6296
- if (path40?.includes("content") && path40.includes("application/octet-stream")) {
6582
+ schema2 = traverse(schema2, (schema3, path41) => {
6583
+ if (path41?.includes("content") && path41.includes("application/octet-stream")) {
6297
6584
  return {};
6298
6585
  }
6299
6586
  if (schema3.type === "string" && schema3.format === "binary") {
@@ -6319,11 +6606,11 @@ var upgradeSchema = (schema2) => {
6319
6606
  }
6320
6607
  return sub;
6321
6608
  });
6322
- schema2 = traverse(schema2, (schema3, path40) => {
6609
+ schema2 = traverse(schema2, (schema3, path41) => {
6323
6610
  if (schema3.type === "string" && schema3.format === "byte") {
6324
- const parentPath = path40?.slice(0, -1);
6611
+ const parentPath = path41?.slice(0, -1);
6325
6612
  const contentMediaType = parentPath?.find(
6326
- (_, index) => path40?.[index - 1] === "content"
6613
+ (_, index) => path41?.[index - 1] === "content"
6327
6614
  );
6328
6615
  return {
6329
6616
  type: "string",
@@ -6335,7 +6622,7 @@ var upgradeSchema = (schema2) => {
6335
6622
  });
6336
6623
  return schema2;
6337
6624
  };
6338
- function isSchemaPath(path40) {
6625
+ function isSchemaPath(path41) {
6339
6626
  const schemaLocations = [
6340
6627
  ["components", "schemas"],
6341
6628
  "properties",
@@ -6348,10 +6635,10 @@ function isSchemaPath(path40) {
6348
6635
  ];
6349
6636
  return schemaLocations.some((location) => {
6350
6637
  if (Array.isArray(location)) {
6351
- return location.every((segment, index) => path40[index] === segment);
6638
+ return location.every((segment, index) => path41[index] === segment);
6352
6639
  }
6353
- return path40.includes(location);
6354
- }) || path40.includes("schema") || path40.some((segment) => segment.endsWith("Schema"));
6640
+ return path41.includes(location);
6641
+ }) || path41.includes("schema") || path41.some((segment) => segment.endsWith("Schema"));
6355
6642
  }
6356
6643
 
6357
6644
  // src/lib/oas/parser/index.ts
@@ -6433,13 +6720,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
6433
6720
  "anyOf",
6434
6721
  "oneOf"
6435
6722
  ]);
6436
- var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path40 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
6723
+ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path41 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
6437
6724
  if (obj === null || typeof obj !== "object") return obj;
6438
6725
  const refPath = obj.__$ref;
6439
6726
  const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
6440
6727
  if (isCircular) {
6441
6728
  if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
6442
- const circularProp = path40.find((p) => !OPENAPI_PROPS.has(p)) || path40[0];
6729
+ const circularProp = path41.find((p) => !OPENAPI_PROPS.has(p)) || path41[0];
6443
6730
  return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
6444
6731
  }
6445
6732
  if (refs.has(obj)) return refs.get(obj);
@@ -6449,7 +6736,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
6449
6736
  value,
6450
6737
  currentPath,
6451
6738
  refs,
6452
- [...path40, key],
6739
+ [...path41, key],
6453
6740
  currentRefPaths
6454
6741
  );
6455
6742
  const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
@@ -6484,7 +6771,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
6484
6771
  var getAllTags = (schema2) => {
6485
6772
  const rootTags = schema2.tags ?? [];
6486
6773
  const operations = Object.values(schema2.paths ?? {}).flatMap(
6487
- (path40) => HttpMethods.map((k) => path40?.[k]).filter((op) => op != null)
6774
+ (path41) => HttpMethods.map((k) => path41?.[k]).filter((op) => op != null)
6488
6775
  );
6489
6776
  const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
6490
6777
  const hasUntaggedOperations = operations.some(
@@ -6539,7 +6826,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
6539
6826
  var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
6540
6827
  var getAllOperations = (paths) => {
6541
6828
  const operations = Object.entries(paths ?? {}).flatMap(
6542
- ([path40, value]) => HttpMethods.flatMap((method) => {
6829
+ ([path41, value]) => HttpMethods.flatMap((method) => {
6543
6830
  if (!value?.[method]) return [];
6544
6831
  const operation = value[method];
6545
6832
  const pathParameters = value.parameters ?? [];
@@ -6559,7 +6846,7 @@ var getAllOperations = (paths) => {
6559
6846
  return {
6560
6847
  ...operation,
6561
6848
  method,
6562
- path: path40,
6849
+ path: path41,
6563
6850
  parameters,
6564
6851
  servers,
6565
6852
  tags: operation.tags ?? []
@@ -6917,8 +7204,8 @@ var Schema = builder.objectRef("Schema").implement({
6917
7204
  }),
6918
7205
  paths: t.field({
6919
7206
  type: [PathItem],
6920
- resolve: (root) => Object.entries(root.paths ?? {}).map(([path40, value]) => ({
6921
- path: path40,
7207
+ resolve: (root) => Object.entries(root.paths ?? {}).map(([path41, value]) => ({
7208
+ path: path41,
6922
7209
  // biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
6923
7210
  methods: Object.keys(value)
6924
7211
  }))
@@ -7008,12 +7295,30 @@ builder.queryType({
7008
7295
  var schema = builder.toSchema();
7009
7296
  var createGraphQLServer = (options) => createYoga({ schema, batching: true, ...options });
7010
7297
 
7298
+ // src/lib/plugins/openapi/processors/injectApitogoGatewayServer.ts
7299
+ var APITOGO_GATEWAY_URL_ENV = "APITOGO_GATEWAY_URL";
7300
+ function injectApitogoGatewayServer(options) {
7301
+ return ({ schema: schema2 }) => {
7302
+ if (process.env[options?.disableEnv ?? "APITOGO_PUBLIC_DISABLE_INJECT_GATEWAY"]) {
7303
+ return schema2;
7304
+ }
7305
+ const url = (options?.gatewayUrl ?? process.env[APITOGO_GATEWAY_URL_ENV])?.trim();
7306
+ if (!url) {
7307
+ return schema2;
7308
+ }
7309
+ return {
7310
+ ...schema2,
7311
+ servers: [{ url: url.replace(/\/+$/, ""), description: "API gateway" }]
7312
+ };
7313
+ };
7314
+ }
7315
+
7011
7316
  // src/lib/util/ensureArray.ts
7012
7317
  var ensureArray = (value) => Array.isArray(value) ? value : [value];
7013
7318
 
7014
7319
  // src/vite/api/SchemaManager.ts
7015
7320
  import fs2 from "node:fs/promises";
7016
- import path10 from "node:path";
7321
+ import path11 from "node:path";
7017
7322
  import {
7018
7323
  $RefParser as $RefParser2
7019
7324
  } from "@apidevtools/json-schema-ref-parser";
@@ -7065,7 +7370,7 @@ init_joinUrl();
7065
7370
 
7066
7371
  // src/vite/api/schema-codegen.ts
7067
7372
  var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
7068
- var getSegmentsFromPath = (path40) => path40.split("/").slice(1).map(unescapeJsonPointer);
7373
+ var getSegmentsFromPath = (path41) => path41.split("/").slice(1).map(unescapeJsonPointer);
7069
7374
  var createLocalRefMap = (obj) => {
7070
7375
  const refMap = /* @__PURE__ */ new Map();
7071
7376
  const siblingsMap = /* @__PURE__ */ new Map();
@@ -7096,16 +7401,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
7096
7401
  /"__refMap\+Siblings:(.*?)"/g,
7097
7402
  (_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
7098
7403
  );
7099
- var lookup = (schema2, path40, filePath) => {
7100
- const parts = getSegmentsFromPath(path40);
7404
+ var lookup = (schema2, path41, filePath) => {
7405
+ const parts = getSegmentsFromPath(path41);
7101
7406
  let val = schema2;
7102
7407
  for (const part of parts) {
7103
7408
  while (val.$ref?.startsWith("#/")) {
7104
- val = val.$ref === path40 ? val : lookup(schema2, val.$ref, filePath);
7409
+ val = val.$ref === path41 ? val : lookup(schema2, val.$ref, filePath);
7105
7410
  }
7106
7411
  if (val[part] === void 0) {
7107
7412
  throw new Error(
7108
- `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path40}`
7413
+ `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path41}`
7109
7414
  );
7110
7415
  }
7111
7416
  val = val[part];
@@ -7203,18 +7508,18 @@ var SchemaManager = class {
7203
7508
  ];
7204
7509
  }
7205
7510
  getPathForFile = (input, params) => {
7206
- const filePath = path10.resolve(this.config.__meta.rootDir, input);
7511
+ const filePath = path11.resolve(this.config.__meta.rootDir, input);
7207
7512
  const apis = ensureArray(this.config.apis ?? []);
7208
7513
  for (const apiConfig of apis) {
7209
7514
  if (!apiConfig || apiConfig.type !== "file" || !apiConfig.path) continue;
7210
7515
  const match = normalizeInputs(apiConfig.input).some(
7211
- (i) => path10.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
7516
+ (i) => path11.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
7212
7517
  );
7213
7518
  if (match) return apiConfig.path;
7214
7519
  }
7215
7520
  };
7216
7521
  processSchema = async (input) => {
7217
- const filePath = path10.resolve(this.config.__meta.rootDir, input.input);
7522
+ const filePath = path11.resolve(this.config.__meta.rootDir, input.input);
7218
7523
  const params = input.params;
7219
7524
  const configuredPath = this.getPathForFile(input.input, params);
7220
7525
  if (!configuredPath) {
@@ -7250,9 +7555,9 @@ var SchemaManager = class {
7250
7555
  const processedTime = Date.now();
7251
7556
  const code = generateCode(processedSchema, filePath);
7252
7557
  const prefixPath = slugify(configuredPath);
7253
- const processedFilePath = path10.posix.join(
7558
+ const processedFilePath = path11.posix.join(
7254
7559
  this.storeDir,
7255
- `${prefixPath}-${path10.basename(filePath)}${paramsSuffix(params)}.js`
7560
+ `${prefixPath}-${path11.basename(filePath)}${paramsSuffix(params)}.js`
7256
7561
  );
7257
7562
  const importKey = processedFilePath;
7258
7563
  await fs2.writeFile(processedFilePath, code);
@@ -7301,7 +7606,7 @@ var SchemaManager = class {
7301
7606
  };
7302
7607
  getAllTrackedFiles = () => Array.from(this.referencedBy.keys());
7303
7608
  getFilesToReprocess = (changedFile) => {
7304
- const resolvedPath = path10.resolve(this.config.__meta.rootDir, changedFile);
7609
+ const resolvedPath = path11.resolve(this.config.__meta.rootDir, changedFile);
7305
7610
  const referencedBy = this.referencedBy.get(resolvedPath);
7306
7611
  if (!referencedBy) return [];
7307
7612
  const filesToProcess = referencedBy.size === 0 ? [resolvedPath] : Array.from(referencedBy);
@@ -7330,7 +7635,7 @@ var SchemaManager = class {
7330
7635
  version: "",
7331
7636
  path: input.path ?? "",
7332
7637
  label: input.label,
7333
- inputPath: path10.resolve(this.config.__meta.rootDir, input.input),
7638
+ inputPath: path11.resolve(this.config.__meta.rootDir, input.input),
7334
7639
  params: input.params,
7335
7640
  importKey: "",
7336
7641
  downloadUrl: "",
@@ -7350,8 +7655,8 @@ var SchemaManager = class {
7350
7655
  }
7351
7656
  }
7352
7657
  };
7353
- getLatestSchema = (path40) => this.processedSchemas[path40]?.at(0);
7354
- getSchemasForPath = (path40) => this.processedSchemas[path40];
7658
+ getLatestSchema = (path41) => this.processedSchemas[path41]?.at(0);
7659
+ getSchemasForPath = (path41) => this.processedSchemas[path41];
7355
7660
  getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
7356
7661
  getUrlToFilePathMap = () => {
7357
7662
  const map = /* @__PURE__ */ new Map();
@@ -7373,7 +7678,7 @@ var SchemaManager = class {
7373
7678
  };
7374
7679
  createSchemaPath = (inputPath, versionPath, apiPath, params) => {
7375
7680
  const suffix = paramsSuffix(params);
7376
- const extension = suffix ? ".json" : path10.extname(inputPath);
7681
+ const extension = suffix ? ".json" : path11.extname(inputPath);
7377
7682
  return joinUrl(
7378
7683
  this.config.basePath,
7379
7684
  apiPath,
@@ -7396,8 +7701,8 @@ var SchemaManager = class {
7396
7701
  // src/vite/plugin-config-reload.ts
7397
7702
  init_logger();
7398
7703
  init_loader();
7399
- import path13 from "node:path";
7400
- import colors3 from "picocolors";
7704
+ import path14 from "node:path";
7705
+ import colors4 from "picocolors";
7401
7706
 
7402
7707
  // src/vite/plugin-navigation.ts
7403
7708
  init_loader();
@@ -7406,7 +7711,7 @@ import { stringify as stringify3 } from "javascript-stringify";
7406
7711
  import { isElement } from "react-is";
7407
7712
 
7408
7713
  // src/config/validators/NavigationSchema.ts
7409
- import path11 from "node:path";
7714
+ import path12 from "node:path";
7410
7715
  import { glob } from "glob";
7411
7716
  import { fromMarkdown } from "mdast-util-from-markdown";
7412
7717
  import { mdxFromMarkdown } from "mdast-util-mdx";
@@ -7457,7 +7762,7 @@ var extractRichH1 = (content) => {
7457
7762
  }
7458
7763
  };
7459
7764
  var isNavigationItem = (item) => item !== void 0;
7460
- var toPosixPath = (filePath) => filePath.split(path11.win32.sep).join(path11.posix.sep);
7765
+ var toPosixPath = (filePath) => filePath.split(path12.win32.sep).join(path12.posix.sep);
7461
7766
  var NavigationResolver = class {
7462
7767
  rootDir;
7463
7768
  globPatterns;
@@ -7590,13 +7895,13 @@ init_invariant();
7590
7895
 
7591
7896
  // src/vite/debug.ts
7592
7897
  import { mkdir, writeFile } from "node:fs/promises";
7593
- import path12 from "node:path";
7898
+ import path13 from "node:path";
7594
7899
  async function writePluginDebugCode(rootDir, pluginName, code, extension = "js") {
7595
7900
  if (process.env.ZUDOKU_BUILD_DEBUG) {
7596
- const debugDir = path12.join(rootDir, "dist", "debug");
7901
+ const debugDir = path13.join(rootDir, "dist", "debug");
7597
7902
  await mkdir(debugDir, { recursive: true });
7598
7903
  await writeFile(
7599
- path12.join(debugDir, `${pluginName}.${extension}`),
7904
+ path13.join(debugDir, `${pluginName}.${extension}`),
7600
7905
  typeof code === "string" ? code : code.join("\n")
7601
7906
  );
7602
7907
  }
@@ -7704,8 +8009,8 @@ var viteConfigReloadPlugin = () => ({
7704
8009
  invalidate(server);
7705
8010
  reload(server);
7706
8011
  logger.info(
7707
- colors3.blue(
7708
- `Config ${path13.basename(currentConfig.__meta.configPath)} changed. Reloading...`
8012
+ colors4.blue(
8013
+ `Config ${path14.basename(currentConfig.__meta.configPath)} changed. Reloading...`
7709
8014
  ),
7710
8015
  { timestamp: true }
7711
8016
  );
@@ -7719,15 +8024,19 @@ var viteApiPlugin = async () => {
7719
8024
  const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
7720
8025
  const initialConfig = getCurrentConfig();
7721
8026
  const zuploProcessors = ZuploEnv.isZuplo ? await runnerImport3(
7722
- path14.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
8027
+ path15.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
7723
8028
  ).then((m) => m.module.default(initialConfig.__meta.rootDir)) : [];
7724
8029
  const buildConfig = await getBuildConfig();
7725
8030
  const buildProcessors = buildConfig?.processors ?? [];
7726
- const tmpStoreDir = path14.posix.join(
8031
+ const tmpStoreDir = path15.posix.join(
7727
8032
  initialConfig.__meta.rootDir,
7728
8033
  "node_modules/.apitogo/processed"
7729
8034
  );
7730
- const processors = [...buildProcessors, ...zuploProcessors];
8035
+ const processors = [
8036
+ ...buildProcessors,
8037
+ ...zuploProcessors,
8038
+ injectApitogoGatewayServer()
8039
+ ];
7731
8040
  const schemaManager = new SchemaManager({
7732
8041
  storeDir: tmpStoreDir,
7733
8042
  config: initialConfig,
@@ -7751,7 +8060,7 @@ var viteApiPlugin = async () => {
7751
8060
  const inputPath = pathMap.get(req.url);
7752
8061
  if (!inputPath) return next();
7753
8062
  const content = await fs3.readFile(inputPath, "utf-8");
7754
- const mimeType = path14.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
8063
+ const mimeType = path15.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
7755
8064
  res.setHeader("Content-Type", `${mimeType}; charset=utf-8`);
7756
8065
  return res.end(content);
7757
8066
  });
@@ -7939,8 +8248,8 @@ var viteApiPlugin = async () => {
7939
8248
  if (process.env.NODE_ENV !== "production") return;
7940
8249
  for (const [urlPath, inputPath] of pathMap) {
7941
8250
  const content = await fs3.readFile(inputPath, "utf-8");
7942
- const outputPath = path14.join(config2.__meta.rootDir, "dist", urlPath);
7943
- await fs3.mkdir(path14.dirname(outputPath), { recursive: true });
8251
+ const outputPath = path15.join(config2.__meta.rootDir, "dist", urlPath);
8252
+ await fs3.mkdir(path15.dirname(outputPath), { recursive: true });
7944
8253
  await fs3.writeFile(outputPath, content, "utf-8");
7945
8254
  }
7946
8255
  }
@@ -7983,7 +8292,7 @@ var plugin_auth_default = viteAuthPlugin;
7983
8292
 
7984
8293
  // src/vite/plugin-component.ts
7985
8294
  init_loader();
7986
- import path15 from "node:path";
8295
+ import path16 from "node:path";
7987
8296
  var viteAliasPlugin = () => {
7988
8297
  return {
7989
8298
  name: "zudoku-component-plugin",
@@ -8011,7 +8320,7 @@ var viteAliasPlugin = () => {
8011
8320
  ];
8012
8321
  const aliases = replacements.map(([find, replacement]) => ({
8013
8322
  find,
8014
- replacement: path15.posix.join(config2.__meta.moduleDir, replacement)
8323
+ replacement: path16.posix.join(config2.__meta.moduleDir, replacement)
8015
8324
  }));
8016
8325
  return config2.__meta.mode === "internal" || config2.__meta.mode === "standalone" ? { resolve: { alias: aliases } } : void 0;
8017
8326
  }
@@ -8022,11 +8331,11 @@ var plugin_component_default = viteAliasPlugin;
8022
8331
  // src/vite/plugin-config.ts
8023
8332
  init_package_json();
8024
8333
  init_loader();
8025
- import path16 from "node:path";
8334
+ import path17 from "node:path";
8026
8335
  import { normalizePath } from "vite";
8027
8336
  var virtualModuleId3 = "virtual:zudoku-config";
8028
8337
  var resolvedVirtualModuleId3 = `\0${virtualModuleId3}`;
8029
- var browserConfigLoaderPath = path16.join(
8338
+ var browserConfigLoaderPath = path17.join(
8030
8339
  getZudokuRootDir(),
8031
8340
  "src/config/apitogo-config-loader.browser.ts"
8032
8341
  );
@@ -8086,8 +8395,11 @@ import { runPluginTransformConfig } from "@lukoweb/apitogo/plugins";
8086
8395
 
8087
8396
  const embeddedConfig = ${serializeClientConfig(loadedConfig)};
8088
8397
 
8398
+ // JSON embedding drops Symbol values (React element's $$typeof). Prefer live
8399
+ // navigation/plugins from the TSX module so custom-page elements stay valid.
8089
8400
  const config = await runPluginTransformConfig({
8090
8401
  ...embeddedConfig,
8402
+ navigation: rawConfig?.navigation ?? embeddedConfig.navigation,
8091
8403
  plugins: rawConfig?.plugins ?? embeddedConfig.plugins ?? [],
8092
8404
  __meta: ${JSON.stringify(clientMeta)},
8093
8405
  });
@@ -8193,7 +8505,7 @@ var viteDocMetadataPlugin = () => ({
8193
8505
 
8194
8506
  // src/vite/plugin-docs.ts
8195
8507
  init_loader();
8196
- import path17 from "node:path";
8508
+ import path18 from "node:path";
8197
8509
  import { glob as glob3 } from "glob";
8198
8510
  import globParent from "glob-parent";
8199
8511
  init_ZudokuConfig();
@@ -8262,7 +8574,7 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
8262
8574
  if (process.env.NODE_ENV !== "development") {
8263
8575
  const draftStatuses = await Promise.all(
8264
8576
  globbedFiles.map(async (file) => {
8265
- const absolutePath = path17.resolve(config2.__meta.rootDir, file);
8577
+ const absolutePath = path18.resolve(config2.__meta.rootDir, file);
8266
8578
  const { data } = await readFrontmatter(absolutePath);
8267
8579
  return { file, isDraft: data.draft === true };
8268
8580
  })
@@ -8275,9 +8587,9 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
8275
8587
  if (draftFiles.has(file)) {
8276
8588
  continue;
8277
8589
  }
8278
- const relativePath = path17.posix.relative(parent, file);
8590
+ const relativePath = path18.posix.relative(parent, file);
8279
8591
  const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
8280
- const filePath = options.absolute ? path17.resolve(config2.__meta.rootDir, file) : file;
8592
+ const filePath = options.absolute ? path18.resolve(config2.__meta.rootDir, file) : file;
8281
8593
  fileMapping[routePath] = filePath;
8282
8594
  }
8283
8595
  }
@@ -8341,7 +8653,7 @@ var viteDocsPlugin = () => {
8341
8653
  const globbedDocuments = {};
8342
8654
  for (const [routePath, file] of Object.entries(fileMapping)) {
8343
8655
  const importPath = ensureLeadingSlash(
8344
- path17.posix.join(globImportBasePath, file)
8656
+ path18.posix.join(globImportBasePath, file)
8345
8657
  );
8346
8658
  globbedDocuments[routePath] = importPath;
8347
8659
  }
@@ -8367,7 +8679,7 @@ var plugin_docs_default = viteDocsPlugin;
8367
8679
  // src/vite/plugin-local-manifest.ts
8368
8680
  init_apitogo_config_loader();
8369
8681
  init_local_manifest();
8370
- import path18 from "node:path";
8682
+ import path19 from "node:path";
8371
8683
  var APITOGO_LOCAL_MANIFEST_VIRTUAL_ID = "virtual:apitogo-local-manifest";
8372
8684
  var resolvedVirtualModuleId4 = `\0${APITOGO_LOCAL_MANIFEST_VIRTUAL_ID}`;
8373
8685
  var viteLocalManifestPlugin = () => {
@@ -8417,8 +8729,8 @@ var viteLocalManifestPlugin = () => {
8417
8729
  server.watcher.add(watchPath);
8418
8730
  }
8419
8731
  server.watcher.on("change", async (changedPath) => {
8420
- const resolvedChanged = path18.resolve(changedPath);
8421
- if (!watchPaths.some((p) => path18.resolve(p) === resolvedChanged)) {
8732
+ const resolvedChanged = path19.resolve(changedPath);
8733
+ if (!watchPaths.some((p) => path19.resolve(p) === resolvedChanged)) {
8422
8734
  return;
8423
8735
  }
8424
8736
  const module = server.moduleGraph.getModuleById(
@@ -8445,7 +8757,7 @@ init_loader();
8445
8757
  init_ProtectedRoutesSchema();
8446
8758
  init_joinUrl();
8447
8759
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
8448
- import path19 from "node:path";
8760
+ import path20 from "node:path";
8449
8761
  import { matchPath } from "react-router";
8450
8762
  var processMarkdownFile = async (filePath) => {
8451
8763
  const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
@@ -8533,7 +8845,7 @@ var viteMarkdownExportPlugin = () => {
8533
8845
  if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
8534
8846
  return;
8535
8847
  }
8536
- const distDir = path19.join(
8848
+ const distDir = path20.join(
8537
8849
  config2.__meta.rootDir,
8538
8850
  "dist",
8539
8851
  config2.basePath ?? ""
@@ -8554,15 +8866,15 @@ var viteMarkdownExportPlugin = () => {
8554
8866
  content: finalMarkdown
8555
8867
  });
8556
8868
  const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
8557
- const outputPath = `${path19.join(distDir, ...segments)}.md`;
8558
- await mkdir2(path19.dirname(outputPath), { recursive: true });
8869
+ const outputPath = `${path20.join(distDir, ...segments)}.md`;
8870
+ await mkdir2(path20.dirname(outputPath), { recursive: true });
8559
8871
  await writeFile2(outputPath, finalMarkdown, "utf-8");
8560
8872
  } catch (error) {
8561
8873
  console.warn(`Failed to export markdown for ${routePath}:`, error);
8562
8874
  }
8563
8875
  }
8564
8876
  if (config2.docs?.llms?.llmsTxt || config2.docs?.llms?.llmsTxtFull) {
8565
- const markdownInfoPath = path19.join(
8877
+ const markdownInfoPath = path20.join(
8566
8878
  config2.__meta.rootDir,
8567
8879
  "node_modules/.apitogo/markdown-info.json"
8568
8880
  );
@@ -8714,9 +9026,9 @@ var remarkCodeTabs = () => (tree) => {
8714
9026
  };
8715
9027
 
8716
9028
  // src/vite/mdx/remark-inject-filepath.ts
8717
- import path20 from "node:path";
9029
+ import path21 from "node:path";
8718
9030
  var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
8719
- const relativePath = path20.relative(rootDir, vfile.path).split(path20.sep).join(path20.posix.sep);
9031
+ const relativePath = path21.relative(rootDir, vfile.path).split(path21.sep).join(path21.posix.sep);
8720
9032
  tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
8721
9033
  };
8722
9034
 
@@ -8803,18 +9115,18 @@ var remarkLastModified = () => {
8803
9115
  };
8804
9116
 
8805
9117
  // src/vite/mdx/remark-link-rewrite.ts
8806
- import path21 from "node:path";
9118
+ import path22 from "node:path";
8807
9119
  import { visit as visit5 } from "unist-util-visit";
8808
9120
  var remarkLinkRewrite = (basePath = "") => (tree) => {
8809
9121
  visit5(tree, "link", (node) => {
8810
9122
  if (!node.url) return;
8811
9123
  if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
8812
9124
  node.url = node.url.replace(/\\/g, "/");
8813
- const base = path21.posix.join(basePath);
9125
+ const base = path22.posix.join(basePath);
8814
9126
  if (basePath && node.url.startsWith(base)) {
8815
9127
  node.url = node.url.slice(base.length);
8816
9128
  } else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
8817
- node.url = path21.posix.join("..", node.url);
9129
+ node.url = path22.posix.join("..", node.url);
8818
9130
  }
8819
9131
  node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
8820
9132
  });
@@ -9034,11 +9346,11 @@ var plugin_mdx_default = viteMdxPlugin;
9034
9346
 
9035
9347
  // src/vite/plugin-modules.ts
9036
9348
  init_loader();
9037
- import path22 from "node:path";
9349
+ import path23 from "node:path";
9038
9350
  import { normalizePath as normalizePath2 } from "vite";
9039
- var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path22.join(moduleDir, "../module-landing/src/index.tsx")) : "@lukoweb/apitogo-module-landing";
9040
- var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path22.join(moduleDir, "../module-user-panel/src/index.tsx")) : "@lukoweb/apitogo-module-user-panel";
9041
- var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(path22.resolve(rootDir, pagePath));
9351
+ var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path23.join(moduleDir, "../module-landing/src/index.tsx")) : "@lukoweb/apitogo-module-landing";
9352
+ var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path23.join(moduleDir, "../module-user-panel/src/index.tsx")) : "@lukoweb/apitogo-module-user-panel";
9353
+ var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(path23.resolve(rootDir, pagePath));
9042
9354
  var viteModulesPlugin = () => {
9043
9355
  const virtualModuleId4 = "virtual:zudoku-modules-plugin";
9044
9356
  const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
@@ -9173,7 +9485,7 @@ var plugin_modules_default = viteModulesPlugin;
9173
9485
 
9174
9486
  // src/vite/plugin-search.ts
9175
9487
  init_loader();
9176
- import path23 from "node:path";
9488
+ import path24 from "node:path";
9177
9489
  var viteSearchPlugin = () => {
9178
9490
  const virtualModuleId4 = "virtual:zudoku-search-plugin";
9179
9491
  const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
@@ -9191,7 +9503,7 @@ var viteSearchPlugin = () => {
9191
9503
  return resolvedVirtualModuleId5;
9192
9504
  }
9193
9505
  if (id === "/pagefind/pagefind.js" && resolvedViteConfig?.publicDir) {
9194
- return path23.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
9506
+ return path24.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
9195
9507
  }
9196
9508
  },
9197
9509
  async load(id) {
@@ -9330,17 +9642,17 @@ function vitePlugin() {
9330
9642
  }
9331
9643
 
9332
9644
  // src/vite/config.ts
9333
- var browserConfigLoaderPath2 = path24.join(
9645
+ var browserConfigLoaderPath2 = path25.join(
9334
9646
  getZudokuRootDir(),
9335
9647
  "src/config/apitogo-config-loader.browser.ts"
9336
9648
  );
9337
9649
  var resolveMergedPublicDir = (rootDir, merged) => {
9338
9650
  if (merged.publicDir === false) return void 0;
9339
9651
  const rel = typeof merged.publicDir === "string" ? merged.publicDir : "public";
9340
- return path24.resolve(rootDir, rel);
9652
+ return path25.resolve(rootDir, rel);
9341
9653
  };
9342
- var getAppClientEntryPath = () => path24.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
9343
- var getAppServerEntryPath = () => path24.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
9654
+ var getAppClientEntryPath = () => path25.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
9655
+ var getAppServerEntryPath = () => path25.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
9344
9656
  var hasLoggedCdnInfo = false;
9345
9657
  var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
9346
9658
  var defineEnvVars = (vars) => Object.fromEntries(
@@ -9357,9 +9669,9 @@ async function getViteConfig(dir, configEnv) {
9357
9669
  const cdnUrl = CdnUrlSchema.parse(config2.cdnUrl);
9358
9670
  const base = cdnUrl?.base ? joinUrl(cdnUrl.base, config2.basePath) : config2.basePath;
9359
9671
  if (cdnUrl && !hasLoggedCdnInfo) {
9360
- logger.info(colors4.blue(`Using CDN URL:`));
9361
- logger.info(colors4.blue(` base: `) + colors4.dim(cdnUrl.base));
9362
- logger.info(colors4.blue(` media: `) + colors4.dim(cdnUrl.media));
9672
+ logger.info(colors5.blue(`Using CDN URL:`));
9673
+ logger.info(colors5.blue(` base: `) + colors5.dim(cdnUrl.base));
9674
+ logger.info(colors5.blue(` media: `) + colors5.dim(cdnUrl.media));
9363
9675
  hasLoggedCdnInfo = true;
9364
9676
  }
9365
9677
  const publicVarsProcessEnvDefine = Object.fromEntries(
@@ -9370,7 +9682,7 @@ async function getViteConfig(dir, configEnv) {
9370
9682
  );
9371
9683
  if (ZuploEnv.isZuplo) {
9372
9684
  dotenv.config({
9373
- path: path24.resolve(config2.__meta.rootDir, "../.env.zuplo"),
9685
+ path: path25.resolve(config2.__meta.rootDir, "../.env.zuplo"),
9374
9686
  quiet: true
9375
9687
  });
9376
9688
  }
@@ -9395,11 +9707,11 @@ async function getViteConfig(dir, configEnv) {
9395
9707
  client: {
9396
9708
  resolve: {
9397
9709
  alias: {
9398
- [path24.join(
9710
+ [path25.join(
9399
9711
  getZudokuRootDir(),
9400
9712
  "src/config/apitogo-config-loader.node.ts"
9401
9713
  )]: browserConfigLoaderPath2,
9402
- [path24.join(
9714
+ [path25.join(
9403
9715
  getZudokuRootDir(),
9404
9716
  "src/config/apitogo-config-loader.node.js"
9405
9717
  )]: browserConfigLoaderPath2
@@ -9445,8 +9757,8 @@ async function getViteConfig(dir, configEnv) {
9445
9757
  ssr: configEnv.isSsrBuild,
9446
9758
  sourcemap: true,
9447
9759
  target: "es2022",
9448
- outDir: path24.resolve(
9449
- path24.join(
9760
+ outDir: path25.resolve(
9761
+ path25.join(
9450
9762
  dir,
9451
9763
  "dist",
9452
9764
  config2.basePath ?? "",
@@ -9465,7 +9777,7 @@ async function getViteConfig(dir, configEnv) {
9465
9777
  },
9466
9778
  experimental: {
9467
9779
  renderBuiltUrl(filename) {
9468
- if (cdnUrl?.base && [".js", ".css"].includes(path24.extname(filename))) {
9780
+ if (cdnUrl?.base && [".js", ".css"].includes(path25.extname(filename))) {
9469
9781
  return joinUrl(cdnUrl.base, filename);
9470
9782
  }
9471
9783
  if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
@@ -9478,7 +9790,7 @@ async function getViteConfig(dir, configEnv) {
9478
9790
  esbuildOptions: {
9479
9791
  target: "es2022"
9480
9792
  },
9481
- entries: [path24.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
9793
+ entries: [path25.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
9482
9794
  exclude: [
9483
9795
  "@lukoweb/apitogo",
9484
9796
  "@lukoweb/apitogo-plugin-dev-portal-billing"
@@ -9522,7 +9834,7 @@ async function getViteConfig(dir, configEnv) {
9522
9834
  if (!loaded) continue;
9523
9835
  mergedViteConfig = mergeConfig2(mergedViteConfig, loaded.config, true);
9524
9836
  if (root === dir) {
9525
- logger.info(colors4.blue(`merged with custom user Vite config`), {
9837
+ logger.info(colors5.blue(`merged with custom user Vite config`), {
9526
9838
  timestamp: true
9527
9839
  });
9528
9840
  }
@@ -9584,7 +9896,7 @@ init_package_json();
9584
9896
  init_joinUrl();
9585
9897
  import assert from "node:assert";
9586
9898
  import { cp, mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
9587
- import path25 from "node:path";
9899
+ import path26 from "node:path";
9588
9900
  var pkgJson = getZudokuPackageJson();
9589
9901
  function generateOutput({
9590
9902
  config: config2,
@@ -9641,9 +9953,9 @@ async function writeOutput(dir, {
9641
9953
  rewrites
9642
9954
  }) {
9643
9955
  const output = generateOutput({ config: config2, redirects, rewrites });
9644
- const outputDir = process.env.VERCEL ? path25.join(dir, ".vercel/output") : path25.join(dir, "dist/.output");
9956
+ const outputDir = process.env.VERCEL ? path26.join(dir, ".vercel/output") : path26.join(dir, "dist/.output");
9645
9957
  await mkdir3(outputDir, { recursive: true });
9646
- const outputFile = path25.join(outputDir, "config.json");
9958
+ const outputFile = path26.join(outputDir, "config.json");
9647
9959
  await writeFile3(outputFile, JSON.stringify(output, null, 2), "utf-8");
9648
9960
  if (process.env.VERCEL) {
9649
9961
  console.log("Wrote Vercel output to", outputDir);
@@ -9655,10 +9967,10 @@ init_logger();
9655
9967
  init_file_exists();
9656
9968
  import { readFile as readFile2, rm } from "node:fs/promises";
9657
9969
  import os from "node:os";
9658
- import path28 from "node:path";
9970
+ import path29 from "node:path";
9659
9971
  import { pathToFileURL } from "node:url";
9660
9972
  import { createIndex } from "pagefind";
9661
- import colors7 from "picocolors";
9973
+ import colors8 from "picocolors";
9662
9974
  import PiscinaImport from "piscina";
9663
9975
  init_transform_config();
9664
9976
  init_invariant();
@@ -9697,8 +10009,8 @@ function throttle(fn) {
9697
10009
  init_joinUrl();
9698
10010
  import { createWriteStream, existsSync as existsSync2 } from "node:fs";
9699
10011
  import { mkdir as mkdir4 } from "node:fs/promises";
9700
- import path26 from "node:path";
9701
- import colors5 from "picocolors";
10012
+ import path27 from "node:path";
10013
+ import colors6 from "picocolors";
9702
10014
  import { SitemapStream } from "sitemap";
9703
10015
  async function generateSitemap({
9704
10016
  outputUrls,
@@ -9711,11 +10023,11 @@ async function generateSitemap({
9711
10023
  return;
9712
10024
  }
9713
10025
  const sitemap = new SitemapStream({ hostname: config2.siteUrl });
9714
- const outputDir = path26.resolve(baseOutputDir, config2.outDir ?? "");
10026
+ const outputDir = path27.resolve(baseOutputDir, config2.outDir ?? "");
9715
10027
  if (!existsSync2(outputDir)) {
9716
10028
  await mkdir4(outputDir, { recursive: true });
9717
10029
  }
9718
- const sitemapOutputPath = path26.join(outputDir, "sitemap.xml");
10030
+ const sitemapOutputPath = path27.join(outputDir, "sitemap.xml");
9719
10031
  const writeStream = createWriteStream(sitemapOutputPath);
9720
10032
  sitemap.pipe(writeStream);
9721
10033
  let lastmod;
@@ -9739,20 +10051,20 @@ async function generateSitemap({
9739
10051
  writeStream.on("error", reject);
9740
10052
  });
9741
10053
  console.debug(
9742
- colors5.blue(`\u2713 wrote sitemap to ${colors5.bold(sitemapOutputPath)}`)
10054
+ colors6.blue(`\u2713 wrote sitemap to ${colors6.bold(sitemapOutputPath)}`)
9743
10055
  );
9744
10056
  }
9745
10057
 
9746
10058
  // src/vite/prerender/utils.ts
9747
10059
  init_joinUrl();
9748
- var resolveRoutePath = (path40) => {
9749
- const segments = path40.split("/");
10060
+ var resolveRoutePath = (path41) => {
10061
+ const segments = path41.split("/");
9750
10062
  if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
9751
10063
  return void 0;
9752
10064
  }
9753
10065
  return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
9754
10066
  };
9755
- var isSkipped = (path40) => path40.includes("*") || /^\d+$/.test(path40);
10067
+ var isSkipped = (path41) => path41.includes("*") || /^\d+$/.test(path41);
9756
10068
  var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
9757
10069
  if (route.path && isSkipped(route.path)) return [];
9758
10070
  const routePath = route.path ? resolveRoutePath(route.path) : void 0;
@@ -9801,12 +10113,12 @@ var prerender = async ({
9801
10113
  serverConfigFilename,
9802
10114
  writeRedirects = true
9803
10115
  }) => {
9804
- const distDir = path28.join(dir, "dist", basePath);
10116
+ const distDir = path29.join(dir, "dist", basePath);
9805
10117
  const serverConfigPath = pathToFileURL(
9806
- path28.join(distDir, "server", serverConfigFilename)
10118
+ path29.join(distDir, "server", serverConfigFilename)
9807
10119
  ).href;
9808
10120
  const entryServerPath = pathToFileURL(
9809
- path28.join(distDir, "server/entry.server.js")
10121
+ path29.join(distDir, "server/entry.server.js")
9810
10122
  ).href;
9811
10123
  const rawConfig = await import(serverConfigPath).then(
9812
10124
  (m) => m.default
@@ -9831,12 +10143,12 @@ var prerender = async ({
9831
10143
  const writeProgress = throttle(
9832
10144
  (count, total, urlPath) => {
9833
10145
  if (quietDeployJson) return;
9834
- writeLine(`prerendering (${count}/${total}) ${colors7.dim(urlPath)}`);
10146
+ writeLine(`prerendering (${count}/${total}) ${colors8.dim(urlPath)}`);
9835
10147
  }
9836
10148
  );
9837
10149
  if (!isTTY() && !quietDeployJson) {
9838
10150
  logger.info(
9839
- colors7.dim(
10151
+ colors8.dim(
9840
10152
  `prerendering ${paths.length} routes using ${maxThreads} workers...`
9841
10153
  )
9842
10154
  );
@@ -9880,7 +10192,7 @@ var prerender = async ({
9880
10192
  const now = performance.now();
9881
10193
  if (now - lastLogTime >= LOG_INTERVAL_MS) {
9882
10194
  logger.info(
9883
- colors7.blue(
10195
+ colors8.blue(
9884
10196
  `prerendered ${completedCount}/${paths.length} routes using ${maxThreads} workers`
9885
10197
  )
9886
10198
  );
@@ -9891,20 +10203,20 @@ var prerender = async ({
9891
10203
  })
9892
10204
  );
9893
10205
  const pagefindWriteResult = await pagefindIndex?.writeFiles({
9894
- outputPath: path28.join(distDir, "pagefind")
10206
+ outputPath: path29.join(distDir, "pagefind")
9895
10207
  });
9896
10208
  const seconds = ((performance.now() - start) / 1e3).toFixed(1);
9897
10209
  const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
9898
10210
  if (!quietDeployJson) {
9899
10211
  if (isTTY()) {
9900
- writeLine(colors7.blue(`${message}
10212
+ writeLine(colors8.blue(`${message}
9901
10213
  `));
9902
10214
  } else {
9903
- logger.info(colors7.blue(message));
10215
+ logger.info(colors8.blue(message));
9904
10216
  }
9905
10217
  if (pagefindWriteResult?.outputPath) {
9906
10218
  logger.info(
9907
- colors7.blue(
10219
+ colors8.blue(
9908
10220
  `\u2713 pagefind index built: ${pagefindWriteResult.outputPath}`
9909
10221
  )
9910
10222
  );
@@ -9923,7 +10235,7 @@ var prerender = async ({
9923
10235
  const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
9924
10236
  const docsConfig = DocsConfigSchema2.parse(config2.docs);
9925
10237
  const llmsConfig = docsConfig.llms ?? {};
9926
- const markdownInfoPath = path28.join(
10238
+ const markdownInfoPath = path29.join(
9927
10239
  dir,
9928
10240
  "node_modules/.apitogo/markdown-info.json"
9929
10241
  );
@@ -10014,7 +10326,7 @@ async function runBuild(options) {
10014
10326
  html,
10015
10327
  basePath: config2.basePath
10016
10328
  });
10017
- await rm2(path29.join(clientOutDir, "index.html"), { force: true });
10329
+ await rm2(path30.join(clientOutDir, "index.html"), { force: true });
10018
10330
  } else {
10019
10331
  await runPrerender({
10020
10332
  dir,
@@ -10038,7 +10350,7 @@ var runPrerender = async (options) => {
10038
10350
  serverConfigFilename,
10039
10351
  writeRedirects: process.env.VERCEL === void 0
10040
10352
  });
10041
- const indexHtml = path29.join(clientOutDir, "index.html");
10353
+ const indexHtml = path30.join(clientOutDir, "index.html");
10042
10354
  if (!workerResults.find((r) => r.outputPath === indexHtml)) {
10043
10355
  await writeFile5(indexHtml, html, "utf-8");
10044
10356
  }
@@ -10048,15 +10360,15 @@ var runPrerender = async (options) => {
10048
10360
  for (const statusPage of statusPages) {
10049
10361
  await rename(
10050
10362
  statusPage,
10051
- path29.join(dir, DIST_DIR, path29.basename(statusPage))
10363
+ path30.join(dir, DIST_DIR, path30.basename(statusPage))
10052
10364
  );
10053
10365
  }
10054
10366
  await rm2(serverOutDir, { recursive: true, force: true });
10055
10367
  if (process.env.VERCEL) {
10056
- await mkdir5(path29.join(dir, ".vercel/output/static"), { recursive: true });
10368
+ await mkdir5(path30.join(dir, ".vercel/output/static"), { recursive: true });
10057
10369
  await rename(
10058
- path29.join(dir, DIST_DIR),
10059
- path29.join(dir, ".vercel/output/static")
10370
+ path30.join(dir, DIST_DIR),
10371
+ path30.join(dir, ".vercel/output/static")
10060
10372
  );
10061
10373
  }
10062
10374
  await writeOutput(dir, {
@@ -10066,7 +10378,7 @@ var runPrerender = async (options) => {
10066
10378
  });
10067
10379
  if (ZuploEnv.isZuplo && issuer) {
10068
10380
  await writeFile5(
10069
- path29.join(dir, DIST_DIR, ".output/zuplo.json"),
10381
+ path30.join(dir, DIST_DIR, ".output/zuplo.json"),
10070
10382
  JSON.stringify({ issuer }, null, 2),
10071
10383
  "utf-8"
10072
10384
  );
@@ -10078,10 +10390,10 @@ var runPrerender = async (options) => {
10078
10390
  };
10079
10391
  var bundleSSREntry = async (options) => {
10080
10392
  const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
10081
- const tempEntryPath = path29.join(dir, "__ssr-entry.ts");
10393
+ const tempEntryPath = path30.join(dir, "__ssr-entry.ts");
10082
10394
  const packageRoot = getZudokuRootDir();
10083
10395
  const templateContent = await readFile3(
10084
- path29.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
10396
+ path30.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
10085
10397
  "utf-8"
10086
10398
  );
10087
10399
  const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
@@ -10096,9 +10408,9 @@ var bundleSSREntry = async (options) => {
10096
10408
  platform: adapter === "node" ? "node" : "neutral",
10097
10409
  target: "es2022",
10098
10410
  format: "esm",
10099
- outfile: path29.join(serverOutDir, "entry.js"),
10411
+ outfile: path30.join(serverOutDir, "entry.js"),
10100
10412
  external: ["./entry.server.js", `./${serverConfigFilename}`],
10101
- nodePaths: [path29.join(packageRoot, "node_modules")],
10413
+ nodePaths: [path30.join(packageRoot, "node_modules")],
10102
10414
  banner: { js: "// Bundled SSR entry" }
10103
10415
  });
10104
10416
  } finally {
@@ -10108,56 +10420,14 @@ var bundleSSREntry = async (options) => {
10108
10420
 
10109
10421
  // src/cli/build/handler.ts
10110
10422
  init_logger();
10111
-
10112
- // src/cli/common/output.ts
10113
- import * as Sentry from "@sentry/node";
10114
- import colors8 from "picocolors";
10115
-
10116
- // src/cli/common/constants.ts
10117
- var CLI_XDG_FOLDER_NAME = "apitogo";
10118
- var VERSION_CHECK_FILE = "version.json";
10119
- var SENTRY_DSN = void 0;
10120
- var MAX_WAIT_PENDING_TIME_MS = 1e3;
10121
- var POST_HOG_CAPTURE_KEY = void 0;
10122
- var DEPLOY_SERVER_API_KEY = "qRVLTP22TFStdN6";
10123
-
10124
- // src/cli/common/output.ts
10125
- function printDiagnosticsToConsole(message) {
10126
- console.error(colors8.bold(colors8.blue(message)));
10127
- }
10128
- function printWarningToConsole(message) {
10129
- console.error(message);
10130
- }
10131
- async function printCriticalFailureToConsoleAndExit(message) {
10132
- console.error(colors8.bold(colors8.red(message)));
10133
- await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
10134
- process.exit(1);
10135
- });
10136
- }
10137
- function printJsonOnlyErrorAndExit(message) {
10138
- console.log(JSON.stringify({ error: message }));
10139
- process.exit(1);
10140
- }
10141
- function printResultToConsole(message) {
10142
- console.log(colors8.bold(colors8.green(message)));
10143
- }
10144
- function textOrJson(text) {
10145
- try {
10146
- return JSON.parse(text);
10147
- } catch {
10148
- return text;
10149
- }
10150
- }
10151
-
10152
- // src/cli/build/handler.ts
10153
10423
  init_package_json();
10154
10424
 
10155
10425
  // src/cli/preview/handler.ts
10156
- import path30 from "node:path";
10426
+ import path31 from "node:path";
10157
10427
  import { preview as vitePreview } from "vite";
10158
10428
  var DEFAULT_PREVIEW_PORT = 4e3;
10159
10429
  async function preview(argv) {
10160
- const dir = path30.resolve(process.cwd(), argv.dir);
10430
+ const dir = path31.resolve(process.cwd(), argv.dir);
10161
10431
  const viteConfig = await getViteConfig(dir, {
10162
10432
  command: "serve",
10163
10433
  mode: "production",
@@ -10198,7 +10468,7 @@ async function build(argv) {
10198
10468
  printDiagnosticsToConsole("");
10199
10469
  printDiagnosticsToConsole("");
10200
10470
  }
10201
- const dir = path31.resolve(process.cwd(), argv.dir);
10471
+ const dir = path32.resolve(process.cwd(), argv.dir);
10202
10472
  try {
10203
10473
  await runBuild({
10204
10474
  dir,
@@ -10223,104 +10493,6 @@ async function build(argv) {
10223
10493
  }
10224
10494
  }
10225
10495
 
10226
- // src/cli/common/analytics/lib.ts
10227
- import { PostHog } from "posthog-node";
10228
-
10229
- // src/cli/common/machine-id/lib.ts
10230
- import { execSync } from "node:child_process";
10231
- import { createHash } from "node:crypto";
10232
- var win32RegBinPath = {
10233
- skipped: "",
10234
- native: "%windir%\\System32",
10235
- mixed: "%windir%\\sysnative\\cmd.exe /c %windir%\\System32"
10236
- };
10237
- var guid = {
10238
- darwin: "ioreg -rd1 -c IOPlatformExpertDevice",
10239
- win32: `${win32RegBinPath[isWindowsProcessMixedOrNativeArchitecture()]}\\REG.exe QUERY HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid`,
10240
- linux: "( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :"
10241
- };
10242
- function isWindowsProcessMixedOrNativeArchitecture() {
10243
- if (process.platform !== "win32") {
10244
- return "skipped";
10245
- }
10246
- if (process.arch === "ia32" && process.env.PROCESSOR_ARCHITEW6432) {
10247
- return "mixed";
10248
- }
10249
- return "native";
10250
- }
10251
- function hash(guid2) {
10252
- return createHash("sha256").update(guid2).digest("hex");
10253
- }
10254
- function expose(result) {
10255
- switch (process.platform) {
10256
- case "darwin":
10257
- return result.split("IOPlatformUUID")[1].split("\n")[0].replace(/=|\s+]"/gi, "").toLowerCase();
10258
- case "win32":
10259
- return result.toString().split("REG_SZ")[1].replace(/\r+|\n+|\s+/gi, "").toLowerCase();
10260
- case "linux":
10261
- return result.toString().replace(/\r+|\n+|\s+/gi, "").toLowerCase();
10262
- case "freebsd":
10263
- return result.toString().replace(/\r+|\n+|\s+/gi, "").toLowerCase();
10264
- default:
10265
- throw new Error(`Unsupported platform: ${process.platform}`);
10266
- }
10267
- }
10268
- function machineId() {
10269
- switch (process.platform) {
10270
- case "darwin":
10271
- case "win32":
10272
- case "linux":
10273
- return hash(expose(execSync(guid[process.platform]).toString()));
10274
- default:
10275
- return "e16fc483-5593-4d71-b485-a6533693da9b";
10276
- }
10277
- }
10278
-
10279
- // src/cli/common/analytics/lib.ts
10280
- var _postHog;
10281
- function init() {
10282
- if (process.env.ZUDOKU_DO_NOT_TRACK || !POST_HOG_CAPTURE_KEY) {
10283
- return void 0;
10284
- }
10285
- _postHog = new PostHog(POST_HOG_CAPTURE_KEY, {
10286
- host: "https://app.posthog.com",
10287
- flushAt: 1,
10288
- flushInterval: 1
10289
- });
10290
- return _postHog;
10291
- }
10292
- async function captureEvent({
10293
- event,
10294
- properties,
10295
- groups,
10296
- sendFeatureFlags,
10297
- timestamp,
10298
- disableGeoip
10299
- }) {
10300
- if (_postHog === void 0) {
10301
- init();
10302
- }
10303
- if (_postHog) {
10304
- properties = properties ?? {};
10305
- properties.$set_once = properties.$set_once ?? {};
10306
- if (process.env.CI) {
10307
- properties.ci = process.env.CI;
10308
- }
10309
- _postHog.capture({
10310
- distinctId: machineId(),
10311
- event,
10312
- properties,
10313
- groups,
10314
- sendFeatureFlags,
10315
- timestamp,
10316
- disableGeoip
10317
- });
10318
- }
10319
- }
10320
- async function shutdownAnalytics() {
10321
- return _postHog?.shutdown();
10322
- }
10323
-
10324
10496
  // src/cli/cmds/build.ts
10325
10497
  var build_default = {
10326
10498
  desc: "Build",
@@ -10357,8 +10529,8 @@ var build_default = {
10357
10529
 
10358
10530
  // src/cli/configure-github-workflow/handler.ts
10359
10531
  import { constants } from "node:fs";
10360
- import { access, mkdir as mkdir6, writeFile as writeFile6 } from "node:fs/promises";
10361
- import path32 from "node:path";
10532
+ import { access as access2, mkdir as mkdir6, writeFile as writeFile6 } from "node:fs/promises";
10533
+ import path33 from "node:path";
10362
10534
  var APITOGO_DEPLOY_WORKFLOW_YAML = `name: Build and Deploy
10363
10535
 
10364
10536
  on:
@@ -10469,12 +10641,12 @@ jobs:
10469
10641
  run: apitogo deploy --deployment-token="$APITOGO_TOKEN" --json-only
10470
10642
  `;
10471
10643
  async function configureGithubWorkflow(argv) {
10472
- const dir = path32.resolve(process.cwd(), argv.dir);
10473
- const workflowDir = path32.join(dir, ".github", "workflows");
10474
- const workflowPath = path32.join(workflowDir, "apitogo-deploy.yml");
10644
+ const dir = path33.resolve(process.cwd(), argv.dir);
10645
+ const workflowDir = path33.join(dir, ".github", "workflows");
10646
+ const workflowPath = path33.join(workflowDir, "apitogo-deploy.yml");
10475
10647
  try {
10476
10648
  try {
10477
- await access(workflowPath, constants.F_OK);
10649
+ await access2(workflowPath, constants.F_OK);
10478
10650
  if (!argv.force) {
10479
10651
  await printCriticalFailureToConsoleAndExit(
10480
10652
  `Workflow file already exists: ${workflowPath}. Pass --force to overwrite.`
@@ -10543,15 +10715,15 @@ function applyJsonOnlyDeployQuietMode() {
10543
10715
  }
10544
10716
 
10545
10717
  // src/cli/deploy/handler.ts
10546
- import { access as access2, readFile as readFile4 } from "node:fs/promises";
10547
- import path33 from "node:path";
10718
+ import { access as access3, readFile as readFile4 } from "node:fs/promises";
10719
+ import path34 from "node:path";
10548
10720
  import { create as createTar } from "tar";
10549
10721
  var DEPLOY_ENDPOINT = "https://deploy-server-dotnet2-b3fkcaaraydbckfe.canadacentral-01.azurewebsites.net/deploy";
10550
10722
  var ARCHIVE_NAME = "dist.tgz";
10551
10723
  var createDeploymentArchive = async (dir) => {
10552
- const distDir = path33.join(dir, "dist");
10553
- await access2(distDir);
10554
- const archivePath = path33.join(dir, ARCHIVE_NAME);
10724
+ const distDir = path34.join(dir, "dist");
10725
+ await access3(distDir);
10726
+ const archivePath = path34.join(dir, ARCHIVE_NAME);
10555
10727
  await createTar(
10556
10728
  {
10557
10729
  cwd: dir,
@@ -10565,7 +10737,7 @@ var createDeploymentArchive = async (dir) => {
10565
10737
  };
10566
10738
  async function deploy(argv) {
10567
10739
  await build({ ...argv, preview: void 0 });
10568
- const dir = path33.resolve(process.cwd(), argv.dir);
10740
+ const dir = path34.resolve(process.cwd(), argv.dir);
10569
10741
  const deploymentToken = argv.deploymentToken?.trim() || process.env.npm_config_deployment_token?.trim();
10570
10742
  const env = argv.env?.trim() || process.env.npm_config_env?.trim() || "production";
10571
10743
  try {
@@ -10578,7 +10750,7 @@ async function deploy(argv) {
10578
10750
  const archivePath = await createDeploymentArchive(dir);
10579
10751
  if (!isJsonOnlyDeployEnv()) {
10580
10752
  printDiagnosticsToConsole(
10581
- `Uploading ${path33.basename(archivePath)} to ${env}...`
10753
+ `Uploading ${path34.basename(archivePath)} to ${env}...`
10582
10754
  );
10583
10755
  }
10584
10756
  const archiveBuffer = await readFile4(archivePath);
@@ -10586,7 +10758,7 @@ async function deploy(argv) {
10586
10758
  formData.append(
10587
10759
  "file",
10588
10760
  new Blob([archiveBuffer], { type: "application/gzip" }),
10589
- path33.basename(archivePath)
10761
+ path34.basename(archivePath)
10590
10762
  );
10591
10763
  formData.append("deploymentToken", deploymentToken);
10592
10764
  formData.append("env", env);
@@ -10671,14 +10843,14 @@ var deploy_default = {
10671
10843
 
10672
10844
  // src/cli/dev/handler.ts
10673
10845
  init_joinUrl();
10674
- import path36 from "node:path";
10846
+ import path37 from "node:path";
10675
10847
 
10676
10848
  // src/vite/dev-server.ts
10677
10849
  init_logger();
10678
10850
  import fs4 from "node:fs/promises";
10679
10851
  import http from "node:http";
10680
10852
  import https from "node:https";
10681
- import path35 from "node:path";
10853
+ import path36 from "node:path";
10682
10854
  import { createHttpTerminator } from "http-terminator";
10683
10855
  import {
10684
10856
  createServer as createViteServer,
@@ -10711,7 +10883,7 @@ init_loader();
10711
10883
  // src/vite/pagefind-dev-index.ts
10712
10884
  init_invariant();
10713
10885
  init_joinUrl();
10714
- import path34 from "node:path";
10886
+ import path35 from "node:path";
10715
10887
  import { createIndex as createIndex2 } from "pagefind";
10716
10888
  import { isRunnableDevEnvironment } from "vite";
10717
10889
  async function* buildPagefindDevIndex(vite, config2) {
@@ -10764,7 +10936,7 @@ async function* buildPagefindDevIndex(vite, config2) {
10764
10936
  path: urlPath
10765
10937
  };
10766
10938
  }
10767
- const outputPath = path34.join(vite.config.publicDir, "pagefind");
10939
+ const outputPath = path35.join(vite.config.publicDir, "pagefind");
10768
10940
  await pagefindIndex.writeFiles({ outputPath });
10769
10941
  yield { type: "complete", success: true, indexed };
10770
10942
  }
@@ -10783,9 +10955,9 @@ var DevServer = class {
10783
10955
  this.protocol = "https";
10784
10956
  const { dir } = this.options;
10785
10957
  const [key, cert, ca] = await Promise.all([
10786
- fs4.readFile(path35.resolve(dir, config2.https.key)),
10787
- fs4.readFile(path35.resolve(dir, config2.https.cert)),
10788
- config2.https.ca ? fs4.readFile(path35.resolve(dir, config2.https.ca)) : void 0
10958
+ fs4.readFile(path36.resolve(dir, config2.https.key)),
10959
+ fs4.readFile(path36.resolve(dir, config2.https.cert)),
10960
+ config2.https.ca ? fs4.readFile(path36.resolve(dir, config2.https.ca)) : void 0
10789
10961
  ]);
10790
10962
  return https.createServer({ key, cert, ca });
10791
10963
  }
@@ -10802,7 +10974,7 @@ var DevServer = class {
10802
10974
  );
10803
10975
  const server = await this.createNodeServer(config2);
10804
10976
  if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
10805
- const publicRoot = path35.resolve(
10977
+ const publicRoot = path36.resolve(
10806
10978
  this.options.dir,
10807
10979
  typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
10808
10980
  );
@@ -10819,7 +10991,7 @@ var DevServer = class {
10819
10991
  // built-in transform middleware which would treat the path as a static asset.
10820
10992
  name: "apitogo:entry-client",
10821
10993
  configureServer(server2) {
10822
- const entryPath = path35.posix.join(
10994
+ const entryPath = path36.posix.join(
10823
10995
  server2.config.base,
10824
10996
  "/__z/entry.client.tsx"
10825
10997
  );
@@ -10984,7 +11156,7 @@ init_package_json();
10984
11156
  async function dev(argv) {
10985
11157
  const packageJson2 = getZudokuPackageJson();
10986
11158
  process.env.NODE_ENV = "development";
10987
- const dir = path36.resolve(process.cwd(), argv.dir);
11159
+ const dir = path37.resolve(process.cwd(), argv.dir);
10988
11160
  const server = new DevServer({
10989
11161
  dir,
10990
11162
  argPort: argv.port,
@@ -11068,15 +11240,15 @@ var dev_default = {
11068
11240
 
11069
11241
  // src/cli/make-config/handler.ts
11070
11242
  import { constants as constants3 } from "node:fs";
11071
- import { access as access4, mkdir as mkdir7, readFile as readFile6, writeFile as writeFile8 } from "node:fs/promises";
11072
- import path38 from "node:path";
11243
+ import { access as access5, mkdir as mkdir7, readFile as readFile6, writeFile as writeFile8 } from "node:fs/promises";
11244
+ import path39 from "node:path";
11073
11245
  import { glob as glob5 } from "glob";
11074
11246
 
11075
11247
  // src/cli/make-config/scaffold-project.ts
11076
11248
  init_package_json();
11077
11249
  import { constants as constants2 } from "node:fs";
11078
- import { access as access3, readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
11079
- import path37 from "node:path";
11250
+ import { access as access4, readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
11251
+ import path38 from "node:path";
11080
11252
  import { glob as glob4 } from "glob";
11081
11253
  var OPENAPI_GLOBS = [
11082
11254
  "apis/openapi.json",
@@ -11136,9 +11308,9 @@ var findMatchingCurly = (source, startIndex) => {
11136
11308
  }
11137
11309
  throw new Error("Could not find matching closing brace for object.");
11138
11310
  };
11139
- var toPosix = (p) => p.split(path37.sep).join("/");
11311
+ var toPosix = (p) => p.split(path38.sep).join("/");
11140
11312
  var sanitizePackageName = (dir) => {
11141
- const base = path37.basename(path37.resolve(dir));
11313
+ const base = path38.basename(path38.resolve(dir));
11142
11314
  const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
11143
11315
  return s || "apitogo-site";
11144
11316
  };
@@ -11148,9 +11320,9 @@ var apitogoVersionRange = () => {
11148
11320
  };
11149
11321
  async function findOpenApiSpecPath(dir) {
11150
11322
  for (const rel of OPENAPI_GLOBS) {
11151
- const full = path37.join(dir, rel);
11323
+ const full = path38.join(dir, rel);
11152
11324
  try {
11153
- await access3(full, constants2.R_OK);
11325
+ await access4(full, constants2.R_OK);
11154
11326
  return toPosix(rel);
11155
11327
  } catch {
11156
11328
  }
@@ -11163,7 +11335,7 @@ async function findOpenApiSpecPath(dir) {
11163
11335
  return extra[0] ? toPosix(extra[0]) : null;
11164
11336
  }
11165
11337
  async function ensurePackageJson(dir) {
11166
- const pkgPath = path37.join(dir, "package.json");
11338
+ const pkgPath = path38.join(dir, "package.json");
11167
11339
  const apitogoVer = apitogoVersionRange();
11168
11340
  const baseDeps = {
11169
11341
  react: ">=19.0.0",
@@ -11176,7 +11348,7 @@ async function ensurePackageJson(dir) {
11176
11348
  preview: "apitogo preview"
11177
11349
  };
11178
11350
  try {
11179
- await access3(pkgPath, constants2.R_OK);
11351
+ await access4(pkgPath, constants2.R_OK);
11180
11352
  } catch (err) {
11181
11353
  const code = err.code;
11182
11354
  if (code !== "ENOENT") throw err;
@@ -11226,9 +11398,9 @@ async function ensurePackageJson(dir) {
11226
11398
  return false;
11227
11399
  }
11228
11400
  async function ensureTsconfigJson(dir) {
11229
- const tsPath = path37.join(dir, "tsconfig.json");
11401
+ const tsPath = path38.join(dir, "tsconfig.json");
11230
11402
  try {
11231
- await access3(tsPath, constants2.R_OK);
11403
+ await access4(tsPath, constants2.R_OK);
11232
11404
  return false;
11233
11405
  } catch {
11234
11406
  const tsconfig = {
@@ -11308,7 +11480,7 @@ var CONFIG_FILENAMES = [
11308
11480
  ];
11309
11481
  var DEFAULT_NEW_CONFIG_FILENAME = "apitogo.config.tsx";
11310
11482
  var createTreeNode = () => ({ docs: [], children: /* @__PURE__ */ new Map() });
11311
- var toPosixPath2 = (value) => value.split(path38.sep).join(path38.posix.sep);
11483
+ var toPosixPath2 = (value) => value.split(path39.sep).join(path39.posix.sep);
11312
11484
  var toRoutePath = (relativeFile, pagesDir) => {
11313
11485
  const relativeNoExt = relativeFile.replace(/\.mdx?$/, "");
11314
11486
  const withoutPagesPrefix = relativeNoExt.replace(
@@ -11553,24 +11725,24 @@ export default config;
11553
11725
  `;
11554
11726
  };
11555
11727
  var ensureApitogoDeployWorkflow = async (dir) => {
11556
- const workflowPath = path38.join(
11728
+ const workflowPath = path39.join(
11557
11729
  dir,
11558
11730
  ".github",
11559
11731
  "workflows",
11560
11732
  "apitogo-deploy.yml"
11561
11733
  );
11562
11734
  try {
11563
- await access4(workflowPath, constants3.F_OK);
11735
+ await access5(workflowPath, constants3.F_OK);
11564
11736
  return false;
11565
11737
  } catch {
11566
11738
  }
11567
- await mkdir7(path38.join(dir, ".github", "workflows"), { recursive: true });
11739
+ await mkdir7(path39.join(dir, ".github", "workflows"), { recursive: true });
11568
11740
  await writeFile8(workflowPath, APITOGO_DEPLOY_WORKFLOW_YAML, "utf8");
11569
11741
  return true;
11570
11742
  };
11571
11743
  var findExistingConfigPath = async (dir) => {
11572
11744
  for (const filename of CONFIG_FILENAMES) {
11573
- const fullPath = path38.join(dir, filename);
11745
+ const fullPath = path39.join(dir, filename);
11574
11746
  try {
11575
11747
  await readFile6(fullPath, "utf8");
11576
11748
  return fullPath;
@@ -11580,7 +11752,7 @@ var findExistingConfigPath = async (dir) => {
11580
11752
  return null;
11581
11753
  };
11582
11754
  async function makeConfig(argv) {
11583
- const dir = path38.resolve(process.cwd(), argv.dir);
11755
+ const dir = path39.resolve(process.cwd(), argv.dir);
11584
11756
  const pagesDir = toPosixPath2(
11585
11757
  argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
11586
11758
  );
@@ -11599,7 +11771,7 @@ async function makeConfig(argv) {
11599
11771
  let configPath = await findExistingConfigPath(dir);
11600
11772
  let createdNew = false;
11601
11773
  if (!configPath) {
11602
- configPath = path38.join(dir, DEFAULT_NEW_CONFIG_FILENAME);
11774
+ configPath = path39.join(dir, DEFAULT_NEW_CONFIG_FILENAME);
11603
11775
  await writeFile8(
11604
11776
  configPath,
11605
11777
  buildNewConfigContents(pagesDir, openApiSpecPath),
@@ -11640,7 +11812,7 @@ async function makeConfig(argv) {
11640
11812
  await writeFile8(configPath, withRedirects, "utf8");
11641
11813
  const action = createdNew ? "Initialized" : "Updated";
11642
11814
  printResultToConsole(
11643
- `${action} ${path38.basename(configPath)} from ${pagesDir}/ (navigation and redirects; other top-level settings preserved unless newly scaffolded).`
11815
+ `${action} ${path39.basename(configPath)} from ${pagesDir}/ (navigation and redirects; other top-level settings preserved unless newly scaffolded).`
11644
11816
  );
11645
11817
  const createdWorkflow = await ensureApitogoDeployWorkflow(dir);
11646
11818
  if (createdWorkflow) {
@@ -11833,12 +12005,12 @@ function box(message, {
11833
12005
 
11834
12006
  // src/cli/common/xdg/lib.ts
11835
12007
  import { homedir } from "node:os";
11836
- import path39 from "node:path";
12008
+ import path40 from "node:path";
11837
12009
  function defineDirectoryWithFallback(xdgName, fallback) {
11838
12010
  if (process.env[xdgName]) {
11839
12011
  return process.env[xdgName];
11840
12012
  } else {
11841
- return path39.join(homedir(), fallback);
12013
+ return path40.join(homedir(), fallback);
11842
12014
  }
11843
12015
  }
11844
12016
  var XDG_CONFIG_HOME = defineDirectoryWithFallback(
@@ -11853,15 +12025,15 @@ var XDG_STATE_HOME = defineDirectoryWithFallback(
11853
12025
  "XDG_DATA_HOME",
11854
12026
  ".local/state"
11855
12027
  );
11856
- var ZUDOKU_XDG_CONFIG_HOME = path39.join(
12028
+ var ZUDOKU_XDG_CONFIG_HOME = path40.join(
11857
12029
  XDG_CONFIG_HOME,
11858
12030
  CLI_XDG_FOLDER_NAME
11859
12031
  );
11860
- var ZUDOKU_XDG_DATA_HOME = path39.join(
12032
+ var ZUDOKU_XDG_DATA_HOME = path40.join(
11861
12033
  XDG_DATA_HOME,
11862
12034
  CLI_XDG_FOLDER_NAME
11863
12035
  );
11864
- var ZUDOKU_XDG_STATE_HOME = path39.join(
12036
+ var ZUDOKU_XDG_STATE_HOME = path40.join(
11865
12037
  XDG_STATE_HOME,
11866
12038
  CLI_XDG_FOLDER_NAME
11867
12039
  );
@@ -12025,7 +12197,7 @@ var cli = yargs(hideBin(process.argv)).option("zuplo", {
12025
12197
  process.env.ZUPLO = "1";
12026
12198
  printDiagnosticsToConsole("Running in Zuplo mode");
12027
12199
  }
12028
- }).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();
12200
+ }).middleware(warnPackageVersionMismatch).command(apply_default).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();
12029
12201
  try {
12030
12202
  void warnIfOutdatedVersion(packageJson?.version);
12031
12203
  await cli.argv;