vike 0.4.223-commit-f1089b4 → 0.4.223-commit-33cc798
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/plugin/plugins/build/{pluginAssetsManifest/fixServerAssets.js → handleAssetsManifest.js} +32 -42
- package/dist/cjs/node/plugin/plugins/build/pluginAutoFullBuild.js +36 -23
- package/dist/cjs/node/plugin/plugins/build/pluginBuildApp.js +4 -31
- package/dist/cjs/node/plugin/plugins/build/pluginBuildConfig.js +7 -7
- package/dist/cjs/node/plugin/plugins/build/pluginBuildEntry.js +1 -1
- package/dist/cjs/node/plugin/plugins/build/pluginDistFileNames.js +1 -1
- package/dist/cjs/node/plugin/plugins/build/pluginDistPackageJsonFile.js +2 -2
- 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/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.js +0 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/virtual-files/getVirtualFilePageConfigValuesAll.js +4 -4
- package/dist/cjs/node/plugin/shared/getFullBuildInlineConfig.js +1 -0
- package/dist/cjs/node/plugin/shared/getOutDirs.js +3 -3
- package/dist/cjs/node/plugin/shared/{viteIsSSR.js → isViteServerBuild.js} +20 -11
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/node/plugin/plugins/build/handleAssetsManifest.d.ts +18 -0
- package/dist/esm/node/plugin/plugins/build/{pluginAssetsManifest/fixServerAssets.js → handleAssetsManifest.js} +32 -44
- package/dist/esm/node/plugin/plugins/build/pluginAutoFullBuild.d.ts +2 -0
- package/dist/esm/node/plugin/plugins/build/pluginAutoFullBuild.js +36 -23
- package/dist/esm/node/plugin/plugins/build/pluginBuildApp.js +5 -32
- package/dist/esm/node/plugin/plugins/build/pluginBuildConfig.js +7 -7
- package/dist/esm/node/plugin/plugins/build/pluginBuildEntry.d.ts +0 -1
- package/dist/esm/node/plugin/plugins/build/pluginBuildEntry.js +1 -1
- package/dist/esm/node/plugin/plugins/build/pluginDistFileNames.js +1 -1
- package/dist/esm/node/plugin/plugins/build/pluginDistPackageJsonFile.js +2 -2
- 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/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.js +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/virtual-files/getVirtualFilePageConfigValuesAll.js +4 -4
- package/dist/esm/node/plugin/shared/getFullBuildInlineConfig.js +1 -0
- package/dist/esm/node/plugin/shared/getOutDirs.js +3 -3
- package/dist/esm/node/plugin/shared/isViteServerBuild.d.ts +15 -0
- package/dist/esm/node/plugin/shared/{viteIsSSR.js → isViteServerBuild.js} +20 -11
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +1 -1
- package/dist/esm/node/plugin/plugins/build/pluginAssetsManifest/fixServerAssets.d.ts +0 -27
- package/dist/esm/node/plugin/shared/viteIsSSR.d.ts +0 -13
|
@@ -6,7 +6,7 @@ import { extractAssetsAddQuery } from '../../../../../shared/extractAssetsQuery.
|
|
|
6
6
|
import { debug } from './debug.js';
|
|
7
7
|
import { isRuntimeEnvMatch } from './isRuntimeEnvMatch.js';
|
|
8
8
|
import { serializeConfigValues } from '../../../../../../shared/page-configs/serialize/serializeConfigValues.js';
|
|
9
|
-
import {
|
|
9
|
+
import { handleAssetsManifest_isFixEnabled } from '../../../build/handleAssetsManifest.js';
|
|
10
10
|
import { getConfigValueBuildTime } from '../../../../../../shared/page-configs/getConfigValueBuildTime.js';
|
|
11
11
|
async function getVirtualFilePageConfigValuesAll(id, isDev, config) {
|
|
12
12
|
const result = isVirtualFileIdPageConfigValuesAll(id);
|
|
@@ -24,11 +24,11 @@ async function getVirtualFilePageConfigValuesAll(id, isDev, config) {
|
|
|
24
24
|
assert(pageConfig, { id, pageId });
|
|
25
25
|
const code = getLoadConfigValuesAll(pageConfig, isForClientSide, pageId,
|
|
26
26
|
// TODO/now: add meta.default
|
|
27
|
-
vikeConfig.global.config.includeAssetsImportedByServer ?? true, isDev);
|
|
27
|
+
vikeConfig.global.config.includeAssetsImportedByServer ?? true, config, isDev);
|
|
28
28
|
debug(id, isForClientSide ? 'CLIENT-SIDE' : 'SERVER-SIDE', code);
|
|
29
29
|
return code;
|
|
30
30
|
}
|
|
31
|
-
function getLoadConfigValuesAll(pageConfig, isForClientSide, pageId, includeAssetsImportedByServer, isDev) {
|
|
31
|
+
function getLoadConfigValuesAll(pageConfig, isForClientSide, pageId, includeAssetsImportedByServer, config, isDev) {
|
|
32
32
|
const lines = [];
|
|
33
33
|
const importStatements = [];
|
|
34
34
|
const filesEnv = new Map();
|
|
@@ -36,7 +36,7 @@ function getLoadConfigValuesAll(pageConfig, isForClientSide, pageId, includeAsse
|
|
|
36
36
|
lines.push('export const configValuesSerialized = {');
|
|
37
37
|
lines.push(...serializeConfigValues(pageConfig, importStatements, filesEnv, (configEnv) => isRuntimeEnvMatch(configEnv, { isForClientSide, isClientRouting, isDev }), '', false));
|
|
38
38
|
lines.push('};');
|
|
39
|
-
if (!
|
|
39
|
+
if (!handleAssetsManifest_isFixEnabled(config) && includeAssetsImportedByServer && isForClientSide && !isDev) {
|
|
40
40
|
importStatements.push(`import '${extractAssetsAddQuery(getVirtualFileIdPageConfigValuesAll(pageId, false))}'`);
|
|
41
41
|
}
|
|
42
42
|
const code = [...importStatements, ...lines].join('\n');
|
|
@@ -2,7 +2,7 @@ export { getOutDirs };
|
|
|
2
2
|
export { resolveOutDir };
|
|
3
3
|
import pc from '@brillout/picocolors';
|
|
4
4
|
import { assert, assertPosixPath, assertUsage, createDebugger, pathJoin, toPosixPath } from '../utils.js';
|
|
5
|
-
import {
|
|
5
|
+
import { isViteServerBuild } from './isViteServerBuild.js';
|
|
6
6
|
const debug = createDebugger('vike:outDir');
|
|
7
7
|
function getOutDirs(configGlobal, viteEnv) {
|
|
8
8
|
const configEnv = viteEnv?.config ?? configGlobal;
|
|
@@ -16,7 +16,7 @@ function getOutDirs(configGlobal, viteEnv) {
|
|
|
16
16
|
/** Appends `client/` or `server/` to `config.build.outDir` */
|
|
17
17
|
function resolveOutDir(config, isSSR) {
|
|
18
18
|
debug('resolveOutDir()', new Error().stack);
|
|
19
|
-
const isServerSide =
|
|
19
|
+
const isServerSide = isViteServerBuild(config) || isSSR;
|
|
20
20
|
debug('isServerSide', isServerSide);
|
|
21
21
|
const outDir = getOutDirFromViteUserConfig(config) || 'dist';
|
|
22
22
|
debug('outDir', outDir);
|
|
@@ -105,7 +105,7 @@ function assertOutDirResolved(outDir, config) {
|
|
|
105
105
|
assert('/client'.length === '/server'.length);
|
|
106
106
|
const outDirCorrected = outDir.slice(0, -1 * '/client'.length);
|
|
107
107
|
const wrongUsage = `You've set Vite's config.build.outDir to ${pc.cyan(outDir)} but you should set it to ${pc.cyan(outDirCorrected)} instead.`;
|
|
108
|
-
if (
|
|
108
|
+
if (isViteServerBuild(config)) {
|
|
109
109
|
assertUsage(outDir.endsWith('/server'), wrongUsage);
|
|
110
110
|
}
|
|
111
111
|
else {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { isViteServerBuild };
|
|
2
|
+
export { isViteClientBuild };
|
|
3
|
+
export { isViteServerBuild_options };
|
|
4
|
+
export { isViteServerBuild_safe };
|
|
5
|
+
export { isViteServerBuild_onlySsrEnv };
|
|
6
|
+
import type { Environment, ResolvedConfig, UserConfig } from 'vite';
|
|
7
|
+
declare function isViteServerBuild(configGlobal: ResolvedConfig | UserConfig, viteEnv?: Environment): boolean;
|
|
8
|
+
declare function isViteServerBuild_onlySsrEnv(configGlobal: ResolvedConfig, viteEnv: Environment | undefined): boolean;
|
|
9
|
+
declare function isViteClientBuild(configGlobal: ResolvedConfig, viteEnv: Environment): boolean;
|
|
10
|
+
declare function isViteServerBuild_options(options: {
|
|
11
|
+
ssr?: boolean;
|
|
12
|
+
} | undefined): boolean;
|
|
13
|
+
declare function isViteServerBuild_safe(config: ResolvedConfig, options: {
|
|
14
|
+
ssr?: boolean;
|
|
15
|
+
} | undefined): boolean;
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
1
|
+
export { isViteServerBuild };
|
|
2
|
+
export { isViteClientBuild };
|
|
3
|
+
export { isViteServerBuild_options };
|
|
4
|
+
export { isViteServerBuild_safe };
|
|
5
|
+
export { isViteServerBuild_onlySsrEnv };
|
|
5
6
|
import { assert } from '../../../utils/assert.js';
|
|
6
|
-
|
|
7
|
-
function viteIsSSR(configGlobal, viteEnv) {
|
|
7
|
+
function isViteServerBuild(configGlobal, viteEnv) {
|
|
8
8
|
const configEnv = viteEnv?.config ?? configGlobal;
|
|
9
9
|
return !!configEnv?.build?.ssr;
|
|
10
10
|
}
|
|
11
|
-
//
|
|
12
|
-
function
|
|
13
|
-
return viteEnv ? viteEnv.name === 'ssr' :
|
|
11
|
+
// Only `ssr` env: for example don't include `vercel_edge` nor `vercel_node`.
|
|
12
|
+
function isViteServerBuild_onlySsrEnv(configGlobal, viteEnv) {
|
|
13
|
+
return viteEnv ? viteEnv.name === 'ssr' : isViteServerBuild(configGlobal);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function isViteClientBuild(configGlobal, viteEnv) {
|
|
16
|
+
const yes = !isViteServerBuild(configGlobal, viteEnv);
|
|
17
|
+
const isVite5 = viteEnv === undefined;
|
|
18
|
+
if (!isVite5) {
|
|
19
|
+
const yes2 = viteEnv.name === 'client';
|
|
20
|
+
assert(yes === yes2);
|
|
21
|
+
}
|
|
22
|
+
return yes;
|
|
23
|
+
}
|
|
24
|
+
function isViteServerBuild_options(options) {
|
|
16
25
|
return !!options?.ssr;
|
|
17
26
|
}
|
|
18
27
|
// Vite is quite messy about setting `ssr: boolean`, thus we use an extra safe implemention for security purposes.
|
|
19
28
|
// It's used for .client.js and .server.js guarantee thus we use agressive assert() calls for added safety.
|
|
20
|
-
function
|
|
29
|
+
function isViteServerBuild_safe(config, options) {
|
|
21
30
|
if (config.command === 'build') {
|
|
22
31
|
assert(typeof config.build.ssr === 'boolean');
|
|
23
32
|
const val = config.build.ssr;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.223-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.223-commit-33cc798";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.223-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.223-commit-33cc798';
|
package/package.json
CHANGED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export { handleAssetsManifest };
|
|
2
|
-
export { fixServerAssets_getBuildConfig };
|
|
3
|
-
export { fixServerAssets_isEnabled };
|
|
4
|
-
export { fixServerAssets_assertUsageCssCodeSplit };
|
|
5
|
-
export { fixServerAssets_assertUsageCssTarget };
|
|
6
|
-
export { writeManifestFile };
|
|
7
|
-
import type { ViteManifest } from '../../../../shared/ViteManifest.js';
|
|
8
|
-
import type { Environment, ResolvedConfig, Rollup, UserConfig } from 'vite';
|
|
9
|
-
type Bundle = Rollup.OutputBundle;
|
|
10
|
-
type Options = Rollup.NormalizedOutputOptions;
|
|
11
|
-
/**
|
|
12
|
-
* true => use workaround config.build.ssrEmitAssets
|
|
13
|
-
* false => use workaround extractAssets plugin
|
|
14
|
-
*
|
|
15
|
-
* Only used by V1 design.
|
|
16
|
-
*/
|
|
17
|
-
declare function fixServerAssets_isEnabled(): boolean;
|
|
18
|
-
declare function fixServerAssets_assertUsageCssCodeSplit(config: ResolvedConfig): void;
|
|
19
|
-
declare function fixServerAssets_assertUsageCssTarget(config: ResolvedConfig): void;
|
|
20
|
-
declare function writeManifestFile(manifest: ViteManifest, manifestFilePath: string): Promise<void>;
|
|
21
|
-
declare function fixServerAssets_getBuildConfig(config: UserConfig): {
|
|
22
|
-
readonly ssrEmitAssets: true | undefined;
|
|
23
|
-
readonly cssMinify: "esbuild" | undefined;
|
|
24
|
-
readonly manifest: "_temp_manifest.json";
|
|
25
|
-
readonly copyPublicDir: boolean | undefined;
|
|
26
|
-
};
|
|
27
|
-
declare function handleAssetsManifest(config: ResolvedConfig, viteEnv: Environment | undefined, options: Options, bundle: Bundle): Promise<void>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { viteIsSSR };
|
|
2
|
-
export { viteIsServerBuildEnvAny };
|
|
3
|
-
export { viteIsSSR_options };
|
|
4
|
-
export { viteIsSSR_safe };
|
|
5
|
-
import type { Environment, ResolvedConfig, UserConfig } from 'vite';
|
|
6
|
-
declare function viteIsSSR(configGlobal: ResolvedConfig | UserConfig, viteEnv?: Environment): boolean;
|
|
7
|
-
declare function viteIsServerBuildEnvAny(configGlobal: ResolvedConfig, viteEnv: Environment | undefined): boolean;
|
|
8
|
-
declare function viteIsSSR_options(options: {
|
|
9
|
-
ssr?: boolean;
|
|
10
|
-
} | undefined): boolean;
|
|
11
|
-
declare function viteIsSSR_safe(config: ResolvedConfig, options: {
|
|
12
|
-
ssr?: boolean;
|
|
13
|
-
} | undefined): boolean;
|