@mintlify/common 1.0.957 → 1.0.959

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.
@@ -0,0 +1,7 @@
1
+ export type ManagedBasePathConfig = {
2
+ domain: string;
3
+ rewriteSuffix: string;
4
+ };
5
+ export declare const MANAGED_BASE_PATHS: Map<string, ManagedBasePathConfig>;
6
+ export declare function isManagedBasePath(basePath: string): boolean;
7
+ export declare function isCustomBasePath(basePath: string): boolean;
@@ -0,0 +1,25 @@
1
+ export const MANAGED_BASE_PATHS = new Map([
2
+ ['/docs', { domain: 'mintlify.dev', rewriteSuffix: '.subdirectory-docs.mintlify.me' }],
3
+ ['/help', { domain: 'mintlify.help', rewriteSuffix: '.help.mintlify.me' }],
4
+ ['/guides', { domain: 'mintlify-guides.com', rewriteSuffix: '.guides.mintlify.me' }],
5
+ ['/wiki', { domain: 'mintlify.wiki', rewriteSuffix: '.wiki.mintlify.me' }],
6
+ ['/developers', { domain: 'mintlify.de', rewriteSuffix: '.developers.mintlify.me' }],
7
+ ['/academy', { domain: 'mintlify.academy', rewriteSuffix: '.academy.mintlify.me' }],
8
+ ['/connect', { domain: 'mintlify-connect.com', rewriteSuffix: '.connect.mintlify.me' }],
9
+ ['/go', { domain: 'mintlify-go.com', rewriteSuffix: '.go.mintlify.me' }],
10
+ ['/blog', { domain: 'mintlify.blog', rewriteSuffix: '.blog.mintlify.me' }],
11
+ [
12
+ '/docs/rest-api/reference',
13
+ {
14
+ domain: 'mintlify-docs-rest-api-reference.com',
15
+ rewriteSuffix: '.docs-rest-api-reference.mintlify.me',
16
+ },
17
+ ],
18
+ ['/ai/docs', { domain: 'mintlify-ai-docs.com', rewriteSuffix: '.ai-docs.mintlify.me' }],
19
+ ]);
20
+ export function isManagedBasePath(basePath) {
21
+ return MANAGED_BASE_PATHS.has(basePath);
22
+ }
23
+ export function isCustomBasePath(basePath) {
24
+ return basePath.length > 0 && !MANAGED_BASE_PATHS.has(basePath);
25
+ }
@@ -1,3 +1,4 @@
1
+ import { MANAGED_BASE_PATHS } from './basePaths.js';
1
2
  function parseOwnerRepo(repoUrl) {
2
3
  const patterns = [
3
4
  /^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?(?:\/|$)/,
@@ -12,19 +13,8 @@ function parseOwnerRepo(repoUrl) {
12
13
  }
13
14
  return null;
14
15
  }
15
- const CUSTOM_DEPLOYMENT_SUBDOMAINS = ['auth0', 'docs-dev', 'docs-staging'];
16
- const CUSTOM_DEPLOYMENT_DOMAINS = {
17
- auth0: 'auth0-mintlify.app',
18
- 'docs-dev': 'auth0-mintlify.app',
19
- 'docs-staging': 'auth0-mintlify.app',
20
- };
21
- function isCustomDeployment(subdomain) {
22
- return CUSTOM_DEPLOYMENT_SUBDOMAINS.some((validSubdomain) => validSubdomain === subdomain);
23
- }
24
- function getCustomDeploymentDomain(subdomain) {
25
- return CUSTOM_DEPLOYMENT_DOMAINS[subdomain];
26
- }
27
16
  function getSubdomain(deployment) {
17
+ var _a, _b;
28
18
  if (deployment.auth) {
29
19
  switch (deployment.basePath) {
30
20
  case '/docs':
@@ -34,31 +24,7 @@ function getSubdomain(deployment) {
34
24
  }
35
25
  }
36
26
  }
37
- if (isCustomDeployment(deployment.subdomain)) {
38
- return getCustomDeploymentDomain(deployment.subdomain);
39
- }
40
- switch (deployment.basePath) {
41
- case '/docs':
42
- return 'mintlify.dev';
43
- case '/help':
44
- return 'mintlify.help';
45
- case '/wiki':
46
- return 'mintlify.wiki';
47
- case '/developers':
48
- return 'mintlify.de';
49
- case '/academy':
50
- return 'mintlify.academy';
51
- case '/connect':
52
- return 'mintlify-connect.com';
53
- case '/go':
54
- return 'mintlify-go.com';
55
- case '/blog':
56
- return 'mintlify.blog';
57
- case '/ai/docs':
58
- return 'mintlify-ai-docs.com';
59
- default:
60
- return 'mintlify.app';
61
- }
27
+ return (_b = (_a = MANAGED_BASE_PATHS.get(deployment.basePath)) === null || _a === void 0 ? void 0 : _a.domain) !== null && _b !== void 0 ? _b : 'mintlify.app';
62
28
  }
63
29
  export function getDisplayDomain(deployment, isDev = false, appendBasePath = true) {
64
30
  var _a, _b, _c, _d;
package/dist/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export * from './truncateAtWordBoundary.js';
28
28
  export * from './api-reference/parseApiTargetFromMetadata.js';
29
29
  export * from './mintIgnore.js';
30
30
  export * from './getDisplayDomain.js';
31
+ export * from './basePaths.js';
31
32
  export * from './exponentialBackoff.js';
32
33
  export * from './editor/index.js';
33
34
  export * from './isOrgLessThanTwoWeeksOld.js';
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ export * from './truncateAtWordBoundary.js';
28
28
  export * from './api-reference/parseApiTargetFromMetadata.js';
29
29
  export * from './mintIgnore.js';
30
30
  export * from './getDisplayDomain.js';
31
+ export * from './basePaths.js';
31
32
  export * from './exponentialBackoff.js';
32
33
  export * from './editor/index.js';
33
34
  export * from './isOrgLessThanTwoWeeksOld.js';