@artinstack/migrator 0.1.12 → 0.1.13

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.
Files changed (32) hide show
  1. package/README.md +2 -1
  2. package/dist/{bundle-CysqqLij.d.ts → bundle-BgoXkWMy.d.ts} +1 -1
  3. package/dist/{chunk-MUFGDYGI.js → chunk-373TTCG7.js} +11 -1
  4. package/dist/chunk-373TTCG7.js.map +1 -0
  5. package/dist/{chunk-J7EUSPEA.js → chunk-4XZK55RW.js} +172 -2
  6. package/dist/chunk-4XZK55RW.js.map +1 -0
  7. package/dist/{chunk-Q44KGFIH.js → chunk-53VXTXGM.js} +74 -5
  8. package/dist/chunk-53VXTXGM.js.map +1 -0
  9. package/dist/{chunk-VRRYN6NS.js → chunk-5TRCJONX.js} +3 -3
  10. package/dist/{chunk-QFJXNEXG.js → chunk-HUSXCKPI.js} +4 -2
  11. package/dist/{chunk-QFJXNEXG.js.map → chunk-HUSXCKPI.js.map} +1 -1
  12. package/dist/{chunk-PFUXPS7A.js → chunk-PD5AZX3B.js} +1 -1
  13. package/dist/chunk-PD5AZX3B.js.map +1 -0
  14. package/dist/{chunk-WCAHVNWW.js → chunk-VQ5HKNYP.js} +13 -3
  15. package/dist/chunk-VQ5HKNYP.js.map +1 -0
  16. package/dist/cli/index.js +5 -5
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +7 -7
  19. package/dist/normalizer/index.d.ts +100 -4
  20. package/dist/normalizer/index.js +2 -2
  21. package/dist/sinks/index.d.ts +2 -2
  22. package/dist/sinks/index.js +3 -3
  23. package/dist/transformers/index.d.ts +1 -1
  24. package/dist/transformers/index.js +3 -3
  25. package/dist/{types-CLNmloya.d.ts → types-Bicgdp4Z.d.ts} +13 -1
  26. package/package.json +1 -1
  27. package/dist/chunk-J7EUSPEA.js.map +0 -1
  28. package/dist/chunk-MUFGDYGI.js.map +0 -1
  29. package/dist/chunk-PFUXPS7A.js.map +0 -1
  30. package/dist/chunk-Q44KGFIH.js.map +0 -1
  31. package/dist/chunk-WCAHVNWW.js.map +0 -1
  32. /package/dist/{chunk-VRRYN6NS.js.map → chunk-5TRCJONX.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/transformers/rewrite-inline-images.ts","../src/parsers/wordpress/builders/registry.ts"],"sourcesContent":["import * as cheerio from \"cheerio\";\n\nimport {\n buildMigrationMediaUrlIndex,\n createMigrationMediaRefReplaceWith,\n isMigrationMediaRef,\n normalizeAssetUrl,\n resolveMigrationMediaSourceId,\n type OriginUrlRewriteConfig,\n} from \"../lib/media-urls.js\";\n\nexport interface RewriteInlineImageRef {\n originalSrc: string;\n sourceAssetId?: string;\n}\n\nexport interface UploadedAssetRef {\n targetId: string;\n publicUrl?: string;\n}\n\nexport interface RewriteInlineImagesOptions {\n resolveAsset: (src: string) => RewriteInlineImageRef | undefined;\n /**\n * Replace a resolved source id with a migration ref or CDN URL.\n * When omitted, defaults to OSS-14 `artinstack-migration://asset/…` refs.\n */\n replaceWith?: (ref: RewriteInlineImageRef, uploaded?: UploadedAssetRef) => string;\n /**\n * When true, skip URLs that cannot be matched to an uploaded vault target.\n * Default: false when using migration refs; true when a custom `replaceWith` is supplied.\n */\n requireUploaded?: boolean;\n}\n\nexport interface RewriteInlineImagesResult {\n html: string;\n referencedSources: string[];\n unresolved: string[];\n}\n\n/** Inline CSS `background` / `background-image: url(…)` (quoted or bare). */\nconst BACKGROUND_IMAGE_URL_PATTERN =\n /background(?:-image)?\\s*:[^;]*?url\\s*\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)/gi;\n\nfunction resolveRewriteOptions(\n options: RewriteInlineImagesOptions,\n): Required<Pick<RewriteInlineImagesOptions, \"replaceWith\" | \"requireUploaded\">> {\n const replaceWith = options.replaceWith ?? createMigrationMediaRefReplaceWith();\n const requireUploaded = options.requireUploaded ?? Boolean(options.replaceWith);\n return { replaceWith, requireUploaded };\n}\n\nfunction tryRewriteUrl(\n src: string,\n options: RewriteInlineImagesOptions,\n uploadedBySourceId: Map<string, UploadedAssetRef>,\n referencedSources: Set<string>,\n unresolved: Set<string>,\n): string | undefined {\n const normalized = normalizeAssetUrl(src);\n if (!normalized) return undefined;\n\n if (isMigrationMediaRef(normalized)) {\n referencedSources.add(normalized);\n return normalized;\n }\n\n referencedSources.add(normalized);\n const ref = options.resolveAsset(normalized);\n if (!ref?.sourceAssetId) {\n unresolved.add(normalized);\n return undefined;\n }\n\n const { replaceWith, requireUploaded } = resolveRewriteOptions(options);\n const uploaded = uploadedBySourceId.get(ref.sourceAssetId);\n if (requireUploaded && !uploaded) {\n unresolved.add(normalized);\n return undefined;\n }\n\n return replaceWith(ref, uploaded);\n}\n\nfunction rewriteBackgroundUrlsInStyle(\n style: string,\n options: RewriteInlineImagesOptions,\n uploadedBySourceId: Map<string, UploadedAssetRef>,\n referencedSources: Set<string>,\n unresolved: Set<string>,\n): string {\n return style.replace(BACKGROUND_IMAGE_URL_PATTERN, (full, quote: string, rawUrl: string) => {\n const replaced = tryRewriteUrl(rawUrl.trim(), options, uploadedBySourceId, referencedSources, unresolved);\n if (!replaced) return full;\n\n const urlCall = quote\n ? `url(${quote}${replaced}${quote})`\n : `url(${replaced})`;\n return full.replace(/url\\s*\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)/i, urlCall);\n });\n}\n\nfunction rewriteSrcset(\n srcset: string,\n options: RewriteInlineImagesOptions,\n uploadedBySourceId: Map<string, UploadedAssetRef>,\n referencedSources: Set<string>,\n unresolved: Set<string>,\n): string {\n return srcset\n .split(\",\")\n .map((entry) => {\n const trimmed = entry.trim();\n if (!trimmed) return entry;\n const [urlPart, descriptor] = trimmed.split(/\\s+/, 2);\n const replaced = tryRewriteUrl(urlPart ?? \"\", options, uploadedBySourceId, referencedSources, unresolved);\n if (!replaced) return entry;\n return descriptor ? `${replaced} ${descriptor}` : replaced;\n })\n .join(\", \");\n}\n\n/** Rewrite `<img src>` / `srcset`, `data-bg-image`, and inline CSS backgrounds using uploaded asset targets. */\nexport function rewriteInlineImages(\n html: string,\n options: RewriteInlineImagesOptions,\n uploadedBySourceId: Map<string, UploadedAssetRef>,\n): RewriteInlineImagesResult {\n if (!html.trim()) {\n return { html, referencedSources: [], unresolved: [] };\n }\n\n const $ = cheerio.load(html, { xml: false });\n const referencedSources = new Set<string>();\n const unresolved = new Set<string>();\n\n $(\"img\").each((_, element) => {\n const img = $(element);\n const src = img.attr(\"src\")?.trim();\n if (src && !src.startsWith(\"data:\")) {\n const replaced = tryRewriteUrl(src, options, uploadedBySourceId, referencedSources, unresolved);\n if (replaced) img.attr(\"src\", replaced);\n }\n\n const srcset = img.attr(\"srcset\")?.trim();\n if (srcset) {\n img.attr(\"srcset\", rewriteSrcset(srcset, options, uploadedBySourceId, referencedSources, unresolved));\n }\n });\n\n $(\"[data-bg-image]\").each((_, element) => {\n const node = $(element);\n const bgImage = node.attr(\"data-bg-image\")?.trim();\n if (!bgImage || bgImage.startsWith(\"data:\")) return;\n const replaced = tryRewriteUrl(bgImage, options, uploadedBySourceId, referencedSources, unresolved);\n if (replaced) node.attr(\"data-bg-image\", replaced);\n });\n\n $(\"[style]\").each((_, element) => {\n const node = $(element);\n const style = node.attr(\"style\");\n if (!style?.includes(\"background\")) return;\n const rewritten = rewriteBackgroundUrlsInStyle(\n style,\n options,\n uploadedBySourceId,\n referencedSources,\n unresolved,\n );\n if (rewritten !== style) node.attr(\"style\", rewritten);\n });\n\n return {\n html: $.root().html() ?? html,\n referencedSources: [...referencedSources],\n unresolved: [...unresolved],\n };\n}\n\nexport interface StampMigrationMediaRefsOptions {\n /** Pre-built url/pathname → sourceId map (from attachments + inline assets). */\n urlToSourceId: Map<string, string>;\n /** Canonicalize lookup keys during stamp (OSS-15). */\n originUrlRewrite?: OriginUrlRewriteConfig;\n replaceWith?: RewriteInlineImagesOptions[\"replaceWith\"];\n requireUploaded?: boolean;\n}\n\n/**\n * OSS-14 — replace resolved `wp-content/uploads` URLs with `artinstack-migration://asset/…`\n * refs. Does not invent refs for unknown URLs (left unchanged + listed in `unresolved`).\n */\nexport function stampMigrationMediaRefs(\n html: string,\n options: StampMigrationMediaRefsOptions,\n): RewriteInlineImagesResult {\n return rewriteInlineImages(\n html,\n {\n resolveAsset: (src) => {\n const sourceAssetId = resolveMigrationMediaSourceId(\n src,\n options.urlToSourceId,\n options.originUrlRewrite,\n );\n if (!sourceAssetId) return undefined;\n return { originalSrc: src, sourceAssetId };\n },\n replaceWith: options.replaceWith,\n requireUploaded: options.requireUploaded ?? false,\n },\n new Map(),\n );\n}\n\n/** Build a url index from attachment rows and/or normalized assets. */\nexport { buildMigrationMediaUrlIndex };\n","export type BuilderHtmlTag = \"img\" | \"video\" | \"iframe\";\nexport type TextHtmlTag = \"p\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\n/** Bucket 1 — shortcodes with asset URL params → standard HTML. */\nexport interface BuilderUrlRule {\n shortcodePrefix: string;\n urlParams: string[];\n tag: BuilderHtmlTag;\n}\n\n/** Bucket 1 — shortcodes with text params → semantic HTML. */\nexport interface BuilderTextRule {\n shortcodePrefix: string;\n fields: { param: string; tag: TextHtmlTag }[];\n}\n\n/** Bucket 1 — shortcodes with inner HTML (+ optional image param). */\nexport interface BuilderWrapperRule {\n shortcodePrefix: string;\n urlParams?: string[];\n}\n\n/** Bucket 1 — image-based icon modules (`icon_image` param) → linked `<img>`. */\nexport interface BuilderIconImageRule {\n shortcodePrefix: string;\n imageParam: string;\n hrefParam?: string;\n}\n\n/** Bucket 1 — dynamic embeds replaced with a static migration placeholder. */\nexport interface BuilderPlaceholderRule {\n shortcodePrefix: string;\n html: string;\n}\n\n/** Profile A — prefixed namespace tokens (Tatsu, Divi, WPBakery, …). */\nexport interface PrefixedLayoutMap {\n kind: \"prefixed\";\n sectionRegex: RegExp;\n sectionCloseRegex: RegExp;\n rowRegex: RegExp;\n rowCloseRegex: RegExp;\n columnRegex: RegExp;\n columnCloseRegex: RegExp;\n bgParamName?: string;\n colsParamName?: string;\n}\n\n/** Profile B — legacy Blox fractional column tokens (`one_third`, `one_half`, …). */\nexport interface FractionalLayoutMap {\n kind: \"fractional\";\n sectionRegex: RegExp;\n sectionCloseRegex: RegExp;\n rowRegex: RegExp;\n rowCloseRegex: RegExp;\n columnTokens: string[];\n columnOpenRegexes: RegExp[];\n columnCloseRegexes: RegExp[];\n columnWidths: Record<string, string>;\n bgParamName?: string;\n}\n\n/** Profile C — multiple tokens per layout role (Blox prefixed, WPBakery inner columns, …). */\nexport interface ExtendedPrefixedLayoutLevel {\n role: \"section\" | \"row\" | \"column\";\n tokens: string[];\n bgParamName?: string;\n colsParamName?: string;\n widthParamName?: string;\n}\n\nexport interface ExtendedPrefixedLayoutMap {\n kind: \"extended-prefixed\";\n levels: ExtendedPrefixedLayoutLevel[];\n}\n\nexport type StructuralLayoutMap =\n | PrefixedLayoutMap\n | FractionalLayoutMap\n | ExtendedPrefixedLayoutMap;\n\nfunction layoutEscapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction shortcodeOpenRegex(token: string): RegExp {\n return new RegExp(`\\\\[${layoutEscapeRegExp(token)}\\\\b([^\\\\]]*)\\\\]`, \"gi\");\n}\n\nfunction shortcodeCloseRegex(token: string): RegExp {\n return new RegExp(`\\\\[\\\\/${layoutEscapeRegExp(token)}\\\\b[^\\\\]]*\\\\]`, \"gi\");\n}\n\nconst FRACTIONAL_COLUMN_WIDTHS: Record<string, string> = {\n one_col: \"100%\",\n one_half: \"50%\",\n one_third: \"33.33%\",\n two_third: \"66.67%\",\n two_thirds: \"66.67%\",\n one_fourth: \"25%\",\n three_fourth: \"75%\",\n three_fourths: \"75%\",\n};\n\nexport function parseFractionalColumnWidth(token: string): string | undefined {\n return FRACTIONAL_COLUMN_WIDTHS[token];\n}\n\n/** Profile A — section/row/column share a static namespace prefix. */\nexport function prefixedLayoutMap(config: {\n section: string;\n row: string;\n column: string;\n bgParamName?: string;\n colsParamName?: string;\n}): PrefixedLayoutMap {\n return {\n kind: \"prefixed\",\n sectionRegex: shortcodeOpenRegex(config.section),\n sectionCloseRegex: shortcodeCloseRegex(config.section),\n rowRegex: shortcodeOpenRegex(config.row),\n rowCloseRegex: shortcodeCloseRegex(config.row),\n columnRegex: shortcodeOpenRegex(config.column),\n columnCloseRegex: shortcodeCloseRegex(config.column),\n bgParamName: config.bgParamName,\n colsParamName: config.colsParamName,\n };\n}\n\n/** Profile B — legacy Blox/Oshine mathematical column shortcodes. */\n/** Profile C — map several shortcode names per section/row/column role (longest token first). */\nexport function extendedPrefixedLayoutMap(\n levels: ExtendedPrefixedLayoutLevel[],\n): ExtendedPrefixedLayoutMap {\n return { kind: \"extended-prefixed\", levels };\n}\n\nexport function fractionalLayoutMap(config: {\n section: string;\n row: string;\n columns: string[];\n bgParamName?: string;\n}): FractionalLayoutMap {\n const columnWidths: Record<string, string> = {};\n for (const token of config.columns) {\n const width = parseFractionalColumnWidth(token);\n if (width) columnWidths[token] = width;\n }\n\n return {\n kind: \"fractional\",\n sectionRegex: shortcodeOpenRegex(config.section),\n sectionCloseRegex: shortcodeCloseRegex(config.section),\n rowRegex: shortcodeOpenRegex(config.row),\n rowCloseRegex: shortcodeCloseRegex(config.row),\n columnTokens: config.columns,\n columnOpenRegexes: config.columns.map(shortcodeOpenRegex),\n columnCloseRegexes: config.columns.map(shortcodeCloseRegex),\n columnWidths,\n bgParamName: config.bgParamName,\n };\n}\n\n/** Per builder-family registry entry — declarative map executed by the flatten engine. */\nexport interface BuilderThemeConfig {\n id: string;\n detect: RegExp;\n layoutMap?: StructuralLayoutMap;\n /** Additional layout maps applied after `layoutMap` (e.g. Blox prefixed + legacy fractional). */\n layoutMaps?: StructuralLayoutMap[];\n urlRules?: BuilderUrlRule[];\n textRules?: BuilderTextRule[];\n wrapperRules?: BuilderWrapperRule[];\n iconImageRules?: BuilderIconImageRule[];\n placeholderRules?: BuilderPlaceholderRule[];\n scaffoldingPrefixes?: string[];\n legacyScaffoldingTokens?: string[];\n}\n\n/** @deprecated Alias — families not themes. */\nexport type BuilderFamilyConfig = BuilderThemeConfig;\n\n// ---------------------------------------------------------------------------\n// Widget registry (OSS-12 / OSS-16) — cross-builder; not BuilderThemeConfig\n// ---------------------------------------------------------------------------\n\n/** Keeps empty widget stubs from collapsing during cheerio text sweeps. */\nexport const WP_WIDGET_PLACEHOLDER = \"\\u200B\";\n\nexport interface WordPressContactFormWidgetRule {\n /** Shortcode tag name (e.g. `contact-form-7`). */\n tag: string;\n /** Value for `data-wp-form-source`. */\n source: string;\n /** Attribute holding the form id (e.g. `id`). */\n idParam: string;\n}\n\n/** Declarative widget tables consumed by `flattenWordPressWidgets()` in flatten.ts. */\nexport interface WordPressWidgetRegistry {\n mapShortcodePrefixes: readonly string[];\n contactFormRules: readonly WordPressContactFormWidgetRule[];\n videoShortcodePrefixes: readonly string[];\n /** Core / plugin portfolio dynamic shortcode tag. */\n portfolioShortcode: string;\n /** Builder blog roll modules (Tatsu/Oshine `[blog]`, etc.). */\n blogShortcodeTags: readonly string[];\n /** WordPress core gallery shortcode tag (`ids=` split handled in engine). */\n galleryShortcode: string;\n /** Builder/plugin gallery shortcodes with explicit `ids=` attachment lists (OSS-12). */\n idGalleryShortcodes: readonly string[];\n}\n\nexport const WORDPRESS_WIDGET_REGISTRY: WordPressWidgetRegistry = {\n mapShortcodePrefixes: [\n \"blox_gmap\",\n \"tatsu_gmap\",\n \"tatsu_map\",\n \"et_pb_map\",\n \"vc_gmaps\",\n \"vc_map\",\n ],\n contactFormRules: [\n { tag: \"contact-form-7\", source: \"contact-form-7\", idParam: \"id\" },\n { tag: \"contact_form\", source: \"contact-form-7\", idParam: \"id\" },\n { tag: \"gravityform\", source: \"gravityforms\", idParam: \"id\" },\n { tag: \"ninja_form\", source: \"ninja-forms\", idParam: \"id\" },\n { tag: \"wpforms\", source: \"wpforms\", idParam: \"id\" },\n ],\n videoShortcodePrefixes: [\n \"youtube\",\n \"vimeo\",\n \"embed\",\n \"tatsu_video\",\n \"et_pb_video\",\n \"vc_video\",\n ],\n portfolioShortcode: \"portfolio\",\n blogShortcodeTags: [\"blog\", \"recent_posts\"],\n galleryShortcode: \"gallery\",\n idGalleryShortcodes: [\"oshine_gallery\", \"vc_gallery\", \"nggallery\"],\n};\n\n/** Shortcodes that cannot become static HTML — reported in conflicts, never stripped. */\nexport const UNRESOLVABLE_SHORTCODE_PREFIXES = [\n \"woocommerce_cart\",\n \"woocommerce_checkout\",\n \"woocommerce_my_account\",\n] as const;\n\nexport const WORDPRESS_BUILDER_REGISTRY: BuilderThemeConfig[] = [\n {\n id: \"tatsu\",\n detect: /\\[(?:\\/)?tatsu_/i,\n layoutMap: prefixedLayoutMap({\n section: \"tatsu_section\",\n row: \"tatsu_row\",\n column: \"tatsu_column\",\n bgParamName: \"bg_image\",\n colsParamName: \"layout\",\n }),\n wrapperRules: [\n { shortcodePrefix: \"tatsu_text\" },\n { shortcodePrefix: \"tatsu_inline_text\" },\n { shortcodePrefix: \"tatsu_text_with_shortcodes\" },\n { shortcodePrefix: \"tatsu_icon_group\" },\n ],\n urlRules: [\n { shortcodePrefix: \"tatsu_image\", urlParams: [\"image\", \"url\", \"src\"], tag: \"img\" },\n { shortcodePrefix: \"tatsu_single_image\", urlParams: [\"image\", \"url\", \"src\"], tag: \"img\" },\n ],\n iconImageRules: [\n { shortcodePrefix: \"tatsu_icon\", imageParam: \"icon_image\", hrefParam: \"href\" },\n ],\n scaffoldingPrefixes: [\"tatsu_\"],\n },\n {\n id: \"divi\",\n detect: /\\[(?:\\/)?et_pb_/i,\n layoutMap: prefixedLayoutMap({\n section: \"et_pb_section\",\n row: \"et_pb_row\",\n column: \"et_pb_column\",\n bgParamName: \"background_image\",\n }),\n urlRules: [{ shortcodePrefix: \"et_pb_image\", urlParams: [\"src\", \"url\"], tag: \"img\" }],\n scaffoldingPrefixes: [\"et_pb_\"],\n },\n {\n id: \"wpbakery\",\n detect: /\\[(?:\\/)?vc_/i,\n layoutMap: extendedPrefixedLayoutMap([\n { role: \"section\", tokens: [\"vc_section\"], bgParamName: \"bg_image\" },\n { role: \"row\", tokens: [\"vc_row\"], colsParamName: \"layout\" },\n { role: \"column\", tokens: [\"vc_column_inner\", \"vc_column\"], widthParamName: \"width\" },\n ]),\n urlRules: [\n { shortcodePrefix: \"vc_single_image\", urlParams: [\"image\", \"src\", \"url\"], tag: \"img\" },\n ],\n scaffoldingPrefixes: [\"vc_\"],\n },\n {\n id: \"fusion\",\n detect: /\\[(?:\\/)?fusion_/i,\n layoutMap: prefixedLayoutMap({\n section: \"fusion_builder_container\",\n row: \"fusion_builder_row\",\n column: \"fusion_builder_column\",\n bgParamName: \"background_image\",\n }),\n scaffoldingPrefixes: [\"fusion_\"],\n },\n {\n id: \"beaver\",\n detect: /\\[(?:\\/)?fl_(?:row|col|builder)/i,\n layoutMap: extendedPrefixedLayoutMap([\n { role: \"row\", tokens: [\"fl_row\"] },\n { role: \"column\", tokens: [\"fl_col\"] },\n ]),\n scaffoldingPrefixes: [\"fl_\"],\n },\n {\n id: \"elementor\",\n detect: /\\[(?:\\/)?elementor[-_]/i,\n urlRules: [\n { shortcodePrefix: \"elementor-widget\", urlParams: [\"url\", \"src\", \"image\"], tag: \"img\" },\n ],\n scaffoldingPrefixes: [\"elementor_\"],\n },\n {\n id: \"oshine\",\n detect:\n /\\[(?:special_sub_title|special_heading5|blox_\\w+|grid_content|grids|testimonial\\b|portfolio\\b|recent_posts\\b|animate_icon\\w*|section\\b|row\\b|one_col|one_third|one_half|one_fourth|two_third|three_fourth|text\\b)/i,\n layoutMap: fractionalLayoutMap({\n section: \"section\",\n row: \"row\",\n columns: [\n \"one_col\",\n \"one_third\",\n \"two_third\",\n \"two_thirds\",\n \"one_half\",\n \"one_fourth\",\n \"three_fourth\",\n \"three_fourths\",\n ],\n bgParamName: \"bg_image\",\n }),\n layoutMaps: [\n extendedPrefixedLayoutMap([\n { role: \"section\", tokens: [\"blox_row\"], bgParamName: \"bg_image\" },\n { role: \"row\", tokens: [\"blox_row_inner\"], colsParamName: \"columns\" },\n {\n role: \"column\",\n tokens: [\"blox_column_inner\", \"blox_column\"],\n widthParamName: \"width\",\n },\n ]),\n ],\n textRules: [\n {\n shortcodePrefix: \"special_sub_title\",\n fields: [{ param: \"title_content\", tag: \"p\" }],\n },\n {\n shortcodePrefix: \"special_heading5\",\n fields: [\n { param: \"title_content\", tag: \"h2\" },\n { param: \"caption_content\", tag: \"h4\" },\n ],\n },\n ],\n wrapperRules: [\n { shortcodePrefix: \"grid_content\" },\n { shortcodePrefix: \"testimonial\", urlParams: [\"author_image\"] },\n { shortcodePrefix: \"blox_text\" },\n ],\n urlRules: [\n { shortcodePrefix: \"blox_image\", urlParams: [\"image\", \"img\", \"src\", \"url\"], tag: \"img\" },\n ],\n scaffoldingPrefixes: [\"blox_\", \"animate_icon\"],\n legacyScaffoldingTokens: [\"text\", \"icon\", \"linebreak\", \"grids\", \"testimonials\"],\n },\n];\n\n/** @deprecated Use urlRules on BuilderThemeConfig — kept for type migration clarity. */\nexport type BuilderContentRule = BuilderUrlRule;\n"],"mappings":";;;;;;;;AAAA,YAAY,aAAa;AA0CzB,IAAM,+BACJ;AAEF,SAAS,sBACP,SAC+E;AAC/E,QAAM,cAAc,QAAQ,eAAe,mCAAmC;AAC9E,QAAM,kBAAkB,QAAQ,mBAAmB,QAAQ,QAAQ,WAAW;AAC9E,SAAO,EAAE,aAAa,gBAAgB;AACxC;AAEA,SAAS,cACP,KACA,SACA,oBACA,mBACA,YACoB;AACpB,QAAM,aAAa,kBAAkB,GAAG;AACxC,MAAI,CAAC,WAAY,QAAO;AAExB,MAAI,oBAAoB,UAAU,GAAG;AACnC,sBAAkB,IAAI,UAAU;AAChC,WAAO;AAAA,EACT;AAEA,oBAAkB,IAAI,UAAU;AAChC,QAAM,MAAM,QAAQ,aAAa,UAAU;AAC3C,MAAI,CAAC,KAAK,eAAe;AACvB,eAAW,IAAI,UAAU;AACzB,WAAO;AAAA,EACT;AAE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AC;AAAA,IACD,YAAY;AAAA,MACV,0BAA0B;AAAA,QACxB,EAAE,MAAM,WAAW,QAAQ,CAAC,UAAU,GAAG,aAAa,WAAW;AAAA,QACjE,EAAE,MAAM,OAAO,QAAQ,CAAC,gBAAgB,GAAG,eAAe,UAAU;AAAA,QACpE;AAAA,UACE,MAAM;AAAA,UACN,QAAQ,CAAC,qBAAqB,aAAa;AAAA,UAC3C,gBAAgB;AAAA,QAClB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,WAAW;AAAA,MACT;AAAA,QACE,iBAAiB;AAAA,QACjB,QAAQ,CAAC,EAAE,OAAO,iBAAiB,KAAK,IAAI,CAAC;AAAA,MAC/C;AAAA,MACA;AAAA,QACE,iBAAiB;AAAA,QACjB,QAAQ;AAAA,UACN,EAAE,OAAO,iBAAiB,KAAK,KAAK;AAAA,UACpC,EAAE,OAAO,mBAAmB,KAAK,KAAK;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ,EAAE,iBAAiB,eAAe;AAAA,MAClC,EAAE,iBAAiB,eAAe,WAAW,CAAC,cAAc,EAAE;AAAA,MAC9D,EAAE,iBAAiB,YAAY;AAAA,IACjC;AAAA,IACA,UAAU;AAAA,MACR,EAAE,iBAAiB,cAAc,WAAW,CAAC,SAAS,OAAO,OAAO,KAAK,GAAG,KAAK,MAAM;AAAA,IACzF;AAAA,IACA,qBAAqB,CAAC,SAAS,cAAc;AAAA,IAC7C,yBAAyB,CAAC,QAAQ,QAAQ,aAAa,SAAS,cAAc;AAAA,EAChF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/transformers/rewrite-inline-images.ts","../src/parsers/wordpress/builders/registry.ts"],"sourcesContent":["import * as cheerio from \"cheerio\";\n\nimport {\n buildMigrationMediaUrlIndex,\n createMigrationMediaRefReplaceWith,\n isMigrationMediaRef,\n normalizeAssetUrl,\n resolveMigrationMediaSourceId,\n type OriginUrlRewriteConfig,\n} from \"../lib/media-urls.js\";\n\nexport interface RewriteInlineImageRef {\n originalSrc: string;\n sourceAssetId?: string;\n}\n\nexport interface UploadedAssetRef {\n targetId: string;\n publicUrl?: string;\n}\n\nexport interface RewriteInlineImagesOptions {\n resolveAsset: (src: string) => RewriteInlineImageRef | undefined;\n /**\n * Replace a resolved source id with a migration ref or CDN URL.\n * When omitted, defaults to OSS-14 `artinstack-migration://asset/…` refs.\n */\n replaceWith?: (ref: RewriteInlineImageRef, uploaded?: UploadedAssetRef) => string;\n /**\n * When true, skip URLs that cannot be matched to an uploaded vault target.\n * Default: false when using migration refs; true when a custom `replaceWith` is supplied.\n */\n requireUploaded?: boolean;\n}\n\nexport interface RewriteInlineImagesResult {\n html: string;\n referencedSources: string[];\n unresolved: string[];\n}\n\n/** Inline CSS `background` / `background-image: url(…)` (quoted or bare). */\nconst BACKGROUND_IMAGE_URL_PATTERN =\n /background(?:-image)?\\s*:[^;]*?url\\s*\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)/gi;\n\nfunction resolveRewriteOptions(\n options: RewriteInlineImagesOptions,\n): Required<Pick<RewriteInlineImagesOptions, \"replaceWith\" | \"requireUploaded\">> {\n const replaceWith = options.replaceWith ?? createMigrationMediaRefReplaceWith();\n const requireUploaded = options.requireUploaded ?? Boolean(options.replaceWith);\n return { replaceWith, requireUploaded };\n}\n\nfunction tryRewriteUrl(\n src: string,\n options: RewriteInlineImagesOptions,\n uploadedBySourceId: Map<string, UploadedAssetRef>,\n referencedSources: Set<string>,\n unresolved: Set<string>,\n): string | undefined {\n const normalized = normalizeAssetUrl(src);\n if (!normalized) return undefined;\n\n if (isMigrationMediaRef(normalized)) {\n referencedSources.add(normalized);\n return normalized;\n }\n\n referencedSources.add(normalized);\n const ref = options.resolveAsset(normalized);\n if (!ref?.sourceAssetId) {\n unresolved.add(normalized);\n return undefined;\n }\n\n const { replaceWith, requireUploaded } = resolveRewriteOptions(options);\n const uploaded = uploadedBySourceId.get(ref.sourceAssetId);\n if (requireUploaded && !uploaded) {\n unresolved.add(normalized);\n return undefined;\n }\n\n return replaceWith(ref, uploaded);\n}\n\nfunction rewriteBackgroundUrlsInStyle(\n style: string,\n options: RewriteInlineImagesOptions,\n uploadedBySourceId: Map<string, UploadedAssetRef>,\n referencedSources: Set<string>,\n unresolved: Set<string>,\n): string {\n return style.replace(BACKGROUND_IMAGE_URL_PATTERN, (full, quote: string, rawUrl: string) => {\n const replaced = tryRewriteUrl(rawUrl.trim(), options, uploadedBySourceId, referencedSources, unresolved);\n if (!replaced) return full;\n\n const urlCall = quote\n ? `url(${quote}${replaced}${quote})`\n : `url(${replaced})`;\n return full.replace(/url\\s*\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)/i, urlCall);\n });\n}\n\nfunction rewriteSrcset(\n srcset: string,\n options: RewriteInlineImagesOptions,\n uploadedBySourceId: Map<string, UploadedAssetRef>,\n referencedSources: Set<string>,\n unresolved: Set<string>,\n): string {\n return srcset\n .split(\",\")\n .map((entry) => {\n const trimmed = entry.trim();\n if (!trimmed) return entry;\n const [urlPart, descriptor] = trimmed.split(/\\s+/, 2);\n const replaced = tryRewriteUrl(urlPart ?? \"\", options, uploadedBySourceId, referencedSources, unresolved);\n if (!replaced) return entry;\n return descriptor ? `${replaced} ${descriptor}` : replaced;\n })\n .join(\", \");\n}\n\n/** Rewrite `<img src>` / `srcset`, `data-bg-image`, and inline CSS backgrounds using uploaded asset targets. */\nexport function rewriteInlineImages(\n html: string,\n options: RewriteInlineImagesOptions,\n uploadedBySourceId: Map<string, UploadedAssetRef>,\n): RewriteInlineImagesResult {\n if (!html.trim()) {\n return { html, referencedSources: [], unresolved: [] };\n }\n\n const $ = cheerio.load(html, { xml: false });\n const referencedSources = new Set<string>();\n const unresolved = new Set<string>();\n\n $(\"img\").each((_, element) => {\n const img = $(element);\n const src = img.attr(\"src\")?.trim();\n if (src && !src.startsWith(\"data:\")) {\n const replaced = tryRewriteUrl(src, options, uploadedBySourceId, referencedSources, unresolved);\n if (replaced) img.attr(\"src\", replaced);\n }\n\n const srcset = img.attr(\"srcset\")?.trim();\n if (srcset) {\n img.attr(\"srcset\", rewriteSrcset(srcset, options, uploadedBySourceId, referencedSources, unresolved));\n }\n });\n\n $(\"[data-bg-image]\").each((_, element) => {\n const node = $(element);\n const bgImage = node.attr(\"data-bg-image\")?.trim();\n if (!bgImage || bgImage.startsWith(\"data:\")) return;\n const replaced = tryRewriteUrl(bgImage, options, uploadedBySourceId, referencedSources, unresolved);\n if (replaced) node.attr(\"data-bg-image\", replaced);\n });\n\n $(\"[style]\").each((_, element) => {\n const node = $(element);\n const style = node.attr(\"style\");\n if (!style?.includes(\"background\")) return;\n const rewritten = rewriteBackgroundUrlsInStyle(\n style,\n options,\n uploadedBySourceId,\n referencedSources,\n unresolved,\n );\n if (rewritten !== style) node.attr(\"style\", rewritten);\n });\n\n return {\n html: $.root().html() ?? html,\n referencedSources: [...referencedSources],\n unresolved: [...unresolved],\n };\n}\n\nexport interface StampMigrationMediaRefsOptions {\n /** Pre-built url/pathname → sourceId map (from attachments + inline assets). */\n urlToSourceId: Map<string, string>;\n /** Canonicalize lookup keys during stamp (OSS-15). */\n originUrlRewrite?: OriginUrlRewriteConfig;\n replaceWith?: RewriteInlineImagesOptions[\"replaceWith\"];\n requireUploaded?: boolean;\n}\n\n/**\n * OSS-14 — replace resolved `wp-content/uploads` URLs with `artinstack-migration://asset/…`\n * refs. Does not invent refs for unknown URLs (left unchanged + listed in `unresolved`).\n */\nexport function stampMigrationMediaRefs(\n html: string,\n options: StampMigrationMediaRefsOptions,\n): RewriteInlineImagesResult {\n return rewriteInlineImages(\n html,\n {\n resolveAsset: (src) => {\n const sourceAssetId = resolveMigrationMediaSourceId(\n src,\n options.urlToSourceId,\n options.originUrlRewrite,\n );\n if (!sourceAssetId) return undefined;\n return { originalSrc: src, sourceAssetId };\n },\n replaceWith: options.replaceWith,\n requireUploaded: options.requireUploaded ?? false,\n },\n new Map(),\n );\n}\n\n/** Build a url index from attachment rows and/or normalized assets. */\nexport { buildMigrationMediaUrlIndex };\n","export type BuilderHtmlTag = \"img\" | \"video\" | \"iframe\";\nexport type TextHtmlTag = \"p\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\n/** Bucket 1 — shortcodes with asset URL params → standard HTML. */\nexport interface BuilderUrlRule {\n shortcodePrefix: string;\n urlParams: string[];\n tag: BuilderHtmlTag;\n}\n\n/** Bucket 1 — shortcodes with text params → semantic HTML. */\nexport interface BuilderTextRule {\n shortcodePrefix: string;\n fields: { param: string; tag: TextHtmlTag }[];\n}\n\n/** Bucket 1 — shortcodes with inner HTML (+ optional image param). */\nexport interface BuilderWrapperRule {\n shortcodePrefix: string;\n urlParams?: string[];\n}\n\n/** Bucket 1 — image-based icon modules (`icon_image` param) → linked `<img>`. */\nexport interface BuilderIconImageRule {\n shortcodePrefix: string;\n imageParam: string;\n hrefParam?: string;\n}\n\n/** Bucket 1 — dynamic embeds replaced with a static migration placeholder. */\nexport interface BuilderPlaceholderRule {\n shortcodePrefix: string;\n html: string;\n}\n\n/** Profile A — prefixed namespace tokens (Tatsu, Divi, WPBakery, …). */\nexport interface PrefixedLayoutMap {\n kind: \"prefixed\";\n sectionRegex: RegExp;\n sectionCloseRegex: RegExp;\n rowRegex: RegExp;\n rowCloseRegex: RegExp;\n columnRegex: RegExp;\n columnCloseRegex: RegExp;\n bgParamName?: string;\n colsParamName?: string;\n}\n\n/** Profile B — legacy Blox fractional column tokens (`one_third`, `one_half`, …). */\nexport interface FractionalLayoutMap {\n kind: \"fractional\";\n sectionRegex: RegExp;\n sectionCloseRegex: RegExp;\n rowRegex: RegExp;\n rowCloseRegex: RegExp;\n columnTokens: string[];\n columnOpenRegexes: RegExp[];\n columnCloseRegexes: RegExp[];\n columnWidths: Record<string, string>;\n bgParamName?: string;\n}\n\n/** Profile C — multiple tokens per layout role (Blox prefixed, WPBakery inner columns, …). */\nexport interface ExtendedPrefixedLayoutLevel {\n role: \"section\" | \"row\" | \"column\";\n tokens: string[];\n bgParamName?: string;\n colsParamName?: string;\n widthParamName?: string;\n}\n\nexport interface ExtendedPrefixedLayoutMap {\n kind: \"extended-prefixed\";\n levels: ExtendedPrefixedLayoutLevel[];\n}\n\nexport type StructuralLayoutMap =\n | PrefixedLayoutMap\n | FractionalLayoutMap\n | ExtendedPrefixedLayoutMap;\n\nfunction layoutEscapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction shortcodeOpenRegex(token: string): RegExp {\n return new RegExp(`\\\\[${layoutEscapeRegExp(token)}\\\\b([^\\\\]]*)\\\\]`, \"gi\");\n}\n\nfunction shortcodeCloseRegex(token: string): RegExp {\n return new RegExp(`\\\\[\\\\/${layoutEscapeRegExp(token)}\\\\b[^\\\\]]*\\\\]`, \"gi\");\n}\n\nconst FRACTIONAL_COLUMN_WIDTHS: Record<string, string> = {\n one_col: \"100%\",\n one_half: \"50%\",\n one_third: \"33.33%\",\n two_third: \"66.67%\",\n two_thirds: \"66.67%\",\n one_fourth: \"25%\",\n three_fourth: \"75%\",\n three_fourths: \"75%\",\n};\n\nexport function parseFractionalColumnWidth(token: string): string | undefined {\n return FRACTIONAL_COLUMN_WIDTHS[token];\n}\n\n/** Profile A — section/row/column share a static namespace prefix. */\nexport function prefixedLayoutMap(config: {\n section: string;\n row: string;\n column: string;\n bgParamName?: string;\n colsParamName?: string;\n}): PrefixedLayoutMap {\n return {\n kind: \"prefixed\",\n sectionRegex: shortcodeOpenRegex(config.section),\n sectionCloseRegex: shortcodeCloseRegex(config.section),\n rowRegex: shortcodeOpenRegex(config.row),\n rowCloseRegex: shortcodeCloseRegex(config.row),\n columnRegex: shortcodeOpenRegex(config.column),\n columnCloseRegex: shortcodeCloseRegex(config.column),\n bgParamName: config.bgParamName,\n colsParamName: config.colsParamName,\n };\n}\n\n/** Profile B — legacy Blox/Oshine mathematical column shortcodes. */\n/** Profile C — map several shortcode names per section/row/column role (longest token first). */\nexport function extendedPrefixedLayoutMap(\n levels: ExtendedPrefixedLayoutLevel[],\n): ExtendedPrefixedLayoutMap {\n return { kind: \"extended-prefixed\", levels };\n}\n\nexport function fractionalLayoutMap(config: {\n section: string;\n row: string;\n columns: string[];\n bgParamName?: string;\n}): FractionalLayoutMap {\n const columnWidths: Record<string, string> = {};\n for (const token of config.columns) {\n const width = parseFractionalColumnWidth(token);\n if (width) columnWidths[token] = width;\n }\n\n return {\n kind: \"fractional\",\n sectionRegex: shortcodeOpenRegex(config.section),\n sectionCloseRegex: shortcodeCloseRegex(config.section),\n rowRegex: shortcodeOpenRegex(config.row),\n rowCloseRegex: shortcodeCloseRegex(config.row),\n columnTokens: config.columns,\n columnOpenRegexes: config.columns.map(shortcodeOpenRegex),\n columnCloseRegexes: config.columns.map(shortcodeCloseRegex),\n columnWidths,\n bgParamName: config.bgParamName,\n };\n}\n\n/** Per builder-family registry entry — declarative map executed by the flatten engine. */\nexport interface BuilderThemeConfig {\n id: string;\n detect: RegExp;\n layoutMap?: StructuralLayoutMap;\n /** Additional layout maps applied after `layoutMap` (e.g. Blox prefixed + legacy fractional). */\n layoutMaps?: StructuralLayoutMap[];\n urlRules?: BuilderUrlRule[];\n textRules?: BuilderTextRule[];\n wrapperRules?: BuilderWrapperRule[];\n iconImageRules?: BuilderIconImageRule[];\n placeholderRules?: BuilderPlaceholderRule[];\n scaffoldingPrefixes?: string[];\n legacyScaffoldingTokens?: string[];\n}\n\n/** @deprecated Alias — families not themes. */\nexport type BuilderFamilyConfig = BuilderThemeConfig;\n\n// ---------------------------------------------------------------------------\n// Widget registry (OSS-12 / OSS-16) — cross-builder; not BuilderThemeConfig\n// ---------------------------------------------------------------------------\n\n/** Keeps empty widget stubs from collapsing during cheerio text sweeps. */\nexport const WP_WIDGET_PLACEHOLDER = \"\\u200B\";\n\nexport interface WordPressContactFormWidgetRule {\n /** Shortcode tag name (e.g. `contact-form-7`). */\n tag: string;\n /** Value for `data-wp-form-source`. */\n source: string;\n /** Attribute holding the form id (e.g. `id`). */\n idParam: string;\n}\n\n/** Declarative widget tables consumed by `flattenWordPressWidgets()` in flatten.ts. */\nexport interface WordPressWidgetRegistry {\n mapShortcodePrefixes: readonly string[];\n contactFormRules: readonly WordPressContactFormWidgetRule[];\n videoShortcodePrefixes: readonly string[];\n /** Core / plugin portfolio dynamic shortcode tag. */\n portfolioShortcode: string;\n /** Builder blog roll modules (Tatsu/Oshine `[blog]`, etc.). */\n blogShortcodeTags: readonly string[];\n /** Testimonials carousel/list wrapper shortcodes (Oshine `[testimonials]`, etc.). */\n testimonialsWrapperTags: readonly string[];\n /** Inner testimonial item shortcode tag. */\n testimonialItemTag: string;\n /** In-body RevSlider / MasterSlider shortcodes → slider widget stub (alias only). */\n sliderShortcodeTags: readonly string[];\n /** WordPress core gallery shortcode tag (`ids=` split handled in engine). */\n galleryShortcode: string;\n /** Builder/plugin gallery shortcodes with explicit `ids=` attachment lists (OSS-12). */\n idGalleryShortcodes: readonly string[];\n}\n\nexport const WORDPRESS_WIDGET_REGISTRY: WordPressWidgetRegistry = {\n mapShortcodePrefixes: [\n \"blox_gmap\",\n \"tatsu_gmap\",\n \"tatsu_map\",\n \"et_pb_map\",\n \"vc_gmaps\",\n \"vc_map\",\n ],\n contactFormRules: [\n { tag: \"contact-form-7\", source: \"contact-form-7\", idParam: \"id\" },\n { tag: \"contact_form\", source: \"contact-form-7\", idParam: \"id\" },\n { tag: \"gravityform\", source: \"gravityforms\", idParam: \"id\" },\n { tag: \"ninja_form\", source: \"ninja-forms\", idParam: \"id\" },\n { tag: \"wpforms\", source: \"wpforms\", idParam: \"id\" },\n ],\n videoShortcodePrefixes: [\n \"youtube\",\n \"vimeo\",\n \"embed\",\n \"tatsu_video\",\n \"et_pb_video\",\n \"vc_video\",\n ],\n portfolioShortcode: \"portfolio\",\n blogShortcodeTags: [\"blog\", \"recent_posts\"],\n testimonialsWrapperTags: [\"testimonials\"],\n testimonialItemTag: \"testimonial\",\n sliderShortcodeTags: [\"rev_slider\", \"masterslider\"],\n galleryShortcode: \"gallery\",\n idGalleryShortcodes: [\"oshine_gallery\", \"vc_gallery\", \"nggallery\"],\n};\n\n/** Shortcodes that cannot become static HTML — reported in conflicts, never stripped. */\nexport const UNRESOLVABLE_SHORTCODE_PREFIXES = [\n \"woocommerce_cart\",\n \"woocommerce_checkout\",\n \"woocommerce_my_account\",\n] as const;\n\nexport const WORDPRESS_BUILDER_REGISTRY: BuilderThemeConfig[] = [\n {\n id: \"tatsu\",\n detect: /\\[(?:\\/)?tatsu_/i,\n layoutMap: prefixedLayoutMap({\n section: \"tatsu_section\",\n row: \"tatsu_row\",\n column: \"tatsu_column\",\n bgParamName: \"bg_image\",\n colsParamName: \"layout\",\n }),\n wrapperRules: [\n { shortcodePrefix: \"tatsu_text\" },\n { shortcodePrefix: \"tatsu_inline_text\" },\n { shortcodePrefix: \"tatsu_text_with_shortcodes\" },\n { shortcodePrefix: \"tatsu_icon_group\" },\n ],\n urlRules: [\n { shortcodePrefix: \"tatsu_image\", urlParams: [\"image\", \"url\", \"src\"], tag: \"img\" },\n { shortcodePrefix: \"tatsu_single_image\", urlParams: [\"image\", \"url\", \"src\"], tag: \"img\" },\n ],\n iconImageRules: [\n { shortcodePrefix: \"tatsu_icon\", imageParam: \"icon_image\", hrefParam: \"href\" },\n ],\n scaffoldingPrefixes: [\"tatsu_\"],\n },\n {\n id: \"divi\",\n detect: /\\[(?:\\/)?et_pb_/i,\n layoutMap: prefixedLayoutMap({\n section: \"et_pb_section\",\n row: \"et_pb_row\",\n column: \"et_pb_column\",\n bgParamName: \"background_image\",\n }),\n urlRules: [{ shortcodePrefix: \"et_pb_image\", urlParams: [\"src\", \"url\"], tag: \"img\" }],\n scaffoldingPrefixes: [\"et_pb_\"],\n },\n {\n id: \"wpbakery\",\n detect: /\\[(?:\\/)?vc_/i,\n layoutMap: extendedPrefixedLayoutMap([\n { role: \"section\", tokens: [\"vc_section\"], bgParamName: \"bg_image\" },\n { role: \"row\", tokens: [\"vc_row\"], colsParamName: \"layout\" },\n { role: \"column\", tokens: [\"vc_column_inner\", \"vc_column\"], widthParamName: \"width\" },\n ]),\n urlRules: [\n { shortcodePrefix: \"vc_single_image\", urlParams: [\"image\", \"src\", \"url\"], tag: \"img\" },\n ],\n scaffoldingPrefixes: [\"vc_\"],\n },\n {\n id: \"fusion\",\n detect: /\\[(?:\\/)?fusion_/i,\n layoutMap: prefixedLayoutMap({\n section: \"fusion_builder_container\",\n row: \"fusion_builder_row\",\n column: \"fusion_builder_column\",\n bgParamName: \"background_image\",\n }),\n scaffoldingPrefixes: [\"fusion_\"],\n },\n {\n id: \"beaver\",\n detect: /\\[(?:\\/)?fl_(?:row|col|builder)/i,\n layoutMap: extendedPrefixedLayoutMap([\n { role: \"row\", tokens: [\"fl_row\"] },\n { role: \"column\", tokens: [\"fl_col\"] },\n ]),\n scaffoldingPrefixes: [\"fl_\"],\n },\n {\n id: \"elementor\",\n detect: /\\[(?:\\/)?elementor[-_]/i,\n urlRules: [\n { shortcodePrefix: \"elementor-widget\", urlParams: [\"url\", \"src\", \"image\"], tag: \"img\" },\n ],\n scaffoldingPrefixes: [\"elementor_\"],\n },\n {\n id: \"oshine\",\n detect:\n /\\[(?:special_sub_title|special_heading5|blox_\\w+|grid_content|grids|testimonial\\b|portfolio\\b|recent_posts\\b|animate_icon\\w*|section\\b|row\\b|one_col|one_third|one_half|one_fourth|two_third|three_fourth|text\\b)/i,\n layoutMap: fractionalLayoutMap({\n section: \"section\",\n row: \"row\",\n columns: [\n \"one_col\",\n \"one_third\",\n \"two_third\",\n \"two_thirds\",\n \"one_half\",\n \"one_fourth\",\n \"three_fourth\",\n \"three_fourths\",\n ],\n bgParamName: \"bg_image\",\n }),\n layoutMaps: [\n extendedPrefixedLayoutMap([\n { role: \"section\", tokens: [\"blox_row\"], bgParamName: \"bg_image\" },\n { role: \"row\", tokens: [\"blox_row_inner\"], colsParamName: \"columns\" },\n {\n role: \"column\",\n tokens: [\"blox_column_inner\", \"blox_column\"],\n widthParamName: \"width\",\n },\n ]),\n ],\n textRules: [\n {\n shortcodePrefix: \"special_sub_title\",\n fields: [{ param: \"title_content\", tag: \"p\" }],\n },\n {\n shortcodePrefix: \"special_heading5\",\n fields: [\n { param: \"title_content\", tag: \"h2\" },\n { param: \"caption_content\", tag: \"h4\" },\n ],\n },\n ],\n wrapperRules: [\n { shortcodePrefix: \"grid_content\" },\n { shortcodePrefix: \"blox_text\" },\n ],\n urlRules: [\n { shortcodePrefix: \"blox_image\", urlParams: [\"image\", \"img\", \"src\", \"url\"], tag: \"img\" },\n ],\n scaffoldingPrefixes: [\"blox_\", \"animate_icon\"],\n legacyScaffoldingTokens: [\"text\", \"icon\", \"linebreak\", \"grids\", \"testimonials\"],\n },\n];\n\n/** @deprecated Use urlRules on BuilderThemeConfig — kept for type migration clarity. */\nexport type BuilderContentRule = BuilderUrlRule;\n"],"mappings":";;;;;;;;AAAA,YAAY,aAAa;AA0CzB,IAAM,+BACJ;AAEF,SAAS,sBACP,SAC+E;AAC/E,QAAM,cAAc,QAAQ,eAAe,mCAAmC;AAC9E,QAAM,kBAAkB,QAAQ,mBAAmB,QAAQ,QAAQ,WAAW;AAC9E,SAAO,EAAE,aAAa,gBAAgB;AACxC;AAEA,SAAS,cACP,KACA,SACA,oBACA,mBACA,YACoB;AACpB,QAAM,aAAa,kBAAkB,GAAG;AACxC,MAAI,CAAC,WAAY,QAAO;AAExB,MAAI,oBAAoB,UAAU,GAAG;AACnC,sBAAkB,IAAI,UAAU;AAChC,WAAO;AAAA,EACT;AAEA,oBAAkB,IAAI,UAAU;AAChC,QAAM,MAAM,QAAQ,aAAa,UAAU;AAC3C,MAAI,CAAC,KAAK,eAAe;AACvB,eAAW,IAAI,UAAU;AACzB,WAAO;AAAA,EACT;AAEA,QAAM,EAAE,aAAa,gBAAgB,IAAI,sBAAsB,OAAO;AACtE,QAAM,WAAW,mBAAmB,IAAI,IAAI,aAAa;AACzD,MAAI,mBAAmB,CAAC,UAAU;AAChC,eAAW,IAAI,UAAU;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AAM,WAAW,QAAQ,CAAC,UAAU,GAAG,aAAa,WAAW;AAAA,QACjE,EAAE,MAAM,OAAO,QAAQ,CAAC,gBAAgB,GAAG,eAAe,UAAU;AAAA,QACpE;AAAA,UACE,MAAM;AAAA,UACN,QAAQ,CAAC,qBAAqB,aAAa;AAAA,UAC3C,gBAAgB;AAAA,QAClB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACA,WAAW;AAAA,MACT;AAAA,QACE,iBAAiB;AAAA,QACjB,QAAQ,CAAC,EAAE,OAAO,iBAAiB,KAAK,IAAI,CAAC;AAAA,MAC/C;AAAA,MACA;AAAA,QACE,iBAAiB;AAAA,QACjB,QAAQ;AAAA,UACN,EAAE,OAAO,iBAAiB,KAAK,KAAK;AAAA,UACpC,EAAE,OAAO,mBAAmB,KAAK,KAAK;AAAA,QACxC;AAAA,MACF;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ,EAAE,iBAAiB,eAAe;AAAA,MAClC,EAAE,iBAAiB,YAAY;AAAA,IACjC;AAAA,IACA,UAAU;AAAA,MACR,EAAE,iBAAiB,cAAc,WAAW,CAAC,SAAS,OAAO,OAAO,KAAK,GAAG,KAAK,MAAM;AAAA,IACzF;AAAA,IACA,qBAAqB,CAAC,SAAS,cAAc;AAAA,IAC7C,yBAAyB,CAAC,QAAQ,QAAQ,aAAa,SAAS,cAAc;AAAA,EAChF;AACF;","names":[]}
