@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,1083 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
5
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
6
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
7
|
-
import { transformSource } from "./transformSource.js";
|
|
8
|
-
import { transformParsedSource } from "./transformParsedSource.js";
|
|
9
|
-
import { getFileNameFromUrl } from "../pipeline/loaderUtils/index.js";
|
|
10
|
-
import { mergeExternals } from "../pipeline/loaderUtils/mergeExternals.js";
|
|
11
|
-
/**
|
|
12
|
-
* Generate a conflict-free filename for globalsCode files.
|
|
13
|
-
* Strategy:
|
|
14
|
-
* 1. Try original filename
|
|
15
|
-
* 2. If conflict, try "global_" prefix
|
|
16
|
-
* 3. If still conflict, add numbers: "global_filename_1.ext", "global_filename_2.ext", etc.
|
|
17
|
-
*/
|
|
18
|
-
function generateConflictFreeFilename(originalFilename, existingFiles) {
|
|
19
|
-
// First try the original filename
|
|
20
|
-
if (!existingFiles.has(originalFilename)) {
|
|
21
|
-
return originalFilename;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Try with global_ prefix
|
|
25
|
-
var globalFilename = "global_".concat(originalFilename);
|
|
26
|
-
if (!existingFiles.has(globalFilename)) {
|
|
27
|
-
return globalFilename;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Split filename into name and extension for proper numbering
|
|
31
|
-
var lastDotIndex = originalFilename.lastIndexOf('.');
|
|
32
|
-
var nameWithoutExt;
|
|
33
|
-
var extension;
|
|
34
|
-
if (lastDotIndex === -1 || lastDotIndex === 0) {
|
|
35
|
-
// No extension or starts with dot (hidden file)
|
|
36
|
-
nameWithoutExt = originalFilename;
|
|
37
|
-
extension = '';
|
|
38
|
-
} else {
|
|
39
|
-
nameWithoutExt = originalFilename.substring(0, lastDotIndex);
|
|
40
|
-
extension = originalFilename.substring(lastDotIndex); // includes the dot
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Add numbers until we find a free name, preserving extension
|
|
44
|
-
var counter = 1;
|
|
45
|
-
var candidateName;
|
|
46
|
-
do {
|
|
47
|
-
candidateName = "global_".concat(nameWithoutExt, "_").concat(counter).concat(extension);
|
|
48
|
-
counter += 1;
|
|
49
|
-
} while (existingFiles.has(candidateName));
|
|
50
|
-
return candidateName;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Helper function to check if we're in production
|
|
54
|
-
function isProduction() {
|
|
55
|
-
return typeof process !== 'undefined' && process.env.NODE_ENV === 'production';
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Helper function to convert a nested key based on the directory of the source file key
|
|
59
|
-
function convertKeyBasedOnDirectory(nestedKey, sourceFileKey) {
|
|
60
|
-
// If it's an absolute path (starts with / or contains ://), keep as-is
|
|
61
|
-
if (nestedKey.startsWith('/') || nestedKey.includes('://')) {
|
|
62
|
-
return nestedKey;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Treat bare filenames as relative to current directory (same as ./filename)
|
|
66
|
-
var processedNestedKey = nestedKey;
|
|
67
|
-
if (!nestedKey.startsWith('.')) {
|
|
68
|
-
processedNestedKey = "./".concat(nestedKey);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Manual path resolution: resolve processedNestedKey relative to the directory of sourceFileKey
|
|
72
|
-
// Both paths are relative to the entry directory (which is always './') - ignore file:// URLs completely
|
|
73
|
-
|
|
74
|
-
// Get the directory of the source file key (not URL)
|
|
75
|
-
var sourceDir = sourceFileKey.includes('/') ? sourceFileKey.substring(0, sourceFileKey.lastIndexOf('/')) : '.';
|
|
76
|
-
|
|
77
|
-
// Parse both paths into components
|
|
78
|
-
var parsePathComponents = function parsePathComponents(path) {
|
|
79
|
-
if (path === '.' || path === '') {
|
|
80
|
-
return [];
|
|
81
|
-
}
|
|
82
|
-
return path.split('/').filter(function (part) {
|
|
83
|
-
return part !== '';
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
var sourceDirComponents = parsePathComponents(sourceDir);
|
|
87
|
-
var nestedComponents = parsePathComponents(processedNestedKey);
|
|
88
|
-
|
|
89
|
-
// Start from the source directory and apply the nested path
|
|
90
|
-
var resultComponents = _toConsumableArray(sourceDirComponents);
|
|
91
|
-
|
|
92
|
-
// Apply each component of the nested path
|
|
93
|
-
var _iterator = _createForOfIteratorHelper(nestedComponents),
|
|
94
|
-
_step;
|
|
95
|
-
try {
|
|
96
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
97
|
-
var component = _step.value;
|
|
98
|
-
if (component === '..') {
|
|
99
|
-
if (resultComponents.length > 0 && resultComponents[resultComponents.length - 1] !== '..') {
|
|
100
|
-
// Normal case: pop a regular directory component
|
|
101
|
-
resultComponents.pop();
|
|
102
|
-
} else {
|
|
103
|
-
// Either resultComponents is empty OR the last component is already '..'
|
|
104
|
-
// In both cases, we need to go up one more level
|
|
105
|
-
resultComponents.push('..');
|
|
106
|
-
}
|
|
107
|
-
} else if (component === '.') {
|
|
108
|
-
// Current directory, skip
|
|
109
|
-
continue;
|
|
110
|
-
} else {
|
|
111
|
-
resultComponents.push(component);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Build the final result
|
|
116
|
-
} catch (err) {
|
|
117
|
-
_iterator.e(err);
|
|
118
|
-
} finally {
|
|
119
|
-
_iterator.f();
|
|
120
|
-
}
|
|
121
|
-
if (resultComponents.length === 0) {
|
|
122
|
-
return '';
|
|
123
|
-
}
|
|
124
|
-
var result = resultComponents.join('/');
|
|
125
|
-
return result;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Normalize a relative path key by removing unnecessary ./ prefix
|
|
130
|
-
*/
|
|
131
|
-
function normalizePathKey(key) {
|
|
132
|
-
if (key.startsWith('./')) {
|
|
133
|
-
return key.substring(2);
|
|
134
|
-
}
|
|
135
|
-
return key;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Loads and processes extra files recursively with support for relative paths
|
|
140
|
-
* and circular dependency detection. Uses Promise.all for parallel loading.
|
|
141
|
-
*/
|
|
142
|
-
function loadSingleFile(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9) {
|
|
143
|
-
return _loadSingleFile.apply(this, arguments);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Loads and processes extra files recursively with support for relative paths
|
|
147
|
-
* and circular dependency detection. Uses Promise.all for parallel loading.
|
|
148
|
-
*/
|
|
149
|
-
function _loadSingleFile() {
|
|
150
|
-
_loadSingleFile = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(variantName, fileName, source, url, loadSource, sourceParser, sourceTransformers, loadSourceCache, transforms) {
|
|
151
|
-
var options,
|
|
152
|
-
allFilesListed,
|
|
153
|
-
knownExtraFiles,
|
|
154
|
-
_options$disableTrans,
|
|
155
|
-
disableTransforms,
|
|
156
|
-
_options$disableParsi,
|
|
157
|
-
disableParsing,
|
|
158
|
-
finalSource,
|
|
159
|
-
extraFilesFromSource,
|
|
160
|
-
extraDependenciesFromSource,
|
|
161
|
-
externalsFromSource,
|
|
162
|
-
loadPromise,
|
|
163
|
-
loadResult,
|
|
164
|
-
_i,
|
|
165
|
-
_Object$entries,
|
|
166
|
-
_Object$entries$_i,
|
|
167
|
-
extraFileName,
|
|
168
|
-
fileData,
|
|
169
|
-
_iterator2,
|
|
170
|
-
_step2,
|
|
171
|
-
dependency,
|
|
172
|
-
newFiles,
|
|
173
|
-
_i2,
|
|
174
|
-
_Object$keys,
|
|
175
|
-
extraFileKey,
|
|
176
|
-
message,
|
|
177
|
-
finalTransforms,
|
|
178
|
-
sourceString,
|
|
179
|
-
parseSource,
|
|
180
|
-
_args = arguments;
|
|
181
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
182
|
-
while (1) switch (_context.prev = _context.next) {
|
|
183
|
-
case 0:
|
|
184
|
-
options = _args.length > 9 && _args[9] !== undefined ? _args[9] : {};
|
|
185
|
-
allFilesListed = _args.length > 10 && _args[10] !== undefined ? _args[10] : false;
|
|
186
|
-
knownExtraFiles = _args.length > 11 && _args[11] !== undefined ? _args[11] : new Set();
|
|
187
|
-
_options$disableTrans = options.disableTransforms, disableTransforms = _options$disableTrans === void 0 ? false : _options$disableTrans, _options$disableParsi = options.disableParsing, disableParsing = _options$disableParsi === void 0 ? false : _options$disableParsi;
|
|
188
|
-
finalSource = source;
|
|
189
|
-
if (finalSource) {
|
|
190
|
-
_context.next = 68;
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
if (loadSource) {
|
|
194
|
-
_context.next = 8;
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
throw new Error('"loadSource" function is required when source is not provided');
|
|
198
|
-
case 8:
|
|
199
|
-
if (url) {
|
|
200
|
-
_context.next = 10;
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
throw new Error('URL is required when loading source');
|
|
204
|
-
case 10:
|
|
205
|
-
_context.prev = 10;
|
|
206
|
-
// Check cache first to avoid duplicate loadSource calls
|
|
207
|
-
loadPromise = loadSourceCache.get(url);
|
|
208
|
-
if (!loadPromise) {
|
|
209
|
-
loadPromise = loadSource(url);
|
|
210
|
-
loadSourceCache.set(url, loadPromise);
|
|
211
|
-
}
|
|
212
|
-
_context.next = 15;
|
|
213
|
-
return loadPromise;
|
|
214
|
-
case 15:
|
|
215
|
-
loadResult = _context.sent;
|
|
216
|
-
finalSource = loadResult.source;
|
|
217
|
-
extraFilesFromSource = loadResult.extraFiles;
|
|
218
|
-
extraDependenciesFromSource = loadResult.extraDependencies;
|
|
219
|
-
externalsFromSource = loadResult.externals;
|
|
220
|
-
|
|
221
|
-
// Validate that extraFiles from loadSource contain only absolute URLs as values
|
|
222
|
-
if (!extraFilesFromSource) {
|
|
223
|
-
_context.next = 31;
|
|
224
|
-
break;
|
|
225
|
-
}
|
|
226
|
-
_i = 0, _Object$entries = Object.entries(extraFilesFromSource);
|
|
227
|
-
case 22:
|
|
228
|
-
if (!(_i < _Object$entries.length)) {
|
|
229
|
-
_context.next = 31;
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), extraFileName = _Object$entries$_i[0], fileData = _Object$entries$_i[1];
|
|
233
|
-
if (!(extraFileName.includes('://') || extraFileName.startsWith('/'))) {
|
|
234
|
-
_context.next = 26;
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
throw new Error("Invalid extraFiles from loadSource: key \"".concat(extraFileName, "\" appears to be an absolute path. ") + "extraFiles keys should be relative paths from the current file.");
|
|
238
|
-
case 26:
|
|
239
|
-
if (!(typeof fileData === 'string' && fileData.startsWith('.'))) {
|
|
240
|
-
_context.next = 28;
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
throw new Error("Invalid extraFiles from loadSource: \"".concat(extraFileName, "\" has relative path \"").concat(fileData, "\". ") + "All extraFiles values must be absolute URLs.");
|
|
244
|
-
case 28:
|
|
245
|
-
_i++;
|
|
246
|
-
_context.next = 22;
|
|
247
|
-
break;
|
|
248
|
-
case 31:
|
|
249
|
-
if (!extraDependenciesFromSource) {
|
|
250
|
-
_context.next = 51;
|
|
251
|
-
break;
|
|
252
|
-
}
|
|
253
|
-
_iterator2 = _createForOfIteratorHelper(extraDependenciesFromSource);
|
|
254
|
-
_context.prev = 33;
|
|
255
|
-
_iterator2.s();
|
|
256
|
-
case 35:
|
|
257
|
-
if ((_step2 = _iterator2.n()).done) {
|
|
258
|
-
_context.next = 43;
|
|
259
|
-
break;
|
|
260
|
-
}
|
|
261
|
-
dependency = _step2.value;
|
|
262
|
-
if (!dependency.startsWith('.')) {
|
|
263
|
-
_context.next = 39;
|
|
264
|
-
break;
|
|
265
|
-
}
|
|
266
|
-
throw new Error("Invalid extraDependencies from loadSource: \"".concat(dependency, "\" is a relative path. ") + "All extraDependencies must be absolute URLs.");
|
|
267
|
-
case 39:
|
|
268
|
-
if (!(dependency === url)) {
|
|
269
|
-
_context.next = 41;
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
throw new Error("Invalid extraDependencies from loadSource: \"".concat(dependency, "\" is the same as the input URL. ") + "extraDependencies should not include the file being loaded.");
|
|
273
|
-
case 41:
|
|
274
|
-
_context.next = 35;
|
|
275
|
-
break;
|
|
276
|
-
case 43:
|
|
277
|
-
_context.next = 48;
|
|
278
|
-
break;
|
|
279
|
-
case 45:
|
|
280
|
-
_context.prev = 45;
|
|
281
|
-
_context.t0 = _context["catch"](33);
|
|
282
|
-
_iterator2.e(_context.t0);
|
|
283
|
-
case 48:
|
|
284
|
-
_context.prev = 48;
|
|
285
|
-
_iterator2.f();
|
|
286
|
-
return _context.finish(48);
|
|
287
|
-
case 51:
|
|
288
|
-
if (!(allFilesListed && (extraFilesFromSource || extraDependenciesFromSource))) {
|
|
289
|
-
_context.next = 61;
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
newFiles = [];
|
|
293
|
-
if (extraFilesFromSource) {
|
|
294
|
-
// Check if any extraFiles keys are not in the known set
|
|
295
|
-
for (_i2 = 0, _Object$keys = Object.keys(extraFilesFromSource); _i2 < _Object$keys.length; _i2++) {
|
|
296
|
-
extraFileKey = _Object$keys[_i2];
|
|
297
|
-
if (!knownExtraFiles.has(extraFileKey)) {
|
|
298
|
-
newFiles.push(extraFileKey);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
if (!(newFiles.length > 0)) {
|
|
303
|
-
_context.next = 61;
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
|
-
message = "Unexpected files discovered via loadSource when allFilesListed=true (variant: ".concat(variantName, ", file: ").concat(fileName, "). ") + "New files: ".concat(newFiles.join(', '), ". ") + "Please update the loadVariantMeta function to provide the complete list of files upfront.";
|
|
307
|
-
if (!isProduction()) {
|
|
308
|
-
_context.next = 60;
|
|
309
|
-
break;
|
|
310
|
-
}
|
|
311
|
-
console.warn(message);
|
|
312
|
-
_context.next = 61;
|
|
313
|
-
break;
|
|
314
|
-
case 60:
|
|
315
|
-
throw new Error(message);
|
|
316
|
-
case 61:
|
|
317
|
-
_context.next = 68;
|
|
318
|
-
break;
|
|
319
|
-
case 63:
|
|
320
|
-
_context.prev = 63;
|
|
321
|
-
_context.t1 = _context["catch"](10);
|
|
322
|
-
if (!(_context.t1 instanceof Error && (_context.t1.message.startsWith('Invalid extraFiles from loadSource:') || _context.t1.message.startsWith('Invalid extraDependencies from loadSource:') || _context.t1.message.startsWith('Unexpected files discovered via loadSource when allFilesListed=true')))) {
|
|
323
|
-
_context.next = 67;
|
|
324
|
-
break;
|
|
325
|
-
}
|
|
326
|
-
throw _context.t1;
|
|
327
|
-
case 67:
|
|
328
|
-
throw new Error("Failed to load source code (variant: ".concat(variantName, ", file: ").concat(fileName, ", url: ").concat(url, "): ").concat(JSON.stringify(_context.t1)));
|
|
329
|
-
case 68:
|
|
330
|
-
// Apply source transformers if no transforms exist and transforms are not disabled
|
|
331
|
-
finalTransforms = transforms;
|
|
332
|
-
if (!(sourceTransformers && !finalTransforms && !disableTransforms && finalSource)) {
|
|
333
|
-
_context.next = 73;
|
|
334
|
-
break;
|
|
335
|
-
}
|
|
336
|
-
_context.next = 72;
|
|
337
|
-
return transformSource(finalSource, normalizePathKey(fileName), sourceTransformers);
|
|
338
|
-
case 72:
|
|
339
|
-
finalTransforms = _context.sent;
|
|
340
|
-
case 73:
|
|
341
|
-
if (!(typeof finalSource === 'string' && !disableParsing)) {
|
|
342
|
-
_context.next = 91;
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
if (sourceParser) {
|
|
346
|
-
_context.next = 76;
|
|
347
|
-
break;
|
|
348
|
-
}
|
|
349
|
-
throw new Error('"sourceParser" function is required when source is a string and parsing is not disabled');
|
|
350
|
-
case 76:
|
|
351
|
-
_context.prev = 76;
|
|
352
|
-
sourceString = finalSource;
|
|
353
|
-
_context.next = 80;
|
|
354
|
-
return sourceParser;
|
|
355
|
-
case 80:
|
|
356
|
-
parseSource = _context.sent;
|
|
357
|
-
finalSource = parseSource(finalSource, fileName);
|
|
358
|
-
if (!(finalTransforms && !disableTransforms)) {
|
|
359
|
-
_context.next = 86;
|
|
360
|
-
break;
|
|
361
|
-
}
|
|
362
|
-
_context.next = 85;
|
|
363
|
-
return transformParsedSource(sourceString, finalSource, normalizePathKey(fileName), finalTransforms, parseSource);
|
|
364
|
-
case 85:
|
|
365
|
-
finalTransforms = _context.sent;
|
|
366
|
-
case 86:
|
|
367
|
-
_context.next = 91;
|
|
368
|
-
break;
|
|
369
|
-
case 88:
|
|
370
|
-
_context.prev = 88;
|
|
371
|
-
_context.t2 = _context["catch"](76);
|
|
372
|
-
throw new Error("Failed to parse source code (variant: ".concat(variantName, ", file: ").concat(fileName, ", url: ").concat(url, "): ").concat(_context.t2 instanceof Error ? _context.t2.message : ''));
|
|
373
|
-
case 91:
|
|
374
|
-
return _context.abrupt("return", {
|
|
375
|
-
source: finalSource,
|
|
376
|
-
transforms: finalTransforms,
|
|
377
|
-
extraFiles: extraFilesFromSource,
|
|
378
|
-
extraDependencies: extraDependenciesFromSource,
|
|
379
|
-
externals: externalsFromSource
|
|
380
|
-
});
|
|
381
|
-
case 92:
|
|
382
|
-
case "end":
|
|
383
|
-
return _context.stop();
|
|
384
|
-
}
|
|
385
|
-
}, _callee, null, [[10, 63], [33, 45, 48, 51], [76, 88]]);
|
|
386
|
-
}));
|
|
387
|
-
return _loadSingleFile.apply(this, arguments);
|
|
388
|
-
}
|
|
389
|
-
function loadExtraFiles(_x0, _x1, _x10, _x11, _x12, _x13, _x14, _x15) {
|
|
390
|
-
return _loadExtraFiles.apply(this, arguments);
|
|
391
|
-
}
|
|
392
|
-
/**
|
|
393
|
-
* Loads a variant with support for recursive extra file loading.
|
|
394
|
-
* The loadSource function can now return extraFiles that will be loaded recursively.
|
|
395
|
-
* Supports both relative and absolute paths for extra files.
|
|
396
|
-
* Uses Promise.all for efficient parallel loading of extra files.
|
|
397
|
-
*/
|
|
398
|
-
function _loadExtraFiles() {
|
|
399
|
-
_loadExtraFiles = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(variantName, extraFiles, baseUrl, entryUrl,
|
|
400
|
-
// Track the original entry file URL
|
|
401
|
-
loadSource, sourceParser, sourceTransformers, loadSourceCache) {
|
|
402
|
-
var options,
|
|
403
|
-
allFilesListed,
|
|
404
|
-
knownExtraFiles,
|
|
405
|
-
globalsFileKeys,
|
|
406
|
-
_options$maxDepth,
|
|
407
|
-
maxDepth,
|
|
408
|
-
_options$loadedFiles,
|
|
409
|
-
loadedFiles,
|
|
410
|
-
processedExtraFiles,
|
|
411
|
-
allFilesUsed,
|
|
412
|
-
allExternals,
|
|
413
|
-
extraFilePromises,
|
|
414
|
-
extraFileResults,
|
|
415
|
-
nestedExtraFilesPromises,
|
|
416
|
-
_iterator3,
|
|
417
|
-
_step3,
|
|
418
|
-
_loop,
|
|
419
|
-
nestedExtraFilesResults,
|
|
420
|
-
_iterator4,
|
|
421
|
-
_step4,
|
|
422
|
-
_step4$value,
|
|
423
|
-
nestedExtraFiles,
|
|
424
|
-
nestedFilesUsed,
|
|
425
|
-
nestedExternals,
|
|
426
|
-
sourceFileKey,
|
|
427
|
-
mergedNestedExternals,
|
|
428
|
-
_i3,
|
|
429
|
-
_Object$entries2,
|
|
430
|
-
_Object$entries2$_i,
|
|
431
|
-
nestedKey,
|
|
432
|
-
nestedValue,
|
|
433
|
-
convertedKey,
|
|
434
|
-
normalizedConvertedKey,
|
|
435
|
-
_args4 = arguments;
|
|
436
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context4) {
|
|
437
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
438
|
-
case 0:
|
|
439
|
-
options = _args4.length > 8 && _args4[8] !== undefined ? _args4[8] : {};
|
|
440
|
-
allFilesListed = _args4.length > 9 && _args4[9] !== undefined ? _args4[9] : false;
|
|
441
|
-
knownExtraFiles = _args4.length > 10 && _args4[10] !== undefined ? _args4[10] : new Set();
|
|
442
|
-
globalsFileKeys = _args4.length > 11 && _args4[11] !== undefined ? _args4[11] : new Set();
|
|
443
|
-
_options$maxDepth = options.maxDepth, maxDepth = _options$maxDepth === void 0 ? 10 : _options$maxDepth, _options$loadedFiles = options.loadedFiles, loadedFiles = _options$loadedFiles === void 0 ? new Set() : _options$loadedFiles;
|
|
444
|
-
if (!(maxDepth <= 0)) {
|
|
445
|
-
_context4.next = 7;
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
throw new Error('Maximum recursion depth reached while loading extra files');
|
|
449
|
-
case 7:
|
|
450
|
-
processedExtraFiles = {};
|
|
451
|
-
allFilesUsed = [];
|
|
452
|
-
allExternals = {}; // Start loading all extra files in parallel
|
|
453
|
-
extraFilePromises = Object.entries(extraFiles).map(/*#__PURE__*/function () {
|
|
454
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref) {
|
|
455
|
-
var _ref3, fileName, fileData, fileUrl, sourceData, transforms, fileResult, filesUsedFromFile, externalsFromFile;
|
|
456
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
457
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
458
|
-
case 0:
|
|
459
|
-
_ref3 = _slicedToArray(_ref, 2), fileName = _ref3[0], fileData = _ref3[1];
|
|
460
|
-
_context2.prev = 1;
|
|
461
|
-
if (!(typeof fileData === 'string')) {
|
|
462
|
-
_context2.next = 9;
|
|
463
|
-
break;
|
|
464
|
-
}
|
|
465
|
-
// fileData is a URL/path - use it directly, don't modify it
|
|
466
|
-
fileUrl = fileData;
|
|
467
|
-
|
|
468
|
-
// Check for circular dependencies
|
|
469
|
-
if (!loadedFiles.has(fileUrl)) {
|
|
470
|
-
_context2.next = 6;
|
|
471
|
-
break;
|
|
472
|
-
}
|
|
473
|
-
throw new Error("Circular dependency detected: ".concat(fileUrl));
|
|
474
|
-
case 6:
|
|
475
|
-
loadedFiles.add(fileUrl);
|
|
476
|
-
_context2.next = 12;
|
|
477
|
-
break;
|
|
478
|
-
case 9:
|
|
479
|
-
// fileData is an object with source and/or transforms
|
|
480
|
-
sourceData = fileData.source;
|
|
481
|
-
transforms = fileData.transforms;
|
|
482
|
-
fileUrl = baseUrl; // Use base URL as fallback
|
|
483
|
-
case 12:
|
|
484
|
-
_context2.next = 14;
|
|
485
|
-
return loadSingleFile(variantName, fileName, sourceData, fileUrl, loadSource, sourceParser, sourceTransformers, loadSourceCache, transforms, _objectSpread(_objectSpread({}, options), {}, {
|
|
486
|
-
maxDepth: maxDepth - 1,
|
|
487
|
-
loadedFiles: new Set(loadedFiles)
|
|
488
|
-
}), allFilesListed, knownExtraFiles);
|
|
489
|
-
case 14:
|
|
490
|
-
fileResult = _context2.sent;
|
|
491
|
-
// Collect files used from this file load
|
|
492
|
-
filesUsedFromFile = [];
|
|
493
|
-
if (typeof fileData === 'string') {
|
|
494
|
-
filesUsedFromFile.push(fileUrl);
|
|
495
|
-
}
|
|
496
|
-
if (fileResult.extraDependencies) {
|
|
497
|
-
filesUsedFromFile.push.apply(filesUsedFromFile, _toConsumableArray(fileResult.extraDependencies));
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// Collect externals from this file load
|
|
501
|
-
externalsFromFile = {};
|
|
502
|
-
if (fileResult.externals) {
|
|
503
|
-
Object.assign(externalsFromFile, fileResult.externals);
|
|
504
|
-
}
|
|
505
|
-
return _context2.abrupt("return", {
|
|
506
|
-
fileName: fileName,
|
|
507
|
-
result: fileResult,
|
|
508
|
-
filesUsed: filesUsedFromFile,
|
|
509
|
-
externals: externalsFromFile
|
|
510
|
-
});
|
|
511
|
-
case 23:
|
|
512
|
-
_context2.prev = 23;
|
|
513
|
-
_context2.t0 = _context2["catch"](1);
|
|
514
|
-
throw new Error("Failed to load extra file (variant: ".concat(variantName, ", file: ").concat(fileName, ", url: ").concat(baseUrl, "): ").concat(_context2.t0 instanceof Error ? _context2.t0.message : ''));
|
|
515
|
-
case 26:
|
|
516
|
-
case "end":
|
|
517
|
-
return _context2.stop();
|
|
518
|
-
}
|
|
519
|
-
}, _callee2, null, [[1, 23]]);
|
|
520
|
-
}));
|
|
521
|
-
return function (_x23) {
|
|
522
|
-
return _ref2.apply(this, arguments);
|
|
523
|
-
};
|
|
524
|
-
}()); // Wait for all extra files to load
|
|
525
|
-
_context4.next = 13;
|
|
526
|
-
return Promise.all(extraFilePromises);
|
|
527
|
-
case 13:
|
|
528
|
-
extraFileResults = _context4.sent;
|
|
529
|
-
// Process results and handle nested extra files
|
|
530
|
-
nestedExtraFilesPromises = [];
|
|
531
|
-
_iterator3 = _createForOfIteratorHelper(extraFileResults);
|
|
532
|
-
_context4.prev = 16;
|
|
533
|
-
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
534
|
-
var _step3$value, fileName, result, filesUsed, externals, normalizedFileName, originalFileData, metadata, mergedExternals, sourceFileUrl, fileData;
|
|
535
|
-
return _regeneratorRuntime().wrap(function _loop$(_context3) {
|
|
536
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
537
|
-
case 0:
|
|
538
|
-
_step3$value = _step3.value, fileName = _step3$value.fileName, result = _step3$value.result, filesUsed = _step3$value.filesUsed, externals = _step3$value.externals;
|
|
539
|
-
normalizedFileName = normalizePathKey(fileName);
|
|
540
|
-
originalFileData = extraFiles[fileName]; // Preserve metadata flag if it exists in the original data, or if this file came from globals
|
|
541
|
-
if (typeof originalFileData !== 'string') {
|
|
542
|
-
metadata = originalFileData.metadata;
|
|
543
|
-
} else if (globalsFileKeys.has(fileName)) {
|
|
544
|
-
metadata = true;
|
|
545
|
-
}
|
|
546
|
-
processedExtraFiles[normalizedFileName] = _objectSpread({
|
|
547
|
-
source: result.source,
|
|
548
|
-
transforms: result.transforms
|
|
549
|
-
}, metadata !== undefined && {
|
|
550
|
-
metadata: metadata
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
// Add files used from this file load
|
|
554
|
-
allFilesUsed.push.apply(allFilesUsed, _toConsumableArray(filesUsed));
|
|
555
|
-
|
|
556
|
-
// Add externals from this file load using proper merging
|
|
557
|
-
mergedExternals = mergeExternals([allExternals, externals]);
|
|
558
|
-
Object.assign(allExternals, mergedExternals);
|
|
559
|
-
|
|
560
|
-
// Collect promises for nested extra files with their source key
|
|
561
|
-
if (result.extraFiles) {
|
|
562
|
-
sourceFileUrl = baseUrl;
|
|
563
|
-
fileData = extraFiles[fileName];
|
|
564
|
-
if (typeof fileData === 'string') {
|
|
565
|
-
sourceFileUrl = fileData; // Use the URL directly, don't modify it
|
|
566
|
-
}
|
|
567
|
-
nestedExtraFilesPromises.push(loadExtraFiles(variantName, result.extraFiles, sourceFileUrl,
|
|
568
|
-
// Use the source file's URL as base for its extra files
|
|
569
|
-
entryUrl,
|
|
570
|
-
// Keep the entry URL for final conversion
|
|
571
|
-
loadSource, sourceParser, sourceTransformers, loadSourceCache, _objectSpread(_objectSpread({}, options), {}, {
|
|
572
|
-
maxDepth: maxDepth - 1,
|
|
573
|
-
loadedFiles: new Set(loadedFiles)
|
|
574
|
-
}), allFilesListed, knownExtraFiles, globalsFileKeys // Pass through globals file tracking
|
|
575
|
-
).then(function (nestedResult) {
|
|
576
|
-
return {
|
|
577
|
-
files: nestedResult.extraFiles,
|
|
578
|
-
allFilesUsed: nestedResult.allFilesUsed,
|
|
579
|
-
allExternals: nestedResult.allExternals,
|
|
580
|
-
sourceFileKey: normalizedFileName // Pass the normalized key
|
|
581
|
-
};
|
|
582
|
-
}));
|
|
583
|
-
}
|
|
584
|
-
case 9:
|
|
585
|
-
case "end":
|
|
586
|
-
return _context3.stop();
|
|
587
|
-
}
|
|
588
|
-
}, _loop);
|
|
589
|
-
});
|
|
590
|
-
_iterator3.s();
|
|
591
|
-
case 19:
|
|
592
|
-
if ((_step3 = _iterator3.n()).done) {
|
|
593
|
-
_context4.next = 23;
|
|
594
|
-
break;
|
|
595
|
-
}
|
|
596
|
-
return _context4.delegateYield(_loop(), "t0", 21);
|
|
597
|
-
case 21:
|
|
598
|
-
_context4.next = 19;
|
|
599
|
-
break;
|
|
600
|
-
case 23:
|
|
601
|
-
_context4.next = 28;
|
|
602
|
-
break;
|
|
603
|
-
case 25:
|
|
604
|
-
_context4.prev = 25;
|
|
605
|
-
_context4.t1 = _context4["catch"](16);
|
|
606
|
-
_iterator3.e(_context4.t1);
|
|
607
|
-
case 28:
|
|
608
|
-
_context4.prev = 28;
|
|
609
|
-
_iterator3.f();
|
|
610
|
-
return _context4.finish(28);
|
|
611
|
-
case 31:
|
|
612
|
-
if (!(nestedExtraFilesPromises.length > 0)) {
|
|
613
|
-
_context4.next = 37;
|
|
614
|
-
break;
|
|
615
|
-
}
|
|
616
|
-
_context4.next = 34;
|
|
617
|
-
return Promise.all(nestedExtraFilesPromises);
|
|
618
|
-
case 34:
|
|
619
|
-
nestedExtraFilesResults = _context4.sent;
|
|
620
|
-
_iterator4 = _createForOfIteratorHelper(nestedExtraFilesResults);
|
|
621
|
-
try {
|
|
622
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
623
|
-
_step4$value = _step4.value, nestedExtraFiles = _step4$value.files, nestedFilesUsed = _step4$value.allFilesUsed, nestedExternals = _step4$value.allExternals, sourceFileKey = _step4$value.sourceFileKey;
|
|
624
|
-
// Add nested files used
|
|
625
|
-
allFilesUsed.push.apply(allFilesUsed, _toConsumableArray(nestedFilesUsed));
|
|
626
|
-
|
|
627
|
-
// Add nested externals using proper merging
|
|
628
|
-
mergedNestedExternals = mergeExternals([allExternals, nestedExternals]);
|
|
629
|
-
Object.assign(allExternals, mergedNestedExternals);
|
|
630
|
-
for (_i3 = 0, _Object$entries2 = Object.entries(nestedExtraFiles); _i3 < _Object$entries2.length; _i3++) {
|
|
631
|
-
_Object$entries2$_i = _slicedToArray(_Object$entries2[_i3], 2), nestedKey = _Object$entries2$_i[0], nestedValue = _Object$entries2$_i[1];
|
|
632
|
-
// Convert the key based on the directory structure of the source key
|
|
633
|
-
convertedKey = convertKeyBasedOnDirectory(nestedKey, sourceFileKey);
|
|
634
|
-
normalizedConvertedKey = normalizePathKey(convertedKey);
|
|
635
|
-
processedExtraFiles[normalizedConvertedKey] = nestedValue;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
} catch (err) {
|
|
639
|
-
_iterator4.e(err);
|
|
640
|
-
} finally {
|
|
641
|
-
_iterator4.f();
|
|
642
|
-
}
|
|
643
|
-
case 37:
|
|
644
|
-
return _context4.abrupt("return", {
|
|
645
|
-
extraFiles: processedExtraFiles,
|
|
646
|
-
allFilesUsed: allFilesUsed,
|
|
647
|
-
allExternals: allExternals
|
|
648
|
-
});
|
|
649
|
-
case 38:
|
|
650
|
-
case "end":
|
|
651
|
-
return _context4.stop();
|
|
652
|
-
}
|
|
653
|
-
}, _callee3, null, [[16, 25, 28, 31]]);
|
|
654
|
-
}));
|
|
655
|
-
return _loadExtraFiles.apply(this, arguments);
|
|
656
|
-
}
|
|
657
|
-
export function loadVariant(_x16, _x17, _x18, _x19, _x20, _x21, _x22) {
|
|
658
|
-
return _loadVariant.apply(this, arguments);
|
|
659
|
-
}
|
|
660
|
-
function _loadVariant() {
|
|
661
|
-
_loadVariant = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(url, variantName, variant, sourceParser, loadSource, loadVariantMeta, sourceTransformers) {
|
|
662
|
-
var options,
|
|
663
|
-
globalsCode,
|
|
664
|
-
loadSourceCache,
|
|
665
|
-
_getFileNameFromUrl,
|
|
666
|
-
_fileName,
|
|
667
|
-
loadedFiles,
|
|
668
|
-
allFilesUsed,
|
|
669
|
-
allExternals,
|
|
670
|
-
knownExtraFiles,
|
|
671
|
-
_i4,
|
|
672
|
-
_Object$keys2,
|
|
673
|
-
extraFileName,
|
|
674
|
-
fileName,
|
|
675
|
-
_finalVariant,
|
|
676
|
-
mainFileResult,
|
|
677
|
-
allExtraFiles,
|
|
678
|
-
_i5,
|
|
679
|
-
_Object$keys3,
|
|
680
|
-
_extraFileName,
|
|
681
|
-
extraFilesToLoad,
|
|
682
|
-
globalsFileKeys,
|
|
683
|
-
existingFiles,
|
|
684
|
-
_i6,
|
|
685
|
-
_Object$keys4,
|
|
686
|
-
key,
|
|
687
|
-
globalsPromises,
|
|
688
|
-
globalsResults,
|
|
689
|
-
_iterator5,
|
|
690
|
-
_step5,
|
|
691
|
-
globalsResult,
|
|
692
|
-
_i7,
|
|
693
|
-
_Object$entries3,
|
|
694
|
-
_Object$entries3$_i,
|
|
695
|
-
_key,
|
|
696
|
-
value,
|
|
697
|
-
conflictFreeKey,
|
|
698
|
-
loadableFiles,
|
|
699
|
-
_i8,
|
|
700
|
-
_Object$entries4,
|
|
701
|
-
_Object$entries4$_i,
|
|
702
|
-
_key2,
|
|
703
|
-
_value,
|
|
704
|
-
_i9,
|
|
705
|
-
_Object$entries5,
|
|
706
|
-
_Object$entries5$_i,
|
|
707
|
-
_key3,
|
|
708
|
-
_value2,
|
|
709
|
-
metadata,
|
|
710
|
-
urlFilesToLoad,
|
|
711
|
-
_i0,
|
|
712
|
-
_Object$entries6,
|
|
713
|
-
_Object$entries6$_i,
|
|
714
|
-
_key4,
|
|
715
|
-
_value3,
|
|
716
|
-
extraFilesResult,
|
|
717
|
-
_extraFilesResult,
|
|
718
|
-
finalVariant,
|
|
719
|
-
_args6 = arguments;
|
|
720
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context6) {
|
|
721
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
722
|
-
case 0:
|
|
723
|
-
options = _args6.length > 7 && _args6[7] !== undefined ? _args6[7] : {};
|
|
724
|
-
if (variant) {
|
|
725
|
-
_context6.next = 3;
|
|
726
|
-
break;
|
|
727
|
-
}
|
|
728
|
-
throw new Error("Variant is missing from code: ".concat(variantName));
|
|
729
|
-
case 3:
|
|
730
|
-
globalsCode = options.globalsCode; // Create a cache for loadSource calls scoped to this loadVariant call
|
|
731
|
-
loadSourceCache = new Map();
|
|
732
|
-
if (!(typeof variant === 'string')) {
|
|
733
|
-
_context6.next = 22;
|
|
734
|
-
break;
|
|
735
|
-
}
|
|
736
|
-
if (loadVariantMeta) {
|
|
737
|
-
_context6.next = 13;
|
|
738
|
-
break;
|
|
739
|
-
}
|
|
740
|
-
// Create a basic loadVariantMeta function as fallback
|
|
741
|
-
_getFileNameFromUrl = getFileNameFromUrl(variant), _fileName = _getFileNameFromUrl.fileName;
|
|
742
|
-
if (_fileName) {
|
|
743
|
-
_context6.next = 10;
|
|
744
|
-
break;
|
|
745
|
-
}
|
|
746
|
-
throw new Error("Cannot determine fileName from URL \"".concat(variant, "\" for variant \"").concat(variantName, "\". ") + "Please provide a loadVariantMeta function or ensure the URL has a valid file extension.");
|
|
747
|
-
case 10:
|
|
748
|
-
variant = {
|
|
749
|
-
url: variant,
|
|
750
|
-
fileName: _fileName
|
|
751
|
-
};
|
|
752
|
-
_context6.next = 22;
|
|
753
|
-
break;
|
|
754
|
-
case 13:
|
|
755
|
-
_context6.prev = 13;
|
|
756
|
-
_context6.next = 16;
|
|
757
|
-
return loadVariantMeta(variantName, variant);
|
|
758
|
-
case 16:
|
|
759
|
-
variant = _context6.sent;
|
|
760
|
-
_context6.next = 22;
|
|
761
|
-
break;
|
|
762
|
-
case 19:
|
|
763
|
-
_context6.prev = 19;
|
|
764
|
-
_context6.t0 = _context6["catch"](13);
|
|
765
|
-
throw new Error("Failed to load variant code (variant: ".concat(variantName, ", url: ").concat(variant, "): ").concat(JSON.stringify(_context6.t0)));
|
|
766
|
-
case 22:
|
|
767
|
-
loadedFiles = new Set();
|
|
768
|
-
if (url) {
|
|
769
|
-
loadedFiles.add(url);
|
|
770
|
-
}
|
|
771
|
-
allFilesUsed = url ? [url] : []; // Start with the main file URL if available
|
|
772
|
-
allExternals = {}; // Collect externals from all sources
|
|
773
|
-
// Build set of known extra files from variant definition
|
|
774
|
-
knownExtraFiles = new Set();
|
|
775
|
-
if (variant.extraFiles) {
|
|
776
|
-
for (_i4 = 0, _Object$keys2 = Object.keys(variant.extraFiles); _i4 < _Object$keys2.length; _i4++) {
|
|
777
|
-
extraFileName = _Object$keys2[_i4];
|
|
778
|
-
knownExtraFiles.add(extraFileName);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
// Load main file
|
|
783
|
-
fileName = variant.fileName || (url ? getFileNameFromUrl(url).fileName : undefined); // If we don't have a fileName and no URL, we can't parse or transform but can still return the code
|
|
784
|
-
if (!(!fileName && !url)) {
|
|
785
|
-
_context6.next = 32;
|
|
786
|
-
break;
|
|
787
|
-
}
|
|
788
|
-
// Return the variant as-is without parsing or transforms
|
|
789
|
-
_finalVariant = _objectSpread(_objectSpread({}, variant), {}, {
|
|
790
|
-
source: typeof variant.source === 'string' ? {
|
|
791
|
-
type: 'root',
|
|
792
|
-
children: [{
|
|
793
|
-
type: 'text',
|
|
794
|
-
value: variant.source || ''
|
|
795
|
-
}]
|
|
796
|
-
} : variant.source
|
|
797
|
-
});
|
|
798
|
-
return _context6.abrupt("return", {
|
|
799
|
-
code: _finalVariant,
|
|
800
|
-
dependencies: [],
|
|
801
|
-
// No dependencies without URL
|
|
802
|
-
externals: {} // No externals without URL
|
|
803
|
-
});
|
|
804
|
-
case 32:
|
|
805
|
-
if (fileName) {
|
|
806
|
-
_context6.next = 34;
|
|
807
|
-
break;
|
|
808
|
-
}
|
|
809
|
-
throw new Error("No fileName available for variant \"".concat(variantName, "\". ") + "Please provide a fileName in the variant definition or ensure the URL has a valid file extension.");
|
|
810
|
-
case 34:
|
|
811
|
-
_context6.next = 36;
|
|
812
|
-
return loadSingleFile(variantName, fileName, variant.source, url, loadSource, sourceParser, sourceTransformers, loadSourceCache, variant.transforms, _objectSpread(_objectSpread({}, options), {}, {
|
|
813
|
-
loadedFiles: loadedFiles
|
|
814
|
-
}), variant.allFilesListed || false, knownExtraFiles);
|
|
815
|
-
case 36:
|
|
816
|
-
mainFileResult = _context6.sent;
|
|
817
|
-
// Add files used from main file loading
|
|
818
|
-
if (mainFileResult.extraDependencies) {
|
|
819
|
-
allFilesUsed.push.apply(allFilesUsed, _toConsumableArray(mainFileResult.extraDependencies));
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
// Add externals from main file loading
|
|
823
|
-
if (mainFileResult.externals) {
|
|
824
|
-
allExternals = mergeExternals([allExternals, mainFileResult.externals]);
|
|
825
|
-
}
|
|
826
|
-
allExtraFiles = {}; // Validate extraFiles keys from variant definition
|
|
827
|
-
if (!variant.extraFiles) {
|
|
828
|
-
_context6.next = 49;
|
|
829
|
-
break;
|
|
830
|
-
}
|
|
831
|
-
_i5 = 0, _Object$keys3 = Object.keys(variant.extraFiles);
|
|
832
|
-
case 42:
|
|
833
|
-
if (!(_i5 < _Object$keys3.length)) {
|
|
834
|
-
_context6.next = 49;
|
|
835
|
-
break;
|
|
836
|
-
}
|
|
837
|
-
_extraFileName = _Object$keys3[_i5];
|
|
838
|
-
if (!(_extraFileName.includes('://') || _extraFileName.startsWith('/'))) {
|
|
839
|
-
_context6.next = 46;
|
|
840
|
-
break;
|
|
841
|
-
}
|
|
842
|
-
throw new Error("Invalid extraFiles key in variant: \"".concat(_extraFileName, "\" appears to be an absolute path. ") + "extraFiles keys in variant definition should be relative paths from the main file.");
|
|
843
|
-
case 46:
|
|
844
|
-
_i5++;
|
|
845
|
-
_context6.next = 42;
|
|
846
|
-
break;
|
|
847
|
-
case 49:
|
|
848
|
-
// Collect extra files from variant definition and from loaded source
|
|
849
|
-
extraFilesToLoad = _objectSpread(_objectSpread({}, variant.extraFiles || {}), mainFileResult.extraFiles || {}); // Track which files come from globals for metadata marking
|
|
850
|
-
globalsFileKeys = new Set(); // Track globals file keys for loadExtraFiles
|
|
851
|
-
// Process globalsCode array and add to extraFiles if provided
|
|
852
|
-
if (!(globalsCode && globalsCode.length > 0)) {
|
|
853
|
-
_context6.next = 61;
|
|
854
|
-
break;
|
|
855
|
-
}
|
|
856
|
-
// Collect existing filenames to avoid conflicts
|
|
857
|
-
existingFiles = new Set(); // Add main variant filename if it exists
|
|
858
|
-
if (variant.fileName) {
|
|
859
|
-
existingFiles.add(variant.fileName);
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
// Add already loaded extra files
|
|
863
|
-
for (_i6 = 0, _Object$keys4 = Object.keys(extraFilesToLoad); _i6 < _Object$keys4.length; _i6++) {
|
|
864
|
-
key = _Object$keys4[_i6];
|
|
865
|
-
existingFiles.add(key);
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
// Process all globals items in parallel
|
|
869
|
-
globalsPromises = globalsCode.map(/*#__PURE__*/function () {
|
|
870
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(globalsItem) {
|
|
871
|
-
var globalsVariant, _getFileNameFromUrl2, globalsFileName, globalsResult;
|
|
872
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context5) {
|
|
873
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
874
|
-
case 0:
|
|
875
|
-
if (!(typeof globalsItem === 'string')) {
|
|
876
|
-
_context5.next = 19;
|
|
877
|
-
break;
|
|
878
|
-
}
|
|
879
|
-
if (loadVariantMeta) {
|
|
880
|
-
_context5.next = 8;
|
|
881
|
-
break;
|
|
882
|
-
}
|
|
883
|
-
// Create a basic variant as fallback
|
|
884
|
-
_getFileNameFromUrl2 = getFileNameFromUrl(globalsItem), globalsFileName = _getFileNameFromUrl2.fileName;
|
|
885
|
-
if (globalsFileName) {
|
|
886
|
-
_context5.next = 5;
|
|
887
|
-
break;
|
|
888
|
-
}
|
|
889
|
-
throw new Error("Cannot determine fileName from globalsCode URL \"".concat(globalsItem, "\". ") + "Please provide a loadVariantMeta function or ensure the URL has a valid file extension.");
|
|
890
|
-
case 5:
|
|
891
|
-
globalsVariant = {
|
|
892
|
-
url: globalsItem,
|
|
893
|
-
fileName: globalsFileName
|
|
894
|
-
};
|
|
895
|
-
_context5.next = 17;
|
|
896
|
-
break;
|
|
897
|
-
case 8:
|
|
898
|
-
_context5.prev = 8;
|
|
899
|
-
_context5.next = 11;
|
|
900
|
-
return loadVariantMeta(variantName, globalsItem);
|
|
901
|
-
case 11:
|
|
902
|
-
globalsVariant = _context5.sent;
|
|
903
|
-
_context5.next = 17;
|
|
904
|
-
break;
|
|
905
|
-
case 14:
|
|
906
|
-
_context5.prev = 14;
|
|
907
|
-
_context5.t0 = _context5["catch"](8);
|
|
908
|
-
throw new Error("Failed to load globalsCode variant metadata (variant: ".concat(variantName, ", url: ").concat(globalsItem, "): ").concat(JSON.stringify(_context5.t0)));
|
|
909
|
-
case 17:
|
|
910
|
-
_context5.next = 20;
|
|
911
|
-
break;
|
|
912
|
-
case 19:
|
|
913
|
-
globalsVariant = globalsItem;
|
|
914
|
-
case 20:
|
|
915
|
-
_context5.prev = 20;
|
|
916
|
-
_context5.next = 23;
|
|
917
|
-
return loadVariant(globalsVariant.url, variantName, globalsVariant, sourceParser, loadSource, loadVariantMeta, sourceTransformers, _objectSpread(_objectSpread({}, options), {}, {
|
|
918
|
-
globalsCode: undefined
|
|
919
|
-
}) // Prevent infinite recursion
|
|
920
|
-
);
|
|
921
|
-
case 23:
|
|
922
|
-
globalsResult = _context5.sent;
|
|
923
|
-
return _context5.abrupt("return", globalsResult);
|
|
924
|
-
case 27:
|
|
925
|
-
_context5.prev = 27;
|
|
926
|
-
_context5.t1 = _context5["catch"](20);
|
|
927
|
-
throw new Error("Failed to load globalsCode (variant: ".concat(variantName, "): ").concat(_context5.t1 instanceof Error ? _context5.t1.message : JSON.stringify(_context5.t1)));
|
|
928
|
-
case 30:
|
|
929
|
-
case "end":
|
|
930
|
-
return _context5.stop();
|
|
931
|
-
}
|
|
932
|
-
}, _callee4, null, [[8, 14], [20, 27]]);
|
|
933
|
-
}));
|
|
934
|
-
return function (_x24) {
|
|
935
|
-
return _ref4.apply(this, arguments);
|
|
936
|
-
};
|
|
937
|
-
}()); // Wait for all globals to load
|
|
938
|
-
_context6.next = 58;
|
|
939
|
-
return Promise.all(globalsPromises);
|
|
940
|
-
case 58:
|
|
941
|
-
globalsResults = _context6.sent;
|
|
942
|
-
// Merge results from all globals
|
|
943
|
-
_iterator5 = _createForOfIteratorHelper(globalsResults);
|
|
944
|
-
try {
|
|
945
|
-
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
946
|
-
globalsResult = _step5.value;
|
|
947
|
-
// Add globals extraFiles (but NOT the main file)
|
|
948
|
-
if (globalsResult.code.extraFiles) {
|
|
949
|
-
// Add globals extra files with conflict-free naming and metadata flag
|
|
950
|
-
for (_i7 = 0, _Object$entries3 = Object.entries(globalsResult.code.extraFiles); _i7 < _Object$entries3.length; _i7++) {
|
|
951
|
-
_Object$entries3$_i = _slicedToArray(_Object$entries3[_i7], 2), _key = _Object$entries3$_i[0], value = _Object$entries3$_i[1];
|
|
952
|
-
conflictFreeKey = generateConflictFreeFilename(_key, existingFiles); // Always add metadata: true flag for globals files
|
|
953
|
-
if (typeof value === 'string') {
|
|
954
|
-
// For string URLs, we can't easily wrap them but need to track for later metadata addition
|
|
955
|
-
extraFilesToLoad[conflictFreeKey] = value;
|
|
956
|
-
globalsFileKeys.add(conflictFreeKey); // Track for loadExtraFiles
|
|
957
|
-
} else {
|
|
958
|
-
// For object values, add metadata directly
|
|
959
|
-
extraFilesToLoad[conflictFreeKey] = _objectSpread(_objectSpread({}, value), {}, {
|
|
960
|
-
metadata: true
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
existingFiles.add(conflictFreeKey); // Track the added file for subsequent iterations
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
// Add globals dependencies
|
|
968
|
-
allFilesUsed.push.apply(allFilesUsed, _toConsumableArray(globalsResult.dependencies));
|
|
969
|
-
|
|
970
|
-
// Add globals externals
|
|
971
|
-
allExternals = mergeExternals([allExternals, globalsResult.externals]);
|
|
972
|
-
}
|
|
973
|
-
} catch (err) {
|
|
974
|
-
_iterator5.e(err);
|
|
975
|
-
} finally {
|
|
976
|
-
_iterator5.f();
|
|
977
|
-
}
|
|
978
|
-
case 61:
|
|
979
|
-
if (!(Object.keys(extraFilesToLoad).length > 0)) {
|
|
980
|
-
_context6.next = 84;
|
|
981
|
-
break;
|
|
982
|
-
}
|
|
983
|
-
if (url) {
|
|
984
|
-
_context6.next = 78;
|
|
985
|
-
break;
|
|
986
|
-
}
|
|
987
|
-
// If there's no URL, we can only load extra files that have inline source or absolute URLs
|
|
988
|
-
loadableFiles = {};
|
|
989
|
-
for (_i8 = 0, _Object$entries4 = Object.entries(extraFilesToLoad); _i8 < _Object$entries4.length; _i8++) {
|
|
990
|
-
_Object$entries4$_i = _slicedToArray(_Object$entries4[_i8], 2), _key2 = _Object$entries4$_i[0], _value = _Object$entries4$_i[1];
|
|
991
|
-
if (typeof _value !== 'string' && _value.source !== undefined) {
|
|
992
|
-
// Inline source - can always load
|
|
993
|
-
loadableFiles[_key2] = _value;
|
|
994
|
-
} else if (typeof _value === 'string' && (_value.includes('://') || _value.startsWith('/'))) {
|
|
995
|
-
// Absolute URL - can load without base URL
|
|
996
|
-
loadableFiles[_key2] = _value;
|
|
997
|
-
} else {
|
|
998
|
-
console.warn("Skipping extra file \"".concat(_key2, "\" - no URL provided and file requires loading from external source"));
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
if (!(Object.keys(loadableFiles).length > 0)) {
|
|
1002
|
-
_context6.next = 76;
|
|
1003
|
-
break;
|
|
1004
|
-
}
|
|
1005
|
-
// Process loadable files: inline sources without URL-based loading, absolute URLs with loading
|
|
1006
|
-
for (_i9 = 0, _Object$entries5 = Object.entries(loadableFiles); _i9 < _Object$entries5.length; _i9++) {
|
|
1007
|
-
_Object$entries5$_i = _slicedToArray(_Object$entries5[_i9], 2), _key3 = _Object$entries5$_i[0], _value2 = _Object$entries5$_i[1];
|
|
1008
|
-
if (typeof _value2 !== 'string') {
|
|
1009
|
-
// Inline source - preserve metadata if it was marked as globals
|
|
1010
|
-
metadata = _value2.metadata || globalsFileKeys.has(_key3) ? true : undefined;
|
|
1011
|
-
allExtraFiles[normalizePathKey(_key3)] = _objectSpread({
|
|
1012
|
-
source: _value2.source,
|
|
1013
|
-
transforms: _value2.transforms
|
|
1014
|
-
}, metadata !== undefined && {
|
|
1015
|
-
metadata: metadata
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
// For absolute URLs, we need to load them
|
|
1021
|
-
urlFilesToLoad = {};
|
|
1022
|
-
for (_i0 = 0, _Object$entries6 = Object.entries(loadableFiles); _i0 < _Object$entries6.length; _i0++) {
|
|
1023
|
-
_Object$entries6$_i = _slicedToArray(_Object$entries6[_i0], 2), _key4 = _Object$entries6$_i[0], _value3 = _Object$entries6$_i[1];
|
|
1024
|
-
if (typeof _value3 === 'string') {
|
|
1025
|
-
urlFilesToLoad[_key4] = _value3;
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
if (!(Object.keys(urlFilesToLoad).length > 0)) {
|
|
1029
|
-
_context6.next = 76;
|
|
1030
|
-
break;
|
|
1031
|
-
}
|
|
1032
|
-
_context6.next = 72;
|
|
1033
|
-
return loadExtraFiles(variantName, urlFilesToLoad, '',
|
|
1034
|
-
// No base URL needed for absolute URLs
|
|
1035
|
-
'',
|
|
1036
|
-
// No entry URL
|
|
1037
|
-
loadSource, sourceParser, sourceTransformers, loadSourceCache, _objectSpread(_objectSpread({}, options), {}, {
|
|
1038
|
-
loadedFiles: loadedFiles
|
|
1039
|
-
}), variant.allFilesListed || false, knownExtraFiles, globalsFileKeys // Pass globals file tracking
|
|
1040
|
-
);
|
|
1041
|
-
case 72:
|
|
1042
|
-
extraFilesResult = _context6.sent;
|
|
1043
|
-
allExtraFiles = _objectSpread(_objectSpread({}, allExtraFiles), extraFilesResult.extraFiles);
|
|
1044
|
-
allFilesUsed.push.apply(allFilesUsed, _toConsumableArray(extraFilesResult.allFilesUsed));
|
|
1045
|
-
allExternals = mergeExternals([allExternals, extraFilesResult.allExternals]);
|
|
1046
|
-
case 76:
|
|
1047
|
-
_context6.next = 84;
|
|
1048
|
-
break;
|
|
1049
|
-
case 78:
|
|
1050
|
-
_context6.next = 80;
|
|
1051
|
-
return loadExtraFiles(variantName, extraFilesToLoad, url, url,
|
|
1052
|
-
// Entry URL is the same as the main file URL
|
|
1053
|
-
loadSource, sourceParser, sourceTransformers, loadSourceCache, _objectSpread(_objectSpread({}, options), {}, {
|
|
1054
|
-
loadedFiles: loadedFiles
|
|
1055
|
-
}), variant.allFilesListed || false, knownExtraFiles, globalsFileKeys // Pass globals file tracking
|
|
1056
|
-
);
|
|
1057
|
-
case 80:
|
|
1058
|
-
_extraFilesResult = _context6.sent;
|
|
1059
|
-
allExtraFiles = _extraFilesResult.extraFiles;
|
|
1060
|
-
allFilesUsed.push.apply(allFilesUsed, _toConsumableArray(_extraFilesResult.allFilesUsed));
|
|
1061
|
-
allExternals = mergeExternals([allExternals, _extraFilesResult.allExternals]);
|
|
1062
|
-
case 84:
|
|
1063
|
-
// Note: metadata marking is now handled during loadExtraFiles processing
|
|
1064
|
-
finalVariant = _objectSpread(_objectSpread({}, variant), {}, {
|
|
1065
|
-
source: mainFileResult.source,
|
|
1066
|
-
transforms: mainFileResult.transforms,
|
|
1067
|
-
extraFiles: Object.keys(allExtraFiles).length > 0 ? allExtraFiles : undefined,
|
|
1068
|
-
externals: Object.keys(allExternals).length > 0 ? Object.keys(allExternals) : undefined
|
|
1069
|
-
});
|
|
1070
|
-
return _context6.abrupt("return", {
|
|
1071
|
-
code: finalVariant,
|
|
1072
|
-
dependencies: Array.from(new Set(allFilesUsed)),
|
|
1073
|
-
// Remove duplicates
|
|
1074
|
-
externals: allExternals
|
|
1075
|
-
});
|
|
1076
|
-
case 86:
|
|
1077
|
-
case "end":
|
|
1078
|
-
return _context6.stop();
|
|
1079
|
-
}
|
|
1080
|
-
}, _callee5, null, [[13, 19]]);
|
|
1081
|
-
}));
|
|
1082
|
-
return _loadVariant.apply(this, arguments);
|
|
1083
|
-
}
|