diff --git a/components/fuzzy-bar.tsx b/components/fuzzy-bar.tsx index e133c84..c1e6d7c 100644 --- a/components/fuzzy-bar.tsx +++ b/components/fuzzy-bar.tsx @@ -1,6 +1,7 @@ import { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react'; import Fuzzy from './_fuzzy'; import pages from '../public/pages.json'; +import posts from '../public/posts.json'; import style from '../styles/fuzzy.module.css'; function FuzzyBar(): JSX.Element { @@ -13,9 +14,15 @@ function FuzzyBar(): JSX.Element { let fuzz: Fuzzy | null = null; + let entries = [...pages]; + + for (const [k,v] of posts.entries()) { + entries.push({title: v.title, link: `posts/${v.slug}`}); + } + try { fuzz = new Fuzzy({ - pages: pages, + pages: entries, searchField: searchField, searchValue: searchValue, resultsValue: resultsValue, diff --git a/components/layout.tsx b/components/layout.tsx index 7ac0f3d..0ad5f90 100644 --- a/components/layout.tsx +++ b/components/layout.tsx @@ -1,5 +1,4 @@ import FuzzyBar from './fuzzy-bar'; -import Logo from '../public/logo.svg'; import Meta from './meta'; import Title from './title'; diff --git a/components/title.tsx b/components/title.tsx index 811bd46..604a46b 100644 --- a/components/title.tsx +++ b/components/title.tsx @@ -1,6 +1,5 @@ import style from '../styles/title.module.css'; import Link from 'next/link'; -import { useEffect, useState } from 'react'; type propsObj = { name: string, diff --git a/lib/slug.ts b/lib/slug.ts new file mode 100644 index 0000000..4e262fd --- /dev/null +++ b/lib/slug.ts @@ -0,0 +1,43 @@ +import fs from 'fs' +import matter from 'gray-matter'; +import { join } from 'path'; + +const postsDirectory = join(process.cwd(), 'posts'); + +export function getPost(rawslug: string, filter: Array = []) { + const slug = rawslug.replace(/\.md$/, ''); + const path = join(postsDirectory, `${slug}.md`); + const file = fs.readFileSync(path, 'utf-8'); + const { data, content } = matter(file); + + if (data['last_updated'] === undefined) + data['last_updated'] = data['created_at']; + + if (filter.length === 0) + return { ...data, content, slug, rawslug }; + + let post: { slug?: string, rawslug?: string, content?: string, title?: string } | any = {}; + for (const [_, entry] of filter.entries()) { + if (entry === 'slug') + post[entry] = slug; + + if (entry === 'rawslug') + post[entry] = rawslug; + + if (entry === 'content') + post[entry] = content; + + + + if (typeof data[entry] !== 'undefined') { + post[entry] = data[entry] + } + } + return post; +} + +export function getAllPosts(filter: Array = []) { + const files = fs.readdirSync(postsDirectory); + + return files.map(file => { return getPost(file, filter) }); +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1864151..1639811 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "dependencies": { "@types/react": "^17.0.37", "dotenv": "^10.0.0", + "gray-matter": "^4.0.3", "next": "^11.1.3", "normalize.css": "^8.0.1", "react": "^17.0.2", @@ -18,6 +19,7 @@ "@types/react-dom": "^17.0.11", "eslint": "^7.32.0", "eslint-config-next": "^11.1.2", + "ts-node": "^10.5.0", "typescript": "^4.5.2" } }, @@ -2147,6 +2149,27 @@ "node": ">=6.9.0" } }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -2288,9 +2311,9 @@ "integrity": "sha512-jDJTpta+P4p1NZTFVLHJ/TLFVYVcOqv6l8xwOeBKNPMgY/zDYH/YH7SJbvrr/h1RcS9GzbPcLKGzpuK9cV56UA==" }, "node_modules/@next/env": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-11.1.3.tgz", - "integrity": "sha512-5+vaeooJuWmICSlmVaAC8KG3O8hwKasACVfkHj58xQuCB5SW0TKW3hWxgxkBuefMBn1nM0yEVPKokXCsYjBtng==" + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/env/-/env-11.1.4.tgz", + "integrity": "sha512-vEW+fSulzZams4nYmcX9LByb1moMBlkwOAVf0eF+44u+1N/h7HDeznPBWIjEfihzTku8rdLB0k7u8VT8AGtNkQ==" }, "node_modules/@next/eslint-plugin-next": { "version": "11.1.2", @@ -2322,14 +2345,14 @@ } }, "node_modules/@next/polyfill-module": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/polyfill-module/-/polyfill-module-11.1.3.tgz", - "integrity": "sha512-7yr9cr4a0SrBoVE8psxXWK1wTFc8UzsY8Wc2cWGL7qA0hgtqACHaXC47M1ByJB410hFZenGrpE+KFaT1unQMyw==" + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/polyfill-module/-/polyfill-module-11.1.4.tgz", + "integrity": "sha512-CY3bOSQf9Dy3+34dFjFbOdg3DRXIGfujb54D/AVO83ajyQczRZ3xdU0i5VV0eSR6B56ktVy3/aelOffpTUq6LA==" }, "node_modules/@next/react-dev-overlay": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/react-dev-overlay/-/react-dev-overlay-11.1.3.tgz", - "integrity": "sha512-zIwtMliSUR+IKl917ToFNB+0fD7bI5kYMdjHU/UEKpfIXAZPnXRHHISCvPDsczlr+bRsbjlUFW1CsNiuFedeuQ==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/react-dev-overlay/-/react-dev-overlay-11.1.4.tgz", + "integrity": "sha512-8/9JflJwRXEvVb6cKCWgRTOmALzDJHpWD5diRbtXWsllqxcMBjtscgnO4PaK+9QyZnSYSUbn0zZUZvxOXOTE1Q==", "dependencies": { "@babel/code-frame": "7.12.11", "anser": "1.4.9", @@ -2413,9 +2436,9 @@ } }, "node_modules/@next/react-refresh-utils": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/react-refresh-utils/-/react-refresh-utils-11.1.3.tgz", - "integrity": "sha512-144kD8q2nChw67V3AJJlPQ6NUJVFczyn10bhTynn9o2rY5DEnkzuBipcyMuQl2DqfxMkV7sn+yOCOYbrLCk9zg==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/react-refresh-utils/-/react-refresh-utils-11.1.4.tgz", + "integrity": "sha512-jTme207yEV4On9Gk0QJYK2N3kfKVBx17lLOL3qSjqNbqk1TnE51xvzogOCQXNABbzQlBY+J/NN+eylPS4QOKwA==", "peerDependencies": { "react-refresh": "0.8.3", "webpack": "^4 || ^5" @@ -2427,9 +2450,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-11.1.3.tgz", - "integrity": "sha512-TwP4krjhs+uU9pesDYCShEXZrLSbJr78p12e7XnLBBaNf20SgWLlVmQUT9gX9KbWan5V0sUbJfmcS8MRNHgYuA==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-11.1.4.tgz", + "integrity": "sha512-jt8dMtIRWnJjRYLid6NWCxXzXdpr9VFT/vhDp8ioh+TtOR0UKPHMxei6R4GA3RqoyPEfFcSNmkG7OtyqCSxNIw==", "cpu": [ "arm64" ], @@ -2442,9 +2465,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-11.1.3.tgz", - "integrity": "sha512-ZSWmkg/PxccHFNUSeBdrfaH8KwSkoeUtewXKvuYYt7Ph0yRsbqSyNIvhUezDua96lApiXXq6EL2d1THfeWomvw==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-11.1.4.tgz", + "integrity": "sha512-5i9tOQNO8kawwggHvQUVR3a5KzIGaE2dw1g1kL//z/N840djvGseHrJSFEGdP1c35gM+dSGPpAKHmeBKrwHM8g==", "cpu": [ "x64" ], @@ -2457,9 +2480,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-11.1.3.tgz", - "integrity": "sha512-PrTBN0iZudAuj4jSbtXcdBdmfpaDCPIneG4Oms4zcs93KwMgLhivYW082Mvlgx9QVEiRm7+RkFpIVtG/i7JitA==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-11.1.4.tgz", + "integrity": "sha512-QfVuXugxBkCUHN9yD/VZ1xqszcMlBDj6vrbRiQvmWuyNo39ON6HqGn3jDwVrTHc9oKo2a0XInm+0zEnQeDmjSw==", "cpu": [ "x64" ], @@ -2472,9 +2495,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-11.1.3.tgz", - "integrity": "sha512-mRwbscVjRoHk+tDY7XbkT5d9FCwujFIQJpGp0XNb1i5OHCSDO8WW/C9cLEWS4LxKRbIZlTLYg1MTXqLQkvva8w==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-11.1.4.tgz", + "integrity": "sha512-7MPXYWsCo5qGZXyyJwBLvQkYi0hKARtpjGxjt/mdxn7A7O+jKJgAuxgOo/lnZIiXfbJzxRnSD8k6WkUwN0IVmg==", "cpu": [ "x64" ], @@ -2779,6 +2802,30 @@ "node": ">=8.9.0" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, "node_modules/@types/debug": { "version": "4.1.7", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", @@ -3053,6 +3100,15 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -3114,11 +3170,16 @@ "node": ">= 8" } }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "dependencies": { "sprintf-js": "~1.0.2" } @@ -3831,6 +3892,12 @@ "sha.js": "^2.4.8" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -4948,7 +5015,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -5029,6 +5095,17 @@ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, + "node_modules/extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dependencies": { + "is-extendable": "^0.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -5299,6 +5376,20 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" }, + "node_modules/gray-matter": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", + "integrity": "sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==", + "dependencies": { + "js-yaml": "^3.13.1", + "kind-of": "^6.0.2", + "section-matter": "^1.0.0", + "strip-bom-string": "^1.0.0" + }, + "engines": { + "node": ">=6.0" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -5648,6 +5739,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -5884,7 +5983,6 @@ "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -5949,6 +6047,14 @@ "node": ">=4.0" } }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/kleur": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz", @@ -6092,6 +6198,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -6746,9 +6858,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "node_modules/nanoid": { - "version": "3.1.30", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", - "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -6771,16 +6883,16 @@ "dev": true }, "node_modules/next": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/next/-/next-11.1.3.tgz", - "integrity": "sha512-ud/gKmnKQ8wtHC+pd1ZiqPRa7DdgulPkAk94MbpsspfNliwZkYs9SIYWhlLSyg+c661LzdUI2nZshvrtggSYWA==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/next/-/next-11.1.4.tgz", + "integrity": "sha512-GWQJrWYkfAKP8vmrzJcCfRSKv955Khyjqd5jipTcVKDGg+SH+NfjDMWFtCwArcQlHPvzisGu1ERLY0+Eoj7G+g==", "dependencies": { "@babel/runtime": "7.15.3", "@hapi/accept": "5.0.2", - "@next/env": "11.1.3", - "@next/polyfill-module": "11.1.3", - "@next/react-dev-overlay": "11.1.3", - "@next/react-refresh-utils": "11.1.3", + "@next/env": "11.1.4", + "@next/polyfill-module": "11.1.4", + "@next/react-dev-overlay": "11.1.4", + "@next/react-refresh-utils": "11.1.4", "@node-rs/helper": "1.2.1", "assert": "2.0.0", "ast-types": "0.13.2", @@ -6802,7 +6914,7 @@ "image-size": "1.0.0", "jest-worker": "27.0.0-next.5", "native-url": "0.3.4", - "node-fetch": "2.6.1", + "node-fetch": "2.6.7", "node-html-parser": "1.4.9", "node-libs-browser": "^2.2.1", "os-browserify": "0.3.0", @@ -6833,10 +6945,10 @@ "node": ">=12.0.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "11.1.3", - "@next/swc-darwin-x64": "11.1.3", - "@next/swc-linux-x64-gnu": "11.1.3", - "@next/swc-win32-x64-msvc": "11.1.3" + "@next/swc-darwin-arm64": "11.1.4", + "@next/swc-darwin-x64": "11.1.4", + "@next/swc-linux-x64-gnu": "11.1.4", + "@next/swc-win32-x64-msvc": "11.1.4" }, "peerDependencies": { "fibers": ">= 3.1.0", @@ -6858,11 +6970,22 @@ } }, "node_modules/node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, "engines": { "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, "node_modules/node-html-parser": { @@ -7967,6 +8090,18 @@ "object-assign": "^4.1.1" } }, + "node_modules/section-matter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", + "integrity": "sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==", + "dependencies": { + "extend-shallow": "^2.0.1", + "kind-of": "^6.0.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -8106,6 +8241,37 @@ "node": ">= 8" } }, + "node_modules/source-map/node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "engines": { + "node": ">=6" + } + }, + "node_modules/source-map/node_modules/tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/source-map/node_modules/webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + }, + "node_modules/source-map/node_modules/whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "dependencies": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + }, "node_modules/space-separated-tokens": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.1.tgz", @@ -8118,8 +8284,7 @@ "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "node_modules/stable": { "version": "0.1.8", @@ -8282,6 +8447,14 @@ "node": ">=4" } }, + "node_modules/strip-bom-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", + "integrity": "sha1-5SEekiQ2n7uB1jOi8ABE3IztrZI=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -8503,20 +8676,9 @@ } }, "node_modules/tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", - "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/tr46/node_modules/punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "engines": { - "node": ">=6" - } + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, "node_modules/trough": { "version": "2.0.2", @@ -8527,6 +8689,69 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/ts-node": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz", + "integrity": "sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/ts-node/node_modules/acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/ts-pnp": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", @@ -8896,6 +9121,12 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, "node_modules/vfile": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.2.0.tgz", @@ -8942,18 +9173,17 @@ } }, "node_modules/webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" }, "node_modules/whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", "dependencies": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" } }, "node_modules/which": { @@ -9043,6 +9273,15 @@ "node": ">= 6" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", @@ -10581,6 +10820,21 @@ "to-fast-properties": "^2.0.0" } }, + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, "@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -10692,9 +10946,9 @@ "integrity": "sha512-jDJTpta+P4p1NZTFVLHJ/TLFVYVcOqv6l8xwOeBKNPMgY/zDYH/YH7SJbvrr/h1RcS9GzbPcLKGzpuK9cV56UA==" }, "@next/env": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-11.1.3.tgz", - "integrity": "sha512-5+vaeooJuWmICSlmVaAC8KG3O8hwKasACVfkHj58xQuCB5SW0TKW3hWxgxkBuefMBn1nM0yEVPKokXCsYjBtng==" + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/env/-/env-11.1.4.tgz", + "integrity": "sha512-vEW+fSulzZams4nYmcX9LByb1moMBlkwOAVf0eF+44u+1N/h7HDeznPBWIjEfihzTku8rdLB0k7u8VT8AGtNkQ==" }, "@next/eslint-plugin-next": { "version": "11.1.2", @@ -10722,14 +10976,14 @@ } }, "@next/polyfill-module": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/polyfill-module/-/polyfill-module-11.1.3.tgz", - "integrity": "sha512-7yr9cr4a0SrBoVE8psxXWK1wTFc8UzsY8Wc2cWGL7qA0hgtqACHaXC47M1ByJB410hFZenGrpE+KFaT1unQMyw==" + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/polyfill-module/-/polyfill-module-11.1.4.tgz", + "integrity": "sha512-CY3bOSQf9Dy3+34dFjFbOdg3DRXIGfujb54D/AVO83ajyQczRZ3xdU0i5VV0eSR6B56ktVy3/aelOffpTUq6LA==" }, "@next/react-dev-overlay": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/react-dev-overlay/-/react-dev-overlay-11.1.3.tgz", - "integrity": "sha512-zIwtMliSUR+IKl917ToFNB+0fD7bI5kYMdjHU/UEKpfIXAZPnXRHHISCvPDsczlr+bRsbjlUFW1CsNiuFedeuQ==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/react-dev-overlay/-/react-dev-overlay-11.1.4.tgz", + "integrity": "sha512-8/9JflJwRXEvVb6cKCWgRTOmALzDJHpWD5diRbtXWsllqxcMBjtscgnO4PaK+9QyZnSYSUbn0zZUZvxOXOTE1Q==", "requires": { "@babel/code-frame": "7.12.11", "anser": "1.4.9", @@ -10790,33 +11044,33 @@ } }, "@next/react-refresh-utils": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/react-refresh-utils/-/react-refresh-utils-11.1.3.tgz", - "integrity": "sha512-144kD8q2nChw67V3AJJlPQ6NUJVFczyn10bhTynn9o2rY5DEnkzuBipcyMuQl2DqfxMkV7sn+yOCOYbrLCk9zg==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/react-refresh-utils/-/react-refresh-utils-11.1.4.tgz", + "integrity": "sha512-jTme207yEV4On9Gk0QJYK2N3kfKVBx17lLOL3qSjqNbqk1TnE51xvzogOCQXNABbzQlBY+J/NN+eylPS4QOKwA==", "requires": {} }, "@next/swc-darwin-arm64": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-11.1.3.tgz", - "integrity": "sha512-TwP4krjhs+uU9pesDYCShEXZrLSbJr78p12e7XnLBBaNf20SgWLlVmQUT9gX9KbWan5V0sUbJfmcS8MRNHgYuA==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-11.1.4.tgz", + "integrity": "sha512-jt8dMtIRWnJjRYLid6NWCxXzXdpr9VFT/vhDp8ioh+TtOR0UKPHMxei6R4GA3RqoyPEfFcSNmkG7OtyqCSxNIw==", "optional": true }, "@next/swc-darwin-x64": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-11.1.3.tgz", - "integrity": "sha512-ZSWmkg/PxccHFNUSeBdrfaH8KwSkoeUtewXKvuYYt7Ph0yRsbqSyNIvhUezDua96lApiXXq6EL2d1THfeWomvw==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-11.1.4.tgz", + "integrity": "sha512-5i9tOQNO8kawwggHvQUVR3a5KzIGaE2dw1g1kL//z/N840djvGseHrJSFEGdP1c35gM+dSGPpAKHmeBKrwHM8g==", "optional": true }, "@next/swc-linux-x64-gnu": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-11.1.3.tgz", - "integrity": "sha512-PrTBN0iZudAuj4jSbtXcdBdmfpaDCPIneG4Oms4zcs93KwMgLhivYW082Mvlgx9QVEiRm7+RkFpIVtG/i7JitA==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-11.1.4.tgz", + "integrity": "sha512-QfVuXugxBkCUHN9yD/VZ1xqszcMlBDj6vrbRiQvmWuyNo39ON6HqGn3jDwVrTHc9oKo2a0XInm+0zEnQeDmjSw==", "optional": true }, "@next/swc-win32-x64-msvc": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-11.1.3.tgz", - "integrity": "sha512-mRwbscVjRoHk+tDY7XbkT5d9FCwujFIQJpGp0XNb1i5OHCSDO8WW/C9cLEWS4LxKRbIZlTLYg1MTXqLQkvva8w==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-11.1.4.tgz", + "integrity": "sha512-7MPXYWsCo5qGZXyyJwBLvQkYi0hKARtpjGxjt/mdxn7A7O+jKJgAuxgOo/lnZIiXfbJzxRnSD8k6WkUwN0IVmg==", "optional": true }, "@node-rs/helper": { @@ -11001,6 +11255,30 @@ } } }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, "@types/debug": { "version": "4.1.7", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz", @@ -11201,6 +11479,12 @@ "dev": true, "requires": {} }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -11246,11 +11530,16 @@ "picomatch": "^2.0.4" } }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -11819,6 +12108,12 @@ "sha.js": "^2.4.8" } }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -12688,8 +12983,7 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" }, "esquery": { "version": "1.4.0", @@ -12745,6 +13039,14 @@ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "requires": { + "is-extendable": "^0.1.0" + } + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -12956,6 +13258,17 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==" }, + "gray-matter": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/gray-matter/-/gray-matter-4.0.3.tgz", + "integrity": "sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==", + "requires": { + "js-yaml": "^3.13.1", + "kind-of": "^6.0.2", + "section-matter": "^1.0.0", + "strip-bom-string": "^1.0.0" + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -13183,6 +13496,11 @@ "has-tostringtag": "^1.0.0" } }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=" + }, "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", @@ -13337,7 +13655,6 @@ "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -13384,6 +13701,11 @@ "object.assign": "^4.1.2" } }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==" + }, "kleur": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.4.tgz", @@ -13502,6 +13824,12 @@ "semver": "^6.0.0" } }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -13902,9 +14230,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "nanoid": { - "version": "3.1.30", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.30.tgz", - "integrity": "sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==" + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==" }, "native-url": { "version": "0.3.4", @@ -13921,20 +14249,20 @@ "dev": true }, "next": { - "version": "11.1.3", - "resolved": "https://registry.npmjs.org/next/-/next-11.1.3.tgz", - "integrity": "sha512-ud/gKmnKQ8wtHC+pd1ZiqPRa7DdgulPkAk94MbpsspfNliwZkYs9SIYWhlLSyg+c661LzdUI2nZshvrtggSYWA==", + "version": "11.1.4", + "resolved": "https://registry.npmjs.org/next/-/next-11.1.4.tgz", + "integrity": "sha512-GWQJrWYkfAKP8vmrzJcCfRSKv955Khyjqd5jipTcVKDGg+SH+NfjDMWFtCwArcQlHPvzisGu1ERLY0+Eoj7G+g==", "requires": { "@babel/runtime": "7.15.3", "@hapi/accept": "5.0.2", - "@next/env": "11.1.3", - "@next/polyfill-module": "11.1.3", - "@next/react-dev-overlay": "11.1.3", - "@next/react-refresh-utils": "11.1.3", - "@next/swc-darwin-arm64": "11.1.3", - "@next/swc-darwin-x64": "11.1.3", - "@next/swc-linux-x64-gnu": "11.1.3", - "@next/swc-win32-x64-msvc": "11.1.3", + "@next/env": "11.1.4", + "@next/polyfill-module": "11.1.4", + "@next/react-dev-overlay": "11.1.4", + "@next/react-refresh-utils": "11.1.4", + "@next/swc-darwin-arm64": "11.1.4", + "@next/swc-darwin-x64": "11.1.4", + "@next/swc-linux-x64-gnu": "11.1.4", + "@next/swc-win32-x64-msvc": "11.1.4", "@node-rs/helper": "1.2.1", "assert": "2.0.0", "ast-types": "0.13.2", @@ -13956,7 +14284,7 @@ "image-size": "1.0.0", "jest-worker": "27.0.0-next.5", "native-url": "0.3.4", - "node-fetch": "2.6.1", + "node-fetch": "2.6.7", "node-html-parser": "1.4.9", "node-libs-browser": "^2.2.1", "os-browserify": "0.3.0", @@ -13982,9 +14310,12 @@ } }, "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "requires": { + "whatwg-url": "^5.0.0" + } }, "node-html-parser": { "version": "1.4.9", @@ -14836,6 +15167,15 @@ "object-assign": "^4.1.1" } }, + "section-matter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", + "integrity": "sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==", + "requires": { + "extend-shallow": "^2.0.1", + "kind-of": "^6.0.0" + } + }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -14939,6 +15279,36 @@ "integrity": "sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==", "requires": { "whatwg-url": "^7.0.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "requires": { + "punycode": "^2.1.0" + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + }, + "whatwg-url": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + } + } } }, "space-separated-tokens": { @@ -14949,8 +15319,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "stable": { "version": "0.1.8", @@ -15088,6 +15457,11 @@ "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, + "strip-bom-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-bom-string/-/strip-bom-string-1.0.0.tgz", + "integrity": "sha1-5SEekiQ2n7uB1jOi8ABE3IztrZI=" + }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -15256,25 +15630,50 @@ "integrity": "sha512-+Y17F0YzxfACxTyjfhnJQEe7afPA0GSpYlFkl2VFMxYP7jshQf9gXV7cH47EfToBumFThfKBvfAcoUn6fdNeRQ==" }, "tr46": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", - "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", - "requires": { - "punycode": "^2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" - } - } + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, "trough": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/trough/-/trough-2.0.2.tgz", "integrity": "sha512-FnHq5sTMxC0sk957wHDzRnemFnNBvt/gSY99HzK8F7UP5WAbvP70yX5bd7CjEQkN+TjdxwI7g7lJ6podqrG2/w==" }, + "ts-node": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.5.0.tgz", + "integrity": "sha512-6kEJKwVxAJ35W4akuiysfKwKmjkbYxwQMTBaAxo9KKAx/Yd26mPUyhGz3ji+EsJoAgrLqVsYHNuuYwQe22lbtw==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.0", + "yn": "3.1.1" + }, + "dependencies": { + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + } + } + }, "ts-pnp": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.2.0.tgz", @@ -15551,6 +15950,12 @@ "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, + "v8-compile-cache-lib": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", + "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", + "dev": true + }, "vfile": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.2.0.tgz", @@ -15586,18 +15991,17 @@ } }, "webidl-conversions": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" }, "whatwg-url": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", - "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", "requires": { - "lodash.sortby": "^4.7.0", - "tr46": "^1.0.1", - "webidl-conversions": "^4.0.2" + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" } }, "which": { @@ -15663,6 +16067,12 @@ "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", "dev": true }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + }, "yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 4cfa958..4533082 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "dependencies": { "@types/react": "^17.0.37", "dotenv": "^10.0.0", + "gray-matter": "^4.0.3", "next": "^11.1.3", "normalize.css": "^8.0.1", "react": "^17.0.2", @@ -19,6 +20,7 @@ "@types/react-dom": "^17.0.11", "eslint": "^7.32.0", "eslint-config-next": "^11.1.2", - "typescript": "^4.5.2" + "typescript": "^4.5.2", + "ts-node": "^10.5.0" } } diff --git a/pages/about.tsx b/pages/about.tsx index 41788fd..3267276 100644 --- a/pages/about.tsx +++ b/pages/about.tsx @@ -13,12 +13,11 @@ function AboutPage() { I do not really know, at least the content I put here. I guess I wanted a place on the web where I wanted to put everything I think is worth looking at some point in the future.

- It seems wise to have things up here even though they may embarrass me at some point in the future, as many of the things I have done in the past have. Especially the web sites I made in high school. I will never forget those. -
+ It seems wise to have things up here even though they may embarrass me at some point in the future, as many of the things I have done in the past have. Got any questions, concerns, or issues? Feel free to contact me via my email: lambdapaul [at] pm [dot] me.
- {ReadmeMd} + {ReadmeMd.replace(/#{1,5} /g, (s: string) => {return `#${s}`})}
) diff --git a/pages/grade-calc/index.tsx b/pages/grade-calc/index.tsx index cfd94da..0b36e7b 100644 --- a/pages/grade-calc/index.tsx +++ b/pages/grade-calc/index.tsx @@ -1,4 +1,4 @@ -import React, { ReactElement, useState } from 'react'; +import React, { ReactElement, useEffect, useState } from 'react'; import Layout from '../../components/layout'; import Link from 'next/link'; import GradeCalc from '../../components/_gc'; @@ -77,9 +77,22 @@ function GradeCalcPage() { // export default GradeCalcPage; export default function WIP() { + useEffect(() => { + const script = document.createElement('script'); + + script.src = '/grade-calc/vanilla.js'; + script.async = true; + + document.body.appendChild(script); + + return () => { + document.body.removeChild(script); + } + }, []); + return ( -
+
Check back later as the port of this page is a Work in Progress.
); diff --git a/pages/index.tsx b/pages/index.tsx index 9be33c1..81475ec 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -2,29 +2,46 @@ import Link from 'next/link'; import React from 'react'; import Layout from '../components/layout'; import Pages from '../public/pages.json'; +import cachePostLinkData from '../util/post-cache'; -// import { GetStaticProps } from 'next'; -function HomePage() { +function HomePage({posts}: any) { + Pages.sort((x, y) => { return ('' + x.title).localeCompare(y.title) }); return ( -
-
Welcome to my website!
{ +
+
Welcome!
+ { Pages.map(obj => { - return
+
+
Posts
+
+ {posts?.map((post: any) => { + return
+ [{ (new Date(post.last_updated)).toLocaleString()}] + {post.title} + +
+ })} +
+
) } -export default HomePage; +export async function getStaticProps() { + // make this webpack plugin + return { + props: {posts: cachePostLinkData()} + }; +} -// export async function getStaticProps(context): GetStaticProps { - -// } \ No newline at end of file +export default HomePage; \ No newline at end of file diff --git a/pages/posts/[page].tsx b/pages/posts/[page].tsx new file mode 100644 index 0000000..2d7f9d7 --- /dev/null +++ b/pages/posts/[page].tsx @@ -0,0 +1,42 @@ +import Layout from '../../components/layout'; +import { useRouter } from 'next/router'; +import { getAllPosts, getPost } from '../../lib/slug'; +import ReactMarkdown from 'react-markdown'; +import Image from 'next/image'; + +function Post({post} : any) { // eh + const router = useRouter(); + return ( + +
+ {post.cover ? {`${post.title} : ''} + {post.content} +
+
+ ); +} + +export async function getStaticProps({params}: any) { + const post = getPost(params.page); + + return { + props: {post} + }; +} + +export async function getStaticPaths() { + const posts = getAllPosts(); + return { + paths: posts.map(post => { + return { + params: { + page: post.slug + } + } + }), + fallback: false + }; +} + + +export default Post; diff --git a/pages/posts/index.tsx b/pages/posts/index.tsx new file mode 100644 index 0000000..6b92374 --- /dev/null +++ b/pages/posts/index.tsx @@ -0,0 +1,32 @@ +import Link from 'next/link'; +import React from 'react'; +import Layout from '../../components/layout'; +import { getAllPosts } from '../../lib/slug'; +import Pages from '../../public/pages.json'; +import cachePostLinkData from '../../util/post-cache'; + + +function HomePage({posts}: any) { + Pages.sort((x, y) => { return ('' + x.title).localeCompare(y.title) }); + return ( + + {posts.map((post: any) => { + return
+ + {post.title} + +
[{ (new Date(post.last_updated)).toLocaleString()}]
+
+ })} +
+ ) +} + +export async function getStaticProps() { + + return { + props: {posts: cachePostLinkData()} + }; +} + +export default HomePage; \ No newline at end of file diff --git a/posts/thoughts-on-baba-is-you.md b/posts/thoughts-on-baba-is-you.md new file mode 100644 index 0000000..90437c7 --- /dev/null +++ b/posts/thoughts-on-baba-is-you.md @@ -0,0 +1,14 @@ +--- +title: Thoughts on Baba Is You +created_at: '2021-10-30T00:43:00.000Z' +cover: 'baba_is_you_screencap.png' +--- + +Just when I thought this game exhausted everything it has to offer, it introduces a new mechanic. +Just when I thought I mastered this game, it introduces something new and adds to the complexity. + +I do not know how to compare it to a typical puzzle game because this game is in a sub-genre on its own. You write the rules to your suiting. However many level constrain the rules so you have to work with the ones that level does not have "locked." The early levels are relatively straight-forward, as they act as tutorials. But the difficulty curve goes up and up until you hit a roadblock and get stuck on it for hours. That is when you play a different level. Yes, the game has this over-world similar to the one in Super Mario World where you access levels and sub-worlds. Beating a level unlocks the surrounding locked levels and a dandelion-looking thing (it is really never explained). Sub-worlds are also unlocked by beating levels and collecting those dandelions. There are other collectibles too that are awarded based on set criteria but that would be too much information for new players and for a review. + +Do not let the cutesy art style and music in the trailers and other promotional media distract you. This game is extremely difficult. But the moment a solution clicks in a level, there is no better feeling. + +Speaking of music, I feel it is the weakest part of the game. The main theme is simple but catchy and the rest are somewhat forget-able. \ No newline at end of file diff --git a/public/assets/images/baba_is_you_screencap.png b/public/assets/images/baba_is_you_screencap.png new file mode 100644 index 0000000..0625355 Binary files /dev/null and b/public/assets/images/baba_is_you_screencap.png differ diff --git a/public/grade-calc/vanilla.js b/public/grade-calc/vanilla.js new file mode 100644 index 0000000..ecbb71a --- /dev/null +++ b/public/grade-calc/vanilla.js @@ -0,0 +1,268 @@ +(()=>{ + const cont = ` +
+

About

+ Check out the README.md file + to learn more about the configuration structure. +

Usage

+
    +
  1. Either configure the calculator using the text box below or load one from the existing JSON files to + generate one.
  2. +
  3. Click Generate.
  4. +
  5. Enter the input values.
  6. +
+
+
+
+ `; + document.querySelector('.grade-calc').innerHTML = cont; +})(); // eh + +function generate() { + let calcSection = document.querySelector(".calculator-container"); + calcSection.innerHTML = ""; + try { + conf = JSON.parse(document.getElementById("json").value); + } + catch (e) { + console.log(e); + calcSection.innerHTML = e; + return; + } + let cb = (out) => { + for (let o of out) { + calcSection.appendChild(o); + } + } + gc = new __GradeCalc(conf, cb); + + calcSection.appendChild(gc.elemTotal); +} + +function loadConfig(filename) { + var client = new XMLHttpRequest(); + client.open('GET', filename); + client.onreadystatechange = function () { + document.getElementById("json").value = (client.responseText); + } + client.send(); +} + +class __GradeCalc { + maxscore = 0; + sections = []; + inputSection = []; + outputSection = []; + fields = []; + grades = []; + ugrades = []; + both = false; + totalOutput = null; + + constructor(config, outCallback) { + this.totalOutput = document.createElement("div"); + let dConfig = JSON.parse(JSON.stringify(config)); // dirty clone + let sanConfig = []; + for (let conf of dConfig) { + if (conf.percentage === undefined || conf.name === undefined) + continue; + if (conf.title === undefined) + conf.title = conf.name[0].toUpperCase() + conf.name.slice(1); + sanConfig.push(conf); + } + this.config = sanConfig; + for (let [i, conf] of this.config.entries()) { + this.maxscore += conf.percentage; + + this.inputSection[i] = []; + this.outputSection[i] = document.createElement("div"); + + if (conf.bothMethods) { + this.both = true; + } + + this.sections[i] = (this.createSection(i)); + } + + for (let [k, v] of this.fields.entries()) { + for (let field of v) { + this.addInputEventListener(k, field); + } + } + + outCallback(this.sections); + } + + createSection(id) { + let conf = this.config[id]; + + var section = document.createElement("div"); + section.classList.add(conf.name); + + var heading = document.createElement("h2"); + heading.innerHTML = `${conf.title} (${conf.percentage}%)`; + + section.appendChild(heading); + + if (conf.info !== undefined) + section.appendChild(document.createTextNode(conf.info)); + + this.fields[id] = []; + if (conf.points !== undefined) { + for (var i = 0; i < conf.points.length; i++) { + section.appendChild(this.createInputSection(id, i)); + } + } + else { + section.appendChild(this.createInputSection(id, 0, true)); + } + + + section.appendChild(this.outputSection[id]); + return section; + } + + createInputSection(sectId, inputId, soleInput = false) { + let conf = this.config[sectId]; + let inputSection = document.createElement("div"); + inputSection.classList.add("input-section"); + + let label = document.createElement("label"); + if (soleInput) + label.innerHTML = `${conf.title} Score: `; + else + label.innerHTML = `${conf.title} ${inputId + 1} Score: `; + + let field = document.createElement("input"); + field.classList.add(`input`); + field.classList.add(`${conf.name}-score`); + this.fields[sectId][inputId] = field; + + let suffix = (soleInput) ? "%" : ` / ${conf.points[inputId]} pts`; + + inputSection.appendChild(label); + inputSection.appendChild(field); + inputSection.appendChild(document.createTextNode(suffix)); + + this.inputSection[sectId][inputId] = inputSection; + return inputSection; + } + + addInputEventListener(id, field, event = "keyup") { + let conf = this.config[id]; + field.addEventListener(event, () => { + if (conf.output !== undefined && conf.output) + this.showSectionGrade(id); + this.showTotalGrade(); + }); + } + + calculateSectionGrade(id, unweighted = false) { + let conf = this.config[id]; + let fields = this.fields[id]; + if (fields === undefined) + return; + if (conf.points === undefined) { + return parseFloat(fields[0].value); + } + + let total = 0; + + if (unweighted) { + let counter = 0; + for (let [i, field] of fields.entries()) { + let val = parseFloat(field.value); + if (isNaN(val)) + continue; + total += val / conf.points[i]; + counter++; + } + + return (total / counter * 100); + } + + total = fields.reduce((acc, cur) => { + let c = parseFloat(cur.value); + if (isNaN(c)) + return acc; + return acc + parseFloat(c); + }, 0); + + let max_total = 0; + for (let [i, field] of conf.points.entries()) { + if (isNaN(parseFloat(fields[i].value))) + continue; + max_total += field; + } + + return (total / max_total * 100); + } + + showSectionGrade(id) { + let conf = this.config[id]; + let grade = this.calculateSectionGrade(id); + let ugrade = this.calculateSectionGrade(id, true); + + + this.grades[id] = grade * parseFloat(conf.percentage) / 100; + this.ugrades[id] = ugrade * parseFloat(conf.percentage) / 100; + + grade = !isNaN(grade) ? grade.toFixed(2) : "..."; + ugrade = !isNaN(ugrade) ? ugrade.toFixed(2) : "..."; + if (conf.bothMethods) { + this.outputSection[id].innerHTML + = `Score (weighted): ${grade}%
Score (unweighted): ${ugrade}%`; + return; + } + + this.outputSection[id].innerHTML = `Score: ${grade}`; + } + + showTotalGrade() { + for (let [k, conf] of this.config.entries()) { + if (!conf.output) { + this.grades[k] = this.calculateSectionGrade(k) * parseFloat(conf.percentage) / 100; + this.ugrades[k] = this.calculateSectionGrade(k, true) * parseFloat(conf.percentage) / 100; + } + } + + let grade = this.grades.reduce((a, c) => { + if (isNaN(c)) + return a; + return a + c + }, 0); + let ugrade = this.ugrades.reduce((a, c) => { + if (isNaN(c)) + return a; + return a + c + }, 0); + + grade = !isNaN(grade) ? grade.toFixed(2) : "..."; + ugrade = !isNaN(ugrade) ? ugrade.toFixed(2) : "..."; + if (this.both) { + this.totalOutput.innerHTML + = `Total Score (weighted): ${grade}%
Total Score (unweighted): ${ugrade}%`; + return; + } + + this.totalOutput.innerHTML = `Total Score: ${grade}%`; + } + + get elemTotal() { + return this.totalOutput; + } +} diff --git a/public/pages.json b/public/pages.json index 0dfd322..c7d8738 100644 --- a/public/pages.json +++ b/public/pages.json @@ -9,5 +9,6 @@ {"title":"Mastodon", "link": "https://mastodon.social/@lambdapaul"}, {"title":"Matrix", "link": "https://matrix.to/#/@lambdapaul:matrix.org"}, {"title":"Keybase", "link": "https://keybase.io/lambdapaul"}, - {"title":"Playlists", "link": "/playlists"} + {"title":"Playlists", "link": "/playlists"}, + {"title":"Posts", "link": "/posts"} ] diff --git a/public/posts.json b/public/posts.json new file mode 100644 index 0000000..096e449 --- /dev/null +++ b/public/posts.json @@ -0,0 +1 @@ +[{"title":"Steam Info","slug":"steam-info","last_updated":"2022-02-14T09:18:29.604Z"},{"title":"Thoughts on Baba Is You","slug":"thoughts-on-baba-is-you","last_updated":"2021-10-29T04:00:00.000Z"}] \ No newline at end of file diff --git a/public/site.json b/public/site.json deleted file mode 100644 index aadbd8c..0000000 --- a/public/site.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "type": "root", - "domain": "paulw.xyz", - "children": [ - { - "name": "resources", - "type": "route" - }, - { - "name": "recommended", - "type": "route" - }, - { - "name": "playlists", - "type": "route" - }, - { - "name": "grade-calc", - "type": "route", - "text": "Grade Calculator", - "children": [ - { - "name": "readme", - "type": "route", - "text": "Grade Calculator Read Me" - } - ] - }, - { - "name": "about", - "type": "route" - }, - { - "name": "github", - "type": "external", - "text": "GitHub", - "url": "https://github.com/LambdaPaul" - }, - { - "name": "gitlab", - "type": "external", - "text": "GitLab", - "url": "https://gitlab.com/LambdaPaul" - }, - { - "name": "mastodon", - "type": "external", - "url": "https://mastodon.social/@lambdapaul" - }, - { - "name": "keybase", - "type": "external", - "url": "https://keybase.io/lambdapaul" - }, - { - "name": "matrix", - "type": "external", - "url": "https://matrix.to/#/@lambdapaul:matrix.org" - } - ] -} diff --git a/public/site.md b/public/site.md deleted file mode 100644 index 4028a81..0000000 --- a/public/site.md +++ /dev/null @@ -1,44 +0,0 @@ -# Site.json File Specification - -This is a very basic site structure specification used to generate some of the navigations pages and components of the website. - -## Definitions - -### Member - -### Website - -## Attributes - -These are the keys to the object definition used to define the website. Not all of the attributes will be read by the application as they are dependent on the type of member. However, if they are, they must conform to this document. - -### `name` - -Name is one of the two required attributes for each member, along with type. - -### `type` - - -### `children` - -Children is used to define sub-members of the current member. - -### `text` - -Text is used tto override the string that the capitalization of the name results in. If a change is not required, this may be omitted. - -### `url` - -### `domain` - -## Types - -The types are the different kinds of members that the page can have. They are defined with the `type` attribute. The current list is tentative. - -### `root` - -### `directory` - -### `route` - -### `external` \ No newline at end of file diff --git a/styles/fuzzy.module.css b/styles/fuzzy.module.css index 6cf1a0a..c24045b 100644 --- a/styles/fuzzy.module.css +++ b/styles/fuzzy.module.css @@ -5,6 +5,7 @@ top: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.9); + z-index: 100; } .search { diff --git a/styles/global.css b/styles/global.css index 3f97975..450d942 100644 --- a/styles/global.css +++ b/styles/global.css @@ -150,9 +150,32 @@ section { } .block { - margin: 2rem; + margin: 0 2rem; padding: 2rem; /* box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2); */ border: 1px solid #ffffff; - border-radius: 1rem; + border-bottom: none; +} + +.block:first-of-type { + border-top-right-radius: 1rem; + border-top-left-radius: 1rem; + margin-top: 2rem; +} + +.block:last-of-type { + border-bottom: 1px solid #ffffff; + border-bottom-right-radius: 1rem; + border-bottom-left-radius: 1rem; + margin-bottom: 2rem; +} + +code { + overflow-x: scroll; + max-width: 100%; + display: inline-block; + background-color: rgba(255, 255, 255, 0.1); + font-size: 1rem; + padding: 0.1rem 0.5rem; + vertical-align: bottom; } \ No newline at end of file diff --git a/util/post-cache.ts b/util/post-cache.ts new file mode 100644 index 0000000..08938db --- /dev/null +++ b/util/post-cache.ts @@ -0,0 +1,14 @@ +import fs from 'fs'; +import { getAllPosts } from '../lib/slug'; +import { join } from 'path'; + +const publicDir = join(process.cwd(), 'public'); + +export default function cachePostLinkData() { + const posts = getAllPosts(['title', 'slug', 'last_updated']); + fs.writeFile(`${publicDir}/posts.json`, JSON.stringify(posts), (e) => { + if (e) + console.error(e); + }); + return posts; +} \ No newline at end of file