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,18 +1,17 @@
|
|
|
1
1
|
export { createGlobalContextShared };
|
|
2
2
|
export { getGlobalContextSyncErrMsg };
|
|
3
|
-
import { changeEnumerable, genPromise,
|
|
3
|
+
import { assert, changeEnumerable, genPromise, objectAssign, objectReplace, unique } from './utils.js';
|
|
4
4
|
import { parseVirtualFileExportsGlobalEntry } from './getPageFiles/parseVirtualFileExportsGlobalEntry.js';
|
|
5
5
|
import { resolveVikeConfigPublicGlobal, resolveVikeConfigPublicPageEagerLoaded, } from './page-configs/resolveVikeConfigPublic.js';
|
|
6
6
|
import { execHookGlobal } from './hooks/execHook.js';
|
|
7
7
|
import { prepareGlobalContextForPublicUsage } from './prepareGlobalContextForPublicUsage.js';
|
|
8
8
|
import { getHookFromPageConfigGlobalCumulative } from './hooks/getHook.js';
|
|
9
9
|
const getGlobalContextSyncErrMsg = "The global context isn't set yet, call getGlobalContextSync() later or use getGlobalContext() instead.";
|
|
10
|
-
const globalObject_ = getGlobalObject('shared/createGlobalContextShared.ts', {});
|
|
11
10
|
// TO-DO/eventually use flat globalContext — like flat pageContext
|
|
12
11
|
async function createGlobalContextShared(virtualFileExportsGlobalEntry, globalObject, addGlobalContext,
|
|
13
12
|
// TO-DO/next-major-release: we'll be able to remove addGlobalContextTmp after loadPageRoutes() is sync (it will be sync after we remove the old design)
|
|
14
13
|
addGlobalContextTmp, addGlobalContextAsync) {
|
|
15
|
-
const {
|
|
14
|
+
const { previousCreateGlobalContextPromise } = globalObject;
|
|
16
15
|
const { promise, resolve } = genPromise({
|
|
17
16
|
// Avoid this Cloudflare Worker error:
|
|
18
17
|
// ```console
|
|
@@ -20,8 +19,11 @@ addGlobalContextTmp, addGlobalContextAsync) {
|
|
|
20
19
|
// ```
|
|
21
20
|
timeout: null,
|
|
22
21
|
});
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
globalObject.previousCreateGlobalContextPromise = promise;
|
|
23
|
+
if (previousCreateGlobalContextPromise) {
|
|
24
|
+
assert(globalObject.globalContext);
|
|
25
|
+
await previousCreateGlobalContextPromise;
|
|
26
|
+
}
|
|
25
27
|
const globalContext = createGlobalContextBase(virtualFileExportsGlobalEntry);
|
|
26
28
|
let isNewGlobalContext;
|
|
27
29
|
if (!globalObject.globalContext) {
|
|
@@ -26,7 +26,7 @@ import type { LocationId } from '../node/vite/shared/resolveVikeConfigInternal/f
|
|
|
26
26
|
import type { FilePath } from './FilePath.js';
|
|
27
27
|
import type { ConfigDefinitionsInternal } from '../node/vite/shared/resolveVikeConfigInternal/configDefinitionsBuiltIn.js';
|
|
28
28
|
import type { PlusFile } from '../node/vite/shared/resolveVikeConfigInternal/getPlusFilesAll.js';
|
|
29
|
-
import type {
|
|
29
|
+
import type { ApiOperation } from '../node/api/types.js';
|
|
30
30
|
type PageConfigCommon = {
|
|
31
31
|
pageId: string;
|
|
32
32
|
} & PageConfigRoute;
|
|
@@ -144,7 +144,7 @@ type DefinedBy = {
|
|
|
144
144
|
definedBy: 'cli' | 'env';
|
|
145
145
|
} | {
|
|
146
146
|
definedBy: 'api';
|
|
147
|
-
operation:
|
|
147
|
+
operation: ApiOperation;
|
|
148
148
|
};
|
|
149
149
|
type DefinedAtFile = {
|
|
150
150
|
filePathToShowToUser: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.237-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.237-commit-33e34e7";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.237-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.237-commit-33e34e7';
|
|
@@ -12,6 +12,7 @@ import { assert, assertUsage, assertWarning } from './assert.js';
|
|
|
12
12
|
import { assertIsNotBrowser } from './assertIsNotBrowser.js';
|
|
13
13
|
import { createDebugger } from './debug.js';
|
|
14
14
|
import { getGlobalObject } from './getGlobalObject.js';
|
|
15
|
+
import { isNonRunnableDev } from './isNonRunnableDev.js';
|
|
15
16
|
import { isVitest } from './isVitest.js';
|
|
16
17
|
import pc from '@brillout/picocolors';
|
|
17
18
|
assertIsNotBrowser();
|
|
@@ -24,8 +25,6 @@ function assertIsNotProductionRuntime() {
|
|
|
24
25
|
setup.shouldNotBeProduction = true;
|
|
25
26
|
}
|
|
26
27
|
function onSetupRuntime() {
|
|
27
|
-
if (true)
|
|
28
|
-
return; // TODO/now refactor this
|
|
29
28
|
if (debug.isActivated)
|
|
30
29
|
debug('assertSetup()', new Error().stack);
|
|
31
30
|
if (isTest())
|
|
@@ -33,7 +32,7 @@ function onSetupRuntime() {
|
|
|
33
32
|
assertNodeEnvIsNotUndefinedString();
|
|
34
33
|
if (!setup.viteDevServer && setup.isViteDev === undefined) {
|
|
35
34
|
// TO-DO/eventually: make it assertUsage() again once https://github.com/vikejs/vike/issues/1528 is implemented.
|
|
36
|
-
assertWarning(!isNodeEnvDev(), `The ${getEnvDescription()}, which is contradictory because the environment seems to be a production environment (Vite isn't loaded), see ${pc.underline('https://vike.dev/NODE_ENV')} and ${pc.underline('https://vike.dev/warning/setup')}`, { onlyOnce: true });
|
|
35
|
+
assertWarning(!isNodeEnvDev() || isNonRunnableDev(), `The ${getEnvDescription()}, which is contradictory because the environment seems to be a production environment (Vite isn't loaded), see ${pc.underline('https://vike.dev/NODE_ENV')} and ${pc.underline('https://vike.dev/warning/setup')}`, { onlyOnce: true });
|
|
37
36
|
assertUsage(!setup.vikeVitePlugin, `Vike's Vite plugin (the ${pc.cyan('vike/plugin')} module) shouldn't be loaded in production, see ${pc.underline('https://vike.dev/warning/setup')}`);
|
|
38
37
|
// This assert() one of the main goal of this file: it ensures assertIsNotProductionRuntime()
|
|
39
38
|
assert(!setup.shouldNotBeProduction);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { isNonRunnableDev };
|
|
2
|
+
import { assert } from './assert.js';
|
|
3
|
+
import { assertIsNotBrowser } from './assertIsNotBrowser.js';
|
|
4
|
+
assertIsNotBrowser();
|
|
5
|
+
function isNonRunnableDev() {
|
|
6
|
+
if (typeof __VIKE__IS_NON_RUNNABLE_DEV === 'undefined')
|
|
7
|
+
return false;
|
|
8
|
+
assert(__VIKE__IS_NON_RUNNABLE_DEV === true);
|
|
9
|
+
return true;
|
|
10
|
+
}
|