{"id":15013653,"url":"https://github.com/billykwok/seihon","last_synced_at":"2026-02-24T09:02:04.460Z","repository":{"id":35547795,"uuid":"218095171","full_name":"billykwok/seihon","owner":"billykwok","description":"The last piece of the puzzle enabling code-splitted CMS-less MDX-based static site generation.","archived":false,"fork":false,"pushed_at":"2023-03-04T05:03:01.000Z","size":2439,"stargazers_count":2,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-02T09:02:57.243Z","etag":null,"topics":["frontmatter","javascript","loader","markdown","mdx","mdx-js","remark-plugin","static-site","unified","webpack"],"latest_commit_sha":null,"homepage":"https://github.com/billykwok/seihon","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/billykwok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"billykwok","tidelift":"npm/seihon"}},"created_at":"2019-10-28T16:29:05.000Z","updated_at":"2024-04-20T18:45:19.000Z","dependencies_parsed_at":"2024-10-14T04:00:56.520Z","dependency_job_id":"f85c6f05-4b65-4114-9532-414b7cddf102","html_url":"https://github.com/billykwok/seihon","commit_stats":{"total_commits":54,"total_committers":3,"mean_commits":18.0,"dds":0.09259259259259256,"last_synced_commit":"fe4bdf014e5c8edbb6b60107f147bff3fe488199"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/billykwok/seihon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billykwok%2Fseihon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billykwok%2Fseihon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billykwok%2Fseihon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billykwok%2Fseihon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/billykwok","download_url":"https://codeload.github.com/billykwok/seihon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/billykwok%2Fseihon/sbom","scorecard":{"id":238224,"data":{"date":"2025-08-11","repo":{"name":"github.com/billykwok/seihon","commit":"fe4bdf014e5c8edbb6b60107f147bff3fe488199"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 16 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"38 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4","Warn: Project is vulnerable to: GHSA-4p35-cfcx-8653","Warn: Project is vulnerable to: GHSA-7f3x-x4pr-wqhj","Warn: Project is vulnerable to: GHSA-jpp7-7chh-cf67","Warn: Project is vulnerable to: GHSA-q6wq-5p59-983w","Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2","Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T06:09:24.167Z","repository_id":35547795,"created_at":"2025-08-17T06:09:24.167Z","updated_at":"2025-08-17T06:09:24.167Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29777607,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T04:54:30.205Z","status":"ssl_error","status_checked_at":"2026-02-24T04:53:58.628Z","response_time":75,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["frontmatter","javascript","loader","markdown","mdx","mdx-js","remark-plugin","static-site","unified","webpack"],"created_at":"2024-09-24T19:44:36.930Z","updated_at":"2026-02-24T09:02:04.391Z","avatar_url":"https://github.com/billykwok.png","language":"TypeScript","funding_links":["https://github.com/sponsors/billykwok","https://tidelift.com/funding/github/npm/seihon"],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"https://raw.githubusercontent.com/billykwok/seihon/master/logo.png\" width=\"240\" alt=\"SEIHON\" /\u003e\n\n[![Babel Macro](https://img.shields.io/badge/babel--macro-%F0%9F%8E%A3-f5da55.svg?style=flat-square)](https://github.com/kentcdodds/babel-plugin-macros)\n[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org)\n[![codecov](https://codecov.io/gh/billykwok/seihon/branch/master/graph/badge.svg)](https://codecov.io/gh/billykwok/seihon)\n[![CircleCI](https://circleci.com/gh/billykwok/seihon/tree/master.svg?style=svg)](https://circleci.com/gh/billykwok/seihon/tree/master)\n\nSeihon【製本】(Bookbinding in Japanese) is a JavaScript toolkit that improves your MDX transformation pipeline. It allows you to quickly transform MDX documents into a collection (like turning codices into book).\n\nMore importantly, this toolkit is the last piece of the puzzle that enables code-splitted CMS-less MDX-based static site generation.\n\nIt currently consists of two libraries.\n\n1. [`@seihon/loader`](https://github.com/billykwok/seihon/tree/master/packages/loader) is a [`webpack`](https://github.com/webpack/webpack) loader that collects [`frontmatter`](https://github.com/jxson/front-matter) from all MDX documents and transforms them into one single object. It allows you to statically generate Table of Content, Blog Directory, Project List, or anything that contains a collection of data derived from [`frontmatter`](https://github.com/jxson/front-matter), without manual maintenance. You can even paginate the result using query parameters.\n\n2. [`@seihon/macro`](https://github.com/billykwok/seihon/tree/master/packages/macro) is a [`babel-macro`](https://github.com/kentcdodds/babel-plugin-macros) that transpiles `collection\u003cItem\u003e('../example.collection.js')` into `require('../example.collection.js')`.\n\n\u003e In most occasions, you need to use this toolkit together with [`webpack`](https://github.com/webpack/webpack), [`@mdx-js/loader`](https://github.com/mdx-js/mdx/tree/master/packages/loader), [`babel-loader`](https://github.com/babel/babel-loader) and [`loadable-components`](https://github.com/smooth-code/loadable-components) in order to build a code-splitted CMS-less MDX-based static site.\n\n## Usage\n\nThis is an example of a complete usage of the Seihon library. For individual usage, please refer to their own README.md.\n\n- [`@seihon/loader`](https://github.com/billykwok/seihon/tree/master/packages/loader)\n- [`@seihon/macro`](https://github.com/billykwok/seihon/tree/master/packages/macro)\n\nAlthough Seihon makes no assumption about your project structure, it's always easier to explain its usage with one. Take the following structure as an example.\n\n```text\nmy-site/\n  src/\n    components/\n      home.jsx\n      post.jsx\n      ...\n    content/\n      posts/\n        introducing-seihon/\n          index.mdx\n          ...\n        effective-javascript/\n          index.mdx\n          ...\n        seihon.config.js\n      projects/\n        ...\n        seihon.config.js\n    ...\n  webpack.config.js\n  ...\n```\n\n```javascript\n// webpack.config.js\n// ...\nmodule: {\n  rules: [\n    {\n      test: /seihon\\.config\\.js$/,\n      use: ['babel-loader', '@seihon/loader'],\n    },\n    // ...\n  ];\n}\n```\n\n```frontmatter\n// src/content/posts/introducing-seihon.mdx\n\n---\ntitle: Introducing Seihon\n---\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n```\n\n```frontmatter\n// src/content/posts/effective-javascript.mdx\n\n---\ntitle: Effective JavaScript\n---\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n```\n\n```javascript\n// src/content/{posts,projects}/seihon.config.js\nmodule.exports = {\n  transform: (frontmatter, text) =\u003e {\n    ...frontmatter,\n    postId: frontmatter.title\n      .replace(/[^0-9a-zA-Z\\s]/gi, '')\n      .replace(/\\s+/gi, '-')\n      .toLowerCase(),\n    minRead: Math.ceil(text.split(' ').length / 200)\n  }\n};\n```\n\n```javascript\n// src/components/home.jsx\nimport React from 'react';\nimport seihon from '@seihon/macro';\n\nconst posts = seihon('../content/posts/seihon.config.js');\n\nexport default function Blog() {\n  return posts.map(({ postId, minRead }) =\u003e (\n    \u003cPostPreview postId={postId} minRead={minRead} /\u003e\n  ));\n}\n```\n\n## Configuration\n\n### Loader Options\n\n`@seihon/loader` takes two options, which control the global behaviors.\n\n```js\n{\n  esModule: true, // boolean - wether to emit the resulting frontmatter array in ES Module syntax\n  parallel: 10 // number - the level of parallelism used when reading frontmatters from markdown files\n}\n```\n\nThe individual `seihon.config.js` determines how a specific collection of frontmatters is loaded. The filename `seihon.config.js` is just a convention. It can be changed to any name as you like.\n\n```js\n{\n  transform: (frontmatter, markdownContent, filePath) =\u003e frontmatter, // function - allow custom transformation of frontmatter\n  sort: (a, b) =\u003e a \u003c b; // function - allow custom sorting of the list of frontmatters\n  serialize: {}, // Record\u003cstring, data =\u003e string\u003e - allow custom serialization of a specific key in the frontmatter\n  hook: code =\u003e code // function - allow custom transformation of the final code right before emitting\n}\n```\n\n## Support\n\nThis library has been continuously used in many of my personal projects, and is regarded as production-ready. In the foreseeable future, I will continuously maintain and support this library.\n\n## Issues and Feedback\n\nPlease voice your opinion and report bugs in the [issues](https://github.com/billykwok/seihon/issues) sections of this GitHub project.\n\n## Contributing\n\nYou are more than welcome to add more functionalities, improve documentation, fix bugs, and anything you think is needed. The build step is pretty self-explanatory. Please refer to [CONTRIBUTING.md](https://github.com/billykwok/seihon/blob/master/CONTRIBUTING.md) for more details.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillykwok%2Fseihon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbillykwok%2Fseihon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillykwok%2Fseihon/lists"}