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

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 (288) 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/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +228 -0
  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/{loaderUtils → pipeline/loaderUtils}/getFileNameFromUrl.d.ts +1 -0
  110. package/pipeline/loaderUtils/getFileNameFromUrl.d.ts.map +1 -0
  111. package/pipeline/loaderUtils/getFileNameFromUrl.js +66 -0
  112. package/pipeline/loaderUtils/index.d.ts +7 -0
  113. package/pipeline/loaderUtils/index.d.ts.map +1 -0
  114. package/pipeline/loaderUtils/index.js +7 -0
  115. package/pipeline/loaderUtils/mergeExternals.d.ts +32 -0
  116. package/pipeline/loaderUtils/mergeExternals.d.ts.map +1 -0
  117. package/pipeline/loaderUtils/mergeExternals.js +72 -0
  118. package/pipeline/loaderUtils/parseImports.d.ts +20 -0
  119. package/pipeline/loaderUtils/parseImports.d.ts.map +1 -0
  120. package/pipeline/loaderUtils/parseImports.js +307 -0
  121. package/{loaderUtils/processImports.d.ts → pipeline/loaderUtils/processRelativeImports.d.ts} +2 -2
  122. package/pipeline/loaderUtils/processRelativeImports.d.ts.map +1 -0
  123. package/pipeline/loaderUtils/processRelativeImports.js +352 -0
  124. package/{loaderUtils → pipeline/loaderUtils}/resolveModulePath.d.ts +19 -6
  125. package/pipeline/loaderUtils/resolveModulePath.d.ts.map +1 -0
  126. package/pipeline/loaderUtils/resolveModulePath.js +1449 -0
  127. package/{loaderUtils → pipeline/loaderUtils}/resolveModulePathWithFs.d.ts +6 -3
  128. package/pipeline/loaderUtils/resolveModulePathWithFs.d.ts.map +1 -0
  129. package/{loaderUtils → pipeline/loaderUtils}/resolveModulePathWithFs.js +8 -4
  130. package/pipeline/loaderUtils/rewriteImports.d.ts +9 -0
  131. package/pipeline/loaderUtils/rewriteImports.d.ts.map +1 -0
  132. package/pipeline/loaderUtils/rewriteImports.js +35 -0
  133. package/pipeline/parseSource/grammars.d.ts.map +1 -0
  134. package/pipeline/parseSource/index.d.ts.map +1 -0
  135. package/pipeline/parseSource/parseSource.d.ts +3 -0
  136. package/pipeline/parseSource/parseSource.d.ts.map +1 -0
  137. package/{parseSource → pipeline/parseSource}/parseSource.js +15 -5
  138. package/pipeline/transformHtmlCode/index.d.ts +2 -0
  139. package/pipeline/transformHtmlCode/index.d.ts.map +1 -0
  140. package/pipeline/transformHtmlCode/index.js +4 -0
  141. package/pipeline/transformHtmlCode/transformHtmlCode.d.ts +13 -0
  142. package/pipeline/transformHtmlCode/transformHtmlCode.d.ts.map +1 -0
  143. package/pipeline/transformHtmlCode/transformHtmlCode.js +303 -0
  144. package/pipeline/transformMarkdownCode/index.d.ts +2 -0
  145. package/pipeline/transformMarkdownCode/index.d.ts.map +1 -0
  146. package/pipeline/transformMarkdownCode/index.js +4 -0
  147. package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts +2 -0
  148. package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts.map +1 -0
  149. package/pipeline/transformMarkdownCode/transformMarkdownCode.js +514 -0
  150. package/pipeline/transformTypescriptToJavascript/index.d.ts +1 -0
  151. package/pipeline/transformTypescriptToJavascript/index.d.ts.map +1 -0
  152. package/pipeline/transformTypescriptToJavascript/index.js +1 -0
  153. package/pipeline/transformTypescriptToJavascript/removeTypes.d.ts.map +1 -0
  154. package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts +3 -0
  155. package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts.map +1 -0
  156. package/{transformTsToJs/transformTsToJs.js → pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.js} +4 -4
  157. package/useCode/index.d.ts.map +1 -1
  158. package/useCode/useCode.d.ts +14 -11
  159. package/useCode/useCode.d.ts.map +1 -1
  160. package/useCode/useCode.js +94 -364
  161. package/useCode/useCodeUtils.d.ts +45 -0
  162. package/useCode/useCodeUtils.d.ts.map +1 -0
  163. package/useCode/useCodeUtils.js +240 -0
  164. package/useCode/useCopyFunctionality.d.ts +17 -0
  165. package/useCode/useCopyFunctionality.d.ts.map +1 -0
  166. package/useCode/useCopyFunctionality.js +28 -0
  167. package/useCode/useFileNavigation.d.ts +49 -0
  168. package/useCode/useFileNavigation.d.ts.map +1 -0
  169. package/useCode/useFileNavigation.js +398 -0
  170. package/useCode/useSourceEditing.d.ts +19 -0
  171. package/useCode/useSourceEditing.d.ts.map +1 -0
  172. package/useCode/useSourceEditing.js +32 -0
  173. package/useCode/useTransformManagement.d.ts +28 -0
  174. package/useCode/useTransformManagement.d.ts.map +1 -0
  175. package/useCode/useTransformManagement.js +82 -0
  176. package/useCode/useUIState.d.ts +16 -0
  177. package/useCode/useUIState.d.ts.map +1 -0
  178. package/useCode/useUIState.js +21 -0
  179. package/useCode/useVariantSelection.d.ts +21 -0
  180. package/useCode/useVariantSelection.d.ts.map +1 -0
  181. package/useCode/useVariantSelection.js +84 -0
  182. package/useCopier/index.d.ts +1 -1
  183. package/useCopier/index.d.ts.map +1 -1
  184. package/useCopier/index.js +5 -5
  185. package/useDemo/createCodeSandbox.d.ts +18 -0
  186. package/useDemo/createCodeSandbox.d.ts.map +1 -0
  187. package/useDemo/createCodeSandbox.js +48 -0
  188. package/useDemo/createStackBlitz.d.ts +22 -0
  189. package/useDemo/createStackBlitz.d.ts.map +1 -0
  190. package/useDemo/createStackBlitz.js +38 -0
  191. package/useDemo/examineVariant.d.ts +25 -0
  192. package/useDemo/examineVariant.d.ts.map +1 -0
  193. package/useDemo/examineVariant.js +134 -0
  194. package/useDemo/exportVariant.d.ts +110 -0
  195. package/useDemo/exportVariant.d.ts.map +1 -0
  196. package/useDemo/exportVariant.js +320 -0
  197. package/useDemo/exportVariantAsCra.d.ts +15 -0
  198. package/useDemo/exportVariantAsCra.d.ts.map +1 -0
  199. package/useDemo/exportVariantAsCra.js +56 -0
  200. package/useDemo/flattenVariant.d.ts +17 -0
  201. package/useDemo/flattenVariant.d.ts.map +1 -0
  202. package/useDemo/flattenVariant.js +206 -0
  203. package/useDemo/index.d.ts +6 -39
  204. package/useDemo/index.d.ts.map +1 -1
  205. package/useDemo/index.js +6 -17
  206. package/useDemo/useDemo.d.ts +79 -0
  207. package/useDemo/useDemo.d.ts.map +1 -0
  208. package/useDemo/useDemo.js +174 -0
  209. package/useLocalStorageState/index.d.ts +2 -0
  210. package/useLocalStorageState/index.d.ts.map +1 -0
  211. package/useLocalStorageState/index.js +2 -0
  212. package/useLocalStorageState/useLocalStorageState.d.ts +14 -0
  213. package/useLocalStorageState/useLocalStorageState.d.ts.map +1 -0
  214. package/useLocalStorageState/useLocalStorageState.js +128 -0
  215. package/useOnHydrate/index.d.ts.map +1 -1
  216. package/useOnHydrate/useOnHydrate.d.ts.map +1 -1
  217. package/useOnIdle/index.d.ts.map +1 -1
  218. package/useOnIdle/useOnIdle.d.ts.map +1 -1
  219. package/useUrlHashState/index.d.ts +1 -0
  220. package/useUrlHashState/index.d.ts.map +1 -0
  221. package/useUrlHashState/index.js +1 -0
  222. package/useUrlHashState/useUrlHashState.d.ts +50 -0
  223. package/useUrlHashState/useUrlHashState.d.ts.map +1 -0
  224. package/useUrlHashState/useUrlHashState.js +113 -0
  225. package/hast/hast.d.ts.map +0 -1
  226. package/hast/index.d.ts +0 -1
  227. package/hast/index.d.ts.map +0 -1
  228. package/hast/index.js +0 -1
  229. package/loadPrecomputedCodeHighlighter/index.d.ts.map +0 -1
  230. package/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +0 -57
  231. package/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts.map +0 -1
  232. package/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +0 -194
  233. package/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts.map +0 -1
  234. package/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +0 -243
  235. package/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts.map +0 -1
  236. package/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +0 -27
  237. package/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts.map +0 -1
  238. package/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +0 -37
  239. package/loadServerCodeMeta/index.d.ts +0 -1
  240. package/loadServerCodeMeta/index.d.ts.map +0 -1
  241. package/loadServerCodeMeta/index.js +0 -1
  242. package/loadServerCodeMeta/serverLoadCodeMeta.d.ts.map +0 -1
  243. package/loadServerSource/index.d.ts +0 -1
  244. package/loadServerSource/index.d.ts.map +0 -1
  245. package/loadServerSource/index.js +0 -1
  246. package/loadServerSource/serverLoadSource.d.ts.map +0 -1
  247. package/loadServerSource/serverLoadSource.js +0 -100
  248. package/loaderUtils/getFileNameFromUrl.d.ts.map +0 -1
  249. package/loaderUtils/getFileNameFromUrl.js +0 -32
  250. package/loaderUtils/index.d.ts +0 -5
  251. package/loaderUtils/index.d.ts.map +0 -1
  252. package/loaderUtils/index.js +0 -5
  253. package/loaderUtils/processImports.d.ts.map +0 -1
  254. package/loaderUtils/processImports.js +0 -82
  255. package/loaderUtils/resolveImports.d.ts +0 -4
  256. package/loaderUtils/resolveImports.d.ts.map +0 -1
  257. package/loaderUtils/resolveImports.js +0 -71
  258. package/loaderUtils/resolveModulePath.d.ts.map +0 -1
  259. package/loaderUtils/resolveModulePath.js +0 -862
  260. package/loaderUtils/resolveModulePathWithFs.d.ts.map +0 -1
  261. package/loaderUtils/rewriteImports.d.ts +0 -9
  262. package/loaderUtils/rewriteImports.d.ts.map +0 -1
  263. package/loaderUtils/rewriteImports.js +0 -57
  264. package/parseSource/grammars.d.ts.map +0 -1
  265. package/parseSource/index.d.ts.map +0 -1
  266. package/parseSource/parseSource.d.ts +0 -3
  267. package/parseSource/parseSource.d.ts.map +0 -1
  268. package/transformRelativeMarkdownPaths/index.d.ts +0 -2
  269. package/transformRelativeMarkdownPaths/index.d.ts.map +0 -1
  270. package/transformRelativeMarkdownPaths/index.js +0 -4
  271. package/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts +0 -12
  272. package/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts.map +0 -1
  273. package/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.js +0 -30
  274. package/transformTsToJs/index.d.ts +0 -1
  275. package/transformTsToJs/index.d.ts.map +0 -1
  276. package/transformTsToJs/index.js +0 -1
  277. package/transformTsToJs/removeTypes.d.ts.map +0 -1
  278. package/transformTsToJs/transformTsToJs.d.ts +0 -3
  279. package/transformTsToJs/transformTsToJs.d.ts.map +0 -1
  280. /package/{hast/hast.d.ts → pipeline/hastUtils/hastUtils.d.ts} +0 -0
  281. /package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/index.d.ts +0 -0
  282. /package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/index.js +0 -0
  283. /package/{parseSource → pipeline/parseSource}/grammars.d.ts +0 -0
  284. /package/{parseSource → pipeline/parseSource}/grammars.js +0 -0
  285. /package/{parseSource → pipeline/parseSource}/index.d.ts +0 -0
  286. /package/{parseSource → pipeline/parseSource}/index.js +0 -0
  287. /package/{transformTsToJs → pipeline/transformTypescriptToJavascript}/removeTypes.d.ts +0 -0
  288. /package/{transformTsToJs → pipeline/transformTypescriptToJavascript}/removeTypes.js +0 -0
