vike 0.4.162 → 0.4.163-commit-2305d5b
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/autoFullBuild.js +7 -4
- package/dist/cjs/node/plugin/plugins/buildConfig.js +21 -17
- package/dist/cjs/node/plugin/plugins/commonConfig.js +8 -2
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +2 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -1
- package/dist/cjs/node/runtime/globalContext/loadImportBuild.js +3 -3
- package/dist/cjs/node/runtime/globalContext.js +47 -6
- package/dist/cjs/node/runtime/index-common.js +4 -1
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +19 -19
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +12 -12
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +5 -5
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +9 -13
- package/dist/cjs/node/runtime/renderPage.js +3 -0
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValue.js +4 -11
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +20 -14
- package/dist/esm/client/shared/getPageContextProxyForUser.js +19 -2
- package/dist/esm/node/plugin/plugins/autoFullBuild.js +7 -4
- package/dist/esm/node/plugin/plugins/buildConfig.js +21 -17
- package/dist/esm/node/plugin/plugins/commonConfig.js +9 -3
- package/dist/esm/node/plugin/plugins/importBuild/index.js +2 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -1
- package/dist/esm/node/runtime/globalContext/loadImportBuild.d.ts +2 -2
- package/dist/esm/node/runtime/globalContext/loadImportBuild.js +3 -3
- package/dist/esm/node/runtime/globalContext.d.ts +11 -2
- package/dist/esm/node/runtime/globalContext.js +49 -6
- package/dist/esm/node/runtime/index-common.d.ts +1 -0
- package/dist/esm/node/runtime/index-common.js +1 -0
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +19 -19
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +12 -12
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +5 -5
- package/dist/esm/node/runtime/renderPage/logErrorHint.js +10 -11
- package/dist/esm/node/runtime/renderPage.js +3 -0
- package/dist/esm/shared/page-configs/PageConfig.d.ts +1 -0
- package/dist/esm/shared/page-configs/serialize/serializeConfigValue.js +5 -9
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +2 -1
|
@@ -2,9 +2,9 @@ export { retrieveAssetsProd };
|
|
|
2
2
|
import { assert, isNpmPackageImport } from '../../utils.js';
|
|
3
3
|
import { getManifestEntry } from './getManifestEntry.js';
|
|
4
4
|
import { extractAssetsAddQuery } from '../../../shared/extractAssetsQuery.js';
|
|
5
|
-
function retrieveAssetsProd(clientDependencies,
|
|
5
|
+
function retrieveAssetsProd(clientDependencies, assetsManifest, includeAssetsImportedByServer) {
|
|
6
6
|
let assetUrls = new Set();
|
|
7
|
-
assert(
|
|
7
|
+
assert(assetsManifest);
|
|
8
8
|
const visistedAssets = new Set();
|
|
9
9
|
clientDependencies.forEach(({ id, onlyAssets, eagerlyImported }) => {
|
|
10
10
|
if (eagerlyImported)
|
|
@@ -19,17 +19,17 @@ function retrieveAssetsProd(clientDependencies, clientManifest, includeAssetsImp
|
|
|
19
19
|
id = extractAssetsAddQuery(id);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
const { manifestKey } = getManifestEntry(id,
|
|
23
|
-
collectAssets(manifestKey, assetUrls, visistedAssets,
|
|
22
|
+
const { manifestKey } = getManifestEntry(id, assetsManifest);
|
|
23
|
+
collectAssets(manifestKey, assetUrls, visistedAssets, assetsManifest, onlyAssets);
|
|
24
24
|
});
|
|
25
|
-
collectSingleStyle(assetUrls,
|
|
25
|
+
collectSingleStyle(assetUrls, assetsManifest);
|
|
26
26
|
return Array.from(assetUrls);
|
|
27
27
|
}
|
|
28
|
-
function collectAssets(manifestKey, assetUrls, visistedAssets,
|
|
28
|
+
function collectAssets(manifestKey, assetUrls, visistedAssets, assetsManifest, onlyCollectStaticAssets) {
|
|
29
29
|
if (visistedAssets.has(manifestKey))
|
|
30
30
|
return;
|
|
31
31
|
visistedAssets.add(manifestKey);
|
|
32
|
-
const manifestEntry =
|
|
32
|
+
const manifestEntry = assetsManifest[manifestKey];
|
|
33
33
|
assert(manifestEntry, { manifestKey });
|
|
34
34
|
const { file } = manifestEntry;
|
|
35
35
|
if (!onlyCollectStaticAssets) {
|
|
@@ -37,9 +37,9 @@ function collectAssets(manifestKey, assetUrls, visistedAssets, manifest, onlyCol
|
|
|
37
37
|
}
|
|
38
38
|
const { imports = [], assets = [], css = [] } = manifestEntry;
|
|
39
39
|
for (const manifestKey of imports) {
|
|
40
|
-
const importManifestEntry =
|
|
40
|
+
const importManifestEntry = assetsManifest[manifestKey];
|
|
41
41
|
assert(importManifestEntry);
|
|
42
|
-
collectAssets(manifestKey, assetUrls, visistedAssets,
|
|
42
|
+
collectAssets(manifestKey, assetUrls, visistedAssets, assetsManifest, onlyCollectStaticAssets);
|
|
43
43
|
}
|
|
44
44
|
for (const cssAsset of css) {
|
|
45
45
|
assetUrls.add(`/${cssAsset}`);
|
|
@@ -49,9 +49,9 @@ function collectAssets(manifestKey, assetUrls, visistedAssets, manifest, onlyCol
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
// Support `config.build.cssCodeSplit: false`, see https://github.com/vikejs/vike/issues/644
|
|
52
|
-
function collectSingleStyle(assetUrls,
|
|
53
|
-
const style =
|
|
54
|
-
if (style && Object.values(
|
|
52
|
+
function collectSingleStyle(assetUrls, assetsManifest) {
|
|
53
|
+
const style = assetsManifest['style.css'];
|
|
54
|
+
if (style && Object.values(assetsManifest).filter((asset) => asset.file.endsWith('.css')).length === 1) {
|
|
55
55
|
assetUrls.add(`/${style.file}`);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -19,9 +19,9 @@ async function getPageAssets(pageContext, clientDependencies, clientEntries) {
|
|
|
19
19
|
assetUrls = await retrieveAssetsDev(clientDependencies, viteDevServer);
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
|
-
const {
|
|
23
|
-
clientEntriesSrc = clientEntries.map((clientEntry) => resolveClientEntriesProd(clientEntry,
|
|
24
|
-
assetUrls = retrieveAssetsProd(clientDependencies,
|
|
22
|
+
const { assetsManifest } = globalContext;
|
|
23
|
+
clientEntriesSrc = clientEntries.map((clientEntry) => resolveClientEntriesProd(clientEntry, assetsManifest));
|
|
24
|
+
assetUrls = retrieveAssetsProd(clientDependencies, assetsManifest, pageContext._includeAssetsImportedByServer);
|
|
25
25
|
}
|
|
26
26
|
let pageAssets = [];
|
|
27
27
|
unique([...clientEntriesSrc, ...assetUrls]).forEach((src) => {
|
|
@@ -116,8 +116,8 @@ async function resolveClientEntriesDev(clientEntry, viteDevServer) {
|
|
|
116
116
|
assertPosixPath(filePath);
|
|
117
117
|
return filePath;
|
|
118
118
|
}
|
|
119
|
-
function resolveClientEntriesProd(clientEntry,
|
|
120
|
-
const { manifestEntry } = getManifestEntry(clientEntry,
|
|
119
|
+
function resolveClientEntriesProd(clientEntry, assetsManifest) {
|
|
120
|
+
const { manifestEntry } = getManifestEntry(clientEntry, assetsManifest);
|
|
121
121
|
assert(manifestEntry.isEntry || manifestEntry.isDynamicEntry || clientEntry.endsWith('.css'), { clientEntry });
|
|
122
122
|
let { file } = manifestEntry;
|
|
123
123
|
assert(!file.startsWith('/'));
|
|
@@ -3,8 +3,7 @@ export { logErrorHint };
|
|
|
3
3
|
export { isCjsEsmError };
|
|
4
4
|
export { isKnownError };
|
|
5
5
|
export { getHint };
|
|
6
|
-
import
|
|
7
|
-
import { assert, formatHintLog, isNotNullish, isObject, unique, joinEnglish } from '../utils.js';
|
|
6
|
+
import { assert, formatHintLog, isNotNullish, isObject, unique } from '../utils.js';
|
|
8
7
|
const knownErrors = [
|
|
9
8
|
{
|
|
10
9
|
errMsg: 'jsxDEV is not a function',
|
|
@@ -13,6 +12,13 @@ const knownErrors = [
|
|
|
13
12
|
{
|
|
14
13
|
errMsg: 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)',
|
|
15
14
|
link: 'https://vike.dev/broken-npm-package#react-invalid-component'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
// ```
|
|
18
|
+
// Error [RollupError]: Could not resolve "../dist/client/assets.json" from "renderer/+onRenderHtml.tsx"
|
|
19
|
+
// ```
|
|
20
|
+
errMsg: 'assets.json',
|
|
21
|
+
link: 'https://vike.dev/getGlobalContext'
|
|
16
22
|
}
|
|
17
23
|
];
|
|
18
24
|
function logErrorHint(error) {
|
|
@@ -31,15 +37,7 @@ function getHint(error) {
|
|
|
31
37
|
}
|
|
32
38
|
const res = isCjsEsmError(error);
|
|
33
39
|
if (res) {
|
|
34
|
-
const
|
|
35
|
-
const hint = [
|
|
36
|
-
'Error could be a CJS/ESM issue, consider ',
|
|
37
|
-
!packageNames || packageNames.length === 0
|
|
38
|
-
? 'using'
|
|
39
|
-
: `adding ${joinEnglish(packageNames.map((p) => pc.cyan(p)), 'or')} to`,
|
|
40
|
-
` ${pc.cyan('ssr.noExternal')}`,
|
|
41
|
-
', see https://vike.dev/broken-npm-package'
|
|
42
|
-
].join('');
|
|
40
|
+
const hint = 'The error seems to be a CJS/ESM issue, see https://vike.dev/broken-npm-package';
|
|
43
41
|
return hint;
|
|
44
42
|
}
|
|
45
43
|
return null;
|
|
@@ -70,6 +68,7 @@ function isCjsEsmError(error) {
|
|
|
70
68
|
packageNames.forEach((packageName) => {
|
|
71
69
|
assert(!['vite', 'vike'].includes(packageName));
|
|
72
70
|
});
|
|
71
|
+
// We don't use this anymore: we could return `true` instead. Shall we remove returning a list of npm packages?
|
|
73
72
|
return packageNames;
|
|
74
73
|
}
|
|
75
74
|
function normalizeRes(res) {
|
|
@@ -321,6 +321,9 @@ function normalizeUrl(pageContextInit, httpRequestId) {
|
|
|
321
321
|
if (disableUrlNormalization)
|
|
322
322
|
return null;
|
|
323
323
|
const { urlOriginal } = pageContextInit;
|
|
324
|
+
const { isPageContextRequest } = handlePageContextRequestUrl(urlOriginal);
|
|
325
|
+
if (isPageContextRequest)
|
|
326
|
+
return null;
|
|
324
327
|
const urlNormalized = normalizeUrlPathname(urlOriginal, trailingSlash, baseServer);
|
|
325
328
|
if (!urlNormalized)
|
|
326
329
|
return null;
|
|
@@ -75,6 +75,7 @@ type ConfigValueSource = {
|
|
|
75
75
|
valueIsImportedAtRuntime: boolean;
|
|
76
76
|
/** Whether the config value is a file path, for example config.client */
|
|
77
77
|
valueIsFilePath?: true;
|
|
78
|
+
valueIsDefinedByValueFile: boolean;
|
|
78
79
|
};
|
|
79
80
|
type DefinedAtFileFullInfo = DefinedAtFile & FilePath & {
|
|
80
81
|
fileExportName?: string;
|
|
@@ -6,8 +6,7 @@ export { serializeConfigValueImported };
|
|
|
6
6
|
// Both parsePageConfigs() parseConfigValuesImported() and are loaded on the client-side and server-side
|
|
7
7
|
import { assertIsNotProductionRuntime } from '../../../utils/assertIsNotProductionRuntime.js';
|
|
8
8
|
assertIsNotProductionRuntime();
|
|
9
|
-
import
|
|
10
|
-
import { assert, assertPosixPath } from '../../utils.js';
|
|
9
|
+
import { assert } from '../../utils.js';
|
|
11
10
|
import { generateEagerImport } from '../../../node/plugin/plugins/importUserCode/generateEagerImport.js';
|
|
12
11
|
function serializeConfigValue(lines, configName, configValueSerialized) {
|
|
13
12
|
let whitespace = ' ';
|
|
@@ -23,13 +22,10 @@ function serializeConfigValue(lines, configName, configValueSerialized) {
|
|
|
23
22
|
function serializeConfigValueImported(configValueSource, configName, whitespace, varCounterContainer, importStatements) {
|
|
24
23
|
assert(!configValueSource.valueIsFilePath);
|
|
25
24
|
assert(whitespace.replaceAll(' ', '').length === 0);
|
|
26
|
-
const { valueIsImportedAtRuntime, definedAt } = configValueSource;
|
|
25
|
+
const { valueIsImportedAtRuntime, valueIsDefinedByValueFile, definedAt } = configValueSource;
|
|
27
26
|
assert(valueIsImportedAtRuntime);
|
|
28
27
|
const { filePathAbsoluteVite, fileExportName } = definedAt;
|
|
29
|
-
|
|
30
|
-
const fileName = path.posix.basename(filePathAbsoluteVite);
|
|
31
|
-
const isValueFile = fileName.startsWith('+');
|
|
32
|
-
if (isValueFile)
|
|
28
|
+
if (valueIsDefinedByValueFile)
|
|
33
29
|
assert(fileExportName === undefined);
|
|
34
30
|
const { importName, importStatement } = generateEagerImport(filePathAbsoluteVite, varCounterContainer.varCounter++, fileExportName);
|
|
35
31
|
importStatements.push(importStatement);
|
|
@@ -37,8 +33,8 @@ function serializeConfigValueImported(configValueSource, configName, whitespace,
|
|
|
37
33
|
lines.push(` {`);
|
|
38
34
|
lines.push(` configName: '${configName}',`);
|
|
39
35
|
lines.push(` importPath: '${filePathAbsoluteVite}',`);
|
|
40
|
-
lines.push(` isValueFile: ${JSON.stringify(
|
|
41
|
-
if (
|
|
36
|
+
lines.push(` isValueFile: ${JSON.stringify(valueIsDefinedByValueFile)},`);
|
|
37
|
+
if (valueIsDefinedByValueFile) {
|
|
42
38
|
lines.push(` exportValues: ${importName},`);
|
|
43
39
|
}
|
|
44
40
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
|
-
declare const PROJECT_VERSION: "0.4.
|
|
3
|
+
declare const PROJECT_VERSION: "0.4.163-commit-2305d5b";
|
|
4
4
|
declare const projectInfo: {
|
|
5
5
|
projectName: "Vike";
|
|
6
|
-
projectVersion: "0.4.
|
|
6
|
+
projectVersion: "0.4.163-commit-2305d5b";
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
3
|
import { onProjectInfo } from './assertSingleInstance.js';
|
|
4
|
-
const PROJECT_VERSION = '0.4.
|
|
4
|
+
const PROJECT_VERSION = '0.4.163-commit-2305d5b';
|
|
5
5
|
const projectInfo = {
|
|
6
6
|
projectName: 'Vike',
|
|
7
7
|
projectVersion: PROJECT_VERSION
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.163-commit-2305d5b",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "tsc --watch",
|
|
6
6
|
"build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",
|
|
@@ -169,6 +169,7 @@
|
|
|
169
169
|
"vike": "./node/cli/bin-entry.js"
|
|
170
170
|
},
|
|
171
171
|
"devDependencies": {
|
|
172
|
+
"@biomejs/biome": "^1.5.3",
|
|
172
173
|
"@brillout/import": "^0.2.3",
|
|
173
174
|
"@brillout/json-serializer": "^0.5.8",
|
|
174
175
|
"@brillout/picocolors": "^1.0.10",
|