@mui/internal-docs-infra 0.1.1-alpha.0 → 0.1.1-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{build/CodeControllerContext → CodeControllerContext}/CodeControllerContext.d.ts +1 -1
- package/CodeControllerContext/CodeControllerContext.d.ts.map +1 -0
- package/CodeControllerContext/index.d.ts.map +1 -0
- package/CodeExternalsContext/CodeExternalsContext.d.ts +8 -0
- package/CodeExternalsContext/CodeExternalsContext.d.ts.map +1 -0
- package/CodeExternalsContext/CodeExternalsContext.js +7 -0
- package/CodeExternalsContext/index.d.ts +1 -0
- package/CodeExternalsContext/index.d.ts.map +1 -0
- package/CodeExternalsContext/index.js +1 -0
- package/CodeHighlighter/CodeHighlighter.d.ts +2 -0
- package/CodeHighlighter/CodeHighlighter.d.ts.map +1 -0
- package/CodeHighlighter/CodeHighlighter.js +470 -0
- package/CodeHighlighter/CodeHighlighterClient.d.ts.map +1 -0
- package/CodeHighlighter/CodeHighlighterClient.js +837 -0
- package/{build/CodeHighlighter → CodeHighlighter}/CodeHighlighterContext.d.ts +2 -0
- package/CodeHighlighter/CodeHighlighterContext.d.ts.map +1 -0
- package/CodeHighlighter/CodeHighlighterFallbackContext.d.ts.map +1 -0
- package/{build/esm/CodeHighlighter → CodeHighlighter}/CodeHighlighterFallbackContext.js +3 -1
- package/CodeHighlighter/applyTransform.d.ts.map +1 -0
- package/{build/CodeHighlighter → CodeHighlighter}/codeToFallbackProps.d.ts +2 -2
- package/CodeHighlighter/codeToFallbackProps.d.ts.map +1 -0
- package/{build/esm/CodeHighlighter → CodeHighlighter}/codeToFallbackProps.js +8 -5
- package/{build/esm/CodeHighlighter → CodeHighlighter}/errors.d.ts.map +1 -1
- package/CodeHighlighter/hasAllVariants.d.ts.map +1 -0
- package/CodeHighlighter/index.d.ts.map +1 -0
- package/{build/esm/CodeHighlighter → CodeHighlighter}/loadFallbackCode.d.ts +3 -2
- package/CodeHighlighter/loadFallbackCode.d.ts.map +1 -0
- package/{build/esm/CodeHighlighter → CodeHighlighter}/loadFallbackCode.js +325 -161
- package/CodeHighlighter/loadVariant.d.ts +12 -0
- package/CodeHighlighter/loadVariant.d.ts.map +1 -0
- package/CodeHighlighter/loadVariant.js +1083 -0
- package/{build/CodeHighlighter → CodeHighlighter}/maybeInitialData.d.ts +1 -1
- package/CodeHighlighter/maybeInitialData.d.ts.map +1 -0
- package/CodeHighlighter/parseCode.d.ts.map +1 -0
- package/{build/esm/CodeHighlighter → CodeHighlighter}/parseCode.js +14 -2
- package/CodeHighlighter/parseControlledCode.d.ts.map +1 -0
- package/{build/esm/CodeHighlighter → CodeHighlighter}/parseControlledCode.js +12 -1
- package/{build/esm/CodeHighlighter → CodeHighlighter}/transformCode.d.ts +1 -0
- package/CodeHighlighter/transformCode.d.ts.map +1 -0
- package/{build/esm/CodeHighlighter → CodeHighlighter}/transformCode.js +43 -3
- package/CodeHighlighter/transformParsedSource.d.ts.map +1 -0
- package/CodeHighlighter/transformSource.d.ts.map +1 -0
- package/{build/esm/CodeHighlighter → CodeHighlighter}/types.d.ts +39 -17
- package/CodeHighlighter/types.d.ts.map +1 -0
- package/CodeProvider/CodeContext.d.ts.map +1 -0
- package/CodeProvider/CodeProvider.d.ts.map +1 -0
- package/{build/esm/CodeProvider → CodeProvider}/CodeProvider.js +21 -6
- package/CodeProvider/index.d.ts +1 -0
- package/CodeProvider/index.d.ts.map +1 -0
- package/CodeProvider/index.js +1 -0
- package/abstractCreateDemo/abstractCreateDemo.d.ts +35 -0
- package/abstractCreateDemo/abstractCreateDemo.d.ts.map +1 -0
- package/abstractCreateDemo/abstractCreateDemo.js +91 -0
- package/abstractCreateDemo/index.d.ts +1 -0
- package/abstractCreateDemo/index.d.ts.map +1 -0
- package/abstractCreateDemo/index.js +1 -0
- package/createDemoData/createDemoData.d.ts +44 -0
- package/createDemoData/createDemoData.d.ts.map +1 -0
- package/createDemoData/createDemoData.js +75 -0
- package/createDemoData/index.d.ts +1 -0
- package/createDemoData/index.d.ts.map +1 -0
- package/createDemoData/index.js +1 -0
- package/createDemoData/types.d.ts +28 -0
- package/createDemoData/types.d.ts.map +1 -0
- package/createDemoData/types.js +1 -0
- package/package.json +20 -73
- package/pipeline/hastUtils/hastUtils.d.ts.map +1 -0
- package/{build/esm/hast/hast.js → pipeline/hastUtils/hastUtils.js} +2 -1
- package/pipeline/hastUtils/index.d.ts +1 -0
- package/pipeline/hastUtils/index.d.ts.map +1 -0
- package/pipeline/hastUtils/index.js +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.d.ts +54 -0
- package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/emitExternalsProvider.js +465 -0
- package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.d.ts +15 -0
- package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/generateExternalsProvider.js +253 -0
- package/pipeline/loadPrecomputedCodeHighlighter/index.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +20 -0
- package/pipeline/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts.map +1 -0
- package/{build/esm → pipeline}/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +105 -75
- package/{build/esm → pipeline}/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts +12 -1
- package/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +433 -0
- package/{build/esm → pipeline}/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts +5 -1
- package/pipeline/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts.map +1 -0
- package/{build/esm → pipeline}/loadPrecomputedCodeHighlighter/parseFunctionParameters.js +1 -1
- package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +25 -0
- package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts.map +1 -0
- package/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +73 -0
- package/pipeline/loadServerCodeMeta/index.d.ts +1 -0
- package/pipeline/loadServerCodeMeta/index.d.ts.map +1 -0
- package/pipeline/loadServerCodeMeta/index.js +1 -0
- package/{build/esm/loadServerCodeMeta/serverLoadCodeMeta.d.ts → pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts} +4 -4
- package/pipeline/loadServerCodeMeta/loadServerCodeMeta.d.ts.map +1 -0
- package/{build/esm/loadServerCodeMeta/serverLoadCodeMeta.js → pipeline/loadServerCodeMeta/loadServerCodeMeta.js} +18 -3
- package/pipeline/loadServerSource/index.d.ts +1 -0
- package/pipeline/loadServerSource/index.d.ts.map +1 -0
- package/pipeline/loadServerSource/index.js +1 -0
- package/{build/loadServerSource/serverLoadSource.d.ts → pipeline/loadServerSource/loadServerSource.d.ts} +5 -5
- package/pipeline/loadServerSource/loadServerSource.d.ts.map +1 -0
- package/pipeline/loadServerSource/loadServerSource.js +135 -0
- package/pipeline/loaderUtils/externalsToPackages.d.ts +1 -0
- package/pipeline/loaderUtils/externalsToPackages.d.ts.map +1 -0
- package/pipeline/loaderUtils/externalsToPackages.js +46 -0
- package/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts +34 -0
- package/pipeline/loaderUtils/extractNameAndSlugFromUrl.d.ts.map +1 -0
- package/pipeline/loaderUtils/extractNameAndSlugFromUrl.js +161 -0
- package/pipeline/loaderUtils/getFileNameFromUrl.d.ts.map +1 -0
- package/pipeline/loaderUtils/index.d.ts +7 -0
- package/pipeline/loaderUtils/index.d.ts.map +1 -0
- package/pipeline/loaderUtils/index.js +7 -0
- package/pipeline/loaderUtils/mergeExternals.d.ts +32 -0
- package/pipeline/loaderUtils/mergeExternals.d.ts.map +1 -0
- package/pipeline/loaderUtils/mergeExternals.js +72 -0
- package/pipeline/loaderUtils/parseImports.d.ts +20 -0
- package/pipeline/loaderUtils/parseImports.d.ts.map +1 -0
- package/pipeline/loaderUtils/parseImports.js +307 -0
- package/{build/esm/loaderUtils/processImports.d.ts → pipeline/loaderUtils/processRelativeImports.d.ts} +2 -2
- package/pipeline/loaderUtils/processRelativeImports.d.ts.map +1 -0
- package/pipeline/loaderUtils/processRelativeImports.js +329 -0
- package/{build/esm → pipeline}/loaderUtils/resolveModulePath.d.ts +19 -6
- package/pipeline/loaderUtils/resolveModulePath.d.ts.map +1 -0
- package/pipeline/loaderUtils/resolveModulePath.js +1449 -0
- package/{build/esm → pipeline}/loaderUtils/resolveModulePathWithFs.d.ts +6 -3
- package/pipeline/loaderUtils/resolveModulePathWithFs.d.ts.map +1 -0
- package/{build/esm → pipeline}/loaderUtils/resolveModulePathWithFs.js +8 -4
- package/pipeline/loaderUtils/rewriteImports.d.ts +9 -0
- package/pipeline/loaderUtils/rewriteImports.d.ts.map +1 -0
- package/pipeline/loaderUtils/rewriteImports.js +35 -0
- package/pipeline/parseSource/grammars.d.ts.map +1 -0
- package/pipeline/parseSource/index.d.ts.map +1 -0
- package/pipeline/parseSource/parseSource.d.ts +3 -0
- package/pipeline/parseSource/parseSource.d.ts.map +1 -0
- package/{build/esm → pipeline}/parseSource/parseSource.js +15 -5
- package/pipeline/transformHtmlCode/index.d.ts +2 -0
- package/pipeline/transformHtmlCode/index.d.ts.map +1 -0
- package/pipeline/transformHtmlCode/index.js +4 -0
- package/pipeline/transformHtmlCode/transformHtmlCode.d.ts +13 -0
- package/pipeline/transformHtmlCode/transformHtmlCode.d.ts.map +1 -0
- package/pipeline/transformHtmlCode/transformHtmlCode.js +303 -0
- package/pipeline/transformMarkdownCode/index.d.ts +2 -0
- package/pipeline/transformMarkdownCode/index.d.ts.map +1 -0
- package/pipeline/transformMarkdownCode/index.js +4 -0
- package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts +2 -0
- package/pipeline/transformMarkdownCode/transformMarkdownCode.d.ts.map +1 -0
- package/pipeline/transformMarkdownCode/transformMarkdownCode.js +514 -0
- package/pipeline/transformTypescriptToJavascript/index.d.ts +1 -0
- package/pipeline/transformTypescriptToJavascript/index.d.ts.map +1 -0
- package/pipeline/transformTypescriptToJavascript/index.js +1 -0
- package/pipeline/transformTypescriptToJavascript/removeTypes.d.ts.map +1 -0
- package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts +3 -0
- package/pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.d.ts.map +1 -0
- package/{build/esm/transformTsToJs/transformTsToJs.js → pipeline/transformTypescriptToJavascript/transformTypescriptToJavascript.js} +4 -4
- package/useCode/index.d.ts.map +1 -0
- package/{build/useCode → useCode}/useCode.d.ts +13 -11
- package/useCode/useCode.d.ts.map +1 -0
- package/useCode/useCode.js +122 -0
- package/useCode/useCodeUtils.d.ts +45 -0
- package/useCode/useCodeUtils.d.ts.map +1 -0
- package/useCode/useCodeUtils.js +240 -0
- package/useCode/useCopyFunctionality.d.ts +17 -0
- package/useCode/useCopyFunctionality.d.ts.map +1 -0
- package/useCode/useCopyFunctionality.js +28 -0
- package/useCode/useFileNavigation.d.ts +48 -0
- package/useCode/useFileNavigation.d.ts.map +1 -0
- package/useCode/useFileNavigation.js +370 -0
- package/useCode/useSourceEditing.d.ts +19 -0
- package/useCode/useSourceEditing.d.ts.map +1 -0
- package/useCode/useSourceEditing.js +32 -0
- package/useCode/useTransformManagement.d.ts +28 -0
- package/useCode/useTransformManagement.d.ts.map +1 -0
- package/useCode/useTransformManagement.js +82 -0
- package/useCode/useUIState.d.ts +16 -0
- package/useCode/useUIState.d.ts.map +1 -0
- package/useCode/useUIState.js +21 -0
- package/useCode/useVariantSelection.d.ts +21 -0
- package/useCode/useVariantSelection.d.ts.map +1 -0
- package/useCode/useVariantSelection.js +84 -0
- package/{build/esm/useCopier → useCopier}/index.d.ts +1 -1
- package/useCopier/index.d.ts.map +1 -0
- package/{build/esm/useCopier → useCopier}/index.js +5 -5
- package/useDemo/createCodeSandbox.d.ts +18 -0
- package/useDemo/createCodeSandbox.d.ts.map +1 -0
- package/useDemo/createCodeSandbox.js +48 -0
- package/useDemo/createStackBlitz.d.ts +22 -0
- package/useDemo/createStackBlitz.d.ts.map +1 -0
- package/useDemo/createStackBlitz.js +38 -0
- package/useDemo/examineVariant.d.ts +25 -0
- package/useDemo/examineVariant.d.ts.map +1 -0
- package/useDemo/examineVariant.js +134 -0
- package/useDemo/exportVariant.d.ts +110 -0
- package/useDemo/exportVariant.d.ts.map +1 -0
- package/useDemo/exportVariant.js +320 -0
- package/useDemo/exportVariantAsCra.d.ts +15 -0
- package/useDemo/exportVariantAsCra.d.ts.map +1 -0
- package/useDemo/exportVariantAsCra.js +56 -0
- package/useDemo/flattenVariant.d.ts +17 -0
- package/useDemo/flattenVariant.d.ts.map +1 -0
- package/useDemo/flattenVariant.js +206 -0
- package/useDemo/index.d.ts +6 -0
- package/useDemo/index.d.ts.map +1 -0
- package/useDemo/index.js +6 -0
- package/useDemo/useDemo.d.ts +78 -0
- package/useDemo/useDemo.d.ts.map +1 -0
- package/useDemo/useDemo.js +174 -0
- package/useLocalStorageState/index.d.ts +2 -0
- package/useLocalStorageState/index.d.ts.map +1 -0
- package/useLocalStorageState/index.js +2 -0
- package/useLocalStorageState/useLocalStorageState.d.ts +14 -0
- package/useLocalStorageState/useLocalStorageState.d.ts.map +1 -0
- package/useLocalStorageState/useLocalStorageState.js +128 -0
- package/useOnHydrate/index.d.ts.map +1 -0
- package/useOnHydrate/useOnHydrate.d.ts.map +1 -0
- package/useOnIdle/index.d.ts.map +1 -0
- package/useOnIdle/useOnIdle.d.ts.map +1 -0
- package/useUrlHashState/index.d.ts +1 -0
- package/useUrlHashState/index.d.ts.map +1 -0
- package/useUrlHashState/index.js +1 -0
- package/useUrlHashState/useUrlHashState.d.ts +50 -0
- package/useUrlHashState/useUrlHashState.d.ts.map +1 -0
- package/useUrlHashState/useUrlHashState.js +113 -0
- package/build/CodeControllerContext/CodeControllerContext.js +0 -21
- package/build/CodeControllerContext/index.js +0 -16
- package/build/CodeHighlighter/CodeHighlighter.d.ts +0 -2
- package/build/CodeHighlighter/CodeHighlighter.js +0 -329
- package/build/CodeHighlighter/CodeHighlighterClient.js +0 -406
- package/build/CodeHighlighter/CodeHighlighterContext.js +0 -22
- package/build/CodeHighlighter/CodeHighlighterFallbackContext.js +0 -18
- package/build/CodeHighlighter/applyTransform.js +0 -83
- package/build/CodeHighlighter/codeToFallbackProps.js +0 -77
- package/build/CodeHighlighter/errors.js +0 -2
- package/build/CodeHighlighter/hasAllVariants.js +0 -37
- package/build/CodeHighlighter/index.js +0 -49
- package/build/CodeHighlighter/loadFallbackCode.d.ts +0 -9
- package/build/CodeHighlighter/loadFallbackCode.js +0 -474
- package/build/CodeHighlighter/loadVariant.d.ts +0 -11
- package/build/CodeHighlighter/loadVariant.js +0 -715
- package/build/CodeHighlighter/maybeInitialData.js +0 -101
- package/build/CodeHighlighter/parseCode.js +0 -129
- package/build/CodeHighlighter/parseControlledCode.js +0 -83
- package/build/CodeHighlighter/transformCode.d.ts +0 -20
- package/build/CodeHighlighter/transformCode.js +0 -231
- package/build/CodeHighlighter/transformParsedSource.js +0 -73
- package/build/CodeHighlighter/transformSource.js +0 -114
- package/build/CodeHighlighter/types.d.ts +0 -138
- package/build/CodeHighlighter/types.js +0 -5
- package/build/CodeProvider/CodeContext.js +0 -14
- package/build/CodeProvider/CodeProvider.js +0 -57
- package/build/CodeProvider/index.d.ts +0 -2
- package/build/CodeProvider/index.js +0 -27
- package/build/README.md +0 -19
- package/build/esm/CodeControllerContext/CodeControllerContext.d.ts +0 -22
- package/build/esm/CodeControllerContext/CodeControllerContext.d.ts.map +0 -1
- package/build/esm/CodeControllerContext/index.d.ts +0 -1
- package/build/esm/CodeControllerContext/index.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/CodeHighlighter.d.ts +0 -2
- package/build/esm/CodeHighlighter/CodeHighlighter.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/CodeHighlighter.js +0 -321
- package/build/esm/CodeHighlighter/CodeHighlighterClient.d.ts +0 -2
- package/build/esm/CodeHighlighter/CodeHighlighterClient.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/CodeHighlighterClient.js +0 -399
- package/build/esm/CodeHighlighter/CodeHighlighterContext.d.ts +0 -14
- package/build/esm/CodeHighlighter/CodeHighlighterContext.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/CodeHighlighterFallbackContext.d.ts +0 -7
- package/build/esm/CodeHighlighter/CodeHighlighterFallbackContext.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/applyTransform.d.ts +0 -19
- package/build/esm/CodeHighlighter/applyTransform.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/codeToFallbackProps.d.ts +0 -2
- package/build/esm/CodeHighlighter/codeToFallbackProps.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/errors.d.ts +0 -0
- package/build/esm/CodeHighlighter/hasAllVariants.d.ts +0 -2
- package/build/esm/CodeHighlighter/hasAllVariants.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/index.d.ts +0 -4
- package/build/esm/CodeHighlighter/index.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/loadFallbackCode.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/loadVariant.d.ts +0 -11
- package/build/esm/CodeHighlighter/loadVariant.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/loadVariant.js +0 -708
- package/build/esm/CodeHighlighter/maybeInitialData.d.ts +0 -10
- package/build/esm/CodeHighlighter/maybeInitialData.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/parseCode.d.ts +0 -6
- package/build/esm/CodeHighlighter/parseCode.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/parseControlledCode.d.ts +0 -6
- package/build/esm/CodeHighlighter/parseControlledCode.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/transformCode.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/transformParsedSource.d.ts +0 -3
- package/build/esm/CodeHighlighter/transformParsedSource.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/transformSource.d.ts +0 -2
- package/build/esm/CodeHighlighter/transformSource.d.ts.map +0 -1
- package/build/esm/CodeHighlighter/types.d.ts.map +0 -1
- package/build/esm/CodeProvider/CodeContext.d.ts +0 -12
- package/build/esm/CodeProvider/CodeContext.d.ts.map +0 -1
- package/build/esm/CodeProvider/CodeProvider.d.ts +0 -13
- package/build/esm/CodeProvider/CodeProvider.d.ts.map +0 -1
- package/build/esm/CodeProvider/index.d.ts +0 -2
- package/build/esm/CodeProvider/index.d.ts.map +0 -1
- package/build/esm/CodeProvider/index.js +0 -2
- package/build/esm/hast/hast.d.ts.map +0 -1
- package/build/esm/hast/index.d.ts +0 -1
- package/build/esm/hast/index.d.ts.map +0 -1
- package/build/esm/hast/index.js +0 -1
- package/build/esm/loadPrecomputedCodeHighlighter/index.d.ts.map +0 -1
- package/build/esm/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +0 -57
- package/build/esm/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts.map +0 -1
- package/build/esm/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts.map +0 -1
- package/build/esm/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +0 -243
- package/build/esm/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts.map +0 -1
- package/build/esm/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +0 -27
- package/build/esm/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts.map +0 -1
- package/build/esm/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +0 -37
- package/build/esm/loadServerCodeMeta/index.d.ts +0 -1
- package/build/esm/loadServerCodeMeta/index.d.ts.map +0 -1
- package/build/esm/loadServerCodeMeta/index.js +0 -1
- package/build/esm/loadServerCodeMeta/serverLoadCodeMeta.d.ts.map +0 -1
- package/build/esm/loadServerSource/index.d.ts +0 -1
- package/build/esm/loadServerSource/index.d.ts.map +0 -1
- package/build/esm/loadServerSource/index.js +0 -1
- package/build/esm/loadServerSource/serverLoadSource.d.ts +0 -25
- package/build/esm/loadServerSource/serverLoadSource.d.ts.map +0 -1
- package/build/esm/loadServerSource/serverLoadSource.js +0 -100
- package/build/esm/loaderUtils/getFileNameFromUrl.d.ts.map +0 -1
- package/build/esm/loaderUtils/index.d.ts +0 -5
- package/build/esm/loaderUtils/index.d.ts.map +0 -1
- package/build/esm/loaderUtils/index.js +0 -5
- package/build/esm/loaderUtils/processImports.d.ts.map +0 -1
- package/build/esm/loaderUtils/processImports.js +0 -82
- package/build/esm/loaderUtils/resolveImports.d.ts +0 -4
- package/build/esm/loaderUtils/resolveImports.d.ts.map +0 -1
- package/build/esm/loaderUtils/resolveImports.js +0 -71
- package/build/esm/loaderUtils/resolveModulePath.d.ts.map +0 -1
- package/build/esm/loaderUtils/resolveModulePath.js +0 -827
- package/build/esm/loaderUtils/resolveModulePathWithFs.d.ts.map +0 -1
- package/build/esm/loaderUtils/rewriteImports.d.ts +0 -9
- package/build/esm/loaderUtils/rewriteImports.d.ts.map +0 -1
- package/build/esm/loaderUtils/rewriteImports.js +0 -57
- package/build/esm/package.json +0 -1
- package/build/esm/parseSource/grammars.d.ts.map +0 -1
- package/build/esm/parseSource/index.d.ts.map +0 -1
- package/build/esm/parseSource/parseSource.d.ts +0 -3
- package/build/esm/parseSource/parseSource.d.ts.map +0 -1
- package/build/esm/transformRelativeMarkdownPaths/index.d.ts +0 -2
- package/build/esm/transformRelativeMarkdownPaths/index.d.ts.map +0 -1
- package/build/esm/transformRelativeMarkdownPaths/index.js +0 -4
- package/build/esm/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts +0 -12
- package/build/esm/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts.map +0 -1
- package/build/esm/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.js +0 -30
- package/build/esm/transformTsToJs/index.d.ts +0 -1
- package/build/esm/transformTsToJs/index.d.ts.map +0 -1
- package/build/esm/transformTsToJs/index.js +0 -1
- package/build/esm/transformTsToJs/removeTypes.d.ts.map +0 -1
- package/build/esm/transformTsToJs/transformTsToJs.d.ts +0 -3
- package/build/esm/transformTsToJs/transformTsToJs.d.ts.map +0 -1
- package/build/esm/useCode/index.d.ts.map +0 -1
- package/build/esm/useCode/useCode.d.ts +0 -37
- package/build/esm/useCode/useCode.d.ts.map +0 -1
- package/build/esm/useCode/useCode.js +0 -393
- package/build/esm/useCopier/index.d.ts.map +0 -1
- package/build/esm/useDemo/index.d.ts +0 -39
- package/build/esm/useDemo/index.d.ts.map +0 -1
- package/build/esm/useDemo/index.js +0 -17
- package/build/esm/useOnHydrate/index.d.ts.map +0 -1
- package/build/esm/useOnHydrate/useOnHydrate.d.ts.map +0 -1
- package/build/esm/useOnIdle/index.d.ts.map +0 -1
- package/build/esm/useOnIdle/useOnIdle.d.ts.map +0 -1
- package/build/hast/hast.d.ts +0 -11
- package/build/hast/hast.js +0 -75
- package/build/hast/index.d.ts +0 -1
- package/build/hast/index.js +0 -16
- package/build/loadPrecomputedCodeHighlighter/index.d.ts +0 -2
- package/build/loadPrecomputedCodeHighlighter/index.js +0 -9
- package/build/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.d.ts +0 -57
- package/build/loadPrecomputedCodeHighlighter/loadPrecomputedCodeHighlighter.js +0 -201
- package/build/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.d.ts +0 -20
- package/build/loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js +0 -248
- package/build/loadPrecomputedCodeHighlighter/parseFunctionParameters.d.ts +0 -15
- package/build/loadPrecomputedCodeHighlighter/parseFunctionParameters.js +0 -174
- package/build/loadPrecomputedCodeHighlighter/replacePrecomputeValue.d.ts +0 -27
- package/build/loadPrecomputedCodeHighlighter/replacePrecomputeValue.js +0 -43
- package/build/loadServerCodeMeta/index.d.ts +0 -1
- package/build/loadServerCodeMeta/index.js +0 -16
- package/build/loadServerCodeMeta/serverLoadCodeMeta.d.ts +0 -24
- package/build/loadServerCodeMeta/serverLoadCodeMeta.js +0 -85
- package/build/loadServerSource/index.d.ts +0 -1
- package/build/loadServerSource/index.js +0 -16
- package/build/loadServerSource/serverLoadSource.js +0 -108
- package/build/loaderUtils/getFileNameFromUrl.d.ts +0 -11
- package/build/loaderUtils/getFileNameFromUrl.js +0 -38
- package/build/loaderUtils/index.d.ts +0 -5
- package/build/loaderUtils/index.js +0 -60
- package/build/loaderUtils/processImports.d.ts +0 -19
- package/build/loaderUtils/processImports.js +0 -89
- package/build/loaderUtils/resolveImports.d.ts +0 -4
- package/build/loaderUtils/resolveImports.js +0 -78
- package/build/loaderUtils/resolveModulePath.d.ts +0 -74
- package/build/loaderUtils/resolveModulePath.js +0 -835
- package/build/loaderUtils/resolveModulePathWithFs.d.ts +0 -44
- package/build/loaderUtils/resolveModulePathWithFs.js +0 -163
- package/build/loaderUtils/rewriteImports.d.ts +0 -9
- package/build/loaderUtils/rewriteImports.js +0 -62
- package/build/package.json +0 -101
- package/build/parseSource/grammars.d.ts +0 -2
- package/build/parseSource/grammars.js +0 -34
- package/build/parseSource/index.d.ts +0 -1
- package/build/parseSource/index.js +0 -16
- package/build/parseSource/parseSource.d.ts +0 -3
- package/build/parseSource/parseSource.js +0 -44
- package/build/transformRelativeMarkdownPaths/index.d.ts +0 -2
- package/build/transformRelativeMarkdownPaths/index.js +0 -9
- package/build/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.d.ts +0 -12
- package/build/transformRelativeMarkdownPaths/transformRelativeMarkdownPaths.js +0 -36
- package/build/transformTsToJs/index.d.ts +0 -1
- package/build/transformTsToJs/index.js +0 -16
- package/build/transformTsToJs/removeTypes.d.ts +0 -13
- package/build/transformTsToJs/removeTypes.js +0 -141
- package/build/transformTsToJs/transformTsToJs.d.ts +0 -3
- package/build/transformTsToJs/transformTsToJs.js +0 -41
- package/build/useCode/index.d.ts +0 -1
- package/build/useCode/index.js +0 -16
- package/build/useCode/useCode.js +0 -401
- package/build/useCopier/index.d.ts +0 -15
- package/build/useCopier/index.js +0 -70
- package/build/useDemo/index.d.ts +0 -39
- package/build/useDemo/index.js +0 -25
- package/build/useOnHydrate/index.d.ts +0 -1
- package/build/useOnHydrate/index.js +0 -16
- package/build/useOnHydrate/useOnHydrate.d.ts +0 -1
- package/build/useOnHydrate/useOnHydrate.js +0 -26
- package/build/useOnIdle/index.d.ts +0 -1
- package/build/useOnIdle/index.js +0 -16
- package/build/useOnIdle/useOnIdle.d.ts +0 -1
- package/build/useOnIdle/useOnIdle.js +0 -47
- /package/{build/esm/CodeControllerContext → CodeControllerContext}/CodeControllerContext.js +0 -0
- /package/{build/CodeControllerContext → CodeControllerContext}/index.d.ts +0 -0
- /package/{build/esm/CodeControllerContext → CodeControllerContext}/index.js +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/CodeHighlighterClient.d.ts +0 -0
- /package/{build/esm/CodeHighlighter → CodeHighlighter}/CodeHighlighterContext.js +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/CodeHighlighterFallbackContext.d.ts +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/applyTransform.d.ts +0 -0
- /package/{build/esm/CodeHighlighter → CodeHighlighter}/applyTransform.js +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/errors.d.ts +0 -0
- /package/{build/esm/CodeHighlighter → CodeHighlighter}/errors.js +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/hasAllVariants.d.ts +0 -0
- /package/{build/esm/CodeHighlighter → CodeHighlighter}/hasAllVariants.js +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/index.d.ts +0 -0
- /package/{build/esm/CodeHighlighter → CodeHighlighter}/index.js +0 -0
- /package/{build/esm/CodeHighlighter → CodeHighlighter}/maybeInitialData.js +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/parseCode.d.ts +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/parseControlledCode.d.ts +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/transformParsedSource.d.ts +0 -0
- /package/{build/esm/CodeHighlighter → CodeHighlighter}/transformParsedSource.js +0 -0
- /package/{build/CodeHighlighter → CodeHighlighter}/transformSource.d.ts +0 -0
- /package/{build/esm/CodeHighlighter → CodeHighlighter}/transformSource.js +0 -0
- /package/{build/esm/CodeHighlighter → CodeHighlighter}/types.js +0 -0
- /package/{build/CodeProvider → CodeProvider}/CodeContext.d.ts +0 -0
- /package/{build/esm/CodeProvider → CodeProvider}/CodeContext.js +0 -0
- /package/{build/CodeProvider → CodeProvider}/CodeProvider.d.ts +0 -0
- /package/{build/LICENSE → LICENSE} +0 -0
- /package/{build/esm/hast/hast.d.ts → pipeline/hastUtils/hastUtils.d.ts} +0 -0
- /package/{build/esm → pipeline}/loadPrecomputedCodeHighlighter/index.d.ts +0 -0
- /package/{build/esm → pipeline}/loadPrecomputedCodeHighlighter/index.js +0 -0
- /package/{build/esm → pipeline}/loaderUtils/getFileNameFromUrl.d.ts +0 -0
- /package/{build/esm → pipeline}/loaderUtils/getFileNameFromUrl.js +0 -0
- /package/{build/esm → pipeline}/parseSource/grammars.d.ts +0 -0
- /package/{build/esm → pipeline}/parseSource/grammars.js +0 -0
- /package/{build/esm → pipeline}/parseSource/index.d.ts +0 -0
- /package/{build/esm → pipeline}/parseSource/index.js +0 -0
- /package/{build/esm/transformTsToJs → pipeline/transformTypescriptToJavascript}/removeTypes.d.ts +0 -0
- /package/{build/esm/transformTsToJs → pipeline/transformTypescriptToJavascript}/removeTypes.js +0 -0
- /package/{build/esm/useCode → useCode}/index.d.ts +0 -0
- /package/{build/esm/useCode → useCode}/index.js +0 -0
- /package/{build/esm/useOnHydrate → useOnHydrate}/index.d.ts +0 -0
- /package/{build/esm/useOnHydrate → useOnHydrate}/index.js +0 -0
- /package/{build/esm/useOnHydrate → useOnHydrate}/useOnHydrate.d.ts +0 -0
- /package/{build/esm/useOnHydrate → useOnHydrate}/useOnHydrate.js +0 -0
- /package/{build/esm/useOnIdle → useOnIdle}/index.d.ts +0 -0
- /package/{build/esm/useOnIdle → useOnIdle}/index.js +0 -0
- /package/{build/esm/useOnIdle → useOnIdle}/useOnIdle.d.ts +0 -0
- /package/{build/esm/useOnIdle → useOnIdle}/useOnIdle.js +0 -0
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
+
import { parseImports } from "../loaderUtils/index.js";
|
|
5
|
+
import { parseFunctionParameters, extractBalancedBraces } from "./parseFunctionParameters.js";
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to convert the new parseImports format to a Map
|
|
8
|
+
* that maps import names to their resolved paths
|
|
9
|
+
*/
|
|
10
|
+
function buildImportMap(importResult) {
|
|
11
|
+
var importMap = new Map();
|
|
12
|
+
Object.values(importResult.relative).forEach(function (_ref) {
|
|
13
|
+
var path = _ref.path,
|
|
14
|
+
names = _ref.names;
|
|
15
|
+
names.forEach(function (_ref2) {
|
|
16
|
+
var name = _ref2.name,
|
|
17
|
+
alias = _ref2.alias;
|
|
18
|
+
// Use alias if available, otherwise use the original name
|
|
19
|
+
var nameToUse = alias || name;
|
|
20
|
+
importMap.set(nameToUse, path);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return importMap;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Helper function to build a mapping from import aliases to their original named exports
|
|
28
|
+
*/
|
|
29
|
+
function buildNamedExportsMap(importResult) {
|
|
30
|
+
var namedExportsMap = new Map();
|
|
31
|
+
Object.values(importResult.relative).forEach(function (_ref3) {
|
|
32
|
+
var names = _ref3.names;
|
|
33
|
+
names.forEach(function (_ref4) {
|
|
34
|
+
var name = _ref4.name,
|
|
35
|
+
alias = _ref4.alias,
|
|
36
|
+
type = _ref4.type;
|
|
37
|
+
// Use alias if available, otherwise use the original name as key
|
|
38
|
+
var nameToUse = alias || name;
|
|
39
|
+
|
|
40
|
+
// Only map to the original export name for named imports
|
|
41
|
+
// Default imports should map to undefined since they don't have a specific named export
|
|
42
|
+
if (type === 'named') {
|
|
43
|
+
namedExportsMap.set(nameToUse, name);
|
|
44
|
+
} else {
|
|
45
|
+
namedExportsMap.set(nameToUse, undefined); // undefined for default/namespace imports
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
return namedExportsMap;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Parses a variants object string and maps variant names to their import paths
|
|
53
|
+
*/
|
|
54
|
+
function parseVariantsObject(variantsObjectStr, importMap, namedExportsMap, functionName, filePath) {
|
|
55
|
+
var demoImports = {};
|
|
56
|
+
var namedExports = {};
|
|
57
|
+
|
|
58
|
+
// Parse the demo object to extract key-value pairs
|
|
59
|
+
// Handle both { Default: BasicCode } and { Default } syntax
|
|
60
|
+
var objectContentRegex = /(\w+)(?:\s*:\s*(\w+))?/g;
|
|
61
|
+
var objectMatch = objectContentRegex.exec(variantsObjectStr);
|
|
62
|
+
while (objectMatch !== null) {
|
|
63
|
+
var _objectMatch = objectMatch,
|
|
64
|
+
_objectMatch2 = _slicedToArray(_objectMatch, 3),
|
|
65
|
+
key = _objectMatch2[1],
|
|
66
|
+
value = _objectMatch2[2];
|
|
67
|
+
var importName = value || key; // Use value if provided, otherwise use key (shorthand syntax)
|
|
68
|
+
|
|
69
|
+
if (importMap.has(importName)) {
|
|
70
|
+
demoImports[key] = importMap.get(importName);
|
|
71
|
+
namedExports[key] = namedExportsMap.get(importName);
|
|
72
|
+
} else {
|
|
73
|
+
// Throw error if any variant component is not imported
|
|
74
|
+
throw new Error("Invalid variants parameter in ".concat(functionName, " call in ").concat(filePath, ". ") + "Component '".concat(importName, "' is not imported. Make sure to import it first."));
|
|
75
|
+
}
|
|
76
|
+
objectMatch = objectContentRegex.exec(variantsObjectStr);
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
variants: demoImports,
|
|
80
|
+
namedExports: namedExports
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Parses variants parameter which can be either an object literal or a single component identifier
|
|
86
|
+
*/
|
|
87
|
+
function parseVariantsParameter(variantsParam, importMap, namedExportsMap, functionName, filePath) {
|
|
88
|
+
var trimmed = variantsParam.trim();
|
|
89
|
+
|
|
90
|
+
// If it's an object literal, use existing logic
|
|
91
|
+
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
|
92
|
+
return parseVariantsObject(trimmed, importMap, namedExportsMap, functionName, filePath);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// If it's a single identifier, map it to "Default"
|
|
96
|
+
if (importMap.has(trimmed)) {
|
|
97
|
+
return {
|
|
98
|
+
variants: {
|
|
99
|
+
Default: importMap.get(trimmed)
|
|
100
|
+
},
|
|
101
|
+
namedExports: {
|
|
102
|
+
Default: namedExportsMap.get(trimmed)
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Throw error if the identifier is not found in imports
|
|
108
|
+
throw new Error("Invalid variants parameter in ".concat(functionName, " call in ").concat(filePath, ". ") + "Component '".concat(trimmed, "' is not imported. Make sure to import it first."));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Validates that a URL parameter follows the expected convention
|
|
113
|
+
*/
|
|
114
|
+
function validateUrlParameter(url, functionName, filePath) {
|
|
115
|
+
var trimmedUrl = url.trim();
|
|
116
|
+
|
|
117
|
+
// Check for import.meta.url
|
|
118
|
+
if (trimmedUrl === 'import.meta.url') {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Check for CJS equivalent: require('url').pathToFileURL(__filename).toString()
|
|
123
|
+
// https://github.com/javiertury/babel-plugin-transform-import-meta#importmetaurl
|
|
124
|
+
var cjsPattern = /require\s*\(\s*['"`]url['"`]\s*\)\s*\.\s*pathToFileURL\s*\(\s*__filename\s*\)\s*\.\s*toString\s*\(\s*\)/;
|
|
125
|
+
if (cjsPattern.test(trimmedUrl)) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
throw new Error("Invalid URL parameter in ".concat(functionName, " call in ").concat(filePath, ". ") + "Expected 'import.meta.url' or 'require('url').pathToFileURL(__filename).toString()' but got: ".concat(trimmedUrl));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Validates that a variants parameter is either an object mapping to imports or a single identifier
|
|
133
|
+
*/
|
|
134
|
+
function validateVariantsParameter(variantsParam, functionName, filePath) {
|
|
135
|
+
if (!variantsParam || variantsParam.trim() === '') {
|
|
136
|
+
throw new Error("Invalid variants parameter in ".concat(functionName, " call in ").concat(filePath, ". ") + "Expected an object mapping variant names to imports or a single component identifier.");
|
|
137
|
+
}
|
|
138
|
+
var trimmed = variantsParam.trim();
|
|
139
|
+
|
|
140
|
+
// Check if it's an object literal
|
|
141
|
+
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
|
|
142
|
+
return; // Valid object literal
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Check if it's a valid identifier (single component)
|
|
146
|
+
if (/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(trimmed)) {
|
|
147
|
+
return; // Valid identifier
|
|
148
|
+
}
|
|
149
|
+
throw new Error("Invalid variants parameter in ".concat(functionName, " call in ").concat(filePath, ". ") + "Expected an object mapping variant names to imports or a single component identifier, but got: ".concat(trimmed));
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Parses a file to extract a single create* factory call and its variants and options
|
|
154
|
+
* Only supports one create* call per file - will throw an error if multiple are found
|
|
155
|
+
* Returns null if no create* call is found
|
|
156
|
+
*/
|
|
157
|
+
export function parseCreateFactoryCall(_x, _x2) {
|
|
158
|
+
return _parseCreateFactoryCall.apply(this, arguments);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Finds create* factory calls in code, handling multiline cases
|
|
163
|
+
*/
|
|
164
|
+
function _parseCreateFactoryCall() {
|
|
165
|
+
_parseCreateFactoryCall = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(code, filePath) {
|
|
166
|
+
var _yield$parseImports, importResult, externals, importMap, namedExportsMap, createFactoryMatches, match, functionName, fullMatch, urlParam, variantsParam, optionsObjectStr, hasOptions, url, _parseVariantsParamet, variants, namedExports, options, hasPrecompute, precomputeValue, precomputeKeyStart, precomputeValueStart, precomputeValueEnd, nameMatch, slugMatch, skipPrecomputeMatch, precomputeInfo, transformedExternals, _i, _Object$entries, _Object$entries$_i, modulePath, externalImport, live;
|
|
167
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
168
|
+
while (1) switch (_context.prev = _context.next) {
|
|
169
|
+
case 0:
|
|
170
|
+
_context.next = 2;
|
|
171
|
+
return parseImports(code, filePath);
|
|
172
|
+
case 2:
|
|
173
|
+
_yield$parseImports = _context.sent;
|
|
174
|
+
importResult = _yield$parseImports.relative;
|
|
175
|
+
externals = _yield$parseImports.externals;
|
|
176
|
+
importMap = buildImportMap({
|
|
177
|
+
relative: importResult,
|
|
178
|
+
externals: externals
|
|
179
|
+
});
|
|
180
|
+
namedExportsMap = buildNamedExportsMap({
|
|
181
|
+
relative: importResult,
|
|
182
|
+
externals: externals
|
|
183
|
+
}); // Find all create* calls in the code
|
|
184
|
+
createFactoryMatches = findCreateFactoryCalls(code, filePath); // Enforce single create* call per file
|
|
185
|
+
if (!(createFactoryMatches.length > 1)) {
|
|
186
|
+
_context.next = 10;
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
throw new Error("Multiple create* factory calls found in ".concat(filePath, ". Only one create* call per file is supported. Found ").concat(createFactoryMatches.length, " calls."));
|
|
190
|
+
case 10:
|
|
191
|
+
if (!(createFactoryMatches.length === 0)) {
|
|
192
|
+
_context.next = 12;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
return _context.abrupt("return", null);
|
|
196
|
+
case 12:
|
|
197
|
+
match = createFactoryMatches[0];
|
|
198
|
+
functionName = match.functionName, fullMatch = match.fullMatch, urlParam = match.urlParam, variantsParam = match.variantsParam, optionsObjectStr = match.optionsObjectStr, hasOptions = match.hasOptions; // Validate URL parameter
|
|
199
|
+
validateUrlParameter(urlParam, functionName, filePath);
|
|
200
|
+
|
|
201
|
+
// Validate variants parameter
|
|
202
|
+
validateVariantsParameter(variantsParam, functionName, filePath);
|
|
203
|
+
|
|
204
|
+
// Extract URL (typically import.meta.url)
|
|
205
|
+
url = urlParam.trim(); // Resolve variants for this specific create* call
|
|
206
|
+
_parseVariantsParamet = parseVariantsParameter(variantsParam, importMap, namedExportsMap, functionName, filePath), variants = _parseVariantsParamet.variants, namedExports = _parseVariantsParamet.namedExports; // Parse options object
|
|
207
|
+
options = {};
|
|
208
|
+
hasPrecompute = false;
|
|
209
|
+
// Extract name
|
|
210
|
+
nameMatch = optionsObjectStr.match(/name\s*:\s*['"`]([^'"`]+)['"`]/);
|
|
211
|
+
if (nameMatch) {
|
|
212
|
+
options.name = nameMatch[1];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Extract slug
|
|
216
|
+
slugMatch = optionsObjectStr.match(/slug\s*:\s*['"`]([^'"`]+)['"`]/);
|
|
217
|
+
if (slugMatch) {
|
|
218
|
+
options.slug = slugMatch[1];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Extract skipPrecompute
|
|
222
|
+
skipPrecomputeMatch = optionsObjectStr.match(/skipPrecompute\s*:\s*(true|false)/);
|
|
223
|
+
if (skipPrecomputeMatch) {
|
|
224
|
+
options.skipPrecompute = skipPrecomputeMatch[1] === 'true';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Extract precompute value using robust parsing
|
|
228
|
+
precomputeInfo = extractPrecomputeFromOptions(optionsObjectStr);
|
|
229
|
+
if (precomputeInfo) {
|
|
230
|
+
hasPrecompute = true;
|
|
231
|
+
precomputeKeyStart = precomputeInfo.keyStart;
|
|
232
|
+
precomputeValueStart = precomputeInfo.valueStart;
|
|
233
|
+
precomputeValueEnd = precomputeInfo.valueEnd;
|
|
234
|
+
precomputeValue = precomputeInfo.value;
|
|
235
|
+
options.precompute = precomputeValue;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Transform externals from parseImports format to simplified format
|
|
239
|
+
// Only include side-effect imports (where names array is empty)
|
|
240
|
+
transformedExternals = {};
|
|
241
|
+
for (_i = 0, _Object$entries = Object.entries(externals); _i < _Object$entries.length; _i++) {
|
|
242
|
+
_Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), modulePath = _Object$entries$_i[0], externalImport = _Object$entries$_i[1];
|
|
243
|
+
// Only include side-effect imports (empty names array)
|
|
244
|
+
if (externalImport.names.length === 0) {
|
|
245
|
+
transformedExternals[modulePath] = []; // Empty array for side-effect imports
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Detect if this is a live demo based on function name containing "Live" as a distinct component
|
|
250
|
+
// This catches: createLive, createLiveDemo, createDemoLive, etc.
|
|
251
|
+
// But avoids false positives like: createDelivery, delivery, etc.
|
|
252
|
+
live = /Live/.test(functionName);
|
|
253
|
+
return _context.abrupt("return", {
|
|
254
|
+
functionName: functionName,
|
|
255
|
+
url: url,
|
|
256
|
+
variants: variants,
|
|
257
|
+
namedExports: namedExports,
|
|
258
|
+
options: options,
|
|
259
|
+
fullMatch: fullMatch,
|
|
260
|
+
variantsObjectStr: variantsParam,
|
|
261
|
+
optionsObjectStr: optionsObjectStr,
|
|
262
|
+
hasOptions: hasOptions,
|
|
263
|
+
hasPrecompute: hasPrecompute,
|
|
264
|
+
precomputeValue: hasPrecompute ? precomputeValue : undefined,
|
|
265
|
+
externals: transformedExternals,
|
|
266
|
+
live: live,
|
|
267
|
+
precomputeKeyStart: hasPrecompute ? precomputeKeyStart : undefined,
|
|
268
|
+
precomputeValueStart: hasPrecompute ? precomputeValueStart : undefined,
|
|
269
|
+
precomputeValueEnd: hasPrecompute ? precomputeValueEnd : undefined
|
|
270
|
+
});
|
|
271
|
+
case 32:
|
|
272
|
+
case "end":
|
|
273
|
+
return _context.stop();
|
|
274
|
+
}
|
|
275
|
+
}, _callee);
|
|
276
|
+
}));
|
|
277
|
+
return _parseCreateFactoryCall.apply(this, arguments);
|
|
278
|
+
}
|
|
279
|
+
function findCreateFactoryCalls(code, filePath) {
|
|
280
|
+
var results = [];
|
|
281
|
+
|
|
282
|
+
// Find all create* function calls
|
|
283
|
+
var createFactoryRegex = /\b(create\w*)\s*\(/g;
|
|
284
|
+
var match = createFactoryRegex.exec(code);
|
|
285
|
+
while (match !== null) {
|
|
286
|
+
var functionName = match[1];
|
|
287
|
+
var startIndex = match.index;
|
|
288
|
+
var parenIndex = match.index + match[0].length - 1; // Position of opening parenthesis
|
|
289
|
+
|
|
290
|
+
// Find the matching closing parenthesis
|
|
291
|
+
var parenCount = 0;
|
|
292
|
+
var endIndex = -1;
|
|
293
|
+
for (var i = parenIndex; i < code.length; i += 1) {
|
|
294
|
+
if (code[i] === '(') {
|
|
295
|
+
parenCount += 1;
|
|
296
|
+
} else if (code[i] === ')') {
|
|
297
|
+
parenCount -= 1;
|
|
298
|
+
if (parenCount === 0) {
|
|
299
|
+
endIndex = i;
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
if (endIndex === -1) {
|
|
305
|
+
match = createFactoryRegex.exec(code);
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
var fullMatch = code.substring(startIndex, endIndex + 1);
|
|
309
|
+
var content = code.substring(parenIndex + 1, endIndex);
|
|
310
|
+
|
|
311
|
+
// Split by commas at the top level, handling nested structures and comments
|
|
312
|
+
var _parseFunctionParamet = parseFunctionParameters(content),
|
|
313
|
+
parts = _parseFunctionParamet.parts,
|
|
314
|
+
objects = _parseFunctionParamet.objects;
|
|
315
|
+
|
|
316
|
+
// Validate the function follows the convention
|
|
317
|
+
if (parts.length < 2 || parts.length > 3) {
|
|
318
|
+
throw new Error("Invalid ".concat(functionName, " call in ").concat(filePath, ". ") + "Expected 2-3 parameters (url, variants, options?) but got ".concat(parts.length, " parameters. ") + "Functions starting with 'create' must follow the convention: create*(url, variants, options?)");
|
|
319
|
+
}
|
|
320
|
+
if (parts.length === 2) {
|
|
321
|
+
var _parts = _slicedToArray(parts, 1),
|
|
322
|
+
urlParam = _parts[0];
|
|
323
|
+
|
|
324
|
+
// The variants parameter can be either an object literal or a single identifier
|
|
325
|
+
var variantsParam = objects[1] || parts[1].trim();
|
|
326
|
+
results.push({
|
|
327
|
+
functionName: functionName,
|
|
328
|
+
fullMatch: fullMatch,
|
|
329
|
+
urlParam: urlParam.trim(),
|
|
330
|
+
variantsParam: variantsParam,
|
|
331
|
+
optionsObjectStr: '{}',
|
|
332
|
+
// Default empty options
|
|
333
|
+
hasOptions: false // No options parameter was provided
|
|
334
|
+
});
|
|
335
|
+
} else if (parts.length === 3) {
|
|
336
|
+
var _parts2 = _slicedToArray(parts, 1),
|
|
337
|
+
_urlParam = _parts2[0];
|
|
338
|
+
|
|
339
|
+
// The variants parameter can be either an object literal or a single identifier
|
|
340
|
+
var _variantsParam = objects[1] || parts[1].trim();
|
|
341
|
+
var optionsObjectStr = objects[2];
|
|
342
|
+
if (!optionsObjectStr) {
|
|
343
|
+
throw new Error("Invalid options parameter in ".concat(functionName, " call in ").concat(filePath, ". ") + "Expected an object but could not parse: ".concat(parts[2].trim()));
|
|
344
|
+
}
|
|
345
|
+
results.push({
|
|
346
|
+
functionName: functionName,
|
|
347
|
+
fullMatch: fullMatch,
|
|
348
|
+
urlParam: _urlParam.trim(),
|
|
349
|
+
variantsParam: _variantsParam,
|
|
350
|
+
optionsObjectStr: optionsObjectStr,
|
|
351
|
+
hasOptions: true // Options parameter was provided
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
match = createFactoryRegex.exec(code);
|
|
355
|
+
}
|
|
356
|
+
return results;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Extracts precompute property from options object using robust parsing
|
|
361
|
+
*/
|
|
362
|
+
function extractPrecomputeFromOptions(optionsObjectStr) {
|
|
363
|
+
// Find the precompute property using regex
|
|
364
|
+
var precomputeMatch = optionsObjectStr.match(/precompute\s*:\s*/);
|
|
365
|
+
if (!precomputeMatch) {
|
|
366
|
+
return null;
|
|
367
|
+
}
|
|
368
|
+
var keyStart = precomputeMatch.index;
|
|
369
|
+
var valueStartIndex = keyStart + precomputeMatch[0].length;
|
|
370
|
+
|
|
371
|
+
// Extract the remaining part after "precompute:"
|
|
372
|
+
var remainingStr = optionsObjectStr.substring(valueStartIndex);
|
|
373
|
+
|
|
374
|
+
// Try to extract a balanced object first
|
|
375
|
+
var objectValue = extractBalancedBraces(remainingStr);
|
|
376
|
+
if (objectValue) {
|
|
377
|
+
// It's an object value
|
|
378
|
+
var _actualValueStart = valueStartIndex;
|
|
379
|
+
while (_actualValueStart < optionsObjectStr.length && /\s/.test(optionsObjectStr[_actualValueStart])) {
|
|
380
|
+
_actualValueStart += 1;
|
|
381
|
+
}
|
|
382
|
+
var _valueEnd = _actualValueStart + objectValue.length;
|
|
383
|
+
return {
|
|
384
|
+
keyStart: keyStart,
|
|
385
|
+
valueStart: _actualValueStart,
|
|
386
|
+
valueEnd: _valueEnd,
|
|
387
|
+
value: objectValue // Keep object as string
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// It's a simple value (true, false, etc.)
|
|
392
|
+
// Parse until comma, newline, or closing brace
|
|
393
|
+
var i = 0;
|
|
394
|
+
var inString = false;
|
|
395
|
+
var stringChar = '';
|
|
396
|
+
while (i < remainingStr.length) {
|
|
397
|
+
var _char = remainingStr[i];
|
|
398
|
+
if (!inString && (_char === '"' || _char === "'" || _char === '`')) {
|
|
399
|
+
inString = true;
|
|
400
|
+
stringChar = _char;
|
|
401
|
+
} else if (inString && _char === stringChar && remainingStr[i - 1] !== '\\') {
|
|
402
|
+
inString = false;
|
|
403
|
+
stringChar = '';
|
|
404
|
+
} else if (!inString && (_char === ',' || _char === '}' || _char === '\n')) {
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
i += 1;
|
|
408
|
+
}
|
|
409
|
+
var valueStr = remainingStr.substring(0, i).trim();
|
|
410
|
+
|
|
411
|
+
// Calculate precise boundaries
|
|
412
|
+
var actualValueStart = valueStartIndex;
|
|
413
|
+
while (actualValueStart < optionsObjectStr.length && /\s/.test(optionsObjectStr[actualValueStart])) {
|
|
414
|
+
actualValueStart += 1;
|
|
415
|
+
}
|
|
416
|
+
var valueEnd = actualValueStart + valueStr.length;
|
|
417
|
+
|
|
418
|
+
// Parse the value
|
|
419
|
+
var parsedValue;
|
|
420
|
+
if (valueStr === 'true') {
|
|
421
|
+
parsedValue = true;
|
|
422
|
+
} else if (valueStr === 'false') {
|
|
423
|
+
parsedValue = false;
|
|
424
|
+
} else {
|
|
425
|
+
parsedValue = valueStr;
|
|
426
|
+
}
|
|
427
|
+
return {
|
|
428
|
+
keyStart: keyStart,
|
|
429
|
+
valueStart: actualValueStart,
|
|
430
|
+
valueEnd: valueEnd,
|
|
431
|
+
value: parsedValue
|
|
432
|
+
};
|
|
433
|
+
}
|
|
@@ -12,4 +12,8 @@ export interface ParsedParameters {
|
|
|
12
12
|
* Parses function parameters, splitting by top-level commas and extracting object literals.
|
|
13
13
|
* This combines comma-splitting with object extraction for common use cases.
|
|
14
14
|
*/
|
|
15
|
-
export declare function parseFunctionParameters(str: string): ParsedParameters;
|
|
15
|
+
export declare function parseFunctionParameters(str: string): ParsedParameters;
|
|
16
|
+
/**
|
|
17
|
+
* Extracts a balanced brace object from a string, handling leading whitespace and comments
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractBalancedBraces(str: string): string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseFunctionParameters.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loadPrecomputedCodeHighlighter/parseFunctionParameters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,0DAA0D;IAC1D,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,8EAA8E;IAC9E,OAAO,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CA8FrE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyEhE"}
|
|
@@ -100,7 +100,7 @@ export function parseFunctionParameters(str) {
|
|
|
100
100
|
/**
|
|
101
101
|
* Extracts a balanced brace object from a string, handling leading whitespace and comments
|
|
102
102
|
*/
|
|
103
|
-
function extractBalancedBraces(str) {
|
|
103
|
+
export function extractBalancedBraces(str) {
|
|
104
104
|
// Find the first opening brace, skipping whitespace and comments
|
|
105
105
|
var startIndex = -1;
|
|
106
106
|
var inSingleLineComment = false;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adds or replaces precompute data in createDemo function calls.
|
|
3
|
+
*
|
|
4
|
+
* This function handles multiple scenarios:
|
|
5
|
+
* 1. Replaces any existing 'precompute' property with actual data
|
|
6
|
+
* 2. Adds precompute property to existing options object when missing
|
|
7
|
+
* 3. Adds entire options object with precompute when no options exist
|
|
8
|
+
* 4. Optionally adds an ExternalsProvider property for external dependencies
|
|
9
|
+
*
|
|
10
|
+
* @param source - The source code string containing createDemo calls
|
|
11
|
+
* @param precomputeData - The data object to inject
|
|
12
|
+
* @param demoCallInfo - Information about the parsed demo call structure
|
|
13
|
+
* @param externalsProviderPath - Optional path to the generated externals provider file
|
|
14
|
+
* @returns The modified source code with precompute data injected
|
|
15
|
+
*/
|
|
16
|
+
export declare function replacePrecomputeValue(source: string, precomputeData: Record<string, any>, demoCallInfo?: {
|
|
17
|
+
fullMatch: string;
|
|
18
|
+
optionsObjectStr: string;
|
|
19
|
+
hasOptions: boolean;
|
|
20
|
+
hasPrecompute: boolean;
|
|
21
|
+
precomputeValue?: any;
|
|
22
|
+
precomputeKeyStart?: number;
|
|
23
|
+
precomputeValueStart?: number;
|
|
24
|
+
precomputeValueEnd?: number;
|
|
25
|
+
}, externalsProviderPath?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replacePrecomputeValue.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loadPrecomputedCodeHighlighter/replacePrecomputeValue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnC,YAAY,CAAC,EAAE;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,EACD,qBAAqB,CAAC,EAAE,MAAM,GAC7B,MAAM,CA8DR"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
/**
|
|
3
|
+
* Adds or replaces precompute data in createDemo function calls.
|
|
4
|
+
*
|
|
5
|
+
* This function handles multiple scenarios:
|
|
6
|
+
* 1. Replaces any existing 'precompute' property with actual data
|
|
7
|
+
* 2. Adds precompute property to existing options object when missing
|
|
8
|
+
* 3. Adds entire options object with precompute when no options exist
|
|
9
|
+
* 4. Optionally adds an ExternalsProvider property for external dependencies
|
|
10
|
+
*
|
|
11
|
+
* @param source - The source code string containing createDemo calls
|
|
12
|
+
* @param precomputeData - The data object to inject
|
|
13
|
+
* @param demoCallInfo - Information about the parsed demo call structure
|
|
14
|
+
* @param externalsProviderPath - Optional path to the generated externals provider file
|
|
15
|
+
* @returns The modified source code with precompute data injected
|
|
16
|
+
*/
|
|
17
|
+
export function replacePrecomputeValue(source, precomputeData, demoCallInfo, externalsProviderPath) {
|
|
18
|
+
// Convert the data to a properly formatted JSON string
|
|
19
|
+
var precomputeDataString = JSON.stringify(precomputeData, null, 2);
|
|
20
|
+
|
|
21
|
+
// If no demoCallInfo provided, return unchanged
|
|
22
|
+
if (!demoCallInfo) {
|
|
23
|
+
return source;
|
|
24
|
+
}
|
|
25
|
+
var callInfo = demoCallInfo;
|
|
26
|
+
var fullMatch = callInfo.fullMatch,
|
|
27
|
+
optionsObjectStr = callInfo.optionsObjectStr,
|
|
28
|
+
hasOptions = callInfo.hasOptions,
|
|
29
|
+
hasPrecompute = callInfo.hasPrecompute,
|
|
30
|
+
precomputeKeyStart = callInfo.precomputeKeyStart,
|
|
31
|
+
precomputeValueEnd = callInfo.precomputeValueEnd;
|
|
32
|
+
|
|
33
|
+
// Prepare externals provider import and property if needed
|
|
34
|
+
var modifiedSource = source;
|
|
35
|
+
var additionalProperties = '';
|
|
36
|
+
if (externalsProviderPath) {
|
|
37
|
+
// Add import statement at the top of the file
|
|
38
|
+
var importStatement = "import { CodeExternalsProvider } from '".concat(externalsProviderPath, "';\n");
|
|
39
|
+
modifiedSource = importStatement + modifiedSource;
|
|
40
|
+
|
|
41
|
+
// Prepare the CodeExternalsProvider property
|
|
42
|
+
additionalProperties = ", CodeExternalsProvider";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Case 1: Replace existing precompute property (from key start to value end)
|
|
46
|
+
if (hasPrecompute && precomputeKeyStart !== undefined && precomputeValueEnd !== undefined) {
|
|
47
|
+
// Replace the entire property from key start to value end
|
|
48
|
+
var beforeProperty = optionsObjectStr.substring(0, precomputeKeyStart);
|
|
49
|
+
var afterProperty = optionsObjectStr.substring(precomputeValueEnd);
|
|
50
|
+
var newOptionsStr = "".concat(beforeProperty, "precompute: ").concat(precomputeDataString).concat(additionalProperties).concat(afterProperty);
|
|
51
|
+
return modifiedSource.replace(optionsObjectStr, newOptionsStr);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Case 2: Add precompute to existing options object
|
|
55
|
+
if (hasOptions) {
|
|
56
|
+
var optionsMatch = optionsObjectStr.match(/^(\s*\{)([\s\S]*?)(\s*\}\s*)$/);
|
|
57
|
+
if (optionsMatch) {
|
|
58
|
+
var _optionsMatch = _slicedToArray(optionsMatch, 4),
|
|
59
|
+
openBrace = _optionsMatch[1],
|
|
60
|
+
content = _optionsMatch[2],
|
|
61
|
+
closeBrace = _optionsMatch[3];
|
|
62
|
+
var trimmedContent = content.trim();
|
|
63
|
+
var needsComma = trimmedContent !== '' && !trimmedContent.endsWith(',');
|
|
64
|
+
var newOptions = "".concat(openBrace).concat(content).concat(needsComma ? ',' : '', "\n precompute: ").concat(precomputeDataString).concat(additionalProperties).concat(closeBrace);
|
|
65
|
+
return modifiedSource.replace(optionsObjectStr, newOptions);
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
// Case 3: Add entire options object
|
|
69
|
+
var newCall = fullMatch.replace(/(\s*)\)$/, "$1, { precompute: ".concat(precomputeDataString).concat(additionalProperties, " })"));
|
|
70
|
+
return modifiedSource.replace(fullMatch, newCall);
|
|
71
|
+
}
|
|
72
|
+
return source;
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./loadServerCodeMeta.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loadServerCodeMeta/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./loadServerCodeMeta.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { LoadCodeMeta } from "
|
|
1
|
+
import type { LoadCodeMeta } from "../../CodeHighlighter/types.js";
|
|
2
2
|
export interface CreateLoadCodeMetaOptions {}
|
|
3
3
|
/**
|
|
4
|
-
* Default
|
|
4
|
+
* Default loadServerCodeMeta function that resolves variant paths from demo files.
|
|
5
5
|
* This function is used to load code metadata for demos, specifically resolving paths for variants defined in the demo files.
|
|
6
6
|
* It reads the demo file, parses it to find `createDemo` calls with variants, and resolves the paths for those variants.
|
|
7
7
|
* It returns a Code object mapping variant names to their resolved file URLs.
|
|
8
8
|
*/
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const loadServerCodeMeta: LoadCodeMeta;
|
|
10
10
|
/**
|
|
11
11
|
* Creates a loadCodeMeta function that resolves variant paths from demo files.
|
|
12
12
|
*
|
|
@@ -21,4 +21,4 @@ export declare const serverLoadCodeMeta: LoadCodeMeta;
|
|
|
21
21
|
* @param options - Configuration options (currently unused)
|
|
22
22
|
* @returns LoadCodeMeta function that takes a URL and returns Promise<Code>
|
|
23
23
|
*/
|
|
24
|
-
export declare function
|
|
24
|
+
export declare function createLoadServerCodeMeta(_options?: CreateLoadCodeMetaOptions): LoadCodeMeta;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadServerCodeMeta.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loadServerCodeMeta/loadServerCodeMeta.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAQ,MAAM,6BAA6B,CAAC;AAKtE,MAAM,WAAW,yBAAyB;CAEzC;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,cAA6B,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,GAAE,yBAA8B,GAAG,YAAY,CAyC/F"}
|
|
@@ -4,13 +4,14 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
4
4
|
import { readFile } from 'node:fs/promises';
|
|
5
5
|
import { resolveVariantPathsWithFs } from "../loaderUtils/resolveModulePathWithFs.js";
|
|
6
6
|
import { parseCreateFactoryCall } from "../loadPrecomputedCodeHighlighter/parseCreateFactoryCall.js";
|
|
7
|
+
import { getFileNameFromUrl } from "../loaderUtils/index.js";
|
|
7
8
|
/**
|
|
8
|
-
* Default
|
|
9
|
+
* Default loadServerCodeMeta function that resolves variant paths from demo files.
|
|
9
10
|
* This function is used to load code metadata for demos, specifically resolving paths for variants defined in the demo files.
|
|
10
11
|
* It reads the demo file, parses it to find `createDemo` calls with variants, and resolves the paths for those variants.
|
|
11
12
|
* It returns a Code object mapping variant names to their resolved file URLs.
|
|
12
13
|
*/
|
|
13
|
-
export var
|
|
14
|
+
export var loadServerCodeMeta = createLoadServerCodeMeta();
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Creates a loadCodeMeta function that resolves variant paths from demo files.
|
|
@@ -26,7 +27,7 @@ export var serverLoadCodeMeta = createServerLoadCodeMeta();
|
|
|
26
27
|
* @param options - Configuration options (currently unused)
|
|
27
28
|
* @returns LoadCodeMeta function that takes a URL and returns Promise<Code>
|
|
28
29
|
*/
|
|
29
|
-
export function
|
|
30
|
+
export function createLoadServerCodeMeta() {
|
|
30
31
|
var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
31
32
|
return /*#__PURE__*/function () {
|
|
32
33
|
var _loadCodeMeta = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
@@ -60,7 +61,21 @@ export function createServerLoadCodeMeta() {
|
|
|
60
61
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
61
62
|
variantName = _ref2[0],
|
|
62
63
|
fileUrl = _ref2[1];
|
|
64
|
+
var namedExport = demoCall.namedExports[variantName];
|
|
63
65
|
code[variantName] = fileUrl;
|
|
66
|
+
if (namedExport) {
|
|
67
|
+
var _getFileNameFromUrl = getFileNameFromUrl(fileUrl),
|
|
68
|
+
fileName = _getFileNameFromUrl.fileName;
|
|
69
|
+
if (!fileName) {
|
|
70
|
+
throw new Error("Cannot determine fileName from URL \"".concat(fileUrl, "\" for variant \"").concat(variantName, "\". ") + "Please ensure the URL has a valid file extension.");
|
|
71
|
+
}
|
|
72
|
+
code[variantName] = {
|
|
73
|
+
url: fileUrl,
|
|
74
|
+
fileName: fileName,
|
|
75
|
+
namedExport: namedExport
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// TODO: will this cause loadVariantMeta not to run? Maybe we should always run it
|
|
64
79
|
});
|
|
65
80
|
return _context.abrupt("return", code);
|
|
66
81
|
case 15:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./loadServerSource.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pipeline/loadServerSource/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./loadServerSource.js";
|