@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,89 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.processImportsWithStoreAt = processImportsWithStoreAt;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _rewriteImports = require("./rewriteImports");
10
+ var _resolveModulePath = require("./resolveModulePath");
11
+ var _getFileNameFromUrl = require("./getFileNameFromUrl");
12
+ /**
13
+ * Processes imports based on the specified storage mode, automatically handling
14
+ * source rewriting when needed (e.g., for 'flat' mode).
15
+ *
16
+ * @param source - The original source code
17
+ * @param importResult - The result from resolveImports
18
+ * @param resolvedPathsMap - Map from import paths to resolved file paths
19
+ * @param storeAt - How to process the imports
20
+ * @returns Object with processed source and extraFiles mapping
21
+ */
22
+ function processImportsWithStoreAt(source, importResult, resolvedPathsMap, storeAt) {
23
+ var processedSource = source;
24
+ var extraFiles = {};
25
+
26
+ // For flat mode, automatically rewrite imports to same directory
27
+ if (storeAt === 'flat') {
28
+ var allResolvedPaths = new Set(resolvedPathsMap.values());
29
+ processedSource = (0, _rewriteImports.rewriteImportsToSameDirectory)(source, allResolvedPaths);
30
+ }
31
+
32
+ // Process each import and generate extraFiles
33
+ Object.entries(importResult).forEach(function (_ref) {
34
+ var _ref2 = (0, _slicedToArray2["default"])(_ref, 2),
35
+ relativePath = _ref2[0],
36
+ importInfo = _ref2[1];
37
+ var resolvedPath = resolvedPathsMap.get(importInfo.path);
38
+ if (resolvedPath) {
39
+ var fileExtension = (0, _getFileNameFromUrl.getFileNameFromUrl)(resolvedPath).extension;
40
+ var isJavascriptModule = (0, _resolveModulePath.isJavaScriptModule)(relativePath);
41
+ var keyPath;
42
+ if (!isJavascriptModule) {
43
+ // For static assets (CSS, JSON, etc.), use the original import path as-is since it already has the extension
44
+ switch (storeAt) {
45
+ case 'canonical':
46
+ case 'import':
47
+ keyPath = relativePath;
48
+ break;
49
+ case 'flat':
50
+ // For flat mode, use just the filename from the original import
51
+ keyPath = "./".concat((0, _getFileNameFromUrl.getFileNameFromUrl)(relativePath).fileName);
52
+ break;
53
+ default:
54
+ keyPath = relativePath;
55
+ }
56
+ } else {
57
+ // For JS/TS modules, apply the existing logic
58
+ switch (storeAt) {
59
+ case 'canonical':
60
+ // Show the full resolved path including index files when they exist
61
+ // e.g., import '../Component' resolved to '/src/Component/index.js'
62
+ // becomes extraFiles: { '../Component/index.js': 'file:///src/Component/index.js' }
63
+ keyPath = "".concat(relativePath).concat(resolvedPath.endsWith("/index".concat(fileExtension)) ? "/index".concat(fileExtension) : fileExtension);
64
+ break;
65
+ case 'import':
66
+ // Use the original import path with the actual file extension
67
+ // e.g., import '../Component' with '/src/Component/index.js'
68
+ // becomes extraFiles: { '../Component.js': 'file:///src/Component/index.js' }
69
+ keyPath = "".concat(relativePath).concat(fileExtension);
70
+ break;
71
+ case 'flat':
72
+ // Flatten all files to current directory using just the filename
73
+ // e.g., import '../Component' with '/src/Component/index.js'
74
+ // becomes extraFiles: { './index.js': 'file:///src/Component/index.js' }
75
+ // Note: This mode also requires rewriting imports in the source code (handled above)
76
+ keyPath = "./".concat((0, _getFileNameFromUrl.getFileNameFromUrl)(resolvedPath).fileName);
77
+ break;
78
+ default:
79
+ keyPath = "".concat(relativePath).concat(fileExtension);
80
+ }
81
+ }
82
+ extraFiles[keyPath] = "file://".concat(resolvedPath);
83
+ }
84
+ });
85
+ return {
86
+ processedSource: processedSource,
87
+ extraFiles: extraFiles
88
+ };
89
+ }
@@ -0,0 +1,4 @@
1
+ export declare function resolveImports(code: string, filePath: string): Promise<Record<string, {
2
+ path: string;
3
+ names: string[];
4
+ }>>;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.resolveImports = resolveImports;
8
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ function resolveImports(_x, _x2) {
12
+ return _resolveImports.apply(this, arguments);
13
+ }
14
+ function _resolveImports() {
15
+ _resolveImports = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _callee(code, filePath) {
16
+ var result, importRegex, importMatch, _loop;
17
+ return (0, _regeneratorRuntime2["default"])().wrap(function _callee$(_context2) {
18
+ while (1) switch (_context2.prev = _context2.next) {
19
+ case 0:
20
+ result = {};
21
+ importRegex = /import\s+(?:(\w+)|\*\s+as\s+(\w+)|{([^}]+)})\s+from\s+['"]([^'"]+)['"]/g;
22
+ importMatch = importRegex.exec(code);
23
+ _loop = /*#__PURE__*/(0, _regeneratorRuntime2["default"])().mark(function _loop() {
24
+ var _importMatch, _importMatch2, defaultImport, namespaceImport, namedImportsStr, modulePath, basePath, resolvedPath, namedImports;
25
+ return (0, _regeneratorRuntime2["default"])().wrap(function _loop$(_context) {
26
+ while (1) switch (_context.prev = _context.next) {
27
+ case 0:
28
+ _importMatch = importMatch, _importMatch2 = (0, _slicedToArray2["default"])(_importMatch, 5), defaultImport = _importMatch2[1], namespaceImport = _importMatch2[2], namedImportsStr = _importMatch2[3], modulePath = _importMatch2[4]; // Only process relative imports
29
+ if (modulePath.startsWith('.')) {
30
+ basePath = filePath.substring(0, filePath.lastIndexOf('/'));
31
+ resolvedPath = new URL(modulePath, "file://".concat(basePath, "/")).pathname;
32
+ if (!result[modulePath]) {
33
+ result[modulePath] = {
34
+ path: resolvedPath,
35
+ names: []
36
+ };
37
+ }
38
+ if (defaultImport) {
39
+ result[modulePath].names.push(defaultImport);
40
+ } else if (namespaceImport) {
41
+ result[modulePath].names.push(namespaceImport);
42
+ } else if (namedImportsStr) {
43
+ // Handle named imports like { ComponentName, Component2 as Alias }
44
+ namedImports = namedImportsStr.split(',').map(function (s) {
45
+ return s.trim();
46
+ });
47
+ namedImports.forEach(function (namedImport) {
48
+ var cleanImport = namedImport.split(' as ')[0].trim();
49
+ result[modulePath].names.push(cleanImport);
50
+ });
51
+ }
52
+ }
53
+ importMatch = importRegex.exec(code);
54
+ case 3:
55
+ case "end":
56
+ return _context.stop();
57
+ }
58
+ }, _loop);
59
+ });
60
+ case 4:
61
+ if (!(importMatch !== null)) {
62
+ _context2.next = 8;
63
+ break;
64
+ }
65
+ return _context2.delegateYield(_loop(), "t0", 6);
66
+ case 6:
67
+ _context2.next = 4;
68
+ break;
69
+ case 8:
70
+ return _context2.abrupt("return", result);
71
+ case 9:
72
+ case "end":
73
+ return _context2.stop();
74
+ }
75
+ }, _callee);
76
+ }));
77
+ return _resolveImports.apply(this, arguments);
78
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Default file extensions for JavaScript/TypeScript modules that can be resolved
3
+ */
4
+ export declare const JAVASCRIPT_MODULE_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".jsx"];
5
+ /**
6
+ * Checks if a file path or import path represents a JavaScript/TypeScript module
7
+ * @param path - The file path or import path to check
8
+ * @returns true if it's a JS/TS module, false otherwise
9
+ */
10
+ export declare function isJavaScriptModule(path: string): boolean;
11
+ export interface DirectoryEntry {
12
+ name: string;
13
+ isFile: boolean;
14
+ isDirectory: boolean;
15
+ }
16
+ export type DirectoryReader = (path: string) => Promise<DirectoryEntry[]>;
17
+ export interface ResolveModulePathOptions {
18
+ /**
19
+ * Array of file extensions to try when resolving modules.
20
+ * Default: ['.ts', '.tsx', '.js', '.jsx']
21
+ */
22
+ extensions?: string[];
23
+ }
24
+ /**
25
+ * Resolves a module path by reading directory contents to find matching files.
26
+ * This is more efficient than checking each file individually with stat calls.
27
+ *
28
+ * Given a path like `/Code/mui-public/packages/docs-infra/docs/app/components/code-highlighter/demos/code/BasicCode`,
29
+ * this function will try to find the actual file by checking for:
30
+ * - `BasicCode.ts`, `BasicCode.tsx`, `BasicCode.js`, `BasicCode.jsx`
31
+ * - `BasicCode/index.ts`, `BasicCode/index.tsx`, `BasicCode/index.js`, `BasicCode/index.jsx`
32
+ *
33
+ * @param modulePath - The module path to resolve (without file extension)
34
+ * @param readDirectory - Function to read directory contents
35
+ * @param options - Configuration options
36
+ * @returns Promise<string> - The resolved file path, or throws if not found
37
+ */
38
+ export declare function resolveModulePath(modulePath: string, readDirectory: DirectoryReader, options?: ResolveModulePathOptions): Promise<string>;
39
+ /**
40
+ * Resolves multiple module paths efficiently by grouping them by directory
41
+ * and performing batch directory lookups.
42
+ *
43
+ * @param modulePaths - Array of module paths to resolve (without file extensions)
44
+ * @param readDirectory - Function to read directory contents
45
+ * @param options - Configuration options
46
+ * @returns Promise<Map<string, string>> - Map from input path to resolved file path
47
+ */
48
+ export declare function resolveModulePaths(modulePaths: string[], readDirectory: DirectoryReader, options?: ResolveModulePathOptions): Promise<Map<string, string>>;
49
+ /**
50
+ * Resolves import result by separating JavaScript modules from static assets,
51
+ * only resolving JavaScript modules and returning a combined map.
52
+ * This function uses the resolveModulePaths function internally but requires
53
+ * a DirectoryReader to be provided.
54
+ *
55
+ * @param importResult - The result from resolveImports containing all imports
56
+ * @param readDirectory - Function to read directory contents
57
+ * @param options - Configuration options for module resolution
58
+ * @returns Promise<Map<string, string>> - Map from import path to resolved file path
59
+ */
60
+ export declare function resolveImportResult(importResult: Record<string, {
61
+ path: string;
62
+ names: string[];
63
+ }>, readDirectory: DirectoryReader, options?: ResolveModulePathOptions): Promise<Map<string, string>>;
64
+ /**
65
+ * Resolves variant paths from a variants object mapping variant names to their file paths.
66
+ * This function extracts the paths, resolves them using resolveModulePaths, and returns
67
+ * a map from variant name to resolved file URL.
68
+ *
69
+ * @param variants - Object mapping variant names to their file paths
70
+ * @param readDirectory - Function to read directory contents
71
+ * @param options - Configuration options for module resolution
72
+ * @returns Promise<Map<string, string>> - Map from variant name to resolved file URL
73
+ */
74
+ export declare function resolveVariantPaths(variants: Record<string, string>, readDirectory: DirectoryReader, options?: ResolveModulePathOptions): Promise<Map<string, string>>;