vike 0.4.161-commit-ba539a4 → 0.4.161-commit-0e9c635
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/envVars.js +6 -2
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +10 -3
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +2 -2
- package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +1 -21
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +11 -91
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +3 -1
- package/dist/cjs/node/plugin/plugins/setGlobalContext.js +0 -14
- package/dist/cjs/node/plugin/shared/rollupSourceMap.js +20 -0
- package/dist/cjs/node/prerender/runPrerender.js +1 -0
- package/dist/cjs/node/runtime/globalContext.js +8 -19
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +1 -3
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +2 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +8 -9
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -23
- package/dist/cjs/node/shared/assertPluginManifest.js +1 -4
- package/dist/cjs/node/shared/assertV1Design.js +26 -0
- package/dist/cjs/node/shared/utils.js +2 -0
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/node/plugin/plugins/envVars.js +6 -2
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +11 -4
- package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +2 -2
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.d.ts +1 -2
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.js +2 -19
- package/dist/esm/node/plugin/plugins/importBuild/index.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +13 -93
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +1 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +3 -1
- package/dist/esm/node/plugin/plugins/setGlobalContext.js +1 -15
- package/dist/esm/node/plugin/shared/rollupSourceMap.d.ts +14 -0
- package/dist/esm/node/plugin/shared/rollupSourceMap.js +17 -0
- package/dist/esm/node/prerender/runPrerender.js +2 -1
- package/dist/esm/node/runtime/globalContext.d.ts +3 -10
- package/dist/esm/node/runtime/globalContext.js +7 -18
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +1 -3
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +8 -9
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +3 -24
- package/dist/esm/node/shared/assertPluginManifest.d.ts +0 -1
- package/dist/esm/node/shared/assertPluginManifest.js +2 -5
- package/dist/esm/node/shared/assertV1Design.d.ts +4 -0
- package/dist/esm/node/shared/assertV1Design.js +23 -0
- package/dist/esm/node/shared/utils.d.ts +2 -0
- package/dist/esm/node/shared/utils.js +2 -0
- package/dist/esm/shared/page-configs/PageConfig.d.ts +1 -3
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/node/plugin/shared/removeSourceMap.js +0 -12
- package/dist/esm/node/plugin/shared/removeSourceMap.d.ts +0 -7
- package/dist/esm/node/plugin/shared/removeSourceMap.js +0 -9
|
@@ -6,7 +6,7 @@ export { getRenderContext };
|
|
|
6
6
|
import { getErrorPageId } from '../../../shared/error-page.js';
|
|
7
7
|
import { getHtmlString } from '../html/renderHtml.js';
|
|
8
8
|
import { getPageFilesAll } from '../../../shared/getPageFiles.js';
|
|
9
|
-
import { assert, assertUsage,
|
|
9
|
+
import { assert, assertUsage, hasProp, objectAssign } from '../utils.js';
|
|
10
10
|
import { serializePageContextClientSide } from '../html/serializePageContextClientSide.js';
|
|
11
11
|
import { addUrlComputedProps } from '../../../shared/addUrlComputedProps.js';
|
|
12
12
|
import { getGlobalContext } from '../globalContext.js';
|
|
@@ -20,8 +20,8 @@ import { preparePageContextForUserConsumptionServerSide } from './preparePageCon
|
|
|
20
20
|
import { executeGuardHook } from '../../../shared/route/executeGuardHook.js';
|
|
21
21
|
import { loadPageRoutes } from '../../../shared/route/loadPageRoutes.js';
|
|
22
22
|
import pc from '@brillout/picocolors';
|
|
23
|
-
import { getConfigValueFilePathToShowToUser } from '../../../shared/page-configs/helpers.js';
|
|
24
23
|
import { isServerSideError } from '../../../shared/misc/isServerSideError.js';
|
|
24
|
+
import { assertV1Design } from '../../shared/assertV1Design.js';
|
|
25
25
|
async function renderPageAlreadyRouted(pageContext) {
|
|
26
26
|
// pageContext._pageId can either be the:
|
|
27
27
|
// - ID of the page matching the routing, or the
|
|
@@ -151,7 +151,7 @@ async function getRenderContext() {
|
|
|
151
151
|
const globalContext = getGlobalContext();
|
|
152
152
|
const { pageFilesAll, allPageIds, pageConfigs, pageConfigGlobal } = await getPageFilesAll(false, globalContext.isProduction);
|
|
153
153
|
const { pageRoutes, onBeforeRouteHook } = await loadPageRoutes(pageFilesAll, pageConfigs, pageConfigGlobal, allPageIds);
|
|
154
|
-
assertV1Design(pageFilesAll, pageConfigs);
|
|
154
|
+
assertV1Design(pageFilesAll.length > 0, pageConfigs, pageFilesAll);
|
|
155
155
|
const renderContext = {
|
|
156
156
|
pageFilesAll: pageFilesAll,
|
|
157
157
|
pageConfigs,
|
|
@@ -162,24 +162,3 @@ async function getRenderContext() {
|
|
|
162
162
|
};
|
|
163
163
|
return renderContext;
|
|
164
164
|
}
|
|
165
|
-
function assertV1Design(pageFilesAll, pageConfigs) {
|
|
166
|
-
const isV1Design = pageConfigs.length !== 0;
|
|
167
|
-
const isDesignOld = pageFilesAll.length !== 0;
|
|
168
|
-
if (isV1Design && isDesignOld) {
|
|
169
|
-
const indent = '- ';
|
|
170
|
-
const v1Files = unique(pageConfigs
|
|
171
|
-
.map((p) => Object.values(p.configValues)
|
|
172
|
-
.map(getConfigValueFilePathToShowToUser)
|
|
173
|
-
.filter(isNotNullish)
|
|
174
|
-
.map((filePathToShowToUser) => indent + filePathToShowToUser))
|
|
175
|
-
.flat(2));
|
|
176
|
-
assertUsage(false, [
|
|
177
|
-
'Mixing the new V1 design with the old V0.4 design is forbidden.',
|
|
178
|
-
'V1 files:',
|
|
179
|
-
...v1Files,
|
|
180
|
-
'V0.4 files:',
|
|
181
|
-
...pageFilesAll.map((p) => indent + p.filePath)
|
|
182
|
-
].join('\n'));
|
|
183
|
-
}
|
|
184
|
-
assertWarning(!isDesignOld, "You are using Vike's deprecated design. Update to the new V1 design, see https://vike.dev/migration/v1-design for how to migrate.", { onlyOnce: true });
|
|
185
|
-
}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
export { assertPluginManifest };
|
|
2
2
|
import { assertRuntimeManifest } from './assertRuntimeManifest.js';
|
|
3
|
-
import { assert, assertUsage, isPlainObject, projectInfo, checkType, hasProp
|
|
3
|
+
import { assert, assertUsage, isPlainObject, projectInfo, checkType, hasProp } from './utils.js';
|
|
4
4
|
function assertPluginManifest(pluginManifest) {
|
|
5
5
|
assert(isPlainObject(pluginManifest));
|
|
6
6
|
assertUsage(pluginManifest.version === projectInfo.projectVersion, `Re-build your app (you're using vike@${projectInfo.projectVersion} but your app was built with vike@${pluginManifest.version})`);
|
|
7
7
|
assertRuntimeManifest(pluginManifest);
|
|
8
8
|
assert(hasProp(pluginManifest, 'usesClientRouter', 'boolean'));
|
|
9
9
|
assert(hasProp(pluginManifest, 'version', 'string'));
|
|
10
|
-
assert(hasProp(pluginManifest, 'manifestKeyMap', 'object'));
|
|
11
|
-
const { manifestKeyMap } = pluginManifest;
|
|
12
|
-
assert(isStringRecord(manifestKeyMap));
|
|
13
10
|
// Avoid:
|
|
14
11
|
// ```
|
|
15
12
|
// Uncaught (in promise) TypeError: Cannot set property manifestKeyMap of #<Object> which has only a getter
|
|
16
13
|
// ```
|
|
14
|
+
// We removed manifestKeyMap, maybe this isn't needed anymore.
|
|
17
15
|
// See https://github.com/vikejs/vike/issues/596
|
|
18
16
|
const pluginManifestClone = { ...pluginManifest };
|
|
19
|
-
objectAssign(pluginManifestClone, { manifestKeyMap });
|
|
20
17
|
checkType(pluginManifestClone);
|
|
21
18
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { assertV1Design };
|
|
2
|
+
import { PageFile } from '../../shared/getPageFiles.js';
|
|
3
|
+
import type { PageConfigBuildTime, PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
|
|
4
|
+
declare function assertV1Design(isOldDesign: boolean, pageConfigs: (PageConfigRuntime | PageConfigBuildTime)[], pageFilesAll?: PageFile[]): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { assertV1Design };
|
|
2
|
+
import { getConfigValueFilePathToShowToUser } from '../../shared/page-configs/helpers.js';
|
|
3
|
+
import { assert, assertUsage, assertWarning, isNotNullish, unique } from './utils.js';
|
|
4
|
+
function assertV1Design(isOldDesign, pageConfigs, pageFilesAll) {
|
|
5
|
+
const isV1Design = pageConfigs.length > 0;
|
|
6
|
+
if (isV1Design && isOldDesign) {
|
|
7
|
+
const lines = ['Mixing the new V1 design with the old V0.4 design is forbidden.'];
|
|
8
|
+
if (pageFilesAll) {
|
|
9
|
+
assert(pageFilesAll.length > 0);
|
|
10
|
+
const indent = '- ';
|
|
11
|
+
const filesV1 = unique(pageConfigs
|
|
12
|
+
.map((p) => Object.values(p.configValues)
|
|
13
|
+
.map(getConfigValueFilePathToShowToUser)
|
|
14
|
+
.filter(isNotNullish)
|
|
15
|
+
.map((filePathToShowToUser) => indent + filePathToShowToUser))
|
|
16
|
+
.flat(2));
|
|
17
|
+
const filesOld = pageFilesAll.map((p) => indent + p.filePath);
|
|
18
|
+
lines.push(...['V1 design files:', ...filesV1, 'Old design files:', ...filesOld]);
|
|
19
|
+
}
|
|
20
|
+
assertUsage(false, lines.join('\n'));
|
|
21
|
+
}
|
|
22
|
+
assertWarning(!isOldDesign, "You are using Vike's deprecated design. Update to the new V1 design, see https://vike.dev/migration/v1-design for how to migrate.", { onlyOnce: true });
|
|
23
|
+
}
|
|
@@ -13,3 +13,5 @@ export * from '../../utils/parseUrl-extras.js';
|
|
|
13
13
|
export * from '../../utils/isObject.js';
|
|
14
14
|
export * from '../../utils/virtual-files.js';
|
|
15
15
|
export * from '../../utils/assertIsNotBrowser.js';
|
|
16
|
+
export * from '../../utils/isNotNullish.js';
|
|
17
|
+
export * from '../../utils/unique.js';
|
|
@@ -15,3 +15,5 @@ export * from '../../utils/parseUrl-extras.js';
|
|
|
15
15
|
export * from '../../utils/isObject.js';
|
|
16
16
|
export * from '../../utils/virtual-files.js';
|
|
17
17
|
export * from '../../utils/assertIsNotBrowser.js';
|
|
18
|
+
export * from '../../utils/isNotNullish.js';
|
|
19
|
+
export * from '../../utils/unique.js';
|
|
@@ -25,11 +25,10 @@ type PageConfigBase = {
|
|
|
25
25
|
routeString: string;
|
|
26
26
|
definedBy: string;
|
|
27
27
|
};
|
|
28
|
+
configValues: ConfigValues;
|
|
28
29
|
};
|
|
29
30
|
/** Page config data structure available at runtime */
|
|
30
31
|
type PageConfigRuntime = PageConfigBase & {
|
|
31
|
-
/** All loaded config values */
|
|
32
|
-
configValues: ConfigValues;
|
|
33
32
|
/** Load config values that are lazily loaded such as config.Page */
|
|
34
33
|
loadConfigValuesAll: () => Promise<{
|
|
35
34
|
configValuesImported: ConfigValueImported[];
|
|
@@ -43,7 +42,6 @@ type PageConfigRuntimeLoaded = PageConfigRuntime & {
|
|
|
43
42
|
};
|
|
44
43
|
/** Page config data structure available at build-time */
|
|
45
44
|
type PageConfigBuildTime = PageConfigBase & {
|
|
46
|
-
configValues: ConfigValues;
|
|
47
45
|
configValueSources: ConfigValueSources;
|
|
48
46
|
configValuesComputed: ConfigValuesComputed;
|
|
49
47
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
|
-
declare const PROJECT_VERSION: "0.4.161-commit-
|
|
3
|
+
declare const PROJECT_VERSION: "0.4.161-commit-0e9c635";
|
|
4
4
|
declare const projectInfo: {
|
|
5
5
|
projectName: "Vike";
|
|
6
|
-
projectVersion: "0.4.161-commit-
|
|
6
|
+
projectVersion: "0.4.161-commit-0e9c635";
|
|
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.161-commit-
|
|
4
|
+
const PROJECT_VERSION = '0.4.161-commit-0e9c635';
|
|
5
5
|
const projectInfo = {
|
|
6
6
|
projectName: 'Vike',
|
|
7
7
|
projectVersion: PROJECT_VERSION
|
package/package.json
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeSourceMap = void 0;
|
|
4
|
-
function removeSourceMap(code) {
|
|
5
|
-
return {
|
|
6
|
-
code,
|
|
7
|
-
// Remove Source Map to save KBs
|
|
8
|
-
// - https://rollupjs.org/guide/en/#source-code-transformations
|
|
9
|
-
map: { mappings: '' }
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
exports.removeSourceMap = removeSourceMap;
|