vike 0.4.144-commit-756f5d7 → 0.4.144-commit-f7ab002
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/buildConfig.js +2 -2
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +3 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +4 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +12 -12
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +152 -152
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +13 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/helpers.js +1 -14
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.js +2 -4
- package/dist/cjs/node/plugin/plugins/previewConfig.js +6 -2
- package/dist/cjs/node/prerender/runPrerender.js +8 -8
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +19 -6
- package/dist/cjs/node/runtime/renderPage/log404/index.js +27 -17
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -2
- package/dist/cjs/node/shared/getClientEntryFilePath.js +2 -2
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +4 -6
- package/dist/cjs/shared/getPageFiles/getExports.js +3 -3
- package/dist/cjs/shared/hooks/getHook.js +1 -1
- package/dist/cjs/shared/page-configs/getExportPath.js +3 -3
- package/dist/cjs/shared/page-configs/helpers/getConfigDefinedAtString.js +43 -0
- package/dist/cjs/shared/page-configs/helpers/getConfigValue.js +44 -0
- package/dist/cjs/shared/page-configs/helpers.js +33 -0
- package/dist/cjs/shared/page-configs/loadConfigValues.js +2 -2
- package/dist/cjs/shared/page-configs/serialize/parseConfigValuesImported.js +6 -8
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -2
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValue.js +9 -10
- package/dist/cjs/shared/route/abort.js +1 -1
- package/dist/cjs/shared/route/loadPageRoutes.js +11 -10
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/cjs/utils/truncateString.js +12 -7
- package/dist/esm/client/client-routing-runtime/getPageContext.js +1 -1
- package/dist/esm/node/plugin/plugins/buildConfig.js +1 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
- package/dist/esm/node/plugin/plugins/importBuild/index.js +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +2 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +4 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +12 -12
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +152 -152
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +14 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/helpers.js +1 -14
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.js +2 -4
- package/dist/esm/node/plugin/plugins/previewConfig.js +6 -2
- package/dist/esm/node/prerender/runPrerender.js +2 -2
- package/dist/esm/node/runtime/html/serializePageContextClientSide.js +20 -7
- package/dist/esm/node/runtime/renderPage/log404/index.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/log404/index.js +27 -16
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +1 -1
- package/dist/esm/node/shared/getClientEntryFilePath.js +1 -1
- package/dist/esm/shared/getPageFiles/analyzeClientSide.js +2 -4
- package/dist/esm/shared/getPageFiles/getExports.js +2 -2
- package/dist/esm/shared/hooks/getHook.js +1 -1
- package/dist/esm/shared/page-configs/PageConfig.d.ts +53 -31
- package/dist/esm/shared/page-configs/getExportPath.d.ts +1 -1
- package/dist/esm/shared/page-configs/getExportPath.js +3 -3
- package/dist/esm/shared/page-configs/helpers/getConfigDefinedAtString.d.ts +7 -0
- package/dist/esm/shared/page-configs/helpers/getConfigDefinedAtString.js +37 -0
- package/dist/esm/shared/page-configs/helpers/getConfigValue.d.ts +14 -0
- package/dist/esm/shared/page-configs/helpers/getConfigValue.js +38 -0
- package/dist/esm/shared/page-configs/helpers.d.ts +13 -0
- package/dist/esm/shared/page-configs/helpers.js +27 -0
- package/dist/esm/shared/page-configs/loadConfigValues.js +2 -2
- package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.d.ts +4 -4
- package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.js +6 -8
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +2 -2
- package/dist/esm/shared/page-configs/serialize/serializeConfigValue.js +9 -10
- package/dist/esm/shared/route/abort.js +1 -1
- package/dist/esm/shared/route/loadPageRoutes.js +8 -7
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/dist/esm/utils/projectInfo.js +1 -1
- package/dist/esm/utils/truncateString.d.ts +2 -1
- package/dist/esm/utils/truncateString.js +10 -7
- package/package.json +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.js +0 -16
- package/dist/cjs/shared/page-configs/utils.js +0 -103
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.d.ts +0 -24
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.js +0 -13
- package/dist/esm/shared/page-configs/utils.d.ts +0 -35
- package/dist/esm/shared/page-configs/utils.js +0 -97
|
@@ -7,7 +7,7 @@ exports.analyzeClientEntries = exports.assertRollupInput = exports.buildConfig =
|
|
|
7
7
|
const utils_js_1 = require("../utils.js");
|
|
8
8
|
const virtualFileImportUserCode_js_1 = require("../../shared/virtual-files/virtualFileImportUserCode.js");
|
|
9
9
|
const getVikeConfig_js_1 = require("./importUserCode/v1-design/getVikeConfig.js");
|
|
10
|
-
const
|
|
10
|
+
const helpers_js_1 = require("../../../shared/page-configs/helpers.js");
|
|
11
11
|
const findPageFiles_js_1 = require("../shared/findPageFiles.js");
|
|
12
12
|
const getConfigVike_js_1 = require("../../shared/getConfigVike.js");
|
|
13
13
|
const virtualFilePageConfigValuesAll_js_1 = require("../../shared/virtual-files/virtualFilePageConfigValuesAll.js");
|
|
@@ -112,7 +112,7 @@ function analyzeClientEntries(pageConfigs, config) {
|
|
|
112
112
|
let clientEntries = {};
|
|
113
113
|
let clientFilePaths = [];
|
|
114
114
|
pageConfigs.forEach((pageConfig) => {
|
|
115
|
-
const configValue = (0,
|
|
115
|
+
const configValue = (0, helpers_js_1.getConfigValue)(pageConfig, 'clientRouting', 'boolean');
|
|
116
116
|
if (configValue?.value) {
|
|
117
117
|
hasClientRouting = true;
|
|
118
118
|
}
|
|
@@ -37,18 +37,18 @@ async function getPageDeps(config, pageConfigs, isDev) {
|
|
|
37
37
|
configValueSourcesRelevant.forEach((configValueSource) => {
|
|
38
38
|
if (!configValueSource.valueIsImportedAtRuntime)
|
|
39
39
|
return;
|
|
40
|
-
const {
|
|
40
|
+
const { definedAt, configEnv } = configValueSource;
|
|
41
41
|
if (configEnv !== 'client-only' && configEnv !== 'server-and-client')
|
|
42
42
|
return;
|
|
43
|
-
if (
|
|
44
|
-
const { filePathAbsoluteFilesystem } =
|
|
43
|
+
if (definedAt.filePathRelativeToUserRootDir !== null) {
|
|
44
|
+
const { filePathAbsoluteFilesystem } = definedAt;
|
|
45
45
|
(0, utils_js_1.assert)(filePathAbsoluteFilesystem);
|
|
46
46
|
// Surprisingly Vite expects entries to be absolute paths
|
|
47
47
|
entries.push(filePathAbsoluteFilesystem);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
// Adding
|
|
51
|
-
const { importPathAbsolute } =
|
|
50
|
+
// Adding definedAt.filePathAbsoluteFilesystem doesn't work for npm packages, I guess because of Vite's config.server.fs.allow
|
|
51
|
+
const { importPathAbsolute } = definedAt;
|
|
52
52
|
(0, utils_js_1.assert)(importPathAbsolute);
|
|
53
53
|
// We need to differentiate between npm package imports and path aliases.
|
|
54
54
|
// There are path aliases that cannot be distinguished from npm package names.
|
|
@@ -32,15 +32,15 @@ function importBuild() {
|
|
|
32
32
|
}
|
|
33
33
|
exports.importBuild = importBuild;
|
|
34
34
|
function getImporterCode(config, pageFilesEntry) {
|
|
35
|
-
const
|
|
35
|
+
const filePathAbsolute = (0, utils_js_1.toPosixPath)(
|
|
36
36
|
// [RELATIVE_PATH_FROM_DIST] Current file: node_modules/vike/dist/esm/node/plugin/plugins/importBuild/index.js
|
|
37
37
|
require_.resolve(`../../../../../../dist/esm/node/runtime/globalContext/loadImportBuild.js`));
|
|
38
38
|
const { outDirServer } = (0, utils_js_1.getOutDirs)(config);
|
|
39
|
-
const
|
|
39
|
+
const filePathRelative = path_1.default.posix.relative(outDirServer, filePathAbsolute);
|
|
40
40
|
// The only reason we went for using CJS require() instead of ESM import() is because import() doesn't support .json files
|
|
41
41
|
const importerCode = [
|
|
42
42
|
'(async () => {',
|
|
43
|
-
` const { setImportBuildGetters } = await import('${
|
|
43
|
+
` const { setImportBuildGetters } = await import('${filePathRelative}');`,
|
|
44
44
|
' setImportBuildGetters({',
|
|
45
45
|
` pageFiles: () => import('./${pageFilesEntry}'),`,
|
|
46
46
|
" clientManifest: () => require('../assets.json'),",
|
|
@@ -49,16 +49,17 @@ const configDefinitionsBuiltIn = {
|
|
|
49
49
|
_valueIsFilePath: true
|
|
50
50
|
},
|
|
51
51
|
clientRouting: {
|
|
52
|
-
|
|
52
|
+
// We could make it 'server-only' (we don't yet because of some legacy V0.4 design code)
|
|
53
|
+
env: 'server-and-client'
|
|
53
54
|
},
|
|
54
55
|
prerender: {
|
|
55
56
|
env: 'server-only'
|
|
56
57
|
},
|
|
57
58
|
hydrationCanBeAborted: {
|
|
58
|
-
env: 'client-only'
|
|
59
|
+
env: 'client-only'
|
|
59
60
|
},
|
|
60
61
|
prefetchStaticAssets: {
|
|
61
|
-
env: 'client-only'
|
|
62
|
+
env: 'client-only'
|
|
62
63
|
},
|
|
63
64
|
extends: {
|
|
64
65
|
env: 'config-only'
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js
CHANGED
|
@@ -7,8 +7,8 @@ const utils_js_1 = require("../../../../utils.js");
|
|
|
7
7
|
* getLocationId('/pages/some-page') => '/pages/some-page'
|
|
8
8
|
* getLocationId('/renderer/+config.js') => '/renderer'
|
|
9
9
|
*/
|
|
10
|
-
function getLocationId(
|
|
11
|
-
const locationId = removeFilename(
|
|
10
|
+
function getLocationId(filePathAbsoluteVite) {
|
|
11
|
+
const locationId = removeFilename(filePathAbsoluteVite, true);
|
|
12
12
|
assertLocationId(locationId);
|
|
13
13
|
return locationId;
|
|
14
14
|
}
|
|
@@ -110,21 +110,21 @@ function removeDirectories(somePath, removeDirs) {
|
|
|
110
110
|
somePath = '/';
|
|
111
111
|
return somePath;
|
|
112
112
|
}
|
|
113
|
-
function removeFilename(
|
|
114
|
-
(0, utils_js_1.assertPosixPath)(
|
|
115
|
-
(0, utils_js_1.assert)(
|
|
113
|
+
function removeFilename(filePathAbsoluteVite, optional) {
|
|
114
|
+
(0, utils_js_1.assertPosixPath)(filePathAbsoluteVite);
|
|
115
|
+
(0, utils_js_1.assert)(filePathAbsoluteVite.startsWith('/') || (0, utils_js_1.isNpmPackageImport)(filePathAbsoluteVite));
|
|
116
116
|
{
|
|
117
|
-
const filename =
|
|
117
|
+
const filename = filePathAbsoluteVite.split('/').slice(-1)[0];
|
|
118
118
|
if (!filename.includes('.')) {
|
|
119
119
|
(0, utils_js_1.assert)(optional);
|
|
120
|
-
return
|
|
120
|
+
return filePathAbsoluteVite;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
assertLocationId(
|
|
127
|
-
return
|
|
123
|
+
let locationId = filePathAbsoluteVite.split('/').slice(0, -1).join('/');
|
|
124
|
+
if (locationId === '')
|
|
125
|
+
locationId = '/';
|
|
126
|
+
assertLocationId(locationId);
|
|
127
|
+
return locationId;
|
|
128
128
|
}
|
|
129
129
|
function getFilesystemRouteDefinedBy(locationId) {
|
|
130
130
|
if (locationId === '/')
|