zudoku 0.82.2 → 0.82.4

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 (39) hide show
  1. package/dist/cli/cli.js +283 -225
  2. package/dist/cli/worker.js +23 -0
  3. package/dist/declarations/app/wrapProtectedRoutes.d.ts +5 -0
  4. package/dist/declarations/config/config.d.ts +3 -0
  5. package/dist/declarations/config/plugin-versions.d.ts +5 -0
  6. package/dist/declarations/config/validators/ZudokuConfig.d.ts +38 -0
  7. package/dist/declarations/lib/authentication/providers/entra.d.ts +13 -0
  8. package/dist/declarations/lib/authentication/providers/openid.d.ts +4 -1
  9. package/dist/declarations/lib/authentication/providers/util.d.ts +4 -0
  10. package/dist/declarations/lib/plugins/openapi/McpClientLogos.d.ts +4 -0
  11. package/dist/declarations/lib/plugins/openapi/mcp-configs.d.ts +3 -0
  12. package/dist/declarations/vite/package-root.d.ts +1 -0
  13. package/dist/flat-config.d.ts +17 -0
  14. package/docs/components/landing-page.mdx +1 -1
  15. package/docs/configuration/authentication-azure-ad.md +17 -15
  16. package/docs/configuration/authentication.md +22 -2
  17. package/docs/guides/mcp-servers.md +26 -0
  18. package/package.json +21 -17
  19. package/src/app/entry.server.tsx +9 -5
  20. package/src/app/wrapProtectedRoutes.ts +25 -0
  21. package/src/config/config.ts +4 -0
  22. package/src/config/loader.ts +15 -0
  23. package/src/config/plugin-versions.ts +38 -0
  24. package/src/config/validators/ZudokuConfig.ts +19 -0
  25. package/src/lib/auth/issuer.ts +7 -1
  26. package/src/lib/authentication/providers/entra.tsx +97 -0
  27. package/src/lib/authentication/providers/openid.tsx +29 -13
  28. package/src/lib/authentication/providers/util.ts +7 -0
  29. package/src/lib/components/navigation/NavigationCategory.tsx +3 -2
  30. package/src/lib/components/navigation/StackRows.tsx +1 -1
  31. package/src/lib/plugins/openapi/MCPEndpoint.tsx +347 -228
  32. package/src/lib/plugins/openapi/McpClientLogos.tsx +72 -0
  33. package/src/lib/plugins/openapi/mcp-configs.ts +55 -0
  34. package/src/vite/api/SchemaManager.ts +11 -25
  35. package/src/vite/plugin-mdx.ts +3 -0
  36. package/src/vite/prerender/prerender.ts +28 -3
  37. package/src/vite/prerender/utils.ts +33 -0
  38. package/src/vite/prerender/worker.ts +8 -1
  39. package/src/zuplo/enrich-with-zuplo-mcp.ts +14 -2
package/dist/cli/cli.js CHANGED
@@ -59,7 +59,7 @@ __export(llms_exports, {
59
59
  generateLlmsTxtFiles: () => generateLlmsTxtFiles
60
60
  });
61
61
  import { writeFile as writeFile5 } from "node:fs/promises";
62
- import path20 from "node:path";
62
+ import path21 from "node:path";
63
63
  import colors6 from "picocolors";
