@soubiran/vite 0.3.1 → 0.4.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.
@@ -1,3 +1,10 @@
1
- import { n as toUrl, t as getUri } from "../utils-CgX7pSaU.mjs";
2
-
3
- export { getUri, toUrl };
1
+ import { joinURL, withoutTrailingSlash } from "ufo";
2
+ //#region src/utils.ts
3
+ function getUri(id) {
4
+ return withoutTrailingSlash(id.split("/pages/")[1].replace(/\.md$/, "").replace(/\.vue$/, "").replace(/index$/, ""));
5
+ }
6
+ function toUrl(hostname, ...paths) {
7
+ return joinURL(`https://${hostname}`, ...paths);
8
+ }
9
+ //#endregion
10
+ export { getUri, toUrl };
@@ -5,7 +5,6 @@ import { Options } from "unplugin-vue-markdown/types";
5
5
  type AssertFn = (id: string, frontmatter: Record<string, any>) => void;
6
6
  //#endregion
7
7
  //#region src/structured-data/breadcrumb.d.ts
8
-
9
8
  interface BreadcrumbItem {
10
9
  title: string;
11
10
  type?: 'WebSite' | 'WebPage';
@@ -1,4 +1,4 @@
1
- import { n as toUrl, t as getUri } from "./utils-CgX7pSaU.mjs";
1
+ import { getUri, toUrl } from "./src/utils.mjs";
2
2
  import { createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
3
3
  import { basename, dirname, join, resolve } from "node:path";
4
4
  import ui from "@nuxt/ui/vite";
@@ -27,7 +27,6 @@ import { cwd } from "node:process";
27
27
  import { cyan, dim, green, yellow } from "ansis";
28
28
  import { createHash } from "node:crypto";
29
29
  import { SitemapStream } from "sitemap";
30
-
31
30
  //#region src/assert.ts
32
31
  function createAssert(customAssert) {
33
32
  return (id, frontmatter) => {
@@ -38,7 +37,6 @@ function createAssert(customAssert) {
38
37
  customAssert?.(id, frontmatter);
39
38
  };
40
39
  }
41
-
42
40
  //#endregion
43
41
  //#region src/canonical.ts
44
42
  function getCanonicalUrl(id, hostname) {
@@ -57,13 +55,12 @@ function canonical(id, frontmatter, hostname) {
57
55
  href: url
58
56
  });
59
57
  }
60
-
61
58
  //#endregion
62
59
  //#region src/markdown-it/custom-image.ts
63
60
  function customImage(md, hostname) {
64
- md.use((md$1) => {
65
- const imageRule = md$1.renderer.rules.image;
66
- md$1.renderer.rules.image = async (tokens, idx, options, env, self) => {
61
+ md.use((md) => {
62
+ const imageRule = md.renderer.rules.image;
63
+ md.renderer.rules.image = async (tokens, idx, options, env, self) => {
67
64
  const token = tokens[idx];
68
65
  const src = token.attrGet("src");
69
66
  if (src) {
@@ -88,13 +85,12 @@ function customImage(md, hostname) {
88
85
  };
89
86
  });
90
87
  }
91
-
92
88
  //#endregion
93
89
  //#region src/markdown-it/custom-link.ts
94
90
  function customLink(md, hostname) {
95
- md.use((md$1) => {
96
- const linkRule = md$1.renderer.rules.link_open;
97
- md$1.renderer.rules.link_open = (tokens, idx, options, env, self) => {
91
+ md.use((md) => {
92
+ const linkRule = md.renderer.rules.link_open;
93
+ md.renderer.rules.link_open = (tokens, idx, options, env, self) => {
98
94
  const token = tokens[idx];
99
95
  const href = token.attrGet("href");
100
96
  if (href && /^https?:\/\/(?:[a-z0-9-]+\.)?soubiran\.dev(?:[/?#]|$)/.test(href)) {
@@ -118,19 +114,16 @@ function customLink(md, hostname) {
118
114
  };
119
115
  });
120
116
  }
121
-
122
117
  //#endregion
123
118
  //#region src/markdown-it/github-alerts.ts
124
119
  function githubAlerts(md) {
125
120
  md.use(MarkdownItGitHubAlerts);
126
121
  }
127
-
128
122
  //#endregion
129
123
  //#region src/markdown-it/implicit-figures.ts
130
124
  function implicitFiguresRule(md) {
131
125
  md.use(implicitFigures, { figcaption: "alt" });
132
126
  }
133
-
134
127
  //#endregion
135
128
  //#region src/markdown-it/link-attributes.ts
136
129
  function linkAttributesRule(md) {
@@ -145,7 +138,6 @@ function linkAttributesRule(md) {
145
138
  }
146
139
  }]);
147
140
  }
148
-
149
141
  //#endregion
150
142
  //#region src/markdown-it/shiki-highlight.ts
151
143
  async function shikiHighlight(md) {
@@ -157,7 +149,6 @@ async function shikiHighlight(md) {
157
149
  }
158
150
  }));
159
151
  }
160
-
161
152
  //#endregion
162
153
  //#region ../../node_modules/.pnpm/markdown-it-table-of-contents@1.1.0_patch_hash=bf17e463c2a0f62d05f1686e2d4c458136845ea3b2c32121b585ceededa45171/node_modules/markdown-it-table-of-contents/index.mjs
163
154
  /**
@@ -349,12 +340,11 @@ function flatHeadlineItemsToNestedTree(headlineItems) {
349
340
  });
350
341
  return toc;
351
342
  }
352
-
353
343
  //#endregion
354
344
  //#region src/markdown-it/table-of-contents.ts
355
345
  function tableOfContentsRule(md) {
356
- md.use((md$1) => {
357
- md$1.renderer.rules.heading_open = (tokens, idx, options, _env, self) => {
346
+ md.use((md) => {
347
+ md.renderer.rules.heading_open = (tokens, idx, options, _env, self) => {
358
348
  const token = tokens[idx];
359
349
  if (token.tag === "h2" || token.tag === "h3") {
360
350
  const inlineToken = tokens[idx + 1];
@@ -364,14 +354,14 @@ function tableOfContentsRule(md) {
364
354
  }
365
355
  return self.renderToken(tokens, idx, options);
366
356
  };
367
- md$1.renderer.rules.heading_close = (tokens, idx, options, _env, self) => {
357
+ md.renderer.rules.heading_close = (tokens, idx, options, _env, self) => {
368
358
  const token = tokens[idx];
369
359
  if (token.tag === "h2" || token.tag === "h3") return "</Heading>";
370
360
  return self.renderToken(tokens, idx, options);
371
361
  };
372
362
  });
373
- md.use((md$1) => {
374
- md$1.core.ruler.push("toc_to_env", (state) => {
363
+ md.use((md) => {
364
+ md.core.ruler.push("toc_to_env", (state) => {
375
365
  const options = defaultOptions;
376
366
  const tocTree = flatHeadlineItemsToNestedTree(findHeadlineElements(options.includeLevel, state.tokens, options));
377
367
  state.env.frontmatter = state.env.frontmatter || {};
@@ -380,14 +370,12 @@ function tableOfContentsRule(md) {
380
370
  });
381
371
  });
382
372
  }
383
-
384
373
  //#endregion
385
374
  //#region src/promise.ts
386
375
  const promises = [];
387
376
  async function resolveAll() {
388
377
  await Promise.all(promises);
389
378
  }
390
-
391
379
  //#endregion
392
380
  //#region src/og.ts
393
381
  const ogSVG = fs.readFileSync(new URL("./og-template.svg", import.meta.url), "utf-8");
@@ -417,7 +405,6 @@ function og(id, frontmatter, hostname) {
417
405
  frontmatter.image = `https://${hostname}/${path}`;
418
406
  })();
419
407
  }
420
-
421
408
  //#endregion
422
409
  //#region src/plugins/api.ts
423
410
  /**
@@ -477,7 +464,6 @@ function apiPlugin(categories = []) {
477
464
  }
478
465
  };
479
466
  }
480
-
481
467
  //#endregion
482
468
  //#region src/plugins/markdown.ts
483
469
  /**
@@ -546,7 +532,6 @@ function markdownPlugin() {
546
532
  }
547
533
  };
548
534
  }
549
-
550
535
  //#endregion
551
536
  //#region src/plugins/meta.ts
552
537
  /**
@@ -619,39 +604,36 @@ function metaPlugin(hostname) {
619
604
  }
620
605
  };
621
606
  }
622
-
623
607
  //#endregion
624
608
  //#region src/sitemap.ts
625
609
  const routes = /* @__PURE__ */ new Set();
626
- function sitemap(config, hostname, routes$1) {
610
+ function sitemap(config, hostname, routes) {
627
611
  const sitemapStream = new SitemapStream({ hostname: `https://${hostname}` });
628
612
  const writeStream = createWriteStream(join(config.build.outDir, "sitemap.xml"));
629
613
  sitemapStream.pipe(writeStream);
630
- routes$1.forEach((item) => sitemapStream.write(item));
614
+ routes.forEach((item) => sitemapStream.write(item));
631
615
  sitemapStream.end();
632
616
  }
633
-
634
617
  //#endregion
635
618
  //#region src/structured-data/article.ts
636
619
  /**
637
620
  * @see https://developer.yoast.com/features/schema/pieces/article/
638
621
  */
639
- function article(id, structuredData$1, properties, options) {
622
+ function article(id, structuredData, properties, options) {
640
623
  const { title, description } = properties;
641
624
  return { data: {
642
625
  "@type": "Article",
643
626
  "@id": joinURL(toUrl(options.hostname), "#", "schema", "Article", getUri(id)),
644
627
  "headline": title,
645
628
  "description": description,
646
- "isPartOf": { "@id": structuredData$1.webpage.data["@id"] },
647
- "mainEntityOfPage": { "@id": structuredData$1.webpage.data["@id"] },
648
- "datePublished": structuredData$1.webpage.data.datePublished ? structuredData$1.webpage.data.datePublished : void 0,
649
- "author": { "@id": structuredData$1.person.data["@id"] },
650
- "publisher": { "@id": structuredData$1.person.data["@id"] },
651
- "inLanguage": structuredData$1.webpage.data.inLanguage
629
+ "isPartOf": { "@id": structuredData.webpage.data["@id"] },
630
+ "mainEntityOfPage": { "@id": structuredData.webpage.data["@id"] },
631
+ "datePublished": structuredData.webpage.data.datePublished ? structuredData.webpage.data.datePublished : void 0,
632
+ "author": { "@id": structuredData.person.data["@id"] },
633
+ "publisher": { "@id": structuredData.person.data["@id"] },
634
+ "inLanguage": structuredData.webpage.data.inLanguage
652
635
  } };
653
636
  }
654
-
655
637
  //#endregion
656
638
  //#region src/structured-data/breadcrumb.ts
657
639
  /**
@@ -672,7 +654,6 @@ function breadcrumb(id, items, options) {
672
654
  }))
673
655
  } };
674
656
  }
675
-
676
657
  //#endregion
677
658
  //#region src/structured-data/person.ts
678
659
  /**
@@ -686,13 +667,12 @@ function person(options, personOptions) {
686
667
  "sameAs": personOptions.sameAs
687
668
  } };
688
669
  }
689
-
690
670
  //#endregion
691
671
  //#region src/structured-data/webpage.ts
692
672
  /**
693
673
  * @see https://developer.yoast.com/features/schema/pieces/webpage/
694
674
  */
695
- function webpage(id, structuredData$1, properties, options) {
675
+ function webpage(id, structuredData, properties, options) {
696
676
  const { title, description, datePublished, keywords } = properties;
697
677
  const canonicalUrl = getCanonicalUrl(id, options.hostname);
698
678
  const data = {
@@ -701,7 +681,7 @@ function webpage(id, structuredData$1, properties, options) {
701
681
  "url": canonicalUrl,
702
682
  "name": title,
703
683
  "description": description,
704
- "isPartOf": { "@id": structuredData$1.website.data["@id"] },
684
+ "isPartOf": { "@id": structuredData.website.data["@id"] },
705
685
  "inLanguage": "en-US",
706
686
  "potentialAction": [{
707
687
  "@type": "ReadAction",
@@ -721,23 +701,21 @@ function webpage(id, structuredData$1, properties, options) {
721
701
  }
722
702
  };
723
703
  }
724
-
725
704
  //#endregion
726
705
  //#region src/structured-data/website.ts
727
706
  /**
728
707
  * @see https://developer.yoast.com/features/schema/pieces/website/
729
708
  */
730
- function website(structuredData$1, options) {
709
+ function website(structuredData, options) {
731
710
  return { data: {
732
711
  "@type": "WebSite",
733
712
  "@id": joinURL(options.url, "#", "schema", "WebSite", "1"),
734
713
  "url": options.url,
735
714
  "name": options.name,
736
715
  "inLanguage": ["en-US"],
737
- "publisher": { "@id": structuredData$1.person.data["@id"] }
716
+ "publisher": { "@id": structuredData.person.data["@id"] }
738
717
  } };
739
718
  }
740
-
741
719
  //#endregion
742
720
  //#region src/structured-data/index.ts
743
721
  function structuredData(id, frontmatter, options) {
@@ -783,7 +761,6 @@ function structuredData(id, frontmatter, options) {
783
761
  innerHTML: JSON.stringify(graph)
784
762
  });
785
763
  }
786
-
787
764
  //#endregion
788
765
  //#region vite.config.ts
789
766
  var vite_config_default = (title, hostname, options, config = {}) => {
@@ -936,6 +913,5 @@ var vite_config_default = (title, hostname, options, config = {}) => {
936
913
  }
937
914
  }), config);
938
915
  };
939
-
940
916
  //#endregion
941
- export { vite_config_default as default };
917
+ export { vite_config_default as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soubiran/vite",
3
3
  "type": "module",
4
- "version": "0.3.1",
4
+ "version": "0.4.0",
5
5
  "author": "Estéban Soubiran <esteban@soubiran.dev>",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/Barbapapazes",
@@ -27,41 +27,41 @@
27
27
  "dist"
28
28
  ],
29
29
  "dependencies": {
30
- "@nuxt/ui": "^4.2.0",
31
- "@shikijs/markdown-it": "^3.15.0",
30
+ "@nuxt/ui": "4.5.0",
31
+ "@shikijs/markdown-it": "^4.0.2",
32
32
  "@types/fs-extra": "^11.0.4",
33
33
  "@types/markdown-it": "^14.1.2",
34
34
  "@types/markdown-it-link-attributes": "^3.0.5",
35
- "@types/node": "^24.10.1",
36
- "@unhead/vue": "^2.0.19",
35
+ "@types/node": "^24.12.0",
36
+ "@unhead/vue": "^2.1.12",
37
37
  "@unpic/placeholder": "^0.1.2",
38
- "@vitejs/plugin-vue": "^6.0.2",
38
+ "@vitejs/plugin-vue": "^6.0.5",
39
39
  "ansis": "^4.2.0",
40
- "fs-extra": "^11.3.2",
40
+ "fs-extra": "^11.3.4",
41
41
  "gray-matter": "^4.0.3",
42
- "markdown-it": "^14.1.0",
42
+ "markdown-it": "^14.1.1",
43
43
  "markdown-it-async": "^2.2.0",
44
- "markdown-it-github-alerts": "^1.0.0",
44
+ "markdown-it-github-alerts": "^1.0.1",
45
45
  "markdown-it-image-figures": "^2.1.1",
46
46
  "markdown-it-link-attributes": "^4.0.1",
47
47
  "markdown-it-table-of-contents": "^1.1.0",
48
48
  "sharp": "^0.34.5",
49
- "shiki": "^3.15.0",
50
- "sitemap": "^8.0.2",
49
+ "shiki": "^4.0.2",
50
+ "sitemap": "^9.0.1",
51
51
  "typescript": "^5.9.3",
52
- "ufo": "^1.6.1",
53
- "unhead": "^2.0.19",
52
+ "ufo": "^1.6.3",
53
+ "unhead": "^2.1.12",
54
54
  "unplugin-fonts": "^1.4.0",
55
- "unplugin-icons": "^22.5.0",
56
- "unplugin-vue-markdown": "^29.2.0",
55
+ "unplugin-icons": "^23.0.1",
56
+ "unplugin-vue-markdown": "^30.0.0",
57
57
  "unplugin-vue-router": "^0.16.2",
58
- "vite": "npm:rolldown-vite@7.1.20",
59
- "vite-ssg": "^28.2.2",
58
+ "vite": "^8.0.1",
59
+ "vite-ssg": "^28.3.0",
60
60
  "vue-router": "^4.6.3",
61
- "@soubiran/ui": "0.3.1"
61
+ "@soubiran/ui": "0.4.0"
62
62
  },
63
63
  "devDependencies": {
64
- "tsdown": "^0.18.3"
64
+ "tsdown": "^0.21.4"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "tsdown"
@@ -1,12 +0,0 @@
1
- import { joinURL, withoutTrailingSlash } from "ufo";
2
-
3
- //#region src/utils.ts
4
- function getUri(id) {
5
- return withoutTrailingSlash(id.split("/pages/")[1].replace(/\.md$/, "").replace(/\.vue$/, "").replace(/index$/, ""));
6
- }
7
- function toUrl(hostname, ...paths) {
8
- return joinURL(`https://${hostname}`, ...paths);
9
- }
10
-
11
- //#endregion
12
- export { toUrl as n, getUri as t };