@opendesign-plus-test/plugins 0.0.1-rc.12 → 0.0.1-rc.14

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