diff --git a/boilerplates/boilerplate-react-ts/server/index.ts b/boilerplates/boilerplate-react-ts/server/index.ts index e8729bd872..dbe5a2f2c2 100644 --- a/boilerplates/boilerplate-react-ts/server/index.ts +++ b/boilerplates/boilerplate-react-ts/server/index.ts @@ -14,7 +14,7 @@ import express from 'express' import compression from 'compression' import { renderPage } from 'vike/server' -import { root } from './root.js' +import { root } from './root' const isProduction = process.env.NODE_ENV === 'production' startServer() diff --git a/boilerplates/boilerplate-react/server/index.js b/boilerplates/boilerplate-react/server/index.js index e8729bd872..dbe5a2f2c2 100644 --- a/boilerplates/boilerplate-react/server/index.js +++ b/boilerplates/boilerplate-react/server/index.js @@ -14,7 +14,7 @@ import express from 'express' import compression from 'compression' import { renderPage } from 'vike/server' -import { root } from './root.js' +import { root } from './root' const isProduction = process.env.NODE_ENV === 'production' startServer() diff --git a/boilerplates/boilerplate-vue-ts/server/index.ts b/boilerplates/boilerplate-vue-ts/server/index.ts index e8729bd872..dbe5a2f2c2 100644 --- a/boilerplates/boilerplate-vue-ts/server/index.ts +++ b/boilerplates/boilerplate-vue-ts/server/index.ts @@ -14,7 +14,7 @@ import express from 'express' import compression from 'compression' import { renderPage } from 'vike/server' -import { root } from './root.js' +import { root } from './root' const isProduction = process.env.NODE_ENV === 'production' startServer() diff --git a/boilerplates/boilerplate-vue/server/index.js b/boilerplates/boilerplate-vue/server/index.js index e8729bd872..dbe5a2f2c2 100644 --- a/boilerplates/boilerplate-vue/server/index.js +++ b/boilerplates/boilerplate-vue/server/index.js @@ -14,7 +14,7 @@ import express from 'express' import compression from 'compression' import { renderPage } from 'vike/server' -import { root } from './root.js' +import { root } from './root' const isProduction = process.env.NODE_ENV === 'production' startServer() diff --git a/vike/__internal/index.ts b/vike/__internal/index.ts index c9cfa6e0c7..5346aa9d84 100644 --- a/vike/__internal/index.ts +++ b/vike/__internal/index.ts @@ -5,12 +5,12 @@ export type { PageRoutes, PageFile, PageConfigRuntime as PageConfig } // Internals needed by nitedani's experimental implementation of vike-telefunc export { getPageFilesAllSafe } -import { route as routeInternal, type PageRoutes } from '../shared/route/index.js' -import { getPageFilesAll, type PageFile } from '../shared/getPageFiles.js' -import { getGlobalContext, initGlobalContext_getGlobalContextAsync } from '../node/runtime/globalContext.js' -import { handleNodeEnv_vitePluginVercel } from '../utils/assertNodeEnv.js' -import { getRenderContext } from '../node/runtime/renderPage/renderPageAlreadyRouted.js' -import { PageConfigRuntime } from '../shared/page-configs/PageConfig.js' +import { route as routeInternal, type PageRoutes } from '../shared/route/index' +import { getPageFilesAll, type PageFile } from '../shared/getPageFiles' +import { getGlobalContext, initGlobalContext_getGlobalContextAsync } from '../node/runtime/globalContext' +import { handleNodeEnv_vitePluginVercel } from '../utils/assertNodeEnv' +import { getRenderContext } from '../node/runtime/renderPage/renderPageAlreadyRouted' +import { PageConfigRuntime } from '../shared/page-configs/PageConfig' /** * Used by {@link https://github.com/magne4000/vite-plugin-vercel|vite-plugin-vercel} diff --git a/vike/client/client-routing-runtime/createPageContext.ts b/vike/client/client-routing-runtime/createPageContext.ts index 3368146615..af1bd2d401 100644 --- a/vike/client/client-routing-runtime/createPageContext.ts +++ b/vike/client/client-routing-runtime/createPageContext.ts @@ -1,10 +1,10 @@ export { createPageContext } -import { getPageContextUrlComputed } from '../../shared/getPageContextUrlComputed.js' -import { getPageFilesAll } from '../../shared/getPageFiles.js' -import { loadPageRoutes } from '../../shared/route/loadPageRoutes.js' -import { getBaseServer } from './getBaseServer.js' -import { assert, isBaseServer, PromiseType, getGlobalObject, objectAssign } from './utils.js' +import { getPageContextUrlComputed } from '../../shared/getPageContextUrlComputed' +import { getPageFilesAll } from '../../shared/getPageFiles' +import { loadPageRoutes } from '../../shared/route/loadPageRoutes' +import { getBaseServer } from './getBaseServer' +import { assert, isBaseServer, PromiseType, getGlobalObject, objectAssign } from './utils' const globalObject = getGlobalObject<{ pageFilesData?: PromiseType> }>('createPageContext.ts', {}) diff --git a/vike/client/client-routing-runtime/entry.ts b/vike/client/client-routing-runtime/entry.ts index 0e78284860..cf6a84d629 100644 --- a/vike/client/client-routing-runtime/entry.ts +++ b/vike/client/client-routing-runtime/entry.ts @@ -1,10 +1,10 @@ -import { assertClientRouting } from '../../utils/assertRoutingType.js' +import { assertClientRouting } from '../../utils/assertRoutingType' assertClientRouting() import './pageFiles' -import { initClientRouter } from './initClientRouter.js' -import { assertSingleInstance_onClientEntryClientRouting } from './utils.js' -import { removeFoucBuster } from '../shared/removeFoucBuster.js' +import { initClientRouter } from './initClientRouter' +import { assertSingleInstance_onClientEntryClientRouting } from './utils' +import { removeFoucBuster } from '../shared/removeFoucBuster' // @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error. const isProd: boolean = import.meta.env.PROD assertSingleInstance_onClientEntryClientRouting(isProd) diff --git a/vike/client/client-routing-runtime/getBaseServer.ts b/vike/client/client-routing-runtime/getBaseServer.ts index da4a4392db..644ee6fa11 100644 --- a/vike/client/client-routing-runtime/getBaseServer.ts +++ b/vike/client/client-routing-runtime/getBaseServer.ts @@ -1,6 +1,6 @@ export { getBaseServer } -import { assert } from '../server-routing-runtime/utils.js' +import { assert } from '../server-routing-runtime/utils' function getBaseServer(): string { // @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error. diff --git a/vike/client/client-routing-runtime/getPageContext/removeBuiltInOverrides.ts b/vike/client/client-routing-runtime/getPageContext/removeBuiltInOverrides.ts index c082c596ea..0bf8af3f3c 100644 --- a/vike/client/client-routing-runtime/getPageContext/removeBuiltInOverrides.ts +++ b/vike/client/client-routing-runtime/getPageContext/removeBuiltInOverrides.ts @@ -1,6 +1,6 @@ export { removeBuiltInOverrides } -import { assert, assertWarning } from '../utils.js' +import { assert, assertWarning } from '../utils' const BUILT_IN_CLIENT_ROUTER = ['urlPathname', 'urlParsed'] as const const BUILT_IN_CLIENT = ['Page', 'pageExports', 'exports'] as const diff --git a/vike/client/client-routing-runtime/getPageContextCurrent.ts b/vike/client/client-routing-runtime/getPageContextCurrent.ts index 2fd87cf968..c402b9b951 100644 --- a/vike/client/client-routing-runtime/getPageContextCurrent.ts +++ b/vike/client/client-routing-runtime/getPageContextCurrent.ts @@ -1,8 +1,8 @@ export { setPageContextCurrent } export { getPageContextCurrent } -import { getGlobalObject } from './utils.js' -import type { PageContextExports } from '../../shared/getPageFiles.js' +import { getGlobalObject } from './utils' +import type { PageContextExports } from '../../shared/getPageFiles' type PageContextCurrent = PageContextExports & { urlPathname: string diff --git a/vike/client/client-routing-runtime/getPageContextFromHooks.ts b/vike/client/client-routing-runtime/getPageContextFromHooks.ts index a50b65bd0c..b0df5c0516 100644 --- a/vike/client/client-routing-runtime/getPageContextFromHooks.ts +++ b/vike/client/client-routing-runtime/getPageContextFromHooks.ts @@ -16,23 +16,23 @@ import { executeHook, isObject, getGlobalObject -} from './utils.js' +} from './utils' import { parse } from '@brillout/json-serializer/parse' -import { getPageContextSerializedInHtml } from '../shared/getPageContextSerializedInHtml.js' -import type { PageContextExports, PageFile } from '../../shared/getPageFiles.js' -import { analyzePageServerSide } from '../../shared/getPageFiles/analyzePageServerSide.js' -import { getHook } from '../../shared/hooks/getHook.js' -import { preparePageContextForUserConsumptionClientSide } from '../shared/preparePageContextForUserConsumptionClientSide.js' -import { removeBuiltInOverrides } from './getPageContext/removeBuiltInOverrides.js' -import { getPageContextRequestUrl } from '../../shared/getPageContextRequestUrl.js' -import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig.js' -import { getPageConfig } from '../../shared/page-configs/helpers.js' -import { getConfigValueRuntime } from '../../shared/page-configs/getConfigValue.js' -import { assertOnBeforeRenderHookReturn } from '../../shared/assertOnBeforeRenderHookReturn.js' -import { executeGuardHook } from '../../shared/route/executeGuardHook.js' -import { AbortRender, isAbortPageContext } from '../../shared/route/abort.js' -import { pageContextInitIsPassedToClient } from '../../shared/misc/pageContextInitIsPassedToClient.js' -import { isServerSideError } from '../../shared/misc/isServerSideError.js' +import { getPageContextSerializedInHtml } from '../shared/getPageContextSerializedInHtml' +import type { PageContextExports, PageFile } from '../../shared/getPageFiles' +import { analyzePageServerSide } from '../../shared/getPageFiles/analyzePageServerSide' +import { getHook } from '../../shared/hooks/getHook' +import { preparePageContextForUserConsumptionClientSide } from '../shared/preparePageContextForUserConsumptionClientSide' +import { removeBuiltInOverrides } from './getPageContext/removeBuiltInOverrides' +import { getPageContextRequestUrl } from '../../shared/getPageContextRequestUrl' +import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig' +import { getPageConfig } from '../../shared/page-configs/helpers' +import { getConfigValueRuntime } from '../../shared/page-configs/getConfigValue' +import { assertOnBeforeRenderHookReturn } from '../../shared/assertOnBeforeRenderHookReturn' +import { executeGuardHook } from '../../shared/route/executeGuardHook' +import { AbortRender, isAbortPageContext } from '../../shared/route/abort' +import { pageContextInitIsPassedToClient } from '../../shared/misc/pageContextInitIsPassedToClient' +import { isServerSideError } from '../../shared/misc/isServerSideError' const globalObject = getGlobalObject<{ pageContextInitIsPassedToClient?: true }>('router/getPageContext.ts', {}) // TODO/eventually: rename diff --git a/vike/client/client-routing-runtime/history.ts b/vike/client/client-routing-runtime/history.ts index e3ad965840..485e0424fb 100644 --- a/vike/client/client-routing-runtime/history.ts +++ b/vike/client/client-routing-runtime/history.ts @@ -4,7 +4,7 @@ export { saveScrollPosition } export type { HistoryInfo } export type { ScrollPosition } -import { assert, assertUsage, getCurrentUrl, getGlobalObject, hasProp, isObject } from './utils.js' +import { assert, assertUsage, getCurrentUrl, getGlobalObject, hasProp, isObject } from './utils' init() const globalObject = getGlobalObject('history.ts', { previous: getHistoryInfo() }) diff --git a/vike/client/client-routing-runtime/index.ts b/vike/client/client-routing-runtime/index.ts index 0f276c35cc..4e82181e2c 100644 --- a/vike/client/client-routing-runtime/index.ts +++ b/vike/client/client-routing-runtime/index.ts @@ -4,13 +4,13 @@ // import { navigate, prefetch } from 'vike' // Use package.json#exports to make the imports isomorphic. -export { navigate, reload } from './navigate.js' -export { prefetch } from './prefetch.js' -export { onPopState } from './initOnPopState.js' -export { PROJECT_VERSION as version } from './utils.js' +export { navigate, reload } from './navigate' +export { prefetch } from './prefetch' +export { onPopState } from './initOnPopState' +export { PROJECT_VERSION as version } from './utils' // TODO/v1-release: remove this -import type { PageContextBuiltInClientWithClientRouting } from '../../shared/types.js' +import type { PageContextBuiltInClientWithClientRouting } from '../../shared/types' /** @deprecated * Replace: * ``` diff --git a/vike/client/client-routing-runtime/initClientRouter.ts b/vike/client/client-routing-runtime/initClientRouter.ts index 581caf37d1..989eac131c 100644 --- a/vike/client/client-routing-runtime/initClientRouter.ts +++ b/vike/client/client-routing-runtime/initClientRouter.ts @@ -1,12 +1,12 @@ export { initClientRouter } -import { assert } from './utils.js' -import { getRenderCount, renderPageClientSide } from './renderPageClientSide.js' -import { initOnPopState } from './initOnPopState.js' -import { initOnLinkClick } from './initOnLinkClick.js' -import { setupNativeScrollRestoration } from './scrollRestoration.js' -import { autoSaveScrollPosition } from './setScrollPosition.js' -import { initLinkPrefetchHandlers } from './prefetch.js' +import { assert } from './utils' +import { getRenderCount, renderPageClientSide } from './renderPageClientSide' +import { initOnPopState } from './initOnPopState' +import { initOnLinkClick } from './initOnLinkClick' +import { setupNativeScrollRestoration } from './scrollRestoration' +import { autoSaveScrollPosition } from './setScrollPosition' +import { initLinkPrefetchHandlers } from './prefetch' async function initClientRouter() { // Init navigation history and scroll restoration diff --git a/vike/client/client-routing-runtime/initOnLinkClick.ts b/vike/client/client-routing-runtime/initOnLinkClick.ts index 1bb28181b7..e045fc4a6d 100644 --- a/vike/client/client-routing-runtime/initOnLinkClick.ts +++ b/vike/client/client-routing-runtime/initOnLinkClick.ts @@ -2,10 +2,10 @@ export { initOnLinkClick } -import { assert } from './utils.js' -import { skipLink } from './skipLink.js' -import { renderPageClientSide } from './renderPageClientSide.js' -import type { ScrollTarget } from './setScrollPosition.js' +import { assert } from './utils' +import { skipLink } from './skipLink' +import { renderPageClientSide } from './renderPageClientSide' +import type { ScrollTarget } from './setScrollPosition' function initOnLinkClick() { document.addEventListener('click', handler) diff --git a/vike/client/client-routing-runtime/initOnPopState.ts b/vike/client/client-routing-runtime/initOnPopState.ts index e585121b25..18e18635c1 100644 --- a/vike/client/client-routing-runtime/initOnPopState.ts +++ b/vike/client/client-routing-runtime/initOnPopState.ts @@ -1,10 +1,10 @@ export { initOnPopState } export { onPopState } -import { assertWarning, getGlobalObject } from './utils.js' -import { onPopStateBegin, type HistoryInfo } from './history.js' -import { renderPageClientSide } from './renderPageClientSide.js' -import { type ScrollTarget, setScrollPosition } from './setScrollPosition.js' +import { assertWarning, getGlobalObject } from './utils' +import { onPopStateBegin, type HistoryInfo } from './history' +import { renderPageClientSide } from './renderPageClientSide' +import { type ScrollTarget, setScrollPosition } from './setScrollPosition' const globalObject = getGlobalObject('initOnPopState.ts', { listeners: [] as Listener[] }) diff --git a/vike/client/client-routing-runtime/isClientSideRoutable.ts b/vike/client/client-routing-runtime/isClientSideRoutable.ts index 625e385e22..d0bf2b4b87 100644 --- a/vike/client/client-routing-runtime/isClientSideRoutable.ts +++ b/vike/client/client-routing-runtime/isClientSideRoutable.ts @@ -1,10 +1,10 @@ export { isClientSideRoutable } -import { analyzePageClientSideInit } from '../../shared/getPageFiles/analyzePageClientSide.js' -import { findPageConfig } from '../../shared/page-configs/findPageConfig.js' -import { analyzeClientSide } from '../../shared/getPageFiles/analyzeClientSide.js' -import type { PageFile } from '../../shared/getPageFiles.js' -import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig.js' +import { analyzePageClientSideInit } from '../../shared/getPageFiles/analyzePageClientSide' +import { findPageConfig } from '../../shared/page-configs/findPageConfig' +import { analyzeClientSide } from '../../shared/getPageFiles/analyzeClientSide' +import type { PageFile } from '../../shared/getPageFiles' +import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig' type PageContextPageFiles = { _pageFilesAll: PageFile[] diff --git a/vike/client/client-routing-runtime/navigate.ts b/vike/client/client-routing-runtime/navigate.ts index 6b0d64e6e6..3e0bc9f9cf 100644 --- a/vike/client/client-routing-runtime/navigate.ts +++ b/vike/client/client-routing-runtime/navigate.ts @@ -1,10 +1,10 @@ export { navigate } export { reload } -import { normalizeUrlArgument } from './normalizeUrlArgument.js' -import { firstRenderStartPromise, renderPageClientSide } from './renderPageClientSide.js' -import type { ScrollTarget } from './setScrollPosition.js' -import { assertClientRouting, getCurrentUrl } from './utils.js' +import { normalizeUrlArgument } from './normalizeUrlArgument' +import { firstRenderStartPromise, renderPageClientSide } from './renderPageClientSide' +import type { ScrollTarget } from './setScrollPosition' +import { assertClientRouting, getCurrentUrl } from './utils' assertClientRouting() diff --git a/vike/client/client-routing-runtime/normalizeUrlArgument.ts b/vike/client/client-routing-runtime/normalizeUrlArgument.ts index f1e4c43214..7c8aa21829 100644 --- a/vike/client/client-routing-runtime/normalizeUrlArgument.ts +++ b/vike/client/client-routing-runtime/normalizeUrlArgument.ts @@ -1,6 +1,6 @@ export { normalizeUrlArgument } -import { assertUsage, isUrl, isUrlPathnameRelative } from './utils.js' +import { assertUsage, isUrl, isUrlPathnameRelative } from './utils' function normalizeUrlArgument(url: string, fnName: 'prefetch' | 'navigate'): string { // Succinct error message to save client-side KBs diff --git a/vike/client/client-routing-runtime/onLoad.ts b/vike/client/client-routing-runtime/onLoad.ts index 95b8119aa8..fb0cf40c53 100644 --- a/vike/client/client-routing-runtime/onLoad.ts +++ b/vike/client/client-routing-runtime/onLoad.ts @@ -1,7 +1,7 @@ export { onLoad } -import { assertIsBrowser } from '../../utils/assertIsBrowser.js' -import { assertClientRouting } from '../../utils/assertRoutingType.js' +import { assertIsBrowser } from '../../utils/assertIsBrowser' +import { assertClientRouting } from '../../utils/assertRoutingType' function onLoad() { assertIsBrowser() diff --git a/vike/client/client-routing-runtime/pageFiles.ts b/vike/client/client-routing-runtime/pageFiles.ts index dac3dc2001..caf59b4e67 100644 --- a/vike/client/client-routing-runtime/pageFiles.ts +++ b/vike/client/client-routing-runtime/pageFiles.ts @@ -1,4 +1,4 @@ -import { setPageFiles } from '../../shared/getPageFiles.js' +import { setPageFiles } from '../../shared/getPageFiles' // @ts-ignore import * as pageFilesExports from 'virtual:vike:importUserCode:client:client-routing' setPageFiles(pageFilesExports) diff --git a/vike/client/client-routing-runtime/prefetch.ts b/vike/client/client-routing-runtime/prefetch.ts index b683d99e1f..472c175689 100644 --- a/vike/client/client-routing-runtime/prefetch.ts +++ b/vike/client/client-routing-runtime/prefetch.ts @@ -15,29 +15,29 @@ import { getGlobalObject, hasProp, objectAssign -} from './utils.js' +} from './utils' import { type PageContextUserFiles, isErrorFetchingStaticAssets, loadUserFilesClientSide -} from '../shared/loadUserFilesClientSide.js' -import { skipLink } from './skipLink.js' -import { disableClientRouting } from './renderPageClientSide.js' -import { isClientSideRoutable } from './isClientSideRoutable.js' -import { createPageContext } from './createPageContext.js' -import { route, type PageContextFromRoute } from '../../shared/route/index.js' -import { noRouteMatch } from '../../shared/route/noRouteMatch.js' -import { type PageContextFromServerHooks, getPageContextFromServerHooks } from './getPageContextFromHooks.js' -import type { PageContextExports, PageFile } from '../../shared/getPageFiles.js' -import { type PageConfigRuntime } from '../../shared/page-configs/PageConfig.js' -import { getPageContextCurrent } from './getPageContextCurrent.js' +} from '../shared/loadUserFilesClientSide' +import { skipLink } from './skipLink' +import { disableClientRouting } from './renderPageClientSide' +import { isClientSideRoutable } from './isClientSideRoutable' +import { createPageContext } from './createPageContext' +import { route, type PageContextFromRoute } from '../../shared/route/index' +import { noRouteMatch } from '../../shared/route/noRouteMatch' +import { type PageContextFromServerHooks, getPageContextFromServerHooks } from './getPageContextFromHooks' +import type { PageContextExports, PageFile } from '../../shared/getPageFiles' +import { type PageConfigRuntime } from '../../shared/page-configs/PageConfig' +import { getPageContextCurrent } from './getPageContextCurrent' import { PAGE_CONTEXT_MAX_AGE_DEFAULT, type PrefetchSettingResolved, getPrefetchSettings -} from './prefetch/getPrefetchSettings.js' +} from './prefetch/getPrefetchSettings' import pc from '@brillout/picocolors' -import { normalizeUrlArgument } from './normalizeUrlArgument.js' +import { normalizeUrlArgument } from './normalizeUrlArgument' assertClientRouting() const globalObject = getGlobalObject('prefetch.ts', { diff --git a/vike/client/client-routing-runtime/prefetch/getPrefetchSettings.ts b/vike/client/client-routing-runtime/prefetch/getPrefetchSettings.ts index 7066fac88e..a325640d38 100644 --- a/vike/client/client-routing-runtime/prefetch/getPrefetchSettings.ts +++ b/vike/client/client-routing-runtime/prefetch/getPrefetchSettings.ts @@ -4,9 +4,9 @@ export { getPrefetchSettings } export { PAGE_CONTEXT_MAX_AGE_DEFAULT } export type { PrefetchSettingResolved } -import { assertUsage, assertInfo } from '../utils.js' -import type { PageContextExports } from '../../../shared/getPageFiles.js' -import type { PrefetchSetting, PrefetchStaticAssets } from './PrefetchSetting.js' +import { assertUsage, assertInfo } from '../utils' +import type { PageContextExports } from '../../../shared/getPageFiles' +import type { PrefetchSetting, PrefetchStaticAssets } from './PrefetchSetting' // TODO/pageContext-prefetch: Make it `Infinity` for pre-rendered pages. const PAGE_CONTEXT_MAX_AGE_DEFAULT = 5000 diff --git a/vike/client/client-routing-runtime/renderPageClientSide.ts b/vike/client/client-routing-runtime/renderPageClientSide.ts index d6caa4da23..15b52f036e 100644 --- a/vike/client/client-routing-runtime/renderPageClientSide.ts +++ b/vike/client/client-routing-runtime/renderPageClientSide.ts @@ -15,7 +15,7 @@ import { augmentType, genPromise, isCallable -} from './utils.js' +} from './utils' import { getPageContextFromClientHooks, getPageContextFromServerHooks, @@ -24,35 +24,35 @@ import { type PageContextFromServerHooks, setPageContextInitIsPassedToClient, PageContextFromClientHooks -} from './getPageContextFromHooks.js' -import { createPageContext } from './createPageContext.js' +} from './getPageContextFromHooks' +import { createPageContext } from './createPageContext' import { addLinkPrefetchHandlers, addLinkPrefetchHandlers_unwatch, addLinkPrefetchHandlers_watch, getPageContextPrefetched, populatePageContextPrefetchCache -} from './prefetch.js' -import { assertInfo, assertWarning, isReact } from './utils.js' -import { type PageContextBeforeRenderClient, executeOnRenderClientHook } from '../shared/executeOnRenderClientHook.js' -import { assertHook, getHook } from '../../shared/hooks/getHook.js' -import { isErrorFetchingStaticAssets, loadUserFilesClientSide } from '../shared/loadUserFilesClientSide.js' -import { pushHistoryState } from './history.js' +} from './prefetch' +import { assertInfo, assertWarning, isReact } from './utils' +import { type PageContextBeforeRenderClient, executeOnRenderClientHook } from '../shared/executeOnRenderClientHook' +import { assertHook, getHook } from '../../shared/hooks/getHook' +import { isErrorFetchingStaticAssets, loadUserFilesClientSide } from '../shared/loadUserFilesClientSide' +import { pushHistoryState } from './history' import { assertNoInfiniteAbortLoop, getPageContextFromAllRewrites, isAbortError, logAbortErrorHandled, type PageContextFromRewrite -} from '../../shared/route/abort.js' -import { route } from '../../shared/route/index.js' -import { isClientSideRoutable } from './isClientSideRoutable.js' -import { setScrollPosition, type ScrollTarget } from './setScrollPosition.js' -import { browserNativeScrollRestoration_disable, setInitialRenderIsDone } from './scrollRestoration.js' -import { getErrorPageId } from '../../shared/error-page.js' -import type { PageContextExports } from '../../shared/getPageFiles.js' -import { setPageContextCurrent } from './getPageContextCurrent.js' -import { getRouteStringParameterList } from '../../shared/route/resolveRouteString.js' +} from '../../shared/route/abort' +import { route } from '../../shared/route/index' +import { isClientSideRoutable } from './isClientSideRoutable' +import { setScrollPosition, type ScrollTarget } from './setScrollPosition' +import { browserNativeScrollRestoration_disable, setInitialRenderIsDone } from './scrollRestoration' +import { getErrorPageId } from '../../shared/error-page' +import type { PageContextExports } from '../../shared/getPageFiles' +import { setPageContextCurrent } from './getPageContextCurrent' +import { getRouteStringParameterList } from '../../shared/route/resolveRouteString' const globalObject = getGlobalObject<{ clientRoutingIsDisabled?: true diff --git a/vike/client/client-routing-runtime/scrollRestoration.ts b/vike/client/client-routing-runtime/scrollRestoration.ts index 9219cad691..8c7ae669c1 100644 --- a/vike/client/client-routing-runtime/scrollRestoration.ts +++ b/vike/client/client-routing-runtime/scrollRestoration.ts @@ -4,7 +4,7 @@ export { browserNativeScrollRestoration_disable } export { setupNativeScrollRestoration } export { setInitialRenderIsDone } -import { getGlobalObject, onPageHide, onPageShow } from './utils.js' +import { getGlobalObject, onPageHide, onPageShow } from './utils' const globalObject = getGlobalObject<{ initialRenderIsDone?: true }>('scrollRestoration.ts', {}) diff --git a/vike/client/client-routing-runtime/setScrollPosition.ts b/vike/client/client-routing-runtime/setScrollPosition.ts index 6c8e45e772..aaf024eb5e 100644 --- a/vike/client/client-routing-runtime/setScrollPosition.ts +++ b/vike/client/client-routing-runtime/setScrollPosition.ts @@ -2,8 +2,8 @@ export { setScrollPosition } export { autoSaveScrollPosition } export type { ScrollTarget } -import { assert, onPageHide, sleep, throttle } from './utils.js' -import { saveScrollPosition, type ScrollPosition } from './history.js' +import { assert, onPageHide, sleep, throttle } from './utils' +import { saveScrollPosition, type ScrollPosition } from './history' type ScrollTarget = undefined | { preserveScroll: boolean } | ScrollPosition function setScrollPosition(scrollTarget: ScrollTarget): void { diff --git a/vike/client/client-routing-runtime/skipLink.ts b/vike/client/client-routing-runtime/skipLink.ts index 3265798c18..981ac00810 100644 --- a/vike/client/client-routing-runtime/skipLink.ts +++ b/vike/client/client-routing-runtime/skipLink.ts @@ -1,7 +1,7 @@ export { skipLink } -import { getBaseServer } from './getBaseServer.js' -import { assert, parseUrl, isBaseServer, isUrl, isUrlExternal } from './utils.js' +import { getBaseServer } from './getBaseServer' +import { assert, parseUrl, isBaseServer, isUrl, isUrlExternal } from './utils' function skipLink(linkTag: HTMLElement): boolean { const url = linkTag.getAttribute('href') diff --git a/vike/client/client-routing-runtime/utils.ts b/vike/client/client-routing-runtime/utils.ts index 7b1db9a9ab..7315f0b6b5 100644 --- a/vike/client/client-routing-runtime/utils.ts +++ b/vike/client/client-routing-runtime/utils.ts @@ -1,34 +1,34 @@ // Utils needed by Client Routing. // We assume all runtime entries will load this utils.ts file -import { onLoad } from './onLoad.js' +import { onLoad } from './onLoad' onLoad() // We load the Server Routing utils: we tolerate the tiny amount of code that is only needed by Server Routing (only 1-2 lines). // We re-export some of the utils down below only to list the utils needed by Client Routing. -export * from '../server-routing-runtime/utils.js' +export * from '../server-routing-runtime/utils' -export * from '../../utils/assert.js' -export * from '../../utils/assertSingleInstance.js' -export * from '../../shared/hooks/executeHook.js' -export * from '../../utils/getCurrentUrl.js' -export * from '../../utils/getGlobalObject.js' -export * from '../../utils/hasProp.js' -export * from '../../utils/isBrowser.js' -export * from '../../utils/isCallable.js' -export * from '../../utils/isObject.js' -export * from '../../utils/isPlainObject.js' -export * from '../../utils/isReact.js' -export * from '../../utils/isSameErrorMessage.js' -export * from '../../utils/objectAssign.js' -export * from '../../utils/parseUrl.js' -export * from '../../utils/PromiseType.js' -export * from '../../utils/redirectHard.js' -export * from '../../utils/sleep.js' -export * from '../../utils/slice.js' -export * from '../../utils/throttle.js' -export * from '../../utils/assertRoutingType.js' -export * from '../../utils/onPageVisibilityChange.js' -export * from '../../utils/augmentType.js' -export * from '../../utils/PROJECT_VERSION.js' -export * from '../../utils/genPromise.js' +export * from '../../utils/assert' +export * from '../../utils/assertSingleInstance' +export * from '../../shared/hooks/executeHook' +export * from '../../utils/getCurrentUrl' +export * from '../../utils/getGlobalObject' +export * from '../../utils/hasProp' +export * from '../../utils/isBrowser' +export * from '../../utils/isCallable' +export * from '../../utils/isObject' +export * from '../../utils/isPlainObject' +export * from '../../utils/isReact' +export * from '../../utils/isSameErrorMessage' +export * from '../../utils/objectAssign' +export * from '../../utils/parseUrl' +export * from '../../utils/PromiseType' +export * from '../../utils/redirectHard' +export * from '../../utils/sleep' +export * from '../../utils/slice' +export * from '../../utils/throttle' +export * from '../../utils/assertRoutingType' +export * from '../../utils/onPageVisibilityChange' +export * from '../../utils/augmentType' +export * from '../../utils/PROJECT_VERSION' +export * from '../../utils/genPromise' diff --git a/vike/client/node.ts b/vike/client/node.ts index 16cd89ad6a..74bd294b77 100644 --- a/vike/client/node.ts +++ b/vike/client/node.ts @@ -1,4 +1,4 @@ -import { assertUsage } from './server-routing-runtime/utils.js' +import { assertUsage } from './server-routing-runtime/utils' assertUsage( false, [ diff --git a/vike/client/server-routing-runtime/entry.ts b/vike/client/server-routing-runtime/entry.ts index 43709ac8fc..cc73605bf2 100644 --- a/vike/client/server-routing-runtime/entry.ts +++ b/vike/client/server-routing-runtime/entry.ts @@ -1,12 +1,12 @@ -import { assertServerRouting } from '../../utils/assertRoutingType.js' +import { assertServerRouting } from '../../utils/assertRoutingType' assertServerRouting() import './pageFiles' -import { getPageContext } from './getPageContext.js' -import { executeOnRenderClientHook } from '../shared/executeOnRenderClientHook.js' -import { assertHook } from '../../shared/hooks/getHook.js' -import { assertSingleInstance_onClientEntryServerRouting } from './utils.js' -import { removeFoucBuster } from '../shared/removeFoucBuster.js' +import { getPageContext } from './getPageContext' +import { executeOnRenderClientHook } from '../shared/executeOnRenderClientHook' +import { assertHook } from '../../shared/hooks/getHook' +import { assertSingleInstance_onClientEntryServerRouting } from './utils' +import { removeFoucBuster } from '../shared/removeFoucBuster' // @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error. const isProd: boolean = import.meta.env.PROD assertSingleInstance_onClientEntryServerRouting(isProd) diff --git a/vike/client/server-routing-runtime/getPageContext.ts b/vike/client/server-routing-runtime/getPageContext.ts index 025c15cb74..1085589ced 100644 --- a/vike/client/server-routing-runtime/getPageContext.ts +++ b/vike/client/server-routing-runtime/getPageContext.ts @@ -1,7 +1,7 @@ -import { assertUsage, assertWarning, getCurrentUrl, objectAssign } from './utils.js' -import { getPageContextSerializedInHtml } from '../shared/getPageContextSerializedInHtml.js' -import { getPageFilesAll } from '../../shared/getPageFiles.js' -import { loadUserFilesClientSide } from '../shared/loadUserFilesClientSide.js' +import { assertUsage, assertWarning, getCurrentUrl, objectAssign } from './utils' +import { getPageContextSerializedInHtml } from '../shared/getPageContextSerializedInHtml' +import { getPageFilesAll } from '../../shared/getPageFiles' +import { loadUserFilesClientSide } from '../shared/loadUserFilesClientSide' export { getPageContext } diff --git a/vike/client/server-routing-runtime/index.ts b/vike/client/server-routing-runtime/index.ts index 60555f7fe1..5d99fee090 100644 --- a/vike/client/server-routing-runtime/index.ts +++ b/vike/client/server-routing-runtime/index.ts @@ -1,6 +1,6 @@ // TODO/v1-release: remove this file -import type { PageContextBuiltInClientWithServerRouting } from '../../shared/types.js' +import type { PageContextBuiltInClientWithServerRouting } from '../../shared/types' /** @deprecated * Replace: * ``` diff --git a/vike/client/server-routing-runtime/onLoad.ts b/vike/client/server-routing-runtime/onLoad.ts index 4177544f14..b8aad18cad 100644 --- a/vike/client/server-routing-runtime/onLoad.ts +++ b/vike/client/server-routing-runtime/onLoad.ts @@ -1,6 +1,6 @@ export { onLoad } -import { assertIsBrowser } from '../../utils/assertIsBrowser.js' +import { assertIsBrowser } from '../../utils/assertIsBrowser' function onLoad() { assertIsBrowser() diff --git a/vike/client/server-routing-runtime/pageFiles.ts b/vike/client/server-routing-runtime/pageFiles.ts index cd85aa52ad..835f842c3b 100644 --- a/vike/client/server-routing-runtime/pageFiles.ts +++ b/vike/client/server-routing-runtime/pageFiles.ts @@ -1,4 +1,4 @@ -import { setPageFiles } from '../../shared/getPageFiles.js' +import { setPageFiles } from '../../shared/getPageFiles' // @ts-ignore import * as pageFilesExports from 'virtual:vike:importUserCode:client:server-routing' setPageFiles(pageFilesExports) diff --git a/vike/client/server-routing-runtime/utils.ts b/vike/client/server-routing-runtime/utils.ts index 8ab95bcc2f..25231c7c0d 100644 --- a/vike/client/server-routing-runtime/utils.ts +++ b/vike/client/server-routing-runtime/utils.ts @@ -1,20 +1,20 @@ // Utils needed by Server Routing. // We assume all runtime entries will load this utils.ts file -import { onLoad } from './onLoad.js' +import { onLoad } from './onLoad' onLoad() -export * from '../../utils/assert.js' -export * from '../../utils/assertSingleInstance.js' -export * from '../../shared/hooks/executeHook.js' -export * from '../../utils/checkType.js' // Only used by Server Routing (not needed for Client Routing) -export * from '../../utils/getCurrentUrl.js' -export * from '../../utils/getGlobalObject.js' -export * from '../../utils/hasProp.js' -export * from '../../utils/isCallable.js' -export * from '../../utils/isObject.js' -export * from '../../utils/objectAssign.js' -export * from '../../utils/parseUrl.js' -export * from '../../utils/slice.js' -export * from '../../utils/unique.js' // Only used by Server Routing (not needed for Client Routing) -export * from '../../utils/getPropAccessNotation.js' +export * from '../../utils/assert' +export * from '../../utils/assertSingleInstance' +export * from '../../shared/hooks/executeHook' +export * from '../../utils/checkType' // Only used by Server Routing (not needed for Client Routing) +export * from '../../utils/getCurrentUrl' +export * from '../../utils/getGlobalObject' +export * from '../../utils/hasProp' +export * from '../../utils/isCallable' +export * from '../../utils/isObject' +export * from '../../utils/objectAssign' +export * from '../../utils/parseUrl' +export * from '../../utils/slice' +export * from '../../utils/unique' // Only used by Server Routing (not needed for Client Routing) +export * from '../../utils/getPropAccessNotation' diff --git a/vike/client/shared/executeOnRenderClientHook.ts b/vike/client/shared/executeOnRenderClientHook.ts index 2e8838b023..979cbe5189 100644 --- a/vike/client/shared/executeOnRenderClientHook.ts +++ b/vike/client/shared/executeOnRenderClientHook.ts @@ -1,14 +1,14 @@ export { executeOnRenderClientHook } export type { PageContextBeforeRenderClient } -import { assert, assertUsage, executeHook } from '../server-routing-runtime/utils.js' -import { getHook, type Hook } from '../../shared/hooks/getHook.js' -import type { PageFile, PageContextExports } from '../../shared/getPageFiles.js' +import { assert, assertUsage, executeHook } from '../server-routing-runtime/utils' +import { getHook, type Hook } from '../../shared/hooks/getHook' +import type { PageFile, PageContextExports } from '../../shared/getPageFiles' import { type PageContextForUserConsumptionClientSide, preparePageContextForUserConsumptionClientSide -} from './preparePageContextForUserConsumptionClientSide.js' -import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig.js' +} from './preparePageContextForUserConsumptionClientSide' +import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig' type PageContextBeforeRenderClient = { _pageFilesLoaded: PageFile[] diff --git a/vike/client/shared/getPageContextProxyForUser.ts b/vike/client/shared/getPageContextProxyForUser.ts index 6cbddff2d4..b8c90c6103 100644 --- a/vike/client/shared/getPageContextProxyForUser.ts +++ b/vike/client/shared/getPageContextProxyForUser.ts @@ -7,8 +7,8 @@ import { assertWarning, getGlobalObject, getPropAccessNotation -} from '../server-routing-runtime/utils.js' -import { notSerializable } from '../../shared/notSerializable.js' +} from '../server-routing-runtime/utils' +import { notSerializable } from '../../shared/notSerializable' const globalObject = getGlobalObject<{ prev?: string }>('getPageContextProxyForUser.ts', {}) type PageContextForPassToClientWarning = { diff --git a/vike/client/shared/getPageContextSerializedInHtml.ts b/vike/client/shared/getPageContextSerializedInHtml.ts index f1ed3158d5..8f6602cdba 100644 --- a/vike/client/shared/getPageContextSerializedInHtml.ts +++ b/vike/client/shared/getPageContextSerializedInHtml.ts @@ -1,5 +1,5 @@ import { parse } from '@brillout/json-serializer/parse' -import { hasProp, assert, assertUsage } from '../server-routing-runtime/utils.js' +import { hasProp, assert, assertUsage } from '../server-routing-runtime/utils' export { getPageContextSerializedInHtml } diff --git a/vike/client/shared/loadUserFilesClientSide.ts b/vike/client/shared/loadUserFilesClientSide.ts index 61da203a19..ce125fe493 100644 --- a/vike/client/shared/loadUserFilesClientSide.ts +++ b/vike/client/shared/loadUserFilesClientSide.ts @@ -7,11 +7,11 @@ import { getPageContextExports, type PageFile, type PageContextExports -} from '../../shared/getPageFiles.js' -import { findPageConfig } from '../../shared/page-configs/findPageConfig.js' -import { loadConfigValues } from '../../shared/page-configs/loadConfigValues.js' -import type { PageConfigRuntime, PageConfigRuntimeLoaded } from '../../shared/page-configs/PageConfig.js' -import { objectAssign } from '../server-routing-runtime/utils.js' +} from '../../shared/getPageFiles' +import { findPageConfig } from '../../shared/page-configs/findPageConfig' +import { loadConfigValues } from '../../shared/page-configs/loadConfigValues' +import type { PageConfigRuntime, PageConfigRuntimeLoaded } from '../../shared/page-configs/PageConfig' +import { objectAssign } from '../server-routing-runtime/utils' const stamp = '__whileFetchingAssets' diff --git a/vike/client/shared/preparePageContextForUserConsumptionClientSide.ts b/vike/client/shared/preparePageContextForUserConsumptionClientSide.ts index c4d8aeb981..12bd4d565f 100644 --- a/vike/client/shared/preparePageContextForUserConsumptionClientSide.ts +++ b/vike/client/shared/preparePageContextForUserConsumptionClientSide.ts @@ -1,12 +1,12 @@ export { preparePageContextForUserConsumptionClientSide } export type { PageContextForUserConsumptionClientSide } -import { assert, objectAssign } from '../server-routing-runtime/utils.js' -import type { PageContextExports } from '../../shared/getPageFiles.js' -import type { PageContextClient, PageContextClientWithServerRouting } from '../../shared/types.js' -import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig.js' -import { getPageContextProxyForUser, PageContextForPassToClientWarning } from './getPageContextProxyForUser.js' -import { preparePageContextForUserConsumption } from '../../shared/preparePageContextForUserConsumption.js' +import { assert, objectAssign } from '../server-routing-runtime/utils' +import type { PageContextExports } from '../../shared/getPageFiles' +import type { PageContextClient, PageContextClientWithServerRouting } from '../../shared/types' +import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig' +import { getPageContextProxyForUser, PageContextForPassToClientWarning } from './getPageContextProxyForUser' +import { preparePageContextForUserConsumption } from '../../shared/preparePageContextForUserConsumption' type PageContextForUserConsumptionClientSide = PageContextExports & PageContextForPassToClientWarning & { diff --git a/vike/client/shared/removeFoucBuster.ts b/vike/client/shared/removeFoucBuster.ts index d89399a719..796ce3b55d 100644 --- a/vike/client/shared/removeFoucBuster.ts +++ b/vike/client/shared/removeFoucBuster.ts @@ -1,6 +1,6 @@ export { removeFoucBuster } -import { assert } from './utils.js' +import { assert } from './utils' // See also: // - Alternative approach of exactly injecting what Vite injects: diff --git a/vike/client/shared/utils.ts b/vike/client/shared/utils.ts index abf1292b48..41df7afb97 100644 --- a/vike/client/shared/utils.ts +++ b/vike/client/shared/utils.ts @@ -1 +1 @@ -export * from '../../utils/assert.js' +export * from '../../utils/assert' diff --git a/vike/node/cli/bin-entry.js b/vike/node/cli/bin-entry.js index 85018024cf..8fa9b80be6 100755 --- a/vike/node/cli/bin-entry.js +++ b/vike/node/cli/bin-entry.js @@ -1,3 +1,3 @@ #!/usr/bin/env node -import '../../dist/esm/node/cli/bin.js' +import '../../dist/esm/node/cli/bin' diff --git a/vike/node/cli/bin.ts b/vike/node/cli/bin.ts index f378af4ffc..42c335e3fb 100644 --- a/vike/node/cli/bin.ts +++ b/vike/node/cli/bin.ts @@ -1,7 +1,7 @@ import { cac } from 'cac' import { resolve } from 'path' -import { runPrerenderFromCLI, runPrerender_forceExit } from '../prerender/runPrerender.js' -import { projectInfo, assertUsage, assertWarning } from './utils.js' +import { runPrerenderFromCLI, runPrerender_forceExit } from '../prerender/runPrerender' +import { projectInfo, assertUsage, assertWarning } from './utils' import pc from '@brillout/picocolors' const cli = cac(projectInfo.projectName) diff --git a/vike/node/cli/index.ts b/vike/node/cli/index.ts index 006a344b8b..150c3577dc 100644 --- a/vike/node/cli/index.ts +++ b/vike/node/cli/index.ts @@ -1,7 +1,7 @@ // TODO/v1-release: remove this file -import { prerender as prerenderOriginal } from '../prerender/index.js' -import { assertWarning } from './utils.js' +import { prerender as prerenderOriginal } from '../prerender/index' +import { assertWarning } from './utils' export const prerender: typeof prerenderOriginal = (options) => { assertWarning( false, diff --git a/vike/node/cli/onLoad.ts b/vike/node/cli/onLoad.ts index 9b3d350cd1..53e18b9dfc 100644 --- a/vike/node/cli/onLoad.ts +++ b/vike/node/cli/onLoad.ts @@ -1,6 +1,6 @@ export { onLoad } -import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser.js' +import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser' function onLoad() { assertIsNotBrowser() diff --git a/vike/node/cli/utils.ts b/vike/node/cli/utils.ts index 3cdc0082e1..8d770d7c8f 100644 --- a/vike/node/cli/utils.ts +++ b/vike/node/cli/utils.ts @@ -1,6 +1,6 @@ // We assume all runtime entries will load this utils.ts file -import { onLoad } from './onLoad.js' +import { onLoad } from './onLoad' onLoad() -export * from '../../utils/assert.js' -export * from '../../utils/projectInfo.js' +export * from '../../utils/assert' +export * from '../../utils/projectInfo' diff --git a/vike/node/client/router.ts b/vike/node/client/router.ts index bb310e5f4e..a2a6796fca 100644 --- a/vike/node/client/router.ts +++ b/vike/node/client/router.ts @@ -3,7 +3,7 @@ export { reload } export { prefetch } export { onPopState } -import { assertWarning } from '../../utils/assert.js' +import { assertWarning } from '../../utils/assert' // `never` to ensure package.json#exports["./client/router"].types points to type defined by the client-side code const navigate: never = (() => warnNoEffect('navigate')) as never diff --git a/vike/node/createPageRenderer.ts b/vike/node/createPageRenderer.ts index 2212521316..2790e090d8 100644 --- a/vike/node/createPageRenderer.ts +++ b/vike/node/createPageRenderer.ts @@ -1,9 +1,9 @@ // TODO/v1-release: remove this file -//import { SsrEnv, setSsrEnv } from './ssrEnv.js' -import { renderPage } from './runtime/renderPage.js' -import { assertWarning } from './runtime/utils.js' -//import { importBuildWasLoaded } from './importBuild.js' +//import { SsrEnv, setSsrEnv } from './ssrEnv' +import { renderPage } from './runtime/renderPage' +import { assertWarning } from './runtime/utils' +//import { importBuildWasLoaded } from './importBuild' export { createPageRenderer } diff --git a/vike/node/plugin/index.ts b/vike/node/plugin/index.ts index 6ce52b69fe..a6f92a016b 100644 --- a/vike/node/plugin/index.ts +++ b/vike/node/plugin/index.ts @@ -3,33 +3,33 @@ export { plugin } // TODO/v1-release: remove export { plugin as ssr } export type { ConfigVikeUserProvided as UserConfig } -export { PROJECT_VERSION as version } from './utils.js' +export { PROJECT_VERSION as version } from './utils' import { version, type Plugin } from 'vite' -import { assertNodeEnv_onVikePluginLoad, assertUsage, assertVersion, markEnvAsVikePluginLoaded } from './utils.js' -import { buildConfig } from './plugins/buildConfig.js' -import { previewConfig } from './plugins/previewConfig.js' -import { autoFullBuild } from './plugins/autoFullBuild.js' -import { devConfig } from './plugins/devConfig/index.js' -import { packageJsonFile } from './plugins/packageJsonFile.js' -import { removeRequireHookPlugin } from './plugins/removeRequireHookPlugin.js' -import { importUserCode } from './plugins/importUserCode/index.js' -import { resolveVikeConfig } from './plugins/config/index.js' -import type { ConfigVikeUserProvided } from '../../shared/ConfigVike.js' -import { distFileNames } from './plugins/distFileNames.js' -import { extractAssetsPlugin } from './plugins/extractAssetsPlugin.js' -import { extractExportNamesPlugin } from './plugins/extractExportNamesPlugin.js' -import { suppressRollupWarning } from './plugins/suppressRollupWarning.js' -import { setGlobalContext } from './plugins/setGlobalContext.js' -import { importBuild } from './plugins/importBuild/index.js' -import { commonConfig } from './plugins/commonConfig.js' -import { baseUrls } from './plugins/baseUrls.js' -import { envVarsPlugin } from './plugins/envVars.js' +import { assertNodeEnv_onVikePluginLoad, assertUsage, assertVersion, markEnvAsVikePluginLoaded } from './utils' +import { buildConfig } from './plugins/buildConfig' +import { previewConfig } from './plugins/previewConfig' +import { autoFullBuild } from './plugins/autoFullBuild' +import { devConfig } from './plugins/devConfig/index' +import { packageJsonFile } from './plugins/packageJsonFile' +import { removeRequireHookPlugin } from './plugins/removeRequireHookPlugin' +import { importUserCode } from './plugins/importUserCode/index' +import { resolveVikeConfig } from './plugins/config/index' +import type { ConfigVikeUserProvided } from '../../shared/ConfigVike' +import { distFileNames } from './plugins/distFileNames' +import { extractAssetsPlugin } from './plugins/extractAssetsPlugin' +import { extractExportNamesPlugin } from './plugins/extractExportNamesPlugin' +import { suppressRollupWarning } from './plugins/suppressRollupWarning' +import { setGlobalContext } from './plugins/setGlobalContext' +import { importBuild } from './plugins/importBuild/index' +import { commonConfig } from './plugins/commonConfig' +import { baseUrls } from './plugins/baseUrls' +import { envVarsPlugin } from './plugins/envVars' import pc from '@brillout/picocolors' -import { fileEnv } from './plugins/fileEnv.js' -import { setResolveClientEntriesDev } from '../runtime/renderPage/getPageAssets.js' -import { resolveClientEntriesDev } from './resolveClientEntriesDev.js' -import { workaroundCssModuleHmr } from './plugins/workaroundCssModuleHmr.js' +import { fileEnv } from './plugins/fileEnv' +import { setResolveClientEntriesDev } from '../runtime/renderPage/getPageAssets' +import { resolveClientEntriesDev } from './resolveClientEntriesDev' +import { workaroundCssModuleHmr } from './plugins/workaroundCssModuleHmr' assertNodeEnv_onVikePluginLoad() markEnvAsVikePluginLoaded() diff --git a/vike/node/plugin/onLoad.ts b/vike/node/plugin/onLoad.ts index ba4d541323..2c7e64a0ed 100644 --- a/vike/node/plugin/onLoad.ts +++ b/vike/node/plugin/onLoad.ts @@ -1,8 +1,8 @@ export { onLoad } -import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser.js' -import { assertIsNotProductionRuntime } from '../../utils/assertIsNotProductionRuntime.js' -import { assertNodeVersion } from '../../utils/assertNodeVersion.js' +import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser' +import { assertIsNotProductionRuntime } from '../../utils/assertIsNotProductionRuntime' +import { assertNodeVersion } from '../../utils/assertNodeVersion' function onLoad() { assertIsNotBrowser() diff --git a/vike/node/plugin/plugins/autoFullBuild.ts b/vike/node/plugin/plugins/autoFullBuild.ts index ffd4d65634..812b161daf 100644 --- a/vike/node/plugin/plugins/autoFullBuild.ts +++ b/vike/node/plugin/plugins/autoFullBuild.ts @@ -2,14 +2,14 @@ export { autoFullBuild } import { build } from 'vite' import type { InlineConfig, Plugin, ResolvedConfig } from 'vite' -import { assertWarning } from '../utils.js' -import { runPrerenderFromAutoFullBuild, runPrerender_forceExit } from '../../prerender/runPrerender.js' -import { getConfigVike } from '../../shared/getConfigVike.js' -import type { ConfigVikeResolved } from '../../../shared/ConfigVike.js' -import { isViteCliCall, getViteConfigFromCli } from '../shared/isViteCliCall.js' +import { assertWarning } from '../utils' +import { runPrerenderFromAutoFullBuild, runPrerender_forceExit } from '../../prerender/runPrerender' +import { getConfigVike } from '../../shared/getConfigVike' +import type { ConfigVikeResolved } from '../../../shared/ConfigVike' +import { isViteCliCall, getViteConfigFromCli } from '../shared/isViteCliCall' import pc from '@brillout/picocolors' -import { logErrorHint } from '../../runtime/renderPage/logErrorHint.js' -import { manifestTempFile } from './buildConfig.js' +import { logErrorHint } from '../../runtime/renderPage/logErrorHint' +import { manifestTempFile } from './buildConfig' let forceExit = false diff --git a/vike/node/plugin/plugins/baseUrls.ts b/vike/node/plugin/plugins/baseUrls.ts index 1a5e364e99..482eb18268 100644 --- a/vike/node/plugin/plugins/baseUrls.ts +++ b/vike/node/plugin/plugins/baseUrls.ts @@ -1,10 +1,10 @@ export { baseUrls } import type { Plugin } from 'vite' -import { resolveBaseFromUserConfig } from '../plugins/config/resolveBase.js' -import { assert } from '../utils.js' -import { getConfigVike } from '../../shared/getConfigVike.js' -import type { ConfigVikeUserProvided } from '../../../shared/ConfigVike.js' +import { resolveBaseFromUserConfig } from '../plugins/config/resolveBase' +import { assert } from '../utils' +import { getConfigVike } from '../../shared/getConfigVike' +import type { ConfigVikeUserProvided } from '../../../shared/ConfigVike' function baseUrls(configVike?: ConfigVikeUserProvided): Plugin { let baseServer: string diff --git a/vike/node/plugin/plugins/buildConfig.ts b/vike/node/plugin/plugins/buildConfig.ts index c1ef089dc9..34e8d8ddf8 100644 --- a/vike/node/plugin/plugins/buildConfig.ts +++ b/vike/node/plugin/plugins/buildConfig.ts @@ -17,23 +17,23 @@ import { type OutDirs, assertNodeEnv_build, assertIsNpmPackageImport -} from '../utils.js' -import { getVikeConfig, isV1Design } from './importUserCode/v1-design/getVikeConfig.js' -import { findPageFiles } from '../shared/findPageFiles.js' -import { getConfigVike } from '../../shared/getConfigVike.js' +} from '../utils' +import { getVikeConfig, isV1Design } from './importUserCode/v1-design/getVikeConfig' +import { findPageFiles } from '../shared/findPageFiles' +import { getConfigVike } from '../../shared/getConfigVike' import type { ResolvedConfig, Plugin, UserConfig } from 'vite' -import { getVirtualFileIdPageConfigValuesAll } from '../../shared/virtual-files/virtualFilePageConfigValuesAll.js' -import type { PageConfigBuildTime } from '../../../shared/page-configs/PageConfig.js' -import type { FileType } from '../../../shared/getPageFiles/fileTypes.js' -import { extractAssetsAddQuery } from '../../shared/extractAssetsQuery.js' +import { getVirtualFileIdPageConfigValuesAll } from '../../shared/virtual-files/virtualFilePageConfigValuesAll' +import type { PageConfigBuildTime } from '../../../shared/page-configs/PageConfig' +import type { FileType } from '../../../shared/getPageFiles/fileTypes' +import { extractAssetsAddQuery } from '../../shared/extractAssetsQuery' import { createRequire } from 'module' import fs from 'fs/promises' import path from 'path' -import { fixServerAssets, fixServerAssets_isEnabled } from './buildConfig/fixServerAssets.js' -import { set_ASSETS_MAP } from './importBuild/index.js' -import { prependEntriesDir } from '../../shared/prependEntriesDir.js' -import { getFilePathResolved } from '../shared/getFilePath.js' -import { getConfigValueBuildTime } from '../../../shared/page-configs/getConfigValueBuildTime.js' +import { fixServerAssets, fixServerAssets_isEnabled } from './buildConfig/fixServerAssets' +import { set_ASSETS_MAP } from './importBuild/index' +import { prependEntriesDir } from '../../shared/prependEntriesDir' +import { getFilePathResolved } from '../shared/getFilePath' +import { getConfigValueBuildTime } from '../../../shared/page-configs/getConfigValueBuildTime' // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build. const importMetaUrl: string = import.meta.url const require_ = createRequire(importMetaUrl) diff --git a/vike/node/plugin/plugins/buildConfig/fixServerAssets.ts b/vike/node/plugin/plugins/buildConfig/fixServerAssets.ts index 321b0041ce..f9cde15277 100644 --- a/vike/node/plugin/plugins/buildConfig/fixServerAssets.ts +++ b/vike/node/plugin/plugins/buildConfig/fixServerAssets.ts @@ -4,12 +4,12 @@ export { fixServerAssets_isEnabled } import fs from 'fs/promises' import path from 'path' import { existsSync } from 'fs' -import { ViteManifest, ViteManifestEntry } from '../../../shared/ViteManifest.js' -import { assert, getOutDirs, pLimit, unique } from '../../utils.js' -import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll.js' -import { manifestTempFile } from '../buildConfig.js' +import { ViteManifest, ViteManifestEntry } from '../../../shared/ViteManifest' +import { assert, getOutDirs, pLimit, unique } from '../../utils' +import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll' +import { manifestTempFile } from '../buildConfig' import { ResolvedConfig } from 'vite' -import { getAssetsDir } from '../../shared/getAssetsDir.js' +import { getAssetsDir } from '../../shared/getAssetsDir' /** * true => use workaround config.build.ssrEmitAssets diff --git a/vike/node/plugin/plugins/commonConfig.ts b/vike/node/plugin/plugins/commonConfig.ts index cf910b281c..ec6a62a1a2 100644 --- a/vike/node/plugin/plugins/commonConfig.ts +++ b/vike/node/plugin/plugins/commonConfig.ts @@ -1,12 +1,12 @@ export { commonConfig } import type { Plugin, ResolvedConfig } from 'vite' -import { assert, assertUsage, assertWarning, findPackageJson } from '../utils.js' -import { assertRollupInput } from './buildConfig.js' +import { assert, assertUsage, assertWarning, findPackageJson } from '../utils' +import { assertRollupInput } from './buildConfig' import { installRequireShim_setUserRootDir } from '@brillout/require-shim' import pc from '@brillout/picocolors' import path from 'path' -import { assertResolveAlias } from './commonConfig/assertResolveAlias.js' +import { assertResolveAlias } from './commonConfig/assertResolveAlias' const pluginName = 'vike:commonConfig-1' function commonConfig(): Plugin[] { diff --git a/vike/node/plugin/plugins/commonConfig/assertResolveAlias.ts b/vike/node/plugin/plugins/commonConfig/assertResolveAlias.ts index 62821f7f6d..277cb4401d 100644 --- a/vike/node/plugin/plugins/commonConfig/assertResolveAlias.ts +++ b/vike/node/plugin/plugins/commonConfig/assertResolveAlias.ts @@ -1,7 +1,7 @@ export { assertResolveAlias } import type { ResolvedConfig } from 'vite' -import { assert, assertUsage, assertWarning, isArray, isValidPathAlias } from '../../utils.js' +import { assert, assertUsage, assertWarning, isArray, isValidPathAlias } from '../../utils' import pc from '@brillout/picocolors' // Recommend users to avoid un-distinguishable path aliases. diff --git a/vike/node/plugin/plugins/config/assertVikeConfig.ts b/vike/node/plugin/plugins/config/assertVikeConfig.ts index b1edd7b1cb..95f2bc71ad 100644 --- a/vike/node/plugin/plugins/config/assertVikeConfig.ts +++ b/vike/node/plugin/plugins/config/assertVikeConfig.ts @@ -1,7 +1,7 @@ export { assertVikeConfig } -import { assert, assertUsage, hasProp, isObject } from '../../utils.js' -import type { ConfigVikeUserProvided } from '../../../../shared/ConfigVike.js' +import { assert, assertUsage, hasProp, isObject } from '../../utils' +import type { ConfigVikeUserProvided } from '../../../../shared/ConfigVike' type WrongUsage = { prop: string; errMsg: `should be a${string}` } diff --git a/vike/node/plugin/plugins/config/index.ts b/vike/node/plugin/plugins/config/index.ts index 502724e0ea..485f7fdda9 100644 --- a/vike/node/plugin/plugins/config/index.ts +++ b/vike/node/plugin/plugins/config/index.ts @@ -1,12 +1,12 @@ export { resolveVikeConfig } import type { Plugin, ResolvedConfig } from 'vite' -import type { ConfigVikeUserProvided, ConfigVikeResolved } from '../../../../shared/ConfigVike.js' -import { assertVikeConfig } from './assertVikeConfig.js' -import { isDev2 } from '../../utils.js' -import { pickFirst } from './pickFirst.js' -import { resolveBase } from './resolveBase.js' -import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig.js' +import type { ConfigVikeUserProvided, ConfigVikeResolved } from '../../../../shared/ConfigVike' +import { assertVikeConfig } from './assertVikeConfig' +import { isDev2 } from '../../utils' +import { pickFirst } from './pickFirst' +import { resolveBase } from './resolveBase' +import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig' import pc from '@brillout/picocolors' function resolveVikeConfig(vikeConfig: unknown): Plugin { diff --git a/vike/node/plugin/plugins/config/resolveBase.ts b/vike/node/plugin/plugins/config/resolveBase.ts index 26eeb0b48e..91330a7fa3 100644 --- a/vike/node/plugin/plugins/config/resolveBase.ts +++ b/vike/node/plugin/plugins/config/resolveBase.ts @@ -1,10 +1,10 @@ export { resolveBase } export { resolveBaseFromUserConfig } -import { assert, assertUsage, isBaseServer, isBaseAssets } from '../../utils.js' +import { assert, assertUsage, isBaseServer, isBaseAssets } from '../../utils' import type { ResolvedConfig, UserConfig } from 'vite' -import type { ConfigVikeUserProvided } from '../../../../shared/ConfigVike.js' -import { pickFirst } from './pickFirst.js' +import type { ConfigVikeUserProvided } from '../../../../shared/ConfigVike' +import { pickFirst } from './pickFirst' import pc from '@brillout/picocolors' type BaseServers = { diff --git a/vike/node/plugin/plugins/devConfig/determineFsAllowList.ts b/vike/node/plugin/plugins/devConfig/determineFsAllowList.ts index 26ef556ab3..e87a23e4cb 100644 --- a/vike/node/plugin/plugins/devConfig/determineFsAllowList.ts +++ b/vike/node/plugin/plugins/devConfig/determineFsAllowList.ts @@ -3,7 +3,7 @@ export { determineFsAllowList } import { searchForWorkspaceRoot } from 'vite' import type { ResolvedConfig } from 'vite' import path from 'path' -import { assert } from '../../utils.js' +import { assert } from '../../utils' import { createRequire } from 'module' import { dirname } from 'path' import { fileURLToPath } from 'url' diff --git a/vike/node/plugin/plugins/devConfig/determineOptimizeDeps.ts b/vike/node/plugin/plugins/devConfig/determineOptimizeDeps.ts index 0552140241..d6bfa153f2 100644 --- a/vike/node/plugin/plugins/devConfig/determineOptimizeDeps.ts +++ b/vike/node/plugin/plugins/devConfig/determineOptimizeDeps.ts @@ -1,16 +1,16 @@ export { determineOptimizeDeps } import type { ResolvedConfig } from 'vite' -import { findPageFiles } from '../../shared/findPageFiles.js' -import { assert, assertIsNpmPackageImport, createDebugger, isArray, unique } from '../../utils.js' -import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig.js' -import { analyzeClientEntries } from '../buildConfig.js' -import type { PageConfigBuildTime } from '../../../../shared/page-configs/PageConfig.js' +import { findPageFiles } from '../../shared/findPageFiles' +import { assert, assertIsNpmPackageImport, createDebugger, isArray, unique } from '../../utils' +import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig' +import { analyzeClientEntries } from '../buildConfig' +import type { PageConfigBuildTime } from '../../../../shared/page-configs/PageConfig' import { virtualFileIdImportUserCodeClientCR, virtualFileIdImportUserCodeClientSR -} from '../../../shared/virtual-files/virtualFileImportUserCode.js' -import { getFilePathResolved } from '../../shared/getFilePath.js' +} from '../../../shared/virtual-files/virtualFileImportUserCode' +import { getFilePathResolved } from '../../shared/getFilePath' const debug = createDebugger('vike:optimizeDeps') diff --git a/vike/node/plugin/plugins/devConfig/index.ts b/vike/node/plugin/plugins/devConfig/index.ts index 4cad9970f4..ba6198f7dc 100644 --- a/vike/node/plugin/plugins/devConfig/index.ts +++ b/vike/node/plugin/plugins/devConfig/index.ts @@ -1,13 +1,13 @@ export { devConfig } import type { Plugin, ResolvedConfig, UserConfig } from 'vite' -import { determineOptimizeDeps } from './determineOptimizeDeps.js' -import { determineFsAllowList } from './determineFsAllowList.js' -import { addSsrMiddleware } from '../../shared/addSsrMiddleware.js' -import { markEnvAsViteDev } from '../../utils.js' -import { improveViteLogs } from '../../shared/loggerVite.js' -import { isErrorDebug } from '../../../shared/isErrorDebug.js' -import { installHttpRequestAsyncStore } from '../../shared/getHttpRequestAsyncStore.js' +import { determineOptimizeDeps } from './determineOptimizeDeps' +import { determineFsAllowList } from './determineFsAllowList' +import { addSsrMiddleware } from '../../shared/addSsrMiddleware' +import { markEnvAsViteDev } from '../../utils' +import { improveViteLogs } from '../../shared/loggerVite' +import { isErrorDebug } from '../../../shared/isErrorDebug' +import { installHttpRequestAsyncStore } from '../../shared/getHttpRequestAsyncStore' if (isErrorDebug()) { Error.stackTraceLimit = Infinity diff --git a/vike/node/plugin/plugins/distFileNames.ts b/vike/node/plugin/plugins/distFileNames.ts index 4a0c586ae1..599212f286 100644 --- a/vike/node/plugin/plugins/distFileNames.ts +++ b/vike/node/plugin/plugins/distFileNames.ts @@ -4,12 +4,12 @@ export { distFileNames } // - https://github.com/vikejs/vike/commit/11a4c49e5403aa7c37c8020c462b499425b41854 // - Blocker: https://github.com/rollup/rollup/issues/4724 -import { assertPosixPath, assert, assertUsage, isArray, isCallable } from '../utils.js' +import { assertPosixPath, assert, assertUsage, isArray, isCallable } from '../utils' import path from 'path' import crypto from 'crypto' import type { Plugin, ResolvedConfig, Rollup } from 'vite' -import { getAssetsDir } from '../shared/getAssetsDir.js' -import { assertModuleId, getModuleFilePathAbsolute } from '../shared/getFilePath.js' +import { getAssetsDir } from '../shared/getAssetsDir' +import { assertModuleId, getModuleFilePathAbsolute } from '../shared/getFilePath' type PreRenderedChunk = Rollup.PreRenderedChunk type PreRenderedAsset = Rollup.PreRenderedAsset diff --git a/vike/node/plugin/plugins/envVars.ts b/vike/node/plugin/plugins/envVars.ts index dbef4dce65..6ba791cfc2 100644 --- a/vike/node/plugin/plugins/envVars.ts +++ b/vike/node/plugin/plugins/envVars.ts @@ -2,10 +2,10 @@ export { envVarsPlugin } import type { Plugin, ResolvedConfig } from 'vite' import { loadEnv } from 'vite' -import { assert, assertPosixPath, assertUsage, assertWarning, escapeRegex, isArray, lowerFirst } from '../utils.js' -import { sourceMapPassthrough } from '../shared/rollupSourceMap.js' -import { getModuleFilePathAbsolute } from '../shared/getFilePath.js' -import { normalizeId } from '../shared/normalizeId.js' +import { assert, assertPosixPath, assertUsage, assertWarning, escapeRegex, isArray, lowerFirst } from '../utils' +import { sourceMapPassthrough } from '../shared/rollupSourceMap' +import { getModuleFilePathAbsolute } from '../shared/getFilePath' +import { normalizeId } from '../shared/normalizeId' // TODO/enventually: (after we implemented vike.config.js) // - Make import.meta.env work inside +config.js diff --git a/vike/node/plugin/plugins/extractAssetsPlugin.ts b/vike/node/plugin/plugins/extractAssetsPlugin.ts index 9fb4aadc26..51456ff08a 100644 --- a/vike/node/plugin/plugins/extractAssetsPlugin.ts +++ b/vike/node/plugin/plugins/extractAssetsPlugin.ts @@ -21,19 +21,19 @@ import { isVirtualFileId, getVirtualFileId, assertUsage -} from '../utils.js' -import { extractAssetsAddQuery } from '../../shared/extractAssetsQuery.js' -import { getConfigVike } from '../../shared/getConfigVike.js' -import type { ConfigVikeResolved } from '../../../shared/ConfigVike.js' -import { isAsset } from '../shared/isAsset.js' -import { getImportStatements, type ImportStatement } from '../shared/parseEsModule.js' -import { sourceMapRemove } from '../shared/rollupSourceMap.js' +} from '../utils' +import { extractAssetsAddQuery } from '../../shared/extractAssetsQuery' +import { getConfigVike } from '../../shared/getConfigVike' +import type { ConfigVikeResolved } from '../../../shared/ConfigVike' +import { isAsset } from '../shared/isAsset' +import { getImportStatements, type ImportStatement } from '../shared/parseEsModule' +import { sourceMapRemove } from '../shared/rollupSourceMap' import type { Rollup } from 'vite' import pc from '@brillout/picocolors' -import { fixServerAssets_isEnabled } from './buildConfig/fixServerAssets.js' -import { getVikeConfig, isV1Design, type VikeConfigObject } from './importUserCode/v1-design/getVikeConfig.js' -import { assertV1Design } from '../../shared/assertV1Design.js' -import { normalizeId } from '../shared/normalizeId.js' +import { fixServerAssets_isEnabled } from './buildConfig/fixServerAssets' +import { getVikeConfig, isV1Design, type VikeConfigObject } from './importUserCode/v1-design/getVikeConfig' +import { assertV1Design } from '../../shared/assertV1Design' +import { normalizeId } from '../shared/normalizeId' type ResolvedId = Rollup.ResolvedId const extractAssetsRE = /(\?|&)extractAssets(?:&|$)/ diff --git a/vike/node/plugin/plugins/extractExportNamesPlugin.ts b/vike/node/plugin/plugins/extractExportNamesPlugin.ts index 9569b206d7..cc5c0fb3af 100644 --- a/vike/node/plugin/plugins/extractExportNamesPlugin.ts +++ b/vike/node/plugin/plugins/extractExportNamesPlugin.ts @@ -3,10 +3,10 @@ export { isUsingClientRouter } export { extractExportNamesRE } import type { Plugin } from 'vite' -import { assert, getFileExtension, viteIsSSR_options, createDebugger, getGlobalObject, assertUsage } from '../utils.js' -import { getExportNames } from '../shared/parseEsModule.js' -import { sourceMapRemove } from '../shared/rollupSourceMap.js' -import { normalizeId } from '../shared/normalizeId.js' +import { assert, getFileExtension, viteIsSSR_options, createDebugger, getGlobalObject, assertUsage } from '../utils' +import { getExportNames } from '../shared/parseEsModule' +import { sourceMapRemove } from '../shared/rollupSourceMap' +import { normalizeId } from '../shared/normalizeId' const extractExportNamesRE = /(\?|&)extractExportNames(?:&|$)/ const debug = createDebugger('vike:extractExportNames') const globalObject = getGlobalObject<{ usesClientRouter?: true }>('extractExportNamesPlugin.ts', {}) diff --git a/vike/node/plugin/plugins/fileEnv.ts b/vike/node/plugin/plugins/fileEnv.ts index 3baaf12b27..100937f38f 100644 --- a/vike/node/plugin/plugins/fileEnv.ts +++ b/vike/node/plugin/plugins/fileEnv.ts @@ -6,14 +6,14 @@ export { fileEnv } // - SvelteKit: https://github.com/sveltejs/kit/blob/6ea7abbc2f66e46cb83ff95cd459a5f548cb7e1e/packages/kit/src/exports/vite/index.js#L383-L401 import type { Plugin, ResolvedConfig, ViteDevServer } from 'vite' -import { assert, assertUsage, assertWarning, capitalizeFirstLetter, joinEnglish } from '../utils.js' -import { extractAssetsRE } from './extractAssetsPlugin.js' -import { extractExportNamesRE } from './extractExportNamesPlugin.js' +import { assert, assertUsage, assertWarning, capitalizeFirstLetter, joinEnglish } from '../utils' +import { extractAssetsRE } from './extractAssetsPlugin' +import { extractExportNamesRE } from './extractExportNamesPlugin' import pc from '@brillout/picocolors' -import { getModuleFilePathAbsolute } from '../shared/getFilePath.js' -import { sourceMapRemove } from '../shared/rollupSourceMap.js' -import { getExportNames } from '../shared/parseEsModule.js' -import { normalizeId } from '../shared/normalizeId.js' +import { getModuleFilePathAbsolute } from '../shared/getFilePath' +import { sourceMapRemove } from '../shared/rollupSourceMap' +import { getExportNames } from '../shared/parseEsModule' +import { normalizeId } from '../shared/normalizeId' function fileEnv(): Plugin { let config: ResolvedConfig diff --git a/vike/node/plugin/plugins/importBuild/getVikeManifest.ts b/vike/node/plugin/plugins/importBuild/getVikeManifest.ts index 002ed54a5f..943f73b334 100644 --- a/vike/node/plugin/plugins/importBuild/getVikeManifest.ts +++ b/vike/node/plugin/plugins/importBuild/getVikeManifest.ts @@ -1,10 +1,10 @@ export { getVikeManifest } -import { projectInfo } from '../../utils.js' -import { type PluginManifest, assertPluginManifest } from '../../../shared/assertPluginManifest.js' -import { isUsingClientRouter } from '../extractExportNamesPlugin.js' -import type { ConfigVikeResolved } from '../../../../shared/ConfigVike.js' -import { getRuntimeManifest } from '../../../runtime/globalContext.js' +import { projectInfo } from '../../utils' +import { type PluginManifest, assertPluginManifest } from '../../../shared/assertPluginManifest' +import { isUsingClientRouter } from '../extractExportNamesPlugin' +import type { ConfigVikeResolved } from '../../../../shared/ConfigVike' +import { getRuntimeManifest } from '../../../runtime/globalContext' function getVikeManifest(configVike: ConfigVikeResolved): PluginManifest { const runtimeManifest = getRuntimeManifest(configVike) diff --git a/vike/node/plugin/plugins/importBuild/index.ts b/vike/node/plugin/plugins/importBuild/index.ts index f69e8c3f6f..64f6f5e5c3 100644 --- a/vike/node/plugin/plugins/importBuild/index.ts +++ b/vike/node/plugin/plugins/importBuild/index.ts @@ -3,14 +3,14 @@ export { set_ASSETS_MAP } import type { Plugin, ResolvedConfig, Rollup } from 'vite' import { serverProductionEntryPlugin } from '@brillout/vite-plugin-server-entry/plugin' -import { assert, getOutDirs, toPosixPath } from '../../utils.js' +import { assert, getOutDirs, toPosixPath } from '../../utils' import path from 'path' import { createRequire } from 'module' -import { getConfigVike } from '../../../shared/getConfigVike.js' -import type { ConfigVikeResolved } from '../../../../shared/ConfigVike.js' -import { getVikeManifest } from './getVikeManifest.js' +import { getConfigVike } from '../../../shared/getConfigVike' +import type { ConfigVikeResolved } from '../../../../shared/ConfigVike' +import { getVikeManifest } from './getVikeManifest' import fs from 'fs/promises' -import { virtualFileIdImportUserCodeServer } from '../../../shared/virtual-files/virtualFileImportUserCode.js' +import { virtualFileIdImportUserCodeServer } from '../../../shared/virtual-files/virtualFileImportUserCode' // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build. const importMetaUrl: string = import.meta.url const require_ = createRequire(importMetaUrl) diff --git a/vike/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.ts b/vike/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.ts index 4d6df65e01..2a39d25a04 100644 --- a/vike/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.ts +++ b/vike/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.ts @@ -16,14 +16,14 @@ import { getOutDirs, isVersionOrAbove, assertWarning -} from '../../utils.js' -import type { ConfigVikeResolved } from '../../../../shared/ConfigVike.js' -import { isVirtualFileIdImportUserCode } from '../../../shared/virtual-files/virtualFileImportUserCode.js' +} from '../../utils' +import type { ConfigVikeResolved } from '../../../../shared/ConfigVike' +import { isVirtualFileIdImportUserCode } from '../../../shared/virtual-files/virtualFileImportUserCode' import { version as viteVersion } from 'vite' -import { type FileType, fileTypes } from '../../../../shared/getPageFiles/fileTypes.js' +import { type FileType, fileTypes } from '../../../../shared/getPageFiles/fileTypes' import path from 'path' -import { getVirtualFilePageConfigs } from './v1-design/getVirtualFilePageConfigs.js' -import { isV1Design as isV1Design_ } from './v1-design/getVikeConfig.js' +import { getVirtualFilePageConfigs } from './v1-design/getVirtualFilePageConfigs' +import { isV1Design as isV1Design_ } from './v1-design/getVikeConfig' type GlobRoot = { includeDir: string // slash-terminated diff --git a/vike/node/plugin/plugins/importUserCode/index.ts b/vike/node/plugin/plugins/importUserCode/index.ts index d1c5972215..6dcb89c790 100644 --- a/vike/node/plugin/plugins/importUserCode/index.ts +++ b/vike/node/plugin/plugins/importUserCode/index.ts @@ -2,10 +2,10 @@ export { importUserCode } import type { Plugin, ResolvedConfig, HmrContext, ViteDevServer, ModuleNode } from 'vite' import { normalizePath } from 'vite' -import type { ConfigVikeResolved } from '../../../../shared/ConfigVike.js' -import { getConfigVike } from '../../../shared/getConfigVike.js' -import { getVirtualFilePageConfigValuesAll } from './v1-design/getVirtualFilePageConfigValuesAll.js' -import { getVirtualFileImportUserCode } from './getVirtualFileImportUserCode.js' +import type { ConfigVikeResolved } from '../../../../shared/ConfigVike' +import { getConfigVike } from '../../../shared/getConfigVike' +import { getVirtualFilePageConfigValuesAll } from './v1-design/getVirtualFilePageConfigValuesAll' +import { getVirtualFileImportUserCode } from './getVirtualFileImportUserCode' import { assert, assertPosixPath, @@ -14,13 +14,13 @@ import { isDev3, isVirtualFileId, resolveVirtualFileId -} from '../../utils.js' -import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll.js' -import { isVirtualFileIdImportUserCode } from '../../../shared/virtual-files/virtualFileImportUserCode.js' -import { vikeConfigDependencies, reloadVikeConfig, isVikeConfigFile, isV1Design } from './v1-design/getVikeConfig.js' +} from '../../utils' +import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll' +import { isVirtualFileIdImportUserCode } from '../../../shared/virtual-files/virtualFileImportUserCode' +import { vikeConfigDependencies, reloadVikeConfig, isVikeConfigFile, isV1Design } from './v1-design/getVikeConfig' import pc from '@brillout/picocolors' -import { logConfigInfo } from '../../shared/loggerNotProd.js' -import { getModuleFilePathAbsolute } from '../../shared/getFilePath.js' +import { logConfigInfo } from '../../shared/loggerNotProd' +import { getModuleFilePathAbsolute } from '../../shared/getFilePath' function importUserCode(): Plugin { let config: ResolvedConfig diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/assertExtensions.ts b/vike/node/plugin/plugins/importUserCode/v1-design/assertExtensions.ts index c1d2e64375..34c2bce686 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/assertExtensions.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/assertExtensions.ts @@ -2,9 +2,9 @@ export { assertExtensionsConventions } export { assertExtensionsPeerDependencies } import pc from '@brillout/picocolors' -import { isObjectOfStrings } from '../../../../../utils/isObjectOfStrings.js' -import { PROJECT_VERSION, assert, assertUsage, assertWarning, findPackageJson } from '../../../utils.js' -import { getConfigValueInterfaceFile, type InterfaceFile } from './getVikeConfig.js' +import { isObjectOfStrings } from '../../../../../utils/isObjectOfStrings' +import { PROJECT_VERSION, assert, assertUsage, assertWarning, findPackageJson } from '../../../utils' +import { getConfigValueInterfaceFile, type InterfaceFile } from './getVikeConfig' import path from 'path' import semver from 'semver' diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/debug.ts b/vike/node/plugin/plugins/importUserCode/v1-design/debug.ts index aeb76e8485..41333f0b37 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/debug.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/debug.ts @@ -1,2 +1,2 @@ -import { createDebugger } from '../../../utils.js' +import { createDebugger } from '../../../utils' export const debug = createDebugger('vike:virtual-files') diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.ts index 8e5ff1f7a5..9d80edf42a 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.ts @@ -1,8 +1,8 @@ export { getConfigFileExport } import pc from '@brillout/picocolors' -import { assertPlusFileExport } from '../../../../../shared/page-configs/assertPlusFileExport.js' -import { assertUsage, isObject } from '../../../utils.js' +import { assertPlusFileExport } from '../../../../../shared/page-configs/assertPlusFileExport' +import { assertUsage, isObject } from '../../../utils' function getConfigFileExport( fileExports: Record, diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.ts index f53b7b0996..f031391e7d 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.ts @@ -28,7 +28,7 @@ import { makeFirst, isNpmPackageImport, reverse -} from '../../../utils.js' +} from '../../../utils' import path from 'path' import type { PageConfigGlobalBuildTime, @@ -38,15 +38,15 @@ import type { PageConfigBuildTime, DefinedAtFilePath, ConfigValuesComputed -} from '../../../../../shared/page-configs/PageConfig.js' -import type { Config } from '../../../../../shared/page-configs/Config.js' +} from '../../../../../shared/page-configs/PageConfig' +import type { Config } from '../../../../../shared/page-configs/Config' import { configDefinitionsBuiltIn, configDefinitionsBuiltInGlobal, type ConfigDefinitions, type ConfigDefinitionInternal, type ConfigNameGlobal -} from './getVikeConfig/configDefinitionsBuiltIn.js' +} from './getVikeConfig/configDefinitionsBuiltIn' import { type LocationId, getLocationId, @@ -56,33 +56,33 @@ import { sortAfterInheritanceOrder, isGlobalLocation, applyFilesystemRoutingRootEffect -} from './getVikeConfig/filesystemRouting.js' -import { isTemporaryBuildFile } from './getVikeConfig/transpileAndExecuteFile.js' -import { isConfigInvalid, isConfigInvalid_set } from '../../../../runtime/renderPage/isConfigInvalid.js' -import { getViteDevServer } from '../../../../runtime/globalContext.js' -import { logConfigError, logConfigErrorRecover } from '../../../shared/loggerNotProd.js' +} from './getVikeConfig/filesystemRouting' +import { isTemporaryBuildFile } from './getVikeConfig/transpileAndExecuteFile' +import { isConfigInvalid, isConfigInvalid_set } from '../../../../runtime/renderPage/isConfigInvalid' +import { getViteDevServer } from '../../../../runtime/globalContext' +import { logConfigError, logConfigErrorRecover } from '../../../shared/loggerNotProd' import { removeSuperfluousViteLog_enable, removeSuperfluousViteLog_disable -} from '../../../shared/loggerVite/removeSuperfluousViteLog.js' +} from '../../../shared/loggerVite/removeSuperfluousViteLog' import pc from '@brillout/picocolors' -import { getConfigDefinedAt } from '../../../../../shared/page-configs/getConfigDefinedAt.js' +import { getConfigDefinedAt } from '../../../../../shared/page-configs/getConfigDefinedAt' import type { ResolvedConfig } from 'vite' -import { crawlPlusFiles } from './getVikeConfig/crawlPlusFiles.js' -import { getConfigFileExport } from './getConfigFileExport.js' +import { crawlPlusFiles } from './getVikeConfig/crawlPlusFiles' +import { getConfigFileExport } from './getConfigFileExport' import { type ConfigFile, ImportedFilesLoaded, loadConfigFile, loadImportedFile, loadValueFile -} from './getVikeConfig/loadFileAtConfigTime.js' -import { clearFilesEnvMap, resolvePointerImportOfConfig } from './getVikeConfig/resolvePointerImport.js' -import { getFilePathResolved } from '../../../shared/getFilePath.js' -import type { FilePathResolved } from '../../../../../shared/page-configs/FilePath.js' -import { getConfigValueBuildTime } from '../../../../../shared/page-configs/getConfigValueBuildTime.js' -import { getConfigVike } from '../../../../shared/getConfigVike.js' -import { assertExtensionsPeerDependencies, assertExtensionsConventions } from './assertExtensions.js' +} from './getVikeConfig/loadFileAtConfigTime' +import { clearFilesEnvMap, resolvePointerImportOfConfig } from './getVikeConfig/resolvePointerImport' +import { getFilePathResolved } from '../../../shared/getFilePath' +import type { FilePathResolved } from '../../../../../shared/page-configs/FilePath' +import { getConfigValueBuildTime } from '../../../../../shared/page-configs/getConfigValueBuildTime' +import { getConfigVike } from '../../../../shared/getConfigVike' +import { assertExtensionsPeerDependencies, assertExtensionsConventions } from './assertExtensions' assertIsNotProductionRuntime() diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.ts index ebd885279d..8d30b69259 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.ts @@ -12,10 +12,10 @@ import type { ConfigValueSources, DefinedAtFilePath, ConfigValueSource -} from '../../../../../../shared/page-configs/PageConfig.js' -import type { Config, ConfigNameBuiltIn } from '../../../../../../shared/page-configs/Config.js' -import { assert, assertUsage } from '../../../../utils.js' -import { getConfigDefinedAt, type ConfigDefinedAt } from '../../../../../../shared/page-configs/getConfigDefinedAt.js' +} from '../../../../../../shared/page-configs/PageConfig' +import type { Config, ConfigNameBuiltIn } from '../../../../../../shared/page-configs/Config' +import { assert, assertUsage } from '../../../../utils' +import { getConfigDefinedAt, type ConfigDefinedAt } from '../../../../../../shared/page-configs/getConfigDefinedAt' // For users /** The meta definition of a config. diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.ts index 5cb4163a48..9584ca22b9 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.ts @@ -10,7 +10,7 @@ import { assertIsNotProductionRuntime, isVersionOrAbove, isScriptFile -} from '../../../../utils.js' +} from '../../../../utils' import path from 'path' import fs from 'fs/promises' import type { Stats } from 'fs' @@ -18,7 +18,7 @@ import glob from 'fast-glob' import { exec } from 'child_process' import { promisify } from 'util' import pc from '@brillout/picocolors' -import { isTemporaryBuildFile } from './transpileAndExecuteFile.js' +import { isTemporaryBuildFile } from './transpileAndExecuteFile' const execA = promisify(exec) const TOO_MANY_UNTRACKED_FILES = 5 diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.spec.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.spec.ts index 29d3947d0c..4ddc3e8e5c 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.spec.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.spec.ts @@ -3,7 +3,7 @@ import { isInherited as isInherited_, getLogicalPath as getLogicalPath_, type LocationId -} from './filesystemRouting.js' +} from './filesystemRouting' import { expect, describe, it } from 'vitest' describe('getLocationId()', () => { diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.ts index aaa0bd87b7..39076250d6 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.ts @@ -11,7 +11,7 @@ export type { LocationId } export { getLogicalPath } import pc from '@brillout/picocolors' -import { assert, assertIsNotProductionRuntime, assertPosixPath, assertWarning, higherFirst } from '../../../../utils.js' +import { assert, assertIsNotProductionRuntime, assertPosixPath, assertWarning, higherFirst } from '../../../../utils' assertIsNotProductionRuntime() /** diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.ts index c40f0277fb..539bf40ad5 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.ts @@ -6,15 +6,15 @@ export { loadConfigFile } export type { ImportedFilesLoaded } export type { ConfigFile } -import { assert, assertUsage, hasProp, assertIsNotProductionRuntime } from '../../../../utils.js' -import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js' -import { transpileAndExecuteFile } from './transpileAndExecuteFile.js' -import type { InterfaceValueFile } from '../getVikeConfig.js' -import { assertPlusFileExport } from '../../../../../../shared/page-configs/assertPlusFileExport.js' +import { assert, assertUsage, hasProp, assertIsNotProductionRuntime } from '../../../../utils' +import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath' +import { transpileAndExecuteFile } from './transpileAndExecuteFile' +import type { InterfaceValueFile } from '../getVikeConfig' +import { assertPlusFileExport } from '../../../../../../shared/page-configs/assertPlusFileExport' import pc from '@brillout/picocolors' -import { type PointerImportData, parsePointerImportData } from './transformPointerImports.js' -import { getConfigFileExport } from '../getConfigFileExport.js' -import { resolvePointerImport } from './resolvePointerImport.js' +import { type PointerImportData, parsePointerImportData } from './transformPointerImports' +import { getConfigFileExport } from '../getConfigFileExport' +import { resolvePointerImport } from './resolvePointerImport' assertIsNotProductionRuntime() diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.ts index 17f8554fd2..0371448aea 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.ts @@ -3,7 +3,7 @@ export { resolvePointerImport } export { clearFilesEnvMap } import pc from '@brillout/picocolors' -import type { ConfigEnvInternal, DefinedAtFilePath } from '../../../../../../shared/page-configs/PageConfig.js' +import type { ConfigEnvInternal, DefinedAtFilePath } from '../../../../../../shared/page-configs/PageConfig' import { assert, assertIsNpmPackageImport, @@ -12,15 +12,15 @@ import { deepEqual, isFilePathAbsolute, requireResolve -} from '../../../../utils.js' -import { type PointerImportData, parsePointerImportData } from './transformPointerImports.js' +} from '../../../../utils' +import { type PointerImportData, parsePointerImportData } from './transformPointerImports' import path from 'path' import { getFilePathAbsoluteUserRootDir, getFilePathResolved, getFilePathUnresolved -} from '../../../../shared/getFilePath.js' -import type { FilePath, FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js' +} from '../../../../shared/getFilePath' +import type { FilePath, FilePathResolved } from '../../../../../../shared/page-configs/FilePath' const filesEnvMap: Map = new Map() diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.spec.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.spec.ts index 890d55ee51..bd3d0de45d 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.spec.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.spec.ts @@ -1,5 +1,5 @@ import { expect, describe, it } from 'vitest' -import { transformPointerImports } from './transformPointerImports.js' +import { transformPointerImports } from './transformPointerImports' function t(code: string) { return transformPointerImports(code, '/fake-file.js', 'all', true) diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.ts index 30a4d00677..0eff741ea3 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.ts @@ -22,7 +22,7 @@ export type { PointerImportData } import { parse } from 'acorn' import type { Program, Identifier, ImportDeclaration } from 'estree' -import { assert, assertUsage, assertWarning, styleFileRE } from '../../../../utils.js' +import { assert, assertUsage, assertWarning, styleFileRE } from '../../../../utils' import pc from '@brillout/picocolors' function transformPointerImports( diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.ts index c644a133f2..1b876f0afd 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.ts @@ -30,12 +30,12 @@ import { createDebugger, assertFilePathAbsoluteFilesystem, assertIsNpmPackageImport -} from '../../../../utils.js' -import { transformPointerImports } from './transformPointerImports.js' -import { vikeConfigDependencies } from '../getVikeConfig.js' -import 'source-map-support/register.js' -import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js' -import { getFilePathAbsoluteUserRootDir } from '../../../../shared/getFilePath.js' +} from '../../../../utils' +import { transformPointerImports } from './transformPointerImports' +import { vikeConfigDependencies } from '../getVikeConfig' +import 'source-map-support/register' +import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath' +import { getFilePathAbsoluteUserRootDir } from '../../../../shared/getFilePath' import { createRequire } from 'module' // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build. const importMetaUrl: string = import.meta.url diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.ts index caa3a35d04..b4d6d3be21 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.ts @@ -1,20 +1,20 @@ export { getVirtualFilePageConfigValuesAll } -import { assert } from '../../../utils.js' -import type { PageConfigBuildTime } from '../../../../../shared/page-configs/PageConfig.js' +import { assert } from '../../../utils' +import type { PageConfigBuildTime } from '../../../../../shared/page-configs/PageConfig' import { getVirtualFileIdPageConfigValuesAll, isVirtualFileIdPageConfigValuesAll -} from '../../../../shared/virtual-files/virtualFilePageConfigValuesAll.js' -import { getVikeConfig } from './getVikeConfig.js' -import { extractAssetsAddQuery } from '../../../../shared/extractAssetsQuery.js' -import { debug } from './debug.js' -import { isRuntimeEnvMatch } from './isRuntimeEnvMatch.js' -import { serializeConfigValues } from '../../../../../shared/page-configs/serialize/serializeConfigValues.js' +} from '../../../../shared/virtual-files/virtualFilePageConfigValuesAll' +import { getVikeConfig } from './getVikeConfig' +import { extractAssetsAddQuery } from '../../../../shared/extractAssetsQuery' +import { debug } from './debug' +import { isRuntimeEnvMatch } from './isRuntimeEnvMatch' +import { serializeConfigValues } from '../../../../../shared/page-configs/serialize/serializeConfigValues' import type { ResolvedConfig } from 'vite' -import { getConfigVike } from '../../../../shared/getConfigVike.js' -import { fixServerAssets_isEnabled } from '../../buildConfig/fixServerAssets.js' -import { getConfigValueBuildTime } from '../../../../../shared/page-configs/getConfigValueBuildTime.js' +import { getConfigVike } from '../../../../shared/getConfigVike' +import { fixServerAssets_isEnabled } from '../../buildConfig/fixServerAssets' +import { getConfigValueBuildTime } from '../../../../../shared/page-configs/getConfigValueBuildTime' async function getVirtualFilePageConfigValuesAll(id: string, isDev: boolean, config: ResolvedConfig): Promise { const result = isVirtualFileIdPageConfigValuesAll(id) diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.ts b/vike/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.ts index 426c4d5f1b..0b01d088d1 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.ts @@ -1,11 +1,11 @@ export { getVirtualFilePageConfigs } -import type { PageConfigBuildTime, PageConfigGlobalBuildTime } from '../../../../../shared/page-configs/PageConfig.js' -import { getVirtualFileIdPageConfigValuesAll } from '../../../../shared/virtual-files/virtualFilePageConfigValuesAll.js' -import { debug } from './debug.js' -import { getVikeConfig } from './getVikeConfig.js' -import { isRuntimeEnvMatch } from './isRuntimeEnvMatch.js' -import { serializeConfigValues } from '../../../../../shared/page-configs/serialize/serializeConfigValues.js' +import type { PageConfigBuildTime, PageConfigGlobalBuildTime } from '../../../../../shared/page-configs/PageConfig' +import { getVirtualFileIdPageConfigValuesAll } from '../../../../shared/virtual-files/virtualFilePageConfigValuesAll' +import { debug } from './debug' +import { getVikeConfig } from './getVikeConfig' +import { isRuntimeEnvMatch } from './isRuntimeEnvMatch' +import { serializeConfigValues } from '../../../../../shared/page-configs/serialize/serializeConfigValues' import type { ResolvedConfig } from 'vite' async function getVirtualFilePageConfigs( diff --git a/vike/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.ts b/vike/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.ts index fc3c13bb2c..f2c682cb38 100644 --- a/vike/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.ts +++ b/vike/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.ts @@ -1,6 +1,6 @@ export { isRuntimeEnvMatch } -import type { ConfigEnvInternal } from '../../../../../shared/page-configs/PageConfig.js' +import type { ConfigEnvInternal } from '../../../../../shared/page-configs/PageConfig' function isRuntimeEnvMatch( configEnv: ConfigEnvInternal, diff --git a/vike/node/plugin/plugins/packageJsonFile.ts b/vike/node/plugin/plugins/packageJsonFile.ts index c660aa7de1..4f4423aa35 100644 --- a/vike/node/plugin/plugins/packageJsonFile.ts +++ b/vike/node/plugin/plugins/packageJsonFile.ts @@ -10,8 +10,8 @@ export { packageJsonFile } import type { Plugin, ResolvedConfig } from 'vite' -import { rollupIsEsm } from '../shared/rollupIsEsm.js' -import { viteIsSSR } from '../utils.js' +import { rollupIsEsm } from '../shared/rollupIsEsm' +import { viteIsSSR } from '../utils' function packageJsonFile(): Plugin { let config: ResolvedConfig diff --git a/vike/node/plugin/plugins/previewConfig.ts b/vike/node/plugin/plugins/previewConfig.ts index 13cd0c7373..c8db2bcb85 100644 --- a/vike/node/plugin/plugins/previewConfig.ts +++ b/vike/node/plugin/plugins/previewConfig.ts @@ -1,13 +1,13 @@ export { previewConfig } import type { Plugin, ResolvedConfig } from 'vite' -import { assertUsage, getOutDirs, resolveOutDir, markEnvAsVitePreview } from '../utils.js' -import { getConfigVike } from '../../shared/getConfigVike.js' +import { assertUsage, getOutDirs, resolveOutDir, markEnvAsVitePreview } from '../utils' +import { getConfigVike } from '../../shared/getConfigVike' import fs from 'fs' import path from 'path' import type { ViteDevServer } from 'vite' -import type { ConfigVikeResolved } from '../../../shared/ConfigVike.js' -import { addSsrMiddleware } from '../shared/addSsrMiddleware.js' +import type { ConfigVikeResolved } from '../../../shared/ConfigVike' +import { addSsrMiddleware } from '../shared/addSsrMiddleware' import pc from '@brillout/picocolors' type ConnectServer = ViteDevServer['middlewares'] diff --git a/vike/node/plugin/plugins/setGlobalContext.ts b/vike/node/plugin/plugins/setGlobalContext.ts index 6b98925aa8..f845a7c44c 100644 --- a/vike/node/plugin/plugins/setGlobalContext.ts +++ b/vike/node/plugin/plugins/setGlobalContext.ts @@ -5,8 +5,8 @@ import { setGlobalContext_isDev, setGlobalContext_viteDevServer, setGlobalContext_viteConfig -} from '../../runtime/globalContext.js' -import { assertFilePathAbsoluteFilesystem, getOutDirs, isDev3 } from '../utils.js' +} from '../../runtime/globalContext' +import { assertFilePathAbsoluteFilesystem, getOutDirs, isDev3 } from '../utils' function setGlobalContext(): Plugin { return { diff --git a/vike/node/plugin/resolveClientEntriesDev.ts b/vike/node/plugin/resolveClientEntriesDev.ts index 815b4424ae..b98b03a831 100644 --- a/vike/node/plugin/resolveClientEntriesDev.ts +++ b/vike/node/plugin/resolveClientEntriesDev.ts @@ -8,7 +8,7 @@ import { pathJoin, assertIsNpmPackageImport, assertIsNotProductionRuntime -} from './utils.js' +} from './utils' import type { ViteDevServer } from 'vite' import { createRequire } from 'module' import { dirname } from 'path' diff --git a/vike/node/plugin/shared/addSsrMiddleware.ts b/vike/node/plugin/shared/addSsrMiddleware.ts index 383f7e9f0e..d62c297abe 100644 --- a/vike/node/plugin/shared/addSsrMiddleware.ts +++ b/vike/node/plugin/shared/addSsrMiddleware.ts @@ -1,8 +1,8 @@ export { addSsrMiddleware } -import { renderPage } from '../../runtime/renderPage.js' +import { renderPage } from '../../runtime/renderPage' import type { ResolvedConfig, ViteDevServer } from 'vite' -import { assertWarning } from '../utils.js' +import { assertWarning } from '../utils' import pc from '@brillout/picocolors' type ConnectServer = ViteDevServer['middlewares'] diff --git a/vike/node/plugin/shared/findPageFiles.ts b/vike/node/plugin/shared/findPageFiles.ts index 6f41ae5f05..ebbf5dca4d 100644 --- a/vike/node/plugin/shared/findPageFiles.ts +++ b/vike/node/plugin/shared/findPageFiles.ts @@ -2,8 +2,8 @@ export { findPageFiles } import glob from 'fast-glob' import type { ResolvedConfig } from 'vite' -import { assertWarning, toPosixPath, scriptFileExtensions, getOutDirs } from '../utils.js' -import type { FileType } from '../../../shared/getPageFiles/fileTypes.js' +import { assertWarning, toPosixPath, scriptFileExtensions, getOutDirs } from '../utils' +import type { FileType } from '../../../shared/getPageFiles/fileTypes' import pc from '@brillout/picocolors' async function findPageFiles(config: ResolvedConfig, fileTypes: FileType[], isDev: boolean): Promise { diff --git a/vike/node/plugin/shared/getAssetsDir.ts b/vike/node/plugin/shared/getAssetsDir.ts index 6cd4006482..9ea5d6264a 100644 --- a/vike/node/plugin/shared/getAssetsDir.ts +++ b/vike/node/plugin/shared/getAssetsDir.ts @@ -1,7 +1,7 @@ export { getAssetsDir } import type { ResolvedConfig } from 'vite' -import { assertUsage } from '../utils.js' +import { assertUsage } from '../utils' function getAssetsDir(config: ResolvedConfig) { let { assetsDir } = config.build diff --git a/vike/node/plugin/shared/getFilePath.ts b/vike/node/plugin/shared/getFilePath.ts index 6aa51c94b2..07ada4acb0 100644 --- a/vike/node/plugin/shared/getFilePath.ts +++ b/vike/node/plugin/shared/getFilePath.ts @@ -14,8 +14,8 @@ import { assertFilePathAbsoluteFilesystem, assertPosixPath, toPosixPath -} from '../utils.js' -import type { FilePathResolved, FilePathUnresolved } from '../../../shared/page-configs/FilePath.js' +} from '../utils' +import type { FilePathResolved, FilePathUnresolved } from '../../../shared/page-configs/FilePath' import type { ResolvedConfig } from 'vite' function getFilePathResolved( diff --git a/vike/node/plugin/shared/getHttpRequestAsyncStore.ts b/vike/node/plugin/shared/getHttpRequestAsyncStore.ts index fbc151cd00..ffa253ea46 100644 --- a/vike/node/plugin/shared/getHttpRequestAsyncStore.ts +++ b/vike/node/plugin/shared/getHttpRequestAsyncStore.ts @@ -14,12 +14,12 @@ export { getHttpRequestAsyncStore } export { installHttpRequestAsyncStore } -import { renderPage_addWrapper } from '../../runtime/renderPage.js' -import { assert, assertIsNotProductionRuntime, isObject, unique } from '../utils.js' +import { renderPage_addWrapper } from '../../runtime/renderPage' +import { assert, assertIsNotProductionRuntime, isObject, unique } from '../utils' import type { AsyncLocalStorage as AsyncLocalStorageType } from 'node:async_hooks' -import { getConfigBuildErrorFormatted } from '../plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js' -import { logErrorDebugNote } from './loggerNotProd.js' -import { isEquivalentErrorWithCodeSnippet } from './loggerNotProd/errorWithCodeSnippet.js' +import { getConfigBuildErrorFormatted } from '../plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile' +import { logErrorDebugNote } from './loggerNotProd' +import { isEquivalentErrorWithCodeSnippet } from './loggerNotProd/errorWithCodeSnippet' import { isDeepStrictEqual } from 'node:util' assertIsNotProductionRuntime() diff --git a/vike/node/plugin/shared/isViteCliCall.ts b/vike/node/plugin/shared/isViteCliCall.ts index db8d93e0f6..1ef8f78bdd 100644 --- a/vike/node/plugin/shared/isViteCliCall.ts +++ b/vike/node/plugin/shared/isViteCliCall.ts @@ -1,7 +1,7 @@ export { isViteCliCall } export { getViteConfigFromCli } -import { assert, isObject, toPosixPath } from '../utils.js' +import { assert, isObject, toPosixPath } from '../utils' import { cac } from 'cac' function isViteCliCall(): boolean { diff --git a/vike/node/plugin/shared/loggerNotProd.ts b/vike/node/plugin/shared/loggerNotProd.ts index e313054475..3120b6fd1d 100644 --- a/vike/node/plugin/shared/loggerNotProd.ts +++ b/vike/node/plugin/shared/loggerNotProd.ts @@ -18,9 +18,9 @@ export type { LogErrorArgs } export type { LogType } export type { LogCategory } -import { isAbortError } from '../../../shared/route/abort.js' -import { getViteConfig } from '../../runtime/globalContext.js' -import { overwriteRuntimeProductionLogger } from '../../runtime/renderPage/loggerRuntime.js' +import { isAbortError } from '../../../shared/route/abort' +import { getViteConfig } from '../../runtime/globalContext' +import { overwriteRuntimeProductionLogger } from '../../runtime/renderPage/loggerRuntime' import { assert, assertIsNotProductionRuntime, @@ -29,19 +29,19 @@ import { overwriteAssertProductionLogger, stripAnsi, warnIfErrorIsNotObject -} from '../utils.js' -import { getHttpRequestAsyncStore } from './getHttpRequestAsyncStore.js' -import { isErrorDebug } from '../../shared/isErrorDebug.js' -import { isErrorWithCodeSnippet, getPrettyErrorWithCodeSnippet } from './loggerNotProd/errorWithCodeSnippet.js' +} from '../utils' +import { getHttpRequestAsyncStore } from './getHttpRequestAsyncStore' +import { isErrorDebug } from '../../shared/isErrorDebug' +import { isErrorWithCodeSnippet, getPrettyErrorWithCodeSnippet } from './loggerNotProd/errorWithCodeSnippet' import { getConfigExecutionErrorIntroMsg, getConfigBuildErrorFormatted -} from '../plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js' -import { logWithVikeTag, logWithViteTag, logDirectly, applyViteSourceMapToStackTrace } from './loggerNotProd/log.js' +} from '../plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile' +import { logWithVikeTag, logWithViteTag, logDirectly, applyViteSourceMapToStackTrace } from './loggerNotProd/log' import pc from '@brillout/picocolors' -import { setAlreadyLogged } from '../../runtime/renderPage/isNewError.js' -import { onRuntimeError } from '../../runtime/renderPage/loggerProd.js' -import { isUserHookError } from '../../../shared/hooks/executeHook.js' +import { setAlreadyLogged } from '../../runtime/renderPage/isNewError' +import { onRuntimeError } from '../../runtime/renderPage/loggerProd' +import { isUserHookError } from '../../../shared/hooks/executeHook' assertIsNotProductionRuntime() overwriteRuntimeProductionLogger(logRuntimeError, logRuntimeInfo) diff --git a/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.ts b/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.ts index 0f2e761929..f1e4a156fe 100644 --- a/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.ts +++ b/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.ts @@ -12,8 +12,8 @@ export { getPrettyErrMessage } // Copied & adapted from https://github.com/vitejs/vite/blob/9c114c5c72a6af87e3330d5573362554b4511265/packages/vite/src/node/server/middlewares/error.ts import pc from '@brillout/picocolors' -import { assert, escapeRegex, isObject, removeEmptyLines, stripAnsi } from '../../utils.js' -import { cleanFilePathUnkown, getFilePathToShowToUserFromUnkown } from '../getFilePath.js' +import { assert, escapeRegex, isObject, removeEmptyLines, stripAnsi } from '../../utils' +import { cleanFilePathUnkown, getFilePathToShowToUserFromUnkown } from '../getFilePath' // Subset of RollupError type ErrorWithCodeSnippet = { id: string; frame?: string; message?: string; plugin?: string } diff --git a/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/getPrettyErrMessage.spec.ts b/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/getPrettyErrMessage.spec.ts index 11fba12a14..895e096bae 100644 --- a/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/getPrettyErrMessage.spec.ts +++ b/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/getPrettyErrMessage.spec.ts @@ -1,4 +1,4 @@ -import { getPrettyErrMessage } from '../errorWithCodeSnippet.js' +import { getPrettyErrMessage } from '../errorWithCodeSnippet' import { expect, describe, it } from 'vitest' diff --git a/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/getPrettyErrorWithCodeSnippet.spec.ts b/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/getPrettyErrorWithCodeSnippet.spec.ts index 2f9e55bb64..255a65fa3e 100644 --- a/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/getPrettyErrorWithCodeSnippet.spec.ts +++ b/vike/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/getPrettyErrorWithCodeSnippet.spec.ts @@ -1,7 +1,7 @@ -import { getPrettyErrorWithCodeSnippet, isErrorWithCodeSnippet } from '../errorWithCodeSnippet.js' +import { getPrettyErrorWithCodeSnippet, isErrorWithCodeSnippet } from '../errorWithCodeSnippet' import { expect, describe, it } from 'vitest' -import { stripAnsi } from '../../../utils.js' +import { stripAnsi } from '../../../utils' import { errBabelSolid } from './fixture-errors/errBabelSolid.js' import { errBabelReact } from './fixture-errors/errBabelReact.js' diff --git a/vike/node/plugin/shared/loggerNotProd/log.ts b/vike/node/plugin/shared/loggerNotProd/log.ts index 502ff7057c..ae681c04e9 100644 --- a/vike/node/plugin/shared/loggerNotProd/log.ts +++ b/vike/node/plugin/shared/loggerNotProd/log.ts @@ -3,11 +3,11 @@ export { logWithVikeTag } export { logDirectly } export { applyViteSourceMapToStackTrace } -import { assert, projectInfo, stripAnsi, hasProp, assertIsNotProductionRuntime } from '../../utils.js' +import { assert, projectInfo, stripAnsi, hasProp, assertIsNotProductionRuntime } from '../../utils' import pc from '@brillout/picocolors' -import { isErrorDebug } from '../../../shared/isErrorDebug.js' -import { getViteDevServer } from '../../../runtime/globalContext.js' -import type { LogCategory, LogType } from '../loggerNotProd.js' +import { isErrorDebug } from '../../../shared/isErrorDebug' +import { getViteDevServer } from '../../../runtime/globalContext' +import type { LogCategory, LogType } from '../loggerNotProd' assertIsNotProductionRuntime() diff --git a/vike/node/plugin/shared/loggerVite.ts b/vike/node/plugin/shared/loggerVite.ts index 909672506f..6909ed2059 100644 --- a/vike/node/plugin/shared/loggerVite.ts +++ b/vike/node/plugin/shared/loggerVite.ts @@ -1,11 +1,11 @@ export { improveViteLogs } -import { assert, removeEmptyLines, trimWithAnsi, trimWithAnsiTrailOnly } from '../utils.js' -import { logViteError, logViteAny } from './loggerNotProd.js' -import { getHttpRequestAsyncStore } from './getHttpRequestAsyncStore.js' -import { removeSuperfluousViteLog } from './loggerVite/removeSuperfluousViteLog.js' +import { assert, removeEmptyLines, trimWithAnsi, trimWithAnsiTrailOnly } from '../utils' +import { logViteError, logViteAny } from './loggerNotProd' +import { getHttpRequestAsyncStore } from './getHttpRequestAsyncStore' +import { removeSuperfluousViteLog } from './loggerVite/removeSuperfluousViteLog' import type { LogType, ResolvedConfig, LogErrorOptions } from 'vite' -import { isErrorDebug } from '../../shared/isErrorDebug.js' +import { isErrorDebug } from '../../shared/isErrorDebug' function improveViteLogs(config: ResolvedConfig) { intercept('info', config) diff --git a/vike/node/plugin/shared/loggerVite/removeSuperfluousViteLog.ts b/vike/node/plugin/shared/loggerVite/removeSuperfluousViteLog.ts index d31754f0b7..2f24279f82 100644 --- a/vike/node/plugin/shared/loggerVite/removeSuperfluousViteLog.ts +++ b/vike/node/plugin/shared/loggerVite/removeSuperfluousViteLog.ts @@ -2,7 +2,7 @@ export { removeSuperfluousViteLog } export { removeSuperfluousViteLog_enable } export { removeSuperfluousViteLog_disable } -import { assert } from '../../utils.js' +import { assert } from '../../utils' const superfluousLog = 'Forced re-optimization of dependencies' let enabled = false diff --git a/vike/node/plugin/shared/normalizeId.ts b/vike/node/plugin/shared/normalizeId.ts index 3eae3fdafd..915b801ee0 100644 --- a/vike/node/plugin/shared/normalizeId.ts +++ b/vike/node/plugin/shared/normalizeId.ts @@ -1,6 +1,6 @@ export { normalizeId } -import { toPosixPath } from '../utils.js' +import { toPosixPath } from '../utils' // In principle Vite/Rollup should always normalize the `id` in `transform(code, id)` but it seems to not always do it. // https://github.com/vikejs/vike/issues/1935 diff --git a/vike/node/plugin/shared/parseEsModule.ts b/vike/node/plugin/shared/parseEsModule.ts index 71d1a32268..7751d0c912 100644 --- a/vike/node/plugin/shared/parseEsModule.ts +++ b/vike/node/plugin/shared/parseEsModule.ts @@ -3,7 +3,7 @@ export { getImportStatements } export type { ImportStatement } import { init, parse } from 'es-module-lexer' -import { assert } from '../utils.js' +import { assert } from '../utils' type ParseResult = ReturnType type ImportStatement = ParseResult[0][0] diff --git a/vike/node/plugin/shared/rollupIsEsm.ts b/vike/node/plugin/shared/rollupIsEsm.ts index 9734237984..dc5af571f0 100644 --- a/vike/node/plugin/shared/rollupIsEsm.ts +++ b/vike/node/plugin/shared/rollupIsEsm.ts @@ -1,4 +1,4 @@ -import { assert } from '../utils.js' +import { assert } from '../utils' export function rollupIsEsm(rollupOptions: { format: string }) { const { format } = rollupOptions assert(typeof format === 'string') diff --git a/vike/node/plugin/utils.ts b/vike/node/plugin/utils.ts index 0732203b40..d92f225ca4 100644 --- a/vike/node/plugin/utils.ts +++ b/vike/node/plugin/utils.ts @@ -1,32 +1,32 @@ // Utils needed by Vike's Vite plugin. // We assume all runtime entries will load this utils.ts file -import { onLoad } from './onLoad.js' +import { onLoad } from './onLoad' onLoad() // We tolerate the fact that we load all of the runtime utils even though some of it isn't needed -export * from '../runtime/utils.js' +export * from '../runtime/utils' // Utils only needed by `plugin/*` -export * from '../../utils/viteIsSSR.js' -export * from '../../utils/requireResolve.js' -export * from '../../utils/includes.js' -export * from '../../utils/isDev.js' -export * from '../../utils/getMostSimilar.js' -export * from '../../utils/getRandomId.js' -export * from '../../utils/joinEnglish.js' -export * from '../../utils/escapeRegex.js' -export * from '../../utils/stripAnsi.js' -export * from '../../utils/trimWithAnsi.js' -export * from '../../utils/removeEmptyLines.js' -export * from '../../utils/findPackageJson.js' -export * from '../../utils/getPropAccessNotation.js' -export * from '../../utils/deepEqual.js' -export * from '../../utils/assertKeys.js' -export * from '../../utils/injectRollupInputs.js' -export * from '../../utils/humanizeTime.js' -export * from '../../utils/pLimit.js' -export * from '../../utils/assertVersion.js' -export * from '../../utils/isFilePathAbsoluteFilesystem.js' -export * from '../../utils/isArray.js' -export * from '../../utils/PROJECT_VERSION.js' +export * from '../../utils/viteIsSSR' +export * from '../../utils/requireResolve' +export * from '../../utils/includes' +export * from '../../utils/isDev' +export * from '../../utils/getMostSimilar' +export * from '../../utils/getRandomId' +export * from '../../utils/joinEnglish' +export * from '../../utils/escapeRegex' +export * from '../../utils/stripAnsi' +export * from '../../utils/trimWithAnsi' +export * from '../../utils/removeEmptyLines' +export * from '../../utils/findPackageJson' +export * from '../../utils/getPropAccessNotation' +export * from '../../utils/deepEqual' +export * from '../../utils/assertKeys' +export * from '../../utils/injectRollupInputs' +export * from '../../utils/humanizeTime' +export * from '../../utils/pLimit' +export * from '../../utils/assertVersion' +export * from '../../utils/isFilePathAbsoluteFilesystem' +export * from '../../utils/isArray' +export * from '../../utils/PROJECT_VERSION' diff --git a/vike/node/prerender/index.ts b/vike/node/prerender/index.ts index c6d487dd5f..e0cdbe4edd 100644 --- a/vike/node/prerender/index.ts +++ b/vike/node/prerender/index.ts @@ -1 +1 @@ -export { runPrerenderFromAPI as prerender } from './runPrerender.js' +export { runPrerenderFromAPI as prerender } from './runPrerender' diff --git a/vike/node/prerender/runPrerender.ts b/vike/node/prerender/runPrerender.ts index 2a1d86c72f..577702965a 100644 --- a/vike/node/prerender/runPrerender.ts +++ b/vike/node/prerender/runPrerender.ts @@ -4,9 +4,9 @@ export { runPrerenderFromAutoFullBuild } export { runPrerender_forceExit } export type { PrerenderOptions } -import '../runtime/page-files/setup.js' +import '../runtime/page-files/setup' import path from 'path' -import { route } from '../../shared/route/index.js' +import { route } from '../../shared/route/index' import { assert, assertUsage, @@ -26,7 +26,7 @@ import { PLimit, isArray, changeEnumerable -} from './utils.js' +} from './utils' import { prerenderPage, prerender404Page, @@ -34,45 +34,45 @@ import { type RenderContext, getPageContextInitEnhanced, PageContextInitEnhanced -} from '../runtime/renderPage/renderPageAlreadyRouted.js' +} from '../runtime/renderPage/renderPageAlreadyRouted' import pc from '@brillout/picocolors' import { cpus } from 'os' -import type { PageFile } from '../../shared/getPageFiles.js' +import type { PageFile } from '../../shared/getPageFiles' import { getGlobalContext, initGlobalContext_runPrerender, setGlobalContext_isPrerendering -} from '../runtime/globalContext.js' +} from '../runtime/globalContext' import { resolveConfig } from 'vite' -import { getConfigVike } from '../shared/getConfigVike.js' +import { getConfigVike } from '../shared/getConfigVike' import type { InlineConfig } from 'vite' -import { getPageFilesServerSide } from '../../shared/getPageFiles.js' -import { getPageContextRequestUrl } from '../../shared/getPageContextRequestUrl.js' -import { getUrlFromRouteString } from '../../shared/route/resolveRouteString.js' -import { getConfigValueFilePathToShowToUser } from '../../shared/page-configs/helpers.js' -import { getConfigValueRuntime } from '../../shared/page-configs/getConfigValue.js' -import { loadConfigValues } from '../../shared/page-configs/loadConfigValues.js' -import { isErrorPage } from '../../shared/error-page.js' +import { getPageFilesServerSide } from '../../shared/getPageFiles' +import { getPageContextRequestUrl } from '../../shared/getPageContextRequestUrl' +import { getUrlFromRouteString } from '../../shared/route/resolveRouteString' +import { getConfigValueFilePathToShowToUser } from '../../shared/page-configs/helpers' +import { getConfigValueRuntime } from '../../shared/page-configs/getConfigValue' +import { loadConfigValues } from '../../shared/page-configs/loadConfigValues' +import { isErrorPage } from '../../shared/error-page' import { getPageContextUrlComputed, PageContextUrlInternal, PageContextUrlSource -} from '../../shared/getPageContextUrlComputed.js' -import { isAbortError } from '../../shared/route/abort.js' -import { loadUserFilesServerSide } from '../runtime/renderPage/loadUserFilesServerSide.js' +} from '../../shared/getPageContextUrlComputed' +import { isAbortError } from '../../shared/route/abort' +import { loadUserFilesServerSide } from '../runtime/renderPage/loadUserFilesServerSide' import { getHookFromPageConfig, getHookFromPageConfigGlobal, getHookTimeoutDefault, getHook_setIsPrerenderering -} from '../../shared/hooks/getHook.js' -import { noRouteMatch } from '../../shared/route/noRouteMatch.js' -import type { PageConfigBuildTime } from '../../shared/page-configs/PageConfig.js' -import { getVikeConfig } from '../plugin/plugins/importUserCode/v1-design/getVikeConfig.js' -import type { HookTimeout } from '../../shared/hooks/getHook.js' -import { logErrorHint } from '../runtime/renderPage/logErrorHint.js' -import { executeHook, isUserHookError } from '../../shared/hooks/executeHook.js' -import { getConfigValueBuildTime } from '../../shared/page-configs/getConfigValueBuildTime.js' +} from '../../shared/hooks/getHook' +import { noRouteMatch } from '../../shared/route/noRouteMatch' +import type { PageConfigBuildTime } from '../../shared/page-configs/PageConfig' +import { getVikeConfig } from '../plugin/plugins/importUserCode/v1-design/getVikeConfig' +import type { HookTimeout } from '../../shared/hooks/getHook' +import { logErrorHint } from '../runtime/renderPage/logErrorHint' +import { executeHook, isUserHookError } from '../../shared/hooks/executeHook' +import { getConfigValueBuildTime } from '../../shared/page-configs/getConfigValueBuildTime' type HtmlFile = { urlOriginal: string diff --git a/vike/node/prerender/utils.ts b/vike/node/prerender/utils.ts index b80fc4a3ee..1317d42d12 100644 --- a/vike/node/prerender/utils.ts +++ b/vike/node/prerender/utils.ts @@ -1,19 +1,19 @@ -import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser.js' +import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser' assertIsNotBrowser() -export * from '../../utils/assert.js' -export * from '../../utils/hasProp.js' -export * from '../../utils/projectInfo.js' -export * from '../../utils/objectAssign.js' -export * from '../../utils/isObjectWithKeys.js' -export * from '../../utils/isCallable.js' -export * from '../../utils/getOutDirs.js' -export * from '../../utils/isPropertyGetter.js' -export * from '../../utils/filesystemPathHandling.js' -export * from '../../utils/urlToFile.js' -export * from '../../utils/isPlainObject.js' -export * from '../../utils/assertNodeEnv.js' -export * from '../../utils/pLimit.js' -export * from '../../utils/isFilePathAbsoluteFilesystem.js' -export * from '../../utils/isArray.js' -export * from '../../utils/changeEnumerable.js' +export * from '../../utils/assert' +export * from '../../utils/hasProp' +export * from '../../utils/projectInfo' +export * from '../../utils/objectAssign' +export * from '../../utils/isObjectWithKeys' +export * from '../../utils/isCallable' +export * from '../../utils/getOutDirs' +export * from '../../utils/isPropertyGetter' +export * from '../../utils/filesystemPathHandling' +export * from '../../utils/urlToFile' +export * from '../../utils/isPlainObject' +export * from '../../utils/assertNodeEnv' +export * from '../../utils/pLimit' +export * from '../../utils/isFilePathAbsoluteFilesystem' +export * from '../../utils/isArray' +export * from '../../utils/changeEnumerable' diff --git a/vike/node/runtime/globalContext.ts b/vike/node/runtime/globalContext.ts index 28c1987e05..f1b9d9a619 100644 --- a/vike/node/runtime/globalContext.ts +++ b/vike/node/runtime/globalContext.ts @@ -25,17 +25,17 @@ import { objectAssign, objectKeys, genPromise -} from './utils.js' -import type { ViteManifest } from '../shared/ViteManifest.js' +} from './utils' +import type { ViteManifest } from '../shared/ViteManifest' import type { ResolvedConfig, ViteDevServer } from 'vite' -import { loadImportBuild } from './globalContext/loadImportBuild.js' -import { setPageFiles } from '../../shared/getPageFiles.js' -import { assertPluginManifest, PluginManifest } from '../shared/assertPluginManifest.js' -import type { ConfigVikeResolved } from '../../shared/ConfigVike.js' -import { getConfigVike } from '../shared/getConfigVike.js' -import { assertRuntimeManifest, type RuntimeManifest } from '../shared/assertRuntimeManifest.js' +import { loadImportBuild } from './globalContext/loadImportBuild' +import { setPageFiles } from '../../shared/getPageFiles' +import { assertPluginManifest, PluginManifest } from '../shared/assertPluginManifest' +import type { ConfigVikeResolved } from '../../shared/ConfigVike' +import { getConfigVike } from '../shared/getConfigVike' +import { assertRuntimeManifest, type RuntimeManifest } from '../shared/assertRuntimeManifest' import pc from '@brillout/picocolors' -import { getPageFilesExports } from './page-files/getPageFilesExports.js' +import { getPageFilesExports } from './page-files/getPageFilesExports' const globalObject = getGlobalObject<{ globalContext?: GlobalContext viteDevServer?: ViteDevServer diff --git a/vike/node/runtime/globalContext/loadImportBuild.ts b/vike/node/runtime/globalContext/loadImportBuild.ts index c742a979fc..55f3c2b5df 100644 --- a/vike/node/runtime/globalContext/loadImportBuild.ts +++ b/vike/node/runtime/globalContext/loadImportBuild.ts @@ -2,7 +2,7 @@ export { loadImportBuild } export { setImportBuildGetters } import { importServerProductionEntry } from '@brillout/vite-plugin-server-entry/runtime' -import { assert } from '../utils.js' +import { assert } from '../utils' const buildGetters = (globalThis.__vike_buildGetters = globalThis.__vike_buildGetters || { getters: null diff --git a/vike/node/runtime/html/injectAssets.ts b/vike/node/runtime/html/injectAssets.ts index 625a15dbb9..d3d6510fe6 100644 --- a/vike/node/runtime/html/injectAssets.ts +++ b/vike/node/runtime/html/injectAssets.ts @@ -3,21 +3,21 @@ export { injectHtmlTagsToStream } export type { PageContextInjectAssets } export type { PageContextPromise } -import { assert, isCallable, isPromise } from '../utils.js' -import type { PageAsset } from '../renderPage/getPageAssets.js' -import { assertPageContextProvidedByUser } from '../../../shared/assertPageContextProvidedByUser.js' +import { assert, isCallable, isPromise } from '../utils' +import type { PageAsset } from '../renderPage/getPageAssets' +import { assertPageContextProvidedByUser } from '../../../shared/assertPageContextProvidedByUser' import { joinHtmlTags, injectHtmlTags, createHtmlHeadIfMissing, injectHtmlTagsUsingStream -} from './injectAssets/injectHtmlTags.js' -import type { HtmlPart } from './renderHtml.js' -import { getHtmlTags, type PreloadFilter, type HtmlTag } from './injectAssets/getHtmlTags.js' -import type { StreamFromReactStreamingPackage } from './stream/react-streaming.js' -import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js' -import type { PageContextSerialization } from './serializePageContextClientSide.js' -import { getViteDevScript } from './injectAssets/getViteDevScript.js' +} from './injectAssets/injectHtmlTags' +import type { HtmlPart } from './renderHtml' +import { getHtmlTags, type PreloadFilter, type HtmlTag } from './injectAssets/getHtmlTags' +import type { StreamFromReactStreamingPackage } from './stream/react-streaming' +import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig' +import type { PageContextSerialization } from './serializePageContextClientSide' +import { getViteDevScript } from './injectAssets/getViteDevScript' type PageContextInjectAssets = { urlPathname: string diff --git a/vike/node/runtime/html/injectAssets/getHtmlTags.ts b/vike/node/runtime/html/injectAssets/getHtmlTags.ts index d7a6cb8873..c9911f588f 100644 --- a/vike/node/runtime/html/injectAssets/getHtmlTags.ts +++ b/vike/node/runtime/html/injectAssets/getHtmlTags.ts @@ -3,20 +3,20 @@ export type { HtmlTag } export type { PreloadFilter } export type { InjectFilterEntry } -import { assert, assertWarning, assertUsage, isObject, freezePartial } from '../../utils.js' -import { type PageContextSerialization, serializePageContextClientSide } from '../serializePageContextClientSide.js' -import { sanitizeJson } from './sanitizeJson.js' -import { inferAssetTag, inferPreloadTag } from './inferHtmlTags.js' -import { mergeScriptTags } from './mergeScriptTags.js' -import type { PageContextInjectAssets } from '../injectAssets.js' -import type { StreamFromReactStreamingPackage } from '../stream/react-streaming.js' -import type { PageAsset } from '../../renderPage/getPageAssets.js' -import type { PageConfigRuntime } from '../../../../shared/page-configs/PageConfig.js' -import { getPageConfig } from '../../../../shared/page-configs/helpers.js' -import { getConfigValueRuntime } from '../../../../shared/page-configs/getConfigValue.js' -import { getGlobalContext } from '../../globalContext.js' +import { assert, assertWarning, assertUsage, isObject, freezePartial } from '../../utils' +import { type PageContextSerialization, serializePageContextClientSide } from '../serializePageContextClientSide' +import { sanitizeJson } from './sanitizeJson' +import { inferAssetTag, inferPreloadTag } from './inferHtmlTags' +import { mergeScriptTags } from './mergeScriptTags' +import type { PageContextInjectAssets } from '../injectAssets' +import type { StreamFromReactStreamingPackage } from '../stream/react-streaming' +import type { PageAsset } from '../../renderPage/getPageAssets' +import type { PageConfigRuntime } from '../../../../shared/page-configs/PageConfig' +import { getPageConfig } from '../../../../shared/page-configs/helpers' +import { getConfigValueRuntime } from '../../../../shared/page-configs/getConfigValue' +import { getGlobalContext } from '../../globalContext' import pc from '@brillout/picocolors' -import { getConfigDefinedAt } from '../../../../shared/page-configs/getConfigDefinedAt.js' +import { getConfigDefinedAt } from '../../../../shared/page-configs/getConfigDefinedAt' const stamp = '__injectFilterEntry' diff --git a/vike/node/runtime/html/injectAssets/getViteDevScript.ts b/vike/node/runtime/html/injectAssets/getViteDevScript.ts index a0827e53b5..25f4083563 100644 --- a/vike/node/runtime/html/injectAssets/getViteDevScript.ts +++ b/vike/node/runtime/html/injectAssets/getViteDevScript.ts @@ -1,7 +1,7 @@ export { getViteDevScript } -import { getGlobalContext } from '../../globalContext.js' -import { assert, assertUsage, assertWarning } from '../../utils.js' +import { getGlobalContext } from '../../globalContext' +import { assert, assertUsage, assertWarning } from '../../utils' import pc from '@brillout/picocolors' async function getViteDevScript(): Promise { diff --git a/vike/node/runtime/html/injectAssets/inferHtmlTags.ts b/vike/node/runtime/html/injectAssets/inferHtmlTags.ts index d4ab674a73..0c4418024f 100644 --- a/vike/node/runtime/html/injectAssets/inferHtmlTags.ts +++ b/vike/node/runtime/html/injectAssets/inferHtmlTags.ts @@ -3,8 +3,8 @@ export { inferPreloadTag } export { inferEarlyHintLink } export { scriptAttrs } -import { assert } from '../../utils.js' -import type { PageAsset } from '../../renderPage/getPageAssets.js' +import { assert } from '../../utils' +import type { PageAsset } from '../../renderPage/getPageAssets' // We can't use `defer` here. With `defer`, the entry script won't start before `` has been parsed, preventing progressive hydration during SSR streaming, see https://github.com/vikejs/vike/pull/1271 const scriptAttrs = 'type="module" async' diff --git a/vike/node/runtime/html/injectAssets/injectAssets__public.ts b/vike/node/runtime/html/injectAssets/injectAssets__public.ts index 5467acdc43..dcb938dabb 100644 --- a/vike/node/runtime/html/injectAssets/injectAssets__public.ts +++ b/vike/node/runtime/html/injectAssets/injectAssets__public.ts @@ -1,8 +1,8 @@ export { injectAssets__public } -import { assertUsage, assertWarning, castProp, hasProp } from '../../utils.js' -import { injectHtmlTagsToString } from '../injectAssets.js' -import type { PageAsset } from '../../renderPage/getPageAssets.js' +import { assertUsage, assertWarning, castProp, hasProp } from '../../utils' +import { injectHtmlTagsToString } from '../injectAssets' +import type { PageAsset } from '../../renderPage/getPageAssets' // TODO/v1-release: remove async function injectAssets__public(htmlString: string, pageContext: Record): Promise { diff --git a/vike/node/runtime/html/injectAssets/injectHtmlTags.spec.ts b/vike/node/runtime/html/injectAssets/injectHtmlTags.spec.ts index 36cb6dc6f8..72e17080f1 100644 --- a/vike/node/runtime/html/injectAssets/injectHtmlTags.spec.ts +++ b/vike/node/runtime/html/injectAssets/injectHtmlTags.spec.ts @@ -1,4 +1,4 @@ -import { injectAtOpeningTag, injectAtClosingTag } from './injectHtmlTags.js' +import { injectAtOpeningTag, injectAtClosingTag } from './injectHtmlTags' import { expect, describe, it } from 'vitest' const htmlHead1 = '' diff --git a/vike/node/runtime/html/injectAssets/injectHtmlTags.ts b/vike/node/runtime/html/injectAssets/injectHtmlTags.ts index c9562f6095..df2fb9f801 100644 --- a/vike/node/runtime/html/injectAssets/injectHtmlTags.ts +++ b/vike/node/runtime/html/injectAssets/injectHtmlTags.ts @@ -9,9 +9,9 @@ export { joinHtmlTags } export { injectAtOpeningTag } export { injectAtClosingTag } -import { assert, assertUsage, slice } from '../../utils.js' -import type { StreamFromReactStreamingPackage } from '../stream/react-streaming.js' -import type { HtmlTag } from './getHtmlTags.js' +import { assert, assertUsage, slice } from '../../utils' +import type { StreamFromReactStreamingPackage } from '../stream/react-streaming' +import type { HtmlTag } from './getHtmlTags' type Position = 'HTML_BEGIN' | 'HTML_END' function injectHtmlTags(htmlString: string, htmlTags: HtmlTag[], position: Position): string { diff --git a/vike/node/runtime/html/injectAssets/mergeScriptTags.ts b/vike/node/runtime/html/injectAssets/mergeScriptTags.ts index d07ba6c5ba..d1ae71858c 100644 --- a/vike/node/runtime/html/injectAssets/mergeScriptTags.ts +++ b/vike/node/runtime/html/injectAssets/mergeScriptTags.ts @@ -1,7 +1,7 @@ export { mergeScriptTags } -import { assert } from '../../utils.js' -import { scriptAttrs } from './inferHtmlTags.js' +import { assert } from '../../utils' +import { scriptAttrs } from './inferHtmlTags' const scriptRE = /(]*>|>))(.*?)<\/script>/gims const srcRE = /\bsrc\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/im diff --git a/vike/node/runtime/html/renderHtml.ts b/vike/node/runtime/html/renderHtml.ts index 1c7ec747bc..1e0981a123 100644 --- a/vike/node/runtime/html/renderHtml.ts +++ b/vike/node/runtime/html/renderHtml.ts @@ -19,9 +19,9 @@ import { isHtml, isPromise, objectAssign -} from '../utils.js' -import { injectHtmlTagsToString, injectHtmlTagsToStream } from './injectAssets.js' -import type { PageContextInjectAssets } from './injectAssets.js' +} from '../utils' +import { injectHtmlTagsToString, injectHtmlTagsToStream } from './injectAssets' +import type { PageContextInjectAssets } from './injectAssets' import { processStream, isStream, @@ -29,12 +29,12 @@ import { streamToString, StreamTypePatch, StreamProviderNormalized -} from './stream.js' -import { isStreamFromReactStreamingPackage } from './stream/react-streaming.js' -import type { StreamFromReactStreamingPackage } from './stream/react-streaming.js' -import type { PageAsset } from '../renderPage/getPageAssets.js' -import type { PreloadFilter } from './injectAssets/getHtmlTags.js' -import { getGlobalContext } from '../globalContext.js' +} from './stream' +import { isStreamFromReactStreamingPackage } from './stream/react-streaming' +import type { StreamFromReactStreamingPackage } from './stream/react-streaming' +import type { PageAsset } from '../renderPage/getPageAssets' +import type { PreloadFilter } from './injectAssets/getHtmlTags' +import { getGlobalContext } from '../globalContext' import pc from '@brillout/picocolors' type DocumentHtml = TemplateWrapped | EscapedString | StreamProviderAny diff --git a/vike/node/runtime/html/serializePageContextClientSide.ts b/vike/node/runtime/html/serializePageContextClientSide.ts index b536606e1c..5d3039aecf 100644 --- a/vike/node/runtime/html/serializePageContextClientSide.ts +++ b/vike/node/runtime/html/serializePageContextClientSide.ts @@ -3,15 +3,15 @@ export { serializePageContextAbort } export type { PageContextSerialization } import { stringify, isJsonSerializerError } from '@brillout/json-serializer/stringify' -import { assert, assertUsage, assertWarning, getPropAccessNotation, hasProp, unique } from '../utils.js' -import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js' -import { isErrorPage } from '../../../shared/error-page.js' -import { addIs404ToPageProps } from '../../../shared/addIs404ToPageProps.js' +import { assert, assertUsage, assertWarning, getPropAccessNotation, hasProp, unique } from '../utils' +import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig' +import { isErrorPage } from '../../../shared/error-page' +import { addIs404ToPageProps } from '../../../shared/addIs404ToPageProps' import pc from '@brillout/picocolors' -import { notSerializable } from '../../../shared/notSerializable.js' -import type { UrlRedirect } from '../../../shared/route/abort.js' -import { pageContextInitIsPassedToClient } from '../../../shared/misc/pageContextInitIsPassedToClient.js' -import { isServerSideError } from '../../../shared/misc/isServerSideError.js' +import { notSerializable } from '../../../shared/notSerializable' +import type { UrlRedirect } from '../../../shared/route/abort' +import { pageContextInitIsPassedToClient } from '../../../shared/misc/pageContextInitIsPassedToClient' +import { isServerSideError } from '../../../shared/misc/isServerSideError' const PASS_TO_CLIENT: string[] = [ 'abortReason', diff --git a/vike/node/runtime/html/stream.ts b/vike/node/runtime/html/stream.ts index fa9f4244cb..2a674ddf4c 100644 --- a/vike/node/runtime/html/stream.ts +++ b/vike/node/runtime/html/stream.ts @@ -41,14 +41,14 @@ import { isCallable, createDebugger, isBug -} from '../utils.js' -import { HtmlRender } from './renderHtml.js' +} from '../utils' +import { HtmlRender } from './renderHtml' import { getStreamOfReactStreamingPackage, isStreamFromReactStreamingPackage, StreamFromReactStreamingPackagePublic, streamFromReactStreamingPackageToString -} from './stream/react-streaming.js' +} from './stream/react-streaming' import { import_ } from '@brillout/import' import type { Readable as Readable_, Writable as Writable_ } from 'node:stream' import pc from '@brillout/picocolors' diff --git a/vike/node/runtime/html/stream/react-streaming.ts b/vike/node/runtime/html/stream/react-streaming.ts index 824d711533..2e2351f10e 100644 --- a/vike/node/runtime/html/stream/react-streaming.ts +++ b/vike/node/runtime/html/stream/react-streaming.ts @@ -7,8 +7,8 @@ export type { StreamFromReactStreamingPackage } export type { StreamFromReactStreamingPackagePublic } import type { renderToStream } from 'react-streaming/server' -import { assert, assertUsage, hasProp, isVikeReactApp } from '../../utils.js' -import { streamPipeNodeToString, StreamReadableWeb, streamReadableWebToString, StreamWritableNode } from '../stream.js' +import { assert, assertUsage, hasProp, isVikeReactApp } from '../../utils' +import { streamPipeNodeToString, StreamReadableWeb, streamReadableWebToString, StreamWritableNode } from '../stream' // We use this simplistic public type to avoid type mismatches (when the user installed another version than Vike's devDependency#react-streaming install). type StreamFromReactStreamingPackagePublic = { injectToStream: Function } diff --git a/vike/node/runtime/index-common.ts b/vike/node/runtime/index-common.ts index 1382cbe997..87c13634db 100644 --- a/vike/node/runtime/index-common.ts +++ b/vike/node/runtime/index-common.ts @@ -1,17 +1,17 @@ -export { renderPage } from './renderPage.js' -export { escapeInject, dangerouslySkipEscape } from './html/renderHtml.js' -export { pipeWebStream, pipeNodeStream, pipeStream, stampPipe } from './html/stream.js' -export { PROJECT_VERSION as version } from './utils.js' -export { getGlobalContextSync, getGlobalContextAsync } from './globalContext.js' +export { renderPage } from './renderPage' +export { escapeInject, dangerouslySkipEscape } from './html/renderHtml' +export { pipeWebStream, pipeNodeStream, pipeStream, stampPipe } from './html/stream' +export { PROJECT_VERSION as version } from './utils' +export { getGlobalContextSync, getGlobalContextAsync } from './globalContext' // TODO/v1-release: remove -export { injectAssets__public as _injectAssets } from './html/injectAssets/injectAssets__public.js' +export { injectAssets__public as _injectAssets } from './html/injectAssets/injectAssets__public' // TODO/v1-release: remove -export { createPageRenderer } from '../createPageRenderer.js' +export { createPageRenderer } from '../createPageRenderer' addEcosystemStamp() -import './page-files/setup.js' +import './page-files/setup' // Used by: // - Telefunc (to detect the user's stack https://github.com/brillout/telefunc/blob/8288310e88e06a42b710d39c39fb502364ca6d30/telefunc/utils/isVikeApp.ts#L4) diff --git a/vike/node/runtime/index-deprecated.ts b/vike/node/runtime/index-deprecated.ts index ee84857e2e..d1019db593 100644 --- a/vike/node/runtime/index-deprecated.ts +++ b/vike/node/runtime/index-deprecated.ts @@ -1,21 +1,21 @@ // TODO/v1-release: replace this with: // assertUsage(false, "`import { something } from 'vike'` doesn't exist: instead import from 'vike/server', 'vike/client', 'vike/plugin', ...") -import { isBrowser } from '../../utils/isBrowser.js' -import { assertUsage } from '../../utils/assert.js' +import { isBrowser } from '../../utils/isBrowser' +import { assertUsage } from '../../utils/assert' assertUsage( !isBrowser(), "It's forbidden to `import { something } from 'vike'` on the client-side: the module 'vike' is a server-only module.", { showStackTrace: true } ) -export * from './index-common.js' -export * from '../../types/index-dreprecated.js' +export * from './index-common' +export * from '../../types/index-dreprecated' -import { assertWarning } from './utils.js' +import { assertWarning } from './utils' import pc from '@brillout/picocolors' -import { RenderErrorPage as RenderErrorPage_ } from '../../shared/route/abort.js' +import { RenderErrorPage as RenderErrorPage_ } from '../../shared/route/abort' /** @deprecated * Replace: * ``` diff --git a/vike/node/runtime/index.ts b/vike/node/runtime/index.ts index e5d4264b7b..646f972f1e 100644 --- a/vike/node/runtime/index.ts +++ b/vike/node/runtime/index.ts @@ -1,9 +1,9 @@ -import { isBrowser } from '../../utils/isBrowser.js' -import { assertUsage } from '../../utils/assert.js' +import { isBrowser } from '../../utils/isBrowser' +import { assertUsage } from '../../utils/assert' assertUsage( !isBrowser(), "It's forbidden to `import { something } from 'vike/server'` on the client-side: the module 'vike/server' is a server-only module.", { showStackTrace: true } ) -export * from './index-common.js' +export * from './index-common' diff --git a/vike/node/runtime/onLoad.ts b/vike/node/runtime/onLoad.ts index faea70b9d7..256b3f92e3 100644 --- a/vike/node/runtime/onLoad.ts +++ b/vike/node/runtime/onLoad.ts @@ -1,10 +1,10 @@ export { onLoad } -import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser.js' -import { assertNodeVersion } from '../../utils/assertNodeVersion.js' +import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser' +import { assertNodeVersion } from '../../utils/assertNodeVersion' import { installRequireShim } from '@brillout/require-shim' -import { setAlwaysShowStackTrace } from './utils.js' -import { isErrorDebug } from '../shared/isErrorDebug.js' +import { setAlwaysShowStackTrace } from './utils' +import { isErrorDebug } from '../shared/isErrorDebug' function onLoad() { assertIsNotBrowser() diff --git a/vike/node/runtime/page-files/getPageFilesExports.ts b/vike/node/runtime/page-files/getPageFilesExports.ts index 8e3af61099..e838f5ffa6 100644 --- a/vike/node/runtime/page-files/getPageFilesExports.ts +++ b/vike/node/runtime/page-files/getPageFilesExports.ts @@ -1,8 +1,8 @@ export { getPageFilesExports } -import { assert, debugGlob, isObject } from '../utils.js' -import { getViteDevServer } from '../globalContext.js' -import { virtualFileIdImportUserCodeServer } from '../../shared/virtual-files/virtualFileImportUserCode.js' +import { assert, debugGlob, isObject } from '../utils' +import { getViteDevServer } from '../globalContext' +import { virtualFileIdImportUserCodeServer } from '../../shared/virtual-files/virtualFileImportUserCode' async function getPageFilesExports(): Promise> { const viteDevServer = getViteDevServer() diff --git a/vike/node/runtime/page-files/setup.ts b/vike/node/runtime/page-files/setup.ts index f0d6a2b230..0048f5f785 100644 --- a/vike/node/runtime/page-files/setup.ts +++ b/vike/node/runtime/page-files/setup.ts @@ -1,4 +1,4 @@ -import { setPageFilesAsync } from '../../../shared/getPageFiles.js' -import { getPageFilesExports } from './getPageFilesExports.js' +import { setPageFilesAsync } from '../../../shared/getPageFiles' +import { getPageFilesExports } from './getPageFilesExports' setPageFilesAsync(getPageFilesExports) diff --git a/vike/node/runtime/renderPage.ts b/vike/node/runtime/renderPage.ts index 8a2d145f83..17138f40fb 100644 --- a/vike/node/runtime/renderPage.ts +++ b/vike/node/runtime/renderPage.ts @@ -7,8 +7,8 @@ import { RenderContext, renderPageAlreadyRouted, PageContextInitEnhanced -} from './renderPage/renderPageAlreadyRouted.js' -import { route } from '../../shared/route/index.js' +} from './renderPage/renderPageAlreadyRouted' +import { route } from '../../shared/route/index' import { assert, hasProp, @@ -30,7 +30,7 @@ import { isUri, type UrlPublic, getUrlPretty -} from './utils.js' +} from './utils' import { assertNoInfiniteAbortLoop, ErrorAbort, @@ -38,32 +38,32 @@ import { isAbortError, logAbortErrorHandled, PageContextFromRewrite -} from '../../shared/route/abort.js' -import { getGlobalContext, initGlobalContext_renderPage } from './globalContext.js' -import { handlePageContextRequestUrl } from './renderPage/handlePageContextRequestUrl.js' +} from '../../shared/route/abort' +import { getGlobalContext, initGlobalContext_renderPage } from './globalContext' +import { handlePageContextRequestUrl } from './renderPage/handlePageContextRequestUrl' import { createHttpResponseFavicon404, createHttpResponseRedirect, createHttpResponsePageContextJson, HttpResponse, createHttpResponseError -} from './renderPage/createHttpResponse.js' -import { logRuntimeError, logRuntimeInfo } from './renderPage/loggerRuntime.js' -import { isNewError } from './renderPage/isNewError.js' -import { assertArguments } from './renderPage/assertArguments.js' -import type { PageContextDebugRouteMatches } from './renderPage/debugPageFiles.js' -import { log404 } from './renderPage/log404/index.js' -import { isConfigInvalid } from './renderPage/isConfigInvalid.js' +} from './renderPage/createHttpResponse' +import { logRuntimeError, logRuntimeInfo } from './renderPage/loggerRuntime' +import { isNewError } from './renderPage/isNewError' +import { assertArguments } from './renderPage/assertArguments' +import type { PageContextDebugRouteMatches } from './renderPage/debugPageFiles' +import { log404 } from './renderPage/log404/index' +import { isConfigInvalid } from './renderPage/isConfigInvalid' import pc from '@brillout/picocolors' -import type { PageContextServer } from '../../types/index.js' -import { serializePageContextAbort, serializePageContextClientSide } from './html/serializePageContextClientSide.js' -import { getErrorPageId } from '../../shared/error-page.js' -import { handleErrorWithoutErrorPage } from './renderPage/handleErrorWithoutErrorPage.js' -import { loadUserFilesServerSide } from './renderPage/loadUserFilesServerSide.js' -import { resolveRedirects } from './renderPage/resolveRedirects.js' -import { PageContextBuiltInServerInternal } from '../../shared/types.js' -import type { PageFile } from '../../shared/getPageFiles.js' -import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig.js' +import type { PageContextServer } from '../../types/index' +import { serializePageContextAbort, serializePageContextClientSide } from './html/serializePageContextClientSide' +import { getErrorPageId } from '../../shared/error-page' +import { handleErrorWithoutErrorPage } from './renderPage/handleErrorWithoutErrorPage' +import { loadUserFilesServerSide } from './renderPage/loadUserFilesServerSide' +import { resolveRedirects } from './renderPage/resolveRedirects' +import { PageContextBuiltInServerInternal } from '../../shared/types' +import type { PageFile } from '../../shared/getPageFiles' +import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig' const globalObject = getGlobalObject('runtime/renderPage.ts', { httpRequestsCount: 0 diff --git a/vike/node/runtime/renderPage/analyzePage.ts b/vike/node/runtime/renderPage/analyzePage.ts index 686418090b..9be33c3c2c 100644 --- a/vike/node/runtime/renderPage/analyzePage.ts +++ b/vike/node/runtime/renderPage/analyzePage.ts @@ -1,14 +1,14 @@ export { analyzePage } -import type { ClientDependency } from '../../../shared/getPageFiles/analyzePageClientSide/ClientDependency.js' -import { getVikeClientEntry } from '../../../shared/getPageFiles/analyzePageClientSide/determineClientEntry.js' -import type { PageFile } from '../../../shared/getPageFiles/getPageFileObject.js' -import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js' -import { type AnalysisResult, analyzePageClientSide } from '../../../shared/getPageFiles/analyzePageClientSide.js' -import { getVirtualFileIdPageConfigValuesAll } from '../../shared/virtual-files/virtualFilePageConfigValuesAll.js' -import { analyzeClientSide } from '../../../shared/getPageFiles/analyzeClientSide.js' -import { getGlobalContext } from '../globalContext.js' -import { getConfigValueRuntime } from '../../../shared/page-configs/getConfigValue.js' +import type { ClientDependency } from '../../../shared/getPageFiles/analyzePageClientSide/ClientDependency' +import { getVikeClientEntry } from '../../../shared/getPageFiles/analyzePageClientSide/determineClientEntry' +import type { PageFile } from '../../../shared/getPageFiles/getPageFileObject' +import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig' +import { type AnalysisResult, analyzePageClientSide } from '../../../shared/getPageFiles/analyzePageClientSide' +import { getVirtualFileIdPageConfigValuesAll } from '../../shared/virtual-files/virtualFilePageConfigValuesAll' +import { analyzeClientSide } from '../../../shared/getPageFiles/analyzeClientSide' +import { getGlobalContext } from '../globalContext' +import { getConfigValueRuntime } from '../../../shared/page-configs/getConfigValue' function analyzePage(pageFilesAll: PageFile[], pageConfig: null | PageConfigRuntime, pageId: string): AnalysisResult { if (pageConfig) { diff --git a/vike/node/runtime/renderPage/assertArguments.ts b/vike/node/runtime/renderPage/assertArguments.ts index cc40722847..86396ecb32 100644 --- a/vike/node/runtime/renderPage/assertArguments.ts +++ b/vike/node/runtime/renderPage/assertArguments.ts @@ -1,6 +1,6 @@ export { assertArguments } -import { assert, assertUsage, assertWarning, hasProp, isObject } from '../utils.js' +import { assert, assertUsage, assertWarning, hasProp, isObject } from '../utils' import pc from '@brillout/picocolors' function assertArguments(...args: unknown[]): void { diff --git a/vike/node/runtime/renderPage/createHttpResponse.ts b/vike/node/runtime/renderPage/createHttpResponse.ts index fb34774f68..2d5170aefd 100644 --- a/vike/node/runtime/renderPage/createHttpResponse.ts +++ b/vike/node/runtime/renderPage/createHttpResponse.ts @@ -5,18 +5,18 @@ export { createHttpResponseRedirect } export { createHttpResponseFavicon404 } export type { HttpResponse } -import type { GetPageAssets } from './getPageAssets.js' -import { assert, assertWarning, escapeHtml } from '../utils.js' -import type { HtmlRender } from '../html/renderHtml.js' -import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js' -import { getErrorPageId, isErrorPage } from '../../../shared/error-page.js' -import type { RenderHook } from './executeOnRenderHtmlHook.js' -import type { RedirectStatusCode, AbortStatusCode, UrlRedirect } from '../../../shared/route/abort.js' -import { getHttpResponseBody, getHttpResponseBodyStreamHandlers, HttpResponseBody } from './getHttpResponseBody.js' -import { getEarlyHints, type EarlyHint } from './getEarlyHints.js' -import { getCacheControl } from './createHttpResponse/getCacheControl.js' -import { assertNoInfiniteHttpRedirect } from './createHttpResponse/assertNoInfiniteHttpRedirect.js' -import type { PageFile } from '../../../shared/getPageFiles.js' +import type { GetPageAssets } from './getPageAssets' +import { assert, assertWarning, escapeHtml } from '../utils' +import type { HtmlRender } from '../html/renderHtml' +import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig' +import { getErrorPageId, isErrorPage } from '../../../shared/error-page' +import type { RenderHook } from './executeOnRenderHtmlHook' +import type { RedirectStatusCode, AbortStatusCode, UrlRedirect } from '../../../shared/route/abort' +import { getHttpResponseBody, getHttpResponseBodyStreamHandlers, HttpResponseBody } from './getHttpResponseBody' +import { getEarlyHints, type EarlyHint } from './getEarlyHints' +import { getCacheControl } from './createHttpResponse/getCacheControl' +import { assertNoInfiniteHttpRedirect } from './createHttpResponse/assertNoInfiniteHttpRedirect' +import type { PageFile } from '../../../shared/getPageFiles' type HttpResponse = { statusCode: 200 | 404 | 500 | RedirectStatusCode | AbortStatusCode diff --git a/vike/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.spec.ts b/vike/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.spec.ts index 3daa4fae63..665d1c213f 100644 --- a/vike/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.spec.ts +++ b/vike/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.spec.ts @@ -1,6 +1,6 @@ import { expect, describe, it, assert } from 'vitest' -import { stripAnsi } from '../../utils.js' -import { assertNoInfiniteHttpRedirect } from './assertNoInfiniteHttpRedirect.js' +import { stripAnsi } from '../../utils' +import { assertNoInfiniteHttpRedirect } from './assertNoInfiniteHttpRedirect' describe('assertNoInfiniteHttpRedirect()', () => { it('works', () => { diff --git a/vike/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.ts b/vike/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.ts index 14b99d7ef9..ac82b1696c 100644 --- a/vike/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.ts +++ b/vike/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.ts @@ -1,6 +1,6 @@ export { assertNoInfiniteHttpRedirect } -import { assert, assertUsage, getGlobalObject } from '../../utils.js' +import { assert, assertUsage, getGlobalObject } from '../../utils' import pc from '@brillout/picocolors' type Graph = Record> diff --git a/vike/node/runtime/renderPage/createHttpResponse/getCacheControl.ts b/vike/node/runtime/renderPage/createHttpResponse/getCacheControl.ts index 4a27983418..27eeaebf36 100644 --- a/vike/node/runtime/renderPage/createHttpResponse/getCacheControl.ts +++ b/vike/node/runtime/renderPage/createHttpResponse/getCacheControl.ts @@ -1,8 +1,8 @@ export { getCacheControl } -import type { PageConfigRuntime } from '../../../../shared/page-configs/PageConfig.js' -import { getPageConfig } from '../../../../shared/page-configs/helpers.js' -import { getConfigValueRuntime } from '../../../../shared/page-configs/getConfigValue.js' +import type { PageConfigRuntime } from '../../../../shared/page-configs/PageConfig' +import { getPageConfig } from '../../../../shared/page-configs/helpers' +import { getConfigValueRuntime } from '../../../../shared/page-configs/getConfigValue' const defaultValue = 'no-store, max-age=0' diff --git a/vike/node/runtime/renderPage/debugPageFiles.ts b/vike/node/runtime/renderPage/debugPageFiles.ts index e7f3fd148d..11251b6c90 100644 --- a/vike/node/runtime/renderPage/debugPageFiles.ts +++ b/vike/node/runtime/renderPage/debugPageFiles.ts @@ -1,12 +1,12 @@ export { debugPageFiles } export type { PageContextDebugRouteMatches } -import type { RouteMatches } from '../../../shared/route/index.js' -import type { ClientDependency } from '../../../shared/getPageFiles/analyzePageClientSide/ClientDependency.js' -import type { PageFile } from '../../../shared/getPageFiles.js' +import type { RouteMatches } from '../../../shared/route/index' +import type { ClientDependency } from '../../../shared/getPageFiles/analyzePageClientSide/ClientDependency' +import type { PageFile } from '../../../shared/getPageFiles' import pc from '@brillout/picocolors' -import { assert, makeFirst, createDebugger } from '../utils.js' -import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js' +import { assert, makeFirst, createDebugger } from '../utils' +import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig' type PageContextDebugRouteMatches = { _debugRouteMatches: 'ROUTING_ERROR' | RouteMatches diff --git a/vike/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.ts b/vike/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.ts index e299b3653d..798a8f5608 100644 --- a/vike/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.ts +++ b/vike/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.ts @@ -1,13 +1,13 @@ export { executeOnBeforeRenderAndDataHooks } -import { type PageContextExports } from '../../../shared/getPageFiles.js' -import { getHook } from '../../../shared/hooks/getHook.js' +import { type PageContextExports } from '../../../shared/getPageFiles' +import { getHook } from '../../../shared/hooks/getHook' import { preparePageContextForUserConsumptionServerSide, type PageContextForUserConsumptionServerSide -} from './preparePageContextForUserConsumptionServerSide.js' -import { assertOnBeforeRenderHookReturn } from '../../../shared/assertOnBeforeRenderHookReturn.js' -import { executeHook } from '../../../shared/hooks/executeHook.js' +} from './preparePageContextForUserConsumptionServerSide' +import { assertOnBeforeRenderHookReturn } from '../../../shared/assertOnBeforeRenderHookReturn' +import { executeHook } from '../../../shared/hooks/executeHook' async function executeOnBeforeRenderAndDataHooks( pageContext: { diff --git a/vike/node/runtime/renderPage/executeOnRenderHtmlHook.ts b/vike/node/runtime/renderPage/executeOnRenderHtmlHook.ts index 93b706d7a6..9958552930 100644 --- a/vike/node/runtime/renderPage/executeOnRenderHtmlHook.ts +++ b/vike/node/runtime/renderPage/executeOnRenderHtmlHook.ts @@ -7,24 +7,24 @@ import { renderDocumentHtml, DocumentHtml, dangerouslySkipEscape -} from '../html/renderHtml.js' -import { getHook, type Hook } from '../../../shared/hooks/getHook.js' -import { assert, assertUsage, assertWarning, isObject, objectAssign, isPromise, isCallable } from '../utils.js' -import type { PageAsset } from './getPageAssets.js' -import { isStream } from '../html/stream.js' -import { assertPageContextProvidedByUser } from '../../../shared/assertPageContextProvidedByUser.js' -import type { PreloadFilter } from '../html/injectAssets/getHtmlTags.js' +} from '../html/renderHtml' +import { getHook, type Hook } from '../../../shared/hooks/getHook' +import { assert, assertUsage, assertWarning, isObject, objectAssign, isPromise, isCallable } from '../utils' +import type { PageAsset } from './getPageAssets' +import { isStream } from '../html/stream' +import { assertPageContextProvidedByUser } from '../../../shared/assertPageContextProvidedByUser' +import type { PreloadFilter } from '../html/injectAssets/getHtmlTags' import { preparePageContextForUserConsumptionServerSide, type PageContextForUserConsumptionServerSide -} from './preparePageContextForUserConsumptionServerSide.js' -import type { PageContextPromise } from '../html/injectAssets.js' -import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js' -import { assertHookReturnedObject } from '../../../shared/assertHookReturnedObject.js' -import { logRuntimeError } from './loggerRuntime.js' -import type { PageContextSerialization } from '../html/serializePageContextClientSide.js' +} from './preparePageContextForUserConsumptionServerSide' +import type { PageContextPromise } from '../html/injectAssets' +import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig' +import { assertHookReturnedObject } from '../../../shared/assertHookReturnedObject' +import { logRuntimeError } from './loggerRuntime' +import type { PageContextSerialization } from '../html/serializePageContextClientSide' import pc from '@brillout/picocolors' -import { executeHook } from '../../../shared/hooks/executeHook.js' +import { executeHook } from '../../../shared/hooks/executeHook' type GetPageAssets = () => Promise diff --git a/vike/node/runtime/renderPage/getEarlyHints.ts b/vike/node/runtime/renderPage/getEarlyHints.ts index 4e647e4258..f353086333 100644 --- a/vike/node/runtime/renderPage/getEarlyHints.ts +++ b/vike/node/runtime/renderPage/getEarlyHints.ts @@ -1,9 +1,9 @@ export { getEarlyHints } export type { EarlyHint } -import { inferEarlyHintLink } from '../html/injectAssets/inferHtmlTags.js' -import { assert } from '../utils.js' -import type { PageAsset } from './getPageAssets.js' +import { inferEarlyHintLink } from '../html/injectAssets/inferHtmlTags' +import { assert } from '../utils' +import type { PageAsset } from './getPageAssets' type EarlyHint = PageAsset & { earlyHintLink: string diff --git a/vike/node/runtime/renderPage/getHttpResponseBody.ts b/vike/node/runtime/renderPage/getHttpResponseBody.ts index 86fcb413c7..67122e16a9 100644 --- a/vike/node/runtime/renderPage/getHttpResponseBody.ts +++ b/vike/node/runtime/renderPage/getHttpResponseBody.ts @@ -22,10 +22,10 @@ import { getStreamReadableWeb, pipeToStreamWritableWeb, pipeToStreamWritableNode -} from '../html/stream.js' -import { assert, assertUsage, assertWarning } from '../utils.js' -import { getHtmlString, type HtmlRender } from '../html/renderHtml.js' -import type { RenderHook } from './executeOnRenderHtmlHook.js' +} from '../html/stream' +import { assert, assertUsage, assertWarning } from '../utils' +import { getHtmlString, type HtmlRender } from '../html/renderHtml' +import type { RenderHook } from './executeOnRenderHtmlHook' import pc from '@brillout/picocolors' const streamDocs = 'See https://vike.dev/streaming for more information.' diff --git a/vike/node/runtime/renderPage/getPageAssets.ts b/vike/node/runtime/renderPage/getPageAssets.ts index a3523c5585..71129ab0aa 100644 --- a/vike/node/runtime/renderPage/getPageAssets.ts +++ b/vike/node/runtime/renderPage/getPageAssets.ts @@ -4,16 +4,16 @@ export type { PageAsset } export type { GetPageAssets } export type { PageContextGetPageAssets } -import { assert, prependBase, toPosixPath, unique, getGlobalObject } from '../utils.js' -import { retrieveAssetsDev } from './getPageAssets/retrieveAssetsDev.js' -import { retrieveAssetsProd } from './getPageAssets/retrieveAssetsProd.js' -import { inferMediaType, type MediaType } from './inferMediaType.js' -import { getManifestEntry } from './getPageAssets/getManifestEntry.js' -import type { ClientDependency } from '../../../shared/getPageFiles/analyzePageClientSide/ClientDependency.js' -import { sortPageAssetsForEarlyHintsHeader } from './getPageAssets/sortPageAssetsForEarlyHintsHeader.js' -import { getGlobalContext } from '../globalContext.js' -import type { ViteManifest } from '../../shared/ViteManifest.js' -import type { ResolveClientEntriesDev } from '../../plugin/resolveClientEntriesDev.js' +import { assert, prependBase, toPosixPath, unique, getGlobalObject } from '../utils' +import { retrieveAssetsDev } from './getPageAssets/retrieveAssetsDev' +import { retrieveAssetsProd } from './getPageAssets/retrieveAssetsProd' +import { inferMediaType, type MediaType } from './inferMediaType' +import { getManifestEntry } from './getPageAssets/getManifestEntry' +import type { ClientDependency } from '../../../shared/getPageFiles/analyzePageClientSide/ClientDependency' +import { sortPageAssetsForEarlyHintsHeader } from './getPageAssets/sortPageAssetsForEarlyHintsHeader' +import { getGlobalContext } from '../globalContext' +import type { ViteManifest } from '../../shared/ViteManifest' +import type { ResolveClientEntriesDev } from '../../plugin/resolveClientEntriesDev' const globalObject = getGlobalObject('getPageAssets.ts', { resolveClientEntriesDev: null as null | ResolveClientEntriesDev diff --git a/vike/node/runtime/renderPage/getPageAssets/getManifestEntry.ts b/vike/node/runtime/renderPage/getPageAssets/getManifestEntry.ts index 1515c7c4bd..7de2a1122a 100644 --- a/vike/node/runtime/renderPage/getPageAssets/getManifestEntry.ts +++ b/vike/node/runtime/renderPage/getPageAssets/getManifestEntry.ts @@ -1,9 +1,9 @@ export { getManifestEntry } -import type { ViteManifest, ViteManifestEntry } from '../../../shared/ViteManifest.js' -import { assert, slice, assertIsNpmPackageImport } from '../../utils.js' -import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll.js' -import { prependEntriesDir } from '../../../shared/prependEntriesDir.js' +import type { ViteManifest, ViteManifestEntry } from '../../../shared/ViteManifest' +import { assert, slice, assertIsNpmPackageImport } from '../../utils' +import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll' +import { prependEntriesDir } from '../../../shared/prependEntriesDir' function getManifestEntry( id: string, diff --git a/vike/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.ts b/vike/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.ts index 920ac495ff..ad921f198c 100644 --- a/vike/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.ts +++ b/vike/node/runtime/renderPage/getPageAssets/retrieveAssetsDev.ts @@ -1,8 +1,8 @@ export { retrieveAssetsDev } -import { assert, styleFileRE } from '../../utils.js' +import { assert, styleFileRE } from '../../utils' import type { ModuleNode, ViteDevServer } from 'vite' -import type { ClientDependency } from '../../../../shared/getPageFiles/analyzePageClientSide/ClientDependency.js' +import type { ClientDependency } from '../../../../shared/getPageFiles/analyzePageClientSide/ClientDependency' async function retrieveAssetsDev(clientDependencies: ClientDependency[], viteDevServer: ViteDevServer) { const visitedModules = new Set() diff --git a/vike/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.ts b/vike/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.ts index 77aa6e1f1d..d891146595 100644 --- a/vike/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.ts +++ b/vike/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.ts @@ -1,10 +1,10 @@ export { retrieveAssetsProd } -import { assert, isNpmPackageImport } from '../../utils.js' -import type { ViteManifest } from '../../../shared/ViteManifest.js' -import { getManifestEntry } from './getManifestEntry.js' -import { extractAssetsAddQuery } from '../../../shared/extractAssetsQuery.js' -import type { ClientDependency } from '../../../../shared/getPageFiles/analyzePageClientSide/ClientDependency.js' +import { assert, isNpmPackageImport } from '../../utils' +import type { ViteManifest } from '../../../shared/ViteManifest' +import { getManifestEntry } from './getManifestEntry' +import { extractAssetsAddQuery } from '../../../shared/extractAssetsQuery' +import type { ClientDependency } from '../../../../shared/getPageFiles/analyzePageClientSide/ClientDependency' function retrieveAssetsProd( clientDependencies: ClientDependency[], diff --git a/vike/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.ts b/vike/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.ts index a3b92bdefe..b76335d8cf 100644 --- a/vike/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.ts +++ b/vike/node/runtime/renderPage/getPageAssets/sortPageAssetsForEarlyHintsHeader.ts @@ -1,8 +1,8 @@ export { sortPageAssetsForEarlyHintsHeader } -import { getGlobalContext } from '../../globalContext.js' -import { higherFirst } from '../../utils.js' -import type { PageAsset } from '../getPageAssets.js' +import { getGlobalContext } from '../../globalContext' +import { higherFirst } from '../../utils' +import type { PageAsset } from '../getPageAssets' function sortPageAssetsForEarlyHintsHeader(pageAssets: PageAsset[]) { const globalContext = getGlobalContext() diff --git a/vike/node/runtime/renderPage/handleErrorWithoutErrorPage.ts b/vike/node/runtime/renderPage/handleErrorWithoutErrorPage.ts index 54bb937e2a..667bfc4695 100644 --- a/vike/node/runtime/renderPage/handleErrorWithoutErrorPage.ts +++ b/vike/node/runtime/renderPage/handleErrorWithoutErrorPage.ts @@ -1,14 +1,14 @@ export { handleErrorWithoutErrorPage } import { stringify } from '@brillout/json-serializer/stringify' -import { getGlobalContext } from '../globalContext.js' -import { assert, assertWarning, objectAssign } from '../utils.js' -import { createHttpResponsePage, createHttpResponseError } from './createHttpResponse.js' +import { getGlobalContext } from '../globalContext' +import { assert, assertWarning, objectAssign } from '../utils' +import { createHttpResponsePage, createHttpResponseError } from './createHttpResponse' import pc from '@brillout/picocolors' -import type { GetPageAssets } from './getPageAssets.js' -import type { PageContextAfterRender } from './renderPageAlreadyRouted.js' -import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js' -import type { PageFile } from '../../../shared/getPageFiles.js' +import type { GetPageAssets } from './getPageAssets' +import type { PageContextAfterRender } from './renderPageAlreadyRouted' +import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig' +import type { PageFile } from '../../../shared/getPageFiles' // When the user hasn't defined _error.page.js async function handleErrorWithoutErrorPage< diff --git a/vike/node/runtime/renderPage/handlePageContextRequestUrl.ts b/vike/node/runtime/renderPage/handlePageContextRequestUrl.ts index 1a96f6c381..5c29becb7e 100644 --- a/vike/node/runtime/renderPage/handlePageContextRequestUrl.ts +++ b/vike/node/runtime/renderPage/handlePageContextRequestUrl.ts @@ -1,7 +1,7 @@ export { handlePageContextRequestUrl } -import { pageContextJsonFileExtension, doNotCreateExtraDirectory } from '../../../shared/getPageContextRequestUrl.js' -import { baseServer, parseUrl, assert, slice } from '../utils.js' +import { pageContextJsonFileExtension, doNotCreateExtraDirectory } from '../../../shared/getPageContextRequestUrl' +import { baseServer, parseUrl, assert, slice } from '../utils' // See shared/getPageContextRequestUrl.ts function handlePageContextRequestUrl(url: string): { diff --git a/vike/node/runtime/renderPage/inferMediaType.ts b/vike/node/runtime/renderPage/inferMediaType.ts index f745cf8d76..26510e2b07 100644 --- a/vike/node/runtime/renderPage/inferMediaType.ts +++ b/vike/node/runtime/renderPage/inferMediaType.ts @@ -1,7 +1,7 @@ export { inferMediaType } export type { MediaType } -import { styleFileRE, isScriptFile } from '../utils.js' +import { styleFileRE, isScriptFile } from '../utils' type MediaType = null | { // List of `as` values: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as diff --git a/vike/node/runtime/renderPage/isConfigInvalid.ts b/vike/node/runtime/renderPage/isConfigInvalid.ts index 34c1f9731b..1513af6f9d 100644 --- a/vike/node/runtime/renderPage/isConfigInvalid.ts +++ b/vike/node/runtime/renderPage/isConfigInvalid.ts @@ -1,7 +1,7 @@ export { isConfigInvalid } export { isConfigInvalid_set } -import { assert } from '../utils.js' +import { assert } from '../utils' let isConfigInvalid: false | { err: unknown } diff --git a/vike/node/runtime/renderPage/isNewError.ts b/vike/node/runtime/renderPage/isNewError.ts index 24dac90bc6..33bbcc28d2 100644 --- a/vike/node/runtime/renderPage/isNewError.ts +++ b/vike/node/runtime/renderPage/isNewError.ts @@ -1,7 +1,7 @@ export { isNewError } export { setAlreadyLogged } -import { getGlobalObject, isObject, isSameErrorMessage, warnIfErrorIsNotObject } from '../utils.js' +import { getGlobalObject, isObject, isSameErrorMessage, warnIfErrorIsNotObject } from '../utils' const globalObject = getGlobalObject('runtime/renderPage/isNewError.ts', { wasAlreadyLogged: new WeakSet() diff --git a/vike/node/runtime/renderPage/loadUserFilesServerSide.ts b/vike/node/runtime/renderPage/loadUserFilesServerSide.ts index e3bfec0dcb..f04ac369d9 100644 --- a/vike/node/runtime/renderPage/loadUserFilesServerSide.ts +++ b/vike/node/runtime/renderPage/loadUserFilesServerSide.ts @@ -2,8 +2,8 @@ export { loadUserFilesServerSide } export type { PageFiles } export type { PageContext_loadUserFilesServerSide } -import { type PageFile, getPageFilesServerSide, getPageContextExports } from '../../../shared/getPageFiles.js' -import { analyzePageClientSideInit } from '../../../shared/getPageFiles/analyzePageClientSide.js' +import { type PageFile, getPageFilesServerSide, getPageContextExports } from '../../../shared/getPageFiles' +import { analyzePageClientSideInit } from '../../../shared/getPageFiles/analyzePageClientSide' import { assert, assertUsage, @@ -13,15 +13,15 @@ import { objectAssign, PromiseType, isArray -} from '../utils.js' -import { getPageAssets, PageContextGetPageAssets, type PageAsset } from './getPageAssets.js' -import { debugPageFiles, type PageContextDebugRouteMatches } from './debugPageFiles.js' -import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js' -import { findPageConfig } from '../../../shared/page-configs/findPageConfig.js' -import { analyzePage } from './analyzePage.js' -import { getGlobalContext } from '../globalContext.js' -import type { MediaType } from './inferMediaType.js' -import { loadConfigValues } from '../../../shared/page-configs/loadConfigValues.js' +} from '../utils' +import { getPageAssets, PageContextGetPageAssets, type PageAsset } from './getPageAssets' +import { debugPageFiles, type PageContextDebugRouteMatches } from './debugPageFiles' +import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig' +import { findPageConfig } from '../../../shared/page-configs/findPageConfig' +import { analyzePage } from './analyzePage' +import { getGlobalContext } from '../globalContext' +import type { MediaType } from './inferMediaType' +import { loadConfigValues } from '../../../shared/page-configs/loadConfigValues' type PageContext_loadUserFilesServerSide = PageContextGetPageAssets & PageContextDebugRouteMatches & { diff --git a/vike/node/runtime/renderPage/log404/index.spec.ts b/vike/node/runtime/renderPage/log404/index.spec.ts index 41ea36b268..dce884d671 100644 --- a/vike/node/runtime/renderPage/log404/index.spec.ts +++ b/vike/node/runtime/renderPage/log404/index.spec.ts @@ -1,7 +1,7 @@ import { expect, describe, it, assert } from 'vitest' -import { getRoutesInfo } from '../log404/index.js' -import { stripAnsi } from '../../utils.js' -import type { PageRoutes } from '../../../../shared/route/index.js' +import { getRoutesInfo } from '../log404/index' +import { stripAnsi } from '../../utils' +import type { PageRoutes } from '../../../../shared/route/index' process.stdout.columns = 134 diff --git a/vike/node/runtime/renderPage/log404/index.ts b/vike/node/runtime/renderPage/log404/index.ts index 7ef68107d7..61381822e4 100644 --- a/vike/node/runtime/renderPage/log404/index.ts +++ b/vike/node/runtime/renderPage/log404/index.ts @@ -3,9 +3,9 @@ export { log404 } // Exported for ./index.spec.ts export { getRoutesInfo } -import type { PageRoutes } from '../../../../shared/route/index.js' -import { noRouteMatch } from '../../../../shared/route/noRouteMatch.js' -import { getGlobalContext } from '../../globalContext.js' +import type { PageRoutes } from '../../../../shared/route/index' +import { noRouteMatch } from '../../../../shared/route/noRouteMatch' +import { getGlobalContext } from '../../globalContext' import { assert, assertUsage, @@ -14,7 +14,7 @@ import { stripAnsi, getTerminalWidth, truncateString -} from '../../utils.js' +} from '../../utils' import pc from '@brillout/picocolors' async function log404(pageContext: { diff --git a/vike/node/runtime/renderPage/logErrorHint.ts b/vike/node/runtime/renderPage/logErrorHint.ts index d38870610d..961fe64043 100644 --- a/vike/node/runtime/renderPage/logErrorHint.ts +++ b/vike/node/runtime/renderPage/logErrorHint.ts @@ -2,7 +2,7 @@ export { logErrorHint } // For ./logErrorHint/getErrorHint.spec.ts export { getErrorHint } -import { assert, formatHintLog, isObject } from '../utils.js' +import { assert, formatHintLog, isObject } from '../utils' import pc from '@brillout/picocolors' const hintDefault = 'The error could be a CJS/ESM issue, see https://vike.dev/broken-npm-package' diff --git a/vike/node/runtime/renderPage/loggerProd.ts b/vike/node/runtime/renderPage/loggerProd.ts index 98cdcbdd04..4c645a32e8 100644 --- a/vike/node/runtime/renderPage/loggerProd.ts +++ b/vike/node/runtime/renderPage/loggerProd.ts @@ -4,11 +4,11 @@ export { logErrorProd } export { onRuntimeError } -import { isAbortError } from '../../../shared/route/abort.js' -import { setAlreadyLogged } from './isNewError.js' -import { isObject, warnIfErrorIsNotObject } from '../utils.js' +import { isAbortError } from '../../../shared/route/abort' +import { setAlreadyLogged } from './isNewError' +import { isObject, warnIfErrorIsNotObject } from '../utils' import pc from '@brillout/picocolors' -import { logErrorHint } from './logErrorHint.js' +import { logErrorHint } from './logErrorHint' function logErrorProd(err: unknown, _httpRquestId: null | number): void { warnIfErrorIsNotObject(err) diff --git a/vike/node/runtime/renderPage/loggerRuntime.ts b/vike/node/runtime/renderPage/loggerRuntime.ts index ab71b88b29..7b0705c08a 100644 --- a/vike/node/runtime/renderPage/loggerRuntime.ts +++ b/vike/node/runtime/renderPage/loggerRuntime.ts @@ -4,8 +4,8 @@ export let logRuntimeError: LogError export let logRuntimeInfo: null | LogInfo = null // logInfo is null in production export { overwriteRuntimeProductionLogger } -import { logErrorProd } from './loggerProd.js' -import type { LogError, LogInfo } from '../../plugin/shared/loggerNotProd.js' +import { logErrorProd } from './loggerProd' +import type { LogError, LogInfo } from '../../plugin/shared/loggerNotProd' // Set production logger (which is overwritten by loggerNotProd.ts in non-production environments such as development and during pre-rendering) logRuntimeError = diff --git a/vike/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.ts b/vike/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.ts index 1837c106fb..91917254c5 100644 --- a/vike/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.ts +++ b/vike/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.ts @@ -1,12 +1,12 @@ export { preparePageContextForUserConsumptionServerSide } export type { PageContextForUserConsumptionServerSide } -import { assert, isPlainObject } from '../utils.js' -import { assertPageContextUrl, PageContextUrlInternal } from '../../../shared/getPageContextUrlComputed.js' -import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig.js' -import type { PageContextExports } from '../../../shared/getPageFiles/getExports.js' -import { PageContextBuiltInServerInternal } from '../../../shared/types.js' -import { preparePageContextForUserConsumption } from '../../../shared/preparePageContextForUserConsumption.js' +import { assert, isPlainObject } from '../utils' +import { assertPageContextUrl, PageContextUrlInternal } from '../../../shared/getPageContextUrlComputed' +import type { PageConfigRuntime } from '../../../shared/page-configs/PageConfig' +import type { PageContextExports } from '../../../shared/getPageFiles/getExports' +import { PageContextBuiltInServerInternal } from '../../../shared/types' +import { preparePageContextForUserConsumption } from '../../../shared/preparePageContextForUserConsumption' type PageContextForUserConsumptionServerSide = PageContextBuiltInServerInternal & PageContextExports & { diff --git a/vike/node/runtime/renderPage/renderPageAlreadyRouted.ts b/vike/node/runtime/renderPage/renderPageAlreadyRouted.ts index 17ffc21d32..d55c2edcc6 100644 --- a/vike/node/runtime/renderPage/renderPageAlreadyRouted.ts +++ b/vike/node/runtime/renderPage/renderPageAlreadyRouted.ts @@ -7,31 +7,31 @@ export type { RenderContext } export type { PageContextAfterRender } export type { PageContextInitEnhanced } -import { getErrorPageId } from '../../../shared/error-page.js' -import { getHtmlString } from '../html/renderHtml.js' -import { type PageFile, getPageFilesAll } from '../../../shared/getPageFiles.js' -import { assert, assertUsage, assertWarning, hasProp, normalizeHeaders, objectAssign } from '../utils.js' -import { serializePageContextClientSide } from '../html/serializePageContextClientSide.js' -import { getPageContextUrlComputed, type PageContextUrlInternal } from '../../../shared/getPageContextUrlComputed.js' -import { getGlobalContext } from '../globalContext.js' -import { createHttpResponsePage, createHttpResponsePageContextJson, HttpResponse } from './createHttpResponse.js' +import { getErrorPageId } from '../../../shared/error-page' +import { getHtmlString } from '../html/renderHtml' +import { type PageFile, getPageFilesAll } from '../../../shared/getPageFiles' +import { assert, assertUsage, assertWarning, hasProp, normalizeHeaders, objectAssign } from '../utils' +import { serializePageContextClientSide } from '../html/serializePageContextClientSide' +import { getPageContextUrlComputed, type PageContextUrlInternal } from '../../../shared/getPageContextUrlComputed' +import { getGlobalContext } from '../globalContext' +import { createHttpResponsePage, createHttpResponsePageContextJson, HttpResponse } from './createHttpResponse' import { loadUserFilesServerSide, PageContext_loadUserFilesServerSide, type PageFiles -} from './loadUserFilesServerSide.js' -import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../../../shared/page-configs/PageConfig.js' -import { executeOnRenderHtmlHook } from './executeOnRenderHtmlHook.js' -import { executeOnBeforeRenderAndDataHooks } from './executeOnBeforeRenderAndDataHooks.js' -import { logRuntimeError } from './loggerRuntime.js' -import { isNewError } from './isNewError.js' -import { preparePageContextForUserConsumptionServerSide } from './preparePageContextForUserConsumptionServerSide.js' -import { executeGuardHook } from '../../../shared/route/executeGuardHook.js' -import { loadPageRoutes, type PageRoutes } from '../../../shared/route/loadPageRoutes.js' +} from './loadUserFilesServerSide' +import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../../../shared/page-configs/PageConfig' +import { executeOnRenderHtmlHook } from './executeOnRenderHtmlHook' +import { executeOnBeforeRenderAndDataHooks } from './executeOnBeforeRenderAndDataHooks' +import { logRuntimeError } from './loggerRuntime' +import { isNewError } from './isNewError' +import { preparePageContextForUserConsumptionServerSide } from './preparePageContextForUserConsumptionServerSide' +import { executeGuardHook } from '../../../shared/route/executeGuardHook' +import { loadPageRoutes, type PageRoutes } from '../../../shared/route/loadPageRoutes' import pc from '@brillout/picocolors' -import type { Hook } from '../../../shared/hooks/getHook.js' -import { isServerSideError } from '../../../shared/misc/isServerSideError.js' -import { assertV1Design } from '../../shared/assertV1Design.js' +import type { Hook } from '../../../shared/hooks/getHook' +import { isServerSideError } from '../../../shared/misc/isServerSideError' +import { assertV1Design } from '../../shared/assertV1Design' type PageContextAfterRender = { httpResponse: HttpResponse; errorWhileRendering: null | Error } diff --git a/vike/node/runtime/renderPage/resolveRedirects.spec.ts b/vike/node/runtime/renderPage/resolveRedirects.spec.ts index 9b89ea7065..03eb603a76 100644 --- a/vike/node/runtime/renderPage/resolveRedirects.spec.ts +++ b/vike/node/runtime/renderPage/resolveRedirects.spec.ts @@ -1,5 +1,5 @@ -import { resolveRouteStringRedirect } from './resolveRedirects.js' -import { stripAnsi } from '../../../utils/stripAnsi.js' +import { resolveRouteStringRedirect } from './resolveRedirects' +import { stripAnsi } from '../../../utils/stripAnsi' import { expect, describe, it } from 'vitest' describe('resolveRouteStringRedirect', () => { diff --git a/vike/node/runtime/renderPage/resolveRedirects.ts b/vike/node/runtime/renderPage/resolveRedirects.ts index f7b1673784..d72e46a67d 100644 --- a/vike/node/runtime/renderPage/resolveRedirects.ts +++ b/vike/node/runtime/renderPage/resolveRedirects.ts @@ -3,10 +3,10 @@ export { resolveRedirects } // For ./resolveRedirects.spec.ts export { resolveRouteStringRedirect } -import { assertIsNotBrowser } from '../../../utils/assertIsNotBrowser.js' -import { assert, assertUsage, assertUsageUrlRedirectTarget, isUrlRedirectTarget } from '../../../shared/utils.js' -import { resolveUrlPathname } from '../../../shared/route/resolveUrlPathname.js' -import { assertRouteString, resolveRouteString } from '../../../shared/route/resolveRouteString.js' +import { assertIsNotBrowser } from '../../../utils/assertIsNotBrowser' +import { assert, assertUsage, assertUsageUrlRedirectTarget, isUrlRedirectTarget } from '../../../shared/utils' +import { resolveUrlPathname } from '../../../shared/route/resolveUrlPathname' +import { assertRouteString, resolveRouteString } from '../../../shared/route/resolveRouteString' import pc from '@brillout/picocolors' assertIsNotBrowser() // Don't bloat the client diff --git a/vike/node/runtime/utils.ts b/vike/node/runtime/utils.ts index d90f92c4f4..edcd4f4f11 100644 --- a/vike/node/runtime/utils.ts +++ b/vike/node/runtime/utils.ts @@ -1,64 +1,64 @@ -import '../../utils/trackLogs.js' +import '../../utils/trackLogs' // We assume all runtime entries will load this utils.ts file -import { onLoad } from './onLoad.js' +import { onLoad } from './onLoad' onLoad() -export * from '../../utils/assert.js' -export * from '../../utils/cast.js' -export * from '../../utils/checkType.js' -export * from '../../utils/isCallable.js' -export * from '../../utils/isBrowser.js' -export * from '../../utils/isPlainObject.js' -export * from '../../utils/isPromise.js' -export * from '../../utils/hasProp.js' -export * from '../../utils/parseUrl.js' -export * from '../../utils/parseUrl-extras.js' -export * from '../../utils/slice.js' -export * from '../../utils/sorter.js' -export * from '../../utils/projectInfo.js' -export * from '../../utils/isArray.js' -export * from '../../utils/isObject.js' -export * from '../../utils/objectAssign.js' -export * from '../../utils/PromiseType.js' -export * from '../../utils/compareString.js' -export * from '../../utils/isObjectWithKeys.js' -export * from '../../utils/stringifyStringArray.js' -export * from '../../utils/unique.js' -export * from '../../utils/filesystemPathHandling.js' -export * from '../../utils/getOutDirs.js' -export * from '../../utils/capitalizeFirstLetter.js' -export * from '../../utils/debugGlob.js' -export * from '../../utils/isSameErrorMessage.js' -export * from '../../utils/styleFileRE.js' -export * from '../../utils/isPropertyGetter.js' -export * from '../../utils/debug.js' -export * from '../../utils/urlToFile.js' -export * from '../../utils/getGlobalObject.js' -export * from '../../utils/freezePartial.js' -export * from '../../utils/isNpmPackage.js' -export * from '../../utils/isNotNullish.js' -export * from '../../utils/isScriptFile.js' -export * from '../../utils/removeFileExtention.js' -export * from '../../utils/objectKeys.js' -export * from '../../utils/objectEntries.js' -export * from '../../utils/objectFromEntries.js' -export * from '../../utils/getFileExtension.js' -export * from '../../utils/assertIsNotProductionRuntime.js' -export * from '../../utils/virtual-files.js' -export * from '../../utils/path-shim.js' -export * from '../../utils/assertNodeEnv.js' -export * from '../../utils/isHtml.js' -export * from '../../utils/warnIfErrorIsNotObject.js' -export * from '../../utils/stripAnsi.js' -export * from '../../utils/getTerminWidth.js' -export * from '../../utils/truncateString.js' -export * from '../../utils/formatHintLog.js' -export * from '../../utils/joinEnglish.js' -export * from '../../utils/isArrayOfStrings.js' -export * from '../../utils/escapeHtml.js' -export * from '../../utils/normalizeHeaders.js' -export * from '../../utils/isVikeReactApp.js' -export * from '../../utils/getPropAccessNotation.js' -export * from '../../utils/PROJECT_VERSION.js' -export * from '../../utils/genPromise.js' +export * from '../../utils/assert' +export * from '../../utils/cast' +export * from '../../utils/checkType' +export * from '../../utils/isCallable' +export * from '../../utils/isBrowser' +export * from '../../utils/isPlainObject' +export * from '../../utils/isPromise' +export * from '../../utils/hasProp' +export * from '../../utils/parseUrl' +export * from '../../utils/parseUrl-extras' +export * from '../../utils/slice' +export * from '../../utils/sorter' +export * from '../../utils/projectInfo' +export * from '../../utils/isArray' +export * from '../../utils/isObject' +export * from '../../utils/objectAssign' +export * from '../../utils/PromiseType' +export * from '../../utils/compareString' +export * from '../../utils/isObjectWithKeys' +export * from '../../utils/stringifyStringArray' +export * from '../../utils/unique' +export * from '../../utils/filesystemPathHandling' +export * from '../../utils/getOutDirs' +export * from '../../utils/capitalizeFirstLetter' +export * from '../../utils/debugGlob' +export * from '../../utils/isSameErrorMessage' +export * from '../../utils/styleFileRE' +export * from '../../utils/isPropertyGetter' +export * from '../../utils/debug' +export * from '../../utils/urlToFile' +export * from '../../utils/getGlobalObject' +export * from '../../utils/freezePartial' +export * from '../../utils/isNpmPackage' +export * from '../../utils/isNotNullish' +export * from '../../utils/isScriptFile' +export * from '../../utils/removeFileExtention' +export * from '../../utils/objectKeys' +export * from '../../utils/objectEntries' +export * from '../../utils/objectFromEntries' +export * from '../../utils/getFileExtension' +export * from '../../utils/assertIsNotProductionRuntime' +export * from '../../utils/virtual-files' +export * from '../../utils/path-shim' +export * from '../../utils/assertNodeEnv' +export * from '../../utils/isHtml' +export * from '../../utils/warnIfErrorIsNotObject' +export * from '../../utils/stripAnsi' +export * from '../../utils/getTerminWidth' +export * from '../../utils/truncateString' +export * from '../../utils/formatHintLog' +export * from '../../utils/joinEnglish' +export * from '../../utils/isArrayOfStrings' +export * from '../../utils/escapeHtml' +export * from '../../utils/normalizeHeaders' +export * from '../../utils/isVikeReactApp' +export * from '../../utils/getPropAccessNotation' +export * from '../../utils/PROJECT_VERSION' +export * from '../../utils/genPromise' diff --git a/vike/node/shared/assertPluginManifest.ts b/vike/node/shared/assertPluginManifest.ts index 7805debe48..9523623582 100644 --- a/vike/node/shared/assertPluginManifest.ts +++ b/vike/node/shared/assertPluginManifest.ts @@ -1,8 +1,8 @@ export { assertPluginManifest } export type { PluginManifest } -import { assertRuntimeManifest } from './assertRuntimeManifest.js' -import { assert, assertUsage, isPlainObject, projectInfo, checkType, hasProp } from './utils.js' +import { assertRuntimeManifest } from './assertRuntimeManifest' +import { assert, assertUsage, isPlainObject, projectInfo, checkType, hasProp } from './utils' type PluginManifest = { version: string diff --git a/vike/node/shared/assertRuntimeManifest.ts b/vike/node/shared/assertRuntimeManifest.ts index 191dc6caea..b08c3350b6 100644 --- a/vike/node/shared/assertRuntimeManifest.ts +++ b/vike/node/shared/assertRuntimeManifest.ts @@ -1,7 +1,7 @@ export { assertRuntimeManifest } export type { RuntimeManifest } -import { assert, castType, checkType, hasProp, isBaseAssets, isBaseServer, isObject } from './utils.js' +import { assert, castType, checkType, hasProp, isBaseAssets, isBaseServer, isObject } from './utils' type RuntimeManifest = { baseServer: string diff --git a/vike/node/shared/assertV1Design.ts b/vike/node/shared/assertV1Design.ts index b027664e3c..829d374672 100644 --- a/vike/node/shared/assertV1Design.ts +++ b/vike/node/shared/assertV1Design.ts @@ -2,9 +2,9 @@ export { assertV1Design } // TODO/next-major-release: remove -import { PageFile } from '../../shared/getPageFiles.js' -import type { PageConfigBuildTime } from '../../shared/page-configs/PageConfig.js' -import { assert, assertUsage, assertWarning, isNotNullish, unique } from './utils.js' +import { PageFile } from '../../shared/getPageFiles' +import type { PageConfigBuildTime } from '../../shared/page-configs/PageConfig' +import { assert, assertUsage, assertWarning, isNotNullish, unique } from './utils' function assertV1Design(pageConfigs: PageConfigBuildTime[] | boolean, pageFilesAll: PageFile[] | boolean): void { const isOldDesign = pageFilesAll === true || (pageFilesAll !== false && pageFilesAll.length > 0) diff --git a/vike/node/shared/extractAssetsQuery.ts b/vike/node/shared/extractAssetsQuery.ts index 5cade9a5dc..30d7ca3266 100644 --- a/vike/node/shared/extractAssetsQuery.ts +++ b/vike/node/shared/extractAssetsQuery.ts @@ -2,7 +2,7 @@ export { extractAssetsAddQuery } export { extractAssetsRemoveQuery } // We import from node/utils.ts insead of node/plugin/utils.ts because this file is loaded by the server runtime -import { assert, getFileExtension } from './utils.js' +import { assert, getFileExtension } from './utils' const query = 'extractAssets' diff --git a/vike/node/shared/getConfigVike.ts b/vike/node/shared/getConfigVike.ts index e8e79e2b5d..b421e65406 100644 --- a/vike/node/shared/getConfigVike.ts +++ b/vike/node/shared/getConfigVike.ts @@ -1,8 +1,8 @@ export { getConfigVike } import { ResolvedConfig } from 'vite' -import type { ConfigVikeResolved } from '../../shared/ConfigVike.js' -import { assert } from './utils.js' +import type { ConfigVikeResolved } from '../../shared/ConfigVike' +import { assert } from './utils' async function getConfigVike(config: ResolvedConfig): Promise { const { configVikePromise } = config as any diff --git a/vike/node/shared/isErrorDebug.ts b/vike/node/shared/isErrorDebug.ts index ada8921959..c49341d60c 100644 --- a/vike/node/shared/isErrorDebug.ts +++ b/vike/node/shared/isErrorDebug.ts @@ -1,6 +1,6 @@ export { isErrorDebug } -import { isDebugActivated } from './utils.js' +import { isDebugActivated } from './utils' function isErrorDebug(): boolean { return isDebugActivated('vike:error') diff --git a/vike/node/shared/prependEntriesDir.ts b/vike/node/shared/prependEntriesDir.ts index 1069891685..fab7813b06 100644 --- a/vike/node/shared/prependEntriesDir.ts +++ b/vike/node/shared/prependEntriesDir.ts @@ -1,6 +1,6 @@ export { prependEntriesDir } -import { assert } from './utils.js' +import { assert } from './utils' function prependEntriesDir(entryName: string): string { if (entryName.startsWith('/')) { diff --git a/vike/node/shared/utils.ts b/vike/node/shared/utils.ts index c56a251298..c5b1a79bad 100644 --- a/vike/node/shared/utils.ts +++ b/vike/node/shared/utils.ts @@ -1,20 +1,20 @@ -import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser.js' +import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser' assertIsNotBrowser() -export * from '../../utils/assert.js' -export * from '../../utils/getFileExtension.js' -export * from '../../utils/isPlainObject.js' -export * from '../../utils/projectInfo.js' -export * from '../../utils/checkType.js' -export * from '../../utils/hasProp.js' -export * from '../../utils/objectAssign.js' -export * from '../../utils/checkType.js' -export * from '../../utils/hasProp.js' -export * from '../../utils/parseUrl.js' -export * from '../../utils/parseUrl-extras.js' -export * from '../../utils/isObject.js' -export * from '../../utils/virtual-files.js' -export * from '../../utils/assertIsNotBrowser.js' -export * from '../../utils/isNotNullish.js' -export * from '../../utils/unique.js' -export * from '../../utils/debug.js' +export * from '../../utils/assert' +export * from '../../utils/getFileExtension' +export * from '../../utils/isPlainObject' +export * from '../../utils/projectInfo' +export * from '../../utils/checkType' +export * from '../../utils/hasProp' +export * from '../../utils/objectAssign' +export * from '../../utils/checkType' +export * from '../../utils/hasProp' +export * from '../../utils/parseUrl' +export * from '../../utils/parseUrl-extras' +export * from '../../utils/isObject' +export * from '../../utils/virtual-files' +export * from '../../utils/assertIsNotBrowser' +export * from '../../utils/isNotNullish' +export * from '../../utils/unique' +export * from '../../utils/debug' diff --git a/vike/node/shared/virtual-files/virtualFileImportUserCode.ts b/vike/node/shared/virtual-files/virtualFileImportUserCode.ts index 6685b1984f..8a9b9e0031 100644 --- a/vike/node/shared/virtual-files/virtualFileImportUserCode.ts +++ b/vike/node/shared/virtual-files/virtualFileImportUserCode.ts @@ -3,7 +3,7 @@ export { virtualFileIdImportUserCodeClientSR } export { virtualFileIdImportUserCodeClientCR } export { isVirtualFileIdImportUserCode } -import { assert, getVirtualFileId } from '../utils.js' +import { assert, getVirtualFileId } from '../utils' const idBase = 'virtual:vike:importUserCode' const virtualFileIdImportUserCodeServer = `${idBase}:server` diff --git a/vike/node/shared/virtual-files/virtualFilePageConfigValuesAll.ts b/vike/node/shared/virtual-files/virtualFilePageConfigValuesAll.ts index 079b402a04..6996bf4a88 100644 --- a/vike/node/shared/virtual-files/virtualFilePageConfigValuesAll.ts +++ b/vike/node/shared/virtual-files/virtualFilePageConfigValuesAll.ts @@ -1,8 +1,8 @@ export { isVirtualFileIdPageConfigValuesAll } export { getVirtualFileIdPageConfigValuesAll } -import { extractAssetsRemoveQuery } from '../extractAssetsQuery.js' -import { assert, getVirtualFileId } from '../utils.js' +import { extractAssetsRemoveQuery } from '../extractAssetsQuery' +import { assert, getVirtualFileId } from '../utils' const idBase = 'virtual:vike:pageConfigValuesAll:' const idBaseClient = `${idBase}client:` as const diff --git a/vike/shared/RenderErrorPage.ts b/vike/shared/RenderErrorPage.ts index ddcad84009..b876ceb0d1 100644 --- a/vike/shared/RenderErrorPage.ts +++ b/vike/shared/RenderErrorPage.ts @@ -1,2 +1,2 @@ // TODO/v1-release: remove -export { RenderErrorPage } from './route/abort.js' +export { RenderErrorPage } from './route/abort' diff --git a/vike/shared/abort.ts b/vike/shared/abort.ts index 51af6fb79b..5da80a8061 100644 --- a/vike/shared/abort.ts +++ b/vike/shared/abort.ts @@ -8,4 +8,4 @@ // } from 'vike' // Use package.json#exports to make the imports isomorphic. // The client-side has no utility when using Server Routing. -export { redirect, render } from './route/abort.js' +export { redirect, render } from './route/abort' diff --git a/vike/shared/addIs404ToPageProps.ts b/vike/shared/addIs404ToPageProps.ts index e8de1d508b..20384ea692 100644 --- a/vike/shared/addIs404ToPageProps.ts +++ b/vike/shared/addIs404ToPageProps.ts @@ -1,8 +1,8 @@ export { addIs404ToPageProps } -import { assert, assertWarning, hasProp, isObject } from './utils.js' -import { isErrorPage } from './error-page.js' -import type { PageConfigRuntime } from './page-configs/PageConfig.js' +import { assert, assertWarning, hasProp, isObject } from './utils' +import { isErrorPage } from './error-page' +import type { PageConfigRuntime } from './page-configs/PageConfig' function addIs404ToPageProps(pageContext: Record & PageContextAssertIs404) { assertIs404(pageContext) diff --git a/vike/shared/assertHookReturnedObject.ts b/vike/shared/assertHookReturnedObject.ts index 955bc590c6..62777d894a 100644 --- a/vike/shared/assertHookReturnedObject.ts +++ b/vike/shared/assertHookReturnedObject.ts @@ -1,6 +1,6 @@ export { assertHookReturnedObject } -import { assert, assertUsage, stringifyStringArray } from './utils.js' +import { assert, assertUsage, stringifyStringArray } from './utils' function assertHookReturnedObject( obj: Record, diff --git a/vike/shared/assertOnBeforeRenderHookReturn.ts b/vike/shared/assertOnBeforeRenderHookReturn.ts index 9aa140aa2f..e377113ae5 100644 --- a/vike/shared/assertOnBeforeRenderHookReturn.ts +++ b/vike/shared/assertOnBeforeRenderHookReturn.ts @@ -1,8 +1,8 @@ export { assertOnBeforeRenderHookReturn } -import { assertUsage, isPlainObject } from './utils.js' -import { assertPageContextProvidedByUser } from './assertPageContextProvidedByUser.js' -import { assertHookReturnedObject } from './assertHookReturnedObject.js' +import { assertUsage, isPlainObject } from './utils' +import { assertPageContextProvidedByUser } from './assertPageContextProvidedByUser' +import { assertHookReturnedObject } from './assertHookReturnedObject' import pc from '@brillout/picocolors' function assertOnBeforeRenderHookReturn( diff --git a/vike/shared/assertPageContextProvidedByUser.ts b/vike/shared/assertPageContextProvidedByUser.ts index 72d197bc7b..7055fcb136 100644 --- a/vike/shared/assertPageContextProvidedByUser.ts +++ b/vike/shared/assertPageContextProvidedByUser.ts @@ -1,6 +1,6 @@ export { assertPageContextProvidedByUser } -import { assert, assertUsage, assertWarning, isObject } from './utils.js' +import { assert, assertUsage, assertWarning, isObject } from './utils' import pc from '@brillout/picocolors' function assertPageContextProvidedByUser( diff --git a/vike/shared/assertPageFilePath.ts b/vike/shared/assertPageFilePath.ts index 5c815decfa..3202bb4436 100644 --- a/vike/shared/assertPageFilePath.ts +++ b/vike/shared/assertPageFilePath.ts @@ -2,7 +2,7 @@ export { assertPageFilePath } -import { assertPosixPath } from './utils.js' +import { assertPosixPath } from './utils' function assertPageFilePath(filePath: string): void { assertPosixPath(filePath) diff --git a/vike/shared/determinePageIdOld.ts b/vike/shared/determinePageIdOld.ts index 982546e1df..4333a9eeb8 100644 --- a/vike/shared/determinePageIdOld.ts +++ b/vike/shared/determinePageIdOld.ts @@ -1,6 +1,6 @@ export { determinePageIdOld } -import { slice, assert } from './utils.js' +import { slice, assert } from './utils' // TODO/v1-release: remove function determinePageIdOld(filePath: string): string { diff --git a/vike/shared/error-page.ts b/vike/shared/error-page.ts index 84f38ad385..ed9ca392d3 100644 --- a/vike/shared/error-page.ts +++ b/vike/shared/error-page.ts @@ -4,9 +4,9 @@ export { isErrorPage } // TODO/v1-release: consider loading this file only for Client Routing -import { assert, assertUsage, unique } from './utils.js' -import type { PageConfigRuntime } from './page-configs/PageConfig.js' -import type { PageFile } from './getPageFiles.js' +import { assert, assertUsage, unique } from './utils' +import type { PageConfigRuntime } from './page-configs/PageConfig' +import type { PageFile } from './getPageFiles' function getErrorPageId(pageFilesAll: PageFile[], pageConfigs: PageConfigRuntime[]): string | null { if (pageConfigs.length > 0) { diff --git a/vike/shared/getPageContext.ts b/vike/shared/getPageContext.ts index a4b37b3f5e..dce085fcd8 100644 --- a/vike/shared/getPageContext.ts +++ b/vike/shared/getPageContext.ts @@ -1 +1 @@ -export { getPageContext, providePageContext } from './hooks/executeHook.js' +export { getPageContext, providePageContext } from './hooks/executeHook' diff --git a/vike/shared/getPageContextRequestUrl.ts b/vike/shared/getPageContextRequestUrl.ts index 191494b813..2193715b89 100644 --- a/vike/shared/getPageContextRequestUrl.ts +++ b/vike/shared/getPageContextRequestUrl.ts @@ -3,7 +3,7 @@ export { pageContextJsonFileExtension } export { doNotCreateExtraDirectory } // This module isn't loaded by the client-side of Server Routing => we don't inlcude `urlToFile` to `./utils.ts` -import { urlToFile } from '../utils/urlToFile.js' +import { urlToFile } from '../utils/urlToFile' const pageContextJsonFileExtension = '.pageContext.json' // `/some-base-url/index.pageContext.json` instead of `/some-base-url.pageContext.json` in order to comply to common reverse proxy setups, see https://github.com/vikejs/vike/issues/443 diff --git a/vike/shared/getPageContextUrlComputed.ts b/vike/shared/getPageContextUrlComputed.ts index b65b955bfa..12dd74e84d 100644 --- a/vike/shared/getPageContextUrlComputed.ts +++ b/vike/shared/getPageContextUrlComputed.ts @@ -10,7 +10,7 @@ export type { PageContextUrlSource } // URLs need to be computed, because the user can modify the URL e.g. with onBeforeRoute() for i18n. // ===================== -import { objectDefineProperty } from '../utils/objectDefineProperty.js' +import { objectDefineProperty } from '../utils/objectDefineProperty' import { assert, parseUrl, @@ -20,7 +20,7 @@ import { isBrowser, changeEnumerable, type UrlPublic -} from './utils.js' +} from './utils' // TODO/v1-release: move pageContext.urlParsed to pageContext.url type PageContextUrlComputed = { diff --git a/vike/shared/getPageFiles.ts b/vike/shared/getPageFiles.ts index 9f010b410c..721ec133a4 100644 --- a/vike/shared/getPageFiles.ts +++ b/vike/shared/getPageFiles.ts @@ -1,10 +1,10 @@ // Types -export type { PageFile } from './getPageFiles/getPageFileObject.js' -export type { ExportsAll, PageContextExports } from './getPageFiles/getExports.js' +export type { PageFile } from './getPageFiles/getPageFileObject' +export type { ExportsAll, PageContextExports } from './getPageFiles/getExports' -export { getPageFilesAll } from './getPageFiles/setPageFiles.js' -export { setPageFiles } from './getPageFiles/setPageFiles.js' -export { setPageFilesAsync } from './getPageFiles/setPageFiles.js' -export { getPageFilesClientSide } from './getPageFiles/getAllPageIdFiles.js' -export { getPageFilesServerSide } from './getPageFiles/getAllPageIdFiles.js' -export { getPageContextExports } from './getPageFiles/getExports.js' +export { getPageFilesAll } from './getPageFiles/setPageFiles' +export { setPageFiles } from './getPageFiles/setPageFiles' +export { setPageFilesAsync } from './getPageFiles/setPageFiles' +export { getPageFilesClientSide } from './getPageFiles/getAllPageIdFiles' +export { getPageFilesServerSide } from './getPageFiles/getAllPageIdFiles' +export { getPageContextExports } from './getPageFiles/getExports' diff --git a/vike/shared/getPageFiles/analyzeClientSide.ts b/vike/shared/getPageFiles/analyzeClientSide.ts index a608cfc408..88d09bd3da 100644 --- a/vike/shared/getPageFiles/analyzeClientSide.ts +++ b/vike/shared/getPageFiles/analyzeClientSide.ts @@ -1,9 +1,9 @@ export { analyzeClientSide } -import { getConfigValueRuntime } from '../page-configs/getConfigValue.js' -import type { PageConfigRuntime } from '../page-configs/PageConfig.js' -import type { PageFile } from './getPageFileObject.js' -import { analyzePageClientSide } from './analyzePageClientSide.js' +import { getConfigValueRuntime } from '../page-configs/getConfigValue' +import type { PageConfigRuntime } from '../page-configs/PageConfig' +import type { PageFile } from './getPageFileObject' +import { analyzePageClientSide } from './analyzePageClientSide' function analyzeClientSide( pageConfig: PageConfigRuntime | null, diff --git a/vike/shared/getPageFiles/analyzePageClientSide.ts b/vike/shared/getPageFiles/analyzePageClientSide.ts index 0972ddfa3b..9de83e4389 100644 --- a/vike/shared/getPageFiles/analyzePageClientSide.ts +++ b/vike/shared/getPageFiles/analyzePageClientSide.ts @@ -2,14 +2,14 @@ export { analyzePageClientSide } export { analyzePageClientSideInit } export type { AnalysisResult } -import { analyzeExports } from './analyzePageClientSide/analyzeExports.js' -import { determineClientEntry } from './analyzePageClientSide/determineClientEntry.js' -import { getPageFilesClientSide } from './getAllPageIdFiles.js' -import { getPageFilesServerSide } from './getAllPageIdFiles.js' -import { assert } from '../utils.js' -import { getExportNames } from './analyzePageClientSide/getExportNames.js' -import type { PageFile } from './getPageFileObject.js' -import type { ClientDependency } from './analyzePageClientSide/ClientDependency.js' +import { analyzeExports } from './analyzePageClientSide/analyzeExports' +import { determineClientEntry } from './analyzePageClientSide/determineClientEntry' +import { getPageFilesClientSide } from './getAllPageIdFiles' +import { getPageFilesServerSide } from './getAllPageIdFiles' +import { assert } from '../utils' +import { getExportNames } from './analyzePageClientSide/getExportNames' +import type { PageFile } from './getPageFileObject' +import type { ClientDependency } from './analyzePageClientSide/ClientDependency' type AnalysisResult = { isHtmlOnly: boolean diff --git a/vike/shared/getPageFiles/analyzePageClientSide/analyzeExports.ts b/vike/shared/getPageFiles/analyzePageClientSide/analyzeExports.ts index 27741b5aa9..a65b085f0d 100644 --- a/vike/shared/getPageFiles/analyzePageClientSide/analyzeExports.ts +++ b/vike/shared/getPageFiles/analyzePageClientSide/analyzeExports.ts @@ -1,8 +1,8 @@ export { analyzeExports } -import { getExportNames } from './getExportNames.js' -import { assertUsage } from '../../utils.js' -import type { PageFile } from '../getPageFileObject.js' +import { getExportNames } from './getExportNames' +import { assertUsage } from '../../utils' +import type { PageFile } from '../getPageFileObject' // TODO/v1-release: remove function analyzeExports({ diff --git a/vike/shared/getPageFiles/analyzePageClientSide/determineClientEntry.ts b/vike/shared/getPageFiles/analyzePageClientSide/determineClientEntry.ts index 4e7cf1db8e..0c6af5a839 100644 --- a/vike/shared/getPageFiles/analyzePageClientSide/determineClientEntry.ts +++ b/vike/shared/getPageFiles/analyzePageClientSide/determineClientEntry.ts @@ -3,8 +3,8 @@ export { determineClientEntry } export { getVikeClientEntry } -import type { ClientDependency } from './ClientDependency.js' -import type { PageFile } from '../../../shared/getPageFiles.js' +import type { ClientDependency } from './ClientDependency' +import type { PageFile } from '../../../shared/getPageFiles' function determineClientEntry({ pageFilesClientSide, diff --git a/vike/shared/getPageFiles/analyzePageClientSide/getExportNames.ts b/vike/shared/getPageFiles/analyzePageClientSide/getExportNames.ts index be1f624c4a..0cf06f06d7 100644 --- a/vike/shared/getPageFiles/analyzePageClientSide/getExportNames.ts +++ b/vike/shared/getPageFiles/analyzePageClientSide/getExportNames.ts @@ -1,7 +1,7 @@ export { getExportNames } -import { assert } from '../../utils.js' -import type { PageFile } from '../getPageFileObject.js' +import { assert } from '../../utils' +import type { PageFile } from '../getPageFileObject' function getExportNames(p: PageFile): string[] { if (p.fileType === '.css') { diff --git a/vike/shared/getPageFiles/analyzePageServerSide.ts b/vike/shared/getPageFiles/analyzePageServerSide.ts index 2b375de9fb..b3fe112533 100644 --- a/vike/shared/getPageFiles/analyzePageServerSide.ts +++ b/vike/shared/getPageFiles/analyzePageServerSide.ts @@ -1,8 +1,8 @@ export { analyzePageServerSide } -import { assert } from '../utils.js' -import { getPageFilesServerSide } from './getAllPageIdFiles.js' -import type { PageFile } from './getPageFileObject.js' +import { assert } from '../utils' +import { getPageFilesServerSide } from './getAllPageIdFiles' +import type { PageFile } from './getPageFileObject' async function analyzePageServerSide(pageFilesAll: PageFile[], pageId: string) { const pageFilesServerSide = getPageFilesServerSide(pageFilesAll, pageId) diff --git a/vike/shared/getPageFiles/assert_exports_old_design.ts b/vike/shared/getPageFiles/assert_exports_old_design.ts index 7c0d70d1ca..7d634b3543 100644 --- a/vike/shared/getPageFiles/assert_exports_old_design.ts +++ b/vike/shared/getPageFiles/assert_exports_old_design.ts @@ -4,8 +4,8 @@ export { assertDefaultExports } export { assertExportValues } export { forbiddenDefaultExports } -import { assert, assertUsage } from '../utils.js' -import type { PageFile } from './getPageFileObject.js' +import { assert, assertUsage } from '../utils' +import type { PageFile } from './getPageFileObject' const enforceTrue = ['clientRouting'] function assertExportValues(pageFile: PageFile) { diff --git a/vike/shared/getPageFiles/fileTypes.ts b/vike/shared/getPageFiles/fileTypes.ts index ceb6493e0b..e7efec03eb 100644 --- a/vike/shared/getPageFiles/fileTypes.ts +++ b/vike/shared/getPageFiles/fileTypes.ts @@ -5,8 +5,8 @@ export { fileTypes } export { isValidFileType } export { determineFileType } -import { assert, assertPosixPath } from '../utils.js' -import { isScriptFile } from '../../utils/isScriptFile.js' +import { assert, assertPosixPath } from '../utils' +import { isScriptFile } from '../../utils/isScriptFile' const fileTypes = [ '.page', diff --git a/vike/shared/getPageFiles/getAllPageIdFiles.ts b/vike/shared/getPageFiles/getAllPageIdFiles.ts index 5b79674c9c..bb6883a4bc 100644 --- a/vike/shared/getPageFiles/getAllPageIdFiles.ts +++ b/vike/shared/getPageFiles/getAllPageIdFiles.ts @@ -3,9 +3,9 @@ export { getPageFilesClientSide } export { getPageFilesServerSide } -import { assert, assertUsage, isNotNullish } from '../utils.js' -import { assertPageFilePath } from '../assertPageFilePath.js' -import type { PageFile } from './getPageFileObject.js' +import { assert, assertUsage, isNotNullish } from '../utils' +import { assertPageFilePath } from '../assertPageFilePath' +import type { PageFile } from './getPageFileObject' function getPageFilesClientSide(pageFilesAll: PageFile[], pageId: string): PageFile[] { return determine(pageFilesAll, pageId, true) diff --git a/vike/shared/getPageFiles/getExports.ts b/vike/shared/getPageFiles/getExports.ts index 92fa36c5b8..7b257d994e 100644 --- a/vike/shared/getPageFiles/getExports.ts +++ b/vike/shared/getPageFiles/getExports.ts @@ -6,18 +6,18 @@ export type { From } export type { Sources } export type { Source } -import { isScriptFile, isTemplateFile } from '../../utils/isScriptFile.js' -import { assert, isObject, assertWarning, assertUsage, makeLast, isBrowser } from '../utils.js' -import { assertDefaultExports, forbiddenDefaultExports } from './assert_exports_old_design.js' -import type { FileType } from './fileTypes.js' -import type { PageConfigRuntimeLoaded } from './../page-configs/PageConfig.js' -import type { PageFile } from './getPageFileObject.js' +import { isScriptFile, isTemplateFile } from '../../utils/isScriptFile' +import { assert, isObject, assertWarning, assertUsage, makeLast, isBrowser } from '../utils' +import { assertDefaultExports, forbiddenDefaultExports } from './assert_exports_old_design' +import type { FileType } from './fileTypes' +import type { PageConfigRuntimeLoaded } from './../page-configs/PageConfig' +import type { PageFile } from './getPageFileObject' import { type ConfigDefinedAtOptional, getConfigDefinedAtOptional, getDefinedAtString -} from '../page-configs/getConfigDefinedAt.js' -import { getConfigValueFilePathToShowToUser } from '../page-configs/helpers.js' +} from '../page-configs/getConfigDefinedAt' +import { getConfigValueFilePathToShowToUser } from '../page-configs/helpers' import pc from '@brillout/picocolors' // TODO/v1-release: remove diff --git a/vike/shared/getPageFiles/getPageFileObject.ts b/vike/shared/getPageFiles/getPageFileObject.ts index 7459c5ea48..9d42c29fdd 100644 --- a/vike/shared/getPageFiles/getPageFileObject.ts +++ b/vike/shared/getPageFiles/getPageFileObject.ts @@ -3,11 +3,11 @@ export { getPageFileObject } export type { PageFile } -import { determinePageIdOld } from '../determinePageIdOld.js' -import { assertPageFilePath } from '../assertPageFilePath.js' -import { isErrorPageId } from '../error-page.js' -import { assert, slice } from '../utils.js' -import { determineFileType, FileType } from './fileTypes.js' +import { determinePageIdOld } from '../determinePageIdOld' +import { assertPageFilePath } from '../assertPageFilePath' +import { isErrorPageId } from '../error-page' +import { assert, slice } from '../utils' +import { determineFileType, FileType } from './fileTypes' type PageFile = { filePath: string diff --git a/vike/shared/getPageFiles/parseGlobResults.ts b/vike/shared/getPageFiles/parseGlobResults.ts index a0a3cb4113..b860c97638 100644 --- a/vike/shared/getPageFiles/parseGlobResults.ts +++ b/vike/shared/getPageFiles/parseGlobResults.ts @@ -2,16 +2,16 @@ export { parseGlobResults } // TODO/v1-release: remove old design code, and remove all assertions. -import { assert, hasProp, isCallable, isObject, cast, isArray } from '../utils.js' -import { assertExportValues } from './assert_exports_old_design.js' -import { getPageFileObject, type PageFile } from './getPageFileObject.js' -import { fileTypes, type FileType } from './fileTypes.js' -import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../page-configs/PageConfig.js' -import { parsePageConfigs } from '../page-configs/serialize/parsePageConfigs.js' +import { assert, hasProp, isCallable, isObject, cast, isArray } from '../utils' +import { assertExportValues } from './assert_exports_old_design' +import { getPageFileObject, type PageFile } from './getPageFileObject' +import { fileTypes, type FileType } from './fileTypes' +import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../page-configs/PageConfig' +import { parsePageConfigs } from '../page-configs/serialize/parsePageConfigs' import type { PageConfigGlobalRuntimeSerialized, PageConfigRuntimeSerialized -} from '../page-configs/serialize/PageConfigSerialized.js' +} from '../page-configs/serialize/PageConfigSerialized' function parseGlobResults(pageFilesExports: unknown): { pageFiles: PageFile[] diff --git a/vike/shared/getPageFiles/setPageFiles.ts b/vike/shared/getPageFiles/setPageFiles.ts index e3e798ecae..b0308b14f7 100644 --- a/vike/shared/getPageFiles/setPageFiles.ts +++ b/vike/shared/getPageFiles/setPageFiles.ts @@ -2,11 +2,11 @@ export { setPageFiles } export { setPageFilesAsync } export { getPageFilesAll } -import { assert, unique } from '../utils.js' -import type { PageFile } from './getPageFileObject.js' -import { parseGlobResults } from './parseGlobResults.js' -import { getGlobalObject } from '../../utils/getGlobalObject.js' -import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../page-configs/PageConfig.js' +import { assert, unique } from '../utils' +import type { PageFile } from './getPageFileObject' +import { parseGlobResults } from './parseGlobResults' +import { getGlobalObject } from '../../utils/getGlobalObject' +import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../page-configs/PageConfig' const globalObject = getGlobalObject<{ pageFilesAll?: PageFile[] | undefined diff --git a/vike/shared/hooks/executeHook.ts b/vike/shared/hooks/executeHook.ts index 204f796113..ec37bfce37 100644 --- a/vike/shared/hooks/executeHook.ts +++ b/vike/shared/hooks/executeHook.ts @@ -3,12 +3,12 @@ export { getPageContext } export { providePageContext } export { isUserHookError } -import { getProjectError, assertWarning } from '../../utils/assert.js' -import { getGlobalObject } from '../../utils/getGlobalObject.js' -import { humanizeTime } from '../../utils/humanizeTime.js' -import { isObject } from '../../utils/isObject.js' -import type { PageContextClient, PageContextServer } from '../types.js' -import type { Hook, HookLoc } from './getHook.js' +import { getProjectError, assertWarning } from '../../utils/assert' +import { getGlobalObject } from '../../utils/getGlobalObject' +import { humanizeTime } from '../../utils/humanizeTime' +import { isObject } from '../../utils/isObject' +import type { PageContextClient, PageContextServer } from '../types' +import type { Hook, HookLoc } from './getHook' const globalObject = getGlobalObject('utils/executeHook.ts', { userHookErrors: new WeakMap(), pageContext: null as PageContextUnknown diff --git a/vike/shared/hooks/getHook.ts b/vike/shared/hooks/getHook.ts index 478fe39d31..c471fd0871 100644 --- a/vike/shared/hooks/getHook.ts +++ b/vike/shared/hooks/getHook.ts @@ -13,13 +13,13 @@ export type { HooksTimeoutProvidedByUser } // We export for old V0.4 design which doesn't support configooksTimeout export { getHookTimeoutDefault } -import { getGlobalObject } from '../../utils/getGlobalObject.js' -import type { PageContextExports } from '../getPageFiles.js' -import type { HookName, HookNamePage, HookNameGlobal } from '../page-configs/Config.js' -import type { PageConfigGlobalRuntime, PageConfigRuntime } from '../page-configs/PageConfig.js' -import { getHookFilePathToShowToUser } from '../page-configs/helpers.js' -import { getConfigValueRuntime } from '../page-configs/getConfigValue.js' -import { assert, assertUsage, checkType, isCallable, isObject } from '../utils.js' +import { getGlobalObject } from '../../utils/getGlobalObject' +import type { PageContextExports } from '../getPageFiles' +import type { HookName, HookNamePage, HookNameGlobal } from '../page-configs/Config' +import type { PageConfigGlobalRuntime, PageConfigRuntime } from '../page-configs/PageConfig' +import { getHookFilePathToShowToUser } from '../page-configs/helpers' +import { getConfigValueRuntime } from '../page-configs/getConfigValue' +import { assert, assertUsage, checkType, isCallable, isObject } from '../utils' import pc from '@brillout/picocolors' const globalObject = getGlobalObject<{ isPrerendering?: true }>('getHook.ts', {}) diff --git a/vike/shared/modifyUrl.ts b/vike/shared/modifyUrl.ts index 461528fd6c..7ba62c7ba4 100644 --- a/vike/shared/modifyUrl.ts +++ b/vike/shared/modifyUrl.ts @@ -1,6 +1,6 @@ export { modifyUrl } -import { createUrlFromComponents, parseUrl } from './utils.js' +import { createUrlFromComponents, parseUrl } from './utils' /** * Modify a URL. diff --git a/vike/shared/page-configs/Config.ts b/vike/shared/page-configs/Config.ts index af18f91ee9..1e0d9a8f6e 100644 --- a/vike/shared/page-configs/Config.ts +++ b/vike/shared/page-configs/Config.ts @@ -36,14 +36,14 @@ export type { KeepScrollPosition } import type { PrefetchSetting, PrefetchStaticAssets -} from '../../client/client-routing-runtime/prefetch/PrefetchSetting.js' -import type { ConfigDefinition } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js' -import type { DocumentHtml } from '../../node/runtime/html/renderHtml.js' -import type { InjectFilterEntry } from '../../types/index.js' -import type { ConfigVikeUserProvided } from '../ConfigVike.js' -import type { Vike, VikePackages } from '../VikeNamespace.js' -import type { HooksTimeoutProvidedByUser } from '../hooks/getHook.js' -import type { PageContextClient, PageContextServer } from '../types.js' +} from '../../client/client-routing-runtime/prefetch/PrefetchSetting' +import type { ConfigDefinition } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn' +import type { DocumentHtml } from '../../node/runtime/html/renderHtml' +import type { InjectFilterEntry } from '../../types/index' +import type { ConfigVikeUserProvided } from '../ConfigVike' +import type { Vike, VikePackages } from '../VikeNamespace' +import type { HooksTimeoutProvidedByUser } from '../hooks/getHook' +import type { PageContextClient, PageContextServer } from '../types' type HookName = HookNamePage | HookNameGlobal | HookNameOldDesign type HookNamePage = diff --git a/vike/shared/page-configs/Config/PageContextConfig.ts b/vike/shared/page-configs/Config/PageContextConfig.ts index 00d716163d..de6701b514 100644 --- a/vike/shared/page-configs/Config/PageContextConfig.ts +++ b/vike/shared/page-configs/Config/PageContextConfig.ts @@ -1,8 +1,8 @@ export type { PageContextConfig } -import type { VikePackages } from '../../VikeNamespace.js' -import type { ConfigBuiltIn, ImportString } from '../Config.js' -import type { Combine, IsNotEmpty, XOR5 } from './helpers.js' +import type { VikePackages } from '../../VikeNamespace' +import type { ConfigBuiltIn, ImportString } from '../Config' +import type { Combine, IsNotEmpty, XOR5 } from './helpers' type WithoutImportString = { [K in keyof T]: Exclude } diff --git a/vike/shared/page-configs/PageConfig.ts b/vike/shared/page-configs/PageConfig.ts index 66897e0910..c90b2bd308 100644 --- a/vike/shared/page-configs/PageConfig.ts +++ b/vike/shared/page-configs/PageConfig.ts @@ -17,10 +17,10 @@ export type { DefinedAtData } export type { DefinedAtFile } export type { DefinedAtFilePath } -import type { ConfigValueSerialized } from './serialize/PageConfigSerialized.js' -import type { LocationId } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js' -import type { FilePath } from './FilePath.js' -import type { ConfigDefinitions } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js' +import type { ConfigValueSerialized } from './serialize/PageConfigSerialized' +import type { LocationId } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting' +import type { FilePath } from './FilePath' +import type { ConfigDefinitions } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn' type PageConfigBase = { pageId: string diff --git a/vike/shared/page-configs/assertPlusFileExport.ts b/vike/shared/page-configs/assertPlusFileExport.ts index 411a6d4b3a..7e511730de 100644 --- a/vike/shared/page-configs/assertPlusFileExport.ts +++ b/vike/shared/page-configs/assertPlusFileExport.ts @@ -1,6 +1,6 @@ export { assertPlusFileExport } -import { assert, assertUsage, assertWarning } from '../utils.js' +import { assert, assertUsage, assertWarning } from '../utils' import pc from '@brillout/picocolors' const EXPORTS_IGNORE = [ diff --git a/vike/shared/page-configs/findPageConfig.ts b/vike/shared/page-configs/findPageConfig.ts index ae787e40b7..6002b70268 100644 --- a/vike/shared/page-configs/findPageConfig.ts +++ b/vike/shared/page-configs/findPageConfig.ts @@ -1,7 +1,7 @@ export { findPageConfig } -import { assert } from '../utils.js' -import type { PageConfigRuntime } from './PageConfig.js' +import { assert } from '../utils' +import type { PageConfigRuntime } from './PageConfig' function findPageConfig(pageConfigs: PageConfigRuntime[], pageId: string): null | PageConfigRuntime { const result = pageConfigs.filter((p) => p.pageId === pageId) diff --git a/vike/shared/page-configs/getConfigDefinedAt.ts b/vike/shared/page-configs/getConfigDefinedAt.ts index 93495c3c56..d4279094da 100644 --- a/vike/shared/page-configs/getConfigDefinedAt.ts +++ b/vike/shared/page-configs/getConfigDefinedAt.ts @@ -4,10 +4,10 @@ export { getDefinedAtString } export type { ConfigDefinedAt } export type { ConfigDefinedAtOptional } -import { assert, isArray } from '../utils.js' -import type { DefinedAtData, DefinedAtFile } from './PageConfig.js' +import { assert, isArray } from '../utils' +import type { DefinedAtData, DefinedAtFile } from './PageConfig' import pc from '@brillout/picocolors' -import { getExportPath } from './getExportPath.js' +import { getExportPath } from './getExportPath' type ConfigDefinedAtOptional = ConfigDefinedAt | `Config ${string} defined internally` type ConfigDefinedAt = `Config ${string} defined at ${string}` diff --git a/vike/shared/page-configs/getConfigValue.ts b/vike/shared/page-configs/getConfigValue.ts index f2f7ffe0d8..c750407426 100644 --- a/vike/shared/page-configs/getConfigValue.ts +++ b/vike/shared/page-configs/getConfigValue.ts @@ -2,11 +2,11 @@ export { getConfigValueRuntime } export { getConfigValueTyped } export type { TypeAsString } -import { type ResolveTypeAsString, assert, assertUsage, getValuePrintable } from '../utils.js' -import type { PageConfigRuntime, ConfigValue, DefinedAtData } from './PageConfig.js' -import type { ConfigNameBuiltIn } from './Config.js' +import { type ResolveTypeAsString, assert, assertUsage, getValuePrintable } from '../utils' +import type { PageConfigRuntime, ConfigValue, DefinedAtData } from './PageConfig' +import type { ConfigNameBuiltIn } from './Config' import pc from '@brillout/picocolors' -import { getConfigDefinedAtOptional } from './getConfigDefinedAt.js' +import { getConfigDefinedAtOptional } from './getConfigDefinedAt' type ConfigName = ConfigNameBuiltIn type TypeAsString = 'string' | 'boolean' | undefined diff --git a/vike/shared/page-configs/getConfigValueBuildTime.ts b/vike/shared/page-configs/getConfigValueBuildTime.ts index 1faa8a79dc..450fc0db26 100644 --- a/vike/shared/page-configs/getConfigValueBuildTime.ts +++ b/vike/shared/page-configs/getConfigValueBuildTime.ts @@ -1,10 +1,10 @@ export { getConfigValueBuildTime } -import { assert, type ResolveTypeAsString } from '../utils.js' -import type { PageConfigBuildTime, ConfigValue, ConfigValueSource, DefinedAtFile } from './PageConfig.js' -import type { ConfigNameBuiltIn } from './Config.js' -import { getConfigValueTyped, type TypeAsString } from './getConfigValue.js' -import { assertIsNotProductionRuntime } from '../../utils/assertIsNotProductionRuntime.js' +import { assert, type ResolveTypeAsString } from '../utils' +import type { PageConfigBuildTime, ConfigValue, ConfigValueSource, DefinedAtFile } from './PageConfig' +import type { ConfigNameBuiltIn } from './Config' +import { getConfigValueTyped, type TypeAsString } from './getConfigValue' +import { assertIsNotProductionRuntime } from '../../utils/assertIsNotProductionRuntime' assertIsNotProductionRuntime() type ConfigName = ConfigNameBuiltIn diff --git a/vike/shared/page-configs/getExportPath.spec.ts b/vike/shared/page-configs/getExportPath.spec.ts index a9fffffc09..37017c07e6 100644 --- a/vike/shared/page-configs/getExportPath.spec.ts +++ b/vike/shared/page-configs/getExportPath.spec.ts @@ -1,4 +1,4 @@ -import { getExportPath } from './getExportPath.js' +import { getExportPath } from './getExportPath' import { expect, describe, it } from 'vitest' describe('getExportPath()', () => { diff --git a/vike/shared/page-configs/getExportPath.ts b/vike/shared/page-configs/getExportPath.ts index 187984e5a5..d8e0c90dca 100644 --- a/vike/shared/page-configs/getExportPath.ts +++ b/vike/shared/page-configs/getExportPath.ts @@ -1,6 +1,6 @@ export { getExportPath } -import { assert } from '../utils.js' +import { assert } from '../utils' function getExportPath(fileExportPathToShowToUser: null | string[], configName: string): null | string { if (!fileExportPathToShowToUser) return null diff --git a/vike/shared/page-configs/helpers.ts b/vike/shared/page-configs/helpers.ts index cdf68e4c2f..650d49b4c5 100644 --- a/vike/shared/page-configs/helpers.ts +++ b/vike/shared/page-configs/helpers.ts @@ -2,8 +2,8 @@ export { getPageConfig } export { getConfigValueFilePathToShowToUser } export { getHookFilePathToShowToUser } -import { assert, isArray } from '../utils.js' -import type { PageConfigRuntime, DefinedAtData } from './PageConfig.js' +import { assert, isArray } from '../utils' +import type { PageConfigRuntime, DefinedAtData } from './PageConfig' function getPageConfig(pageId: string, pageConfigs: PageConfigRuntime[]): PageConfigRuntime { const pageConfig = pageConfigs.find((p) => p.pageId === pageId) diff --git a/vike/shared/page-configs/loadConfigValues.ts b/vike/shared/page-configs/loadConfigValues.ts index e47a0c0b35..c66c9f19f0 100644 --- a/vike/shared/page-configs/loadConfigValues.ts +++ b/vike/shared/page-configs/loadConfigValues.ts @@ -1,8 +1,8 @@ export { loadConfigValues } -import { objectAssign } from '../utils.js' -import type { PageConfigRuntime, PageConfigRuntimeLoaded } from './PageConfig.js' -import { parseConfigValuesSerialized } from './serialize/parsePageConfigs.js' +import { objectAssign } from '../utils' +import type { PageConfigRuntime, PageConfigRuntimeLoaded } from './PageConfig' +import { parseConfigValuesSerialized } from './serialize/parsePageConfigs' async function loadConfigValues(pageConfig: PageConfigRuntime, isDev: boolean): Promise { if ( diff --git a/vike/shared/page-configs/serialize/PageConfigSerialized.ts b/vike/shared/page-configs/serialize/PageConfigSerialized.ts index ebcc6ead24..f9e6300923 100644 --- a/vike/shared/page-configs/serialize/PageConfigSerialized.ts +++ b/vike/shared/page-configs/serialize/PageConfigSerialized.ts @@ -8,7 +8,7 @@ import type { ConfigValueComputed, ConfigValueCumulative, PageConfigRuntime -} from '../PageConfig.js' +} from '../PageConfig' /** Page config data structure serialized in virtual files: parsing it results in PageConfigRuntime */ type PageConfigRuntimeSerialized = Omit & { diff --git a/vike/shared/page-configs/serialize/parsePageConfigs.ts b/vike/shared/page-configs/serialize/parsePageConfigs.ts index 3056e5727d..2e36ba504c 100644 --- a/vike/shared/page-configs/serialize/parsePageConfigs.ts +++ b/vike/shared/page-configs/serialize/parsePageConfigs.ts @@ -7,17 +7,17 @@ import type { PageConfigGlobalRuntime, ConfigValue, DefinedAtFile -} from '../PageConfig.js' +} from '../PageConfig' import type { PageConfigGlobalRuntimeSerialized, PageConfigRuntimeSerialized, ValueSerialized -} from './PageConfigSerialized.js' -import { assert, assertUsage, isCallable } from '../../utils.js' -import { getConfigDefinedAt } from '../getConfigDefinedAt.js' -import type { ConfigValueSerialized } from './PageConfigSerialized.js' +} from './PageConfigSerialized' +import { assert, assertUsage, isCallable } from '../../utils' +import { getConfigDefinedAt } from '../getConfigDefinedAt' +import type { ConfigValueSerialized } from './PageConfigSerialized' import { parseTransform } from '@brillout/json-serializer/parse' -import { assertPlusFileExport } from '../assertPlusFileExport.js' +import { assertPlusFileExport } from '../assertPlusFileExport' function parseConfigValuesSerialized(configValuesSerialized: Record): ConfigValues { const configValues = parseConfigValuesSerialized_tmp(configValuesSerialized) diff --git a/vike/shared/page-configs/serialize/serializeConfigValues.ts b/vike/shared/page-configs/serialize/serializeConfigValues.ts index 11130e7a22..d1bd9b5c78 100644 --- a/vike/shared/page-configs/serialize/serializeConfigValues.ts +++ b/vike/shared/page-configs/serialize/serializeConfigValues.ts @@ -1,7 +1,7 @@ export { serializeConfigValues } -import { assertIsNotProductionRuntime } from '../../../utils/assertIsNotProductionRuntime.js' -import { assert, assertUsage, getPropAccessNotation } from '../../../node/plugin/utils.js' +import { assertIsNotProductionRuntime } from '../../../utils/assertIsNotProductionRuntime' +import { assert, assertUsage, getPropAccessNotation } from '../../../node/plugin/utils' import type { ConfigEnvInternal, ConfigValue, @@ -10,11 +10,11 @@ import type { DefinedAtFile, PageConfigBuildTime, PageConfigGlobalBuildTime -} from '../PageConfig.js' -import type { ValueSerialized } from './PageConfigSerialized.js' -import { addImportStatement } from '../../../node/plugin/plugins/importUserCode/addImportStatement.js' -import { parsePointerImportData } from '../../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.js' -import { getConfigValueFilePathToShowToUser } from '../helpers.js' +} from '../PageConfig' +import type { ValueSerialized } from './PageConfigSerialized' +import { addImportStatement } from '../../../node/plugin/plugins/importUserCode/addImportStatement' +import { parsePointerImportData } from '../../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports' +import { getConfigValueFilePathToShowToUser } from '../helpers' import { stringify } from '@brillout/json-serializer/stringify' import pc from '@brillout/picocolors' const REPLACE_ME_BEFORE = '__VIKE__REPLACE_ME_BEFORE__' @@ -216,7 +216,7 @@ function valueToJson( // - We don't need this anymore and could remove it. // - We temporarily needed it for nested document configs (`config.document.{title,description,favicon}`), but we finally decided to go for flat document configs instead (`config.{title,description,favicon}`). // - https://github.com/vikejs/vike-react/pull/113 - replacer(_, value) { + replacer(_: unknown, value: string) { if (typeof value === 'string') { const importData = parsePointerImportData(value) if (importData) { diff --git a/vike/shared/preparePageContextForUserConsumption.ts b/vike/shared/preparePageContextForUserConsumption.ts index 26c4fe6496..ffdef6c0bb 100644 --- a/vike/shared/preparePageContextForUserConsumption.ts +++ b/vike/shared/preparePageContextForUserConsumption.ts @@ -1,9 +1,9 @@ export { preparePageContextForUserConsumption } -import { assert, assertWarning, compareString } from './utils.js' -import type { PageContextForUserConsumptionClientSide } from '../client/shared/preparePageContextForUserConsumptionClientSide.js' -import type { PageContextForUserConsumptionServerSide } from '../node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.js' -import { addIs404ToPageProps } from './addIs404ToPageProps.js' +import { assert, assertWarning, compareString } from './utils' +import type { PageContextForUserConsumptionClientSide } from '../client/shared/preparePageContextForUserConsumptionClientSide' +import type { PageContextForUserConsumptionServerSide } from '../node/runtime/renderPage/preparePageContextForUserConsumptionServerSide' +import { addIs404ToPageProps } from './addIs404ToPageProps' type PageContextForUserConsumption = PageContextForUserConsumptionServerSide | PageContextForUserConsumptionClientSide diff --git a/vike/shared/route/abort.ts b/vike/shared/route/abort.ts index 8f25305867..41a3de0cbf 100644 --- a/vike/shared/route/abort.ts +++ b/vike/shared/route/abort.ts @@ -13,7 +13,7 @@ export type { ErrorAbort } export type { PageContextFromRewrite } export type { UrlRedirect } -import { isUserHookError } from '../hooks/executeHook.js' +import { isUserHookError } from '../hooks/executeHook' import { assert, assertInfo, @@ -26,7 +26,7 @@ import { joinEnglish, objectAssign, truncateString -} from './utils.js' +} from './utils' import pc from '@brillout/picocolors' type RedirectStatusCode = number & diff --git a/vike/shared/route/debug.ts b/vike/shared/route/debug.ts index a1f132da72..fbeb080ff9 100644 --- a/vike/shared/route/debug.ts +++ b/vike/shared/route/debug.ts @@ -1,7 +1,7 @@ export { debug } // Note how we only import `type`: we don't actually import/load the debug code. -import type { createDebugger, Debug } from '../../utils/debug.js' +import type { createDebugger, Debug } from '../../utils/debug' var _debug: undefined | typeof debug function debug(...args: Parameters) { diff --git a/vike/shared/route/deduceRouteStringFromFilesystemPath.spec.ts b/vike/shared/route/deduceRouteStringFromFilesystemPath.spec.ts index 89e56b6e11..b33024dc25 100644 --- a/vike/shared/route/deduceRouteStringFromFilesystemPath.spec.ts +++ b/vike/shared/route/deduceRouteStringFromFilesystemPath.spec.ts @@ -1,4 +1,4 @@ -import { deduceRouteStringFromFilesystemPath } from './deduceRouteStringFromFilesystemPath.js' +import { deduceRouteStringFromFilesystemPath } from './deduceRouteStringFromFilesystemPath' import { expect, describe, it } from 'vitest' describe('deduceRouteStringFromFilesystemPath', () => { diff --git a/vike/shared/route/deduceRouteStringFromFilesystemPath.ts b/vike/shared/route/deduceRouteStringFromFilesystemPath.ts index dd4be560fd..a7a759dcbf 100644 --- a/vike/shared/route/deduceRouteStringFromFilesystemPath.ts +++ b/vike/shared/route/deduceRouteStringFromFilesystemPath.ts @@ -1,6 +1,6 @@ // Unit tests at ./deduceRouteStringFromFilesystemPath.spec.ts -import { assert, higherFirst, slice } from './utils.js' +import { assert, higherFirst, slice } from './utils' export { deduceRouteStringFromFilesystemPath } export type { FilesystemRoot } diff --git a/vike/shared/route/executeGuardHook.ts b/vike/shared/route/executeGuardHook.ts index 9dbbfbd606..79ce18f5ef 100644 --- a/vike/shared/route/executeGuardHook.ts +++ b/vike/shared/route/executeGuardHook.ts @@ -1,10 +1,10 @@ export { executeGuardHook } -import { getHook, getHookTimeoutDefault, type Hook } from '../hooks/getHook.js' -import { assert, assertUsage, isCallable } from './utils.js' -import type { PageContextExports, PageFile } from '../getPageFiles.js' -import type { PageConfigRuntime } from '../page-configs/PageConfig.js' -import { executeHook } from '../hooks/executeHook.js' +import { getHook, getHookTimeoutDefault, type Hook } from '../hooks/getHook' +import { assert, assertUsage, isCallable } from './utils' +import type { PageContextExports, PageFile } from '../getPageFiles' +import type { PageConfigRuntime } from '../page-configs/PageConfig' +import { executeHook } from '../hooks/executeHook' const errIntro = 'The guard() hook defined by' async function executeGuardHook< diff --git a/vike/shared/route/executeOnBeforeRouteHook.ts b/vike/shared/route/executeOnBeforeRouteHook.ts index 64561bf9dd..e038fad731 100644 --- a/vike/shared/route/executeOnBeforeRouteHook.ts +++ b/vike/shared/route/executeOnBeforeRouteHook.ts @@ -1,6 +1,6 @@ export { executeOnBeforeRouteHook } -import { assertPageContextProvidedByUser } from '../assertPageContextProvidedByUser.js' +import { assertPageContextProvidedByUser } from '../assertPageContextProvidedByUser' import { assertUsage, hasProp, @@ -10,12 +10,12 @@ import { assertUsageUrlPathnameAbsolute, joinEnglish, assert -} from './utils.js' -import { assertRouteParams, assertSyncRouting } from './resolveRouteFunction.js' +} from './utils' +import { assertRouteParams, assertSyncRouting } from './resolveRouteFunction' import pc from '@brillout/picocolors' -import type { PageContextForRoute, PageContextFromRoute } from './index.js' -import type { Hook } from '../hooks/getHook.js' -import { executeHook } from '../hooks/executeHook.js' +import type { PageContextForRoute, PageContextFromRoute } from './index' +import type { Hook } from '../hooks/getHook' +import { executeHook } from '../hooks/executeHook' async function executeOnBeforeRouteHook( pageContext: PageContextForRoute diff --git a/vike/shared/route/index.ts b/vike/shared/route/index.ts index 208ad5c37b..51710f0849 100644 --- a/vike/shared/route/index.ts +++ b/vike/shared/route/index.ts @@ -5,28 +5,28 @@ export type { PageRoutes } export type { RouteMatches } // Ensure we don't bloat runtime of Server Routing -import { assertClientRouting } from '../../utils/assertRoutingType.js' -import { isBrowser } from '../../utils/isBrowser.js' +import { assertClientRouting } from '../../utils/assertRoutingType' +import { isBrowser } from '../../utils/isBrowser' if (isBrowser()) { assertClientRouting() } -import type { PageFile } from '../getPageFiles.js' -import { assert, assertUsage, isPlainObject, objectAssign } from './utils.js' +import type { PageFile } from '../getPageFiles' +import { assert, assertUsage, isPlainObject, objectAssign } from './utils' import { assertPageContextUrl, type PageContextUrlInternal, type PageContextUrlSource -} from '../getPageContextUrlComputed.js' -import { resolvePrecendence } from './resolvePrecedence.js' -import { resolveRouteString } from './resolveRouteString.js' -import { resolveRouteFunction } from './resolveRouteFunction.js' -import { executeOnBeforeRouteHook } from './executeOnBeforeRouteHook.js' -import type { PageRoutes, RouteType } from './loadPageRoutes.js' -import { debug } from './debug.js' -import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../page-configs/PageConfig.js' +} from '../getPageContextUrlComputed' +import { resolvePrecendence } from './resolvePrecedence' +import { resolveRouteString } from './resolveRouteString' +import { resolveRouteFunction } from './resolveRouteFunction' +import { executeOnBeforeRouteHook } from './executeOnBeforeRouteHook' +import type { PageRoutes, RouteType } from './loadPageRoutes' +import { debug } from './debug' +import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../page-configs/PageConfig' import pc from '@brillout/picocolors' -import type { Hook } from '../hooks/getHook.js' +import type { Hook } from '../hooks/getHook' type PageContextForRoute = PageContextUrlInternal & { _pageFilesAll: PageFile[] diff --git a/vike/shared/route/loadPageRoutes.ts b/vike/shared/route/loadPageRoutes.ts index 693c46093f..aa9ed27615 100644 --- a/vike/shared/route/loadPageRoutes.ts +++ b/vike/shared/route/loadPageRoutes.ts @@ -2,16 +2,16 @@ export { loadPageRoutes } export type { PageRoutes } export type { RouteType } -import type { PageFile } from '../getPageFiles.js' -import { isErrorPageId } from '../error-page.js' -import { assert, assertUsage, hasProp, slice } from './utils.js' -import { FilesystemRoot, deduceRouteStringFromFilesystemPath } from './deduceRouteStringFromFilesystemPath.js' -import { isCallable } from '../utils.js' -import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../page-configs/PageConfig.js' -import { getConfigValueRuntime } from '../page-configs/getConfigValue.js' -import { getDefinedAtString } from '../page-configs/getConfigDefinedAt.js' -import { warnDeprecatedAllowKey } from './resolveRouteFunction.js' -import { getHookFromPageConfigGlobal, getHookTimeoutDefault, type Hook } from '../hooks/getHook.js' +import type { PageFile } from '../getPageFiles' +import { isErrorPageId } from '../error-page' +import { assert, assertUsage, hasProp, slice } from './utils' +import { FilesystemRoot, deduceRouteStringFromFilesystemPath } from './deduceRouteStringFromFilesystemPath' +import { isCallable } from '../utils' +import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../page-configs/PageConfig' +import { getConfigValueRuntime } from '../page-configs/getConfigValue' +import { getDefinedAtString } from '../page-configs/getConfigDefinedAt' +import { warnDeprecatedAllowKey } from './resolveRouteFunction' +import { getHookFromPageConfigGlobal, getHookTimeoutDefault, type Hook } from '../hooks/getHook' type PageRoute = { pageId: string diff --git a/vike/shared/route/resolvePrecedence.ts b/vike/shared/route/resolvePrecedence.ts index 901b97b1ae..99809fb9de 100644 --- a/vike/shared/route/resolvePrecedence.ts +++ b/vike/shared/route/resolvePrecedence.ts @@ -1,11 +1,11 @@ export { resolvePrecendence } // export type { RouteMatch } -import { analyzeRouteString } from './resolveRouteString.js' -import { higherFirst, lowerFirst } from './utils.js' -import { makeFirst } from './utils.js' -import { isStaticRouteString } from './resolveRouteString.js' -import type { RouteType } from './loadPageRoutes.js' +import { analyzeRouteString } from './resolveRouteString' +import { higherFirst, lowerFirst } from './utils' +import { makeFirst } from './utils' +import { isStaticRouteString } from './resolveRouteString' +import type { RouteType } from './loadPageRoutes' type RouteMatch = { precedence?: number | null diff --git a/vike/shared/route/resolvePrecedence/resolvePrecedence_overall.spec.ts b/vike/shared/route/resolvePrecedence/resolvePrecedence_overall.spec.ts index e0b39b9050..0222430172 100644 --- a/vike/shared/route/resolvePrecedence/resolvePrecedence_overall.spec.ts +++ b/vike/shared/route/resolvePrecedence/resolvePrecedence_overall.spec.ts @@ -1,4 +1,4 @@ -import { resolvePrecendence } from '../resolvePrecedence.js' +import { resolvePrecendence } from '../resolvePrecedence' import { expect, describe, it } from 'vitest' const routeFilesystemStatic = { diff --git a/vike/shared/route/resolvePrecedence/resolvePrecedence_route-strings.spec.ts b/vike/shared/route/resolvePrecedence/resolvePrecedence_route-strings.spec.ts index d294037e92..13c017d4fa 100644 --- a/vike/shared/route/resolvePrecedence/resolvePrecedence_route-strings.spec.ts +++ b/vike/shared/route/resolvePrecedence/resolvePrecedence_route-strings.spec.ts @@ -1,5 +1,5 @@ -import { resolvePrecendence } from '../resolvePrecedence.js' -import { resolveRouteString } from '../resolveRouteString.js' +import { resolvePrecendence } from '../resolvePrecedence' +import { resolveRouteString } from '../resolveRouteString' import { expect, describe, it } from 'vitest' describe('Route Strings Precedence', () => { diff --git a/vike/shared/route/resolveRoute.ts b/vike/shared/route/resolveRoute.ts index b3a6c018e7..eb711b95d2 100644 --- a/vike/shared/route/resolveRoute.ts +++ b/vike/shared/route/resolveRoute.ts @@ -1,7 +1,7 @@ export { resolveRoute } -import { assertUsage } from './utils.js' -import { resolveRouteString } from './resolveRouteString.js' +import { assertUsage } from './utils' +import { resolveRouteString } from './resolveRouteString' import pc from '@brillout/picocolors' function resolveRoute( diff --git a/vike/shared/route/resolveRouteFunction.ts b/vike/shared/route/resolveRouteFunction.ts index f101834951..9daf592d02 100644 --- a/vike/shared/route/resolveRouteFunction.ts +++ b/vike/shared/route/resolveRouteFunction.ts @@ -3,8 +3,8 @@ export { assertRouteParams } export { assertSyncRouting } export { warnDeprecatedAllowKey } -import { assertPageContextUrl, PageContextUrlInternal } from '../getPageContextUrlComputed.js' -import { assert, assertUsage, assertWarning, hasProp, isPlainObject, isPromise } from './utils.js' +import { assertPageContextUrl, PageContextUrlInternal } from '../getPageContextUrlComputed' +import { assert, assertUsage, assertWarning, hasProp, isPlainObject, isPromise } from './utils' import pc from '@brillout/picocolors' async function resolveRouteFunction( diff --git a/vike/shared/route/resolveRouteString.spec.ts b/vike/shared/route/resolveRouteString.spec.ts index ee32d26c79..e50afe2b11 100644 --- a/vike/shared/route/resolveRouteString.spec.ts +++ b/vike/shared/route/resolveRouteString.spec.ts @@ -1,5 +1,5 @@ -import { resolveRouteString } from './resolveRouteString.js' -import { stripAnsi } from '../../utils/stripAnsi.js' +import { resolveRouteString } from './resolveRouteString' +import { stripAnsi } from '../../utils/stripAnsi' import { expect, describe, it } from 'vitest' const r: typeof resolveRouteString = (a, b) => resolveRouteString(a, b) diff --git a/vike/shared/route/resolveRouteString.ts b/vike/shared/route/resolveRouteString.ts index 0a09485cc0..d3e58d83f8 100644 --- a/vike/shared/route/resolveRouteString.ts +++ b/vike/shared/route/resolveRouteString.ts @@ -5,8 +5,8 @@ export { analyzeRouteString } export { assertRouteString } export { getRouteStringParameterList } -import { assertWarning, isBrowser, escapeRegex } from '../utils.js' -import { assert, assertUsage } from './utils.js' +import { assertWarning, isBrowser, escapeRegex } from '../utils' +import { assert, assertUsage } from './utils' import pc from '@brillout/picocolors' const PARAM_TOKEN_NEW = '@' diff --git a/vike/shared/route/resolveUrlPathname.ts b/vike/shared/route/resolveUrlPathname.ts index 36e412e3cb..c14a93b5fe 100644 --- a/vike/shared/route/resolveUrlPathname.ts +++ b/vike/shared/route/resolveUrlPathname.ts @@ -1,7 +1,7 @@ export { resolveUrlPathname } -import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser.js' -import { assert, assertUsage } from '../utils.js' +import { assertIsNotBrowser } from '../../utils/assertIsNotBrowser' +import { assert, assertUsage } from '../utils' assertIsNotBrowser() // Don't bloat the client type Part = diff --git a/vike/shared/route/routing.ts b/vike/shared/route/routing.ts index e1c827ed79..ded69a17a5 100644 --- a/vike/shared/route/routing.ts +++ b/vike/shared/route/routing.ts @@ -2,4 +2,4 @@ // import { resolveRoute } from 'vike/routing' // to: // import { resolveRoute } from 'vike' -export { resolveRoute } from './resolveRoute.js' +export { resolveRoute } from './resolveRoute' diff --git a/vike/shared/route/utils.ts b/vike/shared/route/utils.ts index 0105f05d84..7e8fbc0e42 100644 --- a/vike/shared/route/utils.ts +++ b/vike/shared/route/utils.ts @@ -3,24 +3,24 @@ // - runtime of client (Client Routing) // Ensure we don't bloat runtime of Server Routing with the utils down below -import { assertClientRouting } from '../../utils/assertRoutingType.js' -import { isBrowser } from '../../utils/isBrowser.js' +import { assertClientRouting } from '../../utils/assertRoutingType' +import { isBrowser } from '../../utils/isBrowser' if (isBrowser()) { assertClientRouting() } -export * from '../../utils/assert.js' -export * from '../../utils/hasProp.js' -export * from '../../utils/isObjectWithKeys.js' -export * from '../../utils/sorter.js' -export * from '../../utils/isPromise.js' -export * from '../../utils/isPlainObject.js' -export * from '../../utils/objectAssign.js' -export * from '../../utils/slice.js' -export * from '../../utils/unique.js' -export * from '../../utils/isBrowser.js' -export * from '../../utils/parseUrl.js' -export * from '../../utils/checkType.js' -export * from '../../utils/joinEnglish.js' -export * from '../../utils/truncateString.js' -export * from '../../utils/isCallable.js' +export * from '../../utils/assert' +export * from '../../utils/hasProp' +export * from '../../utils/isObjectWithKeys' +export * from '../../utils/sorter' +export * from '../../utils/isPromise' +export * from '../../utils/isPlainObject' +export * from '../../utils/objectAssign' +export * from '../../utils/slice' +export * from '../../utils/unique' +export * from '../../utils/isBrowser' +export * from '../../utils/parseUrl' +export * from '../../utils/checkType' +export * from '../../utils/joinEnglish' +export * from '../../utils/truncateString' +export * from '../../utils/isCallable' diff --git a/vike/shared/types.ts b/vike/shared/types.ts index 0c642a6f24..e503ae7c06 100644 --- a/vike/shared/types.ts +++ b/vike/shared/types.ts @@ -14,11 +14,11 @@ export { PageContextBuiltInServer_deprecated as PageContextBuiltInServer } export { PageContextBuiltInClientWithClientRouting_deprecated as PageContextBuiltInClientWithClientRouting } export { PageContextBuiltInClientWithServerRouting_deprecated as PageContextBuiltInClientWithServerRouting } -import type { PageContextUrlInternal, PageContextUrlClient, PageContextUrlServer } from './getPageContextUrlComputed.js' -import type { ConfigEntries, ExportsAll, From, Source, Sources } from './getPageFiles/getExports.js' -import type { Config } from './page-configs/Config.js' -import type { PageContextConfig } from './page-configs/Config/PageContextConfig.js' -import type { AbortStatusCode } from './route/abort.js' +import type { PageContextUrlInternal, PageContextUrlClient, PageContextUrlServer } from './getPageContextUrlComputed' +import type { ConfigEntries, ExportsAll, From, Source, Sources } from './getPageFiles/getExports' +import type { Config } from './page-configs/Config' +import type { PageContextConfig } from './page-configs/Config/PageContextConfig' +import type { AbortStatusCode } from './route/abort' type PageContextServer = PageContextBuiltInServer & Vike.PageContext diff --git a/vike/shared/utils.ts b/vike/shared/utils.ts index 7f07cb2d2b..cc31f511bc 100644 --- a/vike/shared/utils.ts +++ b/vike/shared/utils.ts @@ -3,27 +3,27 @@ // - runtime of client (Server Routing) // - runtime of client (Client Routing) -export * from '../utils/assert.js' -export * from '../utils/parseUrl.js' -export * from '../utils/objectAssign.js' -export * from '../utils/isCallable.js' -export * from '../utils/isObject.js' -export * from '../utils/unique.js' -export * from '../utils/slice.js' -export * from '../utils/sorter.js' -export * from '../utils/isBrowser.js' -export * from '../utils/hasProp.js' -export * from '../utils/isPlainObject.js' -export * from '../utils/compareString.js' -export * from '../utils/isNotNullish.js' -export * from '../utils/stringifyStringArray.js' -export * from '../utils/filesystemPathHandling.js' -export * from '../utils/cast.js' -export * from '../utils/isPropertyGetter.js' -export * from '../utils/isPromise.js' -export * from '../utils/checkType.js' -export * from '../utils/getValuePrintable.js' -export * from '../utils/escapeRegex.js' -export * from '../utils/isArray.js' -export * from '../utils/changeEnumerable.js' -export * from '../utils/objectDefineProperty.js' +export * from '../utils/assert' +export * from '../utils/parseUrl' +export * from '../utils/objectAssign' +export * from '../utils/isCallable' +export * from '../utils/isObject' +export * from '../utils/unique' +export * from '../utils/slice' +export * from '../utils/sorter' +export * from '../utils/isBrowser' +export * from '../utils/hasProp' +export * from '../utils/isPlainObject' +export * from '../utils/compareString' +export * from '../utils/isNotNullish' +export * from '../utils/stringifyStringArray' +export * from '../utils/filesystemPathHandling' +export * from '../utils/cast' +export * from '../utils/isPropertyGetter' +export * from '../utils/isPromise' +export * from '../utils/checkType' +export * from '../utils/getValuePrintable' +export * from '../utils/escapeRegex' +export * from '../utils/isArray' +export * from '../utils/changeEnumerable' +export * from '../utils/objectDefineProperty' diff --git a/vike/tsconfig.json b/vike/tsconfig.json index 8436f63b59..cb99402a36 100644 --- a/vike/tsconfig.json +++ b/vike/tsconfig.json @@ -1,14 +1,14 @@ { "compilerOptions": { // Output - "target": "ES2020", - "module": "Node16", + "target": "ESNext", + "module": "ESNext", "outDir": "./dist/esm/", // ./dist/cjs/ is generated by ./tsconfig.cjs.json "rootDir": "./", "declaration": true, "noEmitOnError": false, // Resolution - "moduleResolution": "Node16", + "moduleResolution": "Bundler", "esModuleInterop": true, // Libs "lib": ["ES2021", "DOM", "DOM.Iterable"], diff --git a/vike/types/defineConfig.ts b/vike/types/defineConfig.ts index e0d148bb6b..ce8a236918 100644 --- a/vike/types/defineConfig.ts +++ b/vike/types/defineConfig.ts @@ -1,6 +1,6 @@ export { defineConfig } -import type { Config } from '../shared/page-configs/Config.js' +import type { Config } from '../shared/page-configs/Config' function defineConfig(config: Config): Config { return config diff --git a/vike/types/index-dreprecated.ts b/vike/types/index-dreprecated.ts index 1619ba9eee..c8aac8f953 100644 --- a/vike/types/index-dreprecated.ts +++ b/vike/types/index-dreprecated.ts @@ -19,7 +19,7 @@ import type { Config as Config_, Env as Env_, ConfigEntries as ConfigEntries_ -} from './index.js' +} from './index' /** @deprecated All types have been moved to `vike/types`. * Replace: diff --git a/vike/types/index.ts b/vike/types/index.ts index 9be3401d39..f7d2a715dd 100644 --- a/vike/types/index.ts +++ b/vike/types/index.ts @@ -1,14 +1,14 @@ -export type { PageContext } from '../shared/types.js' -export type { PageContextServer } from '../shared/types.js' -export type { PageContextClient } from '../shared/types.js' -export type { PageContextWithServerRouting } from '../shared/types.js' -export type { PageContextClientWithServerRouting } from '../shared/types.js' +export type { PageContext } from '../shared/types' +export type { PageContextServer } from '../shared/types' +export type { PageContextClient } from '../shared/types' +export type { PageContextWithServerRouting } from '../shared/types' +export type { PageContextClientWithServerRouting } from '../shared/types' export type { ConfigVitePluginServerEntry } from '@brillout/vite-plugin-server-entry/plugin' // TODO/v1-release: remove these three exports -export type { PageContextBuiltInServer } from '../shared/types.js' -export type { PageContextBuiltInClientWithClientRouting } from '../shared/types.js' -export type { PageContextBuiltInClientWithServerRouting } from '../shared/types.js' +export type { PageContextBuiltInServer } from '../shared/types' +export type { PageContextBuiltInClientWithClientRouting } from '../shared/types' +export type { PageContextBuiltInClientWithServerRouting } from '../shared/types' export type { Config, diff --git a/vike/utils/assert.ts b/vike/utils/assert.ts index f35178fb3b..5072266441 100644 --- a/vike/utils/assert.ts +++ b/vike/utils/assert.ts @@ -9,11 +9,11 @@ export { overwriteAssertProductionLogger } export { isBug } export { setAlwaysShowStackTrace } -import { assertSingleInstance_onAssertModuleLoad } from './assertSingleInstance.js' -import { createErrorWithCleanStackTrace } from './createErrorWithCleanStackTrace.js' -import { getGlobalObject } from './getGlobalObject.js' -import { isObject } from './isObject.js' -import { projectInfo } from './projectInfo.js' +import { assertSingleInstance_onAssertModuleLoad } from './assertSingleInstance' +import { createErrorWithCleanStackTrace } from './createErrorWithCleanStackTrace' +import { getGlobalObject } from './getGlobalObject' +import { isObject } from './isObject' +import { projectInfo } from './projectInfo' import pc from '@brillout/picocolors' const globalObject = getGlobalObject<{ alreadyLogged: Set diff --git a/vike/utils/assertIsBrowser.ts b/vike/utils/assertIsBrowser.ts index 99562ff23f..5755ff227a 100644 --- a/vike/utils/assertIsBrowser.ts +++ b/vike/utils/assertIsBrowser.ts @@ -1,7 +1,7 @@ export { assertIsBrowser } -import { isBrowser } from './isBrowser.js' -import { assert } from './assert.js' +import { isBrowser } from './isBrowser' +import { assert } from './assert' function assertIsBrowser() { assert(isBrowser()) diff --git a/vike/utils/assertIsNotBrowser.ts b/vike/utils/assertIsNotBrowser.ts index bfd606dc65..013a099b76 100644 --- a/vike/utils/assertIsNotBrowser.ts +++ b/vike/utils/assertIsNotBrowser.ts @@ -1,7 +1,7 @@ export { assertIsNotBrowser } -import { isBrowser } from './isBrowser.js' -import { assert } from './assert.js' +import { isBrowser } from './isBrowser' +import { assert } from './assert' /** Ensure we don't bloat the client-side */ function assertIsNotBrowser() { diff --git a/vike/utils/assertIsNotProductionRuntime.ts b/vike/utils/assertIsNotProductionRuntime.ts index 6ece3e620e..8e52c8a85c 100644 --- a/vike/utils/assertIsNotProductionRuntime.ts +++ b/vike/utils/assertIsNotProductionRuntime.ts @@ -7,11 +7,11 @@ export { markEnvAsVikePluginLoaded } export { assertEnv } export { vikeVitePluginLoadedInProductionError } -import { assert, assertUsage } from './assert.js' -import { assertIsNotBrowser } from './assertIsNotBrowser.js' -import { createDebugger } from './debug.js' -import { getGlobalObject } from './getGlobalObject.js' -import { isVitest } from './isVitest.js' +import { assert, assertUsage } from './assert' +import { assertIsNotBrowser } from './assertIsNotBrowser' +import { createDebugger } from './debug' +import { getGlobalObject } from './getGlobalObject' +import { isVitest } from './isVitest' assertIsNotBrowser() const debug = createDebugger('vike:setup') const vikeVitePluginLoadedInProductionError = `Loading Vike's Vite plugin (the vike/plugin module) is prohibited in production.` diff --git a/vike/utils/assertKeys.ts b/vike/utils/assertKeys.ts index aff4dd992c..f7a96b851a 100644 --- a/vike/utils/assertKeys.ts +++ b/vike/utils/assertKeys.ts @@ -1,8 +1,8 @@ export { assertKeys } import pc from '@brillout/picocolors' -import { assertUsage } from './assert.js' -import { joinEnglish } from './joinEnglish.js' +import { assertUsage } from './assert' +import { joinEnglish } from './joinEnglish' function assertKeys( obj: Record, diff --git a/vike/utils/assertNodeEnv.ts b/vike/utils/assertNodeEnv.ts index ae9538b11d..3de176d611 100644 --- a/vike/utils/assertNodeEnv.ts +++ b/vike/utils/assertNodeEnv.ts @@ -20,9 +20,9 @@ export { handleNodeEnv_prerender } export { handleNodeEnv_vitePluginVercel } import pc from '@brillout/picocolors' -import { assertIsNotBrowser } from './assertIsNotBrowser.js' -import { assertWarning } from './assert.js' -import { vikeVitePluginLoadedInProductionError } from './assertIsNotProductionRuntime.js' +import { assertIsNotBrowser } from './assertIsNotBrowser' +import { assertWarning } from './assert' +import { vikeVitePluginLoadedInProductionError } from './assertIsNotProductionRuntime' assertIsNotBrowser() function assertNodeEnv_build() { diff --git a/vike/utils/assertNodeVersion.ts b/vike/utils/assertNodeVersion.ts index bea325712d..c0dbd56d23 100644 --- a/vike/utils/assertNodeVersion.ts +++ b/vike/utils/assertNodeVersion.ts @@ -1,7 +1,7 @@ export { assertNodeVersion } -import { isNodeJS } from './isNodeJS.js' -import { assertVersion } from './assertVersion.js' +import { isNodeJS } from './isNodeJS' +import { assertVersion } from './assertVersion' // node_modules/vike/package.json#engines.node isn't enough as users can ignore it function assertNodeVersion() { diff --git a/vike/utils/assertRoutingType.ts b/vike/utils/assertRoutingType.ts index 5b3cafda06..6f3f544307 100644 --- a/vike/utils/assertRoutingType.ts +++ b/vike/utils/assertRoutingType.ts @@ -2,9 +2,9 @@ export { assertClientRouting } export { assertServerRouting } export { checkIfClientRouting } -import { assertUsage, assertWarning } from './assert.js' -import { getGlobalObject } from './getGlobalObject.js' -import { isBrowser } from './isBrowser.js' +import { assertUsage, assertWarning } from './assert' +import { getGlobalObject } from './getGlobalObject' +import { isBrowser } from './isBrowser' import pc from '@brillout/picocolors' const state = getGlobalObject<{ isClientRouting?: boolean }>('utils/assertRouterType.ts', {}) diff --git a/vike/utils/assertSingleInstance.ts b/vike/utils/assertSingleInstance.ts index da8d6b4f09..833c4327e6 100644 --- a/vike/utils/assertSingleInstance.ts +++ b/vike/utils/assertSingleInstance.ts @@ -6,12 +6,12 @@ export { assertSingleInstance_onAssertModuleLoad } // - Show warning if entry of Client Routing and entry of Server Routing are both loaded // - Show warning if vike is loaded twice -import { unique } from './unique.js' -import { getGlobalObject } from './getGlobalObject.js' -import { projectInfo } from './projectInfo.js' +import { unique } from './unique' +import { getGlobalObject } from './getGlobalObject' +import { projectInfo } from './projectInfo' import pc from '@brillout/picocolors' /* Use original assertUsage() & assertWarning() after all CJS is removed from node_modules/vike/dist/ -import { assertUsage, assertWarning } from './assert.js' +import { assertUsage, assertWarning } from './assert' */ const globalObject = getGlobalObject<{ instances: string[] diff --git a/vike/utils/assertVersion.ts b/vike/utils/assertVersion.ts index 64c8623ae7..72b1ef8ae3 100644 --- a/vike/utils/assertVersion.ts +++ b/vike/utils/assertVersion.ts @@ -1,7 +1,7 @@ export { assertVersion } export { isVersionOrAbove } -import { assert, assertUsage } from './assert.js' +import { assert, assertUsage } from './assert' function assertVersion( dependencyName: 'Vite' | 'Node.js', diff --git a/vike/utils/augmentType.ts b/vike/utils/augmentType.ts index c7e06059d8..3224abc4ec 100644 --- a/vike/utils/augmentType.ts +++ b/vike/utils/augmentType.ts @@ -1,6 +1,6 @@ export { augmentType } -import { assert } from './assert.js' +import { assert } from './assert' /** Help TypeScript augment the type of objects. */ function augmentType(thing: Thing, clone: Clone): asserts thing is Thing & Clone { diff --git a/vike/utils/createErrorWithCleanStackTrace.ts b/vike/utils/createErrorWithCleanStackTrace.ts index cfd8cfcdbb..da22dbc4f3 100644 --- a/vike/utils/createErrorWithCleanStackTrace.ts +++ b/vike/utils/createErrorWithCleanStackTrace.ts @@ -1,6 +1,6 @@ export { createErrorWithCleanStackTrace } -import { isNodeJS } from './isNodeJS.js' +import { isNodeJS } from './isNodeJS' function createErrorWithCleanStackTrace(errorMessage: string, numberOfStackTraceLinesToRemove: number) { const err = new Error(errorMessage) diff --git a/vike/utils/debug.ts b/vike/utils/debug.ts index 9adddf380e..4cfaa1caa9 100644 --- a/vike/utils/debug.ts +++ b/vike/utils/debug.ts @@ -2,16 +2,16 @@ export { createDebugger } export { isDebugActivated } export type { Debug } -import { isBrowser } from './isBrowser.js' -import { isCallable } from './isCallable.js' -import { objectAssign } from './objectAssign.js' -import { assert, assertUsage } from './assert.js' -import { checkType } from './checkType.js' -import { getTerminalWidth } from './getTerminWidth.js' +import { isBrowser } from './isBrowser' +import { isCallable } from './isCallable' +import { objectAssign } from './objectAssign' +import { assert, assertUsage } from './assert' +import { checkType } from './checkType' +import { getTerminalWidth } from './getTerminWidth' import pc from '@brillout/picocolors' -import { isArray } from './isArray.js' +import { isArray } from './isArray' -// Avoid this to be loaded in the browser. For isomorphic code: instead of `import { createDebugger } from './utils.js'`, use `globalThis.createDebugger()`. +// Avoid this to be loaded in the browser. For isomorphic code: instead of `import { createDebugger } from './utils'`, use `globalThis.createDebugger()`. assert(!isBrowser()) ;(globalThis as any).__brillout_debug_createDebugger = createDebugger diff --git a/vike/utils/debugGlob.ts b/vike/utils/debugGlob.ts index 84063440d2..f26546969b 100644 --- a/vike/utils/debugGlob.ts +++ b/vike/utils/debugGlob.ts @@ -1,3 +1,3 @@ -import { createDebugger } from './debug.js' +import { createDebugger } from './debug' // TODO/v1-release: remove (or rename?) export const debugGlob = createDebugger('vike:glob') diff --git a/vike/utils/filesystemPathHandling.ts b/vike/utils/filesystemPathHandling.ts index c700b6c23d..64c5eb9335 100644 --- a/vike/utils/filesystemPathHandling.ts +++ b/vike/utils/filesystemPathHandling.ts @@ -1,7 +1,7 @@ export { toPosixPath } export { assertPosixPath } -import { assert } from './assert.js' +import { assert } from './assert' function toPosixPath(path: string): string { const pathPosix = path.split('\\').join('/') diff --git a/vike/utils/findFile.ts b/vike/utils/findFile.ts index 8f865beef3..c5adcfd5e7 100644 --- a/vike/utils/findFile.ts +++ b/vike/utils/findFile.ts @@ -2,8 +2,8 @@ export { findFile } import path from 'path' import fs from 'fs' -import { isArray } from './isArray.js' -import { assertPosixPath } from './filesystemPathHandling.js' +import { isArray } from './isArray' +import { assertPosixPath } from './filesystemPathHandling' type Filename = 'package.json' | 'vike.config.js' | 'vike.config.ts' diff --git a/vike/utils/findPackageJson.ts b/vike/utils/findPackageJson.ts index d175e426da..f2a688edf9 100644 --- a/vike/utils/findPackageJson.ts +++ b/vike/utils/findPackageJson.ts @@ -1,6 +1,6 @@ export { findPackageJson } -import { findFile } from './findFile.js' +import { findFile } from './findFile' import { createRequire } from 'module' // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build. const importMetaUrl: string = import.meta.url diff --git a/vike/utils/formatHintLog.ts b/vike/utils/formatHintLog.ts index c80bb03275..a01aa485cd 100644 --- a/vike/utils/formatHintLog.ts +++ b/vike/utils/formatHintLog.ts @@ -1,5 +1,5 @@ -import { assert } from './assert.js' -import { stripAnsi } from './stripAnsi.js' +import { assert } from './assert' +import { stripAnsi } from './stripAnsi' export { formatHintLog } diff --git a/vike/utils/freezePartial.spec.ts b/vike/utils/freezePartial.spec.ts index 9d993e32c2..edab805e45 100644 --- a/vike/utils/freezePartial.spec.ts +++ b/vike/utils/freezePartial.spec.ts @@ -1,5 +1,5 @@ import { expect, describe, it } from 'vitest' -import { freezePartial } from './freezePartial.js' +import { freezePartial } from './freezePartial' import pc from '@brillout/picocolors' describe('freezePartial', () => { diff --git a/vike/utils/freezePartial.ts b/vike/utils/freezePartial.ts index 4d5f71e20e..bee6f061c8 100644 --- a/vike/utils/freezePartial.ts +++ b/vike/utils/freezePartial.ts @@ -3,7 +3,7 @@ export { freezePartial } import pc from '@brillout/picocolors' // Unit tests at ./freezePartial.spec.ts -import { assertIsNotBrowser } from './assertIsNotBrowser.js' +import { assertIsNotBrowser } from './assertIsNotBrowser' assertIsNotBrowser() function freezePartial(obj: Record, allowList: Record boolean>) { diff --git a/vike/utils/getCurrentUrl.ts b/vike/utils/getCurrentUrl.ts index 1efa798427..2768fc306b 100644 --- a/vike/utils/getCurrentUrl.ts +++ b/vike/utils/getCurrentUrl.ts @@ -1,7 +1,7 @@ export { getCurrentUrl } -import { parseUrl } from './parseUrl.js' -import { assert } from './assert.js' +import { parseUrl } from './parseUrl' +import { assert } from './assert' function getCurrentUrl(options?: { withoutHash: true }): `/${string}` { const url = window.location.href diff --git a/vike/utils/getFileExtension.ts b/vike/utils/getFileExtension.ts index cd5e91b428..c353b5891b 100644 --- a/vike/utils/getFileExtension.ts +++ b/vike/utils/getFileExtension.ts @@ -1,6 +1,6 @@ export { getFileExtension } -import { slice } from './slice.js' +import { slice } from './slice' function getFileExtension(id: string) { id = id.split('?')[0]! diff --git a/vike/utils/getGlobalObject.ts b/vike/utils/getGlobalObject.ts index d3f2faf130..f41649628b 100644 --- a/vike/utils/getGlobalObject.ts +++ b/vike/utils/getGlobalObject.ts @@ -1,8 +1,8 @@ export { getGlobalObject } export { assertIsSingleModuleInstance } -import { assert } from './assert.js' -import { projectInfo } from './projectInfo.js' +import { assert } from './assert' +import { projectInfo } from './projectInfo' const projectKey = `_${projectInfo.projectName.toLowerCase()}` as const /** Share information across module instances. */ diff --git a/vike/utils/getMostSimilar.ts b/vike/utils/getMostSimilar.ts index b8d3950b37..dddcf8a57c 100644 --- a/vike/utils/getMostSimilar.ts +++ b/vike/utils/getMostSimilar.ts @@ -1,8 +1,8 @@ export { getMostSimilar } -import { assert } from './assert.js' -import { higherFirst } from './sorter.js' -import { assertIsNotBrowser } from './assertIsNotBrowser.js' +import { assert } from './assert' +import { higherFirst } from './sorter' +import { assertIsNotBrowser } from './assertIsNotBrowser' assertIsNotBrowser() diff --git a/vike/utils/getOutDirs.ts b/vike/utils/getOutDirs.ts index 7536c9a2f0..2ac484549a 100644 --- a/vike/utils/getOutDirs.ts +++ b/vike/utils/getOutDirs.ts @@ -3,12 +3,12 @@ export { resolveOutDir } export type { OutDirs } import type { UserConfig, ResolvedConfig } from 'vite' -import { viteIsSSR } from './viteIsSSR.js' -import { assert, assertUsage } from './assert.js' -import { pathJoin } from './path-shim.js' -import { assertPosixPath, toPosixPath } from './filesystemPathHandling.js' +import { viteIsSSR } from './viteIsSSR' +import { assert, assertUsage } from './assert' +import { pathJoin } from './path-shim' +import { assertPosixPath, toPosixPath } from './filesystemPathHandling' import pc from '@brillout/picocolors' -import { createDebugger } from './debug.js' +import { createDebugger } from './debug' const debug = createDebugger('vike:outDir') type OutDirs = { diff --git a/vike/utils/getRandomId.ts b/vike/utils/getRandomId.ts index d9ce63beb5..00c350ff86 100644 --- a/vike/utils/getRandomId.ts +++ b/vike/utils/getRandomId.ts @@ -1,6 +1,6 @@ export { getRandomId } -import { assert } from './assert.js' +import { assert } from './assert' // https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript diff --git a/vike/utils/getValuePrintable.spec.ts b/vike/utils/getValuePrintable.spec.ts index 3d813f15fe..b4d3eda56c 100644 --- a/vike/utils/getValuePrintable.spec.ts +++ b/vike/utils/getValuePrintable.spec.ts @@ -1,5 +1,5 @@ import { expect, describe, it } from 'vitest' -import { getValuePrintable } from './getValuePrintable.js' +import { getValuePrintable } from './getValuePrintable' describe('getValuePrintable()', () => { it('works', () => { diff --git a/vike/utils/hasProp.ts b/vike/utils/hasProp.ts index 8d93258190..518dd5c6bf 100644 --- a/vike/utils/hasProp.ts +++ b/vike/utils/hasProp.ts @@ -1,11 +1,11 @@ export { hasProp } export type { ResolveTypeAsString } -import { isCallable } from './isCallable.js' -import { isObject } from './isObject.js' -import { isArrayOfStrings } from './isArrayOfStrings.js' -import { isObjectOfStrings } from './isObjectOfStrings.js' -import { isArray } from './isArray.js' +import { isCallable } from './isCallable' +import { isObject } from './isObject' +import { isArrayOfStrings } from './isArrayOfStrings' +import { isObjectOfStrings } from './isObjectOfStrings' +import { isArray } from './isArray' type TypeAsString = | 'object' diff --git a/vike/utils/injectRollupInputs.ts b/vike/utils/injectRollupInputs.ts index 50d07a6e85..c7858e10d2 100644 --- a/vike/utils/injectRollupInputs.ts +++ b/vike/utils/injectRollupInputs.ts @@ -2,9 +2,9 @@ export { injectRollupInputs } export { normalizeRollupInput } import type { ResolvedConfig, Rollup } from 'vite' -import { assert } from './assert.js' -import { isObject } from './isObject.js' -import { isArray } from './isArray.js' +import { assert } from './assert' +import { isObject } from './isObject' +import { isArray } from './isArray' type InputOption = Rollup.InputOption type InputsMap = Record diff --git a/vike/utils/isArrayOfStrings.ts b/vike/utils/isArrayOfStrings.ts index 00c235badc..6a08a973af 100644 --- a/vike/utils/isArrayOfStrings.ts +++ b/vike/utils/isArrayOfStrings.ts @@ -1,6 +1,6 @@ export { isArrayOfStrings } -import { isArray } from './isArray.js' +import { isArray } from './isArray' function isArrayOfStrings(val: unknown): val is string[] { return isArray(val) && val.every((v) => typeof v === 'string') diff --git a/vike/utils/isDev.ts b/vike/utils/isDev.ts index c3711365f5..8011c09b21 100644 --- a/vike/utils/isDev.ts +++ b/vike/utils/isDev.ts @@ -1,7 +1,7 @@ export { isDev2 } export { isDev3 } -import { assert } from './assert.js' +import { assert } from './assert' // We can propbably remove this file after we implement the Vike CLI @@ -30,7 +30,7 @@ function isDev3(configEnv: ConfigEnv): boolean { * - https://github.com/vikejs/vike/issues/1791 * - Calling Vite's createServer() is enough for hasViteDevServer to be true, even without actually adding Vite's development middleware to the server: https://github.com/vikejs/vike/issues/792#issuecomment-1516830759 * -import { getGlobalObject } from './getGlobalObject.js' +import { getGlobalObject } from './getGlobalObject' const globalObject = getGlobalObject('utils/isDev.ts', { isDev: false, isDev_wasCalled: false }) function isDev1(): boolean { globalObject.isDev_wasCalled = true diff --git a/vike/utils/isFilePathAbsoluteFilesystem.ts b/vike/utils/isFilePathAbsoluteFilesystem.ts index 8efe1ab1ad..bf00f3f675 100644 --- a/vike/utils/isFilePathAbsoluteFilesystem.ts +++ b/vike/utils/isFilePathAbsoluteFilesystem.ts @@ -2,8 +2,8 @@ export { assertFilePathAbsoluteFilesystem } export { isFilePathAbsolute } import path from 'path' -import { assert } from './assert.js' -import { assertPosixPath } from './filesystemPathHandling.js' +import { assert } from './assert' +import { assertPosixPath } from './filesystemPathHandling' /** * Asserts that `filePath` is an absolute file path starting from the filesystem root. diff --git a/vike/utils/isHtml.spec.ts b/vike/utils/isHtml.spec.ts index 0321d52fd5..5caf1df85b 100644 --- a/vike/utils/isHtml.spec.ts +++ b/vike/utils/isHtml.spec.ts @@ -1,5 +1,5 @@ import { expect, describe, it } from 'vitest' -import { isHtml } from './isHtml.js' +import { isHtml } from './isHtml' describe('isHtml()', () => { it('works', () => { diff --git a/vike/utils/isNpmPackage.spec.ts b/vike/utils/isNpmPackage.spec.ts index 3be1efd99d..4fb6e92c0d 100644 --- a/vike/utils/isNpmPackage.spec.ts +++ b/vike/utils/isNpmPackage.spec.ts @@ -1,5 +1,5 @@ import { expect, describe, it, assert } from 'vitest' -import { isDistinguishable, isValidPathAlias, parse } from './isNpmPackage.js' +import { isDistinguishable, isValidPathAlias, parse } from './isNpmPackage' describe('parse()', () => { it('basics', () => { diff --git a/vike/utils/isNpmPackage.ts b/vike/utils/isNpmPackage.ts index 41d7906eea..ef1c4ca6c0 100644 --- a/vike/utils/isNpmPackage.ts +++ b/vike/utils/isNpmPackage.ts @@ -12,8 +12,8 @@ export { getNpmPackageImportPath } export { parse } export { isDistinguishable } -import { assert } from './assert.js' -import { assertIsNotBrowser } from './assertIsNotBrowser.js' +import { assert } from './assert' +import { assertIsNotBrowser } from './assertIsNotBrowser' assertIsNotBrowser() function isNpmPackageImport(str: string, { cannotBePathAlias }: { cannotBePathAlias: true }): boolean { diff --git a/vike/utils/isObjectOfStrings.ts b/vike/utils/isObjectOfStrings.ts index bd316f1aeb..fe58fc14dc 100644 --- a/vike/utils/isObjectOfStrings.ts +++ b/vike/utils/isObjectOfStrings.ts @@ -1,6 +1,6 @@ export { isObjectOfStrings } -import { isObject } from './isObject.js' +import { isObject } from './isObject' function isObjectOfStrings(val: unknown): val is Record { return isObject(val) && Object.values(val).every((v) => typeof v === 'string') diff --git a/vike/utils/isObjectWithKeys.ts b/vike/utils/isObjectWithKeys.ts index 512e0e9783..bb98d69ef4 100644 --- a/vike/utils/isObjectWithKeys.ts +++ b/vike/utils/isObjectWithKeys.ts @@ -1,4 +1,4 @@ -import { isPlainObject } from './isPlainObject.js' +import { isPlainObject } from './isPlainObject' export { isObjectWithKeys } diff --git a/vike/utils/isPromise.ts b/vike/utils/isPromise.ts index 87b8ea6664..3551c2fd74 100644 --- a/vike/utils/isPromise.ts +++ b/vike/utils/isPromise.ts @@ -1,4 +1,4 @@ -import { isCallable } from './isCallable.js' +import { isCallable } from './isCallable' export function isPromise(val: unknown): val is Promise { return typeof val === 'object' && val !== null && 'then' in val && isCallable((val as Record).then) } diff --git a/vike/utils/isSameErrorMessage.ts b/vike/utils/isSameErrorMessage.ts index 912c70b9b7..53be7014d9 100644 --- a/vike/utils/isSameErrorMessage.ts +++ b/vike/utils/isSameErrorMessage.ts @@ -1,4 +1,4 @@ -import { isObject } from './isObject.js' +import { isObject } from './isObject' export { isSameErrorMessage } diff --git a/vike/utils/isScriptFile.ts b/vike/utils/isScriptFile.ts index 2ea551bbf8..186937a9a8 100644 --- a/vike/utils/isScriptFile.ts +++ b/vike/utils/isScriptFile.ts @@ -4,7 +4,7 @@ export { isTemplateFile } export { scriptFileExtensions } export { scriptFileExtensionList } -import { assert } from './assert.js' +import { assert } from './assert' // We can't use a RegExp: // - Needs to work with Micromatch: https://github.com/micromatch/micromatch because: diff --git a/vike/utils/joinEnglish.ts b/vike/utils/joinEnglish.ts index 559f6d41b2..5f6cd970d6 100644 --- a/vike/utils/joinEnglish.ts +++ b/vike/utils/joinEnglish.ts @@ -1,6 +1,6 @@ export { joinEnglish } -import { assert } from './assert.js' +import { assert } from './assert' // https://stackoverflow.com/questions/53879088/join-an-array-by-commas-and-and/53879103#53879103 function joinEnglish( diff --git a/vike/utils/normalizeHeaders.spec.ts b/vike/utils/normalizeHeaders.spec.ts index dbb4c9ec06..167434fed7 100644 --- a/vike/utils/normalizeHeaders.spec.ts +++ b/vike/utils/normalizeHeaders.spec.ts @@ -1,5 +1,5 @@ import { expect, describe, it } from 'vitest' -import { normalizeHeaders } from './normalizeHeaders.js' +import { normalizeHeaders } from './normalizeHeaders' describe('normalizeHeaders()', () => { it('works', () => { diff --git a/vike/utils/normalizeHeaders.ts b/vike/utils/normalizeHeaders.ts index 4fd744c4f7..b16f7a5ae0 100644 --- a/vike/utils/normalizeHeaders.ts +++ b/vike/utils/normalizeHeaders.ts @@ -1,6 +1,6 @@ export { normalizeHeaders } -import { isObject } from './isObject.js' +import { isObject } from './isObject' function normalizeHeaders( /* This type is precise, too precise which can be annoying: e.g. cannot pass a string[][] argument because it doesn't match the more precise [string,string][] type. diff --git a/vike/utils/objectAssign.ts b/vike/utils/objectAssign.ts index 5e599773f4..ab860cbe75 100644 --- a/vike/utils/objectAssign.ts +++ b/vike/utils/objectAssign.ts @@ -1,6 +1,6 @@ export { objectAssign } -import { assert } from './assert.js' +import { assert } from './assert' // Same as Object.assign() but: // - With type inference diff --git a/vike/utils/parseUrl-extras.spec.ts b/vike/utils/parseUrl-extras.spec.ts index 54233b6b59..fd4be6cc95 100644 --- a/vike/utils/parseUrl-extras.spec.ts +++ b/vike/utils/parseUrl-extras.spec.ts @@ -1,4 +1,4 @@ -import { normalizeUrlPathname, removeUrlOrigin, setUrlOrigin } from './parseUrl-extras.js' +import { normalizeUrlPathname, removeUrlOrigin, setUrlOrigin } from './parseUrl-extras' import { expect, describe, it } from 'vitest' describe('normalizeUrlPathname()', () => { diff --git a/vike/utils/parseUrl-extras.ts b/vike/utils/parseUrl-extras.ts index 8caebc72ea..4b70295cc0 100644 --- a/vike/utils/parseUrl-extras.ts +++ b/vike/utils/parseUrl-extras.ts @@ -7,10 +7,10 @@ export { removeUrlOrigin } export { setUrlOrigin } export { getUrlPretty } -import { assertUrlComponents, createUrlFromComponents, isBaseServer, parseUrl } from './parseUrl.js' -import { assert } from './assert.js' -import { slice } from './slice.js' -import { assertIsNotBrowser } from './assertIsNotBrowser.js' +import { assertUrlComponents, createUrlFromComponents, isBaseServer, parseUrl } from './parseUrl' +import { assert } from './assert' +import { slice } from './slice' +import { assertIsNotBrowser } from './assertIsNotBrowser' assertIsNotBrowser() function prependBase(url: string, baseServer: string): string { diff --git a/vike/utils/parseUrl.spec.ts b/vike/utils/parseUrl.spec.ts index 05b0f0e005..10fe89b239 100644 --- a/vike/utils/parseUrl.spec.ts +++ b/vike/utils/parseUrl.spec.ts @@ -1,4 +1,4 @@ -import { parseUrl } from './parseUrl.js' +import { parseUrl } from './parseUrl' import { expect, describe, it } from 'vitest' import assert from 'assert' diff --git a/vike/utils/parseUrl.ts b/vike/utils/parseUrl.ts index 8571c08246..cf6318b0c5 100644 --- a/vike/utils/parseUrl.ts +++ b/vike/utils/parseUrl.ts @@ -18,8 +18,8 @@ export { createUrlFromComponents } export type { UrlPublic } export type { UrlPrivate } -import { slice } from './slice.js' -import { assert, assertUsage } from './assert.js' +import { slice } from './slice' +import { assert, assertUsage } from './assert' import pc from '@brillout/picocolors' type UrlPublic = { diff --git a/vike/utils/path-shim.ts b/vike/utils/path-shim.ts index e0aab9e38f..401eab43bb 100644 --- a/vike/utils/path-shim.ts +++ b/vike/utils/path-shim.ts @@ -3,7 +3,7 @@ export { pathJoin } // Simple shim for `import * from "node:path"` used by the server runtime. // Robust alternative: https://github.com/unjs/pathe -import { assert } from './assert.js' +import { assert } from './assert' function pathJoin(path1: string, path2: string): string { assert(!path1.includes('\\')) diff --git a/vike/utils/projectInfo.ts b/vike/utils/projectInfo.ts index ccf50d4ab2..a7283a2c6c 100644 --- a/vike/utils/projectInfo.ts +++ b/vike/utils/projectInfo.ts @@ -1,4 +1,4 @@ -import { PROJECT_VERSION } from './PROJECT_VERSION.js' +import { PROJECT_VERSION } from './PROJECT_VERSION' export const projectInfo = { projectName: 'Vike' as const, projectVersion: PROJECT_VERSION diff --git a/vike/utils/requireResolve.ts b/vike/utils/requireResolve.ts index a8e8ce748d..da7b85ad04 100644 --- a/vike/utils/requireResolve.ts +++ b/vike/utils/requireResolve.ts @@ -1,10 +1,10 @@ export { requireResolve } -import { assert } from './assert.js' -import { assertIsNotBrowser } from './assertIsNotBrowser.js' -import { assertIsNotProductionRuntime } from './assertIsNotProductionRuntime.js' -import { assertPosixPath, toPosixPath } from './filesystemPathHandling.js' -import { scriptFileExtensionList } from './isScriptFile.js' +import { assert } from './assert' +import { assertIsNotBrowser } from './assertIsNotBrowser' +import { assertIsNotProductionRuntime } from './assertIsNotProductionRuntime' +import { assertPosixPath, toPosixPath } from './filesystemPathHandling' +import { scriptFileExtensionList } from './isScriptFile' import { createRequire } from 'module' // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build. const importMetaUrl: string = import.meta.url diff --git a/vike/utils/slice.ts b/vike/utils/slice.ts index 4f54fec9b8..e7451aa7d7 100644 --- a/vike/utils/slice.ts +++ b/vike/utils/slice.ts @@ -1,4 +1,4 @@ -import { assert } from './assert.js' +import { assert } from './assert' export { slice } diff --git a/vike/utils/sorter.ts b/vike/utils/sorter.ts index b86056682d..b9a1ead9ab 100644 --- a/vike/utils/sorter.ts +++ b/vike/utils/sorter.ts @@ -1,4 +1,4 @@ -import { assert } from './assert.js' +import { assert } from './assert' export { higherFirst } export { lowerFirst } diff --git a/vike/utils/stripAnsi.ts b/vike/utils/stripAnsi.ts index 590410c704..c2a94dfa9c 100644 --- a/vike/utils/stripAnsi.ts +++ b/vike/utils/stripAnsi.ts @@ -1,6 +1,6 @@ export { stripAnsi } -import { assertIsNotBrowser } from './assertIsNotBrowser.js' +import { assertIsNotBrowser } from './assertIsNotBrowser' assertIsNotBrowser() const ansiRegex = getAnsiRegex() diff --git a/vike/utils/trackLogs.ts b/vike/utils/trackLogs.ts index 509cc776f2..6d535f34f1 100644 --- a/vike/utils/trackLogs.ts +++ b/vike/utils/trackLogs.ts @@ -1,6 +1,6 @@ -import { isDebugActivated } from './debug.js' +import { isDebugActivated } from './debug' import pc from '@brillout/picocolors' -import { assertIsNotBrowser } from './assertIsNotBrowser.js' +import { assertIsNotBrowser } from './assertIsNotBrowser' assertIsNotBrowser() diff --git a/vike/utils/trimWithAnsi.spec.ts b/vike/utils/trimWithAnsi.spec.ts index 432099e82a..d785642b00 100644 --- a/vike/utils/trimWithAnsi.spec.ts +++ b/vike/utils/trimWithAnsi.spec.ts @@ -1,4 +1,4 @@ -import { trimWithAnsi, trimWithAnsiTrailOnly } from './trimWithAnsi.js' +import { trimWithAnsi, trimWithAnsiTrailOnly } from './trimWithAnsi' import { expect, describe, it } from 'vitest' import pc from '@brillout/picocolors' diff --git a/vike/utils/trimWithAnsi.ts b/vike/utils/trimWithAnsi.ts index 9b4cb4e6d1..f34e64c197 100644 --- a/vike/utils/trimWithAnsi.ts +++ b/vike/utils/trimWithAnsi.ts @@ -1,8 +1,8 @@ export { trimWithAnsi } export { trimWithAnsiTrailOnly } -import { assert } from './assert.js' -import { stripAnsi } from './stripAnsi.js' +import { assert } from './assert' +import { stripAnsi } from './stripAnsi' const whitespaceRegex = /(\s+)/ // Capturing parathesis so that split preserves seperator diff --git a/vike/utils/truncateString.ts b/vike/utils/truncateString.ts index 364b60d862..42f26221e9 100644 --- a/vike/utils/truncateString.ts +++ b/vike/utils/truncateString.ts @@ -1,7 +1,7 @@ export { truncateString } import pc from '@brillout/picocolors' -import { assert } from './assert.js' +import { assert } from './assert' function truncateString(str: string, lenMax: number) { const lenMaxReal = lenMax - 3 diff --git a/vike/utils/urlToFile.ts b/vike/utils/urlToFile.ts index e78d78a5ff..9b405b3c5f 100644 --- a/vike/utils/urlToFile.ts +++ b/vike/utils/urlToFile.ts @@ -1,9 +1,9 @@ export { urlToFile } export { baseServer } -import { assert } from './assert.js' -import { parseUrl } from './parseUrl.js' -import { slice } from './slice.js' +import { assert } from './assert' +import { parseUrl } from './parseUrl' +import { slice } from './slice' // - When doing a `.pageContext.json` HTTP request, the base URL should be preserved. (The server-side will handle the base URL.) // - While pre-rendering there is no base URL diff --git a/vike/utils/virtual-files.ts b/vike/utils/virtual-files.ts index 258e8f78d0..1e350a978f 100644 --- a/vike/utils/virtual-files.ts +++ b/vike/utils/virtual-files.ts @@ -2,7 +2,7 @@ export { isVirtualFileId } export { getVirtualFileId } export { resolveVirtualFileId } -import { assert } from './assert.js' +import { assert } from './assert' const idBase = 'virtual:vike:' // https://vitejs.dev/guide/api-plugin.html#virtual-modules-convention diff --git a/vike/utils/viteIsSSR.ts b/vike/utils/viteIsSSR.ts index 41788858f3..5e6c799c48 100644 --- a/vike/utils/viteIsSSR.ts +++ b/vike/utils/viteIsSSR.ts @@ -1,5 +1,5 @@ -import { assert } from './assert.js' -import { isObject } from './isObject.js' +import { assert } from './assert' +import { isObject } from './isObject' export { viteIsSSR } export { viteIsSSR_options } diff --git a/vike/utils/warnIfErrorIsNotObject.ts b/vike/utils/warnIfErrorIsNotObject.ts index 86c914f862..d3e0bf4593 100644 --- a/vike/utils/warnIfErrorIsNotObject.ts +++ b/vike/utils/warnIfErrorIsNotObject.ts @@ -1,8 +1,8 @@ export { warnIfErrorIsNotObject } -import { assertWarning } from './assert.js' -import { assertIsNotBrowser } from './assertIsNotBrowser.js' -import { isObject } from './isObject.js' +import { assertWarning } from './assert' +import { assertIsNotBrowser } from './assertIsNotBrowser' +import { isObject } from './isObject' import pc from '@brillout/picocolors' assertIsNotBrowser()