vike 0.4.223 → 0.4.224-commit-f0d0f8a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/node/api/build.js +4 -37
- package/dist/cjs/node/api/prepareViteApiCall.js +9 -3
- package/dist/cjs/node/plugin/index.js +8 -20
- package/dist/cjs/node/plugin/plugins/baseUrls.js +3 -1
- package/dist/cjs/node/plugin/plugins/{buildConfig/fixServerAssets.js → build/handleAssetsManifest.js} +130 -52
- package/dist/cjs/node/plugin/plugins/build/pluginAutoFullBuild.js +145 -0
- package/dist/cjs/node/plugin/plugins/build/pluginBuildApp.js +52 -0
- package/dist/cjs/node/plugin/plugins/{buildConfig.js → build/pluginBuildConfig.js} +22 -84
- package/dist/cjs/node/plugin/plugins/{buildEntry/index.js → build/pluginBuildEntry.js} +9 -9
- package/dist/cjs/node/plugin/plugins/{distFileNames.js → build/pluginDistFileNames.js} +7 -7
- package/dist/cjs/node/plugin/plugins/{packageJsonFile.js → build/pluginDistPackageJsonFile.js} +6 -6
- package/dist/cjs/node/plugin/plugins/{suppressRollupWarning.js → build/pluginSuppressRollupWarning.js} +3 -3
- package/dist/cjs/node/plugin/plugins/build.js +21 -0
- package/dist/cjs/node/plugin/plugins/commonConfig.js +22 -4
- package/dist/cjs/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
- package/dist/cjs/node/plugin/plugins/devConfig/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/envVars.js +2 -2
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +9 -9
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +2 -2
- package/dist/cjs/node/plugin/plugins/fileEnv.js +5 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +3 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +2 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/assertExtensions.js +5 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +7 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles/ignorePatternsBuiltIn.js +16 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +50 -64
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +2 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js +3 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +19 -7
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +277 -212
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/virtual-files/getVirtualFilePageConfigValuesAll.js +4 -4
- package/dist/cjs/node/plugin/plugins/previewConfig.js +12 -7
- package/dist/cjs/node/plugin/shared/addSsrMiddleware.js +5 -1
- package/dist/cjs/node/plugin/shared/findPageFiles.js +3 -3
- package/dist/cjs/node/plugin/shared/getOutDirs.js +8 -7
- package/dist/cjs/node/plugin/shared/isViteServerBuild.js +47 -0
- package/dist/cjs/node/plugin/shared/resolveClientEntriesDev.js +1 -1
- package/dist/cjs/node/plugin/utils.js +1 -0
- package/dist/cjs/node/prerender/context.js +3 -8
- package/dist/cjs/node/prerender/resolvePrerenderConfig.js +30 -21
- package/dist/cjs/node/prerender/runPrerender.js +28 -30
- package/dist/cjs/node/prerender/utils.js +1 -0
- package/dist/cjs/node/runtime/html/stream.js +7 -0
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +13 -2
- package/dist/cjs/shared/getPageContextUrlComputed.js +1 -1
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +2 -5
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +3 -1
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +20 -9
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/debug.js +2 -1
- package/dist/cjs/utils/findFile.js +1 -1
- package/dist/cjs/utils/findPackageJson.js +1 -1
- package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +10 -4
- package/dist/cjs/utils/path.js +1 -0
- package/dist/cjs/utils/requireResolve.js +11 -4
- package/dist/cjs/utils/sorter.js +0 -3
- package/dist/esm/client/client-routing-runtime/index.d.ts +1 -0
- package/dist/esm/client/client-routing-runtime/index.js +1 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.d.ts +8 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +10 -1
- package/dist/esm/node/api/build.js +4 -4
- package/dist/esm/node/api/prepareViteApiCall.js +9 -3
- package/dist/esm/node/plugin/index.d.ts +2 -1
- package/dist/esm/node/plugin/index.js +4 -17
- package/dist/esm/node/plugin/plugins/baseUrls.js +3 -1
- package/dist/esm/node/plugin/plugins/build/handleAssetsManifest.d.ts +18 -0
- package/dist/esm/node/plugin/plugins/{buildConfig/fixServerAssets.js → build/handleAssetsManifest.js} +131 -53
- package/dist/esm/node/plugin/plugins/build/pluginAutoFullBuild.d.ts +5 -0
- package/dist/esm/node/plugin/plugins/build/pluginAutoFullBuild.js +140 -0
- package/dist/esm/node/plugin/plugins/build/pluginBuildApp.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/build/pluginBuildApp.js +50 -0
- package/dist/esm/node/plugin/plugins/{buildConfig.d.ts → build/pluginBuildConfig.d.ts} +3 -3
- package/dist/esm/node/plugin/plugins/{buildConfig.js → build/pluginBuildConfig.js} +22 -81
- package/dist/esm/node/plugin/plugins/build/pluginBuildEntry.d.ts +7 -0
- package/dist/esm/node/plugin/plugins/{buildEntry/index.js → build/pluginBuildEntry.js} +9 -9
- package/dist/esm/node/plugin/plugins/build/pluginDistFileNames.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/{distFileNames.js → build/pluginDistFileNames.js} +7 -7
- package/dist/esm/node/plugin/plugins/build/pluginDistPackageJsonFile.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/{packageJsonFile.js → build/pluginDistPackageJsonFile.js} +7 -6
- package/dist/esm/node/plugin/plugins/build/pluginSuppressRollupWarning.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/{suppressRollupWarning.js → build/pluginSuppressRollupWarning.js} +3 -3
- package/dist/esm/node/plugin/plugins/build.d.ts +3 -0
- package/dist/esm/node/plugin/plugins/build.js +19 -0
- package/dist/esm/node/plugin/plugins/commonConfig.d.ts +16 -6
- package/dist/esm/node/plugin/plugins/commonConfig.js +22 -4
- package/dist/esm/node/plugin/plugins/devConfig/determineFsAllowList.js +1 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
- package/dist/esm/node/plugin/plugins/devConfig/index.js +1 -1
- package/dist/esm/node/plugin/plugins/envVars.js +2 -2
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +10 -10
- package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +2 -2
- package/dist/esm/node/plugin/plugins/fileEnv.js +5 -2
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +2 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/assertExtensions.js +5 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +7 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles/ignorePatternsBuiltIn.d.ts +1 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles/ignorePatternsBuiltIn.js +13 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +50 -64
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +2 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +20 -8
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +8 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +279 -214
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/virtual-files/getVirtualFilePageConfigValuesAll.js +4 -4
- package/dist/esm/node/plugin/plugins/previewConfig.js +12 -7
- package/dist/esm/node/plugin/shared/addSsrMiddleware.d.ts +1 -1
- package/dist/esm/node/plugin/shared/addSsrMiddleware.js +5 -1
- package/dist/esm/node/plugin/shared/findPageFiles.js +3 -3
- package/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.js +1 -3
- package/dist/esm/node/plugin/shared/getOutDirs.d.ts +2 -2
- package/dist/esm/node/plugin/shared/getOutDirs.js +8 -7
- package/dist/esm/node/plugin/shared/isViteServerBuild.d.ts +15 -0
- package/dist/esm/node/plugin/shared/isViteServerBuild.js +45 -0
- package/dist/esm/node/plugin/shared/resolveClientEntriesDev.js +1 -1
- package/dist/esm/node/plugin/utils.d.ts +1 -0
- package/dist/esm/node/plugin/utils.js +1 -0
- package/dist/esm/node/prerender/context.d.ts +0 -2
- package/dist/esm/node/prerender/context.js +4 -9
- package/dist/esm/node/prerender/resolvePrerenderConfig.d.ts +11 -6
- package/dist/esm/node/prerender/resolvePrerenderConfig.js +31 -22
- package/dist/esm/node/prerender/runPrerender.d.ts +7 -25
- package/dist/esm/node/prerender/runPrerender.js +29 -31
- package/dist/esm/node/prerender/utils.d.ts +1 -0
- package/dist/esm/node/prerender/utils.js +1 -0
- package/dist/esm/node/runtime/globalContext.d.ts +3 -2
- package/dist/esm/node/runtime/html/stream.js +7 -0
- package/dist/esm/node/runtime/renderPage/logErrorHint.js +13 -2
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +165 -5
- package/dist/esm/shared/getPageContextUrlComputed.js +1 -1
- package/dist/esm/shared/page-configs/Config.d.ts +12 -2
- package/dist/esm/shared/page-configs/PageConfig.d.ts +5 -5
- package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +2 -5
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +3 -1
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.d.ts +2 -0
- package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +20 -9
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/debug.js +2 -1
- package/dist/esm/utils/findFile.js +1 -1
- package/dist/esm/utils/findPackageJson.js +1 -1
- package/dist/esm/utils/isFilePathAbsoluteFilesystem.js +8 -2
- package/dist/esm/utils/path.js +1 -0
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/dist/esm/utils/requireResolve.js +11 -4
- package/dist/esm/utils/sorter.d.ts +18 -5
- package/dist/esm/utils/sorter.js +0 -3
- package/package.json +9 -16
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +0 -119
- package/dist/cjs/node/plugin/plugins/buildApp.js +0 -76
- package/dist/cjs/node/plugin/plugins/removeRequireHookPlugin.js +0 -17
- package/dist/cjs/node/plugin/shared/getFullBuildInlineConfig.js +0 -20
- package/dist/cjs/node/plugin/shared/viteIsSSR.js +0 -31
- package/dist/esm/node/plugin/plugins/autoFullBuild.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/autoFullBuild.js +0 -114
- package/dist/esm/node/plugin/plugins/buildApp.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/buildApp.js +0 -74
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.d.ts +0 -20
- package/dist/esm/node/plugin/plugins/buildEntry/index.d.ts +0 -8
- package/dist/esm/node/plugin/plugins/distFileNames.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/packageJsonFile.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/removeRequireHookPlugin.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/removeRequireHookPlugin.js +0 -15
- package/dist/esm/node/plugin/plugins/suppressRollupWarning.d.ts +0 -3
- package/dist/esm/node/plugin/shared/getFullBuildInlineConfig.d.ts +0 -2
- package/dist/esm/node/plugin/shared/getFullBuildInlineConfig.js +0 -17
- package/dist/esm/node/plugin/shared/viteIsSSR.d.ts +0 -11
- package/dist/esm/node/plugin/shared/viteIsSSR.js +0 -29
- package/dist-cjs-fixup.mjs +0 -41
|
@@ -23,7 +23,6 @@ import type { ResolvedConfig, ViteDevServer } from 'vite';
|
|
|
23
23
|
import type { PageConfigUserFriendly, PageConfigsUserFriendly } from '../../shared/page-configs/getPageConfigUserFriendly.js';
|
|
24
24
|
import type { ConfigVitePluginServerEntry } from '@brillout/vite-plugin-server-entry/plugin';
|
|
25
25
|
import { type BaseUrlsResolved } from '../shared/resolveBase.js';
|
|
26
|
-
type GlobalContextPublic = Pick<GlobalContext, 'assetsManifest' | 'config' | 'viteConfig' | 'pages' | 'baseAssets' | 'baseServer'>;
|
|
27
26
|
type PageRuntimeInfo = Awaited<ReturnType<typeof getUserFiles>>;
|
|
28
27
|
type GlobalContextInternal = GlobalContext & {
|
|
29
28
|
globalContext_public: GlobalContextPublic;
|
|
@@ -57,6 +56,8 @@ declare function getGlobalContextInternal(): Promise<GlobalContextInternal>;
|
|
|
57
56
|
declare function getGlobalContextSync(): GlobalContextPublic;
|
|
58
57
|
/** @experimental https://vike.dev/getGlobalContext */
|
|
59
58
|
declare function getGlobalContextAsync(isProduction: boolean): Promise<GlobalContextPublic>;
|
|
59
|
+
type GlobalContextPublic = ReturnType<typeof makePublic>;
|
|
60
|
+
declare function makePublic(globalContext: GlobalContext): Pick<GlobalContext, "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
|
|
60
61
|
declare function setGlobalContext_viteDevServer(viteDevServer: ViteDevServer): Promise<void>;
|
|
61
62
|
declare function setGlobalContext_viteConfig(viteConfig: ResolvedConfig, outDirRoot: string): void;
|
|
62
63
|
declare function setGlobalContext_isPrerendering(): void;
|
|
@@ -74,7 +75,7 @@ declare function getUserFiles(): Promise<{
|
|
|
74
75
|
pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
75
76
|
onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
76
77
|
pages: PageConfigsUserFriendly;
|
|
77
|
-
config: import("../../
|
|
78
|
+
config: import("../../types/index.js").ConfigResolved;
|
|
78
79
|
}>;
|
|
79
80
|
declare function setGlobalContext_buildEntry(buildEntry: unknown): Promise<void>;
|
|
80
81
|
type BuildInfo = {
|
|
@@ -159,6 +159,13 @@ function getStreamReadableWeb(htmlRender) {
|
|
|
159
159
|
if (isStreamReadableWeb(htmlRender)) {
|
|
160
160
|
return htmlRender;
|
|
161
161
|
}
|
|
162
|
+
if (isStreamPipeWeb(htmlRender)) {
|
|
163
|
+
const streamPipeWeb = getStreamPipeWeb(htmlRender);
|
|
164
|
+
assert(streamPipeWeb);
|
|
165
|
+
const { readable, writable } = new TransformStream();
|
|
166
|
+
streamPipeWeb(writable);
|
|
167
|
+
return readable;
|
|
168
|
+
}
|
|
162
169
|
return null;
|
|
163
170
|
}
|
|
164
171
|
function pipeToStreamWritableWeb(htmlRender, writable) {
|
|
@@ -23,15 +23,25 @@ const errorsMisc = [
|
|
|
23
23
|
errMsg: 'assets.json',
|
|
24
24
|
link: 'https://vike.dev/getGlobalContext',
|
|
25
25
|
mustMentionNodeModules: false
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
errMsg: 'ERR_UNKNOWN_FILE_EXTENSION',
|
|
29
|
+
link: 'https://vike.dev/broken-npm-package#err-unknown-file-extension'
|
|
26
30
|
}
|
|
27
31
|
];
|
|
32
|
+
const reactInvalidEelement = 'https://vike.dev/broken-npm-package#react-invalid-component';
|
|
28
33
|
const errorsReact = [
|
|
29
34
|
{
|
|
30
35
|
errMsg: 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)',
|
|
31
|
-
link:
|
|
36
|
+
link: reactInvalidEelement,
|
|
32
37
|
// The stack trace can be user-land while the import is coming from node_modules
|
|
33
38
|
mustMentionNodeModules: false
|
|
34
39
|
},
|
|
40
|
+
{
|
|
41
|
+
errMsg: 'Objects are not valid as a React child',
|
|
42
|
+
link: reactInvalidEelement,
|
|
43
|
+
mustMentionNodeModules: false
|
|
44
|
+
},
|
|
35
45
|
{
|
|
36
46
|
// React's "Invalid hook call.", see https://github.com/vikejs/vike/discussions/1637#discussioncomment-9424712
|
|
37
47
|
errMsg: "Cannot read properties of null (reading 'useContext')"
|
|
@@ -67,7 +77,8 @@ const errorsCjsEsm = [
|
|
|
67
77
|
{ errMsg: 'exports is not defined' },
|
|
68
78
|
{ errMsg: 'module is not defined' },
|
|
69
79
|
{ errMsg: 'not defined in ES' },
|
|
70
|
-
{ errMsg: "Unexpected token 'export'" }
|
|
80
|
+
{ errMsg: "Unexpected token 'export'" },
|
|
81
|
+
{ errMsg: 'Failed to resolve entry for package' }
|
|
71
82
|
];
|
|
72
83
|
function logErrorHint(error) {
|
|
73
84
|
/* Collect errors for ./logErrorHint.spec.ts
|
|
@@ -48,7 +48,39 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
48
48
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
49
49
|
_globalContext: GlobalContextInternal;
|
|
50
50
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
51
|
-
globalContext:
|
|
51
|
+
globalContext: Pick<{
|
|
52
|
+
viteConfigRuntime: {
|
|
53
|
+
_baseViteOriginal: null | string;
|
|
54
|
+
};
|
|
55
|
+
config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
|
|
56
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
57
|
+
} & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
|
|
58
|
+
pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
|
|
59
|
+
pageConfigs: import("../../../__internal/index.js").PageConfig[];
|
|
60
|
+
pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
|
|
61
|
+
allPageIds: string[];
|
|
62
|
+
pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
63
|
+
onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
64
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
65
|
+
config: import("../../../types/index.js").ConfigResolved;
|
|
66
|
+
} & ({
|
|
67
|
+
isProduction: false;
|
|
68
|
+
isPrerendering: false;
|
|
69
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
70
|
+
viteDevServer: import("vite").ViteDevServer;
|
|
71
|
+
assetsManifest: null;
|
|
72
|
+
} | ({
|
|
73
|
+
isProduction: true;
|
|
74
|
+
assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
|
|
75
|
+
viteDevServer: null;
|
|
76
|
+
} & ({
|
|
77
|
+
isPrerendering: false;
|
|
78
|
+
viteConfig: null;
|
|
79
|
+
} | {
|
|
80
|
+
isPrerendering: true;
|
|
81
|
+
usesClientRouter: boolean;
|
|
82
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
83
|
+
})))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
|
|
52
84
|
_pageContextInit: {
|
|
53
85
|
urlOriginal: string;
|
|
54
86
|
headersOriginal?: unknown;
|
|
@@ -102,7 +134,39 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
|
|
|
102
134
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
103
135
|
_globalContext: GlobalContextInternal;
|
|
104
136
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
105
|
-
globalContext:
|
|
137
|
+
globalContext: Pick<{
|
|
138
|
+
viteConfigRuntime: {
|
|
139
|
+
_baseViteOriginal: null | string;
|
|
140
|
+
};
|
|
141
|
+
config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
|
|
142
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
143
|
+
} & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
|
|
144
|
+
pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
|
|
145
|
+
pageConfigs: import("../../../__internal/index.js").PageConfig[];
|
|
146
|
+
pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
|
|
147
|
+
allPageIds: string[];
|
|
148
|
+
pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
149
|
+
onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
150
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
151
|
+
config: import("../../../types/index.js").ConfigResolved;
|
|
152
|
+
} & ({
|
|
153
|
+
isProduction: false;
|
|
154
|
+
isPrerendering: false;
|
|
155
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
156
|
+
viteDevServer: import("vite").ViteDevServer;
|
|
157
|
+
assetsManifest: null;
|
|
158
|
+
} | ({
|
|
159
|
+
isProduction: true;
|
|
160
|
+
assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
|
|
161
|
+
viteDevServer: null;
|
|
162
|
+
} & ({
|
|
163
|
+
isPrerendering: false;
|
|
164
|
+
viteConfig: null;
|
|
165
|
+
} | {
|
|
166
|
+
isPrerendering: true;
|
|
167
|
+
usesClientRouter: boolean;
|
|
168
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
169
|
+
})))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
|
|
106
170
|
_pageContextInit: {
|
|
107
171
|
urlOriginal: string;
|
|
108
172
|
headersOriginal?: unknown;
|
|
@@ -157,7 +221,39 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
|
|
|
157
221
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
158
222
|
_globalContext: GlobalContextInternal;
|
|
159
223
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
160
|
-
globalContext:
|
|
224
|
+
globalContext: Pick<{
|
|
225
|
+
viteConfigRuntime: {
|
|
226
|
+
_baseViteOriginal: null | string;
|
|
227
|
+
};
|
|
228
|
+
config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
|
|
229
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
230
|
+
} & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
|
|
231
|
+
pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
|
|
232
|
+
pageConfigs: import("../../../__internal/index.js").PageConfig[];
|
|
233
|
+
pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
|
|
234
|
+
allPageIds: string[];
|
|
235
|
+
pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
236
|
+
onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
237
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
238
|
+
config: import("../../../types/index.js").ConfigResolved;
|
|
239
|
+
} & ({
|
|
240
|
+
isProduction: false;
|
|
241
|
+
isPrerendering: false;
|
|
242
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
243
|
+
viteDevServer: import("vite").ViteDevServer;
|
|
244
|
+
assetsManifest: null;
|
|
245
|
+
} | ({
|
|
246
|
+
isProduction: true;
|
|
247
|
+
assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
|
|
248
|
+
viteDevServer: null;
|
|
249
|
+
} & ({
|
|
250
|
+
isPrerendering: false;
|
|
251
|
+
viteConfig: null;
|
|
252
|
+
} | {
|
|
253
|
+
isPrerendering: true;
|
|
254
|
+
usesClientRouter: boolean;
|
|
255
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
256
|
+
})))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
|
|
161
257
|
_pageContextInit: {
|
|
162
258
|
urlOriginal: string;
|
|
163
259
|
headersOriginal?: unknown;
|
|
@@ -211,7 +307,39 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
|
|
|
211
307
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
212
308
|
_globalContext: GlobalContextInternal;
|
|
213
309
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
214
|
-
globalContext:
|
|
310
|
+
globalContext: Pick<{
|
|
311
|
+
viteConfigRuntime: {
|
|
312
|
+
_baseViteOriginal: null | string;
|
|
313
|
+
};
|
|
314
|
+
config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
|
|
315
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
316
|
+
} & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
|
|
317
|
+
pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
|
|
318
|
+
pageConfigs: import("../../../__internal/index.js").PageConfig[];
|
|
319
|
+
pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
|
|
320
|
+
allPageIds: string[];
|
|
321
|
+
pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
322
|
+
onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
323
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
324
|
+
config: import("../../../types/index.js").ConfigResolved;
|
|
325
|
+
} & ({
|
|
326
|
+
isProduction: false;
|
|
327
|
+
isPrerendering: false;
|
|
328
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
329
|
+
viteDevServer: import("vite").ViteDevServer;
|
|
330
|
+
assetsManifest: null;
|
|
331
|
+
} | ({
|
|
332
|
+
isProduction: true;
|
|
333
|
+
assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
|
|
334
|
+
viteDevServer: null;
|
|
335
|
+
} & ({
|
|
336
|
+
isPrerendering: false;
|
|
337
|
+
viteConfig: null;
|
|
338
|
+
} | {
|
|
339
|
+
isPrerendering: true;
|
|
340
|
+
usesClientRouter: boolean;
|
|
341
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
342
|
+
})))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
|
|
215
343
|
_pageContextInit: {
|
|
216
344
|
urlOriginal: string;
|
|
217
345
|
headersOriginal?: unknown;
|
|
@@ -274,7 +402,39 @@ declare function getPageContextInitEnhanced(pageContextInit: {
|
|
|
274
402
|
_onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
275
403
|
_globalContext: GlobalContextInternal;
|
|
276
404
|
/** @experimental This is a beta feature https://vike.dev/getGlobalContext */
|
|
277
|
-
globalContext:
|
|
405
|
+
globalContext: Pick<{
|
|
406
|
+
viteConfigRuntime: {
|
|
407
|
+
_baseViteOriginal: null | string;
|
|
408
|
+
};
|
|
409
|
+
config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
|
|
410
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
411
|
+
} & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
|
|
412
|
+
pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
|
|
413
|
+
pageConfigs: import("../../../__internal/index.js").PageConfig[];
|
|
414
|
+
pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
|
|
415
|
+
allPageIds: string[];
|
|
416
|
+
pageRoutes: import("../../../__internal/index.js").PageRoutes;
|
|
417
|
+
onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
|
|
418
|
+
pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
|
|
419
|
+
config: import("../../../types/index.js").ConfigResolved;
|
|
420
|
+
} & ({
|
|
421
|
+
isProduction: false;
|
|
422
|
+
isPrerendering: false;
|
|
423
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
424
|
+
viteDevServer: import("vite").ViteDevServer;
|
|
425
|
+
assetsManifest: null;
|
|
426
|
+
} | ({
|
|
427
|
+
isProduction: true;
|
|
428
|
+
assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
|
|
429
|
+
viteDevServer: null;
|
|
430
|
+
} & ({
|
|
431
|
+
isPrerendering: false;
|
|
432
|
+
viteConfig: null;
|
|
433
|
+
} | {
|
|
434
|
+
isPrerendering: true;
|
|
435
|
+
usesClientRouter: boolean;
|
|
436
|
+
viteConfig: import("vite").ResolvedConfig;
|
|
437
|
+
})))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
|
|
278
438
|
_pageContextInit: {
|
|
279
439
|
urlOriginal: string;
|
|
280
440
|
headersOriginal?: unknown;
|
|
@@ -37,7 +37,7 @@ function getUrlParsed(pageContext) {
|
|
|
37
37
|
// 6. The value of pageContext.urlPathname is now '/login': the pathname of `pageContext.urlLogical`. (While pageContext.urlOriginal is still '/fr-FR/admin'.)
|
|
38
38
|
// Reproduction: https://github.com/vikejs/vike/discussions/1436#discussioncomment-8142023
|
|
39
39
|
// Determine logical URL
|
|
40
|
-
const assertUrlResolved = (src) => assert(
|
|
40
|
+
const assertUrlResolved = (src) => assert(typeof urlResolved === 'string',
|
|
41
41
|
// TODO/eventually: remove debug logs, see:
|
|
42
42
|
// - https://github.com/vikejs/vike/issues/2138#issuecomment-2631713411
|
|
43
43
|
// - https://github.com/vikejs/vike/commit/5c7810f3080ab62536950f26e019bb2a3a517082
|
|
@@ -296,6 +296,14 @@ type ConfigBuiltIn = {
|
|
|
296
296
|
* @default false
|
|
297
297
|
*/
|
|
298
298
|
disableAutoRun?: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Set prerender settings without enabling pre-rendering.
|
|
301
|
+
*
|
|
302
|
+
* https://vike.dev/prerender#value
|
|
303
|
+
*
|
|
304
|
+
* @default true
|
|
305
|
+
*/
|
|
306
|
+
value?: boolean | null;
|
|
299
307
|
};
|
|
300
308
|
/**
|
|
301
309
|
* Install Vike extensions.
|
|
@@ -422,10 +430,12 @@ type ConfigBuiltIn = {
|
|
|
422
430
|
includeAssetsImportedByServer?: boolean;
|
|
423
431
|
/** @deprecated See https://vike.dev/disableAutoFullBuild */
|
|
424
432
|
disableAutoFullBuild?: boolean | 'prerender';
|
|
425
|
-
/**
|
|
433
|
+
/**
|
|
434
|
+
* Use builder.buildApp() to orchestrate the build process.
|
|
435
|
+
*
|
|
426
436
|
* @experimental
|
|
427
437
|
*/
|
|
428
|
-
|
|
438
|
+
vite6BuilderApp?: boolean;
|
|
429
439
|
/** The Base URL of your server.
|
|
430
440
|
*
|
|
431
441
|
* https://vike.dev/base-url
|
|
@@ -22,7 +22,7 @@ import type { ConfigValueSerialized } from './serialize/PageConfigSerialized.js'
|
|
|
22
22
|
import type { LocationId } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js';
|
|
23
23
|
import type { FilePath } from './FilePath.js';
|
|
24
24
|
import type { ConfigDefinitions } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js';
|
|
25
|
-
import type { PlusFile
|
|
25
|
+
import type { PlusFile } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js';
|
|
26
26
|
type PageConfigCommon = {
|
|
27
27
|
pageId: string;
|
|
28
28
|
} & PageConfigRoute;
|
|
@@ -49,7 +49,7 @@ type PageConfigGlobalRuntime = {
|
|
|
49
49
|
/** Page config, build-time data structure */
|
|
50
50
|
type PageConfigBuildTime = PageConfigCommon & {
|
|
51
51
|
configDefinitions: ConfigDefinitions;
|
|
52
|
-
plusFiles:
|
|
52
|
+
plusFiles: PlusFile[];
|
|
53
53
|
configValueSources: ConfigValueSources;
|
|
54
54
|
configValuesComputed: ConfigValuesComputed;
|
|
55
55
|
};
|
|
@@ -92,12 +92,12 @@ type ConfigValueSource = {
|
|
|
92
92
|
definedAtFilePath: DefinedAtFilePath;
|
|
93
93
|
plusFile: PlusFile | null;
|
|
94
94
|
locationId: LocationId;
|
|
95
|
-
isOverriden: boolean;
|
|
96
95
|
/** Wether the config value is loaded at runtime, for example config.Page or config.onBeforeRender */
|
|
97
|
-
|
|
96
|
+
valueIsLoadedWithImport: boolean;
|
|
98
97
|
/** Whether the config value is a file path, for example config.client */
|
|
99
98
|
valueIsFilePath?: true;
|
|
100
|
-
|
|
99
|
+
/** Whether the config value is defined by a +{configName}.js file */
|
|
100
|
+
valueIsDefinedByPlusValueFile: boolean;
|
|
101
101
|
} & ({
|
|
102
102
|
valueIsLoaded: false;
|
|
103
103
|
} | {
|
|
@@ -27,9 +27,7 @@ function getConfigValue(pageConfig, configName) {
|
|
|
27
27
|
if (!configDef.cumulative) {
|
|
28
28
|
const configValueSource = sources[0];
|
|
29
29
|
assert(configValueSource);
|
|
30
|
-
assert(configValueSource.
|
|
31
|
-
assert(sources.slice(1).every((s) => s.isOverriden === true));
|
|
32
|
-
assert('value' in configValueSource);
|
|
30
|
+
assert(configValueSource.valueIsLoaded);
|
|
33
31
|
return {
|
|
34
32
|
type: 'standard',
|
|
35
33
|
value: configValueSource.value,
|
|
@@ -50,9 +48,8 @@ function mergeCumulative(configValueSources) {
|
|
|
50
48
|
const value = [];
|
|
51
49
|
const definedAtData = [];
|
|
52
50
|
configValueSources.forEach((configValueSource) => {
|
|
53
|
-
assert(configValueSource.isOverriden === false);
|
|
54
51
|
assert(configValueSource.configEnv.config === true);
|
|
55
|
-
assert(
|
|
52
|
+
assert(configValueSource.valueIsLoaded);
|
|
56
53
|
value.push(configValueSource.value);
|
|
57
54
|
definedAtData.push(getDefinedAtFile(configValueSource));
|
|
58
55
|
});
|
|
@@ -64,7 +64,9 @@ function parseConfigValuesSerialized_tmp(configValuesSerialized) {
|
|
|
64
64
|
const { valueSerialized, ...common } = configValueSeriliazed;
|
|
65
65
|
const { value, sideExports } = parseValueSerialized(valueSerialized, configName, () => {
|
|
66
66
|
assert(configValueSeriliazed.type !== 'computed');
|
|
67
|
-
|
|
67
|
+
const { definedAtData } = configValueSeriliazed;
|
|
68
|
+
const definedAtFile = Array.isArray(definedAtData) ? definedAtData[0] : definedAtData;
|
|
69
|
+
return definedAtFile;
|
|
68
70
|
});
|
|
69
71
|
addSideExports(sideExports);
|
|
70
72
|
configValue = { value, ...common };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export { serializeConfigValues };
|
|
2
2
|
export { getConfigValuesBase };
|
|
3
|
+
export { isJsonValue };
|
|
3
4
|
export type { FilesEnv };
|
|
4
5
|
import type { ConfigEnvInternal, ConfigValueSource, DefinedAtFile, PageConfigBuildTime, PageConfigGlobalBuildTime } from '../PageConfig.js';
|
|
5
6
|
declare function serializeConfigValues(pageConfig: PageConfigBuildTime | PageConfigGlobalBuildTime, importStatements: string[], filesEnv: FilesEnv, isEnvMatch: (configEnv: ConfigEnvInternal) => boolean, tabspace: string, isEager: boolean | null): string[];
|
|
7
|
+
declare function isJsonValue(value: unknown): boolean;
|
|
6
8
|
declare function getConfigValuesBase(pageConfig: PageConfigBuildTime | PageConfigGlobalBuildTime, isEnvMatch: (configEnv: ConfigEnvInternal) => boolean, isEager: boolean | null): ConfigValuesBase;
|
|
7
9
|
type ConfigValuesBase = ({
|
|
8
10
|
configValueBase: {
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { serializeConfigValues };
|
|
2
2
|
export { getConfigValuesBase };
|
|
3
|
+
export { isJsonValue };
|
|
3
4
|
import { assertIsNotProductionRuntime } from '../../../utils/assertSetup.js';
|
|
4
5
|
import { assert, assertPosixPath, assertUsage, deepEqual, getPropAccessNotation } from '../../../node/plugin/utils.js';
|
|
5
6
|
import { parsePointerImportData } from '../../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transformPointerImports.js';
|
|
6
7
|
import { getConfigValueFilePathToShowToUser } from '../helpers.js';
|
|
7
8
|
import { stringify } from '@brillout/json-serializer/stringify';
|
|
8
9
|
import pc from '@brillout/picocolors';
|
|
10
|
+
import { isOverriden } from '../../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js';
|
|
11
|
+
const stringifyOptions = { forbidReactElements: true };
|
|
9
12
|
const REPLACE_ME_BEFORE = '__VIKE__REPLACE_ME_BEFORE__';
|
|
10
13
|
const REPLACE_ME_AFTER = '__VIKE__REPLACE_ME_AFTER__';
|
|
11
14
|
// This file is never loaded on the client-side but we save it under the vike/shared/ directory in order to collocate it with parsePageConfigs()
|
|
@@ -42,9 +45,8 @@ function serializeConfigValues(pageConfig, importStatements, filesEnv, isEnvMatc
|
|
|
42
45
|
return lines;
|
|
43
46
|
}
|
|
44
47
|
function getValueSerializedFromSource(configValueSource, configName, importStatements, filesEnv) {
|
|
45
|
-
assert(configValueSource.isOverriden === false);
|
|
46
48
|
let valueData;
|
|
47
|
-
if (
|
|
49
|
+
if (configValueSource.valueIsLoaded && !configValueSource.valueIsLoadedWithImport) {
|
|
48
50
|
valueData = getValueSerializedWithJson(configValueSource.value, configName, configValueSource.definedAtFilePath, importStatements, filesEnv, configValueSource.configEnv);
|
|
49
51
|
}
|
|
50
52
|
else {
|
|
@@ -96,14 +98,13 @@ function serializeConfigValue(configValueBase, valueData, configName, lines, tab
|
|
|
96
98
|
}
|
|
97
99
|
function getValueSerializedWithImport(configValueSource, importStatements, filesEnv, configName) {
|
|
98
100
|
assert(!configValueSource.valueIsFilePath);
|
|
99
|
-
const {
|
|
100
|
-
assert(valueIsImportedAtRuntime);
|
|
101
|
+
const { valueIsDefinedByPlusValueFile, definedAtFilePath, configEnv } = configValueSource;
|
|
101
102
|
const { filePathAbsoluteVite, fileExportName } = definedAtFilePath;
|
|
102
|
-
if (
|
|
103
|
+
if (valueIsDefinedByPlusValueFile)
|
|
103
104
|
assert(fileExportName === undefined);
|
|
104
105
|
const { importName } = addImportStatement(importStatements, filePathAbsoluteVite, fileExportName || '*', filesEnv, configEnv, configName);
|
|
105
106
|
return {
|
|
106
|
-
type:
|
|
107
|
+
type: valueIsDefinedByPlusValueFile ? 'plus-file' : 'pointer-import',
|
|
107
108
|
valueAsJsCode: importName
|
|
108
109
|
};
|
|
109
110
|
}
|
|
@@ -120,7 +121,7 @@ function valueToJson(value, configName, definedAtData, importStatements, filesEn
|
|
|
120
121
|
try {
|
|
121
122
|
configValueSerialized = stringify(value, {
|
|
122
123
|
valueName,
|
|
123
|
-
|
|
124
|
+
...stringifyOptions,
|
|
124
125
|
// Replace import strings with import variables.
|
|
125
126
|
// - We don't need this anymore and could remove it.
|
|
126
127
|
// - 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}`).
|
|
@@ -147,6 +148,15 @@ function valueToJson(value, configName, definedAtData, importStatements, filesEn
|
|
|
147
148
|
assert(!configValueSerialized.includes(REPLACE_ME_AFTER));
|
|
148
149
|
return configValueSerialized;
|
|
149
150
|
}
|
|
151
|
+
function isJsonValue(value) {
|
|
152
|
+
try {
|
|
153
|
+
stringify(value, stringifyOptions);
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
150
160
|
function logJsonSerializeError(err, configName, definedAtData) {
|
|
151
161
|
/*
|
|
152
162
|
// import { isJsonSerializerError } from '@brillout/json-serializer/stringify'
|
|
@@ -186,7 +196,6 @@ function getConfigValuesBase(pageConfig, isEnvMatch, isEager) {
|
|
|
186
196
|
if (!configDef.cumulative) {
|
|
187
197
|
const source = sources[0];
|
|
188
198
|
assert(source);
|
|
189
|
-
assert(sources.slice(1).every((s) => s.isOverriden === true));
|
|
190
199
|
if (!isEnvMatch(source.configEnv))
|
|
191
200
|
return 'SKIP';
|
|
192
201
|
const definedAtFile = getDefinedAtFileSource(source);
|
|
@@ -197,7 +206,9 @@ function getConfigValuesBase(pageConfig, isEnvMatch, isEager) {
|
|
|
197
206
|
return { configValueBase, sourceRelevant: source, configName };
|
|
198
207
|
}
|
|
199
208
|
else {
|
|
200
|
-
const sourcesRelevant = sources
|
|
209
|
+
const sourcesRelevant = sources
|
|
210
|
+
.filter((source) => !isOverriden(source, configName, pageConfig))
|
|
211
|
+
.filter((source) => isEnvMatch(source.configEnv));
|
|
201
212
|
if (sourcesRelevant.length === 0)
|
|
202
213
|
return 'SKIP';
|
|
203
214
|
const definedAtData = [];
|
|
@@ -8,9 +8,11 @@ export type { PageContextBuiltInServer } from '../shared/types.js';
|
|
|
8
8
|
export type { PageContextBuiltInClientWithClientRouting } from '../shared/types.js';
|
|
9
9
|
export type { PageContextBuiltInClientWithServerRouting } from '../shared/types.js';
|
|
10
10
|
export type { Config, ConfigMeta as Meta, ImportString, DataAsync, DataSync, GuardAsync, GuardSync, OnBeforePrerenderStartAsync, OnBeforePrerenderStartSync, OnBeforeRenderAsync, OnBeforeRenderSync, OnBeforeRouteAsync, OnBeforeRouteSync, OnHydrationEndAsync, OnHydrationEndSync, OnPageTransitionEndAsync, OnPageTransitionEndSync, OnPageTransitionStartAsync, OnPageTransitionStartSync, OnPrerenderStartAsync, OnPrerenderStartSync, OnRenderClientAsync, OnRenderClientSync, OnRenderHtmlAsync, OnRenderHtmlSync, RouteAsync, RouteSync, KeepScrollPosition } from '../shared/page-configs/Config.js';
|
|
11
|
+
export type { ConfigResolved } from '../shared/page-configs/Config/PageContextConfig.js';
|
|
11
12
|
export type { ConfigEnv } from '../shared/page-configs/PageConfig.js';
|
|
12
13
|
export type { ConfigDefinition, ConfigEffect } from '../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js';
|
|
13
14
|
export type { ConfigEntries } from '../shared/page-configs/getPageConfigUserFriendly.js';
|
|
15
|
+
export type { VikeConfigPublic as VikeConfig } from '../node/plugin/plugins/commonConfig.js';
|
|
14
16
|
export type { UrlPublic as Url } from '../utils/parseUrl.js';
|
|
15
17
|
export type { InjectFilterEntry } from '../node/runtime/html/injectAssets/getHtmlTags.js';
|
|
16
18
|
export { defineConfig } from './defineConfig.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.224-commit-f0d0f8a";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.224-commit-f0d0f8a';
|
package/dist/esm/utils/debug.js
CHANGED
|
@@ -11,6 +11,8 @@ import { isArray } from './isArray.js';
|
|
|
11
11
|
// Avoid this to be loaded in the browser. For isomorphic code: instead of `import { createDebugger } from './utils.js'`, use `globalThis.createDebugger()`.
|
|
12
12
|
assert(!isBrowser());
|
|
13
13
|
globalThis.__brillout_debug_createDebugger = createDebugger;
|
|
14
|
+
// We purposely read process.env.DEBUG early, in order to avoid users from the temptation to set process.env.DEBUG with JavaScript, since reading & writing process.env.DEBUG dynamically leads to inconsistencies: for example https://github.com/vikejs/vike/issues/2239
|
|
15
|
+
const DEBUG = getDEBUG() ?? '';
|
|
14
16
|
const flags = [
|
|
15
17
|
'vike:crawl',
|
|
16
18
|
'vike:error',
|
|
@@ -145,7 +147,6 @@ function assertFlagsActivated() {
|
|
|
145
147
|
});
|
|
146
148
|
}
|
|
147
149
|
function getFlagsActivated() {
|
|
148
|
-
const DEBUG = getDEBUG() ?? '';
|
|
149
150
|
const flagsActivated = DEBUG.match(flagRegex) ?? [];
|
|
150
151
|
const all = DEBUG.includes('vike:*');
|
|
151
152
|
return { flagsActivated, all };
|
|
@@ -3,7 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import { isArray } from './isArray.js';
|
|
5
5
|
import { assertPosixPath } from './path.js';
|
|
6
|
-
// We need to be able to crawl the filesystem, regardless of Vike's `$ git ls-files` command call, because we need to fallback if the user didn't setup Git (e.g. we cannot remove the
|
|
6
|
+
// We need to be able to crawl the filesystem, regardless of Vike's `$ git ls-files` command call, because we need to fallback if the user didn't setup Git (e.g. we cannot remove the tinyglobby fallback).
|
|
7
7
|
function findFile(arg, cwd) {
|
|
8
8
|
assertPosixPath(cwd);
|
|
9
9
|
const filenames = isArray(arg) ? arg : [arg];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { findPackageJson };
|
|
2
2
|
import { findFile } from './findFile.js';
|
|
3
3
|
import { createRequire } from 'module';
|
|
4
|
-
// @ts-ignore
|
|
4
|
+
// @ts-ignore import.meta.url is shimmed at dist/cjs by dist-cjs-fixup.js.
|
|
5
5
|
const importMetaUrl = import.meta.url;
|
|
6
6
|
const require_ = createRequire(importMetaUrl);
|
|
7
7
|
function findPackageJson(cwd) {
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
export { assertFilePathAbsoluteFilesystem };
|
|
2
2
|
export { isFilePathAbsolute };
|
|
3
|
-
import path from 'path';
|
|
3
|
+
import path from 'node:path';
|
|
4
4
|
import { assert } from './assert.js';
|
|
5
5
|
import { assertPosixPath } from './path.js';
|
|
6
|
+
import { assertIsNotBrowser } from './assertIsNotBrowser.js';
|
|
7
|
+
import { assertIsNotProductionRuntime } from './assertSetup.js';
|
|
8
|
+
assertIsNotBrowser();
|
|
9
|
+
// Server runtime shouldn't depend on node:path
|
|
10
|
+
assertIsNotProductionRuntime();
|
|
6
11
|
/**
|
|
7
12
|
* Asserts that `filePath` is an absolute file path starting from the filesystem root.
|
|
8
13
|
*
|
|
@@ -13,6 +18,7 @@ function assertFilePathAbsoluteFilesystem(filePath) {
|
|
|
13
18
|
// - For Windows users, the assert is correct.
|
|
14
19
|
// - For Linux users assertFilePathAbsoluteFilesystem() will erroneously succeed if `p` is a path absolute from the user root dir.
|
|
15
20
|
// - But that's okay because the assertion will eventually fail for Windows users.
|
|
21
|
+
// - On Linux there doesn't seem to be a way to distinguish between an absolute path starting from the filesystem root or starting from the user root directory, see comment at isFilePathAbsoluteFilesystem()
|
|
16
22
|
assert(isFilePathAbsoluteFilesystem(filePath));
|
|
17
23
|
assertPosixPath(filePath);
|
|
18
24
|
}
|
|
@@ -28,7 +34,7 @@ function isFilePathAbsoluteFilesystem(filePath) {
|
|
|
28
34
|
// - File path absolute starting from filesystem root, e.g. /home/rom/code/my-app/pages/about/+Page.js
|
|
29
35
|
// - File path absolute starting from user root dir (Vite's `config.root`), e.g. /pages/about/+Page.js
|
|
30
36
|
// - Checking whether `p` starts with the first directory of process.cwd() (or `userRootDir`) can be erroneous, most notably when using docker: https://github.com/vikejs/vike/issues/703
|
|
31
|
-
// - Using require.resolve() would be a solution but
|
|
37
|
+
// - Using require.resolve() or node:fs to check wehther the file/dir exsits would be a solution, but maybe too slow?
|
|
32
38
|
return filePath.startsWith('/');
|
|
33
39
|
}
|
|
34
40
|
else {
|
package/dist/esm/utils/path.js
CHANGED
|
@@ -7,6 +7,7 @@ export { assertPosixPath };
|
|
|
7
7
|
// - Robust shim reference: https://github.com/unjs/pathe
|
|
8
8
|
import { assert } from './assert.js';
|
|
9
9
|
import { assertIsNotBrowser } from './assertIsNotBrowser.js';
|
|
10
|
+
// While this path shim also works on the client-side, let's try to not use it on the client-side in order to minimize KBs sent to the browser.
|
|
10
11
|
assertIsNotBrowser();
|
|
11
12
|
/**********************/
|
|
12
13
|
/****** SHIMS *********/
|