@emailens/engine 0.11.2 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10571,9 +10571,12 @@ function transformForClient(html, clientId, framework) {
10571
10571
  ]
10572
10572
  };
10573
10573
  }
10574
- const source = clientId === "outlook-windows-legacy" ? renderOutlookBranch(html) : html;
10574
+ const wordEngine = clientId === "outlook-windows-legacy" && /<!--\[if/i.test(html);
10575
+ const source = wordEngine ? resolveMsoBranch(html) : html;
10575
10576
  const downleveled = downlevelCSS(source);
10576
- return applyTransform(downleveled, config, framework);
10577
+ const result = applyTransform(downleveled, config, framework);
10578
+ if (wordEngine) result.html = vmlToCss(result.html);
10579
+ return result;
10577
10580
  }
10578
10581
  function transformForAllClients(html, framework) {
10579
10582
  if (!html || !html.trim()) {
@@ -10587,9 +10590,18 @@ function transformForAllClients(html, framework) {
10587
10590
  throw new Error(`HTML input exceeds ${MAX_HTML_SIZE / 1024}KB limit.`);
10588
10591
  }
10589
10592
  const downleveled = downlevelCSS(html);
10590
- return Object.keys(CLIENT_CONFIGS).map(
10591
- (clientId) => applyTransform(downleveled, CLIENT_CONFIGS[clientId], framework)
10592
- );
10593
+ const hasOutlookBranch = /<!--\[if/i.test(html);
10594
+ const outlookSource = hasOutlookBranch ? downlevelCSS(resolveMsoBranch(html)) : downleveled;
10595
+ return Object.keys(CLIENT_CONFIGS).map((clientId) => {
10596
+ const wordEngine = clientId === "outlook-windows-legacy" && hasOutlookBranch;
10597
+ const result = applyTransform(
10598
+ wordEngine ? outlookSource : downleveled,
10599
+ CLIENT_CONFIGS[clientId],
10600
+ framework
10601
+ );
10602
+ if (wordEngine) result.html = vmlToCss(result.html);
10603
+ return result;
10604
+ });
10593
10605
  }
10594
10606
 
10595
10607
  // src/analyze.ts