blume 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -3616,10 +3616,7 @@ var collectIcons = (navigation) => {
3616
3616
  push(item.icon, `selector "${item.label}"`);
3617
3617
  }
3618
3618
  }
3619
- const sidebars = [
3620
- navigation.sidebar,
3621
- ...navigation.sidebarVariants.map((variant) => variant.sidebar)
3622
- ];
3619
+ const sidebars = [navigation.sidebar];
3623
3620
  for (const sidebar of sidebars) {
3624
3621
  for (const node of flattenNodes(sidebar)) {
3625
3622
  push(node.icon, `"${node.label}"`);
@@ -3692,11 +3689,7 @@ var duplicateLabelDiagnostics = (navigation) => {
3692
3689
  }
3693
3690
  };
3694
3691
  const sidebars = [
3695
- { nodes: navigation.sidebar, where: "at the top level" },
3696
- ...navigation.sidebarVariants.map((variant) => ({
3697
- nodes: variant.sidebar,
3698
- where: `in the "${variant.path}" section`
3699
- }))
3692
+ { nodes: navigation.sidebar, where: "at the top level" }
3700
3693
  ];
3701
3694
  for (const { nodes, where } of sidebars) {
3702
3695
  checkLevel(nodes, where);
@@ -3708,10 +3701,7 @@ var hiddenInSidebarDiagnostics = (navigation, pages) => {
3708
3701
  if (hidden.size === 0) {
3709
3702
  return [];
3710
3703
  }
3711
- const sidebars = [
3712
- navigation.sidebar,
3713
- ...navigation.sidebarVariants.map((variant) => variant.sidebar)
3714
- ];
3704
+ const sidebars = [navigation.sidebar];
3715
3705
  const diagnostics = [];
3716
3706
  const seen = new Set;
3717
3707
  for (const sidebar of sidebars) {
@@ -6978,7 +6968,6 @@ var buildRuntimeData = (project) => {
6978
6968
  chromeVariants: [],
6979
6969
  selectors: [],
6980
6970
  sidebar: [],
6981
- sidebarVariants: [],
6982
6971
  tabs: []
6983
6972
  })
6984
6973
  ])) : {};
@@ -7558,16 +7547,6 @@ var mintlifyBackgroundDecoration = (value) => {
7558
7547
  }
7559
7548
  return;
7560
7549
  };
