do11y 0.4.1 → 0.4.3
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.
package/dist/docs/html/plugin.js
CHANGED
|
@@ -3,10 +3,19 @@ import { writeFileSync } from "node:fs";
|
|
|
3
3
|
import { output } from "../files.js";
|
|
4
4
|
import { render } from "./render.js";
|
|
5
5
|
export const indexHtml = (folder, key) => ({
|
|
6
|
-
writeBundle() {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
writeBundle(_, bundle) {
|
|
7
|
+
const chunk = Object.values(bundle).find((chunk) => {
|
|
8
|
+
return chunk.type === "chunk" && chunk.isEntry && chunk.facadeModuleId?.endsWith(`${key}.js`);
|
|
9
|
+
});
|
|
10
|
+
if (!chunk) {
|
|
11
|
+
throw new Error(`Failed to create HTML file for ${key}.`);
|
|
12
|
+
}
|
|
13
|
+
const stylesheets = Array.from(chunk.viteMetadata?.importedCss || []);
|
|
14
|
+
const html = render(chunk.fileName, stylesheets);
|
|
15
|
+
writeFileSync(join(output, `${key}.html`), html);
|
|
16
|
+
if (key === "index") {
|
|
17
|
+
writeFileSync(join(output, "404.html"), html);
|
|
18
|
+
}
|
|
10
19
|
},
|
|
11
20
|
configureServer(server) {
|
|
12
21
|
const bundle = join(folder, `${key}.js`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const render: (script: string,
|
|
1
|
+
export declare const render: (script: string, stylesheets?: string[]) => string;
|
package/dist/docs/html/render.js
CHANGED
|
@@ -2,13 +2,13 @@ import { readFileSync } from "node:fs";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { JSDOM } from "jsdom";
|
|
4
4
|
const template = readFileSync(join(import.meta.dirname, "index.html"), "utf-8");
|
|
5
|
-
export const render = (script,
|
|
5
|
+
export const render = (script, stylesheets = []) => {
|
|
6
6
|
const jsdom = new JSDOM(template);
|
|
7
7
|
const scriptElement = jsdom.window.document.createElement("script");
|
|
8
8
|
scriptElement.setAttribute("type", "module");
|
|
9
9
|
scriptElement.setAttribute("src", script);
|
|
10
10
|
jsdom.window.document.documentElement.appendChild(scriptElement);
|
|
11
|
-
|
|
11
|
+
for (const stylesheet of stylesheets) {
|
|
12
12
|
const linkElement = jsdom.window.document.createElement("link");
|
|
13
13
|
linkElement.setAttribute("as", "style");
|
|
14
14
|
linkElement.setAttribute("rel", "preload stylesheet");
|
package/dist/docs/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import type { Options } from "./plugins/options.js";
|
|
|
2
2
|
import type { Meta } from "./plugins/meta/meta-types.js";
|
|
3
3
|
export type { Options, Meta };
|
|
4
4
|
export interface SandboxIframeProps {
|
|
5
|
+
/**
|
|
6
|
+
* The accessible title for the Iframe.
|
|
7
|
+
*/
|
|
8
|
+
title: string;
|
|
5
9
|
/**
|
|
6
10
|
* The `id` of the sandbox - which is the filename
|
|
7
11
|
* in lower-case without the extension.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{computed as e,createBlock as t,createElementBlock as n,defineComponent as r,mergeProps as i,onBeforeMount as a,openBlock as o,shallowRef as s,unref as c}from"vue";import l from"do11y:options";var u=[`src`],d=r({__name:`SandboxIframe`,props:{id:{},url:{},highlightedSource:{},highlightedStylelessSource:{},highlightedCssSource:{},passedProps:{}},setup(r){let d=r,f=e(()=>`/sandbox?id=${d.id}`),p=s();return a(async()=>{p.value=(await l.SandboxIframe?.())?.default}),(e,a)=>p.value?(o(),t(c(p),i({key:0,id:r.id,url:f.value,"highlighted-source":r.highlightedSource,"highlighted-css-source":r.highlightedCssSource,"highlighted-styleless-source":r.highlightedStylelessSource},r.passedProps),null,16,[`id`,`url`,`highlighted-source`,`highlighted-css-source`,`highlighted-styleless-source`])):(o(),n(`iframe`,{key:1,src:f.value},null,8,u))}});export{d as default};
|
|
1
|
+
import{computed as e,createBlock as t,createElementBlock as n,defineComponent as r,mergeProps as i,onBeforeMount as a,openBlock as o,shallowRef as s,unref as c}from"vue";import l from"do11y:options";var u=[`title`,`src`],d=r({__name:`SandboxIframe`,props:{title:{},id:{},url:{},highlightedSource:{},highlightedStylelessSource:{},highlightedCssSource:{},passedProps:{}},setup(r){let d=r,f=e(()=>`/sandbox?id=${d.id}`),p=s();return a(async()=>{p.value=(await l.SandboxIframe?.())?.default}),(e,a)=>p.value?(o(),t(c(p),i({key:0,title:r.title,id:r.id,url:f.value,"highlighted-source":r.highlightedSource,"highlighted-css-source":r.highlightedCssSource,"highlighted-styleless-source":r.highlightedStylelessSource},r.passedProps),null,16,[`title`,`id`,`url`,`highlighted-source`,`highlighted-css-source`,`highlighted-styleless-source`])):(o(),n(`iframe`,{key:1,title:r.title,src:f.value},null,8,u))}});export{d as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "do11y",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "A bare-bones tool to document Vue components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs-generator",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"jiti": "^2.6.1",
|
|
51
51
|
"oxfmt": "^0.41.0",
|
|
52
52
|
"oxlint": "^1.56.0",
|
|
53
|
-
"typescript": "~
|
|
53
|
+
"typescript": "~6.0.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@vitejs/plugin-vue": "^6.0.5",
|