@thallylabs/migrate 0.2.29 → 0.2.30
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/index.js +29 -14
- package/dist/index.js.map +1 -1
- package/dist/url-migration.js +29 -14
- package/dist/url-migration.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14359,6 +14359,33 @@ async function runUrlMigration(options) {
|
|
|
14359
14359
|
enqueue(sourceUrl, sourceUrl, "submitted");
|
|
14360
14360
|
for (const path of ["llms.txt", "sitemap.xml", "robots.txt"]) enqueue(`${scopePath === "/" ? "" : scopePath}/${path}`, sourceUrl, "discovery-index");
|
|
14361
14361
|
if (scopePath !== "/") for (const path of ["llms.txt", "sitemap.xml", "robots.txt"]) enqueue(`/${path}`, sourceUrl, "discovery-index");
|
|
14362
|
+
const enqueueArticleLinks = (links, base, discoveredBy) => {
|
|
14363
|
+
for (const link of links) {
|
|
14364
|
+
try {
|
|
14365
|
+
const url = new URL(link, base);
|
|
14366
|
+
if (!/\.(?:png|jpe?g|gif|svg|webp|avif|pdf|zip|mp4|webm|css|js)$/i.test(url.pathname)) enqueue(link, base, discoveredBy);
|
|
14367
|
+
} catch {
|
|
14368
|
+
}
|
|
14369
|
+
}
|
|
14370
|
+
};
|
|
14371
|
+
const enqueueNavigation = (nodes, base) => {
|
|
14372
|
+
for (const node of nodes) {
|
|
14373
|
+
if (node.url) enqueue(node.url, base, "source-navigation");
|
|
14374
|
+
enqueueNavigation(node.children ?? [], base);
|
|
14375
|
+
}
|
|
14376
|
+
};
|
|
14377
|
+
for (const record of [...records.values()]) {
|
|
14378
|
+
if (!record.evidence) continue;
|
|
14379
|
+
const final = canonical(record.evidence.finalUrl, sourceUrl);
|
|
14380
|
+
if (!final) continue;
|
|
14381
|
+
if (record.outcome === "imported") enqueueArticleLinks(record.evidence.links, final, record.url);
|
|
14382
|
+
else if (record.outcome === "excluded") {
|
|
14383
|
+
if (classifyMigrationResponse({ finalUrl: new URL(final), contentType: record.evidence.contentType, body: "" }) === "index") {
|
|
14384
|
+
for (const link of record.evidence.links) enqueue(link, final, record.url);
|
|
14385
|
+
}
|
|
14386
|
+
}
|
|
14387
|
+
}
|
|
14388
|
+
enqueueNavigation(checkpoint.navigation, sourceUrl);
|
|
14362
14389
|
const fetcher = options.fetcher ?? defaultMigrationFetcher;
|
|
14363
14390
|
const capture = options.captureProvider?.capture.bind(options.captureProvider) ?? (async ({ url }) => fetcher(url, { accept: ACCEPT }));
|
|
14364
14391
|
const assetFetcher = options.assetFetcher ?? (!options.fetcher && !options.captureProvider ? defaultAssetFetcher : void 0);
|
|
@@ -14545,20 +14572,8 @@ ${difference}`;
|
|
|
14545
14572
|
checkpoint.navigation = navigation;
|
|
14546
14573
|
navigationChanged = true;
|
|
14547
14574
|
}
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
const url = new URL(link, final);
|
|
14551
|
-
if (!/\.(?:png|jpe?g|gif|svg|webp|avif|pdf|zip|mp4|webm|css|js)$/i.test(url.pathname)) enqueue(link, final, record.url);
|
|
14552
|
-
} catch {
|
|
14553
|
-
}
|
|
14554
|
-
}
|
|
14555
|
-
const visit = (nodes) => {
|
|
14556
|
-
for (const node of nodes) {
|
|
14557
|
-
if (node.url) enqueue(node.url, final, "source-navigation");
|
|
14558
|
-
visit(node.children ?? []);
|
|
14559
|
-
}
|
|
14560
|
-
};
|
|
14561
|
-
visit(navigation);
|
|
14575
|
+
enqueueArticleLinks(evidence.links, final, record.url);
|
|
14576
|
+
enqueueNavigation(navigation, final);
|
|
14562
14577
|
} catch (error) {
|
|
14563
14578
|
if (options.signal?.aborted) return;
|
|
14564
14579
|
const wasImported = record.outcome === "imported";
|