7561
- var sidebarItemPaths = (items) => items.flatMap((item) => {
7562
- if (typeof item === "string") {
7563
- return [tabPathFromRef(item)];
7564
- }
7565
- if (item.href) {
7566
- return [item.href];
7567
- }
7568
- const paths = item.root ? [tabPathFromRef(item.root)] : [];
7569
- return item.items ? [...paths, ...sidebarItemPaths(item.items)] : paths;
7570
- });
7571
7550
  var collapsedFromExpanded = (value) => {
7572
7551
  if (value === false) {
7573
7552
  return true;
@@ -7652,59 +7631,6 @@ var selectorItemsFor = (items) => items.flatMap((item) => {
7652
7631
  ];
7653
7632
  });
7654
7633
  var isExternalRoute = (path) => path.startsWith("http://") || path.startsWith("https://") || path.startsWith("mailto:") || path.startsWith("tel:");
7655
- var hasOwnNavigationContent = (item) => Boolean(asString(item.root)) || childItemsFor(item).length > 0;
7656
- var mintlifySidebarVariants = async (spec) => {
7657
- const navigation = asObject(spec.navigation) ?? {};
7658
- const global = asObject(navigation.global) ?? {};
7659
- const candidates = [];
7660
- const addCandidate = (item) => {
7661
- const path = navItemPath(item);
7662
- if (!path || isExternalRoute(path)) {
7663
- return;
7664
- }
7665
- candidates.push({ item, path });
7666
- };
7667
- for (const item of [
7668
- ...asArray(navigation.tabs),
7669
- ...asArray(navigation.anchors),
7670
- ...asArray(global.anchors)
7671
- ]) {
7672
- const object = asObject(item);
7673
- if (!object) {
7674
- addCandidate(item);
7675
- continue;
7676
- }
7677
- for (const menuItem of asArray(object.menu)) {
7678
- addCandidate(menuItem);
7679
- }
7680
- if (hasOwnNavigationContent(object)) {
7681
- addCandidate(item);
7682
- }
7683
- }
7684
- for (const item of [
7685
- ...asArray(navigation.dropdowns),
7686
- ...asArray(navigation.products),
7687
- ...asArray(navigation.versions),
7688
- ...asArray(navigation.languages)
7689
- ]) {
7690
- addCandidate(item);
7691
- }
7692
- const resolved = await Promise.all(candidates.map(async (candidate) => {
7693
- const items = await toSidebarItems([candidate.item], {});
7694
- if (items.length === 0) {
7695
- return [];
7696
- }
7697
- return [candidate.path, ...sidebarItemPaths(items)].filter((path) => !isExternalRoute(path)).map((path) => ({ items, path }));
7698
- }));
7699
- const seen = new Set;
7700
- return resolved.flat().flatMap((variant) => {
7701
- if (!variant || seen.has(variant.path)) {
7702
- return [];
7703
- }
7704
- seen.add(variant.path);
7705
- return [variant];
7706
- });
7707
- };
7708
7634
  var mintlifyTabs = (spec) => {
7709
7635
  const navigation = asObject(spec.navigation) ?? {};
7710
7636
  const global = asObject(navigation.global) ?? {};
@@ -7776,18 +7702,30 @@ var mintignorePatterns = async (root) => {
7776
7702
  };
7777
7703
  var REDIRECT_PARAM = /:(?<name>[A-Za-z_]\w*)(?<modifier>[*+?])?/gu;
7778
7704
  var toAstroRedirectPath = (path) => path.replaceAll(REDIRECT_PARAM, (_match, name, modifier) => modifier === "*" || modifier === "+" ? `[...${name}]` : `[${name}]`);
7779
- var mintlifyRedirects = (spec) => asArray(spec.redirects).flatMap((redirect) => {
7780
- const object = asObject(redirect);
7781
- if (!object) {
7782
- return [];
7783
- }
7784
- const from = asString(object.source) ?? asString(object.from);
7785
- const to = asString(object.destination) ?? asString(object.to) ?? asString(object.redirect);
7786
- if (!from || !to) {
7787
- return [];
7705
+ var isDynamicRedirectPath = (path) => path.includes("[");
7706
+ var partitionMintlifyRedirects = (spec) => {
7707
+ const kept = [];
7708
+ const dropped = [];
7709
+ for (const redirect of asArray(spec.redirects)) {
7710
+ const object = asObject(redirect);
7711
+ if (!object) {
7712
+ continue;
7713
+ }
7714
+ const source = asString(object.source) ?? asString(object.from);
7715
+ const destination = asString(object.destination) ?? asString(object.to) ?? asString(object.redirect);
7716
+ if (!source || !destination) {
7717
+ continue;
7718
+ }
7719
+ const from = toAstroRedirectPath(source);
7720
+ const to = toAstroRedirectPath(destination);
7721
+ if (isDynamicRedirectPath(from) || isDynamicRedirectPath(to)) {
7722
+ dropped.push(source);
7723
+ } else {
7724
+ kept.push({ from, to });
7725
+ }
7788
7726
  }
7789
- return [{ from: toAstroRedirectPath(from), to: toAstroRedirectPath(to) }];
7790
- });
7727
+ return { dropped, kept };
7728
+ };
7791
7729
  var openapiRouteFromDirectory = (value) => {
7792
7730
  const directory = normalizeDirectory(asString(value) ?? "");
7793
7731
  return directory.length > 0 ? `/${directory}` : undefined;
@@ -8052,11 +7990,10 @@ var loadMintlifyConfig = async (root, file) => {
8052
7990
  chromeVariants: mintlifyChromeVariants(spec),
8053
7991
  selectors: mintlifySelectors(spec),
8054
7992
  sidebar: await toSidebarItems(mintlifyNavigationItems(navigation), {}),
8055
- sidebarVariants: await mintlifySidebarVariants(spec),
8056
7993
  tabs: mintlifyTabs(spec)
8057
7994
  },
8058
7995
  openapi: mintlifyOpenapi(spec),
8059
- redirects: mintlifyRedirects(spec),
7996
+ redirects: partitionMintlifyRedirects(spec).kept,
8060
7997
  search: {
8061
7998
  indexing: {
8062
7999
  includeHiddenPages: seo.indexing === "all"
@@ -8441,10 +8378,6 @@ var sidebarItemSchema = z2.lazy(() => z2.union([
8441
8378
  root: z2.string().optional()
8442
8379
  }).strict()
8443
8380
  ]));
8444
- var sidebarVariantSchema = z2.object({
8445
- items: z2.array(sidebarItemSchema).default([]),
8446
- path: z2.string()
8447
- }).strict();
8448
8381
  var variablesConfigSchema = z2.record(z2.string().regex(/^[A-Za-z0-9-]+$/u), z2.string()).default({});
8449
8382
  var fontSlug = z2.string().refine(isFontSlug, (value) => ({
8450
8383
  message: `Unknown font "${value}". Supported fonts: ${FONT_SLUGS.join(", ")}.`
@@ -8558,7 +8491,6 @@ var navigationConfigSchema = z2.object({
8558
8491
  repo: z2.boolean().default(true),
8559
8492
  selectors: z2.array(navSelectorSchema).default([]),
8560
8493
  sidebar: z2.array(sidebarItemSchema).optional(),
8561
- sidebarVariants: z2.array(sidebarVariantSchema).default([]),
8562
8494
  tabs: z2.array(navTabSchema).optional()
8563
8495
  }).strict();
8564
8496
  var exportConfigSchema = z2.union([
@@ -9025,16 +8957,11 @@ var buildNavigation = (pages, options) => {
9025
8957
  options.refByLogical ? page.translationKey : page.route,
9026
8958
  page
9027
8959
  ]));
9028
- const sidebarVariants = (options.sidebarVariants ?? []).map((variant) => ({
9029
- path: variant.path,
9030
- sidebar: buildConfigSidebar(variant.items, byRoute)
9031
- }));
9032
8960
  if (options.sidebar) {
9033
8961
  return {
9034
8962
  chromeVariants,
9035
8963
  selectors,
9036
8964
  sidebar: buildConfigSidebar(options.sidebar, byRoute),
9037
- sidebarVariants,
9038
8965
  tabs
9039
8966
  };
9040
8967
  }
@@ -9042,7 +8969,6 @@ var buildNavigation = (pages, options) => {
9042
8969
  chromeVariants,
9043
8970
  selectors,
9044
8971
  sidebar: buildFileSystemSidebar(pages, options.folderMeta, sharedFolderMeta, metaPrefix),
9045
- sidebarVariants,
9046
8972
  tabs
9047
8973
  };
9048
8974
  };
@@ -9107,7 +9033,6 @@ var buildContentGraph = (pages, options) => {
9107
9033
  selectors: options.navigation.selectors,
9108
9034
  sharedFolderMeta: options.sharedFolderMeta,
9109
9035
  sidebar: options.navigation.sidebar,
9110
- sidebarVariants: options.navigation.sidebarVariants,
9111
9036
  tabs
9112
9037
  });
9113
9038
  }
@@ -9115,7 +9040,6 @@ var buildContentGraph = (pages, options) => {
9115
9040
  chromeVariants: [],
9116
9041
  selectors: [],
9117
9042
  sidebar: [],
9118
- sidebarVariants: [],
9119
9043
  tabs: []
9120
9044
  };
9121
9045
  } else {
@@ -9125,7 +9049,6 @@ var buildContentGraph = (pages, options) => {
9125
9049
  selectors: options.navigation.selectors,
9126
9050
  sharedFolderMeta: options.sharedFolderMeta,
9127
9051
  sidebar: options.navigation.sidebar,
9128
- sidebarVariants: options.navigation.sidebarVariants,
9129
9052
  tabs: options.navigation.tabs
9130
9053
  });
9131
9054
  }
@@ -10241,6 +10164,7 @@ var rewriteMintlifyCallouts = (source) => rewriteCallouts(source, {
10241
10164
  typeDirectives: CALLOUT_TYPE_DIRECTIVES
10242
10165
  });
10243
10166
  var rewriteMintlifyExampleBlocks = (source) => source.replaceAll(/<(?<close>\/?)(?:Request|Response)Example\b/gu, "<$<close>CodeGroup");
10167
+ var rewriteMintlifyAccordions = (source) => source.replaceAll(/<(?<close>\/?)Accordion(?<group>Group)?\b/gu, (_match, close, group) => group ? `<${close}Accordion` : `<${close}AccordionItem`);
10244
10168
  var SNIPPET_IMPORT = /^import\s+[\s\S]*?\s+from\s+["'](?<source>\/snippets\/[^"']+)["'];?[ \t]*\n?/gmu;
10245
10169
  var rewriteSnippetImports = (source, options) => {
10246
10170
  const components = [];
@@ -10636,6 +10560,7 @@ var transformMintlifyContent = async (raw, options) => {
10636
10560
  text = snippetImports.source;
10637
10561
  text = rewriteMintlifySvgIconProps(text);
10638
10562
  text = rewriteMintlifyExampleBlocks(text);
10563
+ text = rewriteMintlifyAccordions(text);
10639
10564
  text = rewriteMintlifyCallouts(text);
10640
10565
  const unsupported = unsupportedMintlifyComponents(text);
10641
10566
  const parsed = frontmatter_default(text);
@@ -13490,6 +13415,15 @@ var droppedChromeWarnings = (spec, config) => {
13490
13415
  }
13491
13416
  return warnings;
13492
13417
  };
13418
+ var droppedRedirectWarnings = (spec) => {
13419
+ const { dropped } = partitionMintlifyRedirects(spec);
13420
+ if (dropped.length === 0) {
13421
+ return [];
13422
+ }
13423
+ return [
13424
+ `Dropped ${dropped.length} dynamic redirect(s) Blume can't model as static path-to-path (${dropped.join(", ")}); re-add them as host-level rules (e.g. _redirects or vercel.json).`
13425
+ ];
13426
+ };
13493
13427
  var prune = (value) => {
13494
13428
  if (Array.isArray(value)) {
13495
13429
  return value.map(prune);
@@ -13597,6 +13531,7 @@ var migrateMintlifyProject = async (root) => {
13597
13531
  warnings.push(`Mapped ${openapiSources.length} OpenAPI spec source(s) to openapi.sources (native reference renderer); verify each spec path or URL resolves.`);
13598
13532
  }
13599
13533
  warnings.push(...droppedChromeWarnings(spec, config));
13534
+ warnings.push(...droppedRedirectWarnings(spec));
13600
13535
  } else {
13601
13536
  warnings.push("No docs.json or mint.json found; writing a default config.");
13602
13537
  config = { content: { root: "." }, title: "Documentation" };
@@ -15059,5 +14994,5 @@ process.on("unhandledRejection", (error) => {
15059
14994
  });
15060
14995
  runMain(main);
15061
14996
 
15062
- //# debugId=432F59E1AFBFB0A064756E2164756E21
14997
+ //# debugId=A4775073F9612C8B64756E2164756E21
15063
14998
  //# sourceMappingURL=index.js.map