@@ -1,100 +0,0 @@
1
- import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
- import { readFile } from 'node:fs/promises';
4
- import { resolveImports } from "../loaderUtils/resolveImports.js";
5
- import { resolveImportResultWithFs } from "../loaderUtils/resolveModulePathWithFs.js";
6
- import { processImportsWithStoreAt } from "../loaderUtils/processImports.js";
7
- import { isJavaScriptModule } from "../loaderUtils/resolveModulePath.js";
8
- /**
9
- * Default serverLoadSource function that reads a file and extracts its dependencies.
10
- * This function is used to load source files for demos, resolving their imports and dependencies.
11
- * It reads the source file, resolves its imports, and returns the processed source along with any
12
- * additional files and dependencies that were found.
13
- */
14
- export var serverLoadSource = createServerLoadSource();
15
-
16
- /**
17
- * Creates a loadSource function that reads a file and extracts its dependencies.
18
- *
19
- * @param options.storeAt - Controls how imports are stored in extraFiles:
20
- * - 'canonical': Full resolved path (e.g., '../Component/index.js')
21
- * - 'import': Import path with file extension (e.g., '../Component.js')
22
- * - 'flat': Flattened to current directory with rewritten imports (e.g., './Component.js')
23
- */
24
- export function createServerLoadSource() {
25
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
- var _options$includeDepen = options.includeDependencies,
27
- includeDependencies = _options$includeDepen === void 0 ? true : _options$includeDepen,
28
- _options$storeAt = options.storeAt,
29
- storeAt = _options$storeAt === void 0 ? 'flat' : _options$storeAt;
30
- return /*#__PURE__*/function () {
31
- var _loadSource = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
32
- var filePath, source, isJavascriptModuleFile, importResult, resolvedPathsMap, _processImportsWithSt, processedSource, extraFiles, extraDependencies;
33
- return _regeneratorRuntime().wrap(function _callee$(_context) {
34
- while (1) switch (_context.prev = _context.next) {
35
- case 0:
36
- // Remove file:// prefix if present
37
- filePath = url.replace('file://', ''); // Read the file
38
- _context.next = 3;
39
- return readFile(filePath, 'utf8');
40
- case 3:
41
- source = _context.sent;
42
- if (includeDependencies) {
43
- _context.next = 6;
44
- break;
45
- }
46
- return _context.abrupt("return", {
47
- source: source
48
- });
49
- case 6:
50
- // Check if this is a static asset file (non-JS/TS modules)
51
- isJavascriptModuleFile = isJavaScriptModule(filePath);
52
- if (isJavascriptModuleFile) {
53
- _context.next = 9;
54
- break;
55
- }
56
- return _context.abrupt("return", {
57
- source: source
58
- });
59
- case 9:
60
- _context.next = 11;
61
- return resolveImports(source, filePath);
62
- case 11:
63
- importResult = _context.sent;
64
- if (!(Object.keys(importResult).length === 0)) {
65
- _context.next = 14;
66
- break;
67
- }
68
- return _context.abrupt("return", {
69
- source: source
70
- });
71
- case 14:
72
- _context.next = 16;
73
- return resolveImportResultWithFs(importResult);
74
- case 16:
75
- resolvedPathsMap = _context.sent;
76
- // Process imports using the consolidated helper function
77
- _processImportsWithSt = processImportsWithStoreAt(source, importResult, resolvedPathsMap, storeAt), processedSource = _processImportsWithSt.processedSource, extraFiles = _processImportsWithSt.extraFiles; // Build dependencies list for recursive loading
78
- extraDependencies = Object.values(importResult).map(function (_ref) {
79
- var path = _ref.path;
80
- return resolvedPathsMap.get(path);
81
- }).filter(function (path) {
82
- return path !== undefined;
83
- });
84
- return _context.abrupt("return", {
85
- source: processedSource,
86
- extraFiles: Object.keys(extraFiles).length > 0 ? extraFiles : undefined,
87
- extraDependencies: extraDependencies.length > 0 ? extraDependencies : undefined
88
- });
89
- case 20:
90
- case "end":
91
- return _context.stop();
92
- }
93
- }, _callee);
94
- }));
95
- function loadSource(_x) {
96
- return _loadSource.apply(this, arguments);
97
- }
98
- return loadSource;
99
- }();
100
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"getFileNameFromUrl.d.ts","sourceRoot":"","sources":["../../../src/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"}
@@ -1,32 +0,0 @@
1
- /**
2
- * Extracts the filename and extension from a URL or file path.
3
- * This function is isomorphic and works in both Node.js and browser environments.
4
- *
5
- * @param url - The URL or file path to extract the filename from
6
- * @returns An object containing the filename and extension
7
- */
8
- export function getFileNameFromUrl(url) {
9
- try {
10
- // Use URL constructor to handle various URL formats
11
- var urlObj = new URL(url);
12
- var pathname = urlObj.pathname;
13
- var fileName = pathname.split('/').pop() || '';
14
-
15
- // Extract extension (including the dot)
16
- var lastDotIndex = fileName.lastIndexOf('.');
17
- var extension = lastDotIndex > 0 ? fileName.substring(lastDotIndex) : '';
18
- return {
19
- fileName: fileName,
20
- extension: extension
21
- };
22
- } catch (_unused) {
23
- // If URL parsing fails, fall back to simple string manipulation
24
- var _fileName = url.split('/').pop() || url;
25
- var _lastDotIndex = _fileName.lastIndexOf('.');
26
- var _extension = _lastDotIndex > 0 ? _fileName.substring(_lastDotIndex) : '';
27
- return {
28
- fileName: _fileName,
29
- extension: _extension
30
- };
31
- }
32
- }
@@ -1,5 +0,0 @@
1
- export * from "./resolveImports.js";
2
- export * from "./resolveModulePath.js";
3
- export * from "./rewriteImports.js";
4
- export * from "./processImports.js";
5
- export * from "./getFileNameFromUrl.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loaderUtils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from "./resolveImports.js";
2
- export * from "./resolveModulePath.js";
3
- export * from "./rewriteImports.js";
4
- export * from "./processImports.js";
5
- export * from "./getFileNameFromUrl.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"processImports.d.ts","sourceRoot":"","sources":["../../../src/loaderUtils/processImports.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,EAC/D,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,OAAO,EAAE,WAAW,GACnB,oBAAoB,CAsEtB"}
@@ -1,82 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import { rewriteImportsToSameDirectory } from "./rewriteImports.js";
3
- import { isJavaScriptModule } from "./resolveModulePath.js";
4
- import { getFileNameFromUrl } from "./getFileNameFromUrl.js";
5
- /**
6
- * Processes imports based on the specified storage mode, automatically handling
7
- * source rewriting when needed (e.g., for 'flat' mode).
8
- *
9
- * @param source - The original source code
10
- * @param importResult - The result from resolveImports
11
- * @param resolvedPathsMap - Map from import paths to resolved file paths
12
- * @param storeAt - How to process the imports
13
- * @returns Object with processed source and extraFiles mapping
14
- */
15
- export function processImportsWithStoreAt(source, importResult, resolvedPathsMap, storeAt) {
16
- var processedSource = source;
17
- var extraFiles = {};
18
-
19
- // For flat mode, automatically rewrite imports to same directory
20
- if (storeAt === 'flat') {
21
- var allResolvedPaths = new Set(resolvedPathsMap.values());
22
- processedSource = rewriteImportsToSameDirectory(source, allResolvedPaths);
23
- }
24
-
25
- // Process each import and generate extraFiles
26
- Object.entries(importResult).forEach(function (_ref) {
27
- var _ref2 = _slicedToArray(_ref, 2),
28
- relativePath = _ref2[0],
29
- importInfo = _ref2[1];
30
- var resolvedPath = resolvedPathsMap.get(importInfo.path);
31
- if (resolvedPath) {
32
- var fileExtension = getFileNameFromUrl(resolvedPath).extension;
33
- var isJavascriptModule = isJavaScriptModule(relativePath);
34
- var keyPath;
35
- if (!isJavascriptModule) {
36
- // For static assets (CSS, JSON, etc.), use the original import path as-is since it already has the extension
37
- switch (storeAt) {
38
- case 'canonical':
39
- case 'import':
40
- keyPath = relativePath;
41
- break;
42
- case 'flat':
43
- // For flat mode, use just the filename from the original import
44
- keyPath = "./".concat(getFileNameFromUrl(relativePath).fileName);
45
- break;
46
- default:
47
- keyPath = relativePath;
48
- }
49
- } else {
50
- // For JS/TS modules, apply the existing logic
51
- switch (storeAt) {
52
- case 'canonical':
53
- // Show the full resolved path including index files when they exist
54
- // e.g., import '../Component' resolved to '/src/Component/index.js'
55
- // becomes extraFiles: { '../Component/index.js': 'file:///src/Component/index.js' }
56
- keyPath = "".concat(relativePath).concat(resolvedPath.endsWith("/index".concat(fileExtension)) ? "/index".concat(fileExtension) : fileExtension);
57
- break;
58
- case 'import':
59
- // Use the original import path with the actual file extension
60
- // e.g., import '../Component' with '/src/Component/index.js'
61
- // becomes extraFiles: { '../Component.js': 'file:///src/Component/index.js' }
62
- keyPath = "".concat(relativePath).concat(fileExtension);
63
- break;
64
- case 'flat':
65
- // Flatten all files to current directory using just the filename
66
- // e.g., import '../Component' with '/src/Component/index.js'
67
- // becomes extraFiles: { './index.js': 'file:///src/Component/index.js' }
68
- // Note: This mode also requires rewriting imports in the source code (handled above)
69
- keyPath = "./".concat(getFileNameFromUrl(resolvedPath).fileName);
70
- break;
71
- default:
72
- keyPath = "".concat(relativePath).concat(fileExtension);
73
- }
74
- }
75
- extraFiles[keyPath] = "file://".concat(resolvedPath);
76
- }
77
- });
78
- return {
79
- processedSource: processedSource,
80
- extraFiles: extraFiles
81
- };
82
- }
@@ -1,4 +0,0 @@
1
- export declare function resolveImports(code: string, filePath: string): Promise<Record<string, {
2
- path: string;
3
- names: string[];
4
- }>>;
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveImports.d.ts","sourceRoot":"","sources":["../../../src/loaderUtils/resolveImports.ts"],"names":[],"mappings":"AAAA,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC,CAkC5D"}
@@ -1,71 +0,0 @@
1
- import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
- export function resolveImports(_x, _x2) {
5
- return _resolveImports.apply(this, arguments);
6
- }
7
- function _resolveImports() {
8
- _resolveImports = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(code, filePath) {
9
- var result, importRegex, importMatch, _loop;
10
- return _regeneratorRuntime().wrap(function _callee$(_context2) {
11
- while (1) switch (_context2.prev = _context2.next) {
12
- case 0:
13
- result = {};
14
- importRegex = /import\s+(?:(\w+)|\*\s+as\s+(\w+)|{([^}]+)})\s+from\s+['"]([^'"]+)['"]/g;
15
- importMatch = importRegex.exec(code);
16
- _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
17
- var _importMatch, _importMatch2, defaultImport, namespaceImport, namedImportsStr, modulePath, basePath, resolvedPath, namedImports;
18
- return _regeneratorRuntime().wrap(function _loop$(_context) {
19
- while (1) switch (_context.prev = _context.next) {
20
- case 0:
21
- _importMatch = importMatch, _importMatch2 = _slicedToArray(_importMatch, 5), defaultImport = _importMatch2[1], namespaceImport = _importMatch2[2], namedImportsStr = _importMatch2[3], modulePath = _importMatch2[4]; // Only process relative imports
22
- if (modulePath.startsWith('.')) {
23
- basePath = filePath.substring(0, filePath.lastIndexOf('/'));
24
- resolvedPath = new URL(modulePath, "file://".concat(basePath, "/")).pathname;
25
- if (!result[modulePath]) {
26
- result[modulePath] = {
27
- path: resolvedPath,
28
- names: []
29
- };
30
- }
31
- if (defaultImport) {
32
- result[modulePath].names.push(defaultImport);
33
- } else if (namespaceImport) {
34
- result[modulePath].names.push(namespaceImport);
35
- } else if (namedImportsStr) {
36
- // Handle named imports like { ComponentName, Component2 as Alias }
37
- namedImports = namedImportsStr.split(',').map(function (s) {
38
- return s.trim();
39
- });
40
- namedImports.forEach(function (namedImport) {
41
- var cleanImport = namedImport.split(' as ')[0].trim();
42
- result[modulePath].names.push(cleanImport);
43
- });
44
- }
45
- }
46
- importMatch = importRegex.exec(code);
47
- case 3:
48
- case "end":
49
- return _context.stop();
50
- }
51
- }, _loop);
52
- });
53
- case 4:
54
- if (!(importMatch !== null)) {
55
- _context2.next = 8;
56
- break;
57
- }
58
- return _context2.delegateYield(_loop(), "t0", 6);
59
- case 6:
60
- _context2.next = 4;
61
- break;
62
- case 8:
63
- return _context2.abrupt("return", result);
64
- case 9:
65
- case "end":
66
- return _context2.stop();
67
- }
68
- }, _callee);
69
- }));
70
- return _resolveImports.apply(this, arguments);
71
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveModulePath.d.ts","sourceRoot":"","sources":["../../../src/loaderUtils/resolveModulePath.ts"],"names":[],"mappings":"AA4BA;;GAEG;AACH,eAAO,MAAM,4BAA4B,yCAA0C,CAAC;AAEpF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOxD;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AAE1E,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,eAAe,EAC9B,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,MAAM,CAAC,CA2FjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EAAE,EACrB,aAAa,EAAE,eAAe,EAC9B,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAiJ9B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,EAC/D,aAAa,EAAE,eAAe,EAC9B,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAmC9B;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,aAAa,EAAE,eAAe,EAC9B,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgB9B"}