vike 0.4.171-commit-6e37128 → 0.4.171-commit-3b2cb88
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/devConfig/index.js +2 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +0 -1
- package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +3 -3
- package/dist/cjs/node/runtime/html/injectAssets/getViteDevScripts.js +2 -1
- package/dist/cjs/node/runtime/html/injectAssets/mergeScriptTags.js +2 -8
- package/dist/cjs/shared/getPageFiles/parseGlobResults.js +15 -8
- package/dist/cjs/shared/page-configs/serialize/assertPageConfigsSerialized.js +0 -17
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/client/client-routing-runtime/installClientRouter.js +18 -10
- package/dist/esm/node/plugin/plugins/devConfig/index.js +2 -1
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +0 -1
- package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +3 -3
- package/dist/esm/node/runtime/html/injectAssets/getViteDevScripts.js +3 -2
- package/dist/esm/node/runtime/html/injectAssets/mergeScriptTags.d.ts +1 -1
- package/dist/esm/node/runtime/html/injectAssets/mergeScriptTags.js +2 -8
- package/dist/esm/shared/getPageFiles/parseGlobResults.js +14 -7
- package/dist/esm/shared/page-configs/serialize/assertPageConfigsSerialized.d.ts +1 -5
- package/dist/esm/shared/page-configs/serialize/assertPageConfigsSerialized.js +1 -15
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +1 -1
|
@@ -75,7 +75,8 @@ function devConfig() {
|
|
|
75
75
|
configureServer: {
|
|
76
76
|
order: 'post',
|
|
77
77
|
handler(server) {
|
|
78
|
-
|
|
78
|
+
const hasHonoViteDevServer = !!config.plugins.find((p) => p.name === '@hono/vite-dev-server');
|
|
79
|
+
if (config.server.middlewareMode || hasHonoViteDevServer)
|
|
79
80
|
return;
|
|
80
81
|
return () => {
|
|
81
82
|
(0, addSsrMiddleware_js_1.addSsrMiddleware)(server.middlewares);
|
|
@@ -69,7 +69,6 @@ export const pageFilesExportNamesLazy = {};
|
|
|
69
69
|
export const pageFilesExportNamesEager = {};
|
|
70
70
|
export const pageFilesList = [];
|
|
71
71
|
export const neverLoaded = {};
|
|
72
|
-
export const isGeneratedFile = true;
|
|
73
72
|
|
|
74
73
|
${await (0, getVirtualFilePageConfigs_js_1.getVirtualFilePageConfigs)(isForClientSide, isDev, id, isClientRouting, config)}
|
|
75
74
|
|
|
@@ -112,7 +112,7 @@ async function getHtmlTags(pageContext, injectToStream, injectFilter) {
|
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
// The JavaScript entry <script> tag
|
|
115
|
-
const scriptEntry = await mergeScriptEntries(pageAssets
|
|
115
|
+
const scriptEntry = await mergeScriptEntries(pageAssets);
|
|
116
116
|
if (scriptEntry) {
|
|
117
117
|
htmlTags.push({
|
|
118
118
|
htmlTag: scriptEntry,
|
|
@@ -134,11 +134,11 @@ async function getHtmlTags(pageContext, injectToStream, injectFilter) {
|
|
|
134
134
|
return htmlTags;
|
|
135
135
|
}
|
|
136
136
|
exports.getHtmlTags = getHtmlTags;
|
|
137
|
-
async function mergeScriptEntries(pageAssets
|
|
137
|
+
async function mergeScriptEntries(pageAssets) {
|
|
138
138
|
const scriptEntries = pageAssets.filter((pageAsset) => pageAsset.isEntry && pageAsset.assetType === 'script');
|
|
139
139
|
const viteScripts = await (0, getViteDevScripts_js_1.getViteDevScripts)();
|
|
140
140
|
const scriptTagsHtml = `${viteScripts}${scriptEntries.map((asset) => (0, inferHtmlTags_js_1.inferAssetTag)(asset)).join('')}`;
|
|
141
|
-
const scriptTag = (0, mergeScriptTags_js_1.mergeScriptTags)(scriptTagsHtml
|
|
141
|
+
const scriptTag = (0, mergeScriptTags_js_1.mergeScriptTags)(scriptTagsHtml);
|
|
142
142
|
return scriptTag;
|
|
143
143
|
}
|
|
144
144
|
function getPageContextJsonScriptTag(pageContext) {
|
|
@@ -21,7 +21,8 @@ async function getViteDevScripts() {
|
|
|
21
21
|
(0, utils_js_1.assertUsage)(!fakeHtml.startsWith(fakeHtmlBegin.replace(' ', '')), 'Vite plugins that minify the HTML are not supported by vike, see https://github.com/vikejs/vike/issues/224');
|
|
22
22
|
(0, utils_js_1.assertUsage)(fakeHtml.startsWith(fakeHtmlBegin) && fakeHtml.endsWith(fakeHtmlEnd), 'You are using a Vite Plugin that transforms the HTML in a way that conflicts with vike. Create a new GitHub ticket to discuss a solution.');
|
|
23
23
|
const viteInjection = fakeHtml.slice(fakeHtmlBegin.length, -1 * fakeHtmlEnd.length);
|
|
24
|
-
(0, utils_js_1.assert)(viteInjection.includes('script')
|
|
24
|
+
(0, utils_js_1.assert)(viteInjection.includes('script'));
|
|
25
|
+
(0, utils_js_1.assertWarning)(!viteInjection.includes('import('), 'Unexpected Vite HMR code. Reach out to a Vike maintainer on GitHub.', { onlyOnce: true });
|
|
25
26
|
const scriptTags = viteInjection;
|
|
26
27
|
return scriptTags;
|
|
27
28
|
}
|
|
@@ -6,7 +6,7 @@ const inferHtmlTags_js_1 = require("./inferHtmlTags.js");
|
|
|
6
6
|
const scriptRE = /(<script\b(?:\s[^>]*>|>))(.*?)<\/script>/gims;
|
|
7
7
|
const srcRE = /\bsrc\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/im;
|
|
8
8
|
const typeRE = /\btype\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/im;
|
|
9
|
-
function mergeScriptTags(scriptTagsHtml
|
|
9
|
+
function mergeScriptTags(scriptTagsHtml) {
|
|
10
10
|
let scriptTag = '';
|
|
11
11
|
const scripts = parseScripts(scriptTagsHtml);
|
|
12
12
|
// We need to merge module scripts to ensure execution order
|
|
@@ -21,13 +21,7 @@ function mergeScriptTags(scriptTagsHtml, isProduction) {
|
|
|
21
21
|
const hasInnerHtml = !!innerHtml.trim();
|
|
22
22
|
if (src) {
|
|
23
23
|
(0, utils_js_1.assert)(!hasInnerHtml);
|
|
24
|
-
|
|
25
|
-
contents.push(`import ${JSON.stringify(src)};`);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
// Ensure HMR preamble code is executed before client entries
|
|
29
|
-
contents.push(`import(${JSON.stringify(src)});`);
|
|
30
|
-
}
|
|
24
|
+
contents.push(`import ${JSON.stringify(src)};`);
|
|
31
25
|
}
|
|
32
26
|
else if (hasInnerHtml) {
|
|
33
27
|
innerHtml = innerHtml.split('\n').filter(Boolean).join('\n');
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseGlobResults = void 0;
|
|
4
|
+
// TODO/v1-release: remove old design code, and remove all assertions.
|
|
4
5
|
const utils_js_1 = require("../utils.js");
|
|
5
6
|
const assert_exports_old_design_js_1 = require("./assert_exports_old_design.js");
|
|
6
7
|
const getPageFileObject_js_1 = require("./getPageFileObject.js");
|
|
7
8
|
const fileTypes_js_1 = require("./fileTypes.js");
|
|
8
|
-
const assertPageConfigsSerialized_js_1 = require("../page-configs/serialize/assertPageConfigsSerialized.js");
|
|
9
9
|
const parsePageConfigs_js_1 = require("../page-configs/serialize/parsePageConfigs.js");
|
|
10
10
|
function parseGlobResults(pageFilesExports) {
|
|
11
|
-
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageFilesExports, 'isGeneratedFile'));
|
|
12
|
-
(0, utils_js_1.assert)(pageFilesExports.isGeneratedFile !== false, `vike was re-installed(/re-built). Restart your app.`);
|
|
13
|
-
(0, utils_js_1.assert)(pageFilesExports.isGeneratedFile === true, `\`isGeneratedFile === ${pageFilesExports.isGeneratedFile}\``);
|
|
14
11
|
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageFilesExports, 'pageFilesLazy', 'object'));
|
|
15
12
|
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageFilesExports, 'pageFilesEager', 'object'));
|
|
16
13
|
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageFilesExports, 'pageFilesExportNamesLazy', 'object'));
|
|
@@ -21,8 +18,8 @@ function parseGlobResults(pageFilesExports) {
|
|
|
21
18
|
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageFilesExports, 'pageConfigsSerialized'));
|
|
22
19
|
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageFilesExports, 'pageConfigGlobalSerialized'));
|
|
23
20
|
const { pageConfigsSerialized, pageConfigGlobalSerialized } = pageFilesExports;
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
assertPageConfigsSerialized(pageConfigsSerialized);
|
|
22
|
+
assertPageConfigGlobalSerialized(pageConfigGlobalSerialized);
|
|
26
23
|
const { pageConfigs, pageConfigGlobal } = (0, parsePageConfigs_js_1.parsePageConfigs)(pageConfigsSerialized, pageConfigGlobalSerialized);
|
|
27
24
|
const pageFilesMap = {};
|
|
28
25
|
parseGlobResult(pageFilesExports.pageFilesLazy).forEach(({ filePath, pageFile, globValue }) => {
|
|
@@ -43,8 +40,6 @@ function parseGlobResults(pageFilesExports) {
|
|
|
43
40
|
pageFile.loadExportNames = async () => {
|
|
44
41
|
if (!('exportNames' in pageFile)) {
|
|
45
42
|
const moduleExports = await loadModule();
|
|
46
|
-
// Vite 2 seems to choke following assertion: https://github.com/vikejs/vike/issues/455
|
|
47
|
-
(0, utils_js_1.assertUsage)('exportNames' in moduleExports, 'You seem to be using Vite 2 but the latest vike versions only work with Vite 3');
|
|
48
43
|
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(moduleExports, 'exportNames', 'string[]'), pageFile.filePath);
|
|
49
44
|
pageFile.exportNames = moduleExports.exportNames;
|
|
50
45
|
}
|
|
@@ -91,3 +86,15 @@ function parseGlobResult(globObject) {
|
|
|
91
86
|
function assertLoadModule(globValue) {
|
|
92
87
|
(0, utils_js_1.assert)((0, utils_js_1.isCallable)(globValue));
|
|
93
88
|
}
|
|
89
|
+
function assertPageConfigsSerialized(pageConfigsSerialized) {
|
|
90
|
+
(0, utils_js_1.assert)((0, utils_js_1.isArray)(pageConfigsSerialized));
|
|
91
|
+
pageConfigsSerialized.forEach((pageConfigSerialized) => {
|
|
92
|
+
(0, utils_js_1.assert)((0, utils_js_1.isObject)(pageConfigSerialized));
|
|
93
|
+
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageConfigSerialized, 'pageId', 'string'));
|
|
94
|
+
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageConfigSerialized, 'routeFilesystem'));
|
|
95
|
+
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageConfigSerialized, 'configValuesSerialized'));
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function assertPageConfigGlobalSerialized(pageConfigGlobalSerialized) {
|
|
99
|
+
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageConfigGlobalSerialized, 'configValuesSerialized'));
|
|
100
|
+
}
|
|
@@ -1,18 +1 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertPageConfigGlobalSerialized = exports.assertPageConfigsSerialized = void 0;
|
|
4
|
-
const utils_js_1 = require("../../utils.js");
|
|
5
|
-
function assertPageConfigsSerialized(pageConfigsSerialized) {
|
|
6
|
-
(0, utils_js_1.assert)((0, utils_js_1.isArray)(pageConfigsSerialized));
|
|
7
|
-
pageConfigsSerialized.forEach((pageConfigSerialized) => {
|
|
8
|
-
(0, utils_js_1.assert)((0, utils_js_1.isObject)(pageConfigSerialized));
|
|
9
|
-
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageConfigSerialized, 'pageId', 'string'));
|
|
10
|
-
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageConfigSerialized, 'routeFilesystem'));
|
|
11
|
-
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageConfigSerialized, 'configValuesSerialized'));
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
exports.assertPageConfigsSerialized = assertPageConfigsSerialized;
|
|
15
|
-
function assertPageConfigGlobalSerialized(pageConfigGlobalSerialized) {
|
|
16
|
-
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(pageConfigGlobalSerialized, 'configValuesSerialized'));
|
|
17
|
-
}
|
|
18
|
-
exports.assertPageConfigGlobalSerialized = assertPageConfigGlobalSerialized;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PROJECT_VERSION = exports.projectInfo = void 0;
|
|
4
|
-
const PROJECT_VERSION = '0.4.171-commit-
|
|
4
|
+
const PROJECT_VERSION = '0.4.171-commit-3b2cb88';
|
|
5
5
|
exports.PROJECT_VERSION = PROJECT_VERSION;
|
|
6
6
|
const projectInfo = {
|
|
7
7
|
projectName: 'Vike',
|
|
@@ -7,22 +7,30 @@ import { onLinkClick } from './onLinkClick.js';
|
|
|
7
7
|
import { setupNativeScrollRestoration } from './scrollRestoration.js';
|
|
8
8
|
import { autoSaveScrollPosition } from './setScrollPosition.js';
|
|
9
9
|
async function installClientRouter() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
//
|
|
10
|
+
// Init navigation history and scroll restoration
|
|
11
|
+
initHistoryAndScroll();
|
|
12
|
+
// Render initial page
|
|
13
|
+
const renderPromise = render();
|
|
14
|
+
// Intercept <a> clicks
|
|
15
|
+
onLinkClick();
|
|
16
|
+
// Preserve stack track
|
|
17
|
+
await renderPromise;
|
|
18
|
+
}
|
|
19
|
+
function render() {
|
|
15
20
|
assert(getRenderCount() === 0);
|
|
16
|
-
const
|
|
21
|
+
const renderPromise = renderPageClientSide({
|
|
17
22
|
scrollTarget: 'preserve-scroll',
|
|
18
23
|
isBackwardNavigation: null,
|
|
19
24
|
isClientSideNavigation: false
|
|
20
25
|
});
|
|
21
26
|
assert(getRenderCount() === 1);
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
return renderPromise;
|
|
28
|
+
}
|
|
29
|
+
function initHistoryAndScroll() {
|
|
30
|
+
setupNativeScrollRestoration();
|
|
31
|
+
initHistoryState();
|
|
32
|
+
autoSaveScrollPosition();
|
|
33
|
+
monkeyPatchHistoryPushState();
|
|
24
34
|
// Handle back-/forward navigation
|
|
25
35
|
onBrowserHistoryNavigation();
|
|
26
|
-
// Only for full stack straces
|
|
27
|
-
await promise;
|
|
28
36
|
}
|
|
@@ -73,7 +73,8 @@ function devConfig() {
|
|
|
73
73
|
configureServer: {
|
|
74
74
|
order: 'post',
|
|
75
75
|
handler(server) {
|
|
76
|
-
|
|
76
|
+
const hasHonoViteDevServer = !!config.plugins.find((p) => p.name === '@hono/vite-dev-server');
|
|
77
|
+
if (config.server.middlewareMode || hasHonoViteDevServer)
|
|
77
78
|
return;
|
|
78
79
|
return () => {
|
|
79
80
|
addSsrMiddleware(server.middlewares);
|
|
@@ -63,7 +63,6 @@ export const pageFilesExportNamesLazy = {};
|
|
|
63
63
|
export const pageFilesExportNamesEager = {};
|
|
64
64
|
export const pageFilesList = [];
|
|
65
65
|
export const neverLoaded = {};
|
|
66
|
-
export const isGeneratedFile = true;
|
|
67
66
|
|
|
68
67
|
${await getVirtualFilePageConfigs(isForClientSide, isDev, id, isClientRouting, config)}
|
|
69
68
|
|
|
@@ -107,7 +107,7 @@ async function getHtmlTags(pageContext, injectToStream, injectFilter) {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
// The JavaScript entry <script> tag
|
|
110
|
-
const scriptEntry = await mergeScriptEntries(pageAssets
|
|
110
|
+
const scriptEntry = await mergeScriptEntries(pageAssets);
|
|
111
111
|
if (scriptEntry) {
|
|
112
112
|
htmlTags.push({
|
|
113
113
|
htmlTag: scriptEntry,
|
|
@@ -128,11 +128,11 @@ async function getHtmlTags(pageContext, injectToStream, injectFilter) {
|
|
|
128
128
|
});
|
|
129
129
|
return htmlTags;
|
|
130
130
|
}
|
|
131
|
-
async function mergeScriptEntries(pageAssets
|
|
131
|
+
async function mergeScriptEntries(pageAssets) {
|
|
132
132
|
const scriptEntries = pageAssets.filter((pageAsset) => pageAsset.isEntry && pageAsset.assetType === 'script');
|
|
133
133
|
const viteScripts = await getViteDevScripts();
|
|
134
134
|
const scriptTagsHtml = `${viteScripts}${scriptEntries.map((asset) => inferAssetTag(asset)).join('')}`;
|
|
135
|
-
const scriptTag = mergeScriptTags(scriptTagsHtml
|
|
135
|
+
const scriptTag = mergeScriptTags(scriptTagsHtml);
|
|
136
136
|
return scriptTag;
|
|
137
137
|
}
|
|
138
138
|
function getPageContextJsonScriptTag(pageContext) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { getViteDevScripts };
|
|
2
2
|
import { getGlobalContext } from '../../globalContext.js';
|
|
3
|
-
import { assert, assertUsage } from '../../utils.js';
|
|
3
|
+
import { assert, assertUsage, assertWarning } from '../../utils.js';
|
|
4
4
|
import pc from '@brillout/picocolors';
|
|
5
5
|
async function getViteDevScripts() {
|
|
6
6
|
const globalContext = getGlobalContext();
|
|
@@ -16,7 +16,8 @@ async function getViteDevScripts() {
|
|
|
16
16
|
assertUsage(!fakeHtml.startsWith(fakeHtmlBegin.replace(' ', '')), 'Vite plugins that minify the HTML are not supported by vike, see https://github.com/vikejs/vike/issues/224');
|
|
17
17
|
assertUsage(fakeHtml.startsWith(fakeHtmlBegin) && fakeHtml.endsWith(fakeHtmlEnd), 'You are using a Vite Plugin that transforms the HTML in a way that conflicts with vike. Create a new GitHub ticket to discuss a solution.');
|
|
18
18
|
const viteInjection = fakeHtml.slice(fakeHtmlBegin.length, -1 * fakeHtmlEnd.length);
|
|
19
|
-
assert(viteInjection.includes('script')
|
|
19
|
+
assert(viteInjection.includes('script'));
|
|
20
|
+
assertWarning(!viteInjection.includes('import('), 'Unexpected Vite HMR code. Reach out to a Vike maintainer on GitHub.', { onlyOnce: true });
|
|
20
21
|
const scriptTags = viteInjection;
|
|
21
22
|
return scriptTags;
|
|
22
23
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { mergeScriptTags };
|
|
2
|
-
declare function mergeScriptTags(scriptTagsHtml: string
|
|
2
|
+
declare function mergeScriptTags(scriptTagsHtml: string): string;
|
|
@@ -4,7 +4,7 @@ import { scriptAttrs } from './inferHtmlTags.js';
|
|
|
4
4
|
const scriptRE = /(<script\b(?:\s[^>]*>|>))(.*?)<\/script>/gims;
|
|
5
5
|
const srcRE = /\bsrc\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/im;
|
|
6
6
|
const typeRE = /\btype\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+))/im;
|
|
7
|
-
function mergeScriptTags(scriptTagsHtml
|
|
7
|
+
function mergeScriptTags(scriptTagsHtml) {
|
|
8
8
|
let scriptTag = '';
|
|
9
9
|
const scripts = parseScripts(scriptTagsHtml);
|
|
10
10
|
// We need to merge module scripts to ensure execution order
|
|
@@ -19,13 +19,7 @@ function mergeScriptTags(scriptTagsHtml, isProduction) {
|
|
|
19
19
|
const hasInnerHtml = !!innerHtml.trim();
|
|
20
20
|
if (src) {
|
|
21
21
|
assert(!hasInnerHtml);
|
|
22
|
-
|
|
23
|
-
contents.push(`import ${JSON.stringify(src)};`);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
// Ensure HMR preamble code is executed before client entries
|
|
27
|
-
contents.push(`import(${JSON.stringify(src)});`);
|
|
28
|
-
}
|
|
22
|
+
contents.push(`import ${JSON.stringify(src)};`);
|
|
29
23
|
}
|
|
30
24
|
else if (hasInnerHtml) {
|
|
31
25
|
innerHtml = innerHtml.split('\n').filter(Boolean).join('\n');
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
export { parseGlobResults };
|
|
2
|
-
|
|
2
|
+
// TODO/v1-release: remove old design code, and remove all assertions.
|
|
3
|
+
import { assert, hasProp, isCallable, isObject, cast, isArray } from '../utils.js';
|
|
3
4
|
import { assertExportValues } from './assert_exports_old_design.js';
|
|
4
5
|
import { getPageFileObject } from './getPageFileObject.js';
|
|
5
6
|
import { fileTypes } from './fileTypes.js';
|
|
6
|
-
import { assertPageConfigGlobalSerialized, assertPageConfigsSerialized } from '../page-configs/serialize/assertPageConfigsSerialized.js';
|
|
7
7
|
import { parsePageConfigs } from '../page-configs/serialize/parsePageConfigs.js';
|
|
8
8
|
function parseGlobResults(pageFilesExports) {
|
|
9
|
-
assert(hasProp(pageFilesExports, 'isGeneratedFile'));
|
|
10
|
-
assert(pageFilesExports.isGeneratedFile !== false, `vike was re-installed(/re-built). Restart your app.`);
|
|
11
|
-
assert(pageFilesExports.isGeneratedFile === true, `\`isGeneratedFile === ${pageFilesExports.isGeneratedFile}\``);
|
|
12
9
|
assert(hasProp(pageFilesExports, 'pageFilesLazy', 'object'));
|
|
13
10
|
assert(hasProp(pageFilesExports, 'pageFilesEager', 'object'));
|
|
14
11
|
assert(hasProp(pageFilesExports, 'pageFilesExportNamesLazy', 'object'));
|
|
@@ -41,8 +38,6 @@ function parseGlobResults(pageFilesExports) {
|
|
|
41
38
|
pageFile.loadExportNames = async () => {
|
|
42
39
|
if (!('exportNames' in pageFile)) {
|
|
43
40
|
const moduleExports = await loadModule();
|
|
44
|
-
// Vite 2 seems to choke following assertion: https://github.com/vikejs/vike/issues/455
|
|
45
|
-
assertUsage('exportNames' in moduleExports, 'You seem to be using Vite 2 but the latest vike versions only work with Vite 3');
|
|
46
41
|
assert(hasProp(moduleExports, 'exportNames', 'string[]'), pageFile.filePath);
|
|
47
42
|
pageFile.exportNames = moduleExports.exportNames;
|
|
48
43
|
}
|
|
@@ -88,3 +83,15 @@ function parseGlobResult(globObject) {
|
|
|
88
83
|
function assertLoadModule(globValue) {
|
|
89
84
|
assert(isCallable(globValue));
|
|
90
85
|
}
|
|
86
|
+
function assertPageConfigsSerialized(pageConfigsSerialized) {
|
|
87
|
+
assert(isArray(pageConfigsSerialized));
|
|
88
|
+
pageConfigsSerialized.forEach((pageConfigSerialized) => {
|
|
89
|
+
assert(isObject(pageConfigSerialized));
|
|
90
|
+
assert(hasProp(pageConfigSerialized, 'pageId', 'string'));
|
|
91
|
+
assert(hasProp(pageConfigSerialized, 'routeFilesystem'));
|
|
92
|
+
assert(hasProp(pageConfigSerialized, 'configValuesSerialized'));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function assertPageConfigGlobalSerialized(pageConfigGlobalSerialized) {
|
|
96
|
+
assert(hasProp(pageConfigGlobalSerialized, 'configValuesSerialized'));
|
|
97
|
+
}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { assertPageConfigGlobalSerialized };
|
|
3
|
-
import type { PageConfigGlobalRuntimeSerialized, PageConfigRuntimeSerialized } from './PageConfigSerialized.js';
|
|
4
|
-
declare function assertPageConfigsSerialized(pageConfigsSerialized: unknown): asserts pageConfigsSerialized is PageConfigRuntimeSerialized[];
|
|
5
|
-
declare function assertPageConfigGlobalSerialized(pageConfigGlobalSerialized: unknown): asserts pageConfigGlobalSerialized is PageConfigGlobalRuntimeSerialized;
|
|
1
|
+
export {};
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { assertPageConfigGlobalSerialized };
|
|
3
|
-
import { assert, isObject, hasProp, isArray } from '../../utils.js';
|
|
4
|
-
function assertPageConfigsSerialized(pageConfigsSerialized) {
|
|
5
|
-
assert(isArray(pageConfigsSerialized));
|
|
6
|
-
pageConfigsSerialized.forEach((pageConfigSerialized) => {
|
|
7
|
-
assert(isObject(pageConfigSerialized));
|
|
8
|
-
assert(hasProp(pageConfigSerialized, 'pageId', 'string'));
|
|
9
|
-
assert(hasProp(pageConfigSerialized, 'routeFilesystem'));
|
|
10
|
-
assert(hasProp(pageConfigSerialized, 'configValuesSerialized'));
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
function assertPageConfigGlobalSerialized(pageConfigGlobalSerialized) {
|
|
14
|
-
assert(hasProp(pageConfigGlobalSerialized, 'configValuesSerialized'));
|
|
15
|
-
}
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
|
-
declare const PROJECT_VERSION: "0.4.171-commit-
|
|
3
|
+
declare const PROJECT_VERSION: "0.4.171-commit-3b2cb88";
|
|
4
4
|
declare const projectInfo: {
|
|
5
5
|
projectName: "Vike";
|
|
6
|
-
projectVersion: "0.4.171-commit-
|
|
6
|
+
projectVersion: "0.4.171-commit-3b2cb88";
|
|
7
7
|
};
|