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 22:00:53 +01:00
parent edf7c6368d
commit 730f91b271
No known key found for this signature in database
9 changed files with 266 additions and 6 deletions

1
.gitignore vendored
View file

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

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

@ -0,0 +1,2 @@
export { RecentNotes, RecentNotesOptions } from '../index.js';
import '@quartz-community/types';

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

@ -0,0 +1,117 @@
import { joinSegments, simplifySlug as simplifySlug$1 } from '@quartz-community/utils';
import { jsxs, jsx } from 'preact/jsx-runtime';
// src/util/lang.ts
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}
// src/i18n/locales/en-US.ts
var en_US_default = {
components: {
recentNotes: {
title: "Recent Notes",
seeRemainingMore: ({ remaining }) => `See ${remaining} more \u2192`
}
}
};
// src/i18n/index.ts
var locales = {
"en-US": en_US_default
};
function i18n(locale) {
return locales[locale] || en_US_default;
}
function simplifySlug(fp) {
return simplifySlug$1(fp);
}
function resolveRelative(current, target) {
const simplified = simplifySlug(target);
const rootPath = pathToRoot(current);
return joinSegments(rootPath, simplified);
}
function pathToRoot(slug) {
let rootPath = slug.split("/").filter((x) => x !== "").slice(0, -1).map((_) => "..").join("/");
if (rootPath.length === 0) {
rootPath = ".";
}
return rootPath;
}
// src/util/date.ts
function getDate(cfg, data) {
if (!cfg.defaultDateType) {
throw new Error(
"Field 'defaultDateType' was not set in the configuration object of quartz.config.ts."
);
}
return data.dates?.[cfg.defaultDateType];
}
function formatDate(d, locale = "en-US") {
return d.toLocaleDateString(locale, {
year: "numeric",
month: "short",
day: "2-digit"
});
}
// src/util/sort.ts
function byDateAndAlphabetical(cfg) {
return (f1, f2) => {
if (f1.dates && f2.dates) {
return getDate(cfg, f2).getTime() - getDate(cfg, f1).getTime();
} else if (f1.dates && !f2.dates) {
return -1;
} else if (!f1.dates && f2.dates) {
return 1;
}
const f1Title = f1.frontmatter?.title?.toLowerCase() ?? "";
const f2Title = f2.frontmatter?.title?.toLowerCase() ?? "";
return f1Title.localeCompare(f2Title);
};
}
// src/components/styles/recentNotes.scss
var recentNotes_default = ".recent-notes > h3 {\n margin: 0.5rem 0 0 0;\n font-size: 1rem;\n}\n.recent-notes > ul.recent-ul {\n list-style: none;\n margin-top: 1rem;\n padding-left: 0;\n}\n.recent-notes > ul.recent-ul > li {\n margin: 1rem 0;\n}\n.recent-notes > ul.recent-ul > li .section > .desc > h3 > a {\n background-color: transparent;\n}\n.recent-notes > ul.recent-ul > li .section > .meta {\n margin: 0 0 0.5rem 0;\n opacity: 0.6;\n}";
var defaultOptions = (cfg) => ({
limit: 3,
linkToMore: false,
showTags: true,
filter: () => true,
sort: byDateAndAlphabetical(cfg)
});
var RecentNotes_default = ((userOpts) => {
const RecentNotes = ({
allFiles,
fileData,
displayClass,
cfg
}) => {
const globalCfg = cfg;
const opts = { ...defaultOptions(globalCfg), ...userOpts };
const pages = allFiles.filter(opts.filter).sort(opts.sort);
const remaining = Math.max(0, pages.length - opts.limit);
const slug = fileData.slug;
const locale = cfg.locale ?? "en-US";
return /* @__PURE__ */ jsxs("div", { class: classNames(displayClass, "recent-notes"), children: [
/* @__PURE__ */ jsx("h3", { children: opts.title ?? i18n(locale).components.recentNotes.title }),
/* @__PURE__ */ jsx("ul", { class: "recent-ul", children: pages.slice(0, opts.limit).map((page) => {
const title = page.frontmatter?.title ?? "Untitled";
const tags = page.frontmatter?.tags ?? [];
return /* @__PURE__ */ jsx("li", { class: "recent-li", children: /* @__PURE__ */ jsxs("div", { class: "section", children: [
/* @__PURE__ */ jsx("div", { class: "desc", children: /* @__PURE__ */ jsx("h3", { children: /* @__PURE__ */ jsx("a", { href: resolveRelative(slug, page.slug), class: "internal", children: title }) }) }),
page.dates && /* @__PURE__ */ jsx("p", { class: "meta", children: /* @__PURE__ */ jsx("time", { datetime: getDate(globalCfg, page)?.toISOString(), children: formatDate(getDate(globalCfg, page), locale) }) }),
opts.showTags && /* @__PURE__ */ jsx("ul", { class: "tags", children: tags.map((tag) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { class: "internal tag-link", href: resolveRelative(slug, `tags/${tag}`), children: tag }) })) })
] }) });
}) }),
opts.linkToMore && remaining > 0 && /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("a", { href: resolveRelative(slug, opts.linkToMore), children: i18n(locale).components.recentNotes.seeRemainingMore({ remaining }) }) })
] });
};
RecentNotes.css = recentNotes_default;
return RecentNotes;
});
export { RecentNotes_default as RecentNotes };
//# 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

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

