@mui/internal-docs-infra 0.1.1-alpha.9 → 0.1.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 +1 -3
- package/esm/package.json +1 -0
- package/esm/useCopier/index.d.ts +15 -0
- package/esm/useCopier/index.d.ts.map +1 -0
- package/esm/useCopier/index.js +62 -0
- package/esm/useDemo/index.d.ts +51 -0
- package/esm/useDemo/index.d.ts.map +1 -0
- package/esm/useDemo/index.js +104 -0
- package/package.json +31 -32
- package/useCopier/index.d.ts +1 -1
- package/useCopier/index.js +23 -15
- package/useDemo/index.d.ts +51 -6
- package/useDemo/index.js +112 -6
- package/CodeControllerContext/CodeControllerContext.d.ts +0 -22
- package/CodeControllerContext/CodeControllerContext.d.ts.map +0 -1
- package/CodeControllerContext/CodeControllerContext.js +0 -14
- package/CodeControllerContext/index.d.ts +0 -1
- package/CodeControllerContext/index.d.ts.map +0 -1
- package/CodeControllerContext/index.js +0 -1
- package/CodeExternalsContext/CodeExternalsContext.d.ts +0 -8
- package/CodeExternalsContext/CodeExternalsContext.d.ts.map +0 -1
- package/CodeExternalsContext/CodeExternalsContext.js +0 -7
- package/CodeExternalsContext/index.d.ts +0 -1
- package/CodeExternalsContext/index.d.ts.map +0 -1
- package/CodeExternalsContext/index.js +0 -1
- package/CodeHighlighter/CodeHighlighter.d.ts +0 -2
- package/CodeHighlighter/CodeHighlighter.d.ts.map +0 -1
- package/CodeHighlighter/CodeHighlighter.js +0 -470
- package/CodeHighlighter/CodeHighlighterClient.d.ts +0 -2
- package/CodeHighlighter/CodeHighlighterClient.d.ts.map +0 -1
- package/CodeHighlighter/CodeHighlighterClient.js +0 -837
- package/CodeHighlighter/CodeHighlighterContext.d.ts +0 -16
- package/CodeHighlighter/CodeHighlighterContext.d.ts.map +0 -1
- package/CodeHighlighter/CodeHighlighterContext.js +0 -14
- package/CodeHighlighter/CodeHighlighterFallbackContext.d.ts +0 -7
- package/CodeHighlighter/CodeHighlighterFallbackContext.d.ts.map +0 -1
- package/CodeHighlighter/CodeHighlighterFallbackContext.js +0 -13
- package/CodeHighlighter/applyTransform.d.ts +0 -19
- package/CodeHighlighter/applyTransform.d.ts.map +0 -1
- package/CodeHighlighter/applyTransform.js +0 -75
- package/CodeHighlighter/codeToFallbackProps.d.ts +0 -2
- package/CodeHighlighter/codeToFallbackProps.d.ts.map +0 -1
- package/CodeHighlighter/codeToFallbackProps.js +0 -73
- package/CodeHighlighter/errors.d.ts +0 -0
- package/CodeHighlighter/errors.d.ts.map +0 -1
- package/CodeHighlighter/errors.js +0 -1
- package/CodeHighlighter/hasAllVariants.d.ts +0 -2
- package/CodeHighlighter/hasAllVariants.d.ts.map +0 -1
- package/CodeHighlighter/hasAllVariants.js +0 -31
- package/CodeHighlighter/index.d.ts +0 -4
- package/CodeHighlighter/index.d.ts.map +0 -1
- package/CodeHighlighter/index.js +0 -4
- package/CodeHighlighter/loadFallbackCode.d.ts +0 -10
- package/CodeHighlighter/loadFallbackCode.d.ts.map +0 -1
- package/CodeHighlighter/loadFallbackCode.js +0 -632
- package/CodeHighlighter/loadVariant.d.ts +0 -12
- package/CodeHighlighter/loadVariant.d.ts.map +0 -1
- package/CodeHighlighter/loadVariant.js +0 -1083
- package/CodeHighlighter/maybeInitialData.d.ts +0 -10
- package/CodeHighlighter/maybeInitialData.d.ts.map +0 -1
- package/CodeHighlighter/maybeInitialData.js +0 -94
- package/CodeHighlighter/parseCode.d.ts +0 -6
- package/CodeHighlighter/parseCode.d.ts.map +0 -1
- package/CodeHighlighter/parseCode.js +0 -134
- package/CodeHighlighter/parseControlledCode.d.ts +0 -6
- package/CodeHighlighter/parseControlledCode.d.ts.map +0 -1
- package/CodeHighlighter/parseControlledCode.js +0 -87
- package/CodeHighlighter/transformCode.d.ts +0 -21
- package/CodeHighlighter/transformCode.d.ts.map +0 -1
- package/CodeHighlighter/transformCode.js +0 -263
- package/CodeHighlighter/transformParsedSource.d.ts +0 -3
- package/CodeHighlighter/transformParsedSource.d.ts.map +0 -1
- package/CodeHighlighter/transformParsedSource.js +0 -66
- package/CodeHighlighter/transformSource.d.ts +0 -2
- package/CodeHighlighter/transformSource.d.ts.map +0 -1
- package/CodeHighlighter/transformSource.js +0 -107
- package/CodeHighlighter/types.d.ts +0 -160
- package/CodeHighlighter/types.d.ts.map +0 -1
- package/CodeHighlighter/types.js +0 -1
- package/CodeProvider/CodeContext.d.ts +0 -12
- package/CodeProvider/CodeContext.d.ts.map +0 -1
- package/CodeProvider/CodeContext.js +0 -8
- package/CodeProvider/CodeProvider.d.ts +0 -13
- package/CodeProvider/CodeProvider.d.ts.map +0 -1
- package/CodeProvider/CodeProvider.js +0 -65
- package/CodeProvider/index.d.ts +0 -1
- package/CodeProvider/index.d.ts.map +0 -1
- package/CodeProvider/index.js +0 -1
- package/abstractCreateDemo/abstractCreateDemo.d.ts +0 -35
- package/abstractCreateDemo/abstractCreateDemo.d.ts.map +0 -1
- package/abstractCreateDemo/abstractCreateDemo.js +0 -91
- package/abstractCreateDemo/index.d.ts +0 -1
- package/abstractCreateDemo/index.d.ts.map +0 -1
- package/abstractCreateDemo/index.js +0 -1
- package/createDemoData/createDemoData.d.ts +0 -44
- package/createDemoData/createDemoData.d.ts.map +0 -1
- package/createDemoData/createDemoData.js +0 -75
- package/createDemoData/index.d.ts +0 -1
- package/createDemoData/index.d.ts.map +0 -1
- package/createDemoData/index.js +0 -1
- package/createDemoData/types.d.ts +0 -28
- package/createDemoData/types.d.ts.map +0 -1
- package/createDemoData/types.js +0 -1
- package/pipeline/hastUtils/hastUtils.d.ts +0 -11
- package/pipeline/hastUtils/hastUtils.d.ts.map +0 -1
- package/pipeline/hastUtils/hastUtils.js +0 -67
- package/pipeline/hastUtils/index.d.ts +0 -1
- package/pipeline/hastUtils/index.d.ts.map +0 -1
- package/pipeline/hastUtils/index.js +0 -1
- package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.d.ts +0 -54
- package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.d.ts.map +0 -1
- package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.js +0 -465
- package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.d.ts +0 -15
- package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.d.ts.map +0 -1
- package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.js +0 -253
- package/pipeline/loadPrecomputedCodeHighlighter/index.d.ts +0 -2
- package/pipeline/loadPrecomputedCodeHighlighter/index.d.ts.map +0 -1
- package/pipeline/loadPrecomputedCodeHighlighter/index.js +0 -4
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +0 -20
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts.map +0 -1
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +0 -224
- package/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts +0 -31
- package/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts.map +0 -1
- package/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +0 -433
- package/pipeline/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts +0 -19
- package/pipeline/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts.map +0 -1
- package/pipeline/loadPrecomputedCodeHighlighter/parseFunctionParameters.js +0 -168
- package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +0 -25
- package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts.map +0 -1
- package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +0 -73
- package/pipeline/loadServerCodeMeta/index.d.ts +0 -1
- package/pipeline/loadServerCodeMeta/index.d.ts.map +0 -1
- package/pipeline/loadServerCodeMeta/index.js +0 -1
- package/pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts +0 -24
- package/pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts.map +0 -1
- package/pipeline/loadServerCodeMeta/loadServerCodeMeta.js +0 -92
- package/pipeline/loadServerSource/index.d.ts +0 -1
- package/pipeline/loadServerSource/index.d.ts.map +0 -1
- package/pipeline/loadServerSource/index.js +0 -1
- package/pipeline/loadServerSource/loadServerSource.d.ts +0 -25
- package/pipeline/loadServerSource/loadServerSource.d.ts.map +0 -1
- package/pipeline/loadServerSource/loadServerSource.js +0 -135
- package/pipeline/loaderUtils/externalsToPackages.d.ts +0 -1
- package/pipeline/loaderUtils/externalsToPackages.d.ts.map +0 -1
- package/pipeline/loaderUtils/externalsToPackages.js +0 -46
- package/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts +0 -34
- package/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts.map +0 -1
- package/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +0 -161
- package/pipeline/loaderUtils/getFileNameFromUrl.d.ts +0 -11
- package/pipeline/loaderUtils/getFileNameFromUrl.d.ts.map +0 -1
- package/pipeline/loaderUtils/getFileNameFromUrl.js +0 -32
- package/pipeline/loaderUtils/index.d.ts +0 -7
- package/pipeline/loaderUtils/index.d.ts.map +0 -1
- package/pipeline/loaderUtils/index.js +0 -7
- package/pipeline/loaderUtils/mergeExternals.d.ts +0 -32
- package/pipeline/loaderUtils/mergeExternals.d.ts.map +0 -1
- package/pipeline/loaderUtils/mergeExternals.js +0 -72
- package/pipeline/loaderUtils/parseImports.d.ts +0 -20
- package/pipeline/loaderUtils/parseImports.d.ts.map +0 -1
- package/pipeline/loaderUtils/parseImports.js +0 -307
- package/pipeline/loaderUtils/processRelativeImports.d.ts +0 -19
- package/pipeline/loaderUtils/processRelativeImports.d.ts.map +0 -1
- package/pipeline/loaderUtils/processRelativeImports.js +0 -329
- package/pipeline/loaderUtils/resolveModulePath.d.ts +0 -87
- package/pipeline/loaderUtils/resolveModulePath.d.ts.map +0 -1
- package/pipeline/loaderUtils/resolveModulePath.js +0 -1449
- package/pipeline/loaderUtils/resolveModulePathWithFs.d.ts +0 -47
- package/pipeline/loaderUtils/resolveModulePathWithFs.d.ts.map +0 -1
- package/pipeline/loaderUtils/resolveModulePathWithFs.js +0 -163
- package/pipeline/loaderUtils/rewriteImports.d.ts +0 -9
- package/pipeline/loaderUtils/rewriteImports.d.ts.map +0 -1
- package/pipeline/loaderUtils/rewriteImports.js +0 -35
- package/pipeline/parseSource/grammars.d.ts +0 -2
- package/pipeline/parseSource/grammars.d.ts.map +0 -1
- package/pipeline/parseSource/grammars.js +0 -27
- package/pipeline/parseSource/index.d.ts +0 -1
- package/pipeline/parseSource/index.d.ts.map +0 -1
- package/pipeline/parseSource/index.js +0 -1
- package/pipeline/parseSource/parseSource.d.ts +0 -3
- package/pipeline/parseSource/parseSource.d.ts.map +0 -1
- package/pipeline/parseSource/parseSource.js +0 -47
- package/pipeline/transformHtmlCode/index.d.ts +0 -2
- package/pipeline/transformHtmlCode/index.d.ts.map +0 -1
- package/pipeline/transformHtmlCode/index.js +0 -4
- package/pipeline/transformHtmlCode/transformHtmlCode.d.ts +0 -13
- package/pipeline/transformHtmlCode/transformHtmlCode.d.ts.map +0 -1
- package/pipeline/transformHtmlCode/transformHtmlCode.js +0 -303
- package/pipeline/transformMarkdownCode/index.d.ts +0 -2
- package/pipeline/transformMarkdownCode/index.d.ts.map +0 -1
- package/pipeline/transformMarkdownCode/index.js +0 -4
- package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts +0 -2
- package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts.map +0 -1
- package/pipeline/transformMarkdownCode/transformMarkdownCode.js +0 -514
- package/pipeline/transformTypescriptToJavascript/index.d.ts +0 -1
- package/pipeline/transformTypescriptToJavascript/index.d.ts.map +0 -1
- package/pipeline/transformTypescriptToJavascript/index.js +0 -1
- package/pipeline/transformTypescriptToJavascript/removeTypes.d.ts +0 -13
- package/pipeline/transformTypescriptToJavascript/removeTypes.d.ts.map +0 -1
- package/pipeline/transformTypescriptToJavascript/removeTypes.js +0 -134
- package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts +0 -3
- package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts.map +0 -1
- package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.js +0 -34
- package/useCode/index.d.ts +0 -1
- package/useCode/index.d.ts.map +0 -1
- package/useCode/index.js +0 -1
- package/useCode/useCode.d.ts +0 -39
- package/useCode/useCode.d.ts.map +0 -1
- package/useCode/useCode.js +0 -122
- package/useCode/useCodeUtils.d.ts +0 -45
- package/useCode/useCodeUtils.d.ts.map +0 -1
- package/useCode/useCodeUtils.js +0 -240
- package/useCode/useCopyFunctionality.d.ts +0 -17
- package/useCode/useCopyFunctionality.d.ts.map +0 -1
- package/useCode/useCopyFunctionality.js +0 -28
- package/useCode/useFileNavigation.d.ts +0 -48
- package/useCode/useFileNavigation.d.ts.map +0 -1
- package/useCode/useFileNavigation.js +0 -370
- package/useCode/useSourceEditing.d.ts +0 -19
- package/useCode/useSourceEditing.d.ts.map +0 -1
- package/useCode/useSourceEditing.js +0 -32
- package/useCode/useTransformManagement.d.ts +0 -28
- package/useCode/useTransformManagement.d.ts.map +0 -1
- package/useCode/useTransformManagement.js +0 -82
- package/useCode/useUIState.d.ts +0 -16
- package/useCode/useUIState.d.ts.map +0 -1
- package/useCode/useUIState.js +0 -21
- package/useCode/useVariantSelection.d.ts +0 -21
- package/useCode/useVariantSelection.d.ts.map +0 -1
- package/useCode/useVariantSelection.js +0 -84
- package/useCopier/index.d.ts.map +0 -1
- package/useDemo/createCodeSandbox.d.ts +0 -18
- package/useDemo/createCodeSandbox.d.ts.map +0 -1
- package/useDemo/createCodeSandbox.js +0 -48
- package/useDemo/createStackBlitz.d.ts +0 -22
- package/useDemo/createStackBlitz.d.ts.map +0 -1
- package/useDemo/createStackBlitz.js +0 -38
- package/useDemo/examineVariant.d.ts +0 -25
- package/useDemo/examineVariant.d.ts.map +0 -1
- package/useDemo/examineVariant.js +0 -134
- package/useDemo/exportVariant.d.ts +0 -110
- package/useDemo/exportVariant.d.ts.map +0 -1
- package/useDemo/exportVariant.js +0 -320
- package/useDemo/exportVariantAsCra.d.ts +0 -15
- package/useDemo/exportVariantAsCra.d.ts.map +0 -1
- package/useDemo/exportVariantAsCra.js +0 -56
- package/useDemo/flattenVariant.d.ts +0 -17
- package/useDemo/flattenVariant.d.ts.map +0 -1
- package/useDemo/flattenVariant.js +0 -206
- package/useDemo/index.d.ts.map +0 -1
- package/useDemo/useDemo.d.ts +0 -78
- package/useDemo/useDemo.d.ts.map +0 -1
- package/useDemo/useDemo.js +0 -174
- package/useLocalStorageState/index.d.ts +0 -2
- package/useLocalStorageState/index.d.ts.map +0 -1
- package/useLocalStorageState/index.js +0 -2
- package/useLocalStorageState/useLocalStorageState.d.ts +0 -14
- package/useLocalStorageState/useLocalStorageState.d.ts.map +0 -1
- package/useLocalStorageState/useLocalStorageState.js +0 -128
- package/useOnHydrate/index.d.ts +0 -1
- package/useOnHydrate/index.d.ts.map +0 -1
- package/useOnHydrate/index.js +0 -1
- package/useOnHydrate/useOnHydrate.d.ts +0 -1
- package/useOnHydrate/useOnHydrate.d.ts.map +0 -1
- package/useOnHydrate/useOnHydrate.js +0 -18
- package/useOnIdle/index.d.ts +0 -1
- package/useOnIdle/index.d.ts.map +0 -1
- package/useOnIdle/index.js +0 -1
- package/useOnIdle/useOnIdle.d.ts +0 -1
- package/useOnIdle/useOnIdle.d.ts.map +0 -1
- package/useOnIdle/useOnIdle.js +0 -39
- package/useUrlHashState/index.d.ts +0 -1
- package/useUrlHashState/index.d.ts.map +0 -1
- package/useUrlHashState/index.js +0 -1
- package/useUrlHashState/useUrlHashState.d.ts +0 -50
- package/useUrlHashState/useUrlHashState.d.ts.map +0 -1
- package/useUrlHashState/useUrlHashState.js +0 -113
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts the filename and extension from a URL or file path.
|
|
3
|
-
* This function is isomorphic and works in both Node.js and browser environments.
|
|
4
|
-
*
|
|
5
|
-
* @param url - The URL or file path to extract the filename from
|
|
6
|
-
* @returns An object containing the filename and extension
|
|
7
|
-
*/
|
|
8
|
-
export function getFileNameFromUrl(url) {
|
|
9
|
-
try {
|
|
10
|
-
// Use URL constructor to handle various URL formats
|
|
11
|
-
var urlObj = new URL(url);
|
|
12
|
-
var pathname = urlObj.pathname;
|
|
13
|
-
var fileName = pathname.split('/').pop() || '';
|
|
14
|
-
|
|
15
|
-
// Extract extension (including the dot)
|
|
16
|
-
var lastDotIndex = fileName.lastIndexOf('.');
|
|
17
|
-
var extension = lastDotIndex > 0 ? fileName.substring(lastDotIndex) : '';
|
|
18
|
-
return {
|
|
19
|
-
fileName: fileName,
|
|
20
|
-
extension: extension
|
|
21
|
-
};
|
|
22
|
-
} catch (_unused) {
|
|
23
|
-
// If URL parsing fails, fall back to simple string manipulation
|
|
24
|
-
var _fileName = url.split('/').pop() || url;
|
|
25
|
-
var _lastDotIndex = _fileName.lastIndexOf('.');
|
|
26
|
-
var _extension = _lastDotIndex > 0 ? _fileName.substring(_lastDotIndex) : '';
|
|
27
|
-
return {
|
|
28
|
-
fileName: _fileName,
|
|
29
|
-
extension: _extension
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "./parseImports.js";
|
|
2
|
-
export * from "./resolveModulePath.js";
|
|
3
|
-
export * from "./rewriteImports.js";
|
|
4
|
-
export * from "./processRelativeImports.js";
|
|
5
|
-
export * from "./getFileNameFromUrl.js";
|
|
6
|
-
export * from "./extractNameAndSlugFromUrl.js";
|
|
7
|
-
export * from "./externalsToPackages.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from "./parseImports.js";
|
|
2
|
-
export * from "./resolveModulePath.js";
|
|
3
|
-
export * from "./rewriteImports.js";
|
|
4
|
-
export * from "./processRelativeImports.js";
|
|
5
|
-
export * from "./getFileNameFromUrl.js";
|
|
6
|
-
export * from "./extractNameAndSlugFromUrl.js";
|
|
7
|
-
export * from "./externalsToPackages.js";
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Externals } from "../../CodeHighlighter/types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Merges multiple externals objects into a single object, combining imports from the same module.
|
|
4
|
-
* Deduplicates imports by name and type within each module.
|
|
5
|
-
*
|
|
6
|
-
* @param externalsArray Array of externals objects to merge
|
|
7
|
-
* @returns Merged externals object
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const externals1 = {
|
|
12
|
-
* 'react': [{ name: 'React', type: 'default' }],
|
|
13
|
-
* 'lodash': [{ name: 'map', type: 'named' }]
|
|
14
|
-
* };
|
|
15
|
-
*
|
|
16
|
-
* const externals2 = {
|
|
17
|
-
* 'react': [{ name: 'useState', type: 'named' }],
|
|
18
|
-
* 'lodash': [{ name: 'map', type: 'named' }] // duplicate - will be removed
|
|
19
|
-
* };
|
|
20
|
-
*
|
|
21
|
-
* const merged = mergeExternals([externals1, externals2]);
|
|
22
|
-
* // Result:
|
|
23
|
-
* // {
|
|
24
|
-
* // 'react': [
|
|
25
|
-
* // { name: 'React', type: 'default' },
|
|
26
|
-
* // { name: 'useState', type: 'named' }
|
|
27
|
-
* // ],
|
|
28
|
-
* // 'lodash': [{ name: 'map', type: 'named' }]
|
|
29
|
-
* // }
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function mergeExternals(externalsArray: Array<Externals>): Externals;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mergeExternals.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/mergeExternals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,GAAG,SAAS,CA4B1E"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
4
|
-
/**
|
|
5
|
-
* Merges multiple externals objects into a single object, combining imports from the same module.
|
|
6
|
-
* Deduplicates imports by name and type within each module.
|
|
7
|
-
*
|
|
8
|
-
* @param externalsArray Array of externals objects to merge
|
|
9
|
-
* @returns Merged externals object
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const externals1 = {
|
|
14
|
-
* 'react': [{ name: 'React', type: 'default' }],
|
|
15
|
-
* 'lodash': [{ name: 'map', type: 'named' }]
|
|
16
|
-
* };
|
|
17
|
-
*
|
|
18
|
-
* const externals2 = {
|
|
19
|
-
* 'react': [{ name: 'useState', type: 'named' }],
|
|
20
|
-
* 'lodash': [{ name: 'map', type: 'named' }] // duplicate - will be removed
|
|
21
|
-
* };
|
|
22
|
-
*
|
|
23
|
-
* const merged = mergeExternals([externals1, externals2]);
|
|
24
|
-
* // Result:
|
|
25
|
-
* // {
|
|
26
|
-
* // 'react': [
|
|
27
|
-
* // { name: 'React', type: 'default' },
|
|
28
|
-
* // { name: 'useState', type: 'named' }
|
|
29
|
-
* // ],
|
|
30
|
-
* // 'lodash': [{ name: 'map', type: 'named' }]
|
|
31
|
-
* // }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export function mergeExternals(externalsArray) {
|
|
35
|
-
var merged = {};
|
|
36
|
-
var _iterator = _createForOfIteratorHelper(externalsArray),
|
|
37
|
-
_step;
|
|
38
|
-
try {
|
|
39
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
40
|
-
var externals = _step.value;
|
|
41
|
-
var _loop = function _loop() {
|
|
42
|
-
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
43
|
-
modulePath = _Object$entries$_i[0],
|
|
44
|
-
imports = _Object$entries$_i[1];
|
|
45
|
-
if (!merged[modulePath]) {
|
|
46
|
-
// First time seeing this module, copy all imports
|
|
47
|
-
merged[modulePath] = _toConsumableArray(imports);
|
|
48
|
-
} else {
|
|
49
|
-
// Module already exists, merge imports and deduplicate
|
|
50
|
-
var existingImports = merged[modulePath];
|
|
51
|
-
var newImports = imports.filter(function (newImport) {
|
|
52
|
-
// Check if this import already exists (same name, type, and isType)
|
|
53
|
-
return !existingImports.some(function (existingImport) {
|
|
54
|
-
return existingImport.name === newImport.name && existingImport.type === newImport.type && existingImport.isType === newImport.isType;
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// Add only the new imports that don't already exist
|
|
59
|
-
merged[modulePath] = [].concat(_toConsumableArray(existingImports), _toConsumableArray(newImports));
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
for (var _i = 0, _Object$entries = Object.entries(externals); _i < _Object$entries.length; _i++) {
|
|
63
|
-
_loop();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
} catch (err) {
|
|
67
|
-
_iterator.e(err);
|
|
68
|
-
} finally {
|
|
69
|
-
_iterator.f();
|
|
70
|
-
}
|
|
71
|
-
return merged;
|
|
72
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
interface ImportName {
|
|
2
|
-
name: string;
|
|
3
|
-
alias?: string;
|
|
4
|
-
type: 'default' | 'named' | 'namespace';
|
|
5
|
-
isType?: boolean;
|
|
6
|
-
}
|
|
7
|
-
interface RelativeImport {
|
|
8
|
-
path: string;
|
|
9
|
-
names: ImportName[];
|
|
10
|
-
includeTypeDefs?: true;
|
|
11
|
-
}
|
|
12
|
-
interface ExternalImport {
|
|
13
|
-
names: ImportName[];
|
|
14
|
-
}
|
|
15
|
-
interface ParseImportsResult {
|
|
16
|
-
relative: Record<string, RelativeImport>;
|
|
17
|
-
externals: Record<string, ExternalImport>;
|
|
18
|
-
}
|
|
19
|
-
export declare function parseImports(code: string, _filePath: string): Promise<ParseImportsResult>;
|
|
20
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseImports.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/parseImports.ts"],"names":[],"mappings":"AAEA,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,eAAe,CAAC,EAAE,IAAI,CAAC;CACxB;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC3C;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA0Q/F"}
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
|
-
import path from 'path';
|
|
6
|
-
export function parseImports(_x, _x2) {
|
|
7
|
-
return _parseImports.apply(this, arguments);
|
|
8
|
-
}
|
|
9
|
-
function _parseImports() {
|
|
10
|
-
_parseImports = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(code, _filePath) {
|
|
11
|
-
var result, externals, importRegex, sideEffectImportRegex, match, _loop, _ret, sideEffectMatch, _sideEffectMatch, _sideEffectMatch2, modulePathRaw, modulePath, isRelative, resolvedPath;
|
|
12
|
-
return _regeneratorRuntime().wrap(function _callee$(_context2) {
|
|
13
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
14
|
-
case 0:
|
|
15
|
-
result = {};
|
|
16
|
-
externals = {}; // Regex to extract regular import statements with 'from' clause
|
|
17
|
-
importRegex = /import(?:\s+type)?\s*([^'"]*)\s*from\s*['"]([^'"]+)['"][;]?/g; // Regex to extract side-effect imports (without 'from' clause)
|
|
18
|
-
sideEffectImportRegex = /import\s*['"]([^'"]+)['"][;]?/g;
|
|
19
|
-
// eslint-disable-next-line no-cond-assign
|
|
20
|
-
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
21
|
-
var _match, _match2, fullMatch, importSpecifierRaw, modulePathRaw, includeTypeDefs, importSpecifier, modulePath, isRelative, _resolvedPath, _resolvedPath2, defaultImportMatch, namespaceImportMatch, namedImportsMatch, defaultImport, namespaceImport, namedImportsStr, existing, _existing, cleanedImportsStr, namedImports, _defaultImportMatch, _namespaceImportMatch, _namedImportsMatch, _defaultImport, _namespaceImport, _namedImportsStr, _existing3, _existing4, _cleanedImportsStr, _namedImports;
|
|
22
|
-
return _regeneratorRuntime().wrap(function _loop$(_context) {
|
|
23
|
-
while (1) switch (_context.prev = _context.next) {
|
|
24
|
-
case 0:
|
|
25
|
-
_match = match, _match2 = _slicedToArray(_match, 3), fullMatch = _match2[0], importSpecifierRaw = _match2[1], modulePathRaw = _match2[2]; // Determine if this is a type import by checking if the full match contains "import type"
|
|
26
|
-
includeTypeDefs = fullMatch.includes('import type');
|
|
27
|
-
importSpecifier = importSpecifierRaw == null ? void 0 : importSpecifierRaw.trim();
|
|
28
|
-
modulePath = modulePathRaw == null ? void 0 : modulePathRaw.trim();
|
|
29
|
-
if (modulePath) {
|
|
30
|
-
_context.next = 6;
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
return _context.abrupt("return", 0);
|
|
34
|
-
case 6:
|
|
35
|
-
// Check if this is a relative import
|
|
36
|
-
isRelative = modulePath.startsWith('./') || modulePath.startsWith('../'); // Handle side-effect imports (no import specifier)
|
|
37
|
-
if (importSpecifier) {
|
|
38
|
-
_context.next = 10;
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
if (isRelative) {
|
|
42
|
-
// Resolve the relative import to an absolute path
|
|
43
|
-
_resolvedPath = path.resolve(path.dirname(_filePath), modulePath);
|
|
44
|
-
if (!result[modulePath]) {
|
|
45
|
-
result[modulePath] = {
|
|
46
|
-
path: _resolvedPath,
|
|
47
|
-
names: [] // Empty names array for side-effect imports
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
} else if (!externals[modulePath]) {
|
|
51
|
-
// External side-effect import
|
|
52
|
-
externals[modulePath] = {
|
|
53
|
-
names: []
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
return _context.abrupt("return", 0);
|
|
57
|
-
case 10:
|
|
58
|
-
if (isRelative) {
|
|
59
|
-
// Resolve the relative import to an absolute path
|
|
60
|
-
_resolvedPath2 = path.resolve(path.dirname(_filePath), modulePath);
|
|
61
|
-
if (!result[modulePath]) {
|
|
62
|
-
result[modulePath] = _objectSpread({
|
|
63
|
-
path: _resolvedPath2,
|
|
64
|
-
names: []
|
|
65
|
-
}, includeTypeDefs && {
|
|
66
|
-
includeTypeDefs: true
|
|
67
|
-
});
|
|
68
|
-
} else if (includeTypeDefs && !result[modulePath].includeTypeDefs) {
|
|
69
|
-
result[modulePath].includeTypeDefs = true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Parse the import specifier to determine the type of import
|
|
73
|
-
defaultImportMatch = importSpecifier.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:,|$)/);
|
|
74
|
-
namespaceImportMatch = importSpecifier.match(/\*\s+as\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/);
|
|
75
|
-
namedImportsMatch = importSpecifier.match(/\{([^}]+)\}/);
|
|
76
|
-
defaultImport = defaultImportMatch == null ? void 0 : defaultImportMatch[1];
|
|
77
|
-
namespaceImport = namespaceImportMatch == null ? void 0 : namespaceImportMatch[1];
|
|
78
|
-
namedImportsStr = namedImportsMatch == null ? void 0 : namedImportsMatch[1];
|
|
79
|
-
if (defaultImport) {
|
|
80
|
-
// Check if we already have this default import
|
|
81
|
-
existing = result[modulePath].names.find(function (n) {
|
|
82
|
-
return n.name === defaultImport && n.type === 'default';
|
|
83
|
-
});
|
|
84
|
-
if (!existing) {
|
|
85
|
-
result[modulePath].names.push(_objectSpread({
|
|
86
|
-
name: defaultImport,
|
|
87
|
-
type: 'default'
|
|
88
|
-
}, includeTypeDefs && {
|
|
89
|
-
isType: true
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (namespaceImport) {
|
|
94
|
-
// Check if we already have this namespace import
|
|
95
|
-
_existing = result[modulePath].names.find(function (n) {
|
|
96
|
-
return n.name === namespaceImport && n.type === 'namespace';
|
|
97
|
-
});
|
|
98
|
-
if (!_existing) {
|
|
99
|
-
result[modulePath].names.push(_objectSpread({
|
|
100
|
-
name: namespaceImport,
|
|
101
|
-
type: 'namespace'
|
|
102
|
-
}, includeTypeDefs && {
|
|
103
|
-
isType: true
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
if (namedImportsStr) {
|
|
108
|
-
// Handle named imports like { ComponentName, Component2 as Alias, type TypeName }
|
|
109
|
-
// Clean up the string by removing comments and extra whitespace
|
|
110
|
-
cleanedImportsStr = namedImportsStr.replace(/\/\*[\s\S]*?\*\//g, '') // Remove /* comment */ blocks
|
|
111
|
-
.replace(/\/\/.*$/gm, '') // Remove // line comments
|
|
112
|
-
.trim();
|
|
113
|
-
if (cleanedImportsStr) {
|
|
114
|
-
namedImports = cleanedImportsStr.split(',').map(function (s) {
|
|
115
|
-
return s.trim();
|
|
116
|
-
}).filter(function (s) {
|
|
117
|
-
return s.length > 0;
|
|
118
|
-
});
|
|
119
|
-
namedImports.forEach(function (namedImport) {
|
|
120
|
-
// Check if this specific import is a type import
|
|
121
|
-
var isTypeImport = namedImport.trim().startsWith('type ');
|
|
122
|
-
|
|
123
|
-
// Clean up the import name (remove 'type' keyword and handle aliases)
|
|
124
|
-
var cleanImport = namedImport.replace(/^type\s+/, ''); // Remove leading 'type'
|
|
125
|
-
|
|
126
|
-
// Parse original name and alias
|
|
127
|
-
var aliasMatch = cleanImport.match(/(.+?)\s+as\s+(.+)/);
|
|
128
|
-
var originalName = aliasMatch ? aliasMatch[1].trim() : cleanImport.trim();
|
|
129
|
-
var alias = aliasMatch ? aliasMatch[2].trim() : undefined;
|
|
130
|
-
|
|
131
|
-
// Only add if we have a valid name
|
|
132
|
-
if (originalName && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(originalName)) {
|
|
133
|
-
// Check if we already have this named import
|
|
134
|
-
var _existing2 = result[modulePath].names.find(function (n) {
|
|
135
|
-
return n.name === originalName && n.type === 'named' && n.alias === alias;
|
|
136
|
-
});
|
|
137
|
-
if (!_existing2) {
|
|
138
|
-
result[modulePath].names.push(_objectSpread(_objectSpread({
|
|
139
|
-
name: originalName
|
|
140
|
-
}, alias && {
|
|
141
|
-
alias: alias
|
|
142
|
-
}), {}, {
|
|
143
|
-
type: 'named'
|
|
144
|
-
}, (includeTypeDefs || isTypeImport) && {
|
|
145
|
-
isType: true
|
|
146
|
-
}));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
} else {
|
|
153
|
-
// This is an external import
|
|
154
|
-
if (!externals[modulePath]) {
|
|
155
|
-
externals[modulePath] = {
|
|
156
|
-
names: []
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Parse the import specifier to determine the type of import
|
|
161
|
-
_defaultImportMatch = importSpecifier.match(/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:,|$)/);
|
|
162
|
-
_namespaceImportMatch = importSpecifier.match(/\*\s+as\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/);
|
|
163
|
-
_namedImportsMatch = importSpecifier.match(/\{([^}]+)\}/);
|
|
164
|
-
_defaultImport = _defaultImportMatch == null ? void 0 : _defaultImportMatch[1];
|
|
165
|
-
_namespaceImport = _namespaceImportMatch == null ? void 0 : _namespaceImportMatch[1];
|
|
166
|
-
_namedImportsStr = _namedImportsMatch == null ? void 0 : _namedImportsMatch[1];
|
|
167
|
-
if (_defaultImport) {
|
|
168
|
-
// Check if we already have this default import
|
|
169
|
-
_existing3 = externals[modulePath].names.find(function (n) {
|
|
170
|
-
return n.name === _defaultImport && n.type === 'default';
|
|
171
|
-
});
|
|
172
|
-
if (!_existing3) {
|
|
173
|
-
externals[modulePath].names.push(_objectSpread({
|
|
174
|
-
name: _defaultImport,
|
|
175
|
-
type: 'default'
|
|
176
|
-
}, includeTypeDefs && {
|
|
177
|
-
isType: true
|
|
178
|
-
}));
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (_namespaceImport) {
|
|
182
|
-
// Check if we already have this namespace import
|
|
183
|
-
_existing4 = externals[modulePath].names.find(function (n) {
|
|
184
|
-
return n.name === _namespaceImport && n.type === 'namespace';
|
|
185
|
-
});
|
|
186
|
-
if (!_existing4) {
|
|
187
|
-
externals[modulePath].names.push(_objectSpread({
|
|
188
|
-
name: _namespaceImport,
|
|
189
|
-
type: 'namespace'
|
|
190
|
-
}, includeTypeDefs && {
|
|
191
|
-
isType: true
|
|
192
|
-
}));
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
if (_namedImportsStr) {
|
|
196
|
-
// Handle named imports like { ComponentName, Component2 as Alias, type TypeName }
|
|
197
|
-
// Clean up the string by removing comments and extra whitespace
|
|
198
|
-
_cleanedImportsStr = _namedImportsStr.replace(/\/\*[\s\S]*?\*\//g, '') // Remove /* comment */ blocks
|
|
199
|
-
.replace(/\/\/.*$/gm, '') // Remove // line comments
|
|
200
|
-
.trim();
|
|
201
|
-
if (_cleanedImportsStr) {
|
|
202
|
-
_namedImports = _cleanedImportsStr.split(',').map(function (s) {
|
|
203
|
-
return s.trim();
|
|
204
|
-
}).filter(function (s) {
|
|
205
|
-
return s.length > 0;
|
|
206
|
-
});
|
|
207
|
-
_namedImports.forEach(function (namedImport) {
|
|
208
|
-
// Check if this specific import is a type import
|
|
209
|
-
var isTypeImport = namedImport.trim().startsWith('type ');
|
|
210
|
-
|
|
211
|
-
// Clean up the import name (remove 'type' keyword and handle aliases)
|
|
212
|
-
var cleanImport = namedImport.replace(/^type\s+/, ''); // Remove leading 'type'
|
|
213
|
-
|
|
214
|
-
// Parse original name and alias - for externals we track both
|
|
215
|
-
var aliasMatch = cleanImport.match(/(.+?)\s+as\s+(.+)/);
|
|
216
|
-
var originalName = aliasMatch ? aliasMatch[1].trim() : cleanImport.trim();
|
|
217
|
-
var alias = aliasMatch ? aliasMatch[2].trim() : undefined;
|
|
218
|
-
|
|
219
|
-
// Only add if we have a valid name
|
|
220
|
-
if (originalName && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(originalName)) {
|
|
221
|
-
// Check if we already have this named import
|
|
222
|
-
var _existing5 = externals[modulePath].names.find(function (n) {
|
|
223
|
-
return n.name === originalName && n.type === 'named' && n.alias === alias;
|
|
224
|
-
});
|
|
225
|
-
if (!_existing5) {
|
|
226
|
-
externals[modulePath].names.push(_objectSpread(_objectSpread({
|
|
227
|
-
name: originalName
|
|
228
|
-
}, alias && {
|
|
229
|
-
alias: alias
|
|
230
|
-
}), {}, {
|
|
231
|
-
type: 'named'
|
|
232
|
-
}, (includeTypeDefs || isTypeImport) && {
|
|
233
|
-
isType: true
|
|
234
|
-
}));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
case 11:
|
|
242
|
-
case "end":
|
|
243
|
-
return _context.stop();
|
|
244
|
-
}
|
|
245
|
-
}, _loop);
|
|
246
|
-
});
|
|
247
|
-
case 5:
|
|
248
|
-
if (!((match = importRegex.exec(code)) !== null)) {
|
|
249
|
-
_context2.next = 12;
|
|
250
|
-
break;
|
|
251
|
-
}
|
|
252
|
-
return _context2.delegateYield(_loop(), "t0", 7);
|
|
253
|
-
case 7:
|
|
254
|
-
_ret = _context2.t0;
|
|
255
|
-
if (!(_ret === 0)) {
|
|
256
|
-
_context2.next = 10;
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
return _context2.abrupt("continue", 5);
|
|
260
|
-
case 10:
|
|
261
|
-
_context2.next = 5;
|
|
262
|
-
break;
|
|
263
|
-
case 12:
|
|
264
|
-
if (!((sideEffectMatch = sideEffectImportRegex.exec(code)) !== null)) {
|
|
265
|
-
_context2.next = 21;
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
_sideEffectMatch = sideEffectMatch, _sideEffectMatch2 = _slicedToArray(_sideEffectMatch, 2), modulePathRaw = _sideEffectMatch2[1];
|
|
269
|
-
modulePath = modulePathRaw == null ? void 0 : modulePathRaw.trim();
|
|
270
|
-
if (modulePath) {
|
|
271
|
-
_context2.next = 17;
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
return _context2.abrupt("continue", 12);
|
|
275
|
-
case 17:
|
|
276
|
-
// Check if this is a relative import
|
|
277
|
-
isRelative = modulePath.startsWith('./') || modulePath.startsWith('../');
|
|
278
|
-
if (isRelative) {
|
|
279
|
-
// Resolve the relative import to an absolute path
|
|
280
|
-
resolvedPath = path.resolve(path.dirname(_filePath), modulePath);
|
|
281
|
-
if (!result[modulePath]) {
|
|
282
|
-
result[modulePath] = {
|
|
283
|
-
path: resolvedPath,
|
|
284
|
-
names: [] // Empty names array for side-effect imports
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
} else if (!externals[modulePath]) {
|
|
288
|
-
// External side-effect import
|
|
289
|
-
externals[modulePath] = {
|
|
290
|
-
names: []
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
_context2.next = 12;
|
|
294
|
-
break;
|
|
295
|
-
case 21:
|
|
296
|
-
return _context2.abrupt("return", {
|
|
297
|
-
relative: result,
|
|
298
|
-
externals: externals
|
|
299
|
-
});
|
|
300
|
-
case 22:
|
|
301
|
-
case "end":
|
|
302
|
-
return _context2.stop();
|
|
303
|
-
}
|
|
304
|
-
}, _callee);
|
|
305
|
-
}));
|
|
306
|
-
return _parseImports.apply(this, arguments);
|
|
307
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export type StoreAtMode = 'canonical' | 'import' | 'flat';
|
|
2
|
-
export interface ProcessImportsResult {
|
|
3
|
-
processedSource: string;
|
|
4
|
-
extraFiles: Record<string, string>;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Processes imports based on the specified storage mode, automatically handling
|
|
8
|
-
* source rewriting when needed (e.g., for 'flat' mode).
|
|
9
|
-
*
|
|
10
|
-
* @param source - The original source code
|
|
11
|
-
* @param importResult - The result from parseImports
|
|
12
|
-
* @param resolvedPathsMap - Map from import paths to resolved file paths
|
|
13
|
-
* @param storeAt - How to process the imports
|
|
14
|
-
* @returns Object with processed source and extraFiles mapping
|
|
15
|
-
*/
|
|
16
|
-
export declare function processRelativeImports(source: string, importResult: Record<string, {
|
|
17
|
-
path: string;
|
|
18
|
-
names: string[];
|
|
19
|
-
}>, resolvedPathsMap: Map<string, string>, storeAt: StoreAtMode): ProcessImportsResult;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processRelativeImports.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loaderUtils/processRelativeImports.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,EAC/D,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,OAAO,EAAE,WAAW,GACnB,oBAAoB,CAmGtB"}
|