robindoc 3.2.1 → 3.3.0
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 +1 -1
- package/README.md +1 -1
- package/lib/components/blocks/anchor-heading/index.js.map +1 -1
- package/lib/components/blocks/breadcrumbs/index.js +1 -1
- package/lib/components/blocks/breadcrumbs/index.js.map +1 -1
- package/lib/components/blocks/code-section/index.js.map +1 -1
- package/lib/components/blocks/contents/index.js +1 -1
- package/lib/components/blocks/contents/index.js.map +1 -1
- package/lib/components/blocks/header-menu/index.js +1 -1
- package/lib/components/blocks/header-menu/index.js.map +1 -1
- package/lib/components/blocks/header-social/index.js +1 -1
- package/lib/components/blocks/header-social/index.js.map +1 -1
- package/lib/components/blocks/last-modified/index.js +1 -1
- package/lib/components/blocks/last-modified/index.js.map +1 -1
- package/lib/components/blocks/nav-content-link/index.js +1 -1
- package/lib/components/blocks/nav-content-link/index.js.map +1 -1
- package/lib/components/blocks/nav-link/index.d.ts +5 -18
- package/lib/components/blocks/nav-link/index.d.ts.map +1 -1
- package/lib/components/blocks/nav-link/index.js +1 -1
- package/lib/components/blocks/nav-link/index.js.map +1 -1
- package/lib/components/blocks/no-js/index.js.map +1 -1
- package/lib/components/blocks/pagination/index.js.map +1 -1
- package/lib/components/blocks/search/index.js +1 -1
- package/lib/components/blocks/search/index.js.map +1 -1
- package/lib/components/blocks/search/search-modal/index.js +1 -1
- package/lib/components/blocks/search/search-modal/index.js.map +1 -1
- package/lib/components/blocks/section-dropdown/index.js +1 -1
- package/lib/components/blocks/section-dropdown/index.js.map +1 -1
- package/lib/components/blocks/theme-detector/index.js +1 -1
- package/lib/components/blocks/theme-detector/index.js.map +1 -1
- package/lib/components/blocks/theme-styles/index.js +1 -1
- package/lib/components/blocks/theme-styles/index.js.map +1 -1
- package/lib/components/blocks/theme-switcher/index.js.map +1 -1
- package/lib/components/contexts/contents/context.d.ts +0 -1
- package/lib/components/contexts/contents/context.d.ts.map +1 -1
- package/lib/components/contexts/contents/context.js.map +1 -1
- package/lib/components/contexts/contents/provider.js +1 -1
- package/lib/components/contexts/contents/provider.js.map +1 -1
- package/lib/components/contexts/contents/use-heading-index.js.map +1 -1
- package/lib/components/contexts/contents/use-heading-register.js +1 -1
- package/lib/components/contexts/contents/use-heading-register.js.map +1 -1
- package/lib/components/contexts/navigate/context.d.ts +0 -1
- package/lib/components/contexts/navigate/context.d.ts.map +1 -1
- package/lib/components/contexts/navigate/context.js.map +1 -1
- package/lib/components/contexts/navigate/provider.js +1 -1
- package/lib/components/contexts/navigate/provider.js.map +1 -1
- package/lib/components/contexts/navigate/use-navigate.js +1 -1
- package/lib/components/contexts/navigate/use-navigate.js.map +1 -1
- package/lib/components/contexts/reference/context.d.ts +0 -1
- package/lib/components/contexts/reference/context.d.ts.map +1 -1
- package/lib/components/contexts/reference/context.js.map +1 -1
- package/lib/components/contexts/reference/provider.js.map +1 -1
- package/lib/components/contexts/reference/use-reference.js.map +1 -1
- package/lib/components/elements/article/document.d.ts.map +1 -1
- package/lib/components/elements/article/document.js +1 -1
- package/lib/components/elements/article/document.js.map +1 -1
- package/lib/components/elements/article/index.js.map +1 -1
- package/lib/components/elements/article/utils.d.ts +1 -1
- package/lib/components/elements/article/utils.d.ts.map +1 -1
- package/lib/components/elements/article/utils.js +1 -1
- package/lib/components/elements/article/utils.js.map +1 -1
- package/lib/components/elements/footer/index.js.map +1 -1
- package/lib/components/elements/header/index.js +1 -1
- package/lib/components/elements/header/index.js.map +1 -1
- package/lib/components/elements/keylink-to-content/index.js.map +1 -1
- package/lib/components/elements/keylink-to-navigation/index.js.map +1 -1
- package/lib/components/elements/robin-provider/index.js.map +1 -1
- package/lib/components/elements/sidebar/index.js +1 -1
- package/lib/components/elements/sidebar/index.js.map +1 -1
- package/lib/components/elements/sidebar/sidebar-drop/index.js +1 -1
- package/lib/components/elements/sidebar/sidebar-drop/index.js.map +1 -1
- package/lib/components/elements/sidebar/sidebar-link/index.js.map +1 -1
- package/lib/components/elements/sidebar/sidebar-menu/index.js +1 -1
- package/lib/components/elements/sidebar/sidebar-menu/index.js.map +1 -1
- package/lib/components/elements/sidebar/tools.d.ts.map +1 -1
- package/lib/components/elements/sidebar/tools.js +1 -1
- package/lib/components/elements/sidebar/tools.js.map +1 -1
- package/lib/components/ui/backdrop/index.js.map +1 -1
- package/lib/components/ui/block/index.js.map +1 -1
- package/lib/components/ui/blockquote/data.d.ts +0 -1
- package/lib/components/ui/blockquote/data.d.ts.map +1 -1
- package/lib/components/ui/blockquote/data.js +1 -1
- package/lib/components/ui/blockquote/data.js.map +1 -1
- package/lib/components/ui/blockquote/icons.js.map +1 -1
- package/lib/components/ui/blockquote/index.js.map +1 -1
- package/lib/components/ui/code-block/index.js +1 -1
- package/lib/components/ui/code-block/index.js.map +1 -1
- package/lib/components/ui/code-block/theme.js.map +1 -1
- package/lib/components/ui/code-span/index.js.map +1 -1
- package/lib/components/ui/container/index.js.map +1 -1
- package/lib/components/ui/content-link/index.d.ts.map +1 -1
- package/lib/components/ui/content-link/index.js.map +1 -1
- package/lib/components/ui/copy-button/index.js +1 -1
- package/lib/components/ui/copy-button/index.js.map +1 -1
- package/lib/components/ui/copy-text/index.js +1 -1
- package/lib/components/ui/copy-text/index.js.map +1 -1
- package/lib/components/ui/del/index.js.map +1 -1
- package/lib/components/ui/em/index.js.map +1 -1
- package/lib/components/ui/external-mark/index.js.map +1 -1
- package/lib/components/ui/git-logos/index.js.map +1 -1
- package/lib/components/ui/heading/index.js +1 -1
- package/lib/components/ui/heading/index.js.map +1 -1
- package/lib/components/ui/hr/index.js.map +1 -1
- package/lib/components/ui/img/index.js.map +1 -1
- package/lib/components/ui/list/list-item/index.js.map +1 -1
- package/lib/components/ui/list/ordered-list/index.js.map +1 -1
- package/lib/components/ui/list/unordered-list/index.js.map +1 -1
- package/lib/components/ui/modal/index.js.map +1 -1
- package/lib/components/ui/modal/use-modal.js +1 -1
- package/lib/components/ui/modal/use-modal.js.map +1 -1
- package/lib/components/ui/paragraph/index.js.map +1 -1
- package/lib/components/ui/strong/index.js.map +1 -1
- package/lib/components/ui/table/table/index.js.map +1 -1
- package/lib/components/ui/table/tbody/index.js.map +1 -1
- package/lib/components/ui/table/td/index.js.map +1 -1
- package/lib/components/ui/table/th/index.js.map +1 -1
- package/lib/components/ui/table/thead/index.js.map +1 -1
- package/lib/components/ui/table/tr/index.js.map +1 -1
- package/lib/components/ui/tabs/index.js +1 -1
- package/lib/components/ui/tabs/index.js.map +1 -1
- package/lib/components/ui/tabs/tabs-header/index.js +1 -1
- package/lib/components/ui/tabs/tabs-header/index.js.map +1 -1
- package/lib/components/ui/tabs/tabs-styles/index.js +1 -1
- package/lib/components/ui/tabs/tabs-styles/index.js.map +1 -1
- package/lib/components/ui/task-list/task-list-item/index.js.map +1 -1
- package/lib/components/ui/task-list/task-unordered-list/index.js.map +1 -1
- package/lib/components/ui/tooltip/index.js.map +1 -1
- package/lib/core/data/contents.js.map +1 -1
- package/lib/core/hooks/use-debouncer.d.ts.map +1 -1
- package/lib/core/hooks/use-debouncer.js +1 -1
- package/lib/core/hooks/use-debouncer.js.map +1 -1
- package/lib/core/hooks/use-system-type.js +1 -1
- package/lib/core/hooks/use-system-type.js.map +1 -1
- package/lib/core/providers/base.js +1 -1
- package/lib/core/providers/base.js.map +1 -1
- package/lib/core/providers/file-system.js +1 -1
- package/lib/core/providers/file-system.js.map +1 -1
- package/lib/core/providers/github.js +1 -1
- package/lib/core/providers/github.js.map +1 -1
- package/lib/core/types/content.d.ts +0 -1
- package/lib/core/types/content.d.ts.map +1 -1
- package/lib/core/utils/content-tools.d.ts.map +1 -1
- package/lib/core/utils/content-tools.js +1 -1
- package/lib/core/utils/content-tools.js.map +1 -1
- package/lib/core/utils/create-base-searcher.d.ts.map +1 -1
- package/lib/core/utils/create-base-searcher.js +1 -1
- package/lib/core/utils/create-base-searcher.js.map +1 -1
- package/lib/core/utils/detect-provider.d.ts.map +1 -1
- package/lib/core/utils/detect-provider.js.map +1 -1
- package/lib/core/utils/get-configuration.d.ts.map +1 -1
- package/lib/core/utils/get-configuration.js.map +1 -1
- package/lib/core/utils/get-metadata.d.ts.map +1 -1
- package/lib/core/utils/get-metadata.js +1 -1
- package/lib/core/utils/get-metadata.js.map +1 -1
- package/lib/core/utils/git-tools.d.ts.map +1 -1
- package/lib/core/utils/git-tools.js.map +1 -1
- package/lib/core/utils/initialize-robindoc.d.ts.map +1 -1
- package/lib/core/utils/initialize-robindoc.js +1 -1
- package/lib/core/utils/initialize-robindoc.js.map +1 -1
- package/lib/core/utils/load-content.d.ts.map +1 -1
- package/lib/core/utils/load-content.js.map +1 -1
- package/lib/core/utils/parse-structure.d.ts.map +1 -1
- package/lib/core/utils/parse-structure.js.map +1 -1
- package/lib/core/utils/path-tools.d.ts.map +1 -1
- package/lib/core/utils/path-tools.js +1 -1
- package/lib/core/utils/path-tools.js.map +1 -1
- package/lib/core/utils/tabs-tools.d.ts.map +1 -1
- package/lib/core/utils/tabs-tools.js +1 -1
- package/lib/core/utils/tabs-tools.js.map +1 -1
- package/lib/styles.css +2045 -2
- package/package.json +27 -27
- package/lib/styles.css.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/ui/task-list/task-list-item/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport { ListItem } from \"../../list\";\n\nimport \"./task-list-item.scss\";\n\ninterface TaskListItemProps {\n className?: string;\n defaultChecked?: boolean;\n}\n\nexport const TaskListItem: React.FC<React.PropsWithChildren<TaskListItemProps>> = ({\n className,\n defaultChecked,\n children,\n}) => {\n return (\n <ListItem className={clsx(\"r-task-li\", className)}>\n <label className=\"r-task-label\">\n <input type=\"checkbox\" defaultChecked={defaultChecked} className=\"r-task-checkbox\" />\n <span className=\"r-task-label-text\">{children}</span>\n </label>\n </ListItem>\n );\n};\n"],"names":["TaskListItem","className","defaultChecked","children","React","createElement","ListItem","clsx","type"],"mappings":"kGAYO,MAAMA,EAAqE,EAC9EC,YACAC,iBACAC,cAGIC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/ui/task-list/task-list-item/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport { ListItem } from \"../../list\";\n\nimport \"./task-list-item.scss\";\n\ninterface TaskListItemProps {\n className?: string;\n defaultChecked?: boolean;\n}\n\nexport const TaskListItem: React.FC<React.PropsWithChildren<TaskListItemProps>> = ({\n className,\n defaultChecked,\n children,\n}) => {\n return (\n <ListItem className={clsx(\"r-task-li\", className)}>\n <label className=\"r-task-label\">\n <input type=\"checkbox\" defaultChecked={defaultChecked} className=\"r-task-checkbox\" />\n <span className=\"r-task-label-text\">{children}</span>\n </label>\n </ListItem>\n );\n};\n"],"names":["TaskListItem","className","defaultChecked","children","React","createElement","ListItem","clsx","type"],"mappings":"kGAYO,MAAMA,EAAqE,EAC9EC,YACAC,iBACAC,cAGIC,EAAAC,cAACC,EAAQ,CAACL,UAAWM,EAAK,YAAaN,IACnCG,EAAAC,cAAA,QAAA,CAAOJ,UAAU,gBACbG,EAAAC,cAAA,QAAA,CAAOG,KAAK,WAAWN,eAAgBA,EAAgBD,UAAU,oBACjEG,EAAAC,cAAA,OAAA,CAAMJ,UAAU,qBAAqBE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/ui/task-list/task-unordered-list/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport { UnorderedList } from \"../../list\";\n\nimport \"./task-unordered-list.scss\";\n\ninterface TaskUnorderedListProps {\n className?: string;\n}\n\nexport const TaskUnorderedList: React.FC<React.PropsWithChildren<TaskUnorderedListProps>> = ({\n className,\n children,\n}) => {\n return <UnorderedList className={clsx(\"r-task-ul\", className)}>{children}</UnorderedList>;\n};\n"],"names":["TaskUnorderedList","className","children","React","createElement","UnorderedList","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/ui/task-list/task-unordered-list/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport { UnorderedList } from \"../../list\";\n\nimport \"./task-unordered-list.scss\";\n\ninterface TaskUnorderedListProps {\n className?: string;\n}\n\nexport const TaskUnorderedList: React.FC<React.PropsWithChildren<TaskUnorderedListProps>> = ({\n className,\n children,\n}) => {\n return <UnorderedList className={clsx(\"r-task-ul\", className)}>{children}</UnorderedList>;\n};\n"],"names":["TaskUnorderedList","className","children","React","createElement","UnorderedList","clsx"],"mappings":"4GAWO,MAAMA,EAA+E,EACxFC,YACAC,cAEOC,EAAAC,cAACC,EAAa,CAACJ,UAAWK,EAAK,YAAaL,IAAaC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/tooltip/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport \"./tooltip.scss\";\n\nexport type TooltipProps = React.PropsWithChildren<{\n className?: string;\n position: keyof typeof positionClassNames;\n visible?: boolean;\n}>;\n\nconst positionClassNames = {\n \"bottom-start\": \"_bottom-start\",\n \"bottom-end\": \"_bottom-end\",\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({ className, position, children, visible }) => (\n <span className={clsx(\"r-tooltip\", positionClassNames[position], visible && \"_visible\", className)}>\n {children}\n </span>\n);\n"],"names":["positionClassNames","Tooltip","className","position","children","visible","React","createElement","clsx"],"mappings":"yCAWA,MAAMA,EAAqB,CACvB,eAAgB,gBAChB,aAAc,eAGLC,EAAkC,EAAGC,YAAWC,WAAUC,WAAUC,aAC7EC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/tooltip/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport \"./tooltip.scss\";\n\nexport type TooltipProps = React.PropsWithChildren<{\n className?: string;\n position: keyof typeof positionClassNames;\n visible?: boolean;\n}>;\n\nconst positionClassNames = {\n \"bottom-start\": \"_bottom-start\",\n \"bottom-end\": \"_bottom-end\",\n};\n\nexport const Tooltip: React.FC<TooltipProps> = ({ className, position, children, visible }) => (\n <span className={clsx(\"r-tooltip\", positionClassNames[position], visible && \"_visible\", className)}>\n {children}\n </span>\n);\n"],"names":["positionClassNames","Tooltip","className","position","children","visible","React","createElement","clsx"],"mappings":"yCAWA,MAAMA,EAAqB,CACvB,eAAgB,gBAChB,aAAc,eAGLC,EAAkC,EAAGC,YAAWC,WAAUC,WAAUC,aAC7EC,EAAAC,cAAA,OAAA,CAAML,UAAWM,EAAK,YAAaR,EAAmBG,GAAWE,GAAW,WAAYH,IACnFE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contents.js","sources":["../../../src/core/data/contents.ts"],"sourcesContent":["export const extensionsMap = {\n \".svg\": \"image/svg+xml\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".png\": \"image/png\",\n \".webp\": \"image/webp\",\n \".avif\": \"image/avif\",\n \".gif\": \"image/gif\",\n \".ico\": \"image/vnd.microsoft.icon\",\n};\n"],"names":["extensionsMap"],"mappings":"
|
|
1
|
+
{"version":3,"file":"contents.js","sources":["../../../src/core/data/contents.ts"],"sourcesContent":["export const extensionsMap = {\n \".svg\": \"image/svg+xml\",\n \".jpg\": \"image/jpeg\",\n \".jpeg\": \"image/jpeg\",\n \".png\": \"image/png\",\n \".webp\": \"image/webp\",\n \".avif\": \"image/avif\",\n \".gif\": \"image/gif\",\n \".ico\": \"image/vnd.microsoft.icon\",\n};\n"],"names":["extensionsMap"],"mappings":"AAAO,MAAMA,EAAgB,CACzB,OAAQ,gBACR,OAAQ,aACR,QAAS,aACT,OAAQ,YACR,QAAS,aACT,QAAS,aACT,OAAQ,YACR,OAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-debouncer.d.ts","sourceRoot":"","sources":["../../../src/core/hooks/use-debouncer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"use-debouncer.d.ts","sourceRoot":"","sources":["../../../src/core/hooks/use-debouncer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,GAAG,EAAE,EAAE,UAAU,CAAC,eAAe,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,OAAO;uBAI7E,CAAC;CAoBpC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useRef as r,useEffect as t}from"react";const e=e=>{const n=r(null),c=r(null);return t((
|
|
1
|
+
import{useRef as r,useEffect as t}from"react";const e=e=>{const n=r(null),c=r(null);return t(()=>()=>{n.current&&clearTimeout(n.current),c.current&&c.current.abort()},[]),{handler:async(...r)=>{n.current&&clearTimeout(n.current),c.current&&!c.current.signal.aborted&&c.current.abort(),n.current=setTimeout(()=>{c.current=new AbortController,e(c.current,...r)},100)}}};export{e as useDebouncer};
|
|
2
2
|
//# sourceMappingURL=use-debouncer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-debouncer.js","sources":["../../../src/core/hooks/use-debouncer.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const useDebouncer = <T extends any[]>(callback: (abortController: AbortController, ...args: T) => unknown) => {\n const debounceRef = useRef<NodeJS.Timeout | null>(null);\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const handler = async (...args: T) => {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n if (abortControllerRef.current && !abortControllerRef.current.signal.aborted)\n abortControllerRef.current.abort();\n\n debounceRef.current = setTimeout(() => {\n abortControllerRef.current = new AbortController();\n\n callback(abortControllerRef.current, ...args);\n }, 100);\n };\n\n useEffect(() => {\n return () => {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n if (abortControllerRef.current) abortControllerRef.current.abort();\n };\n }, []);\n\n return { handler };\n};\n"],"names":["useDebouncer","callback","debounceRef","useRef","abortControllerRef","useEffect","current","clearTimeout","abort","handler","async","args","signal","aborted","setTimeout","AbortController"],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-debouncer.js","sources":["../../../src/core/hooks/use-debouncer.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const useDebouncer = <T extends any[]>(callback: (abortController: AbortController, ...args: T) => unknown) => {\n const debounceRef = useRef<NodeJS.Timeout | null>(null);\n const abortControllerRef = useRef<AbortController | null>(null);\n\n const handler = async (...args: T) => {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n if (abortControllerRef.current && !abortControllerRef.current.signal.aborted)\n abortControllerRef.current.abort();\n\n debounceRef.current = setTimeout(() => {\n abortControllerRef.current = new AbortController();\n\n callback(abortControllerRef.current, ...args);\n }, 100);\n };\n\n useEffect(() => {\n return () => {\n if (debounceRef.current) clearTimeout(debounceRef.current);\n if (abortControllerRef.current) abortControllerRef.current.abort();\n };\n }, []);\n\n return { handler };\n};\n"],"names":["useDebouncer","callback","debounceRef","useRef","abortControllerRef","useEffect","current","clearTimeout","abort","handler","async","args","signal","aborted","setTimeout","AbortController"],"mappings":"8CAGO,MAAMA,EAAiCC,IAC1C,MAAMC,EAAcC,EAA8B,MAC5CC,EAAqBD,EAA+B,MAqB1D,OAPAE,EAAU,IACC,KACCH,EAAYI,SAASC,aAAaL,EAAYI,SAC9CF,EAAmBE,SAASF,EAAmBE,QAAQE,SAEhE,IAEI,CAAEC,QAnBOC,SAAUC,KAClBT,EAAYI,SAASC,aAAaL,EAAYI,SAC9CF,EAAmBE,UAAYF,EAAmBE,QAAQM,OAAOC,SACjET,EAAmBE,QAAQE,QAE/BN,EAAYI,QAAUQ,WAAW,KAC7BV,EAAmBE,QAAU,IAAIS,gBAEjCd,EAASG,EAAmBE,WAAYK,IACzC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useState as t,useEffect as r}from"react";const e=()=>{const[e,n]=t(null);return r((
|
|
1
|
+
import{useState as t,useEffect as r}from"react";const e=()=>{const[e,n]=t(null);return r(()=>{navigator.userAgent.includes("Macintosh")?n("apple"):n("other")},[]),e};export{e as useSystemType};
|
|
2
2
|
//# sourceMappingURL=use-system-type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-system-type.js","sources":["../../../src/core/hooks/use-system-type.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport type SystemType = null | \"other\" | \"apple\";\n\nexport const useSystemType = () => {\n const [system, setSystem] = useState<SystemType>(null);\n\n useEffect(() => {\n if (navigator.userAgent.includes(\"Macintosh\")) {\n setSystem(\"apple\");\n } else {\n setSystem(\"other\");\n }\n }, []);\n\n return system;\n};\n"],"names":["useSystemType","system","setSystem","useState","useEffect","navigator","userAgent","includes"],"mappings":"gDAIO,MAAMA,EAAgB,KACzB,MAAOC,EAAQC,GAAaC,EAAqB,MAUjD,OARAC,
|
|
1
|
+
{"version":3,"file":"use-system-type.js","sources":["../../../src/core/hooks/use-system-type.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport type SystemType = null | \"other\" | \"apple\";\n\nexport const useSystemType = () => {\n const [system, setSystem] = useState<SystemType>(null);\n\n useEffect(() => {\n if (navigator.userAgent.includes(\"Macintosh\")) {\n setSystem(\"apple\");\n } else {\n setSystem(\"other\");\n }\n }, []);\n\n return system;\n};\n"],"names":["useSystemType","system","setSystem","useState","useEffect","navigator","userAgent","includes"],"mappings":"gDAIO,MAAMA,EAAgB,KACzB,MAAOC,EAAQC,GAAaC,EAAqB,MAUjD,OARAC,EAAU,KACFC,UAAUC,UAAUC,SAAS,aAC7BL,EAAU,SAEVA,EAAU,UAEf,IAEID"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class e{type="local";sourceRoot;filesPromise;constructor(e){this.sourceRoot=e.replaceAll("\\","/").replace(/\/$/,""),this.filesPromise={docs:[],structures:[]}}async getPageSourcePathname(e,t){let s=null;if(t.endsWith(".md")||t.endsWith(".mdx")||t.endsWith(".json"))s=t;else{const t=(await this.filesPromise).docs.find(
|
|
1
|
+
class e{type="local";sourceRoot;filesPromise;constructor(e){this.sourceRoot=e.replaceAll("\\","/").replace(/\/$/,""),this.filesPromise={docs:[],structures:[]}}async getPageSourcePathname(e,t){let s=null;if(t.endsWith(".md")||t.endsWith(".mdx")||t.endsWith(".json"))s=t;else{const t=(await this.filesPromise).docs.find(t=>t.clientPath===e);t&&(s=t.origPath)}return s}async load(e){return""}async getEditUri(e){return null}async getLastModifiedDate(e){return null}async getFileSrc(e,t,s){return t}}export{e as BaseProvider};
|
|
2
2
|
//# sourceMappingURL=base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sources":["../../../src/core/providers/base.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { type BranchFiles } from \"../types/content\";\n\nexport class BaseProvider {\n type: \"local\" | \"remote\" = \"local\";\n\n sourceRoot: string;\n\n filesPromise: Promise<BranchFiles> | BranchFiles;\n\n constructor(sourceRoot: string) {\n this.sourceRoot = sourceRoot.replaceAll(\"\\\\\", \"/\").replace(/\\/$/, \"\");\n this.filesPromise = { docs: [], structures: [] };\n }\n\n async getPageSourcePathname(uri: string, fullUri: string) {\n let pathname = null;\n if (fullUri.endsWith(\".md\") || fullUri.endsWith(\".mdx\") || fullUri.endsWith(\".json\")) {\n pathname = fullUri;\n } else {\n const files = await this.filesPromise;\n const validFile = files.docs.find((file) => file.clientPath === uri);\n if (validFile) {\n pathname = validFile.origPath;\n }\n }\n return pathname;\n }\n\n async load(_uri: string) {\n return \"\";\n }\n\n async getEditUri(_uri: string): Promise<string | null> {\n return null;\n }\n\n async getLastModifiedDate(_uri: string): Promise<string | null> {\n return null;\n }\n\n async getFileSrc(_uri: string, href: string, _publicDirs?: string[]): Promise<string> {\n return href;\n }\n}\n"],"names":["BaseProvider","type","sourceRoot","filesPromise","constructor","this","replaceAll","replace","docs","structures","getPageSourcePathname","uri","fullUri","pathname","endsWith","validFile","find","file","clientPath","origPath","load","_uri","getEditUri","getLastModifiedDate","getFileSrc","href","_publicDirs"],"mappings":"MAGaA,EACTC,KAA2B,QAE3BC,WAEAC,aAEA,WAAAC,CAAYF,GACRG,KAAKH,WAAaA,EAAWI,WAAW,KAAM,KAAKC,QAAQ,MAAO,IAClEF,KAAKF,aAAe,CAAEK,KAAM,GAAIC,WAAY,
|
|
1
|
+
{"version":3,"file":"base.js","sources":["../../../src/core/providers/base.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { type BranchFiles } from \"../types/content\";\n\nexport class BaseProvider {\n type: \"local\" | \"remote\" = \"local\";\n\n sourceRoot: string;\n\n filesPromise: Promise<BranchFiles> | BranchFiles;\n\n constructor(sourceRoot: string) {\n this.sourceRoot = sourceRoot.replaceAll(\"\\\\\", \"/\").replace(/\\/$/, \"\");\n this.filesPromise = { docs: [], structures: [] };\n }\n\n async getPageSourcePathname(uri: string, fullUri: string) {\n let pathname = null;\n if (fullUri.endsWith(\".md\") || fullUri.endsWith(\".mdx\") || fullUri.endsWith(\".json\")) {\n pathname = fullUri;\n } else {\n const files = await this.filesPromise;\n const validFile = files.docs.find((file) => file.clientPath === uri);\n if (validFile) {\n pathname = validFile.origPath;\n }\n }\n return pathname;\n }\n\n async load(_uri: string) {\n return \"\";\n }\n\n async getEditUri(_uri: string): Promise<string | null> {\n return null;\n }\n\n async getLastModifiedDate(_uri: string): Promise<string | null> {\n return null;\n }\n\n async getFileSrc(_uri: string, href: string, _publicDirs?: string[]): Promise<string> {\n return href;\n }\n}\n"],"names":["BaseProvider","type","sourceRoot","filesPromise","constructor","this","replaceAll","replace","docs","structures","getPageSourcePathname","uri","fullUri","pathname","endsWith","validFile","find","file","clientPath","origPath","load","_uri","getEditUri","getLastModifiedDate","getFileSrc","href","_publicDirs"],"mappings":"MAGaA,EACTC,KAA2B,QAE3BC,WAEAC,aAEA,WAAAC,CAAYF,GACRG,KAAKH,WAAaA,EAAWI,WAAW,KAAM,KAAKC,QAAQ,MAAO,IAClEF,KAAKF,aAAe,CAAEK,KAAM,GAAIC,WAAY,GAChD,CAEA,2BAAMC,CAAsBC,EAAaC,GACrC,IAAIC,EAAW,KACf,GAAID,EAAQE,SAAS,QAAUF,EAAQE,SAAS,SAAWF,EAAQE,SAAS,SACxED,EAAWD,MACR,CACH,MACMG,SADcV,KAAKF,cACDK,KAAKQ,KAAMC,GAASA,EAAKC,aAAeP,GAC5DI,IACAF,EAAWE,EAAUI,SAE7B,CACA,OAAON,CACX,CAEA,UAAMO,CAAKC,GACP,MAAO,EACX,CAEA,gBAAMC,CAAWD,GACb,OAAO,IACX,CAEA,yBAAME,CAAoBF,GACtB,OAAO,IACX,CAEA,gBAAMG,CAAWH,EAAcI,EAAcC,GACzC,OAAOD,CACX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readFile as t}from"fs/promises";import{glob as e}from"glob";import s from"path";import{BaseProvider as o}from"./base.js";import{extensionsMap as r}from"../data/contents.js";import{getFileUrl as i,normalizePathname as a}from"../utils/path-tools.js";class c extends o{type="local";sourceRoot;constructor(t=process.cwd()){super(t),this.sourceRoot=t.replaceAll("\\","/"),this.filesPromise=this.loadFiles("")}async getPageSourcePathname(t){if(this.sourceRoot.endsWith(".md")||this.sourceRoot.endsWith(".mdx"))return this.sourceRoot;const e=s.posix.join(this.sourceRoot,t).replaceAll("\\","/").replace(/\/$/,"");return super.getPageSourcePathname(t,e)}async load(e){const s=await this.getPageSourcePathname(e);if(!s)throw new Error(`Can not find file for "${e}"`);return await t(s,"utf-8")}async getFileSrc(e,o,i){if(o.match(/https?:\/\//))return o;const a=s.posix.join(process.cwd(),e?.replace(/^\//,"./")||"",o.replace(/^\//,"./")),c=s.posix.relative(process.cwd(),a),{dir:n,ext:l}=s.parse(c),p=i&&new RegExp(`^(${i?.join("|")})(/|$)`),u=p&&n.match(p);let h=o;if(u)h=`${c.replace(u[1],"")}`;else if(l in r){const e=await t(c,"base64");h=`data:${r[l]};base64,${e}`}return h}async loadFiles(t){const o=t?.replace(/^\//,""),r=(await e(["**/*.{md,mdx}","**/structure.json"],{cwd:this.sourceRoot,posix:!0})).reduce((
|
|
1
|
+
import{readFile as t}from"fs/promises";import{glob as e}from"glob";import s from"path";import{BaseProvider as o}from"./base.js";import{extensionsMap as r}from"../data/contents.js";import{getFileUrl as i,normalizePathname as a}from"../utils/path-tools.js";class c extends o{type="local";sourceRoot;constructor(t=process.cwd()){super(t),this.sourceRoot=t.replaceAll("\\","/"),this.filesPromise=this.loadFiles("")}async getPageSourcePathname(t){if(this.sourceRoot.endsWith(".md")||this.sourceRoot.endsWith(".mdx"))return this.sourceRoot;const e=s.posix.join(this.sourceRoot,t).replaceAll("\\","/").replace(/\/$/,"");return super.getPageSourcePathname(t,e)}async load(e){const s=await this.getPageSourcePathname(e);if(!s)throw new Error(`Can not find file for "${e}"`);return await t(s,"utf-8")}async getFileSrc(e,o,i){if(o.match(/https?:\/\//))return o;const a=s.posix.join(process.cwd(),e?.replace(/^\//,"./")||"",o.replace(/^\//,"./")),c=s.posix.relative(process.cwd(),a),{dir:n,ext:l}=s.parse(c),p=i&&new RegExp(`^(${i?.join("|")})(/|$)`),u=p&&n.match(p);let h=o;if(u)h=`${c.replace(u[1],"")}`;else if(l in r){const e=await t(c,"base64");h=`data:${r[l]};base64,${e}`}return h}async loadFiles(t){const o=t?.replace(/^\//,""),r=(await e(["**/*.{md,mdx}","**/structure.json"],{cwd:this.sourceRoot,posix:!0})).reduce((t,e)=>{if(!o||o&&e.startsWith(o)){const r=s.relative(process.cwd(),(this.sourceRoot||".")+"/"+e).replace(/\\/g,"/");if(e.match(/\.mdx?$/)){const s=i("/"+e),c=a(s.substring(o?.length||0)),n=c.replace(/\/[0-9]+[-_](.)/g,"/$1");t.docs.push({origPath:r,clientPath:n,origClientPath:c})}else t.structures.push(r)}return t},{docs:[],structures:[]});return r.docs.sort((t,e)=>t.origClientPath.localeCompare(e.origClientPath)),this.filesPromise=r,r}}export{c as FileSystemProvider};
|
|
2
2
|
//# sourceMappingURL=file-system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.js","sources":["../../../src/core/providers/file-system.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport { glob } from \"glob\";\nimport path from \"path\";\n\nimport { type BranchFiles } from \"../types/content\";\nimport { BaseProvider } from \"./base\";\nimport { extensionsMap } from \"../data/contents\";\nimport { getFileUrl, normalizePathname } from \"../utils/path-tools\";\n\nexport class FileSystemProvider extends BaseProvider {\n readonly type = \"local\";\n\n sourceRoot: string;\n\n constructor(sourceRoot: string = process.cwd()) {\n super(sourceRoot);\n this.sourceRoot = sourceRoot.replaceAll(\"\\\\\", \"/\");\n this.filesPromise = this.loadFiles(\"\");\n }\n\n async getPageSourcePathname(uri: string) {\n if (this.sourceRoot.endsWith(\".md\") || this.sourceRoot.endsWith(\".mdx\")) {\n return this.sourceRoot;\n }\n const fullUri = path.posix.join(this.sourceRoot, uri).replaceAll(\"\\\\\", \"/\").replace(/\\/$/, \"\");\n return super.getPageSourcePathname(uri, fullUri);\n }\n\n async load(uri: string) {\n const filePath = await this.getPageSourcePathname(uri);\n if (!filePath) {\n throw new Error(`Can not find file for \"${uri}\"`);\n }\n const content = await readFile(filePath, \"utf-8\");\n return content;\n }\n\n async getFileSrc(uri: string, href: string, publicDirs?: string[]) {\n if (href.match(/https?:\\/\\//)) return href;\n\n const assetPath = path.posix.join(process.cwd(), uri?.replace(/^\\//, \"./\") || \"\", href.replace(/^\\//, \"./\"));\n const relativePath = path.posix.relative(process.cwd(), assetPath);\n const { dir, ext } = path.parse(relativePath);\n const publicDirsRule = publicDirs && new RegExp(`^(${publicDirs?.join(\"|\")})(\\/|$)`);\n const publicDirMatch = publicDirsRule && dir.match(publicDirsRule);\n\n let src = href;\n if (publicDirMatch) {\n src = `${relativePath.replace(publicDirMatch[1], \"\")}`;\n } else if (ext in extensionsMap) {\n const base64Image = await readFile(relativePath, \"base64\");\n src = `data:${extensionsMap[ext as keyof typeof extensionsMap]};base64,${base64Image}`;\n }\n return src;\n }\n\n private async loadFiles(pathname?: string) {\n const pathnameClean = pathname?.replace(/^\\//, \"\");\n const files = await glob([\"**/*.{md,mdx}\", \"**/structure.json\"], { cwd: this.sourceRoot, posix: true });\n\n const fileTree = files.reduce<BranchFiles>(\n (acc, item) => {\n if (!pathnameClean || (pathnameClean && item.startsWith(pathnameClean))) {\n const origPath = path\n .relative(process.cwd(), (this.sourceRoot || \".\") + \"/\" + item)\n .replace(/\\\\/g, \"/\");\n\n if (item.match(/\\.mdx?$/)) {\n const clientUrl = getFileUrl(\"/\" + item);\n const origClientPath = normalizePathname(clientUrl.substring(pathnameClean?.length || 0));\n const clientPath = origClientPath.replace(/\\/[0-9]+[-_](.)/g, \"/$1\");\n\n acc.docs.push({\n origPath,\n clientPath,\n origClientPath,\n });\n } else {\n acc.structures.push(origPath);\n }\n }\n return acc;\n },\n { docs: [], structures: [] },\n );\n fileTree.docs.sort((a, b) => a.origClientPath.localeCompare(b.origClientPath));\n this.filesPromise = fileTree;\n return fileTree;\n }\n}\n"],"names":["FileSystemProvider","BaseProvider","type","sourceRoot","constructor","process","cwd","super","this","replaceAll","filesPromise","loadFiles","getPageSourcePathname","uri","endsWith","fullUri","path","posix","join","replace","load","filePath","Error","readFile","getFileSrc","href","publicDirs","match","assetPath","relativePath","relative","dir","ext","parse","publicDirsRule","RegExp","publicDirMatch","src","extensionsMap","base64Image","pathname","pathnameClean","fileTree","glob","reduce","acc","item","startsWith","origPath","clientUrl","getFileUrl","origClientPath","normalizePathname","substring","length","clientPath","docs","push","structures","sort","a","b","localeCompare"],"mappings":"+PASM,MAAOA,UAA2BC,EAC3BC,KAAO,QAEhBC,WAEA,WAAAC,CAAYD,EAAqBE,QAAQC,OACrCC,MAAMJ,GACNK,KAAKL,WAAaA,EAAWM,WAAW,KAAM,KAC9CD,KAAKE,aAAeF,KAAKG,UAAU,
|
|
1
|
+
{"version":3,"file":"file-system.js","sources":["../../../src/core/providers/file-system.ts"],"sourcesContent":["import { readFile } from \"fs/promises\";\nimport { glob } from \"glob\";\nimport path from \"path\";\n\nimport { type BranchFiles } from \"../types/content\";\nimport { BaseProvider } from \"./base\";\nimport { extensionsMap } from \"../data/contents\";\nimport { getFileUrl, normalizePathname } from \"../utils/path-tools\";\n\nexport class FileSystemProvider extends BaseProvider {\n readonly type = \"local\";\n\n sourceRoot: string;\n\n constructor(sourceRoot: string = process.cwd()) {\n super(sourceRoot);\n this.sourceRoot = sourceRoot.replaceAll(\"\\\\\", \"/\");\n this.filesPromise = this.loadFiles(\"\");\n }\n\n async getPageSourcePathname(uri: string) {\n if (this.sourceRoot.endsWith(\".md\") || this.sourceRoot.endsWith(\".mdx\")) {\n return this.sourceRoot;\n }\n const fullUri = path.posix.join(this.sourceRoot, uri).replaceAll(\"\\\\\", \"/\").replace(/\\/$/, \"\");\n return super.getPageSourcePathname(uri, fullUri);\n }\n\n async load(uri: string) {\n const filePath = await this.getPageSourcePathname(uri);\n if (!filePath) {\n throw new Error(`Can not find file for \"${uri}\"`);\n }\n const content = await readFile(filePath, \"utf-8\");\n return content;\n }\n\n async getFileSrc(uri: string, href: string, publicDirs?: string[]) {\n if (href.match(/https?:\\/\\//)) return href;\n\n const assetPath = path.posix.join(process.cwd(), uri?.replace(/^\\//, \"./\") || \"\", href.replace(/^\\//, \"./\"));\n const relativePath = path.posix.relative(process.cwd(), assetPath);\n const { dir, ext } = path.parse(relativePath);\n const publicDirsRule = publicDirs && new RegExp(`^(${publicDirs?.join(\"|\")})(\\/|$)`);\n const publicDirMatch = publicDirsRule && dir.match(publicDirsRule);\n\n let src = href;\n if (publicDirMatch) {\n src = `${relativePath.replace(publicDirMatch[1], \"\")}`;\n } else if (ext in extensionsMap) {\n const base64Image = await readFile(relativePath, \"base64\");\n src = `data:${extensionsMap[ext as keyof typeof extensionsMap]};base64,${base64Image}`;\n }\n return src;\n }\n\n private async loadFiles(pathname?: string) {\n const pathnameClean = pathname?.replace(/^\\//, \"\");\n const files = await glob([\"**/*.{md,mdx}\", \"**/structure.json\"], { cwd: this.sourceRoot, posix: true });\n\n const fileTree = files.reduce<BranchFiles>(\n (acc, item) => {\n if (!pathnameClean || (pathnameClean && item.startsWith(pathnameClean))) {\n const origPath = path\n .relative(process.cwd(), (this.sourceRoot || \".\") + \"/\" + item)\n .replace(/\\\\/g, \"/\");\n\n if (item.match(/\\.mdx?$/)) {\n const clientUrl = getFileUrl(\"/\" + item);\n const origClientPath = normalizePathname(clientUrl.substring(pathnameClean?.length || 0));\n const clientPath = origClientPath.replace(/\\/[0-9]+[-_](.)/g, \"/$1\");\n\n acc.docs.push({\n origPath,\n clientPath,\n origClientPath,\n });\n } else {\n acc.structures.push(origPath);\n }\n }\n return acc;\n },\n { docs: [], structures: [] },\n );\n fileTree.docs.sort((a, b) => a.origClientPath.localeCompare(b.origClientPath));\n this.filesPromise = fileTree;\n return fileTree;\n }\n}\n"],"names":["FileSystemProvider","BaseProvider","type","sourceRoot","constructor","process","cwd","super","this","replaceAll","filesPromise","loadFiles","getPageSourcePathname","uri","endsWith","fullUri","path","posix","join","replace","load","filePath","Error","readFile","getFileSrc","href","publicDirs","match","assetPath","relativePath","relative","dir","ext","parse","publicDirsRule","RegExp","publicDirMatch","src","extensionsMap","base64Image","pathname","pathnameClean","fileTree","glob","reduce","acc","item","startsWith","origPath","clientUrl","getFileUrl","origClientPath","normalizePathname","substring","length","clientPath","docs","push","structures","sort","a","b","localeCompare"],"mappings":"+PASM,MAAOA,UAA2BC,EAC3BC,KAAO,QAEhBC,WAEA,WAAAC,CAAYD,EAAqBE,QAAQC,OACrCC,MAAMJ,GACNK,KAAKL,WAAaA,EAAWM,WAAW,KAAM,KAC9CD,KAAKE,aAAeF,KAAKG,UAAU,GACvC,CAEA,2BAAMC,CAAsBC,GACxB,GAAIL,KAAKL,WAA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c,KAAO,IAAM2C,GACzD3B,QAAQ,MAAO,KAEpB,GAAI2B,EAAKnB,MAAM,WAAY,CACvB,MAAMsB,EAAYC,EAAW,IAAMJ,GAC7BK,EAAiBC,EAAkBH,EAAUI,UAAUZ,GAAea,QAAU,IAChFC,EAAaJ,EAAehC,QAAQ,mBAAoB,OAE9D0B,EAAIW,KAAKC,KAAK,CACVT,WACAO,aACAJ,kBAER,MACIN,EAAIa,WAAWD,KAAKT,EAE5B,CACA,OAAOH,GAEX,CAAEW,KAAM,GAAIE,WAAY,KAI5B,OAFAhB,EAASc,KAAKG,KAAK,CAACC,EAAGC,IAAMD,EAAET,eAAeW,cAAcD,EAAEV,iBAC9D3C,KAAKE,aAAegC,EACbA,CACX"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"path";import{BaseProvider as e}from"./base.js";import{extensionsMap as r}from"../data/contents.js";import{getFileUrl as s,normalizePathname as o}from"../utils/path-tools.js";class a extends e{type="remote";owner;repo;ref;token;pathname;fetcher;constructor(t,e=fetch,r){super(t);const s=this.parseUri(t);if(!s)throw new Error(`Invalid URI: "${t}"`);const{owner:o,repo:a,ref:i="main",pathname:n=""}=s;this.owner=o,this.repo=a,this.ref=i,this.token=r,this.pathname=n,this.fetcher=e,this.filesPromise=this.loadTree(n)}async getPageSourcePathname(t){if(this.pathname.endsWith(".md")||this.pathname.endsWith(".mdx"))return this.pathname;const e=[...this.pathname?.split("/")||[],...t.split("/")].filter(Boolean).join("/");return super.getPageSourcePathname(t,e)}async load(t){const e=await this.getPageSourcePathname(t);if(!e)throw new Error(`Can not find md file for "${t}" at "https://github.com/${this.owner}/${this.repo}/blob/${this.ref}"`);const r=new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/contents/${e}`),s=new Headers;s.set("Accept","application/vnd.github.raw+json"),r.searchParams.set("ref",this.ref),this.token&&s.set("Authorization",`Bearer ${this.token}`);const o=await this.fetcher(r.toString(),{headers:s});if(!o.ok)throw new Error(`Can not load "${t}" content from "https://github.com/${this.owner}/${this.repo}/blob/${this.ref}": ${o.statusText}`);return await o.text()}async loadTree(t){const e=t?.replace(/^\//,""),r=new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/git/trees/${this.ref}?recursive=true`),a=new Headers;a.set("Accept","application/vnd.github.raw+json"),this.token&&a.set("Authorization",`Bearer ${this.token}`);const i=await this.fetcher(r.toString(),{headers:a});if(!i.ok)throw new Error("Can not load tree: "+i.statusText);const n=(await i.json()).tree.reduce((
|
|
1
|
+
import t from"path";import{BaseProvider as e}from"./base.js";import{extensionsMap as r}from"../data/contents.js";import{getFileUrl as s,normalizePathname as o}from"../utils/path-tools.js";class a extends e{type="remote";owner;repo;ref;token;pathname;fetcher;constructor(t,e=fetch,r){super(t);const s=this.parseUri(t);if(!s)throw new Error(`Invalid URI: "${t}"`);const{owner:o,repo:a,ref:i="main",pathname:n=""}=s;this.owner=o,this.repo=a,this.ref=i,this.token=r,this.pathname=n,this.fetcher=e,this.filesPromise=this.loadTree(n)}async getPageSourcePathname(t){if(this.pathname.endsWith(".md")||this.pathname.endsWith(".mdx"))return this.pathname;const e=[...this.pathname?.split("/")||[],...t.split("/")].filter(Boolean).join("/");return super.getPageSourcePathname(t,e)}async load(t){const e=await this.getPageSourcePathname(t);if(!e)throw new Error(`Can not find md file for "${t}" at "https://github.com/${this.owner}/${this.repo}/blob/${this.ref}"`);const r=new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/contents/${e}`),s=new Headers;s.set("Accept","application/vnd.github.raw+json"),r.searchParams.set("ref",this.ref),this.token&&s.set("Authorization",`Bearer ${this.token}`);const o=await this.fetcher(r.toString(),{headers:s});if(!o.ok)throw new Error(`Can not load "${t}" content from "https://github.com/${this.owner}/${this.repo}/blob/${this.ref}": ${o.statusText}`);return await o.text()}async loadTree(t){const e=t?.replace(/^\//,""),r=new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/git/trees/${this.ref}?recursive=true`),a=new Headers;a.set("Accept","application/vnd.github.raw+json"),this.token&&a.set("Authorization",`Bearer ${this.token}`);const i=await this.fetcher(r.toString(),{headers:a});if(!i.ok)throw new Error("Can not load tree: "+i.statusText);const n=(await i.json()).tree.reduce((t,r)=>{if(!e||e&&r.path.startsWith(e))if(r.path.match(/\.(md|mdx)$/)){const a=s(r.path),i=o(a.substring(e?.length||0)),n=i.replace(/\/[0-9]+[-_](.)/g,"/$1");t.docs.push({origPath:"/"+r.path,clientPath:n,origClientPath:i})}else r.path.endsWith("structure.json")&&t.structures.push(r.path);return t},{docs:[],structures:[]});return n.docs.sort((t,e)=>t.origClientPath.localeCompare(e.origClientPath)),this.filesPromise=n,n}parseUri(t){const e=t.match(/^https:\/\/github.com\/(?<owner>[^/]+)\/(?<repo>[^/]+)(?:\/(blob|tree)\/(?<ref>[^/]+)(?<pathname>\/.*)|\/)?$/),r=e?.groups;return r||null}async getEditUri(t){const e=await this.getPageSourcePathname(t);return e?`https://github.com/${this.owner}/${this.repo}/edit/${this.ref}${e}`:null}async getLastModifiedDate(t){const e=await this.getPageSourcePathname(t);if(!e)return null;const r=new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/commits?page=1&per_page=1`);r.searchParams.set("path",e),r.searchParams.set("sha",this.ref);const s=new Headers;this.token&&s.set("Authorization",`Bearer ${this.token}`);const o=await fetch(r,{headers:s});if(!o.ok)throw new Error(`Can not load last modified date for "${t}" from "https://github.com/${this.owner}/${this.repo}/blob/${this.ref}": ${o.statusText}`);return(await o.json())[0].commit.committer.date}async getFileSrc(e,s){if(s.match(/https?:\/\//))return s;const o=s.startsWith("/")?s:e.replace(/\/$/,"")+"/"+s,a=new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/contents${o}`);a.searchParams.set("ref",this.ref);const i=new Headers;this.token&&i.set("Authorization",`Bearer ${this.token}`);const n=await this.fetcher(a.toString(),{headers:i});if(!n.ok)throw new Error("Can not load asset: "+n.statusText);const h=await n.json();if(new URL(h.download_url).searchParams.get("token")){const{ext:e}=t.parse(o);return`data:${r[e]};base64,${h.content}`}return h.download_url}}export{a as GithubProvider};
|
|
2
2
|
//# sourceMappingURL=github.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.js","sources":["../../../src/core/providers/github.ts"],"sourcesContent":["import path from \"path\";\n\nimport { type BranchFiles, type Fetcher } from \"../types/content\";\nimport { BaseProvider } from \"./base\";\nimport { extensionsMap } from \"../data/contents\";\nimport { getFileUrl, normalizePathname } from \"../utils/path-tools\";\n\nexport class GithubProvider extends BaseProvider {\n readonly type = \"remote\";\n\n owner: string;\n\n repo: string;\n\n ref: string;\n\n token?: string;\n\n pathname: string;\n\n fetcher: Fetcher;\n\n constructor(sourceRoot: string, fetcher: Fetcher = fetch, token?: string) {\n super(sourceRoot);\n\n const groups = this.parseUri(sourceRoot);\n if (!groups) {\n throw new Error(`Invalid URI: \"${sourceRoot}\"`);\n }\n\n const { owner, repo, ref = \"main\", pathname = \"\" } = groups;\n this.owner = owner;\n this.repo = repo;\n this.ref = ref;\n this.token = token;\n this.pathname = pathname;\n this.fetcher = fetcher;\n this.filesPromise = this.loadTree(pathname);\n }\n\n async getPageSourcePathname(uri: string) {\n if (this.pathname.endsWith(\".md\") || this.pathname.endsWith(\".mdx\")) {\n return this.pathname;\n }\n const segments = [...(this.pathname?.split(\"/\") || []), ...uri.split(\"/\")].filter(Boolean);\n const fullUri = segments.join(\"/\");\n return super.getPageSourcePathname(uri, fullUri);\n }\n\n async load(uri: string) {\n const pathname = await this.getPageSourcePathname(uri);\n if (!pathname) {\n throw new Error(\n `Can not find md file for \"${uri}\" at \"https://github.com/${this.owner}/${this.repo}/blob/${this.ref}\"`,\n );\n }\n\n const url = new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/contents/${pathname}`);\n const headers = new Headers();\n headers.set(\"Accept\", \"application/vnd.github.raw+json\");\n\n url.searchParams.set(\"ref\", this.ref);\n if (this.token) headers.set(\"Authorization\", `Bearer ${this.token}`);\n\n const resp = await this.fetcher(url.toString(), { headers });\n if (!resp.ok) {\n throw new Error(\n `Can not load \"${uri}\" content from \"https://github.com/${this.owner}/${this.repo}/blob/${this.ref}\": ${resp.statusText}`,\n );\n }\n const content = await resp.text();\n return content;\n }\n\n private async loadTree(pathname?: string) {\n const pathnameClean = pathname?.replace(/^\\//, \"\");\n const url = new URL(\n `https://api.github.com/repos/${this.owner}/${this.repo}/git/trees/${this.ref}?recursive=true`,\n );\n const headers = new Headers();\n headers.set(\"Accept\", \"application/vnd.github.raw+json\");\n\n if (this.token) headers.set(\"Authorization\", `Bearer ${this.token}`);\n\n const resp = await this.fetcher(url.toString(), { headers });\n if (!resp.ok) {\n throw new Error(\"Can not load tree: \" + resp.statusText);\n }\n const data = (await resp.json()) as { tree: { path: string }[] };\n\n const fileTree = data.tree.reduce<BranchFiles>(\n (acc, item) => {\n if (!pathnameClean || (pathnameClean && item.path.startsWith(pathnameClean))) {\n if (item.path.match(/\\.(md|mdx)$/)) {\n const clientUrl = getFileUrl(item.path);\n const origClientPath = normalizePathname(clientUrl.substring(pathnameClean?.length || 0));\n const clientPath = origClientPath.replace(/\\/[0-9]+[-_](.)/g, \"/$1\");\n\n acc.docs.push({\n origPath: \"/\" + item.path,\n clientPath,\n origClientPath,\n });\n } else if (item.path.endsWith(\"structure.json\")) {\n acc.structures.push(item.path);\n }\n }\n return acc;\n },\n { docs: [], structures: [] },\n );\n fileTree.docs.sort((a, b) => a.origClientPath.localeCompare(b.origClientPath));\n this.filesPromise = fileTree;\n return fileTree;\n }\n\n private parseUri(uri: string) {\n const match = uri.match(\n /^https:\\/\\/github.com\\/(?<owner>[^/]+)\\/(?<repo>[^/]+)(?:\\/(blob|tree)\\/(?<ref>[^/]+)(?<pathname>\\/.*)|\\/)?$/,\n );\n const groups = match?.groups;\n return groups || null;\n }\n\n async getEditUri(uri: string) {\n const pathname = await this.getPageSourcePathname(uri);\n if (!pathname) {\n return null;\n }\n\n return `https://github.com/${this.owner}/${this.repo}/edit/${this.ref}${pathname}`;\n }\n\n async getLastModifiedDate(uri: string) {\n const pathname = await this.getPageSourcePathname(uri);\n if (!pathname) {\n return null;\n }\n\n const url = new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/commits?page=1&per_page=1`);\n url.searchParams.set(\"path\", pathname);\n url.searchParams.set(\"sha\", this.ref);\n\n const headers = new Headers();\n if (this.token) headers.set(\"Authorization\", `Bearer ${this.token}`);\n\n const resp = await fetch(url, { headers });\n if (!resp.ok) {\n throw new Error(\n `Can not load last modified date for \"${uri}\" from \"https://github.com/${this.owner}/${this.repo}/blob/${this.ref}\": ${resp.statusText}`,\n );\n }\n\n const data = await resp.json();\n return data[0].commit.committer.date;\n }\n\n async getFileSrc(uri: string, href: string) {\n if (href.match(/https?:\\/\\//)) return href;\n\n const filePath = href.startsWith(\"/\") ? href : uri.replace(/\\/$/, \"\") + \"/\" + href;\n const url = new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/contents${filePath}`);\n url.searchParams.set(\"ref\", this.ref);\n\n const headers = new Headers();\n if (this.token) headers.set(\"Authorization\", `Bearer ${this.token}`);\n\n const resp = await this.fetcher(url.toString(), { headers });\n\n if (!resp.ok) {\n throw new Error(\"Can not load asset: \" + resp.statusText);\n }\n\n const fileData = await resp.json();\n const srcUrl = new URL(fileData.download_url);\n\n if (srcUrl.searchParams.get(\"token\")) {\n const { ext } = path.parse(filePath);\n return `data:${extensionsMap[ext as keyof typeof extensionsMap]};base64,${fileData.content}`;\n } else {\n return fileData.download_url;\n }\n }\n}\n"],"names":["GithubProvider","BaseProvider","type","owner","repo","ref","token","pathname","fetcher","constructor","sourceRoot","fetch","super","groups","this","parseUri","Error","filesPromise","loadTree","getPageSourcePathname","uri","endsWith","fullUri","split","filter","Boolean","join","load","url","URL","headers","Headers","set","searchParams","resp","toString","ok","statusText","text","pathnameClean","replace","fileTree","json","tree","reduce","acc","item","path","startsWith","match","clientUrl","getFileUrl","origClientPath","normalizePathname","substring","length","clientPath","docs","push","origPath","structures","sort","a","b","localeCompare","getEditUri","getLastModifiedDate","commit","committer","date","getFileSrc","href","filePath","fileData","download_url","get","ext","parse","extensionsMap","content"],"mappings":"4LAOM,MAAOA,UAAuBC,EACvBC,KAAO,SAEhBC,MAEAC,KAEAC,IAEAC,MAEAC,SAEAC,QAEA,WAAAC,CAAYC,EAAoBF,EAAmBG,MAAOL,GACtDM,MAAMF,GAEN,MAAMG,EAASC,KAAKC,SAASL,GAC7B,IAAKG,EACD,MAAM,IAAIG,MAAM,iBAAiBN,MAGrC,MAAMP,MAAEA,EAAKC,KAAEA,EAAIC,IAAEA,EAAM,OAAME,SAAEA,EAAW,IAAOM,EACrDC,KAAKX,MAAQA,EACbW,KAAKV,KAAOA,EACZU,KAAKT,IAAMA,EACXS,KAAKR,MAAQA,EACbQ,KAAKP,SAAWA,EAChBO,KAAKN,QAAUA,EACfM,KAAKG,aAAeH,KAAKI,SAASX,EACrC,CAED,2BAAMY,CAAsBC,GACxB,GAAIN,KAAKP,SAASc,SAAS,QAAUP,KAAKP,SAASc,SAAS,QACxD,OAAOP,KAAKP,SAEhB,MACMe,EADW,IAAKR,KAAKP,UAAUgB,MAAM,MAAQ,MAAQH,EAAIG,MAAM,MAAMC,OAAOC,SACzDC,KAAK,KAC9B,OAAOd,MAAMO,sBAAsBC,EAAKE,EAC3C,CAED,UAAMK,CAAKP,GACP,MAAMb,QAAiBO,KAAKK,sBAAsBC,GAClD,IAAKb,EACD,MAAM,IAAIS,MACN,6BAA6BI,6BAA+BN,KAAKX,SAASW,KAAKV,aAAaU,KAAKT,QAIzG,MAAMuB,EAAM,IAAIC,IAAI,gCAAgCf,KAAKX,SAASW,KAAKV,iBAAiBG,KAClFuB,EAAU,IAAIC,QACpBD,EAAQE,IAAI,SAAU,mCAEtBJ,EAAIK,aAAaD,IAAI,MAAOlB,KAAKT,KAC7BS,KAAKR,OAAOwB,EAAQE,IAAI,gBAAiB,UAAUlB,KAAKR,SAE5D,MAAM4B,QAAapB,KAAKN,QAAQoB,EAAIO,WAAY,CAAEL,YA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ASC,cAErBzC,aAAa0C,IAAI,SAAU,CAClC,MAAMC,IAAEA,GAAQ7B,EAAK8B,MAAML,GAC3B,MAAO,QAAQM,EAAcF,aAA6CH,EAASM,SACtF,CACG,OAAON,EAASC,YAEvB"}
|
|
1
|
+
{"version":3,"file":"github.js","sources":["../../../src/core/providers/github.ts"],"sourcesContent":["import path from \"path\";\n\nimport { type BranchFiles, type Fetcher } from \"../types/content\";\nimport { BaseProvider } from \"./base\";\nimport { extensionsMap } from \"../data/contents\";\nimport { getFileUrl, normalizePathname } from \"../utils/path-tools\";\n\nexport class GithubProvider extends BaseProvider {\n readonly type = \"remote\";\n\n owner: string;\n\n repo: string;\n\n ref: string;\n\n token?: string;\n\n pathname: string;\n\n fetcher: Fetcher;\n\n constructor(sourceRoot: string, fetcher: Fetcher = fetch, token?: string) {\n super(sourceRoot);\n\n const groups = this.parseUri(sourceRoot);\n if (!groups) {\n throw new Error(`Invalid URI: \"${sourceRoot}\"`);\n }\n\n const { owner, repo, ref = \"main\", pathname = \"\" } = groups;\n this.owner = owner;\n this.repo = repo;\n this.ref = ref;\n this.token = token;\n this.pathname = pathname;\n this.fetcher = fetcher;\n this.filesPromise = this.loadTree(pathname);\n }\n\n async getPageSourcePathname(uri: string) {\n if (this.pathname.endsWith(\".md\") || this.pathname.endsWith(\".mdx\")) {\n return this.pathname;\n }\n const segments = [...(this.pathname?.split(\"/\") || []), ...uri.split(\"/\")].filter(Boolean);\n const fullUri = segments.join(\"/\");\n return super.getPageSourcePathname(uri, fullUri);\n }\n\n async load(uri: string) {\n const pathname = await this.getPageSourcePathname(uri);\n if (!pathname) {\n throw new Error(\n `Can not find md file for \"${uri}\" at \"https://github.com/${this.owner}/${this.repo}/blob/${this.ref}\"`,\n );\n }\n\n const url = new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/contents/${pathname}`);\n const headers = new Headers();\n headers.set(\"Accept\", \"application/vnd.github.raw+json\");\n\n url.searchParams.set(\"ref\", this.ref);\n if (this.token) headers.set(\"Authorization\", `Bearer ${this.token}`);\n\n const resp = await this.fetcher(url.toString(), { headers });\n if (!resp.ok) {\n throw new Error(\n `Can not load \"${uri}\" content from \"https://github.com/${this.owner}/${this.repo}/blob/${this.ref}\": ${resp.statusText}`,\n );\n }\n const content = await resp.text();\n return content;\n }\n\n private async loadTree(pathname?: string) {\n const pathnameClean = pathname?.replace(/^\\//, \"\");\n const url = new URL(\n `https://api.github.com/repos/${this.owner}/${this.repo}/git/trees/${this.ref}?recursive=true`,\n );\n const headers = new Headers();\n headers.set(\"Accept\", \"application/vnd.github.raw+json\");\n\n if (this.token) headers.set(\"Authorization\", `Bearer ${this.token}`);\n\n const resp = await this.fetcher(url.toString(), { headers });\n if (!resp.ok) {\n throw new Error(\"Can not load tree: \" + resp.statusText);\n }\n const data = (await resp.json()) as { tree: { path: string }[] };\n\n const fileTree = data.tree.reduce<BranchFiles>(\n (acc, item) => {\n if (!pathnameClean || (pathnameClean && item.path.startsWith(pathnameClean))) {\n if (item.path.match(/\\.(md|mdx)$/)) {\n const clientUrl = getFileUrl(item.path);\n const origClientPath = normalizePathname(clientUrl.substring(pathnameClean?.length || 0));\n const clientPath = origClientPath.replace(/\\/[0-9]+[-_](.)/g, \"/$1\");\n\n acc.docs.push({\n origPath: \"/\" + item.path,\n clientPath,\n origClientPath,\n });\n } else if (item.path.endsWith(\"structure.json\")) {\n acc.structures.push(item.path);\n }\n }\n return acc;\n },\n { docs: [], structures: [] },\n );\n fileTree.docs.sort((a, b) => a.origClientPath.localeCompare(b.origClientPath));\n this.filesPromise = fileTree;\n return fileTree;\n }\n\n private parseUri(uri: string) {\n const match = uri.match(\n /^https:\\/\\/github.com\\/(?<owner>[^/]+)\\/(?<repo>[^/]+)(?:\\/(blob|tree)\\/(?<ref>[^/]+)(?<pathname>\\/.*)|\\/)?$/,\n );\n const groups = match?.groups;\n return groups || null;\n }\n\n async getEditUri(uri: string) {\n const pathname = await this.getPageSourcePathname(uri);\n if (!pathname) {\n return null;\n }\n\n return `https://github.com/${this.owner}/${this.repo}/edit/${this.ref}${pathname}`;\n }\n\n async getLastModifiedDate(uri: string) {\n const pathname = await this.getPageSourcePathname(uri);\n if (!pathname) {\n return null;\n }\n\n const url = new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/commits?page=1&per_page=1`);\n url.searchParams.set(\"path\", pathname);\n url.searchParams.set(\"sha\", this.ref);\n\n const headers = new Headers();\n if (this.token) headers.set(\"Authorization\", `Bearer ${this.token}`);\n\n const resp = await fetch(url, { headers });\n if (!resp.ok) {\n throw new Error(\n `Can not load last modified date for \"${uri}\" from \"https://github.com/${this.owner}/${this.repo}/blob/${this.ref}\": ${resp.statusText}`,\n );\n }\n\n const data = await resp.json();\n return data[0].commit.committer.date;\n }\n\n async getFileSrc(uri: string, href: string) {\n if (href.match(/https?:\\/\\//)) return href;\n\n const filePath = href.startsWith(\"/\") ? href : uri.replace(/\\/$/, \"\") + \"/\" + href;\n const url = new URL(`https://api.github.com/repos/${this.owner}/${this.repo}/contents${filePath}`);\n url.searchParams.set(\"ref\", this.ref);\n\n const headers = new Headers();\n if (this.token) headers.set(\"Authorization\", `Bearer ${this.token}`);\n\n const resp = await this.fetcher(url.toString(), { headers });\n\n if (!resp.ok) {\n throw new Error(\"Can not load asset: \" + resp.statusText);\n }\n\n const fileData = await resp.json();\n const srcUrl = new URL(fileData.download_url);\n\n if (srcUrl.searchParams.get(\"token\")) {\n const { ext } = path.parse(filePath);\n return `data:${extensionsMap[ext as keyof typeof extensionsMap]};base64,${fileData.content}`;\n } else {\n return fileData.download_url;\n }\n }\n}\n"],"names":["GithubProvider","BaseProvider","type","owner","repo","ref","token","pathname","fetcher","constructor","sourceRoot","fetch","super","groups","this","parseUri","Error","filesPromise","loadTree","getPageSourcePathname","uri","endsWith","fullUri","split","filter","Boolean","join","load","url","URL","headers","Headers","set","searchParams","resp","toString","ok","statusText","text","pathnameClean","replace","fileTree","json","tree","reduce","acc","item","path","startsWith","match","clientUrl","getFileUrl","origClientPath","normalizePathname","substring","length","clientPath","docs","push","origPath","structures","sort","a","b","localeCompare","getEditUri","getLastModifiedDate","commit","committer","date","getFileSrc","href","filePath","fileData","download_url","get","ext","parse","extensionsMap","content"],"mappings":"4LAOM,MAAOA,UAAuBC,EACvBC,KAAO,SAEhBC,MAEAC,KAEAC,IAEAC,MAEAC,SAEAC,QAEA,WAAAC,CAAYC,EAAoBF,EAAmBG,MAAOL,GACtDM,MAAMF,GAEN,MAAMG,EAASC,KAAKC,SAASL,GAC7B,IAAKG,EACD,MAAM,IAAIG,MAAM,iBAAiBN,MAGrC,MAAMP,MAAEA,EAAKC,KAAEA,EAAIC,IAAEA,EAAM,OAAME,SAAEA,EAAW,IAAOM,EACrDC,KAAKX,MAAQA,EACbW,KAAKV,KAAOA,EACZU,KAAKT,IAAMA,EACXS,KAAKR,MAAQA,EACbQ,KAAKP,SAAWA,EAChBO,KAAKN,QAAUA,EACfM,KAAKG,aAAeH,KAAKI,SAASX,EACtC,CAEA,2BAAMY,CAAsBC,GACxB,GAAIN,KAAKP,SAASc,SAAS,QAAUP,KAAKP,SAASc,SAAS,QACxD,OAAOP,KAAKP,SAEhB,MACMe,EADW,IAAKR,KAAKP,UAAUgB,MAAM,MAAQ,MAAQH,EAAIG,MAAM,MAAMC,OAAOC,SACzDC,KAAK,KAC9B,OAAOd,MAAMO,sBAAsBC,EAAKE,EAC5C,CAEA,UAAMK,CAAKP,GACP,MAAMb,QAAiBO,KAAKK,sBAAsBC,GAClD,IAAKb,EACD,MAAM,IAAIS,MACN,6BAA6BI,6BAA+BN,KAAKX,SAASW,KAAKV,aAAaU,KAAKT,QAIzG,MAAMuB,EAAM,IAAIC,IAAI,gCAAgCf,KAAKX,SAASW,KAAKV,iBAAiBG,KAClFuB,EAAU,IAAIC,QACpBD,EAAQE,IAAI,SAAU,mCAEtBJ,EAAIK,aAAaD,IAAI,MAAOlB,KAAKT,KAC7BS,KAAKR,OAAOwB,EAAQE,IAAI,gBAAiB,UAAUlB,KAAKR,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lD,MAAMoC,QAAiBvC,EAAKQ,OAG5B,GAFe,IAAIb,IAAI4C,EAASC,cAErBzC,aAAa0C,IAAI,SAAU,CAClC,MAAMC,IAAEA,GAAQ7B,EAAK8B,MAAML,GAC3B,MAAO,QAAQM,EAAcF,aAA6CH,EAASM,SACvF,CACI,OAAON,EAASC,YAExB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/core/types/content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../../src/core/types/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,UAAU,GAAG;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IAErB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;CAC7E,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC;AAE1F,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,QAAQ,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;AAEjG,MAAM,MAAM,aAAa,GAAG;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;AAE9B,MAAM,MAAM,IAAI,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/content-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEpC,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"content-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/content-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEpC,eAAO,MAAM,cAAc,GAAI,OAAO,KAAK,KAAG,MAgB7C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t=n=>n?"tokens"in n?n.tokens?.map(
|
|
1
|
+
const t=n=>n?"tokens"in n?n.tokens?.map(n=>t(n)).join("")||"":"text"in n?n.text:"raw"in n?n.raw:"":"";export{t as parseTokenText};
|
|
2
2
|
//# sourceMappingURL=content-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-tools.js","sources":["../../../src/core/utils/content-tools.ts"],"sourcesContent":["import { type Token } from \"marked\";\n\nexport const parseTokenText = (token: Token): string => {\n if (!token) return \"\";\n\n if (\"tokens\" in token) {\n return token.tokens?.map((el) => parseTokenText(el)).join(\"\") || \"\";\n }\n\n if (\"text\" in token) {\n return token.text;\n }\n\n if (\"raw\" in token) {\n return token.raw;\n }\n\n return \"\";\n};\n"],"names":["parseTokenText","token","tokens","map","el","join","text","raw"],"mappings":"
|
|
1
|
+
{"version":3,"file":"content-tools.js","sources":["../../../src/core/utils/content-tools.ts"],"sourcesContent":["import { type Token } from \"marked\";\n\nexport const parseTokenText = (token: Token): string => {\n if (!token) return \"\";\n\n if (\"tokens\" in token) {\n return token.tokens?.map((el) => parseTokenText(el)).join(\"\") || \"\";\n }\n\n if (\"text\" in token) {\n return token.text;\n }\n\n if (\"raw\" in token) {\n return token.raw;\n }\n\n return \"\";\n};\n"],"names":["parseTokenText","token","tokens","map","el","join","text","raw"],"mappings":"AAEO,MAAMA,EAAkBC,GACtBA,EAED,WAAYA,EACLA,EAAMC,QAAQC,IAAKC,GAAOJ,EAAeI,IAAKC,KAAK,KAAO,GAGjE,SAAUJ,EACHA,EAAMK,KAGb,QAASL,EACFA,EAAMM,IAGV,GAdY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-base-searcher.d.ts","sourceRoot":"","sources":["../../../src/core/utils/create-base-searcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"create-base-searcher.d.ts","sourceRoot":"","sources":["../../../src/core/utils/create-base-searcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,GAC1B,WAAW,MAAM,KAAG,QAUpB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const r=r=>(t,n)=>{const o=new URLSearchParams([["s",t]]);return fetch(`${r}?${o.toString()}`,{signal:n.signal}).then(
|
|
1
|
+
const r=r=>(t,n)=>{const o=new URLSearchParams([["s",t]]);return fetch(`${r}?${o.toString()}`,{signal:n.signal}).then(r=>r.json()).catch(r=>{if("AbortError"!==r.name)throw r})};export{r as createBaseSearcher};
|
|
2
2
|
//# sourceMappingURL=create-base-searcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-base-searcher.js","sources":["../../../src/core/utils/create-base-searcher.ts"],"sourcesContent":["import { type Searcher } from \"../types/search\";\n\nexport const createBaseSearcher =\n (searchUri: string): Searcher =>\n (search: string, abortController: AbortController) => {\n const qs = new URLSearchParams([[\"s\", search]]);\n return fetch(`${searchUri}?${qs.toString()}`, { signal: abortController.signal })\n .then((response) => response.json())\n .catch((error) => {\n if (error.name !== \"AbortError\") {\n throw error;\n }\n });\n };\n"],"names":["createBaseSearcher","searchUri","search","abortController","qs","URLSearchParams","fetch","toString","signal","then","response","json","catch","error","name"],"mappings":"AAEO,MAAMA,EACRC,GACD,CAACC,EAAgBC,KACb,MAAMC,EAAK,IAAIC,gBAAgB,CAAC,CAAC,IAAKH,KACtC,OAAOI,MAAM,GAAGL,KAAaG,EAAGG,aAAc,CAAEC,OAAQL,EAAgBK,SACnEC,
|
|
1
|
+
{"version":3,"file":"create-base-searcher.js","sources":["../../../src/core/utils/create-base-searcher.ts"],"sourcesContent":["import { type Searcher } from \"../types/search\";\n\nexport const createBaseSearcher =\n (searchUri: string): Searcher =>\n (search: string, abortController: AbortController) => {\n const qs = new URLSearchParams([[\"s\", search]]);\n return fetch(`${searchUri}?${qs.toString()}`, { signal: abortController.signal })\n .then((response) => response.json())\n .catch((error) => {\n if (error.name !== \"AbortError\") {\n throw error;\n }\n });\n };\n"],"names":["createBaseSearcher","searchUri","search","abortController","qs","URLSearchParams","fetch","toString","signal","then","response","json","catch","error","name"],"mappings":"AAEO,MAAMA,EACRC,GACD,CAACC,EAAgBC,KACb,MAAMC,EAAK,IAAIC,gBAAgB,CAAC,CAAC,IAAKH,KACtC,OAAOI,MAAM,GAAGL,KAAaG,EAAGG,aAAc,CAAEC,OAAQL,EAAgBK,SACnEC,KAAMC,GAAaA,EAASC,QAC5BC,MAAOC,IACJ,GAAmB,eAAfA,EAAMC,KACN,MAAMD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-provider.d.ts","sourceRoot":"","sources":["../../../src/core/utils/detect-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElE,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"detect-provider.d.ts","sourceRoot":"","sources":["../../../src/core/utils/detect-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElE,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,sDASzC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detect-provider.js","sources":["../../../src/core/utils/detect-provider.ts"],"sourcesContent":["import { GithubProvider, FileSystemProvider } from \"../providers\";\n\nexport const detectProvider = (uri: string) => {\n if (uri.startsWith(\"https://github.com/\")) {\n return GithubProvider;\n }\n if (uri.match(/https?:\\/\\//)) {\n throw new Error(`Unknown uri \"${uri}\". Please use custom provider or create issue`);\n }\n\n return FileSystemProvider;\n};\n"],"names":["detectProvider","uri","startsWith","GithubProvider","match","Error","FileSystemProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"detect-provider.js","sources":["../../../src/core/utils/detect-provider.ts"],"sourcesContent":["import { GithubProvider, FileSystemProvider } from \"../providers\";\n\nexport const detectProvider = (uri: string) => {\n if (uri.startsWith(\"https://github.com/\")) {\n return GithubProvider;\n }\n if (uri.match(/https?:\\/\\//)) {\n throw new Error(`Unknown uri \"${uri}\". Please use custom provider or create issue`);\n }\n\n return FileSystemProvider;\n};\n"],"names":["detectProvider","uri","startsWith","GithubProvider","match","Error","FileSystemProvider"],"mappings":"yHAEO,MAAMA,EAAkBC,IAC3B,GAAIA,EAAIC,WAAW,uBACf,OAAOC,EAEX,GAAIF,EAAIG,MAAM,eACV,MAAM,IAAIC,MAAM,gBAAgBJ,kDAGpC,OAAOK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-configuration.d.ts","sourceRoot":"","sources":["../../../src/core/utils/get-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"get-configuration.d.ts","sourceRoot":"","sources":["../../../src/core/utils/get-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,GAAI,sBAAsB,aAAa,EAAE,wBAAuB,aAAkB;;;;;;;CAmC9G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-configuration.js","sources":["../../../src/core/utils/get-configuration.ts"],"sourcesContent":["import { type Configuration } from \"../types/content\";\nimport { detectProvider } from \"./detect-provider\";\n\nexport const getConfiguration = (currentConfiguration: Configuration, previousConfiguration: Configuration = {}) => {\n let basePath = previousConfiguration.basePath;\n let gitToken = previousConfiguration.gitToken;\n let spreadedLevel = previousConfiguration.spreadedLevel;\n let sourceRoot = previousConfiguration.sourceRoot;\n let fetcher = previousConfiguration.fetcher || fetch;\n let provider = previousConfiguration.provider;\n\n if (currentConfiguration.basePath) {\n basePath = currentConfiguration.basePath;\n }\n if (currentConfiguration.gitToken) {\n gitToken = currentConfiguration.gitToken;\n }\n if (currentConfiguration.spreadedLevel !== undefined) {\n spreadedLevel = currentConfiguration.spreadedLevel;\n }\n if (currentConfiguration.sourceRoot !== undefined) {\n sourceRoot = currentConfiguration.sourceRoot;\n }\n if (currentConfiguration.fetcher !== undefined) {\n fetcher = currentConfiguration.fetcher || fetch;\n }\n if (currentConfiguration.provider) {\n provider = currentConfiguration.provider;\n } else if (\n (currentConfiguration.sourceRoot && currentConfiguration.sourceRoot !== previousConfiguration.sourceRoot) ||\n !provider\n ) {\n if (sourceRoot) {\n const Provider = currentConfiguration.provider || detectProvider(sourceRoot);\n provider = new Provider(sourceRoot, fetcher, gitToken);\n }\n }\n return { sourceRoot, provider, basePath, gitToken, fetcher, spreadedLevel };\n};\n"],"names":["getConfiguration","currentConfiguration","previousConfiguration","basePath","gitToken","spreadedLevel","sourceRoot","fetcher","fetch","provider","undefined","detectProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-configuration.js","sources":["../../../src/core/utils/get-configuration.ts"],"sourcesContent":["import { type Configuration } from \"../types/content\";\nimport { detectProvider } from \"./detect-provider\";\n\nexport const getConfiguration = (currentConfiguration: Configuration, previousConfiguration: Configuration = {}) => {\n let basePath = previousConfiguration.basePath;\n let gitToken = previousConfiguration.gitToken;\n let spreadedLevel = previousConfiguration.spreadedLevel;\n let sourceRoot = previousConfiguration.sourceRoot;\n let fetcher = previousConfiguration.fetcher || fetch;\n let provider = previousConfiguration.provider;\n\n if (currentConfiguration.basePath) {\n basePath = currentConfiguration.basePath;\n }\n if (currentConfiguration.gitToken) {\n gitToken = currentConfiguration.gitToken;\n }\n if (currentConfiguration.spreadedLevel !== undefined) {\n spreadedLevel = currentConfiguration.spreadedLevel;\n }\n if (currentConfiguration.sourceRoot !== undefined) {\n sourceRoot = currentConfiguration.sourceRoot;\n }\n if (currentConfiguration.fetcher !== undefined) {\n fetcher = currentConfiguration.fetcher || fetch;\n }\n if (currentConfiguration.provider) {\n provider = currentConfiguration.provider;\n } else if (\n (currentConfiguration.sourceRoot && currentConfiguration.sourceRoot !== previousConfiguration.sourceRoot) ||\n !provider\n ) {\n if (sourceRoot) {\n const Provider = currentConfiguration.provider || detectProvider(sourceRoot);\n provider = new Provider(sourceRoot, fetcher, gitToken);\n }\n }\n return { sourceRoot, provider, basePath, gitToken, fetcher, spreadedLevel };\n};\n"],"names":["getConfiguration","currentConfiguration","previousConfiguration","basePath","gitToken","spreadedLevel","sourceRoot","fetcher","fetch","provider","undefined","detectProvider"],"mappings":"sDAGO,MAAMA,EAAmB,CAACC,EAAqCC,EAAuC,MACzG,IAAIC,EAAWD,EAAsBC,SACjCC,EAAWF,EAAsBE,SACjCC,EAAgBH,EAAsBG,cACtCC,EAAaJ,EAAsBI,WACnCC,EAAUL,EAAsBK,SAAWC,MAC3CC,EAAWP,EAAsBO,SAiBrC,GAfIR,EAAqBE,WACrBA,EAAWF,EAAqBE,UAEhCF,EAAqBG,WACrBA,EAAWH,EAAqBG,eAEOM,IAAvCT,EAAqBI,gBACrBA,EAAgBJ,EAAqBI,oBAEDK,IAApCT,EAAqBK,aACrBA,EAAaL,EAAqBK,iBAEDI,IAAjCT,EAAqBM,UACrBA,EAAUN,EAAqBM,SAAWC,OAE1CP,EAAqBQ,SACrBA,EAAWR,EAAqBQ,cAC7B,IACFR,EAAqBK,YAAcL,EAAqBK,aAAeJ,EAAsBI,aAC7FG,IAEGH,EAAY,CAEZG,EAAW,IADMR,EAAqBQ,UAAYE,EAAeL,IACzCA,EAAYC,EAASH,EACjD,CAEJ,MAAO,CAAEE,aAAYG,WAAUN,WAAUC,WAAUG,UAASF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-metadata.d.ts","sourceRoot":"","sources":["../../../src/core/utils/get-metadata.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,KAAK,kBAAkB,GACjB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GAC7D;IAAE,GAAG,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"get-metadata.d.ts","sourceRoot":"","sources":["../../../src/core/utils/get-metadata.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,KAAK,kBAAkB,GACjB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GAC7D;IAAE,GAAG,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,eAAO,MAAM,WAAW,GAAU,MAAM,kBAAkB,oCAsCzD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"gray-matter";import{lexer as o}from"marked";import{
|
|
1
|
+
import t from"gray-matter";import{lexer as o}from"marked";import{setProperty as r}from"dot-prop";import{loadContent as e}from"./load-content.js";import{parseTokenText as n}from"./content-tools.js";const i=async i=>{const{uri:a,provider:s,content:c}=i,{data:d}=a?await e(a,s):{data:c};if(!d)throw new Error("Robindoc: Please provide content or valid URI");const{content:p,data:m}=t(d),f=o(p),l=Object.entries(f.links).reduce((t,o)=>{const[e,n]=o,i=n.title,a=e.startsWith("robin.")&&e.substring(6);return i&&a&&r(t,a,i),t},m);if(!l.title){const t=f.find(t=>"heading"===t.type&&1===t.depth);t?.text&&(l.title=n(t))}if(!l.description){const t=f.find(t=>"paragraph"===t.type);t?.text&&(l.description=n(t))}return l};export{i as getMetadata};
|
|
2
2
|
//# sourceMappingURL=get-metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-metadata.js","sources":["../../../src/core/utils/get-metadata.ts"],"sourcesContent":["import matter from \"gray-matter\";\nimport { lexer, Tokens } from \"marked\";\nimport {
|
|
1
|
+
{"version":3,"file":"get-metadata.js","sources":["../../../src/core/utils/get-metadata.ts"],"sourcesContent":["import matter from \"gray-matter\";\nimport { lexer, Tokens } from \"marked\";\nimport { setProperty } from \"dot-prop\";\n\nimport { type BaseProvider } from \"../providers/base\";\nimport { loadContent } from \"./load-content\";\nimport { parseTokenText } from \"./content-tools\";\n\ntype GetMetadataOptions =\n | { uri: string; provider?: BaseProvider; content?: undefined }\n | { uri?: undefined; provider?: undefined; content: string };\n\nexport const getMetadata = async (opts: GetMetadataOptions) => {\n const { uri, provider, content } = opts;\n const { data } = uri ? await loadContent(uri, provider) : { data: content };\n\n if (!data) {\n throw new Error(\"Robindoc: Please provide content or valid URI\");\n }\n\n const { content: matterContent, data: matterData } = matter(data);\n const tree = lexer(matterContent);\n\n const robinData = Object.entries(tree.links).reduce<Record<string, string>>((acc, cur) => {\n const [key, value] = cur;\n const content = value.title;\n const metaKey = key.startsWith(\"robin.\") && key.substring(6);\n\n if (content && metaKey) {\n setProperty(acc, metaKey, content);\n }\n\n return acc;\n }, matterData);\n\n if (!robinData.title) {\n const pageHeading = tree.find((el) => el.type === \"heading\" && el.depth === 1) as Tokens.Heading | undefined;\n if (pageHeading?.text) {\n robinData.title = parseTokenText(pageHeading);\n }\n }\n\n if (!robinData.description) {\n const firstParagraph = tree.find((el) => el.type === \"paragraph\") as Tokens.Heading | undefined;\n if (firstParagraph?.text) {\n robinData.description = parseTokenText(firstParagraph);\n }\n }\n\n return robinData;\n};\n"],"names":["getMetadata","async","opts","uri","provider","content","data","loadContent","Error","matterContent","matterData","matter","tree","lexer","robinData","Object","entries","links","reduce","acc","cur","key","value","title","metaKey","startsWith","substring","setProperty","pageHeading","find","el","type","depth","text","parseTokenText","description","firstParagraph"],"mappings":"2MAYaA,EAAcC,MAAOC,IAC9B,MAAMC,IAAEA,EAAGC,SAAEA,EAAQC,QAAEA,GAAYH,GAC7BI,KAAEA,GAASH,QAAYI,EAAYJ,EAAKC,GAAY,CAAEE,KAAMD,GAElE,IAAKC,EACD,MAAM,IAAIE,MAAM,iDAGpB,MAAQH,QAASI,EAAeH,KAAMI,GAAeC,EAAOL,GACtDM,EAAOC,EAAMJ,GAEbK,EAAYC,OAAOC,QAAQJ,EAAKK,OAAOC,OAA+B,CAACC,EAAKC,KAC9E,MAAOC,EAAKC,GAASF,EACff,EAAUiB,EAAMC,MAChBC,EAAUH,EAAII,WAAW,WAAaJ,EAAIK,UAAU,GAM1D,OAJIrB,GAAWmB,GACXG,EAAYR,EAAKK,EAASnB,GAGvBc,GACRT,GAEH,IAAKI,EAAUS,MAAO,CAClB,MAAMK,EAAchB,EAAKiB,KAAMC,GAAmB,YAAZA,EAAGC,MAAmC,IAAbD,EAAGE,OAC9DJ,GAAaK,OACbnB,EAAUS,MAAQW,EAAeN,GAEzC,CAEA,IAAKd,EAAUqB,YAAa,CACxB,MAAMC,EAAiBxB,EAAKiB,KAAMC,GAAmB,cAAZA,EAAGC,MACxCK,GAAgBH,OAChBnB,EAAUqB,YAAcD,EAAeE,GAE/C,CAEA,OAAOtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/git-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"git-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/git-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM;;;;;;;;;CAQxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-tools.js","sources":["../../../src/core/utils/git-tools.ts"],"sourcesContent":["export const detectGitType = (uri: string) => {\n if (uri.match(/^https?:\\/\\/github.com/)) {\n return { name: \"GitHub\", key: \"github\" } as const;\n } else if (uri.match(/^https?:\\/\\/gitlab.com/)) {\n return { name: \"GitLab\", key: \"gitlab\" } as const;\n } else {\n return { name: \"Git\", key: \"git\" } as const;\n }\n};\n"],"names":["detectGitType","uri","match","name","key"],"mappings":"
|
|
1
|
+
{"version":3,"file":"git-tools.js","sources":["../../../src/core/utils/git-tools.ts"],"sourcesContent":["export const detectGitType = (uri: string) => {\n if (uri.match(/^https?:\\/\\/github.com/)) {\n return { name: \"GitHub\", key: \"github\" } as const;\n } else if (uri.match(/^https?:\\/\\/gitlab.com/)) {\n return { name: \"GitLab\", key: \"gitlab\" } as const;\n } else {\n return { name: \"Git\", key: \"git\" } as const;\n }\n};\n"],"names":["detectGitType","uri","match","name","key"],"mappings":"AAAO,MAAMA,EAAiBC,GACtBA,EAAIC,MAAM,0BACH,CAAEC,KAAM,SAAUC,IAAK,UACvBH,EAAIC,MAAM,0BACV,CAAEC,KAAM,SAAUC,IAAK,UAEvB,CAAED,KAAM,MAAOC,IAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-robindoc.d.ts","sourceRoot":"","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AACjH,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AAEjH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAOpD,KAAK,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IACtG,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAUnD,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"initialize-robindoc.d.ts","sourceRoot":"","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AACjH,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AAEjH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAOpD,KAAK,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IACtG,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAUnD,eAAO,MAAM,kBAAkB,GAAI,mBAAmB,SAAS,GAAG,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;;;sBAmDrE,CAAC,SAAS,MAAM,wBACnC,MAAM,qBACI,CAAC;4BAiBc,MAAM;4BAgBN,MAAM;;;;mCAeC,MAAM;CAarD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"react";import{Article as e}from"../../components/elements/article/index.js";import{Sidebar as r}from"../../components/elements/sidebar/index.js";import{parseStructure as a}from"./parse-structure.js";import{getConfiguration as n}from"./get-configuration.js";import{getMetadata as i}from"./get-metadata.js";import{normalizePathname as o,removeTrailingSlash as s}from"./path-tools.js";import{loadContent as c}from"./load-content.js";const u=u=>{const p=(async t=>"function"==typeof t?t():t)(u).then(
|
|
1
|
+
import t from"react";import{Article as e}from"../../components/elements/article/index.js";import{Sidebar as r}from"../../components/elements/sidebar/index.js";import{parseStructure as a}from"./parse-structure.js";import{getConfiguration as n}from"./get-configuration.js";import{getMetadata as i}from"./get-metadata.js";import{normalizePathname as o,removeTrailingSlash as s}from"./path-tools.js";import{loadContent as c}from"./load-content.js";const u=u=>{const p=(async t=>"function"==typeof t?t():t)(u).then(t=>a(t.items||[],n(t.configuration||{})));return{Page:async({pathname:r,...a})=>{const{pages:n}=await p,i=o(r),s=n[i];if(!s)throw new Error(`Can not find data for "${i}". Please check structure`);const c=Object.keys(n),u=c.indexOf(i),m=c[u-1],f=u<c.length-1&&c[u+1],d=m&&{pathname:m,title:n[m].title},g=f&&{pathname:f,title:n[f].title},l=s.crumbs.map(t=>({title:n[t].title,pathname:t})),h=Object.entries(n).reduce((t,[e,{origPath:r}])=>(r&&t.push({clientPath:e,origPath:r}),t),[]);return t.createElement(e,{pathname:i,provider:s.configuration.provider,uri:s.uri,title:s.title,breadcrumbs:l,prev:d||void 0,next:g||void 0,pages:h,...a})},Sidebar:async e=>{const{tree:a}=await p;return t.createElement(r,{tree:a,...e})},getStaticParams:async(t="",e="segments")=>{const{pages:r}=await p,a=Object.keys(r),n=s(t);return a.reduce((t,r)=>r.startsWith(n)?(t.push({[e]:r.substring(n.length+1).split("/")}),t):t,[])},getMetadata:async t=>{const{pages:e}=await p,r=o(t),a=e[r];if(!a)throw new Error(`Can not find data for "${r}". Please check structure`);return await i({uri:a.uri,provider:a.configuration.provider})},getPageData:async t=>{const{pages:e}=await p,r=o(t),a=e[r];if(!a)throw new Error(`Can not find data for "${r}". Please check structure`);const n=a.title,{data:i}=await c(a.uri,a.configuration.provider);return{title:n,raw:i}},getPageInstruction:async t=>{const{pages:e}=await p,r=o(t),a=e[r];if(!a)throw new Error(`Can not find data for "${r}". Please check structure`);return a}}};export{u as initializeRobindoc};
|
|
2
2
|
//# sourceMappingURL=initialize-robindoc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-robindoc.js","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { Article as ArticleBase, type ArticleProps as ArticlePropsBase } from \"@src/components/elements/article\";\nimport { Sidebar as SidebarBase, type SidebarProps as SidebarPropsBase } from \"@src/components/elements/sidebar\";\n\nimport { type Structure } from \"../types/structure\";\nimport { parseStructure } from \"./parse-structure\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMetadata as getMetadataBase } from \"./get-metadata\";\nimport { normalizePathname, removeTrailingSlash } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\ntype PageProps = Omit<Partial<ArticlePropsBase>, \"uri\" | \"content\" | \"provider\" | \"pathname\" | \"pages\"> & {\n pathname: string;\n};\n\ntype SidebarProps = Omit<SidebarPropsBase, \"tree\">;\n\nconst loadStructure = async (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {\n if (typeof structureTemplate === \"function\") {\n return structureTemplate();\n } else {\n return structureTemplate;\n }\n};\n\nexport const initializeRobindoc = (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {\n const structureParsedPromise = loadStructure(structureTemplate).then((structure) =>\n parseStructure(structure.items || [], getConfiguration(structure.configuration || {})),\n );\n\n const Page: React.FC<PageProps> = async ({ pathname, ...props }) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const paths = Object.keys(pages);\n const targetPageIndex = paths.indexOf(pathnameNormalized);\n const prevPagePathname = paths[targetPageIndex - 1];\n const nextPagePathname = targetPageIndex < paths.length - 1 && paths[targetPageIndex + 1];\n const prev = prevPagePathname && { pathname: prevPagePathname, title: pages[prevPagePathname].title };\n const next = nextPagePathname && { pathname: nextPagePathname, title: pages[nextPagePathname].title };\n\n const breadcrumbs = pageInstruction.crumbs.map((crumb) => ({ title: pages[crumb].title, pathname: crumb }));\n const clientPages = Object.entries(pages).reduce<{ clientPath: string; origPath: string }[]>(\n (acc, [clientPath, { origPath }]) => {\n if (origPath) acc.push({ clientPath, origPath });\n return acc;\n },\n [],\n );\n\n return (\n <ArticleBase\n pathname={pathnameNormalized}\n provider={pageInstruction.configuration.provider}\n uri={pageInstruction.uri}\n title={pageInstruction.title}\n breadcrumbs={breadcrumbs}\n prev={prev || undefined}\n next={next || undefined}\n pages={clientPages}\n {...props}\n />\n );\n };\n\n const Sidebar: React.FC<SidebarProps> = async (props) => {\n const { tree } = await structureParsedPromise;\n\n return <SidebarBase tree={tree} {...props} />;\n };\n\n const getStaticParams = async <T extends string = \"segments\">(\n prefix: string = \"\",\n segmentsParamKey: T = \"segments\" as T,\n ) => {\n const { pages } = await structureParsedPromise;\n const pagesArr = Object.keys(pages);\n const prefixWithoutTrailingSlash = removeTrailingSlash(prefix);\n\n return pagesArr.reduce<Record<T, string[]>[]>((acc, cur) => {\n if (!cur.startsWith(prefixWithoutTrailingSlash)) return acc;\n\n acc.push({\n [segmentsParamKey]: cur.substring(prefixWithoutTrailingSlash.length + 1).split(\"/\"),\n } as Record<T, string[]>);\n\n return acc;\n }, []);\n };\n\n const getMetadata = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const metadata = await getMetadataBase({\n uri: pageInstruction.uri,\n provider: pageInstruction.configuration.provider,\n });\n return metadata;\n };\n\n const getPageData = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const title = pageInstruction.title;\n const { data } = await loadContent(pageInstruction.uri, pageInstruction.configuration.provider);\n\n return { title, raw: data };\n };\n\n const getPageInstruction = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n return pageInstruction;\n };\n\n return { Page, Sidebar, getStaticParams, getMetadata, getPageData, getPageInstruction };\n};\n"],"names":["initializeRobindoc","structureTemplate","structureParsedPromise","async","loadStructure","then","structure","parseStructure","items","getConfiguration","configuration","Page","pathname","props","pages","pathnameNormalized","normalizePathname","pageInstruction","Error","paths","Object","keys","targetPageIndex","indexOf","prevPagePathname","nextPagePathname","length","prev","title","next","breadcrumbs","crumbs","map","crumb","clientPages","entries","reduce","acc","clientPath","origPath","push","React","ArticleBase","provider","uri","undefined","Sidebar","tree","createElement","SidebarBase","getStaticParams","prefix","segmentsParamKey","pagesArr","prefixWithoutTrailingSlash","removeTrailingSlash","cur","startsWith","substring","split","getMetadata","getMetadataBase","getPageData","data","loadContent","raw","getPageInstruction"],"mappings":"4bAkBA,MAQaA,EAAsBC,IAC/B,MAAMC,EATYC,OAAOF,GACQ,mBAAtBA,EACAA,IAEAA,EAKoBG,CAAcH,GAAmBI,
|
|
1
|
+
{"version":3,"file":"initialize-robindoc.js","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { Article as ArticleBase, type ArticleProps as ArticlePropsBase } from \"@src/components/elements/article\";\nimport { Sidebar as SidebarBase, type SidebarProps as SidebarPropsBase } from \"@src/components/elements/sidebar\";\n\nimport { type Structure } from \"../types/structure\";\nimport { parseStructure } from \"./parse-structure\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMetadata as getMetadataBase } from \"./get-metadata\";\nimport { normalizePathname, removeTrailingSlash } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\ntype PageProps = Omit<Partial<ArticlePropsBase>, \"uri\" | \"content\" | \"provider\" | \"pathname\" | \"pages\"> & {\n pathname: string;\n};\n\ntype SidebarProps = Omit<SidebarPropsBase, \"tree\">;\n\nconst loadStructure = async (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {\n if (typeof structureTemplate === \"function\") {\n return structureTemplate();\n } else {\n return structureTemplate;\n }\n};\n\nexport const initializeRobindoc = (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {\n const structureParsedPromise = loadStructure(structureTemplate).then((structure) =>\n parseStructure(structure.items || [], getConfiguration(structure.configuration || {})),\n );\n\n const Page: React.FC<PageProps> = async ({ pathname, ...props }) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const paths = Object.keys(pages);\n const targetPageIndex = paths.indexOf(pathnameNormalized);\n const prevPagePathname = paths[targetPageIndex - 1];\n const nextPagePathname = targetPageIndex < paths.length - 1 && paths[targetPageIndex + 1];\n const prev = prevPagePathname && { pathname: prevPagePathname, title: pages[prevPagePathname].title };\n const next = nextPagePathname && { pathname: nextPagePathname, title: pages[nextPagePathname].title };\n\n const breadcrumbs = pageInstruction.crumbs.map((crumb) => ({ title: pages[crumb].title, pathname: crumb }));\n const clientPages = Object.entries(pages).reduce<{ clientPath: string; origPath: string }[]>(\n (acc, [clientPath, { origPath }]) => {\n if (origPath) acc.push({ clientPath, origPath });\n return acc;\n },\n [],\n );\n\n return (\n <ArticleBase\n pathname={pathnameNormalized}\n provider={pageInstruction.configuration.provider}\n uri={pageInstruction.uri}\n title={pageInstruction.title}\n breadcrumbs={breadcrumbs}\n prev={prev || undefined}\n next={next || undefined}\n pages={clientPages}\n {...props}\n />\n );\n };\n\n const Sidebar: React.FC<SidebarProps> = async (props) => {\n const { tree } = await structureParsedPromise;\n\n return <SidebarBase tree={tree} {...props} />;\n };\n\n const getStaticParams = async <T extends string = \"segments\">(\n prefix: string = \"\",\n segmentsParamKey: T = \"segments\" as T,\n ) => {\n const { pages } = await structureParsedPromise;\n const pagesArr = Object.keys(pages);\n const prefixWithoutTrailingSlash = removeTrailingSlash(prefix);\n\n return pagesArr.reduce<Record<T, string[]>[]>((acc, cur) => {\n if (!cur.startsWith(prefixWithoutTrailingSlash)) return acc;\n\n acc.push({\n [segmentsParamKey]: cur.substring(prefixWithoutTrailingSlash.length + 1).split(\"/\"),\n } as Record<T, string[]>);\n\n return acc;\n }, []);\n };\n\n const getMetadata = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const metadata = await getMetadataBase({\n uri: pageInstruction.uri,\n provider: pageInstruction.configuration.provider,\n });\n return metadata;\n };\n\n const getPageData = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const title = pageInstruction.title;\n const { data } = await loadContent(pageInstruction.uri, pageInstruction.configuration.provider);\n\n return { title, raw: data };\n };\n\n const getPageInstruction = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n return pageInstruction;\n };\n\n return { Page, Sidebar, getStaticParams, getMetadata, getPageData, getPageInstruction };\n};\n"],"names":["initializeRobindoc","structureTemplate","structureParsedPromise","async","loadStructure","then","structure","parseStructure","items","getConfiguration","configuration","Page","pathname","props","pages","pathnameNormalized","normalizePathname","pageInstruction","Error","paths","Object","keys","targetPageIndex","indexOf","prevPagePathname","nextPagePathname","length","prev","title","next","breadcrumbs","crumbs","map","crumb","clientPages","entries","reduce","acc","clientPath","origPath","push","React","ArticleBase","provider","uri","undefined","Sidebar","tree","createElement","SidebarBase","getStaticParams","prefix","segmentsParamKey","pagesArr","prefixWithoutTrailingSlash","removeTrailingSlash","cur","startsWith","substring","split","getMetadata","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kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"load-content.d.ts","sourceRoot":"","sources":["../../../src/core/utils/load-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,WAAW,GAAU,KAAK,MAAM,EAAE,cAAc,YAAY,EAAE,OAAO,MAAM;;;;;;;;;;;;;;;;EA4BvF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-content.js","sources":["../../../src/core/utils/load-content.ts"],"sourcesContent":["import { type BaseProvider } from \"../providers/base\";\nimport { GithubProvider } from \"../providers/github\";\nimport { FileSystemProvider } from \"../providers\";\n\nexport const loadContent = async (uri: string, providerArg?: BaseProvider, root?: string) => {\n if (providerArg) {\n const content = await providerArg.load(uri);\n return { data: content, type: providerArg.type, provider: providerArg };\n }\n\n if (uri.startsWith(\"https://github.com/\")) {\n const provider = new GithubProvider(uri);\n if (provider.pathname) {\n const content = await provider.load(provider.pathname);\n return { data: content, type: \"remote\", provider };\n } else {\n throw new Error(\"Can not load content\");\n }\n }\n\n if (uri.match(/https?:\\/\\//)) {\n const resp = await fetch(uri);\n if (!resp.ok) {\n throw new Error(\"Can not load content\");\n }\n const content = await resp.text();\n return { data: content, type: \"remote\", provider: null };\n }\n\n const provider = new FileSystemProvider(root);\n const content = await provider.load(uri);\n return { data: content, type: \"local\", provider };\n};\n"],"names":["loadContent","async","uri","providerArg","root","data","load","type","provider","startsWith","GithubProvider","pathname","Error","match","resp","fetch","ok","text","FileSystemProvider"],"mappings":"yHAIO,MAAMA,EAAcC,MAAOC,EAAaC,EAA4BC,KACvE,GAAID,EAAa,CAEb,MAAO,CAAEE,WADaF,EAAYG,KAAKJ,GACfK,KAAMJ,EAAYI,KAAMC,SAAUL,
|
|
1
|
+
{"version":3,"file":"load-content.js","sources":["../../../src/core/utils/load-content.ts"],"sourcesContent":["import { type BaseProvider } from \"../providers/base\";\nimport { GithubProvider } from \"../providers/github\";\nimport { FileSystemProvider } from \"../providers\";\n\nexport const loadContent = async (uri: string, providerArg?: BaseProvider, root?: string) => {\n if (providerArg) {\n const content = await providerArg.load(uri);\n return { data: content, type: providerArg.type, provider: providerArg };\n }\n\n if (uri.startsWith(\"https://github.com/\")) {\n const provider = new GithubProvider(uri);\n if (provider.pathname) {\n const content = await provider.load(provider.pathname);\n return { data: content, type: \"remote\", provider };\n } else {\n throw new Error(\"Can not load content\");\n }\n }\n\n if (uri.match(/https?:\\/\\//)) {\n const resp = await fetch(uri);\n if (!resp.ok) {\n throw new Error(\"Can not load content\");\n }\n const content = await resp.text();\n return { data: content, type: \"remote\", provider: null };\n }\n\n const provider = new FileSystemProvider(root);\n const content = await provider.load(uri);\n return { data: content, type: \"local\", provider };\n};\n"],"names":["loadContent","async","uri","providerArg","root","data","load","type","provider","startsWith","GithubProvider","pathname","Error","match","resp","fetch","ok","text","FileSystemProvider"],"mappings":"yHAIO,MAAMA,EAAcC,MAAOC,EAAaC,EAA4BC,KACvE,GAAID,EAAa,CAEb,MAAO,CAAEE,WADaF,EAAYG,KAAKJ,GACfK,KAAMJ,EAAYI,KAAMC,SAAUL,EAC9D,CAEA,GAAID,EAAIO,WAAW,uBAAwB,CACvC,MAAMD,EAAW,IAAIE,EAAeR,GACpC,GAAIM,EAASG,SAAU,CAEnB,MAAO,CAAEN,WADaG,EAASF,KAAKE,EAASG,UACrBJ,KAAM,SAAUC,WAC5C,CACI,MAAM,IAAII,MAAM,uBAExB,CAEA,GAAIV,EAAIW,MAAM,eAAgB,CAC1B,MAAMC,QAAaC,MAAMb,GACzB,IAAKY,EAAKE,GACN,MAAM,IAAIJ,MAAM,wBAGpB,MAAO,CAAEP,WADaS,EAAKG,OACHV,KAAM,SAAUC,SAAU,KACtD,CAEA,MAAMA,EAAW,IAAIU,EAAmBd,GAExC,MAAO,CAAEC,WADaG,EAASF,KAAKJ,GACZK,KAAM,QAASC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-structure.d.ts","sourceRoot":"","sources":["../../../src/core/utils/parse-structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAgPxE,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"parse-structure.d.ts","sourceRoot":"","sources":["../../../src/core/utils/parse-structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAgPxE,eAAO,MAAM,cAAc,GACvB,OAAO,OAAO,EAAE,GAAG,MAAM,EACzB,sBAAqB,aAAkB,EACvC,SAAQ,MAAW,EACnB,WAAU,MAAW,EACrB,eAAc,MAAU;WAjFjB,KAAK;UACN,QAAQ,EAAE;EAyFnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-structure.js","sources":["../../../src/core/utils/parse-structure.ts"],"sourcesContent":["import { type DocItem } from \"../types/structure\";\nimport { type Pages, type Crumbs, type Configuration } from \"../types/content\";\nimport { type TreeItem } from \"../../components/elements/sidebar/types\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMetadata } from \"./get-metadata\";\nimport { generatePseudoTitle, checkIsLinkExternal, mergePathname, normalizePathname } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\nconst parseJSONStructure = async (\n parentConfiguration: Configuration = {},\n parentPathname = \"\",\n crumbs: Crumbs = [],\n nestingLevel: number,\n) => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n if (!parentConfiguration.provider) return { pages, tree };\n\n const branchFiles = await parentConfiguration.provider.filesPromise;\n\n if (branchFiles.structures.includes(`${parentPathname}/structure.json`)) {\n const content = await loadContent(`${parentPathname}/structure.json`, parentConfiguration.provider);\n try {\n const structure: { [segment: string]: { title: string } } = JSON.parse(content.data);\n for (const segment in structure) {\n const data = structure[segment];\n const clientPath = normalizePathname(\n segment === \"index\" ? parentPathname : parentPathname + \"/\" + segment,\n );\n const pathname = mergePathname(parentConfiguration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n if (!checkIsLinkExternal(pathnameNormalized)) {\n const origPath = await parentConfiguration.provider?.getPageSourcePathname(\n clientPath,\n pathnameNormalized,\n );\n if (origPath) {\n pages[pathnameNormalized] = {\n title: data.title,\n uri: clientPath,\n configuration: parentConfiguration,\n origPath,\n crumbs,\n };\n }\n }\n\n let subTree: TreeItem[] | undefined;\n if (segment !== \"index\") {\n const subItemsData = await parseAutoStructure(\n parentConfiguration,\n [...crumbs, pathnameNormalized],\n clientPath,\n nestingLevel + 1,\n );\n subTree = subItemsData.tree;\n Object.assign(pages, subItemsData.pages);\n }\n\n tree.push({\n title: data.title,\n href: pathnameNormalized,\n items: subTree,\n type: \"row\",\n });\n }\n } catch {\n throw new Error(`Can't parse structure \"${parentPathname}/structure.json\"`);\n }\n return { pages, tree };\n }\n};\n\nconst parseAutoStructure = async (\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n parentPathname = \"\",\n nestingLevel: number,\n) => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n if (!parentConfiguration.provider) return { pages, tree };\n\n const branchFiles = await parentConfiguration.provider.filesPromise;\n\n if (branchFiles.structures.includes(`${parentPathname}/structure.json`)) {\n const jsonStructureData = await parseJSONStructure(\n parentConfiguration,\n parentPathname,\n crumbs,\n nestingLevel + 1,\n );\n if (jsonStructureData) {\n return jsonStructureData;\n }\n }\n\n for await (const generatedItem of branchFiles.docs) {\n const linkLevel = generatedItem.clientPath.split(\"/\").filter(Boolean).length;\n const topLevelLink = linkLevel < 2;\n\n if (\n (!parentPathname && !topLevelLink) ||\n (parentPathname &&\n !generatedItem.clientPath.match(new RegExp(`^${parentPathname.replace(/\\/$/, \"\")}/[^/]+$`)))\n ) {\n continue;\n }\n\n const { clientPath } = generatedItem;\n const pathname = mergePathname(parentConfiguration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n const metadata = await getMetadata({ provider: parentConfiguration.provider, uri: clientPath });\n const title = metadata.title || generatePseudoTitle(pathnameNormalized);\n const origPath = await parentConfiguration.provider?.getPageSourcePathname(clientPath, pathnameNormalized);\n if (origPath) {\n pages[pathnameNormalized] = {\n title,\n uri: clientPath,\n configuration: parentConfiguration,\n origPath,\n crumbs,\n };\n }\n\n const subItemsData = await parseAutoStructure(\n parentConfiguration,\n [...crumbs, pathnameNormalized],\n clientPath,\n nestingLevel + 1,\n );\n Object.assign(pages, subItemsData.pages);\n\n if (nestingLevel < (parentConfiguration.spreadedLevel || 1)) {\n tree.push(\n {\n title,\n href: pathnameNormalized,\n type: nestingLevel === 0 ? \"heading\" : \"row\",\n },\n ...subItemsData.tree,\n );\n } else {\n tree.push({\n title,\n href: pathnameNormalized,\n items: subItemsData.tree,\n type: nestingLevel === 0 ? \"heading\" : \"row\",\n });\n }\n }\n\n return { pages, tree };\n};\n\nconst parseStaticStructure = async (\n items: DocItem[],\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n parentPathname: string,\n nestingLevel: number,\n): Promise<{\n pages: Pages;\n tree: TreeItem[];\n}> => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n for await (const item of items) {\n if (typeof item === \"string\") {\n const subItemsData = await parseStructure(item, parentConfiguration, crumbs, parentPathname, nestingLevel);\n Object.assign(pages, subItemsData.pages);\n tree.push(...subItemsData.tree);\n continue;\n }\n if (item.type === \"separator\") {\n tree.push({ type: \"separator\" });\n\n continue;\n }\n let subCrumbs = crumbs;\n const configuration = getConfiguration(item.configuration || {}, parentConfiguration);\n const clientPath = item.href;\n const pathname = mergePathname(configuration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n if (!checkIsLinkExternal(pathnameNormalized) && clientPath) {\n const origPath = await configuration.provider?.getPageSourcePathname(clientPath, pathnameNormalized);\n\n if (origPath) {\n pages[pathnameNormalized] = {\n title: item.title || \"\",\n uri: clientPath,\n configuration,\n origPath,\n crumbs,\n };\n subCrumbs = [...crumbs, pathnameNormalized];\n }\n }\n\n let subTree: TreeItem[] = [];\n if (item.items) {\n const subItemsData = await parseStructure(\n item.items,\n configuration,\n subCrumbs,\n item.href,\n nestingLevel + 1,\n );\n subTree = subItemsData.tree;\n Object.assign(pages, subItemsData.pages);\n }\n\n if (!item.hidden) {\n if (nestingLevel < (parentConfiguration.spreadedLevel || 1)) {\n tree.push(\n {\n title: item.title || generatePseudoTitle(pathnameNormalized),\n href: item.href ? pathnameNormalized : undefined,\n type: item.type,\n },\n ...subTree,\n );\n } else {\n tree.push({\n title: item.title || generatePseudoTitle(pathnameNormalized),\n href: item.href ? pathnameNormalized : undefined,\n items: subTree,\n type: item.type,\n });\n }\n }\n }\n\n return { pages, tree };\n};\n\nexport const parseStructure = async (\n items: DocItem[] | \"auto\",\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n pathname: string = \"\",\n nestingLevel: number = 0,\n) => {\n if (items === \"auto\") {\n const structureParsed = await parseAutoStructure(parentConfiguration, crumbs, pathname, nestingLevel);\n return structureParsed;\n }\n\n const structureParsed = await parseStaticStructure(items, parentConfiguration, crumbs, pathname, nestingLevel);\n return structureParsed;\n};\n"],"names":["parseAutoStructure","async","parentConfiguration","crumbs","parentPathname","nestingLevel","pages","tree","provider","branchFiles","filesPromise","structures","includes","jsonStructureData","content","loadContent","structure","JSON","parse","data","segment","clientPath","normalizePathname","pathname","mergePathname","basePath","pathnameNormalized","checkIsLinkExternal","origPath","getPageSourcePathname","title","uri","configuration","subTree","subItemsData","Object","assign","push","href","items","type","Error","parseJSONStructure","generatedItem","docs","linkLevel","split","filter","Boolean","length","match","RegExp","replace","getMetadata","generatePseudoTitle","spreadedLevel","parseStructure","structureParsed","item","subCrumbs","getConfiguration","hidden","undefined","parseStaticStructure"],"mappings":"mRAQA,MAmEMA,EAAqBC,MACvBC,EAAqC,GACrCC,EAAiB,GACjBC,EAAiB,GACjBC,KAEA,MAAMC,EAAe,CAAA,EACfC,EAAmB,GAEzB,IAAKL,EAAoBM,SAAU,MAAO,CAAEF,QAAOC,QAEnD,MAAME,QAAoBP,EAAoBM,SAASE,aAEvD,GAAID,EAAYE,WAAWC,SAAS,GAAGR,oBAAkC,CACrE,MAAMS,OAjFaZ,OACvBC,EAAqC,GACrCE,EAAiB,GACjBD,EAAiB,GACjBE,KAEA,MAAMC,EAAe,CAAA,EACfC,EAAmB,GAEzB,IAAKL,EAAoBM,SAAU,MAAO,CAAEF,QAAOC,QAInD,UAF0BL,EAAoBM,SAASE,cAEvCC,WAAWC,SAAS,GAAGR,oBAAkC,CACrE,MAAMU,QAAgBC,EAAY,GAAGX,mBAAiCF,EAAoBM,UAC1F,IACI,MAAMQ,EAAsDC,KAAKC,MAAMJ,EAAQK,MAC/E,IAAK,MAAMC,KAAWJ,EAAW,CAC7B,MAAMG,EAAOH,EAAUI,GACjBC,EAAaC,EACH,UAAZF,EAAsBhB,EAAiBA,EAAiB,IAAMgB,GAE5DG,EAAWC,EAActB,EAAoBuB,SAAUJ,GACvDK,EAAqBJ,EAAkBC,GAE7C,IAAKI,EAAoBD,GAAqB,CAC1C,MAAME,QAAiB1B,EAAoBM,UAAUqB,sBACjDR,EACAK,IAEAE,IACAtB,EAAMoB,GAAsB,CACxBI,MAAOX,E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,QAAqBsB,EACvBE,EAAKnB,MACLP,EACA2B,EACAD,EAAKpB,KACLjC,EAAe,GAEnB4B,EAAUC,EAAa3B,KACvB4B,OAAOC,OAAO9B,EAAO4B,EAAa5B,MACrC,CAEIoD,EAAKG,SACFxD,GAAgBH,EAAoBqD,eAAiB,GACrDhD,EAAK8B,KACD,CACIP,MAAO4B,EAAK5B,OAASwB,EAAoB5B,GACzCY,KAAMoB,EAAKpB,KAAOZ,OAAqBoC,EACvCtB,KAAMkB,EAAKlB,SAEZP,GAGP1B,EAAK8B,KAAK,CACNP,MAAO4B,EAAK5B,OAASwB,EAAoB5B,GACzCY,KAAMoB,EAAKpB,KAAOZ,OAAqBoC,EACvCvB,MAAON,EACPO,KAAMkB,EAAKlB,OAI1B,CAED,MAAO,CAAElC,QAAOC,OAAM,EAeQwD,CAAqBxB,EAAOrC,EAAqBC,EAAQoB,EAAUlB,GACjG,OAAOoD,CAAe"}
|
|
1
|
+
{"version":3,"file":"parse-structure.js","sources":["../../../src/core/utils/parse-structure.ts"],"sourcesContent":["import { type DocItem } from \"../types/structure\";\nimport { type Pages, type Crumbs, type Configuration } from \"../types/content\";\nimport { type TreeItem } from \"../../components/elements/sidebar/types\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMetadata } from \"./get-metadata\";\nimport { generatePseudoTitle, checkIsLinkExternal, mergePathname, normalizePathname } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\nconst parseJSONStructure = async (\n parentConfiguration: Configuration = {},\n parentPathname = \"\",\n crumbs: Crumbs = [],\n nestingLevel: number,\n) => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n if (!parentConfiguration.provider) return { pages, tree };\n\n const branchFiles = await parentConfiguration.provider.filesPromise;\n\n if (branchFiles.structures.includes(`${parentPathname}/structure.json`)) {\n const content = await loadContent(`${parentPathname}/structure.json`, parentConfiguration.provider);\n try {\n const structure: { [segment: string]: { title: string } } = JSON.parse(content.data);\n for (const segment in structure) {\n const data = structure[segment];\n const clientPath = normalizePathname(\n segment === \"index\" ? parentPathname : parentPathname + \"/\" + segment,\n );\n const pathname = mergePathname(parentConfiguration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n if (!checkIsLinkExternal(pathnameNormalized)) {\n const origPath = await parentConfiguration.provider?.getPageSourcePathname(\n clientPath,\n pathnameNormalized,\n );\n if (origPath) {\n pages[pathnameNormalized] = {\n title: data.title,\n uri: clientPath,\n configuration: parentConfiguration,\n origPath,\n crumbs,\n };\n }\n }\n\n let subTree: TreeItem[] | undefined;\n if (segment !== \"index\") {\n const subItemsData = await parseAutoStructure(\n parentConfiguration,\n [...crumbs, pathnameNormalized],\n clientPath,\n nestingLevel + 1,\n );\n subTree = subItemsData.tree;\n Object.assign(pages, subItemsData.pages);\n }\n\n tree.push({\n title: data.title,\n href: pathnameNormalized,\n items: subTree,\n type: \"row\",\n });\n }\n } catch {\n throw new Error(`Can't parse structure \"${parentPathname}/structure.json\"`);\n }\n return { pages, tree };\n }\n};\n\nconst parseAutoStructure = async (\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n parentPathname = \"\",\n nestingLevel: number,\n) => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n if (!parentConfiguration.provider) return { pages, tree };\n\n const branchFiles = await parentConfiguration.provider.filesPromise;\n\n if (branchFiles.structures.includes(`${parentPathname}/structure.json`)) {\n const jsonStructureData = await parseJSONStructure(\n parentConfiguration,\n parentPathname,\n crumbs,\n nestingLevel + 1,\n );\n if (jsonStructureData) {\n return jsonStructureData;\n }\n }\n\n for await (const generatedItem of branchFiles.docs) {\n const linkLevel = generatedItem.clientPath.split(\"/\").filter(Boolean).length;\n const topLevelLink = linkLevel < 2;\n\n if (\n (!parentPathname && !topLevelLink) ||\n (parentPathname &&\n !generatedItem.clientPath.match(new RegExp(`^${parentPathname.replace(/\\/$/, \"\")}/[^/]+$`)))\n ) {\n continue;\n }\n\n const { clientPath } = generatedItem;\n const pathname = mergePathname(parentConfiguration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n const metadata = await getMetadata({ provider: parentConfiguration.provider, uri: clientPath });\n const title = metadata.title || generatePseudoTitle(pathnameNormalized);\n const origPath = await parentConfiguration.provider?.getPageSourcePathname(clientPath, pathnameNormalized);\n if (origPath) {\n pages[pathnameNormalized] = {\n title,\n uri: clientPath,\n configuration: parentConfiguration,\n origPath,\n crumbs,\n };\n }\n\n const subItemsData = await parseAutoStructure(\n parentConfiguration,\n [...crumbs, pathnameNormalized],\n clientPath,\n nestingLevel + 1,\n );\n Object.assign(pages, subItemsData.pages);\n\n if (nestingLevel < (parentConfiguration.spreadedLevel || 1)) {\n tree.push(\n {\n title,\n href: pathnameNormalized,\n type: nestingLevel === 0 ? \"heading\" : \"row\",\n },\n ...subItemsData.tree,\n );\n } else {\n tree.push({\n title,\n href: pathnameNormalized,\n items: subItemsData.tree,\n type: nestingLevel === 0 ? \"heading\" : \"row\",\n });\n }\n }\n\n return { pages, tree };\n};\n\nconst parseStaticStructure = async (\n items: DocItem[],\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n parentPathname: string,\n nestingLevel: number,\n): Promise<{\n pages: Pages;\n tree: TreeItem[];\n}> => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n for await (const item of items) {\n if (typeof item === \"string\") {\n const subItemsData = await parseStructure(item, parentConfiguration, crumbs, parentPathname, nestingLevel);\n Object.assign(pages, subItemsData.pages);\n tree.push(...subItemsData.tree);\n continue;\n }\n if (item.type === \"separator\") {\n tree.push({ type: \"separator\" });\n\n continue;\n }\n let subCrumbs = crumbs;\n const configuration = getConfiguration(item.configuration || {}, parentConfiguration);\n const clientPath = item.href;\n const pathname = mergePathname(configuration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n if (!checkIsLinkExternal(pathnameNormalized) && clientPath) {\n const origPath = await configuration.provider?.getPageSourcePathname(clientPath, pathnameNormalized);\n\n if (origPath) {\n pages[pathnameNormalized] = {\n title: item.title || \"\",\n uri: clientPath,\n configuration,\n origPath,\n crumbs,\n };\n subCrumbs = [...crumbs, pathnameNormalized];\n }\n }\n\n let subTree: TreeItem[] = [];\n if (item.items) {\n const subItemsData = await parseStructure(\n item.items,\n configuration,\n subCrumbs,\n item.href,\n nestingLevel + 1,\n );\n subTree = subItemsData.tree;\n Object.assign(pages, subItemsData.pages);\n }\n\n if (!item.hidden) {\n if (nestingLevel < (parentConfiguration.spreadedLevel || 1)) {\n tree.push(\n {\n title: item.title || generatePseudoTitle(pathnameNormalized),\n href: item.href ? pathnameNormalized : undefined,\n type: item.type,\n },\n ...subTree,\n );\n } else {\n tree.push({\n title: item.title || generatePseudoTitle(pathnameNormalized),\n href: item.href ? pathnameNormalized : undefined,\n items: subTree,\n type: item.type,\n });\n }\n }\n }\n\n return { pages, tree };\n};\n\nexport const parseStructure = async (\n items: DocItem[] | \"auto\",\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n pathname: string = \"\",\n nestingLevel: number = 0,\n) => {\n if (items === \"auto\") {\n const structureParsed = await parseAutoStructure(parentConfiguration, crumbs, pathname, nestingLevel);\n return structureParsed;\n }\n\n const structureParsed = await parseStaticStructure(items, parentConfiguration, crumbs, pathname, nestingLevel);\n return structureParsed;\n};\n"],"names":["parseAutoStructure","async","parentConfiguration","crumbs","parentPathname","nestingLevel","pages","tree","provider","branchFiles","filesPromise","structures","includes","jsonStructureData","content","loadContent","structure","JSON","parse","data","segment","clientPath","normalizePathname","pathname","mergePathname","basePath","pathnameNormalized","checkIsLinkExternal","origPath","getPageSourcePathname","title","uri","configuration","subTree","subItemsData","Object","assign","push","href","items","type","Error","parseJSONStructure","generatedItem","docs","linkLevel","split","filter","Boolean","length","match","RegExp","replace","getMetadata","generatePseudoTitle","spreadedLevel","parseStructure","structureParsed","item","subCrumbs","getConfiguration","hidden","undefined","parseStaticStructure"],"mappings":"mRAQA,MAmEMA,EAAqBC,MACvBC,EAAqC,GACrCC,EAAiB,GACjBC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zCY,KAAMoB,EAAKpB,KAAOZ,OAAqBoC,EACvCvB,MAAON,EACPO,KAAMkB,EAAKlB,OAI3B,CAEA,MAAO,CAAElC,QAAOC,SAecwD,CAAqBxB,EAAOrC,EAAqBC,EAAQoB,EAAUlB,GACjG,OAAOoD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/path-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"path-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/path-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,GAAI,UAAU,MAAM,WAS1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,GAAG,IAAI,WAIzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,WAAW,MAAM,GAAG,IAAI,WAI3D,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,WAAW,MAAM,GAAG,IAAI,WAIxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,WAAW,MAAM,GAAG,IAAI,WAS3D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,YAG/C,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,EAAE,OAAO,MAAM,uBAE7D,CAAC"}
|