@mui/internal-docs-infra 0.2.3-canary.9 → 0.3.1-canary.1
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.
- package/README.md +3 -2
- package/esm/CodeHighlighter/CodeHighlighter.js +16 -16
- package/esm/CodeHighlighter/CodeHighlighterClient.js +33 -33
- package/esm/CodeHighlighter/errors.js +3 -3
- package/esm/CodeHighlighter/types.d.ts +1 -1
- package/esm/CodeProvider/CodeContext.d.ts +4 -4
- package/esm/CodeProvider/CodeProvider.js +7 -7
- package/esm/cli/index.d.ts +1 -0
- package/esm/cli/index.js +6 -0
- package/esm/cli/runValidate.d.ts +8 -0
- package/esm/cli/runValidate.js +297 -0
- package/esm/createSitemap/createSitemap.d.ts +23 -0
- package/esm/createSitemap/createSitemap.js +45 -0
- package/esm/createSitemap/index.d.ts +1 -0
- package/esm/createSitemap/index.js +1 -0
- package/esm/createSitemap/types.d.ts +68 -0
- package/esm/createSitemap/types.js +1 -0
- package/esm/pipeline/getFileConventions/fileConventions.d.ts +4 -0
- package/esm/pipeline/getFileConventions/fileConventions.js +4 -0
- package/esm/pipeline/getFileConventions/getFileConventions.d.ts +4 -0
- package/esm/pipeline/getFileConventions/getFileConventions.js +17 -0
- package/esm/pipeline/getFileConventions/index.d.ts +1 -0
- package/esm/pipeline/getFileConventions/index.js +1 -0
- package/esm/{CodeHighlighter/addPathsToVariant.d.ts → pipeline/loadCodeVariant/addCodeVariantPaths.d.ts} +1 -1
- package/esm/{CodeHighlighter/applyTransform.d.ts → pipeline/loadCodeVariant/applyCodeTransform.d.ts} +3 -3
- package/esm/{CodeHighlighter/applyTransform.js → pipeline/loadCodeVariant/applyCodeTransform.js} +4 -4
- package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/calculateMainFilePath.js +1 -1
- package/esm/{CodeHighlighter/transformCode.d.ts → pipeline/loadCodeVariant/computeHastDeltas.d.ts} +9 -5
- package/esm/{CodeHighlighter/transformCode.js → pipeline/loadCodeVariant/computeHastDeltas.js} +20 -16
- package/esm/pipeline/loadCodeVariant/diffHast.d.ts +3 -0
- package/esm/{CodeHighlighter/transformParsedSource.js → pipeline/loadCodeVariant/diffHast.js} +5 -5
- package/esm/{CodeHighlighter/examineVariant.d.ts → pipeline/loadCodeVariant/examineCodeVariant.d.ts} +2 -2
- package/esm/{CodeHighlighter/examineVariant.js → pipeline/loadCodeVariant/examineCodeVariant.js} +1 -1
- package/esm/{useDemo/flattenVariant.d.ts → pipeline/loadCodeVariant/flattenCodeVariant.d.ts} +2 -2
- package/esm/{useDemo/flattenVariant.js → pipeline/loadCodeVariant/flattenCodeVariant.js} +3 -3
- package/esm/{CodeHighlighter/hasAllVariants.d.ts → pipeline/loadCodeVariant/hasAllCodeVariants.d.ts} +1 -1
- package/esm/pipeline/loadCodeVariant/index.d.ts +10 -0
- package/esm/pipeline/loadCodeVariant/index.js +17 -0
- package/esm/{CodeHighlighter/loadFallbackCode.d.ts → pipeline/loadCodeVariant/loadCodeFallback.d.ts} +2 -2
- package/esm/{CodeHighlighter/loadFallbackCode.js → pipeline/loadCodeVariant/loadCodeFallback.js} +180 -106
- package/esm/{CodeHighlighter/loadVariant.d.ts → pipeline/loadCodeVariant/loadCodeVariant.d.ts} +2 -2
- package/esm/{CodeHighlighter/loadVariant.js → pipeline/loadCodeVariant/loadCodeVariant.js} +141 -55
- package/esm/{CodeHighlighter/maybeInitialData.d.ts → pipeline/loadCodeVariant/maybeCodeInitialData.d.ts} +6 -6
- package/esm/{CodeHighlighter/maybeInitialData.js → pipeline/loadCodeVariant/maybeCodeInitialData.js} +6 -6
- package/esm/{CodeHighlighter/mergeMetadata.d.ts → pipeline/loadCodeVariant/mergeCodeMetadata.d.ts} +3 -3
- package/esm/{CodeHighlighter/mergeMetadata.js → pipeline/loadCodeVariant/mergeCodeMetadata.js} +3 -3
- package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/parseCode.d.ts +1 -1
- package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/transformSource.d.ts +1 -1
- package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +5 -0
- package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +94 -16
- package/esm/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +3 -3
- package/esm/pipeline/loadPrecomputedCodeHighlighter/performanceLogger.d.ts +30 -0
- package/esm/pipeline/loadPrecomputedCodeHighlighter/performanceLogger.js +77 -0
- package/esm/pipeline/loadPrecomputedCodeHighlighterClient/loadPrecomputedCodeHighlighterClient.js +24 -14
- package/esm/pipeline/loadPrecomputedSitemap/index.d.ts +2 -0
- package/esm/pipeline/loadPrecomputedSitemap/index.js +4 -0
- package/esm/pipeline/loadPrecomputedSitemap/loadPrecomputedSitemap.d.ts +10 -0
- package/esm/pipeline/loadPrecomputedSitemap/loadPrecomputedSitemap.js +220 -0
- package/esm/pipeline/loadServerCodeMeta/index.d.ts +2 -1
- package/esm/pipeline/loadServerCodeMeta/index.js +2 -1
- package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts +1 -1
- package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.js +7 -5
- package/esm/pipeline/{loaderUtils → loadServerCodeMeta}/resolveModulePathWithFs.d.ts +3 -3
- package/esm/pipeline/{loaderUtils → loadServerCodeMeta}/resolveModulePathWithFs.js +14 -8
- package/esm/pipeline/loadServerPageIndex/index.d.ts +2 -0
- package/esm/pipeline/loadServerPageIndex/index.js +1 -0
- package/esm/pipeline/loadServerPageIndex/loadServerPageIndex.d.ts +51 -0
- package/esm/pipeline/loadServerPageIndex/loadServerPageIndex.js +176 -0
- package/esm/pipeline/loadServerSitemap/index.d.ts +2 -0
- package/esm/pipeline/loadServerSitemap/index.js +1 -0
- package/esm/pipeline/loadServerSitemap/loadServerSitemap.d.ts +39 -0
- package/esm/pipeline/loadServerSitemap/loadServerSitemap.js +170 -0
- package/esm/pipeline/loadServerSource/loadServerSource.js +18 -15
- package/esm/pipeline/loaderUtils/externalsToPackages.js +1 -1
- package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts +0 -9
- package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +7 -7
- package/esm/pipeline/loaderUtils/fileUrlToPortablePath.d.ts +44 -0
- package/esm/pipeline/loaderUtils/fileUrlToPortablePath.js +80 -0
- package/esm/pipeline/loaderUtils/index.d.ts +2 -1
- package/esm/pipeline/loaderUtils/index.js +2 -1
- package/esm/pipeline/loaderUtils/parseImportsAndComments.d.ts +10 -6
- package/esm/pipeline/loaderUtils/parseImportsAndComments.js +17 -12
- package/esm/pipeline/loaderUtils/processRelativeImports.d.ts +1 -1
- package/esm/pipeline/loaderUtils/processRelativeImports.js +44 -27
- package/esm/pipeline/loaderUtils/resolveModulePath.d.ts +5 -5
- package/esm/pipeline/loaderUtils/resolveModulePath.js +40 -37
- package/esm/pipeline/loaderUtils/rewriteImports.d.ts +36 -0
- package/esm/pipeline/loaderUtils/rewriteImports.js +139 -8
- package/esm/pipeline/syncPageIndex/createMarkdownNodes.d.ts +76 -0
- package/esm/pipeline/syncPageIndex/createMarkdownNodes.js +305 -0
- package/esm/pipeline/syncPageIndex/index.d.ts +1 -0
- package/esm/pipeline/syncPageIndex/index.js +1 -0
- package/esm/pipeline/syncPageIndex/mergeMetadataMarkdown.d.ts +58 -0
- package/esm/pipeline/syncPageIndex/mergeMetadataMarkdown.js +214 -0
- package/esm/pipeline/syncPageIndex/metadataToMarkdown.d.ts +67 -0
- package/esm/pipeline/syncPageIndex/metadataToMarkdown.js +1486 -0
- package/esm/pipeline/syncPageIndex/syncPageIndex.d.ts +108 -0
- package/esm/pipeline/syncPageIndex/syncPageIndex.js +540 -0
- package/esm/pipeline/transformHtmlCodePrecomputed/transformHtmlCodePrecomputed.d.ts +2 -2
- package/esm/pipeline/transformHtmlCodePrecomputed/transformHtmlCodePrecomputed.js +5 -5
- package/esm/pipeline/transformMarkdownBlockquoteCallouts/index.d.ts +2 -0
- package/esm/pipeline/transformMarkdownBlockquoteCallouts/index.js +4 -0
- package/esm/pipeline/transformMarkdownBlockquoteCallouts/transformMarkdownBlockquoteCallouts.d.ts +16 -0
- package/esm/pipeline/transformMarkdownBlockquoteCallouts/transformMarkdownBlockquoteCallouts.js +58 -0
- package/esm/pipeline/transformMarkdownDemoLinks/index.d.ts +2 -0
- package/esm/pipeline/transformMarkdownDemoLinks/index.js +4 -0
- package/esm/pipeline/transformMarkdownDemoLinks/transformMarkdownDemoLinks.d.ts +26 -0
- package/esm/pipeline/transformMarkdownDemoLinks/transformMarkdownDemoLinks.js +107 -0
- package/esm/pipeline/transformMarkdownMetadata/index.d.ts +2 -0
- package/esm/pipeline/transformMarkdownMetadata/index.js +4 -0
- package/esm/pipeline/transformMarkdownMetadata/transformMarkdownMetadata.d.ts +3 -0
- package/esm/pipeline/transformMarkdownMetadata/transformMarkdownMetadata.js +1010 -0
- package/esm/pipeline/transformMarkdownMetadata/types.d.ts +110 -0
- package/esm/pipeline/transformMarkdownMetadata/types.js +1 -0
- package/esm/pipeline/transformMarkdownRelativePaths/index.d.ts +2 -0
- package/esm/pipeline/transformMarkdownRelativePaths/index.js +4 -0
- package/esm/pipeline/transformMarkdownRelativePaths/transformMarkdownRelativePaths.d.ts +15 -0
- package/esm/pipeline/transformMarkdownRelativePaths/transformMarkdownRelativePaths.js +43 -0
- package/esm/useCode/Pre.js +15 -2
- package/esm/useCode/useCode.d.ts +15 -2
- package/esm/useCode/useCode.js +15 -6
- package/esm/useCode/useCodeUtils.js +3 -3
- package/esm/useCode/useFileNavigation.d.ts +9 -3
- package/esm/useCode/useFileNavigation.js +124 -81
- package/esm/useCode/useUIState.d.ts +4 -1
- package/esm/useCode/useUIState.js +17 -2
- package/esm/useCode/useVariantSelection.d.ts +8 -3
- package/esm/useCode/useVariantSelection.js +144 -52
- package/esm/useCopier/index.js +5 -4
- package/esm/useDemo/createCodeSandbox.d.ts +1 -1
- package/esm/useDemo/createStackBlitz.d.ts +1 -1
- package/esm/useDemo/exportVariant.js +13 -11
- package/esm/useDemo/index.d.ts +1 -1
- package/esm/useDemo/index.js +1 -1
- package/esm/useDemo/useDemo.d.ts +5 -5
- package/esm/useDemo/useDemo.js +6 -6
- package/esm/useErrors/useErrors.d.ts +1 -1
- package/esm/useErrors/useErrors.js +6 -2
- package/esm/useSearch/index.d.ts +1 -0
- package/esm/useSearch/index.js +1 -0
- package/esm/useSearch/types.d.ts +165 -0
- package/esm/useSearch/types.js +1 -0
- package/esm/useSearch/useSearch.d.ts +56 -0
- package/esm/useSearch/useSearch.js +647 -0
- package/esm/withDocsInfra/withDeploymentConfig.js +4 -2
- package/esm/withDocsInfra/withDocsInfra.d.ts +39 -0
- package/esm/withDocsInfra/withDocsInfra.js +94 -14
- package/package.json +105 -5
- package/esm/CodeHighlighter/transformParsedSource.d.ts +0 -3
- /package/esm/{CodeHighlighter/addPathsToVariant.js → pipeline/loadCodeVariant/addCodeVariantPaths.js} +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/calculateMainFilePath.d.ts +0 -0
- /package/esm/{CodeHighlighter/hasAllVariants.js → pipeline/loadCodeVariant/hasAllCodeVariants.js} +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/parseCode.js +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/pathUtils.d.ts +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/pathUtils.js +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/transformSource.js +0 -0
|
@@ -4,6 +4,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
4
4
|
import { rewriteImports } from "./rewriteImports.js";
|
|
5
5
|
import { isJavaScriptModule } from "./resolveModulePath.js";
|
|
6
6
|
import { getFileNameFromUrl } from "./getFileNameFromUrl.js";
|
|
7
|
+
import { fileUrlToPortablePath, portablePathToFileUrl } from "./fileUrlToPortablePath.js";
|
|
7
8
|
/**
|
|
8
9
|
* Processes flat mode with intelligent conflict resolution
|
|
9
10
|
*/
|
|
@@ -16,9 +17,11 @@ function processFlatMode(importResult, resolvedPathsMap) {
|
|
|
16
17
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
17
18
|
relativePath = _ref2[0],
|
|
18
19
|
importInfo = _ref2[1];
|
|
19
|
-
var
|
|
20
|
-
if (
|
|
21
|
-
|
|
20
|
+
var resolvedUrl = resolvedPathsMap.get(importInfo.url);
|
|
21
|
+
if (resolvedUrl) {
|
|
22
|
+
// Convert file URL to portable path for path manipulation
|
|
23
|
+
var resolvedPath = resolvedUrl.startsWith('file://') ? fileUrlToPortablePath(resolvedUrl) : resolvedUrl;
|
|
24
|
+
var fileExtension = getFileNameFromUrl(resolvedUrl).extension;
|
|
22
25
|
var pathSegments = resolvedPath.split('/').filter(Boolean);
|
|
23
26
|
fileMapping.push({
|
|
24
27
|
resolvedPath: resolvedPath,
|
|
@@ -36,8 +39,13 @@ function processFlatMode(importResult, resolvedPathsMap) {
|
|
|
36
39
|
var file = _fileMapping[_i];
|
|
37
40
|
var fileName = file.segments[file.segments.length - 1];
|
|
38
41
|
var isIndexFile = fileName.startsWith('index.');
|
|
42
|
+
var isUnderscoreIndexFile = fileName.startsWith('_index.');
|
|
39
43
|
var candidateName = void 0;
|
|
40
|
-
if (
|
|
44
|
+
if (isUnderscoreIndexFile) {
|
|
45
|
+
// Files starting with "_index." should be treated as direct index imports
|
|
46
|
+
// e.g., "../../dir/_index.module.css" -> "index.module.css"
|
|
47
|
+
candidateName = "index".concat(file.extension);
|
|
48
|
+
} else if (isIndexFile) {
|
|
41
49
|
// Check if the original import was a direct index file (e.g., "./index.ext")
|
|
42
50
|
var originalImportParts = file.originalImportPath.split('/');
|
|
43
51
|
var isDirectIndexImport = originalImportParts.length === 2 && originalImportParts[0] === '.' && originalImportParts[1].startsWith('index.');
|
|
@@ -131,9 +139,13 @@ function processFlatMode(importResult, resolvedPathsMap) {
|
|
|
131
139
|
var _file = _step.value;
|
|
132
140
|
var _fileName = _file.segments[_file.segments.length - 1];
|
|
133
141
|
var _isIndexFile = _fileName.startsWith('index.');
|
|
142
|
+
var _isUnderscoreIndexFile = _fileName.startsWith('_index.');
|
|
134
143
|
var distinguishingSegment = _file.segments[_distinguishingIndex];
|
|
135
144
|
var finalName = void 0;
|
|
136
|
-
if (
|
|
145
|
+
if (_isUnderscoreIndexFile) {
|
|
146
|
+
// Files starting with "_index." should always use "index" as the base name
|
|
147
|
+
finalName = "".concat(distinguishingSegment, "/index").concat(_file.extension);
|
|
148
|
+
} else if (_isIndexFile) {
|
|
137
149
|
// Check if this was a direct index import
|
|
138
150
|
var _originalImportParts = _file.originalImportPath.split('/');
|
|
139
151
|
var _isDirectIndexImport = _originalImportParts.length === 2 && _originalImportParts[0] === '.' && _originalImportParts[1].startsWith('index.');
|
|
@@ -202,9 +214,13 @@ function processFlatMode(importResult, resolvedPathsMap) {
|
|
|
202
214
|
var _file2 = _step3.value;
|
|
203
215
|
var _fileName2 = _file2.segments[_file2.segments.length - 1];
|
|
204
216
|
var _isIndexFile2 = _fileName2.startsWith('index.');
|
|
217
|
+
var _isUnderscoreIndexFile2 = _fileName2.startsWith('_index.');
|
|
205
218
|
var _distinguishingSegment = _file2.segments[distinguishingIndex];
|
|
206
219
|
var _finalName = void 0;
|
|
207
|
-
if (
|
|
220
|
+
if (_isUnderscoreIndexFile2) {
|
|
221
|
+
// Files starting with "_index." should always use "index" as the base name
|
|
222
|
+
_finalName = "".concat(_distinguishingSegment, "/index").concat(_file2.extension);
|
|
223
|
+
} else if (_isIndexFile2) {
|
|
208
224
|
// Check if this was a direct index import
|
|
209
225
|
var _originalImportParts2 = _file2.originalImportPath.split('/');
|
|
210
226
|
var _isDirectIndexImport2 = _originalImportParts2.length === 2 && _originalImportParts2[0] === '.' && _originalImportParts2[1].startsWith('index.');
|
|
@@ -229,7 +245,7 @@ function processFlatMode(importResult, resolvedPathsMap) {
|
|
|
229
245
|
|
|
230
246
|
// Fourth pass: build the extraFiles mapping
|
|
231
247
|
finalNames.forEach(function (finalName, resolvedPath) {
|
|
232
|
-
extraFiles["./".concat(finalName)] =
|
|
248
|
+
extraFiles["./".concat(finalName)] = portablePathToFileUrl(resolvedPath);
|
|
233
249
|
});
|
|
234
250
|
return {
|
|
235
251
|
processedSource: '',
|
|
@@ -253,8 +269,8 @@ function processBasicImports(source, importResult, storeAt) {
|
|
|
253
269
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
254
270
|
_relativePath = _ref4[0],
|
|
255
271
|
importInfo = _ref4[1];
|
|
256
|
-
var resolvedPath = importInfo.
|
|
257
|
-
var fileUrl =
|
|
272
|
+
var resolvedPath = importInfo.url; // For CSS, this is already resolved by parseImports
|
|
273
|
+
var fileUrl = portablePathToFileUrl(resolvedPath);
|
|
258
274
|
var _getFileNameFromUrl = getFileNameFromUrl(fileUrl),
|
|
259
275
|
fileName = _getFileNameFromUrl.fileName,
|
|
260
276
|
extension = _getFileNameFromUrl.extension;
|
|
@@ -277,7 +293,7 @@ function processBasicImports(source, importResult, storeAt) {
|
|
|
277
293
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
278
294
|
relativePath = _ref6[0],
|
|
279
295
|
importInfo = _ref6[1];
|
|
280
|
-
var resolvedPath = importInfo.
|
|
296
|
+
var resolvedPath = importInfo.url;
|
|
281
297
|
var finalName = finalNames.get(resolvedPath);
|
|
282
298
|
if (finalName) {
|
|
283
299
|
importPathMapping.set(relativePath, finalName);
|
|
@@ -286,8 +302,7 @@ function processBasicImports(source, importResult, storeAt) {
|
|
|
286
302
|
|
|
287
303
|
// Create extraFiles entries
|
|
288
304
|
finalNames.forEach(function (finalName, resolvedPath) {
|
|
289
|
-
|
|
290
|
-
extraFiles["./".concat(finalName)] = fileUrl;
|
|
305
|
+
extraFiles["./".concat(finalName)] = portablePathToFileUrl(resolvedPath);
|
|
291
306
|
});
|
|
292
307
|
|
|
293
308
|
// Apply import path replacements using position-based rewriting
|
|
@@ -316,9 +331,8 @@ function processBasicImports(source, importResult, storeAt) {
|
|
|
316
331
|
var _ref8 = _slicedToArray(_ref7, 2),
|
|
317
332
|
relativePath = _ref8[0],
|
|
318
333
|
importInfo = _ref8[1];
|
|
319
|
-
var resolvedPath = importInfo.
|
|
320
|
-
|
|
321
|
-
extraFiles[relativePath] = fileUrl; // Always use original path for extraFiles
|
|
334
|
+
var resolvedPath = importInfo.url;
|
|
335
|
+
extraFiles[relativePath] = portablePathToFileUrl(resolvedPath); // Always use original path for extraFiles
|
|
322
336
|
});
|
|
323
337
|
|
|
324
338
|
// Apply import path replacements using position-based rewriting
|
|
@@ -338,9 +352,8 @@ function processBasicImports(source, importResult, storeAt) {
|
|
|
338
352
|
var _ref0 = _slicedToArray(_ref9, 2),
|
|
339
353
|
relativePath = _ref0[0],
|
|
340
354
|
importInfo = _ref0[1];
|
|
341
|
-
var resolvedPath = importInfo.
|
|
342
|
-
|
|
343
|
-
extraFiles[relativePath] = fileUrl; // Use original import path
|
|
355
|
+
var resolvedPath = importInfo.url;
|
|
356
|
+
extraFiles[relativePath] = portablePathToFileUrl(resolvedPath); // Use original import path
|
|
344
357
|
});
|
|
345
358
|
return {
|
|
346
359
|
processedSource: source,
|
|
@@ -363,7 +376,8 @@ function processJsImports(source, importResult, storeAt, resolvedPathsMap) {
|
|
|
363
376
|
var _ref10 = _slicedToArray(_ref1, 2),
|
|
364
377
|
extraFileKey = _ref10[0],
|
|
365
378
|
fileUrl = _ref10[1];
|
|
366
|
-
|
|
379
|
+
// Convert file URL to portable path for lookup
|
|
380
|
+
var resolvedPath = fileUrl.startsWith('file://') ? fileUrlToPortablePath(fileUrl) : fileUrl;
|
|
367
381
|
resolvedToExtraFile.set(resolvedPath, extraFileKey);
|
|
368
382
|
});
|
|
369
383
|
|
|
@@ -373,8 +387,10 @@ function processJsImports(source, importResult, storeAt, resolvedPathsMap) {
|
|
|
373
387
|
var _ref12 = _slicedToArray(_ref11, 2),
|
|
374
388
|
relativePath = _ref12[0],
|
|
375
389
|
importInfo = _ref12[1];
|
|
376
|
-
var
|
|
377
|
-
if (
|
|
390
|
+
var resolvedUrl = resolvedPathsMap.get(importInfo.url);
|
|
391
|
+
if (resolvedUrl) {
|
|
392
|
+
// Convert file URL to portable path for lookup
|
|
393
|
+
var resolvedPath = resolvedUrl.startsWith('file://') ? fileUrlToPortablePath(resolvedUrl) : resolvedUrl;
|
|
378
394
|
var extraFileKey = resolvedToExtraFile.get(resolvedPath);
|
|
379
395
|
if (extraFileKey) {
|
|
380
396
|
// For JavaScript modules, remove the extension; for other files (CSS, JSON, etc.), keep it
|
|
@@ -408,12 +424,14 @@ function processJsImports(source, importResult, storeAt, resolvedPathsMap) {
|
|
|
408
424
|
var _ref14 = _slicedToArray(_ref13, 2),
|
|
409
425
|
relativePath = _ref14[0],
|
|
410
426
|
importInfo = _ref14[1];
|
|
411
|
-
var
|
|
412
|
-
if (!
|
|
427
|
+
var resolvedUrl = resolvedPathsMap.get(importInfo.url);
|
|
428
|
+
if (!resolvedUrl) {
|
|
413
429
|
return;
|
|
414
430
|
}
|
|
415
|
-
|
|
416
|
-
|
|
431
|
+
|
|
432
|
+
// Convert file URL to portable path for path manipulation
|
|
433
|
+
var resolvedPath = resolvedUrl.startsWith('file://') ? fileUrlToPortablePath(resolvedUrl) : resolvedUrl;
|
|
434
|
+
var fileExtension = getFileNameFromUrl(resolvedUrl).extension;
|
|
417
435
|
var isJavascriptModule = isJavaScriptModule(relativePath);
|
|
418
436
|
var keyPath;
|
|
419
437
|
if (!isJavascriptModule) {
|
|
@@ -434,8 +452,7 @@ function processJsImports(source, importResult, storeAt, resolvedPathsMap) {
|
|
|
434
452
|
keyPath = "".concat(relativePath).concat(fileExtension);
|
|
435
453
|
}
|
|
436
454
|
}
|
|
437
|
-
|
|
438
|
-
extraFiles[keyPath] = fileUrl;
|
|
455
|
+
extraFiles[keyPath] = portablePathToFileUrl(resolvedPath);
|
|
439
456
|
});
|
|
440
457
|
return {
|
|
441
458
|
processedSource: source,
|
|
@@ -37,18 +37,18 @@ export interface TypeAwareResolveResult {
|
|
|
37
37
|
* Resolves a module path by reading directory contents to find matching files.
|
|
38
38
|
* This is more efficient than checking each file individually with stat calls.
|
|
39
39
|
*
|
|
40
|
-
* Given a path like
|
|
40
|
+
* Given a path like `file:///Code/mui-public/packages/docs-infra/docs/app/components/code-highlighter/demos/code/BasicCode`,
|
|
41
41
|
* this function will try to find the actual file by checking for:
|
|
42
42
|
* - `BasicCode.ts`, `BasicCode.tsx`, `BasicCode.js`, `BasicCode.jsx`
|
|
43
43
|
* - `BasicCode/index.ts`, `BasicCode/index.tsx`, `BasicCode/index.js`, `BasicCode/index.jsx`
|
|
44
44
|
*
|
|
45
|
-
* @param
|
|
45
|
+
* @param moduleUrl - The module URL to resolve (file:// URL or portable path, without file extension)
|
|
46
46
|
* @param readDirectory - Function to read directory contents
|
|
47
47
|
* @param options - Configuration options
|
|
48
48
|
* @param includeTypeDefs - If true, returns both import and typeImport paths with different extension priorities
|
|
49
|
-
* @returns Promise<string | TypeAwareResolveResult> - The resolved file
|
|
49
|
+
* @returns Promise<string | TypeAwareResolveResult> - The resolved file:// URL(s)
|
|
50
50
|
*/
|
|
51
|
-
export declare function resolveModulePath(
|
|
51
|
+
export declare function resolveModulePath(moduleUrl: string, readDirectory: DirectoryReader, options?: ResolveModulePathOptions, includeTypeDefs?: boolean): Promise<string | TypeAwareResolveResult>;
|
|
52
52
|
/**
|
|
53
53
|
* Resolves multiple module paths efficiently by grouping them by directory
|
|
54
54
|
* and performing batch directory lookups.
|
|
@@ -70,7 +70,7 @@ export declare function resolveModulePaths(modulePaths: string[], readDirectory:
|
|
|
70
70
|
* @returns Promise<Map<string, string>> - Map from import path to resolved file path
|
|
71
71
|
*/
|
|
72
72
|
export declare function resolveImportResult(importResult: Record<string, {
|
|
73
|
-
|
|
73
|
+
url: string;
|
|
74
74
|
names: string[];
|
|
75
75
|
includeTypeDefs?: true;
|
|
76
76
|
positions?: Array<{
|
|
@@ -5,6 +5,7 @@ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIt
|
|
|
5
5
|
import _regenerator from "@babel/runtime/helpers/esm/regenerator";
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
7
|
import { getFileNameFromUrl } from "./getFileNameFromUrl.js";
|
|
8
|
+
import { fileUrlToPortablePath, portablePathToFileUrl } from "./fileUrlToPortablePath.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Isomorphic path joining function that works in both Node.js and browser environments.
|
|
@@ -65,16 +66,16 @@ export function isJavaScriptModule(path) {
|
|
|
65
66
|
* Resolves a module path by reading directory contents to find matching files.
|
|
66
67
|
* This is more efficient than checking each file individually with stat calls.
|
|
67
68
|
*
|
|
68
|
-
* Given a path like
|
|
69
|
+
* Given a path like `file:///Code/mui-public/packages/docs-infra/docs/app/components/code-highlighter/demos/code/BasicCode`,
|
|
69
70
|
* this function will try to find the actual file by checking for:
|
|
70
71
|
* - `BasicCode.ts`, `BasicCode.tsx`, `BasicCode.js`, `BasicCode.jsx`
|
|
71
72
|
* - `BasicCode/index.ts`, `BasicCode/index.tsx`, `BasicCode/index.js`, `BasicCode/index.jsx`
|
|
72
73
|
*
|
|
73
|
-
* @param
|
|
74
|
+
* @param moduleUrl - The module URL to resolve (file:// URL or portable path, without file extension)
|
|
74
75
|
* @param readDirectory - Function to read directory contents
|
|
75
76
|
* @param options - Configuration options
|
|
76
77
|
* @param includeTypeDefs - If true, returns both import and typeImport paths with different extension priorities
|
|
77
|
-
* @returns Promise<string | TypeAwareResolveResult> - The resolved file
|
|
78
|
+
* @returns Promise<string | TypeAwareResolveResult> - The resolved file:// URL(s)
|
|
78
79
|
*/
|
|
79
80
|
export function resolveModulePath(_x, _x2) {
|
|
80
81
|
return _resolveModulePath.apply(this, arguments);
|
|
@@ -85,11 +86,12 @@ export function resolveModulePath(_x, _x2) {
|
|
|
85
86
|
* This function is optimized to do only a single directory read instead of two separate reads.
|
|
86
87
|
*/
|
|
87
88
|
function _resolveModulePath() {
|
|
88
|
-
_resolveModulePath = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(
|
|
89
|
+
_resolveModulePath = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(moduleUrl, readDirectory) {
|
|
89
90
|
var options,
|
|
90
91
|
includeTypeDefs,
|
|
91
92
|
_options$extensions,
|
|
92
93
|
extensions,
|
|
94
|
+
modulePath,
|
|
93
95
|
lastSlashIndex,
|
|
94
96
|
parentDir,
|
|
95
97
|
moduleName,
|
|
@@ -100,7 +102,8 @@ function _resolveModulePath() {
|
|
|
100
102
|
case 0:
|
|
101
103
|
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
|
102
104
|
includeTypeDefs = _args.length > 3 ? _args[3] : undefined;
|
|
103
|
-
_options$extensions = options.extensions, extensions = _options$extensions === void 0 ? JAVASCRIPT_MODULE_EXTENSIONS : _options$extensions; //
|
|
105
|
+
_options$extensions = options.extensions, extensions = _options$extensions === void 0 ? JAVASCRIPT_MODULE_EXTENSIONS : _options$extensions; // Convert file URL to portable path for internal processing
|
|
106
|
+
modulePath = moduleUrl.startsWith('file://') ? fileUrlToPortablePath(moduleUrl) : moduleUrl; // If includeTypeDefs is true, we need to resolve with both type and value extension priorities
|
|
104
107
|
if (!includeTypeDefs) {
|
|
105
108
|
_context.n = 1;
|
|
106
109
|
break;
|
|
@@ -205,7 +208,7 @@ function _resolveWithTypeAwareness() {
|
|
|
205
208
|
parentDir = modulePath.substring(0, lastSlashIndex);
|
|
206
209
|
moduleName = modulePath.substring(lastSlashIndex + 1); // Single filesystem read to get directory contents
|
|
207
210
|
_context2.n = 1;
|
|
208
|
-
return readDirectory(parentDir);
|
|
211
|
+
return readDirectory(portablePathToFileUrl(parentDir));
|
|
209
212
|
case 1:
|
|
210
213
|
dirContents = _context2.v;
|
|
211
214
|
// Build a map of available files by basename
|
|
@@ -271,7 +274,7 @@ function _resolveWithTypeAwareness() {
|
|
|
271
274
|
_context2.n = 6;
|
|
272
275
|
break;
|
|
273
276
|
}
|
|
274
|
-
importPath = joinPath(parentDir, entry.name);
|
|
277
|
+
importPath = portablePathToFileUrl(joinPath(parentDir, entry.name));
|
|
275
278
|
return _context2.a(3, 7);
|
|
276
279
|
case 6:
|
|
277
280
|
_context2.n = 5;
|
|
@@ -332,7 +335,7 @@ function _resolveWithTypeAwareness() {
|
|
|
332
335
|
_context2.n = 20;
|
|
333
336
|
break;
|
|
334
337
|
}
|
|
335
|
-
typeImportPath = joinPath(parentDir, _entry.name);
|
|
338
|
+
typeImportPath = portablePathToFileUrl(joinPath(parentDir, _entry.name));
|
|
336
339
|
return _context2.a(3, 21);
|
|
337
340
|
case 20:
|
|
338
341
|
_context2.n = 19;
|
|
@@ -405,7 +408,7 @@ function _resolveWithTypeAwareness() {
|
|
|
405
408
|
moduleDir = joinPath(parentDir, directoryMatches[0].name);
|
|
406
409
|
_context2.p = 33;
|
|
407
410
|
_context2.n = 34;
|
|
408
|
-
return readDirectory(moduleDir);
|
|
411
|
+
return readDirectory(portablePathToFileUrl(moduleDir));
|
|
409
412
|
case 34:
|
|
410
413
|
moduleDirContents = _context2.v;
|
|
411
414
|
// Build a map of available index files by basename
|
|
@@ -471,7 +474,7 @@ function _resolveWithTypeAwareness() {
|
|
|
471
474
|
_context2.n = 39;
|
|
472
475
|
break;
|
|
473
476
|
}
|
|
474
|
-
_importPath = joinPath(moduleDir, _entry2.name);
|
|
477
|
+
_importPath = portablePathToFileUrl(joinPath(moduleDir, _entry2.name));
|
|
475
478
|
return _context2.a(3, 40);
|
|
476
479
|
case 39:
|
|
477
480
|
_context2.n = 38;
|
|
@@ -532,7 +535,7 @@ function _resolveWithTypeAwareness() {
|
|
|
532
535
|
_context2.n = 53;
|
|
533
536
|
break;
|
|
534
537
|
}
|
|
535
|
-
_typeImportPath = joinPath(moduleDir, _entry3.name);
|
|
538
|
+
_typeImportPath = portablePathToFileUrl(joinPath(moduleDir, _entry3.name));
|
|
536
539
|
return _context2.a(3, 54);
|
|
537
540
|
case 53:
|
|
538
541
|
_context2.n = 52;
|
|
@@ -628,7 +631,7 @@ function _resolveSinglePath() {
|
|
|
628
631
|
case 0:
|
|
629
632
|
_context3.p = 0;
|
|
630
633
|
_context3.n = 1;
|
|
631
|
-
return readDirectory(parentDir);
|
|
634
|
+
return readDirectory(portablePathToFileUrl(parentDir));
|
|
632
635
|
case 1:
|
|
633
636
|
dirContents = _context3.v;
|
|
634
637
|
// Look for direct file matches in extension priority order
|
|
@@ -696,7 +699,7 @@ function _resolveSinglePath() {
|
|
|
696
699
|
break;
|
|
697
700
|
}
|
|
698
701
|
resolvedPath = joinPath(parentDir, entry.name);
|
|
699
|
-
return _context3.a(2, resolvedPath);
|
|
702
|
+
return _context3.a(2, portablePathToFileUrl(resolvedPath));
|
|
700
703
|
case 6:
|
|
701
704
|
_context3.n = 5;
|
|
702
705
|
break;
|
|
@@ -737,7 +740,7 @@ function _resolveSinglePath() {
|
|
|
737
740
|
moduleDir = joinPath(parentDir, directoryMatches[0].name);
|
|
738
741
|
_context3.p = 15;
|
|
739
742
|
_context3.n = 16;
|
|
740
|
-
return readDirectory(moduleDir);
|
|
743
|
+
return readDirectory(portablePathToFileUrl(moduleDir));
|
|
741
744
|
case 16:
|
|
742
745
|
moduleDirContents = _context3.v;
|
|
743
746
|
// Look for index files in extension priority order
|
|
@@ -803,7 +806,7 @@ function _resolveSinglePath() {
|
|
|
803
806
|
_context3.n = 21;
|
|
804
807
|
break;
|
|
805
808
|
}
|
|
806
|
-
return _context3.a(2, joinPath(moduleDir, _entry5.name));
|
|
809
|
+
return _context3.a(2, portablePathToFileUrl(joinPath(moduleDir, _entry5.name)));
|
|
807
810
|
case 21:
|
|
808
811
|
_context3.n = 20;
|
|
809
812
|
break;
|
|
@@ -931,7 +934,7 @@ function _resolveModulePaths() {
|
|
|
931
934
|
_ref3 = _slicedToArray(_ref, 2), parentDir = _ref3[0], pathGroup = _ref3[1];
|
|
932
935
|
_context5.p = 1;
|
|
933
936
|
_context5.n = 2;
|
|
934
|
-
return readDirectory(parentDir);
|
|
937
|
+
return readDirectory(portablePathToFileUrl(parentDir));
|
|
935
938
|
case 2:
|
|
936
939
|
dirContents = _context5.v;
|
|
937
940
|
unresolved = [];
|
|
@@ -999,7 +1002,7 @@ function _resolveModulePaths() {
|
|
|
999
1002
|
}
|
|
1000
1003
|
resolved.push({
|
|
1001
1004
|
fullPath: _fullPath,
|
|
1002
|
-
resolvedPath: joinPath(parentDir, _entry7.name)
|
|
1005
|
+
resolvedPath: portablePathToFileUrl(joinPath(parentDir, _entry7.name))
|
|
1003
1006
|
});
|
|
1004
1007
|
foundMatch = true;
|
|
1005
1008
|
return _context5.a(3, 10);
|
|
@@ -1083,7 +1086,7 @@ function _resolveModulePaths() {
|
|
|
1083
1086
|
moduleDir = joinPath(parentDir, moduleName);
|
|
1084
1087
|
_context4.p = 1;
|
|
1085
1088
|
_context4.n = 2;
|
|
1086
|
-
return readDirectory(moduleDir);
|
|
1089
|
+
return readDirectory(portablePathToFileUrl(moduleDir));
|
|
1087
1090
|
case 2:
|
|
1088
1091
|
moduleDirContents = _context4.v;
|
|
1089
1092
|
// Look for index files in extension priority order
|
|
@@ -1140,7 +1143,7 @@ function _resolveModulePaths() {
|
|
|
1140
1143
|
}
|
|
1141
1144
|
return _context4.a(2, {
|
|
1142
1145
|
fullPath: fullPath,
|
|
1143
|
-
resolvedPath: joinPath(moduleDir, entry.name)
|
|
1146
|
+
resolvedPath: portablePathToFileUrl(joinPath(moduleDir, entry.name))
|
|
1144
1147
|
});
|
|
1145
1148
|
case 7:
|
|
1146
1149
|
_context4.n = 6;
|
|
@@ -1285,26 +1288,26 @@ function _resolveImportResult() {
|
|
|
1285
1288
|
jsModulesWithExtensions = [];
|
|
1286
1289
|
staticAssets = [];
|
|
1287
1290
|
_loop = /*#__PURE__*/_regenerator().m(function _loop() {
|
|
1288
|
-
var _Object$entries$_i, importPath, _Object$entries$_i$,
|
|
1291
|
+
var _Object$entries$_i, importPath, _Object$entries$_i$, url, includeTypeDefs;
|
|
1289
1292
|
return _regenerator().w(function (_context7) {
|
|
1290
1293
|
while (1) switch (_context7.n) {
|
|
1291
1294
|
case 0:
|
|
1292
|
-
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), importPath = _Object$entries$_i[0], _Object$entries$_i$ = _Object$entries$_i[1],
|
|
1295
|
+
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), importPath = _Object$entries$_i[0], _Object$entries$_i$ = _Object$entries$_i[1], url = _Object$entries$_i$.url, includeTypeDefs = _Object$entries$_i$.includeTypeDefs;
|
|
1293
1296
|
if (isJavaScriptModule(importPath)) {
|
|
1294
1297
|
// If the import path already has a JS/TS extension, use it as-is
|
|
1295
1298
|
if (JAVASCRIPT_MODULE_EXTENSIONS.some(function (ext) {
|
|
1296
1299
|
return importPath.endsWith(ext);
|
|
1297
1300
|
})) {
|
|
1298
|
-
jsModulesWithExtensions.push(
|
|
1301
|
+
jsModulesWithExtensions.push(url);
|
|
1299
1302
|
} else {
|
|
1300
1303
|
jsModulesToResolve.push({
|
|
1301
|
-
|
|
1304
|
+
url: url,
|
|
1302
1305
|
includeTypeDefs: includeTypeDefs
|
|
1303
1306
|
});
|
|
1304
1307
|
}
|
|
1305
1308
|
} else {
|
|
1306
|
-
// Static asset - use
|
|
1307
|
-
staticAssets.push(
|
|
1309
|
+
// Static asset - use url as-is
|
|
1310
|
+
staticAssets.push(url);
|
|
1308
1311
|
}
|
|
1309
1312
|
case 1:
|
|
1310
1313
|
return _context7.a(2);
|
|
@@ -1324,13 +1327,13 @@ function _resolveImportResult() {
|
|
|
1324
1327
|
break;
|
|
1325
1328
|
case 3:
|
|
1326
1329
|
// Add modules with extensions as-is
|
|
1327
|
-
jsModulesWithExtensions.forEach(function (
|
|
1328
|
-
resolvedPathsMap.set(
|
|
1330
|
+
jsModulesWithExtensions.forEach(function (url) {
|
|
1331
|
+
resolvedPathsMap.set(url, url);
|
|
1329
1332
|
});
|
|
1330
1333
|
|
|
1331
1334
|
// Add static assets as-is
|
|
1332
|
-
staticAssets.forEach(function (
|
|
1333
|
-
resolvedPathsMap.set(
|
|
1335
|
+
staticAssets.forEach(function (url) {
|
|
1336
|
+
resolvedPathsMap.set(url, url);
|
|
1334
1337
|
});
|
|
1335
1338
|
|
|
1336
1339
|
// Resolve JS modules without extensions
|
|
@@ -1340,14 +1343,14 @@ function _resolveImportResult() {
|
|
|
1340
1343
|
}
|
|
1341
1344
|
resolutionPromises = jsModulesToResolve.map(/*#__PURE__*/function () {
|
|
1342
1345
|
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(_ref6) {
|
|
1343
|
-
var
|
|
1346
|
+
var url, includeTypeDefs, resolved, _t21;
|
|
1344
1347
|
return _regenerator().w(function (_context8) {
|
|
1345
1348
|
while (1) switch (_context8.p = _context8.n) {
|
|
1346
1349
|
case 0:
|
|
1347
|
-
|
|
1350
|
+
url = _ref6.url, includeTypeDefs = _ref6.includeTypeDefs;
|
|
1348
1351
|
_context8.p = 1;
|
|
1349
1352
|
_context8.n = 2;
|
|
1350
|
-
return resolveModulePath(
|
|
1353
|
+
return resolveModulePath(url, readDirectory, options, includeTypeDefs);
|
|
1351
1354
|
case 2:
|
|
1352
1355
|
resolved = _context8.v;
|
|
1353
1356
|
if (!(typeof resolved === 'string')) {
|
|
@@ -1355,12 +1358,12 @@ function _resolveImportResult() {
|
|
|
1355
1358
|
break;
|
|
1356
1359
|
}
|
|
1357
1360
|
return _context8.a(2, {
|
|
1358
|
-
|
|
1361
|
+
url: url,
|
|
1359
1362
|
resolved: resolved
|
|
1360
1363
|
});
|
|
1361
1364
|
case 3:
|
|
1362
1365
|
return _context8.a(2, {
|
|
1363
|
-
|
|
1366
|
+
url: url,
|
|
1364
1367
|
resolved: resolved["import"]
|
|
1365
1368
|
});
|
|
1366
1369
|
case 4:
|
|
@@ -1381,7 +1384,7 @@ function _resolveImportResult() {
|
|
|
1381
1384
|
// Add successful resolutions to the map
|
|
1382
1385
|
resolutionResults.forEach(function (result) {
|
|
1383
1386
|
if (result) {
|
|
1384
|
-
resolvedPathsMap.set(result.
|
|
1387
|
+
resolvedPathsMap.set(result.url, result.resolved);
|
|
1385
1388
|
}
|
|
1386
1389
|
});
|
|
1387
1390
|
case 5:
|
|
@@ -1423,8 +1426,8 @@ function _resolveVariantPaths() {
|
|
|
1423
1426
|
_Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), variantName = _Object$entries2$_i[0], variantPath = _Object$entries2$_i[1];
|
|
1424
1427
|
resolvedVariantPath = resolvedVariantPaths.get(variantPath);
|
|
1425
1428
|
if (resolvedVariantPath) {
|
|
1426
|
-
// Store as a file URL
|
|
1427
|
-
variantMap.set(variantName,
|
|
1429
|
+
// Store as a file URL (portablePathToFileUrl handles portable paths correctly)
|
|
1430
|
+
variantMap.set(variantName, portablePathToFileUrl(resolvedVariantPath));
|
|
1428
1431
|
}
|
|
1429
1432
|
}
|
|
1430
1433
|
return _context0.a(2, variantMap);
|
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts import statements to const declarations set to null.
|
|
3
|
+
* This preserves variable names while removing the actual imports.
|
|
4
|
+
* Useful when precomputing data that makes the imports unnecessary.
|
|
5
|
+
*
|
|
6
|
+
* @param source - The source code to process
|
|
7
|
+
* @param importPathsToRewrite - Set of import paths whose import statements should be rewritten
|
|
8
|
+
* @param importResult - Import result with position and name data
|
|
9
|
+
* @returns The source code with import statements rewritten to const declarations
|
|
10
|
+
*/
|
|
11
|
+
export declare function rewriteImportsToNull(source: string, importPathsToRewrite: Set<string>, importResult: Record<string, {
|
|
12
|
+
positions: Array<{
|
|
13
|
+
start: number;
|
|
14
|
+
end: number;
|
|
15
|
+
}>;
|
|
16
|
+
names: Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
alias?: string;
|
|
19
|
+
type: string;
|
|
20
|
+
}>;
|
|
21
|
+
}>): string;
|
|
22
|
+
/**
|
|
23
|
+
* Removes entire import statements for the specified import paths.
|
|
24
|
+
* This removes the full import line, not just the path.
|
|
25
|
+
*
|
|
26
|
+
* @param source - The source code to process
|
|
27
|
+
* @param importPathsToRemove - Set of import paths whose entire import statements should be removed
|
|
28
|
+
* @param importResult - Import result with position data
|
|
29
|
+
* @returns The source code with import statements removed
|
|
30
|
+
*/
|
|
31
|
+
export declare function removeImports(source: string, importPathsToRemove: Set<string>, importResult: Record<string, {
|
|
32
|
+
positions: Array<{
|
|
33
|
+
start: number;
|
|
34
|
+
end: number;
|
|
35
|
+
}>;
|
|
36
|
+
}>): string;
|
|
1
37
|
/**
|
|
2
38
|
* Efficiently rewrites import paths using position data.
|
|
3
39
|
* This avoids regex parsing and uses precise position information for replacement.
|