vike 0.4.220 → 0.4.221-commit-ab9e52a
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/dist/cjs/__internal/index.js +5 -23
- package/dist/cjs/node/api/build.js +33 -24
- package/dist/cjs/node/api/context.js +6 -8
- package/dist/cjs/node/api/prepareViteApiCall.js +23 -21
- package/dist/cjs/node/api/prerender.js +1 -0
- package/dist/cjs/node/api/utils.js +2 -1
- package/dist/cjs/node/cli/context.js +16 -0
- package/dist/cjs/node/cli/entry.js +2 -0
- package/dist/cjs/node/cli/utils.js +1 -0
- package/dist/cjs/node/plugin/index.js +4 -8
- package/dist/cjs/node/plugin/onLoad.js +6 -1
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +34 -33
- package/dist/cjs/node/plugin/plugins/baseUrls.js +2 -2
- package/dist/cjs/node/plugin/plugins/buildApp.js +72 -0
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +12 -12
- package/dist/cjs/node/plugin/plugins/buildConfig.js +17 -12
- package/dist/cjs/node/plugin/plugins/buildEntry/index.js +28 -24
- package/dist/cjs/node/plugin/plugins/commonConfig.js +9 -7
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +7 -4
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +2 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +15 -10
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +11 -6
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/{assertExtensions.js → getVikeConfig/assertExtensions.js} +41 -36
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +59 -22
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/{getConfigFileExport.js → getVikeConfig/getConfigFileExport.js} +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js +159 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +40 -23
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +9 -64
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +11 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +403 -590
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/{debug.js → virtual-files/debug.js} +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/{getVirtualFilePageConfigValuesAll.js → virtual-files/getVirtualFilePageConfigValuesAll.js} +12 -9
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/{getVirtualFilePageConfigs.js → virtual-files/getVirtualFilePageConfigs.js} +13 -11
- package/dist/cjs/node/plugin/plugins/packageJsonFile.js +2 -2
- package/dist/cjs/node/plugin/plugins/previewConfig.js +7 -7
- package/dist/cjs/node/plugin/plugins/setGlobalContext.js +3 -5
- package/dist/cjs/node/plugin/shared/findPageFiles.js +2 -1
- package/dist/cjs/node/plugin/shared/getFullBuildInlineConfig.js +20 -0
- package/dist/cjs/{utils → node/plugin/shared}/getOutDirs.js +70 -61
- package/dist/cjs/node/plugin/{resolveClientEntriesDev.js → shared/resolveClientEntriesDev.js} +5 -8
- package/dist/cjs/{utils → node/plugin/shared}/viteIsSSR.js +2 -2
- package/dist/cjs/node/plugin/utils.js +1 -2
- package/dist/cjs/node/prerender/context.js +31 -0
- package/dist/cjs/node/prerender/resolvePrerenderConfig.js +46 -0
- package/dist/cjs/node/prerender/runPrerender.js +89 -68
- package/dist/cjs/node/prerender/utils.js +2 -2
- package/dist/cjs/node/runtime/globalContext.js +222 -150
- package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +11 -7
- package/dist/cjs/node/runtime/html/injectAssets/getViteDevScript.js +2 -3
- package/dist/cjs/node/runtime/html/injectAssets.js +4 -4
- package/dist/cjs/node/runtime/html/renderHtml.js +4 -5
- package/dist/cjs/node/runtime/page-files/setup.js +1 -1
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +2 -3
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +2 -27
- package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +2 -4
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +4 -4
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +3 -5
- package/dist/cjs/node/runtime/renderPage/isFontFallback.js +29 -0
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +5 -4
- package/dist/cjs/node/runtime/renderPage/log404/index.js +1 -2
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +14 -10
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +6 -5
- package/dist/cjs/node/runtime/renderPage.js +31 -29
- package/dist/cjs/node/runtime/utils.js +3 -3
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +5 -3
- package/dist/cjs/node/shared/resolveBase.js +7 -0
- package/dist/cjs/shared/getPageConfigsRuntime.js +20 -0
- package/dist/cjs/shared/getPageContextUrlComputed.js +6 -1
- package/dist/cjs/shared/getPageFiles/fileTypes.js +0 -1
- package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +0 -3
- package/dist/cjs/shared/getPageFiles/getPageFileObject.js +0 -5
- package/dist/cjs/shared/getPageFiles/parseGlobResults.js +4 -3
- package/dist/cjs/shared/getPageFiles.js +1 -3
- package/dist/cjs/shared/page-configs/getPageConfigUserFriendly.js +15 -6
- package/dist/cjs/shared/page-configs/loadConfigValues.js +5 -1
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +69 -18
- package/dist/cjs/shared/route/loadPageRoutes.js +1 -0
- package/dist/cjs/shared/utils.js +0 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assertSetup.js +1 -1
- package/dist/cjs/utils/catchInfiniteLoop.js +34 -0
- package/dist/cjs/utils/debug.js +8 -6
- package/dist/cjs/utils/findFile.js +4 -3
- package/dist/cjs/utils/isDev.js +2 -2
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +2 -2
- package/dist/cjs/utils/makePublicCopy.js +32 -0
- package/dist/cjs/utils/objectAssignSafe.js +7 -0
- package/dist/cjs/utils/path.js +48 -0
- package/dist/cjs/utils/requireResolve.js +3 -3
- package/dist/esm/__internal/index.d.ts +2 -2
- package/dist/esm/__internal/index.js +7 -26
- package/dist/esm/client/client-routing-runtime/createPageContext.js +5 -9
- package/dist/esm/client/client-routing-runtime/history.d.ts +3 -1
- package/dist/esm/client/client-routing-runtime/history.js +23 -18
- package/dist/esm/client/client-routing-runtime/index.d.ts +0 -1
- package/dist/esm/client/client-routing-runtime/index.js +0 -1
- package/dist/esm/client/client-routing-runtime/initClientRouter.js +2 -2
- package/dist/esm/client/client-routing-runtime/initOnLinkClick.d.ts +0 -4
- package/dist/esm/client/client-routing-runtime/initOnLinkClick.js +0 -11
- package/dist/esm/client/client-routing-runtime/initOnPopState.d.ts +0 -10
- package/dist/esm/client/client-routing-runtime/initOnPopState.js +50 -70
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +15 -15
- package/dist/esm/client/client-routing-runtime/scrollRestoration.d.ts +4 -6
- package/dist/esm/client/client-routing-runtime/scrollRestoration.js +17 -12
- package/dist/esm/client/client-routing-runtime/setScrollPosition.d.ts +1 -1
- package/dist/esm/client/client-routing-runtime/setScrollPosition.js +29 -5
- package/dist/esm/client/client-routing-runtime/skipLink.d.ts +0 -2
- package/dist/esm/client/client-routing-runtime/skipLink.js +0 -1
- package/dist/esm/client/client-routing-runtime/utils.d.ts +1 -0
- package/dist/esm/client/client-routing-runtime/utils.js +1 -0
- package/dist/esm/client/server-routing-runtime/getPageContext.js +3 -4
- package/dist/esm/client/shared/loadUserFilesClientSide.js +3 -2
- package/dist/esm/node/api/build.d.ts +1 -6
- package/dist/esm/node/api/build.js +31 -25
- package/dist/esm/node/api/context.d.ts +4 -4
- package/dist/esm/node/api/context.js +6 -9
- package/dist/esm/node/api/prepareViteApiCall.d.ts +4 -3
- package/dist/esm/node/api/prepareViteApiCall.js +24 -22
- package/dist/esm/node/api/prerender.js +1 -0
- package/dist/esm/node/api/utils.d.ts +2 -1
- package/dist/esm/node/api/utils.js +2 -1
- package/dist/esm/node/cli/context.d.ts +5 -0
- package/dist/esm/node/cli/context.js +14 -0
- package/dist/esm/node/cli/entry.js +2 -0
- package/dist/esm/node/cli/parseCli.d.ts +3 -1
- package/dist/esm/node/cli/utils.d.ts +1 -0
- package/dist/esm/node/cli/utils.js +1 -0
- package/dist/esm/node/plugin/index.d.ts +29 -1
- package/dist/esm/node/plugin/index.js +5 -9
- package/dist/esm/node/plugin/onLoad.js +7 -2
- package/dist/esm/node/plugin/plugins/autoFullBuild.js +35 -34
- package/dist/esm/node/plugin/plugins/baseUrls.js +2 -2
- package/dist/esm/node/plugin/plugins/buildApp.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/buildApp.js +70 -0
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.d.ts +0 -2
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +11 -11
- package/dist/esm/node/plugin/plugins/buildConfig.js +16 -11
- package/dist/esm/node/plugin/plugins/buildEntry/index.d.ts +3 -3
- package/dist/esm/node/plugin/plugins/buildEntry/index.js +28 -24
- package/dist/esm/node/plugin/plugins/commonConfig.d.ts +8 -2
- package/dist/esm/node/plugin/plugins/commonConfig.js +7 -5
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +6 -3
- package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +2 -1
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +14 -9
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +11 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/assertExtensions.d.ts +6 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{assertExtensions.js → getVikeConfig/assertExtensions.js} +41 -36
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +58 -21
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{getConfigFileExport.js → getVikeConfig/getConfigFileExport.js} +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.d.ts +39 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js +154 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.d.ts +15 -9
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +41 -24
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.d.ts +8 -18
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +10 -65
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +6 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +12 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +10 -122
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +407 -594
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{debug.js → virtual-files/debug.js} +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{getVirtualFilePageConfigValuesAll.js → virtual-files/getVirtualFilePageConfigValuesAll.js} +12 -9
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{getVirtualFilePageConfigs.js → virtual-files/getVirtualFilePageConfigs.js} +13 -11
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{isRuntimeEnvMatch.d.ts → virtual-files/isRuntimeEnvMatch.d.ts} +1 -1
- package/dist/esm/node/plugin/plugins/packageJsonFile.js +1 -1
- package/dist/esm/node/plugin/plugins/previewConfig.js +5 -5
- package/dist/esm/node/plugin/plugins/setGlobalContext.js +4 -6
- package/dist/esm/node/plugin/shared/findPageFiles.js +2 -1
- package/dist/esm/node/plugin/shared/getFullBuildInlineConfig.d.ts +2 -0
- package/dist/esm/node/plugin/shared/getFullBuildInlineConfig.js +17 -0
- package/dist/esm/{utils → node/plugin/shared}/getOutDirs.d.ts +1 -1
- package/dist/esm/{utils → node/plugin/shared}/getOutDirs.js +52 -43
- package/dist/esm/node/plugin/{resolveClientEntriesDev.js → shared/resolveClientEntriesDev.js} +5 -8
- package/dist/esm/{utils → node/plugin/shared}/viteIsSSR.d.ts +2 -5
- package/dist/esm/{utils → node/plugin/shared}/viteIsSSR.js +2 -2
- package/dist/esm/node/plugin/utils.d.ts +0 -1
- package/dist/esm/node/plugin/utils.js +1 -2
- package/dist/esm/node/prerender/context.d.ts +11 -0
- package/dist/esm/node/prerender/context.js +29 -0
- package/dist/esm/node/prerender/resolvePrerenderConfig.d.ts +12 -0
- package/dist/esm/node/prerender/resolvePrerenderConfig.js +44 -0
- package/dist/esm/node/prerender/runPrerender.d.ts +42 -1
- package/dist/esm/node/prerender/runPrerender.js +90 -69
- package/dist/esm/node/prerender/utils.d.ts +2 -2
- package/dist/esm/node/prerender/utils.js +2 -2
- package/dist/esm/node/runtime/globalContext.d.ts +44 -36
- package/dist/esm/node/runtime/globalContext.js +223 -151
- package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.d.ts +1 -1
- package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +11 -7
- package/dist/esm/node/runtime/html/injectAssets/getViteDevScript.d.ts +4 -1
- package/dist/esm/node/runtime/html/injectAssets/getViteDevScript.js +2 -3
- package/dist/esm/node/runtime/html/injectAssets.d.ts +2 -0
- package/dist/esm/node/runtime/html/injectAssets.js +4 -4
- package/dist/esm/node/runtime/html/renderHtml.js +4 -5
- package/dist/esm/node/runtime/page-files/setup.js +1 -1
- package/dist/esm/node/runtime/renderPage/analyzePage.d.ts +2 -1
- package/dist/esm/node/runtime/renderPage/analyzePage.js +2 -3
- package/dist/esm/node/runtime/renderPage/getEarlyHints.js +1 -26
- package/dist/esm/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +2 -4
- package/dist/esm/node/runtime/renderPage/getPageAssets.d.ts +3 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +4 -4
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.js +3 -5
- package/dist/esm/node/runtime/renderPage/isFontFallback.d.ts +3 -0
- package/dist/esm/node/runtime/renderPage/isFontFallback.js +27 -0
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +6 -5
- package/dist/esm/node/runtime/renderPage/log404/index.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/log404/index.js +1 -2
- package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +3 -0
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +26 -10
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +14 -10
- package/dist/esm/node/runtime/renderPage/resolveRedirects.d.ts +2 -0
- package/dist/esm/node/runtime/renderPage/resolveRedirects.js +5 -5
- package/dist/esm/node/runtime/renderPage.js +32 -30
- package/dist/esm/node/runtime/utils.d.ts +3 -3
- package/dist/esm/node/runtime/utils.js +3 -3
- package/dist/esm/node/runtime-dev/createDevMiddleware.js +5 -3
- package/dist/esm/node/shared/resolveBase.d.ts +5 -1
- package/dist/esm/node/shared/resolveBase.js +7 -0
- package/dist/esm/shared/getPageConfigsRuntime.d.ts +13 -0
- package/dist/esm/shared/getPageConfigsRuntime.js +18 -0
- package/dist/esm/shared/getPageContextUrlComputed.js +6 -1
- package/dist/esm/shared/getPageFiles/fileTypes.js +1 -2
- package/dist/esm/shared/getPageFiles/getAllPageIdFiles.js +0 -3
- package/dist/esm/shared/getPageFiles/getPageFileObject.js +0 -5
- package/dist/esm/shared/getPageFiles/parseGlobResults.d.ts +1 -1
- package/dist/esm/shared/getPageFiles/parseGlobResults.js +4 -3
- package/dist/esm/shared/getPageFiles.d.ts +0 -1
- package/dist/esm/shared/getPageFiles.js +0 -1
- package/dist/esm/shared/page-configs/Config.d.ts +83 -3
- package/dist/esm/shared/page-configs/PageConfig.d.ts +30 -18
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.d.ts +6 -8
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.js +15 -6
- package/dist/esm/shared/page-configs/loadConfigValues.js +6 -2
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.d.ts +7 -1
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +70 -19
- package/dist/esm/shared/route/loadPageRoutes.js +1 -0
- package/dist/esm/shared/utils.d.ts +0 -1
- package/dist/esm/shared/utils.js +0 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assertSetup.js +1 -1
- package/dist/esm/utils/catchInfiniteLoop.d.ts +2 -0
- package/dist/esm/utils/catchInfiniteLoop.js +32 -0
- package/dist/esm/utils/debug.d.ts +1 -1
- package/dist/esm/utils/debug.js +8 -6
- package/dist/esm/utils/findFile.js +2 -1
- package/dist/esm/utils/isDev.js +3 -3
- package/dist/esm/utils/isFilePathAbsoluteFilesystem.js +1 -1
- package/dist/esm/utils/makePublicCopy.d.ts +3 -0
- package/dist/esm/utils/makePublicCopy.js +30 -0
- package/dist/esm/utils/objectAssignSafe.d.ts +1 -0
- package/dist/esm/utils/objectAssignSafe.js +4 -0
- package/dist/esm/utils/path.d.ts +14 -0
- package/dist/esm/utils/path.js +46 -0
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/dist/esm/utils/requireResolve.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/node/plugin/plugins/buildEntry/getVikeManifest.js +0 -17
- package/dist/cjs/node/plugin/plugins/importUserCode/addImportStatement.js +0 -29
- package/dist/cjs/node/prerender/isPrerenderAutoRunEnabled.js +0 -16
- package/dist/cjs/node/shared/assertPluginManifest.js +0 -20
- package/dist/cjs/node/shared/assertRuntimeManifest.js +0 -16
- package/dist/cjs/shared/assertPageFilePath.js +0 -11
- package/dist/cjs/shared/getPageFiles/getPageFiles.js +0 -48
- package/dist/cjs/utils/filesystemPathHandling.js +0 -18
- package/dist/cjs/utils/path-shim.js +0 -19
- package/dist/esm/node/plugin/plugins/buildEntry/getVikeManifest.d.ts +0 -5
- package/dist/esm/node/plugin/plugins/buildEntry/getVikeManifest.js +0 -15
- package/dist/esm/node/plugin/plugins/importUserCode/addImportStatement.d.ts +0 -14
- package/dist/esm/node/plugin/plugins/importUserCode/addImportStatement.js +0 -27
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/assertExtensions.d.ts +0 -5
- package/dist/esm/node/prerender/isPrerenderAutoRunEnabled.d.ts +0 -5
- package/dist/esm/node/prerender/isPrerenderAutoRunEnabled.js +0 -14
- package/dist/esm/node/shared/assertPluginManifest.d.ts +0 -12
- package/dist/esm/node/shared/assertPluginManifest.js +0 -18
- package/dist/esm/node/shared/assertRuntimeManifest.d.ts +0 -10
- package/dist/esm/node/shared/assertRuntimeManifest.js +0 -14
- package/dist/esm/shared/assertPageFilePath.d.ts +0 -2
- package/dist/esm/shared/assertPageFilePath.js +0 -9
- package/dist/esm/shared/getPageFiles/getPageFiles.d.ts +0 -15
- package/dist/esm/shared/getPageFiles/getPageFiles.js +0 -46
- package/dist/esm/utils/filesystemPathHandling.d.ts +0 -4
- package/dist/esm/utils/filesystemPathHandling.js +0 -16
- package/dist/esm/utils/path-shim.d.ts +0 -2
- package/dist/esm/utils/path-shim.js +0 -17
- /package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/{isRuntimeEnvMatch.js → virtual-files/isRuntimeEnvMatch.js} +0 -0
- /package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{getConfigFileExport.d.ts → getVikeConfig/getConfigFileExport.d.ts} +0 -0
- /package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{debug.d.ts → virtual-files/debug.d.ts} +0 -0
- /package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{getVirtualFilePageConfigValuesAll.d.ts → virtual-files/getVirtualFilePageConfigValuesAll.d.ts} +0 -0
- /package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{getVirtualFilePageConfigs.d.ts → virtual-files/getVirtualFilePageConfigs.d.ts} +0 -0
- /package/dist/esm/node/plugin/plugins/importUserCode/v1-design/{isRuntimeEnvMatch.js → virtual-files/isRuntimeEnvMatch.js} +0 -0
- /package/dist/esm/node/plugin/{resolveClientEntriesDev.d.ts → shared/resolveClientEntriesDev.d.ts} +0 -0
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js
CHANGED
|
@@ -1,44 +1,58 @@
|
|
|
1
|
-
// Files
|
|
2
|
-
export {
|
|
1
|
+
// Files loaded at config time:
|
|
2
|
+
export { loadPointerImport };
|
|
3
3
|
export { loadValueFile };
|
|
4
4
|
export { loadConfigFile };
|
|
5
5
|
import { assert, assertUsage, assertIsNotProductionRuntime, isArrayOfStrings, isObject } from '../../../../utils.js';
|
|
6
6
|
import { transpileAndExecuteFile } from './transpileAndExecuteFile.js';
|
|
7
|
+
import { getConfigDefinitionOptional } from '../getVikeConfig.js';
|
|
7
8
|
import { assertPlusFileExport } from '../../../../../../shared/page-configs/assertPlusFileExport.js';
|
|
8
9
|
import pc from '@brillout/picocolors';
|
|
9
10
|
import { parsePointerImportData } from './transformPointerImports.js';
|
|
10
|
-
import { getConfigFileExport } from '
|
|
11
|
-
import {
|
|
11
|
+
import { getConfigFileExport } from './getConfigFileExport.js';
|
|
12
|
+
import { resolvePointerImportData } from './resolvePointerImport.js';
|
|
13
|
+
import { getConfigDefinedAt } from '../../../../../../shared/page-configs/getConfigDefinedAt.js';
|
|
12
14
|
assertIsNotProductionRuntime();
|
|
13
15
|
// Load pointer import
|
|
14
|
-
async function
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
async function loadPointerImport(pointerImport, userRootDir, configName, configDefinitions, esbuildCache) {
|
|
17
|
+
// The value of `extends` was already loaded and already used: we don't need the value of `extends` anymore
|
|
18
|
+
if (configName === 'extends')
|
|
19
|
+
return;
|
|
20
|
+
const configDef = getConfigDefinitionOptional(configDefinitions, configName);
|
|
21
|
+
// Only load pointer import if `env.config===true`
|
|
22
|
+
if (!configDef || !shouldBeLoadableAtBuildTime(configDef))
|
|
23
|
+
return;
|
|
24
|
+
const configDefinedAt = getConfigDefinedAt('Config', configName, pointerImport.fileExportPath);
|
|
25
|
+
assertUsage(pointerImport.fileExportPath.filePathAbsoluteFilesystem, `${configDefinedAt} cannot be defined over an aliased import`);
|
|
26
|
+
const { fileExports } = await transpileAndExecuteFile(pointerImport.fileExportPath, userRootDir, false, esbuildCache);
|
|
27
|
+
const fileExportValue = fileExports[pointerImport.fileExportPath.fileExportName];
|
|
28
|
+
pointerImport.fileExportValueLoaded = true;
|
|
29
|
+
assert(pointerImport.fileExportValueLoaded);
|
|
30
|
+
pointerImport.fileExportValue = fileExportValue;
|
|
22
31
|
}
|
|
23
32
|
// Load +{configName}.js
|
|
24
|
-
async function loadValueFile(interfaceValueFile,
|
|
25
|
-
const {
|
|
33
|
+
async function loadValueFile(interfaceValueFile, configDefinitions, userRootDir, esbuildCache) {
|
|
34
|
+
const { configName } = interfaceValueFile;
|
|
35
|
+
const configDef = getConfigDefinitionOptional(configDefinitions, configName);
|
|
36
|
+
// Only load value files with `env.config===true`
|
|
37
|
+
if (!configDef || !shouldBeLoadableAtBuildTime(configDef))
|
|
38
|
+
return;
|
|
39
|
+
interfaceValueFile.isNotLoaded = false;
|
|
40
|
+
assert(!interfaceValueFile.isNotLoaded);
|
|
41
|
+
interfaceValueFile.fileExportsByConfigName = {};
|
|
42
|
+
const { fileExports } = await transpileAndExecuteFile(interfaceValueFile.filePath, userRootDir, false, esbuildCache);
|
|
26
43
|
const { filePathToShowToUser } = interfaceValueFile.filePath;
|
|
27
44
|
assertPlusFileExport(fileExports, filePathToShowToUser, configName);
|
|
28
45
|
Object.entries(fileExports).forEach(([exportName, configValue]) => {
|
|
29
46
|
const configName_ = exportName === 'default' ? configName : exportName;
|
|
30
|
-
interfaceValueFile.fileExportsByConfigName[configName_] =
|
|
47
|
+
interfaceValueFile.fileExportsByConfigName[configName_] = configValue;
|
|
31
48
|
});
|
|
32
49
|
}
|
|
33
50
|
// Load +config.js, including all its extends pointer imports
|
|
34
|
-
async function loadConfigFile(configFilePath, userRootDir, visited, isExtensionConfig) {
|
|
51
|
+
async function loadConfigFile(configFilePath, userRootDir, visited, isExtensionConfig, esbuildCache) {
|
|
35
52
|
const { filePathAbsoluteFilesystem } = configFilePath;
|
|
36
53
|
assertNoInfiniteLoop(visited, filePathAbsoluteFilesystem);
|
|
37
|
-
const { fileExports } = await transpileAndExecuteFile(configFilePath, userRootDir, isExtensionConfig ? 'is-extension-config' : true);
|
|
38
|
-
const { extendsConfigs, extendsFilePaths } = await loadExtendsConfigs(fileExports, configFilePath, userRootDir, [
|
|
39
|
-
...visited,
|
|
40
|
-
filePathAbsoluteFilesystem
|
|
41
|
-
]);
|
|
54
|
+
const { fileExports } = await transpileAndExecuteFile(configFilePath, userRootDir, isExtensionConfig ? 'is-extension-config' : true, esbuildCache);
|
|
55
|
+
const { extendsConfigs, extendsFilePaths } = await loadExtendsConfigs(fileExports, configFilePath, userRootDir, [...visited, filePathAbsoluteFilesystem], esbuildCache);
|
|
42
56
|
const configFile = {
|
|
43
57
|
fileExports,
|
|
44
58
|
filePath: configFilePath,
|
|
@@ -54,15 +68,15 @@ function assertNoInfiniteLoop(visited, filePathAbsoluteFilesystem) {
|
|
|
54
68
|
assert(loop[0] === filePathAbsoluteFilesystem);
|
|
55
69
|
assertUsage(idx === -1, `Infinite extends loop ${[...loop, filePathAbsoluteFilesystem].join('>')}`);
|
|
56
70
|
}
|
|
57
|
-
async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir, visited) {
|
|
71
|
+
async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir, visited, esbuildCache) {
|
|
58
72
|
const { extendsPointerImportData, extendsConfigs } = getExtendsPointerImportData(configFileExports, configFilePath);
|
|
59
73
|
const extendsConfigFiles = [];
|
|
60
74
|
extendsPointerImportData.map((pointerImportData) => {
|
|
61
|
-
const filePath =
|
|
75
|
+
const filePath = resolvePointerImportData(pointerImportData, configFilePath, userRootDir);
|
|
62
76
|
assert(filePath.filePathAbsoluteFilesystem);
|
|
63
77
|
extendsConfigFiles.push(filePath);
|
|
64
78
|
});
|
|
65
|
-
const results = await Promise.all(extendsConfigFiles.map(async (configFilePath) => await loadConfigFile(configFilePath, userRootDir, visited, true)));
|
|
79
|
+
const results = await Promise.all(extendsConfigFiles.map(async (configFilePath) => await loadConfigFile(configFilePath, userRootDir, visited, true, esbuildCache)));
|
|
66
80
|
results.forEach((result) => {
|
|
67
81
|
extendsConfigs.push(result.configFile);
|
|
68
82
|
extendsConfigs.push(...result.extendsConfigs);
|
|
@@ -105,3 +119,6 @@ function getExtendsPointerImportData(configFileExports, configFilePath) {
|
|
|
105
119
|
}
|
|
106
120
|
return { extendsPointerImportData, extendsConfigs };
|
|
107
121
|
}
|
|
122
|
+
function shouldBeLoadableAtBuildTime(configDef) {
|
|
123
|
+
return !!configDef.env.config && !configDef._valueIsFilePath;
|
|
124
|
+
}
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
export { resolvePointerImportOfConfig };
|
|
2
1
|
export { resolvePointerImport };
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
import type {
|
|
2
|
+
export { resolvePointerImportData };
|
|
3
|
+
export type { PointerImport };
|
|
4
|
+
import type { DefinedAtFilePath } from '../../../../../../shared/page-configs/PageConfig.js';
|
|
6
5
|
import { type PointerImportData } from './transformPointerImports.js';
|
|
7
6
|
import type { FilePath, FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js';
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
declare function resolvePointerImportOfConfig(configValue: unknown, importerFilePath: FilePathResolved, userRootDir: string, configEnv: ConfigEnvInternal, configName: string): null | {
|
|
12
|
-
pointerImport: PointerImportResolved;
|
|
13
|
-
configEnvResolved: ConfigEnvInternal;
|
|
14
|
-
};
|
|
15
|
-
declare function resolvePointerImport(pointerImportData: PointerImportData, importerFilePath: FilePathResolved, userRootDir: string): FilePath;
|
|
16
|
-
declare function clearFilesEnvMap(): void;
|
|
17
|
-
declare function resolveConfigEnvWithFileName(configEnv: ConfigEnvInternal, filePath: FilePathResolved): {
|
|
18
|
-
server?: boolean | undefined;
|
|
19
|
-
config?: boolean | undefined;
|
|
20
|
-
client?: boolean | "if-client-routing";
|
|
21
|
-
production?: boolean;
|
|
7
|
+
type PointerImport = {
|
|
8
|
+
fileExportPath: FileExportPath;
|
|
22
9
|
};
|
|
10
|
+
type FileExportPath = DefinedAtFilePath & Required<Pick<DefinedAtFilePath, 'fileExportName'>>;
|
|
11
|
+
declare function resolvePointerImport(configValue: unknown, importerFilePath: FilePathResolved, userRootDir: string, configName: string): null | PointerImport;
|
|
12
|
+
declare function resolvePointerImportData(pointerImportData: PointerImportData, importerFilePath: FilePathResolved, userRootDir: string): FilePath;
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js
CHANGED
|
@@ -1,34 +1,27 @@
|
|
|
1
|
-
export { resolvePointerImportOfConfig };
|
|
2
1
|
export { resolvePointerImport };
|
|
3
|
-
export {
|
|
4
|
-
export { resolveConfigEnvWithFileName };
|
|
2
|
+
export { resolvePointerImportData };
|
|
5
3
|
import pc from '@brillout/picocolors';
|
|
6
|
-
import { assert, assertPosixPath, assertUsage,
|
|
4
|
+
import { assert, assertPosixPath, assertUsage, isFilePathAbsolute, pathIsRelative, requireResolve } from '../../../../utils.js';
|
|
7
5
|
import { parsePointerImportData } from './transformPointerImports.js';
|
|
8
6
|
import path from 'path';
|
|
9
7
|
import { getFilePathAbsoluteUserRootDir, getFilePathResolved, getFilePathUnresolved } from '../../../../shared/getFilePath.js';
|
|
10
|
-
|
|
11
|
-
function resolvePointerImportOfConfig(configValue, importerFilePath, userRootDir, configEnv, configName) {
|
|
8
|
+
function resolvePointerImport(configValue, importerFilePath, userRootDir, configName) {
|
|
12
9
|
if (typeof configValue !== 'string')
|
|
13
10
|
return null;
|
|
14
11
|
const pointerImportData = parsePointerImportData(configValue);
|
|
15
12
|
if (!pointerImportData)
|
|
16
13
|
return null;
|
|
17
|
-
const {
|
|
18
|
-
const filePath =
|
|
14
|
+
const { exportName } = pointerImportData;
|
|
15
|
+
const filePath = resolvePointerImportData(pointerImportData, importerFilePath, userRootDir);
|
|
19
16
|
const fileExportPathToShowToUser = exportName === 'default' || exportName === configName ? [] : [exportName];
|
|
20
|
-
|
|
21
|
-
if (filePath.filePathAbsoluteFilesystem)
|
|
22
|
-
configEnvResolved = resolveConfigEnvWithFileName(configEnv, filePath);
|
|
23
|
-
assertUsageFileEnv(filePath, importPath, configEnvResolved, configName);
|
|
24
|
-
const pointerImport = {
|
|
17
|
+
const fileExportPath = {
|
|
25
18
|
...filePath,
|
|
26
19
|
fileExportName: exportName,
|
|
27
20
|
fileExportPathToShowToUser
|
|
28
21
|
};
|
|
29
|
-
return {
|
|
22
|
+
return { fileExportPath };
|
|
30
23
|
}
|
|
31
|
-
function
|
|
24
|
+
function resolvePointerImportData(pointerImportData, importerFilePath, userRootDir) {
|
|
32
25
|
// `importPath` should be one of the following:
|
|
33
26
|
// - A relative import path
|
|
34
27
|
// - A filesystem absolute path
|
|
@@ -39,7 +32,7 @@ function resolvePointerImport(pointerImportData, importerFilePath, userRootDir)
|
|
|
39
32
|
assertPosixPath(importPath);
|
|
40
33
|
if (importPath.startsWith('.') || isFilePathAbsolute(importPath)) {
|
|
41
34
|
if (importPath.startsWith('.')) {
|
|
42
|
-
assertUsage(
|
|
35
|
+
assertUsage(pathIsRelative(importPath), `Invalid relative import path ${pc.code(importPath)} defined by ${importerFilePath.filePathToShowToUser} because it should start with ${pc.code('./')} or ${pc.code('../')}, or use an npm package import instead.`);
|
|
43
36
|
}
|
|
44
37
|
// Pointer imports are included in virtual files, thus relative imports need to be resolved. (Virtual modules cannot contain relative imports.)
|
|
45
38
|
assertUsageResolutionSuccess(filePathAbsoluteFilesystem, pointerImportData, importerFilePath);
|
|
@@ -95,7 +88,7 @@ function assertUsageResolutionSuccess(filePathAbsoluteFilesystem, pointerImportD
|
|
|
95
88
|
: `The import ${pc.code(importString)} defined by ${filePathToShowToUser}`;
|
|
96
89
|
const errIntro2 = `${errIntro} couldn't be resolved: does ${importPathString}`;
|
|
97
90
|
if (importPath.startsWith('.')) {
|
|
98
|
-
assert(
|
|
91
|
+
assert(pathIsRelative(importPath));
|
|
99
92
|
assertUsage(false, `${errIntro2} point to an existing file?`);
|
|
100
93
|
}
|
|
101
94
|
else {
|
|
@@ -103,51 +96,3 @@ function assertUsageResolutionSuccess(filePathAbsoluteFilesystem, pointerImportD
|
|
|
103
96
|
}
|
|
104
97
|
}
|
|
105
98
|
}
|
|
106
|
-
function assertUsageFileEnv(filePath, importPath, configEnvResolved, configName) {
|
|
107
|
-
let key;
|
|
108
|
-
if (filePath.filePathAbsoluteFilesystem) {
|
|
109
|
-
key = filePath.filePathAbsoluteFilesystem;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
// Path alias
|
|
113
|
-
assert(!isRelativeImportPath(importPath));
|
|
114
|
-
key = importPath;
|
|
115
|
-
}
|
|
116
|
-
assertPosixPath(key);
|
|
117
|
-
if (!filesEnvMap.has(key)) {
|
|
118
|
-
filesEnvMap.set(key, []);
|
|
119
|
-
}
|
|
120
|
-
const fileEnv = filesEnvMap.get(key);
|
|
121
|
-
fileEnv.push({ configEnvResolved, configName });
|
|
122
|
-
const configDifferentEnv = fileEnv.filter((c) => !deepEqual(c.configEnvResolved, configEnvResolved))[0];
|
|
123
|
-
if (configDifferentEnv) {
|
|
124
|
-
assertUsage(false, [
|
|
125
|
-
`${key} defines the value of configs living in different environments:`,
|
|
126
|
-
...[configDifferentEnv, { configName, configEnvResolved }].map((c) => ` - config ${pc.code(c.configName)} which value lives in environment ${pc.code(JSON.stringify(c.configEnvResolved))}`),
|
|
127
|
-
'Defining config values in the same file is allowed only if they live in the same environment, see https://vike.dev/config#pointer-imports'
|
|
128
|
-
].join('\n'));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function clearFilesEnvMap() {
|
|
132
|
-
filesEnvMap.clear();
|
|
133
|
-
}
|
|
134
|
-
function resolveConfigEnvWithFileName(configEnv, filePath) {
|
|
135
|
-
const { fileName } = filePath;
|
|
136
|
-
const configEnvResolved = { ...configEnv };
|
|
137
|
-
if (fileName.includes('.server.')) {
|
|
138
|
-
configEnvResolved.server = true;
|
|
139
|
-
configEnvResolved.client = false;
|
|
140
|
-
}
|
|
141
|
-
else if (fileName.includes('.client.')) {
|
|
142
|
-
configEnvResolved.client = true;
|
|
143
|
-
configEnvResolved.server = false;
|
|
144
|
-
}
|
|
145
|
-
else if (fileName.includes('.shared.')) {
|
|
146
|
-
configEnvResolved.server = true;
|
|
147
|
-
configEnvResolved.client = true;
|
|
148
|
-
}
|
|
149
|
-
return configEnvResolved;
|
|
150
|
-
}
|
|
151
|
-
function isRelativeImportPath(importPath) {
|
|
152
|
-
return importPath.startsWith('./') || importPath.startsWith('../');
|
|
153
|
-
}
|
|
@@ -2,11 +2,15 @@ export { transpileAndExecuteFile };
|
|
|
2
2
|
export { getConfigBuildErrorFormatted };
|
|
3
3
|
export { getConfigExecutionErrorIntroMsg };
|
|
4
4
|
export { isTemporaryBuildFile };
|
|
5
|
+
export type { EsbuildCache };
|
|
5
6
|
import 'source-map-support/register.js';
|
|
6
7
|
import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js';
|
|
7
|
-
|
|
8
|
+
type FileExports = {
|
|
8
9
|
fileExports: Record<string, unknown>;
|
|
9
|
-
}
|
|
10
|
+
};
|
|
11
|
+
type EsbuildCache = Record<string, // filePathAbsoluteFilesystem
|
|
12
|
+
Promise<FileExports>>;
|
|
13
|
+
declare function transpileAndExecuteFile(filePath: FilePathResolved, userRootDir: string, isConfigFile: boolean | 'is-extension-config', esbuildCache: EsbuildCache): Promise<FileExports>;
|
|
10
14
|
declare function getConfigBuildErrorFormatted(err: unknown): null | string;
|
|
11
15
|
declare function getConfigExecutionErrorIntroMsg(err: unknown): string | null;
|
|
12
16
|
declare function isTemporaryBuildFile(filePath: string): boolean;
|
|
@@ -7,7 +7,7 @@ import fs from 'fs';
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import pc from '@brillout/picocolors';
|
|
9
9
|
import { import_ } from '@brillout/import';
|
|
10
|
-
import { assertPosixPath, getRandomId, assertIsNotProductionRuntime, assert, assertWarning, isObject, toPosixPath, assertUsage, isPlainJavaScriptFile, createDebugger, assertFilePathAbsoluteFilesystem, assertIsNpmPackageImport } from '../../../../utils.js';
|
|
10
|
+
import { assertPosixPath, getRandomId, assertIsNotProductionRuntime, assert, assertWarning, isObject, toPosixPath, assertUsage, isPlainJavaScriptFile, createDebugger, assertFilePathAbsoluteFilesystem, assertIsNpmPackageImport, genPromise } from '../../../../utils.js';
|
|
11
11
|
import { transformPointerImports } from './transformPointerImports.js';
|
|
12
12
|
import { vikeConfigDependencies } from '../getVikeConfig.js';
|
|
13
13
|
import 'source-map-support/register.js';
|
|
@@ -21,25 +21,31 @@ const debug = createDebugger('vike:pointer-imports');
|
|
|
21
21
|
const debugEsbuildResolve = createDebugger('vike:esbuild-resolve');
|
|
22
22
|
if (debugEsbuildResolve.isActivated)
|
|
23
23
|
debugEsbuildResolve('esbuild version', version);
|
|
24
|
-
async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile) {
|
|
24
|
+
async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile, esbuildCache) {
|
|
25
25
|
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
26
26
|
const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
|
|
27
|
+
if (esbuildCache[filePathAbsoluteFilesystem]) {
|
|
28
|
+
return await esbuildCache[filePathAbsoluteFilesystem];
|
|
29
|
+
}
|
|
30
|
+
const { promise, resolve } = genPromise();
|
|
31
|
+
esbuildCache[filePathAbsoluteFilesystem] = promise;
|
|
27
32
|
assertUsage(isPlainJavaScriptFile(filePathAbsoluteFilesystem), `${filePathToShowToUserResolved} has file extension .${fileExtension} but a config file can only be a JavaScript/TypeScript file`);
|
|
28
33
|
const isHeader = isHeaderFile(filePathAbsoluteFilesystem);
|
|
29
34
|
if (isHeader) {
|
|
30
35
|
assertWarning(false, `${pc.cyan('.h.js')} files are deprecated: simply renaming ${filePathToShowToUserResolved} to ${removeHeaderFileExtension(filePathToShowToUserResolved)} is usually enough, although you may occasionally need to use ${pc.cyan("with { type: 'pointer' }")} as explained at https://vike.dev/config#pointer-imports`, { onlyOnce: true });
|
|
31
36
|
}
|
|
37
|
+
let fileExports;
|
|
32
38
|
if (isConfigFile === 'is-extension-config' && !isHeader && fileExtension.endsWith('js')) {
|
|
33
39
|
// This doesn't track dependencies => we should never use this for user land configs
|
|
34
|
-
|
|
35
|
-
return { fileExports };
|
|
40
|
+
fileExports = await executeFile(filePathAbsoluteFilesystem, filePath);
|
|
36
41
|
}
|
|
37
42
|
else {
|
|
38
43
|
const transformImports = isConfigFile && (isHeader ? 'all' : true);
|
|
39
44
|
const code = await transpileFile(filePath, transformImports, userRootDir);
|
|
40
|
-
|
|
41
|
-
return { fileExports };
|
|
45
|
+
fileExports = await executeTranspiledFile(filePath, code);
|
|
42
46
|
}
|
|
47
|
+
resolve({ fileExports });
|
|
48
|
+
return { fileExports };
|
|
43
49
|
}
|
|
44
50
|
async function transpileFile(filePath, transformImports, userRootDir) {
|
|
45
51
|
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
@@ -2,43 +2,18 @@ export { getVikeConfig };
|
|
|
2
2
|
export { getVikeConfig2 };
|
|
3
3
|
export { reloadVikeConfig };
|
|
4
4
|
export { vikeConfigDependencies };
|
|
5
|
-
export { isVikeConfigFile };
|
|
6
5
|
export { isV1Design };
|
|
7
|
-
export {
|
|
6
|
+
export { getConfVal };
|
|
7
|
+
export { getConfigDefinitionOptional };
|
|
8
8
|
export type { VikeConfigObject };
|
|
9
|
-
export type { InterfaceValueFile };
|
|
10
|
-
export type { InterfaceFile };
|
|
11
|
-
export type { VikeConfigGlobal };
|
|
12
|
-
export type { VikeVitePluginOptions };
|
|
13
9
|
import type { PageConfigGlobalBuildTime, PageConfigBuildTime } from '../../../../../shared/page-configs/PageConfig.js';
|
|
14
|
-
import { type
|
|
10
|
+
import { type ConfigDefinitions, type ConfigDefinitionInternal } from './getVikeConfig/configDefinitionsBuiltIn.js';
|
|
15
11
|
import type { ResolvedConfig } from 'vite';
|
|
16
|
-
import type { FilePathResolved } from '../../../../../shared/page-configs/FilePath.js';
|
|
17
12
|
import { getPageConfigUserFriendlyNew } from '../../../../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
18
|
-
type
|
|
19
|
-
type InterfaceFileCommons = {
|
|
20
|
-
locationId: LocationId;
|
|
21
|
-
filePath: FilePathResolved;
|
|
22
|
-
fileExportsByConfigName: Record<ConfigName, {
|
|
23
|
-
configValue?: unknown;
|
|
24
|
-
}>;
|
|
25
|
-
};
|
|
26
|
-
type InterfaceConfigFile = InterfaceFileCommons & {
|
|
27
|
-
isConfigFile: true;
|
|
28
|
-
isValueFile: false;
|
|
29
|
-
extendsFilePaths: string[];
|
|
30
|
-
isConfigExtend: boolean;
|
|
31
|
-
};
|
|
32
|
-
type InterfaceValueFile = InterfaceFileCommons & {
|
|
33
|
-
isConfigFile: false;
|
|
34
|
-
isValueFile: true;
|
|
35
|
-
configName: string;
|
|
36
|
-
};
|
|
37
|
-
type ConfigName = string;
|
|
13
|
+
import { type PlusFile } from './getVikeConfig/getPlusFilesAll.js';
|
|
38
14
|
type VikeConfigObject = {
|
|
39
15
|
pageConfigs: PageConfigBuildTime[];
|
|
40
16
|
pageConfigGlobal: PageConfigGlobalBuildTime;
|
|
41
|
-
vikeConfigGlobal: VikeConfigGlobal;
|
|
42
17
|
global: ReturnType<typeof getPageConfigUserFriendlyNew>;
|
|
43
18
|
};
|
|
44
19
|
declare const vikeConfigDependencies: Set<string>;
|
|
@@ -48,97 +23,10 @@ declare function getVikeConfig(config: ResolvedConfig, { doNotRestartViteOnError
|
|
|
48
23
|
}): Promise<VikeConfigObject>;
|
|
49
24
|
declare function getVikeConfig2(userRootDir: string, isDev: boolean, vikeVitePluginOptions: unknown): Promise<VikeConfigObject>;
|
|
50
25
|
declare function isV1Design(config: ResolvedConfig): Promise<boolean>;
|
|
51
|
-
declare function
|
|
52
|
-
declare function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
partial: boolean;
|
|
58
|
-
disableAutoRun: boolean;
|
|
59
|
-
};
|
|
60
|
-
disableAutoFullBuild: boolean | 'prerender' | null;
|
|
61
|
-
includeAssetsImportedByServer: boolean;
|
|
62
|
-
baseAssets: string | null;
|
|
63
|
-
baseServer: string | null;
|
|
64
|
-
trailingSlash: boolean;
|
|
65
|
-
disableUrlNormalization: boolean;
|
|
66
|
-
};
|
|
67
|
-
type VikeVitePluginOptions = {
|
|
68
|
-
/**
|
|
69
|
-
* Enable pre-rendering.
|
|
70
|
-
*
|
|
71
|
-
* https://vike.dev/pre-rendering
|
|
72
|
-
*
|
|
73
|
-
* @default false
|
|
74
|
-
*/
|
|
75
|
-
prerender?: boolean | {
|
|
76
|
-
/**
|
|
77
|
-
* Don't create a new directory for each HTML file.
|
|
78
|
-
*
|
|
79
|
-
* For example, generate `dist/client/about.html` instead of `dist/client/about/index.html`.
|
|
80
|
-
*
|
|
81
|
-
* @default false
|
|
82
|
-
*/
|
|
83
|
-
noExtraDir?: boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Number of concurrent pre-render jobs.
|
|
86
|
-
*
|
|
87
|
-
* Set to `false` to disable concurrency.
|
|
88
|
-
*
|
|
89
|
-
* @default os.cpus().length
|
|
90
|
-
*/
|
|
91
|
-
parallel?: boolean | number;
|
|
92
|
-
/**
|
|
93
|
-
* Allow only some of your pages to be pre-rendered.
|
|
94
|
-
*
|
|
95
|
-
* This setting doesn't affect the pre-rendering process: it merely suppresses the warnings when some of your pages cannot be pre-rendered.
|
|
96
|
-
|
|
97
|
-
* @default false
|
|
98
|
-
*/
|
|
99
|
-
partial?: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Disable the automatic initiation of the pre-rendering process when running `$ vike build`.
|
|
102
|
-
*
|
|
103
|
-
* Use this if you want to programmatically initiate the pre-rendering process instead.
|
|
104
|
-
*
|
|
105
|
-
* https://vike.dev/api#prerender
|
|
106
|
-
*
|
|
107
|
-
* @default false
|
|
108
|
-
*/
|
|
109
|
-
disableAutoRun?: boolean;
|
|
110
|
-
};
|
|
111
|
-
/** @deprecated See https://vike.dev/disableAutoFullBuild */
|
|
112
|
-
disableAutoFullBuild?: boolean | 'prerender';
|
|
113
|
-
/** The Base URL of your server.
|
|
114
|
-
*
|
|
115
|
-
* https://vike.dev/base-url
|
|
116
|
-
*/
|
|
117
|
-
baseServer?: string;
|
|
118
|
-
/** The Base URL of your static assets.
|
|
119
|
-
*
|
|
120
|
-
* https://vike.dev/base-url
|
|
121
|
-
*/
|
|
122
|
-
baseAssets?: string;
|
|
123
|
-
/** @deprecated It's now `true` by default. You can remove this option. */
|
|
124
|
-
includeAssetsImportedByServer?: boolean;
|
|
125
|
-
/** Permanent redirections (HTTP status code 301)
|
|
126
|
-
*
|
|
127
|
-
* https://vike.dev/redirects
|
|
128
|
-
*/
|
|
129
|
-
redirects?: Record<string, string>;
|
|
130
|
-
/** Whether URLs should end with a trailing slash.
|
|
131
|
-
*
|
|
132
|
-
* https://vike.dev/url-normalization
|
|
133
|
-
*
|
|
134
|
-
* @default false
|
|
135
|
-
*/
|
|
136
|
-
trailingSlash?: boolean;
|
|
137
|
-
/** Disable automatic URL normalization.
|
|
138
|
-
*
|
|
139
|
-
* https://vike.dev/url-normalization
|
|
140
|
-
*
|
|
141
|
-
* @default false
|
|
142
|
-
*/
|
|
143
|
-
disableUrlNormalization?: boolean;
|
|
26
|
+
declare function getConfigDefinitionOptional(configDefinitions: ConfigDefinitions, configName: string): ConfigDefinitionInternal | null;
|
|
27
|
+
declare function getConfVal(plusFile: PlusFile, configName: string): null | {
|
|
28
|
+
configValue: unknown;
|
|
29
|
+
configValueLoaded: true;
|
|
30
|
+
} | {
|
|
31
|
+
configValueLoaded: false;
|
|
144
32
|
};
|