@limetech/kompendium 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +313 -0
- package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +13 -0
- package/dist/cjs/_commonjsHelpers-BJu3ubxk.js.map +1 -0
- package/dist/cjs/anchor-scroll-BmplAyR0.js +69 -0
- package/dist/cjs/anchor-scroll-BmplAyR0.js.map +1 -0
- package/dist/cjs/index-DYiJ6dQL.js +1866 -0
- package/dist/cjs/index-DYiJ6dQL.js.map +1 -0
- package/dist/cjs/index.cjs.js +3 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/kompendium-app.kompendium-darkmode-switch.kompendium-navigation.kompendium-search.stencil-route.stencil-route-switch.stencil-router.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-app_7.cjs.entry.js +2924 -0
- package/dist/cjs/kompendium-code.cjs.entry.js +2724 -0
- package/dist/cjs/kompendium-code.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-component.cjs.entry.js +207 -0
- package/dist/cjs/kompendium-component.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-debug.cjs.entry.js +47 -0
- package/dist/cjs/kompendium-debug.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-example-code.cjs.entry.js +20 -0
- package/dist/cjs/kompendium-example-code.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-example-markdown.cjs.entry.js +165 -0
- package/dist/cjs/kompendium-example-markdown.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-guide.cjs.entry.js +33 -0
- package/dist/cjs/kompendium-guide.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-markdown.cjs.entry.js +48923 -0
- package/dist/cjs/kompendium-markdown.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-playground.cjs.entry.js +89 -0
- package/dist/cjs/kompendium-playground.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-proplist.kompendium-taglist.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium-proplist_2.cjs.entry.js +49 -0
- package/dist/cjs/kompendium-type.cjs.entry.js +83 -0
- package/dist/cjs/kompendium-type.entry.cjs.js.map +1 -0
- package/dist/cjs/kompendium.cjs.js +25 -0
- package/dist/cjs/kompendium.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/markdown-types-B884tLd-.js +15 -0
- package/dist/cjs/markdown-types-B884tLd-.js.map +1 -0
- package/dist/cjs/methods-DoA78dOH.js +97 -0
- package/dist/cjs/methods-DoA78dOH.js.map +1 -0
- package/dist/cjs/types-SjA7Kcy_.js +8 -0
- package/dist/cjs/types-SjA7Kcy_.js.map +1 -0
- package/dist/collection/assets/favicon.svg +65 -0
- package/dist/collection/assets/icons/bookmark-fill.svg +1 -0
- package/dist/collection/assets/icons/danger.svg +1 -0
- package/dist/collection/assets/icons/debug.svg +1 -0
- package/dist/collection/assets/icons/important.svg +1 -0
- package/dist/collection/assets/icons/info.svg +1 -0
- package/dist/collection/assets/icons/logo.svg +1 -0
- package/dist/collection/assets/icons/note.svg +1 -0
- package/dist/collection/assets/icons/search.svg +1 -0
- package/dist/collection/assets/icons/tip.svg +1 -0
- package/dist/collection/assets/icons/warning.svg +1 -0
- package/dist/collection/assets/logotype.svg +64 -0
- package/dist/collection/collection-manifest.json +35 -0
- package/dist/collection/components/anchor-scroll.js +61 -0
- package/dist/collection/components/anchor-scroll.js.map +1 -0
- package/dist/collection/components/app/app.css +125 -0
- package/dist/collection/components/app/app.js +149 -0
- package/dist/collection/components/app/app.js.map +1 -0
- package/dist/collection/components/code/code.css +250 -0
- package/dist/collection/components/code/code.js +82 -0
- package/dist/collection/components/code/code.js.map +1 -0
- package/dist/collection/components/code/examples/code.js +14 -0
- package/dist/collection/components/code/examples/code.js.map +1 -0
- package/dist/collection/components/component/component.css +383 -0
- package/dist/collection/components/component/component.js +191 -0
- package/dist/collection/components/component/component.js.map +1 -0
- package/dist/collection/components/component/templates/events.js +32 -0
- package/dist/collection/components/component/templates/events.js.map +1 -0
- package/dist/collection/components/component/templates/examples.js +17 -0
- package/dist/collection/components/component/templates/examples.js.map +1 -0
- package/dist/collection/components/component/templates/methods.js +54 -0
- package/dist/collection/components/component/templates/methods.js.map +1 -0
- package/dist/collection/components/component/templates/props.js +36 -0
- package/dist/collection/components/component/templates/props.js.map +1 -0
- package/dist/collection/components/component/templates/slots.js +14 -0
- package/dist/collection/components/component/templates/slots.js.map +1 -0
- package/dist/collection/components/component/templates/style.js +14 -0
- package/dist/collection/components/component/templates/style.js.map +1 -0
- package/dist/collection/components/darkmode-switch/darkmode-switch.css +141 -0
- package/dist/collection/components/darkmode-switch/darkmode-switch.js +90 -0
- package/dist/collection/components/darkmode-switch/darkmode-switch.js.map +1 -0
- package/dist/collection/components/darkmode-switch/types.js +2 -0
- package/dist/collection/components/darkmode-switch/types.js.map +1 -0
- package/dist/collection/components/debug/debug.js +146 -0
- package/dist/collection/components/debug/debug.js.map +1 -0
- package/dist/collection/components/guide/guide.js +61 -0
- package/dist/collection/components/guide/guide.js.map +1 -0
- package/dist/collection/components/markdown/examples/markdown-example.js +150 -0
- package/dist/collection/components/markdown/examples/markdown-example.js.map +1 -0
- package/dist/collection/components/markdown/examples/markdown.js +14 -0
- package/dist/collection/components/markdown/examples/markdown.js.map +1 -0
- package/dist/collection/components/markdown/markdown-types.js +8 -0
- package/dist/collection/components/markdown/markdown-types.js.map +1 -0
- package/dist/collection/components/markdown/markdown.css +660 -0
- package/dist/collection/components/markdown/markdown.js +83 -0
- package/dist/collection/components/markdown/markdown.js.map +1 -0
- package/dist/collection/components/navigation/navigation.css +403 -0
- package/dist/collection/components/navigation/navigation.js +184 -0
- package/dist/collection/components/navigation/navigation.js.map +1 -0
- package/dist/collection/components/playground/playground.css +198 -0
- package/dist/collection/components/playground/playground.js +174 -0
- package/dist/collection/components/playground/playground.js.map +1 -0
- package/dist/collection/components/playground/playground.types.js +2 -0
- package/dist/collection/components/playground/playground.types.js.map +1 -0
- package/dist/collection/components/proplist/proplist.css +334 -0
- package/dist/collection/components/proplist/proplist.js +53 -0
- package/dist/collection/components/proplist/proplist.js.map +1 -0
- package/dist/collection/components/search/search.css +183 -0
- package/dist/collection/components/search/search.js +76 -0
- package/dist/collection/components/search/search.js.map +1 -0
- package/dist/collection/components/taglist/taglist.css +58 -0
- package/dist/collection/components/taglist/taglist.js +82 -0
- package/dist/collection/components/taglist/taglist.js.map +1 -0
- package/dist/collection/components/type/templates/alias.js +11 -0
- package/dist/collection/components/type/templates/alias.js.map +1 -0
- package/dist/collection/components/type/templates/enum.js +25 -0
- package/dist/collection/components/type/templates/enum.js.map +1 -0
- package/dist/collection/components/type/templates/interface.js +13 -0
- package/dist/collection/components/type/templates/interface.js.map +1 -0
- package/dist/collection/components/type/type.js +97 -0
- package/dist/collection/components/type/type.js.map +1 -0
- package/dist/collection/index.js +4 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/kompendium/config.js +7 -0
- package/dist/collection/kompendium/config.js.map +1 -0
- package/dist/collection/kompendium/filesystem.js +9 -0
- package/dist/collection/kompendium/filesystem.js.map +1 -0
- package/dist/collection/kompendium/generator.js +217 -0
- package/dist/collection/kompendium/generator.js.map +1 -0
- package/dist/collection/kompendium/guides.js +30 -0
- package/dist/collection/kompendium/guides.js.map +1 -0
- package/dist/collection/kompendium/index.js +2 -0
- package/dist/collection/kompendium/index.js.map +1 -0
- package/dist/collection/kompendium/markdown-admonitions.js +82 -0
- package/dist/collection/kompendium/markdown-admonitions.js.map +1 -0
- package/dist/collection/kompendium/markdown-code.js +40 -0
- package/dist/collection/kompendium/markdown-code.js.map +1 -0
- package/dist/collection/kompendium/markdown-frontmatter.js +12 -0
- package/dist/collection/kompendium/markdown-frontmatter.js.map +1 -0
- package/dist/collection/kompendium/markdown-nodes.js +10 -0
- package/dist/collection/kompendium/markdown-nodes.js.map +1 -0
- package/dist/collection/kompendium/markdown-typelinks.js +115 -0
- package/dist/collection/kompendium/markdown-typelinks.js.map +1 -0
- package/dist/collection/kompendium/markdown.js +35 -0
- package/dist/collection/kompendium/markdown.js.map +1 -0
- package/dist/collection/kompendium/menu.js +149 -0
- package/dist/collection/kompendium/menu.js.map +1 -0
- package/dist/collection/kompendium/schema.js +167 -0
- package/dist/collection/kompendium/schema.js.map +1 -0
- package/dist/collection/kompendium/search.js +144 -0
- package/dist/collection/kompendium/search.js.map +1 -0
- package/dist/collection/kompendium/source.js +81 -0
- package/dist/collection/kompendium/source.js.map +1 -0
- package/dist/collection/kompendium/test/fixtures/basic.js +48 -0
- package/dist/collection/kompendium/test/fixtures/basic.js.map +1 -0
- package/dist/collection/kompendium/test/fixtures/filtering/example-type.js +2 -0
- package/dist/collection/kompendium/test/fixtures/filtering/example-type.js.map +1 -0
- package/dist/collection/kompendium/test/fixtures/filtering/node-modules-type.js +2 -0
- package/dist/collection/kompendium/test/fixtures/filtering/node-modules-type.js.map +1 -0
- package/dist/collection/kompendium/test/fixtures/filtering/private-types.js +2 -0
- package/dist/collection/kompendium/test/fixtures/filtering/private-types.js.map +1 -0
- package/dist/collection/kompendium/test/fixtures/filtering/stencil-component-types.js +2 -0
- package/dist/collection/kompendium/test/fixtures/filtering/stencil-component-types.js.map +1 -0
- package/dist/collection/kompendium/test/fixtures/filtering/test-helper-type.js +2 -0
- package/dist/collection/kompendium/test/fixtures/filtering/test-helper-type.js.map +1 -0
- package/dist/collection/kompendium/test/fixtures/filtering/valid-types.js +29 -0
- package/dist/collection/kompendium/test/fixtures/filtering/valid-types.js.map +1 -0
- package/dist/collection/kompendium/typedoc.js +481 -0
- package/dist/collection/kompendium/typedoc.js.map +1 -0
- package/dist/collection/kompendium/watch.js +9 -0
- package/dist/collection/kompendium/watch.js.map +1 -0
- package/dist/collection/types.js +2 -0
- package/dist/collection/types.js.map +1 -0
- package/dist/config.ts +8 -0
- package/dist/esm/_commonjsHelpers-BFTU3MAI.js +10 -0
- package/dist/esm/_commonjsHelpers-BFTU3MAI.js.map +1 -0
- package/dist/esm/anchor-scroll-BAGXN2n6.js +65 -0
- package/dist/esm/anchor-scroll-BAGXN2n6.js.map +1 -0
- package/dist/esm/index-9UrzenzW.js +1857 -0
- package/dist/esm/index-9UrzenzW.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/kompendium-app.kompendium-darkmode-switch.kompendium-navigation.kompendium-search.stencil-route.stencil-route-switch.stencil-router.entry.js.map +1 -0
- package/dist/esm/kompendium-app_7.entry.js +2916 -0
- package/dist/esm/kompendium-code.entry.js +2722 -0
- package/dist/esm/kompendium-code.entry.js.map +1 -0
- package/dist/esm/kompendium-component.entry.js +205 -0
- package/dist/esm/kompendium-component.entry.js.map +1 -0
- package/dist/esm/kompendium-debug.entry.js +45 -0
- package/dist/esm/kompendium-debug.entry.js.map +1 -0
- package/dist/esm/kompendium-example-code.entry.js +18 -0
- package/dist/esm/kompendium-example-code.entry.js.map +1 -0
- package/dist/esm/kompendium-example-markdown.entry.js +163 -0
- package/dist/esm/kompendium-example-markdown.entry.js.map +1 -0
- package/dist/esm/kompendium-guide.entry.js +31 -0
- package/dist/esm/kompendium-guide.entry.js.map +1 -0
- package/dist/esm/kompendium-markdown.entry.js +48921 -0
- package/dist/esm/kompendium-markdown.entry.js.map +1 -0
- package/dist/esm/kompendium-playground.entry.js +87 -0
- package/dist/esm/kompendium-playground.entry.js.map +1 -0
- package/dist/esm/kompendium-proplist.kompendium-taglist.entry.js.map +1 -0
- package/dist/esm/kompendium-proplist_2.entry.js +46 -0
- package/dist/esm/kompendium-type.entry.js +81 -0
- package/dist/esm/kompendium-type.entry.js.map +1 -0
- package/dist/esm/kompendium.js +21 -0
- package/dist/esm/kompendium.js.map +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/markdown-types-Ajsawr_9.js +12 -0
- package/dist/esm/markdown-types-Ajsawr_9.js.map +1 -0
- package/dist/esm/methods-BAjd6f7g.js +94 -0
- package/dist/esm/methods-BAjd6f7g.js.map +1 -0
- package/dist/esm/types-BIPLEi1G.js +6 -0
- package/dist/esm/types-BIPLEi1G.js.map +1 -0
- package/dist/filesystem.ts +9 -0
- package/dist/generator.ts +302 -0
- package/dist/guides.ts +49 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/index.ts +1 -0
- package/dist/kompendium/index.esm.js +2 -0
- package/dist/kompendium/index.esm.js.map +1 -0
- package/dist/kompendium/kompendium-app.kompendium-darkmode-switch.kompendium-navigation.kompendium-search.stencil-route.stencil-route-switch.stencil-router.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-code.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-component.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-debug.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-example-code.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-example-markdown.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-guide.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-markdown.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-playground.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-proplist.kompendium-taglist.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium-type.entry.esm.js.map +1 -0
- package/dist/kompendium/kompendium.css +47 -0
- package/dist/kompendium/kompendium.esm.js +2 -0
- package/dist/kompendium/kompendium.esm.js.map +1 -0
- package/dist/kompendium/loader.esm.js.map +1 -0
- package/dist/kompendium/p-15e4b2c0.entry.js +2 -0
- package/dist/kompendium/p-15e4b2c0.entry.js.map +1 -0
- package/dist/kompendium/p-1cf0168f.entry.js +2 -0
- package/dist/kompendium/p-1cf0168f.entry.js.map +1 -0
- package/dist/kompendium/p-29c23c89.entry.js +2 -0
- package/dist/kompendium/p-29c23c89.entry.js.map +1 -0
- package/dist/kompendium/p-3981d11f.entry.js +2 -0
- package/dist/kompendium/p-3981d11f.entry.js.map +1 -0
- package/dist/kompendium/p-93f0548d.entry.js +2 -0
- package/dist/kompendium/p-93f0548d.entry.js.map +1 -0
- package/dist/kompendium/p-97b02575.entry.js +2 -0
- package/dist/kompendium/p-97b02575.entry.js.map +1 -0
- package/dist/kompendium/p-9UrzenzW.js +3 -0
- package/dist/kompendium/p-9UrzenzW.js.map +1 -0
- package/dist/kompendium/p-Ajsawr_9.js +2 -0
- package/dist/kompendium/p-Ajsawr_9.js.map +1 -0
- package/dist/kompendium/p-BAGXN2n6.js +2 -0
- package/dist/kompendium/p-BAGXN2n6.js.map +1 -0
- package/dist/kompendium/p-BFTU3MAI.js +2 -0
- package/dist/kompendium/p-BFTU3MAI.js.map +1 -0
- package/dist/kompendium/p-BIPLEi1G.js +2 -0
- package/dist/kompendium/p-BIPLEi1G.js.map +1 -0
- package/dist/kompendium/p-CnQEA7KO.js +2 -0
- package/dist/kompendium/p-CnQEA7KO.js.map +1 -0
- package/dist/kompendium/p-b0f95bd6.entry.js +2 -0
- package/dist/kompendium/p-b0f95bd6.entry.js.map +1 -0
- package/dist/kompendium/p-d9bcc473.entry.js +10 -0
- package/dist/kompendium/p-d9bcc473.entry.js.map +1 -0
- package/dist/kompendium/p-e36f3f1e.entry.js +2 -0
- package/dist/kompendium/p-e36f3f1e.entry.js.map +1 -0
- package/dist/kompendium/p-e52a2f57.entry.js +2 -0
- package/dist/kompendium/p-e52a2f57.entry.js.map +1 -0
- package/dist/kompendium/p-ec5861de.entry.js +2 -0
- package/dist/kompendium/p-ec5861de.entry.js.map +1 -0
- package/dist/markdown-admonitions.ts +112 -0
- package/dist/markdown-code.ts +51 -0
- package/dist/markdown-frontmatter.ts +19 -0
- package/dist/markdown-nodes.ts +23 -0
- package/dist/markdown-typelinks.ts +166 -0
- package/dist/markdown.ts +49 -0
- package/dist/menu.ts +189 -0
- package/dist/schema.ts +233 -0
- package/dist/search.ts +197 -0
- package/dist/source.ts +129 -0
- package/dist/typedoc.ts +665 -0
- package/dist/types/components/anchor-scroll.d.ts +36 -0
- package/dist/types/components/app/app.d.ts +22 -0
- package/dist/types/components/code/code.d.ts +26 -0
- package/dist/types/components/code/examples/code.d.ts +3 -0
- package/dist/types/components/component/component.d.ts +32 -0
- package/dist/types/components/component/templates/events.d.ts +5 -0
- package/dist/types/components/component/templates/examples.d.ts +9 -0
- package/dist/types/components/component/templates/methods.d.ts +5 -0
- package/dist/types/components/component/templates/props.d.ts +5 -0
- package/dist/types/components/component/templates/slots.d.ts +5 -0
- package/dist/types/components/component/templates/style.d.ts +5 -0
- package/dist/types/components/darkmode-switch/darkmode-switch.d.ts +18 -0
- package/dist/types/components/darkmode-switch/types.d.ts +2 -0
- package/dist/types/components/debug/debug.d.ts +24 -0
- package/dist/types/components/guide/guide.d.ts +14 -0
- package/dist/types/components/markdown/examples/markdown-example.d.ts +1 -0
- package/dist/types/components/markdown/examples/markdown.d.ts +7 -0
- package/dist/types/components/markdown/markdown-types.d.ts +2 -0
- package/dist/types/components/markdown/markdown.d.ts +20 -0
- package/dist/types/components/navigation/navigation.d.ts +35 -0
- package/dist/types/components/playground/playground.d.ts +32 -0
- package/dist/types/components/playground/playground.types.d.ts +1 -0
- package/dist/types/components/proplist/proplist.d.ts +12 -0
- package/dist/types/components/search/search.d.ts +15 -0
- package/dist/types/components/taglist/taglist.d.ts +16 -0
- package/dist/types/components/type/templates/alias.d.ts +4 -0
- package/dist/types/components/type/templates/enum.d.ts +4 -0
- package/dist/types/components/type/templates/interface.d.ts +4 -0
- package/dist/types/components/type/type.d.ts +15 -0
- package/dist/types/components.d.ts +517 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/kompendium/config.d.ts +2 -0
- package/dist/types/kompendium/filesystem.d.ts +1 -0
- package/dist/types/kompendium/generator.d.ts +4 -0
- package/dist/types/kompendium/guides.d.ts +9 -0
- package/dist/types/kompendium/index.d.ts +1 -0
- package/dist/types/kompendium/markdown-admonitions.d.ts +3 -0
- package/dist/types/kompendium/markdown-code.d.ts +2 -0
- package/dist/types/kompendium/markdown-frontmatter.d.ts +6 -0
- package/dist/types/kompendium/markdown-nodes.d.ts +12 -0
- package/dist/types/kompendium/markdown-typelinks.d.ts +21 -0
- package/dist/types/kompendium/markdown.d.ts +8 -0
- package/dist/types/kompendium/menu.d.ts +12 -0
- package/dist/types/kompendium/schema.d.ts +9 -0
- package/dist/types/kompendium/search.d.ts +3 -0
- package/dist/types/kompendium/source.d.ts +10 -0
- package/dist/types/kompendium/test/fixtures/basic.d.ts +65 -0
- package/dist/types/kompendium/test/fixtures/filtering/example-type.d.ts +8 -0
- package/dist/types/kompendium/test/fixtures/filtering/node-modules-type.d.ts +8 -0
- package/dist/types/kompendium/test/fixtures/filtering/private-types.d.ts +23 -0
- package/dist/types/kompendium/test/fixtures/filtering/stencil-component-types.d.ts +19 -0
- package/dist/types/kompendium/test/fixtures/filtering/test-helper-type.d.ts +8 -0
- package/dist/types/kompendium/test/fixtures/filtering/valid-types.d.ts +42 -0
- package/dist/types/kompendium/typedoc.d.ts +2 -0
- package/dist/types/kompendium/watch.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1746 -0
- package/dist/types/types.d.ts +119 -0
- package/dist/watch.ts +14 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +116 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { JsonDocs, Config, Logger } from '@stencil/core/internal';
|
|
2
|
+
import { defaultConfig } from './config';
|
|
3
|
+
import { addSources } from './source';
|
|
4
|
+
import lnk from 'lnk';
|
|
5
|
+
import { createMenu } from './menu';
|
|
6
|
+
import { copyFile, mkdir, readFile, stat, writeFile } from 'fs/promises';
|
|
7
|
+
import { exists } from './filesystem';
|
|
8
|
+
import { createWatcher } from './watch';
|
|
9
|
+
import { findGuides } from './guides';
|
|
10
|
+
import { KompendiumConfig, KompendiumData, TypeDescription } from '../types';
|
|
11
|
+
import { parseFile } from './typedoc';
|
|
12
|
+
import { createSchemas } from './schema';
|
|
13
|
+
import { createIndex } from './search';
|
|
14
|
+
|
|
15
|
+
export const kompendium = (config: Partial<KompendiumConfig> = {}) => {
|
|
16
|
+
if (!generateDocs()) {
|
|
17
|
+
return () => null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return kompendiumGenerator(config);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let logger: Logger;
|
|
24
|
+
|
|
25
|
+
export function kompendiumGenerator(
|
|
26
|
+
config: Partial<KompendiumConfig>,
|
|
27
|
+
): (docs: JsonDocs, stencilConfig: Config) => Promise<void> {
|
|
28
|
+
config = {
|
|
29
|
+
...defaultConfig,
|
|
30
|
+
...config,
|
|
31
|
+
};
|
|
32
|
+
initialize(config);
|
|
33
|
+
|
|
34
|
+
return async (docs: JsonDocs, stencilConfig: Config) => {
|
|
35
|
+
logger = stencilConfig.logger;
|
|
36
|
+
const timeSpan = logger.createTimeSpan('kompendium started');
|
|
37
|
+
|
|
38
|
+
const [jsonDocs, title, readme, guides, types] = await Promise.all([
|
|
39
|
+
addSources(docs),
|
|
40
|
+
getProjectTitle(config),
|
|
41
|
+
getReadme(),
|
|
42
|
+
findGuides(config),
|
|
43
|
+
getTypes(config, stencilConfig.tsconfig),
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const data: KompendiumData = {
|
|
47
|
+
docs: jsonDocs,
|
|
48
|
+
title: title,
|
|
49
|
+
logo: config.logo,
|
|
50
|
+
menu: createMenu(docs, guides, types),
|
|
51
|
+
readme: readme,
|
|
52
|
+
guides: guides,
|
|
53
|
+
types: types,
|
|
54
|
+
schemas: createSchemas(docs.components, types),
|
|
55
|
+
index: null,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
data.index = createIndex(data);
|
|
59
|
+
|
|
60
|
+
await writeData(config, data);
|
|
61
|
+
|
|
62
|
+
timeSpan.finish('kompendium finished');
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function initialize(config: Partial<KompendiumConfig>) {
|
|
67
|
+
const path = `${config.publicPath}/kompendium.json`;
|
|
68
|
+
|
|
69
|
+
if (isWatcher()) {
|
|
70
|
+
createWatcher(path, 'unlink', onUnlink(config));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
await createOutputDirs(config);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const onUnlink = (config: Partial<KompendiumConfig>) => () => {
|
|
77
|
+
createSymlink(config);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
async function createSymlink(config: Partial<KompendiumConfig>) {
|
|
81
|
+
const source = `${config.path}/kompendium.json`;
|
|
82
|
+
const target = `${config.publicPath}/kompendium.json`;
|
|
83
|
+
|
|
84
|
+
if (!(await exists(source))) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (await exists(target)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
lnk([source], config.publicPath);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async function getProjectTitle(
|
|
96
|
+
config: Partial<KompendiumConfig>,
|
|
97
|
+
): Promise<string> {
|
|
98
|
+
if (config.title) {
|
|
99
|
+
return config.title;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const json = await readFile('./package.json', 'utf8');
|
|
103
|
+
const data = JSON.parse(json);
|
|
104
|
+
|
|
105
|
+
return data.name
|
|
106
|
+
.replace(/^@[^/]+?\//, '')
|
|
107
|
+
.split('-')
|
|
108
|
+
.join(' ');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function writeData(
|
|
112
|
+
config: Partial<KompendiumConfig>,
|
|
113
|
+
data: KompendiumData,
|
|
114
|
+
) {
|
|
115
|
+
// Always write to the kompendium config folder (typically `.kompendium` in
|
|
116
|
+
// the root of the project) to avoid Stencil deleting the file during build.
|
|
117
|
+
const filePath = `${config.path}/kompendium.json`;
|
|
118
|
+
|
|
119
|
+
await writeFile(filePath, JSON.stringify(data), 'utf8');
|
|
120
|
+
|
|
121
|
+
if (isProd()) {
|
|
122
|
+
// In production, we used to write the kompendium.json file to the
|
|
123
|
+
// public path. We now copy the file to the public path for backwards
|
|
124
|
+
// compatibility with projects that do not have problems with Stencil
|
|
125
|
+
// deleting the file during build. For projects that do have this
|
|
126
|
+
// problem, they can always copy the file from the config folder.
|
|
127
|
+
const publicFilePath = `${config.publicPath}/kompendium.json`;
|
|
128
|
+
if (!(await exists(config.publicPath))) {
|
|
129
|
+
await mkdir(config.publicPath, { recursive: true });
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
await copyFile(filePath, publicFilePath);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (isWatcher()) {
|
|
136
|
+
createSymlink(config);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function createOutputDirs(config: Partial<KompendiumConfig>) {
|
|
141
|
+
let path = config.path;
|
|
142
|
+
if (!(await exists(path))) {
|
|
143
|
+
mkdir(path, { recursive: true });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
path = config.publicPath;
|
|
147
|
+
if (!(await exists(path))) {
|
|
148
|
+
mkdir(path, { recursive: true });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async function getReadme(): Promise<string> {
|
|
153
|
+
const files = ['readme.md', 'README.md', 'README', 'readme'];
|
|
154
|
+
let data = null;
|
|
155
|
+
|
|
156
|
+
for (const file of files) {
|
|
157
|
+
if (data) {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (!(await exists(file))) {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
data = await readFile(file, 'utf8');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!data) {
|
|
169
|
+
logger.warn('README did not exist');
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return data;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function generateDocs(): boolean {
|
|
176
|
+
return !!process.argv.includes('--docs');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function isWatcher(): boolean {
|
|
180
|
+
return !!process.argv.includes('--watch');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function isProd(): boolean {
|
|
184
|
+
return !(
|
|
185
|
+
process.argv.includes('--dev') ||
|
|
186
|
+
process.argv.includes('test') ||
|
|
187
|
+
process.argv.find((arg) => arg.includes('jest-worker'))
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function getTypes(
|
|
192
|
+
config: Partial<KompendiumConfig>,
|
|
193
|
+
tsconfig?: string,
|
|
194
|
+
): Promise<TypeDescription[]> {
|
|
195
|
+
logger.debug('Getting type information...');
|
|
196
|
+
let types = await readTypes(config);
|
|
197
|
+
const cache = await readCache(config);
|
|
198
|
+
|
|
199
|
+
if (types.length === 0 || (await isModified(types, cache))) {
|
|
200
|
+
logger.debug('Parsing types...');
|
|
201
|
+
const data = parseFile(config.typeRoot, tsconfig);
|
|
202
|
+
await saveData(config, data);
|
|
203
|
+
types = data;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return types;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function isModified(types: any[], cache: Record<string, number>) {
|
|
210
|
+
if (Object.keys(cache).length === 0) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const filenames = getUniqueSourceFilenames(types);
|
|
215
|
+
const stats = await Promise.all(filenames.map(tryStatFile));
|
|
216
|
+
|
|
217
|
+
return stats.some((fileStat, index) =>
|
|
218
|
+
hasFileChangedSinceCached(filenames[index], fileStat, cache),
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function getUniqueSourceFilenames(types: any[]): string[] {
|
|
223
|
+
const filenames = types.map((t) => t.sources).flat();
|
|
224
|
+
|
|
225
|
+
return [...new Set(filenames)];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function tryStatFile(filename: string) {
|
|
229
|
+
return stat(filename).catch(() => null);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function hasFileChangedSinceCached(
|
|
233
|
+
filename: string,
|
|
234
|
+
fileStat: Awaited<ReturnType<typeof stat>> | null,
|
|
235
|
+
cache: Record<string, number>,
|
|
236
|
+
): boolean {
|
|
237
|
+
if (!fileStat) {
|
|
238
|
+
logger.debug(`${filename} cannot be accessed, marking as modified`);
|
|
239
|
+
|
|
240
|
+
return true;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const result = cache[filename] !== fileStat.mtimeMs;
|
|
244
|
+
|
|
245
|
+
logger.debug(`${filename} was ${result ? '' : 'not'} modified!`);
|
|
246
|
+
|
|
247
|
+
return result;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async function saveData(
|
|
251
|
+
config: Partial<KompendiumConfig>,
|
|
252
|
+
types: TypeDescription[],
|
|
253
|
+
) {
|
|
254
|
+
const filenames = getUniqueSourceFilenames(types);
|
|
255
|
+
const stats = await Promise.all(filenames.map(tryStatFile));
|
|
256
|
+
const cache = buildCacheFromFileStats(filenames, stats);
|
|
257
|
+
|
|
258
|
+
await Promise.all([writeCache(config, cache), writeTypes(config, types)]);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function buildCacheFromFileStats(
|
|
262
|
+
filenames: string[],
|
|
263
|
+
stats: Array<Awaited<ReturnType<typeof stat>> | null>,
|
|
264
|
+
): Record<string, number> {
|
|
265
|
+
const cache: Record<string, number> = {};
|
|
266
|
+
|
|
267
|
+
stats.forEach((fileStat, index) => {
|
|
268
|
+
if (fileStat) {
|
|
269
|
+
cache[filenames[index]] = fileStat.mtimeMs;
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
return cache;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
async function readCache(config: Partial<KompendiumConfig>) {
|
|
277
|
+
try {
|
|
278
|
+
const data = await readFile(`${config.path}/cache.json`, 'utf8');
|
|
279
|
+
|
|
280
|
+
return JSON.parse(data);
|
|
281
|
+
} catch {
|
|
282
|
+
return {};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
async function writeCache(config: Partial<KompendiumConfig>, data: any) {
|
|
287
|
+
await writeFile(`${config.path}/cache.json`, JSON.stringify(data), 'utf8');
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
async function readTypes(config: Partial<KompendiumConfig>) {
|
|
291
|
+
try {
|
|
292
|
+
const data = await readFile(`${config.path}/types.json`, 'utf8');
|
|
293
|
+
|
|
294
|
+
return JSON.parse(data);
|
|
295
|
+
} catch {
|
|
296
|
+
return [];
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
async function writeTypes(config: Partial<KompendiumConfig>, data: any) {
|
|
301
|
+
await writeFile(`${config.path}/types.json`, JSON.stringify(data), 'utf8');
|
|
302
|
+
}
|
package/dist/guides.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { basename, dirname, resolve } from 'path';
|
|
2
|
+
import { readFile } from 'fs/promises';
|
|
3
|
+
import { KompendiumGuide, KompendiumConfig, Guide } from '../types';
|
|
4
|
+
|
|
5
|
+
export async function findGuides(
|
|
6
|
+
config: Partial<KompendiumConfig>,
|
|
7
|
+
): Promise<KompendiumGuide[]> {
|
|
8
|
+
const nodes = config.guides.map(createMenuNode('/')).flat();
|
|
9
|
+
const promises = nodes.map(createGuide);
|
|
10
|
+
|
|
11
|
+
return Promise.all(promises);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface MenuNode {
|
|
15
|
+
menupath: string;
|
|
16
|
+
filepath: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const createMenuNode =
|
|
20
|
+
(path: string) =>
|
|
21
|
+
(guide: Guide): MenuNode | MenuNode[] => {
|
|
22
|
+
if (typeof guide !== 'string') {
|
|
23
|
+
const newPath = path + guide.name + '/';
|
|
24
|
+
|
|
25
|
+
return guide.children.map(createMenuNode(newPath)).flat();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
menupath: path,
|
|
30
|
+
filepath: guide,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const createGuide = async ({
|
|
35
|
+
menupath: path,
|
|
36
|
+
filepath,
|
|
37
|
+
}: MenuNode): Promise<KompendiumGuide> => {
|
|
38
|
+
const content = await readFile(filepath, 'utf8');
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
dirPath: dirname(filepath),
|
|
42
|
+
fileName: basename(filepath),
|
|
43
|
+
filePath: resolve(filepath),
|
|
44
|
+
data: {
|
|
45
|
+
path: path + basename(filepath),
|
|
46
|
+
},
|
|
47
|
+
content: content,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./cjs/index.cjs.js');
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './esm/index.js';
|
package/dist/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { kompendium } from './generator';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|