@mui/internal-docs-infra 0.1.1-canary.9 → 0.2.0-alpha.2

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 (217) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +3 -11
  3. package/esm/CodeControllerContext/CodeControllerContext.d.ts +62 -0
  4. package/esm/CodeControllerContext/CodeControllerContext.js +33 -0
  5. package/esm/CodeControllerContext/index.d.ts +1 -0
  6. package/esm/CodeControllerContext/index.js +1 -0
  7. package/esm/CodeExternalsContext/CodeExternalsContext.d.ts +8 -0
  8. package/esm/CodeExternalsContext/CodeExternalsContext.js +8 -0
  9. package/esm/CodeExternalsContext/index.d.ts +1 -0
  10. package/esm/CodeExternalsContext/index.js +1 -0
  11. package/esm/CodeHighlighter/CodeHighlighter.d.ts +2 -0
  12. package/esm/CodeHighlighter/CodeHighlighter.js +441 -0
  13. package/esm/CodeHighlighter/CodeHighlighterClient.d.ts +2 -0
  14. package/esm/CodeHighlighter/CodeHighlighterClient.js +984 -0
  15. package/esm/CodeHighlighter/CodeHighlighterContext.d.ts +16 -0
  16. package/esm/CodeHighlighter/CodeHighlighterContext.js +15 -0
  17. package/esm/CodeHighlighter/CodeHighlighterFallbackContext.d.ts +7 -0
  18. package/esm/CodeHighlighter/CodeHighlighterFallbackContext.js +14 -0
  19. package/esm/CodeHighlighter/addPathsToVariant.d.ts +14 -0
  20. package/esm/CodeHighlighter/addPathsToVariant.js +68 -0
  21. package/esm/CodeHighlighter/applyTransform.d.ts +19 -0
  22. package/esm/CodeHighlighter/applyTransform.js +75 -0
  23. package/esm/CodeHighlighter/calculateMainFilePath.d.ts +1 -0
  24. package/esm/CodeHighlighter/calculateMainFilePath.js +108 -0
  25. package/esm/CodeHighlighter/codeToFallbackProps.d.ts +2 -0
  26. package/esm/CodeHighlighter/codeToFallbackProps.js +73 -0
  27. package/esm/CodeHighlighter/errors.d.ts +141 -0
  28. package/esm/CodeHighlighter/errors.js +441 -0
  29. package/esm/CodeHighlighter/examineVariant.d.ts +25 -0
  30. package/esm/CodeHighlighter/examineVariant.js +73 -0
  31. package/esm/CodeHighlighter/hasAllVariants.d.ts +27 -0
  32. package/esm/CodeHighlighter/hasAllVariants.js +63 -0
  33. package/esm/CodeHighlighter/index.d.ts +1 -0
  34. package/esm/CodeHighlighter/index.js +1 -0
  35. package/esm/CodeHighlighter/loadFallbackCode.d.ts +10 -0
  36. package/esm/CodeHighlighter/loadFallbackCode.js +679 -0
  37. package/esm/CodeHighlighter/loadVariant.d.ts +12 -0
  38. package/esm/CodeHighlighter/loadVariant.js +1044 -0
  39. package/esm/CodeHighlighter/maybeInitialData.d.ts +108 -0
  40. package/esm/CodeHighlighter/maybeInitialData.js +192 -0
  41. package/esm/CodeHighlighter/mergeMetadata.d.ts +40 -0
  42. package/esm/CodeHighlighter/mergeMetadata.js +165 -0
  43. package/esm/CodeHighlighter/parseCode.d.ts +6 -0
  44. package/esm/CodeHighlighter/parseCode.js +134 -0
  45. package/esm/CodeHighlighter/parseControlledCode.d.ts +6 -0
  46. package/esm/CodeHighlighter/parseControlledCode.js +87 -0
  47. package/esm/CodeHighlighter/pathUtils.d.ts +120 -0
  48. package/esm/CodeHighlighter/pathUtils.js +258 -0
  49. package/esm/CodeHighlighter/transformCode.d.ts +21 -0
  50. package/esm/CodeHighlighter/transformCode.js +251 -0
  51. package/esm/CodeHighlighter/transformParsedSource.d.ts +3 -0
  52. package/esm/CodeHighlighter/transformParsedSource.js +60 -0
  53. package/esm/CodeHighlighter/transformSource.d.ts +2 -0
  54. package/esm/CodeHighlighter/transformSource.js +103 -0
  55. package/esm/CodeHighlighter/types.d.ts +276 -0
  56. package/esm/CodeHighlighter/types.js +1 -0
  57. package/esm/CodeProvider/CodeContext.d.ts +31 -0
  58. package/esm/CodeProvider/CodeContext.js +12 -0
  59. package/esm/CodeProvider/CodeProvider.d.ts +13 -0
  60. package/esm/CodeProvider/CodeProvider.js +83 -0
  61. package/esm/CodeProvider/index.d.ts +1 -0
  62. package/esm/CodeProvider/index.js +1 -0
  63. package/esm/abstractCreateDemo/abstractCreateDemo.d.ts +45 -0
  64. package/esm/abstractCreateDemo/abstractCreateDemo.js +100 -0
  65. package/esm/abstractCreateDemo/index.d.ts +1 -0
  66. package/esm/abstractCreateDemo/index.js +1 -0
  67. package/esm/abstractCreateDemoClient/abstractCreateDemoClient.d.ts +32 -0
  68. package/esm/abstractCreateDemoClient/abstractCreateDemoClient.js +52 -0
  69. package/esm/abstractCreateDemoClient/index.d.ts +1 -0
  70. package/esm/abstractCreateDemoClient/index.js +1 -0
  71. package/esm/createDemoData/createDemoData.d.ts +44 -0
  72. package/esm/createDemoData/createDemoData.js +74 -0
  73. package/esm/createDemoData/index.d.ts +1 -0
  74. package/esm/createDemoData/index.js +1 -0
  75. package/esm/createDemoData/types.d.ts +25 -0
  76. package/esm/createDemoData/types.js +1 -0
  77. package/esm/pipeline/hastUtils/hastUtils.d.ts +11 -0
  78. package/esm/pipeline/hastUtils/hastUtils.js +67 -0
  79. package/esm/pipeline/hastUtils/index.d.ts +1 -0
  80. package/esm/pipeline/hastUtils/index.js +1 -0
  81. package/esm/pipeline/loadPrecomputedCodeHighlighter/index.d.ts +2 -0
  82. package/esm/pipeline/loadPrecomputedCodeHighlighter/index.js +4 -0
  83. package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +14 -0
  84. package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +178 -0
  85. package/esm/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts +47 -0
  86. package/esm/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +849 -0
  87. package/esm/pipeline/loadPrecomputedCodeHighlighter/parseFunctionArguments.d.ts +85 -0
  88. package/esm/pipeline/loadPrecomputedCodeHighlighter/parseFunctionArguments.js +715 -0
  89. package/esm/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +14 -0
  90. package/esm/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +73 -0
  91. package/esm/pipeline/loadPrecomputedCodeHighlighter/serializeFunctionArguments.d.ts +11 -0
  92. package/esm/pipeline/loadPrecomputedCodeHighlighter/serializeFunctionArguments.js +203 -0
  93. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/filterRuntimeExternals.d.ts +6 -0
  94. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/filterRuntimeExternals.js +23 -0
  95. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/generateImportStatements.d.ts +6 -0
  96. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/generateImportStatements.js +148 -0
  97. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/generateResolvedExternals.d.ts +9 -0
  98. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/generateResolvedExternals.js +198 -0
  99. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/index.d.ts +2 -0
  100. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/index.js +4 -0
  101. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/injectImportsIntoSource.d.ts +5 -0
  102. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/injectImportsIntoSource.js +21 -0
  103. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/loadPrecomputedCodeHighlighterClient.d.ts +15 -0
  104. package/esm/pipeline/loadPrecomputedCodeHighlighterClient/loadPrecomputedCodeHighlighterClient.js +233 -0
  105. package/esm/pipeline/loadServerCodeMeta/index.d.ts +1 -0
  106. package/esm/pipeline/loadServerCodeMeta/index.js +1 -0
  107. package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts +24 -0
  108. package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.js +90 -0
  109. package/esm/pipeline/loadServerSource/index.d.ts +1 -0
  110. package/esm/pipeline/loadServerSource/index.js +1 -0
  111. package/esm/pipeline/loadServerSource/loadServerSource.d.ts +25 -0
  112. package/esm/pipeline/loadServerSource/loadServerSource.js +134 -0
  113. package/esm/pipeline/loaderUtils/externalsToPackages.d.ts +1 -0
  114. package/esm/pipeline/loaderUtils/externalsToPackages.js +46 -0
  115. package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts +34 -0
  116. package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +161 -0
  117. package/esm/pipeline/loaderUtils/getFileNameFromUrl.d.ts +12 -0
  118. package/esm/pipeline/loaderUtils/getFileNameFromUrl.js +66 -0
  119. package/esm/pipeline/loaderUtils/index.d.ts +7 -0
  120. package/esm/pipeline/loaderUtils/index.js +7 -0
  121. package/esm/pipeline/loaderUtils/mergeExternals.d.ts +32 -0
  122. package/esm/pipeline/loaderUtils/mergeExternals.js +72 -0
  123. package/esm/pipeline/loaderUtils/parseImports.d.ts +19 -0
  124. package/esm/pipeline/loaderUtils/parseImports.js +306 -0
  125. package/esm/pipeline/loaderUtils/processRelativeImports.d.ts +19 -0
  126. package/esm/pipeline/loaderUtils/processRelativeImports.js +352 -0
  127. package/esm/pipeline/loaderUtils/resolveModulePath.d.ts +87 -0
  128. package/esm/pipeline/loaderUtils/resolveModulePath.js +1435 -0
  129. package/esm/pipeline/loaderUtils/resolveModulePathWithFs.d.ts +47 -0
  130. package/esm/pipeline/loaderUtils/resolveModulePathWithFs.js +150 -0
  131. package/esm/pipeline/loaderUtils/rewriteImports.d.ts +9 -0
  132. package/esm/pipeline/loaderUtils/rewriteImports.js +35 -0
  133. package/esm/pipeline/parseSource/addLineGutters.d.ts +9 -0
  134. package/esm/pipeline/parseSource/addLineGutters.js +181 -0
  135. package/esm/pipeline/parseSource/grammars.d.ts +2 -0
  136. package/esm/pipeline/parseSource/grammars.js +27 -0
  137. package/esm/pipeline/parseSource/index.d.ts +1 -0
  138. package/esm/pipeline/parseSource/index.js +1 -0
  139. package/esm/pipeline/parseSource/parseSource.d.ts +3 -0
  140. package/esm/pipeline/parseSource/parseSource.js +51 -0
  141. package/esm/pipeline/transformHtmlCode/index.d.ts +2 -0
  142. package/esm/pipeline/transformHtmlCode/index.js +4 -0
  143. package/esm/pipeline/transformHtmlCode/transformHtmlCode.d.ts +13 -0
  144. package/esm/pipeline/transformHtmlCode/transformHtmlCode.js +300 -0
  145. package/esm/pipeline/transformMarkdownCode/index.d.ts +2 -0
  146. package/esm/pipeline/transformMarkdownCode/index.js +4 -0
  147. package/esm/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts +2 -0
  148. package/esm/pipeline/transformMarkdownCode/transformMarkdownCode.js +514 -0
  149. package/esm/pipeline/transformTypescriptToJavascript/index.d.ts +1 -0
  150. package/esm/pipeline/transformTypescriptToJavascript/index.js +1 -0
  151. package/esm/pipeline/transformTypescriptToJavascript/removeTypes.d.ts +13 -0
  152. package/esm/pipeline/transformTypescriptToJavascript/removeTypes.js +131 -0
  153. package/esm/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts +3 -0
  154. package/esm/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.js +31 -0
  155. package/esm/useCode/Pre.d.ts +15 -0
  156. package/esm/useCode/Pre.js +164 -0
  157. package/esm/useCode/index.d.ts +1 -0
  158. package/esm/useCode/index.js +1 -0
  159. package/esm/useCode/useCode.d.ts +41 -0
  160. package/esm/useCode/useCode.js +128 -0
  161. package/esm/useCode/useCodeUtils.d.ts +44 -0
  162. package/esm/useCode/useCodeUtils.js +245 -0
  163. package/esm/useCode/useCopyFunctionality.d.ts +18 -0
  164. package/esm/useCode/useCopyFunctionality.js +28 -0
  165. package/esm/useCode/useFileNavigation.d.ts +41 -0
  166. package/esm/useCode/useFileNavigation.js +453 -0
  167. package/esm/useCode/useSourceEditing.d.ts +21 -0
  168. package/esm/useCode/useSourceEditing.js +32 -0
  169. package/esm/useCode/useTransformManagement.d.ts +30 -0
  170. package/esm/useCode/useTransformManagement.js +72 -0
  171. package/esm/useCode/useUIState.d.ts +16 -0
  172. package/esm/useCode/useUIState.js +21 -0
  173. package/esm/useCode/useVariantSelection.d.ts +23 -0
  174. package/esm/useCode/useVariantSelection.js +75 -0
  175. package/esm/useCopier/index.d.ts +1 -1
  176. package/esm/useCopier/index.js +5 -5
  177. package/esm/useDemo/createCodeSandbox.d.ts +15 -0
  178. package/esm/useDemo/createCodeSandbox.js +42 -0
  179. package/esm/useDemo/createStackBlitz.d.ts +22 -0
  180. package/esm/useDemo/createStackBlitz.js +38 -0
  181. package/esm/useDemo/exportVariant.d.ts +184 -0
  182. package/esm/useDemo/exportVariant.js +422 -0
  183. package/esm/useDemo/exportVariantAsCra.d.ts +15 -0
  184. package/esm/useDemo/exportVariantAsCra.js +57 -0
  185. package/esm/useDemo/flattenVariant.d.ts +19 -0
  186. package/esm/useDemo/flattenVariant.js +49 -0
  187. package/esm/useDemo/index.d.ts +6 -51
  188. package/esm/useDemo/index.js +6 -104
  189. package/esm/useDemo/useDemo.d.ts +81 -0
  190. package/esm/useDemo/useDemo.js +193 -0
  191. package/esm/useErrors/ErrorsContext.d.ts +6 -0
  192. package/esm/useErrors/ErrorsContext.js +8 -0
  193. package/esm/useErrors/index.d.ts +1 -0
  194. package/esm/useErrors/index.js +1 -0
  195. package/esm/useErrors/useErrors.d.ts +5 -0
  196. package/esm/useErrors/useErrors.js +7 -0
  197. package/esm/useLocalStorageState/index.d.ts +2 -0
  198. package/esm/useLocalStorageState/index.js +2 -0
  199. package/esm/useLocalStorageState/useLocalStorageState.d.ts +14 -0
  200. package/esm/useLocalStorageState/useLocalStorageState.js +128 -0
  201. package/esm/usePreference/PreferencesProvider.d.ts +6 -0
  202. package/esm/usePreference/PreferencesProvider.js +8 -0
  203. package/esm/usePreference/index.d.ts +2 -0
  204. package/esm/usePreference/index.js +2 -0
  205. package/esm/usePreference/usePreference.d.ts +2 -0
  206. package/esm/usePreference/usePreference.js +25 -0
  207. package/esm/useUrlHashState/index.d.ts +1 -0
  208. package/esm/useUrlHashState/index.js +1 -0
  209. package/esm/useUrlHashState/useUrlHashState.d.ts +5 -0
  210. package/esm/useUrlHashState/useUrlHashState.js +68 -0
  211. package/esm/withDocsInfra/index.d.ts +1 -0
  212. package/esm/withDocsInfra/index.js +1 -0
  213. package/esm/withDocsInfra/withDocsInfra.d.ts +82 -0
  214. package/esm/withDocsInfra/withDocsInfra.js +147 -0
  215. package/package.json +178 -11
  216. package/esm/useCopier/index.d.ts.map +0 -1
  217. package/esm/useDemo/index.d.ts.map +0 -1
