vike 0.4.239 → 0.4.240-commit-bac5dee
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/esm/client/index.d.ts +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/runtime-client-routing/entry.js +5 -3
- package/dist/esm/client/runtime-client-routing/getBaseServer.js +0 -1
- package/dist/esm/client/runtime-client-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +2 -2
- package/dist/esm/client/runtime-client-routing/{globalContext.js → getGlobalContextClientInternal.js} +8 -4
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +6 -6
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.js +1 -1
- package/dist/esm/client/runtime-client-routing/isClientSideRoutable.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +4 -4
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.js +15 -4
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.js +1 -1
- package/dist/esm/client/runtime-server-routing/entry.js +5 -3
- package/dist/esm/client/runtime-server-routing/{globalContext.d.ts → getGlobalContextClientInternal.d.ts} +2 -2
- package/dist/esm/client/runtime-server-routing/getGlobalContextClientInternal.js +6 -0
- package/dist/esm/client/shared/execHookOnRenderClient.d.ts +1 -1
- package/dist/esm/client/shared/{createGetGlobalContextClient.d.ts → getGlobalContextClientInternalShared.d.ts} +11 -8
- package/dist/esm/client/shared/getGlobalContextClientInternalShared.js +66 -0
- package/dist/esm/client/shared/loadPageConfigsLazyClientSide.js +1 -3
- package/dist/esm/node/prerender/runPrerender.d.ts +4 -2
- package/dist/esm/node/prerender/runPrerender.js +5 -2
- package/dist/esm/node/runtime/globalContext.d.ts +15 -2
- package/dist/esm/node/runtime/globalContext.js +46 -32
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +4 -2
- package/dist/esm/node/runtime/renderPage/loadPageConfigsLazyServerSide.d.ts +4 -2
- package/dist/esm/node/runtime/renderPage/renderPageAfterRoute.d.ts +8 -4
- package/dist/esm/node/runtime/renderPage.d.ts +4 -2
- package/dist/esm/node/vite/index.js +42 -18
- package/dist/esm/node/vite/onLoad.js +1 -1
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.d.ts +4 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/handleAssetsManifest.js +21 -6
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.js +24 -20
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.js +20 -6
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistFileNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/build/pluginDistFileNames.js +253 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginDistPackageJsonFile.d.ts +1 -1
- package/dist/esm/node/vite/plugins/build/pluginDistPackageJsonFile.js +40 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginModuleBanner.d.ts +1 -1
- package/dist/esm/node/vite/plugins/build/pluginModuleBanner.js +49 -0
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.js +4 -2
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.d.ts +1 -1
- package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginSuppressRollupWarning.js +27 -23
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.d.ts +7 -0
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginReplaceConstantsNonRunnableDev.js +47 -0
- package/dist/esm/node/vite/plugins/{pluginNonRunnableDev.d.ts → non-runnable-dev/pluginViteRPC.d.ts} +3 -7
- package/dist/esm/node/vite/plugins/non-runnable-dev/pluginViteRPC.js +30 -0
- package/dist/esm/node/vite/plugins/pluginBaseUrls.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBaseUrls.js +39 -33
- package/dist/esm/node/vite/plugins/pluginCommon.js +8 -28
- package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -1
- package/dist/esm/node/vite/plugins/pluginDev/determineOptimizeDeps.js +1 -1
- package/dist/esm/node/vite/plugins/pluginDev.js +51 -47
- package/dist/esm/node/vite/plugins/pluginExtractAssets.js +108 -92
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +39 -23
- package/dist/esm/node/vite/plugins/pluginFileEnv.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginFileEnv.js +117 -92
- package/dist/esm/node/vite/plugins/pluginPreview.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginPreview.js +38 -30
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsEnvVars.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsEnvVars.js +127 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsGlobalThis.d.ts +17 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsGlobalThis.js +52 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsPageContext.d.ts +3 -0
- package/dist/esm/node/vite/plugins/pluginReplaceConstantsPageContext.js +89 -0
- package/dist/esm/node/vite/plugins/pluginSetGlobalContext.js +4 -2
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +1 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles.js +67 -47
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +13 -9
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +26 -24
- package/dist/esm/node/vite/shared/getMagicString.d.ts +1 -1
- package/dist/esm/node/vite/shared/getMagicString.js +2 -0
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +2 -2
- package/dist/esm/shared/createGlobalContextShared.d.ts +4 -4
- package/dist/esm/shared/route/abort.d.ts +22 -11
- package/dist/esm/shared/route/abort.js +45 -5
- package/dist/esm/shared/route/index.js +13 -4
- package/dist/esm/shared/route/utils.d.ts +1 -0
- package/dist/esm/shared/route/utils.js +1 -0
- package/dist/esm/types/Config.d.ts +1 -1
- package/dist/esm/types/PageContext.d.ts +8 -8
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assert.js +1 -0
- package/dist/esm/utils/debug.d.ts +5 -3
- package/dist/esm/utils/debug.js +28 -11
- package/dist/esm/utils/findPackageJson.js +0 -1
- package/dist/esm/utils/getGlobalObject.d.ts +5 -1
- package/dist/esm/utils/getGlobalObject.js +5 -1
- package/dist/esm/utils/getViteRPC.js +0 -2
- package/dist/esm/utils/isDev.js +3 -1
- package/dist/esm/utils/isNonRunnableDev.js +2 -2
- package/dist/esm/utils/requireResolve.js +1 -2
- package/dist/esm/utils/virtualFileId.d.ts +4 -0
- package/dist/esm/utils/virtualFileId.js +14 -11
- package/package.json +7 -26
- package/dist/cjs/__internal/index.js +0 -35
- package/dist/cjs/client/runtime-client-routing/globalContext.js +0 -49
- package/dist/cjs/client/runtime-client-routing/prefetch/PrefetchSetting.js +0 -2
- package/dist/cjs/client/runtime-server-routing/globalContext.js +0 -41
- package/dist/cjs/client/runtime-server-routing/onLoad.js +0 -7
- package/dist/cjs/client/runtime-server-routing/utils.js +0 -34
- package/dist/cjs/client/shared/createGetGlobalContextClient.js +0 -65
- package/dist/cjs/client/shared/getJsonSerializedInHtml.js +0 -40
- package/dist/cjs/client/shared/preparePageContextForPublicUsageClientShared.js +0 -41
- package/dist/cjs/client/shared/utils.js +0 -23
- package/dist/cjs/node/api/build.js +0 -24
- package/dist/cjs/node/api/context.js +0 -23
- package/dist/cjs/node/api/dev.js +0 -18
- package/dist/cjs/node/api/index.js +0 -44
- package/dist/cjs/node/api/onLoad.js +0 -9
- package/dist/cjs/node/api/prepareViteApiCall.js +0 -206
- package/dist/cjs/node/api/prerender.js +0 -18
- package/dist/cjs/node/api/preview.js +0 -38
- package/dist/cjs/node/api/types.js +0 -2
- package/dist/cjs/node/api/utils.js +0 -27
- package/dist/cjs/node/cli/context.js +0 -17
- package/dist/cjs/node/cli/entry.js +0 -121
- package/dist/cjs/node/cli/index.js +0 -12
- package/dist/cjs/node/cli/onLoad.js +0 -9
- package/dist/cjs/node/cli/parseCli.js +0 -95
- package/dist/cjs/node/cli/utils.js +0 -24
- package/dist/cjs/node/client/router.js +0 -19
- package/dist/cjs/node/createPageRenderer.js +0 -132
- package/dist/cjs/node/importBuild.js +0 -3
- package/dist/cjs/node/prerender/context.js +0 -26
- package/dist/cjs/node/prerender/index.js +0 -12
- package/dist/cjs/node/prerender/resolvePrerenderConfig.js +0 -66
- package/dist/cjs/node/prerender/runPrerender.js +0 -777
- package/dist/cjs/node/prerender/runPrerenderEntry.js +0 -55
- package/dist/cjs/node/prerender/utils.js +0 -37
- package/dist/cjs/node/runtime/globalContext.js +0 -572
- package/dist/cjs/node/runtime/index-deprecated.js +0 -33
- package/dist/cjs/node/runtime/index.js +0 -74
- package/dist/cjs/node/runtime/loggerRuntime.js +0 -17
- package/dist/cjs/node/runtime/onLoad.js +0 -29
- package/dist/cjs/node/runtime/page-files/setup.js +0 -5
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +0 -71
- package/dist/cjs/node/runtime/renderPage/assertArguments.js +0 -42
- package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +0 -51
- package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +0 -114
- package/dist/cjs/node/runtime/renderPage/createPageContextServerSide.js +0 -59
- package/dist/cjs/node/runtime/renderPage/csp.js +0 -47
- package/dist/cjs/node/runtime/renderPage/execHookDataAndOnBeforeRender.js +0 -31
- package/dist/cjs/node/runtime/renderPage/execHookOnRenderHtml.js +0 -120
- package/dist/cjs/node/runtime/renderPage/execHookServer.js +0 -8
- package/dist/cjs/node/runtime/renderPage/getCacheControl.js +0 -24
- package/dist/cjs/node/runtime/renderPage/getEarlyHints.js +0 -20
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +0 -137
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +0 -125
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsDev.js +0 -86
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrievePageAssetsProd.js +0 -77
- package/dist/cjs/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.js +0 -36
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +0 -50
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +0 -41
- package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +0 -68
- package/dist/cjs/node/runtime/renderPage/headersResponse.js +0 -48
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/getHtmlTags.js +0 -269
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/getViteDevScript.js +0 -32
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/inferHtmlTags.js +0 -55
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectAssets__public.js +0 -31
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/injectHtmlTags.js +0 -161
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/mergeScriptTags.js +0 -73
- package/dist/cjs/node/runtime/renderPage/html/injectAssets/sanitizeJson.js +0 -8
- package/dist/cjs/node/runtime/renderPage/html/injectAssets.js +0 -93
- package/dist/cjs/node/runtime/renderPage/html/propKeys.js +0 -47
- package/dist/cjs/node/runtime/renderPage/html/renderHtml.js +0 -245
- package/dist/cjs/node/runtime/renderPage/html/serializeContext.js +0 -189
- package/dist/cjs/node/runtime/renderPage/html/stream/react-streaming.js +0 -36
- package/dist/cjs/node/runtime/renderPage/html/stream.js +0 -829
- package/dist/cjs/node/runtime/renderPage/inferMediaType.js +0 -81
- package/dist/cjs/node/runtime/renderPage/isFontFallback.js +0 -29
- package/dist/cjs/node/runtime/renderPage/isNewError.js +0 -25
- package/dist/cjs/node/runtime/renderPage/loadPageConfigsLazyServerSide.js +0 -124
- package/dist/cjs/node/runtime/renderPage/log404/index.js +0 -154
- package/dist/cjs/node/runtime/renderPage/logErrorHint/errors.js +0 -20
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +0 -200
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +0 -34
- package/dist/cjs/node/runtime/renderPage/preparePageContextForPublicUsageServer.js +0 -10
- package/dist/cjs/node/runtime/renderPage/renderPageAfterRoute.js +0 -83
- package/dist/cjs/node/runtime/renderPage/resolveRedirects.js +0 -71
- package/dist/cjs/node/runtime/renderPage.js +0 -502
- package/dist/cjs/node/runtime/universal-middleware.js +0 -20
- package/dist/cjs/node/runtime/utils.js +0 -83
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +0 -27
- package/dist/cjs/node/runtime-dev/index.js +0 -42
- package/dist/cjs/node/shared/assertV1Design.js +0 -30
- package/dist/cjs/node/shared/extractAssetsQuery.js +0 -29
- package/dist/cjs/node/shared/getVikeConfigError.js +0 -22
- package/dist/cjs/node/shared/isErrorDebug.js +0 -7
- package/dist/cjs/node/shared/prependEntriesDir.js +0 -13
- package/dist/cjs/node/shared/resolveBase.js +0 -35
- package/dist/cjs/node/shared/utils.js +0 -35
- package/dist/cjs/node/shared/virtualFileId.js +0 -110
- package/dist/cjs/node/vite/index.js +0 -69
- package/dist/cjs/node/vite/onLoad.js +0 -21
- package/dist/cjs/node/vite/plugins/pluginBaseUrls.js +0 -48
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +0 -342
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +0 -179
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +0 -220
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -254
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -36
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -41
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginProdBuildEntry.js +0 -109
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginSuppressRollupWarning.js +0 -63
- package/dist/cjs/node/vite/plugins/pluginBuild.js +0 -21
- package/dist/cjs/node/vite/plugins/pluginCommon/assertResolveAlias.js +0 -88
- package/dist/cjs/node/vite/plugins/pluginCommon.js +0 -197
- package/dist/cjs/node/vite/plugins/pluginDev/determineFsAllowList.js +0 -28
- package/dist/cjs/node/vite/plugins/pluginDev/determineOptimizeDeps.js +0 -163
- package/dist/cjs/node/vite/plugins/pluginDev.js +0 -107
- package/dist/cjs/node/vite/plugins/pluginEnvVars.js +0 -87
- package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +0 -227
- package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +0 -99
- package/dist/cjs/node/vite/plugins/pluginFileEnv.js +0 -149
- package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +0 -52
- package/dist/cjs/node/vite/plugins/pluginPreview.js +0 -76
- package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +0 -69
- package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +0 -49
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/debug.js +0 -5
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.js +0 -56
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +0 -190
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +0 -54
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +0 -97
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles.js +0 -215
- package/dist/cjs/node/vite/plugins/pluginWorkaroundCssModuleHmr.js +0 -15
- package/dist/cjs/node/vite/plugins/pluginWorkaroundVite6HmrRegression.js +0 -35
- package/dist/cjs/node/vite/shared/addSsrMiddleware.js +0 -60
- package/dist/cjs/node/vite/shared/findPageFiles.js +0 -25
- package/dist/cjs/node/vite/shared/getAssetsDir.js +0 -10
- package/dist/cjs/node/vite/shared/getClientEntrySrcDev.js +0 -42
- package/dist/cjs/node/vite/shared/getEnvVarObject.js +0 -37
- package/dist/cjs/node/vite/shared/getFilePath.js +0 -172
- package/dist/cjs/node/vite/shared/getHttpRequestAsyncStore.js +0 -125
- package/dist/cjs/node/vite/shared/getMagicString.js +0 -18
- package/dist/cjs/node/vite/shared/getManifestFilePathRelative.js +0 -10
- package/dist/cjs/node/vite/shared/getOutDirs.js +0 -146
- package/dist/cjs/node/vite/shared/getViteConfigRuntime.js +0 -21
- package/dist/cjs/node/vite/shared/isAsset.js +0 -40
- package/dist/cjs/node/vite/shared/isViteCliCall.js +0 -83
- package/dist/cjs/node/vite/shared/isViteServerSide.js +0 -68
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelSolid.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +0 -38
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx1.js +0 -26
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errMdx2.js +0 -85
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errPostcss.js +0 -30
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwc.js +0 -19
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errSwcBig.js +0 -19
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +0 -29
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueHtml.js +0 -13
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueJavascript.js +0 -15
- package/dist/cjs/node/vite/shared/loggerNotProd/errorWithCodeSnippet.js +0 -162
- package/dist/cjs/node/vite/shared/loggerNotProd/log.js +0 -102
- package/dist/cjs/node/vite/shared/loggerNotProd.js +0 -208
- package/dist/cjs/node/vite/shared/loggerVite/removeSuperfluousViteLog.js +0 -26
- package/dist/cjs/node/vite/shared/loggerVite.js +0 -54
- package/dist/cjs/node/vite/shared/normalizeId.js +0 -9
- package/dist/cjs/node/vite/shared/parseEsModule.js +0 -33
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/assertExtensions.js +0 -136
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +0 -262
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles/ignorePatternsBuiltIn.js +0 -18
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +0 -252
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/filesystemRouting.js +0 -190
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getConfigFileExport.js +0 -17
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js +0 -127
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/loadFileAtConfigTime.js +0 -129
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/pointerImports.js +0 -195
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +0 -102
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/transpileAndExecuteFile.js +0 -425
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +0 -1151
- package/dist/cjs/node/vite/shared/rollupIsEsm.js +0 -15
- package/dist/cjs/node/vite/utils.js +0 -45
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/shared/NOT_SERIALIZABLE.js +0 -4
- package/dist/cjs/shared/RenderErrorPage.js +0 -6
- package/dist/cjs/shared/abort.js +0 -16
- package/dist/cjs/shared/addIs404ToPageProps.js +0 -18
- package/dist/cjs/shared/assertHookReturnedObject.js +0 -21
- package/dist/cjs/shared/assertOnBeforeRenderHookReturn.js +0 -21
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +0 -20
- package/dist/cjs/shared/createGlobalContextShared.js +0 -109
- package/dist/cjs/shared/createPageContextShared.js +0 -17
- package/dist/cjs/shared/determinePageIdOld.js +0 -11
- package/dist/cjs/shared/error-page.js +0 -40
- package/dist/cjs/shared/getPageContext.js +0 -6
- package/dist/cjs/shared/getPageContextRequestUrl.js +0 -16
- package/dist/cjs/shared/getPageContextUrlComputed.js +0 -132
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +0 -19
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/ClientDependency.js +0 -2
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/analyzeExports.js +0 -50
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/determineClientEntry.js +0 -30
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide/getExportNames.js +0 -15
- package/dist/cjs/shared/getPageFiles/analyzePageClientSide.js +0 -59
- package/dist/cjs/shared/getPageFiles/analyzePageServerSide.js +0 -22
- package/dist/cjs/shared/getPageFiles/assert_exports_old_design.js +0 -24
- package/dist/cjs/shared/getPageFiles/fileTypes.js +0 -52
- package/dist/cjs/shared/getPageFiles/getAllPageIdFiles.js +0 -102
- package/dist/cjs/shared/getPageFiles/getPageFileObject.js +0 -56
- package/dist/cjs/shared/getPageFiles/parseVirtualFileExportsGlobalEntry.js +0 -100
- package/dist/cjs/shared/getPageFiles.js +0 -7
- package/dist/cjs/shared/getProxyForPublicUsage.js +0 -56
- package/dist/cjs/shared/hooks/execHook.js +0 -147
- package/dist/cjs/shared/hooks/getHook.js +0 -173
- package/dist/cjs/shared/htmlElementIds.js +0 -5
- package/dist/cjs/shared/misc/isServerSideError.js +0 -4
- package/dist/cjs/shared/misc/pageContextInitIsPassedToClient.js +0 -4
- package/dist/cjs/shared/modifyUrl.js +0 -28
- package/dist/cjs/shared/modifyUrlSameOrigin.js +0 -47
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +0 -42
- package/dist/cjs/shared/page-configs/findPageConfig.js +0 -10
- package/dist/cjs/shared/page-configs/getConfigDefinedAt.js +0 -65
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -68
- package/dist/cjs/shared/page-configs/getConfigValueRuntime.js +0 -10
- package/dist/cjs/shared/page-configs/getConfigValueTyped.js +0 -32
- package/dist/cjs/shared/page-configs/getExportPath.js +0 -29
- package/dist/cjs/shared/page-configs/helpers.js +0 -27
- package/dist/cjs/shared/page-configs/loadAndParseVirtualFilePageEntry.js +0 -25
- package/dist/cjs/shared/page-configs/resolveVikeConfigPublic.js +0 -287
- package/dist/cjs/shared/page-configs/serialize/PageConfigSerialized.js +0 -2
- package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +0 -1
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigsSerialized.js +0 -145
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +0 -290
- package/dist/cjs/shared/prepareGlobalContextForPublicUsage.js +0 -10
- package/dist/cjs/shared/preparePageContextForPublicUsage.js +0 -80
- package/dist/cjs/shared/route/abort.js +0 -178
- package/dist/cjs/shared/route/debug.js +0 -23
- package/dist/cjs/shared/route/deduceRouteStringFromFilesystemPath.js +0 -52
- package/dist/cjs/shared/route/execHookGuard.js +0 -37
- package/dist/cjs/shared/route/execHookOnBeforeRoute.js +0 -84
- package/dist/cjs/shared/route/index.js +0 -107
- package/dist/cjs/shared/route/loadPageRoutes.js +0 -197
- package/dist/cjs/shared/route/noRouteMatch.js +0 -4
- package/dist/cjs/shared/route/resolvePrecedence.js +0 -93
- package/dist/cjs/shared/route/resolveRoute.js +0 -20
- package/dist/cjs/shared/route/resolveRouteFunction.js +0 -73
- package/dist/cjs/shared/route/resolveRouteString.js +0 -153
- package/dist/cjs/shared/route/resolveUrlPathname.js +0 -47
- package/dist/cjs/shared/route/routing.js +0 -9
- package/dist/cjs/shared/route/utils.js +0 -40
- package/dist/cjs/shared/utils.js +0 -49
- package/dist/cjs/types/Config/ConfigResolved.js +0 -2
- package/dist/cjs/types/Config.js +0 -2
- package/dist/cjs/types/FilePath.js +0 -2
- package/dist/cjs/types/PageConfig.js +0 -2
- package/dist/cjs/types/PageContext.js +0 -2
- package/dist/cjs/types/VikeGlobalInternal.js +0 -2
- package/dist/cjs/types/VikeNamespace.js +0 -2
- package/dist/cjs/types/ViteManifest.js +0 -2
- package/dist/cjs/types/defineConfig.js +0 -6
- package/dist/cjs/types/index-dreprecated.js +0 -3
- package/dist/cjs/types/index.js +0 -5
- package/dist/cjs/utils/PROJECT_VERSION.js +0 -5
- package/dist/cjs/utils/PromiseType.js +0 -2
- package/dist/cjs/utils/assert.js +0 -211
- package/dist/cjs/utils/assertIsBrowser.js +0 -8
- package/dist/cjs/utils/assertIsNotBrowser.js +0 -9
- package/dist/cjs/utils/assertKeys.js +0 -27
- package/dist/cjs/utils/assertNodeVersion.js +0 -14
- package/dist/cjs/utils/assertRoutingType.js +0 -29
- package/dist/cjs/utils/assertSetup.js +0 -171
- package/dist/cjs/utils/assertSingleInstance.js +0 -110
- package/dist/cjs/utils/assertVersion.js +0 -60
- package/dist/cjs/utils/capitalizeFirstLetter.js +0 -9
- package/dist/cjs/utils/cast.js +0 -6
- package/dist/cjs/utils/catchInfiniteLoop.js +0 -34
- package/dist/cjs/utils/changeEnumerable.js +0 -8
- package/dist/cjs/utils/checkType.js +0 -6
- package/dist/cjs/utils/compareString.js +0 -10
- package/dist/cjs/utils/createErrorWithCleanStackTrace.js +0 -39
- package/dist/cjs/utils/debug.js +0 -178
- package/dist/cjs/utils/debugGlob.js +0 -6
- package/dist/cjs/utils/deepEqual.js +0 -10
- package/dist/cjs/utils/escapeHtml.js +0 -13
- package/dist/cjs/utils/escapeRegex.js +0 -7
- package/dist/cjs/utils/findFile.js +0 -30
- package/dist/cjs/utils/findPackageJson.js +0 -18
- package/dist/cjs/utils/formatHintLog.js +0 -17
- package/dist/cjs/utils/freezePartial.js +0 -35
- package/dist/cjs/utils/genPromise.js +0 -51
- package/dist/cjs/utils/getFileExtension.js +0 -16
- package/dist/cjs/utils/getGlobalObject.js +0 -15
- package/dist/cjs/utils/getMostSimilar.js +0 -68
- package/dist/cjs/utils/getPropAccessNotation.js +0 -9
- package/dist/cjs/utils/getRandomId.js +0 -14
- package/dist/cjs/utils/getTerminalWidth.js +0 -7
- package/dist/cjs/utils/getValuePrintable.js +0 -10
- package/dist/cjs/utils/getViteRPC.js +0 -79
- package/dist/cjs/utils/hasProp.js +0 -50
- package/dist/cjs/utils/humanizeTime.js +0 -24
- package/dist/cjs/utils/includes.js +0 -13
- package/dist/cjs/utils/injectRollupInputs.js +0 -29
- package/dist/cjs/utils/isArray.js +0 -7
- package/dist/cjs/utils/isArrayOfStrings.js +0 -7
- package/dist/cjs/utils/isBrowser.js +0 -8
- package/dist/cjs/utils/isCallable.js +0 -6
- package/dist/cjs/utils/isDev.js +0 -20
- package/dist/cjs/utils/isDocker.js +0 -45
- package/dist/cjs/utils/isEqualStringList.js +0 -13
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +0 -66
- package/dist/cjs/utils/isHtml.js +0 -9
- package/dist/cjs/utils/isImportPath.js +0 -21
- package/dist/cjs/utils/isNodeJS.js +0 -16
- package/dist/cjs/utils/isNonRunnableDev.js +0 -12
- package/dist/cjs/utils/isNullish.js +0 -16
- package/dist/cjs/utils/isObject.js +0 -6
- package/dist/cjs/utils/isObjectOfStrings.js +0 -7
- package/dist/cjs/utils/isObjectWithKeys.js +0 -15
- package/dist/cjs/utils/isPlainObject.js +0 -19
- package/dist/cjs/utils/isPromise.js +0 -7
- package/dist/cjs/utils/isPropertyGetter.js +0 -7
- package/dist/cjs/utils/isReact.js +0 -23
- package/dist/cjs/utils/isRunnableDevEnvironment.js +0 -9
- package/dist/cjs/utils/isSameErrorMessage.js +0 -9
- package/dist/cjs/utils/isScriptFile.js +0 -67
- package/dist/cjs/utils/isVikeReactApp.js +0 -8
- package/dist/cjs/utils/isVitest.js +0 -6
- package/dist/cjs/utils/joinEnglish.js +0 -14
- package/dist/cjs/utils/normalizeHeaders.js +0 -17
- package/dist/cjs/utils/objectAssign.js +0 -14
- package/dist/cjs/utils/objectAssignSafe.js +0 -7
- package/dist/cjs/utils/objectDefineProperty.js +0 -7
- package/dist/cjs/utils/objectEntries.js +0 -8
- package/dist/cjs/utils/objectEntriesForEach.js +0 -7
- package/dist/cjs/utils/objectFilter.js +0 -10
- package/dist/cjs/utils/objectFromEntries.js +0 -7
- package/dist/cjs/utils/objectKeys.js +0 -9
- package/dist/cjs/utils/objectReplace.js +0 -9
- package/dist/cjs/utils/onPageVisibilityChange.js +0 -18
- package/dist/cjs/utils/pLimit.js +0 -134
- package/dist/cjs/utils/parseNpmPackage.js +0 -106
- package/dist/cjs/utils/parseUrl-extras.js +0 -110
- package/dist/cjs/utils/parseUrl.js +0 -338
- package/dist/cjs/utils/path.js +0 -59
- package/dist/cjs/utils/pick.js +0 -12
- package/dist/cjs/utils/preservePropertyGetters.js +0 -30
- package/dist/cjs/utils/redirectHard.js +0 -6
- package/dist/cjs/utils/removeEmptyLines.js +0 -9
- package/dist/cjs/utils/removeFileExtension.js +0 -6
- package/dist/cjs/utils/requireResolve.js +0 -214
- package/dist/cjs/utils/rollupSourceMap.js +0 -19
- package/dist/cjs/utils/sleep.js +0 -6
- package/dist/cjs/utils/slice.js +0 -35
- package/dist/cjs/utils/sorter.js +0 -117
- package/dist/cjs/utils/stringifyStringArray.js +0 -6
- package/dist/cjs/utils/stripAnsi.js +0 -21
- package/dist/cjs/utils/styleFileRE.js +0 -6
- package/dist/cjs/utils/throttle.js +0 -15
- package/dist/cjs/utils/trackLogs.js +0 -31
- package/dist/cjs/utils/trimWithAnsi.js +0 -40
- package/dist/cjs/utils/truncateString.js +0 -23
- package/dist/cjs/utils/unique.js +0 -6
- package/dist/cjs/utils/updateType.js +0 -9
- package/dist/cjs/utils/urlToFile.js +0 -36
- package/dist/cjs/utils/virtualFileId.js +0 -39
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +0 -23
- package/dist/esm/client/runtime-server-routing/globalContext.js +0 -5
- package/dist/esm/client/shared/createGetGlobalContextClient.js +0 -65
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -249
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +0 -34
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +0 -39
- package/dist/esm/node/vite/plugins/pluginBuild.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginBuild.js +0 -19
- package/dist/esm/node/vite/plugins/pluginEnvVars.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +0 -85
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +0 -50
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +0 -67
- package/dist/esm/shared/route/debug.d.ts +0 -6
- package/dist/esm/shared/route/debug.js +0 -21
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildApp.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginBuildConfig.d.ts +0 -0
- /package/dist/esm/node/vite/plugins/{pluginBuild → build}/pluginProdBuildEntry.d.ts +0 -0
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.requireResolveOptional = requireResolveOptional;
|
|
7
|
-
exports.requireResolveOptionalDir = requireResolveOptionalDir;
|
|
8
|
-
exports.requireResolveNpmPackage = requireResolveNpmPackage;
|
|
9
|
-
exports.requireResolveDistFile = requireResolveDistFile;
|
|
10
|
-
exports.getPackageNodeModulesDirectory = getPackageNodeModulesDirectory;
|
|
11
|
-
const assert_js_1 = require("./assert.js");
|
|
12
|
-
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
13
|
-
const assertSetup_js_1 = require("./assertSetup.js");
|
|
14
|
-
const path_js_1 = require("./path.js");
|
|
15
|
-
const isScriptFile_js_1 = require("./isScriptFile.js");
|
|
16
|
-
const node_module_1 = require("node:module");
|
|
17
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
18
|
-
const parseNpmPackage_js_1 = require("./parseNpmPackage.js");
|
|
19
|
-
const isNullish_js_1 = require("./isNullish.js");
|
|
20
|
-
const debug_js_1 = require("./debug.js");
|
|
21
|
-
// @ts-ignore `file:///${__filename.split('\\').join('/')}` is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
22
|
-
const importMetaUrl = `file:///${__filename.split('\\').join('/')}`;
|
|
23
|
-
(0, path_js_1.assertPosixPath)(importMetaUrl);
|
|
24
|
-
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
25
|
-
(0, assertSetup_js_1.assertIsNotProductionRuntime)();
|
|
26
|
-
const debug = (0, debug_js_1.createDebugger)('vike:resolve');
|
|
27
|
-
// - We still can't use import.meta.resolve() as of 23.1.0 (November 2024) because `parent` argument requires an experimental flag.
|
|
28
|
-
// - https://stackoverflow.com/questions/54977743/do-require-resolve-for-es-modules#comment139581675_62272600
|
|
29
|
-
// - Passing context to createRequire(context) isn't equivalent to passing it to the `paths` argument of require.resolve()
|
|
30
|
-
// - https://github.com/brillout/require-test
|
|
31
|
-
// - In practice, I guess it doesn't make a difference? It just seems to be small Node.js weirdness.
|
|
32
|
-
// - The argument createRequire(argument) seems to be overridden by the `paths` argument require.resolve()
|
|
33
|
-
// - For example, passing an empty array to `paths` kills the argument passed to `createRequire()`
|
|
34
|
-
// - Thus, when `paths` is defined, then the context needs to be passed to both createRequire() as well as the `paths` argument of require.resolve()
|
|
35
|
-
function requireResolve_(importPath, importerFilePath, userRootDir, doNotHandleFileExtension = false) {
|
|
36
|
-
(0, path_js_1.assertPosixPath)(importPath);
|
|
37
|
-
const contexts = importerFilePath
|
|
38
|
-
? [importerFilePath]
|
|
39
|
-
: [userRootDir ? getFakeImporterFile(userRootDir) : importMetaUrl];
|
|
40
|
-
addExtraContextForNpmPackageImport(contexts, importPath, userRootDir);
|
|
41
|
-
let importPathResolvedFilePath;
|
|
42
|
-
let failure;
|
|
43
|
-
for (const context of contexts) {
|
|
44
|
-
(0, path_js_1.assertPosixPath)(context);
|
|
45
|
-
const contextNode = makeNodeFriendly(ensureFilePrefix(context));
|
|
46
|
-
let importPathNode = makeNodeFriendly(importPath);
|
|
47
|
-
const require_ = (0, node_module_1.createRequire)(contextNode);
|
|
48
|
-
if (!doNotHandleFileExtension) {
|
|
49
|
-
addFileExtensionsToRequireResolve(require_);
|
|
50
|
-
importPathNode = removeFileExtension(importPathNode);
|
|
51
|
-
}
|
|
52
|
-
try {
|
|
53
|
-
importPathResolvedFilePath = require_.resolve(importPathNode);
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
if (debug.isActivated) {
|
|
57
|
-
const stack = new Error().stack;
|
|
58
|
-
debug('ERROR', { err, importPath, context }, stack);
|
|
59
|
-
}
|
|
60
|
-
failure ?? (failure = { err });
|
|
61
|
-
}
|
|
62
|
-
if (importPathResolvedFilePath)
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
if (!importPathResolvedFilePath) {
|
|
66
|
-
(0, assert_js_1.assert)(failure);
|
|
67
|
-
if (debug.isActivated) {
|
|
68
|
-
debug('FAILURE', {
|
|
69
|
-
importPath,
|
|
70
|
-
importerFilePath,
|
|
71
|
-
userRootDir,
|
|
72
|
-
doNotHandleFileExtension,
|
|
73
|
-
importMetaUrl,
|
|
74
|
-
contexts,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return { importPathResolvedFilePath: undefined, err: failure.err, hasFailed: true };
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
if (failure && debug.isActivated) {
|
|
81
|
-
debug('SUCCESS', {
|
|
82
|
-
importPath,
|
|
83
|
-
contexts,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
(0, assert_js_1.assert)(importPathResolvedFilePath);
|
|
87
|
-
importPathResolvedFilePath = (0, path_js_1.toPosixPath)(importPathResolvedFilePath);
|
|
88
|
-
return { importPathResolvedFilePath, err: undefined, hasFailed: false };
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function requireResolveOptional({ importPath, importerFilePath, userRootDir, }) {
|
|
92
|
-
const res = requireResolve_(importPath, importerFilePath, userRootDir);
|
|
93
|
-
if (res.hasFailed)
|
|
94
|
-
return null;
|
|
95
|
-
return res.importPathResolvedFilePath;
|
|
96
|
-
}
|
|
97
|
-
function requireResolveOptionalDir({ importPath, importerDir, userRootDir, }) {
|
|
98
|
-
const importerFilePath = getFakeImporterFile(importerDir);
|
|
99
|
-
const res = requireResolve_(importPath, importerFilePath, userRootDir);
|
|
100
|
-
if (res.hasFailed)
|
|
101
|
-
return null;
|
|
102
|
-
return res.importPathResolvedFilePath;
|
|
103
|
-
}
|
|
104
|
-
function requireResolveNpmPackage({ importPathNpmPackage, userRootDir, }) {
|
|
105
|
-
(0, parseNpmPackage_js_1.assertIsImportPathNpmPackage)(importPathNpmPackage);
|
|
106
|
-
const importerFilePath = getFakeImporterFile(userRootDir);
|
|
107
|
-
const res = requireResolve_(importPathNpmPackage, importerFilePath, userRootDir);
|
|
108
|
-
if (res.hasFailed)
|
|
109
|
-
throw res.err;
|
|
110
|
-
return res.importPathResolvedFilePath;
|
|
111
|
-
}
|
|
112
|
-
function requireResolveDistFile(distFile) {
|
|
113
|
-
const packageNodeModulesDirectory = getPackageNodeModulesDirectory();
|
|
114
|
-
(0, path_js_1.assertPosixPath)(packageNodeModulesDirectory);
|
|
115
|
-
(0, path_js_1.assertPosixPath)(distFile);
|
|
116
|
-
const importPathResolvedFilePath = makeNodeFriendly(node_path_1.default.posix.join(packageNodeModulesDirectory, distFile));
|
|
117
|
-
// Double check
|
|
118
|
-
{
|
|
119
|
-
const res = requireResolve_(importPathResolvedFilePath,
|
|
120
|
-
// No context needed: importPathResolvedFilePath is already resolved and absolute
|
|
121
|
-
null, null, true);
|
|
122
|
-
if (res.hasFailed)
|
|
123
|
-
throw res.err;
|
|
124
|
-
(0, assert_js_1.assert)(res.importPathResolvedFilePath === importPathResolvedFilePath);
|
|
125
|
-
}
|
|
126
|
-
return importPathResolvedFilePath;
|
|
127
|
-
}
|
|
128
|
-
function addExtraContextForNpmPackageImport(contexts, importPath, userRootDir) {
|
|
129
|
-
// We should add extra context only for npm packages, but unfortunately we cannot always disambiguate between npm package imports and path aliases.
|
|
130
|
-
if (!(0, parseNpmPackage_js_1.isImportPathNpmPackageOrPathAlias)(importPath))
|
|
131
|
-
return;
|
|
132
|
-
const userRootDirFakeFile = userRootDir && getFakeImporterFile(userRootDir);
|
|
133
|
-
[
|
|
134
|
-
// Workaround for monorepo resolve issue: https://github.com/vikejs/vike-react/pull/161/commits/dbaa6643e78015ac2797c237552800fef29b72a7
|
|
135
|
-
userRootDirFakeFile,
|
|
136
|
-
// I can't think of a use case where this would be needed, but let's add one extra last chance to successfully resolve some complex monorepo setups
|
|
137
|
-
importMetaUrl,
|
|
138
|
-
]
|
|
139
|
-
.filter(isNullish_js_1.isNotNullish)
|
|
140
|
-
.forEach((context) => {
|
|
141
|
-
const alreadyHasContext = contexts.includes(context) || contexts.includes(ensureFilePrefix(context));
|
|
142
|
-
if (alreadyHasContext)
|
|
143
|
-
return;
|
|
144
|
-
contexts.push(context);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function removeFileExtension(importPath) {
|
|
148
|
-
// Skip for Bun: https://github.com/vikejs/vike/issues/2204
|
|
149
|
-
//@ts-ignore
|
|
150
|
-
if (typeof Bun !== 'undefined') {
|
|
151
|
-
// https://bun.sh/guides/util/detect-bun
|
|
152
|
-
(0, assert_js_1.assert)(process.versions.bun);
|
|
153
|
-
return importPath;
|
|
154
|
-
}
|
|
155
|
-
for (const ext of isScriptFile_js_1.scriptFileExtensionList) {
|
|
156
|
-
const suffix = `.${ext}`;
|
|
157
|
-
if (importPath.endsWith(suffix)) {
|
|
158
|
-
return importPath.slice(0, -1 * suffix.length);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return importPath;
|
|
162
|
-
}
|
|
163
|
-
function addFileExtensionsToRequireResolve(require_) {
|
|
164
|
-
const added = [];
|
|
165
|
-
isScriptFile_js_1.scriptFileExtensionList.forEach((ext) => {
|
|
166
|
-
(0, assert_js_1.assert)(!ext.includes('.'));
|
|
167
|
-
ext = `.${ext}`;
|
|
168
|
-
if (!require_.extensions[ext]) {
|
|
169
|
-
require_.extensions[ext] = require_.extensions['.js'];
|
|
170
|
-
added.push(ext);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
function getPackageNodeModulesDirectory() {
|
|
175
|
-
// [RELATIVE_PATH_FROM_DIST] Current file: node_modules/${packageName}/dist/esm/utils/requireResolve.js
|
|
176
|
-
(0, assert_js_1.assert)(importMetaUrl.includes('/dist/esm/utils/') || importMetaUrl.includes('/dist/cjs/utils/'));
|
|
177
|
-
const packageNodeModulesDirectory = node_path_1.default.posix.join(removeFilePrefix(node_path_1.default.dirname(importMetaUrl)), '../../../');
|
|
178
|
-
// Return `node_modules/${packageName}/`
|
|
179
|
-
return packageNodeModulesDirectory;
|
|
180
|
-
}
|
|
181
|
-
function getFakeImporterFile(dirPath) {
|
|
182
|
-
(0, path_js_1.assertPosixPath)(dirPath);
|
|
183
|
-
(0, assert_js_1.assert)(!dirPath.startsWith('file')); // The file:// prefix is bogus when used with path.posix.join()
|
|
184
|
-
const importerFilePath = node_path_1.default.posix.join(dirPath, 'fakeFileForNodeResolve.js');
|
|
185
|
-
return importerFilePath;
|
|
186
|
-
}
|
|
187
|
-
function ensureFilePrefix(filePath) {
|
|
188
|
-
(0, path_js_1.assertPosixPath)(filePath);
|
|
189
|
-
const filePrefix = getFilePrefix();
|
|
190
|
-
if (!filePath.startsWith(filePrefix)) {
|
|
191
|
-
(0, assert_js_1.assert)(!filePath.startsWith('file'));
|
|
192
|
-
filePath = filePrefix + filePath;
|
|
193
|
-
}
|
|
194
|
-
(0, assert_js_1.assert)(filePath.startsWith(filePrefix));
|
|
195
|
-
return filePath;
|
|
196
|
-
}
|
|
197
|
-
function removeFilePrefix(filePath) {
|
|
198
|
-
const filePrefix = getFilePrefix();
|
|
199
|
-
if (filePath.startsWith(filePrefix)) {
|
|
200
|
-
filePath = filePath.slice(filePrefix.length);
|
|
201
|
-
}
|
|
202
|
-
(0, assert_js_1.assert)(!filePath.startsWith('file'));
|
|
203
|
-
return filePath;
|
|
204
|
-
}
|
|
205
|
-
function getFilePrefix() {
|
|
206
|
-
let prefix = 'file://';
|
|
207
|
-
if (process.platform === 'win32')
|
|
208
|
-
prefix += '/';
|
|
209
|
-
return prefix;
|
|
210
|
-
}
|
|
211
|
-
function makeNodeFriendly(filePath) {
|
|
212
|
-
// https://github.com/vikejs/vike/issues/2436#issuecomment-2849145340
|
|
213
|
-
return decodeURIComponent(filePath);
|
|
214
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rollupSourceMapRemove = rollupSourceMapRemove;
|
|
4
|
-
exports.rollupSourceMapPassthrough = rollupSourceMapPassthrough;
|
|
5
|
-
// https://rollupjs.org/guide/en/#source-code-transformations
|
|
6
|
-
/** Remove entire source mapping, to save KBs. */
|
|
7
|
-
function rollupSourceMapRemove(code) {
|
|
8
|
-
return {
|
|
9
|
-
code,
|
|
10
|
-
map: { mappings: '' },
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
/** Don't provide any source map, pass through current source map instead. */
|
|
14
|
-
function rollupSourceMapPassthrough(code) {
|
|
15
|
-
return {
|
|
16
|
-
code,
|
|
17
|
-
map: null,
|
|
18
|
-
};
|
|
19
|
-
}
|
package/dist/cjs/utils/sleep.js
DELETED
package/dist/cjs/utils/slice.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.slice = slice;
|
|
4
|
-
const assert_js_1 = require("./assert.js");
|
|
5
|
-
function slice(thing, from, to) {
|
|
6
|
-
if (typeof thing === 'string') {
|
|
7
|
-
return sliceArray(thing.split(''), from, to).join('');
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
return sliceArray(thing, from, to);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
function sliceArray(list, from, to) {
|
|
14
|
-
const listSlice = [];
|
|
15
|
-
let start = from >= 0 ? from : list.length + from;
|
|
16
|
-
(0, assert_js_1.assert)(start >= 0 && start <= list.length);
|
|
17
|
-
let end = to >= 0 ? to : list.length + to;
|
|
18
|
-
(0, assert_js_1.assert)(end >= 0 && end <= list.length);
|
|
19
|
-
while (true) {
|
|
20
|
-
if (start === end) {
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
if (start === list.length) {
|
|
24
|
-
start = 0;
|
|
25
|
-
}
|
|
26
|
-
if (start === end) {
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
const el = list[start];
|
|
30
|
-
(0, assert_js_1.assert)(el !== undefined);
|
|
31
|
-
listSlice.push(el);
|
|
32
|
-
start++;
|
|
33
|
-
}
|
|
34
|
-
return listSlice;
|
|
35
|
-
}
|
package/dist/cjs/utils/sorter.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.higherFirst = higherFirst;
|
|
4
|
-
exports.lowerFirst = lowerFirst;
|
|
5
|
-
exports.makeFirst = makeFirst;
|
|
6
|
-
exports.makeLast = makeLast;
|
|
7
|
-
exports.reverse = reverse;
|
|
8
|
-
const assert_js_1 = require("./assert.js");
|
|
9
|
-
/**
|
|
10
|
-
* ```js
|
|
11
|
-
* let arr = [
|
|
12
|
-
* { price: 10 },
|
|
13
|
-
* { price: 1000 },
|
|
14
|
-
* { price: 100 }
|
|
15
|
-
* ]
|
|
16
|
-
* arr = arr.sort(higherFirst(el => el.price))
|
|
17
|
-
* isEqual(arr, [
|
|
18
|
-
* { price: 1000 },
|
|
19
|
-
* { price: 100 },
|
|
20
|
-
* { price: 10 }
|
|
21
|
-
* ])
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
function higherFirst(getValue) {
|
|
25
|
-
return (element1, element2) => {
|
|
26
|
-
const val1 = getValue(element1);
|
|
27
|
-
const val2 = getValue(element2);
|
|
28
|
-
if (val1 === val2) {
|
|
29
|
-
return 0;
|
|
30
|
-
}
|
|
31
|
-
return val1 > val2 ? -1 : 1;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* ```js
|
|
36
|
-
* let arr = [
|
|
37
|
-
* { price: 10 },
|
|
38
|
-
* { price: 1000 },
|
|
39
|
-
* { price: 100 }
|
|
40
|
-
* ]
|
|
41
|
-
* arr = arr.sort(lowerFirst(el => el.price))
|
|
42
|
-
* isEqual(arr, [
|
|
43
|
-
* { price: 10 },
|
|
44
|
-
* { price: 100 },
|
|
45
|
-
* { price: 1000 }
|
|
46
|
-
* ])
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
function lowerFirst(getValue) {
|
|
50
|
-
return (element1, element2) => {
|
|
51
|
-
const val1 = getValue(element1);
|
|
52
|
-
const val2 = getValue(element2);
|
|
53
|
-
if (val1 === val2) {
|
|
54
|
-
return 0;
|
|
55
|
-
}
|
|
56
|
-
return val1 < val2 ? -1 : 1;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* ```js
|
|
61
|
-
* let arr = [
|
|
62
|
-
* { name: 'iphone', isRocket: false },
|
|
63
|
-
* { name: 'starship', isRocket: true }
|
|
64
|
-
* ]
|
|
65
|
-
* arr = arr.sort(makeFirst(el => el.isRocket))
|
|
66
|
-
* isEqual(arr, [
|
|
67
|
-
* { name: 'starship', isRocket: true },
|
|
68
|
-
* { name: 'iphone', isRocket: false }
|
|
69
|
-
* ])
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
function makeFirst(getValue) {
|
|
73
|
-
return (element1, element2) => {
|
|
74
|
-
const val1 = getValue(element1);
|
|
75
|
-
const val2 = getValue(element2);
|
|
76
|
-
(0, assert_js_1.assert)([true, false, null].includes(val1));
|
|
77
|
-
(0, assert_js_1.assert)([true, false, null].includes(val2));
|
|
78
|
-
if (val1 === val2) {
|
|
79
|
-
return 0;
|
|
80
|
-
}
|
|
81
|
-
if (val1 === true || val2 === false) {
|
|
82
|
-
return -1;
|
|
83
|
-
}
|
|
84
|
-
if (val2 === true || val1 === false) {
|
|
85
|
-
return 1;
|
|
86
|
-
}
|
|
87
|
-
(0, assert_js_1.assert)(false);
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* ```js
|
|
92
|
-
* let arr = [
|
|
93
|
-
* { name: 'starship', isRocket: true },
|
|
94
|
-
* { name: 'iphone', isRocket: false }
|
|
95
|
-
* ]
|
|
96
|
-
* arr = arr.sort(makeLast(el => el.isRocket))
|
|
97
|
-
* isEqual(arr, [
|
|
98
|
-
* { name: 'iphone', isRocket: false },
|
|
99
|
-
* { name: 'starship', isRocket: true }
|
|
100
|
-
* ])
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
function makeLast(getValue) {
|
|
104
|
-
return makeFirst((element) => {
|
|
105
|
-
const val = getValue(element);
|
|
106
|
-
if (val === null) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
return !val;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
/** Reverse order result. */
|
|
115
|
-
function reverse(sortKey) {
|
|
116
|
-
return (-1 * sortKey);
|
|
117
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stripAnsi = stripAnsi;
|
|
4
|
-
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
5
|
-
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
6
|
-
const ansiRegex = getAnsiRegex();
|
|
7
|
-
// Copied from https://github.com/chalk/strip-ansi/blob/1fdc531d4046cbaa830460f5c74452bf1f0a0884/index.js
|
|
8
|
-
function stripAnsi(string) {
|
|
9
|
-
// Even though the regex is global, we don't need to reset the `.lastIndex`
|
|
10
|
-
// because unlike `.exec()` and `.test()`, `.replace()` does it automatically
|
|
11
|
-
// and doing it manually has a performance penalty.
|
|
12
|
-
return string.replace(ansiRegex, '');
|
|
13
|
-
}
|
|
14
|
-
// Copied from https://github.com/chalk/ansi-regex/blob/02fa893d619d3da85411acc8fd4e2eea0e95a9d9/index.js
|
|
15
|
-
function getAnsiRegex() {
|
|
16
|
-
const pattern = [
|
|
17
|
-
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)',
|
|
18
|
-
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))',
|
|
19
|
-
].join('|');
|
|
20
|
-
return new RegExp(pattern, 'g');
|
|
21
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.styleFileRE = void 0;
|
|
4
|
-
// Copied from https://github.com/vitejs/vite/blob/d649daba7682791178b711d9a3e44a6b5d00990c/packages/vite/src/node/plugins/css.ts#L90-L91
|
|
5
|
-
// spellcheck-ignore
|
|
6
|
-
exports.styleFileRE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\?)/;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.throttle = throttle;
|
|
4
|
-
function throttle(func, waitTime) {
|
|
5
|
-
let isQueued = false;
|
|
6
|
-
return () => {
|
|
7
|
-
if (!isQueued) {
|
|
8
|
-
isQueued = true;
|
|
9
|
-
setTimeout(() => {
|
|
10
|
-
isQueued = false;
|
|
11
|
-
func();
|
|
12
|
-
}, waitTime);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const debug_js_1 = require("./debug.js");
|
|
7
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
8
|
-
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
9
|
-
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
10
|
-
if ((0, debug_js_1.isDebugActivated)('vike:log')) {
|
|
11
|
-
trackLogs();
|
|
12
|
-
}
|
|
13
|
-
// https://stackoverflow.com/questions/45395369/how-to-get-console-log-line-numbers-shown-in-nodejs/75109905#75109905
|
|
14
|
-
function trackLogs() {
|
|
15
|
-
const logOriginal = process.stdout.write;
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
const log = (msg) => logOriginal.call(process.stdout, msg + '\n');
|
|
18
|
-
['stdout', 'stderr'].forEach((stdName) => {
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
var methodOriginal = process[stdName].write;
|
|
21
|
-
// @ts-ignore
|
|
22
|
-
process[stdName].write = function (...args) {
|
|
23
|
-
log(picocolors_1.default.bold(picocolors_1.default.blue('*** LOG ***')));
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
methodOriginal.apply(process[stdName], args);
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
log(new Error().stack.replace(/^Error(\:|)/, picocolors_1.default.magenta('*** LOG ORIGIN ***')));
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
Error.stackTraceLimit = Infinity;
|
|
31
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.trimWithAnsi = trimWithAnsi;
|
|
4
|
-
exports.trimWithAnsiTrailOnly = trimWithAnsiTrailOnly;
|
|
5
|
-
const assert_js_1 = require("./assert.js");
|
|
6
|
-
const stripAnsi_js_1 = require("./stripAnsi.js");
|
|
7
|
-
const whitespaceRegex = /(\s+)/; // Capturing parathesis so that split preserves separator
|
|
8
|
-
/* Same as trim() but works with ANSI escape codes */
|
|
9
|
-
function trimWithAnsi(str) {
|
|
10
|
-
str = trimWithAnsiHead(str);
|
|
11
|
-
str = trimWithAnsiTrailOnly(str);
|
|
12
|
-
return str;
|
|
13
|
-
}
|
|
14
|
-
function trimWithAnsiHead(str) {
|
|
15
|
-
return trim(str, false);
|
|
16
|
-
}
|
|
17
|
-
function trimWithAnsiTrailOnly(str) {
|
|
18
|
-
return trim(str, true);
|
|
19
|
-
}
|
|
20
|
-
function trim(str, trail) {
|
|
21
|
-
let parts = str.split(whitespaceRegex);
|
|
22
|
-
if (trail)
|
|
23
|
-
parts.reverse();
|
|
24
|
-
let visible = false;
|
|
25
|
-
parts = parts.map((line) => {
|
|
26
|
-
if (visible)
|
|
27
|
-
return line;
|
|
28
|
-
const lineTrimmed = line.trim();
|
|
29
|
-
const lineTrimmedAndStripped = (0, stripAnsi_js_1.stripAnsi)(lineTrimmed);
|
|
30
|
-
(0, assert_js_1.assert)(lineTrimmedAndStripped.trim() === lineTrimmedAndStripped);
|
|
31
|
-
if (lineTrimmedAndStripped !== '')
|
|
32
|
-
visible = true;
|
|
33
|
-
return lineTrimmed;
|
|
34
|
-
});
|
|
35
|
-
if (trail)
|
|
36
|
-
parts.reverse();
|
|
37
|
-
(0, assert_js_1.assert)(str.split(whitespaceRegex).join('') === str);
|
|
38
|
-
const strTrimmed = parts.join('');
|
|
39
|
-
return strTrimmed;
|
|
40
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.truncateString = truncateString;
|
|
7
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
8
|
-
const assert_js_1 = require("./assert.js");
|
|
9
|
-
function truncateString(str, lenMax) {
|
|
10
|
-
const lenMaxReal = lenMax - 3;
|
|
11
|
-
(0, assert_js_1.assert)(lenMaxReal >= 1); // Show at least one character before the ellipsis
|
|
12
|
-
if (str.length < lenMax) {
|
|
13
|
-
return str;
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
// Breaks ANSI codes.
|
|
17
|
-
// - So far, the `str` we pass to truncateString(str) is always expected to not contain any ANSI code
|
|
18
|
-
str = str.substring(0, lenMaxReal);
|
|
19
|
-
const ellipsis = picocolors_1.default.dim('...');
|
|
20
|
-
str = str + ellipsis;
|
|
21
|
-
return str;
|
|
22
|
-
}
|
|
23
|
-
}
|
package/dist/cjs/utils/unique.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateType = updateType;
|
|
4
|
-
const assert_js_1 = require("./assert.js");
|
|
5
|
-
/** Help TypeScript update the type of dynamically modified objects. */
|
|
6
|
-
function updateType(thing, clone) {
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
(0, assert_js_1.assert)(thing === clone);
|
|
9
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.baseServer = void 0;
|
|
4
|
-
exports.urlToFile = urlToFile;
|
|
5
|
-
const assert_js_1 = require("./assert.js");
|
|
6
|
-
const parseUrl_js_1 = require("./parseUrl.js");
|
|
7
|
-
const slice_js_1 = require("./slice.js");
|
|
8
|
-
// - When doing a `.pageContext.json` HTTP request, the base URL should be preserved. (The server-side will handle the base URL.)
|
|
9
|
-
// - While pre-rendering there is no base URL
|
|
10
|
-
const baseServer = '/';
|
|
11
|
-
exports.baseServer = baseServer;
|
|
12
|
-
function urlToFile(url, fileExtension, doNotCreateExtraDirectory) {
|
|
13
|
-
const { pathnameOriginal, searchOriginal, hashOriginal } = (0, parseUrl_js_1.parseUrl)(url, baseServer);
|
|
14
|
-
if (url.startsWith('/')) {
|
|
15
|
-
(0, assert_js_1.assert)(url === `${pathnameOriginal}${searchOriginal || ''}${hashOriginal || ''}`, { url });
|
|
16
|
-
}
|
|
17
|
-
const hasTrailingSlash = pathnameOriginal.endsWith('/');
|
|
18
|
-
let pathnameModified;
|
|
19
|
-
if (doNotCreateExtraDirectory && pathnameOriginal !== '/') {
|
|
20
|
-
if (hasTrailingSlash) {
|
|
21
|
-
pathnameModified = (0, slice_js_1.slice)(pathnameOriginal, 0, -1);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
pathnameModified = pathnameOriginal;
|
|
25
|
-
}
|
|
26
|
-
(0, assert_js_1.assert)(!pathnameModified.endsWith('/'), { url });
|
|
27
|
-
(0, assert_js_1.assert)(pathnameModified !== '');
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
pathnameModified = pathnameOriginal + (hasTrailingSlash ? '' : '/') + 'index';
|
|
31
|
-
}
|
|
32
|
-
(0, assert_js_1.assert)(pathnameModified);
|
|
33
|
-
pathnameModified = pathnameModified + fileExtension;
|
|
34
|
-
const fileUrl = `${pathnameModified}${searchOriginal || ''}${hashOriginal || ''}`;
|
|
35
|
-
return fileUrl;
|
|
36
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.isVirtualFileId = isVirtualFileId;
|
|
7
|
-
exports.addVirtualFileIdPrefix = addVirtualFileIdPrefix;
|
|
8
|
-
exports.removeVirtualFileIdPrefix = removeVirtualFileIdPrefix;
|
|
9
|
-
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
10
|
-
const assert_js_1 = require("./assert.js");
|
|
11
|
-
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
12
|
-
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
13
|
-
const idBase = 'virtual:vike:';
|
|
14
|
-
// https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention
|
|
15
|
-
const prefix = '\0';
|
|
16
|
-
function isVirtualFileId(id) {
|
|
17
|
-
if (id.startsWith(idBase))
|
|
18
|
-
return true;
|
|
19
|
-
if (id.startsWith(prefix + idBase))
|
|
20
|
-
return true;
|
|
21
|
-
// https://github.com/vikejs/vike/issues/1985
|
|
22
|
-
(0, assert_js_1.assertUsage)(!id.includes(idBase), `Encountered a module ID ${picocolors_1.default.cyan(id)} that is unexpected. Are you using a tool that modifies the ID of modules? For example, the baseUrl setting in tsconfig.json cannot be used.`);
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
function addVirtualFileIdPrefix(id) {
|
|
26
|
-
(0, assert_js_1.assert)(isVirtualFileId(id));
|
|
27
|
-
if (!id.startsWith(prefix)) {
|
|
28
|
-
id = prefix + id;
|
|
29
|
-
}
|
|
30
|
-
(0, assert_js_1.assert)(id.startsWith(prefix));
|
|
31
|
-
return id;
|
|
32
|
-
}
|
|
33
|
-
function removeVirtualFileIdPrefix(id) {
|
|
34
|
-
if (id.startsWith(prefix)) {
|
|
35
|
-
id = id.slice(prefix.length);
|
|
36
|
-
}
|
|
37
|
-
(0, assert_js_1.assert)(!id.startsWith(prefix));
|
|
38
|
-
return id;
|
|
39
|
-
}
|