vike 0.4.237-commit-8749e81 → 0.4.237-commit-92dc549
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/runtime/html/injectAssets/getHtmlTags.js +1 -1
- package/dist/cjs/node/runtime/renderPage.js +12 -7
- package/dist/cjs/node/runtime/utils.js +1 -1
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +12 -11
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginAutoFullBuild.js +8 -7
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +5 -5
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildEntry.js +1 -1
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +2 -10
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginModuleBanner.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginDev/determineFsAllowList.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginEnvVars.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginExtractAssets.js +3 -3
- package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +1 -1
- package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +51 -21
- package/dist/cjs/node/vite/shared/getClientEntrySrcDev.js +1 -1
- package/dist/cjs/node/vite/shared/getHttpRequestAsyncStore.js +8 -6
- package/dist/cjs/node/vite/shared/getOutDirs.js +9 -6
- package/dist/cjs/node/vite/shared/{isViteServerBuild.js → isViteServerSide.js} +15 -15
- package/dist/cjs/node/vite/shared/loggerVite/removeSuperfluousViteLog.js +6 -4
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +20 -36
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +5 -4
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +42 -44
- package/dist/cjs/types/VikeGlobalInternal.js +2 -0
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assertVersion.js +2 -0
- package/dist/cjs/utils/debug.js +4 -4
- package/dist/cjs/utils/getGlobalObject.js +8 -15
- package/dist/cjs/utils/isScriptFile.js +1 -1
- package/dist/cjs/utils/path.js +5 -5
- package/dist/cjs/utils/requireResolve.js +13 -12
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +2 -3
- package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +1 -1
- package/dist/esm/node/runtime/renderPage.d.ts +7 -4
- package/dist/esm/node/runtime/renderPage.js +12 -7
- package/dist/esm/node/runtime/utils.d.ts +1 -1
- package/dist/esm/node/runtime/utils.js +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.js +13 -12
- package/dist/esm/node/vite/plugins/pluginBuild/pluginAutoFullBuild.js +9 -8
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildConfig.js +6 -6
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildEntry.js +2 -2
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistPackageJsonFile.js +2 -10
- package/dist/esm/node/vite/plugins/pluginBuild/pluginModuleBanner.js +2 -2
- package/dist/esm/node/vite/plugins/pluginDev/determineFsAllowList.js +3 -3
- package/dist/esm/node/vite/plugins/pluginEnvVars.js +2 -2
- package/dist/esm/node/vite/plugins/pluginExtractAssets.js +3 -3
- package/dist/esm/node/vite/plugins/pluginExtractExportNames.js +2 -2
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +2 -2
- package/dist/esm/node/vite/plugins/pluginReplaceConstants.js +2 -2
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/generateVirtualFileGlobalEntryWithOldDesign.js +2 -2
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.d.ts +5 -1
- package/dist/esm/node/vite/plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js +52 -22
- package/dist/esm/node/vite/shared/getClientEntrySrcDev.js +2 -2
- package/dist/esm/node/vite/shared/getHttpRequestAsyncStore.js +9 -7
- package/dist/esm/node/vite/shared/getOutDirs.d.ts +1 -1
- package/dist/esm/node/vite/shared/getOutDirs.js +9 -6
- package/dist/esm/node/vite/shared/isViteServerSide.d.ts +18 -0
- package/dist/esm/node/vite/shared/{isViteServerBuild.js → isViteServerSide.js} +15 -17
- package/dist/esm/node/vite/shared/loggerVite/removeSuperfluousViteLog.js +7 -5
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.d.ts +3 -2
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js +21 -37
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal/crawlPlusFiles.js +6 -5
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.d.ts +2 -0
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.js +43 -45
- package/dist/esm/types/VikeGlobalInternal.d.ts +4 -0
- package/dist/esm/types/VikeGlobalInternal.js +1 -0
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assertVersion.js +2 -0
- package/dist/esm/utils/debug.js +3 -3
- package/dist/esm/utils/getGlobalObject.d.ts +6 -5
- package/dist/esm/utils/getGlobalObject.js +8 -15
- package/dist/esm/utils/isScriptFile.d.ts +1 -1
- package/dist/esm/utils/isScriptFile.js +1 -1
- package/dist/esm/utils/path.d.ts +2 -0
- package/dist/esm/utils/path.js +5 -5
- package/dist/esm/utils/requireResolve.d.ts +4 -4
- package/dist/esm/utils/requireResolve.js +13 -12
- package/package.json +2 -2
- package/dist/esm/node/vite/shared/isViteServerBuild.d.ts +0 -18
- /package/dist/cjs/utils/{getTerminWidth.js → getTerminalWidth.js} +0 -0
- /package/dist/esm/utils/{getTerminWidth.d.ts → getTerminalWidth.d.ts} +0 -0
- /package/dist/esm/utils/{getTerminWidth.js → getTerminalWidth.js} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
3
|
+
exports.isViteServerSide = isViteServerSide;
|
|
4
|
+
exports.isViteClientSide = isViteClientSide;
|
|
5
|
+
exports.isViteServerSide_withoutEnv = isViteServerSide_withoutEnv;
|
|
6
|
+
exports.isViteServerSide_onlySsrEnv = isViteServerSide_onlySsrEnv;
|
|
7
|
+
exports.isViteServerSide_extraSafe = isViteServerSide_extraSafe;
|
|
8
8
|
const assert_js_1 = require("../../../utils/assert.js");
|
|
9
|
-
function
|
|
9
|
+
function isViteServerSide_withoutEnv(configGlobal, viteEnv) {
|
|
10
10
|
(0, assert_js_1.assert)(!('consumer' in configGlobal)); // make sure configGlobal isn't viteEnv.config
|
|
11
11
|
const isServerSide1 = !viteEnv?.config.consumer ? null : viteEnv.config.consumer !== 'client';
|
|
12
12
|
const isServerSide2 = !viteEnv?.name ? null : viteEnv.name !== 'client'; // I can't think of a use case for creating another client-side environment
|
|
@@ -41,23 +41,23 @@ function isViteServerBuild_withoutEnv(configGlobal, viteEnv) {
|
|
|
41
41
|
}
|
|
42
42
|
return isServerSide4;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
44
|
+
function isViteServerSide(configGlobal, viteEnv) {
|
|
45
|
+
return isViteServerSide_withoutEnv(configGlobal, viteEnv);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return !
|
|
47
|
+
function isViteClientSide(configGlobal, viteEnv) {
|
|
48
|
+
return !isViteServerSide(configGlobal, viteEnv);
|
|
49
49
|
}
|
|
50
50
|
// Only `ssr` env: for example don't include `vercel_edge` nor `vercel_node`.
|
|
51
|
-
function
|
|
52
|
-
return viteEnv ? viteEnv.name === 'ssr' :
|
|
51
|
+
function isViteServerSide_onlySsrEnv(configGlobal, viteEnv) {
|
|
52
|
+
return viteEnv.name ? viteEnv.name === 'ssr' : isViteServerSide(configGlobal, viteEnv);
|
|
53
53
|
}
|
|
54
54
|
// Vite is quite messy about setting config.build.ssr — for security purposes, we use an extra safe implementation with lots of assertions, which is needed for the .client.js and .server.js guarantee.
|
|
55
|
-
function
|
|
55
|
+
function isViteServerSide_extraSafe(config, options, viteEnv) {
|
|
56
56
|
if (config.command === 'build') {
|
|
57
57
|
const res = config.build.ssr;
|
|
58
58
|
(0, assert_js_1.assert)(typeof res === 'boolean');
|
|
59
59
|
(0, assert_js_1.assert)(res === options?.ssr || options?.ssr === undefined);
|
|
60
|
-
(0, assert_js_1.assert)(res ===
|
|
60
|
+
(0, assert_js_1.assert)(res === isViteServerSide(config, viteEnv));
|
|
61
61
|
return res;
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
@@ -66,7 +66,7 @@ function isViteServerBuild_extraSafe(config, options, viteEnv) {
|
|
|
66
66
|
/* This assertion can fail, seems to be a Vite bug? It's very unexpected.
|
|
67
67
|
if (typeof config.build.ssr === 'boolean') assert(res === config.build.ssr)
|
|
68
68
|
*/
|
|
69
|
-
(0, assert_js_1.assert)(res ===
|
|
69
|
+
(0, assert_js_1.assert)(res === isViteServerSide(config, viteEnv));
|
|
70
70
|
return res;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -4,10 +4,12 @@ exports.removeSuperfluousViteLog = removeSuperfluousViteLog;
|
|
|
4
4
|
exports.removeSuperfluousViteLog_enable = removeSuperfluousViteLog_enable;
|
|
5
5
|
exports.removeSuperfluousViteLog_disable = removeSuperfluousViteLog_disable;
|
|
6
6
|
const utils_js_1 = require("../../utils.js");
|
|
7
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('removeSuperfluousViteLog.ts', {
|
|
8
|
+
enabled: false,
|
|
9
|
+
});
|
|
7
10
|
const superfluousLog = 'Forced re-optimization of dependencies';
|
|
8
|
-
let enabled = false;
|
|
9
11
|
function removeSuperfluousViteLog(msg) {
|
|
10
|
-
if (!enabled) {
|
|
12
|
+
if (!globalObject.enabled) {
|
|
11
13
|
return false;
|
|
12
14
|
}
|
|
13
15
|
if (msg.toLowerCase().includes('forced') && msg.toLowerCase().includes('optimization')) {
|
|
@@ -17,8 +19,8 @@ function removeSuperfluousViteLog(msg) {
|
|
|
17
19
|
return false;
|
|
18
20
|
}
|
|
19
21
|
function removeSuperfluousViteLog_enable() {
|
|
20
|
-
enabled = true;
|
|
22
|
+
globalObject.enabled = true;
|
|
21
23
|
}
|
|
22
24
|
function removeSuperfluousViteLog_disable() {
|
|
23
|
-
enabled = false;
|
|
25
|
+
globalObject.enabled = false;
|
|
24
26
|
}
|
|
@@ -110,7 +110,9 @@ const configDefinitionsBuiltIn = {
|
|
|
110
110
|
}, pageConfig))
|
|
111
111
|
.flat(1)
|
|
112
112
|
// Server-only
|
|
113
|
-
.filter((source) => !source.configEnv.client)
|
|
113
|
+
.filter((source) => !source.configEnv.client)
|
|
114
|
+
// Config value isn't `null`
|
|
115
|
+
.filter((source) => !(0, getConfigValueSourcesRelevant_js_1.isConfigSourceValueNull)(source));
|
|
114
116
|
return sources.length > 0;
|
|
115
117
|
},
|
|
116
118
|
},
|
|
@@ -122,22 +124,19 @@ const configDefinitionsBuiltIn = {
|
|
|
122
124
|
env: { server: true, client: true },
|
|
123
125
|
eager: true,
|
|
124
126
|
_computed: (pageConfig) => {
|
|
125
|
-
const { configValueSources } = pageConfig;
|
|
126
127
|
{
|
|
127
|
-
const source =
|
|
128
|
+
const source = (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourceRelevantAnyEnv)('clientHooks', pageConfig);
|
|
128
129
|
if (source) {
|
|
129
130
|
(0, utils_js_1.assert)(source.valueIsLoaded);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return value;
|
|
135
|
-
}
|
|
131
|
+
const { value, definedAt } = source;
|
|
132
|
+
const configDefinedAt = (0, getConfigDefinedAt_js_1.getConfigDefinedAt)('Config', 'clientHooks', definedAt);
|
|
133
|
+
(0, utils_js_1.assertUsage)(typeof value === 'boolean', `${configDefinedAt} should be a boolean`);
|
|
134
|
+
return value;
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
|
-
return (isConfigSet(
|
|
139
|
-
isConfigSet(
|
|
140
|
-
!!getConfigEnv(
|
|
137
|
+
return (isConfigSet(pageConfig, 'onRenderClient') &&
|
|
138
|
+
isConfigSet(pageConfig, 'Page') &&
|
|
139
|
+
!!getConfigEnv(pageConfig, 'Page')?.client);
|
|
141
140
|
},
|
|
142
141
|
},
|
|
143
142
|
// TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
|
|
@@ -145,10 +144,7 @@ const configDefinitionsBuiltIn = {
|
|
|
145
144
|
env: { client: true },
|
|
146
145
|
eager: true,
|
|
147
146
|
_computed: (pageConfig) => {
|
|
148
|
-
|
|
149
|
-
return !isConfigSet(configValueSources, 'onBeforeRender')
|
|
150
|
-
? null
|
|
151
|
-
: getConfigEnv(configValueSources, 'onBeforeRender');
|
|
147
|
+
return !isConfigSet(pageConfig, 'onBeforeRender') ? null : getConfigEnv(pageConfig, 'onBeforeRender');
|
|
152
148
|
},
|
|
153
149
|
},
|
|
154
150
|
// TO-DO/soon/cumulative-hooks: remove and replace with new computed prop `clientOnlyHooks: string[]` (see other TO-DO/soon/cumulative-hooks entries)
|
|
@@ -156,8 +152,7 @@ const configDefinitionsBuiltIn = {
|
|
|
156
152
|
env: { client: true },
|
|
157
153
|
eager: true,
|
|
158
154
|
_computed: (pageConfig) => {
|
|
159
|
-
|
|
160
|
-
return !isConfigSet(configValueSources, 'data') ? null : getConfigEnv(configValueSources, 'data');
|
|
155
|
+
return !isConfigSet(pageConfig, 'data') ? null : getConfigEnv(pageConfig, 'data');
|
|
161
156
|
},
|
|
162
157
|
},
|
|
163
158
|
hooksTimeout: {
|
|
@@ -246,11 +241,11 @@ const configDefinitionsBuiltIn = {
|
|
|
246
241
|
},
|
|
247
242
|
};
|
|
248
243
|
exports.configDefinitionsBuiltIn = configDefinitionsBuiltIn;
|
|
249
|
-
function getConfigEnv(
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
244
|
+
function getConfigEnv(pageConfig, configName) {
|
|
245
|
+
const source = (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourceRelevantAnyEnv)(configName, pageConfig);
|
|
246
|
+
if (!source)
|
|
252
247
|
return null;
|
|
253
|
-
const { configEnv } =
|
|
248
|
+
const { configEnv } = source;
|
|
254
249
|
const env = {};
|
|
255
250
|
if (configEnv.client)
|
|
256
251
|
env.client = true;
|
|
@@ -258,18 +253,7 @@ function getConfigEnv(configValueSources, configName) {
|
|
|
258
253
|
env.server = true;
|
|
259
254
|
return env;
|
|
260
255
|
}
|
|
261
|
-
function isConfigSet(
|
|
262
|
-
const source =
|
|
263
|
-
return
|
|
264
|
-
!(source.valueIsLoaded &&
|
|
265
|
-
// Enable users to suppress inherited config by overriding it with `null`
|
|
266
|
-
source.value === null));
|
|
267
|
-
}
|
|
268
|
-
function getConfigValueSource(configValueSources, configName) {
|
|
269
|
-
const sources = configValueSources[configName];
|
|
270
|
-
if (!sources)
|
|
271
|
-
return null;
|
|
272
|
-
const configValueSource = sources[0];
|
|
273
|
-
(0, utils_js_1.assert)(configValueSource);
|
|
274
|
-
return configValueSource;
|
|
256
|
+
function isConfigSet(pageConfig, configName) {
|
|
257
|
+
const source = (0, getConfigValueSourcesRelevant_js_1.getConfigValueSourceRelevantAnyEnv)(configName, pageConfig);
|
|
258
|
+
return !!source;
|
|
275
259
|
}
|
|
@@ -19,8 +19,9 @@ const ignorePatternsBuiltIn_js_1 = require("./crawlPlusFiles/ignorePatternsBuilt
|
|
|
19
19
|
const execA = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
20
20
|
const debug = (0, utils_js_1.createDebugger)('vike:crawl');
|
|
21
21
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
22
|
-
(0, utils_js_1.
|
|
23
|
-
|
|
22
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('getVikeConfig/crawlPlusFiles.ts', {
|
|
23
|
+
gitIsNotUsable: false,
|
|
24
|
+
});
|
|
24
25
|
async function crawlPlusFiles(userRootDir) {
|
|
25
26
|
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
26
27
|
(0, utils_js_1.assertFilePathAbsoluteFilesystem)(userRootDir);
|
|
@@ -53,7 +54,7 @@ async function crawlPlusFiles(userRootDir) {
|
|
|
53
54
|
}
|
|
54
55
|
// Same as tinyglobby() but using `$ git ls-files`
|
|
55
56
|
async function gitLsFiles(userRootDir, ignorePatterns, ignoreMatchers) {
|
|
56
|
-
if (gitIsNotUsable)
|
|
57
|
+
if (globalObject.gitIsNotUsable)
|
|
57
58
|
return null;
|
|
58
59
|
// Preserve UTF-8 file paths.
|
|
59
60
|
// https://github.com/vikejs/vike/issues/1658
|
|
@@ -87,7 +88,7 @@ async function gitLsFiles(userRootDir, ignorePatterns, ignoreMatchers) {
|
|
|
87
88
|
}
|
|
88
89
|
catch (err) {
|
|
89
90
|
if (await isGitNotUsable(userRootDir)) {
|
|
90
|
-
gitIsNotUsable = true;
|
|
91
|
+
globalObject.gitIsNotUsable = true;
|
|
91
92
|
return null;
|
|
92
93
|
}
|
|
93
94
|
throw err;
|
|
@@ -35,21 +35,19 @@ const resolvePrerenderConfig_js_1 = require("../../prerender/resolvePrerenderCon
|
|
|
35
35
|
const getProxyForPublicUsage_js_1 = require("../../../shared/getProxyForPublicUsage.js");
|
|
36
36
|
const getVikeConfigError_js_1 = require("../../shared/getVikeConfigError.js");
|
|
37
37
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
let vikeConfigCtx = null; // Information provided by Vite's `config` and Vike's CLI. We could, if we want or need to, completely remove the dependency on Vite.
|
|
49
|
-
let prerenderContext;
|
|
38
|
+
const globalObject = (0, utils_js_1.getGlobalObject)('vite/shared/resolveVikeConfigInternal.ts', {
|
|
39
|
+
restartVite: false,
|
|
40
|
+
vikeConfigHasBuildError: null,
|
|
41
|
+
isV1Design_: null,
|
|
42
|
+
vikeConfigPromise: null,
|
|
43
|
+
// TO-DO/next-major-release: remove
|
|
44
|
+
vikeConfigSync: null,
|
|
45
|
+
vikeConfigCtx: null, // Information provided by Vite's `config` and Vike's CLI. We could, if we want or need to, completely remove the dependency on Vite.
|
|
46
|
+
prerenderContext: null,
|
|
47
|
+
});
|
|
50
48
|
function reloadVikeConfig() {
|
|
51
|
-
(0, utils_js_1.assert)(vikeConfigCtx);
|
|
52
|
-
const { userRootDir, vikeVitePluginOptions } = vikeConfigCtx;
|
|
49
|
+
(0, utils_js_1.assert)(globalObject.vikeConfigCtx);
|
|
50
|
+
const { userRootDir, vikeVitePluginOptions } = globalObject.vikeConfigCtx;
|
|
53
51
|
(0, utils_js_1.assert)(vikeVitePluginOptions);
|
|
54
52
|
resolveVikeConfigInternal_withErrorHandling(userRootDir, true, vikeVitePluginOptions);
|
|
55
53
|
}
|
|
@@ -57,15 +55,15 @@ async function getVikeConfigInternal(
|
|
|
57
55
|
// I don't remember the logic behind it — neither why we restart Vite's dev server, nor why we sometimes don't.
|
|
58
56
|
// TO-DO/eventually: re-think all that. Some + settings are expected to influence Vite's config (restarting Vite's dev server is needed) while some don't.
|
|
59
57
|
doNotRestartViteOnError = false) {
|
|
60
|
-
(0, utils_js_1.assert)(vikeConfigCtx);
|
|
61
|
-
const { userRootDir, isDev, vikeVitePluginOptions } = vikeConfigCtx;
|
|
58
|
+
(0, utils_js_1.assert)(globalObject.vikeConfigCtx);
|
|
59
|
+
const { userRootDir, isDev, vikeVitePluginOptions } = globalObject.vikeConfigCtx;
|
|
62
60
|
const vikeConfig = await getOrResolveVikeConfig(userRootDir, isDev, vikeVitePluginOptions, doNotRestartViteOnError);
|
|
63
61
|
return vikeConfig;
|
|
64
62
|
}
|
|
65
63
|
// TO-DO/next-major-release: remove
|
|
66
64
|
function getVikeConfigInternalSync() {
|
|
67
|
-
(0, utils_js_1.assert)(vikeConfigSync);
|
|
68
|
-
return vikeConfigSync;
|
|
65
|
+
(0, utils_js_1.assert)(globalObject.vikeConfigSync);
|
|
66
|
+
return globalObject.vikeConfigSync;
|
|
69
67
|
}
|
|
70
68
|
// TO-DO/eventually: this maybe(/probably?) isn't safe against race conditions upon file changes in development, thus:
|
|
71
69
|
// - Like getGlobalContext() and getGlobalContextSync() — make getVikeConfig() async and provide a getVikeConfigSync() while discourage using it
|
|
@@ -86,29 +84,29 @@ config) {
|
|
|
86
84
|
}
|
|
87
85
|
function setVikeConfigContext(vikeConfigCtx_) {
|
|
88
86
|
// If the user changes Vite's `config.root` => Vite completely reloads itself => setVikeConfigContext() is called again
|
|
89
|
-
vikeConfigCtx = vikeConfigCtx_;
|
|
87
|
+
globalObject.vikeConfigCtx = vikeConfigCtx_;
|
|
90
88
|
}
|
|
91
89
|
async function getOrResolveVikeConfig(userRootDir, isDev, vikeVitePluginOptions, doNotRestartViteOnError) {
|
|
92
|
-
if (!vikeConfigPromise) {
|
|
90
|
+
if (!globalObject.vikeConfigPromise) {
|
|
93
91
|
resolveVikeConfigInternal_withErrorHandling(userRootDir, isDev, vikeVitePluginOptions, doNotRestartViteOnError);
|
|
94
92
|
}
|
|
95
|
-
(0, utils_js_1.assert)(vikeConfigPromise);
|
|
96
|
-
const vikeConfig = await vikeConfigPromise;
|
|
93
|
+
(0, utils_js_1.assert)(globalObject.vikeConfigPromise);
|
|
94
|
+
const vikeConfig = await globalObject.vikeConfigPromise;
|
|
97
95
|
return vikeConfig;
|
|
98
96
|
}
|
|
99
97
|
async function getVikeConfigInternalOptional() {
|
|
100
|
-
if (!vikeConfigPromise)
|
|
98
|
+
if (!globalObject.vikeConfigPromise)
|
|
101
99
|
return null;
|
|
102
|
-
const vikeConfig = await vikeConfigPromise;
|
|
100
|
+
const vikeConfig = await globalObject.vikeConfigPromise;
|
|
103
101
|
return vikeConfig;
|
|
104
102
|
}
|
|
105
103
|
function isV1Design() {
|
|
106
|
-
(0, utils_js_1.assert)(typeof isV1Design_ === 'boolean');
|
|
107
|
-
return isV1Design_;
|
|
104
|
+
(0, utils_js_1.assert)(typeof globalObject.isV1Design_ === 'boolean');
|
|
105
|
+
return globalObject.isV1Design_;
|
|
108
106
|
}
|
|
109
107
|
async function resolveVikeConfigInternal_withErrorHandling(userRootDir, isDev, vikeVitePluginOptions, doNotRestartViteOnError) {
|
|
110
108
|
const { promise, resolve, reject } = (0, utils_js_1.genPromise)();
|
|
111
|
-
vikeConfigPromise = promise;
|
|
109
|
+
globalObject.vikeConfigPromise = promise;
|
|
112
110
|
const esbuildCache = {
|
|
113
111
|
transpileCache: {},
|
|
114
112
|
vikeConfigDependencies: new Set(),
|
|
@@ -125,10 +123,10 @@ async function resolveVikeConfigInternal_withErrorHandling(userRootDir, isDev, v
|
|
|
125
123
|
}
|
|
126
124
|
// There is a newer call — let the new call supersede the old one.
|
|
127
125
|
// We deliberately swallow the intermetidate state (including any potential error) — it's now outdated and has existed only for a very short period of time.
|
|
128
|
-
if (vikeConfigPromise !== promise) {
|
|
126
|
+
if (globalObject.vikeConfigPromise !== promise) {
|
|
129
127
|
// vikeConfigPromise.then(resolve).catch(reject)
|
|
130
128
|
try {
|
|
131
|
-
resolve(await vikeConfigPromise);
|
|
129
|
+
resolve(await globalObject.vikeConfigPromise);
|
|
132
130
|
}
|
|
133
131
|
catch (err) {
|
|
134
132
|
reject(err);
|
|
@@ -138,13 +136,13 @@ async function resolveVikeConfigInternal_withErrorHandling(userRootDir, isDev, v
|
|
|
138
136
|
if (!hasError) {
|
|
139
137
|
(0, utils_js_1.assert)(ret);
|
|
140
138
|
(0, utils_js_1.assert)(err === undefined);
|
|
141
|
-
const hadError = vikeConfigHasBuildError;
|
|
142
|
-
vikeConfigHasBuildError = false;
|
|
139
|
+
const hadError = globalObject.vikeConfigHasBuildError;
|
|
140
|
+
globalObject.vikeConfigHasBuildError = false;
|
|
143
141
|
(0, getVikeConfigError_js_1.setVikeConfigError)({ errorBuild: false });
|
|
144
142
|
if (hadError) {
|
|
145
143
|
(0, loggerNotProd_js_1.logConfigErrorRecover)();
|
|
146
|
-
if (restartVite) {
|
|
147
|
-
restartVite = false;
|
|
144
|
+
if (globalObject.restartVite) {
|
|
145
|
+
globalObject.restartVite = false;
|
|
148
146
|
restartViteDevServer();
|
|
149
147
|
}
|
|
150
148
|
}
|
|
@@ -153,10 +151,10 @@ async function resolveVikeConfigInternal_withErrorHandling(userRootDir, isDev, v
|
|
|
153
151
|
else {
|
|
154
152
|
(0, utils_js_1.assert)(ret === undefined);
|
|
155
153
|
(0, utils_js_1.assert)(err);
|
|
156
|
-
vikeConfigHasBuildError = true;
|
|
154
|
+
globalObject.vikeConfigHasBuildError = true;
|
|
157
155
|
(0, getVikeConfigError_js_1.setVikeConfigError)({ errorBuild: { err } });
|
|
158
156
|
if (!doNotRestartViteOnError)
|
|
159
|
-
restartVite = true;
|
|
157
|
+
globalObject.restartVite = true;
|
|
160
158
|
if (!isDev) {
|
|
161
159
|
reject(err);
|
|
162
160
|
}
|
|
@@ -170,8 +168,8 @@ async function resolveVikeConfigInternal(userRootDir, vikeVitePluginOptions, esb
|
|
|
170
168
|
const plusFilesAll = await (0, getPlusFilesAll_js_1.getPlusFilesAll)(userRootDir, esbuildCache);
|
|
171
169
|
const configDefinitionsResolved = await resolveConfigDefinitions(plusFilesAll, userRootDir, esbuildCache);
|
|
172
170
|
const { pageConfigGlobal, pageConfigs } = getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRootDir);
|
|
173
|
-
if (!isV1Design_)
|
|
174
|
-
isV1Design_ = pageConfigs.length > 0;
|
|
171
|
+
if (!globalObject.isV1Design_)
|
|
172
|
+
globalObject.isV1Design_ = pageConfigs.length > 0;
|
|
175
173
|
// Backwards compatibility for vike(options) in vite.config.js
|
|
176
174
|
temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, userRootDir);
|
|
177
175
|
setCliAndApiOptions(pageConfigGlobal, configDefinitionsResolved);
|
|
@@ -197,7 +195,7 @@ async function resolveVikeConfigInternal(userRootDir, vikeVitePluginOptions, esb
|
|
|
197
195
|
prerenderContext,
|
|
198
196
|
_vikeConfigDependencies: esbuildCache.vikeConfigDependencies,
|
|
199
197
|
};
|
|
200
|
-
vikeConfigSync = vikeConfig;
|
|
198
|
+
globalObject.vikeConfigSync = vikeConfig;
|
|
201
199
|
return vikeConfig;
|
|
202
200
|
}
|
|
203
201
|
async function resolveConfigDefinitions(plusFilesAll, userRootDir, esbuildCache) {
|
|
@@ -1102,7 +1100,7 @@ function isGlobalLocation(locationId, plusFilesAll) {
|
|
|
1102
1100
|
}
|
|
1103
1101
|
function resolvePrerenderContext(vikeConfig) {
|
|
1104
1102
|
const { isPrerenderingEnabled, isPrerenderingEnabledForAllPages } = (0, resolvePrerenderConfig_js_1.resolvePrerenderConfigGlobal)(vikeConfig);
|
|
1105
|
-
prerenderContext ?? (prerenderContext = {
|
|
1103
|
+
globalObject.prerenderContext ?? (globalObject.prerenderContext = {
|
|
1106
1104
|
isPrerenderingEnabled: false,
|
|
1107
1105
|
isPrerenderingEnabledForAllPages: false,
|
|
1108
1106
|
// Set at runPrerender()
|
|
@@ -1110,9 +1108,9 @@ function resolvePrerenderContext(vikeConfig) {
|
|
|
1110
1108
|
// Set at runPrerender()
|
|
1111
1109
|
pageContexts: null,
|
|
1112
1110
|
});
|
|
1113
|
-
prerenderContext.isPrerenderingEnabled = isPrerenderingEnabled;
|
|
1114
|
-
prerenderContext.isPrerenderingEnabledForAllPages = isPrerenderingEnabledForAllPages;
|
|
1115
|
-
return prerenderContext;
|
|
1111
|
+
globalObject.prerenderContext.isPrerenderingEnabled = isPrerenderingEnabled;
|
|
1112
|
+
globalObject.prerenderContext.isPrerenderingEnabledForAllPages = isPrerenderingEnabledForAllPages;
|
|
1113
|
+
return globalObject.prerenderContext;
|
|
1116
1114
|
}
|
|
1117
1115
|
function restartViteDevServer() {
|
|
1118
1116
|
const viteDevServer = (0, globalContext_js_1.getViteDevServer)();
|
|
@@ -1149,7 +1147,7 @@ function getVikeConfigDummy(esbuildCache) {
|
|
|
1149
1147
|
prerenderContext: prerenderContextDummy,
|
|
1150
1148
|
_vikeConfigDependencies: esbuildCache.vikeConfigDependencies,
|
|
1151
1149
|
};
|
|
1152
|
-
vikeConfigSync = vikeConfigDummy;
|
|
1153
|
-
isV1Design_ = true;
|
|
1150
|
+
globalObject.vikeConfigSync = vikeConfigDummy;
|
|
1151
|
+
globalObject.isV1Design_ = true;
|
|
1154
1152
|
return vikeConfigDummy;
|
|
1155
1153
|
}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.assertVersion = assertVersion;
|
|
4
4
|
exports.isVersionOrAbove = isVersionOrAbove;
|
|
5
5
|
const assert_js_1 = require("./assert.js");
|
|
6
|
+
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
7
|
+
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
6
8
|
function assertVersion(dependencyName, versionActual, versionExpected) {
|
|
7
9
|
(0, assert_js_1.assert)(versionActual);
|
|
8
10
|
(0, assert_js_1.assert)(versionExpected);
|
package/dist/cjs/utils/debug.js
CHANGED
|
@@ -5,17 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.createDebugger = createDebugger;
|
|
7
7
|
exports.isDebugActivated = isDebugActivated;
|
|
8
|
-
const isBrowser_js_1 = require("./isBrowser.js");
|
|
9
8
|
const isCallable_js_1 = require("./isCallable.js");
|
|
10
9
|
const objectAssign_js_1 = require("./objectAssign.js");
|
|
11
10
|
const assert_js_1 = require("./assert.js");
|
|
12
11
|
const checkType_js_1 = require("./checkType.js");
|
|
13
|
-
const
|
|
12
|
+
const getTerminalWidth_js_1 = require("./getTerminalWidth.js");
|
|
14
13
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
15
14
|
const isArray_js_1 = require("./isArray.js");
|
|
16
15
|
const isObject_js_1 = require("./isObject.js");
|
|
17
16
|
const debug_js_1 = require("../shared/route/debug.js");
|
|
18
|
-
|
|
17
|
+
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
18
|
+
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
19
19
|
(0, debug_js_1.setCreateDebugger)(createDebugger); // for isomorphic code
|
|
20
20
|
const flags = [
|
|
21
21
|
'vike:crawl',
|
|
@@ -117,7 +117,7 @@ function formatMsg(info, options, padding, position) {
|
|
|
117
117
|
return str;
|
|
118
118
|
}
|
|
119
119
|
function pad(str, padding) {
|
|
120
|
-
const terminalWidth = (0,
|
|
120
|
+
const terminalWidth = (0, getTerminalWidth_js_1.getTerminalWidth)();
|
|
121
121
|
const lines = [];
|
|
122
122
|
str.split('\n').forEach((line) => {
|
|
123
123
|
if (!terminalWidth) {
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getGlobalObject = getGlobalObject;
|
|
4
|
-
exports.assertIsSingleModuleInstance = assertIsSingleModuleInstance;
|
|
5
|
-
const assert_js_1 = require("./assert.js");
|
|
6
4
|
/** Share information across module instances. */
|
|
7
|
-
function getGlobalObject(
|
|
8
|
-
const
|
|
9
|
-
const globalObject = (
|
|
5
|
+
function getGlobalObject(moduleId, defaultValue) {
|
|
6
|
+
const globals = getGlobals();
|
|
7
|
+
const globalObject = (globals[moduleId] ?? (globals[moduleId] = defaultValue));
|
|
10
8
|
return globalObject;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
(
|
|
16
|
-
|
|
17
|
-
function getGlobalObjects() {
|
|
18
|
-
const projectKey = '_vike';
|
|
19
|
-
// @ts-ignore
|
|
20
|
-
const globalObjects = (globalThis[projectKey] = globalThis[projectKey] || {});
|
|
21
|
-
return globalObjects;
|
|
10
|
+
function getGlobals() {
|
|
11
|
+
var _a;
|
|
12
|
+
globalThis._vike ?? (globalThis._vike = {});
|
|
13
|
+
(_a = globalThis._vike).globals ?? (_a.globals = {});
|
|
14
|
+
return globalThis._vike.globals;
|
|
22
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.scriptFileExtensionPattern = exports.scriptFileExtensionList = void 0;
|
|
4
4
|
exports.isScriptFile = isScriptFile;
|
|
5
5
|
exports.isPlainScriptFile = isPlainScriptFile;
|
|
6
6
|
exports.isTemplateFile = isTemplateFile;
|
package/dist/cjs/utils/path.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pathJoin = pathJoin;
|
|
4
4
|
exports.pathIsRelative = pathIsRelative;
|
|
5
|
+
exports.pathIsAbsolute = pathIsAbsolute;
|
|
5
6
|
exports.toPosixPath = toPosixPath;
|
|
6
7
|
exports.assertPosixPath = assertPosixPath;
|
|
7
8
|
// Utilities for handling file paths.
|
|
@@ -22,12 +23,11 @@ function pathJoin(path1, path2) {
|
|
|
22
23
|
joined = '/' + joined;
|
|
23
24
|
return joined;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
const IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]
|
|
27
|
-
function pathIsAbsolute(filePath
|
|
28
|
-
|
|
26
|
+
// https://github.com/brillout/telefunc/blob/0fd44322acbd07857ae29361ba7c998607f17dd5/telefunc/utils/path-shim.ts#L17-L21
|
|
27
|
+
const IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
28
|
+
function pathIsAbsolute(filePath) {
|
|
29
|
+
return IS_ABSOLUTE_RE.test(filePath);
|
|
29
30
|
}
|
|
30
|
-
//*/
|
|
31
31
|
/**********************/
|
|
32
32
|
/****** UTILS *********/
|
|
33
33
|
/**********************/
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.requireResolveOptional = requireResolveOptional;
|
|
7
7
|
exports.requireResolveOptionalDir = requireResolveOptionalDir;
|
|
8
8
|
exports.requireResolveNpmPackage = requireResolveNpmPackage;
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
9
|
+
exports.requireResolveDistFile = requireResolveDistFile;
|
|
10
|
+
exports.getPackageNodeModulesDirectory = getPackageNodeModulesDirectory;
|
|
11
11
|
const assert_js_1 = require("./assert.js");
|
|
12
12
|
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
13
13
|
const assertSetup_js_1 = require("./assertSetup.js");
|
|
@@ -109,11 +109,11 @@ function requireResolveNpmPackage({ importPathNpmPackage, userRootDir, }) {
|
|
|
109
109
|
throw res.err;
|
|
110
110
|
return res.importPathResolvedFilePath;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
const
|
|
114
|
-
(0, path_js_1.assertPosixPath)(
|
|
115
|
-
(0, path_js_1.assertPosixPath)(
|
|
116
|
-
const importPathResolvedFilePath = makeNodeFriendly(node_path_1.default.posix.join(
|
|
112
|
+
function requireResolveDistFile(distFile) {
|
|
113
|
+
const packageNodeModulesDirectory = getPackageNodeModulesDirectory();
|
|
114
|
+
(0, path_js_1.assertPosixPath)(packageNodeModulesDirectory);
|
|
115
|
+
(0, path_js_1.assertPosixPath)(distFile);
|
|
116
|
+
const importPathResolvedFilePath = makeNodeFriendly(node_path_1.default.posix.join(packageNodeModulesDirectory, distFile));
|
|
117
117
|
// Double check
|
|
118
118
|
{
|
|
119
119
|
const res = requireResolve_(importPathResolvedFilePath,
|
|
@@ -171,11 +171,12 @@ function addFileExtensionsToRequireResolve(require_) {
|
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
// [RELATIVE_PATH_FROM_DIST] Current file:
|
|
176
|
-
(0, assert_js_1.assert)(importMetaUrl.includes('/dist/esm/') || importMetaUrl.includes('/dist/cjs/'));
|
|
177
|
-
const
|
|
178
|
-
|
|
174
|
+
function getPackageNodeModulesDirectory() {
|
|
175
|
+
// [RELATIVE_PATH_FROM_DIST] Current file: node_modules/${packageName}/dist/esm/utils/requireResolve.js
|
|
176
|
+
(0, assert_js_1.assert)(importMetaUrl.includes('/dist/esm/utils/') || importMetaUrl.includes('/dist/cjs/utils/'));
|
|
177
|
+
const packageNodeModulesDirectory = node_path_1.default.posix.join(removeFilePrefix(node_path_1.default.dirname(importMetaUrl)), '../../../');
|
|
178
|
+
// Return `node_modules/${packageName}/`
|
|
179
|
+
return packageNodeModulesDirectory;
|
|
179
180
|
}
|
|
180
181
|
function getFakeImporterFile(dirPath) {
|
|
181
182
|
(0, path_js_1.assertPosixPath)(dirPath);
|
|
@@ -8,6 +8,7 @@ import { type PageContextFromRewrite } from '../../shared/route/abort.js';
|
|
|
8
8
|
import { type ScrollTarget } from './setScrollPosition.js';
|
|
9
9
|
import type { VikeConfigPublicPageLazyLoaded } from '../../shared/getPageFiles.js';
|
|
10
10
|
import type { PageContextClient } from '../../types/PageContext.js';
|
|
11
|
+
import type { VikeGlobalInternal } from '../../types/VikeGlobalInternal.js';
|
|
11
12
|
declare const firstRenderStartPromise: Promise<void>;
|
|
12
13
|
type PageContextRouted = {
|
|
13
14
|
pageId: string;
|
|
@@ -156,9 +157,7 @@ declare function getPageContextBegin(isForErrorPage: boolean, { urlOriginal, isB
|
|
|
156
157
|
}) | null;
|
|
157
158
|
}>;
|
|
158
159
|
declare global {
|
|
159
|
-
var _vike:
|
|
160
|
-
fullyRenderedUrl?: string;
|
|
161
|
-
} | undefined;
|
|
160
|
+
var _vike: VikeGlobalInternal;
|
|
162
161
|
}
|
|
163
162
|
declare function disableClientRouting(err: unknown, log: boolean): void;
|
|
164
163
|
declare function getRenderCount(): number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isFontFallback } from '../../renderPage/isFontFallback.js';
|
|
2
1
|
export { getHtmlTags };
|
|
3
2
|
import { assert, assertWarning, assertUsage, isObject, freezePartial } from '../../utils.js';
|
|
4
3
|
import { getGlobalContextClientSerialized, getPageContextClientSerialized, } from '../serializeContext.js';
|
|
@@ -10,6 +9,7 @@ import { getConfigValueRuntime } from '../../../../shared/page-configs/getConfig
|
|
|
10
9
|
import pc from '@brillout/picocolors';
|
|
11
10
|
import { getConfigDefinedAt } from '../../../../shared/page-configs/getConfigDefinedAt.js';
|
|
12
11
|
import { htmlElementId_globalContext, htmlElementId_pageContext } from '../../../../shared/htmlElementIds.js';
|
|
12
|
+
import { isFontFallback } from '../../renderPage/isFontFallback.js';
|
|
13
13
|
const stamp = '__injectFilterEntry';
|
|
14
14
|
async function getHtmlTags(pageContext, streamFromReactStreamingPackage, injectFilter, pageAssets, viteDevScript, isStream) {
|
|
15
15
|
assert([true, false].includes(pageContext._isHtmlOnly));
|
|
@@ -6,6 +6,12 @@ import { type GlobalContextServerInternal } from './globalContext.js';
|
|
|
6
6
|
import { type HttpResponse } from './renderPage/createHttpResponse.js';
|
|
7
7
|
import type { PageContextServer } from '../../types/index.js';
|
|
8
8
|
import type { PageContextInternalServer } from '../../types/PageContext.js';
|
|
9
|
+
declare const globalObject: {
|
|
10
|
+
httpRequestsCount: number;
|
|
11
|
+
asyncHookWrapper: <PageContext>(_httpRequestId: number, ret: () => Promise<PageContext>) => Promise<{
|
|
12
|
+
pageContextReturn: Awaited<PageContext>;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
9
15
|
type PageContextInit = Pick<PageContextInternalServer, 'urlOriginal' | 'headersOriginal'> & {
|
|
10
16
|
/** @deprecated Set `pageContextInit.urlOriginal` instead */ url?: string;
|
|
11
17
|
/** @deprecated Set pageContextInit.headersOriginal instead */ headers?: Record<string, string>;
|
|
@@ -14,10 +20,7 @@ type PageContextBegin = ReturnType<typeof getPageContextBegin>;
|
|
|
14
20
|
declare function renderPage<PageContextUserAdded extends {}, PageContextInitUser extends PageContextInit>(pageContextInit: PageContextInitUser): Promise<PageContextInitUser & {
|
|
15
21
|
httpResponse: HttpResponse;
|
|
16
22
|
} & Partial<PageContextServer & PageContextUserAdded>>;
|
|
17
|
-
declare
|
|
18
|
-
pageContextReturn: Awaited<PageContext>;
|
|
19
|
-
}>;
|
|
20
|
-
declare function renderPage_addAsyncHookwrapper(wrapper: typeof asyncHookWrapper): void;
|
|
23
|
+
declare function renderPage_addAsyncHookwrapper(wrapper: typeof globalObject.asyncHookWrapper): void;
|
|
21
24
|
declare function getPageContextBegin(pageContextInit: PageContextInit, globalContext: GlobalContextServerInternal, httpRequestId: number): {
|
|
22
25
|
_isOriginalObject: true;
|
|
23
26
|
isPageContext: true;
|