@thallylabs/migrate 0.2.35 → 0.2.37

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.
@@ -3760,7 +3760,7 @@ function validateUrlMigration(checkpoint, cancelled = false) {
3760
3760
  } catch {
3761
3761
  }
3762
3762
  if (!destination.evidence?.anchors.includes(anchor)) {
3763
- warnings.push({ code: "source-link-warning", source: record.url, message: `The original source link refers to an absent source anchor: ${link}` });
3763
+ warnings.push({ code: "source-link-warning", source: record.url, message: `The original source link refers to an absent source anchor; the imported link opens the page instead: ${link}` });
3764
3764
  } else if (destination.page) {
3765
3765
  const nodes = markdownNodes(destination.page.body);
3766
3766
  const explicit = nodes.flatMap((node) => node.name === "a" ? (node.attributes ?? []).flatMap((attribute) => attribute.name === "id" && typeof attribute.value === "string" ? [attribute.value] : []) : []);
@@ -4209,8 +4209,17 @@ ${difference}`;
4209
4209
  } catch {
4210
4210
  return value;
4211
4211
  }
4212
- const route = routeMap.get(canonical(url.toString(), sourceUrl));
4213
- return route ? `${route}${url.hash}` : value;
4212
+ const identity = canonical(url.toString(), sourceUrl);
4213
+ const route = routeMap.get(identity);
4214
+ if (!route) return value;
4215
+ const destination = resolveMigrationRecord(records, records.get(identity));
4216
+ let anchor = url.hash.slice(1);
4217
+ try {
4218
+ anchor = decodeURIComponent(anchor);
4219
+ } catch {
4220
+ }
4221
+ const hasBrokenSourceAnchor = Boolean(url.hash && destination?.outcome === "imported" && destination.evidence && !destination.evidence.anchors.includes(anchor));
4222
+ return `${route}${hasBrokenSourceAnchor ? "" : url.hash}`;
4214
4223
  }) }] : []);
4215
4224
  const validation = validateUrlMigration(checkpoint, Boolean(options.signal?.aborted));
4216
4225
  validation.issues.push(...navigationIssues);