vike 0.4.176 → 0.4.177-commit-f4a92e0
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/extractAssetsPlugin.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +129 -18
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +14 -6
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +5 -5
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +9 -9
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +7 -7
- package/dist/cjs/node/runtime/renderPage/handleErrorWithoutErrorPage.js +2 -2
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +4 -2
- package/dist/cjs/node/shared/assertV1Design.js +11 -6
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -1
- package/dist/cjs/utils/assertSingleInstance.js +5 -1
- package/dist/cjs/utils/parseUrl.js +3 -1
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/client/client-routing-runtime/installClientRouter.js +1 -1
- package/dist/esm/client/client-routing-runtime/navigate.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/navigate.js +2 -12
- package/dist/esm/client/client-routing-runtime/onBrowserHistoryNavigation.js +1 -1
- package/dist/esm/client/client-routing-runtime/onLinkClick.js +6 -2
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +2 -2
- package/dist/esm/client/client-routing-runtime/setScrollPosition.d.ts +3 -1
- package/dist/esm/client/client-routing-runtime/setScrollPosition.js +16 -16
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +130 -19
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +14 -6
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errBabelReact.js +5 -5
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errEsbuild.js +9 -9
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet/fixture-errors/errVueCss.js +7 -7
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.js +2 -2
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +4 -2
- package/dist/esm/node/shared/assertV1Design.d.ts +1 -1
- package/dist/esm/node/shared/assertV1Design.js +11 -6
- package/dist/esm/shared/page-configs/PageConfig.d.ts +3 -3
- package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +0 -1
- package/dist/esm/utils/assertSingleInstance.js +2 -1
- package/dist/esm/utils/parseUrl.js +3 -1
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ import { executeGuardHook } from '../../../shared/route/executeGuardHook.js';
|
|
|
21
21
|
import { loadPageRoutes } from '../../../shared/route/loadPageRoutes.js';
|
|
22
22
|
import pc from '@brillout/picocolors';
|
|
23
23
|
import { isServerSideError } from '../../../shared/misc/isServerSideError.js';
|
|
24
|
+
import { assertV1Design } from '../../shared/assertV1Design.js';
|
|
24
25
|
async function renderPageAlreadyRouted(pageContext) {
|
|
25
26
|
// pageContext._pageId can either be the:
|
|
26
27
|
// - ID of the page matching the routing, or the
|
|
@@ -170,8 +171,9 @@ async function getRenderContext() {
|
|
|
170
171
|
const globalContext = getGlobalContext();
|
|
171
172
|
const { pageFilesAll, allPageIds, pageConfigs, pageConfigGlobal } = await getPageFilesAll(false, globalContext.isProduction);
|
|
172
173
|
const { pageRoutes, onBeforeRouteHook } = await loadPageRoutes(pageFilesAll, pageConfigs, pageConfigGlobal, allPageIds);
|
|
173
|
-
|
|
174
|
-
|
|
174
|
+
assertV1Design(
|
|
175
|
+
// pageConfigs is PageConfigRuntime[] but assertV1Design() requires PageConfigBuildTime[]
|
|
176
|
+
pageConfigs.length > 0, pageFilesAll);
|
|
175
177
|
const renderContext = {
|
|
176
178
|
pageFilesAll: pageFilesAll,
|
|
177
179
|
pageConfigs,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { assertV1Design };
|
|
2
2
|
import { PageFile } from '../../shared/getPageFiles.js';
|
|
3
3
|
import type { PageConfigBuildTime } from '../../shared/page-configs/PageConfig.js';
|
|
4
|
-
declare function assertV1Design(
|
|
4
|
+
declare function assertV1Design(pageConfigs: PageConfigBuildTime[] | boolean, pageFilesAll: PageFile[] | boolean): void;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
export { assertV1Design };
|
|
2
2
|
import { assert, assertUsage, assertWarning, isNotNullish, unique } from './utils.js';
|
|
3
|
-
function assertV1Design(
|
|
4
|
-
const
|
|
3
|
+
function assertV1Design(pageConfigs, pageFilesAll) {
|
|
4
|
+
const isOldDesign = pageFilesAll === true || (pageFilesAll !== false && pageFilesAll.length > 0);
|
|
5
|
+
const isV1Design = pageConfigs === true || (pageConfigs !== false && pageConfigs.length > 0);
|
|
5
6
|
if (isV1Design && isOldDesign) {
|
|
6
7
|
const lines = ['Mixing the new V1 design with the old V0.4 design is forbidden.'];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const indent = '- ';
|
|
9
|
+
if (typeof pageConfigs !== 'boolean') {
|
|
10
|
+
assert(pageConfigs.length > 0);
|
|
10
11
|
const filesV1 = unique(pageConfigs
|
|
11
12
|
.map((p) => Object.values(p.configValueSources).map((sources) => sources
|
|
12
13
|
.map((c) => c.definedAtFilePath.filePathAbsoluteUserRootDir)
|
|
13
14
|
.filter(isNotNullish)
|
|
14
15
|
.map((filePathToShowToUser) => indent + filePathToShowToUser)))
|
|
15
16
|
.flat(2));
|
|
17
|
+
lines.push(...['V1 design files:', ...filesV1]);
|
|
18
|
+
}
|
|
19
|
+
if (typeof pageFilesAll !== 'boolean') {
|
|
20
|
+
assert(pageFilesAll.length > 0);
|
|
16
21
|
const filesOld = pageFilesAll.map((p) => indent + p.filePath);
|
|
17
|
-
lines.push(...['
|
|
22
|
+
lines.push(...['Old design files:', ...filesOld]);
|
|
18
23
|
}
|
|
19
24
|
assertUsage(false, lines.join('\n'));
|
|
20
25
|
}
|
|
@@ -67,9 +67,9 @@ type ConfigEnv = {
|
|
|
67
67
|
/** For Vike internal use */
|
|
68
68
|
type ConfigEnvInternal = Omit<ConfigEnv, 'client'> & {
|
|
69
69
|
client?: boolean | 'if-client-routing';
|
|
70
|
-
/** Always load value,
|
|
71
|
-
eager?:
|
|
72
|
-
/** Load value only in production or only in development. */
|
|
70
|
+
/** Always load value, no matter which page is loaded. */
|
|
71
|
+
eager?: true;
|
|
72
|
+
/** Load value only in production, or only in development. */
|
|
73
73
|
production?: boolean;
|
|
74
74
|
};
|
|
75
75
|
type ConfigValueSource = {
|
|
@@ -22,7 +22,6 @@ function getConfigValue(pageConfig, configName) {
|
|
|
22
22
|
const sources = configValueSources[configName];
|
|
23
23
|
if (!sources)
|
|
24
24
|
return null;
|
|
25
|
-
assert(sources.every((s) => s.configEnv.config === true));
|
|
26
25
|
const configDef = configDefinitions[configName];
|
|
27
26
|
assert(configDef);
|
|
28
27
|
if (!configDef.cumulative) {
|
|
@@ -7,6 +7,7 @@ export { onAssertModuleLoad };
|
|
|
7
7
|
import { unique } from './unique.js';
|
|
8
8
|
import { getGlobalObject } from './getGlobalObject.js';
|
|
9
9
|
import { projectInfo } from './projectInfo.js';
|
|
10
|
+
import pc from '@brillout/picocolors';
|
|
10
11
|
/* Use original assertUsage() & assertWarning() after all CJS is removed from node_modules/vike/dist/
|
|
11
12
|
import { assertUsage, assertWarning } from './assert.js'
|
|
12
13
|
*/
|
|
@@ -21,7 +22,7 @@ function assertSingleInstance() {
|
|
|
21
22
|
const versions = unique(globalObject.instances);
|
|
22
23
|
assertUsage(versions.length <= 1,
|
|
23
24
|
// DO *NOT* patch vike to remove this error: because of multiple conflicting versions, you *will* eventually encounter insidious issues that hard to debug and potentially a security hazard, see for example https://github.com/vikejs/vike/issues/1108
|
|
24
|
-
`
|
|
25
|
+
`vike@${pc.bold(versions[0])} and vike@${pc.bold(versions[1])} loaded but only one version should be loaded`);
|
|
25
26
|
}
|
|
26
27
|
if (globalObject.checkSingleInstance && globalObject.instances.length > 1) {
|
|
27
28
|
/*/ Not sure whether circular dependency can cause problems? In principle not since client-side code is ESM.
|
|
@@ -18,7 +18,9 @@ const PROTOCOLS = [
|
|
|
18
18
|
// For [Tauri](https://tauri.app/)
|
|
19
19
|
'tauri://',
|
|
20
20
|
// For Electron: https://github.com/vikejs/vike/issues/1557
|
|
21
|
-
'file://'
|
|
21
|
+
'file://',
|
|
22
|
+
// For Capacitor: https://github.com/vikejs/vike/issues/1706
|
|
23
|
+
'capacitor://'
|
|
22
24
|
];
|
|
23
25
|
function isParsable(url) {
|
|
24
26
|
// `parseUrl()` works with these URLs
|
|
@@ -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.177-commit-f4a92e0";
|
|
4
4
|
declare const projectInfo: {
|
|
5
5
|
projectName: "Vike";
|
|
6
|
-
projectVersion: "0.4.
|
|
6
|
+
projectVersion: "0.4.177-commit-f4a92e0";
|
|
7
7
|
};
|