@ox-content/vite-plugin 0.7.0 → 0.8.0

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.cjs CHANGED
@@ -7947,11 +7947,11 @@ function resolveDocsOptions(options) {
7947
7947
  /**
7948
7948
  * Wraps template HTML in a minimal document with viewport locked to given dimensions.
7949
7949
  */
7950
- function wrapHtml(bodyHtml, width, height) {
7950
+ function wrapHtml(bodyHtml, width, height, useBaseUrl) {
7951
7951
  return `<!DOCTYPE html>
7952
7952
  <html>
7953
7953
  <head>
7954
- <meta charset="UTF-8">
7954
+ <meta charset="UTF-8">${useBaseUrl ? `\n<base href="http://localhost/">` : ""}
7955
7955
  <style>
7956
7956
  * { margin: 0; padding: 0; box-sizing: border-box; }
7957
7957
  html, body { width: ${width}px; height: ${height}px; overflow: hidden; }
@@ -8008,7 +8008,7 @@ async function renderHtmlToPng(page, html, width, height, publicDir) {
8008
8008
  }
8009
8009
  });
8010
8010
  }
8011
- const fullHtml = wrapHtml(html, width, height);
8011
+ const fullHtml = wrapHtml(html, width, height, !!publicDir);
8012
8012
  await page.setContent(fullHtml, { waitUntil: "networkidle" });
8013
8013
  const screenshot = await page.screenshot({
8014
8014
  type: "png",
@@ -8301,16 +8301,7 @@ async function resolveVueTemplate(templatePath, options, root) {
8301
8301
  if (compilerSfc) {
8302
8302
  const sfcSource = await fs.readFile(templatePath, "utf-8");
8303
8303
  const { descriptor } = compilerSfc.parse(sfcSource, { filename: templatePath });
8304
- const scopeId = Component.__scopeId;
8305
- for (const style of descriptor.styles) if (style.scoped && scopeId) {
8306
- const result = compilerSfc.compileStyle({
8307
- id: scopeId,
8308
- source: style.content,
8309
- scoped: true,
8310
- filename: templatePath
8311
- });
8312
- if (!result.errors.length) extractedCss += result.code;
8313
- } else extractedCss += style.content;
8304
+ for (const style of descriptor.styles) extractedCss += style.content;
8314
8305
  }
8315
8306
  } catch {}
8316
8307
  const { createSSRApp } = await import("vue");