@mui/internal-docs-infra 0.2.3-canary.9 → 0.3.1-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/esm/CodeHighlighter/CodeHighlighter.js +16 -16
- package/esm/CodeHighlighter/CodeHighlighterClient.js +33 -33
- package/esm/CodeHighlighter/errors.js +3 -3
- package/esm/CodeHighlighter/types.d.ts +1 -1
- package/esm/CodeProvider/CodeContext.d.ts +4 -4
- package/esm/CodeProvider/CodeProvider.js +7 -7
- package/esm/cli/index.d.ts +1 -0
- package/esm/cli/index.js +6 -0
- package/esm/cli/runValidate.d.ts +8 -0
- package/esm/cli/runValidate.js +297 -0
- package/esm/createSitemap/createSitemap.d.ts +23 -0
- package/esm/createSitemap/createSitemap.js +45 -0
- package/esm/createSitemap/index.d.ts +1 -0
- package/esm/createSitemap/index.js +1 -0
- package/esm/createSitemap/types.d.ts +68 -0
- package/esm/createSitemap/types.js +1 -0
- package/esm/pipeline/getFileConventions/fileConventions.d.ts +4 -0
- package/esm/pipeline/getFileConventions/fileConventions.js +4 -0
- package/esm/pipeline/getFileConventions/getFileConventions.d.ts +4 -0
- package/esm/pipeline/getFileConventions/getFileConventions.js +17 -0
- package/esm/pipeline/getFileConventions/index.d.ts +1 -0
- package/esm/pipeline/getFileConventions/index.js +1 -0
- package/esm/{CodeHighlighter/addPathsToVariant.d.ts → pipeline/loadCodeVariant/addCodeVariantPaths.d.ts} +1 -1
- package/esm/{CodeHighlighter/applyTransform.d.ts → pipeline/loadCodeVariant/applyCodeTransform.d.ts} +3 -3
- package/esm/{CodeHighlighter/applyTransform.js → pipeline/loadCodeVariant/applyCodeTransform.js} +4 -4
- package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/calculateMainFilePath.js +1 -1
- package/esm/{CodeHighlighter/transformCode.d.ts → pipeline/loadCodeVariant/computeHastDeltas.d.ts} +9 -5
- package/esm/{CodeHighlighter/transformCode.js → pipeline/loadCodeVariant/computeHastDeltas.js} +20 -16
- package/esm/pipeline/loadCodeVariant/diffHast.d.ts +3 -0
- package/esm/{CodeHighlighter/transformParsedSource.js → pipeline/loadCodeVariant/diffHast.js} +5 -5
- package/esm/{CodeHighlighter/examineVariant.d.ts → pipeline/loadCodeVariant/examineCodeVariant.d.ts} +2 -2
- package/esm/{CodeHighlighter/examineVariant.js → pipeline/loadCodeVariant/examineCodeVariant.js} +1 -1
- package/esm/{useDemo/flattenVariant.d.ts → pipeline/loadCodeVariant/flattenCodeVariant.d.ts} +2 -2
- package/esm/{useDemo/flattenVariant.js → pipeline/loadCodeVariant/flattenCodeVariant.js} +3 -3
- package/esm/{CodeHighlighter/hasAllVariants.d.ts → pipeline/loadCodeVariant/hasAllCodeVariants.d.ts} +1 -1
- package/esm/pipeline/loadCodeVariant/index.d.ts +10 -0
- package/esm/pipeline/loadCodeVariant/index.js +17 -0
- package/esm/{CodeHighlighter/loadFallbackCode.d.ts → pipeline/loadCodeVariant/loadCodeFallback.d.ts} +2 -2
- package/esm/{CodeHighlighter/loadFallbackCode.js → pipeline/loadCodeVariant/loadCodeFallback.js} +180 -106
- package/esm/{CodeHighlighter/loadVariant.d.ts → pipeline/loadCodeVariant/loadCodeVariant.d.ts} +2 -2
- package/esm/{CodeHighlighter/loadVariant.js → pipeline/loadCodeVariant/loadCodeVariant.js} +141 -55
- package/esm/{CodeHighlighter/maybeInitialData.d.ts → pipeline/loadCodeVariant/maybeCodeInitialData.d.ts} +6 -6
- package/esm/{CodeHighlighter/maybeInitialData.js → pipeline/loadCodeVariant/maybeCodeInitialData.js} +6 -6
- package/esm/{CodeHighlighter/mergeMetadata.d.ts → pipeline/loadCodeVariant/mergeCodeMetadata.d.ts} +3 -3
- package/esm/{CodeHighlighter/mergeMetadata.js → pipeline/loadCodeVariant/mergeCodeMetadata.js} +3 -3
- package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/parseCode.d.ts +1 -1
- package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/transformSource.d.ts +1 -1
- package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +5 -0
- package/esm/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +94 -16
- package/esm/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +3 -3
- package/esm/pipeline/loadPrecomputedCodeHighlighter/performanceLogger.d.ts +30 -0
- package/esm/pipeline/loadPrecomputedCodeHighlighter/performanceLogger.js +77 -0
- package/esm/pipeline/loadPrecomputedCodeHighlighterClient/loadPrecomputedCodeHighlighterClient.js +24 -14
- package/esm/pipeline/loadPrecomputedSitemap/index.d.ts +2 -0
- package/esm/pipeline/loadPrecomputedSitemap/index.js +4 -0
- package/esm/pipeline/loadPrecomputedSitemap/loadPrecomputedSitemap.d.ts +10 -0
- package/esm/pipeline/loadPrecomputedSitemap/loadPrecomputedSitemap.js +220 -0
- package/esm/pipeline/loadServerCodeMeta/index.d.ts +2 -1
- package/esm/pipeline/loadServerCodeMeta/index.js +2 -1
- package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts +1 -1
- package/esm/pipeline/loadServerCodeMeta/loadServerCodeMeta.js +7 -5
- package/esm/pipeline/{loaderUtils → loadServerCodeMeta}/resolveModulePathWithFs.d.ts +3 -3
- package/esm/pipeline/{loaderUtils → loadServerCodeMeta}/resolveModulePathWithFs.js +14 -8
- package/esm/pipeline/loadServerPageIndex/index.d.ts +2 -0
- package/esm/pipeline/loadServerPageIndex/index.js +1 -0
- package/esm/pipeline/loadServerPageIndex/loadServerPageIndex.d.ts +51 -0
- package/esm/pipeline/loadServerPageIndex/loadServerPageIndex.js +176 -0
- package/esm/pipeline/loadServerSitemap/index.d.ts +2 -0
- package/esm/pipeline/loadServerSitemap/index.js +1 -0
- package/esm/pipeline/loadServerSitemap/loadServerSitemap.d.ts +39 -0
- package/esm/pipeline/loadServerSitemap/loadServerSitemap.js +170 -0
- package/esm/pipeline/loadServerSource/loadServerSource.js +18 -15
- package/esm/pipeline/loaderUtils/externalsToPackages.js +1 -1
- package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts +0 -9
- package/esm/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +7 -7
- package/esm/pipeline/loaderUtils/fileUrlToPortablePath.d.ts +44 -0
- package/esm/pipeline/loaderUtils/fileUrlToPortablePath.js +80 -0
- package/esm/pipeline/loaderUtils/index.d.ts +2 -1
- package/esm/pipeline/loaderUtils/index.js +2 -1
- package/esm/pipeline/loaderUtils/parseImportsAndComments.d.ts +10 -6
- package/esm/pipeline/loaderUtils/parseImportsAndComments.js +17 -12
- package/esm/pipeline/loaderUtils/processRelativeImports.d.ts +1 -1
- package/esm/pipeline/loaderUtils/processRelativeImports.js +44 -27
- package/esm/pipeline/loaderUtils/resolveModulePath.d.ts +5 -5
- package/esm/pipeline/loaderUtils/resolveModulePath.js +40 -37
- package/esm/pipeline/loaderUtils/rewriteImports.d.ts +36 -0
- package/esm/pipeline/loaderUtils/rewriteImports.js +139 -8
- package/esm/pipeline/syncPageIndex/createMarkdownNodes.d.ts +76 -0
- package/esm/pipeline/syncPageIndex/createMarkdownNodes.js +305 -0
- package/esm/pipeline/syncPageIndex/index.d.ts +1 -0
- package/esm/pipeline/syncPageIndex/index.js +1 -0
- package/esm/pipeline/syncPageIndex/mergeMetadataMarkdown.d.ts +58 -0
- package/esm/pipeline/syncPageIndex/mergeMetadataMarkdown.js +214 -0
- package/esm/pipeline/syncPageIndex/metadataToMarkdown.d.ts +67 -0
- package/esm/pipeline/syncPageIndex/metadataToMarkdown.js +1486 -0
- package/esm/pipeline/syncPageIndex/syncPageIndex.d.ts +108 -0
- package/esm/pipeline/syncPageIndex/syncPageIndex.js +540 -0
- package/esm/pipeline/transformHtmlCodePrecomputed/transformHtmlCodePrecomputed.d.ts +2 -2
- package/esm/pipeline/transformHtmlCodePrecomputed/transformHtmlCodePrecomputed.js +5 -5
- package/esm/pipeline/transformMarkdownBlockquoteCallouts/index.d.ts +2 -0
- package/esm/pipeline/transformMarkdownBlockquoteCallouts/index.js +4 -0
- package/esm/pipeline/transformMarkdownBlockquoteCallouts/transformMarkdownBlockquoteCallouts.d.ts +16 -0
- package/esm/pipeline/transformMarkdownBlockquoteCallouts/transformMarkdownBlockquoteCallouts.js +58 -0
- package/esm/pipeline/transformMarkdownDemoLinks/index.d.ts +2 -0
- package/esm/pipeline/transformMarkdownDemoLinks/index.js +4 -0
- package/esm/pipeline/transformMarkdownDemoLinks/transformMarkdownDemoLinks.d.ts +26 -0
- package/esm/pipeline/transformMarkdownDemoLinks/transformMarkdownDemoLinks.js +107 -0
- package/esm/pipeline/transformMarkdownMetadata/index.d.ts +2 -0
- package/esm/pipeline/transformMarkdownMetadata/index.js +4 -0
- package/esm/pipeline/transformMarkdownMetadata/transformMarkdownMetadata.d.ts +3 -0
- package/esm/pipeline/transformMarkdownMetadata/transformMarkdownMetadata.js +1010 -0
- package/esm/pipeline/transformMarkdownMetadata/types.d.ts +110 -0
- package/esm/pipeline/transformMarkdownMetadata/types.js +1 -0
- package/esm/pipeline/transformMarkdownRelativePaths/index.d.ts +2 -0
- package/esm/pipeline/transformMarkdownRelativePaths/index.js +4 -0
- package/esm/pipeline/transformMarkdownRelativePaths/transformMarkdownRelativePaths.d.ts +15 -0
- package/esm/pipeline/transformMarkdownRelativePaths/transformMarkdownRelativePaths.js +43 -0
- package/esm/useCode/Pre.js +15 -2
- package/esm/useCode/useCode.d.ts +15 -2
- package/esm/useCode/useCode.js +15 -6
- package/esm/useCode/useCodeUtils.js +3 -3
- package/esm/useCode/useFileNavigation.d.ts +9 -3
- package/esm/useCode/useFileNavigation.js +124 -81
- package/esm/useCode/useUIState.d.ts +4 -1
- package/esm/useCode/useUIState.js +17 -2
- package/esm/useCode/useVariantSelection.d.ts +8 -3
- package/esm/useCode/useVariantSelection.js +144 -52
- package/esm/useCopier/index.js +5 -4
- package/esm/useDemo/createCodeSandbox.d.ts +1 -1
- package/esm/useDemo/createStackBlitz.d.ts +1 -1
- package/esm/useDemo/exportVariant.js +13 -11
- package/esm/useDemo/index.d.ts +1 -1
- package/esm/useDemo/index.js +1 -1
- package/esm/useDemo/useDemo.d.ts +5 -5
- package/esm/useDemo/useDemo.js +6 -6
- package/esm/useErrors/useErrors.d.ts +1 -1
- package/esm/useErrors/useErrors.js +6 -2
- package/esm/useSearch/index.d.ts +1 -0
- package/esm/useSearch/index.js +1 -0
- package/esm/useSearch/types.d.ts +165 -0
- package/esm/useSearch/types.js +1 -0
- package/esm/useSearch/useSearch.d.ts +56 -0
- package/esm/useSearch/useSearch.js +647 -0
- package/esm/withDocsInfra/withDeploymentConfig.js +4 -2
- package/esm/withDocsInfra/withDocsInfra.d.ts +39 -0
- package/esm/withDocsInfra/withDocsInfra.js +94 -14
- package/package.json +105 -5
- package/esm/CodeHighlighter/transformParsedSource.d.ts +0 -3
- /package/esm/{CodeHighlighter/addPathsToVariant.js → pipeline/loadCodeVariant/addCodeVariantPaths.js} +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/calculateMainFilePath.d.ts +0 -0
- /package/esm/{CodeHighlighter/hasAllVariants.js → pipeline/loadCodeVariant/hasAllCodeVariants.js} +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/parseCode.js +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/pathUtils.d.ts +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/pathUtils.js +0 -0
- /package/esm/{CodeHighlighter → pipeline/loadCodeVariant}/transformSource.js +0 -0
package/esm/{CodeHighlighter/loadFallbackCode.js → pipeline/loadCodeVariant/loadCodeFallback.js}
RENAMED
|
@@ -4,8 +4,9 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
import _regenerator from "@babel/runtime/helpers/esm/regenerator";
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
|
-
import {
|
|
8
|
-
import { getFileNameFromUrl } from "../
|
|
7
|
+
import { loadCodeVariant } from "./loadCodeVariant.js";
|
|
8
|
+
import { getFileNameFromUrl } from "../loaderUtils/index.js";
|
|
9
|
+
import { performanceMeasure } from "../loadPrecomputedCodeHighlighter/performanceLogger.js";
|
|
9
10
|
|
|
10
11
|
// Helper function to get the source for a specific filename from a variant
|
|
11
12
|
function getFileSource(_x, _x2, _x3) {
|
|
@@ -83,11 +84,11 @@ function _getFileSource() {
|
|
|
83
84
|
}));
|
|
84
85
|
return _getFileSource.apply(this, arguments);
|
|
85
86
|
}
|
|
86
|
-
export function
|
|
87
|
-
return
|
|
87
|
+
export function loadCodeFallback(_x4, _x5, _x6) {
|
|
88
|
+
return _loadCodeFallback.apply(this, arguments);
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
90
|
+
function _loadCodeFallback() {
|
|
91
|
+
_loadCodeFallback = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(url, initialVariant, loaded) {
|
|
91
92
|
var options,
|
|
92
93
|
shouldHighlight,
|
|
93
94
|
fallbackUsesExtraFiles,
|
|
@@ -100,6 +101,8 @@ function _loadFallbackCode() {
|
|
|
100
101
|
variants,
|
|
101
102
|
globalsCode,
|
|
102
103
|
output,
|
|
104
|
+
functionName,
|
|
105
|
+
currentMark,
|
|
103
106
|
initial,
|
|
104
107
|
_allFileNames,
|
|
105
108
|
fileSource,
|
|
@@ -107,11 +110,13 @@ function _loadFallbackCode() {
|
|
|
107
110
|
result,
|
|
108
111
|
parseSource,
|
|
109
112
|
quickVariant,
|
|
113
|
+
beforeInitialVariantMark,
|
|
110
114
|
_allFileNames2,
|
|
111
115
|
_fileSource,
|
|
112
116
|
_actualFilename,
|
|
113
117
|
_result,
|
|
114
118
|
_parseSource,
|
|
119
|
+
beforeGlobalsMark,
|
|
115
120
|
globalsCodeObjects,
|
|
116
121
|
hasStringUrls,
|
|
117
122
|
globalsPromises,
|
|
@@ -120,9 +125,10 @@ function _loadFallbackCode() {
|
|
|
120
125
|
_step,
|
|
121
126
|
codeObj,
|
|
122
127
|
targetVariant,
|
|
123
|
-
_yield$
|
|
128
|
+
_yield$loadCodeVarian,
|
|
124
129
|
loadedVariant,
|
|
125
130
|
allFileNames,
|
|
131
|
+
beforeAllVariantMark,
|
|
126
132
|
allVariants,
|
|
127
133
|
variantPromises,
|
|
128
134
|
variantResults,
|
|
@@ -145,11 +151,14 @@ function _loadFallbackCode() {
|
|
|
145
151
|
options = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : {};
|
|
146
152
|
shouldHighlight = options.shouldHighlight, fallbackUsesExtraFiles = options.fallbackUsesExtraFiles, fallbackUsesAllVariants = options.fallbackUsesAllVariants, sourceParser = options.sourceParser, loadSource = options.loadSource, loadVariantMeta = options.loadVariantMeta, loadCodeMeta = options.loadCodeMeta, initialFilename = options.initialFilename, variants = options.variants, globalsCode = options.globalsCode, output = options.output;
|
|
147
153
|
loaded = _extends({}, loaded);
|
|
148
|
-
|
|
149
|
-
|
|
154
|
+
functionName = 'Load Fallback Code';
|
|
155
|
+
currentMark = performanceMeasure(undefined, {
|
|
156
|
+
mark: 'Start',
|
|
157
|
+
measure: 'Start'
|
|
158
|
+
}, [functionName, url], true); // Step 1: Ensure we have the initial variant loaded
|
|
150
159
|
initial = loaded[initialVariant];
|
|
151
160
|
if (initial) {
|
|
152
|
-
_context4.n =
|
|
161
|
+
_context4.n = 6;
|
|
153
162
|
break;
|
|
154
163
|
}
|
|
155
164
|
if (loadCodeMeta) {
|
|
@@ -177,8 +186,13 @@ function _loadFallbackCode() {
|
|
|
177
186
|
}
|
|
178
187
|
throw new Error("Initial variant \"".concat(initialVariant, "\" not found in loaded code."));
|
|
179
188
|
case 5:
|
|
189
|
+
currentMark = performanceMeasure(currentMark, {
|
|
190
|
+
mark: 'Loaded Code Meta',
|
|
191
|
+
measure: 'Code Meta Loading'
|
|
192
|
+
}, [functionName, url]);
|
|
193
|
+
case 6:
|
|
180
194
|
if (!(typeof initial !== 'string' && initial.allFilesListed && !fallbackUsesExtraFiles && !fallbackUsesAllVariants)) {
|
|
181
|
-
_context4.n =
|
|
195
|
+
_context4.n = 17;
|
|
182
196
|
break;
|
|
183
197
|
}
|
|
184
198
|
// Collect all file names from the loaded code
|
|
@@ -193,40 +207,50 @@ function _loadFallbackCode() {
|
|
|
193
207
|
}
|
|
194
208
|
|
|
195
209
|
// Get the source for the requested filename (or main file if not specified)
|
|
196
|
-
_context4.p =
|
|
197
|
-
_context4.n =
|
|
210
|
+
_context4.p = 7;
|
|
211
|
+
_context4.n = 8;
|
|
198
212
|
return getFileSource(initial, initialFilename, loadSource);
|
|
199
|
-
case
|
|
213
|
+
case 8:
|
|
200
214
|
result = _context4.v;
|
|
201
215
|
fileSource = result.source;
|
|
202
216
|
actualFilename = result.filename;
|
|
203
|
-
_context4.n =
|
|
217
|
+
_context4.n = 10;
|
|
204
218
|
break;
|
|
205
|
-
case
|
|
206
|
-
_context4.p =
|
|
219
|
+
case 9:
|
|
220
|
+
_context4.p = 9;
|
|
207
221
|
_t5 = _context4.v;
|
|
208
222
|
throw new Error("Failed to get source for file ".concat(initialFilename || initial.fileName, " in variant ").concat(initialVariant, ": ").concat(_t5));
|
|
209
|
-
case
|
|
223
|
+
case 10:
|
|
224
|
+
currentMark = performanceMeasure(currentMark, {
|
|
225
|
+
mark: 'Loaded Main File',
|
|
226
|
+
measure: 'Main File Loading'
|
|
227
|
+
}, [functionName, url]);
|
|
228
|
+
|
|
229
|
+
// If we need highlighting and have a string source, parse it
|
|
210
230
|
if (!(shouldHighlight && typeof fileSource === 'string' && sourceParser && actualFilename)) {
|
|
211
|
-
_context4.n =
|
|
231
|
+
_context4.n = 15;
|
|
212
232
|
break;
|
|
213
233
|
}
|
|
214
|
-
_context4.p =
|
|
215
|
-
_context4.n =
|
|
234
|
+
_context4.p = 11;
|
|
235
|
+
_context4.n = 12;
|
|
216
236
|
return sourceParser;
|
|
217
|
-
case
|
|
237
|
+
case 12:
|
|
218
238
|
parseSource = _context4.v;
|
|
219
239
|
fileSource = parseSource(fileSource, actualFilename);
|
|
220
|
-
_context4.n =
|
|
240
|
+
_context4.n = 14;
|
|
221
241
|
break;
|
|
222
|
-
case
|
|
223
|
-
_context4.p =
|
|
242
|
+
case 13:
|
|
243
|
+
_context4.p = 13;
|
|
224
244
|
_t6 = _context4.v;
|
|
225
245
|
throw new Error("Failed to parse source for highlighting (variant: ".concat(initialVariant, ", file: ").concat(actualFilename, "): ").concat(JSON.stringify(_t6)));
|
|
226
|
-
case 13:
|
|
227
|
-
_context4.n = 15;
|
|
228
|
-
break;
|
|
229
246
|
case 14:
|
|
247
|
+
currentMark = performanceMeasure(currentMark, {
|
|
248
|
+
mark: 'Parsed Main File',
|
|
249
|
+
measure: 'Main File Parsing'
|
|
250
|
+
}, [functionName, url]);
|
|
251
|
+
_context4.n = 16;
|
|
252
|
+
break;
|
|
253
|
+
case 15:
|
|
230
254
|
if (shouldHighlight && typeof fileSource === 'string' && !actualFilename) {
|
|
231
255
|
// Create basic HAST node when we can't parse due to missing filename
|
|
232
256
|
// This marks that the source has passed through the parsing pipeline
|
|
@@ -238,7 +262,7 @@ function _loadFallbackCode() {
|
|
|
238
262
|
}]
|
|
239
263
|
};
|
|
240
264
|
}
|
|
241
|
-
case
|
|
265
|
+
case 16:
|
|
242
266
|
// Update the loaded code with any changes we made
|
|
243
267
|
if (actualFilename && actualFilename === initial.fileName) {
|
|
244
268
|
initial = _extends(_extends({}, initial), {}, {
|
|
@@ -261,35 +285,40 @@ function _loadFallbackCode() {
|
|
|
261
285
|
initialExtraFiles: initial.extraFiles || {},
|
|
262
286
|
allFileNames: Array.from(_allFileNames)
|
|
263
287
|
});
|
|
264
|
-
case
|
|
288
|
+
case 17:
|
|
265
289
|
if (!(typeof initial === 'string')) {
|
|
266
|
-
_context4.n =
|
|
290
|
+
_context4.n = 34;
|
|
267
291
|
break;
|
|
268
292
|
}
|
|
269
|
-
_context4.p =
|
|
293
|
+
_context4.p = 18;
|
|
270
294
|
if (!loadVariantMeta) {
|
|
271
|
-
_context4.n =
|
|
295
|
+
_context4.n = 20;
|
|
272
296
|
break;
|
|
273
297
|
}
|
|
274
|
-
_context4.n =
|
|
298
|
+
_context4.n = 19;
|
|
275
299
|
return loadVariantMeta(initialVariant, initial);
|
|
276
|
-
case
|
|
300
|
+
case 19:
|
|
277
301
|
quickVariant = _context4.v;
|
|
278
|
-
|
|
302
|
+
currentMark = performanceMeasure(currentMark, {
|
|
303
|
+
mark: 'Loaded Initial Variant Meta',
|
|
304
|
+
measure: 'Initial Variant Meta Loading'
|
|
305
|
+
}, [functionName, url]);
|
|
306
|
+
_context4.n = 21;
|
|
279
307
|
break;
|
|
280
|
-
case
|
|
308
|
+
case 20:
|
|
281
309
|
// Create a basic variant using fallback logic
|
|
282
310
|
quickVariant = {
|
|
283
311
|
url: initial,
|
|
284
312
|
fileName: getFileNameFromUrl(initial).fileName
|
|
285
313
|
};
|
|
286
|
-
case
|
|
314
|
+
case 21:
|
|
315
|
+
beforeInitialVariantMark = currentMark;
|
|
287
316
|
loaded = _extends(_extends({}, loaded), {}, _defineProperty({}, initialVariant, quickVariant));
|
|
288
317
|
initial = quickVariant;
|
|
289
318
|
|
|
290
319
|
// If we have all files listed and don't need extra file processing, we can optimize
|
|
291
320
|
if (!(quickVariant.allFilesListed && !fallbackUsesExtraFiles && !fallbackUsesAllVariants)) {
|
|
292
|
-
_context4.n =
|
|
321
|
+
_context4.n = 32;
|
|
293
322
|
break;
|
|
294
323
|
}
|
|
295
324
|
// Collect all file names from the quick load
|
|
@@ -304,40 +333,48 @@ function _loadFallbackCode() {
|
|
|
304
333
|
}
|
|
305
334
|
|
|
306
335
|
// Get the source for the requested filename (or main file if not specified)
|
|
307
|
-
_context4.p =
|
|
308
|
-
_context4.n =
|
|
336
|
+
_context4.p = 22;
|
|
337
|
+
_context4.n = 23;
|
|
309
338
|
return getFileSource(quickVariant, initialFilename, loadSource);
|
|
310
|
-
case
|
|
339
|
+
case 23:
|
|
311
340
|
_result = _context4.v;
|
|
312
341
|
_fileSource = _result.source;
|
|
313
342
|
_actualFilename = _result.filename;
|
|
314
|
-
|
|
343
|
+
currentMark = performanceMeasure(currentMark, {
|
|
344
|
+
mark: 'Loaded Initial File',
|
|
345
|
+
measure: 'Initial File Loading'
|
|
346
|
+
}, [functionName, initialFilename || 'unknown', url]);
|
|
347
|
+
_context4.n = 25;
|
|
315
348
|
break;
|
|
316
|
-
case
|
|
317
|
-
_context4.p =
|
|
349
|
+
case 24:
|
|
350
|
+
_context4.p = 24;
|
|
318
351
|
_t7 = _context4.v;
|
|
319
352
|
throw new Error("Failed to get source for file ".concat(initialFilename || quickVariant.fileName, " in variant ").concat(initialVariant, ": ").concat(_t7));
|
|
320
|
-
case
|
|
353
|
+
case 25:
|
|
321
354
|
if (!(shouldHighlight && typeof _fileSource === 'string' && sourceParser && _actualFilename)) {
|
|
322
|
-
_context4.n =
|
|
355
|
+
_context4.n = 30;
|
|
323
356
|
break;
|
|
324
357
|
}
|
|
325
|
-
_context4.p =
|
|
326
|
-
_context4.n =
|
|
358
|
+
_context4.p = 26;
|
|
359
|
+
_context4.n = 27;
|
|
327
360
|
return sourceParser;
|
|
328
|
-
case
|
|
361
|
+
case 27:
|
|
329
362
|
_parseSource = _context4.v;
|
|
330
363
|
_fileSource = _parseSource(_fileSource, _actualFilename);
|
|
331
|
-
|
|
364
|
+
currentMark = performanceMeasure(currentMark, {
|
|
365
|
+
mark: 'Parsed Initial File',
|
|
366
|
+
measure: 'Initial File Parsing'
|
|
367
|
+
}, [functionName, initialFilename || 'unknown', url]);
|
|
368
|
+
_context4.n = 29;
|
|
332
369
|
break;
|
|
333
|
-
case
|
|
334
|
-
_context4.p =
|
|
370
|
+
case 28:
|
|
371
|
+
_context4.p = 28;
|
|
335
372
|
_t8 = _context4.v;
|
|
336
373
|
throw new Error("Failed to parse source for highlighting (variant: ".concat(initialVariant, ", file: ").concat(_actualFilename, "): ").concat(JSON.stringify(_t8)));
|
|
337
|
-
case 28:
|
|
338
|
-
_context4.n = 30;
|
|
339
|
-
break;
|
|
340
374
|
case 29:
|
|
375
|
+
_context4.n = 31;
|
|
376
|
+
break;
|
|
377
|
+
case 30:
|
|
341
378
|
if (shouldHighlight && typeof _fileSource === 'string' && !_actualFilename) {
|
|
342
379
|
// Create basic HAST node when we can't parse due to missing filename
|
|
343
380
|
// This marks that the source has passed through the parsing pipeline
|
|
@@ -349,7 +386,7 @@ function _loadFallbackCode() {
|
|
|
349
386
|
}]
|
|
350
387
|
};
|
|
351
388
|
}
|
|
352
|
-
case
|
|
389
|
+
case 31:
|
|
353
390
|
// Update the loaded code with any changes we made
|
|
354
391
|
if (_actualFilename && _actualFilename === quickVariant.fileName) {
|
|
355
392
|
initial = _extends(_extends({}, quickVariant), {}, {
|
|
@@ -363,6 +400,10 @@ function _loadFallbackCode() {
|
|
|
363
400
|
});
|
|
364
401
|
loaded = _extends(_extends({}, loaded), {}, _defineProperty({}, initialVariant, initial));
|
|
365
402
|
}
|
|
403
|
+
currentMark = performanceMeasure(beforeInitialVariantMark, {
|
|
404
|
+
mark: 'Loaded Initial Files',
|
|
405
|
+
measure: 'Initial Files Loading'
|
|
406
|
+
}, [functionName, url], true);
|
|
366
407
|
|
|
367
408
|
// Early return - we have all the info we need
|
|
368
409
|
return _context4.a(2, {
|
|
@@ -372,31 +413,33 @@ function _loadFallbackCode() {
|
|
|
372
413
|
initialExtraFiles: quickVariant.extraFiles || {},
|
|
373
414
|
allFileNames: Array.from(_allFileNames2)
|
|
374
415
|
});
|
|
375
|
-
case 31:
|
|
376
|
-
_context4.n = 33;
|
|
377
|
-
break;
|
|
378
416
|
case 32:
|
|
379
|
-
_context4.
|
|
417
|
+
_context4.n = 34;
|
|
418
|
+
break;
|
|
419
|
+
case 33:
|
|
420
|
+
_context4.p = 33;
|
|
380
421
|
_t9 = _context4.v;
|
|
381
422
|
throw new Error("Failed to load initial variant code (variant: ".concat(initialVariant, ", url: ").concat(initial, "): ").concat(JSON.stringify(_t9)));
|
|
382
|
-
case
|
|
423
|
+
case 34:
|
|
424
|
+
beforeGlobalsMark = currentMark; // Step 2b: Fall back to full loadCodeVariant processing
|
|
425
|
+
// Load globalsCode - convert string URLs to Code objects, keep Code objects as-is
|
|
383
426
|
if (!(globalsCode && globalsCode.length > 0)) {
|
|
384
|
-
_context4.n =
|
|
427
|
+
_context4.n = 37;
|
|
385
428
|
break;
|
|
386
429
|
}
|
|
387
430
|
hasStringUrls = globalsCode.some(function (item) {
|
|
388
431
|
return typeof item === 'string';
|
|
389
432
|
});
|
|
390
433
|
if (!(hasStringUrls && !loadCodeMeta)) {
|
|
391
|
-
_context4.n =
|
|
434
|
+
_context4.n = 35;
|
|
392
435
|
break;
|
|
393
436
|
}
|
|
394
437
|
throw new Error('loadCodeMeta function is required when globalsCode contains string URLs');
|
|
395
|
-
case
|
|
438
|
+
case 35:
|
|
396
439
|
// Load all string URLs in parallel, keep Code objects as-is
|
|
397
440
|
globalsPromises = globalsCode.map(/*#__PURE__*/function () {
|
|
398
441
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(globalItem) {
|
|
399
|
-
var _t;
|
|
442
|
+
var codeMeta, _t;
|
|
400
443
|
return _regenerator().w(function (_context2) {
|
|
401
444
|
while (1) switch (_context2.p = _context2.n) {
|
|
402
445
|
case 0:
|
|
@@ -408,7 +451,12 @@ function _loadFallbackCode() {
|
|
|
408
451
|
_context2.n = 2;
|
|
409
452
|
return loadCodeMeta(globalItem);
|
|
410
453
|
case 2:
|
|
411
|
-
|
|
454
|
+
codeMeta = _context2.v;
|
|
455
|
+
currentMark = performanceMeasure(currentMark, {
|
|
456
|
+
mark: 'Loaded Global Code Meta',
|
|
457
|
+
measure: 'Global Code Meta Loading'
|
|
458
|
+
}, [functionName, globalItem, url]);
|
|
459
|
+
return _context2.a(2, codeMeta);
|
|
412
460
|
case 3:
|
|
413
461
|
_context2.p = 3;
|
|
414
462
|
_t = _context2.v;
|
|
@@ -424,11 +472,15 @@ function _loadFallbackCode() {
|
|
|
424
472
|
return _ref.apply(this, arguments);
|
|
425
473
|
};
|
|
426
474
|
}());
|
|
427
|
-
_context4.n =
|
|
475
|
+
_context4.n = 36;
|
|
428
476
|
return Promise.all(globalsPromises);
|
|
429
|
-
case 35:
|
|
430
|
-
globalsCodeObjects = _context4.v;
|
|
431
477
|
case 36:
|
|
478
|
+
globalsCodeObjects = _context4.v;
|
|
479
|
+
currentMark = performanceMeasure(beforeGlobalsMark, {
|
|
480
|
+
mark: 'Loaded Globals Meta',
|
|
481
|
+
measure: 'Globals Meta Loading'
|
|
482
|
+
}, [functionName, url], true);
|
|
483
|
+
case 37:
|
|
432
484
|
if (globalsCodeObjects && globalsCodeObjects.length > 0) {
|
|
433
485
|
resolvedGlobalsCode = [];
|
|
434
486
|
_iterator = _createForOfIteratorHelper(globalsCodeObjects);
|
|
@@ -447,9 +499,9 @@ function _loadFallbackCode() {
|
|
|
447
499
|
_iterator.f();
|
|
448
500
|
}
|
|
449
501
|
}
|
|
450
|
-
_context4.p =
|
|
451
|
-
_context4.n =
|
|
452
|
-
return
|
|
502
|
+
_context4.p = 38;
|
|
503
|
+
_context4.n = 39;
|
|
504
|
+
return loadCodeVariant(url, initialVariant, initial, {
|
|
453
505
|
sourceParser: sourceParser,
|
|
454
506
|
loadSource: loadSource,
|
|
455
507
|
loadVariantMeta: loadVariantMeta,
|
|
@@ -463,19 +515,24 @@ function _loadFallbackCode() {
|
|
|
463
515
|
// Pass resolved globalsCode
|
|
464
516
|
output: output
|
|
465
517
|
});
|
|
466
|
-
case
|
|
467
|
-
_yield$
|
|
468
|
-
loadedVariant = _yield$
|
|
518
|
+
case 39:
|
|
519
|
+
_yield$loadCodeVarian = _context4.v;
|
|
520
|
+
loadedVariant = _yield$loadCodeVarian.code;
|
|
521
|
+
currentMark = performanceMeasure(currentMark, {
|
|
522
|
+
mark: 'Loaded Initial Variant',
|
|
523
|
+
measure: 'Initial Variant Loading'
|
|
524
|
+
}, [functionName, url], true);
|
|
525
|
+
|
|
469
526
|
// Update the loaded code with the processed variant
|
|
470
527
|
loaded = _extends(_extends({}, loaded), {}, _defineProperty({}, initialVariant, loadedVariant));
|
|
471
528
|
initial = loadedVariant;
|
|
472
|
-
_context4.n =
|
|
529
|
+
_context4.n = 41;
|
|
473
530
|
break;
|
|
474
|
-
case 39:
|
|
475
|
-
_context4.p = 39;
|
|
476
|
-
_t0 = _context4.v;
|
|
477
|
-
throw new Error("Failed to load initial variant using loadVariant (variant: ".concat(initialVariant, ", url: ").concat(url, "): ").concat(JSON.stringify(_t0)));
|
|
478
531
|
case 40:
|
|
532
|
+
_context4.p = 40;
|
|
533
|
+
_t0 = _context4.v;
|
|
534
|
+
throw new Error("Failed to load initial variant using loadCodeVariant (variant: ".concat(initialVariant, ", url: ").concat(url, "): ").concat(JSON.stringify(_t0)));
|
|
535
|
+
case 41:
|
|
479
536
|
// Step 3: Collect all file names
|
|
480
537
|
allFileNames = new Set();
|
|
481
538
|
if (initial.fileName) {
|
|
@@ -491,24 +548,24 @@ function _loadFallbackCode() {
|
|
|
491
548
|
|
|
492
549
|
// Step 4: Handle fallbackUsesAllVariants - load all variants to get all possible files
|
|
493
550
|
if (!fallbackUsesAllVariants) {
|
|
494
|
-
_context4.n =
|
|
551
|
+
_context4.n = 45;
|
|
495
552
|
break;
|
|
496
553
|
}
|
|
497
|
-
// Determine all variants to process - use provided variants or infer from loaded code
|
|
554
|
+
beforeAllVariantMark = currentMark; // Determine all variants to process - use provided variants or infer from loaded code
|
|
498
555
|
allVariants = variants || Object.keys(loaded || {});
|
|
499
556
|
if (!(allVariants.length === 0)) {
|
|
500
|
-
_context4.n =
|
|
557
|
+
_context4.n = 42;
|
|
501
558
|
break;
|
|
502
559
|
}
|
|
503
560
|
console.warn('No variants found for fallbackUsesAllVariants processing');
|
|
504
|
-
_context4.n =
|
|
561
|
+
_context4.n = 44;
|
|
505
562
|
break;
|
|
506
|
-
case
|
|
563
|
+
case 42:
|
|
507
564
|
// Process all required variants, not just the ones already loaded
|
|
508
565
|
variantPromises = allVariants.map(/*#__PURE__*/function () {
|
|
509
566
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(variantName) {
|
|
510
567
|
var _loaded;
|
|
511
|
-
var variant, allCode, _yield$
|
|
568
|
+
var variant, allCode, _yield$loadCodeVarian2, _loadedVariant, fileNames, _t2, _t3;
|
|
512
569
|
return _regenerator().w(function (_context3) {
|
|
513
570
|
while (1) switch (_context3.p = _context3.n) {
|
|
514
571
|
case 0:
|
|
@@ -535,6 +592,10 @@ function _loadFallbackCode() {
|
|
|
535
592
|
variant = allCode[variantName];
|
|
536
593
|
// Update loaded with all variants from loadCodeMeta
|
|
537
594
|
loaded = _extends(_extends({}, loaded), allCode);
|
|
595
|
+
currentMark = performanceMeasure(currentMark, {
|
|
596
|
+
mark: 'Loaded Initial Code Meta',
|
|
597
|
+
measure: 'Initial Code Meta Loading'
|
|
598
|
+
}, [functionName, url]);
|
|
538
599
|
_context3.n = 5;
|
|
539
600
|
break;
|
|
540
601
|
case 4:
|
|
@@ -560,7 +621,7 @@ function _loadFallbackCode() {
|
|
|
560
621
|
case 6:
|
|
561
622
|
_context3.p = 6;
|
|
562
623
|
_context3.n = 7;
|
|
563
|
-
return
|
|
624
|
+
return loadCodeVariant(url, variantName, variant, {
|
|
564
625
|
sourceParser: sourceParser,
|
|
565
626
|
loadSource: loadSource,
|
|
566
627
|
loadVariantMeta: loadVariantMeta,
|
|
@@ -592,13 +653,17 @@ function _loadFallbackCode() {
|
|
|
592
653
|
}() : undefined
|
|
593
654
|
});
|
|
594
655
|
case 7:
|
|
595
|
-
_yield$
|
|
596
|
-
_loadedVariant = _yield$
|
|
656
|
+
_yield$loadCodeVarian2 = _context3.v;
|
|
657
|
+
_loadedVariant = _yield$loadCodeVarian2.code;
|
|
597
658
|
// Collect file names from this variant
|
|
598
659
|
fileNames = _loadedVariant.fileName ? [_loadedVariant.fileName] : [];
|
|
599
660
|
if (_loadedVariant.extraFiles) {
|
|
600
661
|
fileNames.push.apply(fileNames, _toConsumableArray(Object.keys(_loadedVariant.extraFiles)));
|
|
601
662
|
}
|
|
663
|
+
currentMark = performanceMeasure(currentMark, {
|
|
664
|
+
mark: 'Loaded Initial Variant',
|
|
665
|
+
measure: 'Initial Variant Loading'
|
|
666
|
+
}, [functionName, variantName, url], true);
|
|
602
667
|
return _context3.a(2, {
|
|
603
668
|
variantName: variantName,
|
|
604
669
|
loadedVariant: _loadedVariant,
|
|
@@ -621,9 +686,9 @@ function _loadFallbackCode() {
|
|
|
621
686
|
return _ref2.apply(this, arguments);
|
|
622
687
|
};
|
|
623
688
|
}());
|
|
624
|
-
_context4.n =
|
|
689
|
+
_context4.n = 43;
|
|
625
690
|
return Promise.all(variantPromises);
|
|
626
|
-
case
|
|
691
|
+
case 43:
|
|
627
692
|
variantResults = _context4.v;
|
|
628
693
|
// Update loaded code and collect file names
|
|
629
694
|
variantResults.forEach(function (_ref3) {
|
|
@@ -637,37 +702,46 @@ function _loadFallbackCode() {
|
|
|
637
702
|
return allFileNames.add(fileName);
|
|
638
703
|
});
|
|
639
704
|
});
|
|
640
|
-
case
|
|
705
|
+
case 44:
|
|
706
|
+
currentMark = performanceMeasure(beforeAllVariantMark, {
|
|
707
|
+
mark: 'Loaded Initial Variants',
|
|
708
|
+
measure: 'Initial Variants Loading'
|
|
709
|
+
}, [functionName, url], true);
|
|
710
|
+
case 45:
|
|
641
711
|
// Ensure we have the latest initial variant data
|
|
642
712
|
finalInitial = loaded[initialVariant];
|
|
643
713
|
if (!(!finalInitial || typeof finalInitial === 'string')) {
|
|
644
|
-
_context4.n =
|
|
714
|
+
_context4.n = 46;
|
|
645
715
|
break;
|
|
646
716
|
}
|
|
647
717
|
throw new Error("Failed to process initial variant: ".concat(initialVariant));
|
|
648
|
-
case
|
|
649
|
-
_context4.p =
|
|
650
|
-
_context4.n =
|
|
718
|
+
case 46:
|
|
719
|
+
_context4.p = 46;
|
|
720
|
+
_context4.n = 47;
|
|
651
721
|
return getFileSource(finalInitial, initialFilename, loadSource);
|
|
652
|
-
case
|
|
722
|
+
case 47:
|
|
653
723
|
_result2 = _context4.v;
|
|
654
724
|
finalFileSource = _result2.source;
|
|
655
725
|
finalFilename = _result2.filename;
|
|
656
|
-
_context4.n =
|
|
726
|
+
_context4.n = 50;
|
|
657
727
|
break;
|
|
658
|
-
case
|
|
659
|
-
_context4.p =
|
|
728
|
+
case 48:
|
|
729
|
+
_context4.p = 48;
|
|
660
730
|
_t1 = _context4.v;
|
|
661
731
|
if (!(!finalInitial.fileName && !finalInitial.source)) {
|
|
662
|
-
_context4.n =
|
|
732
|
+
_context4.n = 49;
|
|
663
733
|
break;
|
|
664
734
|
}
|
|
665
735
|
throw new Error("Cannot determine filename for initial variant \"".concat(initialVariant, "\". ") + "No fileName available in variant definition, no initialFilename provided, and no source available.");
|
|
666
|
-
case
|
|
736
|
+
case 49:
|
|
667
737
|
// Fall back to the main file with proper validation
|
|
668
738
|
finalFileSource = finalInitial.source || '';
|
|
669
739
|
finalFilename = finalInitial.fileName;
|
|
670
|
-
case
|
|
740
|
+
case 50:
|
|
741
|
+
currentMark = performanceMeasure(currentMark, {
|
|
742
|
+
mark: 'Loaded Initial File',
|
|
743
|
+
measure: 'Initial File Loading'
|
|
744
|
+
}, [functionName, url]);
|
|
671
745
|
return _context4.a(2, {
|
|
672
746
|
code: loaded,
|
|
673
747
|
initialFilename: finalFilename,
|
|
@@ -677,7 +751,7 @@ function _loadFallbackCode() {
|
|
|
677
751
|
processedGlobalsCode: globalsCodeObjects
|
|
678
752
|
});
|
|
679
753
|
}
|
|
680
|
-
}, _callee4, null, [[
|
|
754
|
+
}, _callee4, null, [[46, 48], [38, 40], [26, 28], [22, 24], [18, 33], [11, 13], [7, 9], [1, 3]]);
|
|
681
755
|
}));
|
|
682
|
-
return
|
|
756
|
+
return _loadCodeFallback.apply(this, arguments);
|
|
683
757
|
}
|
package/esm/{CodeHighlighter/loadVariant.d.ts → pipeline/loadCodeVariant/loadCodeVariant.d.ts}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { VariantCode, LoadVariantOptions, Externals } from "
|
|
1
|
+
import type { VariantCode, LoadVariantOptions, Externals } from "../../CodeHighlighter/types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Loads a variant with support for recursive extra file loading.
|
|
4
4
|
* The loadSource function can now return extraFiles that will be loaded recursively.
|
|
5
5
|
* Supports both relative and absolute paths for extra files.
|
|
6
6
|
* Uses Promise.all for efficient parallel loading of extra files.
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function loadCodeVariant(url: string | undefined, variantName: string, variant: VariantCode | string | undefined, options?: LoadVariantOptions): Promise<{
|
|
9
9
|
code: VariantCode;
|
|
10
10
|
dependencies: string[];
|
|
11
11
|
externals: Externals;
|