vite-plugin-sitemap 0.2.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.
Files changed (5) hide show
  1. package/README.md +7 -0
  2. package/dist/index.d.ts +111 -3
  3. package/dist/index.js +10234 -8445
  4. package/dist/index.mjs +10270 -8492
  5. package/package.json +13 -12
package/README.md CHANGED
@@ -137,6 +137,13 @@ Last modification option for sitemap.
137
137
 
138
138
  Converts XML into a human readable format
139
139
 
140
+ ### generateRobotsTxt
141
+
142
+ - **Type:** `boolean`
143
+ - **Default:** `true`
144
+
145
+ Enables robots.txt file generation
146
+
140
147
  ### robots
141
148
 
142
149
  - **Type:** `RobotOption[]`
package/dist/index.d.ts CHANGED
@@ -1,6 +1,114 @@
1
- import { Plugin } from 'vite';
2
- import { UserOptions } from 'sitemap-ts';
1
+ interface RobotOption {
2
+ /**
3
+ * User-agent value.
4
+ * Example: Googlebot
5
+ */
6
+ userAgent: string;
7
+ /**
8
+ * Allowed routes for corresponding User-agent.
9
+ * Example: '/'
10
+ */
11
+ allow?: string | string[];
12
+ /**
13
+ * Disallowed routes for corresponding User-agent.
14
+ * Example: ['/admin', '/confidential']
15
+ */
16
+ disallow?: string | string[];
17
+ /**
18
+ * Crawl-delay option for robot.
19
+ * Example: 2
20
+ */
21
+ crawlDelay?: number;
22
+ /**
23
+ * Clean-param option for robot.
24
+ * Example: 'ref /articles/'
25
+ */
26
+ cleanParam?: string;
27
+ }
28
+ /**
29
+ * Plugin options.
30
+ */
31
+ interface Options {
32
+ /**
33
+ * Base URI
34
+ * @default 'http://localhost/'
35
+ */
36
+ hostname: string;
37
+ /**
38
+ * Array of strings with dynamic routes.
39
+ * Example: ['/routes1', '/route2/sub-route']
40
+ * @default []
41
+ */
42
+ dynamicRoutes: string[];
43
+ /**
44
+ * Array of strings with excluded routes.
45
+ * Example: ['/routes1', '/route2/sub-route']
46
+ * @default []
47
+ */
48
+ exclude: string[];
49
+ /**
50
+ * String with base path.
51
+ * Example: '/mysubpath'
52
+ * @default ''
53
+ */
54
+ basePath: string;
55
+ /**
56
+ * Output directory
57
+ * @default 'dist'
58
+ */
59
+ outDir: string;
60
+ /**
61
+ * File extensions that need to be generated.
62
+ * Example: ['html', 'md']
63
+ * @default 'html'
64
+ */
65
+ extensions: string | string[];
66
+ /**
67
+ * Change frequency option for sitemap
68
+ * @default 'daily'
69
+ */
70
+ changefreq: string;
71
+ /**
72
+ * Priority option for sitemap
73
+ * @default 1
74
+ */
75
+ priority: number;
76
+ /**
77
+ * Last modification option for sitemap
78
+ * @default new Date()
79
+ */
80
+ lastmod: Date;
81
+ /**
82
+ * Converts XML into a human-readable format
83
+ * @default false
84
+ */
85
+ readable: boolean;
86
+ /**
87
+ * Enables robots.txt file generation
88
+ * @default true
89
+ */
90
+ generateRobotsTxt: boolean;
91
+ /**
92
+ * Robots policy
93
+ * @default [{ userAgent: '*', allow: '/' }]
94
+ */
95
+ robots: RobotOption[];
96
+ }
97
+ type UserOptions = Partial<Options>;
3
98
 
4
- declare function sitemapPlugin(options?: UserOptions): Plugin;
99
+ declare function sitemapPlugin(options?: UserOptions): {
100
+ name: string;
101
+ closeBundle(): void;
102
+ transformIndexHtml(): {
103
+ tag: string;
104
+ injectTo: "head" | "body" | "head-prepend" | "body-prepend" | undefined;
105
+ attrs: {
106
+ rel: string;
107
+ type: string;
108
+ title: string;
109
+ href: string;
110
+ };
111
+ }[];
112
+ };
5
113
 
6
114
  export { sitemapPlugin as default };