feat: merge looper and writepage
@@ -9,6 +9,7 @@ "cpy": "^13.2.1",
"express-static": "^1.2.6", "fs-extra": "^11.3.2", "glob": "^13.0.6", + "hast-util-select": "^6.0.4", "hastx": "^0.1.2", "js-yaml": "^4.1.1", "livereload": "^0.10.3",@@ -22,6 +23,7 @@ "rehype-document": "^7.0.3",
"rehype-format": "^5.0.1", "rehype-meta": "^4.0.1", "rehype-parse": "^9.0.1", + "rehype-preset-minify": "^7.0.1", "rehype-raw": "^7.0.0", "rehype-react": "^8.0.0", "rehype-stringify": "^10.0.1",@@ -35,6 +37,9 @@ "sharp": "^0.34.5",
"to-vfile": "^8.0.0", "unified": "^11.0.5", "unist-util-visit": "^5.0.0", + "vfile": "^6.0.3", + "vfile-matter": "^5.0.1", + "vfile-rename": "^3.0.0", "vfile-reporter": "^8.1.1", "vite": "^8.0.10", },@@ -211,7 +216,11 @@ "balanced-match": ["balanced-match@4.0.4", "", {}, "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA=="],
"base62": ["base62@1.2.8", "", {}, "sha512-V6YHUbjLxN1ymqNLb1DPHoU1CpfdL7d2YTIp5W3U4hhoG4hhxNmsFDs66M9EXxBiSEke5Bt5dwdfMwwZF70iLA=="], + "bcp-47": ["bcp-47@2.1.0", "", { "dependencies": { "is-alphabetical": "^2.0.0", "is-alphanumerical": "^2.0.0", "is-decimal": "^2.0.0" } }, "sha512-9IIS3UPrvIa1Ej+lVDdDwO7zLehjqsaByECw0bu2RRGP73jALm6FYbzI5gWbgHLvNdkvfXB5YrSbocZdOS0c0w=="], + "bcp-47-match": ["bcp-47-match@2.0.3", "", {}, "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ=="], + + "bcp-47-normalize": ["bcp-47-normalize@2.3.0", "", { "dependencies": { "bcp-47": "^2.0.0", "bcp-47-match": "^2.0.0" } }, "sha512-8I/wfzqQvttUFz7HVJgIZ7+dj3vUaIyIxYXaTRP1YWoSDfzt6TUmxaKZeuXR62qBmYr+nvuWINFRl6pZ5DlN4Q=="], "boolbase": ["boolbase@1.0.0", "", {}, "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="],@@ -232,6 +241,10 @@
"character-reference-invalid": ["character-reference-invalid@2.0.1", "", {}, "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw=="], "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], + + "clean-css": ["clean-css@5.3.3", "", { "dependencies": { "source-map": "~0.6.0" } }, "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg=="], + + "collapse-white-space": ["collapse-white-space@2.1.0", "", {}, "sha512-loKTxY1zCOuG4j9f6EPnuyyYkf58RnhhWTvRoZEokgB+WbdXehfjFviyOVYkqzEWz1Q5kRiZdBYS5SwxbQYwzw=="], "comma-separated-tokens": ["comma-separated-tokens@2.0.3", "", {}, "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg=="],@@ -322,12 +335,24 @@
"hast-util-from-parse5": ["hast-util-from-parse5@8.0.3", "", { "dependencies": { "@types/hast": "^3.0.0", "@types/unist": "^3.0.0", "devlop": "^1.0.0", "hastscript": "^9.0.0", "property-information": "^7.0.0", "vfile": "^6.0.0", "vfile-location": "^5.0.0", "web-namespaces": "^2.0.0" } }, "sha512-3kxEVkEKt0zvcZ3hCRYI8rqrgwtlIOFMWkbclACvjlDw8Li9S2hk/d51OI0nr/gIpdMHNepwgOKqZ/sy0Clpyg=="], "hast-util-from-selector": ["hast-util-from-selector@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "css-selector-parser": "^3.0.0", "devlop": "^1.0.0", "hastscript": "^9.0.0" } }, "sha512-CA2dwcsAS6a7DNZq8HT5fNP4FzUq2PUpQpKnAtOCmfTk429jR0RtasLSMlFA1FNKd8lgfeCIAFl3/vD95be8Lg=="], + + "hast-util-from-string": ["hast-util-from-string@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-EpOi8Ux+QiJEUhv69d0xtGlA/7o6V1Yr4jqy6hq0s71mgl9sJsdruRrCo9UMVLMg+VwBVB4dnut/qsOsem5WWA=="], "hast-util-has-property": ["hast-util-has-property@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA=="], "hast-util-is-body-ok-link": ["hast-util-is-body-ok-link@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-0qpnzOBLztXHbHQenVB8uNuxTnm/QBFUOmdOSsEn7GnBtyY07+ENTWVFBAnXd/zEgd9/SUG3lRY7hSIBWRgGpQ=="], - "hast-util-is-element": ["hast-util-is-element@1.1.0", "", {}, "sha512-oUmNua0bFbdrD/ELDSSEadRVtWZOf3iF6Lbv81naqsIV99RnSCieTbWuWCY8BAeEfKJTKl0gRdokv+dELutHGQ=="], + "hast-util-is-conditional-comment": ["hast-util-is-conditional-comment@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-RWpXL//CiEWwOh4OeAvr2fFeoBbX/sAnPnaYN9x4Nv6O4VPdFf/3Dq64mIybctblVA498SgVjfNc0/mN9S4IQw=="], + + "hast-util-is-css-link": ["hast-util-is-css-link@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "collapse-white-space": "^2.0.0" } }, "sha512-jyR6Ns8ypYH3nnJhvGehHTpSJdymxjKrg5PgDMClNH61JpWxXm9FLMvnk2CtWN5nulm6IeIrRgbVCsye+UPIBg=="], + + "hast-util-is-css-style": ["hast-util-is-css-style@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "collapse-white-space": "^2.0.0" } }, "sha512-5dlGKMoyB2+HY4hAB9pEkzlrH1tfnlHdkw6q1pkzLv2RI01w2ofyhJICzcYbW3NOrTUy4/0qrNvCPsVyHQlB2w=="], + + "hast-util-is-element": ["hast-util-is-element@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g=="], + + "hast-util-is-event-handler": ["hast-util-is-event-handler@3.0.1", "", {}, "sha512-Xu8jmmojIJ45sSE4c39kZXrW96O/J/wFCxZmg+C7/A/Av6kxwtTPRMBe9TGNJEtRRSch3v1H6iZe7C2hkGe8oQ=="], + + "hast-util-is-javascript": ["hast-util-is-javascript@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "collapse-white-space": "^2.0.0" } }, "sha512-z4KmilPwiFev1QP9dl++aZDvN1y9LLKgWiZ5oyOG23ybNz+F3Y4tIoWzG+RiQfns/+y3iq7H7p2ebwaY2fFLSQ=="], "hast-util-minify-whitespace": ["hast-util-minify-whitespace@1.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-embedded": "^3.0.0", "hast-util-is-element": "^3.0.0", "hast-util-whitespace": "^3.0.0", "unist-util-is": "^6.0.0" } }, "sha512-L96fPOVpnclQE0xzdWb/D12VT5FabA7SnZOUMtL1DbXmYiHJMXZvFkIZfiMmTCNJHUeO2K9UYNXoVyfz+QHuOw=="],@@ -355,6 +380,10 @@ "hastx": ["hastx@0.1.2", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-vpfSyE9mwJsN3UT+9iyKZZQc2RRNnreii/uR+onvCcxlcL8f05L431irUiH8qzSu4bRp3+kFJjE8Nug8y0Apmw=="],
"hotscript": ["hotscript@1.0.13", "", {}, "sha512-C++tTF1GqkGYecL+2S1wJTfoH6APGAsbb7PAWQ3iVIwgG/EFseAfEVOKFgAFq4yK3+6j1EjUD4UQ9dRJHX/sSQ=="], + "html-enumerated-attributes": ["html-enumerated-attributes@1.1.1", "", {}, "sha512-fxfswuADQ6N6RmCUYoCEIw09Zbk/h8GJSJsbiQ3Uw3mkQegJ5b7Eu5Tpxl2xDUq9meWmivHe0GFieG2qHl2j4A=="], + + "html-url-attributes": ["html-url-attributes@3.0.1", "", {}, "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ=="], + "html-void-elements": ["html-void-elements@3.0.0", "", {}, "sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg=="], "html-whitespace-sensitive-tag-names": ["html-whitespace-sensitive-tag-names@3.0.1", "", {}, "sha512-q+310vW8zmymYHALr1da4HyXUQ0zgiIwIicEfotYPWGN0OJVEN/58IJ3A4GBYcEq3LGAZqKb+ugvP0GNB9CEAA=="],@@ -553,7 +582,7 @@ "private": ["private@0.1.8", "", {}, "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg=="],
"promise": ["promise@7.3.1", "", { "dependencies": { "asap": "~2.0.3" } }, "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg=="], - "property-information": ["property-information@6.5.0", "", {}, "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig=="], + "property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="], "q": ["q@1.5.1", "", {}, "sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw=="],@@ -579,12 +608,60 @@ "rehype-format": ["rehype-format@5.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-format": "^1.0.0" } }, "sha512-zvmVru9uB0josBVpr946OR8ui7nJEdzZobwLOOqHb/OOD88W0Vk2SqLwoVOj0fM6IPCCO6TaV9CvQvJMWwukFQ=="],
"rehype-meta": ["rehype-meta@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-from-selector": "^3.0.0", "hast-util-select": "^6.0.0", "hastscript": "^9.0.0", "vfile": "^6.0.0" } }, "sha512-nLwA17+GbtBYi3C1KSrFR8JlqXv76mz185U//xDEAYgzE3g/bSD6WKSXva1W95ttzouUCJwA09X3AQZIi3R+Nw=="], + "rehype-minify-attribute-whitespace": ["rehype-minify-attribute-whitespace@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "collapse-white-space": "^2.0.0", "hast-util-is-element": "^3.0.0", "hast-util-is-event-handler": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-QAfUrcZ6KCfpYonDbiWKTRpnVu9DYxFlvXMWWZe4BQbojwjjUbGIg1zoqyInJiJHAdYYyTHN5yJV2THa3opIng=="], + + "rehype-minify-css-style": ["rehype-minify-css-style@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "clean-css": "^5.0.0", "hast-util-from-string": "^3.0.0", "hast-util-is-css-style": "^3.0.0", "hast-util-to-string": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-vIYlkQx0vvstzUk7XKc//i5HOklD7N84jaRq22XzOqxgf8bpGF9Jl90V4T+OUepX110UMEltv1rHl57lpAQjjg=="], + + "rehype-minify-enumerated-attribute": ["rehype-minify-enumerated-attribute@5.0.2", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-select": "^6.0.0", "html-enumerated-attributes": "^1.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-B4laV6OHZAtXnvfNQw17q9a2TIzSCLM5gGc0Hv8Cn2Zun7Ri0hz5wKRULy0yelAyBZfTMbjM/euR2kHAmQHITw=="], + + "rehype-minify-event-handler": ["rehype-minify-event-handler@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-event-handler": "^3.0.0", "uglify-js": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-zDO5GyQqPKP68mGV4lGeCDoVii9eAt4DgqOiyfYIapHA/8YTQHCjJAevrNuBd3+xPg2e9jsH4KE8SpRjjAKfLg=="], + + "rehype-minify-javascript-script": ["rehype-minify-javascript-script@5.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-from-string": "^3.0.0", "hast-util-is-javascript": "^3.0.0", "hast-util-to-string": "^3.0.0", "uglify-js": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-7kzo/4hJz/6zIdPune/TyaFfA8IEawN3WmEZpw1Sa/iGu0nXwFI07nH45efYdYg/PD8EGNzJfuGqHGzfq0ewhA=="], + + "rehype-minify-javascript-url": ["rehype-minify-javascript-url@5.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-element": "^3.0.0", "html-url-attributes": "^3.0.0", "uglify-js": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-sBaN58Vj/a303tnKVv0fKKJoN9TxpZhw1Jt1k1rQoIxs3SCCjDpIc+VGp4RcqBY4K2F7i1gjbAKYQ1H/7mjUTQ=="], + + "rehype-minify-json-script": ["rehype-minify-json-script@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-from-string": "^3.0.0", "hast-util-to-string": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-r4+mqLZvhICFTPGxNykw2uOejnCy0wHtnAZSFHZbOCq5fF0+fr9892o6fdwT7phcXCrLPeZXORRZr48mTyhEBQ=="], + + "rehype-minify-language": ["rehype-minify-language@3.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "bcp-47-normalize": "^2.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-601rocoA1MntPZZsWmPUkNN76nisKbG2JGv8OsacWs8tnpHoE8Ozurm9kp7ddvFjTbYy8xtgJB72s2yPEFhbzg=="], + + "rehype-minify-media-attribute": ["rehype-minify-media-attribute@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "clean-css": "^5.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-J6W+RceuJ07PQcHUTBfFEgxw5buGvwY901PQMGSQJBoWkfe7vJhXSPwZJ5EdIeAMbh0vYpc80k//FNfFUhqKXg=="], + + "rehype-minify-meta-color": ["rehype-minify-meta-color@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "clean-css": "^5.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-oWpcdB+fZQNZBvVLSF8Jo7/D+s8y7okJQCJNOu73WF2asXuR5Iz5zmFChujhqTVl4X3Io2yZ9NryJ+2QK/butQ=="], + + "rehype-minify-meta-content": ["rehype-minify-meta-content@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-81/0V5HIgaSkgzlhi8P9lXh8JkoQ8gZzda+xAIGgK0zRFu9EUYfbzJp/y5pUsV7zZaSWDgr0WhMSs4zyUnRLQA=="], + + "rehype-minify-style-attribute": ["rehype-minify-style-attribute@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "clean-css": "^5.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-J2efUDe9A4AIwCi04HRHnqf2+mZoADZAmnwBmfJKMAjoci1d8nGgTyAhw1uq6XHXzG0wDa3i54o5xoS+4lc5xw=="], + + "rehype-minify-whitespace": ["rehype-minify-whitespace@6.0.2", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-minify-whitespace": "^1.0.0" } }, "sha512-Zk0pyQ06A3Lyxhe9vGtOtzz3Z0+qZ5+7icZ/PL/2x1SHPbKao5oB/g/rlc6BCTajqBb33JcOe71Ye1oFsuYbnw=="], + + "rehype-normalize-attribute-value-case": ["rehype-normalize-attribute-value-case@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-element": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-sdsfY4DgVWO3K9lJHdIQHg+ErgSGxpFJX0lIOo0tpChQ+iaJHMITHWCGofLor1NjcxLZeeMTfJ5Aif85kLhL3g=="], + "rehype-parse": ["rehype-parse@9.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-from-html": "^2.0.0", "unified": "^11.0.0" } }, "sha512-ksCzCD0Fgfh7trPDxr2rSylbwq9iYDkSn8TCDmEJ49ljEUBxDVCzCHv7QNzZOfODanX4+bWQ4WZqLCRWYLfhag=="], + "rehype-preset-minify": ["rehype-preset-minify@7.0.1", "", { "dependencies": { "rehype-minify-attribute-whitespace": "^4.0.0", "rehype-minify-css-style": "^4.0.0", "rehype-minify-enumerated-attribute": "^5.0.0", "rehype-minify-event-handler": "^4.0.0", "rehype-minify-javascript-script": "^5.0.0", "rehype-minify-javascript-url": "^5.0.0", "rehype-minify-json-script": "^4.0.0", "rehype-minify-language": "^3.0.0", "rehype-minify-media-attribute": "^4.0.0", "rehype-minify-meta-color": "^4.0.0", "rehype-minify-meta-content": "^4.0.0", "rehype-minify-style-attribute": "^4.0.0", "rehype-minify-whitespace": "^6.0.0", "rehype-normalize-attribute-value-case": "^4.0.0", "rehype-remove-comments": "^6.0.0", "rehype-remove-duplicate-attribute-values": "^4.0.0", "rehype-remove-empty-attribute": "^4.0.0", "rehype-remove-external-script-content": "^4.0.0", "rehype-remove-meta-http-equiv": "^4.0.0", "rehype-remove-script-type-javascript": "^4.0.0", "rehype-remove-style-type-css": "^4.0.0", "rehype-sort-attribute-values": "^5.0.0", "rehype-sort-attributes": "^5.0.0", "unified": "^11.0.0" } }, "sha512-yI5Jdfkg8cVar+d5GgqL3HdM1uFOSvnjIOuoJz2U5ZDOSTMrxPrFlh1egNzYNdddwVXakUz9ivKeCuZbATsFDQ=="], + "rehype-raw": ["rehype-raw@7.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-raw": "^9.0.0", "vfile": "^6.0.0" } }, "sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww=="], "rehype-react": ["rehype-react@8.0.0", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-to-jsx-runtime": "^2.0.0", "unified": "^11.0.0" } }, "sha512-vzo0YxYbB2HE+36+9HWXVdxNoNDubx63r5LBzpxBGVWM8s9mdnMdbmuJBAX6TTyuGdZjZix6qU3GcSuKCIWivw=="], + "rehype-remove-comments": ["rehype-remove-comments@6.1.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-conditional-comment": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-O3OAvqpV8IUJf6+Q4s5nqaKQqrgeXdU/+0fjUHMO0KAB4SwkMdN34NJQC9hexwvjYE00tX/xB8GvnVJI8Cdf6g=="], + + "rehype-remove-duplicate-attribute-values": ["rehype-remove-duplicate-attribute-values@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-element": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-CwSTYj6Oxs/CzfMvzwJeTyqKegiYMr1L8y4PUlbAicnZm0Ex1DzDKlTmW8ik6jDOL4SzA6+f4PRkt6t4bJBM9Q=="], + + "rehype-remove-empty-attribute": ["rehype-remove-empty-attribute@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-element": "^3.0.0", "hast-util-is-event-handler": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-DumltSgLRNKSecLa9+amnr72Qn70D9mwnm/1Y1FcSiyXLcfrbXaM9bvTwpGGIhDPdyUp1khEDGxx1MnD2PPV2Q=="], + + "rehype-remove-external-script-content": ["rehype-remove-external-script-content@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-javascript": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-wt+ONr0EY97RUMcI7J+oUuyuTu8AbMGIxApNdfaYi+/zYQfqre0LEvMuuaCSG6hRbmo22nr0a2FeKNmo6bYfNw=="], + + "rehype-remove-meta-http-equiv": ["rehype-remove-meta-http-equiv@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "space-separated-tokens": "^2.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-BtnEEEjxFzj8ywdvY5iBoOWINFUPFHa73hdFRA/1niho82KeB7jZCbetDNX4nE4B16aooSuPUiKtM3J1WnDhiA=="], + + "rehype-remove-script-type-javascript": ["rehype-remove-script-type-javascript@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-javascript": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-YtFejlGvyZE1tbpGav6RThBuVcfLMV9IAG8CDf8wXENIu3qJyegyC+HFz80MZPxw3mQKsZHAOHYE3G4LoOcGzg=="], + + "rehype-remove-style-type-css": ["rehype-remove-style-type-css@4.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-css-link": "^3.0.0", "hast-util-is-css-style": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-vMTQu+QjkzpzftOGzr6tmk/tA9V/JsfYlPz1APjrsjWl4el5ySJjKKjZiSVmxKUZDO6cDNVZQm+2ldODyoN4wg=="], + + "rehype-sort-attribute-values": ["rehype-sort-attribute-values@5.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-is-element": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-lU3ABJO5frbUgV132YS6SL7EISf//irIm9KFMaeu5ixHfgWf6jhe+09Uf/Ef8pOYUJWKOaQJDRJGCXs6cNsdsQ=="], + + "rehype-sort-attributes": ["rehype-sort-attributes@5.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "unist-util-visit": "^5.0.0" } }, "sha512-Bxo+AKUIELcnnAZwJDt5zUDDRpt4uzhfz9d0PVGhcxYWsbFj5Cv35xuWxu5r1LeYNFNhgGqsr9Q2QiIOM/Qctg=="], + "rehype-stringify": ["rehype-stringify@10.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "hast-util-to-html": "^9.0.0", "unified": "^11.0.0" } }, "sha512-k9ecfXHmIPuFVI61B9DeLPN0qFHfawM6RsuX48hoqlaKSF61RskNjSm1lI8PhBEM0MRdLxVVm4WmTqJQccH9mA=="], "rehype-wrap": ["rehype-wrap@1.1.0", "", { "dependencies": { "hast-util-parse-selector": "^2.2.4", "hast-util-select": "^4.0.0", "unist-util-visit": "^2.0.3" } }, "sha512-wu1bi74XSvVy2Nwy0AQd5kLwIsk+a8qgDWUxYkfvoh9qQ/CExAE3mx7OjD6r0v70bUSZF3irypeMVmpNFYj0Tg=="],@@ -615,7 +692,7 @@ "sharp": ["sharp@0.34.5", "", { "dependencies": { "@img/colour": "^1.0.0", "detect-libc": "^2.1.2", "semver": "^7.7.3" }, "optionalDependencies": { "@img/sharp-darwin-arm64": "0.34.5", "@img/sharp-darwin-x64": "0.34.5", "@img/sharp-libvips-darwin-arm64": "1.2.4", "@img/sharp-libvips-darwin-x64": "1.2.4", "@img/sharp-libvips-linux-arm": "1.2.4", "@img/sharp-libvips-linux-arm64": "1.2.4", "@img/sharp-libvips-linux-ppc64": "1.2.4", "@img/sharp-libvips-linux-riscv64": "1.2.4", "@img/sharp-libvips-linux-s390x": "1.2.4", "@img/sharp-libvips-linux-x64": "1.2.4", "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", "@img/sharp-libvips-linuxmusl-x64": "1.2.4", "@img/sharp-linux-arm": "0.34.5", "@img/sharp-linux-arm64": "0.34.5", "@img/sharp-linux-ppc64": "0.34.5", "@img/sharp-linux-riscv64": "0.34.5", "@img/sharp-linux-s390x": "0.34.5", "@img/sharp-linux-x64": "0.34.5", "@img/sharp-linuxmusl-arm64": "0.34.5", "@img/sharp-linuxmusl-x64": "0.34.5", "@img/sharp-wasm32": "0.34.5", "@img/sharp-win32-arm64": "0.34.5", "@img/sharp-win32-ia32": "0.34.5", "@img/sharp-win32-x64": "0.34.5" } }, "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg=="],
"slash": ["slash@5.1.0", "", {}, "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg=="], - "source-map": ["source-map@0.4.4", "", { "dependencies": { "amdefine": ">=0.0.4" } }, "sha512-Y8nIfcb1s/7DcobUz1yOO1GSp7gyL+D9zLHDehT7iRESqGSxjJ448Sg7rvfgsRJCnKLdSl11uGf0s9X80cH0/A=="], + "source-map": ["source-map@0.6.1", "", {}, "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="], "source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],@@ -655,6 +732,8 @@ "type-fest": ["type-fest@5.4.4", "", { "dependencies": { "tagged-tag": "^1.0.0" } }, "sha512-JnTrzGu+zPV3aXIUhnyWJj4z/wigMsdYajGLIYakqyOW1nPllzXEJee0QQbHj+CTIQtXGlAjuK0UY+2xTyjVAw=="],
"ua-parser-js": ["ua-parser-js@0.7.41", "", { "bin": { "ua-parser-js": "script/cli.js" } }, "sha512-O3oYyCMPYgNNHuO7Jjk3uacJWZF8loBgwrfd/5LE/HyZ3lUIOdniQ7DNXJcIgZbwioZxk0fLfI4EVnetdiX5jg=="], + "uglify-js": ["uglify-js@3.19.3", "", { "bin": { "uglifyjs": "bin/uglifyjs" } }, "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ=="], + "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="], "unicorn-magic": ["unicorn-magic@0.4.0", "", {}, "sha512-wH590V9VNgYH9g3lH9wWjTrUoKsjLF6sGLjhR4sH1LWpLmCOH0Zf7PukhDA8BiS7KHe4oPNkcTHqYkj7SOGUOw=="],@@ -676,9 +755,13 @@
"vfile": ["vfile@6.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile-message": "^4.0.0" } }, "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q=="], "vfile-location": ["vfile-location@5.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "vfile": "^6.0.0" } }, "sha512-5yXvWDEgqeiYiBe1lbxYF7UMAIm/IcopxMHrMQDq3nvKcjPKIhZklUKL+AE7J7uApI4kwe2snsK+eI6UTj9EHg=="], + + "vfile-matter": ["vfile-matter@5.0.1", "", { "dependencies": { "vfile": "^6.0.0", "yaml": "^2.0.0" } }, "sha512-o6roP82AiX0XfkyTHyRCMXgHfltUNlXSEqCIS80f+mbAyiQBE2fxtDVMtseyytGx75sihiJFo/zR6r/4LTs2Cw=="], "vfile-message": ["vfile-message@4.0.3", "", { "dependencies": { "@types/unist": "^3.0.0", "unist-util-stringify-position": "^4.0.0" } }, "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw=="], + "vfile-rename": ["vfile-rename@3.0.0", "", { "dependencies": { "vfile": "^6.0.0" } }, "sha512-7G9XKjzwBj8b0CR1vTGl1U9yjnSsi2Eg4dGcNCvaAl1HMGqudDYqZGbMYB6tzLcTCOv+r1dbTO1foA0z5LDX8g=="], + "vfile-reporter": ["vfile-reporter@8.1.1", "", { "dependencies": { "@types/supports-color": "^8.0.0", "string-width": "^6.0.0", "supports-color": "^9.0.0", "unist-util-stringify-position": "^4.0.0", "vfile": "^6.0.0", "vfile-message": "^4.0.0", "vfile-sort": "^4.0.0", "vfile-statistics": "^3.0.0" } }, "sha512-qxRZcnFSQt6pWKn3PAk81yLK2rO2i7CDXpy8v8ZquiEOMLSnPw6BMSi9Y1sUCwGGl7a9b3CJT1CKpnRF7pp66g=="], "vfile-sort": ["vfile-sort@4.0.0", "", { "dependencies": { "vfile": "^6.0.0", "vfile-message": "^4.0.0" } }, "sha512-lffPI1JrbHDTToJwcq0rl6rBmkjQmMuXkAxsZPRS9DXbaJQvc642eCg6EGxcX2i1L+esbuhq+2l9tBll5v8AeQ=="],@@ -697,6 +780,8 @@ "ws": ["ws@8.19.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg=="],
"xtend": ["xtend@4.0.2", "", {}, "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="], + "yaml": ["yaml@2.8.4", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-ml/JPOj9fOQK8RNnWojA67GbZ0ApXAUlN2UQclwv2eVgTgn7O9gg9o7paZWKMp4g0H3nTLtS9LVzhkpOFIKzog=="], + "zwitch": ["zwitch@2.0.4", "", {}, "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A=="], "@rolldown/binding-wasm32-wasi/@emnapi/runtime": ["@emnapi/runtime@1.10.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA=="],@@ -707,27 +792,15 @@ "commoner/commander": ["commander@2.20.3", "", {}, "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="],
"commoner/glob": ["glob@5.0.15", "", { "dependencies": { "inflight": "^1.0.4", "inherits": "2", "minimatch": "2 || 3", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA=="], - "hast-util-embedded/hast-util-is-element": ["hast-util-is-element@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g=="], - "hast-util-from-parse5/hastscript": ["hastscript@9.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-parse-selector": "^4.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0" } }, "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w=="], - "hast-util-from-parse5/property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="], - "hast-util-from-selector/hastscript": ["hastscript@9.0.1", "", { "dependencies": { "@types/hast": "^3.0.0", "comma-separated-tokens": "^2.0.0", "hast-util-parse-selector": "^4.0.0", "property-information": "^7.0.0", "space-separated-tokens": "^2.0.0" } }, "sha512-g7df9rMFX/SPi34tyGCyUBREQoKkapwdY/T04Qn9TDWfHhAYt4/I0gMVirzK5wEzeUqIjEB+LXC/ypb7Aqno5w=="], - "hast-util-minify-whitespace/hast-util-is-element": ["hast-util-is-element@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g=="], - - "hast-util-phrasing/hast-util-is-element": ["hast-util-is-element@3.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g=="], - - "hast-util-select/property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="], - - "hast-util-to-html/property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="], - - "hast-util-to-jsx-runtime/property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="], + "hastscript/hast-util-parse-selector": ["hast-util-parse-selector@4.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="], - "hast-util-to-parse5/property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="], + "hastscript/property-information": ["property-information@6.5.0", "", {}, "sha512-PgTgs/BlvHxOu8QuEN7wi5A0OmXaBcHpmCSTehcs6Uuu9IkDIEo13Hy7n898RHfrQ49vKCoGeWZSaAK01nwVig=="], - "hastscript/hast-util-parse-selector": ["hast-util-parse-selector@4.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="], + "jstransform/source-map": ["source-map@0.4.4", "", { "dependencies": { "amdefine": ">=0.0.4" } }, "sha512-Y8nIfcb1s/7DcobUz1yOO1GSp7gyL+D9zLHDehT7iRESqGSxjJ448Sg7rvfgsRJCnKLdSl11uGf0s9X80cH0/A=="], "micromatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="],@@ -751,11 +824,7 @@ "hast-util-from-parse5/hastscript/hast-util-parse-selector": ["hast-util-parse-selector@4.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="],
"hast-util-from-selector/hastscript/hast-util-parse-selector": ["hast-util-parse-selector@4.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="], - "hast-util-from-selector/hastscript/property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="], - "rehype-meta/hastscript/hast-util-parse-selector": ["hast-util-parse-selector@4.0.0", "", { "dependencies": { "@types/hast": "^3.0.0" } }, "sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A=="], - - "rehype-meta/hastscript/property-information": ["property-information@7.1.0", "", {}, "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ=="], "rehype-wrap/hast-util-select/bcp-47-match": ["bcp-47-match@1.0.3", "", {}, "sha512-LggQ4YTdjWQSKELZF5JwchnBa1u0pIQSZf5lSdOHEdbVP55h0qICA/FUp3+W99q0xqxYa1ZQizTUH87gecII5w=="],@@ -766,6 +835,8 @@
"rehype-wrap/hast-util-select/direction": ["direction@1.0.4", "", { "bin": { "direction": "cli.js" } }, "sha512-GYqKi1aH7PJXxdhTeZBFrg8vUBeKXi+cNprXsC1kpJcbcVnV9wBsrOu1cQEdG0WeQwlfHiy3XvnKfIrJ2R0NzQ=="], "rehype-wrap/hast-util-select/hast-util-has-property": ["hast-util-has-property@1.0.4", "", {}, "sha512-ghHup2voGfgFoHMGnaLHOjbYFACKrRh9KFttdCzMCbFoBMJXiNi2+XTrPP8+q6cDJM/RSqlCfVWrjp1H201rZg=="], + + "rehype-wrap/hast-util-select/hast-util-is-element": ["hast-util-is-element@1.1.0", "", {}, "sha512-oUmNua0bFbdrD/ELDSSEadRVtWZOf3iF6Lbv81naqsIV99RnSCieTbWuWCY8BAeEfKJTKl0gRdokv+dELutHGQ=="], "rehype-wrap/hast-util-select/hast-util-to-string": ["hast-util-to-string@1.0.4", "", {}, "sha512-eK0MxRX47AV2eZ+Lyr18DCpQgodvaS3fAQO2+b9Two9F5HEoRPhiUMNzoXArMJfZi2yieFzUBMRl3HNJ3Jus3w=="],
@@ -0,0 +1,54 @@
+import double from "./addons/double.js"; //TODO add systemized plugin support +import insertJSX from "./insertJSX.js"; +import rehypeDocument from "rehype-document"; +import rehypeFormat from "rehype-format"; +import rehypePresetMinify from "rehype-preset-minify"; +import rehypeRaw from "rehype-raw"; +import rehypeStringify from "rehype-stringify"; +import rehypeWrap from "rehype-wrap"; +import remarkParse from "remark-parse"; +import remarkRehype from "remark-rehype"; +import { matter } from "vfile-matter"; +import { read, write } from "to-vfile"; +import { unified } from "unified"; +import { createSiteIndex } from "./createSiteIndex.js"; +import { emptyDir } from "fs-extra"; +import cpy from "cpy"; +import { glob } from "glob"; + +await cpy(["input/**", "!input/**/*{.md,.jsx}"], "out", { flat: true }); //copies all the assets into out/ +emptyDir("out", { recursive: true }); // clears the output folder +const siteIndex = await createSiteIndex(); + +export async function kushiyaki(filepath) { + const file = await read(filepath, "utf-8"); + matter(file, { strip: true }); + file.data.matter.filename = file.stem; + + const processor = unified() + .data("siteIndex", siteIndex) + .use(remarkParse) + .use(double) + .use(remarkRehype, { allowDangerousHtml: true }) + .use(rehypeRaw) + .use(rehypeWrap, { wrapper: "main" }) + .use(insertJSX, file.data.matter) + .use(rehypeDocument, { + css: file.data.matter?.css ?? "style.css", + title: file.data.matter?.title ?? "untitled", + link: [{ href: "favicon.png", rel: "icon", type: "image/png" }], //FIX make filetype-agnostic + }) + // .use(rehypePresetMinify) //NOTE mainly using this for easier tree traversal + .use(rehypeFormat) + .use(rehypeStringify); + + const output = await processor.process(file); + output.extname = ".html"; + output.dirname = "out"; + return output; +} + +for (const file of await glob("input/**/*.md", { nodir: true })) { + await write(await kushiyaki(file)); +} +// console.log(await writePage("./input/content/cookie.md"));
@@ -1,15 +0,0 @@
-import { emptyDir, writeFile } from "fs-extra"; -import cpy from "cpy"; -import { glob } from "glob"; -import { writePage } from "./writePage"; - -//mise en place -emptyDir("out", { recursive: true }); // clears the output folder -await cpy(["input/**", "!input/**/*{.md,.jsx}"], "out", { flat: true }); //copies all the assets into out/ - -for (const file of await glob("input/**/*.md", { nodir: true })) { - await writeFile( - file.replace(/input[\/\w]*\//, "out/").replace(".md", ".html"), - await writePage(file), - ); -}
@@ -10,6 +10,7 @@ "cpy": "^13.2.1",
"express-static": "^1.2.6", "fs-extra": "^11.3.2", "glob": "^13.0.6", + "hast-util-select": "^6.0.4", "hastx": "^0.1.2", "js-yaml": "^4.1.1", "livereload": "^0.10.3",@@ -23,6 +24,7 @@ "rehype-document": "^7.0.3",
"rehype-format": "^5.0.1", "rehype-meta": "^4.0.1", "rehype-parse": "^9.0.1", + "rehype-preset-minify": "^7.0.1", "rehype-raw": "^7.0.0", "rehype-react": "^8.0.0", "rehype-stringify": "^10.0.1",@@ -36,6 +38,9 @@ "sharp": "^0.34.5",
"to-vfile": "^8.0.0", "unified": "^11.0.5", "unist-util-visit": "^5.0.0", + "vfile": "^6.0.3", + "vfile-matter": "^5.0.1", + "vfile-rename": "^3.0.0", "vfile-reporter": "^8.1.1", "vite": "^8.0.10" }
@@ -1,85 +0,0 @@
-const yaml = require("js-yaml"); -import double from "./addons/double.js"; //TODO add systemized plugin support -import rehypeDocument from "rehype-document"; -import rehypeFormat from "rehype-format"; -import rehypeParse from "rehype-parse"; -import rehypeRaw from "rehype-raw"; -import rehypeStringify from "rehype-stringify"; -import rehypeWrap from "rehype-wrap"; -import remarkFrontmatter from "remark-frontmatter"; -import remarkParse from "remark-parse"; -import remarkRehype from "remark-rehype"; -import { readFile } from "fs-extra"; -import { unified } from "unified"; -import insertJSX from "./insertJSX.js"; -import home from "./input/templates/home.jsx"; - -export async function writePage(filepath) { - /* - markdown --> MDAST --> HAST --> html - |-> YAML --> {OBJ} - - - - - -> |-> {OBJ, main:html} - */ - let page; - const processor = await unified() - .use(remarkParse) - .use(remarkFrontmatter, "yaml") - .use(() => (tree) => { - page = yaml.load(tree.children[0].value, { - schema: yaml.FAILSAFE_SCHEMA, - }); - page.filename = filepath.split("/").pop().split(".").shift(); - }) - // .data(page) - .use(double) - .use(remarkRehype, { allowDangerousHtml: true }) - .use(rehypeRaw) - .use(rehypeWrap, { wrapper: "main" }) - /* - * TODO before/after - * TODO pass data - */ - .use(insertJSX, "h2") - .use(rehypeFormat) - .use(rehypeStringify) //HACK should return HAST - .process(await readFile(filepath, "utf-8")); - page.main = processor.value; - return page.main; -} -/* - component maker/joiner - NOTE I could move this into a plugin - */ - -/* - let recipe = ["before", "header", "main", "footer", "after"]; //TODO remove header/footer, accept component arrays - for (let i of [0, 1, 3, 4]) { - if (!Object.keys(page).includes(recipe[i])) { - recipe[i] = null; - } - } - - let union = ""; - for (let i of recipe.filter((x) => !!x)) { - if (i === "main") { - union += page.main; - } else { - const fn = await import(`./input/templates/${page[i]}.jsx`); //FIX avoid strict filestruct past "input" - union += unified().use(rehypeStringify).stringify(fn.default(page)); //FIX use tree-visit - } - } - - const processor2 = unified() //HACK merge trees via unist tree visit - .use(rehypeParse, { fragment: true }) - .use(rehypeDocument, { - css: page.css ?? "style.css", - title: page?.title ?? page?.filename ?? "title", - link: [{ href: "favicon.png", rel: "icon", type: "image/png" }], - }) - .use(rehypeFormat) - .use(rehypeStringify); - - const output = await processor2.process(union); - return output.value; -} -*/ -console.log(await writePage("./input/content/cookie.md"));