do11y 0.5.11 → 0.5.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.
@@ -6,7 +6,6 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
 
8
8
  <title>Do11y</title>
9
- <link rel="icon" href="/favicon.ico" />
10
9
  </head>
11
10
 
12
11
  <body id="app"></body>
@@ -4,6 +4,10 @@ import { JSDOM } from "jsdom";
4
4
  const template = readFileSync(join(import.meta.dirname, "index.html"), "utf-8");
5
5
  export const render = (base = "", script, stylesheets = []) => {
6
6
  const jsdom = new JSDOM(template);
7
+ const faviconElement = jsdom.window.document.createElement("link");
8
+ faviconElement.setAttribute("rel", "icon");
9
+ faviconElement.setAttribute("href", `${base}favicon.ico`);
10
+ jsdom.window.document.head.appendChild(faviconElement);
7
11
  const scriptElement = jsdom.window.document.createElement("script");
8
12
  scriptElement.setAttribute("type", "module");
9
13
  scriptElement.setAttribute("src", `${base}${script}`);
@@ -34,18 +34,27 @@ const getPlugin = async (plugin) => {
34
34
  const getUserPlugins = async (userViteConfig) => {
35
35
  const userPlugins = userViteConfig.plugins?.map(async (p) => await getPlugin(p)) ?? [];
36
36
  const resolvedUserPlugins = (await Promise.all(userPlugins)).flat();
37
- const vuePluginApi = resolvedUserPlugins.find((p) => p.name === "vite:vue")?.api;
37
+ const vuePluginApi = resolvedUserPlugins.find((p) => p.name === "vite:vue")?.api ?? {};
38
38
  const VuePlugin = (await import("@vitejs/plugin-vue")).default;
39
+ const { include, exclude } = vuePluginApi;
40
+ const mergeInclusion = (rawValues, do11yValues) => {
41
+ const values = Array.isArray(rawValues) ? rawValues : rawValues ? [rawValues] : [];
42
+ return [...new Set([...values, ...do11yValues])];
43
+ };
39
44
  return [
40
45
  VuePlugin({
41
46
  ...vuePluginApi?.options,
42
- include: [/\.vue$/, /\.md$/],
43
- exclude: [
47
+ /* prettier-ignore */
48
+ include: mergeInclusion(include, [
49
+ /\.vue$/,
50
+ /\.md$/
51
+ ]),
52
+ exclude: mergeInclusion(exclude, [
44
53
  /\.vue\?meta$/,
45
54
  /\.vue\?highlight$/,
46
55
  /\.vue\?highlight&lang=css$/,
47
56
  /\.vue\?highlight&styleless$/,
48
- ],
57
+ ]),
49
58
  }),
50
59
  ...resolvedUserPlugins.filter((i) => i.name !== "vite:vue"),
51
60
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "do11y",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "A bare-bones tool to document Vue components.",
5
5
  "keywords": [
6
6
  "docs-generator",