@mintlify/common 1.0.1316 → 1.0.1317
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.
|
@@ -3,10 +3,6 @@ export type DisplayDomainDeployment = {
|
|
|
3
3
|
basePath: string;
|
|
4
4
|
customDomains?: string[];
|
|
5
5
|
auth?: unknown;
|
|
6
|
-
atlas?: {
|
|
7
|
-
id: string;
|
|
8
|
-
repoUrl?: string;
|
|
9
|
-
};
|
|
10
6
|
};
|
|
11
7
|
export declare function getDisplayDomain(deployment: DisplayDomainDeployment, isDev?: boolean, appendBasePath?: boolean): string;
|
|
12
8
|
export declare function getMarkdownLinkDomain(deployment: DisplayDomainDeployment & {
|
package/dist/getDisplayDomain.js
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
function parseOwnerRepo(repoUrl) {
|
|
2
|
-
const patterns = [
|
|
3
|
-
/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?(?:\/|$)/,
|
|
4
|
-
/^github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/,
|
|
5
|
-
/^([^/]+)\/([^/]+)$/,
|
|
6
|
-
];
|
|
7
|
-
for (const pattern of patterns) {
|
|
8
|
-
const match = repoUrl.match(pattern);
|
|
9
|
-
if ((match === null || match === void 0 ? void 0 : match[1]) && match[2]) {
|
|
10
|
-
return { owner: match[1], repo: match[2].replace(/\.git$/, '') };
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
1
|
function getSubdomain(deployment) {
|
|
16
2
|
if (deployment.auth) {
|
|
17
3
|
switch (deployment.basePath) {
|
|
@@ -25,19 +11,13 @@ function getSubdomain(deployment) {
|
|
|
25
11
|
return 'mintlify.site';
|
|
26
12
|
}
|
|
27
13
|
export function getDisplayDomain(deployment, isDev = false, appendBasePath = true) {
|
|
28
|
-
var _a, _b
|
|
29
|
-
var
|
|
14
|
+
var _a, _b;
|
|
15
|
+
var _c;
|
|
30
16
|
const { subdomain } = deployment;
|
|
31
|
-
if ((_a = deployment.
|
|
32
|
-
const parsed = parseOwnerRepo(deployment.atlas.repoUrl);
|
|
33
|
-
if (parsed) {
|
|
34
|
-
return `mintlify.com/${parsed.owner}/${parsed.repo}`;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (isDev && !((_b = deployment.customDomains) === null || _b === void 0 ? void 0 : _b[0])) {
|
|
17
|
+
if (isDev && !((_a = deployment.customDomains) === null || _a === void 0 ? void 0 : _a[0])) {
|
|
38
18
|
return `${subdomain}.mintlifytest.com`;
|
|
39
19
|
}
|
|
40
|
-
const displayDomainBase = (
|
|
20
|
+
const displayDomainBase = (_c = (_b = deployment.customDomains) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : `${subdomain}.${getSubdomain(deployment)}`;
|
|
41
21
|
return displayDomainBase + (appendBasePath ? deployment.basePath : '');
|
|
42
22
|
}
|
|
43
23
|
export function getMarkdownLinkDomain(deployment, requestedHost, { selfHosted = false } = {}) {
|