@thallylabs/migrate 0.2.45 → 0.2.46

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 CHANGED
@@ -8423,6 +8423,19 @@ function staticStringField(source, name, bindings) {
8423
8423
  return void 0;
8424
8424
  }
8425
8425
  }
8426
+ var COPYRIGHT_YEAR = /\$\{\s*new Date\(\)\s*\.\s*getFullYear\(\)\s*\}/g;
8427
+ var COPYRIGHT_TOKEN = /\$\{([^}]*)\}/g;
8428
+ var DOCUSAURUS_CREDIT = /\s*\bBuilt with Docusaurus\b[.!]*/gi;
8429
+ function docusaurusCopyright(source, bindings, unresolved) {
8430
+ const value = source.replace(COPYRIGHT_YEAR, "{year}").replace(COPYRIGHT_TOKEN, (_match, expression) => {
8431
+ const reference = expression.trim();
8432
+ const resolved = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(reference) ? bindings.get(reference) : void 0;
8433
+ if (resolved !== void 0) return resolved;
8434
+ unresolved.push(reference);
8435
+ return "";
8436
+ }).replace(DOCUSAURUS_CREDIT, "").replace(/[ \t]{2,}/g, " ").replace(/\s+([.,;!?])/g, "$1").trim();
8437
+ return value || void 0;
8438
+ }
8426
8439
  function readDocusaurusSiteSettings(repositoryRoot) {
8427
8440
  const empty2 = { docsRouteBasePath: "docs", defaultColorMode: "light", navbarLinks: [], footerLinks: [] };
8428
8441
  const configPath = findDocusaurusConfigPath(repositoryRoot);
@@ -8469,7 +8482,10 @@ function readDocusaurusSiteSettings(repositoryRoot) {
8469
8482
  });
8470
8483
  return items.length > 0 ? [{ heading, items }] : [];
8471
8484
  }) : [];
8472
- const copyright = footer && propertyStart(footer, "copyright") >= 0 ? staticStringField(footer, "copyright") ?? footer.slice(propertyStart(footer, "copyright")).match(/^`([^`]+)`/)?.[1]?.replace(/\$\{new Date\(\)\.getFullYear\(\)\}/g, "{year}") : void 0;
8485
+ const copyrightStart = footer ? propertyStart(footer, "copyright") : -1;
8486
+ const copyrightSource = copyrightStart < 0 ? void 0 : staticStringField(footer, "copyright", bindings) ?? footer.slice(copyrightStart).match(/^`([^`]+)`/)?.[1];
8487
+ const unresolvedCopyright = [];
8488
+ const copyright = copyrightSource === void 0 ? void 0 : docusaurusCopyright(copyrightSource, bindings, unresolvedCopyright);
8473
8489
  const announcementStart = theme ? propertyStart(theme, "announcementBar") : -1;
8474
8490
  const announcement = announcementStart < 0 ? null : matchingObjectLiteral(theme, announcementStart);
8475
8491
  const announcementContent = announcement && staticStringField(announcement, "content") || announcement?.slice(propertyStart(announcement, "content")).match(/^`([^`]+)`/)?.[1];
@@ -8487,6 +8503,7 @@ function readDocusaurusSiteSettings(repositoryRoot) {
8487
8503
  ...description ? { description } : {},
8488
8504
  ...navbarTitle ? { navbarTitle } : {},
8489
8505
  ...unresolvedIdentity.length > 0 ? { unresolvedIdentity } : {},
8506
+ ...unresolvedCopyright.length > 0 ? { unresolvedCopyright } : {},
8490
8507
  defaultColorMode,
8491
8508
  docsRouteBasePath,
8492
8509
  ...logo && staticStringField(logo, "src", bindings) ? {
@@ -17684,6 +17701,12 @@ ${reasons.map((reason) => `- ${reason}`).join("\n")}` : "No importable Markdown
17684
17701
  message: `The Docusaurus ${DOCUSAURUS_IDENTITY_LABELS[field]} could not be read without running the config and was left out of the migration.${fallback} Use a string literal, or plain data in an imported module, to import it.`
17685
17702
  });
17686
17703
  }
17704
+ for (const token of docusaurusSettings.unresolvedCopyright ?? []) {
17705
+ warnings.push({
17706
+ code: "unsupported-config",
17707
+ message: `The Docusaurus footer copyright references ${token}, which could not be read without running the config, so the placeholder was removed. Use a literal value, or plain data in an imported module, to import it.`
17708
+ });
17709
+ }
17687
17710
  if (presentation) {
17688
17711
  assets.push({ path: "_thally/source-theme.css", content: Buffer.from(presentation.css) });
17689
17712
  docsConfig = { ...docsConfig, stylesheets: [...docsConfig.stylesheets ?? [], "/_thally/source-theme.css"], ...presentation.headingFont ? { fonts: { ...docsConfig.fonts, heading: { family: presentation.headingFont, weight: ["400", "500", "600", "700"] } } } : {} };