72 lines
23 KiB
JavaScript
72 lines
23 KiB
JavaScript
|
|
var __create = Object.create;
|
||
|
|
var __defProp = Object.defineProperty;
|
||
|
|
var __defProps = Object.defineProperties;
|
||
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
||
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
||
|
|
var __getProtoOf = Object.getPrototypeOf;
|
||
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
||
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||
|
|
var __spreadValues = (a, b) => {
|
||
|
|
for (var prop in b || (b = {}))
|
||
|
|
if (__hasOwnProp.call(b, prop))
|
||
|
|
__defNormalProp(a, prop, b[prop]);
|
||
|
|
if (__getOwnPropSymbols)
|
||
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
||
|
|
if (__propIsEnum.call(b, prop))
|
||
|
|
__defNormalProp(a, prop, b[prop]);
|
||
|
|
}
|
||
|
|
return a;
|
||
|
|
};
|
||
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
||
|
|
var __export = (target, all) => {
|
||
|
|
for (var name in all)
|
||
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
||
|
|
};
|
||
|
|
var __copyProps = (to, from, except, desc) => {
|
||
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
||
|
|
for (let key of __getOwnPropNames(from))
|
||
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
||
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||
|
|
}
|
||
|
|
return to;
|
||
|
|
};
|
||
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
||
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||
|
|
var stdin_exports = {};
|
||
|
|
__export(stdin_exports, {
|
||
|
|
get: () => get
|
||
|
|
});
|
||
|
|
module.exports = __toCommonJS(stdin_exports);
|
||
|
|
var import_mdsvex = require("mdsvex");
|
||
|
|
var import_getPostsFromGlobResult_2e7f393c = require("../../../../chunks/getPostsFromGlobResult-2e7f393c.js");
|
||
|
|
var import_remark_gfm = __toESM(require("remark-gfm"));
|
||
|
|
const fetchBlogPostBySlug = async (slug) => {
|
||
|
|
const globResult = await { "../content/blog/2016-02-28-eating-disorder-powerful.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2016-02-28-eating-disorder-powerful-0af4a0ee.js"))), "../content/blog/2017-03-03-loss-and-ed.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2017-03-03-loss-and-ed-d4b1c1a5.js"))), "../content/blog/2019-08-15-goodbye-bear.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2019-08-15-goodbye-bear-799aed90.js"))), "../content/blog/2019-09-20-why-use-css-in-js.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2019-09-20-why-use-css-in-js-9fcc7d49.js"))), "../content/blog/2019-10-30-culture-i-devoured-in-september-2019.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2019-10-30-culture-i-devoured-in-september-2019-46f09e61.js"))), "../content/blog/2019-12-20-nuxt-to-gatsby.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2019-12-20-nuxt-to-gatsby-fc2a6097.js"))), "../content/blog/2020-02-20-introducing-eating-disorders.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-02-20-introducing-eating-disorders-d2e86304.js"))), "../content/blog/2020-02-24-hereabouts-devblog-1.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-02-24-hereabouts-devblog-1-18e93c36.js"))), "../content/blog/2020-03-15-ux-with-components-screens-state-and-actions.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-03-15-ux-with-components-screens-state-and-actions-0c39ac14.js"))), "../content/blog/2020-03-22-chosing-react-native-for-hereabouts.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-03-22-chosing-react-native-for-hereabouts-b7863833.js"))), "../content/blog/2020-04-02-hereabouts-devlog-2.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-04-02-hereabouts-devlog-2-264ab07c.js"))), "../content/blog/2020-05-31-unicorns.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-05-31-unicorns-06ff6905.js"))), "../content/blog/2020-06-11-deploy-rails-in-render.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-06-11-deploy-rails-in-render-30f28e2a.js"))), "../content/blog/2020-08-07-where-i-go-for-ui-inspiration.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-08-07-where-i-go-for-ui-inspiration-fc5cd52d.js"))), "../content/blog/2020-08-14-thing-i-learned.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-08-14-thing-i-learned-05e37aa6.js"))), "../content/blog/2020-08-21-things-i-learned.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-08-21-things-i-learned-a798a2f9.js"))), "../content/blog/2020-08-23-why-are-you-like-this-javascript.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-08-23-why-are-you-like-this-javascript-843edfcd.js"))), "../content/blog/2020-08-28-things-i-learned-3.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-08-28-things-i-learned-3-2e553969.js"))), "../content/blog/2020-08-29-apple-what-are-you-doing.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-08-29-apple-what-are-you-doing-a46abe23.js"))), "../content/blog/2020-09-04-things-i-learned-4.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-09-04-things-i-learned-4-a37f698c.js"))), "../content/blog/2020-09-06-js-promise-introduction.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-09-06-js-promise-introduction-04a4a7c9.js"))), "../content/blog/2020-09-11-things-i-learned-5.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-09-11-things-i-learned-5-9ba86116.js"))), "../content/blog/2020-09-18-things-i-learned-6.md": () => Promise.resolve().then(() => __toESM(require("../../../../chunks/2020-09-18-things-i-learned-6
|
||
|
|
const allFiles = await (0, import_getPostsFromGlobResult_2e7f393c.g)(globResult);
|
||
|
|
const post = allFiles.find((post2) => post2.slug === slug);
|
||
|
|
if (!post) {
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
const compiles = await (0, import_mdsvex.compile)(post.html, { remarkPlugins: [import_remark_gfm.default] });
|
||
|
|
return __spreadProps(__spreadValues({}, post), {
|
||
|
|
html: compiles.code
|
||
|
|
});
|
||
|
|
};
|
||
|
|
const get = async ({ params }) => {
|
||
|
|
const { slug } = params;
|
||
|
|
const post = await fetchBlogPostBySlug(slug);
|
||
|
|
if (!post) {
|
||
|
|
return {
|
||
|
|
status: 404,
|
||
|
|
body: {}
|
||
|
|
};
|
||
|
|
}
|
||
|
|
return {
|
||
|
|
status: 200,
|
||
|
|
body: { post }
|
||
|
|
};
|
||
|
|
};
|