64
64
  async function generateLlmsTxtFiles({
65
65
  markdownFileInfos,
@@ -94,7 +94,7 @@ async function generateLlmsTxtFiles({
94
94
  }
95
95
  }
96
96
  const llmsTxt2 = llmsTxtParts.join("\n");
97
- await writeFile5(path20.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
97
+ await writeFile5(path21.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
98
98
  console.log(colors6.blue("\u2713 generated llms.txt"));
99
99
  }
100
100
  if (llmsTxtFull) {
@@ -120,7 +120,7 @@ ${info.content}
120
120
  }
121
121
  const llmsFull = llmsFullParts.join("\n");
122
122
  await writeFile5(
123
- path20.join(baseOutputDir, "llms-full.txt"),
123
+ path21.join(baseOutputDir, "llms-full.txt"),
124
124
  llmsFull,
125
125
  "utf-8"
126
126
  );
@@ -134,17 +134,16 @@ var init_llms = __esm({
134
134
  });
135
135
 
136
136
  // src/cli/cli.ts
137
- import * as Sentry2 from "@sentry/node";
138
137
  import { hideBin } from "yargs/helpers";
139
138
  import yargs from "yargs/yargs";
140
139
 
141
140
  // src/cli/build/handler.ts
142
- import path25 from "node:path";
141
+ import path26 from "node:path";
143
142
 
144
143
  // src/vite/build.ts
145
144
  import { existsSync as existsSync2 } from "node:fs";
146
- import { mkdir as mkdir6, readFile as readFile4, rename as rename2, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
147
- import path23 from "node:path";
145
+ import { mkdir as mkdir6, readFile as readFile5, rename as rename2, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
146
+ import path24 from "node:path";
148
147
  import { build as esbuild } from "esbuild";
149
148
  import { createBuilder } from "vite";
150
149
 
@@ -230,7 +229,7 @@ var getZudokuRootDir = () => path.dirname(getPackageJsonPath("zudoku"));
230
229
 
231
230
  // src/config/loader.ts
232
231
  import { stat as stat2 } from "node:fs/promises";
233
- import path3 from "node:path";
232
+ import path5 from "node:path";
234
233
  import colors2 from "picocolors";
235
234
  import {
236
235
  runnerImport,
@@ -321,7 +320,47 @@ var ZudokuError = class extends Error {
321
320
 
322
321
  // src/config/file-exists.ts
323
322
  import { stat } from "node:fs/promises";
324
- var fileExists = (path30) => stat(path30).then(() => true).catch(() => false);
323
+ var fileExists = (path31) => stat(path31).then(() => true).catch(() => false);
324
+
325
+ // src/config/plugin-versions.ts
326
+ import { readFile } from "node:fs/promises";
327
+ import path3 from "node:path";
328
+
329
+ // src/vite/package-root.ts
330
+ import path2 from "node:path";
331
+ var findPackageRoot = async (startDir) => {
332
+ let dir = startDir;
333
+ while (dir !== path2.dirname(dir)) {
334
+ if (await fileExists(path2.join(dir, "package.json"))) return dir;
335
+ dir = path2.dirname(dir);
336
+ }
337
+ };
338
+
339
+ // src/config/plugin-versions.ts
340
+ var getPluginVersions = async (pluginDirs) => {
341
+ const roots = await Promise.all(
342
+ [...new Set(pluginDirs)].map(findPackageRoot)
343
+ );
344
+ const resolved = await Promise.all(
345
+ roots.map(async (root) => {
346
+ if (!root) return void 0;
347
+ try {
348
+ const pkg = JSON.parse(
349
+ await readFile(path3.join(root, "package.json"), "utf-8")
350
+ );
351
+ if (!pkg.name) return void 0;
352
+ return { name: pkg.name, version: pkg.version ?? "unknown" };
353
+ } catch {
354
+ return void 0;
355
+ }
356
+ })
357
+ );
358
+ const byName = /* @__PURE__ */ new Map();
359
+ for (const version of resolved) {
360
+ if (version && !byName.has(version.name)) byName.set(version.name, version);
361
+ }
362
+ return [...byName.values()];
363
+ };
325
364
 
326
365
  // src/config/validators/ZudokuConfig.ts
327
366
  import colors from "picocolors";
@@ -329,7 +368,7 @@ import { isValidElement as isValidElement2 } from "react";
329
368
  import { z as z7 } from "zod";
330
369
 
331
370
  // src/vite/plugin-theme.ts
332
- import path2 from "node:path";
371
+ import path4 from "node:path";
333
372
  import { normalizeTheme } from "shiki";
334
373
 
335
374
  // src/lib/shiki.ts
@@ -782,7 +821,7 @@ ${rootVars.join("\n")}
782
821
  config.__meta.rootDir,
783
822
  ...config.__meta.dependencies,
784
823
  ...config.__pluginDirs ?? []
785
- ].map((file) => path2.relative(path2.dirname(id), file))
824
+ ].map((file) => path4.relative(path4.dirname(id), file))
786
825
  );
787
826
  const code = [...files].map((file) => `@source "${file}";`);
788
827
  code.push("@theme inline {");
@@ -2990,8 +3029,8 @@ import { createNanoEvents } from "nanoevents";
2990
3029
 
2991
3030
  // src/lib/util/url.ts
2992
3031
  import { matchPath } from "react-router";
2993
- var matchesProtectedPattern = (pattern, path30) => matchPath({ path: pattern, end: true }, path30) != null;
2994
- var matchesAnyProtectedPattern = (patterns, path30) => patterns.some((p) => matchesProtectedPattern(p, path30));
3032
+ var matchesProtectedPattern = (pattern, path31) => matchPath({ path: pattern, end: true }, path31) != null;
3033
+ var matchesAnyProtectedPattern = (patterns, path31) => patterns.some((p) => matchesProtectedPattern(p, path31));
2995
3034
 
2996
3035
  // src/lib/core/ZudokuContext.ts
2997
3036
  var normalizeProtectedRoutes = (val) => {
@@ -3344,6 +3383,25 @@ var AuthenticationSchema = z7.discriminatedUnion("type", [
3344
3383
  authorizationParams: z7.record(z7.string(), z7.string()).optional(),
3345
3384
  forwardAuthorizationParams: z7.array(z7.string()).optional()
3346
3385
  }),
3386
+ z7.object({
3387
+ type: z7.literal("entra"),
3388
+ basePath: z7.string().optional(),
3389
+ clientId: z7.string(),
3390
+ // Tenant id or one of Entra's multi-tenant authorities
3391
+ // (common/organizations/consumers). Defaults to "common".
3392
+ tenantId: z7.string().optional(),
3393
+ // Full issuer override, e.g. for CIAM tenants on *.ciamlogin.com.
3394
+ issuer: z7.string().optional(),
3395
+ audience: z7.string().optional(),
3396
+ scopes: z7.array(z7.string()).optional(),
3397
+ redirectToAfterSignUp: z7.string().optional(),
3398
+ redirectToAfterSignIn: z7.string().optional(),
3399
+ redirectToAfterSignOut: z7.string().optional(),
3400
+ signUp: SignUpOpenIdSchema.optional(),
3401
+ disableSignUp: z7.boolean().optional(),
3402
+ authorizationParams: z7.record(z7.string(), z7.string()).optional(),
3403
+ forwardAuthorizationParams: z7.array(z7.string()).optional()
3404
+ }),
3347
3405
  z7.object({
3348
3406
  type: z7.literal("azureb2c"),
3349
3407
  basePath: z7.string().optional(),
@@ -3635,7 +3693,7 @@ var zudokuConfigFiles = [
3635
3693
  ];
3636
3694
  async function getConfigFilePath(rootDir) {
3637
3695
  for (const fileName of zudokuConfigFiles) {
3638
- const filepath = path3.join(rootDir, fileName);
3696
+ const filepath = path5.join(rootDir, fileName);
3639
3697
  if (await fileExists(filepath)) {
3640
3698
  return filepath;
3641
3699
  }
@@ -3771,6 +3829,15 @@ async function loadZudokuConfig(configEnv, rootDir) {
3771
3829
  colors2.cyan(`loaded config file `) + colors2.dim(config.__meta.configPath),
3772
3830
  { timestamp: true }
3773
3831
  );
3832
+ const pluginVersions = await getPluginVersions(config.__pluginDirs ?? []);
3833
+ if (pluginVersions.length > 0) {
3834
+ logger.info(
3835
+ colors2.cyan(`loaded plugins `) + colors2.dim(
3836
+ pluginVersions.map((p) => `${p.name}@${p.version}`).join(", ")
3837
+ ),
3838
+ { timestamp: true }
3839
+ );
3840
+ }
3774
3841
  return { config, envPrefix, publicEnv };
3775
3842
  } catch (error) {
3776
3843
  const lastValid = getConfig();
@@ -3791,6 +3858,7 @@ async function loadZudokuConfig(configEnv, rootDir) {
3791
3858
  }
3792
3859
 
3793
3860
  // src/lib/authentication/providers/util.ts
3861
+ var getEntraIssuer = (config) => config.issuer ?? `https://login.microsoftonline.com/${config.tenantId ?? "common"}/v2.0`;
3794
3862
  var getClerkFrontendApi = (publishableKey) => {
3795
3863
  const parts = publishableKey.split("_");
3796
3864
  if (parts.length !== 3 || !parts[2]) {
@@ -3824,6 +3892,9 @@ var getIssuer = async (config) => {
3824
3892
  case "openid": {
3825
3893
  return config.authentication.issuer;
3826
3894
  }
3895
+ case "entra": {
3896
+ return getEntraIssuer(config.authentication);
3897
+ }
3827
3898
  case "supabase": {
3828
3899
  return config.authentication.supabaseUrl;
3829
3900
  }
@@ -3846,7 +3917,7 @@ var getIssuer = async (config) => {
3846
3917
  init_joinUrl();
3847
3918
 
3848
3919
  // src/vite/config.ts
3849
- import path16 from "node:path";
3920
+ import path17 from "node:path";
3850
3921
  import dotenv from "dotenv";
3851
3922
  import colors4 from "picocolors";
3852
3923
  import {
@@ -3894,22 +3965,12 @@ var buildManifest = (config) => {
3894
3965
  // src/vite/config.ts
3895
3966
  init_joinUrl();
3896
3967
 
3897
- // src/vite/package-root.ts
3898
- import path4 from "node:path";
3899
- var findPackageRoot = async (startDir) => {
3900
- let dir = startDir;
3901
- while (dir !== path4.dirname(dir)) {
3902
- if (await fileExists(path4.join(dir, "package.json"))) return dir;
3903
- dir = path4.dirname(dir);
3904
- }
3905
- };
3906
-
3907
3968
  // src/vite/plugin.ts
3908
3969
  import tailwindcss from "@tailwindcss/vite";
3909
3970
  import react from "@vitejs/plugin-react";
3910
3971
 
3911
3972
  // src/vite/css/plugin.ts
3912
- import path5 from "node:path";
3973
+ import path6 from "node:path";
3913
3974
  import { isCSSRequest as isCSSRequest2 } from "vite";
3914
3975
 
3915
3976
  // src/vite/css/collect.ts
@@ -3944,7 +4005,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
3944
4005
  function vitePluginSsrCss(pluginOpts) {
3945
4006
  let server;
3946
4007
  const config = getCurrentConfig();
3947
- const virtualHref = path5.join(
4008
+ const virtualHref = path6.join(
3948
4009
  config.basePath ?? "",
3949
4010
  `/@id/__x00__${VIRTUAL_ENTRY}?direct`
3950
4011
  );
@@ -4076,12 +4137,12 @@ var plugin_api_keys_default = viteApiKeysPlugin;
4076
4137
 
4077
4138
  // src/vite/plugin-api.ts
4078
4139
  import fs2 from "node:fs/promises";
4079
- import path11 from "node:path";
4140
+ import path12 from "node:path";
4080
4141
  import { deepEqual as deepEqual2 } from "fast-equals";
4081
4142
  import { runnerImport as runnerImport3 } from "vite";
4082
4143
 
4083
4144
  // src/config/validators/BuildSchema.ts
4084
- import path6 from "node:path";
4145
+ import path7 from "node:path";
4085
4146
  import { runnerImport as runnerImport2 } from "vite";
4086
4147
  import { z as z8 } from "zod";
4087
4148
  var BuildProcessorSchema = z8.custom((val) => typeof val === "function");
@@ -4105,7 +4166,7 @@ var zudokuBuildConfigFiles = [
4105
4166
  ];
4106
4167
  async function getBuildConfigFilePath(rootDir) {
4107
4168
  for (const fileName of zudokuBuildConfigFiles) {
4108
- const filepath = path6.join(rootDir, fileName);
4169
+ const filepath = path7.join(rootDir, fileName);
4109
4170
  if (await fileExists(filepath)) {
4110
4171
  return filepath;
4111
4172
  }
@@ -4227,14 +4288,14 @@ var flattenAllOf = (schema2) => {
4227
4288
  };
4228
4289
 
4229
4290
  // src/lib/util/traverse.ts
4230
- var traverse = (specification, transform, path30 = []) => {
4231
- const transformed = transform(specification, path30);
4291
+ var traverse = (specification, transform, path31 = []) => {
4292
+ const transformed = transform(specification, path31);
4232
4293
  if (typeof transformed !== "object" || transformed === null) {
4233
4294
  return transformed;
4234
4295
  }
4235
4296
  const result = Array.isArray(transformed) ? [] : {};
4236
4297
  for (const [key, value] of Object.entries(transformed)) {
4237
- const currentPath = [...path30, key];
4298
+ const currentPath = [...path31, key];
4238
4299
  if (Array.isArray(value)) {
4239
4300
  result[key] = value.map(
4240
4301
  (item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
@@ -4262,9 +4323,9 @@ var resolveLocalRef = (schema2, ref) => {
4262
4323
  if (schemaCache?.has(ref)) {
4263
4324
  return schemaCache.get(ref);
4264
4325
  }
4265
- const path30 = ref.split("/").slice(1);
4326
+ const path31 = ref.split("/").slice(1);
4266
4327
  let current = schema2;
4267
- for (const segment of path30) {
4328
+ for (const segment of path31) {
4268
4329
  if (!current || typeof current !== "object") {
4269
4330
  current = null;
4270
4331
  }
@@ -4283,7 +4344,7 @@ var dereference = async (schema2, resolvers = []) => {
4283
4344
  }
4284
4345
  const cloned = structuredClone(schema2);
4285
4346
  const visited = /* @__PURE__ */ new Set();
4286
- const resolve = async (current, path30) => {
4347
+ const resolve = async (current, path31) => {
4287
4348
  if (isIndexableObject(current)) {
4288
4349
  if (visited.has(current)) {
4289
4350
  return CIRCULAR_REF;
@@ -4291,7 +4352,7 @@ var dereference = async (schema2, resolvers = []) => {
4291
4352
  visited.add(current);
4292
4353
  if (Array.isArray(current)) {
4293
4354
  for (let index = 0; index < current.length; index++) {
4294
- current[index] = await resolve(current[index], `${path30}/${index}`);
4355
+ current[index] = await resolve(current[index], `${path31}/${index}`);
4295
4356
  }
4296
4357
  } else {
4297
4358
  if ("$ref" in current && typeof current.$ref === "string") {
@@ -4302,13 +4363,13 @@ var dereference = async (schema2, resolvers = []) => {
4302
4363
  for (const resolver of resolvers) {
4303
4364
  const resolved = await resolver($ref);
4304
4365
  if (resolved) {
4305
- result2 = await resolve(resolved, path30);
4366
+ result2 = await resolve(resolved, path31);
4306
4367
  break;
4307
4368
  }
4308
4369
  }
4309
4370
  if (result2 === void 0) {
4310
4371
  const resolved = await resolveLocalRef(cloned, $ref);
4311
- result2 = await resolve(resolved, path30);
4372
+ result2 = await resolve(resolved, path31);
4312
4373
  }
4313
4374
  if (hasSiblings) {
4314
4375
  if (result2 === CIRCULAR_REF) {
@@ -4321,7 +4382,7 @@ var dereference = async (schema2, resolvers = []) => {
4321
4382
  return result2;
4322
4383
  }
4323
4384
  for (const key in current) {
4324
- current[key] = await resolve(current[key], `${path30}/${key}`);
4385
+ current[key] = await resolve(current[key], `${path31}/${key}`);
4325
4386
  }
4326
4387
  }
4327
4388
  visited.delete(current);
@@ -4360,9 +4421,9 @@ var upgradeSchema = (schema2) => {
4360
4421
  }
4361
4422
  return sub;
4362
4423
  });
4363
- schema2 = traverse(schema2, (sub, path30) => {
4424
+ schema2 = traverse(schema2, (sub, path31) => {
4364
4425
  if (sub.example !== void 0) {
4365
- if (isSchemaPath(path30 ?? [])) {
4426
+ if (isSchemaPath(path31 ?? [])) {
4366
4427
  sub.examples = [sub.example];
4367
4428
  } else {
4368
4429
  sub.examples = {
@@ -4375,11 +4436,11 @@ var upgradeSchema = (schema2) => {
4375
4436
  }
4376
4437
  return sub;
4377
4438
  });
4378
- schema2 = traverse(schema2, (schema3, path30) => {
4439
+ schema2 = traverse(schema2, (schema3, path31) => {
4379
4440
  if (schema3.type === "object" && schema3.properties !== void 0) {
4380
- const parentPath = path30?.slice(0, -1);
4441
+ const parentPath = path31?.slice(0, -1);
4381
4442
  const isMultipart = parentPath?.some((segment, index) => {
4382
- return segment === "content" && path30?.[index + 1] === "multipart/form-data";
4443
+ return segment === "content" && path31?.[index + 1] === "multipart/form-data";
4383
4444
  });
4384
4445
  if (isMultipart) {
4385
4446
  const entries = Object.entries(schema3.properties);
@@ -4393,8 +4454,8 @@ var upgradeSchema = (schema2) => {
4393
4454
  }
4394
4455
  return schema3;
4395
4456
  });
4396
- schema2 = traverse(schema2, (schema3, path30) => {
4397
- if (path30?.includes("content") && path30.includes("application/octet-stream")) {
4457
+ schema2 = traverse(schema2, (schema3, path31) => {
4458
+ if (path31?.includes("content") && path31.includes("application/octet-stream")) {
4398
4459
  return {};
4399
4460
  }
4400
4461
  if (schema3.type === "string" && schema3.format === "binary") {
@@ -4420,11 +4481,11 @@ var upgradeSchema = (schema2) => {
4420
4481
  }
4421
4482
  return sub;
4422
4483
  });
4423
- schema2 = traverse(schema2, (schema3, path30) => {
4484
+ schema2 = traverse(schema2, (schema3, path31) => {
4424
4485
  if (schema3.type === "string" && schema3.format === "byte") {
4425
- const parentPath = path30?.slice(0, -1);
4486
+ const parentPath = path31?.slice(0, -1);
4426
4487
  const contentMediaType = parentPath?.find(
4427
- (_, index) => path30?.[index - 1] === "content"
4488
+ (_, index) => path31?.[index - 1] === "content"
4428
4489
  );
4429
4490
  return {
4430
4491
  type: "string",
@@ -4436,7 +4497,7 @@ var upgradeSchema = (schema2) => {
4436
4497
  });
4437
4498
  return schema2;
4438
4499
  };
4439
- function isSchemaPath(path30) {
4500
+ function isSchemaPath(path31) {
4440
4501
  const schemaLocations = [
4441
4502
  ["components", "schemas"],
4442
4503
  "properties",
@@ -4449,10 +4510,10 @@ function isSchemaPath(path30) {
4449
4510
  ];
4450
4511
  return schemaLocations.some((location) => {
4451
4512
  if (Array.isArray(location)) {
4452
- return location.every((segment, index) => path30[index] === segment);
4513
+ return location.every((segment, index) => path31[index] === segment);
4453
4514
  }
4454
- return path30.includes(location);
4455
- }) || path30.includes("schema") || path30.some((segment) => segment.endsWith("Schema"));
4515
+ return path31.includes(location);
4516
+ }) || path31.includes("schema") || path31.some((segment) => segment.endsWith("Schema"));
4456
4517
  }
4457
4518
 
4458
4519
  // src/lib/oas/parser/index.ts
@@ -4534,13 +4595,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
4534
4595
  "anyOf",
4535
4596
  "oneOf"
4536
4597
  ]);
4537
- var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path30 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
4598
+ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path31 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
4538
4599
  if (obj === null || typeof obj !== "object") return obj;
4539
4600
  const refPath = obj.__$ref;
4540
4601
  const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
4541
4602
  if (isCircular) {
4542
4603
  if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
4543
- const circularProp = path30.find((p) => !OPENAPI_PROPS.has(p)) || path30[0];
4604
+ const circularProp = path31.find((p) => !OPENAPI_PROPS.has(p)) || path31[0];
4544
4605
  return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
4545
4606
  }
4546
4607
  if (refs.has(obj)) return refs.get(obj);
@@ -4550,7 +4611,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
4550
4611
  value,
4551
4612
  currentPath,
4552
4613
  refs,
4553
- [...path30, key],
4614
+ [...path31, key],
4554
4615
  currentRefPaths
4555
4616
  );
4556
4617
  const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
@@ -4588,7 +4649,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
4588
4649
  var getAllTags = (schema2) => {
4589
4650
  const rootTags = schema2.tags ?? [];
4590
4651
  const operations = Object.values(schema2.paths ?? {}).flatMap(
4591
- (path30) => HttpMethods.map((k) => path30?.[k]).filter((op) => op != null)
4652
+ (path31) => HttpMethods.map((k) => path31?.[k]).filter((op) => op != null)
4592
4653
  );
4593
4654
  const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
4594
4655
  const hasUntaggedOperations = operations.some(
@@ -4643,7 +4704,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
4643
4704
  var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
4644
4705
  var getAllOperations = (paths) => {
4645
4706
  const operations = Object.entries(paths ?? {}).flatMap(
4646
- ([path30, value]) => HttpMethods.flatMap((method) => {
4707
+ ([path31, value]) => HttpMethods.flatMap((method) => {
4647
4708
  if (!value?.[method]) return [];
4648
4709
  const operation = value[method];
4649
4710
  const pathParameters = value.parameters ?? [];
@@ -4663,7 +4724,7 @@ var getAllOperations = (paths) => {
4663
4724
  return {
4664
4725
  ...operation,
4665
4726
  method,
4666
- path: path30,
4727
+ path: path31,
4667
4728
  parameters,
4668
4729
  servers,
4669
4730
  tags: operation.tags ?? []
@@ -5161,8 +5222,8 @@ var Schema = builder.objectRef("Schema").implement({
5161
5222
  }),
5162
5223
  paths: t.field({
5163
5224
  type: [PathItem],
5164
- resolve: (root) => Object.entries(root.paths ?? {}).map(([path30, value]) => ({
5165
- path: path30,
5225
+ resolve: (root) => Object.entries(root.paths ?? {}).map(([path31, value]) => ({
5226
+ path: path31,
5166
5227
  // biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
5167
5228
  methods: Object.keys(value)
5168
5229
  }))
@@ -5266,11 +5327,9 @@ var ensureArray = (value) => Array.isArray(value) ? value : [value];
5266
5327
 
5267
5328
  // src/vite/api/SchemaManager.ts
5268
5329
  import fs from "node:fs/promises";
5269
- import path7 from "node:path";
5270
- import {
5271
- $RefParser as $RefParser2
5272
- } from "@apidevtools/json-schema-ref-parser";
5273
- import { upgrade, validate as validate2 } from "@scalar/openapi-parser";
5330
+ import path8 from "node:path";
5331
+ import { $RefParser as $RefParser2 } from "@apidevtools/json-schema-ref-parser";
5332
+ import { upgrade } from "@scalar/openapi-parser";
5274
5333
  import { deepEqual } from "fast-equals";
5275
5334
 
5276
5335
  // src/lib/util/flattenAllOfProcessor.ts
@@ -5318,7 +5377,7 @@ init_joinUrl();
5318
5377
 
5319
5378
  // src/vite/api/schema-codegen.ts
5320
5379
  var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
5321
- var getSegmentsFromPath = (path30) => path30.split("/").slice(1).map(unescapeJsonPointer);
5380
+ var getSegmentsFromPath = (path31) => path31.split("/").slice(1).map(unescapeJsonPointer);
5322
5381
  var createLocalRefMap = (obj) => {
5323
5382
  const refMap = /* @__PURE__ */ new Map();
5324
5383
  const siblingsMap = /* @__PURE__ */ new Map();
@@ -5349,16 +5408,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
5349
5408
  /"__refMap\+Siblings:(.*?)"/g,
5350
5409
  (_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
5351
5410
  );
5352
- var lookup = (schema2, path30, filePath) => {
5353
- const parts = getSegmentsFromPath(path30);
5411
+ var lookup = (schema2, path31, filePath) => {
5412
+ const parts = getSegmentsFromPath(path31);
5354
5413
  let val = schema2;
5355
5414
  for (const part of parts) {
5356
5415
  while (val.$ref?.startsWith("#/")) {
5357
- val = val.$ref === path30 ? val : lookup(schema2, val.$ref, filePath);
5416
+ val = val.$ref === path31 ? val : lookup(schema2, val.$ref, filePath);
5358
5417
  }
5359
5418
  if (val[part] === void 0) {
5360
5419
  throw new Error(
5361
- `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path30}`
5420
+ `Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path31}`
5362
5421
  );
5363
5422
  }
5364
5423
  val = val[part];
@@ -5450,24 +5509,30 @@ var SchemaManager = class {
5450
5509
  this.storeDir = storeDir;
5451
5510
  this.config = config;
5452
5511
  this.processors = [
5453
- ({ schema: schema2 }) => upgrade(schema2).specification,
5512
+ ({ schema: schema2 }) => {
5513
+ const upgraded = upgrade(schema2).specification;
5514
+ if (upgraded?.info && typeof upgraded.info.version !== "string") {
5515
+ upgraded.info.version = "0.0.1";
5516
+ }
5517
+ return upgraded;
5518
+ },
5454
5519
  flattenAllOfProcessor,
5455
5520
  ...processors
5456
5521
  ];
5457
5522
  }
5458
5523
  getPathForFile = (input, params) => {
5459
- const filePath = path7.resolve(this.config.__meta.rootDir, input);
5524
+ const filePath = path8.resolve(this.config.__meta.rootDir, input);
5460
5525
  const apis = ensureArray(this.config.apis ?? []);
5461
5526
  for (const apiConfig of apis) {
5462
5527
  if (!apiConfig || apiConfig.type !== "file" || !apiConfig.path) continue;
5463
5528
  const match = normalizeInputs(apiConfig.input).some(
5464
- (i) => path7.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
5529
+ (i) => path8.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
5465
5530
  );
5466
5531
  if (match) return apiConfig.path;
5467
5532
  }
5468
5533
  };
5469
5534
  processSchema = async (input) => {
5470
- const filePath = path7.resolve(this.config.__meta.rootDir, input.input);
5535
+ const filePath = path8.resolve(this.config.__meta.rootDir, input.input);
5471
5536
  const params = input.params;
5472
5537
  const configuredPath = this.getPathForFile(input.input, params);
5473
5538
  if (!configuredPath) {
@@ -5485,7 +5550,6 @@ var SchemaManager = class {
5485
5550
  }
5486
5551
  this.referencedBy.get(file)?.add(filePath);
5487
5552
  });
5488
- const validatedSchema = await this.validateSchema(schema2, filePath);
5489
5553
  const processedSchema = await this.processors.reduce(
5490
5554
  async (schema3, processor) => processor({
5491
5555
  schema: await schema3,
@@ -5498,14 +5562,14 @@ var SchemaManager = class {
5498
5562
  }
5499
5563
  })
5500
5564
  }),
5501
- Promise.resolve(validatedSchema)
5565
+ Promise.resolve(schema2)
5502
5566
  );
5503
5567
  const processedTime = Date.now();
5504
5568
  const code = generateCode(processedSchema, filePath);
5505
5569
  const prefixPath = slugify(configuredPath);
5506
- const processedFilePath = path7.posix.join(
5570
+ const processedFilePath = path8.posix.join(
5507
5571
  this.storeDir,
5508
- `${prefixPath}-${path7.basename(filePath)}${paramsSuffix(params)}.js`
5572
+ `${prefixPath}-${path8.basename(filePath)}${paramsSuffix(params)}.js`
5509
5573
  );
5510
5574
  const importKey = processedFilePath;
5511
5575
  await fs.writeFile(processedFilePath, code);
@@ -5558,7 +5622,7 @@ var SchemaManager = class {
5558
5622
  };
5559
5623
  getAllTrackedFiles = () => Array.from(this.referencedBy.keys());
5560
5624
  getFilesToReprocess = (changedFile) => {
5561
- const resolvedPath = path7.resolve(this.config.__meta.rootDir, changedFile);
5625
+ const resolvedPath = path8.resolve(this.config.__meta.rootDir, changedFile);
5562
5626
  const referencedBy = this.referencedBy.get(resolvedPath);
5563
5627
  if (!referencedBy) return [];
5564
5628
  const filesToProcess = referencedBy.size === 0 ? [resolvedPath] : Array.from(referencedBy);
@@ -5587,7 +5651,7 @@ var SchemaManager = class {
5587
5651
  version: "",
5588
5652
  path: input.path ?? "",
5589
5653
  label: input.label,
5590
- inputPath: path7.resolve(this.config.__meta.rootDir, input.input),
5654
+ inputPath: path8.resolve(this.config.__meta.rootDir, input.input),
5591
5655
  params: input.params,
5592
5656
  importKey: "",
5593
5657
  downloadUrl: "",
@@ -5607,8 +5671,8 @@ var SchemaManager = class {
5607
5671
  }
5608
5672
  }
5609
5673
  };
5610
- getLatestSchema = (path30) => this.processedSchemas[path30]?.at(0);
5611
- getSchemasForPath = (path30) => this.processedSchemas[path30];
5674
+ getLatestSchema = (path31) => this.processedSchemas[path31]?.at(0);
5675
+ getSchemasForPath = (path31) => this.processedSchemas[path31];
5612
5676
  getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
5613
5677
  getUrlToFilePathMap = () => {
5614
5678
  const map = /* @__PURE__ */ new Map();
@@ -5630,7 +5694,7 @@ var SchemaManager = class {
5630
5694
  };
5631
5695
  createSchemaPath = (inputPath, versionPath, apiPath, params, config) => {
5632
5696
  const suffix = paramsSuffix(params);
5633
- const extension = suffix ? ".json" : path7.extname(inputPath);
5697
+ const extension = suffix ? ".json" : path8.extname(inputPath);
5634
5698
  const fileName = config?.schemaDownload?.fileName ?? this.config.defaults?.apis?.schemaDownload?.fileName ?? "schema";
5635
5699
  return joinUrl(
5636
5700
  this.config.basePath,
@@ -5639,20 +5703,10 @@ var SchemaManager = class {
5639
5703
  `${fileName}${suffix}${extension}`
5640
5704
  );
5641
5705
  };
5642
- validateSchema = async (schema2, filePath) => {
5643
- const validated = await validate2(schema2);
5644
- if (validated.errors?.length) {
5645
- console.warn(`Schema warnings in ${filePath}:`);
5646
- for (const error of validated.errors) {
5647
- console.warn(error);
5648
- }
5649
- }
5650
- return schema2;
5651
- };
5652
5706
  };
5653
5707
 
5654
5708
  // src/vite/plugin-config-reload.ts
5655
- import path10 from "node:path";
5709
+ import path11 from "node:path";
5656
5710
  import colors3 from "picocolors";
5657
5711
 
5658
5712
  // src/vite/plugin-navigation.ts
@@ -5660,14 +5714,14 @@ import { stringify as stringify3 } from "javascript-stringify";
5660
5714
  import { isElement } from "react-is";
5661
5715
 
5662
5716
  // src/config/validators/NavigationSchema.ts
5663
- import path8 from "node:path";
5717
+ import path9 from "node:path";
5664
5718
  import { glob } from "glob";
5665
5719
  import { fromMarkdown } from "mdast-util-from-markdown";
5666
5720
  import { mdxFromMarkdown } from "mdast-util-mdx";
5667
5721
  import { mdxjs } from "micromark-extension-mdxjs";
5668
5722
 
5669
5723
  // src/lib/util/readFrontmatter.ts
5670
- import { readFile } from "node:fs/promises";
5724
+ import { readFile as readFile2 } from "node:fs/promises";
5671
5725
  import matter from "gray-matter";
5672
5726
  import { parse, stringify as stringify2 } from "yaml";
5673
5727
  var yaml = {
@@ -5675,7 +5729,7 @@ var yaml = {
5675
5729
  stringify: (obj) => stringify2(obj)
5676
5730
  };
5677
5731
  var readFrontmatter = async (filePath) => {
5678
- const content = await readFile(filePath, "utf-8");
5732
+ const content = await readFile2(filePath, "utf-8");
5679
5733
  const normalizedContent = content.replace(/\r\n/g, "\n");
5680
5734
  return matter(normalizedContent, { engines: { yaml } });
5681
5735
  };
@@ -5710,7 +5764,7 @@ var extractRichH1 = (content) => {
5710
5764
  }
5711
5765
  };
5712
5766
  var isNavigationItem = (item) => item !== void 0;
5713
- var toPosixPath = (filePath) => filePath.split(path8.win32.sep).join(path8.posix.sep);
5767
+ var toPosixPath = (filePath) => filePath.split(path9.win32.sep).join(path9.posix.sep);
5714
5768
  var NavigationResolver = class {
5715
5769
  rootDir;
5716
5770
  globPatterns;
@@ -5843,13 +5897,13 @@ var NavigationResolver = class {
5843
5897
 
5844
5898
  // src/vite/debug.ts
5845
5899
  import { mkdir, writeFile } from "node:fs/promises";
5846
- import path9 from "node:path";
5900
+ import path10 from "node:path";
5847
5901
  async function writePluginDebugCode(rootDir, pluginName, code, extension = "js") {
5848
5902
  if (process.env.ZUDOKU_BUILD_DEBUG) {
5849
- const debugDir = path9.join(rootDir, "dist", "debug");
5903
+ const debugDir = path10.join(rootDir, "dist", "debug");
5850
5904
  await mkdir(debugDir, { recursive: true });
5851
5905
  await writeFile(
5852
- path9.join(debugDir, `${pluginName}.${extension}`),
5906
+ path10.join(debugDir, `${pluginName}.${extension}`),
5853
5907
  typeof code === "string" ? code : code.join("\n")
5854
5908
  );
5855
5909
  }
@@ -5960,7 +6014,7 @@ var viteConfigReloadPlugin = () => ({
5960
6014
  });
5961
6015
  logger.info(
5962
6016
  colors3.blue(
5963
- `Config ${path10.basename(currentConfig.__meta.configPath)} changed. Reloading...`
6017
+ `Config ${path11.basename(currentConfig.__meta.configPath)} changed. Reloading...`
5964
6018
  ),
5965
6019
  { timestamp: true }
5966
6020
  );
@@ -5975,11 +6029,11 @@ var viteApiPlugin = async () => {
5975
6029
  const resolvedVirtualModuleId4 = `\0${virtualModuleId4}`;
5976
6030
  const initialConfig = getCurrentConfig();
5977
6031
  const zuploProcessors = ZuploEnv.isZuplo ? await runnerImport3(
5978
- path11.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
6032
+ path12.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
5979
6033
  ).then((m) => m.module.default(initialConfig.__meta.rootDir)) : [];
5980
6034
  const buildConfig = await getBuildConfig();
5981
6035
  const buildProcessors = buildConfig?.processors ?? [];
5982
- const tmpStoreDir = path11.posix.join(
6036
+ const tmpStoreDir = path12.posix.join(
5983
6037
  initialConfig.__meta.rootDir,
5984
6038
  PROCESSED_STORE_SUBPATH
5985
6039
  );
@@ -6007,7 +6061,7 @@ var viteApiPlugin = async () => {
6007
6061
  const inputPath = pathMap.get(req.url);
6008
6062
  if (!inputPath) return next();
6009
6063
  const content = await fs2.readFile(inputPath, "utf-8");
6010
- const mimeType = path11.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
6064
+ const mimeType = path12.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
6011
6065
  res.setHeader("Content-Type", `${mimeType}; charset=utf-8`);
6012
6066
  return res.end(content);
6013
6067
  });
@@ -6233,8 +6287,8 @@ var viteApiPlugin = async () => {
6233
6287
  if (process.env.NODE_ENV !== "production") return;
6234
6288
  for (const [urlPath, inputPath] of pathMap) {
6235
6289
  const content = await fs2.readFile(inputPath, "utf-8");
6236
- const outputPath = path11.join(config.__meta.rootDir, "dist", urlPath);
6237
- await fs2.mkdir(path11.dirname(outputPath), { recursive: true });
6290
+ const outputPath = path12.join(config.__meta.rootDir, "dist", urlPath);
6291
+ await fs2.mkdir(path12.dirname(outputPath), { recursive: true });
6238
6292
  await fs2.writeFile(outputPath, content, "utf-8");
6239
6293
  }
6240
6294
  }
@@ -6399,7 +6453,7 @@ var viteDocMetadataPlugin = () => ({
6399
6453
  });
6400
6454
 
6401
6455
  // src/vite/plugin-docs.ts
6402
- import path12 from "node:path";
6456
+ import path13 from "node:path";
6403
6457
  import { glob as glob3 } from "glob";
6404
6458
  import globParent from "glob-parent";
6405
6459
 
@@ -6466,7 +6520,7 @@ var globMarkdownFiles = async (config, options = { absolute: false }) => {
6466
6520
  if (process.env.NODE_ENV !== "development") {
6467
6521
  const draftStatuses = await Promise.all(
6468
6522
  globbedFiles.map(async (file) => {
6469
- const absolutePath = path12.resolve(config.__meta.rootDir, file);
6523
+ const absolutePath = path13.resolve(config.__meta.rootDir, file);
6470
6524
  const { data } = await readFrontmatter(absolutePath);
6471
6525
  return { file, isDraft: data.draft === true };
6472
6526
  })
@@ -6479,9 +6533,9 @@ var globMarkdownFiles = async (config, options = { absolute: false }) => {
6479
6533
  if (draftFiles.has(file)) {
6480
6534
  continue;
6481
6535
  }
6482
- const relativePath = path12.posix.relative(parent, file);
6536
+ const relativePath = path13.posix.relative(parent, file);
6483
6537
  const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
6484
- const filePath = options.absolute ? path12.resolve(config.__meta.rootDir, file) : file;
6538
+ const filePath = options.absolute ? path13.resolve(config.__meta.rootDir, file) : file;
6485
6539
  fileMapping[routePath] = filePath;
6486
6540
  }
6487
6541
  }
@@ -6565,7 +6619,7 @@ var plugin_docs_default = viteDocsPlugin;
6565
6619
 
6566
6620
  // src/vite/plugin-markdown-export.ts
6567
6621
  import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
6568
- import path13 from "node:path";
6622
+ import path14 from "node:path";
6569
6623
  init_joinUrl();
6570
6624
  var processMarkdownFile = async (filePath) => {
6571
6625
  const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
@@ -6582,7 +6636,7 @@ ${markdownContent}`;
6582
6636
  };
6583
6637
  var getMarkdownOutputPath = (distDir, routePath) => {
6584
6638
  const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
6585
- return `${path13.join(distDir, ...segments)}.md`;
6639
+ return `${path14.join(distDir, ...segments)}.md`;
6586
6640
  };
6587
6641
  var resolveMarkdownRoutePath = (requestUrl, basePath) => {
6588
6642
  const pathname = requestUrl.split(/[?#]/)[0] ?? requestUrl;
@@ -6654,7 +6708,7 @@ var viteMarkdownExportPlugin = () => {
6654
6708
  if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles(config)) {
6655
6709
  return;
6656
6710
  }
6657
- const distDir = path13.join(
6711
+ const distDir = path14.join(
6658
6712
  config.__meta.rootDir,
6659
6713
  "dist",
6660
6714
  config.basePath ?? ""
@@ -6675,14 +6729,14 @@ var viteMarkdownExportPlugin = () => {
6675
6729
  content: finalMarkdown
6676
6730
  });
6677
6731
  const outputPath = getMarkdownOutputPath(distDir, routePath);
6678
- await mkdir2(path13.dirname(outputPath), { recursive: true });
6732
+ await mkdir2(path14.dirname(outputPath), { recursive: true });
6679
6733
  await writeFile2(outputPath, finalMarkdown, "utf-8");
6680
6734
  } catch (error) {
6681
6735
  console.warn(`Failed to export markdown for ${routePath}:`, error);
6682
6736
  }
6683
6737
  }
6684
6738
  if (config.docs.llms.llmsTxt || config.docs.llms.llmsTxtFull) {
6685
- const markdownInfoPath = path13.join(
6739
+ const markdownInfoPath = path14.join(
6686
6740
  config.__meta.rootDir,
6687
6741
  "node_modules/.zudoku/markdown-info.json"
6688
6742
  );
@@ -6699,9 +6753,11 @@ var plugin_markdown_export_default = viteMarkdownExportPlugin;
6699
6753
 
6700
6754
  // src/vite/plugin-mdx.ts
6701
6755
  import rehypeMetaAsAttributes from "@lekoarts/rehype-meta-as-attributes";
6756
+ import { nodeTypes } from "@mdx-js/mdx";
6702
6757
  import mdx from "@mdx-js/rollup";
6703
6758
  import { toString as hastToString2 } from "hast-util-to-string";
6704
6759
  import rehypeMdxImportMedia from "rehype-mdx-import-media";
6760
+ import rehypeRaw from "rehype-raw";
6705
6761
  import rehypeSlug from "rehype-slug";
6706
6762
  import remarkComment from "remark-comment";
6707
6763
  import remarkDirective from "remark-directive";
@@ -6832,9 +6888,9 @@ var remarkCodeTabs = () => (tree) => {
6832
6888
  };
6833
6889
 
6834
6890
  // src/vite/mdx/remark-inject-filepath.ts
6835
- import path14 from "node:path";
6891
+ import path15 from "node:path";
6836
6892
  var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
6837
- const relativePath = path14.relative(rootDir, vfile.path).split(path14.sep).join(path14.posix.sep);
6893
+ const relativePath = path15.relative(rootDir, vfile.path).split(path15.sep).join(path15.posix.sep);
6838
6894
  tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
6839
6895
  };
6840
6896
 
@@ -6921,7 +6977,7 @@ var remarkLastModified = () => {
6921
6977
  };
6922
6978
 
6923
6979
  // src/vite/mdx/remark-link-rewrite.ts
6924
- import path15 from "node:path";
6980
+ import path16 from "node:path";
6925
6981
  import { visit as visit5 } from "unist-util-visit";
6926
6982
  var markdownExtension = /\.mdx?$/;
6927
6983
  var resolveToRoute = (url, filePath, routesByFile) => {
@@ -6929,7 +6985,7 @@ var resolveToRoute = (url, filePath, routesByFile) => {
6929
6985
  if (!markdownExtension.test(pathname) || pathname.startsWith("/")) {
6930
6986
  return void 0;
6931
6987
  }
6932
- const targetFile = path15.resolve(path15.dirname(filePath), pathname).replace(markdownExtension, "");
6988
+ const targetFile = path16.resolve(path16.dirname(filePath), pathname).replace(markdownExtension, "");
6933
6989
  const route = routesByFile.get(targetFile);
6934
6990
  if (route === void 0) return void 0;
6935
6991
  return `${route}${suffix}`;
@@ -6944,11 +7000,11 @@ var remarkLinkRewrite = (basePath = "", routesByFile = /* @__PURE__ */ new Map()
6944
7000
  node.url = resolved;
6945
7001
  return;
6946
7002
  }
6947
- const base = path15.posix.join(basePath);
7003
+ const base = path16.posix.join(basePath);
6948
7004
  if (basePath && node.url.startsWith(base)) {
6949
7005
  node.url = node.url.slice(base.length);
6950
7006
  } else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
6951
- node.url = path15.posix.join("..", node.url);
7007
+ node.url = path16.posix.join("..", node.url);
6952
7008
  }
6953
7009
  node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
6954
7010
  });
@@ -7146,6 +7202,7 @@ var viteMdxPlugin = async () => {
7146
7202
  ];
7147
7203
  const remarkPlugins = typeof buildConfig?.remarkPlugins === "function" ? buildConfig.remarkPlugins(defaultRemarkPlugins) : [...defaultRemarkPlugins, ...buildConfig?.remarkPlugins ?? []];
7148
7204
  const defaultRehypePlugins = [
7205
+ [rehypeRaw, { passThrough: nodeTypes }],
7149
7206
  rehypeSlug,
7150
7207
  rehype_extract_toc_with_jsx_default,
7151
7208
  rehype_extract_toc_with_jsx_export_default,
@@ -7456,8 +7513,8 @@ var protectedAnnotatorPlugin = () => ({
7456
7513
  });
7457
7514
 
7458
7515
  // src/vite/config.ts
7459
- var getAppClientEntryPath = () => path16.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
7460
- var getAppServerEntryPath = () => path16.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
7516
+ var getAppClientEntryPath = () => path17.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
7517
+ var getAppServerEntryPath = () => path17.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
7461
7518
  var hasLoggedCdnInfo = false;
7462
7519
  var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
7463
7520
  var defineEnvVars = (vars) => Object.fromEntries(
@@ -7491,7 +7548,7 @@ async function getViteConfig(dir, configEnv, options = {}) {
7491
7548
  );
7492
7549
  if (ZuploEnv.isZuplo) {
7493
7550
  dotenv.config({
7494
- path: path16.resolve(config.__meta.rootDir, "../.env.zuplo"),
7551
+ path: path17.resolve(config.__meta.rootDir, "../.env.zuplo"),
7495
7552
  quiet: true
7496
7553
  });
7497
7554
  }
@@ -7551,7 +7608,7 @@ async function getViteConfig(dir, configEnv, options = {}) {
7551
7608
  sourcemap: true,
7552
7609
  target: "es2022",
7553
7610
  chunkSizeWarningLimit: 1500,
7554
- outDir: path16.resolve(path16.join(dir, "dist", config.basePath ?? "")),
7611
+ outDir: path17.resolve(path17.join(dir, "dist", config.basePath ?? "")),
7555
7612
  emptyOutDir: false,
7556
7613
  rolldownOptions: {
7557
7614
  external: [joinUrl(config.basePath, "/pagefind/pagefind.js")],
@@ -7581,8 +7638,8 @@ async function getViteConfig(dir, configEnv, options = {}) {
7581
7638
  external: ["@shikijs/themes", "@shikijs/langs"]
7582
7639
  },
7583
7640
  build: {
7584
- outDir: path16.resolve(
7585
- path16.join(dir, "dist", config.basePath ?? "", "server")
7641
+ outDir: path17.resolve(
7642
+ path17.join(dir, "dist", config.basePath ?? "", "server")
7586
7643
  ),
7587
7644
  copyPublicDir: false,
7588
7645
  rolldownOptions: {
@@ -7597,7 +7654,7 @@ async function getViteConfig(dir, configEnv, options = {}) {
7597
7654
  if (filename.startsWith(`${PROTECTED_CHUNK_DIR}/`)) {
7598
7655
  return joinUrl(config.basePath, `/${filename}`);
7599
7656
  }
7600
- if (cdnUrl?.base && [".js", ".css"].includes(path16.extname(filename))) {
7657
+ if (cdnUrl?.base && [".js", ".css"].includes(path17.extname(filename))) {
7601
7658
  return joinUrl(cdnUrl.base, filename);
7602
7659
  }
7603
7660
  if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
@@ -7607,7 +7664,7 @@ async function getViteConfig(dir, configEnv, options = {}) {
7607
7664
  }
7608
7665
  },
7609
7666
  optimizeDeps: {
7610
- entries: [path16.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
7667
+ entries: [path17.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
7611
7668
  exclude: ["zudoku"],
7612
7669
  include: [
7613
7670
  "@mdx-js/react",
@@ -7704,10 +7761,10 @@ ${cssLinks}
7704
7761
 
7705
7762
  // src/vite/manifest.ts
7706
7763
  import { writeFile as writeFile3 } from "node:fs/promises";
7707
- import path17 from "node:path";
7764
+ import path18 from "node:path";
7708
7765
  var writeManifest = async (distDir, config) => {
7709
7766
  await writeFile3(
7710
- path17.join(distDir, MANIFEST_FILENAME),
7767
+ path18.join(distDir, MANIFEST_FILENAME),
7711
7768
  `${JSON.stringify(buildManifest(config), null, 2)}
7712
7769
  `,
7713
7770
  "utf-8"
@@ -7717,7 +7774,7 @@ var writeManifest = async (distDir, config) => {
7717
7774
  // src/vite/output.ts
7718
7775
  import assert from "node:assert";
7719
7776
  import { cp, mkdir as mkdir3, writeFile as writeFile4 } from "node:fs/promises";
7720
- import path18 from "node:path";
7777
+ import path19 from "node:path";
7721
7778
  init_joinUrl();
7722
7779
  var pkgJson = getZudokuPackageJson();
7723
7780
  function generateOutput({
@@ -7775,9 +7832,9 @@ async function writeOutput(dir, {
7775
7832
  rewrites
7776
7833
  }) {
7777
7834
  const output = generateOutput({ config, redirects, rewrites });
7778
- const outputDir = process.env.VERCEL ? path18.join(dir, ".vercel/output") : path18.join(dir, "dist/.output");
7835
+ const outputDir = process.env.VERCEL ? path19.join(dir, ".vercel/output") : path19.join(dir, "dist/.output");
7779
7836
  await mkdir3(outputDir, { recursive: true });
7780
- const outputFile = path18.join(outputDir, "config.json");
7837
+ const outputFile = path19.join(outputDir, "config.json");
7781
7838
  await writeFile4(outputFile, JSON.stringify(output, null, 2), "utf-8");
7782
7839
  if (process.env.VERCEL) {
7783
7840
  console.log("Wrote Vercel output to", outputDir);
@@ -7786,9 +7843,9 @@ async function writeOutput(dir, {
7786
7843
 
7787
7844
  // src/vite/prerender/prerender.ts
7788
7845
  import { readFileSync as readFileSync2 } from "node:fs";
7789
- import { readFile as readFile2, rm } from "node:fs/promises";
7846
+ import { readFile as readFile3, rm } from "node:fs/promises";
7790
7847
  import os from "node:os";
7791
- import path21 from "node:path";
7848
+ import path22 from "node:path";
7792
7849
  import { pathToFileURL } from "node:url";
7793
7850
  import { createIndex } from "pagefind";
7794
7851
  import colors7 from "picocolors";
@@ -7828,7 +7885,7 @@ function throttle(fn) {
7828
7885
  init_joinUrl();
7829
7886
  import { createWriteStream, existsSync } from "node:fs";
7830
7887
  import { mkdir as mkdir4 } from "node:fs/promises";
7831
- import path19 from "node:path";
7888
+ import path20 from "node:path";
7832
7889
  import colors5 from "picocolors";
7833
7890
  import { SitemapStream } from "sitemap";
7834
7891
  async function generateSitemap({
@@ -7842,11 +7899,11 @@ async function generateSitemap({
7842
7899
  return;
7843
7900
  }
7844
7901
  const sitemap = new SitemapStream({ hostname: config.siteUrl });
7845
- const outputDir = path19.resolve(baseOutputDir, config.outDir ?? "");
7902
+ const outputDir = path20.resolve(baseOutputDir, config.outDir ?? "");
7846
7903
  if (!existsSync(outputDir)) {
7847
7904
  await mkdir4(outputDir, { recursive: true });
7848
7905
  }
7849
- const sitemapOutputPath = path19.join(outputDir, "sitemap.xml");
7906
+ const sitemapOutputPath = path20.join(outputDir, "sitemap.xml");
7850
7907
  const writeStream = createWriteStream(sitemapOutputPath);
7851
7908
  sitemap.pipe(writeStream);
7852
7909
  let lastmod;
@@ -7876,14 +7933,14 @@ async function generateSitemap({
7876
7933
 
7877
7934
  // src/vite/prerender/utils.ts
7878
7935
  init_joinUrl();
7879
- var resolveRoutePath = (path30) => {
7880
- const segments = path30.split("/");
7936
+ var resolveRoutePath = (path31) => {
7937
+ const segments = path31.split("/");
7881
7938
  if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
7882
7939
  return void 0;
7883
7940
  }
7884
7941
  return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
7885
7942
  };
7886
- var isSkipped = (path30) => path30.includes("*") || /^\d+$/.test(path30);
7943
+ var isSkipped = (path31) => path31.includes("*") || /^\d+$/.test(path31);
7887
7944
  var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
7888
7945
  if (route.path && isSkipped(route.path)) return [];
7889
7946
  const routePath = route.path ? resolveRoutePath(route.path) : void 0;
@@ -7913,6 +7970,16 @@ var collectRewrites = (resolved) => resolved.flatMap((r) => [
7913
7970
  ]);
7914
7971
  var routesToPaths = (routes) => collectPaths(resolveRoutes(routes), "");
7915
7972
  var routesToRewrites = (routes) => collectRewrites(resolveRoutes(routes));
7973
+ var selectPagesToIndex = (pages, paths) => {
7974
+ const withUrl = pages.flatMap(({ indexStatusCode, html }, i) => {
7975
+ const url = paths[i];
7976
+ return url === void 0 ? [] : [{ url, html, indexStatusCode }];
7977
+ });
7978
+ return {
7979
+ include: withUrl.filter((p) => p.indexStatusCode < 400).map(({ url, html }) => ({ url, html })),
7980
+ exclude: withUrl.filter((p) => p.indexStatusCode >= 400).map(({ url, indexStatusCode }) => ({ url, status: indexStatusCode }))
7981
+ };
7982
+ };
7916
7983
 
7917
7984
  // src/vite/prerender/prerender.ts
7918
7985
  var Piscina = PiscinaImport;
@@ -7932,12 +7999,12 @@ var prerender = async ({
7932
7999
  serverConfigFilename,
7933
8000
  writeRedirects = true
7934
8001
  }) => {
7935
- const distDir = path21.join(dir, "dist", basePath);
8002
+ const distDir = path22.join(dir, "dist", basePath);
7936
8003
  const serverConfigPath = pathToFileURL(
7937
- path21.join(distDir, "server", serverConfigFilename)
8004
+ path22.join(distDir, "server", serverConfigFilename)
7938
8005
  ).href;
7939
8006
  const entryServerPath = pathToFileURL(
7940
- path21.join(distDir, "server/entry.server.js")
8007
+ path22.join(distDir, "server/entry.server.js")
7941
8008
  ).href;
7942
8009
  const rawConfig = await import(serverConfigPath).then((m) => m.default);
7943
8010
  const config = validateConfig(await runPluginTransformConfig(rawConfig));
@@ -8026,9 +8093,18 @@ var prerender = async ({
8026
8093
  logger.info(colors7.blue(message));
8027
8094
  }
8028
8095
  if (pagefindIndex) {
8029
- const pagesToIndex = workerResults.flatMap(
8030
- ({ statusCode, html: html2 }, i) => statusCode < 400 ? { url: paths[i], html: html2 } : []
8096
+ const { include: pagesToIndex, exclude } = selectPagesToIndex(
8097
+ workerResults,
8098
+ paths
8031
8099
  );
8100
+ if (exclude.length > 0) {
8101
+ const details = exclude.map(({ url, status }) => `${url} (${status})`).join(", ");
8102
+ logger.warn(
8103
+ colors7.yellow(
8104
+ `\u26A0 ${exclude.length} route(s) excluded from the search index (render status >= 400): ${details}`
8105
+ )
8106
+ );
8107
+ }
8032
8108
  const BATCH_SIZE = 40;
8033
8109
  const pagefindStart = performance.now();
8034
8110
  for (let offset = 0; offset < pagesToIndex.length; offset += BATCH_SIZE) {
@@ -8047,7 +8123,7 @@ var prerender = async ({
8047
8123
  }
8048
8124
  if (isTTY()) writeLine("");
8049
8125
  const { outputPath } = await pagefindIndex.writeFiles({
8050
- outputPath: path21.join(distDir, "pagefind")
8126
+ outputPath: path22.join(distDir, "pagefind")
8051
8127
  });
8052
8128
  if (outputPath) {
8053
8129
  const duration = (performance.now() - pagefindStart) / 1e3;
@@ -8067,13 +8143,13 @@ var prerender = async ({
8067
8143
  redirectUrls
8068
8144
  });
8069
8145
  const llmsConfig = config.docs.llms;
8070
- const markdownInfoPath = path21.join(
8146
+ const markdownInfoPath = path22.join(
8071
8147
  dir,
8072
8148
  "node_modules/.zudoku/markdown-info.json"
8073
8149
  );
8074
8150
  let markdownFileInfos = [];
8075
8151
  if (await fileExists(markdownInfoPath)) {
8076
- const markdownInfoContent = await readFile2(markdownInfoPath, "utf-8");
8152
+ const markdownInfoContent = await readFile3(markdownInfoPath, "utf-8");
8077
8153
  markdownFileInfos = JSON.parse(markdownInfoContent);
8078
8154
  }
8079
8155
  if (llmsConfig.llmsTxt || llmsConfig.llmsTxtFull) {
@@ -8093,7 +8169,7 @@ var prerender = async ({
8093
8169
  await Promise.all(
8094
8170
  markdownFileInfos.map((info) => {
8095
8171
  const outputPath = getMarkdownOutputPath(distDir, info.routePath);
8096
- if (!path21.resolve(outputPath).startsWith(path21.resolve(distDir))) {
8172
+ if (!path22.resolve(outputPath).startsWith(path22.resolve(distDir))) {
8097
8173
  return;
8098
8174
  }
8099
8175
  return rm(outputPath).catch(() => {
@@ -8151,8 +8227,8 @@ var getContainerMemoryLimitMb = () => {
8151
8227
  };
8152
8228
 
8153
8229
  // src/vite/protected/build.ts
8154
- import { mkdir as mkdir5, readdir, readFile as readFile3, rename, rm as rm2 } from "node:fs/promises";
8155
- import path22 from "node:path";
8230
+ import { mkdir as mkdir5, readdir, readFile as readFile4, rename, rm as rm2 } from "node:fs/promises";
8231
+ import path23 from "node:path";
8156
8232
  init_joinUrl();
8157
8233
  var assertProtectedPatternsCovered = (config) => {
8158
8234
  const { patterns } = getProtectedSourceMatcher(config);
@@ -8174,11 +8250,11 @@ var findProtectedLeaks = (output) => {
8174
8250
  const visited = /* @__PURE__ */ new Set();
8175
8251
  const stack = [{ fileName: entry.fileName, path: [entry.fileName] }];
8176
8252
  while (stack.length > 0) {
8177
- const { fileName, path: path30 } = stack.pop();
8253
+ const { fileName, path: path31 } = stack.pop();
8178
8254
  if (visited.has(fileName)) continue;
8179
8255
  visited.add(fileName);
8180
8256
  for (const imp of byFileName.get(fileName)?.imports ?? []) {
8181
- const next = [...path30, imp];
8257
+ const next = [...path31, imp];
8182
8258
  if (isProtected(imp)) {
8183
8259
  leaks.push(next.join(" -> "));
8184
8260
  continue;
@@ -8209,17 +8285,17 @@ This eagerly pulls gated content into the public bundle. Check that nothing in n
8209
8285
  );
8210
8286
  };
8211
8287
  var moveProtectedChunks = async (clientOutDir, serverOutDir) => {
8212
- const srcDir = path22.join(clientOutDir, PROTECTED_CHUNK_DIR);
8288
+ const srcDir = path23.join(clientOutDir, PROTECTED_CHUNK_DIR);
8213
8289
  const files = await readdir(srcDir).catch((err) => {
8214
8290
  if (err.code === "ENOENT") return null;
8215
8291
  throw err;
8216
8292
  });
8217
8293
  if (!files) return;
8218
- const destDir = path22.join(serverOutDir, PROTECTED_CHUNK_DIR);
8294
+ const destDir = path23.join(serverOutDir, PROTECTED_CHUNK_DIR);
8219
8295
  await mkdir5(destDir, { recursive: true });
8220
8296
  await Promise.all(
8221
8297
  files.map(
8222
- (file) => rename(path22.join(srcDir, file), path22.join(destDir, file))
8298
+ (file) => rename(path23.join(srcDir, file), path23.join(destDir, file))
8223
8299
  )
8224
8300
  );
8225
8301
  const leftover = await readdir(srcDir).catch(() => []);
@@ -8237,7 +8313,7 @@ var assertCloudflareWranglerGatesProtected = async (dir, config) => {
8237
8313
  const protectedPrefix = `${joinUrl(config.basePath, PROTECTED_CHUNK_DIR)}/`;
8238
8314
  const candidates = ["wrangler.toml", "wrangler.jsonc", "wrangler.json"];
8239
8315
  for (const name of candidates) {
8240
- const file = await readFile3(path22.join(dir, name), "utf-8").catch(
8316
+ const file = await readFile4(path23.join(dir, name), "utf-8").catch(
8241
8317
  () => void 0
8242
8318
  );
8243
8319
  if (file === void 0) continue;
@@ -8265,7 +8341,7 @@ async function runBuild(options) {
8265
8341
  const builder2 = await createBuilder(viteConfig);
8266
8342
  invariant(builder2.environments.client, "Client environment is missing");
8267
8343
  invariant(builder2.environments.ssr, "SSR environment is missing");
8268
- const distDir = path23.resolve(path23.join(dir, "dist"));
8344
+ const distDir = path24.resolve(path24.join(dir, "dist"));
8269
8345
  await rm3(distDir, { recursive: true, force: true });
8270
8346
  const [clientResult, serverResult] = await Promise.all([
8271
8347
  builder2.build(builder2.environments.client),
@@ -8315,13 +8391,13 @@ async function runBuild(options) {
8315
8391
  await assertCloudflareWranglerGatesProtected(dir, config);
8316
8392
  }
8317
8393
  await writeFile6(
8318
- path23.join(distDir, "package.json"),
8394
+ path24.join(distDir, "package.json"),
8319
8395
  `${JSON.stringify({ type: "module" }, null, 2)}
8320
8396
  `,
8321
8397
  "utf-8"
8322
8398
  );
8323
8399
  await writeManifest(distDir, config);
8324
- await rm3(path23.join(clientOutDir, "index.html"), { force: true });
8400
+ await rm3(path24.join(clientOutDir, "index.html"), { force: true });
8325
8401
  } else {
8326
8402
  await runPrerender({
8327
8403
  dir,
@@ -8352,25 +8428,25 @@ var runPrerender = async (options) => {
8352
8428
  serverConfigFilename,
8353
8429
  writeRedirects: process.env.VERCEL === void 0
8354
8430
  });
8355
- const indexHtml = path23.join(clientOutDir, "index.html");
8431
+ const indexHtml = path24.join(clientOutDir, "index.html");
8356
8432
  if (!workerResults.find((r) => r.outputPath === indexHtml)) {
8357
8433
  await writeFile6(indexHtml, html, "utf-8");
8358
8434
  }
8359
8435
  const statusPages = workerResults.flatMap(
8360
- (r) => /^(400|404|500)\.html$/.test(path23.basename(r.outputPath)) ? r.outputPath : []
8436
+ (r) => /^(400|404|500)\.html$/.test(path24.basename(r.outputPath)) ? r.outputPath : []
8361
8437
  );
8362
8438
  for (const statusPage of statusPages) {
8363
8439
  await rename2(
8364
8440
  statusPage,
8365
- path23.join(dir, DIST_DIR, path23.basename(statusPage))
8441
+ path24.join(dir, DIST_DIR, path24.basename(statusPage))
8366
8442
  );
8367
8443
  }
8368
8444
  await rm3(serverOutDir, { recursive: true, force: true });
8369
8445
  if (process.env.VERCEL) {
8370
- await mkdir6(path23.join(dir, ".vercel/output/static"), { recursive: true });
8446
+ await mkdir6(path24.join(dir, ".vercel/output/static"), { recursive: true });
8371
8447
  await rename2(
8372
- path23.join(dir, DIST_DIR),
8373
- path23.join(dir, ".vercel/output/static")
8448
+ path24.join(dir, DIST_DIR),
8449
+ path24.join(dir, ".vercel/output/static")
8374
8450
  );
8375
8451
  }
8376
8452
  await writeOutput(dir, {
@@ -8381,7 +8457,7 @@ var runPrerender = async (options) => {
8381
8457
  if (ZuploEnv.isZuplo && issuer) {
8382
8458
  const provider = config.authentication?.type;
8383
8459
  await writeFile6(
8384
- path23.join(dir, DIST_DIR, ".output/zuplo.json"),
8460
+ path24.join(dir, DIST_DIR, ".output/zuplo.json"),
8385
8461
  JSON.stringify({ issuer, provider }, null, 2),
8386
8462
  "utf-8"
8387
8463
  );
@@ -8393,7 +8469,7 @@ var runPrerender = async (options) => {
8393
8469
  };
8394
8470
  var findUserEntry = (dir) => {
8395
8471
  for (const ext of ["ts", "tsx", "js", "mjs"]) {
8396
- const candidate = path23.join(dir, `zudoku.server.${ext}`);
8472
+ const candidate = path24.join(dir, `zudoku.server.${ext}`);
8397
8473
  if (existsSync2(candidate)) return candidate;
8398
8474
  }
8399
8475
  };
@@ -8404,15 +8480,15 @@ var bundleSSREntry = async (options) => {
8404
8480
  let entryPoint = userEntry;
8405
8481
  let tempEntryPath;
8406
8482
  if (!entryPoint) {
8407
- tempEntryPath = path23.join(dir, "__ssr-entry.ts");
8408
- const templateContent = await readFile4(
8409
- path23.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
8483
+ tempEntryPath = path24.join(dir, "__ssr-entry.ts");
8484
+ const templateContent = await readFile5(
8485
+ path24.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
8410
8486
  "utf-8"
8411
8487
  );
8412
8488
  await writeFile6(tempEntryPath, templateContent, "utf-8");
8413
8489
  entryPoint = tempEntryPath;
8414
8490
  }
8415
- const frameworkPath = path23.join(serverOutDir, "entry.server.js");
8491
+ const frameworkPath = path24.join(serverOutDir, "entry.server.js");
8416
8492
  try {
8417
8493
  await esbuild({
8418
8494
  entryPoints: [entryPoint],
@@ -8420,9 +8496,9 @@ var bundleSSREntry = async (options) => {
8420
8496
  platform: ["node", "lambda"].includes(adapter) ? "node" : "neutral",
8421
8497
  target: "es2022",
8422
8498
  format: "esm",
8423
- outfile: path23.join(serverOutDir, "entry.js"),
8499
+ outfile: path24.join(serverOutDir, "entry.js"),
8424
8500
  external: ["./zudoku.config.js"],
8425
- nodePaths: [path23.join(packageRoot, "node_modules")],
8501
+ nodePaths: [path24.join(packageRoot, "node_modules")],
8426
8502
  banner: { js: "// Bundled SSR entry" },
8427
8503
  define: {
8428
8504
  __ZUDOKU_TEMPLATE__: JSON.stringify(html)
@@ -8441,7 +8517,7 @@ var bundleSSREntry = async (options) => {
8441
8517
  await Promise.all([
8442
8518
  rm3(frameworkPath, { force: true }),
8443
8519
  rm3(`${frameworkPath}.map`, { force: true }),
8444
- rm3(path23.join(serverOutDir, "assets"), {
8520
+ rm3(path24.join(serverOutDir, "assets"), {
8445
8521
  recursive: true,
8446
8522
  force: true
8447
8523
  })
@@ -8452,17 +8528,7 @@ var bundleSSREntry = async (options) => {
8452
8528
  };
8453
8529
 
8454
8530
  // src/cli/common/output.ts
8455
- import * as Sentry from "@sentry/node";
8456
8531
  import colors8 from "picocolors";
8457
-
8458
- // src/cli/common/constants.ts
8459
- var CLI_XDG_FOLDER_NAME = "zudoku";
8460
- var VERSION_CHECK_FILE = "version.json";
8461
- var SENTRY_DSN = void 0;
8462
- var MAX_WAIT_PENDING_TIME_MS = 1e3;
8463
- var POST_HOG_CAPTURE_KEY = void 0;
8464
-
8465
- // src/cli/common/output.ts
8466
8532
  function printDiagnosticsToConsole(message) {
8467
8533
  console.error(colors8.bold(colors8.blue(message)));
8468
8534
  }
@@ -8471,11 +8537,11 @@ function printWarningToConsole(message) {
8471
8537
  }
8472
8538
 
8473
8539
  // src/cli/preview/handler.ts
8474
- import path24 from "node:path";
8540
+ import path25 from "node:path";
8475
8541
  import { preview as vitePreview } from "vite";
8476
8542
  var DEFAULT_PREVIEW_PORT = 4e3;
8477
8543
  async function preview(argv) {
8478
- const dir = path24.resolve(process.cwd(), argv.dir);
8544
+ const dir = path25.resolve(process.cwd(), argv.dir);
8479
8545
  const viteConfig = await getViteConfig(dir, {
8480
8546
  command: "serve",
8481
8547
  mode: "production",
@@ -8513,7 +8579,7 @@ async function build(argv) {
8513
8579
  printDiagnosticsToConsole(`Starting Zudoku build v${packageJson2.version}`);
8514
8580
  printDiagnosticsToConsole("");
8515
8581
  printDiagnosticsToConsole("");
8516
- const dir = path25.resolve(process.cwd(), argv.dir);
8582
+ const dir = path26.resolve(process.cwd(), argv.dir);
8517
8583
  try {
8518
8584
  await runBuild({
8519
8585
  dir,
@@ -8536,6 +8602,11 @@ async function build(argv) {
8536
8602
  // src/cli/common/analytics/lib.ts
8537
8603
  import { PostHog } from "posthog-node";
8538
8604
 
8605
+ // src/cli/common/constants.ts
8606
+ var CLI_XDG_FOLDER_NAME = "zudoku";
8607
+ var VERSION_CHECK_FILE = "version.json";
8608
+ var POST_HOG_CAPTURE_KEY = void 0;
8609
+
8539
8610
  // src/cli/common/machine-id/lib.ts
8540
8611
  import { execSync } from "node:child_process";
8541
8612
  import { createHash } from "node:crypto";
@@ -8667,13 +8738,13 @@ var build_default = {
8667
8738
 
8668
8739
  // src/cli/dev/handler.ts
8669
8740
  init_joinUrl();
8670
- import path28 from "node:path";
8741
+ import path29 from "node:path";
8671
8742
 
8672
8743
  // src/vite/dev-server.ts
8673
8744
  import fs3 from "node:fs/promises";
8674
8745
  import http from "node:http";
8675
8746
  import https from "node:https";
8676
- import path27 from "node:path";
8747
+ import path28 from "node:path";
8677
8748
  import { stripVTControlCharacters } from "node:util";
8678
8749
  import { createHttpTerminator } from "http-terminator";
8679
8750
  import {
@@ -8705,7 +8776,7 @@ async function findAvailablePort(startPort) {
8705
8776
  init_joinUrl();
8706
8777
 
8707
8778
  // src/vite/pagefind-dev-index.ts
8708
- import path26 from "node:path";
8779
+ import path27 from "node:path";
8709
8780
  import { createIndex as createIndex2 } from "pagefind";
8710
8781
  import { isRunnableDevEnvironment } from "vite";
8711
8782
  init_joinUrl();
@@ -8759,7 +8830,7 @@ async function* buildPagefindDevIndex(vite, config) {
8759
8830
  path: urlPath
8760
8831
  };
8761
8832
  }
8762
- const outputPath = path26.join(vite.config.publicDir, "pagefind");
8833
+ const outputPath = path27.join(vite.config.publicDir, "pagefind");
8763
8834
  await pagefindIndex.writeFiles({ outputPath });
8764
8835
  yield { type: "complete", success: true, indexed };
8765
8836
  }
@@ -8779,9 +8850,9 @@ var DevServer = class {
8779
8850
  this.protocol = "https";
8780
8851
  const { dir } = this.#options;
8781
8852
  const [key, cert, ca] = await Promise.all([
8782
- fs3.readFile(path27.resolve(dir, config.https.key)),
8783
- fs3.readFile(path27.resolve(dir, config.https.cert)),
8784
- config.https.ca ? fs3.readFile(path27.resolve(dir, config.https.ca)) : void 0
8853
+ fs3.readFile(path28.resolve(dir, config.https.key)),
8854
+ fs3.readFile(path28.resolve(dir, config.https.cert)),
8855
+ config.https.ca ? fs3.readFile(path28.resolve(dir, config.https.ca)) : void 0
8785
8856
  ]);
8786
8857
  return https.createServer({ key, cert, ca });
8787
8858
  }
@@ -8809,7 +8880,7 @@ var DevServer = class {
8809
8880
  // built-in transform middleware which would treat the path as a static asset.
8810
8881
  name: "zudoku:entry-client",
8811
8882
  configureServer(server2) {
8812
- const entryPath = path27.posix.join(
8883
+ const entryPath = path28.posix.join(
8813
8884
  server2.config.base,
8814
8885
  "/__z/entry.client.tsx"
8815
8886
  );
@@ -8921,13 +8992,13 @@ var DevServer = class {
8921
8992
  `Server-side rendering ${this.#options.ssr ? "enabled" : "disabled"}`
8922
8993
  );
8923
8994
  if (config.search?.type === "pagefind") {
8924
- const pagefindPath = path27.join(
8995
+ const pagefindPath = path28.join(
8925
8996
  vite.config.publicDir,
8926
8997
  "pagefind/pagefind.js"
8927
8998
  );
8928
8999
  const exists = await fs3.stat(pagefindPath).catch(() => false);
8929
9000
  if (!exists) {
8930
- await fs3.mkdir(path27.dirname(pagefindPath), { recursive: true });
9001
+ await fs3.mkdir(path28.dirname(pagefindPath), { recursive: true });
8931
9002
  await fs3.writeFile(pagefindPath, 'throw new Error("NOT_BUILT_YET");');
8932
9003
  }
8933
9004
  }
@@ -9029,7 +9100,7 @@ var DevServer = class {
9029
9100
  async function dev(argv) {
9030
9101
  const packageJson2 = getZudokuPackageJson();
9031
9102
  process.env.NODE_ENV = "development";
9032
- const dir = path28.resolve(process.cwd(), argv.dir);
9103
+ const dir = path29.resolve(process.cwd(), argv.dir);
9033
9104
  const server = new DevServer({
9034
9105
  dir,
9035
9106
  argPort: argv.port,
@@ -9135,7 +9206,7 @@ var preview_default = previewCommand;
9135
9206
 
9136
9207
  // src/cli/common/outdated.ts
9137
9208
  import { existsSync as existsSync3, mkdirSync } from "node:fs";
9138
- import { readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
9209
+ import { readFile as readFile6, writeFile as writeFile7 } from "node:fs/promises";
9139
9210
  import { join } from "node:path";
9140
9211
  import colors10 from "picocolors";
9141
9212
  import { gt } from "semver";
@@ -9185,12 +9256,12 @@ function box(message, {
9185
9256
 
9186
9257
  // src/cli/common/xdg/lib.ts
9187
9258
  import { homedir } from "node:os";
9188
- import path29 from "node:path";
9259
+ import path30 from "node:path";
9189
9260
  function defineDirectoryWithFallback(xdgName, fallback) {
9190
9261
  if (process.env[xdgName]) {
9191
9262
  return process.env[xdgName];
9192
9263
  } else {
9193
- return path29.join(homedir(), fallback);
9264
+ return path30.join(homedir(), fallback);
9194
9265
  }
9195
9266
  }
9196
9267
  var XDG_CONFIG_HOME = defineDirectoryWithFallback(
@@ -9205,15 +9276,15 @@ var XDG_STATE_HOME = defineDirectoryWithFallback(
9205
9276
  "XDG_DATA_HOME",
9206
9277
  ".local/state"
9207
9278
  );
9208
- var ZUDOKU_XDG_CONFIG_HOME = path29.join(
9279
+ var ZUDOKU_XDG_CONFIG_HOME = path30.join(
9209
9280
  XDG_CONFIG_HOME,
9210
9281
  CLI_XDG_FOLDER_NAME
9211
9282
  );
9212
- var ZUDOKU_XDG_DATA_HOME = path29.join(
9283
+ var ZUDOKU_XDG_DATA_HOME = path30.join(
9213
9284
  XDG_DATA_HOME,
9214
9285
  CLI_XDG_FOLDER_NAME
9215
9286
  );
9216
- var ZUDOKU_XDG_STATE_HOME = path29.join(
9287
+ var ZUDOKU_XDG_STATE_HOME = path30.join(
9217
9288
  XDG_STATE_HOME,
9218
9289
  CLI_XDG_FOLDER_NAME
9219
9290
  );
@@ -9262,7 +9333,7 @@ async function getVersionCheckInfo() {
9262
9333
  let versionCheckInfo;
9263
9334
  if (existsSync3(versionCheckPath)) {
9264
9335
  try {
9265
- versionCheckInfo = await readFile5(versionCheckPath, "utf-8").then(
9336
+ versionCheckInfo = await readFile6(versionCheckPath, "utf-8").then(
9266
9337
  JSON.parse
9267
9338
  );
9268
9339
  } catch {
@@ -9348,12 +9419,6 @@ To fix, run:
9348
9419
  // src/cli/cli.ts
9349
9420
  process.env.ZUDOKU_ENV = process.env.ZUDOKU_INTERNAL_DEV ? "internal" : "module";
9350
9421
  var packageJson = getZudokuPackageJson();
9351
- if (SENTRY_DSN) {
9352
- Sentry2.init({
9353
- dsn: SENTRY_DSN,
9354
- release: packageJson?.version
9355
- });
9356
- }
9357
9422
  var cli = yargs(hideBin(process.argv)).option("zuplo", {
9358
9423
  type: "boolean",
9359
9424
  description: "Enable Zuplo mode",
@@ -9367,14 +9432,7 @@ var cli = yargs(hideBin(process.argv)).option("zuplo", {
9367
9432
  try {
9368
9433
  void warnIfOutdatedVersion(packageJson?.version);
9369
9434
  await cli.argv;
9370
- void Sentry2.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
9371
- process.exit(0);
9372
- });
9373
- } catch (err) {
9374
- if (err instanceof Error) {
9375
- Sentry2.captureException(err);
9376
- }
9377
- throw err;
9378
9435
  } finally {
9379
9436
  await shutdownAnalytics();
9380
9437
  }
9438
+ process.exit();