vike 0.4.267-commit-b005535 → 0.4.267-commit-7884d91
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/client/runtime-client-routing/createPageContextClient.d.ts +4 -0
- package/dist/client/runtime-client-routing/getGlobalContextClientInternal.d.ts +4 -0
- package/dist/client/runtime-client-routing/getPageContextFromHooks.d.ts +22 -2
- package/dist/client/runtime-client-routing/getPageContextFromHooks.js +4 -5
- package/dist/client/runtime-client-routing/renderPageClient.d.ts +472 -9
- package/dist/client/runtime-client-routing/renderPageClient.js +11 -5
- package/dist/client/runtime-client-routing/streamedValues.d.ts +5 -0
- package/dist/client/runtime-client-routing/streamedValues.js +23 -0
- package/dist/client/runtime-server-routing/createPageContextClient.d.ts +4 -0
- package/dist/client/runtime-server-routing/entry.js +1 -1
- package/dist/client/runtime-server-routing/getGlobalContextClientInternal.d.ts +4 -0
- package/dist/client/shared/getGlobalContextClientInternalShared.d.ts +4 -0
- package/dist/client/shared/getJsonSerializedInHtml.d.ts +2 -2
- package/dist/client/shared/getJsonSerializedInHtml.js +9 -6
- package/dist/client/shared/streamedValues/asyncIterable.d.ts +4 -0
- package/dist/client/shared/streamedValues/asyncIterable.js +26 -0
- package/dist/client/shared/streamedValues/lines.d.ts +11 -0
- package/dist/client/shared/streamedValues/lines.js +19 -0
- package/dist/client/shared/streamedValues/promise.d.ts +4 -0
- package/dist/client/shared/streamedValues/promise.js +19 -0
- package/dist/client/shared/streamedValues/readableStream.d.ts +4 -0
- package/dist/client/shared/streamedValues/readableStream.js +44 -0
- package/dist/client/shared/streamedValues/registry.d.ts +21 -0
- package/dist/client/shared/streamedValues/registry.js +40 -0
- package/dist/client/shared/streamedValues.d.ts +7 -0
- package/dist/client/shared/streamedValues.js +82 -0
- package/dist/node/api/resolveViteConfigUser.js +2 -2
- package/dist/node/prerender/runPrerender.d.ts +12 -4
- package/dist/node/prerender/runPrerender.js +60 -15
- package/dist/node/vite/assertEnvVite.js +1 -1
- package/dist/node/vite/index.js +2 -0
- package/dist/node/vite/plugins/build/handleAssetsManifest.js +6 -2
- package/dist/node/vite/plugins/build/pluginBuildApp.js +25 -26
- package/dist/node/vite/plugins/build/pluginBuildConfig.d.ts +2 -2
- package/dist/node/vite/plugins/build/pluginBuildConfig.js +24 -16
- package/dist/node/vite/plugins/build/pluginDistFileNames.js +70 -50
- package/dist/node/vite/plugins/build/pluginEnvironmentEntries.d.ts +6 -0
- package/dist/node/vite/plugins/build/pluginEnvironmentEntries.js +71 -0
- package/dist/node/vite/plugins/build/pluginSuppressRollupWarning.js +19 -17
- package/dist/node/vite/plugins/pluginCommon.js +9 -6
- package/dist/node/vite/plugins/pluginDev/optimizeDeps.js +1 -1
- package/dist/node/vite/plugins/pluginReplaceConstantsGlobalThis.js +6 -4
- package/dist/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.d.ts +2 -1
- package/dist/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntry.js +29 -12
- package/dist/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +3 -2
- package/dist/node/vite/plugins/pluginVirtualFiles/generateVirtualFilePageEntry.js +7 -7
- package/dist/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.d.ts +7 -5
- package/dist/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +4 -10
- package/dist/node/vite/plugins/pluginVirtualFiles.js +20 -0
- package/dist/node/vite/shared/addSsrMiddleware.js +13 -1
- package/dist/node/vite/shared/getAssetsDir.d.ts +3 -2
- package/dist/node/vite/shared/getAssetsDir.js +3 -3
- package/dist/node/vite/shared/isViteCli.d.ts +3 -3
- package/dist/node/vite/shared/isViteCli.js +80 -84
- package/dist/node/vite/shared/isViteServerSide.js +2 -7
- package/dist/node/vite/shared/resolveVikeConfigInternal/metaBuiltIn.d.ts +1 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal/metaBuiltIn.js +8 -6
- package/dist/node/vite/shared/resolveVikeConfigInternal.d.ts +4 -1
- package/dist/node/vite/shared/resolveVikeConfigInternal.js +82 -11
- package/dist/server/runtime/globalContext.d.ts +20 -0
- package/dist/server/runtime/renderPageServer/analyzePage.js +3 -3
- package/dist/server/runtime/renderPageServer/createHttpResponse.d.ts +20 -7
- package/dist/server/runtime/renderPageServer/createHttpResponse.js +34 -15
- package/dist/server/runtime/renderPageServer/createPageContextServer.d.ts +4 -0
- package/dist/server/runtime/renderPageServer/execHookOnError.js +1 -1
- package/dist/server/runtime/renderPageServer/execHookOnRenderHtml.d.ts +9 -0
- package/dist/server/runtime/renderPageServer/execHookOnRenderHtml.js +17 -5
- package/dist/server/runtime/renderPageServer/getHttpResponseBody.d.ts +2 -2
- package/dist/server/runtime/renderPageServer/getHttpResponseBody.js +17 -2
- package/dist/server/runtime/renderPageServer/getPageContextJson.d.ts +8 -0
- package/dist/server/runtime/renderPageServer/getPageContextJson.js +47 -0
- package/dist/server/runtime/renderPageServer/handleErrorWithoutErrorPage.d.ts +2 -0
- package/dist/server/runtime/renderPageServer/handleErrorWithoutErrorPage.js +1 -1
- package/dist/server/runtime/renderPageServer/headersResponse.d.ts +11 -2
- package/dist/server/runtime/renderPageServer/headersResponse.js +20 -1
- package/dist/server/runtime/renderPageServer/html/injectAssets/getHtmlTags.js +5 -4
- package/dist/server/runtime/renderPageServer/html/injectAssets.d.ts +3 -2
- package/dist/server/runtime/renderPageServer/html/injectAssets.js +7 -1
- package/dist/server/runtime/renderPageServer/html/renderHtml.js +4 -2
- package/dist/server/runtime/renderPageServer/html/serializeContext.d.ts +5 -1
- package/dist/server/runtime/renderPageServer/html/serializeContext.js +12 -9
- package/dist/server/runtime/renderPageServer/html/stream.d.ts +13 -6
- package/dist/server/runtime/renderPageServer/html/stream.js +121 -31
- package/dist/server/runtime/renderPageServer/html/streamedValuesHtml.d.ts +30 -0
- package/dist/server/runtime/renderPageServer/html/streamedValuesHtml.js +92 -0
- package/dist/server/runtime/renderPageServer/loadPageConfigsLazyServerSide.d.ts +4 -0
- package/dist/server/runtime/renderPageServer/loadPageConfigsLazyServerSide.js +5 -1
- package/dist/server/runtime/renderPageServer/loadPageContextEnvironments.d.ts +15 -0
- package/dist/server/runtime/renderPageServer/loadPageContextEnvironments.js +61 -0
- package/dist/server/runtime/renderPageServer/renderPageServerAfterRoute.d.ts +314 -1
- package/dist/server/runtime/renderPageServer/renderPageServerAfterRoute.js +21 -12
- package/dist/server/runtime/renderPageServer/streamedValues/asyncIterable.d.ts +4 -0
- package/dist/server/runtime/renderPageServer/streamedValues/asyncIterable.js +12 -0
- package/dist/server/runtime/renderPageServer/streamedValues/lines.d.ts +10 -0
- package/dist/server/runtime/renderPageServer/streamedValues/lines.js +49 -0
- package/dist/server/runtime/renderPageServer/streamedValues/promise.d.ts +4 -0
- package/dist/server/runtime/renderPageServer/streamedValues/promise.js +14 -0
- package/dist/server/runtime/renderPageServer/streamedValues/pump.d.ts +10 -0
- package/dist/server/runtime/renderPageServer/streamedValues/pump.js +67 -0
- package/dist/server/runtime/renderPageServer/streamedValues/readableStream.d.ts +4 -0
- package/dist/server/runtime/renderPageServer/streamedValues/readableStream.js +12 -0
- package/dist/server/runtime/renderPageServer/streamedValues/registry.d.ts +28 -0
- package/dist/server/runtime/renderPageServer/streamedValues/registry.js +33 -0
- package/dist/server/runtime/renderPageServer.d.ts +4 -0
- package/dist/server/runtime/renderPageServer.js +17 -8
- package/dist/shared-server-client/createGlobalContextShared.d.ts +8 -0
- package/dist/shared-server-client/createGlobalContextShared.js +2 -1
- package/dist/shared-server-client/getPageContextPublicShared.js +0 -2
- package/dist/shared-server-client/getPageFiles/parseVirtualFileExportsGlobalEntry.d.ts +8 -0
- package/dist/shared-server-client/getPageFiles/parseVirtualFileExportsGlobalEntry.js +17 -7
- package/dist/shared-server-client/hooks/execHook.d.ts +1 -1
- package/dist/shared-server-client/hooks/execHook.js +2 -2
- package/dist/shared-server-client/route/abort.d.ts +1 -1
- package/dist/shared-server-client/route/abort.js +4 -2
- package/dist/shared-server-client/streamedValues.d.ts +22 -0
- package/dist/shared-server-client/streamedValues.js +24 -0
- package/dist/shared-server-node/vike-environments.d.ts +4 -0
- package/dist/shared-server-node/vike-environments.js +10 -0
- package/dist/shared-server-node/virtualFileId.d.ts +7 -5
- package/dist/shared-server-node/virtualFileId.js +42 -42
- package/dist/types/Config.d.ts +1 -1
- package/dist/types/PageConfig.d.ts +13 -5
- package/dist/types/PageContext.d.ts +18 -1
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/dist/utils/assertViteVersion.d.ts +1 -3
- package/dist/utils/assertViteVersion.js +6 -9
- package/dist/utils/deepEqual.d.ts +2 -1
- package/dist/utils/deepEqual.js +21 -6
- package/dist/utils/getContentTypeFromUrl.d.ts +2 -0
- package/dist/utils/getContentTypeFromUrl.js +39 -0
- package/dist/utils/injectRollupInputs.d.ts +2 -2
- package/dist/utils/injectRollupInputs.js +2 -2
- package/dist/utils/isDev.js +2 -7
- package/dist/utils/parseUrl-extras.js +4 -0
- package/package.json +6 -6
- package/dist/shared-server-client/addIs404ToPageProps.d.ts +0 -2
- package/dist/shared-server-client/addIs404ToPageProps.js +0 -17
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { generateVirtualFileGlobalEntry };
|
|
2
|
+
import type { RuntimeEnvRuntime } from './getConfigValueSourcesRelevant.js';
|
|
2
3
|
import '../../assertEnvVite.js';
|
|
3
|
-
declare function generateVirtualFileGlobalEntry(
|
|
4
|
+
declare function generateVirtualFileGlobalEntry(runtimeEnv: RuntimeEnvRuntime, id: string): Promise<string>;
|
|
@@ -4,25 +4,31 @@ import { debug } from './debug.js';
|
|
|
4
4
|
import { getVikeConfigInternal } from '../../shared/resolveVikeConfigInternal.js';
|
|
5
5
|
import { serializeConfigValues, } from '../../../../shared-server-client/page-configs/serialize/serializeConfigValues.js';
|
|
6
6
|
import { VIRTUAL_FILE_ID_constantsGlobalThis } from '../pluginReplaceConstantsGlobalThis.js';
|
|
7
|
+
import { getEnvironmentEntryPlaceholder } from '../build/pluginEnvironmentEntries.js';
|
|
7
8
|
import '../../assertEnvVite.js';
|
|
8
|
-
async function generateVirtualFileGlobalEntry(
|
|
9
|
+
async function generateVirtualFileGlobalEntry(runtimeEnv, id) {
|
|
9
10
|
const vikeConfig = await getVikeConfigInternal(true);
|
|
10
|
-
const { _pageConfigs: pageConfigs, _pageConfigGlobal: pageConfigGlobal } = vikeConfig;
|
|
11
|
-
return getCode(pageConfigs, pageConfigGlobal,
|
|
11
|
+
const { _pageConfigs: pageConfigs, _pageConfigGlobal: pageConfigGlobal, _additionalEnvironmentNames: additionalEnvironmentNames, } = vikeConfig;
|
|
12
|
+
return getCode(pageConfigs, pageConfigGlobal, runtimeEnv, id, additionalEnvironmentNames);
|
|
12
13
|
}
|
|
13
|
-
function getCode(pageConfigs, pageConfigGlobal,
|
|
14
|
+
function getCode(pageConfigs, pageConfigGlobal, runtimeEnv, id, additionalEnvironmentNames) {
|
|
14
15
|
const lines = [];
|
|
15
16
|
const importStatements = [];
|
|
16
17
|
const filesEnv = new Map();
|
|
18
|
+
const { environmentName, isDev } = runtimeEnv;
|
|
19
|
+
const isForClientSide = environmentName === 'client';
|
|
17
20
|
if (!isForClientSide) {
|
|
18
21
|
importStatements.push(`import '${VIRTUAL_FILE_ID_constantsGlobalThis}';`);
|
|
19
22
|
}
|
|
20
23
|
lines.push('export const pageConfigsSerialized = [');
|
|
21
|
-
lines.push(getCodePageConfigsSerialized(pageConfigs,
|
|
24
|
+
lines.push(getCodePageConfigsSerialized(pageConfigs, runtimeEnv, importStatements, filesEnv));
|
|
22
25
|
lines.push('];');
|
|
23
26
|
lines.push('export const pageConfigGlobalSerialized = {');
|
|
24
|
-
lines.push(getCodePageConfigGlobalSerialized(pageConfigGlobal,
|
|
27
|
+
lines.push(getCodePageConfigGlobalSerialized(pageConfigGlobal, runtimeEnv, importStatements, filesEnv));
|
|
25
28
|
lines.push('};');
|
|
29
|
+
if (environmentName === 'server') {
|
|
30
|
+
lines.push(getCodeEnvironmentEntries(additionalEnvironmentNames, isDev, importStatements));
|
|
31
|
+
}
|
|
26
32
|
if (!isForClientSide && isDev) {
|
|
27
33
|
// https://vite.dev/guide/api-environment-frameworks.html
|
|
28
34
|
lines.push('if (import.meta.hot) import.meta.hot.accept();');
|
|
@@ -31,10 +37,21 @@ function getCode(pageConfigs, pageConfigGlobal, isForClientSide, isDev, id, isCl
|
|
|
31
37
|
if (!isForClientSide) {
|
|
32
38
|
code = `import '${VIRTUAL_FILE_ID_constantsGlobalThis}';\n` + code;
|
|
33
39
|
}
|
|
34
|
-
debug(id,
|
|
40
|
+
debug(id, `${environmentName.toUpperCase()}-SIDE`, code);
|
|
35
41
|
return code;
|
|
36
42
|
}
|
|
37
|
-
|
|
43
|
+
// The global entries of the additional environments (e.g. `rsc`), loaded by loadPageContextEnvironments.ts
|
|
44
|
+
// - In development, they're loaded with the environment's module runner instead
|
|
45
|
+
function getCodeEnvironmentEntries(additionalEnvironmentNames, isDev, importStatements) {
|
|
46
|
+
const entries = additionalEnvironmentNames.map((name, i) => {
|
|
47
|
+
if (isDev)
|
|
48
|
+
return `${JSON.stringify(name)}: null`;
|
|
49
|
+
importStatements.push(`import * as environmentEntry${i} from ${JSON.stringify(getEnvironmentEntryPlaceholder(name))};`);
|
|
50
|
+
return `${JSON.stringify(name)}: environmentEntry${i}`;
|
|
51
|
+
});
|
|
52
|
+
return `export const environmentEntries = { ${entries.join(', ')} };`;
|
|
53
|
+
}
|
|
54
|
+
function getCodePageConfigsSerialized(pageConfigs, runtimeEnv, importStatements, filesEnv) {
|
|
38
55
|
const lines = [];
|
|
39
56
|
pageConfigs.forEach((pageConfig) => {
|
|
40
57
|
const { pageId, routeFilesystem, isErrorPage } = pageConfig;
|
|
@@ -42,20 +59,20 @@ function getCodePageConfigsSerialized(pageConfigs, isForClientSide, isClientRout
|
|
|
42
59
|
lines.push(` pageId: ${JSON.stringify(pageId)},`);
|
|
43
60
|
lines.push(` isErrorPage: ${JSON.stringify(isErrorPage)},`);
|
|
44
61
|
lines.push(` routeFilesystem: ${JSON.stringify(routeFilesystem)},`);
|
|
45
|
-
const virtualFileId = JSON.stringify(generateVirtualFileId({ type: 'page-entry', pageId,
|
|
62
|
+
const virtualFileId = JSON.stringify(generateVirtualFileId({ type: 'page-entry', pageId, environmentName: runtimeEnv.environmentName }));
|
|
46
63
|
lines.push(` loadVirtualFilePageEntry: () => ({ moduleId: ${virtualFileId}, moduleExportsPromise: import(${virtualFileId}) }),`);
|
|
47
64
|
lines.push(` configValuesSerialized: {`);
|
|
48
|
-
lines.push(...serializeConfigValues(pageConfig, importStatements, filesEnv,
|
|
65
|
+
lines.push(...serializeConfigValues(pageConfig, importStatements, filesEnv, runtimeEnv, ' ', true));
|
|
49
66
|
lines.push(` },`);
|
|
50
67
|
lines.push(` },`);
|
|
51
68
|
});
|
|
52
69
|
const code = lines.join('\n');
|
|
53
70
|
return code;
|
|
54
71
|
}
|
|
55
|
-
function getCodePageConfigGlobalSerialized(pageConfigGlobal,
|
|
72
|
+
function getCodePageConfigGlobalSerialized(pageConfigGlobal, runtimeEnv, importStatements, filesEnv) {
|
|
56
73
|
const lines = [];
|
|
57
74
|
lines.push(` configValuesSerialized: {`);
|
|
58
|
-
lines.push(...serializeConfigValues(pageConfigGlobal, importStatements, filesEnv,
|
|
75
|
+
lines.push(...serializeConfigValues(pageConfigGlobal, importStatements, filesEnv, runtimeEnv, ' ', null));
|
|
59
76
|
lines.push(` },`);
|
|
60
77
|
const code = lines.join('\n');
|
|
61
78
|
return code;
|
package/dist/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js
CHANGED
|
@@ -18,7 +18,8 @@ import '../../assertEnvVite.js';
|
|
|
18
18
|
async function generateVirtualFileGlobalEntryWithOldDesign(id, options, config, env, isDev) {
|
|
19
19
|
const idParsed = parseVirtualFileId(id);
|
|
20
20
|
assert(idParsed && idParsed.type === 'global-entry');
|
|
21
|
-
const {
|
|
21
|
+
const { environmentName, isClientRouting } = idParsed;
|
|
22
|
+
const isForClientSide = environmentName === 'client';
|
|
22
23
|
assert(isForClientSide === !isViteServerSide_extraSafe(config, env, options));
|
|
23
24
|
const code = await getCode(config, isForClientSide, isClientRouting, isDev, id);
|
|
24
25
|
return code;
|
|
@@ -75,7 +76,7 @@ export const pageFilesExportNamesEager = {};
|
|
|
75
76
|
export const pageFilesList = [];
|
|
76
77
|
export const neverLoaded = {};
|
|
77
78
|
|
|
78
|
-
${await generateVirtualFileGlobalEntry(isForClientSide, isDev, id
|
|
79
|
+
${await generateVirtualFileGlobalEntry({ environmentName: isForClientSide ? 'client' : 'server', isClientRouting, isDev }, id)}
|
|
79
80
|
|
|
80
81
|
`;
|
|
81
82
|
const vikeConfig = await getVikeConfigInternal();
|
|
@@ -18,7 +18,7 @@ async function generateVirtualFilePageEntry(id, isDev) {
|
|
|
18
18
|
assert(result.isForClientSide === isForClientSide)
|
|
19
19
|
}
|
|
20
20
|
*/
|
|
21
|
-
const { pageId,
|
|
21
|
+
const { pageId, environmentName } = result;
|
|
22
22
|
const vikeConfig = await getVikeConfigInternal(true);
|
|
23
23
|
const { _pageConfigs: pageConfigs } = vikeConfig;
|
|
24
24
|
const pageConfig = pageConfigs.find((pageConfig) => pageConfig.pageId === pageId);
|
|
@@ -31,20 +31,20 @@ async function generateVirtualFilePageEntry(id, isDev) {
|
|
|
31
31
|
throw getProjectError(`Outdated request. Try again. ${getDebugInfoStr({ id, pageId })}`);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const code = getCode(pageConfig,
|
|
35
|
-
debug(id,
|
|
34
|
+
const code = getCode(pageConfig, environmentName, pageId, resolveIncludeAssetsImportedByServer(vikeConfig.config), isDev);
|
|
35
|
+
debug(id, `${environmentName.toUpperCase()}-SIDE`, code);
|
|
36
36
|
return code;
|
|
37
37
|
}
|
|
38
|
-
function getCode(pageConfig,
|
|
38
|
+
function getCode(pageConfig, environmentName, pageId, includeAssetsImportedByServer, isDev) {
|
|
39
39
|
const lines = [];
|
|
40
40
|
const importStatements = [];
|
|
41
41
|
const filesEnv = new Map();
|
|
42
42
|
const isClientRouting = getConfigValueBuildTime(pageConfig, 'clientRouting', 'boolean')?.value ?? false;
|
|
43
43
|
lines.push('export const configValuesSerialized = {');
|
|
44
|
-
lines.push(...serializeConfigValues(pageConfig, importStatements, filesEnv, {
|
|
44
|
+
lines.push(...serializeConfigValues(pageConfig, importStatements, filesEnv, { environmentName, isClientRouting, isDev }, '', false));
|
|
45
45
|
lines.push('};');
|
|
46
|
-
if (!handleAssetsManifest_isFixEnabled() && includeAssetsImportedByServer &&
|
|
47
|
-
importStatements.push(`import '${extractAssetsAddQuery(generateVirtualFileId({ type: 'page-entry', pageId,
|
|
46
|
+
if (!handleAssetsManifest_isFixEnabled() && includeAssetsImportedByServer && environmentName === 'client' && !isDev) {
|
|
47
|
+
importStatements.push(`import '${extractAssetsAddQuery(generateVirtualFileId({ type: 'page-entry', pageId, environmentName: 'server' }))}'`);
|
|
48
48
|
}
|
|
49
49
|
const code = [...importStatements, ...lines].join('\n');
|
|
50
50
|
return code;
|
|
@@ -3,15 +3,17 @@ export { getConfigValueSourceRelevantAnyEnv };
|
|
|
3
3
|
export { isRuntimeEnvMatch };
|
|
4
4
|
export { isConfigSourceValueNull };
|
|
5
5
|
export type { RuntimeEnv };
|
|
6
|
+
export type { RuntimeEnvRuntime };
|
|
6
7
|
import type { ConfigEnv, ConfigValueSource, PageConfigBuildTime, PageConfigGlobalBuildTime } from '../../../../types/PageConfig.js';
|
|
7
8
|
import '../../assertEnvVite.js';
|
|
8
|
-
type RuntimeEnv = {
|
|
9
|
-
isForClientSide: boolean;
|
|
10
|
-
isClientRouting: boolean;
|
|
11
|
-
isDev?: boolean;
|
|
12
|
-
} | {
|
|
9
|
+
type RuntimeEnv = RuntimeEnvRuntime | {
|
|
13
10
|
isForConfig: true;
|
|
14
11
|
};
|
|
12
|
+
type RuntimeEnvRuntime = {
|
|
13
|
+
environmentName: string;
|
|
14
|
+
isClientRouting?: boolean;
|
|
15
|
+
isDev: boolean;
|
|
16
|
+
};
|
|
15
17
|
type PageConfigPartial = Pick<PageConfigBuildTime | PageConfigGlobalBuildTime, 'configValueSources' | 'configDefinitions'>;
|
|
16
18
|
declare function getConfigValueSourcesRelevant(configName: string, runtimeEnv: RuntimeEnv, pageConfig: PageConfigPartial): ConfigValueSource[];
|
|
17
19
|
declare function getConfigValueSourceRelevantAnyEnv(configName: string, pageConfig: PageConfigPartial): null | ConfigValueSource;
|
|
@@ -47,16 +47,10 @@ function isRuntimeEnvMatch(configEnv, runtimeEnv) {
|
|
|
47
47
|
if ('isForConfig' in runtimeEnv)
|
|
48
48
|
return !!configEnv.config;
|
|
49
49
|
// Runtime
|
|
50
|
-
if (!runtimeEnv.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
else {
|
|
55
|
-
if (!configEnv.client)
|
|
56
|
-
return false;
|
|
57
|
-
if (configEnv.client === 'if-client-routing' && !runtimeEnv.isClientRouting)
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
50
|
+
if (!configEnv[runtimeEnv.environmentName])
|
|
51
|
+
return false;
|
|
52
|
+
if (runtimeEnv.environmentName === 'client' && configEnv.clientRoutingOnly && !runtimeEnv.isClientRouting)
|
|
53
|
+
return false;
|
|
60
54
|
// Production/development
|
|
61
55
|
if (configEnv.production !== undefined) {
|
|
62
56
|
assert(typeof configEnv.production === 'boolean');
|
|
@@ -2,6 +2,7 @@ export { pluginVirtualFiles };
|
|
|
2
2
|
import { normalizePath } from 'vite';
|
|
3
3
|
import { generateVirtualFilePageEntry } from './pluginVirtualFiles/generateVirtualFilePageEntry.js';
|
|
4
4
|
import { generateVirtualFileGlobalEntryWithOldDesign } from './pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js';
|
|
5
|
+
import { generateVirtualFileGlobalEntry } from './pluginVirtualFiles/generateVirtualFileGlobalEntry.js';
|
|
5
6
|
import { escapeRegex } from '../../../utils/escapeRegex.js';
|
|
6
7
|
import { isScriptFile } from '../../../utils/isScriptFile.js';
|
|
7
8
|
import { addVirtualFileIdPrefix, isVirtualFileId, removeVirtualFileIdPrefix, virtualFileIdPrefix1, virtualFileIdPrefix2, } from '../../../utils/virtualFileId.js';
|
|
@@ -9,6 +10,8 @@ import { assert } from '../../../utils/assert.js';
|
|
|
9
10
|
import { assertPosixPath } from '../../../utils/path.js';
|
|
10
11
|
import { parseVirtualFileId } from '../../../shared-server-node/virtualFileId.js';
|
|
11
12
|
import { reloadVikeConfig, isV1Design, getVikeConfigInternalOptional } from '../shared/resolveVikeConfigInternal.js';
|
|
13
|
+
import { isEnvironmentBuiltIn } from '../../../shared-server-node/vike-environments.js';
|
|
14
|
+
import { isRunnableDevEnvironment } from '../../../utils/isRunnableDevEnvironment.js';
|
|
12
15
|
import pc from '@brillout/picocolors';
|
|
13
16
|
import { logConfigInfo } from '../shared/loggerDev.js';
|
|
14
17
|
import { getFilePathToShowToUserModule } from '../shared/getFilePath.js';
|
|
@@ -73,6 +76,9 @@ function pluginVirtualFiles() {
|
|
|
73
76
|
return code;
|
|
74
77
|
}
|
|
75
78
|
if (idParsed.type === 'global-entry') {
|
|
79
|
+
if (!isEnvironmentBuiltIn(idParsed.environmentName)) {
|
|
80
|
+
return generateVirtualFileGlobalEntry({ environmentName: idParsed.environmentName, isDev }, id);
|
|
81
|
+
}
|
|
76
82
|
const code = await generateVirtualFileGlobalEntryWithOldDesign(id, options, config, this.environment, isDev);
|
|
77
83
|
return code;
|
|
78
84
|
}
|
|
@@ -179,6 +185,20 @@ function invalidateVikeVirtualFiles(server) {
|
|
|
179
185
|
vikeVirtualFiles.forEach((mod) => {
|
|
180
186
|
server.moduleGraph.invalidateModule(mod);
|
|
181
187
|
});
|
|
188
|
+
// - `server.moduleGraph` only covers the `client` and `ssr` environments, while additional environments (e.g. `rsc`) also load Vike's virtual files
|
|
189
|
+
Object.values(server.environments).forEach((environment) => {
|
|
190
|
+
environment.moduleGraph.idToModuleMap.forEach((mod, id) => {
|
|
191
|
+
if (parseVirtualFileId(id))
|
|
192
|
+
environment.moduleGraph.invalidateModule(mod);
|
|
193
|
+
});
|
|
194
|
+
if (!isRunnableDevEnvironment(environment))
|
|
195
|
+
return;
|
|
196
|
+
const { evaluatedModules } = environment.runner;
|
|
197
|
+
evaluatedModules.idToModuleMap.forEach((mod, id) => {
|
|
198
|
+
if (parseVirtualFileId(id))
|
|
199
|
+
evaluatedModules.invalidateModule(mod);
|
|
200
|
+
});
|
|
201
|
+
});
|
|
182
202
|
}
|
|
183
203
|
function getVikeVirtualFiles(server) {
|
|
184
204
|
const vikeVirtualFiles = Array.from(server.moduleGraph.urlToModuleMap.keys())
|
|
@@ -50,8 +50,20 @@ function addSsrMiddleware(middlewares, config, isPreview, isPrerenderingEnabled)
|
|
|
50
50
|
res.setHeader(name, value);
|
|
51
51
|
}
|
|
52
52
|
const { httpResponse } = pageContext;
|
|
53
|
-
|
|
53
|
+
setHeadersWithMultipleCookies(res, httpResponse.headers);
|
|
54
54
|
res.statusCode = httpResponse.statusCode;
|
|
55
55
|
httpResponse.pipe(res);
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
+
// A response can have several Set-Cookie headers: res.setHeader() would only keep the last one
|
|
59
|
+
function setHeadersWithMultipleCookies(res, headers) {
|
|
60
|
+
const cookies = [];
|
|
61
|
+
headers.forEach(([name, value]) => {
|
|
62
|
+
if (name.toLowerCase() === 'set-cookie')
|
|
63
|
+
cookies.push(value);
|
|
64
|
+
else
|
|
65
|
+
res.setHeader(name, value);
|
|
66
|
+
});
|
|
67
|
+
if (cookies.length > 0)
|
|
68
|
+
res.setHeader('set-cookie', cookies);
|
|
69
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { getAssetsDir };
|
|
2
2
|
import { assertUsage } from '../../../utils/assert.js';
|
|
3
3
|
import '../assertEnvVite.js';
|
|
4
|
-
function getAssetsDir(
|
|
5
|
-
let { assetsDir } =
|
|
6
|
-
assertUsage(assetsDir,
|
|
4
|
+
function getAssetsDir(build) {
|
|
5
|
+
let { assetsDir } = build;
|
|
6
|
+
assertUsage(assetsDir, "Vite's build.assetsDir cannot be an empty string");
|
|
7
7
|
assetsDir = assetsDir.split(/\/|\\/).filter(Boolean).join('/');
|
|
8
8
|
return assetsDir;
|
|
9
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { isViteCli };
|
|
2
2
|
export { getViteCliArgs };
|
|
3
|
-
export {
|
|
3
|
+
export { getViteCliArgsMinimal };
|
|
4
4
|
export { getViteCliCommand };
|
|
5
5
|
import '../assertEnvVite.js';
|
|
6
6
|
declare function isViteCli(): boolean;
|
|
@@ -12,8 +12,8 @@ type ConfigFromCli = {
|
|
|
12
12
|
};
|
|
13
13
|
type ViteCommand = 'dev' | 'build' | 'optimize' | 'preview';
|
|
14
14
|
declare function getViteCliCommand(): ViteCommand | null;
|
|
15
|
-
declare function
|
|
16
|
-
declare function getViteCliArgs(): null | {
|
|
15
|
+
declare function getViteCliArgsMinimal(): null | {
|
|
17
16
|
root: string | undefined;
|
|
18
17
|
configFile: string | undefined;
|
|
19
18
|
};
|
|
19
|
+
declare function getViteCliArgs(): null | ConfigFromCli;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { isViteCli };
|
|
2
2
|
export { getViteCliArgs };
|
|
3
|
-
export {
|
|
3
|
+
export { getViteCliArgsMinimal };
|
|
4
4
|
export { getViteCliCommand };
|
|
5
|
+
// Copied from Vite's CLI
|
|
5
6
|
import { assert } from '../../../utils/assert.js';
|
|
6
7
|
import { isObject } from '../../../utils/isObject.js';
|
|
7
8
|
import { isToolCli } from '../../../utils/isToolCli.js';
|
|
@@ -11,48 +12,23 @@ const desc = 'vike:vite-cli-simulation';
|
|
|
11
12
|
function isViteCli() {
|
|
12
13
|
return isToolCli('vite');
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
assert(
|
|
20
|
-
|
|
15
|
+
function parseViteCli() {
|
|
16
|
+
let viteCli;
|
|
17
|
+
const onCommand = (command) => (root, options) => {
|
|
18
|
+
assert(viteCli === undefined);
|
|
19
|
+
assert(root === undefined || typeof root === 'string');
|
|
20
|
+
assert(isObject(options));
|
|
21
|
+
// Same as Vite: duplicated options => the last value wins
|
|
22
|
+
for (const [key, value] of Object.entries(options)) {
|
|
23
|
+
if (Array.isArray(value))
|
|
24
|
+
options[key] = value[value.length - 1];
|
|
25
|
+
}
|
|
26
|
+
assert(options.config === undefined || typeof options.config === 'string');
|
|
27
|
+
viteCli = { command, root, options };
|
|
21
28
|
};
|
|
22
|
-
//
|
|
23
|
-
// https://github.com/vitejs/vite/blob/d3e7eeefa91e1992f47694d16fe4dbe708c4d80e/packages/vite/src/node/cli.ts#L186-L188
|
|
24
|
-
const cli = cac(desc);
|
|
25
|
-
// dev
|
|
26
|
-
cli
|
|
27
|
-
.command('[root]', desc)
|
|
28
|
-
.alias('serve')
|
|
29
|
-
.alias('dev')
|
|
30
|
-
.action(() => {
|
|
31
|
-
setCommand('dev');
|
|
32
|
-
});
|
|
33
|
-
// build
|
|
34
|
-
cli.command('build [root]', desc).action(() => {
|
|
35
|
-
setCommand('build');
|
|
36
|
-
});
|
|
37
|
-
// optimize
|
|
38
|
-
cli.command('optimize [root]', desc).action(() => {
|
|
39
|
-
setCommand('optimize');
|
|
40
|
-
});
|
|
41
|
-
// preview
|
|
42
|
-
cli.command('preview [root]', desc).action(() => {
|
|
43
|
-
setCommand('preview');
|
|
44
|
-
});
|
|
45
|
-
cli.parse();
|
|
46
|
-
assert(command);
|
|
47
|
-
return command;
|
|
48
|
-
}
|
|
49
|
-
function getViteBuildCliArgs() {
|
|
50
|
-
if (!isViteCli())
|
|
51
|
-
return null;
|
|
52
|
-
// Copied & adapted from Vite
|
|
29
|
+
// We need to declare all Vite's options, otherwise cac consumes the next argument as the value of boolean options (e.g. `vite build --emptyOutDir some-root`).
|
|
53
30
|
const cli = cac(desc);
|
|
54
31
|
// Common configs
|
|
55
|
-
// https://github.com/vitejs/vite/blob/d3e7eeefa91e1992f47694d16fe4dbe708c4d80e/packages/vite/src/node/cli.ts#L169-L182
|
|
56
32
|
cli
|
|
57
33
|
.option('-c, --config <file>', desc)
|
|
58
34
|
.option('--base <path>', desc)
|
|
@@ -62,8 +38,22 @@ function getViteBuildCliArgs() {
|
|
|
62
38
|
.option('-d, --debug [feat]', desc)
|
|
63
39
|
.option('-f, --filter <filter>', desc)
|
|
64
40
|
.option('-m, --mode <mode>', desc);
|
|
65
|
-
//
|
|
66
|
-
|
|
41
|
+
// dev
|
|
42
|
+
cli
|
|
43
|
+
.command('[root]', desc)
|
|
44
|
+
.alias('serve')
|
|
45
|
+
.alias('dev')
|
|
46
|
+
.option('--host [host]', desc)
|
|
47
|
+
.option('--port <port>', desc)
|
|
48
|
+
.option('--open [path]', desc)
|
|
49
|
+
.option('--cors', desc)
|
|
50
|
+
.option('--strictPort', desc)
|
|
51
|
+
.option('--force', desc)
|
|
52
|
+
.option('--experimentalBundle', desc)
|
|
53
|
+
// Options that this copy doesn't declare (e.g. added by newer Vite versions) are still validated by Vite's own CLI, which throws `Unknown option` for options Vite doesn't know
|
|
54
|
+
.allowUnknownOptions()
|
|
55
|
+
.action(onCommand('dev'));
|
|
56
|
+
// build
|
|
67
57
|
cli
|
|
68
58
|
.command('build [root]', desc)
|
|
69
59
|
.option('--target <target>', desc)
|
|
@@ -71,35 +61,61 @@ function getViteBuildCliArgs() {
|
|
|
71
61
|
.option('--assetsDir <dir>', desc)
|
|
72
62
|
.option('--assetsInlineLimit <number>', desc)
|
|
73
63
|
.option('--ssr [entry]', desc)
|
|
74
|
-
.option('--sourcemap', desc)
|
|
64
|
+
.option('--sourcemap [output]', desc)
|
|
75
65
|
.option('--minify [minifier]', desc)
|
|
76
66
|
.option('--manifest [name]', desc)
|
|
77
67
|
.option('--ssrManifest [name]', desc)
|
|
78
68
|
.option('--emptyOutDir', desc)
|
|
79
69
|
.option('-w, --watch', desc)
|
|
80
70
|
.option('--app', desc)
|
|
81
|
-
.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
build: buildOptions,
|
|
96
|
-
...(options.app ? { builder: {} } : {}),
|
|
97
|
-
};
|
|
98
|
-
});
|
|
99
|
-
let configFromCli = null;
|
|
71
|
+
.allowUnknownOptions()
|
|
72
|
+
.action(onCommand('build'));
|
|
73
|
+
// optimize
|
|
74
|
+
cli.command('optimize [root]', desc).option('--force', desc).allowUnknownOptions().action(onCommand('optimize'));
|
|
75
|
+
// preview
|
|
76
|
+
cli
|
|
77
|
+
.command('preview [root]', desc)
|
|
78
|
+
.option('--host [host]', desc)
|
|
79
|
+
.option('--port <port>', desc)
|
|
80
|
+
.option('--strictPort', desc)
|
|
81
|
+
.option('--open [path]', desc)
|
|
82
|
+
.option('--outDir <dir>', desc)
|
|
83
|
+
.allowUnknownOptions()
|
|
84
|
+
.action(onCommand('preview'));
|
|
100
85
|
cli.parse();
|
|
101
|
-
|
|
102
|
-
|
|
86
|
+
assert(viteCli);
|
|
87
|
+
return viteCli;
|
|
88
|
+
}
|
|
89
|
+
function getViteCliCommand() {
|
|
90
|
+
if (!isViteCli())
|
|
91
|
+
return null;
|
|
92
|
+
return parseViteCli().command;
|
|
93
|
+
}
|
|
94
|
+
function getViteCliArgsMinimal() {
|
|
95
|
+
if (!isViteCli())
|
|
96
|
+
return null;
|
|
97
|
+
const { root, options } = parseViteCli();
|
|
98
|
+
return { root, configFile: options.config };
|
|
99
|
+
}
|
|
100
|
+
function getViteCliArgs() {
|
|
101
|
+
if (!isViteCli())
|
|
102
|
+
return null;
|
|
103
|
+
const { command, root, options } = parseViteCli();
|
|
104
|
+
if (command !== 'build')
|
|
105
|
+
return null;
|
|
106
|
+
// Like Vite: all options except the global ones go to `build`
|
|
107
|
+
const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
|
|
108
|
+
return {
|
|
109
|
+
root,
|
|
110
|
+
base: options.base,
|
|
111
|
+
mode: options.mode,
|
|
112
|
+
configFile: options.config,
|
|
113
|
+
configLoader: options.configLoader,
|
|
114
|
+
logLevel: options.logLevel,
|
|
115
|
+
clearScreen: options.clearScreen,
|
|
116
|
+
build: buildOptions,
|
|
117
|
+
...(options.app ? { builder: {} } : {}),
|
|
118
|
+
};
|
|
103
119
|
function cleanGlobalCLIOptions(options) {
|
|
104
120
|
const ret = { ...options };
|
|
105
121
|
delete ret['--'];
|
|
@@ -129,29 +145,9 @@ function getViteBuildCliArgs() {
|
|
|
129
145
|
}
|
|
130
146
|
return ret;
|
|
131
147
|
}
|
|
132
|
-
// https://github.com/vitejs/vite/blob/d3e7eeefa91e1992f47694d16fe4dbe708c4d80e/packages/vite/src/node/cli.ts#L141
|
|
133
148
|
function cleanBuilderCLIOptions(options) {
|
|
134
149
|
const ret = { ...options };
|
|
135
150
|
delete ret.app;
|
|
136
151
|
return ret;
|
|
137
152
|
}
|
|
138
153
|
}
|
|
139
|
-
function getViteCliArgs() {
|
|
140
|
-
if (!isViteCli())
|
|
141
|
-
return null;
|
|
142
|
-
const cli = cac(desc);
|
|
143
|
-
cli.option('-c, --config <file>', desc);
|
|
144
|
-
let result = null;
|
|
145
|
-
const setResult = (root, options) => {
|
|
146
|
-
assert(root === undefined || typeof root === 'string');
|
|
147
|
-
assert(isObject(options));
|
|
148
|
-
assert(options.config === undefined || typeof options.config === 'string');
|
|
149
|
-
result = { root, configFile: options.config };
|
|
150
|
-
};
|
|
151
|
-
cli.command('[root]', desc).alias('serve').alias('dev').action(setResult);
|
|
152
|
-
cli.command('build [root]', desc).action(setResult);
|
|
153
|
-
cli.command('optimize [root]', desc).action(setResult);
|
|
154
|
-
cli.command('preview [root]', desc).action(setResult);
|
|
155
|
-
cli.parse();
|
|
156
|
-
return result;
|
|
157
|
-
}
|
|
@@ -4,8 +4,7 @@ export { isViteServerSide_onlySsrEnv };
|
|
|
4
4
|
export { isViteServerSide_extraSafe };
|
|
5
5
|
export { isViteServerSide_applyToEnvironment };
|
|
6
6
|
export { isViteServerSide_configEnvironment };
|
|
7
|
-
import {
|
|
8
|
-
import { assert, assertUsage } from '../../../utils/assert.js';
|
|
7
|
+
import { assert } from '../../../utils/assert.js';
|
|
9
8
|
import '../assertEnvVite.js';
|
|
10
9
|
function isViteServerSide_impl(configGlobal, viteEnv) {
|
|
11
10
|
assert(!('consumer' in configGlobal)); // make sure configGlobal isn't viteEnv.config
|
|
@@ -60,11 +59,7 @@ function isViteServerSide_extraSafe(config, viteEnv, options) {
|
|
|
60
59
|
optionsSsr: options?.ssr ?? null,
|
|
61
60
|
};
|
|
62
61
|
assert(options, debug);
|
|
63
|
-
|
|
64
|
-
assert(typeof options.ssr === 'boolean', debug)
|
|
65
|
-
/*/
|
|
66
|
-
assertUsage(typeof options.ssr === 'boolean', `You're using an old Vite version — update Vite to ${viteVersionMin} or above.`);
|
|
67
|
-
//*/
|
|
62
|
+
assert(typeof options.ssr === 'boolean', debug);
|
|
68
63
|
assert(options.ssr === isServerSide, debug);
|
|
69
64
|
return isServerSide;
|
|
70
65
|
}
|
|
@@ -57,7 +57,7 @@ type ConfigDefinition = {
|
|
|
57
57
|
/** Whether changes to the configuration should trigger a Vite restart. */
|
|
58
58
|
vite?: boolean;
|
|
59
59
|
/** @experimental */
|
|
60
|
-
_computed?: (pageConfig: PageConfigBuildTimeBeforeComputed) => unknown;
|
|
60
|
+
_computed?: (pageConfig: PageConfigBuildTimeBeforeComputed, isDev: boolean) => unknown;
|
|
61
61
|
/** @experimental */
|
|
62
62
|
_valueIsFilePath?: true;
|
|
63
63
|
/** @experimental */
|
|
@@ -53,14 +53,15 @@ const metaBuiltIn = {
|
|
|
53
53
|
route: {
|
|
54
54
|
env: {
|
|
55
55
|
server: true,
|
|
56
|
-
client:
|
|
56
|
+
client: true,
|
|
57
|
+
clientRoutingOnly: true,
|
|
57
58
|
// For vite-plugin-vercel
|
|
58
59
|
config: true,
|
|
59
60
|
},
|
|
60
61
|
eager: true,
|
|
61
62
|
},
|
|
62
63
|
guard: {
|
|
63
|
-
env: { server: true, client:
|
|
64
|
+
env: { server: true, client: true, clientRoutingOnly: true },
|
|
64
65
|
},
|
|
65
66
|
data: {
|
|
66
67
|
env: { server: true },
|
|
@@ -70,7 +71,7 @@ const metaBuiltIn = {
|
|
|
70
71
|
cumulative: true,
|
|
71
72
|
},
|
|
72
73
|
iKnowThePerformanceRisksOfAsyncRouteFunctions: {
|
|
73
|
-
env: { server: true, client:
|
|
74
|
+
env: { server: true, client: true, clientRoutingOnly: true },
|
|
74
75
|
eager: true,
|
|
75
76
|
},
|
|
76
77
|
filesystemRoutingRoot: {
|
|
@@ -114,12 +115,13 @@ const metaBuiltIn = {
|
|
|
114
115
|
hasServerOnlyHook: {
|
|
115
116
|
env: { client: true },
|
|
116
117
|
eager: true,
|
|
117
|
-
_computed: (pageConfig) => {
|
|
118
|
+
_computed: (pageConfig, isDev) => {
|
|
118
119
|
const sources = ['data', 'onBeforeRender', 'onCreatePageContext', 'guard']
|
|
119
120
|
.map((hookName) => getConfigValueSourcesRelevant(hookName, {
|
|
120
|
-
|
|
121
|
+
environmentName: 'server',
|
|
121
122
|
// TO-DO/eventually/remove-server-router: let's eventually remove support for Server Routing
|
|
122
123
|
isClientRouting: true,
|
|
124
|
+
isDev,
|
|
123
125
|
}, pageConfig))
|
|
124
126
|
.flat(1)
|
|
125
127
|
// Server-only
|
|
@@ -253,7 +255,7 @@ const metaBuiltIn = {
|
|
|
253
255
|
global: true,
|
|
254
256
|
},
|
|
255
257
|
onBeforeRoute: {
|
|
256
|
-
env: { server: true, client:
|
|
258
|
+
env: { server: true, client: true, clientRoutingOnly: true },
|
|
257
259
|
eager: true,
|
|
258
260
|
global: true,
|
|
259
261
|
},
|
|
@@ -3,6 +3,7 @@ export type { VikeConfig };
|
|
|
3
3
|
export { getVikeConfigInternal };
|
|
4
4
|
export { getVikeConfigInternalOptional };
|
|
5
5
|
export { setVikeConfigContext };
|
|
6
|
+
export { setViteEnvironmentNames };
|
|
6
7
|
export { isVikeConfigContextSet };
|
|
7
8
|
export { reloadVikeConfig };
|
|
8
9
|
export { isV1Design };
|
|
@@ -36,6 +37,7 @@ type VikeConfigInternal = GlobalConfigPublic & {
|
|
|
36
37
|
_pageConfigGlobal: PageConfigGlobalBuildTime;
|
|
37
38
|
_vikeConfigDependencies: Set<string>;
|
|
38
39
|
_extensions: PlusFile[];
|
|
40
|
+
_additionalEnvironmentNames: string[];
|
|
39
41
|
prerenderContext: PrerenderContext;
|
|
40
42
|
};
|
|
41
43
|
declare function reloadVikeConfig(): void;
|
|
@@ -53,6 +55,7 @@ type VikeConfig = Pick<VikeConfigInternal, 'config' | 'pages' | 'prerenderContex
|
|
|
53
55
|
dangerouslyUseInternals: DangerouslyUseInternals<VikeConfigInternal>;
|
|
54
56
|
};
|
|
55
57
|
declare function setVikeConfigContext(vikeConfigCtx_: VikeConfigContext): void;
|
|
58
|
+
declare function setViteEnvironmentNames(viteEnvironmentNames: string[]): Promise<void>;
|
|
56
59
|
declare function isVikeConfigContextSet(): boolean;
|
|
57
60
|
declare function getVikeConfigInternalOptional(): Promise<null | VikeConfigInternal>;
|
|
58
61
|
declare function isV1Design(): boolean;
|
|
@@ -74,7 +77,7 @@ declare function getConfigDefinitionOptional(configDefinitions: ConfigDefinition
|
|
|
74
77
|
isGlobalLocation: boolean;
|
|
75
78
|
}) => boolean);
|
|
76
79
|
vite?: boolean;
|
|
77
|
-
_computed?: (pageConfig: PageConfigBuildTimeBeforeComputed) => unknown;
|
|
80
|
+
_computed?: (pageConfig: PageConfigBuildTimeBeforeComputed, isDev: boolean) => unknown;
|
|
78
81
|
_valueIsFilePath?: true;
|
|
79
82
|
_userEffectDefinedAtFilePath?: DefinedAtFilePath;
|
|
80
83
|
isDefinedByPeerDependency?: undefined;
|