@opendesign-plus-test/plugins 0.0.1-rc.12 → 0.0.1-rc.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.
@@ -1,70 +0,0 @@
1
- import { defineNuxtModule as h, addVitePlugin as y } from "nuxt/kit";
2
- import { g as S, m as j } from "../../generate-lastmod-changefreq-Wk3kOITw.js";
3
- import { existsSync as w, readFileSync as $, createWriteStream as b, readdirSync as x } from "node:fs";
4
- import i from "node:path";
5
- import { pipeline as A } from "node:stream/promises";
6
- const v = h({
7
- meta: {
8
- name: "generate-sitemap",
9
- configKey: "generateSitemap"
10
- },
11
- setup(t, a) {
12
- y(S(t.lastmodAndChangefreqOptions));
13
- const u = Array.isArray(t.ignore) ? t.ignore : typeof t.ignore == "string" ? [t.ignore] : [], f = t.base.endsWith("/") ? t.base.slice(0, -1) : t.base;
14
- a.hook("close", async () => {
15
- const s = i.join(a.options.rootDir, ".output", "public");
16
- if (!w(s))
17
- return;
18
- const m = [], c = (e) => {
19
- const o = x(e, {
20
- withFileTypes: !0,
21
- encoding: "utf-8"
22
- });
23
- for (const n of o) {
24
- if (n.isDirectory()) {
25
- c(i.join(e, n.name));
26
- continue;
27
- }
28
- if (n.name === "index.html") {
29
- const r = `/${i.relative(s, e).replace(/\\/g, "/")}`;
30
- for (const l of u)
31
- j(r, l);
32
- m.push(r);
33
- }
34
- }
35
- };
36
- c(s), console.log("[module:generate-sitemap] collect html done");
37
- const g = t.lastmodAndChangefreqOptions.outputFile || i.join(a.options.rootDir, "last-modified.json"), d = JSON.parse($(g, "utf-8")), p = b(i.join(s, "sitemap.xml"), "utf-8");
38
- try {
39
- await A(function* () {
40
- yield `<?xml version="1.0" encoding="UTF-8"?>
41
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
42
- `;
43
- for (const e of m) {
44
- if (!e.startsWith("/"))
45
- continue;
46
- const o = d[`pages${e}/index.vue`] || d[`pages${e}.md`];
47
- o != null && o.lastmod && (o.lastmod = new Date(o.lastmod).toISOString());
48
- const n = {
49
- loc: f + e,
50
- ...o
51
- };
52
- yield ` <url>
53
- ${Object.entries(n).map(([r, l]) => ` <${r}>${l}</${r}>`).join(`
54
- `)}
55
- </url>
56
- `;
57
- }
58
- yield "</urlset>";
59
- }, p);
60
- } catch (e) {
61
- console.log("[module:generate-sitemap] error", e);
62
- return;
63
- }
64
- console.log("[module:generate-sitemap] generate done");
65
- });
66
- }
67
- });
68
- export {
69
- v as default
70
- };
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;