From 3de7bfb8851a91f4f2b01639eda2fc20baa07aa4 Mon Sep 17 00:00:00 2001 From: saberzero1 Date: Sat, 14 Mar 2026 21:57:30 +0100 Subject: [PATCH] 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. --- .gitignore | 1 - dist/components/index.d.ts | 1 + dist/components/index.js | 46 ++++++++++++++++++++++++++++++++++++ dist/components/index.js.map | 1 + dist/index.d.ts | 36 ++++++++++++++++++++++++++++ dist/index.js | 46 ++++++++++++++++++++++++++++++++++++ dist/index.js.map | 1 + package-lock.json | 7 +++--- package.json | 1 - 9 files changed, 134 insertions(+), 6 deletions(-) create mode 100644 dist/components/index.d.ts create mode 100644 dist/components/index.js create mode 100644 dist/components/index.js.map create mode 100644 dist/index.d.ts create mode 100644 dist/index.js create mode 100644 dist/index.js.map diff --git a/.gitignore b/.gitignore index 657842b..ef88793 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ node_modules/ .pnp.js # Build output -dist/ build/ *.tsbuildinfo diff --git a/dist/components/index.d.ts b/dist/components/index.d.ts new file mode 100644 index 0000000..74f52bb --- /dev/null +++ b/dist/components/index.d.ts @@ -0,0 +1 @@ +export { Comments, CommentsOptions } from '../index.js'; diff --git a/dist/components/index.js b/dist/components/index.js new file mode 100644 index 0000000..aaa8122 --- /dev/null +++ b/dist/components/index.js @@ -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 \ No newline at end of file diff --git a/dist/components/index.js.map b/dist/components/index.js.map new file mode 100644 index 0000000..dcfa586 --- /dev/null +++ b/dist/components/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../../src/util/lang.ts","../../src/components/scripts/comments.inline.ts","../../src/components/Comments.tsx"],"names":[],"mappings":";;;AAAO,SAAS,cAAc,OAAA,EAAwD;AACpF,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,GAAG,CAAA;AACzC;;;ACFA,IAAA,uBAAA,GAAA,wlDAAA;AC0CA,SAAS,iBAAiB,CAAA,EAAoB;AAC5C,EAAA,OAAO,IAAI,GAAA,GAAM,GAAA;AACnB;AAEA,IAAO,gBAAA,IAAS,CAAC,IAAA,KAA0B;AACzC,EAAA,MAAM,WAA4B,CAAC,EAAE,YAAA,EAAc,QAAA,EAAU,KAAI,KAA4B;AAE3F,IAAA,MAAM,EAAA,GAAK,QAAA;AACX,IAAA,MAAM,cAAA,GACJ,OAAQ,EAAA,CAAG,WAAA,EAAyC,QAAA,KAAa,WAAA,KAChE,CAAE,EAAA,CAAG,WAAA,EAAyC,QAAA,IAC5C,EAAA,CAAG,WAAA,EAAyC,QAAA,KAAa,OAAA,CAAA;AAC9D,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAE,CAAA;AAAA,IACX;AAEA,IAAA,MAAM,CAAA,GAAI,GAAA;AACV,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,UAAA,CAAW,YAAA,EAAc,QAAQ,CAAA;AAAA,QACxC,WAAA,EAAW,KAAK,OAAA,CAAQ,IAAA;AAAA,QACxB,cAAA,EAAc,KAAK,OAAA,CAAQ,MAAA;AAAA,QAC3B,eAAA,EAAe,KAAK,OAAA,CAAQ,QAAA;AAAA,QAC5B,kBAAA,EAAkB,KAAK,OAAA,CAAQ,UAAA;AAAA,QAC/B,cAAA,EAAc,IAAA,CAAK,OAAA,CAAQ,OAAA,IAAW,KAAA;AAAA,QACtC,aAAA,EAAa,gBAAA,CAAiB,IAAA,CAAK,OAAA,CAAQ,UAAU,IAAI,CAAA;AAAA,QACzD,wBAAA,EAAwB,gBAAA,CAAiB,IAAA,CAAK,OAAA,CAAQ,oBAAoB,IAAI,CAAA;AAAA,QAC9E,qBAAA,EAAqB,IAAA,CAAK,OAAA,CAAQ,aAAA,IAAiB,QAAA;AAAA,QACnD,kBAAA,EAAkB,IAAA,CAAK,OAAA,CAAQ,UAAA,IAAc,OAAA;AAAA,QAC7C,iBAAA,EAAiB,IAAA,CAAK,OAAA,CAAQ,SAAA,IAAa,MAAA;AAAA,QAC3C,kBACE,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA,QAAA,EAAY,CAAA,CAAE,WAAsB,aAAa,CAAA,cAAA,CAAA;AAAA,QAE5E,WAAA,EAAW,IAAA,CAAK,OAAA,CAAQ,IAAA,IAAQ;AAAA;AAAA,KACjC;AAAA,EAEL,CAAA;AAEA,EAAA,QAAA,CAAS,cAAA,GAAiB,uBAAA;AAE1B,EAAA,OAAO,QAAA;AACT,CAAA","file":"index.js","sourcesContent":["export function classNames(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","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","import { classNames } from \"../util/lang\";\n// @ts-expect-error - inline script imported as string by esbuild loader\nimport script from \"./scripts/comments.inline\";\n\ninterface QuartzComponent {\n (props: QuartzComponentProps): unknown;\n css?: string;\n beforeDOMLoaded?: string;\n afterDOMLoaded?: string;\n}\n\ntype QuartzComponentProps = {\n ctx: unknown;\n externalResources: unknown;\n fileData: unknown;\n cfg: unknown;\n children: unknown[];\n tree: unknown;\n allFiles: unknown[];\n displayClass?: \"mobile-only\" | \"desktop-only\";\n};\n\ntype QuartzComponentConstructor = (opts: Options) => QuartzComponent;\n\nexport type CommentsOptions = {\n provider: \"giscus\";\n options: {\n repo: `${string}/${string}`;\n repoId: string;\n category: string;\n categoryId: string;\n themeUrl?: string;\n lightTheme?: string;\n darkTheme?: string;\n mapping?: \"url\" | \"title\" | \"og:title\" | \"specific\" | \"number\" | \"pathname\";\n strict?: boolean;\n reactionsEnabled?: boolean;\n inputPosition?: \"top\" | \"bottom\";\n lang?: string;\n };\n};\n\nfunction boolToStringBool(b: boolean): string {\n return b ? \"1\" : \"0\";\n}\n\nexport default ((opts: CommentsOptions) => {\n const Comments: QuartzComponent = ({ displayClass, fileData, cfg }: QuartzComponentProps) => {\n // check if comments should be displayed according to frontmatter\n const fd = fileData as Record;\n const disableComment: boolean =\n typeof (fd.frontmatter as Record)?.comments !== \"undefined\" &&\n (!(fd.frontmatter as Record)?.comments ||\n (fd.frontmatter as Record)?.comments === \"false\");\n if (disableComment) {\n return <>;\n }\n\n const c = cfg as Record;\n return (\n \n );\n };\n\n Comments.afterDOMLoaded = script;\n\n return Comments;\n}) satisfies QuartzComponentConstructor;\n"]} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..ed55273 --- /dev/null +++ b/dist/index.d.ts @@ -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 }; diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..aaa8122 --- /dev/null +++ b/dist/index.js @@ -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 \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..301d8bf --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/util/lang.ts","../src/components/scripts/comments.inline.ts","../src/components/Comments.tsx"],"names":[],"mappings":";;;AAAO,SAAS,cAAc,OAAA,EAAwD;AACpF,EAAA,OAAO,OAAA,CAAQ,MAAA,CAAO,OAAO,CAAA,CAAE,KAAK,GAAG,CAAA;AACzC;;;ACFA,IAAA,uBAAA,GAAA,wlDAAA;AC0CA,SAAS,iBAAiB,CAAA,EAAoB;AAC5C,EAAA,OAAO,IAAI,GAAA,GAAM,GAAA;AACnB;AAEA,IAAO,gBAAA,IAAS,CAAC,IAAA,KAA0B;AACzC,EAAA,MAAM,WAA4B,CAAC,EAAE,YAAA,EAAc,QAAA,EAAU,KAAI,KAA4B;AAE3F,IAAA,MAAM,EAAA,GAAK,QAAA;AACX,IAAA,MAAM,cAAA,GACJ,OAAQ,EAAA,CAAG,WAAA,EAAyC,QAAA,KAAa,WAAA,KAChE,CAAE,EAAA,CAAG,WAAA,EAAyC,QAAA,IAC5C,EAAA,CAAG,WAAA,EAAyC,QAAA,KAAa,OAAA,CAAA;AAC9D,IAAA,IAAI,cAAA,EAAgB;AAClB,MAAA,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAE,CAAA;AAAA,IACX;AAEA,IAAA,MAAM,CAAA,GAAI,GAAA;AACV,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO,UAAA,CAAW,YAAA,EAAc,QAAQ,CAAA;AAAA,QACxC,WAAA,EAAW,KAAK,OAAA,CAAQ,IAAA;AAAA,QACxB,cAAA,EAAc,KAAK,OAAA,CAAQ,MAAA;AAAA,QAC3B,eAAA,EAAe,KAAK,OAAA,CAAQ,QAAA;AAAA,QAC5B,kBAAA,EAAkB,KAAK,OAAA,CAAQ,UAAA;AAAA,QAC/B,cAAA,EAAc,IAAA,CAAK,OAAA,CAAQ,OAAA,IAAW,KAAA;AAAA,QACtC,aAAA,EAAa,gBAAA,CAAiB,IAAA,CAAK,OAAA,CAAQ,UAAU,IAAI,CAAA;AAAA,QACzD,wBAAA,EAAwB,gBAAA,CAAiB,IAAA,CAAK,OAAA,CAAQ,oBAAoB,IAAI,CAAA;AAAA,QAC9E,qBAAA,EAAqB,IAAA,CAAK,OAAA,CAAQ,aAAA,IAAiB,QAAA;AAAA,QACnD,kBAAA,EAAkB,IAAA,CAAK,OAAA,CAAQ,UAAA,IAAc,OAAA;AAAA,QAC7C,iBAAA,EAAiB,IAAA,CAAK,OAAA,CAAQ,SAAA,IAAa,MAAA;AAAA,QAC3C,kBACE,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA,QAAA,EAAY,CAAA,CAAE,WAAsB,aAAa,CAAA,cAAA,CAAA;AAAA,QAE5E,WAAA,EAAW,IAAA,CAAK,OAAA,CAAQ,IAAA,IAAQ;AAAA;AAAA,KACjC;AAAA,EAEL,CAAA;AAEA,EAAA,QAAA,CAAS,cAAA,GAAiB,uBAAA;AAE1B,EAAA,OAAO,QAAA;AACT,CAAA","file":"index.js","sourcesContent":["export function classNames(...classes: (string | undefined | null | false)[]): string {\n return classes.filter(Boolean).join(\" \");\n}\n","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","import { classNames } from \"../util/lang\";\n// @ts-expect-error - inline script imported as string by esbuild loader\nimport script from \"./scripts/comments.inline\";\n\ninterface QuartzComponent {\n (props: QuartzComponentProps): unknown;\n css?: string;\n beforeDOMLoaded?: string;\n afterDOMLoaded?: string;\n}\n\ntype QuartzComponentProps = {\n ctx: unknown;\n externalResources: unknown;\n fileData: unknown;\n cfg: unknown;\n children: unknown[];\n tree: unknown;\n allFiles: unknown[];\n displayClass?: \"mobile-only\" | \"desktop-only\";\n};\n\ntype QuartzComponentConstructor = (opts: Options) => QuartzComponent;\n\nexport type CommentsOptions = {\n provider: \"giscus\";\n options: {\n repo: `${string}/${string}`;\n repoId: string;\n category: string;\n categoryId: string;\n themeUrl?: string;\n lightTheme?: string;\n darkTheme?: string;\n mapping?: \"url\" | \"title\" | \"og:title\" | \"specific\" | \"number\" | \"pathname\";\n strict?: boolean;\n reactionsEnabled?: boolean;\n inputPosition?: \"top\" | \"bottom\";\n lang?: string;\n };\n};\n\nfunction boolToStringBool(b: boolean): string {\n return b ? \"1\" : \"0\";\n}\n\nexport default ((opts: CommentsOptions) => {\n const Comments: QuartzComponent = ({ displayClass, fileData, cfg }: QuartzComponentProps) => {\n // check if comments should be displayed according to frontmatter\n const fd = fileData as Record;\n const disableComment: boolean =\n typeof (fd.frontmatter as Record)?.comments !== \"undefined\" &&\n (!(fd.frontmatter as Record)?.comments ||\n (fd.frontmatter as Record)?.comments === \"false\");\n if (disableComment) {\n return <>;\n }\n\n const c = cfg as Record;\n return (\n \n );\n };\n\n Comments.afterDOMLoaded = script;\n\n return Comments;\n}) satisfies QuartzComponentConstructor;\n"]} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7b49c51..7cf17e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index a3e470d..c8c96dc 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,6 @@ "sideEffects": false, "scripts": { "build": "tsup", - "prepare": "npm run build", "dev": "tsup --watch", "lint": "eslint . --max-warnings=0", "format": "prettier . --check",