@mui/internal-docs-infra 0.1.0 → 0.1.1-alpha.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.
Files changed (294) hide show
  1. package/README.md +3 -1
  2. package/build/CodeControllerContext/CodeControllerContext.d.ts +22 -0
  3. package/build/CodeControllerContext/CodeControllerContext.js +21 -0
  4. package/build/CodeControllerContext/index.d.ts +1 -0
  5. package/build/CodeControllerContext/index.js +16 -0
  6. package/build/CodeHighlighter/CodeHighlighter.d.ts +2 -0
  7. package/build/CodeHighlighter/CodeHighlighter.js +329 -0
  8. package/build/CodeHighlighter/CodeHighlighterClient.d.ts +2 -0
  9. package/build/CodeHighlighter/CodeHighlighterClient.js +406 -0
  10. package/build/CodeHighlighter/CodeHighlighterContext.d.ts +14 -0
  11. package/build/CodeHighlighter/CodeHighlighterContext.js +22 -0
  12. package/build/CodeHighlighter/CodeHighlighterFallbackContext.d.ts +7 -0
  13. package/build/CodeHighlighter/CodeHighlighterFallbackContext.js +18 -0
  14. package/build/CodeHighlighter/applyTransform.d.ts +19 -0
  15. package/build/CodeHighlighter/applyTransform.js +83 -0
  16. package/build/CodeHighlighter/codeToFallbackProps.d.ts +2 -0
  17. package/build/CodeHighlighter/codeToFallbackProps.js +77 -0
  18. package/build/CodeHighlighter/errors.d.ts +0 -0
  19. package/build/CodeHighlighter/errors.js +2 -0
  20. package/build/CodeHighlighter/hasAllVariants.d.ts +2 -0
  21. package/build/CodeHighlighter/hasAllVariants.js +37 -0
  22. package/build/CodeHighlighter/index.d.ts +4 -0
  23. package/build/CodeHighlighter/index.js +49 -0
  24. package/build/CodeHighlighter/loadFallbackCode.d.ts +9 -0
  25. package/build/CodeHighlighter/loadFallbackCode.js +474 -0
  26. package/build/CodeHighlighter/loadVariant.d.ts +11 -0
  27. package/build/CodeHighlighter/loadVariant.js +715 -0
  28. package/build/CodeHighlighter/maybeInitialData.d.ts +10 -0
  29. package/build/CodeHighlighter/maybeInitialData.js +101 -0
  30. package/build/CodeHighlighter/parseCode.d.ts +6 -0
  31. package/build/CodeHighlighter/parseCode.js +129 -0
  32. package/build/CodeHighlighter/parseControlledCode.d.ts +6 -0
  33. package/build/CodeHighlighter/parseControlledCode.js +83 -0
  34. package/build/CodeHighlighter/transformCode.d.ts +20 -0
  35. package/build/CodeHighlighter/transformCode.js +231 -0
  36. package/build/CodeHighlighter/transformParsedSource.d.ts +3 -0
  37. package/build/CodeHighlighter/transformParsedSource.js +73 -0
  38. package/build/CodeHighlighter/transformSource.d.ts +2 -0
  39. package/build/CodeHighlighter/transformSource.js +114 -0
  40. package/build/CodeHighlighter/types.d.ts +138 -0
  41. package/build/CodeHighlighter/types.js +5 -0
  42. package/build/CodeProvider/CodeContext.d.ts +12 -0
  43. package/build/CodeProvider/CodeContext.js +14 -0
  44. package/build/CodeProvider/CodeProvider.d.ts +13 -0
  45. package/build/CodeProvider/CodeProvider.js +57 -0
  46. package/build/CodeProvider/index.d.ts +2 -0
  47. package/build/CodeProvider/index.js +27 -0
  48. package/build/README.md +19 -0
  49. package/build/esm/CodeControllerContext/CodeControllerContext.d.ts +22 -0
  50. package/build/esm/CodeControllerContext/CodeControllerContext.d.ts.map +1 -0
  51. package/build/esm/CodeControllerContext/CodeControllerContext.js +14 -0
  52. package/build/esm/CodeControllerContext/index.d.ts +1 -0
  53. package/build/esm/CodeControllerContext/index.d.ts.map +1 -0
  54. package/build/esm/CodeControllerContext/index.js +1 -0
  55. package/build/esm/CodeHighlighter/CodeHighlighter.d.ts +2 -0
  56. package/build/esm/CodeHighlighter/CodeHighlighter.d.ts.map +1 -0
  57. package/build/esm/CodeHighlighter/CodeHighlighter.js +321 -0
  58. package/build/esm/CodeHighlighter/CodeHighlighterClient.d.ts +2 -0
  59. package/build/esm/CodeHighlighter/CodeHighlighterClient.d.ts.map +1 -0
  60. package/build/esm/CodeHighlighter/CodeHighlighterClient.js +399 -0
  61. package/build/esm/CodeHighlighter/CodeHighlighterContext.d.ts +14 -0
  62. package/build/esm/CodeHighlighter/CodeHighlighterContext.d.ts.map +1 -0
  63. package/build/esm/CodeHighlighter/CodeHighlighterContext.js +14 -0
  64. package/build/esm/CodeHighlighter/CodeHighlighterFallbackContext.d.ts +7 -0
  65. package/build/esm/CodeHighlighter/CodeHighlighterFallbackContext.d.ts.map +1 -0
  66. package/build/esm/CodeHighlighter/CodeHighlighterFallbackContext.js +11 -0
  67. package/build/esm/CodeHighlighter/applyTransform.d.ts +19 -0
  68. package/build/esm/CodeHighlighter/applyTransform.d.ts.map +1 -0
  69. package/build/esm/CodeHighlighter/applyTransform.js +75 -0
  70. package/build/esm/CodeHighlighter/codeToFallbackProps.d.ts +2 -0
  71. package/build/esm/CodeHighlighter/codeToFallbackProps.d.ts.map +1 -0
  72. package/build/esm/CodeHighlighter/codeToFallbackProps.js +70 -0
  73. package/build/esm/CodeHighlighter/errors.d.ts +0 -0
  74. package/build/esm/CodeHighlighter/errors.d.ts.map +1 -0
  75. package/build/esm/CodeHighlighter/errors.js +1 -0
  76. package/build/esm/CodeHighlighter/hasAllVariants.d.ts +2 -0
  77. package/build/esm/CodeHighlighter/hasAllVariants.d.ts.map +1 -0
  78. package/build/esm/CodeHighlighter/hasAllVariants.js +31 -0
  79. package/build/esm/CodeHighlighter/index.d.ts +4 -0
  80. package/build/esm/CodeHighlighter/index.d.ts.map +1 -0
  81. package/build/esm/CodeHighlighter/index.js +4 -0
  82. package/build/esm/CodeHighlighter/loadFallbackCode.d.ts +9 -0
  83. package/build/esm/CodeHighlighter/loadFallbackCode.d.ts.map +1 -0
  84. package/build/esm/CodeHighlighter/loadFallbackCode.js +468 -0
  85. package/build/esm/CodeHighlighter/loadVariant.d.ts +11 -0
  86. package/build/esm/CodeHighlighter/loadVariant.d.ts.map +1 -0
  87. package/build/esm/CodeHighlighter/loadVariant.js +708 -0
  88. package/build/esm/CodeHighlighter/maybeInitialData.d.ts +10 -0
  89. package/build/esm/CodeHighlighter/maybeInitialData.d.ts.map +1 -0
  90. package/build/esm/CodeHighlighter/maybeInitialData.js +94 -0
  91. package/build/esm/CodeHighlighter/parseCode.d.ts +6 -0
  92. package/build/esm/CodeHighlighter/parseCode.d.ts.map +1 -0
  93. package/build/esm/CodeHighlighter/parseCode.js +122 -0
  94. package/build/esm/CodeHighlighter/parseControlledCode.d.ts +6 -0
  95. package/build/esm/CodeHighlighter/parseControlledCode.d.ts.map +1 -0
  96. package/build/esm/CodeHighlighter/parseControlledCode.js +76 -0
  97. package/build/esm/CodeHighlighter/transformCode.d.ts +20 -0
  98. package/build/esm/CodeHighlighter/transformCode.d.ts.map +1 -0
  99. package/build/esm/CodeHighlighter/transformCode.js +223 -0
  100. package/build/esm/CodeHighlighter/transformParsedSource.d.ts +3 -0
  101. package/build/esm/CodeHighlighter/transformParsedSource.d.ts.map +1 -0
  102. package/build/esm/CodeHighlighter/transformParsedSource.js +66 -0
  103. package/build/esm/CodeHighlighter/transformSource.d.ts +2 -0
  104. package/build/esm/CodeHighlighter/transformSource.d.ts.map +1 -0
  105. package/build/esm/CodeHighlighter/transformSource.js +107 -0
  106. package/build/esm/CodeHighlighter/types.d.ts +138 -0
  107. package/build/esm/CodeHighlighter/types.d.ts.map +1 -0
  108. package/build/esm/CodeHighlighter/types.js +1 -0
  109. package/build/esm/CodeProvider/CodeContext.d.ts +12 -0
  110. package/build/esm/CodeProvider/CodeContext.d.ts.map +1 -0
  111. package/build/esm/CodeProvider/CodeContext.js +8 -0
  112. package/build/esm/CodeProvider/CodeProvider.d.ts +13 -0
  113. package/build/esm/CodeProvider/CodeProvider.d.ts.map +1 -0
  114. package/build/esm/CodeProvider/CodeProvider.js +50 -0
  115. package/build/esm/CodeProvider/index.d.ts +2 -0
  116. package/build/esm/CodeProvider/index.d.ts.map +1 -0
  117. package/build/esm/CodeProvider/index.js +2 -0
  118. package/build/esm/hast/hast.d.ts +11 -0
  119. package/build/esm/hast/hast.d.ts.map +1 -0
  120. package/build/esm/hast/hast.js +66 -0
  121. package/build/esm/hast/index.d.ts +1 -0
  122. package/build/esm/hast/index.d.ts.map +1 -0
  123. package/build/esm/hast/index.js +1 -0
  124. package/build/esm/loadPrecomputedCodeHighlighter/index.d.ts +2 -0
  125. package/build/esm/loadPrecomputedCodeHighlighter/index.d.ts.map +1 -0
  126. package/build/esm/loadPrecomputedCodeHighlighter/index.js +4 -0
  127. package/build/esm/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +57 -0
  128. package/build/esm/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts.map +1 -0
  129. package/build/esm/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +194 -0
  130. package/build/esm/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts +20 -0
  131. package/build/esm/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts.map +1 -0
  132. package/build/esm/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +243 -0
  133. package/build/esm/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts +15 -0
  134. package/build/esm/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts.map +1 -0
  135. package/build/esm/loadPrecomputedCodeHighlighter/parseFunctionParameters.js +168 -0
  136. package/build/esm/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +27 -0
  137. package/build/esm/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts.map +1 -0
  138. package/build/esm/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +37 -0
  139. package/build/esm/loadServerCodeMeta/index.d.ts +1 -0
  140. package/build/esm/loadServerCodeMeta/index.d.ts.map +1 -0
  141. package/build/esm/loadServerCodeMeta/index.js +1 -0
  142. package/build/esm/loadServerCodeMeta/serverLoadCodeMeta.d.ts +24 -0
  143. package/build/esm/loadServerCodeMeta/serverLoadCodeMeta.d.ts.map +1 -0
  144. package/build/esm/loadServerCodeMeta/serverLoadCodeMeta.js +77 -0
  145. package/build/esm/loadServerSource/index.d.ts +1 -0
  146. package/build/esm/loadServerSource/index.d.ts.map +1 -0
  147. package/build/esm/loadServerSource/index.js +1 -0
  148. package/build/esm/loadServerSource/serverLoadSource.d.ts +25 -0
  149. package/build/esm/loadServerSource/serverLoadSource.d.ts.map +1 -0
  150. package/build/esm/loadServerSource/serverLoadSource.js +100 -0
  151. package/build/esm/loaderUtils/getFileNameFromUrl.d.ts +11 -0
  152. package/build/esm/loaderUtils/getFileNameFromUrl.d.ts.map +1 -0
  153. package/build/esm/loaderUtils/getFileNameFromUrl.js +32 -0
  154. package/build/esm/loaderUtils/index.d.ts +5 -0
  155. package/build/esm/loaderUtils/index.d.ts.map +1 -0
  156. package/build/esm/loaderUtils/index.js +5 -0
  157. package/build/esm/loaderUtils/processImports.d.ts +19 -0
  158. package/build/esm/loaderUtils/processImports.d.ts.map +1 -0
  159. package/build/esm/loaderUtils/processImports.js +82 -0
  160. package/build/esm/loaderUtils/resolveImports.d.ts +4 -0
  161. package/build/esm/loaderUtils/resolveImports.d.ts.map +1 -0
  162. package/build/esm/loaderUtils/resolveImports.js +71 -0
  163. package/build/esm/loaderUtils/resolveModulePath.d.ts +74 -0
  164. package/build/esm/loaderUtils/resolveModulePath.d.ts.map +1 -0
  165. package/build/esm/loaderUtils/resolveModulePath.js +827 -0
  166. package/build/esm/loaderUtils/resolveModulePathWithFs.d.ts +44 -0
  167. package/build/esm/loaderUtils/resolveModulePathWithFs.d.ts.map +1 -0
  168. package/build/esm/loaderUtils/resolveModulePathWithFs.js +159 -0
  169. package/build/esm/loaderUtils/rewriteImports.d.ts +9 -0
  170. package/build/esm/loaderUtils/rewriteImports.d.ts.map +1 -0
  171. package/build/esm/loaderUtils/rewriteImports.js +57 -0
  172. package/build/esm/parseSource/grammars.d.ts +2 -0
  173. package/build/esm/parseSource/grammars.d.ts.map +1 -0
  174. package/build/esm/parseSource/grammars.js +27 -0
  175. package/build/esm/parseSource/index.d.ts +1 -0
  176. package/build/esm/parseSource/index.d.ts.map +1 -0
  177. package/build/esm/parseSource/index.js +1 -0
  178. package/build/esm/parseSource/parseSource.d.ts +3 -0
  179. package/build/esm/parseSource/parseSource.d.ts.map +1 -0
  180. package/build/esm/parseSource/parseSource.js +37 -0
  181. package/build/esm/transformRelativeMarkdownPaths/index.d.ts +2 -0
  182. package/build/esm/transformRelativeMarkdownPaths/index.d.ts.map +1 -0
  183. package/build/esm/transformRelativeMarkdownPaths/index.js +4 -0
  184. package/build/esm/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts +12 -0
  185. package/build/esm/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts.map +1 -0
  186. package/build/esm/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.js +30 -0
  187. package/build/esm/transformTsToJs/index.d.ts +1 -0
  188. package/build/esm/transformTsToJs/index.d.ts.map +1 -0
  189. package/build/esm/transformTsToJs/index.js +1 -0
  190. package/build/esm/transformTsToJs/removeTypes.d.ts +13 -0
  191. package/build/esm/transformTsToJs/removeTypes.d.ts.map +1 -0
  192. package/build/esm/transformTsToJs/removeTypes.js +134 -0
  193. package/build/esm/transformTsToJs/transformTsToJs.d.ts +3 -0
  194. package/build/esm/transformTsToJs/transformTsToJs.d.ts.map +1 -0
  195. package/build/esm/transformTsToJs/transformTsToJs.js +34 -0
  196. package/build/esm/useCode/index.d.ts +1 -0
  197. package/build/esm/useCode/index.d.ts.map +1 -0
  198. package/build/esm/useCode/index.js +1 -0
  199. package/build/esm/useCode/useCode.d.ts +37 -0
  200. package/build/esm/useCode/useCode.d.ts.map +1 -0
  201. package/build/esm/useCode/useCode.js +393 -0
  202. package/{esm → build/esm}/useDemo/index.d.ts +12 -24
  203. package/build/esm/useDemo/index.d.ts.map +1 -0
  204. package/build/esm/useDemo/index.js +17 -0
  205. package/build/esm/useOnHydrate/index.d.ts +1 -0
  206. package/build/esm/useOnHydrate/index.d.ts.map +1 -0
  207. package/build/esm/useOnHydrate/index.js +1 -0
  208. package/build/esm/useOnHydrate/useOnHydrate.d.ts +1 -0
  209. package/build/esm/useOnHydrate/useOnHydrate.d.ts.map +1 -0
  210. package/build/esm/useOnHydrate/useOnHydrate.js +18 -0
  211. package/build/esm/useOnIdle/index.d.ts +1 -0
  212. package/build/esm/useOnIdle/index.d.ts.map +1 -0
  213. package/build/esm/useOnIdle/index.js +1 -0
  214. package/build/esm/useOnIdle/useOnIdle.d.ts +1 -0
  215. package/build/esm/useOnIdle/useOnIdle.d.ts.map +1 -0
  216. package/build/esm/useOnIdle/useOnIdle.js +39 -0
  217. package/build/hast/hast.d.ts +11 -0
  218. package/build/hast/hast.js +75 -0
  219. package/build/hast/index.d.ts +1 -0
  220. package/build/hast/index.js +16 -0
  221. package/build/loadPrecomputedCodeHighlighter/index.d.ts +2 -0
  222. package/build/loadPrecomputedCodeHighlighter/index.js +9 -0
  223. package/build/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +57 -0
  224. package/build/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +201 -0
  225. package/build/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts +20 -0
  226. package/build/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +248 -0
  227. package/build/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts +15 -0
  228. package/build/loadPrecomputedCodeHighlighter/parseFunctionParameters.js +174 -0
  229. package/build/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +27 -0
  230. package/build/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +43 -0
  231. package/build/loadServerCodeMeta/index.d.ts +1 -0
  232. package/build/loadServerCodeMeta/index.js +16 -0
  233. package/build/loadServerCodeMeta/serverLoadCodeMeta.d.ts +24 -0
  234. package/build/loadServerCodeMeta/serverLoadCodeMeta.js +85 -0
  235. package/build/loadServerSource/index.d.ts +1 -0
  236. package/build/loadServerSource/index.js +16 -0
  237. package/build/loadServerSource/serverLoadSource.d.ts +25 -0
  238. package/build/loadServerSource/serverLoadSource.js +108 -0
  239. package/build/loaderUtils/getFileNameFromUrl.d.ts +11 -0
  240. package/build/loaderUtils/getFileNameFromUrl.js +38 -0
  241. package/build/loaderUtils/index.d.ts +5 -0
  242. package/build/loaderUtils/index.js +60 -0
  243. package/build/loaderUtils/processImports.d.ts +19 -0
  244. package/build/loaderUtils/processImports.js +89 -0
  245. package/build/loaderUtils/resolveImports.d.ts +4 -0
  246. package/build/loaderUtils/resolveImports.js +78 -0
  247. package/build/loaderUtils/resolveModulePath.d.ts +74 -0
  248. package/build/loaderUtils/resolveModulePath.js +835 -0
  249. package/build/loaderUtils/resolveModulePathWithFs.d.ts +44 -0
  250. package/build/loaderUtils/resolveModulePathWithFs.js +163 -0
  251. package/build/loaderUtils/rewriteImports.d.ts +9 -0
  252. package/build/loaderUtils/rewriteImports.js +62 -0
  253. package/build/package.json +101 -0
  254. package/build/parseSource/grammars.d.ts +2 -0
  255. package/build/parseSource/grammars.js +34 -0
  256. package/build/parseSource/index.d.ts +1 -0
  257. package/build/parseSource/index.js +16 -0
  258. package/build/parseSource/parseSource.d.ts +3 -0
  259. package/build/parseSource/parseSource.js +44 -0
  260. package/build/transformRelativeMarkdownPaths/index.d.ts +2 -0
  261. package/build/transformRelativeMarkdownPaths/index.js +9 -0
  262. package/build/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts +12 -0
  263. package/build/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.js +36 -0
  264. package/build/transformTsToJs/index.d.ts +1 -0
  265. package/build/transformTsToJs/index.js +16 -0
  266. package/build/transformTsToJs/removeTypes.d.ts +13 -0
  267. package/build/transformTsToJs/removeTypes.js +141 -0
  268. package/build/transformTsToJs/transformTsToJs.d.ts +3 -0
  269. package/build/transformTsToJs/transformTsToJs.js +41 -0
  270. package/build/useCode/index.d.ts +1 -0
  271. package/build/useCode/index.js +16 -0
  272. package/build/useCode/useCode.d.ts +37 -0
  273. package/build/useCode/useCode.js +401 -0
  274. package/{useDemo → build/useDemo}/index.d.ts +12 -24
  275. package/build/useDemo/index.js +25 -0
  276. package/build/useOnHydrate/index.d.ts +1 -0
  277. package/build/useOnHydrate/index.js +16 -0
  278. package/build/useOnHydrate/useOnHydrate.d.ts +1 -0
  279. package/build/useOnHydrate/useOnHydrate.js +26 -0
  280. package/build/useOnIdle/index.d.ts +1 -0
  281. package/build/useOnIdle/index.js +16 -0
  282. package/build/useOnIdle/useOnIdle.d.ts +1 -0
  283. package/build/useOnIdle/useOnIdle.js +47 -0
  284. package/package.json +86 -14
  285. package/esm/useDemo/index.d.ts.map +0 -1
  286. package/esm/useDemo/index.js +0 -104
  287. package/useDemo/index.js +0 -112
  288. /package/{LICENSE → build/LICENSE} +0 -0
  289. /package/{esm → build/esm}/package.json +0 -0
  290. /package/{esm → build/esm}/useCopier/index.d.ts +0 -0
  291. /package/{esm → build/esm}/useCopier/index.d.ts.map +0 -0
  292. /package/{esm → build/esm}/useCopier/index.js +0 -0
  293. /package/{useCopier → build/useCopier}/index.d.ts +0 -0
  294. /package/{useCopier → build/useCopier}/index.js +0 -0