@@ -0,0 +1,1435 @@
1
+ import _regeneratorValues from "@babel/runtime/helpers/esm/regeneratorValues";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
5
+ import _regenerator from "@babel/runtime/helpers/esm/regenerator";
6
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
7
+ import { getFileNameFromUrl } from "./getFileNameFromUrl.js";
8
+
9
+ /**
10
+ * Isomorphic path joining function that works in both Node.js and browser environments.
11
+ * Uses string concatenation to handle path joining consistently across platforms.
12
+ */
13
+ function joinPath(basePath) {
14
+ // Start with the base path, ensuring it has a trailing slash for URL construction
15
+ var result = basePath.endsWith('/') ? basePath : "".concat(basePath, "/");
16
+
17
+ // Handle each segment
18
+ for (var i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i += 1) {
19
+ var segment = i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1];
20
+ if (segment) {
21
+ // Remove leading slash from segment to avoid double slashes
22
+ var cleanSegment = segment.startsWith('/') ? segment.slice(1) : segment;
23
+ // Append segment
24
+ result += cleanSegment;
25
+ // Add trailing slash for intermediate segments
26
+ if (i < (arguments.length <= 1 ? 0 : arguments.length - 1) - 1) {
27
+ result += '/';
28
+ }
29
+ }
30
+ }
31
+ return result;
32
+ }
33
+
34
+ /**
35
+ * Default file extensions for JavaScript/TypeScript modules that can be resolved
36
+ */
37
+ export var JAVASCRIPT_MODULE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.d.ts'];
38
+
39
+ /**
40
+ * Extension priority for type-only imports - prioritize .d.ts first
41
+ */
42
+ export var TYPE_IMPORT_EXTENSIONS = ['.d.ts', '.ts', '.tsx', '.js', '.jsx'];
43
+
44
+ /**
45
+ * Extension priority for value imports - standard priority with .d.ts last
46
+ */
47
+ export var VALUE_IMPORT_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx', '.d.ts'];
48
+
49
+ /**
50
+ * Checks if a file path or import path represents a JavaScript/TypeScript module
51
+ * @param path - The file path or import path to check
52
+ * @returns true if it's a JS/TS module, false otherwise
53
+ */
54
+ export function isJavaScriptModule(path) {
55
+ // If the path has an extension, check if it's one of the JS/TS extensions
56
+ if (/\.[^/]+$/.test(path)) {
57
+ return JAVASCRIPT_MODULE_EXTENSIONS.some(function (ext) {
58
+ return path.endsWith(ext);
59
+ });
60
+ }
61
+ // If no extension, assume it's a JS/TS module (will be resolved to one)
62
+ return true;
63
+ }
64
+ /**
65
+ * Resolves a module path by reading directory contents to find matching files.
66
+ * This is more efficient than checking each file individually with stat calls.
67
+ *
68
+ * Given a path like `/Code/mui-public/packages/docs-infra/docs/app/components/code-highlighter/demos/code/BasicCode`,
69
+ * this function will try to find the actual file by checking for:
70
+ * - `BasicCode.ts`, `BasicCode.tsx`, `BasicCode.js`, `BasicCode.jsx`
71
+ * - `BasicCode/index.ts`, `BasicCode/index.tsx`, `BasicCode/index.js`, `BasicCode/index.jsx`
72
+ *
73
+ * @param modulePath - The module path to resolve (without file extension)
74
+ * @param readDirectory - Function to read directory contents
75
+ * @param options - Configuration options
76
+ * @param includeTypeDefs - If true, returns both import and typeImport paths with different extension priorities
77
+ * @returns Promise<string | TypeAwareResolveResult> - The resolved file path(s)
78
+ */
79
+ export function resolveModulePath(_x, _x2) {
80
+ return _resolveModulePath.apply(this, arguments);
81
+ }
82
+
83
+ /**
84
+ * Resolves a module path with type-aware resolution, returning both import and typeImport paths
85
+ * This function is optimized to do only a single directory read instead of two separate reads.
86
+ */
87
+ function _resolveModulePath() {
88
+ _resolveModulePath = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(modulePath, readDirectory) {
89
+ var options,
90
+ includeTypeDefs,
91
+ _options$extensions,
92
+ extensions,
93
+ lastSlashIndex,
94
+ parentDir,
95
+ moduleName,
96
+ resolvedPath,
97
+ _args = arguments;
98
+ return _regenerator().w(function (_context) {
99
+ while (1) switch (_context.n) {
100
+ case 0:
101
+ options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
102
+ includeTypeDefs = _args.length > 3 ? _args[3] : undefined;
103
+ _options$extensions = options.extensions, extensions = _options$extensions === void 0 ? JAVASCRIPT_MODULE_EXTENSIONS : _options$extensions; // If includeTypeDefs is true, we need to resolve with both type and value extension priorities
104
+ if (!includeTypeDefs) {
105
+ _context.n = 1;
106
+ break;
107
+ }
108
+ return _context.a(2, resolveWithTypeAwareness(modulePath, readDirectory, options));
109
+ case 1:
110
+ // Extract the parent directory and the module name
111
+ lastSlashIndex = modulePath.lastIndexOf('/');
112
+ parentDir = modulePath.substring(0, lastSlashIndex);
113
+ moduleName = modulePath.substring(lastSlashIndex + 1);
114
+ _context.n = 2;
115
+ return resolveSinglePath(modulePath, parentDir, moduleName, readDirectory, extensions);
116
+ case 2:
117
+ resolvedPath = _context.v;
118
+ return _context.a(2, resolvedPath);
119
+ }
120
+ }, _callee);
121
+ }));
122
+ return _resolveModulePath.apply(this, arguments);
123
+ }
124
+ function resolveWithTypeAwareness(_x3, _x4) {
125
+ return _resolveWithTypeAwareness.apply(this, arguments);
126
+ }
127
+ /**
128
+ * Internal function to resolve a single path with given extensions
129
+ */
130
+ function _resolveWithTypeAwareness() {
131
+ _resolveWithTypeAwareness = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(modulePath, readDirectory) {
132
+ var _options,
133
+ lastSlashIndex,
134
+ parentDir,
135
+ moduleName,
136
+ dirContents,
137
+ filesByBaseName,
138
+ _iterator,
139
+ _step,
140
+ _entry4,
141
+ _fileName,
142
+ _fileBaseName,
143
+ _actualExtension,
144
+ _getFileNameFromUrl2,
145
+ _fileExt,
146
+ matchingFiles,
147
+ entryMap,
148
+ importPath,
149
+ _iterator2,
150
+ _step2,
151
+ ext,
152
+ _iterator4,
153
+ _step4,
154
+ entry,
155
+ typeImportPath,
156
+ _iterator3,
157
+ _step3,
158
+ _ext,
159
+ _iterator5,
160
+ _step5,
161
+ _entry,
162
+ directoryMatches,
163
+ moduleDir,
164
+ moduleDirContents,
165
+ indexFilesByBaseName,
166
+ _iterator6,
167
+ _step6,
168
+ moduleFile,
169
+ fileName,
170
+ fileBaseName,
171
+ actualExtension,
172
+ _getFileNameFromUrl,
173
+ fileExt,
174
+ indexFiles,
175
+ indexEntryMap,
176
+ _importPath,
177
+ _iterator7,
178
+ _step7,
179
+ _ext2,
180
+ _iterator9,
181
+ _step9,
182
+ _entry2,
183
+ _typeImportPath,
184
+ _iterator8,
185
+ _step8,
186
+ _ext3,
187
+ _iterator0,
188
+ _step0,
189
+ _entry3,
190
+ _args2 = arguments,
191
+ _t,
192
+ _t2,
193
+ _t3,
194
+ _t4,
195
+ _t5,
196
+ _t6,
197
+ _t7,
198
+ _t8,
199
+ _t9;
200
+ return _regenerator().w(function (_context2) {
201
+ while (1) switch (_context2.p = _context2.n) {
202
+ case 0:
203
+ _options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
204
+ lastSlashIndex = modulePath.lastIndexOf('/');
205
+ parentDir = modulePath.substring(0, lastSlashIndex);
206
+ moduleName = modulePath.substring(lastSlashIndex + 1); // Single filesystem read to get directory contents
207
+ _context2.n = 1;
208
+ return readDirectory(parentDir);
209
+ case 1:
210
+ dirContents = _context2.v;
211
+ // Build a map of available files by basename
212
+ filesByBaseName = new Map();
213
+ _iterator = _createForOfIteratorHelper(dirContents);
214
+ try {
215
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
216
+ _entry4 = _step.value;
217
+ if (_entry4.isFile) {
218
+ _fileName = _entry4.name;
219
+ _fileBaseName = void 0;
220
+ _actualExtension = void 0; // Handle .d.ts files specially since getFileNameFromUrl returns .ts for types.d.ts
221
+ if (_fileName.endsWith('.d.ts')) {
222
+ _actualExtension = '.d.ts';
223
+ _fileBaseName = _fileName.substring(0, _fileName.length - 5); // Remove .d.ts
224
+ } else {
225
+ _getFileNameFromUrl2 = getFileNameFromUrl(_fileName), _fileExt = _getFileNameFromUrl2.extension;
226
+ _actualExtension = _fileExt;
227
+ _fileBaseName = _fileName.substring(0, _fileName.length - _fileExt.length);
228
+ }
229
+ if (!filesByBaseName.has(_fileBaseName)) {
230
+ filesByBaseName.set(_fileBaseName, []);
231
+ }
232
+ // Store the entry with its actual extension for later matching
233
+ filesByBaseName.get(_fileBaseName).push(_extends(_extends({}, _entry4), {}, {
234
+ actualExtension: _actualExtension
235
+ }));
236
+ }
237
+ }
238
+
239
+ // Check for the module in both priority orders
240
+ } catch (err) {
241
+ _iterator.e(err);
242
+ } finally {
243
+ _iterator.f();
244
+ }
245
+ matchingFiles = filesByBaseName.get(moduleName);
246
+ if (!matchingFiles) {
247
+ _context2.n = 32;
248
+ break;
249
+ }
250
+ entryMap = matchingFiles; // Find best match for value imports (VALUE_IMPORT_EXTENSIONS priority)
251
+ importPath = null;
252
+ _iterator2 = _createForOfIteratorHelper(VALUE_IMPORT_EXTENSIONS);
253
+ _context2.p = 2;
254
+ _iterator2.s();
255
+ case 3:
256
+ if ((_step2 = _iterator2.n()).done) {
257
+ _context2.n = 12;
258
+ break;
259
+ }
260
+ ext = _step2.value;
261
+ _iterator4 = _createForOfIteratorHelper(entryMap);
262
+ _context2.p = 4;
263
+ _iterator4.s();
264
+ case 5:
265
+ if ((_step4 = _iterator4.n()).done) {
266
+ _context2.n = 7;
267
+ break;
268
+ }
269
+ entry = _step4.value;
270
+ if (!(entry.actualExtension === ext)) {
271
+ _context2.n = 6;
272
+ break;
273
+ }
274
+ importPath = joinPath(parentDir, entry.name);
275
+ return _context2.a(3, 7);
276
+ case 6:
277
+ _context2.n = 5;
278
+ break;
279
+ case 7:
280
+ _context2.n = 9;
281
+ break;
282
+ case 8:
283
+ _context2.p = 8;
284
+ _t = _context2.v;
285
+ _iterator4.e(_t);
286
+ case 9:
287
+ _context2.p = 9;
288
+ _iterator4.f();
289
+ return _context2.f(9);
290
+ case 10:
291
+ if (!importPath) {
292
+ _context2.n = 11;
293
+ break;
294
+ }
295
+ return _context2.a(3, 12);
296
+ case 11:
297
+ _context2.n = 3;
298
+ break;
299
+ case 12:
300
+ _context2.n = 14;
301
+ break;
302
+ case 13:
303
+ _context2.p = 13;
304
+ _t2 = _context2.v;
305
+ _iterator2.e(_t2);
306
+ case 14:
307
+ _context2.p = 14;
308
+ _iterator2.f();
309
+ return _context2.f(14);
310
+ case 15:
311
+ // Find best match for type imports (TYPE_IMPORT_EXTENSIONS priority)
312
+ typeImportPath = null;
313
+ _iterator3 = _createForOfIteratorHelper(TYPE_IMPORT_EXTENSIONS);
314
+ _context2.p = 16;
315
+ _iterator3.s();
316
+ case 17:
317
+ if ((_step3 = _iterator3.n()).done) {
318
+ _context2.n = 26;
319
+ break;
320
+ }
321
+ _ext = _step3.value;
322
+ _iterator5 = _createForOfIteratorHelper(entryMap);
323
+ _context2.p = 18;
324
+ _iterator5.s();
325
+ case 19:
326
+ if ((_step5 = _iterator5.n()).done) {
327
+ _context2.n = 21;
328
+ break;
329
+ }
330
+ _entry = _step5.value;
331
+ if (!(_entry.actualExtension === _ext)) {
332
+ _context2.n = 20;
333
+ break;
334
+ }
335
+ typeImportPath = joinPath(parentDir, _entry.name);
336
+ return _context2.a(3, 21);
337
+ case 20:
338
+ _context2.n = 19;
339
+ break;
340
+ case 21:
341
+ _context2.n = 23;
342
+ break;
343
+ case 22:
344
+ _context2.p = 22;
345
+ _t3 = _context2.v;
346
+ _iterator5.e(_t3);
347
+ case 23:
348
+ _context2.p = 23;
349
+ _iterator5.f();
350
+ return _context2.f(23);
351
+ case 24:
352
+ if (!typeImportPath) {
353
+ _context2.n = 25;
354
+ break;
355
+ }
356
+ return _context2.a(3, 26);
357
+ case 25:
358
+ _context2.n = 17;
359
+ break;
360
+ case 26:
361
+ _context2.n = 28;
362
+ break;
363
+ case 27:
364
+ _context2.p = 27;
365
+ _t4 = _context2.v;
366
+ _iterator3.e(_t4);
367
+ case 28:
368
+ _context2.p = 28;
369
+ _iterator3.f();
370
+ return _context2.f(28);
371
+ case 29:
372
+ if (!(importPath && typeImportPath && importPath !== typeImportPath)) {
373
+ _context2.n = 30;
374
+ break;
375
+ }
376
+ return _context2.a(2, {
377
+ "import": importPath,
378
+ typeImport: typeImportPath
379
+ });
380
+ case 30:
381
+ if (!importPath) {
382
+ _context2.n = 31;
383
+ break;
384
+ }
385
+ return _context2.a(2, {
386
+ "import": importPath
387
+ });
388
+ case 31:
389
+ if (!typeImportPath) {
390
+ _context2.n = 32;
391
+ break;
392
+ }
393
+ return _context2.a(2, {
394
+ "import": typeImportPath
395
+ });
396
+ case 32:
397
+ // Try index files with the same single-pass approach
398
+ directoryMatches = dirContents.filter(function (entry) {
399
+ return entry.isDirectory && entry.name === moduleName;
400
+ });
401
+ if (!(directoryMatches.length > 0)) {
402
+ _context2.n = 67;
403
+ break;
404
+ }
405
+ moduleDir = joinPath(parentDir, directoryMatches[0].name);
406
+ _context2.p = 33;
407
+ _context2.n = 34;
408
+ return readDirectory(moduleDir);
409
+ case 34:
410
+ moduleDirContents = _context2.v;
411
+ // Build a map of available index files by basename
412
+ indexFilesByBaseName = new Map();
413
+ _iterator6 = _createForOfIteratorHelper(moduleDirContents);
414
+ try {
415
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
416
+ moduleFile = _step6.value;
417
+ if (moduleFile.isFile) {
418
+ fileName = moduleFile.name;
419
+ fileBaseName = void 0;
420
+ actualExtension = void 0; // Handle .d.ts files specially since getFileNameFromUrl returns .ts for index.d.ts
421
+ if (fileName.endsWith('.d.ts')) {
422
+ actualExtension = '.d.ts';
423
+ fileBaseName = fileName.substring(0, fileName.length - 5); // Remove .d.ts
424
+ } else {
425
+ _getFileNameFromUrl = getFileNameFromUrl(fileName), fileExt = _getFileNameFromUrl.extension;
426
+ actualExtension = fileExt;
427
+ fileBaseName = fileName.substring(0, fileName.length - fileExt.length);
428
+ }
429
+ if (!indexFilesByBaseName.has(fileBaseName)) {
430
+ indexFilesByBaseName.set(fileBaseName, []);
431
+ }
432
+ // Store the entry with its actual extension for later matching
433
+ indexFilesByBaseName.get(fileBaseName).push(_extends(_extends({}, moduleFile), {}, {
434
+ actualExtension: actualExtension
435
+ }));
436
+ }
437
+ }
438
+
439
+ // Check for index files in both priority orders
440
+ } catch (err) {
441
+ _iterator6.e(err);
442
+ } finally {
443
+ _iterator6.f();
444
+ }
445
+ indexFiles = indexFilesByBaseName.get('index');
446
+ if (!indexFiles) {
447
+ _context2.n = 65;
448
+ break;
449
+ }
450
+ indexEntryMap = indexFiles; // Find best match for value imports
451
+ _importPath = null;
452
+ _iterator7 = _createForOfIteratorHelper(VALUE_IMPORT_EXTENSIONS);
453
+ _context2.p = 35;
454
+ _iterator7.s();
455
+ case 36:
456
+ if ((_step7 = _iterator7.n()).done) {
457
+ _context2.n = 45;
458
+ break;
459
+ }
460
+ _ext2 = _step7.value;
461
+ _iterator9 = _createForOfIteratorHelper(indexEntryMap);
462
+ _context2.p = 37;
463
+ _iterator9.s();
464
+ case 38:
465
+ if ((_step9 = _iterator9.n()).done) {
466
+ _context2.n = 40;
467
+ break;
468
+ }
469
+ _entry2 = _step9.value;
470
+ if (!(_entry2.actualExtension === _ext2)) {
471
+ _context2.n = 39;
472
+ break;
473
+ }
474
+ _importPath = joinPath(moduleDir, _entry2.name);
475
+ return _context2.a(3, 40);
476
+ case 39:
477
+ _context2.n = 38;
478
+ break;
479
+ case 40:
480
+ _context2.n = 42;
481
+ break;
482
+ case 41:
483
+ _context2.p = 41;
484
+ _t5 = _context2.v;
485
+ _iterator9.e(_t5);
486
+ case 42:
487
+ _context2.p = 42;
488
+ _iterator9.f();
489
+ return _context2.f(42);
490
+ case 43:
491
+ if (!_importPath) {
492
+ _context2.n = 44;
493
+ break;
494
+ }
495
+ return _context2.a(3, 45);
496
+ case 44:
497
+ _context2.n = 36;
498
+ break;
499
+ case 45:
500
+ _context2.n = 47;
501
+ break;
502
+ case 46:
503
+ _context2.p = 46;
504
+ _t6 = _context2.v;
505
+ _iterator7.e(_t6);
506
+ case 47:
507
+ _context2.p = 47;
508
+ _iterator7.f();
509
+ return _context2.f(47);
510
+ case 48:
511
+ // Find best match for type imports
512
+ _typeImportPath = null;
513
+ _iterator8 = _createForOfIteratorHelper(TYPE_IMPORT_EXTENSIONS);
514
+ _context2.p = 49;
515
+ _iterator8.s();
516
+ case 50:
517
+ if ((_step8 = _iterator8.n()).done) {
518
+ _context2.n = 59;
519
+ break;
520
+ }
521
+ _ext3 = _step8.value;
522
+ _iterator0 = _createForOfIteratorHelper(indexEntryMap);
523
+ _context2.p = 51;
524
+ _iterator0.s();
525
+ case 52:
526
+ if ((_step0 = _iterator0.n()).done) {
527
+ _context2.n = 54;
528
+ break;
529
+ }
530
+ _entry3 = _step0.value;
531
+ if (!(_entry3.actualExtension === _ext3)) {
532
+ _context2.n = 53;
533
+ break;
534
+ }
535
+ _typeImportPath = joinPath(moduleDir, _entry3.name);
536
+ return _context2.a(3, 54);
537
+ case 53:
538
+ _context2.n = 52;
539
+ break;
540
+ case 54:
541
+ _context2.n = 56;
542
+ break;
543
+ case 55:
544
+ _context2.p = 55;
545
+ _t7 = _context2.v;
546
+ _iterator0.e(_t7);
547
+ case 56:
548
+ _context2.p = 56;
549
+ _iterator0.f();
550
+ return _context2.f(56);
551
+ case 57:
552
+ if (!_typeImportPath) {
553
+ _context2.n = 58;
554
+ break;
555
+ }
556
+ return _context2.a(3, 59);
557
+ case 58:
558
+ _context2.n = 50;
559
+ break;
560
+ case 59:
561
+ _context2.n = 61;
562
+ break;
563
+ case 60:
564
+ _context2.p = 60;
565
+ _t8 = _context2.v;
566
+ _iterator8.e(_t8);
567
+ case 61:
568
+ _context2.p = 61;
569
+ _iterator8.f();
570
+ return _context2.f(61);
571
+ case 62:
572
+ if (!(_importPath && _typeImportPath && _importPath !== _typeImportPath)) {
573
+ _context2.n = 63;
574
+ break;
575
+ }
576
+ return _context2.a(2, {
577
+ "import": _importPath,
578
+ typeImport: _typeImportPath
579
+ });
580
+ case 63:
581
+ if (!_importPath) {
582
+ _context2.n = 64;
583
+ break;
584
+ }
585
+ return _context2.a(2, {
586
+ "import": _importPath
587
+ });
588
+ case 64:
589
+ if (!_typeImportPath) {
590
+ _context2.n = 65;
591
+ break;
592
+ }
593
+ return _context2.a(2, {
594
+ "import": _typeImportPath
595
+ });
596
+ case 65:
597
+ _context2.n = 67;
598
+ break;
599
+ case 66:
600
+ _context2.p = 66;
601
+ _t9 = _context2.v;
602
+ case 67:
603
+ throw new Error("Could not resolve module at path \"".concat(modulePath, "\". Tried extensions: ").concat(VALUE_IMPORT_EXTENSIONS.join(', '), ", ").concat(TYPE_IMPORT_EXTENSIONS.join(', ')));
604
+ case 68:
605
+ return _context2.a(2);
606
+ }
607
+ }, _callee2, null, [[51, 55, 56, 57], [49, 60, 61, 62], [37, 41, 42, 43], [35, 46, 47, 48], [33, 66], [18, 22, 23, 24], [16, 27, 28, 29], [4, 8, 9, 10], [2, 13, 14, 15]]);
608
+ }));
609
+ return _resolveWithTypeAwareness.apply(this, arguments);
610
+ }
611
+ function resolveSinglePath(_x5, _x6, _x7, _x8, _x9) {
612
+ return _resolveSinglePath.apply(this, arguments);
613
+ }
614
+ /**
615
+ * Resolves multiple module paths efficiently by grouping them by directory
616
+ * and performing batch directory lookups.
617
+ *
618
+ * @param modulePaths - Array of module paths to resolve (without file extensions)
619
+ * @param readDirectory - Function to read directory contents
620
+ * @param options - Configuration options
621
+ * @returns Promise<Map<string, string>> - Map from input path to resolved file path
622
+ */
623
+ function _resolveSinglePath() {
624
+ _resolveSinglePath = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(modulePath, parentDir, moduleName, readDirectory, extensions) {
625
+ var dirContents, filesByBaseName, _iterator1, _step1, _entry6, _fileName2, _fileBaseName2, _actualExtension2, _getFileNameFromUrl4, _fileExt2, matchingFiles, _iterator10, _step10, ext, _iterator11, _step11, entry, entryWithExt, resolvedPath, directoryMatches, moduleDir, moduleDirContents, indexFilesByBaseName, _iterator12, _step12, moduleFile, fileName, fileBaseName, actualExtension, _getFileNameFromUrl3, fileExt, indexFiles, _iterator13, _step13, _ext4, _iterator14, _step14, _entry5, _entryWithExt, _t0, _t1, _t10, _t11, _t12, _t13;
626
+ return _regenerator().w(function (_context3) {
627
+ while (1) switch (_context3.p = _context3.n) {
628
+ case 0:
629
+ _context3.p = 0;
630
+ _context3.n = 1;
631
+ return readDirectory(parentDir);
632
+ case 1:
633
+ dirContents = _context3.v;
634
+ // Look for direct file matches in extension priority order
635
+ // Create a map of baseName -> files with that basename for efficient lookup
636
+ filesByBaseName = new Map();
637
+ _iterator1 = _createForOfIteratorHelper(dirContents);
638
+ try {
639
+ for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
640
+ _entry6 = _step1.value;
641
+ if (_entry6.isFile) {
642
+ _fileName2 = _entry6.name;
643
+ _fileBaseName2 = void 0;
644
+ _actualExtension2 = void 0; // Handle .d.ts files specially since getFileNameFromUrl returns .ts for types.d.ts
645
+ if (_fileName2.endsWith('.d.ts')) {
646
+ _actualExtension2 = '.d.ts';
647
+ _fileBaseName2 = _fileName2.substring(0, _fileName2.length - 5); // Remove .d.ts
648
+ } else {
649
+ _getFileNameFromUrl4 = getFileNameFromUrl(_fileName2), _fileExt2 = _getFileNameFromUrl4.extension;
650
+ _actualExtension2 = _fileExt2;
651
+ _fileBaseName2 = _fileName2.substring(0, _fileName2.length - _fileExt2.length);
652
+ }
653
+ if (!filesByBaseName.has(_fileBaseName2)) {
654
+ filesByBaseName.set(_fileBaseName2, []);
655
+ }
656
+ // Store the entry with its actual extension for later matching
657
+ filesByBaseName.get(_fileBaseName2).push(_extends(_extends({}, _entry6), {}, {
658
+ // Add a custom property to track the actual extension
659
+ actualExtension: _actualExtension2
660
+ }));
661
+ }
662
+ }
663
+
664
+ // Check for the module in extension priority order
665
+ } catch (err) {
666
+ _iterator1.e(err);
667
+ } finally {
668
+ _iterator1.f();
669
+ }
670
+ matchingFiles = filesByBaseName.get(moduleName);
671
+ if (!matchingFiles) {
672
+ _context3.n = 14;
673
+ break;
674
+ }
675
+ _iterator10 = _createForOfIteratorHelper(extensions);
676
+ _context3.p = 2;
677
+ _iterator10.s();
678
+ case 3:
679
+ if ((_step10 = _iterator10.n()).done) {
680
+ _context3.n = 11;
681
+ break;
682
+ }
683
+ ext = _step10.value;
684
+ _iterator11 = _createForOfIteratorHelper(matchingFiles);
685
+ _context3.p = 4;
686
+ _iterator11.s();
687
+ case 5:
688
+ if ((_step11 = _iterator11.n()).done) {
689
+ _context3.n = 7;
690
+ break;
691
+ }
692
+ entry = _step11.value;
693
+ entryWithExt = entry;
694
+ if (!(entryWithExt.actualExtension === ext)) {
695
+ _context3.n = 6;
696
+ break;
697
+ }
698
+ resolvedPath = joinPath(parentDir, entry.name);
699
+ return _context3.a(2, resolvedPath);
700
+ case 6:
701
+ _context3.n = 5;
702
+ break;
703
+ case 7:
704
+ _context3.n = 9;
705
+ break;
706
+ case 8:
707
+ _context3.p = 8;
708
+ _t0 = _context3.v;
709
+ _iterator11.e(_t0);
710
+ case 9:
711
+ _context3.p = 9;
712
+ _iterator11.f();
713
+ return _context3.f(9);
714
+ case 10:
715
+ _context3.n = 3;
716
+ break;
717
+ case 11:
718
+ _context3.n = 13;
719
+ break;
720
+ case 12:
721
+ _context3.p = 12;
722
+ _t1 = _context3.v;
723
+ _iterator10.e(_t1);
724
+ case 13:
725
+ _context3.p = 13;
726
+ _iterator10.f();
727
+ return _context3.f(13);
728
+ case 14:
729
+ // Look for directory with index files
730
+ directoryMatches = dirContents.filter(function (entry) {
731
+ return entry.isDirectory && entry.name === moduleName;
732
+ });
733
+ if (!(directoryMatches.length > 0)) {
734
+ _context3.n = 31;
735
+ break;
736
+ }
737
+ moduleDir = joinPath(parentDir, directoryMatches[0].name);
738
+ _context3.p = 15;
739
+ _context3.n = 16;
740
+ return readDirectory(moduleDir);
741
+ case 16:
742
+ moduleDirContents = _context3.v;
743
+ // Look for index files in extension priority order
744
+ // Create a map of baseName -> files for efficient lookup
745
+ indexFilesByBaseName = new Map();
746
+ _iterator12 = _createForOfIteratorHelper(moduleDirContents);
747
+ try {
748
+ for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
749
+ moduleFile = _step12.value;
750
+ if (moduleFile.isFile) {
751
+ fileName = moduleFile.name;
752
+ fileBaseName = void 0;
753
+ actualExtension = void 0; // Handle .d.ts files specially since getFileNameFromUrl returns .ts for index.d.ts
754
+ if (fileName.endsWith('.d.ts')) {
755
+ actualExtension = '.d.ts';
756
+ fileBaseName = fileName.substring(0, fileName.length - 5); // Remove .d.ts
757
+ } else {
758
+ _getFileNameFromUrl3 = getFileNameFromUrl(fileName), fileExt = _getFileNameFromUrl3.extension;
759
+ actualExtension = fileExt;
760
+ fileBaseName = fileName.substring(0, fileName.length - fileExt.length);
761
+ }
762
+ if (!indexFilesByBaseName.has(fileBaseName)) {
763
+ indexFilesByBaseName.set(fileBaseName, []);
764
+ }
765
+ // Store the entry with its actual extension for later matching
766
+ indexFilesByBaseName.get(fileBaseName).push(_extends(_extends({}, moduleFile), {}, {
767
+ actualExtension: actualExtension
768
+ }));
769
+ }
770
+ }
771
+
772
+ // Check for index files in extension priority order
773
+ } catch (err) {
774
+ _iterator12.e(err);
775
+ } finally {
776
+ _iterator12.f();
777
+ }
778
+ indexFiles = indexFilesByBaseName.get('index');
779
+ if (!indexFiles) {
780
+ _context3.n = 29;
781
+ break;
782
+ }
783
+ _iterator13 = _createForOfIteratorHelper(extensions);
784
+ _context3.p = 17;
785
+ _iterator13.s();
786
+ case 18:
787
+ if ((_step13 = _iterator13.n()).done) {
788
+ _context3.n = 26;
789
+ break;
790
+ }
791
+ _ext4 = _step13.value;
792
+ _iterator14 = _createForOfIteratorHelper(indexFiles);
793
+ _context3.p = 19;
794
+ _iterator14.s();
795
+ case 20:
796
+ if ((_step14 = _iterator14.n()).done) {
797
+ _context3.n = 22;
798
+ break;
799
+ }
800
+ _entry5 = _step14.value;
801
+ _entryWithExt = _entry5;
802
+ if (!(_entryWithExt.actualExtension === _ext4)) {
803
+ _context3.n = 21;
804
+ break;
805
+ }
806
+ return _context3.a(2, joinPath(moduleDir, _entry5.name));
807
+ case 21:
808
+ _context3.n = 20;
809
+ break;
810
+ case 22:
811
+ _context3.n = 24;
812
+ break;
813
+ case 23:
814
+ _context3.p = 23;
815
+ _t10 = _context3.v;
816
+ _iterator14.e(_t10);
817
+ case 24:
818
+ _context3.p = 24;
819
+ _iterator14.f();
820
+ return _context3.f(24);
821
+ case 25:
822
+ _context3.n = 18;
823
+ break;
824
+ case 26:
825
+ _context3.n = 28;
826
+ break;
827
+ case 27:
828
+ _context3.p = 27;
829
+ _t11 = _context3.v;
830
+ _iterator13.e(_t11);
831
+ case 28:
832
+ _context3.p = 28;
833
+ _iterator13.f();
834
+ return _context3.f(28);
835
+ case 29:
836
+ _context3.n = 31;
837
+ break;
838
+ case 30:
839
+ _context3.p = 30;
840
+ _t12 = _context3.v;
841
+ case 31:
842
+ _context3.n = 33;
843
+ break;
844
+ case 32:
845
+ _context3.p = 32;
846
+ _t13 = _context3.v;
847
+ case 33:
848
+ throw new Error("Could not resolve module at path \"".concat(modulePath, "\". Tried extensions: ").concat(extensions.join(', ')));
849
+ case 34:
850
+ return _context3.a(2);
851
+ }
852
+ }, _callee3, null, [[19, 23, 24, 25], [17, 27, 28, 29], [15, 30], [4, 8, 9, 10], [2, 12, 13, 14], [0, 32]]);
853
+ }));
854
+ return _resolveSinglePath.apply(this, arguments);
855
+ }
856
+ export function resolveModulePaths(_x0, _x1) {
857
+ return _resolveModulePaths.apply(this, arguments);
858
+ }
859
+
860
+ /**
861
+ * Resolves import result by separating JavaScript modules from static assets,
862
+ * only resolving JavaScript modules and returning a combined map.
863
+ * This function uses the new type-aware resolveModulePath function internally.
864
+ *
865
+ * @param importResult - The result from parseImports containing all imports
866
+ * @param readDirectory - Function to read directory contents
867
+ * @param options - Configuration options for module resolution
868
+ * @returns Promise<Map<string, string>> - Map from import path to resolved file path
869
+ */
870
+ function _resolveModulePaths() {
871
+ _resolveModulePaths = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(modulePaths, readDirectory) {
872
+ var options,
873
+ _options$extensions2,
874
+ extensions,
875
+ results,
876
+ pathsByDirectory,
877
+ _iterator15,
878
+ _step15,
879
+ modulePath,
880
+ lastSlashIndex,
881
+ parentDir,
882
+ moduleName,
883
+ directoryEntries,
884
+ directoryResults,
885
+ _iterator24,
886
+ _step24,
887
+ directoryResult,
888
+ _iterator25,
889
+ _step25,
890
+ _step25$value,
891
+ fullPath,
892
+ resolvedPath,
893
+ _args6 = arguments;
894
+ return _regenerator().w(function (_context6) {
895
+ while (1) switch (_context6.n) {
896
+ case 0:
897
+ options = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
898
+ _options$extensions2 = options.extensions, extensions = _options$extensions2 === void 0 ? JAVASCRIPT_MODULE_EXTENSIONS : _options$extensions2;
899
+ results = new Map(); // Group paths by their parent directory
900
+ pathsByDirectory = new Map();
901
+ _iterator15 = _createForOfIteratorHelper(modulePaths);
902
+ try {
903
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
904
+ modulePath = _step15.value;
905
+ lastSlashIndex = modulePath.lastIndexOf('/');
906
+ parentDir = modulePath.substring(0, lastSlashIndex);
907
+ moduleName = modulePath.substring(lastSlashIndex + 1);
908
+ if (!pathsByDirectory.has(parentDir)) {
909
+ pathsByDirectory.set(parentDir, []);
910
+ }
911
+ pathsByDirectory.get(parentDir).push({
912
+ fullPath: modulePath,
913
+ moduleName: moduleName
914
+ });
915
+ }
916
+
917
+ // Process each directory group
918
+ } catch (err) {
919
+ _iterator15.e(err);
920
+ } finally {
921
+ _iterator15.f();
922
+ }
923
+ directoryEntries = Array.from(pathsByDirectory.entries());
924
+ _context6.n = 1;
925
+ return Promise.all(directoryEntries.map(/*#__PURE__*/function () {
926
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref) {
927
+ var _ref3, parentDir, pathGroup, dirContents, unresolved, resolved, filesByBaseName, _iterator16, _step16, entry, fileName, _getFileNameFromUrl7, fileExt, fileBaseName, _iterator17, _step17, _step17$value, _fullPath, moduleName, foundMatch, matchingFiles, _iterator22, _step22, ext, _iterator23, _step23, _entry7, _getFileNameFromUrl8, entryExt, directories, indexResults, _iterator21, _step21, _step21$value, fullPath, resolvedPath, _t17, _t18, _t19, _t20;
928
+ return _regenerator().w(function (_context5) {
929
+ while (1) switch (_context5.p = _context5.n) {
930
+ case 0:
931
+ _ref3 = _slicedToArray(_ref, 2), parentDir = _ref3[0], pathGroup = _ref3[1];
932
+ _context5.p = 1;
933
+ _context5.n = 2;
934
+ return readDirectory(parentDir);
935
+ case 2:
936
+ dirContents = _context5.v;
937
+ unresolved = [];
938
+ resolved = []; // Look for direct file matches in extension priority order
939
+ // Create a map of baseName -> files for efficient lookup
940
+ filesByBaseName = new Map();
941
+ _iterator16 = _createForOfIteratorHelper(dirContents);
942
+ try {
943
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
944
+ entry = _step16.value;
945
+ if (entry.isFile) {
946
+ fileName = entry.name;
947
+ _getFileNameFromUrl7 = getFileNameFromUrl(fileName), fileExt = _getFileNameFromUrl7.extension;
948
+ fileBaseName = fileName.substring(0, fileName.length - fileExt.length);
949
+ if (!filesByBaseName.has(fileBaseName)) {
950
+ filesByBaseName.set(fileBaseName, []);
951
+ }
952
+ filesByBaseName.get(fileBaseName).push(entry);
953
+ }
954
+ }
955
+
956
+ // Check each module path against the file map
957
+ } catch (err) {
958
+ _iterator16.e(err);
959
+ } finally {
960
+ _iterator16.f();
961
+ }
962
+ _iterator17 = _createForOfIteratorHelper(pathGroup);
963
+ _context5.p = 3;
964
+ _iterator17.s();
965
+ case 4:
966
+ if ((_step17 = _iterator17.n()).done) {
967
+ _context5.n = 20;
968
+ break;
969
+ }
970
+ _step17$value = _step17.value, _fullPath = _step17$value.fullPath, moduleName = _step17$value.moduleName;
971
+ foundMatch = false;
972
+ matchingFiles = filesByBaseName.get(moduleName);
973
+ if (!matchingFiles) {
974
+ _context5.n = 18;
975
+ break;
976
+ }
977
+ _iterator22 = _createForOfIteratorHelper(extensions);
978
+ _context5.p = 5;
979
+ _iterator22.s();
980
+ case 6:
981
+ if ((_step22 = _iterator22.n()).done) {
982
+ _context5.n = 15;
983
+ break;
984
+ }
985
+ ext = _step22.value;
986
+ _iterator23 = _createForOfIteratorHelper(matchingFiles);
987
+ _context5.p = 7;
988
+ _iterator23.s();
989
+ case 8:
990
+ if ((_step23 = _iterator23.n()).done) {
991
+ _context5.n = 10;
992
+ break;
993
+ }
994
+ _entry7 = _step23.value;
995
+ _getFileNameFromUrl8 = getFileNameFromUrl(_entry7.name), entryExt = _getFileNameFromUrl8.extension;
996
+ if (!(entryExt === ext)) {
997
+ _context5.n = 9;
998
+ break;
999
+ }
1000
+ resolved.push({
1001
+ fullPath: _fullPath,
1002
+ resolvedPath: joinPath(parentDir, _entry7.name)
1003
+ });
1004
+ foundMatch = true;
1005
+ return _context5.a(3, 10);
1006
+ case 9:
1007
+ _context5.n = 8;
1008
+ break;
1009
+ case 10:
1010
+ _context5.n = 12;
1011
+ break;
1012
+ case 11:
1013
+ _context5.p = 11;
1014
+ _t17 = _context5.v;
1015
+ _iterator23.e(_t17);
1016
+ case 12:
1017
+ _context5.p = 12;
1018
+ _iterator23.f();
1019
+ return _context5.f(12);
1020
+ case 13:
1021
+ if (!foundMatch) {
1022
+ _context5.n = 14;
1023
+ break;
1024
+ }
1025
+ return _context5.a(3, 15);
1026
+ case 14:
1027
+ _context5.n = 6;
1028
+ break;
1029
+ case 15:
1030
+ _context5.n = 17;
1031
+ break;
1032
+ case 16:
1033
+ _context5.p = 16;
1034
+ _t18 = _context5.v;
1035
+ _iterator22.e(_t18);
1036
+ case 17:
1037
+ _context5.p = 17;
1038
+ _iterator22.f();
1039
+ return _context5.f(17);
1040
+ case 18:
1041
+ if (!foundMatch) {
1042
+ unresolved.push({
1043
+ fullPath: _fullPath,
1044
+ moduleName: moduleName
1045
+ });
1046
+ }
1047
+ case 19:
1048
+ _context5.n = 4;
1049
+ break;
1050
+ case 20:
1051
+ _context5.n = 22;
1052
+ break;
1053
+ case 21:
1054
+ _context5.p = 21;
1055
+ _t19 = _context5.v;
1056
+ _iterator17.e(_t19);
1057
+ case 22:
1058
+ _context5.p = 22;
1059
+ _iterator17.f();
1060
+ return _context5.f(22);
1061
+ case 23:
1062
+ if (!(unresolved.length > 0)) {
1063
+ _context5.n = 25;
1064
+ break;
1065
+ }
1066
+ directories = new Set(dirContents.filter(function (entry) {
1067
+ return entry.isDirectory;
1068
+ }).map(function (entry) {
1069
+ return entry.name;
1070
+ }));
1071
+ _context5.n = 24;
1072
+ return Promise.all(unresolved.map(/*#__PURE__*/function () {
1073
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref4) {
1074
+ var fullPath, moduleName, moduleDir, moduleDirContents, indexFilesByBaseName, _iterator18, _step18, moduleFile, fileName, _getFileNameFromUrl6, fileExt, fileBaseName, indexFiles, _iterator19, _step19, ext, _iterator20, _step20, entry, _getFileNameFromUrl5, entryExt, _t14, _t15, _t16;
1075
+ return _regenerator().w(function (_context4) {
1076
+ while (1) switch (_context4.p = _context4.n) {
1077
+ case 0:
1078
+ fullPath = _ref4.fullPath, moduleName = _ref4.moduleName;
1079
+ if (!directories.has(moduleName)) {
1080
+ _context4.n = 17;
1081
+ break;
1082
+ }
1083
+ moduleDir = joinPath(parentDir, moduleName);
1084
+ _context4.p = 1;
1085
+ _context4.n = 2;
1086
+ return readDirectory(moduleDir);
1087
+ case 2:
1088
+ moduleDirContents = _context4.v;
1089
+ // Look for index files in extension priority order
1090
+ // Create a map of baseName -> files for efficient lookup
1091
+ indexFilesByBaseName = new Map();
1092
+ _iterator18 = _createForOfIteratorHelper(moduleDirContents);
1093
+ try {
1094
+ for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) {
1095
+ moduleFile = _step18.value;
1096
+ if (moduleFile.isFile) {
1097
+ fileName = moduleFile.name;
1098
+ _getFileNameFromUrl6 = getFileNameFromUrl(fileName), fileExt = _getFileNameFromUrl6.extension;
1099
+ fileBaseName = fileName.substring(0, fileName.length - fileExt.length);
1100
+ if (!indexFilesByBaseName.has(fileBaseName)) {
1101
+ indexFilesByBaseName.set(fileBaseName, []);
1102
+ }
1103
+ indexFilesByBaseName.get(fileBaseName).push(moduleFile);
1104
+ }
1105
+ }
1106
+
1107
+ // Check for index files in extension priority order
1108
+ } catch (err) {
1109
+ _iterator18.e(err);
1110
+ } finally {
1111
+ _iterator18.f();
1112
+ }
1113
+ indexFiles = indexFilesByBaseName.get('index');
1114
+ if (!indexFiles) {
1115
+ _context4.n = 15;
1116
+ break;
1117
+ }
1118
+ _iterator19 = _createForOfIteratorHelper(extensions);
1119
+ _context4.p = 3;
1120
+ _iterator19.s();
1121
+ case 4:
1122
+ if ((_step19 = _iterator19.n()).done) {
1123
+ _context4.n = 12;
1124
+ break;
1125
+ }
1126
+ ext = _step19.value;
1127
+ _iterator20 = _createForOfIteratorHelper(indexFiles);
1128
+ _context4.p = 5;
1129
+ _iterator20.s();
1130
+ case 6:
1131
+ if ((_step20 = _iterator20.n()).done) {
1132
+ _context4.n = 8;
1133
+ break;
1134
+ }
1135
+ entry = _step20.value;
1136
+ _getFileNameFromUrl5 = getFileNameFromUrl(entry.name), entryExt = _getFileNameFromUrl5.extension;
1137
+ if (!(entryExt === ext)) {
1138
+ _context4.n = 7;
1139
+ break;
1140
+ }
1141
+ return _context4.a(2, {
1142
+ fullPath: fullPath,
1143
+ resolvedPath: joinPath(moduleDir, entry.name)
1144
+ });
1145
+ case 7:
1146
+ _context4.n = 6;
1147
+ break;
1148
+ case 8:
1149
+ _context4.n = 10;
1150
+ break;
1151
+ case 9:
1152
+ _context4.p = 9;
1153
+ _t14 = _context4.v;
1154
+ _iterator20.e(_t14);
1155
+ case 10:
1156
+ _context4.p = 10;
1157
+ _iterator20.f();
1158
+ return _context4.f(10);
1159
+ case 11:
1160
+ _context4.n = 4;
1161
+ break;
1162
+ case 12:
1163
+ _context4.n = 14;
1164
+ break;
1165
+ case 13:
1166
+ _context4.p = 13;
1167
+ _t15 = _context4.v;
1168
+ _iterator19.e(_t15);
1169
+ case 14:
1170
+ _context4.p = 14;
1171
+ _iterator19.f();
1172
+ return _context4.f(14);
1173
+ case 15:
1174
+ _context4.n = 17;
1175
+ break;
1176
+ case 16:
1177
+ _context4.p = 16;
1178
+ _t16 = _context4.v;
1179
+ case 17:
1180
+ return _context4.a(2, {
1181
+ fullPath: fullPath,
1182
+ resolvedPath: null
1183
+ });
1184
+ }
1185
+ }, _callee4, null, [[5, 9, 10, 11], [3, 13, 14, 15], [1, 16]]);
1186
+ }));
1187
+ return function (_x15) {
1188
+ return _ref5.apply(this, arguments);
1189
+ };
1190
+ }()));
1191
+ case 24:
1192
+ indexResults = _context5.v;
1193
+ _iterator21 = _createForOfIteratorHelper(indexResults);
1194
+ try {
1195
+ for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) {
1196
+ _step21$value = _step21.value, fullPath = _step21$value.fullPath, resolvedPath = _step21$value.resolvedPath;
1197
+ if (resolvedPath) {
1198
+ resolved.push({
1199
+ fullPath: fullPath,
1200
+ resolvedPath: resolvedPath
1201
+ });
1202
+ }
1203
+ }
1204
+ } catch (err) {
1205
+ _iterator21.e(err);
1206
+ } finally {
1207
+ _iterator21.f();
1208
+ }
1209
+ case 25:
1210
+ return _context5.a(2, resolved);
1211
+ case 26:
1212
+ _context5.p = 26;
1213
+ _t20 = _context5.v;
1214
+ return _context5.a(2, []);
1215
+ }
1216
+ }, _callee5, null, [[7, 11, 12, 13], [5, 16, 17, 18], [3, 21, 22, 23], [1, 26]]);
1217
+ }));
1218
+ return function (_x14) {
1219
+ return _ref2.apply(this, arguments);
1220
+ };
1221
+ }()));
1222
+ case 1:
1223
+ directoryResults = _context6.v;
1224
+ // Collect all resolved paths
1225
+ _iterator24 = _createForOfIteratorHelper(directoryResults);
1226
+ try {
1227
+ for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) {
1228
+ directoryResult = _step24.value;
1229
+ _iterator25 = _createForOfIteratorHelper(directoryResult);
1230
+ try {
1231
+ for (_iterator25.s(); !(_step25 = _iterator25.n()).done;) {
1232
+ _step25$value = _step25.value, fullPath = _step25$value.fullPath, resolvedPath = _step25$value.resolvedPath;
1233
+ results.set(fullPath, resolvedPath);
1234
+ }
1235
+ } catch (err) {
1236
+ _iterator25.e(err);
1237
+ } finally {
1238
+ _iterator25.f();
1239
+ }
1240
+ }
1241
+ } catch (err) {
1242
+ _iterator24.e(err);
1243
+ } finally {
1244
+ _iterator24.f();
1245
+ }
1246
+ return _context6.a(2, results);
1247
+ }
1248
+ }, _callee6);
1249
+ }));
1250
+ return _resolveModulePaths.apply(this, arguments);
1251
+ }
1252
+ export function resolveImportResult(_x10, _x11) {
1253
+ return _resolveImportResult.apply(this, arguments);
1254
+ }
1255
+
1256
+ /**
1257
+ * Resolves variant paths from a variants object mapping variant names to their file paths.
1258
+ * This function extracts the paths, resolves them using resolveModulePaths, and returns
1259
+ * a map from variant name to resolved file URL.
1260
+ *
1261
+ * @param variants - Object mapping variant names to their file paths
1262
+ * @param readDirectory - Function to read directory contents
1263
+ * @param options - Configuration options for module resolution
1264
+ * @returns Promise<Map<string, string>> - Map from variant name to resolved file URL
1265
+ */
1266
+ function _resolveImportResult() {
1267
+ _resolveImportResult = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(importResult, readDirectory) {
1268
+ var options,
1269
+ resolvedPathsMap,
1270
+ jsModulesToResolve,
1271
+ jsModulesWithExtensions,
1272
+ staticAssets,
1273
+ _loop,
1274
+ _i,
1275
+ _Object$entries,
1276
+ resolutionPromises,
1277
+ resolutionResults,
1278
+ _args9 = arguments;
1279
+ return _regenerator().w(function (_context9) {
1280
+ while (1) switch (_context9.n) {
1281
+ case 0:
1282
+ options = _args9.length > 2 && _args9[2] !== undefined ? _args9[2] : {};
1283
+ resolvedPathsMap = new Map(); // Separate imports into categories for processing
1284
+ jsModulesToResolve = [];
1285
+ jsModulesWithExtensions = [];
1286
+ staticAssets = [];
1287
+ _loop = /*#__PURE__*/_regenerator().m(function _loop() {
1288
+ var _Object$entries$_i, importPath, _Object$entries$_i$, path, includeTypeDefs;
1289
+ return _regenerator().w(function (_context7) {
1290
+ while (1) switch (_context7.n) {
1291
+ case 0:
1292
+ _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), importPath = _Object$entries$_i[0], _Object$entries$_i$ = _Object$entries$_i[1], path = _Object$entries$_i$.path, includeTypeDefs = _Object$entries$_i$.includeTypeDefs;
1293
+ if (isJavaScriptModule(importPath)) {
1294
+ // If the import path already has a JS/TS extension, use it as-is
1295
+ if (JAVASCRIPT_MODULE_EXTENSIONS.some(function (ext) {
1296
+ return importPath.endsWith(ext);
1297
+ })) {
1298
+ jsModulesWithExtensions.push(path);
1299
+ } else {
1300
+ jsModulesToResolve.push({
1301
+ path: path,
1302
+ includeTypeDefs: includeTypeDefs
1303
+ });
1304
+ }
1305
+ } else {
1306
+ // Static asset - use path as-is
1307
+ staticAssets.push(path);
1308
+ }
1309
+ case 1:
1310
+ return _context7.a(2);
1311
+ }
1312
+ }, _loop);
1313
+ });
1314
+ _i = 0, _Object$entries = Object.entries(importResult);
1315
+ case 1:
1316
+ if (!(_i < _Object$entries.length)) {
1317
+ _context9.n = 3;
1318
+ break;
1319
+ }
1320
+ return _context9.d(_regeneratorValues(_loop()), 2);
1321
+ case 2:
1322
+ _i++;
1323
+ _context9.n = 1;
1324
+ break;
1325
+ case 3:
1326
+ // Add modules with extensions as-is
1327
+ jsModulesWithExtensions.forEach(function (path) {
1328
+ resolvedPathsMap.set(path, path);
1329
+ });
1330
+
1331
+ // Add static assets as-is
1332
+ staticAssets.forEach(function (path) {
1333
+ resolvedPathsMap.set(path, path);
1334
+ });
1335
+
1336
+ // Resolve JS modules without extensions
1337
+ if (!(jsModulesToResolve.length > 0)) {
1338
+ _context9.n = 5;
1339
+ break;
1340
+ }
1341
+ resolutionPromises = jsModulesToResolve.map(/*#__PURE__*/function () {
1342
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(_ref6) {
1343
+ var path, includeTypeDefs, resolved, _t21;
1344
+ return _regenerator().w(function (_context8) {
1345
+ while (1) switch (_context8.p = _context8.n) {
1346
+ case 0:
1347
+ path = _ref6.path, includeTypeDefs = _ref6.includeTypeDefs;
1348
+ _context8.p = 1;
1349
+ _context8.n = 2;
1350
+ return resolveModulePath(path, readDirectory, options, includeTypeDefs);
1351
+ case 2:
1352
+ resolved = _context8.v;
1353
+ if (!(typeof resolved === 'string')) {
1354
+ _context8.n = 3;
1355
+ break;
1356
+ }
1357
+ return _context8.a(2, {
1358
+ path: path,
1359
+ resolved: resolved
1360
+ });
1361
+ case 3:
1362
+ return _context8.a(2, {
1363
+ path: path,
1364
+ resolved: resolved["import"]
1365
+ });
1366
+ case 4:
1367
+ _context8.p = 4;
1368
+ _t21 = _context8.v;
1369
+ return _context8.a(2, null);
1370
+ }
1371
+ }, _callee7, null, [[1, 4]]);
1372
+ }));
1373
+ return function (_x16) {
1374
+ return _ref7.apply(this, arguments);
1375
+ };
1376
+ }());
1377
+ _context9.n = 4;
1378
+ return Promise.all(resolutionPromises);
1379
+ case 4:
1380
+ resolutionResults = _context9.v;
1381
+ // Add successful resolutions to the map
1382
+ resolutionResults.forEach(function (result) {
1383
+ if (result) {
1384
+ resolvedPathsMap.set(result.path, result.resolved);
1385
+ }
1386
+ });
1387
+ case 5:
1388
+ return _context9.a(2, resolvedPathsMap);
1389
+ }
1390
+ }, _callee8);
1391
+ }));
1392
+ return _resolveImportResult.apply(this, arguments);
1393
+ }
1394
+ export function resolveVariantPaths(_x12, _x13) {
1395
+ return _resolveVariantPaths.apply(this, arguments);
1396
+ }
1397
+ function _resolveVariantPaths() {
1398
+ _resolveVariantPaths = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(variants, readDirectory) {
1399
+ var options,
1400
+ variantPaths,
1401
+ resolvedVariantPaths,
1402
+ variantMap,
1403
+ _i2,
1404
+ _Object$entries2,
1405
+ _Object$entries2$_i,
1406
+ variantName,
1407
+ variantPath,
1408
+ resolvedVariantPath,
1409
+ _args0 = arguments;
1410
+ return _regenerator().w(function (_context0) {
1411
+ while (1) switch (_context0.n) {
1412
+ case 0:
1413
+ options = _args0.length > 2 && _args0[2] !== undefined ? _args0[2] : {};
1414
+ // Extract the variant paths and resolve them
1415
+ variantPaths = Object.values(variants);
1416
+ _context0.n = 1;
1417
+ return resolveModulePaths(variantPaths, readDirectory, options);
1418
+ case 1:
1419
+ resolvedVariantPaths = _context0.v;
1420
+ // Build a map from variant name to resolved file URL
1421
+ variantMap = new Map();
1422
+ for (_i2 = 0, _Object$entries2 = Object.entries(variants); _i2 < _Object$entries2.length; _i2++) {
1423
+ _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), variantName = _Object$entries2$_i[0], variantPath = _Object$entries2$_i[1];
1424
+ resolvedVariantPath = resolvedVariantPaths.get(variantPath);
1425
+ if (resolvedVariantPath) {
1426
+ // Store as a file URL
1427
+ variantMap.set(variantName, "file://".concat(resolvedVariantPath));
1428
+ }
1429
+ }
1430
+ return _context0.a(2, variantMap);
1431
+ }
1432
+ }, _callee9);
1433
+ }));
1434
+ return _resolveVariantPaths.apply(this, arguments);
1435
+ }