chore: commit dist/ and remove prepare script

Pre-built output is now committed to the repository so that
Quartz can skip the build step during plugin installation.
The prepare script is removed to prevent redundant builds
when installing from npm/git.
This commit is contained in:
saberzero1 2026-03-14 21:57:30 +01:00
parent f52fe5335f
commit 3de7bfb885
No known key found for this signature in database
9 changed files with 134 additions and 6 deletions

1
.gitignore vendored
View file

@ -4,7 +4,6 @@ node_modules/
.pnp.js
# Build output
dist/
build/
*.tsbuildinfo

1
dist/components/index.d.ts vendored Normal file
View file

@ -0,0 +1 @@
export { Comments, CommentsOptions } from '../index.js';

46
dist/components/index.js vendored Normal file
View file

@ -0,0 +1,46 @@
import { jsx, Fragment } from 'preact/jsx-runtime';
// src/util/lang.ts
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}
// src/components/scripts/comments.inline.ts
var comments_inline_default = 'var d=s=>{let e=s.detail.theme,t=document.querySelector("iframe.giscus-frame");t&&t.contentWindow&&t.contentWindow.postMessage({giscus:{setConfig:{theme:c(r(e))}}},"https://giscus.app")},r=s=>{if(s!=="dark"&&s!=="light")return s;let e=document.querySelector(".giscus");if(!e)return s;let t=e.dataset.darkTheme??"dark",a=e.dataset.lightTheme??"light";return s==="dark"?t:a},c=s=>{let e=document.querySelector(".giscus");return e?`${e.dataset.themeUrl??"https://giscus.app/themes"}/${s}.css`:`https://giscus.app/themes/${s}.css`},n=[],u=s=>{n.push(s)};if(typeof document<"u"){let s=()=>{n.forEach(o=>o()),n.length=0;let e=document.querySelector(".giscus");if(!e)return;let t=document.createElement("script");t.src="https://giscus.app/client.js",t.async=!0,t.crossOrigin="anonymous",t.setAttribute("data-loading","lazy"),t.setAttribute("data-emit-metadata","0"),t.setAttribute("data-repo",e.dataset.repo),t.setAttribute("data-repo-id",e.dataset.repoId),t.setAttribute("data-category",e.dataset.category),t.setAttribute("data-category-id",e.dataset.categoryId),t.setAttribute("data-mapping",e.dataset.mapping),t.setAttribute("data-strict",e.dataset.strict),t.setAttribute("data-reactions-enabled",e.dataset.reactionsEnabled),t.setAttribute("data-input-position",e.dataset.inputPosition),t.setAttribute("data-lang",e.dataset.lang);let a=document.documentElement.getAttribute("saved-theme");a&&t.setAttribute("data-theme",c(r(a))),e.appendChild(t);let i=d;document.addEventListener("themechange",i),u(()=>document.removeEventListener("themechange",i))};document.addEventListener("nav",s),document.addEventListener("render",s)}\n';
function boolToStringBool(b) {
return b ? "1" : "0";
}
var Comments_default = ((opts) => {
const Comments = ({ displayClass, fileData, cfg }) => {
const fd = fileData;
const disableComment = typeof fd.frontmatter?.comments !== "undefined" && (!fd.frontmatter?.comments || fd.frontmatter?.comments === "false");
if (disableComment) {
return /* @__PURE__ */ jsx(Fragment, {});
}
const c = cfg;
return /* @__PURE__ */ jsx(
"div",
{
class: classNames(displayClass, "giscus"),
"data-repo": opts.options.repo,
"data-repo-id": opts.options.repoId,
"data-category": opts.options.category,
"data-category-id": opts.options.categoryId,
"data-mapping": opts.options.mapping ?? "url",
"data-strict": boolToStringBool(opts.options.strict ?? true),
"data-reactions-enabled": boolToStringBool(opts.options.reactionsEnabled ?? true),
"data-input-position": opts.options.inputPosition ?? "bottom",
"data-light-theme": opts.options.lightTheme ?? "light",
"data-dark-theme": opts.options.darkTheme ?? "dark",
"data-theme-url": opts.options.themeUrl ?? `https://${c.baseUrl ?? "example.com"}/static/giscus`,
"data-lang": opts.options.lang ?? "en"
}
);
};
Comments.afterDOMLoaded = comments_inline_default;
return Comments;
});
export { Comments_default as Comments };
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map

1
dist/components/index.js.map vendored Normal file

File diff suppressed because one or more lines are too long

36
dist/index.d.ts vendored Normal file
View file

@ -0,0 +1,36 @@
interface QuartzComponent {
(props: QuartzComponentProps): unknown;
css?: string;
beforeDOMLoaded?: string;
afterDOMLoaded?: string;
}
type QuartzComponentProps = {
ctx: unknown;
externalResources: unknown;
fileData: unknown;
cfg: unknown;
children: unknown[];
tree: unknown;
allFiles: unknown[];
displayClass?: "mobile-only" | "desktop-only";
};
type CommentsOptions = {
provider: "giscus";
options: {
repo: `${string}/${string}`;
repoId: string;
category: string;
categoryId: string;
themeUrl?: string;
lightTheme?: string;
darkTheme?: string;
mapping?: "url" | "title" | "og:title" | "specific" | "number" | "pathname";
strict?: boolean;
reactionsEnabled?: boolean;
inputPosition?: "top" | "bottom";
lang?: string;
};
};
declare const _default: (opts: CommentsOptions) => QuartzComponent;
export { _default as Comments, type CommentsOptions };

