@mui/internal-docs-infra 0.1.1-alpha.1 → 0.1.1-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CodeControllerContext/CodeControllerContext.d.ts +1 -1
- package/CodeControllerContext/CodeControllerContext.d.ts.map +1 -1
- package/CodeControllerContext/index.d.ts.map +1 -1
- package/CodeExternalsContext/CodeExternalsContext.d.ts +8 -0
- package/CodeExternalsContext/CodeExternalsContext.d.ts.map +1 -0
- package/CodeExternalsContext/CodeExternalsContext.js +7 -0
- package/CodeExternalsContext/index.d.ts +1 -0
- package/CodeExternalsContext/index.d.ts.map +1 -0
- package/CodeExternalsContext/index.js +1 -0
- package/CodeHighlighter/CodeHighlighter.d.ts +1 -1
- package/CodeHighlighter/CodeHighlighter.d.ts.map +1 -1
- package/CodeHighlighter/CodeHighlighter.js +235 -86
- package/CodeHighlighter/CodeHighlighterClient.d.ts.map +1 -1
- package/CodeHighlighter/CodeHighlighterClient.js +500 -62
- package/CodeHighlighter/CodeHighlighterContext.d.ts +2 -0
- package/CodeHighlighter/CodeHighlighterContext.d.ts.map +1 -1
- package/CodeHighlighter/CodeHighlighterFallbackContext.d.ts.map +1 -1
- package/CodeHighlighter/CodeHighlighterFallbackContext.js +3 -1
- package/CodeHighlighter/applyTransform.d.ts.map +1 -1
- package/CodeHighlighter/codeToFallbackProps.d.ts +2 -2
- package/CodeHighlighter/codeToFallbackProps.d.ts.map +1 -1
- package/CodeHighlighter/codeToFallbackProps.js +8 -5
- package/CodeHighlighter/errors.d.ts.map +1 -1
- package/CodeHighlighter/hasAllVariants.d.ts.map +1 -1
- package/CodeHighlighter/index.d.ts.map +1 -1
- package/CodeHighlighter/loadFallbackCode.d.ts +3 -2
- package/CodeHighlighter/loadFallbackCode.d.ts.map +1 -1
- package/CodeHighlighter/loadFallbackCode.js +325 -161
- package/CodeHighlighter/loadVariant.d.ts +3 -2
- package/CodeHighlighter/loadVariant.d.ts.map +1 -1
- package/CodeHighlighter/loadVariant.js +604 -229
- package/CodeHighlighter/maybeInitialData.d.ts +1 -1
- package/CodeHighlighter/maybeInitialData.d.ts.map +1 -1
- package/CodeHighlighter/parseCode.d.ts.map +1 -1
- package/CodeHighlighter/parseCode.js +14 -2
- package/CodeHighlighter/parseControlledCode.d.ts.map +1 -1
- package/CodeHighlighter/parseControlledCode.js +12 -1
- package/CodeHighlighter/transformCode.d.ts +1 -0
- package/CodeHighlighter/transformCode.d.ts.map +1 -1
- package/CodeHighlighter/transformCode.js +43 -3
- package/CodeHighlighter/transformParsedSource.d.ts.map +1 -1
- package/CodeHighlighter/transformSource.d.ts.map +1 -1
- package/CodeHighlighter/types.d.ts +39 -17
- package/CodeHighlighter/types.d.ts.map +1 -1
- package/CodeProvider/CodeContext.d.ts.map +1 -1
- package/CodeProvider/CodeProvider.d.ts.map +1 -1
- package/CodeProvider/CodeProvider.js +21 -6
- package/CodeProvider/index.d.ts +1 -2
- package/CodeProvider/index.d.ts.map +1 -1
- package/CodeProvider/index.js +1 -2
- package/abstractCreateDemo/abstractCreateDemo.d.ts +35 -0
- package/abstractCreateDemo/abstractCreateDemo.d.ts.map +1 -0
- package/abstractCreateDemo/abstractCreateDemo.js +91 -0
- package/abstractCreateDemo/index.d.ts +1 -0
- package/abstractCreateDemo/index.d.ts.map +1 -0
- package/abstractCreateDemo/index.js +1 -0
- package/createDemoData/createDemoData.d.ts +44 -0
- package/createDemoData/createDemoData.d.ts.map +1 -0
- package/createDemoData/createDemoData.js +75 -0
- package/createDemoData/index.d.ts +1 -0
- package/createDemoData/index.d.ts.map +1 -0
- package/createDemoData/index.js +1 -0
- package/createDemoData/types.d.ts +28 -0
- package/createDemoData/types.d.ts.map +1 -0
- package/createDemoData/types.js +1 -0
- package/package.json +15 -9
- package/pipeline/hastUtils/hastUtils.d.ts.map +1 -0
- package/{hast/hast.js → pipeline/hastUtils/hastUtils.js} +2 -1
- package/pipeline/hastUtils/index.d.ts +1 -0
- package/pipeline/hastUtils/index.d.ts.map +1 -0
- package/pipeline/hastUtils/index.js +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.d.ts +54 -0
- package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.js +465 -0
- package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.d.ts +15 -0
- package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.js +253 -0
- package/pipeline/loadPrecomputedCodeHighlighter/index.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +20 -0
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +228 -0
- package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/parseCreateFactoryCall.d.ts +12 -1
- package/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +433 -0
- package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/parseFunctionParameters.d.ts +5 -1
- package/pipeline/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts.map +1 -0
- package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/parseFunctionParameters.js +1 -1
- package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +25 -0
- package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +73 -0
- package/pipeline/loadServerCodeMeta/index.d.ts +1 -0
- package/pipeline/loadServerCodeMeta/index.d.ts.map +1 -0
- package/pipeline/loadServerCodeMeta/index.js +1 -0
- package/{loadServerCodeMeta/serverLoadCodeMeta.d.ts → pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts} +4 -4
- package/pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts.map +1 -0
- package/{loadServerCodeMeta/serverLoadCodeMeta.js → pipeline/loadServerCodeMeta/loadServerCodeMeta.js} +18 -3
- package/pipeline/loadServerSource/index.d.ts +1 -0
- package/pipeline/loadServerSource/index.d.ts.map +1 -0
- package/pipeline/loadServerSource/index.js +1 -0
- package/{loadServerSource/serverLoadSource.d.ts → pipeline/loadServerSource/loadServerSource.d.ts} +5 -5
- package/pipeline/loadServerSource/loadServerSource.d.ts.map +1 -0
- package/pipeline/loadServerSource/loadServerSource.js +135 -0
- package/pipeline/loaderUtils/externalsToPackages.d.ts +1 -0
- package/pipeline/loaderUtils/externalsToPackages.d.ts.map +1 -0
- package/pipeline/loaderUtils/externalsToPackages.js +46 -0
- package/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts +34 -0
- package/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts.map +1 -0
- package/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +161 -0
- package/{loaderUtils → pipeline/loaderUtils}/getFileNameFromUrl.d.ts +1 -0
- package/pipeline/loaderUtils/getFileNameFromUrl.d.ts.map +1 -0
- package/pipeline/loaderUtils/getFileNameFromUrl.js +66 -0
- package/pipeline/loaderUtils/index.d.ts +7 -0
- package/pipeline/loaderUtils/index.d.ts.map +1 -0
- package/pipeline/loaderUtils/index.js +7 -0
- package/pipeline/loaderUtils/mergeExternals.d.ts +32 -0
- package/pipeline/loaderUtils/mergeExternals.d.ts.map +1 -0
- package/pipeline/loaderUtils/mergeExternals.js +72 -0
- package/pipeline/loaderUtils/parseImports.d.ts +20 -0
- package/pipeline/loaderUtils/parseImports.d.ts.map +1 -0
- package/pipeline/loaderUtils/parseImports.js +307 -0
- package/{loaderUtils/processImports.d.ts → pipeline/loaderUtils/processRelativeImports.d.ts} +2 -2
- package/pipeline/loaderUtils/processRelativeImports.d.ts.map +1 -0
- package/pipeline/loaderUtils/processRelativeImports.js +352 -0
- package/{loaderUtils → pipeline/loaderUtils}/resolveModulePath.d.ts +19 -6
- package/pipeline/loaderUtils/resolveModulePath.d.ts.map +1 -0
- package/pipeline/loaderUtils/resolveModulePath.js +1449 -0
- package/{loaderUtils → pipeline/loaderUtils}/resolveModulePathWithFs.d.ts +6 -3
- package/pipeline/loaderUtils/resolveModulePathWithFs.d.ts.map +1 -0
- package/{loaderUtils → pipeline/loaderUtils}/resolveModulePathWithFs.js +8 -4
- package/pipeline/loaderUtils/rewriteImports.d.ts +9 -0
- package/pipeline/loaderUtils/rewriteImports.d.ts.map +1 -0
- package/pipeline/loaderUtils/rewriteImports.js +35 -0
- package/pipeline/parseSource/grammars.d.ts.map +1 -0
- package/pipeline/parseSource/index.d.ts.map +1 -0
- package/pipeline/parseSource/parseSource.d.ts +3 -0
- package/pipeline/parseSource/parseSource.d.ts.map +1 -0
- package/{parseSource → pipeline/parseSource}/parseSource.js +15 -5
- package/pipeline/transformHtmlCode/index.d.ts +2 -0
- package/pipeline/transformHtmlCode/index.d.ts.map +1 -0
- package/pipeline/transformHtmlCode/index.js +4 -0
- package/pipeline/transformHtmlCode/transformHtmlCode.d.ts +13 -0
- package/pipeline/transformHtmlCode/transformHtmlCode.d.ts.map +1 -0
- package/pipeline/transformHtmlCode/transformHtmlCode.js +303 -0
- package/pipeline/transformMarkdownCode/index.d.ts +2 -0
- package/pipeline/transformMarkdownCode/index.d.ts.map +1 -0
- package/pipeline/transformMarkdownCode/index.js +4 -0
- package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts +2 -0
- package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts.map +1 -0
- package/pipeline/transformMarkdownCode/transformMarkdownCode.js +514 -0
- package/pipeline/transformTypescriptToJavascript/index.d.ts +1 -0
- package/pipeline/transformTypescriptToJavascript/index.d.ts.map +1 -0
- package/pipeline/transformTypescriptToJavascript/index.js +1 -0
- package/pipeline/transformTypescriptToJavascript/removeTypes.d.ts.map +1 -0
- package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts +3 -0
- package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts.map +1 -0
- package/{transformTsToJs/transformTsToJs.js → pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.js} +4 -4
- package/useCode/index.d.ts.map +1 -1
- package/useCode/useCode.d.ts +14 -11
- package/useCode/useCode.d.ts.map +1 -1
- package/useCode/useCode.js +94 -364
- package/useCode/useCodeUtils.d.ts +45 -0
- package/useCode/useCodeUtils.d.ts.map +1 -0
- package/useCode/useCodeUtils.js +240 -0
- package/useCode/useCopyFunctionality.d.ts +17 -0
- package/useCode/useCopyFunctionality.d.ts.map +1 -0
- package/useCode/useCopyFunctionality.js +28 -0
- package/useCode/useFileNavigation.d.ts +49 -0
- package/useCode/useFileNavigation.d.ts.map +1 -0
- package/useCode/useFileNavigation.js +398 -0
- package/useCode/useSourceEditing.d.ts +19 -0
- package/useCode/useSourceEditing.d.ts.map +1 -0
- package/useCode/useSourceEditing.js +32 -0
- package/useCode/useTransformManagement.d.ts +28 -0
- package/useCode/useTransformManagement.d.ts.map +1 -0
- package/useCode/useTransformManagement.js +82 -0
- package/useCode/useUIState.d.ts +16 -0
- package/useCode/useUIState.d.ts.map +1 -0
- package/useCode/useUIState.js +21 -0
- package/useCode/useVariantSelection.d.ts +21 -0
- package/useCode/useVariantSelection.d.ts.map +1 -0
- package/useCode/useVariantSelection.js +84 -0
- package/useCopier/index.d.ts +1 -1
- package/useCopier/index.d.ts.map +1 -1
- package/useCopier/index.js +5 -5
- package/useDemo/createCodeSandbox.d.ts +18 -0
- package/useDemo/createCodeSandbox.d.ts.map +1 -0
- package/useDemo/createCodeSandbox.js +48 -0
- package/useDemo/createStackBlitz.d.ts +22 -0
- package/useDemo/createStackBlitz.d.ts.map +1 -0
- package/useDemo/createStackBlitz.js +38 -0
- package/useDemo/examineVariant.d.ts +25 -0
- package/useDemo/examineVariant.d.ts.map +1 -0
- package/useDemo/examineVariant.js +134 -0
- package/useDemo/exportVariant.d.ts +110 -0
- package/useDemo/exportVariant.d.ts.map +1 -0
- package/useDemo/exportVariant.js +320 -0
- package/useDemo/exportVariantAsCra.d.ts +15 -0
- package/useDemo/exportVariantAsCra.d.ts.map +1 -0
- package/useDemo/exportVariantAsCra.js +56 -0
- package/useDemo/flattenVariant.d.ts +17 -0
- package/useDemo/flattenVariant.d.ts.map +1 -0
- package/useDemo/flattenVariant.js +206 -0
- package/useDemo/index.d.ts +6 -39
- package/useDemo/index.d.ts.map +1 -1
- package/useDemo/index.js +6 -17
- package/useDemo/useDemo.d.ts +79 -0
- package/useDemo/useDemo.d.ts.map +1 -0
- package/useDemo/useDemo.js +174 -0
- package/useLocalStorageState/index.d.ts +2 -0
- package/useLocalStorageState/index.d.ts.map +1 -0
- package/useLocalStorageState/index.js +2 -0
- package/useLocalStorageState/useLocalStorageState.d.ts +14 -0
- package/useLocalStorageState/useLocalStorageState.d.ts.map +1 -0
- package/useLocalStorageState/useLocalStorageState.js +128 -0
- package/useOnHydrate/index.d.ts.map +1 -1
- package/useOnHydrate/useOnHydrate.d.ts.map +1 -1
- package/useOnIdle/index.d.ts.map +1 -1
- package/useOnIdle/useOnIdle.d.ts.map +1 -1
- package/useUrlHashState/index.d.ts +1 -0
- package/useUrlHashState/index.d.ts.map +1 -0
- package/useUrlHashState/index.js +1 -0
- package/useUrlHashState/useUrlHashState.d.ts +50 -0
- package/useUrlHashState/useUrlHashState.d.ts.map +1 -0
- package/useUrlHashState/useUrlHashState.js +113 -0
- package/hast/hast.d.ts.map +0 -1
- package/hast/index.d.ts +0 -1
- package/hast/index.d.ts.map +0 -1
- package/hast/index.js +0 -1
- package/loadPrecomputedCodeHighlighter/index.d.ts.map +0 -1
- package/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +0 -57
- package/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts.map +0 -1
- package/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +0 -194
- package/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts.map +0 -1
- package/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +0 -243
- package/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts.map +0 -1
- package/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +0 -27
- package/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts.map +0 -1
- package/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +0 -37
- package/loadServerCodeMeta/index.d.ts +0 -1
- package/loadServerCodeMeta/index.d.ts.map +0 -1
- package/loadServerCodeMeta/index.js +0 -1
- package/loadServerCodeMeta/serverLoadCodeMeta.d.ts.map +0 -1
- package/loadServerSource/index.d.ts +0 -1
- package/loadServerSource/index.d.ts.map +0 -1
- package/loadServerSource/index.js +0 -1
- package/loadServerSource/serverLoadSource.d.ts.map +0 -1
- package/loadServerSource/serverLoadSource.js +0 -100
- package/loaderUtils/getFileNameFromUrl.d.ts.map +0 -1
- package/loaderUtils/getFileNameFromUrl.js +0 -32
- package/loaderUtils/index.d.ts +0 -5
- package/loaderUtils/index.d.ts.map +0 -1
- package/loaderUtils/index.js +0 -5
- package/loaderUtils/processImports.d.ts.map +0 -1
- package/loaderUtils/processImports.js +0 -82
- package/loaderUtils/resolveImports.d.ts +0 -4
- package/loaderUtils/resolveImports.d.ts.map +0 -1
- package/loaderUtils/resolveImports.js +0 -71
- package/loaderUtils/resolveModulePath.d.ts.map +0 -1
- package/loaderUtils/resolveModulePath.js +0 -862
- package/loaderUtils/resolveModulePathWithFs.d.ts.map +0 -1
- package/loaderUtils/rewriteImports.d.ts +0 -9
- package/loaderUtils/rewriteImports.d.ts.map +0 -1
- package/loaderUtils/rewriteImports.js +0 -57
- package/parseSource/grammars.d.ts.map +0 -1
- package/parseSource/index.d.ts.map +0 -1
- package/parseSource/parseSource.d.ts +0 -3
- package/parseSource/parseSource.d.ts.map +0 -1
- package/transformRelativeMarkdownPaths/index.d.ts +0 -2
- package/transformRelativeMarkdownPaths/index.d.ts.map +0 -1
- package/transformRelativeMarkdownPaths/index.js +0 -4
- package/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts +0 -12
- package/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts.map +0 -1
- package/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.js +0 -30
- package/transformTsToJs/index.d.ts +0 -1
- package/transformTsToJs/index.d.ts.map +0 -1
- package/transformTsToJs/index.js +0 -1
- package/transformTsToJs/removeTypes.d.ts.map +0 -1
- package/transformTsToJs/transformTsToJs.d.ts +0 -3
- package/transformTsToJs/transformTsToJs.d.ts.map +0 -1
- /package/{hast/hast.d.ts → pipeline/hastUtils/hastUtils.d.ts} +0 -0
- /package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/index.d.ts +0 -0
- /package/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/index.js +0 -0
- /package/{parseSource → pipeline/parseSource}/grammars.d.ts +0 -0
- /package/{parseSource → pipeline/parseSource}/grammars.js +0 -0
- /package/{parseSource → pipeline/parseSource}/index.d.ts +0 -0
- /package/{parseSource → pipeline/parseSource}/index.js +0 -0
- /package/{transformTsToJs → pipeline/transformTypescriptToJavascript}/removeTypes.d.ts +0 -0
- /package/{transformTsToJs → pipeline/transformTypescriptToJavascript}/removeTypes.js +0 -0
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
-
import { readFile } from 'node:fs/promises';
|
|
4
|
-
import { resolveImports } from "../loaderUtils/resolveImports.js";
|
|
5
|
-
import { resolveImportResultWithFs } from "../loaderUtils/resolveModulePathWithFs.js";
|
|
6
|
-
import { processImportsWithStoreAt } from "../loaderUtils/processImports.js";
|
|
7
|
-
import { isJavaScriptModule } from "../loaderUtils/resolveModulePath.js";
|
|
8
|
-
/**
|
|
9
|
-
* Default serverLoadSource function that reads a file and extracts its dependencies.
|
|
10
|
-
* This function is used to load source files for demos, resolving their imports and dependencies.
|
|
11
|
-
* It reads the source file, resolves its imports, and returns the processed source along with any
|
|
12
|
-
* additional files and dependencies that were found.
|
|
13
|
-
*/
|
|
14
|
-
export var serverLoadSource = createServerLoadSource();
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Creates a loadSource function that reads a file and extracts its dependencies.
|
|
18
|
-
*
|
|
19
|
-
* @param options.storeAt - Controls how imports are stored in extraFiles:
|
|
20
|
-
* - 'canonical': Full resolved path (e.g., '../Component/index.js')
|
|
21
|
-
* - 'import': Import path with file extension (e.g., '../Component.js')
|
|
22
|
-
* - 'flat': Flattened to current directory with rewritten imports (e.g., './Component.js')
|
|
23
|
-
*/
|
|
24
|
-
export function createServerLoadSource() {
|
|
25
|
-
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
|
-
var _options$includeDepen = options.includeDependencies,
|
|
27
|
-
includeDependencies = _options$includeDepen === void 0 ? true : _options$includeDepen,
|
|
28
|
-
_options$storeAt = options.storeAt,
|
|
29
|
-
storeAt = _options$storeAt === void 0 ? 'flat' : _options$storeAt;
|
|
30
|
-
return /*#__PURE__*/function () {
|
|
31
|
-
var _loadSource = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
32
|
-
var filePath, source, isJavascriptModuleFile, importResult, resolvedPathsMap, _processImportsWithSt, processedSource, extraFiles, extraDependencies;
|
|
33
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
|
-
while (1) switch (_context.prev = _context.next) {
|
|
35
|
-
case 0:
|
|
36
|
-
// Remove file:// prefix if present
|
|
37
|
-
filePath = url.replace('file://', ''); // Read the file
|
|
38
|
-
_context.next = 3;
|
|
39
|
-
return readFile(filePath, 'utf8');
|
|
40
|
-
case 3:
|
|
41
|
-
source = _context.sent;
|
|
42
|
-
if (includeDependencies) {
|
|
43
|
-
_context.next = 6;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
return _context.abrupt("return", {
|
|
47
|
-
source: source
|
|
48
|
-
});
|
|
49
|
-
case 6:
|
|
50
|
-
// Check if this is a static asset file (non-JS/TS modules)
|
|
51
|
-
isJavascriptModuleFile = isJavaScriptModule(filePath);
|
|
52
|
-
if (isJavascriptModuleFile) {
|
|
53
|
-
_context.next = 9;
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
return _context.abrupt("return", {
|
|
57
|
-
source: source
|
|
58
|
-
});
|
|
59
|
-
case 9:
|
|
60
|
-
_context.next = 11;
|
|
61
|
-
return resolveImports(source, filePath);
|
|
62
|
-
case 11:
|
|
63
|
-
importResult = _context.sent;
|
|
64
|
-
if (!(Object.keys(importResult).length === 0)) {
|
|
65
|
-
_context.next = 14;
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
return _context.abrupt("return", {
|
|
69
|
-
source: source
|
|
70
|
-
});
|
|
71
|
-
case 14:
|
|
72
|
-
_context.next = 16;
|
|
73
|
-
return resolveImportResultWithFs(importResult);
|
|
74
|
-
case 16:
|
|
75
|
-
resolvedPathsMap = _context.sent;
|
|
76
|
-
// Process imports using the consolidated helper function
|
|
77
|
-
_processImportsWithSt = processImportsWithStoreAt(source, importResult, resolvedPathsMap, storeAt), processedSource = _processImportsWithSt.processedSource, extraFiles = _processImportsWithSt.extraFiles; // Build dependencies list for recursive loading
|
|
78
|
-
extraDependencies = Object.values(importResult).map(function (_ref) {
|
|
79
|
-
var path = _ref.path;
|
|
80
|
-
return resolvedPathsMap.get(path);
|
|
81
|
-
}).filter(function (path) {
|
|
82
|
-
return path !== undefined;
|
|
83
|
-
});
|
|
84
|
-
return _context.abrupt("return", {
|
|
85
|
-
source: processedSource,
|
|
86
|
-
extraFiles: Object.keys(extraFiles).length > 0 ? extraFiles : undefined,
|
|
87
|
-
extraDependencies: extraDependencies.length > 0 ? extraDependencies : undefined
|
|
88
|
-
});
|
|
89
|
-
case 20:
|
|
90
|
-
case "end":
|
|
91
|
-
return _context.stop();
|
|
92
|
-
}
|
|
93
|
-
}, _callee);
|
|
94
|
-
}));
|
|
95
|
-
function loadSource(_x) {
|
|
96
|
-
return _loadSource.apply(this, arguments);
|
|
97
|
-
}
|
|
98
|
-
return loadSource;
|
|
99
|
-
}();
|
|
100
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getFileNameFromUrl.d.ts","sourceRoot":"","sources":["../../../src/loaderUtils/getFileNameFromUrl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAoBvF"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Extracts the filename and extension from a URL or file path.
|
|
3
|
-
* This function is isomorphic and works in both Node.js and browser environments.
|
|
4
|
-
*
|
|
5
|
-
* @param url - The URL or file path to extract the filename from
|
|
6
|
-
* @returns An object containing the filename and extension
|
|
7
|
-
*/
|
|
8
|
-
export function getFileNameFromUrl(url) {
|
|
9
|
-
try {
|
|
10
|
-
// Use URL constructor to handle various URL formats
|
|
11
|
-
var urlObj = new URL(url);
|
|
12
|
-
var pathname = urlObj.pathname;
|
|
13
|
-
var fileName = pathname.split('/').pop() || '';
|
|
14
|
-
|
|
15
|
-
// Extract extension (including the dot)
|
|
16
|
-
var lastDotIndex = fileName.lastIndexOf('.');
|
|
17
|
-
var extension = lastDotIndex > 0 ? fileName.substring(lastDotIndex) : '';
|
|
18
|
-
return {
|
|
19
|
-
fileName: fileName,
|
|
20
|
-
extension: extension
|
|
21
|
-
};
|
|
22
|
-
} catch (_unused) {
|
|
23
|
-
// If URL parsing fails, fall back to simple string manipulation
|
|
24
|
-
var _fileName = url.split('/').pop() || url;
|
|
25
|
-
var _lastDotIndex = _fileName.lastIndexOf('.');
|
|
26
|
-
var _extension = _lastDotIndex > 0 ? _fileName.substring(_lastDotIndex) : '';
|
|
27
|
-
return {
|
|
28
|
-
fileName: _fileName,
|
|
29
|
-
extension: _extension
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
}
|
package/loaderUtils/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/loaderUtils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
|
package/loaderUtils/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processImports.d.ts","sourceRoot":"","sources":["../../../src/loaderUtils/processImports.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,EAC/D,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,OAAO,EAAE,WAAW,GACnB,oBAAoB,CAsEtB"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import { rewriteImportsToSameDirectory } from "./rewriteImports.js";
|
|
3
|
-
import { isJavaScriptModule } from "./resolveModulePath.js";
|
|
4
|
-
import { getFileNameFromUrl } from "./getFileNameFromUrl.js";
|
|
5
|
-
/**
|
|
6
|
-
* Processes imports based on the specified storage mode, automatically handling
|
|
7
|
-
* source rewriting when needed (e.g., for 'flat' mode).
|
|
8
|
-
*
|
|
9
|
-
* @param source - The original source code
|
|
10
|
-
* @param importResult - The result from resolveImports
|
|
11
|
-
* @param resolvedPathsMap - Map from import paths to resolved file paths
|
|
12
|
-
* @param storeAt - How to process the imports
|
|
13
|
-
* @returns Object with processed source and extraFiles mapping
|
|
14
|
-
*/
|
|
15
|
-
export function processImportsWithStoreAt(source, importResult, resolvedPathsMap, storeAt) {
|
|
16
|
-
var processedSource = source;
|
|
17
|
-
var extraFiles = {};
|
|
18
|
-
|
|
19
|
-
// For flat mode, automatically rewrite imports to same directory
|
|
20
|
-
if (storeAt === 'flat') {
|
|
21
|
-
var allResolvedPaths = new Set(resolvedPathsMap.values());
|
|
22
|
-
processedSource = rewriteImportsToSameDirectory(source, allResolvedPaths);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Process each import and generate extraFiles
|
|
26
|
-
Object.entries(importResult).forEach(function (_ref) {
|
|
27
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
28
|
-
relativePath = _ref2[0],
|
|
29
|
-
importInfo = _ref2[1];
|
|
30
|
-
var resolvedPath = resolvedPathsMap.get(importInfo.path);
|
|
31
|
-
if (resolvedPath) {
|
|
32
|
-
var fileExtension = getFileNameFromUrl(resolvedPath).extension;
|
|
33
|
-
var isJavascriptModule = isJavaScriptModule(relativePath);
|
|
34
|
-
var keyPath;
|
|
35
|
-
if (!isJavascriptModule) {
|
|
36
|
-
// For static assets (CSS, JSON, etc.), use the original import path as-is since it already has the extension
|
|
37
|
-
switch (storeAt) {
|
|
38
|
-
case 'canonical':
|
|
39
|
-
case 'import':
|
|
40
|
-
keyPath = relativePath;
|
|
41
|
-
break;
|
|
42
|
-
case 'flat':
|
|
43
|
-
// For flat mode, use just the filename from the original import
|
|
44
|
-
keyPath = "./".concat(getFileNameFromUrl(relativePath).fileName);
|
|
45
|
-
break;
|
|
46
|
-
default:
|
|
47
|
-
keyPath = relativePath;
|
|
48
|
-
}
|
|
49
|
-
} else {
|
|
50
|
-
// For JS/TS modules, apply the existing logic
|
|
51
|
-
switch (storeAt) {
|
|
52
|
-
case 'canonical':
|
|
53
|
-
// Show the full resolved path including index files when they exist
|
|
54
|
-
// e.g., import '../Component' resolved to '/src/Component/index.js'
|
|
55
|
-
// becomes extraFiles: { '../Component/index.js': 'file:///src/Component/index.js' }
|
|
56
|
-
keyPath = "".concat(relativePath).concat(resolvedPath.endsWith("/index".concat(fileExtension)) ? "/index".concat(fileExtension) : fileExtension);
|
|
57
|
-
break;
|
|
58
|
-
case 'import':
|
|
59
|
-
// Use the original import path with the actual file extension
|
|
60
|
-
// e.g., import '../Component' with '/src/Component/index.js'
|
|
61
|
-
// becomes extraFiles: { '../Component.js': 'file:///src/Component/index.js' }
|
|
62
|
-
keyPath = "".concat(relativePath).concat(fileExtension);
|
|
63
|
-
break;
|
|
64
|
-
case 'flat':
|
|
65
|
-
// Flatten all files to current directory using just the filename
|
|
66
|
-
// e.g., import '../Component' with '/src/Component/index.js'
|
|
67
|
-
// becomes extraFiles: { './index.js': 'file:///src/Component/index.js' }
|
|
68
|
-
// Note: This mode also requires rewriting imports in the source code (handled above)
|
|
69
|
-
keyPath = "./".concat(getFileNameFromUrl(resolvedPath).fileName);
|
|
70
|
-
break;
|
|
71
|
-
default:
|
|
72
|
-
keyPath = "".concat(relativePath).concat(fileExtension);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
extraFiles[keyPath] = "file://".concat(resolvedPath);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
return {
|
|
79
|
-
processedSource: processedSource,
|
|
80
|
-
extraFiles: extraFiles
|
|
81
|
-
};
|
|
82
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveImports.d.ts","sourceRoot":"","sources":["../../../src/loaderUtils/resolveImports.ts"],"names":[],"mappings":"AAAA,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAAC,CAkC5D"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
-
export function resolveImports(_x, _x2) {
|
|
5
|
-
return _resolveImports.apply(this, arguments);
|
|
6
|
-
}
|
|
7
|
-
function _resolveImports() {
|
|
8
|
-
_resolveImports = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(code, filePath) {
|
|
9
|
-
var result, importRegex, importMatch, _loop;
|
|
10
|
-
return _regeneratorRuntime().wrap(function _callee$(_context2) {
|
|
11
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
12
|
-
case 0:
|
|
13
|
-
result = {};
|
|
14
|
-
importRegex = /import\s+(?:(\w+)|\*\s+as\s+(\w+)|{([^}]+)})\s+from\s+['"]([^'"]+)['"]/g;
|
|
15
|
-
importMatch = importRegex.exec(code);
|
|
16
|
-
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
17
|
-
var _importMatch, _importMatch2, defaultImport, namespaceImport, namedImportsStr, modulePath, basePath, resolvedPath, namedImports;
|
|
18
|
-
return _regeneratorRuntime().wrap(function _loop$(_context) {
|
|
19
|
-
while (1) switch (_context.prev = _context.next) {
|
|
20
|
-
case 0:
|
|
21
|
-
_importMatch = importMatch, _importMatch2 = _slicedToArray(_importMatch, 5), defaultImport = _importMatch2[1], namespaceImport = _importMatch2[2], namedImportsStr = _importMatch2[3], modulePath = _importMatch2[4]; // Only process relative imports
|
|
22
|
-
if (modulePath.startsWith('.')) {
|
|
23
|
-
basePath = filePath.substring(0, filePath.lastIndexOf('/'));
|
|
24
|
-
resolvedPath = new URL(modulePath, "file://".concat(basePath, "/")).pathname;
|
|
25
|
-
if (!result[modulePath]) {
|
|
26
|
-
result[modulePath] = {
|
|
27
|
-
path: resolvedPath,
|
|
28
|
-
names: []
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
if (defaultImport) {
|
|
32
|
-
result[modulePath].names.push(defaultImport);
|
|
33
|
-
} else if (namespaceImport) {
|
|
34
|
-
result[modulePath].names.push(namespaceImport);
|
|
35
|
-
} else if (namedImportsStr) {
|
|
36
|
-
// Handle named imports like { ComponentName, Component2 as Alias }
|
|
37
|
-
namedImports = namedImportsStr.split(',').map(function (s) {
|
|
38
|
-
return s.trim();
|
|
39
|
-
});
|
|
40
|
-
namedImports.forEach(function (namedImport) {
|
|
41
|
-
var cleanImport = namedImport.split(' as ')[0].trim();
|
|
42
|
-
result[modulePath].names.push(cleanImport);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
importMatch = importRegex.exec(code);
|
|
47
|
-
case 3:
|
|
48
|
-
case "end":
|
|
49
|
-
return _context.stop();
|
|
50
|
-
}
|
|
51
|
-
}, _loop);
|
|
52
|
-
});
|
|
53
|
-
case 4:
|
|
54
|
-
if (!(importMatch !== null)) {
|
|
55
|
-
_context2.next = 8;
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
return _context2.delegateYield(_loop(), "t0", 6);
|
|
59
|
-
case 6:
|
|
60
|
-
_context2.next = 4;
|
|
61
|
-
break;
|
|
62
|
-
case 8:
|
|
63
|
-
return _context2.abrupt("return", result);
|
|
64
|
-
case 9:
|
|
65
|
-
case "end":
|
|
66
|
-
return _context2.stop();
|
|
67
|
-
}
|
|
68
|
-
}, _callee);
|
|
69
|
-
}));
|
|
70
|
-
return _resolveImports.apply(this, arguments);
|
|
71
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveModulePath.d.ts","sourceRoot":"","sources":["../../../src/loaderUtils/resolveModulePath.ts"],"names":[],"mappings":"AA4BA;;GAEG;AACH,eAAO,MAAM,4BAA4B,yCAA0C,CAAC;AAEpF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOxD;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AAE1E,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,eAAe,EAC9B,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,MAAM,CAAC,CA2FjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,EAAE,EACrB,aAAa,EAAE,eAAe,EAC9B,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAiJ9B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CACvC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,EAC/D,aAAa,EAAE,eAAe,EAC9B,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAmC9B;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,aAAa,EAAE,eAAe,EAC9B,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgB9B"}
|