do11y 0.2.5 → 0.2.7

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.
@@ -5,16 +5,14 @@ import { do11yOptions } from "../../options.js";
5
5
  */
6
6
  export default () => ({
7
7
  name: "do11y:highlight-css",
8
- async resolveId(id) {
8
+ resolveId(id) {
9
9
  if (id === "do11y:css") {
10
- return "\0dolly:css.css";
10
+ return "\0dolly:css";
11
11
  }
12
12
  },
13
- load: {
14
- order: "post",
15
- handler(id) {
16
- if (id === "\0dolly:css.css") {
17
- const generateThemeCss = (theme) => `
13
+ load(id) {
14
+ if (id === "\0dolly:css") {
15
+ const generateThemeCss = (theme) => `
18
16
  [data-theme="${theme}"] .shiki {
19
17
  background-color: var(--shiki-${theme}-bg) !important;
20
18
  }
@@ -23,11 +21,11 @@ export default () => ({
23
21
  color: var(--shiki-${theme}) !important;
24
22
  }
25
23
  `;
26
- return Object.keys(do11yOptions.highlighter.themesInput)
27
- .filter((theme) => do11yOptions.highlighter.defaultTheme !== theme)
28
- .map((theme) => generateThemeCss(theme))
29
- .join("\n");
30
- }
31
- },
24
+ const css = Object.keys(do11yOptions.highlighter.themesInput)
25
+ .filter((theme) => do11yOptions.highlighter.defaultTheme !== theme)
26
+ .map((theme) => generateThemeCss(theme))
27
+ .join("\n");
28
+ return `export default \`${css}\``;
29
+ }
32
30
  },
33
31
  });
@@ -45,7 +45,7 @@ export default () => {
45
45
  configureServer(server) {
46
46
  viteDevServer = server;
47
47
  },
48
- async load(id) {
48
+ async transform(_, id) {
49
49
  if (id.endsWith(".vue?highlight") || id.endsWith(".vue?highlight&lang=css")) {
50
50
  const path = id.replace("?highlight", "").replace("&lang=css", "");
51
51
  const source = readFileSync(path, "utf-8");
@@ -57,7 +57,10 @@ export default () => {
57
57
  * to compile the style tags to CSS.
58
58
  */
59
59
  if (viteDevServer?.config.command === "serve" || !id.endsWith("lang=css")) {
60
- return `export default \`${await highlightAndFormatCode(path, source)}\`;`;
60
+ return {
61
+ code: `export default \`${await highlightAndFormatCode(path, source)}\`;`,
62
+ moduleType: "js",
63
+ };
61
64
  }
62
65
  const loadCss = async (index, lang) => {
63
66
  const { code } = await this.load({
@@ -76,7 +79,10 @@ export default () => {
76
79
  .filter((stylesheet) => !!stylesheet)
77
80
  .map((stylesheet) => `<style>${stylesheet}</style>`)
78
81
  .join("\n");
79
- return `export default \`${await highlightAndFormatCode(path, sourceWithoutStyles + css)}\`;`;
82
+ return {
83
+ code: `export default \`${await highlightAndFormatCode(path, sourceWithoutStyles + css)}\`;`,
84
+ moduleType: "js",
85
+ };
80
86
  }
81
87
  },
82
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "do11y",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "A bare-bones tool to document Vue components.",
5
5
  "keywords": [
6
6
  "docs-generator",