vike 0.4.227-commit-f991d58 → 0.4.228-commit-13824ea
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/dev.js +2 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -4
- package/dist/cjs/node/runtime/globalContext.js +43 -9
- package/dist/cjs/node/runtime/index-common.js +2 -1
- package/dist/cjs/node/runtime-dev/createDevMiddleware.js +1 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/node/api/dev.js +2 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -4
- package/dist/esm/node/runtime/globalContext.d.ts +21 -4
- package/dist/esm/node/runtime/globalContext.js +43 -9
- package/dist/esm/node/runtime/index-common.d.ts +1 -1
- package/dist/esm/node/runtime/index-common.js +1 -1
- package/dist/esm/node/runtime-dev/createDevMiddleware.js +1 -1
- package/dist/esm/shared/page-configs/getConfigDefinedAt.d.ts +1 -1
- package/dist/esm/shared/types.d.ts +1 -3
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/package.json +1 -1
package/dist/cjs/node/api/dev.js
CHANGED
|
@@ -3,12 +3,14 @@ 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");
|
|
6
7
|
/**
|
|
7
8
|
* Programmatically trigger `$ vike dev`
|
|
8
9
|
*
|
|
9
10
|
* https://vike.dev/api#dev
|
|
10
11
|
*/
|
|
11
12
|
async function dev(options = {}) {
|
|
13
|
+
(0, globalContext_js_1.setGlobalContext_isProduction)(false);
|
|
12
14
|
const { viteConfigFromUserEnhanced } = await (0, prepareViteApiCall_js_1.prepareViteApiCall)(options, 'dev');
|
|
13
15
|
const server = await (0, vite_1.createServer)(viteConfigFromUserEnhanced);
|
|
14
16
|
return {
|
|
@@ -410,7 +410,7 @@ function setCliAndApiOptions(pageConfigGlobal, configDefinitionsResolved) {
|
|
|
410
410
|
Object.entries(configValues).forEach(([configName, value]) => {
|
|
411
411
|
var _a;
|
|
412
412
|
const sourceName = `The ${(0, getConfigDefinedAt_js_1.getDefinedByString)(definedBy, configName)}`;
|
|
413
|
-
assertKnownConfig(configName, configDefinitionsResolved.configNamesKnownGlobal, configDefinitionsResolved, '/', sourceName, exitOnError);
|
|
413
|
+
assertKnownConfig(configName, configDefinitionsResolved.configNamesKnownGlobal, configDefinitionsResolved, '/', false, sourceName, exitOnError);
|
|
414
414
|
const sources = ((_a = pageConfigGlobal.configValueSources)[configName] ?? (_a[configName] = []));
|
|
415
415
|
sources.unshift(getSourceNonConfigFile(configName, value, definedBy));
|
|
416
416
|
});
|
|
@@ -885,12 +885,12 @@ function assertKnownConfigs(configDefinitionsResolved) {
|
|
|
885
885
|
configNames.forEach((configName) => {
|
|
886
886
|
const { locationId } = plusFile;
|
|
887
887
|
const sourceName = plusFile.filePath.filePathToShowToUser;
|
|
888
|
-
assertKnownConfig(configName, configNamesKnownLocal, configDefinitionsResolved, locationId, sourceName, false);
|
|
888
|
+
assertKnownConfig(configName, configNamesKnownLocal, configDefinitionsResolved, locationId, true, sourceName, false);
|
|
889
889
|
});
|
|
890
890
|
});
|
|
891
891
|
});
|
|
892
892
|
}
|
|
893
|
-
function assertKnownConfig(configName, configNamesKnownRelevant, configDefinitionsResolved, locationId, sourceName, exitOnError) {
|
|
893
|
+
function assertKnownConfig(configName, configNamesKnownRelevant, configDefinitionsResolved, locationId, isPlusFile, sourceName, exitOnError) {
|
|
894
894
|
const { configNamesKnownAll } = configDefinitionsResolved;
|
|
895
895
|
if (configNamesKnownRelevant.includes(configName)) {
|
|
896
896
|
(0, utils_js_1.assert)(configNamesKnownAll.includes(configName));
|
|
@@ -901,7 +901,9 @@ function assertKnownConfig(configName, configNamesKnownRelevant, configDefinitio
|
|
|
901
901
|
if (configNamesKnownAll.includes(configName)) {
|
|
902
902
|
(0, utils_js_1.assertUsage)(false, `${sourceName} sets the value of the config ${configNameColored} which is a custom config that is defined with ${picocolors_1.default.underline('https://vike.dev/meta')} at a path that doesn't apply to ${locationId} — see ${picocolors_1.default.underline('https://vike.dev/config#inheritance')}`, { exitOnError });
|
|
903
903
|
}
|
|
904
|
-
const errMsg =
|
|
904
|
+
const errMsg = isPlusFile
|
|
905
|
+
? `${sourceName} sets an unknown config ${configNameColored}`
|
|
906
|
+
: `${sourceName} sets an unknown Vike config, see ${picocolors_1.default.underline('https://vike.dev/cli')} for the list of CLI options`;
|
|
905
907
|
// Missing vike-{react,vue,solid} installation
|
|
906
908
|
{
|
|
907
909
|
const ui = ['vike-react', 'vike-vue', 'vike-solid'];
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getGlobalContext = getGlobalContext;
|
|
6
7
|
exports.getGlobalContextSync = getGlobalContextSync;
|
|
7
8
|
exports.getGlobalContextAsync = getGlobalContextAsync;
|
|
8
9
|
exports.getGlobalContextInternal = getGlobalContextInternal;
|
|
@@ -58,13 +59,24 @@ function assertGlobalContextIsDefined() {
|
|
|
58
59
|
assertIsDefined(globalObject.globalContext);
|
|
59
60
|
(0, utils_js_1.assert)(globalObject.globalContext_public);
|
|
60
61
|
}
|
|
61
|
-
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Get runtime information about your app.
|
|
64
|
+
*
|
|
65
|
+
* https://vike.dev/getGlobalContext
|
|
66
|
+
*/
|
|
67
|
+
async function getGlobalContext() {
|
|
68
|
+
debug('getGlobalContext()');
|
|
69
|
+
const { isProduction } = globalObject;
|
|
70
|
+
// 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).
|
|
71
|
+
(0, utils_js_1.assertUsage)(isProduction !== undefined, "The global context isn't set yet, use getGlobalContextAsync() instead.");
|
|
72
|
+
(0, utils_js_1.assert)(typeof globalObject.isProduction === 'boolean');
|
|
73
|
+
return await getGlobalContextAsync(isProduction);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get runtime information about your app.
|
|
77
|
+
*
|
|
78
|
+
* https://vike.dev/getGlobalContext
|
|
79
|
+
*/
|
|
68
80
|
async function getGlobalContextAsync(isProduction) {
|
|
69
81
|
debug('getGlobalContextAsync()');
|
|
70
82
|
(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')}`}`);
|
|
@@ -78,6 +90,23 @@ async function getGlobalContextAsync(isProduction) {
|
|
|
78
90
|
(0, utils_js_1.assert)(globalContext_public);
|
|
79
91
|
return globalContext_public;
|
|
80
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Get runtime information about your app.
|
|
95
|
+
*
|
|
96
|
+
* https://vike.dev/getGlobalContext
|
|
97
|
+
*
|
|
98
|
+
* @deprecated
|
|
99
|
+
*/
|
|
100
|
+
function getGlobalContextSync() {
|
|
101
|
+
debug('getGlobalContextSync()');
|
|
102
|
+
const { globalContext_public } = globalObject;
|
|
103
|
+
(0, utils_js_1.assertUsage)(globalContext_public, "The global context isn't set yet, call getGlobalContextSync() later or use getGlobalContext() instead.");
|
|
104
|
+
(0, utils_js_1.assertWarning)(false,
|
|
105
|
+
// We discourage users from using it because using `pageContext.globalContext` is better: it doesn't have the race condition issue that `getGlobalContextSync()` would have when called inside React/Vue components.
|
|
106
|
+
// We're lying about "is going to be deprecated in the next major release": let's keep it and see if users need it (so far I can't see a use case for it).
|
|
107
|
+
'getGlobalContextSync() is going to be deprecated in the next major release, see https://vike.dev/getGlobalContext', { onlyOnce: true });
|
|
108
|
+
return globalContext_public;
|
|
109
|
+
}
|
|
81
110
|
function makePublic(globalContext) {
|
|
82
111
|
const globalContextPublic = (0, utils_js_1.makePublicCopy)(globalContext, 'globalContext', [
|
|
83
112
|
'assetsManifest',
|
|
@@ -118,8 +147,13 @@ function setGlobalContext_isPrerendering() {
|
|
|
118
147
|
globalObject.isPrerendering = true;
|
|
119
148
|
setIsProduction(true);
|
|
120
149
|
}
|
|
121
|
-
function setGlobalContext_isProduction(isProduction) {
|
|
122
|
-
|
|
150
|
+
function setGlobalContext_isProduction(isProduction, tolerateContraditction) {
|
|
151
|
+
if (globalObject.isProduction === undefined) {
|
|
152
|
+
setIsProduction(isProduction);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
(0, utils_js_1.assert)(globalObject.isProduction === isProduction || tolerateContraditction);
|
|
156
|
+
}
|
|
123
157
|
}
|
|
124
158
|
function getViteDevServer() {
|
|
125
159
|
return globalObject.viteDevServer ?? null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPageRenderer = exports._injectAssets = exports.createDevMiddleware = exports.getGlobalContextAsync = exports.getGlobalContextSync = exports.version = exports.stampPipe = exports.pipeStream = exports.pipeNodeStream = exports.pipeWebStream = exports.dangerouslySkipEscape = exports.escapeInject = exports.renderPage = void 0;
|
|
3
|
+
exports.createPageRenderer = exports._injectAssets = exports.createDevMiddleware = exports.getGlobalContextAsync = exports.getGlobalContextSync = exports.getGlobalContext = exports.version = exports.stampPipe = exports.pipeStream = exports.pipeNodeStream = exports.pipeWebStream = exports.dangerouslySkipEscape = exports.escapeInject = exports.renderPage = void 0;
|
|
4
4
|
var renderPage_js_1 = require("./renderPage.js");
|
|
5
5
|
Object.defineProperty(exports, "renderPage", { enumerable: true, get: function () { return renderPage_js_1.renderPage; } });
|
|
6
6
|
var renderHtml_js_1 = require("./html/renderHtml.js");
|
|
@@ -14,6 +14,7 @@ Object.defineProperty(exports, "stampPipe", { enumerable: true, get: function ()
|
|
|
14
14
|
var utils_js_1 = require("./utils.js");
|
|
15
15
|
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return utils_js_1.PROJECT_VERSION; } });
|
|
16
16
|
var globalContext_js_1 = require("./globalContext.js");
|
|
17
|
+
Object.defineProperty(exports, "getGlobalContext", { enumerable: true, get: function () { return globalContext_js_1.getGlobalContext; } });
|
|
17
18
|
Object.defineProperty(exports, "getGlobalContextSync", { enumerable: true, get: function () { return globalContext_js_1.getGlobalContextSync; } });
|
|
18
19
|
Object.defineProperty(exports, "getGlobalContextAsync", { enumerable: true, get: function () { return globalContext_js_1.getGlobalContextAsync; } });
|
|
19
20
|
var index_js_1 = require("../runtime-dev/index.js");
|
|
@@ -10,7 +10,7 @@ const globalContext_js_1 = require("../runtime/globalContext.js");
|
|
|
10
10
|
* https://vike.dev/createDevMiddleware
|
|
11
11
|
*/
|
|
12
12
|
async function createDevMiddleware(options = {}) {
|
|
13
|
-
(0, globalContext_js_1.setGlobalContext_isProduction)(false);
|
|
13
|
+
(0, globalContext_js_1.setGlobalContext_isProduction)(false, true);
|
|
14
14
|
const optionsMod = {
|
|
15
15
|
...options,
|
|
16
16
|
viteConfig: {
|
package/dist/esm/node/api/dev.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { dev };
|
|
2
2
|
import { prepareViteApiCall } from './prepareViteApiCall.js';
|
|
3
3
|
import { createServer } from 'vite';
|
|
4
|
+
import { setGlobalContext_isProduction } from '../runtime/globalContext.js';
|
|
4
5
|
/**
|
|
5
6
|
* Programmatically trigger `$ vike dev`
|
|
6
7
|
*
|
|
7
8
|
* https://vike.dev/api#dev
|
|
8
9
|
*/
|
|
9
10
|
async function dev(options = {}) {
|
|
11
|
+
setGlobalContext_isProduction(false);
|
|
10
12
|
const { viteConfigFromUserEnhanced } = await prepareViteApiCall(options, 'dev');
|
|
11
13
|
const server = await createServer(viteConfigFromUserEnhanced);
|
|
12
14
|
return {
|
|
@@ -405,7 +405,7 @@ function setCliAndApiOptions(pageConfigGlobal, configDefinitionsResolved) {
|
|
|
405
405
|
Object.entries(configValues).forEach(([configName, value]) => {
|
|
406
406
|
var _a;
|
|
407
407
|
const sourceName = `The ${getDefinedByString(definedBy, configName)}`;
|
|
408
|
-
assertKnownConfig(configName, configDefinitionsResolved.configNamesKnownGlobal, configDefinitionsResolved, '/', sourceName, exitOnError);
|
|
408
|
+
assertKnownConfig(configName, configDefinitionsResolved.configNamesKnownGlobal, configDefinitionsResolved, '/', false, sourceName, exitOnError);
|
|
409
409
|
const sources = ((_a = pageConfigGlobal.configValueSources)[configName] ?? (_a[configName] = []));
|
|
410
410
|
sources.unshift(getSourceNonConfigFile(configName, value, definedBy));
|
|
411
411
|
});
|
|
@@ -880,12 +880,12 @@ function assertKnownConfigs(configDefinitionsResolved) {
|
|
|
880
880
|
configNames.forEach((configName) => {
|
|
881
881
|
const { locationId } = plusFile;
|
|
882
882
|
const sourceName = plusFile.filePath.filePathToShowToUser;
|
|
883
|
-
assertKnownConfig(configName, configNamesKnownLocal, configDefinitionsResolved, locationId, sourceName, false);
|
|
883
|
+
assertKnownConfig(configName, configNamesKnownLocal, configDefinitionsResolved, locationId, true, sourceName, false);
|
|
884
884
|
});
|
|
885
885
|
});
|
|
886
886
|
});
|
|
887
887
|
}
|
|
888
|
-
function assertKnownConfig(configName, configNamesKnownRelevant, configDefinitionsResolved, locationId, sourceName, exitOnError) {
|
|
888
|
+
function assertKnownConfig(configName, configNamesKnownRelevant, configDefinitionsResolved, locationId, isPlusFile, sourceName, exitOnError) {
|
|
889
889
|
const { configNamesKnownAll } = configDefinitionsResolved;
|
|
890
890
|
if (configNamesKnownRelevant.includes(configName)) {
|
|
891
891
|
assert(configNamesKnownAll.includes(configName));
|
|
@@ -896,7 +896,9 @@ function assertKnownConfig(configName, configNamesKnownRelevant, configDefinitio
|
|
|
896
896
|
if (configNamesKnownAll.includes(configName)) {
|
|
897
897
|
assertUsage(false, `${sourceName} sets the value of the config ${configNameColored} which is a custom config that is defined with ${pc.underline('https://vike.dev/meta')} at a path that doesn't apply to ${locationId} — see ${pc.underline('https://vike.dev/config#inheritance')}`, { exitOnError });
|
|
898
898
|
}
|
|
899
|
-
const errMsg =
|
|
899
|
+
const errMsg = isPlusFile
|
|
900
|
+
? `${sourceName} sets an unknown config ${configNameColored}`
|
|
901
|
+
: `${sourceName} sets an unknown Vike config, see ${pc.underline('https://vike.dev/cli')} for the list of CLI options`;
|
|
900
902
|
// Missing vike-{react,vue,solid} installation
|
|
901
903
|
{
|
|
902
904
|
const ui = ['vike-react', 'vike-vue', 'vike-solid'];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { getGlobalContext };
|
|
1
2
|
export { getGlobalContextSync };
|
|
2
3
|
export { getGlobalContextAsync };
|
|
3
4
|
export { getGlobalContextInternal };
|
|
@@ -49,16 +50,32 @@ type GlobalContext = {
|
|
|
49
50
|
viteConfig: ResolvedConfig;
|
|
50
51
|
})));
|
|
51
52
|
declare function getGlobalContextInternal(): Promise<GlobalContextInternal>;
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Get runtime information about your app.
|
|
55
|
+
*
|
|
56
|
+
* https://vike.dev/getGlobalContext
|
|
57
|
+
*/
|
|
58
|
+
declare function getGlobalContext(): Promise<GlobalContextPublic>;
|
|
59
|
+
/**
|
|
60
|
+
* Get runtime information about your app.
|
|
61
|
+
*
|
|
62
|
+
* https://vike.dev/getGlobalContext
|
|
63
|
+
*/
|
|
55
64
|
declare function getGlobalContextAsync(isProduction: boolean): Promise<GlobalContextPublic>;
|
|
65
|
+
/**
|
|
66
|
+
* Get runtime information about your app.
|
|
67
|
+
*
|
|
68
|
+
* https://vike.dev/getGlobalContext
|
|
69
|
+
*
|
|
70
|
+
* @deprecated
|
|
71
|
+
*/
|
|
72
|
+
declare function getGlobalContextSync(): GlobalContextPublic;
|
|
56
73
|
type GlobalContextPublic = ReturnType<typeof makePublic>;
|
|
57
74
|
declare function makePublic(globalContext: GlobalContext): Pick<GlobalContext, "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig" | "viteConfigRuntime">;
|
|
58
75
|
declare function setGlobalContext_viteDevServer(viteDevServer: ViteDevServer): Promise<void>;
|
|
59
76
|
declare function setGlobalContext_viteConfig(viteConfig: ResolvedConfig, viteConfigRuntime: ViteConfigRuntime): void;
|
|
60
77
|
declare function setGlobalContext_isPrerendering(): void;
|
|
61
|
-
declare function setGlobalContext_isProduction(isProduction: boolean): void;
|
|
78
|
+
declare function setGlobalContext_isProduction(isProduction: boolean, tolerateContraditction?: true): void;
|
|
62
79
|
declare function getViteDevServer(): ViteDevServer | null;
|
|
63
80
|
declare function getViteConfig(): ResolvedConfig | null;
|
|
64
81
|
declare function initGlobalContext_renderPage(): Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Public use
|
|
2
|
+
export { getGlobalContext };
|
|
2
3
|
export { getGlobalContextSync };
|
|
3
4
|
export { getGlobalContextAsync };
|
|
4
5
|
// Internal use
|
|
@@ -55,13 +56,24 @@ function assertGlobalContextIsDefined() {
|
|
|
55
56
|
assertIsDefined(globalObject.globalContext);
|
|
56
57
|
assert(globalObject.globalContext_public);
|
|
57
58
|
}
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Get runtime information about your app.
|
|
61
|
+
*
|
|
62
|
+
* https://vike.dev/getGlobalContext
|
|
63
|
+
*/
|
|
64
|
+
async function getGlobalContext() {
|
|
65
|
+
debug('getGlobalContext()');
|
|
66
|
+
const { isProduction } = globalObject;
|
|
67
|
+
// 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).
|
|
68
|
+
assertUsage(isProduction !== undefined, "The global context isn't set yet, use getGlobalContextAsync() instead.");
|
|
69
|
+
assert(typeof globalObject.isProduction === 'boolean');
|
|
70
|
+
return await getGlobalContextAsync(isProduction);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get runtime information about your app.
|
|
74
|
+
*
|
|
75
|
+
* https://vike.dev/getGlobalContext
|
|
76
|
+
*/
|
|
65
77
|
async function getGlobalContextAsync(isProduction) {
|
|
66
78
|
debug('getGlobalContextAsync()');
|
|
67
79
|
assertUsage(typeof isProduction === 'boolean', `[getGlobalContextAsync(isProduction)] Argument ${pc.cyan('isProduction')} ${isProduction === undefined ? 'is missing' : `should be ${pc.cyan('true')} or ${pc.cyan('false')}`}`);
|
|
@@ -75,6 +87,23 @@ async function getGlobalContextAsync(isProduction) {
|
|
|
75
87
|
assert(globalContext_public);
|
|
76
88
|
return globalContext_public;
|
|
77
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Get runtime information about your app.
|
|
92
|
+
*
|
|
93
|
+
* https://vike.dev/getGlobalContext
|
|
94
|
+
*
|
|
95
|
+
* @deprecated
|
|
96
|
+
*/
|
|
97
|
+
function getGlobalContextSync() {
|
|
98
|
+
debug('getGlobalContextSync()');
|
|
99
|
+
const { globalContext_public } = globalObject;
|
|
100
|
+
assertUsage(globalContext_public, "The global context isn't set yet, call getGlobalContextSync() later or use getGlobalContext() instead.");
|
|
101
|
+
assertWarning(false,
|
|
102
|
+
// We discourage users from using it because using `pageContext.globalContext` is better: it doesn't have the race condition issue that `getGlobalContextSync()` would have when called inside React/Vue components.
|
|
103
|
+
// We're lying about "is going to be deprecated in the next major release": let's keep it and see if users need it (so far I can't see a use case for it).
|
|
104
|
+
'getGlobalContextSync() is going to be deprecated in the next major release, see https://vike.dev/getGlobalContext', { onlyOnce: true });
|
|
105
|
+
return globalContext_public;
|
|
106
|
+
}
|
|
78
107
|
function makePublic(globalContext) {
|
|
79
108
|
const globalContextPublic = makePublicCopy(globalContext, 'globalContext', [
|
|
80
109
|
'assetsManifest',
|
|
@@ -115,8 +144,13 @@ function setGlobalContext_isPrerendering() {
|
|
|
115
144
|
globalObject.isPrerendering = true;
|
|
116
145
|
setIsProduction(true);
|
|
117
146
|
}
|
|
118
|
-
function setGlobalContext_isProduction(isProduction) {
|
|
119
|
-
|
|
147
|
+
function setGlobalContext_isProduction(isProduction, tolerateContraditction) {
|
|
148
|
+
if (globalObject.isProduction === undefined) {
|
|
149
|
+
setIsProduction(isProduction);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
assert(globalObject.isProduction === isProduction || tolerateContraditction);
|
|
153
|
+
}
|
|
120
154
|
}
|
|
121
155
|
function getViteDevServer() {
|
|
122
156
|
return globalObject.viteDevServer ?? null;
|
|
@@ -2,7 +2,7 @@ export { renderPage } from './renderPage.js';
|
|
|
2
2
|
export { escapeInject, dangerouslySkipEscape } from './html/renderHtml.js';
|
|
3
3
|
export { pipeWebStream, pipeNodeStream, pipeStream, stampPipe } from './html/stream.js';
|
|
4
4
|
export { PROJECT_VERSION as version } from './utils.js';
|
|
5
|
-
export { getGlobalContextSync, getGlobalContextAsync } from './globalContext.js';
|
|
5
|
+
export { getGlobalContext, getGlobalContextSync, getGlobalContextAsync } from './globalContext.js';
|
|
6
6
|
export { createDevMiddleware } from '../runtime-dev/index.js';
|
|
7
7
|
export { injectAssets__public as _injectAssets } from './html/injectAssets/injectAssets__public.js';
|
|
8
8
|
export { createPageRenderer } from '../createPageRenderer.js';
|
|
@@ -2,7 +2,7 @@ export { renderPage } from './renderPage.js';
|
|
|
2
2
|
export { escapeInject, dangerouslySkipEscape } from './html/renderHtml.js';
|
|
3
3
|
export { pipeWebStream, pipeNodeStream, pipeStream, stampPipe } from './html/stream.js';
|
|
4
4
|
export { PROJECT_VERSION as version } from './utils.js';
|
|
5
|
-
export { getGlobalContextSync, getGlobalContextAsync } from './globalContext.js';
|
|
5
|
+
export { getGlobalContext, getGlobalContextSync, getGlobalContextAsync } from './globalContext.js';
|
|
6
6
|
export { createDevMiddleware } from '../runtime-dev/index.js';
|
|
7
7
|
// TODO/v1-release: remove
|
|
8
8
|
export { injectAssets__public as _injectAssets } from './html/injectAssets/injectAssets__public.js';
|
|
@@ -8,7 +8,7 @@ import { setGlobalContext_isProduction } from '../runtime/globalContext.js';
|
|
|
8
8
|
* https://vike.dev/createDevMiddleware
|
|
9
9
|
*/
|
|
10
10
|
async function createDevMiddleware(options = {}) {
|
|
11
|
-
setGlobalContext_isProduction(false);
|
|
11
|
+
setGlobalContext_isProduction(false, true);
|
|
12
12
|
const optionsMod = {
|
|
13
13
|
...options,
|
|
14
14
|
viteConfig: {
|
|
@@ -10,4 +10,4 @@ type ConfigDefinedAt = `Config ${string} defined at ${string}`;
|
|
|
10
10
|
declare function getConfigDefinedAt<SentenceBegin extends 'Config' | 'config', ConfigName extends string>(sentenceBegin: SentenceBegin, configName: ConfigName, definedAtData: NonNullable<DefinedAtData>): `${SentenceBegin} ${ConfigName} defined at ${string}`;
|
|
11
11
|
declare function getConfigDefinedAtOptional<SentenceBegin extends 'Config' | 'config', ConfigName extends string>(sentenceBegin: SentenceBegin, configName: ConfigName, definedAtData: DefinedAtData): `${SentenceBegin} ${ConfigName} defined ${'internally' | `at ${string}`}`;
|
|
12
12
|
declare function getDefinedAtString(definedAtData: NonNullable<DefinedAtData>, configName: string): string;
|
|
13
|
-
declare function getDefinedByString(definedAt: DefinedBy, configName: string): `API call
|
|
13
|
+
declare function getDefinedByString(definedAt: DefinedBy, configName: string): `API call ${string}({ vikeConfig: { ${string} } })` | `CLI option --${string}` | `environment variable VIKE_CONFIG="{${string}}"`;
|
|
@@ -120,11 +120,9 @@ type PageContextBuiltInCommon<Data> = {
|
|
|
120
120
|
/** @experimental https://github.com/vikejs/vike/issues/1268 */
|
|
121
121
|
sources: Sources;
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
123
|
+
* Runtime information about your app.
|
|
124
124
|
*
|
|
125
125
|
* https://vike.dev/getGlobalContext
|
|
126
|
-
*
|
|
127
|
-
* @experimental
|
|
128
126
|
*/
|
|
129
127
|
globalContext: GlobalContextPublic;
|
|
130
128
|
/** @deprecated */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.228-commit-13824ea";
|
|
@@ -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.228-commit-13824ea';
|