@soubiran/vite 0.8.6 → 0.8.8

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 (2) hide show
  1. package/dist/index.mjs +3 -2
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -69,6 +69,7 @@ const ogSVG = fs.readFileSync(new URL("./og-template.svg", import.meta.url), "ut
69
69
  const titleBreakRE = /(.{0,30})(?:\s|$)/g;
70
70
  const templateTokenRE = /\{\{([^}]+)\}\}/g;
71
71
  const titleSuffixRE = /\s-\s.*$/;
72
+ const pagesDirRE = /[/\\]pages[/\\]/;
72
73
  async function generate(title, hostname, output) {
73
74
  if (fs.existsSync(output)) return;
74
75
  await fs.mkdir(dirname(output), { recursive: true });
@@ -90,7 +91,7 @@ async function generate(title, hostname, output) {
90
91
  }
91
92
  function og(id, frontmatter, hostname) {
92
93
  (() => {
93
- const path = `og/${basename(id, ".md")}.png`;
94
+ const path = `og/${(id.split(pagesDirRE)[1] ?? id).replaceAll("\\", "/").replace(markdownExtensionRE, "")}.png`;
94
95
  promises.push(generate(frontmatter.title.replace(titleSuffixRE, "").trim(), hostname, `public/${path}`));
95
96
  frontmatter.image = `https://${hostname}/${path}`;
96
97
  })();
@@ -723,7 +724,7 @@ function scanPagesForMeta(pagesDir, baseUri = "") {
723
724
  * Generate meta.json file with all pages metadata
724
725
  */
725
726
  function generateMeta(outDir, hostname, logger) {
726
- const pagesDir = resolve(cwd(), "pages");
727
+ const pagesDir = resolve(cwd(), "src", "app", "pages");
727
728
  const distDir = resolve(cwd(), outDir);
728
729
  const pages = scanPagesForMeta(pagesDir).filter((page) => page.title).map((page) => ({
729
730
  id: page.id,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soubiran/vite",
3
3
  "type": "module",
4
- "version": "0.8.6",
4
+ "version": "0.8.8",
5
5
  "author": "Estéban Soubiran <esteban@soubiran.dev>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/Barbapapazes",
@@ -63,7 +63,7 @@
63
63
  "vite": "^8.0.10",
64
64
  "vite-ssg": "^28.3.0",
65
65
  "vue-router": "^5.0.6",
66
- "@soubiran/ui": "0.8.6"
66
+ "@soubiran/ui": "0.8.8"
67
67
  },
68
68
  "devDependencies": {
69
69
  "tsdown": "^0.21.10"