vike 0.4.221 → 0.4.222-commit-6647d1e
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/api/prepareViteApiCall.js +18 -16
- package/dist/cjs/node/plugin/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/baseUrls.js +6 -1
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +8 -10
- package/dist/cjs/node/plugin/plugins/buildConfig.js +0 -1
- package/dist/cjs/node/plugin/plugins/commonConfig.js +4 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +73 -39
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +64 -14
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +0 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js +2 -40
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +6 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +45 -21
- package/dist/cjs/node/runtime/globalContext.js +24 -8
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +3 -3
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -4
- package/dist/cjs/node/runtime/renderPage.js +4 -8
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +3 -3
- package/dist/cjs/node/shared/resolveBase.js +0 -13
- package/dist/cjs/shared/getPageConfigsRuntime.js +5 -2
- package/dist/cjs/shared/page-configs/getPageConfigUserFriendly.js +45 -11
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -8
- package/dist/cjs/shared/route/loadPageRoutes.js +1 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assertSingleInstance.js +1 -1
- package/dist/cjs/utils/debug.js +9 -6
- package/dist/esm/client/client-routing-runtime/getPageContextCurrent.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.d.ts +4 -4
- package/dist/esm/client/client-routing-runtime/prefetch/getPrefetchSettings.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/prefetch.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/prefetch.js +3 -3
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.d.ts +5 -0
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +9 -2
- package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +2 -1
- package/dist/esm/client/server-routing-runtime/getPageContext.js +4 -3
- package/dist/esm/client/shared/executeOnRenderClientHook.d.ts +2 -2
- package/dist/esm/client/shared/loadUserFilesClientSide.d.ts +5 -4
- package/dist/esm/client/shared/loadUserFilesClientSide.js +3 -3
- package/dist/esm/client/shared/preparePageContextForUserConsumptionClientSide.d.ts +2 -2
- package/dist/esm/node/api/prepareViteApiCall.d.ts +2 -2
- package/dist/esm/node/api/prepareViteApiCall.js +18 -16
- package/dist/esm/node/plugin/index.d.ts +4 -1
- package/dist/esm/node/plugin/index.js +1 -1
- package/dist/esm/node/plugin/plugins/baseUrls.js +6 -1
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.d.ts +0 -2
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +8 -10
- package/dist/esm/node/plugin/plugins/buildConfig.js +1 -2
- package/dist/esm/node/plugin/plugins/commonConfig.d.ts +1 -0
- package/dist/esm/node/plugin/plugins/commonConfig.js +4 -1
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +73 -39
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.d.ts +4 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +65 -15
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +0 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.d.ts +0 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js +2 -37
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +6 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +3 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +47 -23
- package/dist/esm/node/runtime/globalContext.d.ts +11 -8
- package/dist/esm/node/runtime/globalContext.js +24 -8
- package/dist/esm/node/runtime/html/injectAssets/getViteDevScript.d.ts +2 -2
- package/dist/esm/node/runtime/html/injectAssets.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/analyzePage.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.d.ts +3 -3
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +4 -4
- package/dist/esm/node/runtime/renderPage/log404/index.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +4 -4
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +12 -12
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -4
- package/dist/esm/node/runtime/renderPage.js +4 -8
- package/dist/esm/node/runtime-dev/createDevMiddleware.js +3 -3
- package/dist/esm/node/shared/resolveBase.d.ts +1 -9
- package/dist/esm/node/shared/resolveBase.js +0 -13
- package/dist/esm/shared/getPageConfigsRuntime.d.ts +3 -2
- package/dist/esm/shared/getPageConfigsRuntime.js +6 -3
- package/dist/esm/shared/getPageFiles.d.ts +1 -1
- package/dist/esm/shared/hooks/getHook.d.ts +3 -3
- package/dist/esm/shared/page-configs/Config.d.ts +3 -1
- package/dist/esm/shared/page-configs/PageConfig.d.ts +9 -2
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.d.ts +24 -10
- package/dist/esm/shared/page-configs/getPageConfigUserFriendly.js +45 -11
- package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.d.ts +3 -2
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +2 -8
- package/dist/esm/shared/route/executeGuardHook.d.ts +2 -2
- package/dist/esm/shared/route/loadPageRoutes.js +1 -1
- package/dist/esm/shared/types.d.ts +9 -0
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assertSingleInstance.js +1 -1
- package/dist/esm/utils/debug.d.ts +1 -1
- package/dist/esm/utils/debug.js +9 -6
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type { PageConfigRuntime };
|
|
2
2
|
export type { PageConfigRuntimeLoaded };
|
|
3
3
|
export type { PageConfigBuildTime };
|
|
4
|
+
export type { PageConfigCommon };
|
|
5
|
+
export type { PageConfigRoute };
|
|
4
6
|
export type { ConfigEnv };
|
|
5
7
|
export type { ConfigEnvInternal };
|
|
6
8
|
export type { PageConfigGlobalRuntime };
|
|
@@ -23,8 +25,13 @@ import type { ConfigDefinitions } from '../../node/plugin/plugins/importUserCode
|
|
|
23
25
|
import type { PlusFile, PlusFilesByLocationId } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getPlusFilesAll.js';
|
|
24
26
|
type PageConfigCommon = {
|
|
25
27
|
pageId: string;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
} & PageConfigRoute;
|
|
29
|
+
type PageConfigRoute = {
|
|
30
|
+
isErrorPage: true;
|
|
31
|
+
routeFilesystem?: undefined;
|
|
32
|
+
} | {
|
|
33
|
+
isErrorPage?: undefined;
|
|
34
|
+
routeFilesystem: {
|
|
28
35
|
routeString: string;
|
|
29
36
|
definedBy: string;
|
|
30
37
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
1
|
+
export { getPageConfigUserFriendly };
|
|
2
|
+
export { getPageConfigUserFriendly_oldDesign };
|
|
3
|
+
export { getPageConfigGlobalUserFriendly };
|
|
4
|
+
export type { PageConfigsUserFriendly };
|
|
4
5
|
export type { PageConfigUserFriendly };
|
|
6
|
+
export type { PageConfigUserFriendlyOld };
|
|
5
7
|
export type { Source };
|
|
6
8
|
export type { Sources };
|
|
7
9
|
export type { From };
|
|
@@ -9,9 +11,10 @@ export type { ExportsAll };
|
|
|
9
11
|
export type { ConfigEntries };
|
|
10
12
|
import type { FileType } from '../getPageFiles/fileTypes.js';
|
|
11
13
|
import type { PageFile } from '../getPageFiles/getPageFileObject.js';
|
|
12
|
-
import type { ConfigValues, PageConfigRuntimeLoaded } from './PageConfig.js';
|
|
14
|
+
import type { ConfigValues, PageConfigBuildTime, PageConfigGlobalRuntime, PageConfigRuntime, PageConfigRuntimeLoaded } from './PageConfig.js';
|
|
13
15
|
import { type ConfigDefinedAtOptional } from './getConfigDefinedAt.js';
|
|
14
16
|
import type { ConfigResolved } from './Config/PageContextConfig.js';
|
|
17
|
+
import type { Route } from './Config.js';
|
|
15
18
|
type ExportsAll = Record<string, {
|
|
16
19
|
exportValue: unknown;
|
|
17
20
|
exportSource: string;
|
|
@@ -32,7 +35,7 @@ type ConfigEntries = Record<string, {
|
|
|
32
35
|
configDefinedAt: ConfigDefinedAtOptional;
|
|
33
36
|
configDefinedByFile: string | null;
|
|
34
37
|
}[]>;
|
|
35
|
-
type
|
|
38
|
+
type PageConfigUserFriendlyOld = {
|
|
36
39
|
config: ConfigResolved;
|
|
37
40
|
source: Source;
|
|
38
41
|
sources: Sources;
|
|
@@ -73,13 +76,24 @@ type SourceConfigsComputed = {
|
|
|
73
76
|
type: 'configsComputed';
|
|
74
77
|
value: unknown;
|
|
75
78
|
};
|
|
76
|
-
type
|
|
79
|
+
type PageConfigUserFriendly = {
|
|
77
80
|
config: ConfigResolved;
|
|
78
81
|
_source: Source;
|
|
79
82
|
_sources: Sources;
|
|
80
83
|
_from: From;
|
|
81
84
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
type PageConfigsUserFriendly = Record<string, // pageId
|
|
86
|
+
PageConfigUserFriendlyWithRoute>;
|
|
87
|
+
type WithRoute = {
|
|
88
|
+
route: Route;
|
|
89
|
+
isErrorPage?: undefined;
|
|
90
|
+
} | {
|
|
91
|
+
route?: undefined;
|
|
92
|
+
isErrorPage: true;
|
|
93
|
+
};
|
|
94
|
+
type PageConfigUserFriendlyWithRoute = PageConfigUserFriendly & WithRoute;
|
|
95
|
+
declare function getPageConfigUserFriendly(pageConfigGlobalValues: ConfigValues, pageConfig: PageConfigRuntime | PageConfigBuildTime, pageConfigValues: ConfigValues): [string, PageConfigUserFriendlyWithRoute];
|
|
96
|
+
declare function getPageConfigGlobalUserFriendly({ pageConfigGlobalValues }: {
|
|
97
|
+
pageConfigGlobalValues: ConfigValues;
|
|
98
|
+
}): PageConfigUserFriendly;
|
|
99
|
+
declare function getPageConfigUserFriendly_oldDesign(pageFiles: PageFile[], pageConfig: PageConfigRuntimeLoaded | null, pageConfigGlobal: PageConfigGlobalRuntime): PageConfigUserFriendlyOld;
|
|
@@ -1,20 +1,51 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { getPageConfigUserFriendly };
|
|
2
|
+
export { getPageConfigUserFriendly_oldDesign };
|
|
3
|
+
export { getPageConfigGlobalUserFriendly };
|
|
3
4
|
import { assertDefaultExports, forbiddenDefaultExports } from '../getPageFiles/assert_exports_old_design.js';
|
|
4
5
|
import { getConfigDefinedAtOptional, getDefinedAtString } from './getConfigDefinedAt.js';
|
|
5
6
|
import { getConfigValueFilePathToShowToUser } from './helpers.js';
|
|
6
7
|
import { assert, isObject, assertWarning, assertUsage, makeLast, isBrowser, isScriptFile, isTemplateFile } from '../utils.js';
|
|
7
8
|
import pc from '@brillout/picocolors';
|
|
8
|
-
function
|
|
9
|
-
const
|
|
9
|
+
function getPageConfigUserFriendly(pageConfigGlobalValues, pageConfig, pageConfigValues) {
|
|
10
|
+
const pageConfigUserFriendly = getPageConfigUserFriendly_public({ pageConfigGlobalValues, pageConfigValues });
|
|
11
|
+
let page;
|
|
12
|
+
if (!pageConfig.isErrorPage) {
|
|
13
|
+
const route = pageConfigUserFriendly.config.route ?? pageConfig.routeFilesystem.routeString;
|
|
14
|
+
page = {
|
|
15
|
+
...pageConfigUserFriendly,
|
|
16
|
+
route
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
page = {
|
|
21
|
+
...pageConfigUserFriendly,
|
|
22
|
+
isErrorPage: true
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return [pageConfig.pageId, page];
|
|
26
|
+
}
|
|
27
|
+
function getPageConfigUserFriendly_public({ pageConfigGlobalValues, pageConfigValues }) {
|
|
28
|
+
const pageConfigUserFriendly = getPageConfigUserFriendly_base({ pageConfigGlobalValues, pageConfigValues });
|
|
29
|
+
return getPublicCopy(pageConfigUserFriendly);
|
|
30
|
+
}
|
|
31
|
+
function getPublicCopy(pageConfigUserFriendly) {
|
|
32
|
+
const p = pageConfigUserFriendly;
|
|
10
33
|
return {
|
|
11
|
-
config:
|
|
12
|
-
_source:
|
|
13
|
-
_sources:
|
|
14
|
-
_from:
|
|
34
|
+
config: p.config,
|
|
35
|
+
_source: p.source,
|
|
36
|
+
_sources: p.sources,
|
|
37
|
+
_from: p.from
|
|
15
38
|
};
|
|
16
39
|
}
|
|
17
|
-
function
|
|
40
|
+
function getPageConfigUserFriendly_base({ pageConfigGlobalValues, pageConfigValues }) {
|
|
41
|
+
const configValues = { ...pageConfigGlobalValues, ...pageConfigValues };
|
|
42
|
+
return getPageConfigUserFriendly_V1Design({ configValues });
|
|
43
|
+
}
|
|
44
|
+
function getPageConfigGlobalUserFriendly({ pageConfigGlobalValues }) {
|
|
45
|
+
const pageConfigGlobalUserFriendly = getPageConfigUserFriendly_V1Design({ configValues: pageConfigGlobalValues });
|
|
46
|
+
return getPublicCopy(pageConfigGlobalUserFriendly);
|
|
47
|
+
}
|
|
48
|
+
function getPageConfigUserFriendly_oldDesign(pageFiles, pageConfig, pageConfigGlobal) {
|
|
18
49
|
const config = {};
|
|
19
50
|
const configEntries = {}; // TODO/v1-release: remove
|
|
20
51
|
const exportsAll = {}; // TODO/v1-release: remove
|
|
@@ -39,7 +70,10 @@ function getPageConfigUserFriendlyOld(pageFiles, pageConfig) {
|
|
|
39
70
|
let sources;
|
|
40
71
|
let from;
|
|
41
72
|
if (pageConfig) {
|
|
42
|
-
const res =
|
|
73
|
+
const res = getPageConfigUserFriendly_base({
|
|
74
|
+
pageConfigGlobalValues: pageConfigGlobal.configValues,
|
|
75
|
+
pageConfigValues: pageConfig.configValues
|
|
76
|
+
});
|
|
43
77
|
source = res.source;
|
|
44
78
|
sources = res.sources;
|
|
45
79
|
from = res.from;
|
|
@@ -85,7 +119,7 @@ function getPageConfigUserFriendlyOld(pageFiles, pageConfig) {
|
|
|
85
119
|
return pageContextExports;
|
|
86
120
|
}
|
|
87
121
|
// V1 design
|
|
88
|
-
function
|
|
122
|
+
function getPageConfigUserFriendly_V1Design(pageConfig) {
|
|
89
123
|
const config = {};
|
|
90
124
|
const configEntries = {};
|
|
91
125
|
const exportsAll = {};
|
|
@@ -2,11 +2,12 @@ export type { PageConfigRuntimeSerialized };
|
|
|
2
2
|
export type { PageConfigGlobalRuntimeSerialized };
|
|
3
3
|
export type { ConfigValueSerialized };
|
|
4
4
|
export type { ValueSerialized };
|
|
5
|
-
import type { ConfigValueStandard, ConfigValueComputed, ConfigValueCumulative, PageConfigRuntime } from '../PageConfig.js';
|
|
5
|
+
import type { ConfigValueStandard, ConfigValueComputed, ConfigValueCumulative, PageConfigCommon, PageConfigRuntime } from '../PageConfig.js';
|
|
6
6
|
/** Page config data structure serialized in virtual files: parsing it results in PageConfigRuntime */
|
|
7
|
-
type PageConfigRuntimeSerialized =
|
|
7
|
+
type PageConfigRuntimeSerialized = PageConfigCommon & {
|
|
8
8
|
/** Config values that are serializable and loaded eagerly such as config.passToClient */
|
|
9
9
|
configValuesSerialized: Record<string, ConfigValueSerialized>;
|
|
10
|
+
loadConfigValuesAll: PageConfigRuntime['loadConfigValuesAll'];
|
|
10
11
|
};
|
|
11
12
|
type PageConfigGlobalRuntimeSerialized = {
|
|
12
13
|
configValuesSerialized: Record<string, ConfigValueSerialized>;
|
|
@@ -12,15 +12,9 @@ function parsePageConfigs(pageConfigsSerialized, pageConfigGlobalSerialized) {
|
|
|
12
12
|
// pageConfigs
|
|
13
13
|
const pageConfigs = pageConfigsSerialized.map((pageConfigSerialized) => {
|
|
14
14
|
const configValues = parseConfigValuesSerialized(pageConfigSerialized.configValuesSerialized);
|
|
15
|
-
const { pageId, isErrorPage, routeFilesystem, loadConfigValuesAll } = pageConfigSerialized;
|
|
16
15
|
assertRouteConfigValue(configValues);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
isErrorPage,
|
|
20
|
-
routeFilesystem,
|
|
21
|
-
configValues,
|
|
22
|
-
loadConfigValuesAll
|
|
23
|
-
};
|
|
16
|
+
const pageConfig = { ...pageConfigSerialized, configValues };
|
|
17
|
+
return pageConfig;
|
|
24
18
|
});
|
|
25
19
|
// pageConfigsGlobal
|
|
26
20
|
const pageConfigGlobal = { configValues: {} };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { executeGuardHook };
|
|
2
|
-
import type {
|
|
2
|
+
import type { PageConfigUserFriendlyOld, PageFile } from '../getPageFiles.js';
|
|
3
3
|
import type { PageConfigRuntime } from '../page-configs/PageConfig.js';
|
|
4
|
-
declare function executeGuardHook<T extends
|
|
4
|
+
declare function executeGuardHook<T extends PageConfigUserFriendlyOld & {
|
|
5
5
|
pageId: string;
|
|
6
6
|
_pageFilesAll: PageFile[];
|
|
7
7
|
_pageConfigs: PageConfigRuntime[];
|
|
@@ -8,7 +8,7 @@ import { getDefinedAtString } from '../page-configs/getConfigDefinedAt.js';
|
|
|
8
8
|
import { warnDeprecatedAllowKey } from './resolveRouteFunction.js';
|
|
9
9
|
import { getHookFromPageConfigGlobal, getHookTimeoutDefault } from '../hooks/getHook.js';
|
|
10
10
|
async function loadPageRoutes(
|
|
11
|
-
// Remove all arguments and use
|
|
11
|
+
// Remove all arguments and use GlobalContextInternal instead?
|
|
12
12
|
pageFilesAll, pageConfigs, pageConfigGlobal, allPageIds) {
|
|
13
13
|
// TODO/next-major: remove & make this function sync
|
|
14
14
|
await Promise.all(pageFilesAll.filter((p) => p.fileType === '.page.route').map((p) => p.loadFile?.()));
|
|
@@ -12,6 +12,7 @@ import type { ConfigEntries, ExportsAll, From, Source, Sources } from './page-co
|
|
|
12
12
|
import type { Config } from './page-configs/Config.js';
|
|
13
13
|
import type { PageContextConfig } from './page-configs/Config/PageContextConfig.js';
|
|
14
14
|
import type { AbortStatusCode } from './route/abort.js';
|
|
15
|
+
import type { GlobalContextPublic } from '../node/runtime/globalContext.js';
|
|
15
16
|
type PageContextServer<Data = unknown> = PageContextBuiltInServer<Data> & Vike.PageContext;
|
|
16
17
|
type PageContext<Data = unknown> = PageContextClient<Data> | PageContextServer<Data>;
|
|
17
18
|
type PageContextClient<Data = unknown> = PageContextBuiltInClientWithClientRouting<Data> & Vike.PageContext;
|
|
@@ -118,6 +119,14 @@ type PageContextBuiltInCommon<Data> = {
|
|
|
118
119
|
source: Source;
|
|
119
120
|
/** @experimental https://github.com/vikejs/vike/issues/1268 */
|
|
120
121
|
sources: Sources;
|
|
122
|
+
/**
|
|
123
|
+
* Information shared by all pages.
|
|
124
|
+
*
|
|
125
|
+
* https://vike.dev/getGlobalContext
|
|
126
|
+
*
|
|
127
|
+
* @experimental
|
|
128
|
+
*/
|
|
129
|
+
globalContext: GlobalContextPublic;
|
|
121
130
|
/** @deprecated */
|
|
122
131
|
url: string;
|
|
123
132
|
/** @deprecated */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.222-commit-6647d1e";
|
|
@@ -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.222-commit-6647d1e';
|
|
@@ -22,7 +22,7 @@ function assertSingleInstance() {
|
|
|
22
22
|
const versions = unique(globalObject.instances);
|
|
23
23
|
assertUsage(versions.length <= 1,
|
|
24
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
|
|
25
|
-
`vike@${pc.bold(versions[0])} and vike@${pc.bold(versions[1])} loaded but
|
|
25
|
+
`vike@${pc.bold(versions[0])} and vike@${pc.bold(versions[1])} loaded but it's forbidden to load different versions`);
|
|
26
26
|
}
|
|
27
27
|
if (globalObject.checkSingleInstance && globalObject.instances.length > 1) {
|
|
28
28
|
/*/ Not sure whether circular dependency can cause problems? In principle not since client-side code is ESM.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createDebugger };
|
|
2
2
|
export { isDebugActivated };
|
|
3
3
|
export type { Debug };
|
|
4
|
-
declare const flags: readonly ["vike:error", "vike:extractAssets", "vike:extractExportNames", "vike:glob", "vike:globalContext", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:routing", "vike:setup", "vike:stream", "vike:virtual-files"
|
|
4
|
+
declare const flags: readonly ["vike:crawl", "vike:error", "vike:esbuild-resolve", "vike:extractAssets", "vike:extractExportNames", "vike:glob", "vike:globalContext", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:routing", "vike:setup", "vike:stream", "vike:virtual-files"];
|
|
5
5
|
type Flag = (typeof flags)[number];
|
|
6
6
|
type Debug = ReturnType<typeof createDebugger>;
|
|
7
7
|
type Options = {
|
package/dist/esm/utils/debug.js
CHANGED
|
@@ -12,7 +12,9 @@ import { isArray } from './isArray.js';
|
|
|
12
12
|
assert(!isBrowser());
|
|
13
13
|
globalThis.__brillout_debug_createDebugger = createDebugger;
|
|
14
14
|
const flags = [
|
|
15
|
+
'vike:crawl',
|
|
15
16
|
'vike:error',
|
|
17
|
+
'vike:esbuild-resolve',
|
|
16
18
|
'vike:extractAssets',
|
|
17
19
|
'vike:extractExportNames',
|
|
18
20
|
'vike:glob',
|
|
@@ -25,9 +27,9 @@ const flags = [
|
|
|
25
27
|
'vike:routing',
|
|
26
28
|
'vike:setup',
|
|
27
29
|
'vike:stream',
|
|
28
|
-
'vike:virtual-files'
|
|
29
|
-
'vike:esbuild-resolve'
|
|
30
|
+
'vike:virtual-files'
|
|
30
31
|
];
|
|
32
|
+
const flagsSkipWildcard = ['vike:log'];
|
|
31
33
|
const flagRegex = /\bvike:[a-zA-Z-]+/g;
|
|
32
34
|
assertFlagsActivated();
|
|
33
35
|
function createDebugger(flag, optionsGlobal) {
|
|
@@ -72,8 +74,8 @@ function debug_(flag, options, ...msgs) {
|
|
|
72
74
|
function isDebugActivated(flag) {
|
|
73
75
|
checkType(flag);
|
|
74
76
|
assert(flags.includes(flag));
|
|
75
|
-
const flagsActivated = getFlagsActivated();
|
|
76
|
-
const isActivated = flagsActivated.includes(flag);
|
|
77
|
+
const { flagsActivated, all } = getFlagsActivated();
|
|
78
|
+
const isActivated = flagsActivated.includes(flag) || (all && !flagsSkipWildcard.includes(flag));
|
|
77
79
|
return isActivated;
|
|
78
80
|
}
|
|
79
81
|
function formatMsg(info, options, padding, position) {
|
|
@@ -137,7 +139,7 @@ function replaceFunctionSerializer(_key, value) {
|
|
|
137
139
|
return value;
|
|
138
140
|
}
|
|
139
141
|
function assertFlagsActivated() {
|
|
140
|
-
const flagsActivated = getFlagsActivated();
|
|
142
|
+
const { flagsActivated } = getFlagsActivated();
|
|
141
143
|
flagsActivated.forEach((flag) => {
|
|
142
144
|
assertUsage(flags.includes(flag), `Unknown DEBUG flag ${pc.cyan(flag)}. Valid flags:\n${flags.map((f) => ` ${pc.cyan(f)}`).join('\n')}`);
|
|
143
145
|
});
|
|
@@ -145,7 +147,8 @@ function assertFlagsActivated() {
|
|
|
145
147
|
function getFlagsActivated() {
|
|
146
148
|
const DEBUG = getDEBUG() ?? '';
|
|
147
149
|
const flagsActivated = DEBUG.match(flagRegex) ?? [];
|
|
148
|
-
|
|
150
|
+
const all = DEBUG.includes('vike:*');
|
|
151
|
+
return { flagsActivated, all };
|
|
149
152
|
}
|
|
150
153
|
function getDEBUG() {
|
|
151
154
|
let DEBUG;
|