vike 0.4.237-commit-2c1db32 → 0.4.237-commit-33e34e7
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/__internal/index.js +3 -3
- package/dist/cjs/node/api/context.js +13 -12
- package/dist/cjs/node/api/dev.js +0 -2
- package/dist/cjs/node/api/index.js +0 -2
- package/dist/cjs/node/api/onLoad.js +2 -2
- package/dist/cjs/node/api/prepareViteApiCall.js +2 -2
- package/dist/cjs/node/api/preview.js +1 -2
- package/dist/cjs/node/api/utils.js +1 -0
- package/dist/cjs/node/cli/index.js +2 -2
- package/dist/cjs/node/cli/onLoad.js +2 -2
- package/dist/cjs/node/runtime/globalContext.js +114 -97
- package/dist/cjs/node/runtime/utils.js +1 -0
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +0 -2
- package/dist/cjs/node/vite/plugins/pluginBuild/handleAssetsManifest.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildApp.js +5 -6
- package/dist/cjs/node/vite/plugins/pluginBuild/{pluginBuildEntry.js → pluginProdBuildEntry.js} +6 -6
- package/dist/cjs/node/vite/plugins/pluginBuild.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginNonRunnableDev.js +9 -5
- package/dist/cjs/node/vite/plugins/pluginSetGlobalContext.js +1 -1
- package/dist/cjs/node/vite/shared/resolveVikeConfigInternal.js +3 -3
- package/dist/cjs/shared/createGlobalContextShared.js +6 -4
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assertSetup.js +2 -3
- package/dist/cjs/utils/isNonRunnableDev.js +12 -0
- package/dist/esm/__internal/index.d.ts +1 -1
- package/dist/esm/__internal/index.js +3 -3
- package/dist/esm/node/api/build.d.ts +2 -2
- package/dist/esm/node/api/context.d.ts +10 -10
- package/dist/esm/node/api/context.js +13 -12
- package/dist/esm/node/api/dev.d.ts +2 -2
- package/dist/esm/node/api/dev.js +0 -2
- package/dist/esm/node/api/index.js +0 -2
- package/dist/esm/node/api/onLoad.js +1 -1
- package/dist/esm/node/api/prepareViteApiCall.d.ts +3 -3
- package/dist/esm/node/api/prepareViteApiCall.js +3 -3
- package/dist/esm/node/api/preview.d.ts +2 -2
- package/dist/esm/node/api/preview.js +1 -2
- package/dist/esm/node/api/types.d.ts +4 -4
- package/dist/esm/node/api/utils.d.ts +1 -0
- package/dist/esm/node/api/utils.js +1 -0
- package/dist/esm/node/cli/index.js +1 -1
- package/dist/esm/node/cli/onLoad.js +1 -1
- package/dist/esm/node/prerender/runPrerender.d.ts +2 -2
- package/dist/esm/node/runtime/globalContext.d.ts +4 -4
- package/dist/esm/node/runtime/globalContext.js +111 -94
- package/dist/esm/node/runtime/utils.d.ts +1 -0
- package/dist/esm/node/runtime/utils.js +1 -0
- package/dist/esm/node/runtime-dev/createDevMiddleware.d.ts +2 -2
- package/dist/esm/node/runtime-dev/createDevMiddleware.js +0 -2
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.js +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildApp.d.ts +0 -2
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildApp.js +5 -6
- package/dist/esm/node/vite/plugins/pluginBuild/{pluginBuildEntry.d.ts → pluginProdBuildEntry.d.ts} +2 -2
- package/dist/esm/node/vite/plugins/pluginBuild/{pluginBuildEntry.js → pluginProdBuildEntry.js} +6 -6
- package/dist/esm/node/vite/plugins/pluginBuild.js +2 -2
- package/dist/esm/node/vite/plugins/pluginNonRunnableDev.js +9 -5
- package/dist/esm/node/vite/plugins/pluginSetGlobalContext.js +2 -2
- package/dist/esm/node/vite/shared/resolveVikeConfigInternal.js +4 -4
- package/dist/esm/shared/createGlobalContextShared.d.ts +1 -0
- package/dist/esm/shared/createGlobalContextShared.js +7 -5
- package/dist/esm/types/PageConfig.d.ts +2 -2
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assertSetup.js +2 -3
- package/dist/esm/utils/isNonRunnableDev.d.ts +2 -0
- package/dist/esm/utils/isNonRunnableDev.js +10 -0
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setGlobalContext_prodBuildEntry = void 0;
|
|
4
4
|
exports.route = route;
|
|
5
5
|
exports.getPagesAndRoutes = getPagesAndRoutes;
|
|
6
|
-
//
|
|
6
|
+
// Used by vike:build:pluginProdBuildEntry
|
|
7
7
|
var globalContext_js_1 = require("../node/runtime/globalContext.js");
|
|
8
|
-
Object.defineProperty(exports, "
|
|
8
|
+
Object.defineProperty(exports, "setGlobalContext_prodBuildEntry", { enumerable: true, get: function () { return globalContext_js_1.setGlobalContext_prodBuildEntry; } });
|
|
9
9
|
const index_js_1 = require("../shared/route/index.js");
|
|
10
10
|
const globalContext_js_2 = require("../node/runtime/globalContext.js");
|
|
11
11
|
const assertSetup_js_1 = require("../utils/assertSetup.js");
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isVikeCliOrApi = isVikeCliOrApi;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
7
|
-
|
|
4
|
+
exports.setContextVikeApiOperation = setContextVikeApiOperation;
|
|
5
|
+
exports.clearContextVikeApiOperation = clearContextVikeApiOperation;
|
|
6
|
+
exports.getVikeApiOperation = getVikeApiOperation;
|
|
7
|
+
// We don't import from ./utils.js because we tolerate this file to be loaded in production
|
|
8
|
+
const utils_js_1 = require("../runtime/utils.js");
|
|
8
9
|
const globalObject = (0, utils_js_1.getGlobalObject)('api/context.ts', {});
|
|
9
|
-
function
|
|
10
|
-
return globalObject.
|
|
10
|
+
function getVikeApiOperation() {
|
|
11
|
+
return globalObject.vikeApiOperation ?? null;
|
|
11
12
|
}
|
|
12
13
|
function isVikeCliOrApi() {
|
|
13
14
|
// The CLI uses the API
|
|
14
|
-
return !!globalObject.
|
|
15
|
+
return !!globalObject.vikeApiOperation;
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
(0, utils_js_1.assert)(!globalObject.
|
|
18
|
-
globalObject.
|
|
17
|
+
function setContextVikeApiOperation(operation, options) {
|
|
18
|
+
(0, utils_js_1.assert)(!globalObject.vikeApiOperation);
|
|
19
|
+
globalObject.vikeApiOperation = { operation, options };
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
-
globalObject.
|
|
21
|
+
function clearContextVikeApiOperation() {
|
|
22
|
+
globalObject.vikeApiOperation = undefined;
|
|
22
23
|
}
|
package/dist/cjs/node/api/dev.js
CHANGED
|
@@ -3,14 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.dev = dev;
|
|
4
4
|
const prepareViteApiCall_js_1 = require("./prepareViteApiCall.js");
|
|
5
5
|
const vite_1 = require("vite");
|
|
6
|
-
const globalContext_js_1 = require("../runtime/globalContext.js");
|
|
7
6
|
/**
|
|
8
7
|
* Programmatically trigger `$ vike dev`
|
|
9
8
|
*
|
|
10
9
|
* https://vike.dev/api#dev
|
|
11
10
|
*/
|
|
12
11
|
async function dev(options = {}) {
|
|
13
|
-
(0, globalContext_js_1.setGlobalContext_isProduction)(false);
|
|
14
12
|
const { viteConfigFromUserEnhanced } = await (0, prepareViteApiCall_js_1.prepareViteApiCall)(options, 'dev');
|
|
15
13
|
const server = await (0, vite_1.createServer)(viteConfigFromUserEnhanced);
|
|
16
14
|
return {
|
|
@@ -34,8 +34,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.prerender = exports.preview = exports.dev = exports.build = void 0;
|
|
37
|
-
const assertIsNotBrowser_js_1 = require("../../utils/assertIsNotBrowser.js");
|
|
38
|
-
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
39
37
|
const build_ = async (...args) => (await Promise.resolve().then(() => __importStar(require('./build.js')))).build(...args);
|
|
40
38
|
exports.build = build_;
|
|
41
39
|
const dev_ = async (...args) => (await Promise.resolve().then(() => __importStar(require('./dev.js')))).dev(...args);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.onLoad = onLoad;
|
|
4
4
|
const assertIsNotBrowser_js_1 = require("../../utils/assertIsNotBrowser.js");
|
|
5
|
-
const
|
|
5
|
+
const assertSetup_js_1 = require("../../utils/assertSetup.js");
|
|
6
6
|
function onLoad() {
|
|
7
7
|
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
8
|
-
(0,
|
|
8
|
+
(0, assertSetup_js_1.assertIsNotProductionRuntime)();
|
|
9
9
|
}
|
|
@@ -51,13 +51,13 @@ const getEnvVarObject_js_1 = require("../vite/shared/getEnvVarObject.js");
|
|
|
51
51
|
const globalObject = (0, utils_js_1.getGlobalObject)('api/prepareViteApiCall.ts', {});
|
|
52
52
|
async function prepareViteApiCall(options, operation) {
|
|
53
53
|
clear();
|
|
54
|
-
(0, context_js_1.
|
|
54
|
+
(0, context_js_1.setContextVikeApiOperation)(operation, options);
|
|
55
55
|
const viteConfigFromUserApiOptions = options.viteConfig;
|
|
56
56
|
return resolveConfigs(viteConfigFromUserApiOptions, operation);
|
|
57
57
|
}
|
|
58
58
|
// For subsequent API calls, e.g. calling prerender() after build()
|
|
59
59
|
function clear() {
|
|
60
|
-
(0, context_js_1.
|
|
60
|
+
(0, context_js_1.clearContextVikeApiOperation)();
|
|
61
61
|
(0, globalContext_js_1.clearGlobalContext)();
|
|
62
62
|
}
|
|
63
63
|
async function resolveConfigs(viteConfigFromUserApiOptions, operation) {
|
|
@@ -11,14 +11,13 @@ const getOutDirs_js_1 = require("../vite/shared/getOutDirs.js");
|
|
|
11
11
|
const utils_js_1 = require("./utils.js");
|
|
12
12
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
13
13
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
-
const utils_js_2 = require("../runtime/utils.js");
|
|
15
14
|
/**
|
|
16
15
|
* Programmatically trigger `$ vike preview`
|
|
17
16
|
*
|
|
18
17
|
* https://vike.dev/api#preview
|
|
19
18
|
*/
|
|
20
19
|
async function preview(options = {}) {
|
|
21
|
-
(0,
|
|
20
|
+
(0, utils_js_1.onSetupPreview)();
|
|
22
21
|
const { viteConfigFromUserEnhanced, viteConfigResolved } = await (0, prepareViteApiCall_js_1.prepareViteApiCall)(options, 'preview');
|
|
23
22
|
if (viteConfigResolved.vitePluginServerEntry?.inject) {
|
|
24
23
|
const outDir = (0, getOutDirs_js_1.getOutDirs)(viteConfigResolved, undefined).outDirRoot;
|
|
@@ -24,3 +24,4 @@ __exportStar(require("../../utils/path.js"), exports);
|
|
|
24
24
|
__exportStar(require("../../utils/isObject.js"), exports);
|
|
25
25
|
__exportStar(require("../../utils/assertVersion.js"), exports);
|
|
26
26
|
__exportStar(require("../../utils/pick.js"), exports);
|
|
27
|
+
__exportStar(require("../../utils/assertSetup.js"), exports);
|
|
@@ -7,6 +7,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.prerender = void 0;
|
|
8
8
|
var prerender_js_1 = require("../api/prerender.js");
|
|
9
9
|
Object.defineProperty(exports, "prerender", { enumerable: true, get: function () { return prerender_js_1.prerender; } });
|
|
10
|
-
const
|
|
10
|
+
const utils_js_1 = require("./utils.js");
|
|
11
11
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
12
|
-
(0,
|
|
12
|
+
(0, utils_js_1.assertWarning)(false, `${picocolors_1.default.cyan("import { prerender } from 'vike/cli'")} is deprecated in favor of ${picocolors_1.default.cyan("import { prerender } from 'vike/api'")}`, { onlyOnce: true });
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.onLoad = onLoad;
|
|
4
4
|
const assertIsNotBrowser_js_1 = require("../../utils/assertIsNotBrowser.js");
|
|
5
|
-
const
|
|
5
|
+
const assertSetup_js_1 = require("../../utils/assertSetup.js");
|
|
6
6
|
function onLoad() {
|
|
7
7
|
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
8
|
-
(0,
|
|
8
|
+
(0, assertSetup_js_1.assertIsNotProductionRuntime)();
|
|
9
9
|
}
|
|
@@ -16,22 +16,16 @@ exports.initGlobalContext_getPagesAndRoutes = initGlobalContext_getPagesAndRoute
|
|
|
16
16
|
exports.setGlobalContext_viteDevServer = setGlobalContext_viteDevServer;
|
|
17
17
|
exports.setGlobalContext_viteConfig = setGlobalContext_viteConfig;
|
|
18
18
|
exports.setGlobalContext_isPrerendering = setGlobalContext_isPrerendering;
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
19
|
+
exports.setGlobalContext_isProductionAccordingToVite = setGlobalContext_isProductionAccordingToVite;
|
|
20
|
+
exports.setGlobalContext_prodBuildEntry = setGlobalContext_prodBuildEntry;
|
|
21
21
|
exports.clearGlobalContext = clearGlobalContext;
|
|
22
22
|
exports.assertBuildInfo = assertBuildInfo;
|
|
23
23
|
exports.updateUserFiles = updateUserFiles;
|
|
24
|
-
// TODO/now: use isProductionEnvironment() instead of globalObject.isProduction
|
|
25
|
-
// TODO/now: rename:
|
|
26
|
-
// - isProduction => isProductionEnvironment
|
|
27
|
-
// - setIsProduction => setIsProductionEnvironment
|
|
28
|
-
// - setGlobalContext_isProduction => setGlobalContext_isProductionEnvironment
|
|
29
|
-
// - sProductionEnvironment => sDevEnv
|
|
30
24
|
// The core logic revolves around:
|
|
31
25
|
// - virtualFileExportsGlobalEntry is the main requirement
|
|
32
|
-
// - In production: globalObject.
|
|
33
|
-
// -
|
|
34
|
-
// - With vike-server it's set at server start: @brillout/vite-plugin-server-entry injects `import './entry.mjs'` (the production entry generated by @brillout/vite-plugin-server-entry) as first line of code of dist/server/index.mjs while dist/server/entry.mjs calls
|
|
26
|
+
// - In production: globalObject.prodBuildEntry which is the production entry set by @brillout/vite-plugin-server-entry
|
|
27
|
+
// - loadProdBuildEntry() sets globalObject.prodBuildEntry and then sets virtualFileExportsGlobalEntry
|
|
28
|
+
// - With vike-server it's set at server start: @brillout/vite-plugin-server-entry injects `import './entry.mjs'` (the production entry generated by @brillout/vite-plugin-server-entry) as first line of code of dist/server/index.mjs while dist/server/entry.mjs calls setGlobalContext_prodBuildEntry()
|
|
35
29
|
// - Without vike-server it's manually loaded here using importServerProductionEntry() which uses @brillout/vite-plugin-server-entry's autoImporter or crawler
|
|
36
30
|
// - In development: globalObject.viteDevServer which is Vite's development server
|
|
37
31
|
// - globalObject.viteDevServer is used by updateUserFiles() which then sets virtualFileExportsGlobalEntry
|
|
@@ -47,6 +41,7 @@ const prepareGlobalContextForPublicUsage_js_1 = require("../../shared/prepareGlo
|
|
|
47
41
|
const loggerRuntime_js_1 = require("./loggerRuntime.js");
|
|
48
42
|
const getVikeConfigError_js_1 = require("../shared/getVikeConfigError.js");
|
|
49
43
|
const isNewError_js_1 = require("./renderPage/isNewError.js");
|
|
44
|
+
const context_js_1 = require("../api/context.js");
|
|
50
45
|
const debug = (0, utils_js_1.createDebugger)('vike:globalContext');
|
|
51
46
|
const globalObject = (0, utils_js_1.getGlobalObject)('runtime/globalContext.ts', getInitialGlobalObject());
|
|
52
47
|
// Trick to break down TypeScript circular dependency
|
|
@@ -59,7 +54,7 @@ async function getGlobalContextServerInternal() {
|
|
|
59
54
|
// getGlobalContextServerInternal() should always be called after initGlobalContext()
|
|
60
55
|
(0, utils_js_1.assert)(globalObject.isInitialized);
|
|
61
56
|
assertGlobalContextIsDefined();
|
|
62
|
-
if (
|
|
57
|
+
if (!isProd())
|
|
63
58
|
await globalObject.waitForUserFilesUpdate;
|
|
64
59
|
const { globalContext } = globalObjectTyped;
|
|
65
60
|
assertIsDefined(globalContext);
|
|
@@ -84,10 +79,9 @@ function assertGlobalContextIsDefined() {
|
|
|
84
79
|
*/
|
|
85
80
|
async function getGlobalContext() {
|
|
86
81
|
debug('getGlobalContext()');
|
|
87
|
-
const
|
|
82
|
+
const isProduction = isProdOptional();
|
|
88
83
|
// This assertion cannot fail for vike-server users (because when using vike-server it's guaranteed that globalObject.isProduction is set before executing any user-land code and any Vike extension code).
|
|
89
|
-
(0, utils_js_1.assertUsage)(isProduction !==
|
|
90
|
-
(0, utils_js_1.assert)(typeof globalObject.isProduction === 'boolean');
|
|
84
|
+
(0, utils_js_1.assertUsage)(isProduction !== null, "The global context isn't set yet, use getGlobalContextAsync() instead.");
|
|
91
85
|
return await getGlobalContextAsync(isProduction);
|
|
92
86
|
}
|
|
93
87
|
/**
|
|
@@ -98,7 +92,7 @@ async function getGlobalContext() {
|
|
|
98
92
|
async function getGlobalContextAsync(isProduction) {
|
|
99
93
|
debug('getGlobalContextAsync()');
|
|
100
94
|
(0, utils_js_1.assertUsage)(typeof isProduction === 'boolean', `[getGlobalContextAsync(isProduction)] Argument ${picocolors_1.default.cyan('isProduction')} ${isProduction === undefined ? 'is missing' : `should be ${picocolors_1.default.cyan('true')} or ${picocolors_1.default.cyan('false')}`}`);
|
|
101
|
-
|
|
95
|
+
globalObject.isProductionAccordingToUser = isProduction;
|
|
102
96
|
if (!globalObject.globalContext)
|
|
103
97
|
await initGlobalContext_getGlobalContextAsync();
|
|
104
98
|
if (!isProduction)
|
|
@@ -115,9 +109,7 @@ function getGlobalContextSync() {
|
|
|
115
109
|
debug('getGlobalContextSync()');
|
|
116
110
|
const { globalContext } = globalObjectTyped;
|
|
117
111
|
(0, utils_js_1.assertUsage)(globalContext, createGlobalContextShared_js_1.getGlobalContextSyncErrMsg);
|
|
118
|
-
|
|
119
|
-
(0, utils_js_1.assert)(typeof isProd === 'boolean');
|
|
120
|
-
(0, utils_js_1.assertWarning)(isProd,
|
|
112
|
+
(0, utils_js_1.assertWarning)(isProd(),
|
|
121
113
|
// - We discourage users from using it in development because `pageContext.globalContext` is safer: I ain't sure but there could be race conditions when using `getGlobalContextSync()` inside React/Vue components upon HMR.
|
|
122
114
|
// - I don't see any issues with getGlobalContextSync() in production.
|
|
123
115
|
// - getGlobalContextSync() is used in production by vike-vercel
|
|
@@ -133,7 +125,6 @@ function getGlobalContextForPublicUsage() {
|
|
|
133
125
|
}
|
|
134
126
|
async function setGlobalContext_viteDevServer(viteDevServer) {
|
|
135
127
|
debug('setGlobalContext_viteDevServer()');
|
|
136
|
-
setIsProduction(false);
|
|
137
128
|
// We cannot cache globalObject.viteDevServer because it's fully replaced when the user modifies vite.config.js => Vite's dev server is fully reloaded and a new viteDevServer replaces the previous one.
|
|
138
129
|
if (!globalObject.viteDevServer) {
|
|
139
130
|
assertIsNotInitializedYet();
|
|
@@ -161,17 +152,9 @@ function assertIsNotInitializedYet() {
|
|
|
161
152
|
}
|
|
162
153
|
function setGlobalContext_isPrerendering() {
|
|
163
154
|
globalObject.isPrerendering = true;
|
|
164
|
-
setIsProduction(true);
|
|
165
155
|
}
|
|
166
|
-
function
|
|
167
|
-
|
|
168
|
-
debug('setGlobalContext_isProduction()', { isProduction, tolerateContradiction });
|
|
169
|
-
if (globalObject.isProduction === undefined) {
|
|
170
|
-
setIsProduction(isProduction);
|
|
171
|
-
}
|
|
172
|
-
else {
|
|
173
|
-
(0, utils_js_1.assert)(globalObject.isProduction === isProduction || tolerateContradiction);
|
|
174
|
-
}
|
|
156
|
+
function setGlobalContext_isProductionAccordingToVite(isProductionAccordingToVite) {
|
|
157
|
+
globalObject.isProductionAccordingToVite = isProductionAccordingToVite;
|
|
175
158
|
}
|
|
176
159
|
function getViteDevServer() {
|
|
177
160
|
return globalObject.viteDevServer ?? null;
|
|
@@ -181,15 +164,13 @@ function getViteConfig() {
|
|
|
181
164
|
}
|
|
182
165
|
async function initGlobalContext_renderPage() {
|
|
183
166
|
debug('initGlobalContext_renderPage()');
|
|
184
|
-
|
|
185
|
-
if (globalObject.isProduction === undefined)
|
|
186
|
-
setIsProduction(true);
|
|
167
|
+
globalObject.isAfterFirstRenderPageCall = true;
|
|
187
168
|
await initGlobalContext();
|
|
188
169
|
}
|
|
189
170
|
async function initGlobalContext_runPrerender() {
|
|
190
171
|
debug('initGlobalContext_runPrerender()');
|
|
191
172
|
(0, utils_js_1.assert)(globalObject.isPrerendering === true);
|
|
192
|
-
(0, utils_js_1.assert)(
|
|
173
|
+
(0, utils_js_1.assert)(isProd());
|
|
193
174
|
if (globalObject.initGlobalContext_runPrerender_alreadyCalled)
|
|
194
175
|
return;
|
|
195
176
|
globalObject.initGlobalContext_runPrerender_alreadyCalled = true;
|
|
@@ -207,36 +188,28 @@ async function initGlobalContext_getGlobalContextAsync() {
|
|
|
207
188
|
}
|
|
208
189
|
async function initGlobalContext_getPagesAndRoutes() {
|
|
209
190
|
debug('initGlobalContext_getPagesAndRoutes()');
|
|
210
|
-
|
|
191
|
+
globalObject.isProductionAccordingToPhotonVercel = true;
|
|
211
192
|
await initGlobalContext();
|
|
212
193
|
}
|
|
213
194
|
async function initGlobalContext() {
|
|
214
|
-
const
|
|
215
|
-
(0, utils_js_1.assert)(typeof isProduction === 'boolean');
|
|
195
|
+
const isProduction = isProd();
|
|
216
196
|
if (!isProduction) {
|
|
217
197
|
if (isProcessSharedWithVite()) {
|
|
218
198
|
await globalObject.viteDevServerPromise;
|
|
219
199
|
}
|
|
220
200
|
else {
|
|
221
|
-
(0, utils_js_1.assert)(isNonRunnableDev());
|
|
201
|
+
(0, utils_js_1.assert)((0, utils_js_1.isNonRunnableDev)());
|
|
222
202
|
await updateUserFiles();
|
|
223
203
|
}
|
|
224
204
|
(0, utils_js_1.assert)(globalObject.waitForUserFilesUpdate);
|
|
225
205
|
await globalObject.waitForUserFilesUpdate;
|
|
226
206
|
}
|
|
227
207
|
else {
|
|
228
|
-
await
|
|
208
|
+
await loadProdBuildEntry(globalObject.viteConfigRuntime?.build.outDir);
|
|
229
209
|
}
|
|
230
210
|
assertGlobalContextIsDefined();
|
|
231
211
|
globalObject.isInitialized = true;
|
|
232
212
|
}
|
|
233
|
-
function setIsProduction(isProduction) {
|
|
234
|
-
debug('setIsProduction', isProduction);
|
|
235
|
-
(0, utils_js_1.assert)(typeof isProduction === 'boolean');
|
|
236
|
-
if (globalObject.isProduction !== undefined)
|
|
237
|
-
(0, utils_js_1.assert)(globalObject.isProduction === isProduction);
|
|
238
|
-
globalObject.isProduction = isProduction;
|
|
239
|
-
}
|
|
240
213
|
function assertViteManifest(manifest) {
|
|
241
214
|
(0, utils_js_1.assert)((0, utils_js_1.isPlainObject)(manifest));
|
|
242
215
|
/* We should include these assertions but we don't as a workaround for PWA manifests: https://github.com/vikejs/vike/issues/769
|
|
@@ -250,57 +223,56 @@ function assertViteManifest(manifest) {
|
|
|
250
223
|
})
|
|
251
224
|
*/
|
|
252
225
|
}
|
|
253
|
-
async function
|
|
254
|
-
debug('
|
|
226
|
+
async function loadProdBuildEntry(outDir) {
|
|
227
|
+
debug('loadProdBuildEntry()');
|
|
255
228
|
if (globalObject.globalContext) {
|
|
256
|
-
debug('
|
|
229
|
+
debug('loadProdBuildEntry() - already done');
|
|
257
230
|
return;
|
|
258
231
|
}
|
|
259
|
-
if (!globalObject.
|
|
232
|
+
if (!globalObject.prodBuildEntry) {
|
|
260
233
|
debug('importServerProductionEntry()');
|
|
261
|
-
// importServerProductionEntry() loads dist/server/entry.mjs which calls
|
|
234
|
+
// importServerProductionEntry() loads dist/server/entry.mjs which calls setGlobalContext_prodBuildEntry()
|
|
262
235
|
await (0, runtime_1.importServerProductionEntry)({ outDir });
|
|
263
|
-
if (!globalObject.
|
|
264
|
-
debug('globalObject.
|
|
236
|
+
if (!globalObject.prodBuildEntry) {
|
|
237
|
+
debug('globalObject.prodBuildEntryPrevious');
|
|
265
238
|
// Needed, for example, when calling the API prerender() then preview() because both trigger a importServerProductionEntry() call but only the first only is applied because of the import() cache. (A proper implementation would be to clear the import() cache, but it probably isn't possible on platforms such as Cloudflare Workers.)
|
|
266
|
-
globalObject.
|
|
239
|
+
globalObject.prodBuildEntry = globalObject.prodBuildEntryPrevious;
|
|
267
240
|
}
|
|
268
|
-
(0, utils_js_1.assert)(globalObject.
|
|
269
|
-
// If using `inject` then dist/server/index.js imports dist/server/entry.js and
|
|
241
|
+
(0, utils_js_1.assert)(globalObject.prodBuildEntry);
|
|
242
|
+
// If using `inject` then dist/server/index.js imports dist/server/entry.js and loadProdBuildEntry() isn't needed.
|
|
270
243
|
// If dist/server/entry.js isn't imported then this means the user is running the original server entry `$ ts-node server/index.ts`.
|
|
271
244
|
(0, utils_js_1.assertWarning)(
|
|
272
245
|
// vike-server => `inject === true`
|
|
273
246
|
// vike-node => `inject === [ 'index' ]` => we don't show the warning to vike-node users (I don't remember why).
|
|
274
247
|
globalObject.buildInfo?.viteConfigRuntime.vitePluginServerEntry.inject !== true || globalObject.isPrerendering, `Run the built server entry (e.g. ${picocolors_1.default.cyan('$ node dist/server/index.mjs')}) instead of the original server entry (e.g. ${picocolors_1.default.cyan('$ ts-node server/index.ts')})`, { onlyOnce: true });
|
|
275
248
|
}
|
|
276
|
-
const {
|
|
277
|
-
|
|
278
|
-
globalObject.assetsManifest =
|
|
279
|
-
globalObject.buildInfo =
|
|
280
|
-
await createGlobalContext(
|
|
249
|
+
const { prodBuildEntry } = globalObject;
|
|
250
|
+
assertProdBuildEntry(prodBuildEntry);
|
|
251
|
+
globalObject.assetsManifest = prodBuildEntry.assetsManifest;
|
|
252
|
+
globalObject.buildInfo = prodBuildEntry.buildInfo;
|
|
253
|
+
await createGlobalContext(prodBuildEntry.virtualFileExportsGlobalEntry);
|
|
281
254
|
}
|
|
282
255
|
// This is the production entry, see:
|
|
283
|
-
// https://github.com/vikejs/vike/blob/
|
|
284
|
-
async function
|
|
285
|
-
debug('
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
globalObject.
|
|
289
|
-
globalObject.
|
|
290
|
-
|
|
291
|
-
await loadBuildEntry();
|
|
256
|
+
// https://github.com/vikejs/vike/blob/8c350e8105a626469e87594d983090919e82099b/packages/vike/node/vite/plugins/pluginBuild/pluginProdBuildEntry.ts#L47
|
|
257
|
+
async function setGlobalContext_prodBuildEntry(prodBuildEntry) {
|
|
258
|
+
debug('setGlobalContext_prodBuildEntry()');
|
|
259
|
+
assertProdBuildEntry(prodBuildEntry);
|
|
260
|
+
globalObject.prodBuildEntry = prodBuildEntry;
|
|
261
|
+
globalObject.prodBuildEntryPrevious = prodBuildEntry;
|
|
262
|
+
(0, utils_js_1.assert)(globalObject.prodBuildEntry); // ensure no infinite loop
|
|
263
|
+
await loadProdBuildEntry();
|
|
292
264
|
assertGlobalContextIsDefined();
|
|
293
|
-
debug('
|
|
294
|
-
}
|
|
295
|
-
function
|
|
296
|
-
(0, utils_js_1.assert)((0, utils_js_1.isObject)(
|
|
297
|
-
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(
|
|
298
|
-
const { virtualFileExportsGlobalEntry } =
|
|
299
|
-
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(
|
|
300
|
-
const { assetsManifest } =
|
|
265
|
+
debug('setGlobalContext_prodBuildEntry() - done');
|
|
266
|
+
}
|
|
267
|
+
function assertProdBuildEntry(prodBuildEntry) {
|
|
268
|
+
(0, utils_js_1.assert)((0, utils_js_1.isObject)(prodBuildEntry));
|
|
269
|
+
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(prodBuildEntry, 'virtualFileExportsGlobalEntry', 'object'));
|
|
270
|
+
const { virtualFileExportsGlobalEntry } = prodBuildEntry;
|
|
271
|
+
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(prodBuildEntry, 'assetsManifest', 'object'));
|
|
272
|
+
const { assetsManifest } = prodBuildEntry;
|
|
301
273
|
assertViteManifest(assetsManifest);
|
|
302
|
-
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(
|
|
303
|
-
const { buildInfo } =
|
|
274
|
+
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(prodBuildEntry, 'buildInfo', 'object'));
|
|
275
|
+
const { buildInfo } = prodBuildEntry;
|
|
304
276
|
assertBuildInfo(buildInfo);
|
|
305
277
|
(0, utils_js_1.checkType)({ virtualFileExportsGlobalEntry, assetsManifest, buildInfo });
|
|
306
278
|
}
|
|
@@ -323,7 +295,7 @@ function assertVersionAtBuildTime(versionAtBuildTime) {
|
|
|
323
295
|
}
|
|
324
296
|
async function updateUserFiles() {
|
|
325
297
|
debug('updateUserFiles()');
|
|
326
|
-
(0, utils_js_1.assert)(!
|
|
298
|
+
(0, utils_js_1.assert)(!isProd());
|
|
327
299
|
const { promise, resolve } = (0, utils_js_1.genPromise)();
|
|
328
300
|
globalObject.waitForUserFilesUpdate = promise;
|
|
329
301
|
globalObject.waitForUserFilesUpdateResolve ?? (globalObject.waitForUserFilesUpdateResolve = []);
|
|
@@ -420,13 +392,18 @@ async function updateUserFiles() {
|
|
|
420
392
|
async function createGlobalContext(virtualFileExportsGlobalEntry) {
|
|
421
393
|
debug('createGlobalContext()');
|
|
422
394
|
(0, utils_js_1.assert)(!(0, getVikeConfigError_js_1.getVikeConfigErrorBuild)());
|
|
423
|
-
const
|
|
395
|
+
const globalContextPromise = (0, createGlobalContextShared_js_1.createGlobalContextShared)(virtualFileExportsGlobalEntry, globalObject, addGlobalContext, addGlobalContextTmp, addGlobalContextAsync);
|
|
396
|
+
debug('createGlobalContext() - done [sync]');
|
|
397
|
+
// We define an early globalContext version synchronously, so that getGlobalContextSync() can be called early.
|
|
398
|
+
// - Required by vike-vercel
|
|
399
|
+
(0, utils_js_1.assert)(globalObject.globalContext);
|
|
400
|
+
const globalContext = await globalContextPromise;
|
|
401
|
+
debug('createGlobalContext() - done [async]');
|
|
424
402
|
(0, assertV1Design_js_1.assertV1Design)(
|
|
425
403
|
// pageConfigs is PageConfigRuntime[] but assertV1Design() requires PageConfigBuildTime[]
|
|
426
404
|
globalContext._pageConfigs.length > 0, globalContext._pageFilesAll);
|
|
427
405
|
assertGlobalContextIsDefined();
|
|
428
406
|
(0, utils_js_1.onSetupRuntime)();
|
|
429
|
-
debug('createGlobalContext() - done');
|
|
430
407
|
// Never actually used, only used for TypeScript `ReturnType<typeof createGlobalContext>`
|
|
431
408
|
return globalContext;
|
|
432
409
|
}
|
|
@@ -446,8 +423,8 @@ function addGlobalContextCommon(globalContext, pageRoutes, onBeforeRouteHook) {
|
|
|
446
423
|
_pageRoutes: pageRoutes,
|
|
447
424
|
_onBeforeRouteHook: onBeforeRouteHook,
|
|
448
425
|
};
|
|
449
|
-
const { viteDevServer, viteConfig, isPrerendering
|
|
450
|
-
|
|
426
|
+
const { viteDevServer, viteConfig, isPrerendering } = globalObject;
|
|
427
|
+
const isProduction = isProd();
|
|
451
428
|
if (!isProduction) {
|
|
452
429
|
(0, utils_js_1.assert)(globalContext); // main common requirement
|
|
453
430
|
(0, utils_js_1.assert)(!isPrerendering);
|
|
@@ -461,7 +438,7 @@ function addGlobalContextCommon(globalContext, pageRoutes, onBeforeRouteHook) {
|
|
|
461
438
|
};
|
|
462
439
|
}
|
|
463
440
|
else {
|
|
464
|
-
(0, utils_js_1.assert)(globalObject.
|
|
441
|
+
(0, utils_js_1.assert)(globalObject.prodBuildEntry);
|
|
465
442
|
(0, utils_js_1.assert)(globalContext); // main common requiement
|
|
466
443
|
const { buildInfo, assetsManifest } = globalObject;
|
|
467
444
|
(0, utils_js_1.assert)(buildInfo);
|
|
@@ -499,8 +476,8 @@ async function addGlobalContextAsync(globalContext) {
|
|
|
499
476
|
}
|
|
500
477
|
else {
|
|
501
478
|
(0, utils_js_1.assert)(!isProcessSharedWithVite()); // process shared with Vite => globalObject.viteConfigRuntime should be set
|
|
502
|
-
(0, utils_js_1.assert)(!
|
|
503
|
-
(0, utils_js_1.assert)(isNonRunnableDev());
|
|
479
|
+
(0, utils_js_1.assert)(!isProd()); // production => globalObject.buildInfo.viteConfigRuntime should be set
|
|
480
|
+
(0, utils_js_1.assert)((0, utils_js_1.isNonRunnableDev)());
|
|
504
481
|
const rpc = (0, utils_js_1.getViteRPC)();
|
|
505
482
|
viteConfigRuntime = await rpc.getViteConfigRuntimeRPC();
|
|
506
483
|
}
|
|
@@ -513,13 +490,12 @@ async function addGlobalContextAsync(globalContext) {
|
|
|
513
490
|
}
|
|
514
491
|
function clearGlobalContext() {
|
|
515
492
|
debug('clearGlobalContext()');
|
|
516
|
-
(0, utils_js_1.objectReplace)(globalObject, getInitialGlobalObject(), ['
|
|
493
|
+
(0, utils_js_1.objectReplace)(globalObject, getInitialGlobalObject(), ['prodBuildEntryPrevious']);
|
|
517
494
|
}
|
|
518
495
|
function getInitialGlobalObject() {
|
|
519
496
|
debug('getInitialGlobalObject()');
|
|
520
497
|
const { promise: viteDevServerPromise, resolve: viteDevServerPromiseResolve } = (0, utils_js_1.genPromise)();
|
|
521
498
|
return {
|
|
522
|
-
isProduction: isNonRunnableDev() ? false : undefined,
|
|
523
499
|
viteDevServerPromise,
|
|
524
500
|
viteDevServerPromiseResolve,
|
|
525
501
|
};
|
|
@@ -533,7 +509,7 @@ function resolveBaseRuntime(viteConfigRuntime, config) {
|
|
|
533
509
|
function isProcessSharedWithVite() {
|
|
534
510
|
const yes = globalThis.__VIKE__IS_PROCESS_SHARED_WITH_VITE ?? false;
|
|
535
511
|
if (yes)
|
|
536
|
-
(0, utils_js_1.assert)(!isNonRunnableDev());
|
|
512
|
+
(0, utils_js_1.assert)(!(0, utils_js_1.isNonRunnableDev)());
|
|
537
513
|
return yes;
|
|
538
514
|
}
|
|
539
515
|
function isRunnable(viteDevServer) {
|
|
@@ -543,13 +519,54 @@ function isRunnable(viteDevServer) {
|
|
|
543
519
|
// Vite 6 or above
|
|
544
520
|
(0, utils_js_1.isRunnableDevEnvironment)(viteDevServer.environments.ssr);
|
|
545
521
|
if (yes)
|
|
546
|
-
(0, utils_js_1.assert)(!isNonRunnableDev());
|
|
522
|
+
(0, utils_js_1.assert)(!(0, utils_js_1.isNonRunnableDev)());
|
|
547
523
|
return yes;
|
|
548
524
|
}
|
|
549
|
-
function
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
525
|
+
function isProd() {
|
|
526
|
+
const isProduction = isProdOptional();
|
|
527
|
+
if (isProduction === null) {
|
|
528
|
+
if (globalObject.isAfterFirstRenderPageCall) {
|
|
529
|
+
// When using a production server without vike-server, there isn't any reliable signal we can use to determine early whether the environment is production or development. If renderPage() was called then some non-negligible amount of time passed — it's likely that, in dev, one of the Vite hooks should have already sent a signal we can use to determine prod/dev.
|
|
530
|
+
return true;
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
(0, utils_js_1.assert)(false);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
return isProduction;
|
|
537
|
+
}
|
|
538
|
+
function isProdOptional() {
|
|
539
|
+
const vikeApiOperation = (0, context_js_1.getVikeApiOperation)()?.operation ?? null;
|
|
540
|
+
const yes =
|
|
541
|
+
// setGlobalContext_prodBuildEntry() was called
|
|
542
|
+
!!globalObject.prodBuildEntry ||
|
|
543
|
+
globalObject.isPrerendering === true ||
|
|
544
|
+
// Vike CLI & Vike API
|
|
545
|
+
(!!vikeApiOperation && vikeApiOperation !== 'dev') ||
|
|
546
|
+
// Vite command
|
|
547
|
+
globalObject.isProductionAccordingToVite === true ||
|
|
548
|
+
// getGlobalContextAsync(isProduction)
|
|
549
|
+
globalObject.isProductionAccordingToUser === true ||
|
|
550
|
+
// vite-plugin-vercel
|
|
551
|
+
globalObject.isProductionAccordingToPhotonVercel === true;
|
|
553
552
|
(0, utils_js_1.assert)(typeof yes === 'boolean');
|
|
554
|
-
|
|
553
|
+
const no = !!globalObject.viteDevServer ||
|
|
554
|
+
// Vike CLI & Vike API
|
|
555
|
+
vikeApiOperation === 'dev' ||
|
|
556
|
+
// Vite command
|
|
557
|
+
globalObject.isProductionAccordingToVite === false ||
|
|
558
|
+
// getGlobalContextAsync(isProduction)
|
|
559
|
+
globalObject.isProductionAccordingToUser === false ||
|
|
560
|
+
// @cloudflare/vite-plugin
|
|
561
|
+
(0, utils_js_1.isNonRunnableDev)() === true;
|
|
562
|
+
(0, utils_js_1.assert)(typeof no === 'boolean');
|
|
563
|
+
if (yes) {
|
|
564
|
+
(0, utils_js_1.assert)(no === false);
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
if (no) {
|
|
568
|
+
(0, utils_js_1.assert)(yes === false);
|
|
569
|
+
return false;
|
|
570
|
+
}
|
|
571
|
+
return null;
|
|
555
572
|
}
|
|
@@ -80,3 +80,4 @@ __exportStar(require("../../utils/changeEnumerable.js"), exports);
|
|
|
80
80
|
__exportStar(require("../../utils/getViteRPC.js"), exports);
|
|
81
81
|
__exportStar(require("../../utils/isRunnableDevEnvironment.js"), exports);
|
|
82
82
|
__exportStar(require("../../utils/assertIsNotBrowser.js"), exports);
|
|
83
|
+
__exportStar(require("../../utils/isNonRunnableDev.js"), exports);
|
|
@@ -3,14 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createDevMiddleware = createDevMiddleware;
|
|
4
4
|
const vite_1 = require("vite");
|
|
5
5
|
const prepareViteApiCall_js_1 = require("../api/prepareViteApiCall.js");
|
|
6
|
-
const globalContext_js_1 = require("../runtime/globalContext.js");
|
|
7
6
|
/*
|
|
8
7
|
* Create server middleware for development with HMR and lazy-transpiling.
|
|
9
8
|
*
|
|
10
9
|
* https://vike.dev/createDevMiddleware
|
|
11
10
|
*/
|
|
12
11
|
async function createDevMiddleware(options = {}) {
|
|
13
|
-
(0, globalContext_js_1.setGlobalContext_isProduction)(false, true);
|
|
14
12
|
const optionsMod = {
|
|
15
13
|
...options,
|
|
16
14
|
viteConfig: {
|
|
@@ -19,7 +19,7 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
19
19
|
const resolveVikeConfigInternal_js_1 = require("../../shared/resolveVikeConfigInternal.js");
|
|
20
20
|
const getOutDirs_js_1 = require("../../shared/getOutDirs.js");
|
|
21
21
|
const isViteServerSide_js_1 = require("../../shared/isViteServerSide.js");
|
|
22
|
-
const
|
|
22
|
+
const pluginProdBuildEntry_js_1 = require("./pluginProdBuildEntry.js");
|
|
23
23
|
const getManifestFilePathRelative_js_1 = require("../../shared/getManifestFilePathRelative.js");
|
|
24
24
|
const globalObject = (0, utils_js_1.getGlobalObject)('build/handleAssetsManifest.ts', {
|
|
25
25
|
assetsJsonFilePath: undefined,
|
|
@@ -312,7 +312,7 @@ async function handleAssetsManifest(config, viteEnv, options, bundle) {
|
|
|
312
312
|
// - Always replace it in dist/server/
|
|
313
313
|
// - Also in some other server builds such as dist/vercel/ from vike-vercel
|
|
314
314
|
// - Don't replace it in dist/rsc/ from vike-react-rsc since __VITE_ASSETS_MANIFEST__ doesn't exist there
|
|
315
|
-
const noop = await (0,
|
|
315
|
+
const noop = await (0, pluginProdBuildEntry_js_1.set_macro_ASSETS_MANIFEST)(globalObject.assetsJsonFilePath, bundle, outDir);
|
|
316
316
|
if (isSsrEnv)
|
|
317
317
|
(0, utils_js_1.assert)(!noop); // dist/server should always contain __VITE_ASSETS_MANIFEST__
|
|
318
318
|
}
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.pluginBuildApp = pluginBuildApp;
|
|
7
|
-
exports.isPrerenderForceExit = isPrerenderForceExit;
|
|
8
7
|
const runPrerenderEntry_js_1 = require("../../../prerender/runPrerenderEntry.js");
|
|
9
8
|
const getOutDirs_js_1 = require("../../shared/getOutDirs.js");
|
|
10
9
|
const utils_js_1 = require("../../utils.js");
|
|
@@ -135,12 +134,12 @@ async function triggerPrerendering(config, viteEnv, bundle) {
|
|
|
135
134
|
// - Issue & reproduction: https://github.com/vikejs/vike/issues/1154#issuecomment-1965954636
|
|
136
135
|
if (!bundle[(0, getManifestFilePathRelative_js_1.getManifestFilePathRelative)(config.build.manifest)])
|
|
137
136
|
return;
|
|
137
|
+
if (!(0, context_js_1.isPrerenderAutoRunEnabled)(vikeConfig))
|
|
138
|
+
return;
|
|
138
139
|
const configInline = getFullBuildInlineConfig(config);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
(0, utils_js_1.assert)((0, context_js_1.wasPrerenderRun)());
|
|
143
|
-
}
|
|
140
|
+
const res = await (0, runPrerenderEntry_js_2.runPrerenderFromAutoRun)(configInline);
|
|
141
|
+
globalObject.forceExit = res.forceExit;
|
|
142
|
+
(0, utils_js_1.assert)((0, context_js_1.wasPrerenderRun)());
|
|
144
143
|
}
|
|
145
144
|
async function abortViteBuildSsr() {
|
|
146
145
|
const vikeConfig = await (0, resolveVikeConfigInternal_js_1.getVikeConfigInternal)();
|