@@ -99,4 +99,4 @@ export {
99
99
  bundleCounts,
100
100
  buildPortfolioMediaLinks
101
101
  };
102
- //# sourceMappingURL=chunk-PFUXPS7A.js.map
102
+ //# sourceMappingURL=chunk-PD5AZX3B.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/normalizer/types.ts","../src/normalizer/idempotency.ts","../src/normalizer/bundle.ts","../src/normalizer/portfolio-media.ts"],"sourcesContent":["export type MigrationPlatform = \"wordpress\" | \"smugmug\" | \"squarespace\" | \"wix\";\n\nexport type EntityType = \"post\" | \"page\" | \"asset\" | \"portfolio\" | \"category\" | \"tag\";\n\nexport type PublishStatus = \"draft\" | \"published\" | \"archived\";\n\nexport interface SourceMetadata {\n platform: MigrationPlatform;\n id: string;\n url?: string;\n path?: string;\n exportedAt?: string;\n /** WordPress `post_type` when the DTO shape differs (e.g. portfolio CPT emitted as `page`). */\n postType?: string;\n}\n\n/** Canonical post DTO — raw HTML; sanitize at host sink. */\nexport interface NormalizedPost {\n type: \"post\";\n source: SourceMetadata;\n sourceId: string;\n title: string;\n slug: string;\n excerpt?: string;\n contentHtml: string;\n publishedAt?: string;\n status: PublishStatus;\n categorySlugs?: string[];\n tagSlugs?: string[];\n /** WordPress attachment id before two-pass resolution. */\n sourceFeaturedMediaId?: string;\n featuredAssetSourceId?: string;\n seoTitle?: string;\n seoDescription?: string;\n}\n\n/** RevSlider / MasterSlider reference from theme hero meta (OSS-27) — alias only, no slide payloads in WXR. */\nexport interface PageHeroSliderHint {\n plugin: \"revslider\" | \"masterslider\";\n alias: string;\n slidertitle?: string;\n source?: \"meta-shortcode\" | \"meta-slider-field\" | \"tatsu-json\";\n}\n\n/** Non-body layout signals for host promotion (theme chrome, hero slots, …). */\nexport interface PageLayoutHints {\n heroSlider?: PageHeroSliderHint;\n}\n\n/** Canonical page DTO — raw HTML snapshot. */\nexport interface NormalizedPage {\n type: \"page\";\n source: SourceMetadata;\n sourceId: string;\n title: string;\n slug: string;\n contentHtml: string;\n contentCss?: string;\n isHomePage?: boolean;\n /** Site portfolio listing shell (distinct from portfolio CPT singles). */\n isPortfolioPage?: boolean;\n layoutHints?: PageLayoutHints;\n status: PublishStatus;\n seoTitle?: string;\n seoDescription?: string;\n}\n\n/** EXIF fields preserved from SmugMug / camera metadata when present. */\nexport interface NormalizedAssetExif {\n iso?: number;\n aperture?: number;\n shutter?: string;\n focalLength?: number;\n}\n\n/** Remote asset to stream into the host sink. */\nexport interface NormalizedAsset {\n type: \"asset\";\n source: SourceMetadata;\n sourceId: string;\n sourceUrl: string;\n filename: string;\n mimeType?: string;\n caption?: string;\n altText?: string;\n keywords?: string[];\n exif?: NormalizedAssetExif;\n portfolioSourceId?: string;\n sort?: number;\n}\n\n/** M2M index: portfolio ↔ asset membership and sort order. */\nexport interface PortfolioMediaLink {\n portfolioSourceId: string;\n assetSourceId: string;\n sort: number;\n}\n\nexport interface NormalizedPortfolio {\n type: \"portfolio\";\n source: SourceMetadata;\n sourceId: string;\n title: string;\n slug: string;\n description?: string;\n parentSourceId?: string;\n}\n\nexport interface NormalizedCategory {\n type: \"category\";\n source: SourceMetadata;\n sourceId: string;\n name: string;\n slug: string;\n}\n\nexport interface NormalizedTag {\n type: \"tag\";\n source: SourceMetadata;\n sourceId: string;\n name: string;\n slug: string;\n}\n\nexport type NormalizedEntity =\n | NormalizedPost\n | NormalizedPage\n | NormalizedAsset\n | NormalizedPortfolio\n | NormalizedCategory\n | NormalizedTag;\n\nexport interface ValidationIssue {\n code: string;\n message: string;\n path?: string;\n}\n\nexport interface ValidationResult {\n ok: boolean;\n issues: ValidationIssue[];\n summary?: {\n posts?: number;\n pages?: number;\n assets?: number;\n portfolios?: number;\n /** WordPress `post_type=portfolio` (and configured CPT slugs) in raw WXR. */\n portfolioCpt?: number;\n categories?: number;\n tags?: number;\n /** WXR rows the parser would emit (OSS-19). */\n importableItemCount?: number;\n unsupportedOnly?: boolean;\n skippedPostTypes?: Record<string, number>;\n };\n}\n\nexport interface WxrImportSummary {\n importableItemCount: number;\n unsupportedOnly: boolean;\n skippedPostTypes: Record<string, number>;\n skippedWooCommerceStubPages?: number;\n}\n\nexport interface AdapterContext {\n input: unknown;\n cursor?: MigrationCursor;\n}\n\nexport interface MigrationAdapter {\n platform: MigrationPlatform;\n validateInput(input: unknown): ValidationResult | Promise<ValidationResult>;\n enumerateEntities(ctx: AdapterContext): AsyncIterable<NormalizedEntity>;\n /** Platform-specific import accounting (e.g. WordPress skipped `post_type`s). */\n getImportSummary?(input: unknown): Promise<WxrImportSummary | undefined>;\n}\n\nexport interface MigrationCursor {\n lastEntityKey?: EntityKey;\n state?: Record<string, unknown>;\n}\n\nexport interface EntityKey {\n platform: MigrationPlatform;\n entityType: EntityType;\n sourceId: string;\n}\n\nexport function entityKey(entity: NormalizedEntity, platform: MigrationPlatform): EntityKey {\n return {\n platform,\n entityType: entity.type,\n sourceId: entity.sourceId,\n };\n}\n","import type { EntityKey, MigrationCursor } from \"./types.js\";\n\n/** Portable entity state for resume / idempotency (not Directus field names). */\nexport type EntityState = \"pending\" | \"done\" | \"failed\" | \"skipped\";\n\nexport interface TrackedEntity extends EntityKey {\n state: EntityState;\n targetId?: string;\n errorMessage?: string;\n}\n\nexport interface MigrationCheckpoint {\n jobId: string;\n cursor: MigrationCursor;\n entities: TrackedEntity[];\n updatedAt: string;\n}\n\nexport function isTerminalState(state: EntityState): boolean {\n return state === \"done\" || state === \"skipped\";\n}\n\nexport function shouldProcessEntity(\n key: EntityKey,\n entities: TrackedEntity[],\n): boolean {\n const existing = entities.find(\n (e) =>\n e.platform === key.platform &&\n e.entityType === key.entityType &&\n e.sourceId === key.sourceId,\n );\n return !existing || !isTerminalState(existing.state);\n}\n","import type {\n NormalizedAsset,\n NormalizedCategory,\n NormalizedEntity,\n NormalizedPage,\n NormalizedPortfolio,\n NormalizedPost,\n NormalizedTag,\n} from \"./types.js\";\n\nexport interface EntityBundle {\n posts: NormalizedPost[];\n pages: NormalizedPage[];\n media: NormalizedAsset[];\n portfolios: NormalizedPortfolio[];\n categories: NormalizedCategory[];\n tags: NormalizedTag[];\n}\n\nexport function emptyBundle(): EntityBundle {\n return {\n posts: [],\n pages: [],\n media: [],\n portfolios: [],\n categories: [],\n tags: [],\n };\n}\n\nexport async function collectEntities(\n entities: AsyncIterable<NormalizedEntity>,\n): Promise<EntityBundle> {\n const bundle = emptyBundle();\n\n for await (const entity of entities) {\n switch (entity.type) {\n case \"post\":\n bundle.posts.push(entity);\n break;\n case \"page\":\n bundle.pages.push(entity);\n break;\n case \"asset\":\n bundle.media.push(entity);\n break;\n case \"portfolio\":\n bundle.portfolios.push(entity);\n break;\n case \"category\":\n bundle.categories.push(entity);\n break;\n case \"tag\":\n bundle.tags.push(entity);\n break;\n default: {\n const _exhaustive: never = entity;\n throw new Error(`Unknown entity type: ${(_exhaustive as NormalizedEntity).type}`);\n }\n }\n }\n\n return bundle;\n}\n\nexport interface BundleCounts {\n posts: number;\n pages: number;\n assets: number;\n portfolios: number;\n categories: number;\n tags: number;\n}\n\nexport function bundleCounts(bundle: EntityBundle): BundleCounts {\n return {\n posts: bundle.posts.length,\n pages: bundle.pages.length,\n assets: bundle.media.length,\n portfolios: bundle.portfolios.length,\n categories: bundle.categories.length,\n tags: bundle.tags.length,\n };\n}\n","import type { EntityBundle } from \"./bundle.js\";\nimport type { PortfolioMediaLink } from \"./types.js\";\n\n/** Derive portfolio↔asset M2M rows from assets carrying `portfolioSourceId`. */\nexport function buildPortfolioMediaLinks(bundle: EntityBundle): PortfolioMediaLink[] {\n const links: PortfolioMediaLink[] = [];\n\n for (const asset of bundle.media) {\n if (!asset.portfolioSourceId) continue;\n links.push({\n portfolioSourceId: asset.portfolioSourceId,\n assetSourceId: asset.sourceId,\n sort: asset.sort ?? 0,\n });\n }\n\n links.sort((a, b) => {\n if (a.portfolioSourceId !== b.portfolioSourceId) {\n return a.portfolioSourceId.localeCompare(b.portfolioSourceId);\n }\n return a.sort - b.sort || a.assetSourceId.localeCompare(b.assetSourceId);\n });\n\n return links;\n}\n"],"mappings":";AA4LO,SAAS,UAAU,QAA0B,UAAwC;AAC1F,SAAO;AAAA,IACL;AAAA,IACA,YAAY,OAAO;AAAA,IACnB,UAAU,OAAO;AAAA,EACnB;AACF;;;AChLO,SAAS,gBAAgB,OAA6B;AAC3D,SAAO,UAAU,UAAU,UAAU;AACvC;AAEO,SAAS,oBACd,KACA,UACS;AACT,QAAM,WAAW,SAAS;AAAA,IACxB,CAAC,MACC,EAAE,aAAa,IAAI,YACnB,EAAE,eAAe,IAAI,cACrB,EAAE,aAAa,IAAI;AAAA,EACvB;AACA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,MAAM,MAAM,QAAQ;AAAA,IACtB,CAAC;AAAA,EACH;AAEA,QAAM,KAAK,CAAC,GAAG,MAAM;AACnB,QAAI,EAAE,sBAAsB,EAAE,mBAAmB;AAC/C,aAAO,EAAE,kBAAkB,cAAc,EAAE,iBAAiB;AAAA,IAC9D;AACA,WAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,cAAc,EAAE,aAAa;AAAA,EACzE,CAAC;AAED,SAAO;AACT;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeVideoEmbedUrl
3
- } from "./chunk-J7EUSPEA.js";
3
+ } from "./chunk-4XZK55RW.js";
4
4
  import {
5
5
  isMigrationMediaRef,
6
6
  parseMigrationMediaRef
@@ -273,13 +273,23 @@ function walkNode($, $el, options) {
273
273
  return component2;
274
274
  }
275
275
  if (isWpWidgetMarker(meta.attributes)) {
276
- return applyElementMeta(
276
+ const component2 = applyElementMeta(
277
277
  {
278
278
  type: resolveWidgetComponentType(options),
279
279
  tagName
280
280
  },
281
281
  meta
282
282
  );
283
+ if (meta.attributes?.[WP_WIDGET_ATTR]?.trim() === "testimonials") {
284
+ const children = walkChildren($, $el, options).filter((child) => {
285
+ if (child.type !== "textnode") return true;
286
+ return Boolean(child.content?.trim());
287
+ });
288
+ if (children.length > 0) {
289
+ component2.components = children;
290
+ }
291
+ }
292
+ return component2;
283
293
  }
284
294
  if (isPreservedEmbedIframe(tagName, meta.attributes)) {
285
295
  return applyElementMeta(
@@ -1056,4 +1066,4 @@ export {
1056
1066
  validateTiptapDoc,
1057
1067
  expandMigrationMediaRefs
1058
1068
  };
1059
- //# sourceMappingURL=chunk-WCAHVNWW.js.map
1069
+ //# sourceMappingURL=chunk-VQ5HKNYP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/transformers/html-to-grapes/index.ts","../src/transformers/css-to-styles/index.ts","../src/transformers/html-to-grapes/walk.ts","../src/transformers/html-to-tiptap/index.ts","../src/transformers/html-to-tiptap/video-embed.ts","../src/transformers/html-to-tiptap/walk.ts","../src/transformers/validate-snapshot.ts","../src/transformers/validate-tiptap-doc.ts","../src/transformers/expand-migration-media-refs.ts"],"sourcesContent":["import * as cheerio from \"cheerio\";\n\nimport { cssToStyles } from \"../css-to-styles/index.js\";\nimport type { GrapesProjectSnapshot, HtmlToGrapesOptions } from \"./types.js\";\nimport { walkHtmlToComponents } from \"./walk.js\";\n\nexport type {\n GrapesComponent,\n GrapesProjectSnapshot,\n GrapesStyleRule,\n HtmlToGrapesOptions,\n LayoutKind,\n LayoutTypeMap,\n} from \"./types.js\";\n\n/** Cheerio HTML walk → Grapes `content` + root `styles`. */\nexport function htmlToGrapes(html: string, options: HtmlToGrapesOptions = {}): GrapesProjectSnapshot {\n const trimmed = html.trim();\n if (!trimmed) {\n return { content: [], styles: [] };\n }\n\n const $ = cheerio.load(trimmed, { xml: false });\n const styleBlocks: string[] = [];\n\n $(\"style\").each((_, element) => {\n styleBlocks.push($(element).html() ?? \"\");\n $(element).remove();\n });\n\n const contentCss = styleBlocks.join(\"\\n\").trim();\n const styles = cssToStyles(contentCss);\n const content = walkHtmlToComponents($, options);\n const contentHtml = serializeContentHtml($);\n\n return {\n content,\n styles,\n ...(contentHtml ? { contentHtml } : {}),\n ...(contentCss ? { contentCss } : {}),\n };\n}\n\nfunction serializeContentHtml($: cheerio.CheerioAPI): string | undefined {\n const body = $(\"body\");\n if (body.length) {\n const html = body.html()?.trim();\n return html || undefined;\n }\n\n const rootHtml = $.root().html()?.trim();\n return rootHtml || undefined;\n}\n","import type { GrapesStyleRule } from \"../html-to-grapes/types.js\";\n\nfunction stripCssComments(css: string): string {\n return css.replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\");\n}\n\nfunction parseDeclarations(block: string): Record<string, string> {\n const style: Record<string, string> = {};\n for (const declaration of block.split(\";\")) {\n const trimmed = declaration.trim();\n if (!trimmed) continue;\n const separator = trimmed.indexOf(\":\");\n if (separator === -1) continue;\n const property = trimmed.slice(0, separator).trim();\n const value = trimmed.slice(separator + 1).trim();\n if (!property || !value) continue;\n style[property] = value;\n }\n return style;\n}\n\n/** Parse `<style>` blocks and class rules into Grapes root `styles[]`. */\nexport function cssToStyles(css: string): GrapesStyleRule[] {\n const cleaned = stripCssComments(css);\n const rules: GrapesStyleRule[] = [];\n const rulePattern = /([^{]+)\\{([^}]*)\\}/g;\n\n for (const match of cleaned.matchAll(rulePattern)) {\n const selectorText = match[1]?.trim() ?? \"\";\n const declarationBlock = match[2] ?? \"\";\n if (!selectorText || selectorText.startsWith(\"@\")) continue;\n\n const style = parseDeclarations(declarationBlock);\n if (Object.keys(style).length === 0) continue;\n\n const selectors = selectorText\n .split(\",\")\n .map((selector) => selector.trim())\n .filter(Boolean);\n\n if (selectors.length === 0) continue;\n rules.push({ selectors, style });\n }\n\n return rules;\n}\n","import type { Cheerio, CheerioAPI } from \"cheerio\";\nimport type { AnyNode } from \"domhandler\";\n\nimport type { GrapesComponent, HtmlToGrapesOptions, LayoutKind } from \"./types.js\";\n\ntype CheerioSelection = Cheerio<AnyNode>;\n\nconst INLINE_TAGS = new Set([\n \"a\",\n \"abbr\",\n \"b\",\n \"br\",\n \"cite\",\n \"code\",\n \"del\",\n \"em\",\n \"i\",\n \"img\",\n \"ins\",\n \"mark\",\n \"q\",\n \"s\",\n \"small\",\n \"span\",\n \"strong\",\n \"sub\",\n \"sup\",\n \"u\",\n \"wbr\",\n]);\n\nconst VOID_TAGS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\nconst TEXT_CONTAINER_TAGS = new Set([\n \"blockquote\",\n \"figcaption\",\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"label\",\n \"li\",\n \"p\",\n \"pre\",\n \"td\",\n \"th\",\n]);\n\nconst SKIP_TAGS = new Set([\"script\", \"style\", \"noscript\", \"template\"]);\n\nconst DEFAULT_TYPES: Record<string, string> = {\n a: \"link\",\n img: \"image\",\n};\n\nconst LAYOUT_DATA_ATTR = \"data-layout\";\nconst WP_WIDGET_ATTR = \"data-wp-widget\";\nconst DEFAULT_WP_WIDGET_TYPE = \"wp-widget\";\nconst EMBED_IFRAME_TYPE = \"embed\";\n\nconst EMBED_IFRAME_SRC =\n /google\\.com\\/maps\\/embed|youtube\\.com\\/embed|youtube-nocookie\\.com\\/embed|player\\.vimeo\\.com\\/video/i;\n\nconst DEFAULT_LAYOUT_TYPE_MAP: Record<LayoutKind, string> = {\n section: \"section\",\n row: \"row\",\n column: \"column\",\n};\n\nfunction parseLayoutKind(attributes: Record<string, string> | undefined): LayoutKind | undefined {\n const value = attributes?.[LAYOUT_DATA_ATTR];\n if (value === \"section\" || value === \"row\" || value === \"column\") return value;\n return undefined;\n}\n\nfunction resolveLayoutComponentType(kind: LayoutKind, options: HtmlToGrapesOptions): string {\n return options.layoutTypeMap?.[kind] ?? DEFAULT_LAYOUT_TYPE_MAP[kind];\n}\n\nfunction resolveWidgetComponentType(options: HtmlToGrapesOptions): string {\n return options.widgetComponentType ?? DEFAULT_WP_WIDGET_TYPE;\n}\n\nfunction isWpWidgetMarker(attributes: Record<string, string> | undefined): boolean {\n return Boolean(attributes?.[WP_WIDGET_ATTR]);\n}\n\nfunction isPreservedEmbedIframe(\n tagName: string | undefined,\n attributes: Record<string, string> | undefined,\n): boolean {\n if (tagName !== \"iframe\") return false;\n const src = attributes?.src ?? \"\";\n return EMBED_IFRAME_SRC.test(src);\n}\n\n/** Block-level `<a href=\"…\"><img …></a>` (e.g. affiliation logos) → void image, not inline HTML text. */\nfunction isBlockLinkedImageAnchor($: CheerioAPI, $el: CheerioSelection): boolean {\n if (tagNameOf($el) !== \"a\") return false;\n const href = $el.attr(\"href\")?.trim();\n if (!href || href === \"#\") return false;\n\n let tagChildCount = 0;\n let onlyImg = false;\n $el.contents().each((_, node) => {\n if (node.type === \"text\") {\n if (String(\"data\" in node ? node.data : \"\").trim()) {\n tagChildCount = -1;\n }\n return;\n }\n if (node.type !== \"tag\") return;\n tagChildCount += 1;\n onlyImg = tagNameOf($(node)) === \"img\";\n });\n\n return tagChildCount === 1 && onlyImg;\n}\n\nfunction walkLinkedImageAnchor(\n $: CheerioAPI,\n $el: CheerioSelection,\n options: HtmlToGrapesOptions,\n): GrapesComponent {\n const href = $el.attr(\"href\")!.trim();\n const $img = $el.children().first();\n const meta = pickElementMeta($img);\n const attributes = { ...(meta.attributes ?? {}), href };\n\n return applyElementMeta(\n {\n type: resolveComponentType(\"img\", meta.classes, options),\n tagName: \"img\",\n void: true,\n },\n {\n attributes,\n classes: meta.classes,\n },\n );\n}\n\nfunction layoutAttributesForComponent(\n attributes: Record<string, string> | undefined,\n): Record<string, string> | undefined {\n if (!attributes) return undefined;\n const { [LAYOUT_DATA_ATTR]: _layout, ...rest } = attributes;\n return Object.keys(rest).length > 0 ? rest : undefined;\n}\n\nfunction tagNameOf($el: CheerioSelection): string | undefined {\n const raw = $el.prop(\"tagName\");\n return typeof raw === \"string\" ? raw.toLowerCase() : undefined;\n}\n\nfunction applyElementMeta(\n component: GrapesComponent,\n meta: Pick<GrapesComponent, \"attributes\" | \"classes\">,\n): GrapesComponent {\n if (meta.attributes) component.attributes = meta.attributes;\n if (meta.classes) component.classes = meta.classes;\n return component;\n}\n\nfunction pickElementMeta($el: CheerioSelection): Pick<GrapesComponent, \"attributes\" | \"classes\"> {\n const attributes: Record<string, string> = {};\n const classes: string[] = [];\n\n if (typeof $el.attr() === \"object\") {\n for (const [key, value] of Object.entries($el.attr() ?? {})) {\n if (key === \"class\") {\n classes.push(...value.split(/\\s+/).filter(Boolean));\n continue;\n }\n attributes[key] = value;\n }\n }\n\n return {\n attributes: Object.keys(attributes).length > 0 ? attributes : undefined,\n classes: classes.length > 0 ? classes : undefined,\n };\n}\n\nfunction resolveComponentType(\n tagName: string,\n classes: string[] | undefined,\n options: HtmlToGrapesOptions,\n fallback = \"default\",\n): string {\n if (options.componentMap && classes) {\n for (const className of classes) {\n const mapped = options.componentMap[className];\n if (mapped) return mapped;\n }\n }\n const tagMapped = options.tagMap?.[tagName];\n if (tagMapped) return tagMapped;\n return DEFAULT_TYPES[tagName] ?? fallback;\n}\n\nfunction hasOnlyInlineContent($: CheerioAPI, $el: CheerioSelection): boolean {\n let inlineOnly = true;\n\n $el.contents().each((_, node) => {\n if (!inlineOnly) return;\n const $child = $(node);\n if ($child.get(0)?.type === \"text\") return;\n const childTag = tagNameOf($child);\n if (!childTag || !INLINE_TAGS.has(childTag)) {\n inlineOnly = false;\n return;\n }\n if (!hasOnlyInlineContent($, $child)) {\n inlineOnly = false;\n }\n });\n\n return inlineOnly;\n}\n\nfunction walkChildren(\n $: CheerioAPI,\n $el: CheerioSelection,\n options: HtmlToGrapesOptions,\n): GrapesComponent[] {\n const components: GrapesComponent[] = [];\n\n $el.contents().each((_, node) => {\n const walked = walkNode($, $(node), options);\n if (!walked) return;\n if (Array.isArray(walked)) {\n components.push(...walked);\n } else {\n components.push(walked);\n }\n });\n\n return components;\n}\n\nfunction walkNode(\n $: CheerioAPI,\n $el: CheerioSelection,\n options: HtmlToGrapesOptions,\n): GrapesComponent | GrapesComponent[] | null {\n const node = $el.get(0);\n if (!node) return null;\n\n if (node.type === \"text\") {\n const text = \"data\" in node ? String(node.data ?? \"\") : \"\";\n if (!text.trim()) return null;\n return { type: \"textnode\", content: text };\n }\n\n if (node.type !== \"tag\") return null;\n\n const tagName = tagNameOf($el);\n if (!tagName || SKIP_TAGS.has(tagName)) return null;\n\n const meta = pickElementMeta($el);\n\n const layoutKind = parseLayoutKind(meta.attributes);\n if (layoutKind) {\n const components = walkChildren($, $el, options);\n const component = applyElementMeta(\n {\n type: resolveLayoutComponentType(layoutKind, options),\n tagName,\n },\n {\n attributes: layoutAttributesForComponent(meta.attributes),\n classes: meta.classes,\n },\n );\n if (components.length > 0) {\n component.components = components;\n }\n return component;\n }\n\n // OSS-13 — atomic widget blocks (do not merge into preceding text / inline walks).\n if (isWpWidgetMarker(meta.attributes)) {\n const component = applyElementMeta(\n {\n type: resolveWidgetComponentType(options),\n tagName,\n },\n meta,\n );\n // OSS-26 — testimonials stub carries per-item child attrs for host promotion.\n if (meta.attributes?.[WP_WIDGET_ATTR]?.trim() === \"testimonials\") {\n const children = walkChildren($, $el, options).filter((child) => {\n if (child.type !== \"textnode\") return true;\n return Boolean(child.content?.trim());\n });\n if (children.length > 0) {\n component.components = children;\n }\n }\n return component;\n }\n\n if (isPreservedEmbedIframe(tagName, meta.attributes)) {\n return applyElementMeta(\n {\n type: EMBED_IFRAME_TYPE,\n tagName,\n void: true,\n },\n meta,\n );\n }\n\n if (tagName === \"a\" && isBlockLinkedImageAnchor($, $el)) {\n return walkLinkedImageAnchor($, $el, options);\n }\n\n if (VOID_TAGS.has(tagName)) {\n return applyElementMeta(\n {\n type: resolveComponentType(tagName, meta.classes, options),\n tagName,\n void: true,\n },\n meta,\n );\n }\n\n if (TEXT_CONTAINER_TAGS.has(tagName) && hasOnlyInlineContent($, $el)) {\n return applyElementMeta(\n {\n type: resolveComponentType(tagName, meta.classes, options, \"text\"),\n tagName,\n content: $el.html() ?? \"\",\n },\n meta,\n );\n }\n\n if (INLINE_TAGS.has(tagName)) {\n return applyElementMeta(\n {\n type: \"text\",\n content: $.html($el) ?? \"\",\n },\n meta,\n );\n }\n\n const components = walkChildren($, $el, options);\n const component = applyElementMeta(\n {\n type: resolveComponentType(tagName, meta.classes, options),\n tagName,\n },\n meta,\n );\n\n if (components.length > 0) {\n component.components = components;\n }\n\n return component;\n}\n\nfunction appendWalked(\n content: GrapesComponent[],\n walked: GrapesComponent | GrapesComponent[] | null,\n): void {\n if (!walked) return;\n if (Array.isArray(walked)) {\n content.push(...walked);\n return;\n }\n content.push(walked);\n}\n\nfunction walkNodes(\n $: CheerioAPI,\n $nodes: CheerioSelection,\n content: GrapesComponent[],\n options: HtmlToGrapesOptions,\n): void {\n $nodes.each((_, node) => {\n appendWalked(content, walkNode($, $(node), options));\n });\n}\n\nexport function walkHtmlToComponents(\n $: CheerioAPI,\n options: HtmlToGrapesOptions = {},\n): GrapesComponent[] {\n const content: GrapesComponent[] = [];\n const body = $(\"body\");\n\n if (body.length) {\n walkNodes($, body.contents(), content, options);\n return content;\n }\n\n const children = $.root().children();\n if (children.length) {\n walkNodes($, children, content, options);\n } else {\n walkNodes($, $.root().contents(), content, options);\n }\n\n return content;\n}\n","import * as cheerio from \"cheerio\";\n\nimport type { HtmlToTiptapOptions, TiptapDoc } from \"./types.js\";\nimport { prepareHtmlForTiptap, walkHtmlToTiptapDoc } from \"./walk.js\";\n\nexport type { HtmlToTiptapOptions, TiptapDoc, TiptapMark, TiptapNode } from \"./types.js\";\n\n/** Cheerio HTML walk → Tiptap / ProseMirror `doc` JSON for blog `content_json`. */\nexport function htmlToTiptap(html: string, options: HtmlToTiptapOptions = {}): TiptapDoc {\n const trimmed = html.trim();\n if (!trimmed) {\n return { type: \"doc\", content: [{ type: \"paragraph\" }] };\n }\n\n const $ = cheerio.load(trimmed, { xml: false });\n prepareHtmlForTiptap($);\n return walkHtmlToTiptapDoc($, options);\n}\n","import type { Cheerio } from \"cheerio\";\nimport type { AnyNode } from \"domhandler\";\n\nimport { normalizeVideoEmbedUrl } from \"../../parsers/wordpress/builders/flatten.js\";\nimport type { TiptapNode } from \"./types.js\";\n\ntype CheerioSelection = Cheerio<AnyNode>;\n\nconst VIDEO_WIDGET = \"video\";\n\nconst VIDEO_IFRAME_SRC =\n /youtube\\.com\\/embed|youtube-nocookie\\.com\\/embed|youtu\\.be|player\\.vimeo\\.com\\/video/i;\n\nexport function isVideoWidgetElement($el: CheerioSelection): boolean {\n return $el.attr(\"data-wp-widget\")?.toLowerCase() === VIDEO_WIDGET;\n}\n\nfunction buildVideoEmbedNode(input: {\n embedUrl: string;\n provider: string;\n}): TiptapNode {\n return {\n type: \"embed\",\n attrs: {\n src: input.embedUrl,\n provider: input.provider,\n dataWpWidget: VIDEO_WIDGET,\n dataEmbedUrl: input.embedUrl,\n dataVideoProvider: input.provider,\n },\n };\n}\n\nexport function videoEmbedNodeFromWidget($el: CheerioSelection): TiptapNode | null {\n const embedUrl = $el.attr(\"data-embed-url\")?.trim();\n if (!embedUrl) return null;\n\n const provider = $el.attr(\"data-video-provider\")?.trim() || \"external\";\n return buildVideoEmbedNode({ embedUrl, provider });\n}\n\nexport function videoEmbedNodeFromIframe($el: CheerioSelection): TiptapNode | null {\n const src = $el.attr(\"src\")?.trim();\n if (!src || !VIDEO_IFRAME_SRC.test(src)) return null;\n\n const normalized = normalizeVideoEmbedUrl(src);\n return buildVideoEmbedNode({\n embedUrl: normalized?.embedUrl ?? src,\n provider: normalized?.provider ?? \"external\",\n });\n}\n\nexport function isPreservedVideoIframe($el: CheerioSelection, tagName: string | undefined): boolean {\n if (tagName !== \"iframe\") return false;\n const src = $el.attr(\"src\")?.trim() ?? \"\";\n return VIDEO_IFRAME_SRC.test(src);\n}\n","import type { Cheerio, CheerioAPI } from \"cheerio\";\nimport type { AnyNode, Element } from \"domhandler\";\n\nimport type { HtmlToTiptapOptions, TiptapDoc, TiptapMark, TiptapNode } from \"./types.js\";\nimport {\n isPreservedVideoIframe,\n isVideoWidgetElement,\n videoEmbedNodeFromIframe,\n videoEmbedNodeFromWidget,\n} from \"./video-embed.js\";\n\ntype CheerioSelection = Cheerio<AnyNode>;\n\nconst SKIP_TAGS = new Set([\"script\", \"style\", \"noscript\", \"template\"]);\nconst HEADING_TAGS = new Set([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]);\nconst UNWRAP_TAGS = new Set([\n \"article\",\n \"aside\",\n \"div\",\n \"figure\",\n \"footer\",\n \"header\",\n \"main\",\n \"nav\",\n \"section\",\n \"span\",\n]);\n\nconst INLINE_TAGS = new Set([\n \"a\",\n \"abbr\",\n \"b\",\n \"br\",\n \"cite\",\n \"code\",\n \"del\",\n \"em\",\n \"i\",\n \"ins\",\n \"mark\",\n \"q\",\n \"s\",\n \"small\",\n \"strong\",\n \"sub\",\n \"sup\",\n \"u\",\n \"wbr\",\n]);\n\nconst LAYOUT_ATTR = \"data-layout\";\n\nfunction tagNameOf($el: CheerioSelection): string | undefined {\n const raw = $el.prop(\"tagName\");\n return typeof raw === \"string\" ? raw.toLowerCase() : undefined;\n}\n\nfunction headingLevel(tagName: string): number {\n const level = Number.parseInt(tagName.slice(1), 10);\n return Number.isFinite(level) ? level : 1;\n}\n\nfunction isLayoutMarker($el: CheerioSelection, options: HtmlToTiptapOptions): boolean {\n if (options.unwrapLayoutMarkers === false) return false;\n return $el.attr(LAYOUT_ATTR) !== undefined;\n}\n\nfunction hasOnlyInlineContent($: CheerioAPI, $el: CheerioSelection): boolean {\n let inlineOnly = true;\n\n $el.contents().each((_, node) => {\n if (!inlineOnly) return;\n const $child = $(node);\n if ($child.get(0)?.type === \"text\") return;\n const childTag = tagNameOf($child);\n if (!childTag || childTag === \"br\" || childTag === \"img\") return;\n if (!INLINE_TAGS.has(childTag)) {\n inlineOnly = false;\n return;\n }\n if (!hasOnlyInlineContent($, $child)) {\n inlineOnly = false;\n }\n });\n\n return inlineOnly;\n}\n\nfunction hasBlockChild($: CheerioAPI, $el: CheerioSelection): boolean {\n let hasBlock = false;\n $el.contents().each((_, node) => {\n if (hasBlock) return;\n const $child = $(node);\n if ($child.get(0)?.type === \"text\") return;\n const childTag = tagNameOf($child);\n if (!childTag) return;\n if (\n HEADING_TAGS.has(childTag) ||\n childTag === \"p\" ||\n childTag === \"ul\" ||\n childTag === \"ol\" ||\n childTag === \"blockquote\" ||\n childTag === \"pre\" ||\n childTag === \"hr\" ||\n childTag === \"img\" ||\n childTag === \"iframe\" ||\n childTag === \"table\" ||\n isLayoutMarker($child, { unwrapLayoutMarkers: true }) ||\n (UNWRAP_TAGS.has(childTag) && hasBlockChild($, $child))\n ) {\n hasBlock = true;\n }\n });\n return hasBlock;\n}\n\nfunction textNode(text: string, marks: TiptapMark[] = []): TiptapNode {\n const node: TiptapNode = { type: \"text\", text };\n if (marks.length > 0) node.marks = marks;\n return node;\n}\n\nfunction paragraph(content: TiptapNode[]): TiptapNode {\n return content.length > 0 ? { type: \"paragraph\", content } : { type: \"paragraph\" };\n}\n\nfunction appendMarks(existing: TiptapMark[], added: TiptapMark): TiptapMark[] {\n if (existing.some((mark) => mark.type === added.type)) return existing;\n return [...existing, added];\n}\n\nfunction marksForTag(tagName: string, $el: CheerioSelection): TiptapMark[] {\n switch (tagName) {\n case \"strong\":\n case \"b\":\n return [{ type: \"bold\" }];\n case \"em\":\n case \"i\":\n return [{ type: \"italic\" }];\n case \"s\":\n case \"del\":\n case \"strike\":\n return [{ type: \"strike\" }];\n case \"u\":\n return [{ type: \"underline\" }];\n case \"code\":\n return [{ type: \"code\" }];\n case \"a\": {\n const href = $el.attr(\"href\");\n if (!href) return [];\n const attrs: Record<string, string> = { href };\n const target = $el.attr(\"target\");\n if (target) attrs.target = target;\n const rel = $el.attr(\"rel\");\n if (rel) attrs.rel = rel;\n return [{ type: \"link\", attrs }];\n }\n default:\n return [];\n }\n}\n\nfunction imageNode($el: CheerioSelection): TiptapNode | null {\n const src = $el.attr(\"src\");\n if (!src) return null;\n const attrs: Record<string, unknown> = { src };\n const alt = $el.attr(\"alt\");\n if (alt !== undefined) attrs.alt = alt;\n const title = $el.attr(\"title\");\n if (title) attrs.title = title;\n return { type: \"image\", attrs };\n}\n\nfunction parseInlineContent(\n $: CheerioAPI,\n $el: CheerioSelection,\n marks: TiptapMark[] = [],\n): TiptapNode[] {\n const rootTag = tagNameOf($el);\n if (rootTag && INLINE_TAGS.has(rootTag) && rootTag !== \"br\") {\n marks = marksForTag(rootTag, $el).reduce((acc, mark) => appendMarks(acc, mark), marks);\n }\n\n const nodes: TiptapNode[] = [];\n\n $el.contents().each((_, node) => {\n if (node.type === \"text\") {\n const text = String(node.data ?? \"\");\n if (text) nodes.push(textNode(text, marks));\n return;\n }\n\n if (node.type !== \"tag\") return;\n\n const $child = $(node);\n const tagName = tagNameOf($child);\n if (!tagName || SKIP_TAGS.has(tagName)) return;\n\n if (tagName === \"br\") {\n nodes.push({ type: \"hardBreak\" });\n return;\n }\n\n if (tagName === \"img\") {\n return;\n }\n\n const childMarks = marksForTag(tagName, $child);\n const combinedMarks = childMarks.reduce((acc, mark) => appendMarks(acc, mark), [...marks]);\n nodes.push(...parseInlineContent($, $child, combinedMarks));\n });\n\n return nodes;\n}\n\n/** Parse a block container that holds inline content (p, heading, etc.). Splits on nested block/img. */\nfunction parseMixedBlockContent(\n $: CheerioAPI,\n $el: CheerioSelection,\n options: HtmlToTiptapOptions,\n): TiptapNode[] {\n const blocks: TiptapNode[] = [];\n let inlineBuffer: TiptapNode[] = [];\n\n function flushInline(): void {\n if (inlineBuffer.length === 0) return;\n blocks.push(paragraph(inlineBuffer));\n inlineBuffer = [];\n }\n\n $el.contents().each((_, node) => {\n if (node.type === \"text\") {\n const text = String(node.data ?? \"\");\n if (text) inlineBuffer.push(textNode(text));\n return;\n }\n\n if (node.type !== \"tag\") return;\n\n const $child = $(node);\n const tagName = tagNameOf($child);\n if (!tagName || SKIP_TAGS.has(tagName)) return;\n\n if (tagName === \"br\") {\n inlineBuffer.push({ type: \"hardBreak\" });\n return;\n }\n\n if (tagName === \"img\") {\n flushInline();\n const image = imageNode($child);\n if (image) blocks.push(image);\n return;\n }\n\n if (tagName === \"iframe\" && isPreservedVideoIframe($child, tagName)) {\n flushInline();\n const embed = videoEmbedNodeFromIframe($child);\n if (embed) blocks.push(embed);\n return;\n }\n\n if (INLINE_TAGS.has(tagName)) {\n inlineBuffer.push(...parseInlineContent($, $child));\n return;\n }\n\n flushInline();\n blocks.push(...walkBlockNodes($, $child, options));\n });\n\n flushInline();\n return blocks;\n}\n\nfunction walkListItem($: CheerioAPI, $el: CheerioSelection, options: HtmlToTiptapOptions): TiptapNode {\n const blocks = walkBlockNodes($, $el, options);\n if (blocks.length === 0) {\n return { type: \"listItem\", content: [{ type: \"paragraph\" }] };\n }\n\n const normalized: TiptapNode[] = [];\n for (const block of blocks) {\n if (\n block.type === \"paragraph\" ||\n block.type === \"image\" ||\n block.type === \"embed\" ||\n block.type === \"blockquote\" ||\n block.type === \"bulletList\" ||\n block.type === \"orderedList\"\n ) {\n normalized.push(block);\n continue;\n }\n normalized.push(paragraph(block.content ?? []));\n }\n\n return { type: \"listItem\", content: normalized };\n}\n\nfunction walkBlockNode(\n $: CheerioAPI,\n $el: CheerioSelection,\n options: HtmlToTiptapOptions,\n): TiptapNode[] {\n const node = $el.get(0);\n if (!node) return [];\n\n if (node.type === \"text\") {\n const text = String(node.data ?? \"\").trim();\n return text ? [paragraph([textNode(text)])] : [];\n }\n\n if (node.type !== \"tag\") return [];\n\n const tagName = tagNameOf($el);\n if (!tagName || SKIP_TAGS.has(tagName)) return [];\n\n if (isLayoutMarker($el, options)) {\n return walkBlockNodes($, $el, options);\n }\n\n if (isVideoWidgetElement($el)) {\n const embed = videoEmbedNodeFromWidget($el);\n return embed ? [embed] : [];\n }\n\n if (isPreservedVideoIframe($el, tagName)) {\n const embed = videoEmbedNodeFromIframe($el);\n return embed ? [embed] : [];\n }\n\n if (UNWRAP_TAGS.has(tagName)) {\n if (hasBlockChild($, $el)) {\n return walkBlockNodes($, $el, options);\n }\n if (hasOnlyInlineContent($, $el)) {\n const inline = parseInlineContent($, $el);\n return inline.length > 0 ? [paragraph(inline)] : [];\n }\n return walkBlockNodes($, $el, options);\n }\n\n if (HEADING_TAGS.has(tagName)) {\n const content = parseInlineContent($, $el);\n if (content.length === 0) return [];\n return [{ type: \"heading\", attrs: { level: headingLevel(tagName) }, content }];\n }\n\n if (tagName === \"p\") {\n return parseMixedBlockContent($, $el, options);\n }\n\n if (tagName === \"ul\") {\n const items: TiptapNode[] = [];\n $el.children(\"li\").each((_, li) => {\n items.push(walkListItem($, $(li), options));\n });\n return items.length > 0 ? [{ type: \"bulletList\", content: items }] : [];\n }\n\n if (tagName === \"ol\") {\n const items: TiptapNode[] = [];\n $el.children(\"li\").each((_, li) => {\n items.push(walkListItem($, $(li), options));\n });\n return items.length > 0 ? [{ type: \"orderedList\", content: items }] : [];\n }\n\n if (tagName === \"li\") {\n return [walkListItem($, $el, options)];\n }\n\n if (tagName === \"blockquote\") {\n const blocks = walkBlockNodes($, $el, options);\n if (blocks.length === 0) return [];\n return [{ type: \"blockquote\", content: blocks }];\n }\n\n if (tagName === \"pre\") {\n const code = $el.find(\"code\").first();\n const text = (code.length ? code.text() : $el.text()).replace(/\\n$/, \"\");\n if (!text) return [];\n return [{ type: \"codeBlock\", content: [textNode(text)] }];\n }\n\n if (tagName === \"hr\") {\n return [{ type: \"horizontalRule\" }];\n }\n\n if (tagName === \"img\") {\n const image = imageNode($el);\n return image ? [image] : [];\n }\n\n if (tagName === \"table\") {\n const rows: string[] = [];\n $el.find(\"tr\").each((_, tr) => {\n const cells: string[] = [];\n $(tr)\n .find(\"th, td\")\n .each((__, cell) => {\n const text = $(cell).text().trim();\n if (text) cells.push(text);\n });\n if (cells.length > 0) rows.push(cells.join(\" | \"));\n });\n return rows.map((row) => paragraph([textNode(row)]));\n }\n\n return walkBlockNodes($, $el, options);\n}\n\nfunction walkBlockNodes(\n $: CheerioAPI,\n $el: CheerioSelection,\n options: HtmlToTiptapOptions,\n): TiptapNode[] {\n const blocks: TiptapNode[] = [];\n\n $el.contents().each((_, node) => {\n blocks.push(...walkBlockNode($, $(node), options));\n });\n\n return blocks;\n}\n\nfunction normalizeDocContent(content: TiptapNode[]): TiptapNode[] {\n const normalized: TiptapNode[] = [];\n\n for (const block of content) {\n if (block.type === \"paragraph\" && (!block.content || block.content.length === 0)) {\n continue;\n }\n normalized.push(block);\n }\n\n return normalized;\n}\n\nexport function walkHtmlToTiptapDoc(\n $: CheerioAPI,\n options: HtmlToTiptapOptions = {},\n): TiptapDoc {\n const resolved: HtmlToTiptapOptions = {\n unwrapLayoutMarkers: options.unwrapLayoutMarkers ?? true,\n };\n\n let content: TiptapNode[] = [];\n const body = $(\"body\");\n\n if (body.length) {\n content = walkBlockNodes($, body, resolved);\n } else {\n const children = $.root().children();\n if (children.length) {\n content = walkBlockNodes($, children, resolved);\n } else {\n content = walkBlockNodes($, $.root(), resolved);\n }\n }\n\n content = normalizeDocContent(content);\n if (content.length === 0) {\n content = [{ type: \"paragraph\" }];\n }\n\n return { type: \"doc\", content };\n}\n\n/** Strip layout/style noise before walking (mutates loaded DOM). */\nexport function prepareHtmlForTiptap($: CheerioAPI): void {\n $(\"style, script, noscript, template\").remove();\n}\n\nexport function isElementNode(node: AnyNode): node is Element {\n return node.type === \"tag\";\n}\n","import { z } from \"zod\";\n\nimport type { ValidationIssue, ValidationResult } from \"../normalizer/types.js\";\nimport type { GrapesComponent, GrapesProjectSnapshot } from \"./html-to-grapes/types.js\";\n\nexport const grapesStyleRuleSchema = z.object({\n selectors: z.array(z.string().min(1)).min(1),\n style: z.record(z.string(), z.string()),\n});\n\nexport const grapesComponentSchema: z.ZodType<GrapesComponent> = z.lazy(() =>\n z.object({\n type: z.string().min(1),\n tagName: z.string().optional(),\n attributes: z.record(z.string(), z.string()).optional(),\n classes: z.array(z.string()).optional(),\n components: z.array(grapesComponentSchema).optional(),\n content: z.string().optional(),\n void: z.boolean().optional(),\n }),\n);\n\nexport const grapesProjectSnapshotSchema = z.object({\n content: z.array(grapesComponentSchema),\n styles: z.array(grapesStyleRuleSchema),\n contentHtml: z.string().optional(),\n contentCss: z.string().optional(),\n});\n\nexport interface ValidateGrapesProjectSnapshotOptions {\n /** When set, every component `type` in the tree must be in this allowlist. */\n allowedComponentTypes?: string[];\n}\n\nfunction zodIssuesToValidationIssues(issues: z.ZodIssue[]): ValidationIssue[] {\n return issues.map((issue) => ({\n code: issue.code,\n message: issue.message,\n path: issue.path.length > 0 ? issue.path.join(\".\") : undefined,\n }));\n}\n\nfunction collectComponentTypes(components: GrapesComponent[]): string[] {\n const types: string[] = [];\n for (const component of components) {\n types.push(component.type);\n if (component.components?.length) {\n types.push(...collectComponentTypes(component.components));\n }\n }\n return types;\n}\n\nfunction validateAllowedComponentTypes(\n snapshot: GrapesProjectSnapshot,\n allowedComponentTypes: string[],\n): ValidationIssue[] {\n const allowlist = new Set(allowedComponentTypes);\n const issues: ValidationIssue[] = [];\n\n for (const componentType of collectComponentTypes(snapshot.content)) {\n if (!allowlist.has(componentType)) {\n issues.push({\n code: \"invalid_component_type\",\n message: `Component type \"${componentType}\" is not in allowedComponentTypes`,\n path: \"content\",\n });\n }\n }\n\n return issues;\n}\n\n/**\n * Opt-in structural check for a Grapes project snapshot (not a full Grapes editor project file).\n * Does not validate host-specific component registries unless `allowedComponentTypes` is passed.\n */\nexport function validateGrapesProjectSnapshot(\n snapshot: unknown,\n options: ValidateGrapesProjectSnapshotOptions = {},\n): ValidationResult {\n const result = grapesProjectSnapshotSchema.safeParse(snapshot);\n if (!result.success) {\n return { ok: false, issues: zodIssuesToValidationIssues(result.error.issues) };\n }\n\n if (options.allowedComponentTypes?.length) {\n const typeIssues = validateAllowedComponentTypes(result.data, options.allowedComponentTypes);\n if (typeIssues.length > 0) {\n return { ok: false, issues: typeIssues };\n }\n }\n\n return { ok: true, issues: [] };\n}\n","import { z } from \"zod\";\n\nimport type { ValidationIssue, ValidationResult } from \"../normalizer/types.js\";\nimport type { TiptapDoc, TiptapNode } from \"./html-to-tiptap/types.js\";\n\nexport const tiptapMarkSchema = z.object({\n type: z.string().min(1),\n attrs: z.record(z.string(), z.string()).optional(),\n});\n\nexport const tiptapNodeSchema: z.ZodType<TiptapNode> = z.lazy(() =>\n z.union([\n z.object({\n type: z.literal(\"text\"),\n text: z.string(),\n marks: z.array(tiptapMarkSchema).optional(),\n }),\n z.object({\n type: z.string().min(1),\n attrs: z.record(z.unknown()).optional(),\n content: z.array(tiptapNodeSchema).optional(),\n marks: z.array(tiptapMarkSchema).optional(),\n }),\n ]),\n);\n\nexport const tiptapDocSchema = z.object({\n type: z.literal(\"doc\"),\n content: z.array(tiptapNodeSchema),\n});\n\nexport interface ValidateTiptapDocOptions {\n /** When set, every node `type` in the tree must be in this allowlist. */\n allowedNodeTypes?: string[];\n /** When set, every mark `type` must be in this allowlist. */\n allowedMarkTypes?: string[];\n}\n\nfunction zodIssuesToValidationIssues(issues: z.ZodIssue[]): ValidationIssue[] {\n return issues.map((issue) => ({\n code: issue.code,\n message: issue.message,\n path: issue.path.length > 0 ? issue.path.join(\".\") : undefined,\n }));\n}\n\nfunction collectNodeTypes(nodes: TiptapNode[]): string[] {\n const types: string[] = [];\n for (const node of nodes) {\n types.push(node.type);\n if (node.content?.length) {\n types.push(...collectNodeTypes(node.content));\n }\n }\n return types;\n}\n\nfunction collectMarkTypes(nodes: TiptapNode[]): string[] {\n const types: string[] = [];\n for (const node of nodes) {\n if (node.marks?.length) {\n types.push(...node.marks.map((mark) => mark.type));\n }\n if (node.content?.length) {\n types.push(...collectMarkTypes(node.content));\n }\n }\n return types;\n}\n\nfunction validateAllowedTypes(\n doc: TiptapDoc,\n allowedNodeTypes: string[] | undefined,\n allowedMarkTypes: string[] | undefined,\n): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n\n if (allowedNodeTypes) {\n const allowlist = new Set(allowedNodeTypes);\n for (const nodeType of collectNodeTypes(doc.content)) {\n if (!allowlist.has(nodeType)) {\n issues.push({\n code: \"invalid_node_type\",\n message: `Node type \"${nodeType}\" is not in allowedNodeTypes`,\n path: \"content\",\n });\n }\n }\n }\n\n if (allowedMarkTypes) {\n const allowlist = new Set(allowedMarkTypes);\n for (const markType of collectMarkTypes(doc.content)) {\n if (!allowlist.has(markType)) {\n issues.push({\n code: \"invalid_mark_type\",\n message: `Mark type \"${markType}\" is not in allowedMarkTypes`,\n path: \"content\",\n });\n }\n }\n }\n\n return issues;\n}\n\n/** Opt-in structural check for a Tiptap / ProseMirror document. */\nexport function validateTiptapDoc(\n doc: unknown,\n options: ValidateTiptapDocOptions = {},\n): ValidationResult {\n const parsed = tiptapDocSchema.safeParse(doc);\n if (!parsed.success) {\n return { ok: false, issues: zodIssuesToValidationIssues(parsed.error.issues) };\n }\n\n const typeIssues = validateAllowedTypes(\n parsed.data,\n options.allowedNodeTypes,\n options.allowedMarkTypes,\n );\n if (typeIssues.length > 0) {\n return { ok: false, issues: typeIssues };\n }\n\n return { ok: true, issues: [] };\n}\n","import * as cheerio from \"cheerio\";\n\nimport { isMigrationMediaRef, parseMigrationMediaRef } from \"../lib/media-urls.js\";\n\nexport interface ExpandMigrationMediaRefsResult {\n html: string;\n unresolved: string[];\n}\n\n/** Inline CSS `background` / `background-image: url(…)` (quoted or bare). */\nconst BACKGROUND_IMAGE_URL_PATTERN =\n /background(?:-image)?\\s*:[^;]*?url\\s*\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)/gi;\n\nfunction tryExpandRef(\n value: string,\n resolvePublicUrl: (sourceId: string) => string | undefined,\n unresolved: Set<string>,\n): string | undefined {\n if (!isMigrationMediaRef(value)) return undefined;\n const sourceId = parseMigrationMediaRef(value);\n if (!sourceId) {\n unresolved.add(value);\n return undefined;\n }\n const publicUrl = resolvePublicUrl(sourceId);\n if (!publicUrl) {\n unresolved.add(value);\n return undefined;\n }\n return publicUrl;\n}\n\nfunction expandBackgroundUrlsInStyle(\n style: string,\n resolvePublicUrl: (sourceId: string) => string | undefined,\n unresolved: Set<string>,\n): string {\n return style.replace(BACKGROUND_IMAGE_URL_PATTERN, (full, quote: string, rawUrl: string) => {\n const expanded = tryExpandRef(rawUrl.trim(), resolvePublicUrl, unresolved);\n if (!expanded) return full;\n\n const urlCall = quote ? `url(${quote}${expanded}${quote})` : `url(${expanded})`;\n return full.replace(/url\\s*\\(\\s*(['\"]?)([^'\")]+)\\1\\s*\\)/i, urlCall);\n });\n}\n\nfunction expandSrcset(\n srcset: string,\n resolvePublicUrl: (sourceId: string) => string | undefined,\n unresolved: Set<string>,\n): string {\n return srcset\n .split(\",\")\n .map((entry) => {\n const trimmed = entry.trim();\n if (!trimmed) return entry;\n const [urlPart, descriptor] = trimmed.split(/\\s+/, 2);\n const expanded = tryExpandRef(urlPart ?? \"\", resolvePublicUrl, unresolved);\n if (!expanded) return entry;\n return descriptor ? `${expanded} ${descriptor}` : expanded;\n })\n .join(\", \");\n}\n\n/**\n * Expand OSS-14 `artinstack-migration://asset/…` refs to host CDN URLs.\n * Lookup (`migration_entities` → `publicUrl`) is host-supplied via `resolvePublicUrl`.\n */\nexport function expandMigrationMediaRefs(\n html: string,\n resolvePublicUrl: (sourceId: string) => string | undefined,\n): ExpandMigrationMediaRefsResult {\n if (!html.trim()) {\n return { html, unresolved: [] };\n }\n\n const $ = cheerio.load(html, { xml: false });\n const unresolved = new Set<string>();\n\n $(\"img\").each((_, element) => {\n const img = $(element);\n const src = img.attr(\"src\")?.trim();\n if (src) {\n const expanded = tryExpandRef(src, resolvePublicUrl, unresolved);\n if (expanded) img.attr(\"src\", expanded);\n }\n\n const srcset = img.attr(\"srcset\")?.trim();\n if (srcset) {\n img.attr(\"srcset\", expandSrcset(srcset, resolvePublicUrl, unresolved));\n }\n });\n\n $(\"[data-bg-image]\").each((_, element) => {\n const node = $(element);\n const bgImage = node.attr(\"data-bg-image\")?.trim();\n if (!bgImage) return;\n const expanded = tryExpandRef(bgImage, resolvePublicUrl, unresolved);\n if (expanded) node.attr(\"data-bg-image\", expanded);\n });\n\n $(\"[style]\").each((_, element) => {\n const node = $(element);\n const style = node.attr(\"style\");\n if (!style?.includes(\"background\")) return;\n const rewritten = expandBackgroundUrlsInStyle(style, resolvePublicUrl, unresolved);\n if (rewritten !== style) node.attr(\"style\", rewritten);\n });\n\n return {\n html: $.root().html() ?? html,\n unresolved: [...unresolved],\n };\n}\n"],"mappings":";;;;;;;;;AAAA,YAAY,aAAa;;;ACEzB,SAAS,iBAAiB,KAAqB;AAC7C,SAAO,IAAI,QAAQ,qBAAqB,EAAE;AAC5C;AAEA,SAAS,kBAAkB,OAAuC;AAChE,QAAM,QAAgC,CAAC;AACvC,aAAW,eAAe,MAAM,MAAM,GAAG,GAAG;AAC1C,UAAM,UAAU,YAAY,KAAK;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U,KAAI,KAAK,OAAO,QAAQ;AAAA,IACxC;AAEA,UAAM,SAAS,IAAI,KAAK,QAAQ,GAAG,KAAK;AACxC,QAAI,QAAQ;AACV,UAAI,KAAK,UAAU,aAAa,QAAQ,kBAAkB,UAAU,CAAC;AAAA,IACvE;AAAA,EACF,CAAC;AAED,IAAE,iBAAiB,EAAE,KAAK,CAAC,GAAG,YAAY;AACxC,UAAM,OAAO,EAAE,OAAO;AACtB,UAAM,UAAU,KAAK,KAAK,eAAe,GAAG,KAAK;AACjD,QAAI,CAAC,QAAS;AACd,UAAM,WAAW,aAAa,SAAS,kBAAkB,UAAU;AACnE,QAAI,SAAU,MAAK,KAAK,iBAAiB,QAAQ;AAAA,EACnD,CAAC;AAED,IAAE,SAAS,EAAE,KAAK,CAAC,GAAG,YAAY;AAChC,UAAM,OAAO,EAAE,OAAO;AACtB,UAAM,QAAQ,KAAK,KAAK,OAAO;AAC/B,QAAI,CAAC,OAAO,SAAS,YAAY,EAAG;AACpC,UAAM,YAAY,4BAA4B,OAAO,kBAAkB,UAAU;AACjF,QAAI,cAAc,MAAO,MAAK,KAAK,SAAS,SAAS;AAAA,EACvD,CAAC;AAED,SAAO;AAAA,IACL,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK;AAAA,IACzB,YAAY,CAAC,GAAG,UAAU;AAAA,EAC5B;AACF;","names":["components","component","cheerio","SKIP_TAGS","INLINE_TAGS","tagNameOf","hasOnlyInlineContent","z","zodIssuesToValidationIssues","cheerio"]}
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  getAdapter
4
- } from "../chunk-Q44KGFIH.js";
4
+ } from "../chunk-53VXTXGM.js";
5
5
  import {
6
6
  analyzeConflicts,
7
7
  buildMigrationReport,
@@ -17,12 +17,12 @@ import {
17
17
  runMigration,
18
18
  staleUrlsFromEstimate,
19
19
  writeFilesystemExport
20
- } from "../chunk-VRRYN6NS.js";
20
+ } from "../chunk-5TRCJONX.js";
21
21
  import {
22
22
  collectEntities
23
- } from "../chunk-PFUXPS7A.js";
24
- import "../chunk-J7EUSPEA.js";
25
- import "../chunk-QFJXNEXG.js";
23
+ } from "../chunk-PD5AZX3B.js";
24
+ import "../chunk-4XZK55RW.js";
25
+ import "../chunk-HUSXCKPI.js";
26
26
  import "../chunk-XRCF73DA.js";
27
27
  import {
28
28
  createWpContentGatewayRewrite
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { M as MigrationAdapter, g as MigrationPlatform } from './types-CLNmloya.js';
2
- export { A as AdapterContext, E as EntityKey, h as EntityType, i as MigrationCursor, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, P as PortfolioMediaLink, k as PublishStatus, S as SourceMetadata, V as ValidationIssue, l as ValidationResult, W as WxrImportSummary, m as entityKey } from './types-CLNmloya.js';
1
+ import { M as MigrationAdapter, g as MigrationPlatform } from './types-Bicgdp4Z.js';
2
+ export { A as AdapterContext, E as EntityKey, h as EntityType, i as MigrationCursor, b as NormalizedAsset, j as NormalizedAssetExif, d as NormalizedCategory, f as NormalizedEntity, a as NormalizedPage, c as NormalizedPortfolio, N as NormalizedPost, e as NormalizedTag, P as PageHeroSliderHint, k as PageLayoutHints, l as PortfolioMediaLink, m as PublishStatus, S as SourceMetadata, V as ValidationIssue, n as ValidationResult, W as WxrImportSummary, o as entityKey } from './types-Bicgdp4Z.js';
3
3
  export { EntityState, MigrationCheckpoint, TrackedEntity, buildPortfolioMediaLinks, isTerminalState, normalizedAssetExifSchema, normalizedAssetSchema, normalizedCategorySchema, normalizedEntitySchema, normalizedPageSchema, normalizedPortfolioSchema, normalizedPostSchema, normalizedTagSchema, shouldProcessEntity, sourceMetadataSchema, validateNormalizedAsset, validateNormalizedCategory, validateNormalizedEntity, validateNormalizedPage, validateNormalizedPortfolio, validateNormalizedPost, validateNormalizedTag } from './normalizer/index.js';
4
- export { B as BundleCounts, E as EntityBundle, b as bundleCounts, c as collectEntities, e as emptyBundle } from './bundle-CysqqLij.js';
4
+ export { B as BundleCounts, E as EntityBundle, b as bundleCounts, c as collectEntities, e as emptyBundle } from './bundle-BgoXkWMy.js';
5
5
  export { AssetDiscoverySummary, ConflictReport, DryRunOptions, DryRunResult, FALLBACK_ASSET_BYTES, FilesystemMigrationSink, MIGRATION_WRITE_STAGES, MigrationRedirect, MigrationReport, MigrationRunMode, MigrationRunOptions, MigrationRunResult, MigrationSink, MigrationWriteStage, StorageEstimate, UploadAssetInput, UploadAssetResult, WriteFilesystemOptions, analyzeConflicts, buildMigrationReport, buildRedirectMap, bundleToCombinedJson, createFilesystemMigrationSink, detectRedirectLoops, emptyConflictReport, estimateStorage, hasBlockingConflicts, hasWarnings, portfolioMediaMatchesBundle, resolveAdapterImportSummary, runDryRun, runMigration, runMigrationFromBundle, staleUrlsFromEstimate, summarizeAssetDiscovery, writeFilesystemExport } from './sinks/index.js';
6
6
  export { R as RewriteInlineImageRef, a as RewriteInlineImagesOptions, b as RewriteInlineImagesResult, S as StampMigrationMediaRefsOptions, U as UploadedAssetRef, r as rewriteInlineImages, s as stampMigrationMediaRefs } from './rewrite-inline-images-BsgSquzV.js';
7
7
  export { ExpandMigrationMediaRefsResult, GrapesComponent, GrapesProjectSnapshot, GrapesStyleRule, HtmlToGrapesOptions, HtmlToTiptapOptions, LayoutKind, LayoutTypeMap, TiptapDoc, TiptapMark, TiptapNode, ValidateGrapesProjectSnapshotOptions, ValidateTiptapDocOptions, cssToStyles, expandMigrationMediaRefs, grapesComponentSchema, grapesProjectSnapshotSchema, grapesStyleRuleSchema, htmlToGrapes, htmlToTiptap, tiptapDocSchema, tiptapMarkSchema, tiptapNodeSchema, validateGrapesProjectSnapshot, validateTiptapDoc } from './transformers/index.js';
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  squarespaceAdapter,
14
14
  wixAdapter,
15
15
  wordpressAdapter
16
- } from "./chunk-Q44KGFIH.js";
16
+ } from "./chunk-53VXTXGM.js";
17
17
  import {
18
18
  normalizedAssetExifSchema,
19
19
  normalizedAssetSchema,
@@ -31,7 +31,7 @@ import {
31
31
  validateNormalizedPortfolio,
32
32
  validateNormalizedPost,
33
33
  validateNormalizedTag
34
- } from "./chunk-MUFGDYGI.js";
34
+ } from "./chunk-373TTCG7.js";
35
35
  import {
36
36
  FALLBACK_ASSET_BYTES,
37
37
  FilesystemMigrationSink,
@@ -58,7 +58,7 @@ import {
58
58
  staleUrlsFromEstimate,
59
59
  summarizeAssetDiscovery,
60
60
  writeFilesystemExport
61
- } from "./chunk-VRRYN6NS.js";
61
+ } from "./chunk-5TRCJONX.js";
62
62
  import {
63
63
  buildPortfolioMediaLinks,
64
64
  bundleCounts,
@@ -67,7 +67,7 @@ import {
67
67
  entityKey,
68
68
  isTerminalState,
69
69
  shouldProcessEntity
70
- } from "./chunk-PFUXPS7A.js";
70
+ } from "./chunk-PD5AZX3B.js";
71
71
  import {
72
72
  cssToStyles,
73
73
  expandMigrationMediaRefs,
@@ -81,12 +81,12 @@ import {
81
81
  tiptapNodeSchema,
82
82
  validateGrapesProjectSnapshot,
83
83
  validateTiptapDoc
84
- } from "./chunk-WCAHVNWW.js";
85
- import "./chunk-J7EUSPEA.js";
84
+ } from "./chunk-VQ5HKNYP.js";
85
+ import "./chunk-4XZK55RW.js";
86
86
  import {
87
87
  rewriteInlineImages,
88
88
  stampMigrationMediaRefs
89
- } from "./chunk-QFJXNEXG.js";
89
+ } from "./chunk-HUSXCKPI.js";
90
90
  import "./chunk-EJTWYEAX.js";
91
91
  import {
92
92
  linkToPath,