@@ -0,0 +1,44 @@
1
+ import { type DirectoryEntry, type DirectoryReader, type ResolveModulePathOptions } from "./resolveModulePath.js";
2
+ /**
3
+ * Resolves a module path using Node.js filesystem APIs.
4
+ * This is a convenience wrapper around the generic resolveModulePath function.
5
+ *
6
+ * @param modulePath - The module path to resolve (without file extension)
7
+ * @param options - Configuration options
8
+ * @returns Promise<string> - The resolved file path, or throws if not found
9
+ */
10
+ export declare function resolveModulePathWithFs(modulePath: string, options?: ResolveModulePathOptions): Promise<string>;
11
+ /**
12
+ * Resolves multiple module paths using Node.js filesystem APIs.
13
+ * This is a convenience wrapper around the generic resolveModulePaths function.
14
+ *
15
+ * @param modulePaths - Array of module paths to resolve (without file extensions)
16
+ * @param options - Configuration options
17
+ * @returns Promise<Map<string, string>> - Map from input path to resolved file path
18
+ */
19
+ export declare function resolveModulePathsWithFs(modulePaths: string[], options?: ResolveModulePathOptions): Promise<Map<string, string>>;
20
+ /**
21
+ * Resolves import result by separating JavaScript modules from static assets,
22
+ * only resolving JavaScript modules and returning a combined map.
23
+ * This is a convenience wrapper around the generic resolveImportResult function
24
+ * that uses Node.js filesystem APIs.
25
+ *
26
+ * @param importResult - The result from resolveImports containing all imports
27
+ * @param options - Configuration options for module resolution
28
+ * @returns Promise<Map<string, string>> - Map from import path to resolved file path
29
+ */
30
+ export declare function resolveImportResultWithFs(importResult: Record<string, {
31
+ path: string;
32
+ names: string[];
33
+ }>, options?: ResolveModulePathOptions): Promise<Map<string, string>>;
34
+ /**
35
+ * Resolves variant paths from a variants object mapping variant names to their file paths.
36
+ * This is a convenience wrapper around the generic resolveVariantPaths function
37
+ * that uses Node.js filesystem APIs.
38
+ *
39
+ * @param variants - Object mapping variant names to their file paths
40
+ * @param options - Configuration options for module resolution
41
+ * @returns Promise<Map<string, string>> - Map from variant name to resolved file URL
42
+ */
43
+ export declare function resolveVariantPathsWithFs(variants: Record<string, string>, options?: ResolveModulePathOptions): Promise<Map<string, string>>;
44
+ export type { DirectoryEntry, DirectoryReader, ResolveModulePathOptions };
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.resolveImportResultWithFs = resolveImportResultWithFs;
8
+ exports.resolveModulePathWithFs = resolveModulePathWithFs;
9
+ exports.resolveModulePathsWithFs = resolveModulePathsWithFs;
10
+ exports.resolveVariantPathsWithFs = resolveVariantPathsWithFs;
11
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+ var _promises = require("node:fs/promises");
14
+ var _resolveModulePath = require("./resolveModulePath");
15
+ /**
16
+ * Node.js filesystem-based directory reader that converts Dirent objects
17
+ * to the DirectoryEntry interface expected by the resolver functions.
18
+ */
19
+ var nodeDirectoryReader = /*#__PURE__*/function () {
20
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee(path) {
21
+ var entries;
22
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
23
+ while (1) switch (_context.prev = _context.next) {
24
+ case 0:
25
+ _context.next = 2;
26
+ return (0, _promises.readdir)(path, {
27
+ withFileTypes: true
28
+ });
29
+ case 2:
30
+ entries = _context.sent;
31
+ return _context.abrupt("return", entries.map(function (entry) {
32
+ return {
33
+ name: entry.name,
34
+ isFile: entry.isFile(),
35
+ isDirectory: entry.isDirectory()
36
+ };
37
+ }));
38
+ case 4:
39
+ case "end":
40
+ return _context.stop();
41
+ }
42
+ }, _callee);
43
+ }));
44
+ return function nodeDirectoryReader(_x) {
45
+ return _ref.apply(this, arguments);
46
+ };
47
+ }();
48
+
49
+ /**
50
+ * Resolves a module path using Node.js filesystem APIs.
51
+ * This is a convenience wrapper around the generic resolveModulePath function.
52
+ *
53
+ * @param modulePath - The module path to resolve (without file extension)
54
+ * @param options - Configuration options
55
+ * @returns Promise<string> - The resolved file path, or throws if not found
56
+ */
57
+ function resolveModulePathWithFs(_x2) {
58
+ return _resolveModulePathWithFs.apply(this, arguments);
59
+ }
60
+ /**
61
+ * Resolves multiple module paths using Node.js filesystem APIs.
62
+ * This is a convenience wrapper around the generic resolveModulePaths function.
63
+ *
64
+ * @param modulePaths - Array of module paths to resolve (without file extensions)
65
+ * @param options - Configuration options
66
+ * @returns Promise<Map<string, string>> - Map from input path to resolved file path
67
+ */
68
+ function _resolveModulePathWithFs() {
69
+ _resolveModulePathWithFs = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee2(modulePath) {
70
+ var options,
71
+ _args2 = arguments;
72
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee2$(_context2) {
73
+ while (1) switch (_context2.prev = _context2.next) {
74
+ case 0:
75
+ options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
76
+ return _context2.abrupt("return", (0, _resolveModulePath.resolveModulePath)(modulePath, nodeDirectoryReader, options));
77
+ case 2:
78
+ case "end":
79
+ return _context2.stop();
80
+ }
81
+ }, _callee2);
82
+ }));
83
+ return _resolveModulePathWithFs.apply(this, arguments);
84
+ }
85
+ function resolveModulePathsWithFs(_x3) {
86
+ return _resolveModulePathsWithFs.apply(this, arguments);
87
+ }
88
+ /**
89
+ * Resolves import result by separating JavaScript modules from static assets,
90
+ * only resolving JavaScript modules and returning a combined map.
91
+ * This is a convenience wrapper around the generic resolveImportResult function
92
+ * that uses Node.js filesystem APIs.
93
+ *
94
+ * @param importResult - The result from resolveImports containing all imports
95
+ * @param options - Configuration options for module resolution
96
+ * @returns Promise<Map<string, string>> - Map from import path to resolved file path
97
+ */
98
+ function _resolveModulePathsWithFs() {
99
+ _resolveModulePathsWithFs = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee3(modulePaths) {
100
+ var options,
101
+ _args3 = arguments;
102
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee3$(_context3) {
103
+ while (1) switch (_context3.prev = _context3.next) {
104
+ case 0:
105
+ options = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
106
+ return _context3.abrupt("return", (0, _resolveModulePath.resolveModulePaths)(modulePaths, nodeDirectoryReader, options));
107
+ case 2:
108
+ case "end":
109
+ return _context3.stop();
110
+ }
111
+ }, _callee3);
112
+ }));
113
+ return _resolveModulePathsWithFs.apply(this, arguments);
114
+ }
115
+ function resolveImportResultWithFs(_x4) {
116
+ return _resolveImportResultWithFs.apply(this, arguments);
117
+ }
118
+ /**
119
+ * Resolves variant paths from a variants object mapping variant names to their file paths.
120
+ * This is a convenience wrapper around the generic resolveVariantPaths function
121
+ * that uses Node.js filesystem APIs.
122
+ *
123
+ * @param variants - Object mapping variant names to their file paths
124
+ * @param options - Configuration options for module resolution
125
+ * @returns Promise<Map<string, string>> - Map from variant name to resolved file URL
126
+ */
127
+ function _resolveImportResultWithFs() {
128
+ _resolveImportResultWithFs = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee4(importResult) {
129
+ var options,
130
+ _args4 = arguments;
131
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee4$(_context4) {
132
+ while (1) switch (_context4.prev = _context4.next) {
133
+ case 0:
134
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
135
+ return _context4.abrupt("return", (0, _resolveModulePath.resolveImportResult)(importResult, nodeDirectoryReader, options));
136
+ case 2:
137
+ case "end":
138
+ return _context4.stop();
139
+ }
140
+ }, _callee4);
141
+ }));
142
+ return _resolveImportResultWithFs.apply(this, arguments);
143
+ }
144
+ function resolveVariantPathsWithFs(_x5) {
145
+ return _resolveVariantPathsWithFs.apply(this, arguments);
146
+ } // Re-export types for convenience
147
+ function _resolveVariantPathsWithFs() {
148
+ _resolveVariantPathsWithFs = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee5(variants) {
149
+ var options,
150
+ _args5 = arguments;
151
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee5$(_context5) {
152
+ while (1) switch (_context5.prev = _context5.next) {
153
+ case 0:
154
+ options = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : {};
155
+ return _context5.abrupt("return", (0, _resolveModulePath.resolveVariantPaths)(variants, nodeDirectoryReader, options));
156
+ case 2:
157
+ case "end":
158
+ return _context5.stop();
159
+ }
160
+ }, _callee5);
161
+ }));
162
+ return _resolveVariantPathsWithFs.apply(this, arguments);
163
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Rewrites relative imports in source code to assume all files are in the same directory.
3
+ * Converts imports like '../utils/helper' or './components/Button' to './helper' and './Button'
4
+ *
5
+ * @param source - The source code to process
6
+ * @param filePaths - Set of file paths that are available as dependencies
7
+ * @returns The source code with rewritten imports
8
+ */
9
+ export declare function rewriteImportsToSameDirectory(source: string, filePaths: Set<string>): string;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.rewriteImportsToSameDirectory = rewriteImportsToSameDirectory;
7
+ var _resolveModulePath = require("./resolveModulePath");
8
+ var _getFileNameFromUrl2 = require("./getFileNameFromUrl");
9
+ /**
10
+ * Rewrites relative imports in source code to assume all files are in the same directory.
11
+ * Converts imports like '../utils/helper' or './components/Button' to './helper' and './Button'
12
+ *
13
+ * @param source - The source code to process
14
+ * @param filePaths - Set of file paths that are available as dependencies
15
+ * @returns The source code with rewritten imports
16
+ */
17
+ function rewriteImportsToSameDirectory(source, filePaths) {
18
+ // Create a map of original file paths to just their basenames
19
+ var fileBasenames = new Map();
20
+ Array.from(filePaths).forEach(function (path) {
21
+ fileBasenames.set(path, (0, _getFileNameFromUrl2.getFileNameFromUrl)(path).fileName);
22
+ });
23
+
24
+ // Regex to match import statements with relative paths
25
+ var importRegex = /import\s+((?:\w+|\*\s+as\s+\w+|{[^}]+})\s+from\s+)['"]([^'"]+)['"]/g;
26
+ return source.replace(importRegex, function (match, importPart, modulePath) {
27
+ // Only process relative imports
28
+ if (modulePath.startsWith('.')) {
29
+ // Extract the filename from the path
30
+ var filename = (0, _getFileNameFromUrl2.getFileNameFromUrl)(modulePath).fileName;
31
+
32
+ // For static assets (CSS, JSON, etc.), use the filename as-is
33
+ if (!(0, _resolveModulePath.isJavaScriptModule)(modulePath)) {
34
+ var matchingPath = Array.from(filePaths).find(function (path) {
35
+ return (0, _getFileNameFromUrl2.getFileNameFromUrl)(path).fileName === filename;
36
+ });
37
+ if (matchingPath) {
38
+ return "import ".concat(importPart, "'./").concat(filename, "'");
39
+ }
40
+ } else {
41
+ // For JS/TS modules, check against all possible extensions
42
+ var _matchingPath = Array.from(filePaths).find(function (path) {
43
+ var pathBasename = (0, _getFileNameFromUrl2.getFileNameFromUrl)(path).fileName;
44
+ return pathBasename === filename || _resolveModulePath.JAVASCRIPT_MODULE_EXTENSIONS.some(function (ext) {
45
+ var _getFileNameFromUrl = (0, _getFileNameFromUrl2.getFileNameFromUrl)(path),
46
+ fileName = _getFileNameFromUrl.fileName;
47
+ return fileName.endsWith(ext) ? fileName.slice(0, -ext.length) === filename : false;
48
+ });
49
+ });
50
+ if (_matchingPath) {
51
+ // For JS/TS modules, rewrite to same directory without extension
52
+ var pathBasename = (0, _getFileNameFromUrl2.getFileNameFromUrl)(_matchingPath).fileName;
53
+ var nameWithoutExt = _resolveModulePath.JAVASCRIPT_MODULE_EXTENSIONS.reduce(function (name, ext) {
54
+ return name.replace(new RegExp("\\".concat(ext, "$")), '');
55
+ }, pathBasename);
56
+ return "import ".concat(importPart, "'./").concat(nameWithoutExt, "'");
57
+ }
58
+ }
59
+ }
60
+ return match;
61
+ });
62
+ }
@@ -0,0 +1,101 @@
1
+ {
2
+ "name": "@mui/internal-docs-infra",
3
+ "version": "0.1.0",
4
+ "author": "MUI Team",
5
+ "description": "MUI Infra - internal documentation creation tools.",
6
+ "keywords": [
7
+ "react",
8
+ "react-component",
9
+ "material-ui",
10
+ "material design",
11
+ "docs"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/mui/mui-public.git",
16
+ "directory": "packages/mui-docs"
17
+ },
18
+ "license": "MIT",
19
+ "bugs": {
20
+ "url": "https://github.com/mui/mui-public/issues"
21
+ },
22
+ "homepage": "https://github.com/mui/mui-public/tree/master/packages/docs-infra",
23
+ "dependencies": {
24
+ "@babel/runtime": "^7.27.6",
25
+ "@babel/standalone": "^7.28.1",
26
+ "@wooorm/starry-night": "^3.8.0",
27
+ "clipboard-copy": "^4.0.1",
28
+ "hast-util-to-jsx-runtime": "^2.3.6",
29
+ "hast-util-to-mdast": "^10.1.2",
30
+ "hast-util-to-text": "^4.0.2",
31
+ "js-sha256": "^0.11.1",
32
+ "jsondiffpatch": "^0.7.3",
33
+ "kebab-case": "^2.0.2",
34
+ "prettier": "^3.5.3",
35
+ "rehype-parse": "^9.0.1",
36
+ "rehype-remark": "^10.0.1",
37
+ "rehype-sanitize": "^6.0.0",
38
+ "remark-stringify": "^11.0.0",
39
+ "unified": "^11.0.5",
40
+ "unist-util-visit": "^5.0.0",
41
+ "vscode-oniguruma": "^2.0.1"
42
+ },
43
+ "peerDependencies": {
44
+ "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
45
+ "next": "^13.5.1 || ^14 || ^15.0.0",
46
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "@types/react": {
50
+ "optional": true
51
+ }
52
+ },
53
+ "exports": {
54
+ "./package.json": "./package.json",
55
+ ".": {
56
+ "require": {
57
+ "types": "./index.d.ts",
58
+ "default": "./index.js"
59
+ },
60
+ "import": {
61
+ "types": "./esm/index.d.ts",
62
+ "default": "./esm/index.js"
63
+ }
64
+ },
65
+ "./*": {
66
+ "import": "./build/esm/*/index.js",
67
+ "require": "./build/*/index.js",
68
+ "types": "./build/*/index.d.ts"
69
+ },
70
+ "./*/types": {
71
+ "import": "./build/esm/*/types.js",
72
+ "require": "./build/*/types.js",
73
+ "types": "./build/*/types.d.ts"
74
+ },
75
+ "./*/errors": {
76
+ "import": "./build/esm/*/errors.js",
77
+ "require": "./build/*/errors.js",
78
+ "types": "./build/*/errors.d.ts"
79
+ },
80
+ "./transformRelativeMarkdownPaths/esm": {
81
+ "import": "./build/esm/transformRelativeMarkdownPaths/index.js",
82
+ "require": "./build/esm/transformRelativeMarkdownPaths/index.js",
83
+ "types": "./build/esm/transformRelativeMarkdownPaths/index.d.ts"
84
+ },
85
+ "./loadPrecomputedCodeHighlighter/esm": {
86
+ "import": "./build/esm/loadPrecomputedCodeHighlighter/index.js",
87
+ "require": "./build/esm/loadPrecomputedCodeHighlighter/index.js",
88
+ "types": "./build/esm/loadPrecomputedCodeHighlighter/index.d.ts"
89
+ }
90
+ },
91
+ "files": [
92
+ "build/**/*"
93
+ ],
94
+ "publishConfig": {
95
+ "access": "public"
96
+ },
97
+ "engines": {
98
+ "node": ">=14.0.0"
99
+ },
100
+ "private": false
101
+ }
@@ -0,0 +1,2 @@
1
+ export declare const grammars: import("@wooorm/starry-night").Grammar[];
2
+ export declare const extensionMap: Record<string, string>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.grammars = exports.extensionMap = void 0;
8
+ var _source = _interopRequireDefault(require("@wooorm/starry-night/source.js"));
9
+ var _source2 = _interopRequireDefault(require("@wooorm/starry-night/source.ts"));
10
+ var _source3 = _interopRequireDefault(require("@wooorm/starry-night/source.tsx"));
11
+ var _source4 = _interopRequireDefault(require("@wooorm/starry-night/source.json"));
12
+ var _text = _interopRequireDefault(require("@wooorm/starry-night/text.md"));
13
+ var _source5 = _interopRequireDefault(require("@wooorm/starry-night/source.mdx"));
14
+ var _textHtml = _interopRequireDefault(require("@wooorm/starry-night/text.html.basic"));
15
+ var _source6 = _interopRequireDefault(require("@wooorm/starry-night/source.css"));
16
+ var _source7 = _interopRequireDefault(require("@wooorm/starry-night/source.shell"));
17
+ var _source8 = _interopRequireDefault(require("@wooorm/starry-night/source.yaml"));
18
+ var grammars = exports.grammars = [_source["default"], _source2["default"], _source3["default"], _source4["default"], _text["default"], _source5["default"],
19
+ // needs sourceTsx
20
+ _textHtml["default"], _source6["default"], _source7["default"], _source8["default"]];
21
+ var extensionMap = exports.extensionMap = {
22
+ '.js': 'source.js',
23
+ '.ts': 'source.ts',
24
+ '.jsx': 'source.tsx',
25
+ // TODO: is there a JSX grammar?
26
+ '.tsx': 'source.tsx',
27
+ '.json': 'source.json',
28
+ '.md': 'text.md',
29
+ '.mdx': 'source.mdx',
30
+ '.html': 'text.html.basic',
31
+ '.css': 'source.css',
32
+ '.sh': 'source.shell',
33
+ '.yaml': 'source.yaml'
34
+ };
@@ -0,0 +1 @@
1
+ export * from "./parseSource.js";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _parseSource = require("./parseSource");
7
+ Object.keys(_parseSource).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _parseSource[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _parseSource[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ import { ParseSource } from "../CodeHighlighter/index.js";
2
+ export declare const parseSource: ParseSource;
3
+ export declare const parseSourceFactory: () => Promise<ParseSource>;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.parseSourceFactory = exports.parseSource = void 0;
8
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _starryNight = require("@wooorm/starry-night");
11
+ var _grammars = require("./grammars");
12
+ var starryNight = null;
13
+ var parseSource = exports.parseSource = function parseSource(source, fileName) {
14
+ if (!starryNight) {
15
+ throw new Error('Starry Night not initialized. Use parseSourceFactory to create an initialized parseSource function.');
16
+ }
17
+ var fileType = fileName.slice(fileName.lastIndexOf('.')) || 'plaintext';
18
+ return starryNight.highlight(source, _grammars.extensionMap[fileType] || 'plaintext');
19
+ };
20
+ var parseSourceFactory = exports.parseSourceFactory = /*#__PURE__*/function () {
21
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee() {
22
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context) {
23
+ while (1) switch (_context.prev = _context.next) {
24
+ case 0:
25
+ if (starryNight) {
26
+ _context.next = 4;
27
+ break;
28
+ }
29
+ _context.next = 3;
30
+ return (0, _starryNight.createStarryNight)(_grammars.grammars);
31
+ case 3:
32
+ starryNight = _context.sent;
33
+ case 4:
34
+ return _context.abrupt("return", parseSource);
35
+ case 5:
36
+ case "end":
37
+ return _context.stop();
38
+ }
39
+ }, _callee);
40
+ }));
41
+ return function parseSourceFactory() {
42
+ return _ref.apply(this, arguments);
43
+ };
44
+ }();
@@ -0,0 +1,2 @@
1
+ import { transformRelativeMarkdownPaths } from "./transformRelativeMarkdownPaths.js";
2
+ export default transformRelativeMarkdownPaths;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _transformRelativeMarkdownPaths = require("./transformRelativeMarkdownPaths");
8
+ // This is the export format expected by a remark plugin.
9
+ var _default = exports["default"] = _transformRelativeMarkdownPaths.transformRelativeMarkdownPaths;
@@ -0,0 +1,12 @@
1
+ import type { Plugin } from 'unified';
2
+ /**
3
+ * Remark plugin that strips page file extensions from URLs.
4
+ * Removes /page.tsx, /page.jsx, /page.js, /page.mdx, /page.md from both absolute and relative URLs.
5
+ * For relative URLs, converts them to absolute paths based on the current file's location.
6
+ *
7
+ * Examples:
8
+ * - /components/page.tsx -> /components
9
+ * - ./code-highlighter/page.mdx -> /components/code-highlighter (when processed from /components/page.mdx)
10
+ * This allows URLs to resolve when reading in VSCode and Github
11
+ */
12
+ export declare const transformRelativeMarkdownPaths: Plugin;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.transformRelativeMarkdownPaths = void 0;
8
+ var _unistUtilVisit = require("unist-util-visit");
9
+ var _path = _interopRequireDefault(require("path"));
10
+ /**
11
+ * Remark plugin that strips page file extensions from URLs.
12
+ * Removes /page.tsx, /page.jsx, /page.js, /page.mdx, /page.md from both absolute and relative URLs.
13
+ * For relative URLs, converts them to absolute paths based on the current file's location.
14
+ *
15
+ * Examples:
16
+ * - /components/page.tsx -> /components
17
+ * - ./code-highlighter/page.mdx -> /components/code-highlighter (when processed from /components/page.mdx)
18
+ * This allows URLs to resolve when reading in VSCode and Github
19
+ */
20
+ var transformRelativeMarkdownPaths = exports.transformRelativeMarkdownPaths = function transformRelativeMarkdownPaths() {
21
+ return function (tree, file) {
22
+ (0, _unistUtilVisit.visit)(tree, 'link', function (node) {
23
+ if (node.url) {
24
+ node.url = node.url.replace(/\/page\.(tsx|jsx|js|mdx|md)$/g, '');
25
+ node.url = node.url.replace(/\/page\.(tsx|jsx|js|mdx|md)(\?[^#]*)?(#.*)?$/g, '$2$3');
26
+ if (node.url.startsWith('./') && file.path) {
27
+ var currentDir = _path["default"].dirname(file.path);
28
+ var appIndex = currentDir.indexOf('/app/');
29
+ var baseDir = appIndex !== -1 ? currentDir.substring(appIndex + 4) : '/';
30
+ node.url = _path["default"].join('/', baseDir, node.url.replace(/^\.\//, ''));
31
+ }
32
+ node.url = node.url.replace(/\/$/, '');
33
+ }
34
+ });
35
+ };
36
+ };
@@ -0,0 +1 @@
1
+ export * from "./transformTsToJs.js";
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _transformTsToJs = require("./transformTsToJs");
7
+ Object.keys(_transformTsToJs).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _transformTsToJs[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _transformTsToJs[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,13 @@
1
+ import type { Options as PrettierOptions } from 'prettier';
2
+ /**
3
+ * Strips TypeScript types and decorators from code (including React in TSX),
4
+ * preserving blank lines and optionally formatting with Prettier.
5
+ *
6
+ * @param code - The source code string to transform.
7
+ * @param filename - The name of the file (e.g. "foo.ts" or "Foo.tsx").
8
+ * Determines whether TSX parsing is enabled.
9
+ * @param prettierConfig - `true` for default formatting, `false` to skip,
10
+ * or a Prettier options object to customize.
11
+ * @returns The transformed (and optionally formatted) code.
12
+ */
13
+ export declare function removeTypes(code: string, filename?: string, prettierConfig?: PrettierOptions | boolean): Promise<string>;