46
dist/index.js vendored Normal file
View file

@ -0,0 +1,46 @@
import { jsx, Fragment } from 'preact/jsx-runtime';
// src/util/lang.ts
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}
// src/components/scripts/comments.inline.ts
var comments_inline_default = 'var d=s=>{let e=s.detail.theme,t=document.querySelector("iframe.giscus-frame");t&&t.contentWindow&&t.contentWindow.postMessage({giscus:{setConfig:{theme:c(r(e))}}},"https://giscus.app")},r=s=>{if(s!=="dark"&&s!=="light")return s;let e=document.querySelector(".giscus");if(!e)return s;let t=e.dataset.darkTheme??"dark",a=e.dataset.lightTheme??"light";return s==="dark"?t:a},c=s=>{let e=document.querySelector(".giscus");return e?`${e.dataset.themeUrl??"https://giscus.app/themes"}/${s}.css`:`https://giscus.app/themes/${s}.css`},n=[],u=s=>{n.push(s)};if(typeof document<"u"){let s=()=>{n.forEach(o=>o()),n.length=0;let e=document.querySelector(".giscus");if(!e)return;let t=document.createElement("script");t.src="https://giscus.app/client.js",t.async=!0,t.crossOrigin="anonymous",t.setAttribute("data-loading","lazy"),t.setAttribute("data-emit-metadata","0"),t.setAttribute("data-repo",e.dataset.repo),t.setAttribute("data-repo-id",e.dataset.repoId),t.setAttribute("data-category",e.dataset.category),t.setAttribute("data-category-id",e.dataset.categoryId),t.setAttribute("data-mapping",e.dataset.mapping),t.setAttribute("data-strict",e.dataset.strict),t.setAttribute("data-reactions-enabled",e.dataset.reactionsEnabled),t.setAttribute("data-input-position",e.dataset.inputPosition),t.setAttribute("data-lang",e.dataset.lang);let a=document.documentElement.getAttribute("saved-theme");a&&t.setAttribute("data-theme",c(r(a))),e.appendChild(t);let i=d;document.addEventListener("themechange",i),u(()=>document.removeEventListener("themechange",i))};document.addEventListener("nav",s),document.addEventListener("render",s)}\n';
function boolToStringBool(b) {
return b ? "1" : "0";
}
var Comments_default = ((opts) => {
const Comments = ({ displayClass, fileData, cfg }) => {
const fd = fileData;
const disableComment = typeof fd.frontmatter?.comments !== "undefined" && (!fd.frontmatter?.comments || fd.frontmatter?.comments === "false");
if (disableComment) {
return /* @__PURE__ */ jsx(Fragment, {});
}
const c = cfg;
return /* @__PURE__ */ jsx(
"div",
{
class: classNames(displayClass, "giscus"),
"data-repo": opts.options.repo,
"data-repo-id": opts.options.repoId,
"data-category": opts.options.category,
"data-category-id": opts.options.categoryId,
"data-mapping": opts.options.mapping ?? "url",
"data-strict": boolToStringBool(opts.options.strict ?? true),
"data-reactions-enabled": boolToStringBool(opts.options.reactionsEnabled ?? true),
"data-input-position": opts.options.inputPosition ?? "bottom",
"data-light-theme": opts.options.lightTheme ?? "light",
"data-dark-theme": opts.options.darkTheme ?? "dark",
"data-theme-url": opts.options.themeUrl ?? `https://${c.baseUrl ?? "example.com"}/static/giscus`,
"data-lang": opts.options.lang ?? "en"
}
);
};
Comments.afterDOMLoaded = comments_inline_default;
return Comments;
});
export { Comments_default as Comments };
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map

1
dist/index.js.map vendored Normal file

File diff suppressed because one or more lines are too long

7
package-lock.json generated
View file

@ -9,9 +9,7 @@
"version": "0.1.0",
"license": "MIT",
"dependencies": {
"@quartz-community/types": "github:quartz-community/types",
"tsup": "^8.5.0",
"typescript": "^5.9.3"
"@quartz-community/types": "github:quartz-community/types"
},
"devDependencies": {
"@types/hast": "^3.0.4",
@ -23,6 +21,8 @@
"eslint-config-prettier": "^9.1.0",
"preact": "^10.28.2",
"prettier": "^3.6.2",
"tsup": "^8.5.0",
"typescript": "^5.9.3",
"vitest": "^2.1.9"
},
"engines": {
@ -2862,7 +2862,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",

View file

@ -43,7 +43,6 @@
"sideEffects": false,
"scripts": {
"build": "tsup",
"prepare": "npm run build",
"dev": "tsup --watch",
"lint": "eslint . --max-warnings=0",
"format": "prettier . --check",