@mui/internal-docs-infra 0.1.1-alpha.1 → 0.1.1-alpha.10
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/{loadPrecomputedCodeHighlighter → pipeline/loadPrecomputedCodeHighlighter}/loadPrecomputedCodeHighlighter.js +105 -75
- 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/pipeline/loaderUtils/getFileNameFromUrl.d.ts.map +1 -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 +329 -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 +13 -11
- package/useCode/useCode.d.ts.map +1 -1
- package/useCode/useCode.js +93 -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 +48 -0
- package/useCode/useFileNavigation.d.ts.map +1 -0
- package/useCode/useFileNavigation.js +370 -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 +78 -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/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/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/{loaderUtils → pipeline/loaderUtils}/getFileNameFromUrl.d.ts +0 -0
- /package/{loaderUtils → pipeline/loaderUtils}/getFileNameFromUrl.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,10 +1,11 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
5
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
5
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
6
7
|
import { loadVariant } from "./loadVariant.js";
|
|
7
|
-
import { getFileNameFromUrl } from "../loaderUtils/index.js";
|
|
8
|
+
import { getFileNameFromUrl } from "../pipeline/loaderUtils/index.js";
|
|
8
9
|
|
|
9
10
|
// Helper function to get the source for a specific filename from a variant
|
|
10
11
|
function getFileSource(_x, _x2, _x3) {
|
|
@@ -16,51 +17,66 @@ function _getFileSource() {
|
|
|
16
17
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
17
18
|
while (1) switch (_context.prev = _context.next) {
|
|
18
19
|
case 0:
|
|
19
|
-
filename = requestedFilename || variant.fileName;
|
|
20
|
+
filename = requestedFilename || variant.fileName;
|
|
21
|
+
if (filename) {
|
|
22
|
+
_context.next = 5;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
if (!(variant.source !== undefined)) {
|
|
26
|
+
_context.next = 4;
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
return _context.abrupt("return", {
|
|
30
|
+
source: variant.source,
|
|
31
|
+
filename: undefined
|
|
32
|
+
});
|
|
33
|
+
case 4:
|
|
34
|
+
throw new Error('No filename available and no source in variant');
|
|
35
|
+
case 5:
|
|
20
36
|
if (!(filename === variant.fileName && variant.source !== undefined)) {
|
|
21
|
-
_context.next =
|
|
37
|
+
_context.next = 7;
|
|
22
38
|
break;
|
|
23
39
|
}
|
|
24
40
|
return _context.abrupt("return", {
|
|
25
41
|
source: variant.source,
|
|
26
42
|
filename: filename
|
|
27
43
|
});
|
|
28
|
-
case
|
|
44
|
+
case 7:
|
|
29
45
|
if (!(filename !== variant.fileName && variant.extraFiles)) {
|
|
30
|
-
_context.next =
|
|
46
|
+
_context.next = 18;
|
|
31
47
|
break;
|
|
32
48
|
}
|
|
33
49
|
extraFile = variant.extraFiles[filename];
|
|
34
50
|
if (!(extraFile && typeof extraFile !== 'string' && extraFile.source !== undefined)) {
|
|
35
|
-
_context.next =
|
|
51
|
+
_context.next = 11;
|
|
36
52
|
break;
|
|
37
53
|
}
|
|
38
54
|
return _context.abrupt("return", {
|
|
39
55
|
source: extraFile.source,
|
|
40
56
|
filename: filename
|
|
41
57
|
});
|
|
42
|
-
case
|
|
58
|
+
case 11:
|
|
43
59
|
if (!(typeof extraFile === 'string' && loadSource)) {
|
|
44
|
-
_context.next =
|
|
60
|
+
_context.next = 16;
|
|
45
61
|
break;
|
|
46
62
|
}
|
|
47
|
-
_context.next =
|
|
63
|
+
_context.next = 14;
|
|
48
64
|
return loadSource(extraFile);
|
|
49
|
-
case
|
|
65
|
+
case 14:
|
|
50
66
|
loadResult = _context.sent;
|
|
51
67
|
return _context.abrupt("return", {
|
|
52
68
|
source: loadResult.source,
|
|
53
69
|
filename: filename
|
|
54
70
|
});
|
|
55
|
-
case
|
|
71
|
+
case 16:
|
|
56
72
|
if (!(extraFile && typeof extraFile !== 'string' && !extraFile.source && loadSource)) {
|
|
57
|
-
_context.next =
|
|
73
|
+
_context.next = 18;
|
|
58
74
|
break;
|
|
59
75
|
}
|
|
60
76
|
throw new Error("Extra file ".concat(filename, " has no source or URL to load from"));
|
|
61
|
-
case
|
|
77
|
+
case 18:
|
|
62
78
|
throw new Error("File ".concat(filename, " not found in variant or cannot be loaded"));
|
|
63
|
-
case
|
|
79
|
+
case 19:
|
|
64
80
|
case "end":
|
|
65
81
|
return _context.stop();
|
|
66
82
|
}
|
|
@@ -68,55 +84,57 @@ function _getFileSource() {
|
|
|
68
84
|
}));
|
|
69
85
|
return _getFileSource.apply(this, arguments);
|
|
70
86
|
}
|
|
71
|
-
export function loadFallbackCode(_x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12, _x13) {
|
|
87
|
+
export function loadFallbackCode(_x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10, _x11, _x12, _x13, _x14) {
|
|
72
88
|
return _loadFallbackCode.apply(this, arguments);
|
|
73
89
|
}
|
|
74
90
|
function _loadFallbackCode() {
|
|
75
|
-
_loadFallbackCode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
76
|
-
var initial, _allFileNames, fileSource, actualFilename, result, parseSource, quickVariant, _allFileNames2, _fileSource, _actualFilename, _result, _parseSource, _yield$loadVariant, loadedVariant, allFileNames, allVariants, variantPromises, variantResults, finalInitial, finalFileSource, finalFilename, _result2;
|
|
77
|
-
return _regeneratorRuntime().wrap(function
|
|
78
|
-
while (1) switch (
|
|
91
|
+
_loadFallbackCode = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(url, initialVariant, loaded, shouldHighlight, fallbackUsesExtraFiles, fallbackUsesAllVariants, sourceParser, loadSource, loadVariantMeta, loadCodeMeta, initialFilename, variants, globalsCode) {
|
|
92
|
+
var initial, _allFileNames, fileSource, actualFilename, result, parseSource, quickVariant, _allFileNames2, _fileSource, _actualFilename, _result, _parseSource, globalsCodeObjects, hasStringUrls, globalsPromises, resolvedGlobalsCode, _iterator, _step, codeObj, targetVariant, _yield$loadVariant, loadedVariant, allFileNames, allVariants, variantPromises, variantResults, finalInitial, finalFileSource, finalFilename, _result2;
|
|
93
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
94
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
79
95
|
case 0:
|
|
80
96
|
loaded = _objectSpread({}, loaded);
|
|
81
97
|
|
|
82
98
|
// Step 1: Ensure we have the initial variant loaded
|
|
83
99
|
initial = loaded[initialVariant];
|
|
84
100
|
if (initial) {
|
|
85
|
-
|
|
101
|
+
_context4.next = 17;
|
|
86
102
|
break;
|
|
87
103
|
}
|
|
88
104
|
if (loadCodeMeta) {
|
|
89
|
-
|
|
105
|
+
_context4.next = 5;
|
|
90
106
|
break;
|
|
91
107
|
}
|
|
92
108
|
throw new Error('"loadCodeMeta" function is required when initial variant is not provided');
|
|
93
109
|
case 5:
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
_context4.prev = 5;
|
|
111
|
+
_context4.next = 8;
|
|
96
112
|
return loadCodeMeta(url);
|
|
97
113
|
case 8:
|
|
98
|
-
loaded =
|
|
99
|
-
|
|
114
|
+
loaded = _context4.sent;
|
|
115
|
+
_context4.next = 14;
|
|
100
116
|
break;
|
|
101
117
|
case 11:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
throw new Error("Failed to load code from URL: ".concat(url, ". Error: ").concat(JSON.stringify(
|
|
118
|
+
_context4.prev = 11;
|
|
119
|
+
_context4.t0 = _context4["catch"](5);
|
|
120
|
+
throw new Error("Failed to load code from URL: ".concat(url, ". Error: ").concat(JSON.stringify(_context4.t0)));
|
|
105
121
|
case 14:
|
|
106
122
|
initial = loaded[initialVariant];
|
|
107
123
|
if (initial) {
|
|
108
|
-
|
|
124
|
+
_context4.next = 17;
|
|
109
125
|
break;
|
|
110
126
|
}
|
|
111
127
|
throw new Error("Initial variant \"".concat(initialVariant, "\" not found in loaded code."));
|
|
112
128
|
case 17:
|
|
113
129
|
if (!(typeof initial !== 'string' && initial.allFilesListed && !fallbackUsesExtraFiles && !fallbackUsesAllVariants)) {
|
|
114
|
-
|
|
130
|
+
_context4.next = 48;
|
|
115
131
|
break;
|
|
116
132
|
}
|
|
117
133
|
// Collect all file names from the loaded code
|
|
118
134
|
_allFileNames = new Set();
|
|
119
|
-
|
|
135
|
+
if (initial.fileName) {
|
|
136
|
+
_allFileNames.add(initial.fileName);
|
|
137
|
+
}
|
|
120
138
|
if (initial.extraFiles) {
|
|
121
139
|
Object.keys(initial.extraFiles).forEach(function (fileName) {
|
|
122
140
|
return _allFileNames.add(fileName);
|
|
@@ -124,39 +142,60 @@ function _loadFallbackCode() {
|
|
|
124
142
|
}
|
|
125
143
|
|
|
126
144
|
// Get the source for the requested filename (or main file if not specified)
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
_context4.prev = 21;
|
|
146
|
+
_context4.next = 24;
|
|
129
147
|
return getFileSource(initial, initialFilename, loadSource);
|
|
130
148
|
case 24:
|
|
131
|
-
result =
|
|
149
|
+
result = _context4.sent;
|
|
132
150
|
fileSource = result.source;
|
|
133
151
|
actualFilename = result.filename;
|
|
134
|
-
|
|
152
|
+
_context4.next = 32;
|
|
135
153
|
break;
|
|
136
154
|
case 29:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
throw new Error("Failed to get source for file ".concat(initialFilename || initial.fileName, " in variant ").concat(initialVariant, ": ").concat(
|
|
155
|
+
_context4.prev = 29;
|
|
156
|
+
_context4.t1 = _context4["catch"](21);
|
|
157
|
+
throw new Error("Failed to get source for file ".concat(initialFilename || initial.fileName, " in variant ").concat(initialVariant, ": ").concat(_context4.t1));
|
|
140
158
|
case 32:
|
|
141
|
-
if (!(shouldHighlight && typeof fileSource === 'string' && sourceParser)) {
|
|
142
|
-
|
|
159
|
+
if (!(shouldHighlight && typeof fileSource === 'string' && sourceParser && actualFilename)) {
|
|
160
|
+
_context4.next = 45;
|
|
143
161
|
break;
|
|
144
162
|
}
|
|
145
|
-
|
|
146
|
-
|
|
163
|
+
_context4.prev = 33;
|
|
164
|
+
_context4.next = 36;
|
|
147
165
|
return sourceParser;
|
|
148
166
|
case 36:
|
|
149
|
-
parseSource =
|
|
167
|
+
parseSource = _context4.sent;
|
|
150
168
|
fileSource = parseSource(fileSource, actualFilename);
|
|
151
|
-
|
|
169
|
+
_context4.next = 43;
|
|
152
170
|
break;
|
|
153
171
|
case 40:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
throw new Error("Failed to parse source for highlighting (variant: ".concat(initialVariant, ", file: ").concat(actualFilename, "): ").concat(JSON.stringify(
|
|
172
|
+
_context4.prev = 40;
|
|
173
|
+
_context4.t2 = _context4["catch"](33);
|
|
174
|
+
throw new Error("Failed to parse source for highlighting (variant: ".concat(initialVariant, ", file: ").concat(actualFilename, "): ").concat(JSON.stringify(_context4.t2)));
|
|
157
175
|
case 43:
|
|
176
|
+
_context4.next = 46;
|
|
177
|
+
break;
|
|
178
|
+
case 45:
|
|
179
|
+
if (shouldHighlight && typeof fileSource === 'string' && !actualFilename) {
|
|
180
|
+
// Create basic HAST node when we can't parse due to missing filename
|
|
181
|
+
// This marks that the source has passed through the parsing pipeline
|
|
182
|
+
fileSource = {
|
|
183
|
+
type: 'root',
|
|
184
|
+
children: [{
|
|
185
|
+
type: 'text',
|
|
186
|
+
value: fileSource
|
|
187
|
+
}]
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
case 46:
|
|
158
191
|
// Update the loaded code with any changes we made
|
|
159
|
-
if (actualFilename === initial.fileName) {
|
|
192
|
+
if (actualFilename && actualFilename === initial.fileName) {
|
|
193
|
+
initial = _objectSpread(_objectSpread({}, initial), {}, {
|
|
194
|
+
source: fileSource
|
|
195
|
+
});
|
|
196
|
+
loaded = _objectSpread(_objectSpread({}, loaded), {}, _defineProperty({}, initialVariant, initial));
|
|
197
|
+
} else if (!actualFilename && !initial.fileName) {
|
|
198
|
+
// If both are undefined, we're dealing with the main source
|
|
160
199
|
initial = _objectSpread(_objectSpread({}, initial), {}, {
|
|
161
200
|
source: fileSource
|
|
162
201
|
});
|
|
@@ -164,47 +203,49 @@ function _loadFallbackCode() {
|
|
|
164
203
|
}
|
|
165
204
|
|
|
166
205
|
// Early return - we have all the info we need
|
|
167
|
-
return
|
|
206
|
+
return _context4.abrupt("return", {
|
|
168
207
|
code: loaded,
|
|
169
208
|
initialFilename: actualFilename,
|
|
170
209
|
initialSource: fileSource,
|
|
171
210
|
initialExtraFiles: initial.extraFiles || {},
|
|
172
211
|
allFileNames: Array.from(_allFileNames)
|
|
173
212
|
});
|
|
174
|
-
case
|
|
213
|
+
case 48:
|
|
175
214
|
if (!(typeof initial === 'string')) {
|
|
176
|
-
|
|
215
|
+
_context4.next = 95;
|
|
177
216
|
break;
|
|
178
217
|
}
|
|
179
|
-
|
|
218
|
+
_context4.prev = 49;
|
|
180
219
|
if (!loadVariantMeta) {
|
|
181
|
-
|
|
220
|
+
_context4.next = 56;
|
|
182
221
|
break;
|
|
183
222
|
}
|
|
184
|
-
|
|
223
|
+
_context4.next = 53;
|
|
185
224
|
return loadVariantMeta(initialVariant, initial);
|
|
186
|
-
case 50:
|
|
187
|
-
quickVariant = _context3.sent;
|
|
188
|
-
_context3.next = 54;
|
|
189
|
-
break;
|
|
190
225
|
case 53:
|
|
226
|
+
quickVariant = _context4.sent;
|
|
227
|
+
_context4.next = 57;
|
|
228
|
+
break;
|
|
229
|
+
case 56:
|
|
191
230
|
// Create a basic variant using fallback logic
|
|
192
231
|
quickVariant = {
|
|
193
232
|
url: initial,
|
|
194
233
|
fileName: getFileNameFromUrl(initial).fileName
|
|
195
234
|
};
|
|
196
|
-
case
|
|
235
|
+
case 57:
|
|
197
236
|
loaded = _objectSpread(_objectSpread({}, loaded), {}, _defineProperty({}, initialVariant, quickVariant));
|
|
198
237
|
initial = quickVariant;
|
|
199
238
|
|
|
200
239
|
// If we have all files listed and don't need extra file processing, we can optimize
|
|
201
240
|
if (!(quickVariant.allFilesListed && !fallbackUsesExtraFiles && !fallbackUsesAllVariants)) {
|
|
202
|
-
|
|
241
|
+
_context4.next = 90;
|
|
203
242
|
break;
|
|
204
243
|
}
|
|
205
244
|
// Collect all file names from the quick load
|
|
206
245
|
_allFileNames2 = new Set();
|
|
207
|
-
|
|
246
|
+
if (quickVariant.fileName) {
|
|
247
|
+
_allFileNames2.add(quickVariant.fileName);
|
|
248
|
+
}
|
|
208
249
|
if (quickVariant.extraFiles) {
|
|
209
250
|
Object.keys(quickVariant.extraFiles).forEach(function (fileName) {
|
|
210
251
|
return _allFileNames2.add(fileName);
|
|
@@ -212,39 +253,60 @@ function _loadFallbackCode() {
|
|
|
212
253
|
}
|
|
213
254
|
|
|
214
255
|
// Get the source for the requested filename (or main file if not specified)
|
|
215
|
-
|
|
216
|
-
|
|
256
|
+
_context4.prev = 63;
|
|
257
|
+
_context4.next = 66;
|
|
217
258
|
return getFileSource(quickVariant, initialFilename, loadSource);
|
|
218
|
-
case
|
|
219
|
-
_result =
|
|
259
|
+
case 66:
|
|
260
|
+
_result = _context4.sent;
|
|
220
261
|
_fileSource = _result.source;
|
|
221
262
|
_actualFilename = _result.filename;
|
|
222
|
-
|
|
263
|
+
_context4.next = 74;
|
|
223
264
|
break;
|
|
224
|
-
case 68:
|
|
225
|
-
_context3.prev = 68;
|
|
226
|
-
_context3.t3 = _context3["catch"](60);
|
|
227
|
-
throw new Error("Failed to get source for file ".concat(initialFilename || quickVariant.fileName, " in variant ").concat(initialVariant, ": ").concat(_context3.t3));
|
|
228
265
|
case 71:
|
|
229
|
-
|
|
230
|
-
|
|
266
|
+
_context4.prev = 71;
|
|
267
|
+
_context4.t3 = _context4["catch"](63);
|
|
268
|
+
throw new Error("Failed to get source for file ".concat(initialFilename || quickVariant.fileName, " in variant ").concat(initialVariant, ": ").concat(_context4.t3));
|
|
269
|
+
case 74:
|
|
270
|
+
if (!(shouldHighlight && typeof _fileSource === 'string' && sourceParser && _actualFilename)) {
|
|
271
|
+
_context4.next = 87;
|
|
231
272
|
break;
|
|
232
273
|
}
|
|
233
|
-
|
|
234
|
-
|
|
274
|
+
_context4.prev = 75;
|
|
275
|
+
_context4.next = 78;
|
|
235
276
|
return sourceParser;
|
|
236
|
-
case
|
|
237
|
-
_parseSource =
|
|
277
|
+
case 78:
|
|
278
|
+
_parseSource = _context4.sent;
|
|
238
279
|
_fileSource = _parseSource(_fileSource, _actualFilename);
|
|
239
|
-
|
|
280
|
+
_context4.next = 85;
|
|
240
281
|
break;
|
|
241
|
-
case 79:
|
|
242
|
-
_context3.prev = 79;
|
|
243
|
-
_context3.t4 = _context3["catch"](72);
|
|
244
|
-
throw new Error("Failed to parse source for highlighting (variant: ".concat(initialVariant, ", file: ").concat(_actualFilename, "): ").concat(JSON.stringify(_context3.t4)));
|
|
245
282
|
case 82:
|
|
283
|
+
_context4.prev = 82;
|
|
284
|
+
_context4.t4 = _context4["catch"](75);
|
|
285
|
+
throw new Error("Failed to parse source for highlighting (variant: ".concat(initialVariant, ", file: ").concat(_actualFilename, "): ").concat(JSON.stringify(_context4.t4)));
|
|
286
|
+
case 85:
|
|
287
|
+
_context4.next = 88;
|
|
288
|
+
break;
|
|
289
|
+
case 87:
|
|
290
|
+
if (shouldHighlight && typeof _fileSource === 'string' && !_actualFilename) {
|
|
291
|
+
// Create basic HAST node when we can't parse due to missing filename
|
|
292
|
+
// This marks that the source has passed through the parsing pipeline
|
|
293
|
+
_fileSource = {
|
|
294
|
+
type: 'root',
|
|
295
|
+
children: [{
|
|
296
|
+
type: 'text',
|
|
297
|
+
value: _fileSource
|
|
298
|
+
}]
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
case 88:
|
|
246
302
|
// Update the loaded code with any changes we made
|
|
247
|
-
if (_actualFilename === quickVariant.fileName) {
|
|
303
|
+
if (_actualFilename && _actualFilename === quickVariant.fileName) {
|
|
304
|
+
initial = _objectSpread(_objectSpread({}, quickVariant), {}, {
|
|
305
|
+
source: _fileSource
|
|
306
|
+
});
|
|
307
|
+
loaded = _objectSpread(_objectSpread({}, loaded), {}, _defineProperty({}, initialVariant, initial));
|
|
308
|
+
} else if (!_actualFilename && !quickVariant.fileName) {
|
|
309
|
+
// If both are undefined, we're dealing with the main source
|
|
248
310
|
initial = _objectSpread(_objectSpread({}, quickVariant), {}, {
|
|
249
311
|
source: _fileSource
|
|
250
312
|
});
|
|
@@ -252,46 +314,120 @@ function _loadFallbackCode() {
|
|
|
252
314
|
}
|
|
253
315
|
|
|
254
316
|
// Early return - we have all the info we need
|
|
255
|
-
return
|
|
317
|
+
return _context4.abrupt("return", {
|
|
256
318
|
code: loaded,
|
|
257
319
|
initialFilename: _actualFilename,
|
|
258
320
|
initialSource: _fileSource,
|
|
259
321
|
initialExtraFiles: quickVariant.extraFiles || {},
|
|
260
322
|
allFileNames: Array.from(_allFileNames2)
|
|
261
323
|
});
|
|
262
|
-
case
|
|
263
|
-
|
|
324
|
+
case 90:
|
|
325
|
+
_context4.next = 95;
|
|
264
326
|
break;
|
|
265
|
-
case
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
throw new Error("Failed to load initial variant code (variant: ".concat(initialVariant, ", url: ").concat(initial, "): ").concat(JSON.stringify(
|
|
269
|
-
case
|
|
270
|
-
|
|
271
|
-
|
|
327
|
+
case 92:
|
|
328
|
+
_context4.prev = 92;
|
|
329
|
+
_context4.t5 = _context4["catch"](49);
|
|
330
|
+
throw new Error("Failed to load initial variant code (variant: ".concat(initialVariant, ", url: ").concat(initial, "): ").concat(JSON.stringify(_context4.t5)));
|
|
331
|
+
case 95:
|
|
332
|
+
if (!(globalsCode && globalsCode.length > 0)) {
|
|
333
|
+
_context4.next = 103;
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
hasStringUrls = globalsCode.some(function (item) {
|
|
337
|
+
return typeof item === 'string';
|
|
338
|
+
});
|
|
339
|
+
if (!(hasStringUrls && !loadCodeMeta)) {
|
|
340
|
+
_context4.next = 99;
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
throw new Error('loadCodeMeta function is required when globalsCode contains string URLs');
|
|
344
|
+
case 99:
|
|
345
|
+
// Load all string URLs in parallel, keep Code objects as-is
|
|
346
|
+
globalsPromises = globalsCode.map(/*#__PURE__*/function () {
|
|
347
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(globalItem) {
|
|
348
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
349
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
350
|
+
case 0:
|
|
351
|
+
if (!(typeof globalItem === 'string')) {
|
|
352
|
+
_context2.next = 12;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
_context2.prev = 1;
|
|
356
|
+
_context2.next = 4;
|
|
357
|
+
return loadCodeMeta(globalItem);
|
|
358
|
+
case 4:
|
|
359
|
+
return _context2.abrupt("return", _context2.sent);
|
|
360
|
+
case 7:
|
|
361
|
+
_context2.prev = 7;
|
|
362
|
+
_context2.t0 = _context2["catch"](1);
|
|
363
|
+
throw new Error("Failed to load globalsCode from URL: ".concat(globalItem, ". Error: ").concat(JSON.stringify(_context2.t0)));
|
|
364
|
+
case 10:
|
|
365
|
+
_context2.next = 13;
|
|
366
|
+
break;
|
|
367
|
+
case 12:
|
|
368
|
+
return _context2.abrupt("return", globalItem);
|
|
369
|
+
case 13:
|
|
370
|
+
case "end":
|
|
371
|
+
return _context2.stop();
|
|
372
|
+
}
|
|
373
|
+
}, _callee2, null, [[1, 7]]);
|
|
374
|
+
}));
|
|
375
|
+
return function (_x15) {
|
|
376
|
+
return _ref.apply(this, arguments);
|
|
377
|
+
};
|
|
378
|
+
}());
|
|
379
|
+
_context4.next = 102;
|
|
380
|
+
return Promise.all(globalsPromises);
|
|
381
|
+
case 102:
|
|
382
|
+
globalsCodeObjects = _context4.sent;
|
|
383
|
+
case 103:
|
|
384
|
+
if (globalsCodeObjects && globalsCodeObjects.length > 0) {
|
|
385
|
+
resolvedGlobalsCode = [];
|
|
386
|
+
_iterator = _createForOfIteratorHelper(globalsCodeObjects);
|
|
387
|
+
try {
|
|
388
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
389
|
+
codeObj = _step.value;
|
|
390
|
+
// Only use the variant that matches the current initialVariant
|
|
391
|
+
targetVariant = codeObj[initialVariant];
|
|
392
|
+
if (targetVariant) {
|
|
393
|
+
resolvedGlobalsCode.push(targetVariant);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
} catch (err) {
|
|
397
|
+
_iterator.e(err);
|
|
398
|
+
} finally {
|
|
399
|
+
_iterator.f();
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
_context4.prev = 104;
|
|
403
|
+
_context4.next = 107;
|
|
272
404
|
return loadVariant(url, initialVariant, initial, sourceParser, loadSource, loadVariantMeta, undefined,
|
|
273
405
|
// sourceTransformers - skip transforms for fallback
|
|
274
406
|
{
|
|
275
407
|
disableTransforms: true,
|
|
276
408
|
// Don't apply transforms for fallback
|
|
277
|
-
disableParsing: !shouldHighlight
|
|
409
|
+
disableParsing: !shouldHighlight,
|
|
410
|
+
// Only parse if highlighting is needed
|
|
411
|
+
globalsCode: resolvedGlobalsCode // Pass resolved globalsCode
|
|
278
412
|
});
|
|
279
|
-
case
|
|
280
|
-
_yield$loadVariant =
|
|
413
|
+
case 107:
|
|
414
|
+
_yield$loadVariant = _context4.sent;
|
|
281
415
|
loadedVariant = _yield$loadVariant.code;
|
|
282
416
|
// Update the loaded code with the processed variant
|
|
283
417
|
loaded = _objectSpread(_objectSpread({}, loaded), {}, _defineProperty({}, initialVariant, loadedVariant));
|
|
284
418
|
initial = loadedVariant;
|
|
285
|
-
|
|
419
|
+
_context4.next = 116;
|
|
286
420
|
break;
|
|
287
|
-
case
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
throw new Error("Failed to load initial variant using loadVariant (variant: ".concat(initialVariant, ", url: ").concat(url, "): ").concat(JSON.stringify(
|
|
291
|
-
case
|
|
421
|
+
case 113:
|
|
422
|
+
_context4.prev = 113;
|
|
423
|
+
_context4.t6 = _context4["catch"](104);
|
|
424
|
+
throw new Error("Failed to load initial variant using loadVariant (variant: ".concat(initialVariant, ", url: ").concat(url, "): ").concat(JSON.stringify(_context4.t6)));
|
|
425
|
+
case 116:
|
|
292
426
|
// Step 3: Collect all file names
|
|
293
427
|
allFileNames = new Set();
|
|
294
|
-
|
|
428
|
+
if (initial.fileName) {
|
|
429
|
+
allFileNames.add(initial.fileName);
|
|
430
|
+
}
|
|
295
431
|
|
|
296
432
|
// Add extra files from the initial variant
|
|
297
433
|
if (initial.extraFiles) {
|
|
@@ -302,32 +438,32 @@ function _loadFallbackCode() {
|
|
|
302
438
|
|
|
303
439
|
// Step 4: Handle fallbackUsesAllVariants - load all variants to get all possible files
|
|
304
440
|
if (!fallbackUsesAllVariants) {
|
|
305
|
-
|
|
441
|
+
_context4.next = 130;
|
|
306
442
|
break;
|
|
307
443
|
}
|
|
308
444
|
// Determine all variants to process - use provided variants or infer from loaded code
|
|
309
445
|
allVariants = variants || Object.keys(loaded || {});
|
|
310
446
|
if (!(allVariants.length === 0)) {
|
|
311
|
-
|
|
447
|
+
_context4.next = 125;
|
|
312
448
|
break;
|
|
313
449
|
}
|
|
314
450
|
console.warn('No variants found for fallbackUsesAllVariants processing');
|
|
315
|
-
|
|
451
|
+
_context4.next = 130;
|
|
316
452
|
break;
|
|
317
|
-
case
|
|
453
|
+
case 125:
|
|
318
454
|
// Process all required variants, not just the ones already loaded
|
|
319
455
|
variantPromises = allVariants.map(/*#__PURE__*/function () {
|
|
320
|
-
var
|
|
456
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(variantName) {
|
|
321
457
|
var _loaded;
|
|
322
458
|
var variant, allCode, _yield$loadVariant2, _loadedVariant, fileNames;
|
|
323
|
-
return _regeneratorRuntime().wrap(function
|
|
324
|
-
while (1) switch (
|
|
459
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
460
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
325
461
|
case 0:
|
|
326
462
|
if (!(variantName === initialVariant)) {
|
|
327
|
-
|
|
463
|
+
_context3.next = 2;
|
|
328
464
|
break;
|
|
329
465
|
}
|
|
330
|
-
return
|
|
466
|
+
return _context3.abrupt("return", {
|
|
331
467
|
variantName: variantName,
|
|
332
468
|
loadedVariant: null,
|
|
333
469
|
fileNames: []
|
|
@@ -335,90 +471,111 @@ function _loadFallbackCode() {
|
|
|
335
471
|
case 2:
|
|
336
472
|
variant = (_loaded = loaded) == null ? void 0 : _loaded[variantName]; // If variant is not loaded yet, load it first using loadCodeMeta
|
|
337
473
|
if (!(!variant && loadCodeMeta)) {
|
|
338
|
-
|
|
474
|
+
_context3.next = 16;
|
|
339
475
|
break;
|
|
340
476
|
}
|
|
341
|
-
|
|
342
|
-
|
|
477
|
+
_context3.prev = 4;
|
|
478
|
+
_context3.next = 7;
|
|
343
479
|
return loadCodeMeta(url);
|
|
344
480
|
case 7:
|
|
345
|
-
allCode =
|
|
481
|
+
allCode = _context3.sent;
|
|
346
482
|
variant = allCode[variantName];
|
|
347
483
|
// Update loaded with all variants from loadCodeMeta
|
|
348
484
|
loaded = _objectSpread(_objectSpread({}, loaded), allCode);
|
|
349
|
-
|
|
485
|
+
_context3.next = 16;
|
|
350
486
|
break;
|
|
351
487
|
case 12:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
console.warn("Failed to load code meta for variant ".concat(variantName, ": ").concat(
|
|
355
|
-
return
|
|
488
|
+
_context3.prev = 12;
|
|
489
|
+
_context3.t0 = _context3["catch"](4);
|
|
490
|
+
console.warn("Failed to load code meta for variant ".concat(variantName, ": ").concat(_context3.t0));
|
|
491
|
+
return _context3.abrupt("return", {
|
|
356
492
|
variantName: variantName,
|
|
357
493
|
loadedVariant: null,
|
|
358
494
|
fileNames: []
|
|
359
495
|
});
|
|
360
496
|
case 16:
|
|
361
497
|
if (variant) {
|
|
362
|
-
|
|
498
|
+
_context3.next = 19;
|
|
363
499
|
break;
|
|
364
500
|
}
|
|
365
501
|
console.warn("Variant ".concat(variantName, " not found after loading code meta"));
|
|
366
|
-
return
|
|
502
|
+
return _context3.abrupt("return", {
|
|
367
503
|
variantName: variantName,
|
|
368
504
|
loadedVariant: null,
|
|
369
505
|
fileNames: []
|
|
370
506
|
});
|
|
371
507
|
case 19:
|
|
372
|
-
|
|
373
|
-
|
|
508
|
+
_context3.prev = 19;
|
|
509
|
+
_context3.next = 22;
|
|
374
510
|
return loadVariant(url, variantName, variant, sourceParser, loadSource, loadVariantMeta, undefined,
|
|
375
511
|
// sourceTransformers
|
|
376
512
|
{
|
|
377
513
|
disableTransforms: true,
|
|
378
|
-
disableParsing: !shouldHighlight
|
|
514
|
+
disableParsing: !shouldHighlight,
|
|
515
|
+
globalsCode: globalsCodeObjects && globalsCodeObjects.length > 0 ? function () {
|
|
516
|
+
// Convert globalsCodeObjects to VariantCode | string for this specific variant
|
|
517
|
+
var variantGlobalsCode = [];
|
|
518
|
+
var _iterator2 = _createForOfIteratorHelper(globalsCodeObjects),
|
|
519
|
+
_step2;
|
|
520
|
+
try {
|
|
521
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
522
|
+
var _codeObj = _step2.value;
|
|
523
|
+
// Only use the variant that matches the current variantName
|
|
524
|
+
var _targetVariant = _codeObj[variantName];
|
|
525
|
+
if (_targetVariant) {
|
|
526
|
+
variantGlobalsCode.push(_targetVariant);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
} catch (err) {
|
|
530
|
+
_iterator2.e(err);
|
|
531
|
+
} finally {
|
|
532
|
+
_iterator2.f();
|
|
533
|
+
}
|
|
534
|
+
return variantGlobalsCode;
|
|
535
|
+
}() : undefined
|
|
379
536
|
});
|
|
380
537
|
case 22:
|
|
381
|
-
_yield$loadVariant2 =
|
|
538
|
+
_yield$loadVariant2 = _context3.sent;
|
|
382
539
|
_loadedVariant = _yield$loadVariant2.code;
|
|
383
540
|
// Collect file names from this variant
|
|
384
|
-
fileNames = [_loadedVariant.fileName];
|
|
541
|
+
fileNames = _loadedVariant.fileName ? [_loadedVariant.fileName] : [];
|
|
385
542
|
if (_loadedVariant.extraFiles) {
|
|
386
543
|
fileNames.push.apply(fileNames, _toConsumableArray(Object.keys(_loadedVariant.extraFiles)));
|
|
387
544
|
}
|
|
388
|
-
return
|
|
545
|
+
return _context3.abrupt("return", {
|
|
389
546
|
variantName: variantName,
|
|
390
547
|
loadedVariant: _loadedVariant,
|
|
391
548
|
fileNames: fileNames
|
|
392
549
|
});
|
|
393
550
|
case 29:
|
|
394
|
-
|
|
395
|
-
|
|
551
|
+
_context3.prev = 29;
|
|
552
|
+
_context3.t1 = _context3["catch"](19);
|
|
396
553
|
// Log but don't fail - we want to get as many file names as possible
|
|
397
|
-
console.warn("Failed to load variant ".concat(variantName, " for file listing: ").concat(
|
|
398
|
-
return
|
|
554
|
+
console.warn("Failed to load variant ".concat(variantName, " for file listing: ").concat(_context3.t1));
|
|
555
|
+
return _context3.abrupt("return", {
|
|
399
556
|
variantName: variantName,
|
|
400
557
|
loadedVariant: null,
|
|
401
558
|
fileNames: []
|
|
402
559
|
});
|
|
403
560
|
case 33:
|
|
404
561
|
case "end":
|
|
405
|
-
return
|
|
562
|
+
return _context3.stop();
|
|
406
563
|
}
|
|
407
|
-
},
|
|
564
|
+
}, _callee3, null, [[4, 12], [19, 29]]);
|
|
408
565
|
}));
|
|
409
|
-
return function (
|
|
410
|
-
return
|
|
566
|
+
return function (_x16) {
|
|
567
|
+
return _ref2.apply(this, arguments);
|
|
411
568
|
};
|
|
412
569
|
}());
|
|
413
|
-
|
|
570
|
+
_context4.next = 128;
|
|
414
571
|
return Promise.all(variantPromises);
|
|
415
|
-
case
|
|
416
|
-
variantResults =
|
|
572
|
+
case 128:
|
|
573
|
+
variantResults = _context4.sent;
|
|
417
574
|
// Update loaded code and collect file names
|
|
418
|
-
variantResults.forEach(function (
|
|
419
|
-
var variantName =
|
|
420
|
-
loadedVariant =
|
|
421
|
-
fileNames =
|
|
575
|
+
variantResults.forEach(function (_ref3) {
|
|
576
|
+
var variantName = _ref3.variantName,
|
|
577
|
+
loadedVariant = _ref3.loadedVariant,
|
|
578
|
+
fileNames = _ref3.fileNames;
|
|
422
579
|
if (loadedVariant) {
|
|
423
580
|
loaded = _objectSpread(_objectSpread({}, loaded), {}, _defineProperty({}, variantName, loadedVariant));
|
|
424
581
|
}
|
|
@@ -426,43 +583,50 @@ function _loadFallbackCode() {
|
|
|
426
583
|
return allFileNames.add(fileName);
|
|
427
584
|
});
|
|
428
585
|
});
|
|
429
|
-
case
|
|
586
|
+
case 130:
|
|
430
587
|
// Ensure we have the latest initial variant data
|
|
431
588
|
finalInitial = loaded[initialVariant];
|
|
432
589
|
if (!(!finalInitial || typeof finalInitial === 'string')) {
|
|
433
|
-
|
|
590
|
+
_context4.next = 133;
|
|
434
591
|
break;
|
|
435
592
|
}
|
|
436
593
|
throw new Error("Failed to process initial variant: ".concat(initialVariant));
|
|
437
|
-
case
|
|
438
|
-
|
|
439
|
-
|
|
594
|
+
case 133:
|
|
595
|
+
_context4.prev = 133;
|
|
596
|
+
_context4.next = 136;
|
|
440
597
|
return getFileSource(finalInitial, initialFilename, loadSource);
|
|
441
|
-
case
|
|
442
|
-
_result2 =
|
|
598
|
+
case 136:
|
|
599
|
+
_result2 = _context4.sent;
|
|
443
600
|
finalFileSource = _result2.source;
|
|
444
601
|
finalFilename = _result2.filename;
|
|
445
|
-
|
|
602
|
+
_context4.next = 147;
|
|
446
603
|
break;
|
|
447
|
-
case
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
604
|
+
case 141:
|
|
605
|
+
_context4.prev = 141;
|
|
606
|
+
_context4.t7 = _context4["catch"](133);
|
|
607
|
+
if (!(!finalInitial.fileName && !finalInitial.source)) {
|
|
608
|
+
_context4.next = 145;
|
|
609
|
+
break;
|
|
610
|
+
}
|
|
611
|
+
throw new Error("Cannot determine filename for initial variant \"".concat(initialVariant, "\". ") + "No fileName available in variant definition, no initialFilename provided, and no source available.");
|
|
612
|
+
case 145:
|
|
613
|
+
// Fall back to the main file with proper validation
|
|
451
614
|
finalFileSource = finalInitial.source || '';
|
|
452
615
|
finalFilename = finalInitial.fileName;
|
|
453
|
-
case
|
|
454
|
-
return
|
|
616
|
+
case 147:
|
|
617
|
+
return _context4.abrupt("return", {
|
|
455
618
|
code: loaded,
|
|
456
619
|
initialFilename: finalFilename,
|
|
457
620
|
initialSource: finalFileSource,
|
|
458
621
|
initialExtraFiles: finalInitial.extraFiles || {},
|
|
459
|
-
allFileNames: Array.from(allFileNames)
|
|
622
|
+
allFileNames: Array.from(allFileNames),
|
|
623
|
+
processedGlobalsCode: globalsCodeObjects
|
|
460
624
|
});
|
|
461
|
-
case
|
|
625
|
+
case 148:
|
|
462
626
|
case "end":
|
|
463
|
-
return
|
|
627
|
+
return _context4.stop();
|
|
464
628
|
}
|
|
465
|
-
},
|
|
629
|
+
}, _callee4, null, [[5, 11], [21, 29], [33, 40], [49, 92], [63, 71], [75, 82], [104, 113], [133, 141]]);
|
|
466
630
|
}));
|
|
467
631
|
return _loadFallbackCode.apply(this, arguments);
|
|
468
632
|
}
|