vike 0.4.246 → 0.4.247-commit-903de25
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/esm/client/runtime-client-routing/getPageContextFromHooks.js +28 -21
- package/dist/esm/node/api/resolveViteConfigFromUser.js +1 -1
- package/dist/esm/node/shared/virtualFileId.js +19 -18
- package/dist/esm/node/vite/plugins/pluginDev/determineOptimizeDeps.js +29 -5
- package/dist/esm/node/vite/plugins/pluginDev.js +7 -24
- package/dist/esm/node/vite/plugins/pluginViteConfigVikeExtensions.js +2 -0
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +9 -0
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/resolvePointerImport.js +3 -1
- package/dist/esm/types/Config.d.ts +1 -1
- package/dist/esm/types/defineConfig.d.ts +1 -1
- package/dist/esm/types/defineConfig.js +2 -0
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assert.js +1 -1
- package/dist/esm/utils/requireResolve.d.ts +1 -1
- package/package.json +3 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// TODO/now: rename
|
|
1
2
|
export { getPageContextFromHooks_isHydration };
|
|
2
3
|
export { getPageContextFromHooks_serialized };
|
|
3
4
|
export { getPageContextFromServerHooks };
|
|
@@ -20,6 +21,10 @@ import { isServerSideError } from '../../shared/misc/isServerSideError.js';
|
|
|
20
21
|
import { execHook } from '../../shared/hooks/execHook.js';
|
|
21
22
|
import { preparePageContextForPublicUsageClient, } from './preparePageContextForPublicUsageClient.js';
|
|
22
23
|
const globalObject = getGlobalObject('runtime-client-routing/getPageContextFromHooks.ts', {});
|
|
24
|
+
// TO-DO/soon/cumulative-hooks: filter & execute all client-only hooks (see other TO-DO/soon/cumulative-hooks entries)
|
|
25
|
+
// - The client-side needs to know what hooks are client-only
|
|
26
|
+
// - Possible implementation: new computed prop `clientOnlyHooks: string[]` (list of hook ids) and add `hookId` to serialized config values
|
|
27
|
+
const clientHooks = ['guard', 'data', 'onBeforeRender'];
|
|
23
28
|
// TO-DO/eventually: rename
|
|
24
29
|
function getPageContextFromHooks_serialized() {
|
|
25
30
|
const pageContextSerialized = getPageContextSerializedInHtml();
|
|
@@ -31,11 +36,13 @@ function getPageContextFromHooks_serialized() {
|
|
|
31
36
|
}
|
|
32
37
|
// TO-DO/eventually: rename
|
|
33
38
|
async function getPageContextFromHooks_isHydration(pageContext) {
|
|
34
|
-
for (const hookName of
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
for (const hookName of clientHooks) {
|
|
40
|
+
if (!hookClientOnlyExists(hookName, pageContext))
|
|
41
|
+
continue;
|
|
42
|
+
if (hookName === 'guard') {
|
|
43
|
+
await execHookGuardClient(pageContext);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
39
46
|
await execHookDataLike(hookName, pageContext);
|
|
40
47
|
}
|
|
41
48
|
}
|
|
@@ -73,24 +80,18 @@ async function getPageContextFromClientHooks(pageContext, isErrorPage) {
|
|
|
73
80
|
// server-side, so we run only the client-only ones in this case.
|
|
74
81
|
// Note: for the error page, we also execute the client-side data() and onBeforeRender() hooks, but maybe we
|
|
75
82
|
// shouldn't? The server-side does it as well (but maybe it shouldn't).
|
|
76
|
-
for (const hookName of
|
|
83
|
+
for (const hookName of clientHooks) {
|
|
84
|
+
if (!hookClientOnlyExists(hookName, pageContext) && pageContext._hasPageContextFromServer)
|
|
85
|
+
continue;
|
|
77
86
|
if (hookName === 'guard') {
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// Should we really call the guard() hook on the client-side? Shouldn't we make the guard() hook a server-side
|
|
82
|
-
// only hook? Or maybe make its env configurable like data() and onBeforeRender()?
|
|
83
|
-
await execHookGuard(pageContext, (pageContext) => preparePageContextForPublicUsageClient(pageContext));
|
|
84
|
-
}
|
|
87
|
+
if (isErrorPage)
|
|
88
|
+
continue;
|
|
89
|
+
await execHookGuardClient(pageContext);
|
|
85
90
|
}
|
|
86
91
|
else {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
dataHookExecuted = true;
|
|
91
|
-
// This won't do anything if no hook has been defined or if the hook's env.client is false.
|
|
92
|
-
await execHookDataLike(hookName, pageContext);
|
|
93
|
-
}
|
|
92
|
+
if (hookName === 'data')
|
|
93
|
+
dataHookExecuted = true;
|
|
94
|
+
await execHookDataLike(hookName, pageContext);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
// Execute +onData
|
|
@@ -104,6 +105,9 @@ async function getPageContextFromClientHooks(pageContext, isErrorPage) {
|
|
|
104
105
|
async function execHookClient(hookName, pageContext) {
|
|
105
106
|
return await execHook(hookName, pageContext, (p) => preparePageContextForPublicUsageClient(p));
|
|
106
107
|
}
|
|
108
|
+
// It's a no-op if:
|
|
109
|
+
// - No hook has been defined, or
|
|
110
|
+
// - The hook's `env.client` is `false`
|
|
107
111
|
async function execHookDataLike(hookName, pageContext) {
|
|
108
112
|
let pageContextFromHook;
|
|
109
113
|
if (hookName === 'data') {
|
|
@@ -178,7 +182,7 @@ function hookClientOnlyExists(hookName, pageContext) {
|
|
|
178
182
|
}
|
|
179
183
|
function getHookEnv(hookName, pageContext) {
|
|
180
184
|
if (isOldDesign(pageContext)) {
|
|
181
|
-
// Client-only onBeforeRender() or
|
|
185
|
+
// Client-only onBeforeRender(), data(), or guard() hooks were never supported for the V0.4 design
|
|
182
186
|
return { client: false, server: true };
|
|
183
187
|
}
|
|
184
188
|
const pageConfig = getPageConfig(pageContext.pageId, pageContext._globalContext._pageConfigs);
|
|
@@ -225,3 +229,6 @@ function processPageContextFromServer(pageContext) {
|
|
|
225
229
|
function isOldDesign(pageContext) {
|
|
226
230
|
return pageContext._globalContext._pageConfigs.length === 0;
|
|
227
231
|
}
|
|
232
|
+
async function execHookGuardClient(pageContext) {
|
|
233
|
+
await execHookGuard(pageContext, (pageContext) => preparePageContextForPublicUsageClient(pageContext));
|
|
234
|
+
}
|
|
@@ -89,7 +89,7 @@ async function getViteInfo(viteConfigFromUserVikeApiOptions, viteContext) {
|
|
|
89
89
|
// Show a warning because Vike supports Vite's CLI (as well as third-party CLIs).
|
|
90
90
|
// - Encourage users to define a vite.config.js file that also works with Vite's CLI (and potentially other third-party CLIs).
|
|
91
91
|
// - Vike-based frameworks, such as DocPress, allow their users to omit defining a vite.config.js file.
|
|
92
|
-
assertWarning(viteConfigFromUserViteConfigFile, // Only show the warning if the user defined a vite.config.js file
|
|
92
|
+
assertWarning(!viteConfigFromUserViteConfigFile, // Only show the warning if the user defined a vite.config.js file
|
|
93
93
|
"Omitting Vike's Vite plugin (inside your vite.config.js) is deprecated — make sure to always add Vike's Vite plugin https://vike.dev/vite-plugin", { onlyOnce: true });
|
|
94
94
|
// Add Vike to plugins if not present.
|
|
95
95
|
// Using a dynamic import because the script calling the Vike API may not live in the same place as vite.config.js, thus vike/plugin may resolved to two different node_modules/vike directories.
|
|
@@ -30,24 +30,12 @@ const virtualFileIdPageEntryPrefix =
|
|
|
30
30
|
const virtualFileIdGlobalEntryPrefix =
|
|
31
31
|
//
|
|
32
32
|
'virtual:vike:global-entry:';
|
|
33
|
-
const virtualFileIdGlobalEntries = [
|
|
34
|
-
virtualFileIdGlobalEntryServer,
|
|
35
|
-
virtualFileIdGlobalEntryClientCR,
|
|
36
|
-
virtualFileIdGlobalEntryClientSR,
|
|
37
|
-
];
|
|
38
|
-
assert(virtualFileIdGlobalEntries.every((v) =>
|
|
39
|
-
//
|
|
40
|
-
v.startsWith(virtualFileIdGlobalEntryPrefix)));
|
|
41
|
-
assert([virtualFileIdPageEntryClient, virtualFileIdPageEntryServer].every((v) =>
|
|
42
|
-
//
|
|
43
|
-
v.startsWith(virtualFileIdPageEntryPrefix)));
|
|
44
33
|
function parseVirtualFileId(id) {
|
|
45
34
|
id = removeVirtualFileIdPrefix(id);
|
|
46
35
|
if (!id.startsWith(virtualFileIdGlobalEntryPrefix) && !id.startsWith(virtualFileIdPageEntryPrefix))
|
|
47
36
|
return false;
|
|
48
37
|
// Global entry
|
|
49
38
|
if (id.includes(virtualFileIdGlobalEntryPrefix)) {
|
|
50
|
-
assert(virtualFileIdGlobalEntries.includes(id));
|
|
51
39
|
const isForClientSide = id !== virtualFileIdGlobalEntryServer;
|
|
52
40
|
const isClientRouting = id === virtualFileIdGlobalEntryClientCR;
|
|
53
41
|
return {
|
|
@@ -58,23 +46,26 @@ function parseVirtualFileId(id) {
|
|
|
58
46
|
}
|
|
59
47
|
// Page entry
|
|
60
48
|
if (id.includes(virtualFileIdPageEntryPrefix)) {
|
|
61
|
-
assert(id.startsWith(virtualFileIdPageEntryPrefix));
|
|
62
49
|
const idOriginal = id;
|
|
63
50
|
id = extractAssetsRemoveQuery(id);
|
|
64
51
|
const isExtractAssets = idOriginal !== id;
|
|
65
52
|
if (id.startsWith(virtualFileIdPageEntryClient)) {
|
|
66
53
|
assert(isExtractAssets === false);
|
|
54
|
+
const pageIdSerialized = id.slice(virtualFileIdPageEntryClient.length);
|
|
55
|
+
const pageId = deserializePageId(pageIdSerialized);
|
|
67
56
|
return {
|
|
68
57
|
type: 'page-entry',
|
|
69
|
-
pageId
|
|
58
|
+
pageId,
|
|
70
59
|
isForClientSide: true,
|
|
71
60
|
isExtractAssets,
|
|
72
61
|
};
|
|
73
62
|
}
|
|
74
63
|
if (id.startsWith(virtualFileIdPageEntryServer)) {
|
|
64
|
+
const pageIdSerialized = id.slice(virtualFileIdPageEntryServer.length);
|
|
65
|
+
const pageId = deserializePageId(pageIdSerialized);
|
|
75
66
|
return {
|
|
76
67
|
type: 'page-entry',
|
|
77
|
-
pageId
|
|
68
|
+
pageId,
|
|
78
69
|
isForClientSide: false,
|
|
79
70
|
isExtractAssets,
|
|
80
71
|
};
|
|
@@ -86,7 +77,6 @@ function parseVirtualFileId(id) {
|
|
|
86
77
|
function generateVirtualFileId(args) {
|
|
87
78
|
if (args.type === 'global-entry') {
|
|
88
79
|
const { isForClientSide, isClientRouting } = args;
|
|
89
|
-
assert(typeof isClientRouting === 'boolean');
|
|
90
80
|
if (!isForClientSide) {
|
|
91
81
|
return virtualFileIdGlobalEntryServer;
|
|
92
82
|
}
|
|
@@ -99,9 +89,20 @@ function generateVirtualFileId(args) {
|
|
|
99
89
|
}
|
|
100
90
|
if (args.type === 'page-entry') {
|
|
101
91
|
const { pageId, isForClientSide } = args;
|
|
102
|
-
|
|
103
|
-
const id = `${isForClientSide ? virtualFileIdPageEntryClient : virtualFileIdPageEntryServer}${
|
|
92
|
+
const pageIdSerialized = serializePageId(pageId);
|
|
93
|
+
const id = `${isForClientSide ? virtualFileIdPageEntryClient : virtualFileIdPageEntryServer}${pageIdSerialized}`;
|
|
104
94
|
return id;
|
|
105
95
|
}
|
|
106
96
|
assert(false);
|
|
107
97
|
}
|
|
98
|
+
// Workaround:
|
|
99
|
+
// - We replace virtual:vike:page-entry:client:/ with virtual:vike:page-entry:client:ROOT
|
|
100
|
+
// - In order to avoid Vite to replace `virtual:vike:page-entry:client:/` with `virtual:vike:page-entry:client:`
|
|
101
|
+
// - I guess Vite/Rollup mistakenly treat the virtual ID as a path and tries to normalize id
|
|
102
|
+
const ROOT = 'ROOT';
|
|
103
|
+
function serializePageId(pageId) {
|
|
104
|
+
return pageId === '/' ? ROOT : pageId;
|
|
105
|
+
}
|
|
106
|
+
function deserializePageId(pageId) {
|
|
107
|
+
return pageId === ROOT ? '/' : pageId;
|
|
108
|
+
}
|
|
@@ -1,22 +1,46 @@
|
|
|
1
1
|
export { determineOptimizeDeps };
|
|
2
2
|
import { findPageFiles } from '../../shared/findPageFiles.js';
|
|
3
|
-
import { assert, assertIsImportPathNpmPackage, createDebugger, getNpmPackageName, isArray, isFilePathAbsoluteFilesystem, isVirtualFileId, } from '../../utils.js';
|
|
3
|
+
import { assert, assertIsImportPathNpmPackage, createDebugger, getNpmPackageName, isArray, isFilePathAbsoluteFilesystem, isVirtualFileId, requireResolveOptional, } from '../../utils.js';
|
|
4
4
|
import { getVikeConfigInternal } from '../../shared/resolveVikeConfigInternal.js';
|
|
5
5
|
import { analyzeClientEntries } from '../build/pluginBuildConfig.js';
|
|
6
6
|
import { virtualFileIdGlobalEntryClientCR, virtualFileIdGlobalEntryClientSR } from '../../../shared/virtualFileId.js';
|
|
7
7
|
import { getFilePathResolved } from '../../shared/getFilePath.js';
|
|
8
8
|
import { getConfigValueSourcesRelevant } from '../pluginVirtualFiles/getConfigValueSourcesRelevant.js';
|
|
9
9
|
const debug = createDebugger('vike:optimizeDeps');
|
|
10
|
+
const WORKAROUND_LATE_DISCOVERY = [
|
|
11
|
+
// Workaround for https://github.com/vitejs/vite-plugin-react/issues/650
|
|
12
|
+
// - The issue was closed as completed with https://github.com/vitejs/vite/pull/20495 but it doesn't fix the issue and the workaround is still needed.
|
|
13
|
+
// - TO-DO/eventually: try removing the workaround and see if the CI fails (at test/@cloudflare_vite-plugin/) — maybe the issue will get fixed at some point.
|
|
14
|
+
'react/jsx-dev-runtime',
|
|
15
|
+
// Workaround for https://github.com/vikejs/vike/issues/2823#issuecomment-3514325487
|
|
16
|
+
'@compiled/react/runtime',
|
|
17
|
+
];
|
|
10
18
|
async function determineOptimizeDeps(config) {
|
|
11
19
|
const vikeConfig = await getVikeConfigInternal();
|
|
12
20
|
const { _pageConfigs: pageConfigs } = vikeConfig;
|
|
13
21
|
const { entriesClient, entriesServer, includeClient, includeServer } = await getPageDeps(config, pageConfigs);
|
|
22
|
+
WORKAROUND_LATE_DISCOVERY.forEach((dep) => {
|
|
23
|
+
const userRootDir = config.root;
|
|
24
|
+
const resolved = requireResolveOptional({ importPath: dep, userRootDir, importerFilePath: null });
|
|
25
|
+
const resolvedInsideRepo = resolved && resolved.startsWith(userRootDir);
|
|
26
|
+
if (resolvedInsideRepo) {
|
|
27
|
+
// We add `dep` only if `resolvedInsideRepo === true` otherwise Vite logs a warning like the following.
|
|
28
|
+
// - ```console
|
|
29
|
+
// [11:22:42.464][/examples/vue-full][npm run dev][stderr] Failed to resolve dependency: react/jsx-dev-runtime, present in client 'optimizeDeps.include'
|
|
30
|
+
// ```
|
|
31
|
+
// - ```console
|
|
32
|
+
// [12:24:53.225][/test/@cloudflare_vite-plugin/test-dev.test.ts][npm run dev][stderr] Failed to resolve dependency: @compiled/react/runtime, present in ssr 'optimizeDeps.include'
|
|
33
|
+
// ```
|
|
34
|
+
includeClient.push(dep);
|
|
35
|
+
includeServer.push(dep);
|
|
36
|
+
}
|
|
37
|
+
else if (config.optimizeDeps.include?.includes(dep)) {
|
|
38
|
+
// Monorepo => always `resolvedInsideRepo === false` — we use this other approach to workaround missing 'react/jsx-dev-runtime'
|
|
39
|
+
includeServer.push(dep);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
14
42
|
config.optimizeDeps.include = add(config.optimizeDeps.include, includeClient);
|
|
15
43
|
config.optimizeDeps.entries = add(config.optimizeDeps.entries, entriesClient);
|
|
16
|
-
// Workaround for https://github.com/vitejs/vite-plugin-react/issues/650
|
|
17
|
-
// - The issue was closed as completed with https://github.com/vitejs/vite/pull/20495 but it doesn't fix the issue and the workaround is still needed.
|
|
18
|
-
// - TO-DO/eventually: try removing the workaround and see if the CI fails (at test/@cloudflare_vite-plugin/) — maybe the issue will get fixed at some point.
|
|
19
|
-
includeServer.push('react/jsx-dev-runtime');
|
|
20
44
|
for (const envName in config.environments) {
|
|
21
45
|
const env = config.environments[envName];
|
|
22
46
|
if (env.consumer === 'server' && env.optimizeDeps.noDiscovery === false) {
|
|
@@ -21,38 +21,21 @@ function pluginDev() {
|
|
|
21
21
|
handler() {
|
|
22
22
|
return {
|
|
23
23
|
appType: 'custom',
|
|
24
|
-
// TO-DO/next-major-release: remove (AFAICT we only need to use config.optimizeDeps for the old design)
|
|
25
24
|
optimizeDeps: {
|
|
26
25
|
exclude: [
|
|
27
|
-
// We exclude Vike's client runtime
|
|
26
|
+
// We must exclude Vike's client runtime so it can import virtual modules
|
|
28
27
|
'vike/client',
|
|
29
28
|
'vike/client/router',
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
//
|
|
33
|
-
// ```
|
|
34
|
-
'vike/routing',
|
|
35
|
-
'vike/getPageContext',
|
|
36
|
-
// We exclude @brillout/json-serializer and @brillout/picocolors to avoid:
|
|
29
|
+
],
|
|
30
|
+
include: [
|
|
31
|
+
// Avoid:
|
|
37
32
|
// ```
|
|
38
33
|
// 9:28:58 AM [vite] ✨ new dependencies optimized: @brillout/json-serializer/parse
|
|
39
34
|
// 9:28:58 AM [vite] ✨ optimized dependencies changed. reloading
|
|
40
35
|
// ```
|
|
41
|
-
'@brillout/json-serializer/parse',
|
|
42
|
-
'@brillout/json-serializer/stringify',
|
|
43
|
-
'@brillout/picocolors',
|
|
44
|
-
// We exclude all packages that depend on any optimizeDeps.exclude entry because, otherwise, the entry cannot be resolved when using pnpm. For example:
|
|
45
|
-
// ```
|
|
46
|
-
// Failed to resolve import "@brillout/json-serializer/parse" from "../../packages/vike-react-query/dist/renderer/VikeReactQueryWrapper.js". Does the file exist?
|
|
47
|
-
// 343| // ../../node_modules/.pnpm/react-streaming@0.3.16_react-dom@18.2.0_react@18.2.0/node_modules/react-streaming/dist/esm/client/useAsync.js
|
|
48
|
-
// 344| import { parse as parse2 } from "@brillout/json-serializer/parse";
|
|
49
|
-
// ```
|
|
50
|
-
// The source map is confusing, the import actually lives at node_modules/.vite/deps/vike-react-query_renderer_VikeReactQueryWrapper.js which contains:
|
|
51
|
-
// ```js
|
|
52
|
-
// // ../../node_modules/.pnpm/react-streaming@0.3.16_react-dom@18.2.0_react@18.2.0/node_modules/react-streaming/dist/esm/client/useAsync.js
|
|
53
|
-
// import { parse as parse2 } from "@brillout/json-serializer/parse";
|
|
54
|
-
// ```
|
|
55
|
-
'react-streaming',
|
|
36
|
+
'vike > @brillout/json-serializer/parse',
|
|
37
|
+
'vike > @brillout/json-serializer/stringify',
|
|
38
|
+
'vike > @brillout/picocolors',
|
|
56
39
|
],
|
|
57
40
|
},
|
|
58
41
|
};
|
|
@@ -21,6 +21,8 @@ async function pluginViteConfigVikeExtensions() {
|
|
|
21
21
|
}));
|
|
22
22
|
const pluginsFromExtensions = (viteConfigFromExtensions.plugins ?? []);
|
|
23
23
|
delete viteConfigFromExtensions.plugins;
|
|
24
|
+
// Avoid infinite loop
|
|
25
|
+
assertUsage(!pluginsFromExtensions.some((p) => p.name?.startsWith('vike:')), "Adding Vike's Vite plugin using +vite is forbidden");
|
|
24
26
|
return [
|
|
25
27
|
...pluginsFromExtensions,
|
|
26
28
|
{
|
|
@@ -142,6 +142,7 @@ const configDefinitionsBuiltIn = {
|
|
|
142
142
|
!!getConfigEnv(pageConfig, 'Page')?.client);
|
|
143
143
|
},
|
|
144
144
|
},
|
|
145
|
+
// TODO/now: rename entries comments
|
|
145
146
|
// TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
|
|
146
147
|
onBeforeRenderEnv: {
|
|
147
148
|
env: { client: true },
|
|
@@ -158,6 +159,14 @@ const configDefinitionsBuiltIn = {
|
|
|
158
159
|
return !isConfigSet(pageConfig, 'data') ? null : getConfigEnv(pageConfig, 'data');
|
|
159
160
|
},
|
|
160
161
|
},
|
|
162
|
+
// TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
|
|
163
|
+
guardEnv: {
|
|
164
|
+
env: { client: true },
|
|
165
|
+
eager: true,
|
|
166
|
+
_computed: (pageConfig) => {
|
|
167
|
+
return !isConfigSet(pageConfig, 'guard') ? null : getConfigEnv(pageConfig, 'guard');
|
|
168
|
+
},
|
|
169
|
+
},
|
|
161
170
|
hooksTimeout: {
|
|
162
171
|
env: { server: true, client: true },
|
|
163
172
|
},
|
|
@@ -73,8 +73,10 @@ function resolveImportPathWithNode(pointerImportData, importerFilePath, userRoot
|
|
|
73
73
|
});
|
|
74
74
|
if (!filePathAbsoluteFilesystem) {
|
|
75
75
|
assert(!isImportPathRelative(pointerImportData.importPath));
|
|
76
|
+
/* This assertion fails if the npm package has a wrongly defined package.json#exports
|
|
76
77
|
// Libraries don't use path aliases => filePathAbsoluteFilesystem should be defined
|
|
77
|
-
assert(!importerFilePathAbsolute.includes('node_modules'))
|
|
78
|
+
assert(!importerFilePathAbsolute.includes('node_modules'))
|
|
79
|
+
*/
|
|
78
80
|
}
|
|
79
81
|
return filePathAbsoluteFilesystem;
|
|
80
82
|
}
|
|
@@ -52,7 +52,7 @@ type HookName = HookNamePage | HookNameGlobal;
|
|
|
52
52
|
type HookNamePage = 'onHydrationEnd' | 'onBeforePrerenderStart' | 'onBeforeRender' | 'onPageTransitionStart' | 'onPageTransitionEnd' | 'onRenderHtml' | 'onRenderClient' | 'guard' | 'data' | 'onData' | 'route';
|
|
53
53
|
type HookNameGlobal = 'onBeforeRoute' | 'onPrerenderStart' | 'onCreatePageContext' | 'onCreateGlobalContext' | 'onError';
|
|
54
54
|
type HookNameOldDesign = 'render' | 'prerender' | 'onBeforePrerender';
|
|
55
|
-
type ConfigNameBuiltIn = Exclude<keyof ConfigBuiltIn, keyof VikeVitePluginOptions | 'onBeforeRoute' | 'onPrerenderStart' | 'vite' | 'redirects'> | 'prerender' | 'hasServerOnlyHook' | 'isClientRuntimeLoaded' | 'onBeforeRenderEnv' | 'dataEnv' | 'hooksTimeout' | 'clientHooks' | 'middleware';
|
|
55
|
+
type ConfigNameBuiltIn = Exclude<keyof ConfigBuiltIn, keyof VikeVitePluginOptions | 'onBeforeRoute' | 'onPrerenderStart' | 'vite' | 'redirects'> | 'prerender' | 'hasServerOnlyHook' | 'isClientRuntimeLoaded' | 'onBeforeRenderEnv' | 'dataEnv' | 'guardEnv' | 'hooksTimeout' | 'clientHooks' | 'middleware';
|
|
56
56
|
type ConfigNameGlobal = 'onPrerenderStart' | 'onBeforeRoute' | 'prerender' | 'disableAutoFullBuild' | 'includeAssetsImportedByServer' | 'baseAssets' | 'baseServer' | 'redirects' | 'trailingSlash' | 'disableUrlNormalization' | 'vite';
|
|
57
57
|
type Config = ConfigBuiltIn & Vike.Config;
|
|
58
58
|
/** @deprecated This type is deprecated, see:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.247-commit-903de25";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.247-commit-903de25';
|
package/dist/esm/utils/assert.js
CHANGED
|
@@ -41,7 +41,7 @@ function assert(condition, debugInfo) {
|
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
const debugInfoSerialized = typeof debugInfo === 'string' ? debugInfo : JSON.stringify(debugInfo);
|
|
44
|
-
return pc.dim(`Debug
|
|
44
|
+
return pc.dim(`Debug for maintainers (you can ignore this): ${debugInfoSerialized}`);
|
|
45
45
|
})();
|
|
46
46
|
const link = pc.underline('https://github.com/vikejs/vike/issues/new?template=bug.yml');
|
|
47
47
|
let errMsg = [
|
|
@@ -5,7 +5,7 @@ export { requireResolveDistFile };
|
|
|
5
5
|
export { getPackageNodeModulesDirectory };
|
|
6
6
|
declare function requireResolveOptional({ importPath, importerFilePath, userRootDir, }: {
|
|
7
7
|
importPath: string;
|
|
8
|
-
importerFilePath: string;
|
|
8
|
+
importerFilePath: string | null;
|
|
9
9
|
userRootDir: string;
|
|
10
10
|
}): string | null;
|
|
11
11
|
declare function requireResolveOptionalDir({ importPath, importerDir, userRootDir, }: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.247-commit-903de25",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"types": "./dist/esm/client/runtime-server-routing/index.d.ts"
|
|
16
16
|
},
|
|
17
17
|
"./types": {
|
|
18
|
-
"types": "./dist/esm/types/index.d.ts"
|
|
18
|
+
"types": "./dist/esm/types/index.d.ts",
|
|
19
|
+
"default": "./dist/esm/types/index.js"
|
|
19
20
|
},
|
|
20
21
|
"./client/router": {
|
|
21
22
|
"worker": "./dist/esm/node/client/router.js",
|