@thallylabs/migrate 0.2.40 → 0.2.41
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/README.md +60 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +469 -59
- package/dist/index.js.map +1 -1
- package/dist/url-migration.d.ts +2 -2
- package/dist/url-migration.js +40 -6
- package/dist/url-migration.js.map +1 -1
- package/dist/{url-run-DFnoqEi-.d.ts → url-run-mSKFqHx_.d.ts} +33 -3
- package/package.json +1 -1
package/dist/url-migration.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { h as MigrationCapture } from './url-run-
|
|
2
|
-
export { a as MigrationAsset, f as MigrationBundle, i as MigrationCaptureProvider, j as MigrationCaptureState, k as MigrationCapturedAsset, g as MigrationDocsConfig, l as MigrationEvidence, m as MigrationFetchRequest, n as MigrationFetchResponse, d as MigrationFetcher, o as MigrationJournalAsset, b as MigrationNavigationGroup, p as MigrationNavigationOccurrence, q as MigrationNavigationTab, M as MigrationPage, e as MigrationPlatform, c as MigrationWarning, R as RenderedMigrationFile, U as UrlMigrationCheckpoint, r as UrlMigrationCheckpointDelta, s as UrlMigrationIssue, t as UrlMigrationRecord, u as UrlMigrationRun, v as UrlMigrationRunOptions, w as UrlMigrationValidation, x as classifyMigrationResponse, z as renderMigrationFiles, A as runUrlMigration, B as validateUrlMigration } from './url-run-
|
|
1
|
+
import { h as MigrationCapture } from './url-run-mSKFqHx_.js';
|
|
2
|
+
export { a as MigrationAsset, f as MigrationBundle, i as MigrationCaptureProvider, j as MigrationCaptureState, k as MigrationCapturedAsset, g as MigrationDocsConfig, l as MigrationEvidence, m as MigrationFetchRequest, n as MigrationFetchResponse, d as MigrationFetcher, o as MigrationJournalAsset, b as MigrationNavigationGroup, p as MigrationNavigationOccurrence, q as MigrationNavigationTab, M as MigrationPage, e as MigrationPlatform, c as MigrationWarning, R as RenderedMigrationFile, U as UrlMigrationCheckpoint, r as UrlMigrationCheckpointDelta, s as UrlMigrationIssue, t as UrlMigrationRecord, u as UrlMigrationRun, v as UrlMigrationRunOptions, w as UrlMigrationValidation, x as classifyMigrationResponse, z as renderMigrationFiles, A as runUrlMigration, B as validateUrlMigration } from './url-run-mSKFqHx_.js';
|
|
3
3
|
|
|
4
4
|
interface UrlMigrationScope {
|
|
5
5
|
scopePath: string;
|
package/dist/url-migration.js
CHANGED
|
@@ -2618,8 +2618,29 @@ ${trimmed.slice(0, marker).trimEnd()}`;
|
|
|
2618
2618
|
function headingIdMarker(id) {
|
|
2619
2619
|
return `{/* #${id} */}`;
|
|
2620
2620
|
}
|
|
2621
|
+
var HEADING_ID_WORD = /[\p{L}\p{M}\p{N}_+&/@\u2019\u201c\u201d\u2014\u2013\u2192]/u;
|
|
2621
2622
|
function mintlifyHeadingSlug(text2) {
|
|
2622
|
-
|
|
2623
|
+
const chars = [...text2.replace(/[\u200b*]/g, "").normalize("NFC").trim().toLowerCase()];
|
|
2624
|
+
const isWord = (char) => char !== void 0 && HEADING_ID_WORD.test(char);
|
|
2625
|
+
let id = "";
|
|
2626
|
+
let afterDash = false;
|
|
2627
|
+
let endsWithDash = false;
|
|
2628
|
+
chars.forEach((char, index) => {
|
|
2629
|
+
const before = chars[index - 1];
|
|
2630
|
+
const after = chars[index + 1];
|
|
2631
|
+
endsWithDash = false;
|
|
2632
|
+
if (isWord(char)) {
|
|
2633
|
+
id += char;
|
|
2634
|
+
afterDash = false;
|
|
2635
|
+
} else if (/[\s-]/.test(char) || char === "." && isWord(after) || char === "(" && isWord(before) && (isWord(after) || after === "{") || char === ")" && after !== void 0 && !/\s/.test(after)) {
|
|
2636
|
+
if (id && !afterDash) id += "-";
|
|
2637
|
+
afterDash = true;
|
|
2638
|
+
endsWithDash = true;
|
|
2639
|
+
} else if (char === "{" || char === ":" || char === '"') {
|
|
2640
|
+
afterDash = false;
|
|
2641
|
+
}
|
|
2642
|
+
});
|
|
2643
|
+
return endsWithDash ? id.replace(/-$/, "") : id;
|
|
2623
2644
|
}
|
|
2624
2645
|
function thallyHeadingSlug(text2) {
|
|
2625
2646
|
return text2.normalize("NFC").toLowerCase().replace(/[^\p{L}\p{M}\p{N}]+/gu, "-").replace(/(^-|-$)/g, "");
|
|
@@ -2631,7 +2652,7 @@ function typesetQuotes(text2) {
|
|
|
2631
2652
|
}).join("");
|
|
2632
2653
|
}
|
|
2633
2654
|
function plainHeadingText(source) {
|
|
2634
|
-
return source.replace(/\{\/\*[\s\S]*?\*\/\}/g, " ").replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/<\/?[A-Za-z][^>]*>/g, "").replace(/`([^`]*)`/g, "$1").replace(/(\*\*|__|~~|\*)/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/\\([\\`*_{}[\]()#+.!&<>|~-])/g, "$1");
|
|
2655
|
+
return source.replace(/\{\/\*[\s\S]*?\*\/\}/g, " ").replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/<\/?[A-Za-z][^>]*>/g, "").replace(/`([^`]*)`/g, "$1").replace(/(?<!\\)(\*\*|__|~~|\*)/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/\\([\\`*_{}[\]()#+.!&<>|~-])/g, "$1");
|
|
2635
2656
|
}
|
|
2636
2657
|
function markMintlifyHeadings(body) {
|
|
2637
2658
|
let fence;
|
|
@@ -3343,7 +3364,7 @@ function normalizeMdx(body, platform, unwrapMdxCodeBlocks = true) {
|
|
|
3343
3364
|
}
|
|
3344
3365
|
if (runMintlify) rewritten = normalizeMintlifyParameterAnchors(rewritten);
|
|
3345
3366
|
rewritten = replaceOutsideCode(rewritten, (segment) => {
|
|
3346
|
-
let result = convertHtmlStyleAttributes(segment).replace(/<!--([\s\S]*?)-->/g, (_match, content) => mdxComment(content)).replace(/<Danger(\s[^>]*)?>/g, "<Error$1>").replace(/<\/Danger>/g, "</Error>").replace(/<Warn(\s[^>]*)?>/g, "<Warning$1>").replace(/<\/Warn>/g, "</Warning>").replace(/<
|
|
3367
|
+
let result = convertHtmlStyleAttributes(segment).replace(/<!--([\s\S]*?)-->/g, (_match, content) => mdxComment(content)).replace(/<Danger(\s[^>]*)?>/g, "<Error$1>").replace(/<\/Danger>/g, "</Error>").replace(/<Warn(\s[^>]*)?>/g, "<Warning$1>").replace(/<\/Warn>/g, "</Warning>").replace(/<Tree\.Folder/g, "<Folder").replace(/<\/Tree\.Folder>/g, "</Folder>").replace(/<Tree\.File/g, "<File").replace(/<\/Tree\.File>/g, "</File>");
|
|
3347
3368
|
if (runDocusaurus) {
|
|
3348
3369
|
result = result.replace(/<TabItem\b([^<>]*)>/g, (_match, attributes) => {
|
|
3349
3370
|
const title = attributes.match(/\blabel=(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean) ?? attributes.match(/\bvalue=(?:"([^"]*)"|'([^']*)')/)?.slice(1).find(Boolean) ?? "Tab";
|
|
@@ -3352,7 +3373,7 @@ function normalizeMdx(body, platform, unwrapMdxCodeBlocks = true) {
|
|
|
3352
3373
|
result = normalizeDocusaurusLinkTags(result).replace(/<(?:DocCardList|TOCInline)\b[^<>]*\/>/g, "");
|
|
3353
3374
|
}
|
|
3354
3375
|
if (runMintlify) {
|
|
3355
|
-
result = normalizeMintlifyUpdateLabels(result).replace(/<FileTree(\s[^>]*)?>/g, "<Tree$1>").replace(/<\/FileTree>/g, "</Tree>").replace(/<GitHub\.Repo/g, "<GitHub").replace(/<\/GitHub\.Repo>/g, "</GitHub>").replace(/<Column(\s[^>]*)?>/g, "<div$1>").replace(/<\/Column>/g, "</div>");
|
|
3376
|
+
result = normalizeMintlifyUpdateLabels(result).replace(/<FileTree(\s[^>]*)?>/g, "<Tree$1>").replace(/<\/FileTree>/g, "</Tree>").replace(/<GitHub\.Repo/g, "<GitHub").replace(/<\/GitHub\.Repo>/g, "</GitHub>").replace(/<Callout(\s[^<>]*)?>/g, (tag) => tag.replace(/(\s)type=(?:"[^"]*"|'[^']*'|\{[^{}]*\})/, '$1type="info"')).replace(/<Column(\s[^>]*)?>/g, "<div$1>").replace(/<\/Column>/g, "</div>");
|
|
3356
3377
|
result = pinStepsTitleSize(result);
|
|
3357
3378
|
}
|
|
3358
3379
|
if (runFern) {
|
|
@@ -3371,6 +3392,16 @@ function normalizeMdx(body, platform, unwrapMdxCodeBlocks = true) {
|
|
|
3371
3392
|
}
|
|
3372
3393
|
return normalizeFlowParagraphContainers(normalized);
|
|
3373
3394
|
}
|
|
3395
|
+
function externalPageUrl(value) {
|
|
3396
|
+
const url = typeof value === "string" ? value.trim() : "";
|
|
3397
|
+
if (!/^https?:\/\/[^\s]+$/i.test(url)) return void 0;
|
|
3398
|
+
try {
|
|
3399
|
+
new URL(url);
|
|
3400
|
+
return url;
|
|
3401
|
+
} catch {
|
|
3402
|
+
return void 0;
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3374
3405
|
function parseMarkdownPage(input) {
|
|
3375
3406
|
const parsed = parseFrontmatter(input.raw);
|
|
3376
3407
|
const fallbackIdentity = {
|
|
@@ -3395,6 +3426,7 @@ function parseMarkdownPage(input) {
|
|
|
3395
3426
|
const badge = typeof parsed.data.tag === "string" && parsed.data.tag.trim() ? parsed.data.tag.trim() : typeof parsed.data.badge === "string" && parsed.data.badge.trim() ? parsed.data.badge.trim() : void 0;
|
|
3396
3427
|
const sourceMode = typeof parsed.data.mode === "string" ? parsed.data.mode : void 0;
|
|
3397
3428
|
const mode = sourceMode === "frame" ? "wide" : ["default", "wide", "custom", "center", "home"].includes(sourceMode ?? "") ? sourceMode : void 0;
|
|
3429
|
+
const externalUrl = input.platform === "mintlify" ? externalPageUrl(parsed.data.url) : void 0;
|
|
3398
3430
|
const description = typeof parsed.data.description === "string" && parsed.data.description.trim() ? parsed.data.description.trim() : typeof parsed.data.openapi === "string" && parsed.data.openapi.trim() ? "" : firstParagraph(body);
|
|
3399
3431
|
const page = {
|
|
3400
3432
|
id: identity.id,
|
|
@@ -3410,7 +3442,9 @@ function parseMarkdownPage(input) {
|
|
|
3410
3442
|
keywords,
|
|
3411
3443
|
mode,
|
|
3412
3444
|
hidden: parsed.data.hidden === true ? true : void 0,
|
|
3413
|
-
|
|
3445
|
+
// The path of a page that links elsewhere redirects, so it has no business in a sitemap.
|
|
3446
|
+
noindex: parsed.data.noindex === true || parsed.data.noindex === "true" || externalUrl ? true : void 0,
|
|
3447
|
+
...externalUrl ? { externalUrl } : {},
|
|
3414
3448
|
...Object.keys(meta).length > 0 ? { meta } : {},
|
|
3415
3449
|
openapi: typeof parsed.data.openapi === "string" ? parsed.data.openapi.trim() : void 0,
|
|
3416
3450
|
...apiFrontmatter(parsed.data, input.warn),
|
|
@@ -6477,7 +6511,7 @@ function renderPage(bundle, page) {
|
|
|
6477
6511
|
page.icon ? `icon: ${yamlString(page.icon)}` : null,
|
|
6478
6512
|
page.iconType ? `iconType: ${yamlString(page.iconType)}` : null,
|
|
6479
6513
|
`description: ${yamlString(page.description)}`,
|
|
6480
|
-
page.descriptionPlacement === "body" ?
|
|
6514
|
+
page.descriptionPlacement === "body" || page.descriptionPlacement === "operation" ? `descriptionPlacement: ${page.descriptionPlacement}` : null,
|
|
6481
6515
|
page.badge ? `badge: ${yamlString(page.badge)}` : null,
|
|
6482
6516
|
page.keywords.length > 0 ? `keywords: [${page.keywords.map(yamlString).join(", ")}]` : null,
|
|
6483
6517
|
page.mode ? `mode: ${yamlString(page.mode)}` : null,
|