@mintlify/common 1.0.1255 → 1.0.1257

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.
@@ -20,7 +20,7 @@ export const extractPackageIslands = (tree, options) => {
20
20
  return [];
21
21
  return [...sideEffects].map(([source, line]) => {
22
22
  const message = CSS_SPECIFIER.test(source)
23
- ? `"${source}" is imported on a page without package components, so it never loads. List it in packages.css in docs.json to load it on every page and remove this import, or use a package component on this page.`
23
+ ? `"${source}" is imported on a page without package components, so it never loads. Use a package component on this page or remove this import.`
24
24
  : `"${source}" is imported on a page without package components, so it never runs. Use a package component on this page or remove this import.`;
25
25
  return { line, code: 'side-effect-import-without-island', message };
26
26
  });
@@ -0,0 +1,3 @@
1
+ import type { ClientGroupConfig, ClientNavPage, ClientPageOrGroupConfig } from '@mintlify/validation';
2
+ export declare const isClientNavPage: (entry: ClientPageOrGroupConfig) => entry is ClientNavPage;
3
+ export declare const isClientNavGroup: (entry: ClientPageOrGroupConfig) => entry is ClientGroupConfig;
@@ -0,0 +1,4 @@
1
+ import { isGroup } from './isGroup.js';
2
+ import { isPage } from './isPage.js';
3
+ export const isClientNavPage = (entry) => isPage(entry);
4
+ export const isClientNavGroup = (entry) => isGroup(entry);
@@ -1,3 +1,3 @@
1
- import type { DecoratedPageOrGroupConfig } from '@mintlify/validation';
1
+ import { type DecoratedPageOrGroupConfig } from '@mintlify/validation';
2
2
  export declare function clientNavView(entries: DecoratedPageOrGroupConfig[]): unknown[];
3
3
  export declare function paginationDescriptions(entries: DecoratedPageOrGroupConfig[], currentPath: string): [unknown, unknown];
@@ -9,10 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
+ import { CLIENT_NAV_PAGE_FIELDS, } from '@mintlify/validation';
12
13
  import { isEqualIgnoringLeadingSlash } from '../paths/isEqualIgnoringLeadingSlash.js';
13
14
  import { replaceSlashIndex } from '../slug/replaceSlashIndex.js';
14
15
  import { isPage } from './isPage.js';
15
- import { CLIENT_NAV_PAGE_FIELDS } from './trimScopedNavPages.js';
16
16
  function clientPage(page) {
17
17
  return Object.fromEntries(CLIENT_NAV_PAGE_FIELDS.filter((field) => Object.hasOwn(page, field)).map((field) => [
18
18
  field,
@@ -1,5 +1,6 @@
1
1
  export * from './isGroup.js';
2
2
  export * from './isPage.js';
3
+ export * from './clientNavGuards.js';
3
4
  export * from './generatePathToBreadcrumbsMap.js';
4
5
  export * from './getFirstPageFromNavigation.js';
5
6
  export * from './generatePathToBreadcrumbsMapForDocsConfig.js';
@@ -1,5 +1,6 @@
1
1
  export * from './isGroup.js';
2
2
  export * from './isPage.js';
3
+ export * from './clientNavGuards.js';
3
4
  export * from './generatePathToBreadcrumbsMap.js';
4
5
  export * from './getFirstPageFromNavigation.js';
5
6
  export * from './generatePathToBreadcrumbsMapForDocsConfig.js';
@@ -1,10 +1,10 @@
1
1
  import { LocaleType } from '@mintlify/models';
2
- import { type DecoratedNavigationConfig, type DocsConfig } from '@mintlify/validation';
2
+ import { type ClientNavigationConfig, type DecoratedNavigationConfig, type DocsConfig } from '@mintlify/validation';
3
3
  import { DivisionMatch } from './updateFirstHrefInDivision.js';
4
4
  export declare function scopeDecoratedNavToPath(nav: DecoratedNavigationConfig, currentPath: string, userGroups?: Set<string>): DecoratedNavigationConfig;
5
5
  export declare function scopeDocsConfigNavToPath(docsConfig: DocsConfig, currentPath: string): DocsConfig;
6
6
  export type ScopedNavForPath = {
7
- scopedNav: DecoratedNavigationConfig;
7
+ scopedNav: ClientNavigationConfig;
8
8
  firstHrefInVersion: Map<string | undefined, DivisionMatch>;
9
9
  firstHrefInLanguage: Map<LocaleType | undefined, DivisionMatch>;
10
10
  currentVersion: string | undefined;
@@ -1,4 +1,3 @@
1
1
  type NavNode = Record<string, unknown>;
2
- export declare const CLIENT_NAV_PAGE_FIELDS: readonly ["href", "title", "hidden", "groups", "sidebarTitle", "url", "icon", "iconType", "tag", "api", "openapi", "asyncapi", "graphql", "deprecated", "hideApiMarker", "mode", "playground", "version"];
3
2
  export declare function trimScopedNavPages(nav: NavNode, currentPath: string): NavNode;
4
3
  export {};
@@ -1,28 +1,6 @@
1
+ import { CLIENT_NAV_PAGE_FIELDS } from '@mintlify/validation';
1
2
  import { normalizeComparablePath } from '../paths/isEqualIgnoringLeadingSlash.js';
2
3
  import { replaceSlashIndex } from '../slug/replaceSlashIndex.js';
3
- function pageFieldAllowlist(fields) {
4
- return fields;
5
- }
6
- export const CLIENT_NAV_PAGE_FIELDS = pageFieldAllowlist([
7
- 'href',
8
- 'title',
9
- 'hidden',
10
- 'groups',
11
- 'sidebarTitle',
12
- 'url',
13
- 'icon',
14
- 'iconType',
15
- 'tag',
16
- 'api',
17
- 'openapi',
18
- 'asyncapi',
19
- 'graphql',
20
- 'deprecated',
21
- 'hideApiMarker',
22
- 'mode',
23
- 'playground',
24
- 'version',
25
- ]);
26
4
  const isNavNode = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
27
5
  const isPageNode = (node) => Object.hasOwn(node, 'href') && Object.hasOwn(node, 'title');
28
6
  const hrefMatches = (href, target) => typeof href === 'string' && normalizeComparablePath(replaceSlashIndex(href)) === target;