@mui/internal-docs-infra 0.1.1-alpha.1 → 0.1.1-alpha.10

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 (286) hide show
  1. package/CodeControllerContext/CodeControllerContext.d.ts +1 -1
  2. package/CodeControllerContext/CodeControllerContext.d.ts.map +1 -1
  3. package/CodeControllerContext/index.d.ts.map +1 -1
  4. package/CodeExternalsContext/CodeExternalsContext.d.ts +8 -0
  5. package/CodeExternalsContext/CodeExternalsContext.d.ts.map +1 -0
  6. package/CodeExternalsContext/CodeExternalsContext.js +7 -0
  7. package/CodeExternalsContext/index.d.ts +1 -0
  8. package/CodeExternalsContext/index.d.ts.map +1 -0
  9. package/CodeExternalsContext/index.js +1 -0
  10. package/CodeHighlighter/CodeHighlighter.d.ts +1 -1
  11. package/CodeHighlighter/CodeHighlighter.d.ts.map +1 -1
  12. package/CodeHighlighter/CodeHighlighter.js +235 -86
  13. package/CodeHighlighter/CodeHighlighterClient.d.ts.map +1 -1
  14. package/CodeHighlighter/CodeHighlighterClient.js +500 -62
  15. package/CodeHighlighter/CodeHighlighterContext.d.ts +2 -0
  16. package/CodeHighlighter/CodeHighlighterContext.d.ts.map +1 -1
  17. package/CodeHighlighter/CodeHighlighterFallbackContext.d.ts.map +1 -1
  18. package/CodeHighlighter/CodeHighlighterFallbackContext.js +3 -1
  19. package/CodeHighlighter/applyTransform.d.ts.map +1 -1
  20. package/CodeHighlighter/codeToFallbackProps.d.ts +2 -2
  21. package/CodeHighlighter/codeToFallbackProps.d.ts.map +1 -1
  22. package/CodeHighlighter/codeToFallbackProps.js +8 -5
  23. package/CodeHighlighter/errors.d.ts.map +1 -1
  24. package/CodeHighlighter/hasAllVariants.d.ts.map +1 -1
  25. package/CodeHighlighter/index.d.ts.map +1 -1
  26. package/CodeHighlighter/loadFallbackCode.d.ts +3 -2
  27. package/CodeHighlighter/loadFallbackCode.d.ts.map +1 -1
  28. package/CodeHighlighter/loadFallbackCode.js +325 -161
  29. package/CodeHighlighter/loadVariant.d.ts +3 -2
  30. package/CodeHighlighter/loadVariant.d.ts.map +1 -1
  31. package/CodeHighlighter/loadVariant.js +604 -229
  32. package/CodeHighlighter/maybeInitialData.d.ts +1 -1
  33. package/CodeHighlighter/maybeInitialData.d.ts.map +1 -1
  34. package/CodeHighlighter/parseCode.d.ts.map +1 -1
  35. package/CodeHighlighter/parseCode.js +14 -2
  36. package/CodeHighlighter/parseControlledCode.d.ts.map +1 -1
  37. package/CodeHighlighter/parseControlledCode.js +12 -1
  38. package/CodeHighlighter/transformCode.d.ts +1 -0
  39. package/CodeHighlighter/transformCode.d.ts.map +1 -1
  40. package/CodeHighlighter/transformCode.js +43 -3
  41. package/CodeHighlighter/transformParsedSource.d.ts.map +1 -1
  42. package/CodeHighlighter/transformSource.d.ts.map +1 -1
  43. package/CodeHighlighter/types.d.ts +39 -17
  44. package/CodeHighlighter/types.d.ts.map +1 -1
  45. package/CodeProvider/CodeContext.d.ts.map +1 -1
  46. package/CodeProvider/CodeProvider.d.ts.map +1 -1
  47. package/CodeProvider/CodeProvider.js +21 -6
  48. package/CodeProvider/index.d.ts +1 -2
  49. package/CodeProvider/index.d.ts.map +1 -1
  50. package/CodeProvider/index.js +1 -2
  51. package/abstractCreateDemo/abstractCreateDemo.d.ts +35 -0
  52. package/abstractCreateDemo/abstractCreateDemo.d.ts.map +1 -0
  53. package/abstractCreateDemo/abstractCreateDemo.js +91 -0
  54. package/abstractCreateDemo/index.d.ts +1 -0
  55. package/abstractCreateDemo/index.d.ts.map +1 -0
  56. package/abstractCreateDemo/index.js +1 -0
  57. package/createDemoData/createDemoData.d.ts +44 -0
  58. package/createDemoData/createDemoData.d.ts.map +1 -0
  59. package/createDemoData/createDemoData.js +75 -0
  60. package/createDemoData/index.d.ts +1 -0
  61. package/createDemoData/index.d.ts.map +1 -0
  62. package/createDemoData/index.js +1 -0
  63. package/createDemoData/types.d.ts +28 -0
  64. package/createDemoData/types.d.ts.map +1 -0
  65. package/createDemoData/types.js +1 -0
  66. package/package.json +15 -9
  67. package/pipeline/hastUtils/hastUtils.d.ts.map +1 -0
  68. package/{hast/hast.js → pipeline/hastUtils/hastUtils.js} +2 -1
  69. package/pipeline/hastUtils/index.d.ts +1 -0
  70. package/pipeline/hastUtils/index.d.ts.map +1 -0
  71. package/pipeline/hastUtils/index.js +1 -0
  72. package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.d.ts +54 -0
  73. package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.d.ts.map +1 -0
  74. package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.js +465 -0
  75. package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.d.ts +15 -0
  76. package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.d.ts.map +1 -0
  77. package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.js +253 -0
  78. package/pipeline/loadPrecomputedCodeHighlighter/index.d.ts.map +1 -0
  79. package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +20 -0
  80. package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts.map +1 -0
  81. package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/loadPrecomputedCodeHighlighter.js +105 -75
  82. package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/parseCreateFactoryCall.d.ts +12 -1
  83. package/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts.map +1 -0
  84. package/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +433 -0
  85. package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/parseFunctionParameters.d.ts +5 -1
  86. package/pipeline/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts.map +1 -0
  87. package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/parseFunctionParameters.js +1 -1
  88. package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +25 -0
  89. package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts.map +1 -0
  90. package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +73 -0
  91. package/pipeline/loadServerCodeMeta/index.d.ts +1 -0
  92. package/pipeline/loadServerCodeMeta/index.d.ts.map +1 -0
  93. package/pipeline/loadServerCodeMeta/index.js +1 -0
  94. package/{loadServerCodeMeta/serverLoadCodeMeta.d.ts → pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts} +4 -4
  95. package/pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts.map +1 -0
  96. package/{loadServerCodeMeta/serverLoadCodeMeta.js → pipeline/loadServerCodeMeta/loadServerCodeMeta.js} +18 -3
  97. package/pipeline/loadServerSource/index.d.ts +1 -0
  98. package/pipeline/loadServerSource/index.d.ts.map +1 -0
  99. package/pipeline/loadServerSource/index.js +1 -0
  100. package/{loadServerSource/serverLoadSource.d.ts → pipeline/loadServerSource/loadServerSource.d.ts} +5 -5
  101. package/pipeline/loadServerSource/loadServerSource.d.ts.map +1 -0
  102. package/pipeline/loadServerSource/loadServerSource.js +135 -0
  103. package/pipeline/loaderUtils/externalsToPackages.d.ts +1 -0
  104. package/pipeline/loaderUtils/externalsToPackages.d.ts.map +1 -0
  105. package/pipeline/loaderUtils/externalsToPackages.js +46 -0
  106. package/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts +34 -0
  107. package/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts.map +1 -0
  108. package/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +161 -0
  109. package/pipeline/loaderUtils/getFileNameFromUrl.d.ts.map +1 -0
  110. package/pipeline/loaderUtils/index.d.ts +7 -0
  111. package/pipeline/loaderUtils/index.d.ts.map +1 -0
  112. package/pipeline/loaderUtils/index.js +7 -0
  113. package/pipeline/loaderUtils/mergeExternals.d.ts +32 -0
  114. package/pipeline/loaderUtils/mergeExternals.d.ts.map +1 -0
  115. package/pipeline/loaderUtils/mergeExternals.js +72 -0
  116. package/pipeline/loaderUtils/parseImports.d.ts +20 -0
  117. package/pipeline/loaderUtils/parseImports.d.ts.map +1 -0
  118. package/pipeline/loaderUtils/parseImports.js +307 -0
  119. package/{loaderUtils/processImports.d.ts → pipeline/loaderUtils/processRelativeImports.d.ts} +2 -2
  120. package/pipeline/loaderUtils/processRelativeImports.d.ts.map +1 -0
  121. package/pipeline/loaderUtils/processRelativeImports.js +329 -0
  122. package/{loaderUtils → pipeline/loaderUtils}/resolveModulePath.d.ts +19 -6
  123. package/pipeline/loaderUtils/resolveModulePath.d.ts.map +1 -0
  124. package/pipeline/loaderUtils/resolveModulePath.js +1449 -0
  125. package/{loaderUtils → pipeline/loaderUtils}/resolveModulePathWithFs.d.ts +6 -3
  126. package/pipeline/loaderUtils/resolveModulePathWithFs.d.ts.map +1 -0
  127. package/{loaderUtils → pipeline/loaderUtils}/resolveModulePathWithFs.js +8 -4
  128. package/pipeline/loaderUtils/rewriteImports.d.ts +9 -0
  129. package/pipeline/loaderUtils/rewriteImports.d.ts.map +1 -0
  130. package/pipeline/loaderUtils/rewriteImports.js +35 -0
  131. package/pipeline/parseSource/grammars.d.ts.map +1 -0
  132. package/pipeline/parseSource/index.d.ts.map +1 -0
  133. package/pipeline/parseSource/parseSource.d.ts +3 -0
  134. package/pipeline/parseSource/parseSource.d.ts.map +1 -0
  135. package/{parseSource → pipeline/parseSource}/parseSource.js +15 -5
  136. package/pipeline/transformHtmlCode/index.d.ts +2 -0
  137. package/pipeline/transformHtmlCode/index.d.ts.map +1 -0
  138. package/pipeline/transformHtmlCode/index.js +4 -0
  139. package/pipeline/transformHtmlCode/transformHtmlCode.d.ts +13 -0
  140. package/pipeline/transformHtmlCode/transformHtmlCode.d.ts.map +1 -0
  141. package/pipeline/transformHtmlCode/transformHtmlCode.js +303 -0
  142. package/pipeline/transformMarkdownCode/index.d.ts +2 -0
  143. package/pipeline/transformMarkdownCode/index.d.ts.map +1 -0
  144. package/pipeline/transformMarkdownCode/index.js +4 -0
  145. package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts +2 -0
  146. package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts.map +1 -0
  147. package/pipeline/transformMarkdownCode/transformMarkdownCode.js +514 -0
  148. package/pipeline/transformTypescriptToJavascript/index.d.ts +1 -0
  149. package/pipeline/transformTypescriptToJavascript/index.d.ts.map +1 -0
  150. package/pipeline/transformTypescriptToJavascript/index.js +1 -0
  151. package/pipeline/transformTypescriptToJavascript/removeTypes.d.ts.map +1 -0
  152. package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts +3 -0
  153. package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts.map +1 -0
  154. package/{transformTsToJs/transformTsToJs.js → pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.js} +4 -4
  155. package/useCode/index.d.ts.map +1 -1
  156. package/useCode/useCode.d.ts +13 -11
  157. package/useCode/useCode.d.ts.map +1 -1
  158. package/useCode/useCode.js +93 -364
  159. package/useCode/useCodeUtils.d.ts +45 -0
  160. package/useCode/useCodeUtils.d.ts.map +1 -0
  161. package/useCode/useCodeUtils.js +240 -0
  162. package/useCode/useCopyFunctionality.d.ts +17 -0
  163. package/useCode/useCopyFunctionality.d.ts.map +1 -0
  164. package/useCode/useCopyFunctionality.js +28 -0
  165. package/useCode/useFileNavigation.d.ts +48 -0
  166. package/useCode/useFileNavigation.d.ts.map +1 -0
  167. package/useCode/useFileNavigation.js +370 -0
  168. package/useCode/useSourceEditing.d.ts +19 -0
  169. package/useCode/useSourceEditing.d.ts.map +1 -0
  170. package/useCode/useSourceEditing.js +32 -0
  171. package/useCode/useTransformManagement.d.ts +28 -0
  172. package/useCode/useTransformManagement.d.ts.map +1 -0
  173. package/useCode/useTransformManagement.js +82 -0
  174. package/useCode/useUIState.d.ts +16 -0
  175. package/useCode/useUIState.d.ts.map +1 -0
  176. package/useCode/useUIState.js +21 -0
  177. package/useCode/useVariantSelection.d.ts +21 -0
  178. package/useCode/useVariantSelection.d.ts.map +1 -0
  179. package/useCode/useVariantSelection.js +84 -0
  180. package/useCopier/index.d.ts +1 -1
  181. package/useCopier/index.d.ts.map +1 -1
  182. package/useCopier/index.js +5 -5
  183. package/useDemo/createCodeSandbox.d.ts +18 -0
  184. package/useDemo/createCodeSandbox.d.ts.map +1 -0
  185. package/useDemo/createCodeSandbox.js +48 -0
  186. package/useDemo/createStackBlitz.d.ts +22 -0
  187. package/useDemo/createStackBlitz.d.ts.map +1 -0
  188. package/useDemo/createStackBlitz.js +38 -0
  189. package/useDemo/examineVariant.d.ts +25 -0
  190. package/useDemo/examineVariant.d.ts.map +1 -0
  191. package/useDemo/examineVariant.js +134 -0
  192. package/useDemo/exportVariant.d.ts +110 -0
  193. package/useDemo/exportVariant.d.ts.map +1 -0
  194. package/useDemo/exportVariant.js +320 -0
  195. package/useDemo/exportVariantAsCra.d.ts +15 -0
  196. package/useDemo/exportVariantAsCra.d.ts.map +1 -0
  197. package/useDemo/exportVariantAsCra.js +56 -0
  198. package/useDemo/flattenVariant.d.ts +17 -0
  199. package/useDemo/flattenVariant.d.ts.map +1 -0
  200. package/useDemo/flattenVariant.js +206 -0
  201. package/useDemo/index.d.ts +6 -39
  202. package/useDemo/index.d.ts.map +1 -1
  203. package/useDemo/index.js +6 -17
  204. package/useDemo/useDemo.d.ts +78 -0
  205. package/useDemo/useDemo.d.ts.map +1 -0
  206. package/useDemo/useDemo.js +174 -0
  207. package/useLocalStorageState/index.d.ts +2 -0
  208. package/useLocalStorageState/index.d.ts.map +1 -0
  209. package/useLocalStorageState/index.js +2 -0
  210. package/useLocalStorageState/useLocalStorageState.d.ts +14 -0
  211. package/useLocalStorageState/useLocalStorageState.d.ts.map +1 -0
  212. package/useLocalStorageState/useLocalStorageState.js +128 -0
  213. package/useOnHydrate/index.d.ts.map +1 -1
  214. package/useOnHydrate/useOnHydrate.d.ts.map +1 -1
  215. package/useOnIdle/index.d.ts.map +1 -1
  216. package/useOnIdle/useOnIdle.d.ts.map +1 -1
  217. package/useUrlHashState/index.d.ts +1 -0
  218. package/useUrlHashState/index.d.ts.map +1 -0
  219. package/useUrlHashState/index.js +1 -0
  220. package/useUrlHashState/useUrlHashState.d.ts +50 -0
  221. package/useUrlHashState/useUrlHashState.d.ts.map +1 -0
  222. package/useUrlHashState/useUrlHashState.js +113 -0
  223. package/hast/hast.d.ts.map +0 -1
  224. package/hast/index.d.ts +0 -1
  225. package/hast/index.d.ts.map +0 -1
  226. package/hast/index.js +0 -1
  227. package/loadPrecomputedCodeHighlighter/index.d.ts.map +0 -1
  228. package/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +0 -57
  229. package/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts.map +0 -1
  230. package/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts.map +0 -1
  231. package/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +0 -243
  232. package/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts.map +0 -1
  233. package/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +0 -27
  234. package/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts.map +0 -1
  235. package/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +0 -37
  236. package/loadServerCodeMeta/index.d.ts +0 -1
  237. package/loadServerCodeMeta/index.d.ts.map +0 -1
  238. package/loadServerCodeMeta/index.js +0 -1
  239. package/loadServerCodeMeta/serverLoadCodeMeta.d.ts.map +0 -1
  240. package/loadServerSource/index.d.ts +0 -1
  241. package/loadServerSource/index.d.ts.map +0 -1
  242. package/loadServerSource/index.js +0 -1
  243. package/loadServerSource/serverLoadSource.d.ts.map +0 -1
  244. package/loadServerSource/serverLoadSource.js +0 -100
  245. package/loaderUtils/getFileNameFromUrl.d.ts.map +0 -1
  246. package/loaderUtils/index.d.ts +0 -5
  247. package/loaderUtils/index.d.ts.map +0 -1
  248. package/loaderUtils/index.js +0 -5
  249. package/loaderUtils/processImports.d.ts.map +0 -1
  250. package/loaderUtils/processImports.js +0 -82
  251. package/loaderUtils/resolveImports.d.ts +0 -4
  252. package/loaderUtils/resolveImports.d.ts.map +0 -1
  253. package/loaderUtils/resolveImports.js +0 -71
  254. package/loaderUtils/resolveModulePath.d.ts.map +0 -1
  255. package/loaderUtils/resolveModulePath.js +0 -862
  256. package/loaderUtils/resolveModulePathWithFs.d.ts.map +0 -1
  257. package/loaderUtils/rewriteImports.d.ts +0 -9
  258. package/loaderUtils/rewriteImports.d.ts.map +0 -1
  259. package/loaderUtils/rewriteImports.js +0 -57
  260. package/parseSource/grammars.d.ts.map +0 -1
  261. package/parseSource/index.d.ts.map +0 -1
  262. package/parseSource/parseSource.d.ts +0 -3
  263. package/parseSource/parseSource.d.ts.map +0 -1
  264. package/transformRelativeMarkdownPaths/index.d.ts +0 -2
  265. package/transformRelativeMarkdownPaths/index.d.ts.map +0 -1
  266. package/transformRelativeMarkdownPaths/index.js +0 -4
  267. package/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts +0 -12
  268. package/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts.map +0 -1
  269. package/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.js +0 -30
  270. package/transformTsToJs/index.d.ts +0 -1
  271. package/transformTsToJs/index.d.ts.map +0 -1
  272. package/transformTsToJs/index.js +0 -1
  273. package/transformTsToJs/removeTypes.d.ts.map +0 -1
  274. package/transformTsToJs/transformTsToJs.d.ts +0 -3
  275. package/transformTsToJs/transformTsToJs.d.ts.map +0 -1
  276. /package/{hast/hast.d.ts → pipeline/hastUtils/hastUtils.d.ts} +0 -0
  277. /package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/index.d.ts +0 -0
  278. /package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/index.js +0 -0
  279. /package/{loaderUtils → pipeline/loaderUtils}/getFileNameFromUrl.d.ts +0 -0
  280. /package/{loaderUtils → pipeline/loaderUtils}/getFileNameFromUrl.js +0 -0
  281. /package/{parseSource → pipeline/parseSource}/grammars.d.ts +0 -0
  282. /package/{parseSource → pipeline/parseSource}/grammars.js +0 -0
  283. /package/{parseSource → pipeline/parseSource}/index.d.ts +0 -0
  284. /package/{parseSource → pipeline/parseSource}/index.js +0 -0
  285. /package/{transformTsToJs → pipeline/transformTypescriptToJavascript}/removeTypes.d.ts +0 -0
  286. /package/{transformTsToJs → pipeline/transformTypescriptToJavascript}/removeTypes.js +0 -0