@ -0,0 +1,25 @@
import { QuartzComponent } from '@quartz-community/types';
export { QuartzComponent, QuartzComponentProps, StringResource } from '@quartz-community/types';
interface QuartzPluginData {
slug?: string;
filePath?: string;
dates?: Record<string, Date>;
frontmatter?: {
title?: string;
tags?: string[];
[key: string]: unknown;
};
[key: string]: unknown;
}
interface RecentNotesOptions {
title?: string;
limit: number;
linkToMore: string | false;
showTags: boolean;
filter: (f: QuartzPluginData) => boolean;
sort: (f1: QuartzPluginData, f2: QuartzPluginData) => number;
}
declare const _default: (userOpts?: Partial<RecentNotesOptions>) => QuartzComponent;
export { _default as RecentNotes, type RecentNotesOptions };

117
dist/index.js vendored Normal file
View file

@ -0,0 +1,117 @@
import { joinSegments, simplifySlug as simplifySlug$1 } from '@quartz-community/utils';
import { jsxs, jsx } from 'preact/jsx-runtime';
// src/util/lang.ts
function classNames(...classes) {
return classes.filter(Boolean).join(" ");
}
// src/i18n/locales/en-US.ts
var en_US_default = {
components: {
recentNotes: {
title: "Recent Notes",
seeRemainingMore: ({ remaining }) => `See ${remaining} more \u2192`
}
}
};
// src/i18n/index.ts
var locales = {
"en-US": en_US_default
};
function i18n(locale) {
return locales[locale] || en_US_default;
}
function simplifySlug(fp) {
return simplifySlug$1(fp);
}
function resolveRelative(current, target) {
const simplified = simplifySlug(target);
const rootPath = pathToRoot(current);
return joinSegments(rootPath, simplified);
}
function pathToRoot(slug) {
let rootPath = slug.split("/").filter((x) => x !== "").slice(0, -1).map((_) => "..").join("/");
if (rootPath.length === 0) {
rootPath = ".";
}
return rootPath;
}
// src/util/date.ts
function getDate(cfg, data) {
if (!cfg.defaultDateType) {
throw new Error(
"Field 'defaultDateType' was not set in the configuration object of quartz.config.ts."
);
}
return data.dates?.[cfg.defaultDateType];
}
function formatDate(d, locale = "en-US") {
return d.toLocaleDateString(locale, {
year: "numeric",
month: "short",
day: "2-digit"
});
}
// src/util/sort.ts
function byDateAndAlphabetical(cfg) {
return (f1, f2) => {
if (f1.dates && f2.dates) {
return getDate(cfg, f2).getTime() - getDate(cfg, f1).getTime();
} else if (f1.dates && !f2.dates) {
return -1;
} else if (!f1.dates && f2.dates) {
return 1;
}
const f1Title = f1.frontmatter?.title?.toLowerCase() ?? "";
const f2Title = f2.frontmatter?.title?.toLowerCase() ?? "";
return f1Title.localeCompare(f2Title);
};
}
// src/components/styles/recentNotes.scss
var recentNotes_default = ".recent-notes > h3 {\n margin: 0.5rem 0 0 0;\n font-size: 1rem;\n}\n.recent-notes > ul.recent-ul {\n list-style: none;\n margin-top: 1rem;\n padding-left: 0;\n}\n.recent-notes > ul.recent-ul > li {\n margin: 1rem 0;\n}\n.recent-notes > ul.recent-ul > li .section > .desc > h3 > a {\n background-color: transparent;\n}\n.recent-notes > ul.recent-ul > li .section > .meta {\n margin: 0 0 0.5rem 0;\n opacity: 0.6;\n}";
var defaultOptions = (cfg) => ({
limit: 3,
linkToMore: false,
showTags: true,
filter: () => true,
sort: byDateAndAlphabetical(cfg)
});
var RecentNotes_default = ((userOpts) => {
const RecentNotes = ({
allFiles,
fileData,
displayClass,
cfg
}) => {
const globalCfg = cfg;
const opts = { ...defaultOptions(globalCfg), ...userOpts };
const pages = allFiles.filter(opts.filter).sort(opts.sort);
const remaining = Math.max(0, pages.length - opts.limit);
const slug = fileData.slug;
const locale = cfg.locale ?? "en-US";
return /* @__PURE__ */ jsxs("div", { class: classNames(displayClass, "recent-notes"), children: [
/* @__PURE__ */ jsx("h3", { children: opts.title ?? i18n(locale).components.recentNotes.title }),
/* @__PURE__ */ jsx("ul", { class: "recent-ul", children: pages.slice(0, opts.limit).map((page) => {
const title = page.frontmatter?.title ?? "Untitled";
const tags = page.frontmatter?.tags ?? [];
return /* @__PURE__ */ jsx("li", { class: "recent-li", children: /* @__PURE__ */ jsxs("div", { class: "section", children: [
/* @__PURE__ */ jsx("div", { class: "desc", children: /* @__PURE__ */ jsx("h3", { children: /* @__PURE__ */ jsx("a", { href: resolveRelative(slug, page.slug), class: "internal", children: title }) }) }),
page.dates && /* @__PURE__ */ jsx("p", { class: "meta", children: /* @__PURE__ */ jsx("time", { datetime: getDate(globalCfg, page)?.toISOString(), children: formatDate(getDate(globalCfg, page), locale) }) }),
opts.showTags && /* @__PURE__ */ jsx("ul", { class: "tags", children: tags.map((tag) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", { class: "internal tag-link", href: resolveRelative(slug, `tags/${tag}`), children: tag }) })) })
] }) });
}) }),
opts.linkToMore && remaining > 0 && /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("a", { href: resolveRelative(slug, opts.linkToMore), children: i18n(locale).components.recentNotes.seeRemainingMore({ remaining }) }) })
] });
};
RecentNotes.css = recentNotes_default;
return RecentNotes;
});
export { RecentNotes_default as RecentNotes };
//# 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

@ -10,9 +10,7 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@quartz-community/types": "github:quartz-community/types", "@quartz-community/types": "github:quartz-community/types",
"@quartz-community/utils": "github:quartz-community/utils", "@quartz-community/utils": "github:quartz-community/utils"
"tsup": "^8.5.0",
"typescript": "^5.9.3"
}, },
"devDependencies": { "devDependencies": {
"@types/hast": "^3.0.4", "@types/hast": "^3.0.4",
@ -26,6 +24,8 @@
"prettier": "^3.6.2", "prettier": "^3.6.2",
"sass": "^1.97.3", "sass": "^1.97.3",
"sass-embedded": "^1.97.3", "sass-embedded": "^1.97.3",
"tsup": "^8.5.0",
"typescript": "^5.9.3",
"vfile": "^6.0.3", "vfile": "^6.0.3",
"vitest": "^2.1.9" "vitest": "^2.1.9"
}, },
@ -4061,7 +4061,6 @@
} }
], ],
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"nanoid": "^3.3.11", "nanoid": "^3.3.11",
"picocolors": "^1.1.1", "picocolors": "^1.1.1",

View file

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