@@ -1,5 +1,5 @@
1
- import type { LoadSource } from "../CodeHighlighter/types.js";
2
- import { type StoreAtMode } from "../loaderUtils/processImports.js";
1
+ import type { LoadSource } from "../../CodeHighlighter/types.js";
2
+ import { type StoreAtMode } from "../loaderUtils/processRelativeImports.js";
3
3
  interface LoadSourceOptions {
4
4
  maxDepth?: number;
5
5
  maxFiles?: number;
@@ -7,12 +7,12 @@ interface LoadSourceOptions {
7
7
  storeAt?: StoreAtMode;
8
8
  }
9
9
  /**
10
- * Default serverLoadSource function that reads a file and extracts its dependencies.
10
+ * Default loadServerSource function that reads a file and extracts its dependencies.
11
11
  * This function is used to load source files for demos, resolving their imports and dependencies.
12
12
  * It reads the source file, resolves its imports, and returns the processed source along with any
13
13
  * additional files and dependencies that were found.
14
14
  */
15
- export declare const serverLoadSource: LoadSource;
15
+ export declare const loadServerSource: LoadSource;
16
16
  /**
17
17
  * Creates a loadSource function that reads a file and extracts its dependencies.
18
18
  *
@@ -21,5 +21,5 @@ export declare const serverLoadSource: LoadSource;
21
21
  * - 'import': Import path with file extension (e.g., '../Component.js')
22
22
  * - 'flat': Flattened to current directory with rewritten imports (e.g., './Component.js')
23
23
  */
24
- export declare function createServerLoadSource(options?: LoadSourceOptions): LoadSource;
24
+ export declare function createLoadServerSource(options?: LoadSourceOptions): LoadSource;
25
25
  export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadServerSource.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loadServerSource/loadServerSource.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,6BAA6B,CAAC;AAGzE,OAAO,EAA0B,KAAK,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAGjG,UAAU,iBAAiB;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,YAA2B,CAAC;AAEzD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU,CA8ElF"}
@@ -0,0 +1,135 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
+ import { readFile } from 'node:fs/promises';
6
+ import { parseImports } from "../loaderUtils/index.js";
7
+ import { resolveImportResultWithFs } from "../loaderUtils/resolveModulePathWithFs.js";
8
+ import { processRelativeImports } from "../loaderUtils/processRelativeImports.js";
9
+ import { isJavaScriptModule } from "../loaderUtils/resolveModulePath.js";
10
+ /**
11
+ * Default loadServerSource function that reads a file and extracts its dependencies.
12
+ * This function is used to load source files for demos, resolving their imports and dependencies.
13
+ * It reads the source file, resolves its imports, and returns the processed source along with any
14
+ * additional files and dependencies that were found.
15
+ */
16
+ export var loadServerSource = createLoadServerSource();
17
+
18
+ /**
19
+ * Creates a loadSource function that reads a file and extracts its dependencies.
20
+ *
21
+ * @param options.storeAt - Controls how imports are stored in extraFiles:
22
+ * - 'canonical': Full resolved path (e.g., '../Component/index.js')
23
+ * - 'import': Import path with file extension (e.g., '../Component.js')
24
+ * - 'flat': Flattened to current directory with rewritten imports (e.g., './Component.js')
25
+ */
26
+ export function createLoadServerSource() {
27
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28
+ var _options$includeDepen = options.includeDependencies,
29
+ includeDependencies = _options$includeDepen === void 0 ? true : _options$includeDepen,
30
+ _options$storeAt = options.storeAt,
31
+ storeAt = _options$storeAt === void 0 ? 'flat' : _options$storeAt;
32
+ return /*#__PURE__*/function () {
33
+ var _loadSource = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
34
+ var filePath, source, isJavascriptModuleFile, _yield$parseImports, importResult, externals, transformedExternals, _i, _Object$entries, _Object$entries$_i, modulePath, externalImport, relativeImportsCompatible, _i2, _Object$entries2, _Object$entries2$_i, importPath, _Object$entries2$_i$, path, names, includeTypeDefs, resolvedPathsMap, _processRelativeImpor, processedSource, extraFiles, extraDependencies;
35
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
36
+ while (1) switch (_context.prev = _context.next) {
37
+ case 0:
38
+ // Remove file:// prefix if present
39
+ filePath = url.replace('file://', ''); // Read the file
40
+ _context.next = 3;
41
+ return readFile(filePath, 'utf8');
42
+ case 3:
43
+ source = _context.sent;
44
+ if (includeDependencies) {
45
+ _context.next = 6;
46
+ break;
47
+ }
48
+ return _context.abrupt("return", {
49
+ source: source
50
+ });
51
+ case 6:
52
+ // Check if this is a static asset file (non-JS/TS modules)
53
+ isJavascriptModuleFile = isJavaScriptModule(filePath);
54
+ if (isJavascriptModuleFile) {
55
+ _context.next = 9;
56
+ break;
57
+ }
58
+ return _context.abrupt("return", {
59
+ source: source
60
+ });
61
+ case 9:
62
+ _context.next = 11;
63
+ return parseImports(source, filePath);
64
+ case 11:
65
+ _yield$parseImports = _context.sent;
66
+ importResult = _yield$parseImports.relative;
67
+ externals = _yield$parseImports.externals;
68
+ // Transform externals from parseImports format to simplified format
69
+ transformedExternals = {};
70
+ for (_i = 0, _Object$entries = Object.entries(externals); _i < _Object$entries.length; _i++) {
71
+ _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), modulePath = _Object$entries$_i[0], externalImport = _Object$entries$_i[1];
72
+ transformedExternals[modulePath] = externalImport.names.map(function (importName) {
73
+ return {
74
+ name: importName.name,
75
+ type: importName.type,
76
+ isType: importName.isType
77
+ };
78
+ });
79
+ }
80
+ if (!(Object.keys(importResult).length === 0)) {
81
+ _context.next = 18;
82
+ break;
83
+ }
84
+ return _context.abrupt("return", {
85
+ source: source,
86
+ externals: Object.keys(transformedExternals).length > 0 ? transformedExternals : undefined
87
+ });
88
+ case 18:
89
+ // Convert to format expected by resolveImportResultWithFs and processImports
90
+ relativeImportsCompatible = {};
91
+ for (_i2 = 0, _Object$entries2 = Object.entries(importResult); _i2 < _Object$entries2.length; _i2++) {
92
+ _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), importPath = _Object$entries2$_i[0], _Object$entries2$_i$ = _Object$entries2$_i[1], path = _Object$entries2$_i$.path, names = _Object$entries2$_i$.names, includeTypeDefs = _Object$entries2$_i$.includeTypeDefs;
93
+ relativeImportsCompatible[importPath] = _objectSpread({
94
+ path: path,
95
+ names: names.map(function (_ref) {
96
+ var name = _ref.name,
97
+ alias = _ref.alias;
98
+ return alias || name;
99
+ })
100
+ }, includeTypeDefs && {
101
+ includeTypeDefs: includeTypeDefs
102
+ });
103
+ }
104
+
105
+ // Resolve import paths, handling JS/TS modules and static assets appropriately
106
+ _context.next = 22;
107
+ return resolveImportResultWithFs(relativeImportsCompatible);
108
+ case 22:
109
+ resolvedPathsMap = _context.sent;
110
+ // Process imports using the consolidated helper function
111
+ _processRelativeImpor = processRelativeImports(source, relativeImportsCompatible, resolvedPathsMap, storeAt), processedSource = _processRelativeImpor.processedSource, extraFiles = _processRelativeImpor.extraFiles; // Build dependencies list for recursive loading
112
+ extraDependencies = Object.values(importResult).map(function (_ref2) {
113
+ var path = _ref2.path;
114
+ return resolvedPathsMap.get(path);
115
+ }).filter(function (path) {
116
+ return path !== undefined;
117
+ });
118
+ return _context.abrupt("return", {
119
+ source: processedSource,
120
+ extraFiles: Object.keys(extraFiles).length > 0 ? extraFiles : undefined,
121
+ extraDependencies: extraDependencies.length > 0 ? extraDependencies : undefined,
122
+ externals: Object.keys(transformedExternals).length > 0 ? transformedExternals : undefined
123
+ });
124
+ case 26:
125
+ case "end":
126
+ return _context.stop();
127
+ }
128
+ }, _callee);
129
+ }));
130
+ function loadSource(_x) {
131
+ return _loadSource.apply(this, arguments);
132
+ }
133
+ return loadSource;
134
+ }();
135
+ }
@@ -0,0 +1 @@
1
+ export declare function externalsToPackages(externals: string[]): Record<string, true>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalsToPackages.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/externalsToPackages.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAiB7E"}
@@ -0,0 +1,46 @@
1
+ export function externalsToPackages(externals) {
2
+ var packages = {};
3
+ externals.forEach(function (external) {
4
+ // Filter out path aliases that start with @/
5
+ if (external.startsWith('@/')) {
6
+ return;
7
+ }
8
+
9
+ // Extract package name from import path
10
+ var packageName = extractPackageName(external);
11
+ if (packageName) {
12
+ packages[packageName] = true;
13
+ }
14
+ });
15
+ return packages;
16
+ }
17
+
18
+ /**
19
+ * Extracts the package name from an import path.
20
+ * Examples:
21
+ * - 'react' -> 'react'
22
+ * - 'react-dom' -> 'react-dom'
23
+ * - '@mui/internal-docs-infra/CodeHighlighter' -> '@mui/internal-docs-infra'
24
+ * - '@mui/internal-docs-infra/parseSource' -> '@mui/internal-docs-infra'
25
+ * - 'lodash/get' -> 'lodash'
26
+ * - 'some-package/submodule/deep' -> 'some-package'
27
+ */
28
+ function extractPackageName(importPath) {
29
+ if (!importPath) {
30
+ return null;
31
+ }
32
+
33
+ // Handle scoped packages (starting with @)
34
+ if (importPath.startsWith('@')) {
35
+ var _parts = importPath.split('/');
36
+ if (_parts.length >= 2) {
37
+ // Return @scope/package-name
38
+ return "".concat(_parts[0], "/").concat(_parts[1]);
39
+ }
40
+ return null;
41
+ }
42
+
43
+ // Handle regular packages
44
+ var parts = importPath.split('/');
45
+ return parts[0] || null;
46
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Extracts and formats a name and slug from a URL path.
3
+ * This utility takes the last meaningful segment of a URL path and formats it
4
+ * into both a human-readable title and a URL-friendly slug.
5
+ *
6
+ * - Strips common file extensions (index.js, index.ts, index.tsx, etc.)
7
+ * - Converts kebab-case to Title Case for names
8
+ * - Ensures slugs are in kebab-case format
9
+ */
10
+ /**
11
+ * Extracts and formats a name and slug from a URL path
12
+ * @param url - The URL to extract from (can be file:// URL or regular path)
13
+ * @returns Object containing the formatted name and slug
14
+ *
15
+ * @example
16
+ * extractNameAndSlugFromUrl('file:///app/components/demos/advanced-keyboard/index.ts')
17
+ * // Returns: { name: 'Advanced Keyboard', slug: 'advanced-keyboard' }
18
+ *
19
+ * @example
20
+ * extractNameAndSlugFromUrl('/src/components/button-group.tsx')
21
+ * // Returns: { name: 'Button Group', slug: 'button-group' }
22
+ *
23
+ * @example
24
+ * extractNameAndSlugFromUrl('/src/components/customButton.tsx')
25
+ * // Returns: { name: 'Custom Button', slug: 'custom-button' }
26
+ *
27
+ * @example
28
+ * extractNameAndSlugFromUrl('https://example.com/docs/getting-started/')
29
+ * // Returns: { name: 'Getting Started', slug: 'getting-started' }
30
+ */
31
+ export declare function extractNameAndSlugFromUrl(url: string): {
32
+ name: string;
33
+ slug: string;
34
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractNameAndSlugFromUrl.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/extractNameAndSlugFromUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4HH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAgBrF"}
@@ -0,0 +1,161 @@
1
+ /**
2
+ * Extracts and formats a name and slug from a URL path.
3
+ * This utility takes the last meaningful segment of a URL path and formats it
4
+ * into both a human-readable title and a URL-friendly slug.
5
+ *
6
+ * - Strips common file extensions (index.js, index.ts, index.tsx, etc.)
7
+ * - Converts kebab-case to Title Case for names
8
+ * - Ensures slugs are in kebab-case format
9
+ */
10
+
11
+ /**
12
+ * Converts a camelCase string to kebab-case
13
+ * @param camelCase - The camelCase string to convert
14
+ * @returns kebab-case string
15
+ */
16
+ function camelToKebabCase(camelCase) {
17
+ return camelCase
18
+ // Insert hyphens before uppercase letters that follow lowercase letters or numbers
19
+ .replace(/([a-z0-9])([A-Z])/g, '$1-$2')
20
+ // Insert hyphens before numbers that follow letters
21
+ .replace(/([a-zA-Z])([0-9])/g, '$1-$2')
22
+ // Insert hyphens before letters that follow numbers
23
+ .replace(/([0-9])([a-zA-Z])/g, '$1-$2').toLowerCase();
24
+ }
25
+
26
+ /**
27
+ * Converts a camelCase string to Title Case with spaces
28
+ * @param camelCase - The camelCase string to convert
29
+ * @returns Title case string with spaces
30
+ */
31
+ function camelToTitleCase(camelCase) {
32
+ return camelCase
33
+ // Insert spaces before uppercase letters that follow lowercase letters or numbers
34
+ .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
35
+ // Insert spaces before numbers that follow letters
36
+ .replace(/([a-zA-Z])([0-9])/g, '$1 $2')
37
+ // Insert spaces before letters that follow numbers
38
+ .replace(/([0-9])([a-zA-Z])/g, '$1 $2')
39
+ // Capitalize the first letter
40
+ .replace(/^./, function (str) {
41
+ return str.toUpperCase();
42
+ });
43
+ }
44
+
45
+ /**
46
+ * Converts a kebab-case string to Title Case
47
+ * @param kebabCase - The kebab-case string to convert
48
+ * @returns Title case string
49
+ */
50
+ function kebabToTitleCase(kebabCase) {
51
+ return kebabCase.split(/[-_]/) // Split on both hyphens and underscores
52
+ .map(function (word) {
53
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
54
+ }).join(' ');
55
+ }
56
+
57
+ /**
58
+ * Detects if a string is camelCase or PascalCase
59
+ * @param str - The string to check
60
+ * @returns true if the string is camelCase or PascalCase
61
+ */
62
+ function isCamelCase(str) {
63
+ // Check if it matches the camelCase/PascalCase pattern:
64
+ // - Only contains letters and numbers
65
+ // - Has at least one transition from lowercase letter or number to uppercase letter
66
+ // - Doesn't contain hyphens, underscores, or spaces
67
+ return /^[a-zA-Z][a-zA-Z0-9]*$/.test(str) && /[a-z0-9][A-Z]/.test(str);
68
+ }
69
+
70
+ /**
71
+ * Converts a string to kebab-case
72
+ * @param str - The string to convert
73
+ * @returns kebab-case string
74
+ */
75
+ function toKebabCase(str) {
76
+ return str.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
77
+ }
78
+
79
+ /**
80
+ * Extracts the last meaningful segment from a URL path
81
+ * @param url - The URL to extract from
82
+ * @returns The last meaningful path segment
83
+ */
84
+ function extractLastSegment(url) {
85
+ // Handle file: URLs by removing the protocol
86
+ var path = url;
87
+ if (url.startsWith('file:')) {
88
+ path = url.replace(/^file:\/\//, '');
89
+ }
90
+
91
+ // Strip query parameters and hash fragments before processing
92
+ path = path.split('?')[0].split('#')[0];
93
+
94
+ // Split the path into segments and filter out empty ones
95
+ var segments = path.split('/').filter(Boolean);
96
+ if (segments.length === 0) {
97
+ throw new Error('Could not extract meaningful segment from URL');
98
+ }
99
+
100
+ // Get the last segment
101
+ var lastSegment = segments[segments.length - 1];
102
+
103
+ // Handle index files - any file that starts with 'index.'
104
+ if (lastSegment.startsWith('index.')) {
105
+ // If it's an index file, use the parent directory name
106
+ if (segments.length < 2) {
107
+ throw new Error('Cannot extract name from index file without parent directory');
108
+ }
109
+ lastSegment = segments[segments.length - 2];
110
+ } else {
111
+ // Strip everything after the first dot from non-index files
112
+ // This handles all extensions: .js, .d.ts, .module.css, .config.dev.js, etc.
113
+ var firstDotIndex = lastSegment.indexOf('.');
114
+ if (firstDotIndex !== -1) {
115
+ lastSegment = lastSegment.substring(0, firstDotIndex);
116
+ }
117
+ }
118
+ if (!lastSegment) {
119
+ throw new Error('Could not extract meaningful segment from URL');
120
+ }
121
+ return lastSegment;
122
+ }
123
+
124
+ /**
125
+ * Extracts and formats a name and slug from a URL path
126
+ * @param url - The URL to extract from (can be file:// URL or regular path)
127
+ * @returns Object containing the formatted name and slug
128
+ *
129
+ * @example
130
+ * extractNameAndSlugFromUrl('file:///app/components/demos/advanced-keyboard/index.ts')
131
+ * // Returns: { name: 'Advanced Keyboard', slug: 'advanced-keyboard' }
132
+ *
133
+ * @example
134
+ * extractNameAndSlugFromUrl('/src/components/button-group.tsx')
135
+ * // Returns: { name: 'Button Group', slug: 'button-group' }
136
+ *
137
+ * @example
138
+ * extractNameAndSlugFromUrl('/src/components/customButton.tsx')
139
+ * // Returns: { name: 'Custom Button', slug: 'custom-button' }
140
+ *
141
+ * @example
142
+ * extractNameAndSlugFromUrl('https://example.com/docs/getting-started/')
143
+ * // Returns: { name: 'Getting Started', slug: 'getting-started' }
144
+ */
145
+ export function extractNameAndSlugFromUrl(url) {
146
+ var segment = extractLastSegment(url);
147
+
148
+ // Check if the segment is camelCase and handle it appropriately
149
+ if (isCamelCase(segment)) {
150
+ return {
151
+ name: camelToTitleCase(segment),
152
+ slug: camelToKebabCase(segment)
153
+ };
154
+ }
155
+
156
+ // For kebab-case, snake_case, or other formats, use the existing logic
157
+ return {
158
+ name: kebabToTitleCase(segment),
159
+ slug: toKebabCase(segment)
160
+ };
161
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFileNameFromUrl.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/getFileNameFromUrl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAoBvF"}
@@ -0,0 +1,7 @@
1
+ export * from "./parseImports.js";
2
+ export * from "./resolveModulePath.js";
3
+ export * from "./rewriteImports.js";
4
+ export * from "./processRelativeImports.js";
5
+ export * from "./getFileNameFromUrl.js";
6
+ export * from "./extractNameAndSlugFromUrl.js";
7
+ export * from "./externalsToPackages.js";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from "./parseImports.js";
2
+ export * from "./resolveModulePath.js";
3
+ export * from "./rewriteImports.js";
4
+ export * from "./processRelativeImports.js";
5
+ export * from "./getFileNameFromUrl.js";
6
+ export * from "./extractNameAndSlugFromUrl.js";
7
+ export * from "./externalsToPackages.js";
@@ -0,0 +1,32 @@
1
+ import type { Externals } from "../../CodeHighlighter/types.js";
2
+ /**
3
+ * Merges multiple externals objects into a single object, combining imports from the same module.
4
+ * Deduplicates imports by name and type within each module.
5
+ *
6
+ * @param externalsArray Array of externals objects to merge
7
+ * @returns Merged externals object
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const externals1 = {
12
+ * 'react': [{ name: 'React', type: 'default' }],
13
+ * 'lodash': [{ name: 'map', type: 'named' }]
14
+ * };
15
+ *
16
+ * const externals2 = {
17
+ * 'react': [{ name: 'useState', type: 'named' }],
18
+ * 'lodash': [{ name: 'map', type: 'named' }] // duplicate - will be removed
19
+ * };
20
+ *
21
+ * const merged = mergeExternals([externals1, externals2]);
22
+ * // Result:
23
+ * // {
24
+ * // 'react': [
25
+ * // { name: 'React', type: 'default' },
26
+ * // { name: 'useState', type: 'named' }
27
+ * // ],
28
+ * // 'lodash': [{ name: 'map', type: 'named' }]
29
+ * // }
30
+ * ```
31
+ */
32
+ export declare function mergeExternals(externalsArray: Array<Externals>): Externals;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeExternals.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/mergeExternals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS,CA4B1E"}
@@ -0,0 +1,72 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
4
+ /**
5
+ * Merges multiple externals objects into a single object, combining imports from the same module.
6
+ * Deduplicates imports by name and type within each module.
7
+ *
8
+ * @param externalsArray Array of externals objects to merge
9
+ * @returns Merged externals object
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * const externals1 = {
14
+ * 'react': [{ name: 'React', type: 'default' }],
15
+ * 'lodash': [{ name: 'map', type: 'named' }]
16
+ * };
17
+ *
18
+ * const externals2 = {
19
+ * 'react': [{ name: 'useState', type: 'named' }],
20
+ * 'lodash': [{ name: 'map', type: 'named' }] // duplicate - will be removed
21
+ * };
22
+ *
23
+ * const merged = mergeExternals([externals1, externals2]);
24
+ * // Result:
25
+ * // {
26
+ * // 'react': [
27
+ * // { name: 'React', type: 'default' },
28
+ * // { name: 'useState', type: 'named' }
29
+ * // ],
30
+ * // 'lodash': [{ name: 'map', type: 'named' }]
31
+ * // }
32
+ * ```
33
+ */
34
+ export function mergeExternals(externalsArray) {
35
+ var merged = {};
36
+ var _iterator = _createForOfIteratorHelper(externalsArray),
37
+ _step;
38
+ try {
39
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
40
+ var externals = _step.value;
41
+ var _loop = function _loop() {
42
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
43
+ modulePath = _Object$entries$_i[0],
44
+ imports = _Object$entries$_i[1];
45
+ if (!merged[modulePath]) {
46
+ // First time seeing this module, copy all imports
47
+ merged[modulePath] = _toConsumableArray(imports);
48
+ } else {
49
+ // Module already exists, merge imports and deduplicate
50
+ var existingImports = merged[modulePath];
51
+ var newImports = imports.filter(function (newImport) {
52
+ // Check if this import already exists (same name, type, and isType)
53
+ return !existingImports.some(function (existingImport) {
54
+ return existingImport.name === newImport.name && existingImport.type === newImport.type && existingImport.isType === newImport.isType;
55
+ });
56
+ });
57
+
58
+ // Add only the new imports that don't already exist
59
+ merged[modulePath] = [].concat(_toConsumableArray(existingImports), _toConsumableArray(newImports));
60
+ }
61
+ };
62
+ for (var _i = 0, _Object$entries = Object.entries(externals); _i < _Object$entries.length; _i++) {
63
+ _loop();
64
+ }
65
+ }
66
+ } catch (err) {
67
+ _iterator.e(err);
68
+ } finally {
69
+ _iterator.f();
70
+ }
71
+ return merged;
72
+ }
@@ -0,0 +1,20 @@
1
+ interface ImportName {
2
+ name: string;
3
+ alias?: string;
4
+ type: 'default' | 'named' | 'namespace';
5
+ isType?: boolean;
6
+ }
7
+ interface RelativeImport {
8
+ path: string;
9
+ names: ImportName[];
10
+ includeTypeDefs?: true;
11
+ }
12
+ interface ExternalImport {
13
+ names: ImportName[];
14
+ }
15
+ interface ParseImportsResult {
16
+ relative: Record<string, RelativeImport>;
17
+ externals: Record<string, ExternalImport>;
18
+ }
19
+ export declare function parseImports(code: string, _filePath: string): Promise<ParseImportsResult>;
20
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseImports.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/parseImports.ts"],"names":[],"mappings":"AAEA,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,eAAe,CAAC,EAAE,IAAI,CAAC;CACxB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC3C;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA0Q/F"}