vike 0.4.182 → 0.4.183-commit-f6cedaa

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.
@@ -74,7 +74,7 @@ Object.defineProperty(plugin, 'apply', {
74
74
  (0, utils_js_2.assertUsage)(false, `Add ${picocolors_1.default.cyan('vike()')} instead of ${picocolors_1.default.cyan('vike')} to vite.config.js#plugins (i.e. call the function and add the return value instead of adding the function itself)`, { showStackTrace: true });
75
75
  }
76
76
  });
77
- // node_modules/vike/package.json#peerDependencies.vite isn't enough as users can ignore it
77
+ // package.json#peerDependencies isn't enough as users can ignore it
78
78
  function assertViteVersion() {
79
- (0, utils_js_2.assertVersion)('Vite', vite_1.version, '4.4.0');
79
+ (0, utils_js_2.assertVersion)('Vite', vite_1.version, '5.1.0');
80
80
  }
@@ -29,7 +29,12 @@ function devConfig() {
29
29
  // We exclude Vike's client runtime to be able to use Vite's import.meta.glob()
30
30
  'vike/client',
31
31
  'vike/client/router',
32
+ // It seems like client-side/isomorphic imports also need to be excluded, in order to avoid the following:
33
+ // ```
34
+ // Client runtime loaded twice https://vike.dev/client-runtime-duplicated
35
+ // ```
32
36
  'vike/routing',
37
+ 'vike/getPageContext',
33
38
  // We exclude @brillout/json-serializer and @brillout/picocolors to avoid:
34
39
  // ```
35
40
  // 9:28:58 AM [vite] ✨ new dependencies optimized: @brillout/json-serializer/parse
@@ -18,11 +18,11 @@ const getFilePath_js_1 = require("../../shared/getFilePath.js");
18
18
  function importUserCode() {
19
19
  let config;
20
20
  let configVike;
21
- let isDev_;
21
+ let isDev;
22
22
  return {
23
23
  name: 'vike:importUserCode',
24
24
  config(_, env) {
25
- isDev_ = (0, utils_js_1.isDev3)(env);
25
+ isDev = (0, utils_js_1.isDev3)(env);
26
26
  return {
27
27
  experimental: {
28
28
  // TODO/v1-release: remove
@@ -50,10 +50,10 @@ function importUserCode() {
50
50
  }
51
51
  },
52
52
  async load(id, options) {
53
- const isDev = isDev_ !== null ? isDev_ : (0, utils_js_1.isDev1)();
54
53
  if (!(0, utils_js_1.isVirtualFileId)(id))
55
54
  return undefined;
56
55
  id = (0, utils_js_1.getVirtualFileId)(id);
56
+ (0, utils_js_1.assert)(typeof isDev === 'boolean');
57
57
  if ((0, virtualFilePageConfigValuesAll_js_1.isVirtualFileIdPageConfigValuesAll)(id)) {
58
58
  const code = await (0, getVirtualFilePageConfigValuesAll_js_1.getVirtualFilePageConfigValuesAll)(id, isDev, config);
59
59
  return code;
@@ -64,8 +64,6 @@ function importUserCode() {
64
64
  }
65
65
  },
66
66
  configureServer(server) {
67
- if (isDev_ === null)
68
- (0, utils_js_1.isDev1_onConfigureServer)();
69
67
  handleFileAddRemove(server, config);
70
68
  }
71
69
  };
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setGlobalContext = void 0;
4
4
  const globalContext_js_1 = require("../../runtime/globalContext.js");
5
+ const utils_js_1 = require("../utils.js");
5
6
  function setGlobalContext() {
6
7
  return {
7
8
  name: 'vike:setGlobalContext',
@@ -11,6 +12,12 @@ function setGlobalContext() {
11
12
  handler(viteDevServer) {
12
13
  (0, globalContext_js_1.setGlobalContext_viteDevServer)(viteDevServer);
13
14
  }
15
+ },
16
+ config: {
17
+ handler(_, env) {
18
+ const isDev = (0, utils_js_1.isDev3)(env);
19
+ (0, globalContext_js_1.setGlobalContext_isDev)(isDev);
20
+ }
14
21
  }
15
22
  };
16
23
  }
@@ -3,7 +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.getRuntimeManifest = exports.setGlobalContext_prerender = exports.setGlobalContext_viteDevServer = exports.getViteConfig = exports.getViteDevServer = exports.getGlobalContext = exports.initGlobalContext = exports.getGlobalContextAsync = exports.getGlobalContextSync = void 0;
6
+ exports.getRuntimeManifest = exports.setGlobalContext_prerender = exports.setGlobalContext_isDev = exports.setGlobalContext_viteDevServer = exports.getViteConfig = exports.getViteDevServer = exports.getGlobalContext = exports.initGlobalContext = exports.getGlobalContextAsync = exports.getGlobalContextSync = void 0;
7
7
  const utils_js_1 = require("./utils.js");
8
8
  const loadImportBuild_js_1 = require("./globalContext/loadImportBuild.js");
9
9
  const getPageFiles_js_1 = require("../../shared/getPageFiles.js");
@@ -61,11 +61,14 @@ function setGlobalContext_viteDevServer(viteDevServer) {
61
61
  if (globalObject.viteDevServer)
62
62
  return;
63
63
  (0, utils_js_1.assert)(!globalObject.globalContext);
64
- (0, utils_js_1.assert)(!globalObject.globalContext);
65
64
  globalObject.viteConfig = viteDevServer.config;
66
65
  globalObject.viteDevServer = viteDevServer;
67
66
  }
68
67
  exports.setGlobalContext_viteDevServer = setGlobalContext_viteDevServer;
68
+ function setGlobalContext_isDev(isDev) {
69
+ globalObject.isDev = isDev;
70
+ }
71
+ exports.setGlobalContext_isDev = setGlobalContext_isDev;
69
72
  function getViteDevServer() {
70
73
  return globalObject.viteDevServer ?? null;
71
74
  }
@@ -84,12 +87,12 @@ exports.getViteConfig = getViteConfig;
84
87
  async function initGlobalContext(isPrerendering = false, outDir) {
85
88
  if (globalObject.globalContext)
86
89
  return;
87
- const { viteDevServer, viteConfig } = globalObject;
88
- (0, utils_js_1.assertNodeEnv_runtime)(!!viteDevServer);
89
- const isProduction = !viteDevServer;
90
- if (!isProduction) {
90
+ const { viteDevServer, viteConfig, isDev } = globalObject;
91
+ (0, utils_js_1.assertNodeEnv_runtime)(isDev ?? false);
92
+ if (isDev) {
91
93
  (0, utils_js_1.assert)(viteConfig);
92
94
  (0, utils_js_1.assert)(!isPrerendering);
95
+ (0, utils_js_1.assert)(viteDevServer);
93
96
  const configVike = await (0, getConfigVike_js_1.getConfigVike)(viteConfig);
94
97
  const pluginManifest = getRuntimeManifest(configVike);
95
98
  globalObject.globalContext = {
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.182';
5
+ exports.PROJECT_VERSION = '0.4.183-commit-f6cedaa';
@@ -24,17 +24,18 @@ function assertNodeEnv_build() {
24
24
  assertNodeEnvIsNotDev('building');
25
25
  }
26
26
  exports.assertNodeEnv_build = assertNodeEnv_build;
27
- function assertNodeEnv_runtime(viteDevServerExists) {
27
+ function assertNodeEnv_runtime(isViteDev) {
28
28
  const nodeEnv = getNodeEnv();
29
29
  if (nodeEnv === null || nodeEnv === 'test')
30
30
  return;
31
- const isDev = isNodeEnvDev();
31
+ const isNodeDev = isNodeEnvDev();
32
32
  // Calling Vite's createServer() is enough for hasViteDevServer to be true, even without actually adding Vite's development middleware to the server: https://github.com/vikejs/vike/issues/792#issuecomment-1516830759
33
- if (viteDevServerExists === isDev)
33
+ if (isViteDev === isNodeDev)
34
34
  return;
35
35
  const nodeEnvDesc = getNodeEnvDesc();
36
36
  // TODO: make it assertUsage() again once #1528 is implemented.
37
- (0, assert_js_1.assertWarning)(false, `Vite's development server was${viteDevServerExists ? '' : "n't"} instantiated while the ${nodeEnvDesc} which is contradictory, see https://vike.dev/NODE_ENV`, { onlyOnce: true });
37
+ const errMsg = `Running ${isViteDev ? picocolors_1.default.cyan('$ vite dev') : 'app in production'} while the ${nodeEnvDesc} which is contradictory, see https://vike.dev/NODE_ENV`;
38
+ (0, assert_js_1.assertWarning)(false, errMsg, { onlyOnce: true });
38
39
  }
39
40
  exports.assertNodeEnv_runtime = assertNodeEnv_runtime;
40
41
  function assertNodeEnv_onVikePluginLoad() {
@@ -14,12 +14,12 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
14
14
  /* Use original assertUsage() & assertWarning() after all CJS is removed from node_modules/vike/dist/
15
15
  import { assertUsage, assertWarning } from './assert.js'
16
16
  */
17
- const globalObject = (0, getGlobalObject_js_1.getGlobalObject)('assertPackageInstances.ts', {
17
+ const globalObject = (0, getGlobalObject_js_1.getGlobalObject)('assertSingleInstance.ts', {
18
18
  instances: [],
19
19
  alreadyLogged: new Set()
20
20
  });
21
- const clientRuntimesClonflict = "The client runtime of Server Routing as well as the client runtime of Client Routing are both being loaded. Make sure they aren't loaded both at the same time for a given page. See https://vike.dev/client-runtimes-conflict";
22
- const clientNotSingleInstance = "Two vike client runtime instances are being loaded. Make sure your client-side bundles don't include vike twice. (In order to reduce the size of your client-side JavaScript bundles.)";
21
+ const clientRuntimesClonflict = 'Client runtime of both Server Routing and Client Routing loaded https://vike.dev/client-runtimes-conflict';
22
+ const clientNotSingleInstance = 'Client runtime loaded twice https://vike.dev/client-runtime-duplicated';
23
23
  function assertSingleInstance() {
24
24
  {
25
25
  const versions = (0, unique_js_1.unique)(globalObject.instances);
@@ -1,35 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isDev3 = exports.isDev2 = exports.isDev1_onConfigureServer = exports.isDev1 = void 0;
3
+ exports.isDev3 = exports.isDev2 = void 0;
4
+ const assert_js_1 = require("./assert.js");
4
5
  function isDev3(configEnv) {
5
6
  const { isPreview, command } = configEnv;
6
7
  if (command !== 'serve')
7
8
  return false;
8
- if (typeof isPreview === 'boolean')
9
- return !isPreview;
10
- // isPreview is undefined in older Vite versions, see https://github.com/vitejs/vite/commit/93fce55
11
- return null;
9
+ // `isPreview` is `undefined` in older Vite versions.
10
+ // https://github.com/vitejs/vite/pull/14855
11
+ // https://github.com/vitejs/vite/pull/15695O
12
+ // - Released at `vite@5.1.0`: https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#510-beta4-2024-01-26:~:text=fix(preview)%3A%20set%20isPreview%20true%20(%2315695)%20(93fce55)%2C%20closes%20%2315695
13
+ (0, assert_js_1.assert)(typeof isPreview === 'boolean');
14
+ return !isPreview;
12
15
  }
13
16
  exports.isDev3 = isDev3;
14
- // ********
15
- // Method 1 - reliable
16
- // ********
17
- const assert_js_1 = require("./assert.js");
18
- const getGlobalObject_js_1 = require("./getGlobalObject.js");
19
- const globalObject = (0, getGlobalObject_js_1.getGlobalObject)('utils/isDev.ts', { isDev: false, isDev_wasCalled: false });
20
- function isDev1() {
21
- globalObject.isDev_wasCalled = true;
22
- return globalObject.isDev;
23
- }
24
- exports.isDev1 = isDev1;
25
- function isDev1_onConfigureServer() {
26
- // configureServer() is called more than once when user presses Vite's dev server reload hotkey <r>
27
- if (globalObject.isDev)
28
- return;
29
- (0, assert_js_1.assert)(!globalObject.isDev_wasCalled);
30
- globalObject.isDev = true;
31
- }
32
- exports.isDev1_onConfigureServer = isDev1_onConfigureServer;
33
17
  function isDev2(config) {
34
18
  const isDev = config.command === 'serve' &&
35
19
  // Mode is 'development' by default: https://github.com/vitejs/vite/blob/bf9c49f521b7a6730231c35754d5e1f9c3a6a16e/packages/vite/src/node/config.ts#L383
@@ -48,7 +48,8 @@ function passToClientHint(pageContext, prop, propName) {
48
48
  }
49
49
  const WHITELIST = [
50
50
  'then',
51
- 'toJSON' // Vue triggers `toJSON`
51
+ // Vue calls toJSON()
52
+ 'toJSON'
52
53
  ];
53
54
  function isWhitelisted(prop) {
54
55
  if (WHITELIST.includes(prop))
@@ -68,7 +68,7 @@ Object.defineProperty(plugin, 'apply', {
68
68
  assertUsage(false, `Add ${pc.cyan('vike()')} instead of ${pc.cyan('vike')} to vite.config.js#plugins (i.e. call the function and add the return value instead of adding the function itself)`, { showStackTrace: true });
69
69
  }
70
70
  });
71
- // node_modules/vike/package.json#peerDependencies.vite isn't enough as users can ignore it
71
+ // package.json#peerDependencies isn't enough as users can ignore it
72
72
  function assertViteVersion() {
73
- assertVersion('Vite', version, '4.4.0');
73
+ assertVersion('Vite', version, '5.1.0');
74
74
  }
@@ -27,7 +27,12 @@ function devConfig() {
27
27
  // We exclude Vike's client runtime to be able to use Vite's import.meta.glob()
28
28
  'vike/client',
29
29
  'vike/client/router',
30
+ // It seems like client-side/isomorphic imports also need to be excluded, in order to avoid the following:
31
+ // ```
32
+ // Client runtime loaded twice https://vike.dev/client-runtime-duplicated
33
+ // ```
30
34
  'vike/routing',
35
+ 'vike/getPageContext',
31
36
  // We exclude @brillout/json-serializer and @brillout/picocolors to avoid:
32
37
  // ```
33
38
  // 9:28:58 AM [vite] ✨ new dependencies optimized: @brillout/json-serializer/parse
@@ -3,7 +3,7 @@ import { normalizePath } from 'vite';
3
3
  import { getConfigVike } from '../../../shared/getConfigVike.js';
4
4
  import { getVirtualFilePageConfigValuesAll } from './v1-design/getVirtualFilePageConfigValuesAll.js';
5
5
  import { getVirtualFileImportUserCode } from './getVirtualFileImportUserCode.js';
6
- import { assert, assertPosixPath, getOutDirs, getVirtualFileId, isDev1, isDev1_onConfigureServer, isDev3, isVirtualFileId, resolveVirtualFileId } from '../../utils.js';
6
+ import { assert, assertPosixPath, getOutDirs, getVirtualFileId, isDev3, isVirtualFileId, resolveVirtualFileId } from '../../utils.js';
7
7
  import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll.js';
8
8
  import { isVirtualFileIdImportUserCode } from '../../../shared/virtual-files/virtualFileImportUserCode.js';
9
9
  import { vikeConfigDependencies, reloadVikeConfig, isVikeConfigFile } from './v1-design/getVikeConfig.js';
@@ -13,11 +13,11 @@ import { getModuleFilePath } from '../../shared/getFilePath.js';
13
13
  function importUserCode() {
14
14
  let config;
15
15
  let configVike;
16
- let isDev_;
16
+ let isDev;
17
17
  return {
18
18
  name: 'vike:importUserCode',
19
19
  config(_, env) {
20
- isDev_ = isDev3(env);
20
+ isDev = isDev3(env);
21
21
  return {
22
22
  experimental: {
23
23
  // TODO/v1-release: remove
@@ -45,10 +45,10 @@ function importUserCode() {
45
45
  }
46
46
  },
47
47
  async load(id, options) {
48
- const isDev = isDev_ !== null ? isDev_ : isDev1();
49
48
  if (!isVirtualFileId(id))
50
49
  return undefined;
51
50
  id = getVirtualFileId(id);
51
+ assert(typeof isDev === 'boolean');
52
52
  if (isVirtualFileIdPageConfigValuesAll(id)) {
53
53
  const code = await getVirtualFilePageConfigValuesAll(id, isDev, config);
54
54
  return code;
@@ -59,8 +59,6 @@ function importUserCode() {
59
59
  }
60
60
  },
61
61
  configureServer(server) {
62
- if (isDev_ === null)
63
- isDev1_onConfigureServer();
64
62
  handleFileAddRemove(server, config);
65
63
  }
66
64
  };
@@ -1,5 +1,6 @@
1
1
  export { setGlobalContext };
2
- import { setGlobalContext_viteDevServer } from '../../runtime/globalContext.js';
2
+ import { setGlobalContext_isDev, setGlobalContext_viteDevServer } from '../../runtime/globalContext.js';
3
+ import { isDev3 } from '../utils.js';
3
4
  function setGlobalContext() {
4
5
  return {
5
6
  name: 'vike:setGlobalContext',
@@ -9,6 +10,12 @@ function setGlobalContext() {
9
10
  handler(viteDevServer) {
10
11
  setGlobalContext_viteDevServer(viteDevServer);
11
12
  }
13
+ },
14
+ config: {
15
+ handler(_, env) {
16
+ const isDev = isDev3(env);
17
+ setGlobalContext_isDev(isDev);
18
+ }
12
19
  }
13
20
  };
14
21
  }
@@ -5,6 +5,7 @@ export { getGlobalContext };
5
5
  export { getViteDevServer };
6
6
  export { getViteConfig };
7
7
  export { setGlobalContext_viteDevServer };
8
+ export { setGlobalContext_isDev };
8
9
  export { setGlobalContext_prerender };
9
10
  export { getRuntimeManifest };
10
11
  import type { ViteManifest } from '../shared/ViteManifest.js';
@@ -47,6 +48,7 @@ declare function getGlobalContextSync(): GlobalContextPublic;
47
48
  /** @experimental https://vike.dev/getGlobalContext */
48
49
  declare function getGlobalContextAsync(): Promise<GlobalContextPublic>;
49
50
  declare function setGlobalContext_viteDevServer(viteDevServer: ViteDevServer): void;
51
+ declare function setGlobalContext_isDev(isDev: boolean): void;
50
52
  declare function getViteDevServer(): ViteDevServer | null;
51
53
  declare function setGlobalContext_prerender(viteConfig: ResolvedConfig): void;
52
54
  declare function getViteConfig(): ResolvedConfig | null;
@@ -7,6 +7,7 @@ export { getGlobalContext };
7
7
  export { getViteDevServer };
8
8
  export { getViteConfig };
9
9
  export { setGlobalContext_viteDevServer };
10
+ export { setGlobalContext_isDev };
10
11
  export { setGlobalContext_prerender };
11
12
  export { getRuntimeManifest };
12
13
  import { assert, assertNodeEnv_runtime, assertUsage, assertWarning, getGlobalObject, isPlainObject, objectAssign, objectKeys } from './utils.js';
@@ -63,10 +64,12 @@ function setGlobalContext_viteDevServer(viteDevServer) {
63
64
  if (globalObject.viteDevServer)
64
65
  return;
65
66
  assert(!globalObject.globalContext);
66
- assert(!globalObject.globalContext);
67
67
  globalObject.viteConfig = viteDevServer.config;
68
68
  globalObject.viteDevServer = viteDevServer;
69
69
  }
70
+ function setGlobalContext_isDev(isDev) {
71
+ globalObject.isDev = isDev;
72
+ }
70
73
  function getViteDevServer() {
71
74
  return globalObject.viteDevServer ?? null;
72
75
  }
@@ -82,12 +85,12 @@ function getViteConfig() {
82
85
  async function initGlobalContext(isPrerendering = false, outDir) {
83
86
  if (globalObject.globalContext)
84
87
  return;
85
- const { viteDevServer, viteConfig } = globalObject;
86
- assertNodeEnv_runtime(!!viteDevServer);
87
- const isProduction = !viteDevServer;
88
- if (!isProduction) {
88
+ const { viteDevServer, viteConfig, isDev } = globalObject;
89
+ assertNodeEnv_runtime(isDev ?? false);
90
+ if (isDev) {
89
91
  assert(viteConfig);
90
92
  assert(!isPrerendering);
93
+ assert(viteDevServer);
91
94
  const configVike = await getConfigVike(viteConfig);
92
95
  const pluginManifest = getRuntimeManifest(configVike);
93
96
  globalObject.globalContext = {
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.182";
1
+ export declare const PROJECT_VERSION: "0.4.183-commit-f6cedaa";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.182';
2
+ export const PROJECT_VERSION = '0.4.183-commit-f6cedaa';
@@ -4,7 +4,7 @@ export { assertNodeEnv_onVikePluginLoad };
4
4
  export { handleNodeEnv_prerender };
5
5
  export { handleNodeEnv_vitePluginVercel };
6
6
  declare function assertNodeEnv_build(): void;
7
- declare function assertNodeEnv_runtime(viteDevServerExists: boolean): void;
7
+ declare function assertNodeEnv_runtime(isViteDev: boolean): void;
8
8
  declare function assertNodeEnv_onVikePluginLoad(): void;
9
9
  declare function handleNodeEnv_prerender(): void;
10
10
  declare function handleNodeEnv_vitePluginVercel(): void;
@@ -24,17 +24,18 @@ assertIsNotBrowser();
24
24
  function assertNodeEnv_build() {
25
25
  assertNodeEnvIsNotDev('building');
26
26
  }
27
- function assertNodeEnv_runtime(viteDevServerExists) {
27
+ function assertNodeEnv_runtime(isViteDev) {
28
28
  const nodeEnv = getNodeEnv();
29
29
  if (nodeEnv === null || nodeEnv === 'test')
30
30
  return;
31
- const isDev = isNodeEnvDev();
31
+ const isNodeDev = isNodeEnvDev();
32
32
  // Calling Vite's createServer() is enough for hasViteDevServer to be true, even without actually adding Vite's development middleware to the server: https://github.com/vikejs/vike/issues/792#issuecomment-1516830759
33
- if (viteDevServerExists === isDev)
33
+ if (isViteDev === isNodeDev)
34
34
  return;
35
35
  const nodeEnvDesc = getNodeEnvDesc();
36
36
  // TODO: make it assertUsage() again once #1528 is implemented.
37
- assertWarning(false, `Vite's development server was${viteDevServerExists ? '' : "n't"} instantiated while the ${nodeEnvDesc} which is contradictory, see https://vike.dev/NODE_ENV`, { onlyOnce: true });
37
+ const errMsg = `Running ${isViteDev ? pc.cyan('$ vite dev') : 'app in production'} while the ${nodeEnvDesc} which is contradictory, see https://vike.dev/NODE_ENV`;
38
+ assertWarning(false, errMsg, { onlyOnce: true });
38
39
  }
39
40
  function assertNodeEnv_onVikePluginLoad() {
40
41
  const nodeEnv = getNodeEnv();
@@ -11,12 +11,12 @@ import pc from '@brillout/picocolors';
11
11
  /* Use original assertUsage() & assertWarning() after all CJS is removed from node_modules/vike/dist/
12
12
  import { assertUsage, assertWarning } from './assert.js'
13
13
  */
14
- const globalObject = getGlobalObject('assertPackageInstances.ts', {
14
+ const globalObject = getGlobalObject('assertSingleInstance.ts', {
15
15
  instances: [],
16
16
  alreadyLogged: new Set()
17
17
  });
18
- const clientRuntimesClonflict = "The client runtime of Server Routing as well as the client runtime of Client Routing are both being loaded. Make sure they aren't loaded both at the same time for a given page. See https://vike.dev/client-runtimes-conflict";
19
- const clientNotSingleInstance = "Two vike client runtime instances are being loaded. Make sure your client-side bundles don't include vike twice. (In order to reduce the size of your client-side JavaScript bundles.)";
18
+ const clientRuntimesClonflict = 'Client runtime of both Server Routing and Client Routing loaded https://vike.dev/client-runtimes-conflict';
19
+ const clientNotSingleInstance = 'Client runtime loaded twice https://vike.dev/client-runtime-duplicated';
20
20
  function assertSingleInstance() {
21
21
  {
22
22
  const versions = unique(globalObject.instances);
@@ -1,10 +1,6 @@
1
- export { isDev1 };
2
- export { isDev1_onConfigureServer };
3
1
  export { isDev2 };
4
2
  export { isDev3 };
5
3
  import type { ConfigEnv } from 'vite';
6
- declare function isDev3(configEnv: ConfigEnv): null | boolean;
7
- declare function isDev1(): boolean;
8
- declare function isDev1_onConfigureServer(): void | undefined;
4
+ declare function isDev3(configEnv: ConfigEnv): boolean;
9
5
  import type { ResolvedConfig } from 'vite';
10
6
  declare function isDev2(config: ResolvedConfig): boolean;
@@ -1,32 +1,16 @@
1
- export { isDev1 };
2
- export { isDev1_onConfigureServer };
3
1
  export { isDev2 };
4
2
  export { isDev3 };
3
+ import { assert } from './assert.js';
5
4
  function isDev3(configEnv) {
6
5
  const { isPreview, command } = configEnv;
7
6
  if (command !== 'serve')
8
7
  return false;
9
- if (typeof isPreview === 'boolean')
10
- return !isPreview;
11
- // isPreview is undefined in older Vite versions, see https://github.com/vitejs/vite/commit/93fce55
12
- return null;
13
- }
14
- // ********
15
- // Method 1 - reliable
16
- // ********
17
- import { assert } from './assert.js';
18
- import { getGlobalObject } from './getGlobalObject.js';
19
- const globalObject = getGlobalObject('utils/isDev.ts', { isDev: false, isDev_wasCalled: false });
20
- function isDev1() {
21
- globalObject.isDev_wasCalled = true;
22
- return globalObject.isDev;
23
- }
24
- function isDev1_onConfigureServer() {
25
- // configureServer() is called more than once when user presses Vite's dev server reload hotkey <r>
26
- if (globalObject.isDev)
27
- return;
28
- assert(!globalObject.isDev_wasCalled);
29
- globalObject.isDev = true;
8
+ // `isPreview` is `undefined` in older Vite versions.
9
+ // https://github.com/vitejs/vite/pull/14855
10
+ // https://github.com/vitejs/vite/pull/15695O
11
+ // - Released at `vite@5.1.0`: https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#510-beta4-2024-01-26:~:text=fix(preview)%3A%20set%20isPreview%20true%20(%2315695)%20(93fce55)%2C%20closes%20%2315695
12
+ assert(typeof isPreview === 'boolean');
13
+ return !isPreview;
30
14
  }
31
15
  function isDev2(config) {
32
16
  const isDev = config.command === 'serve' &&
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.182";
3
+ projectVersion: "0.4.183-commit-f6cedaa";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.182",
3
+ "version": "0.4.183-commit-f6cedaa",
4
4
  "scripts": {
5
5
  "dev": "tsc --watch",
6
6
  "build": "rimraf dist/ && pnpm run build:esm && pnpm run build:cjs",
@@ -23,7 +23,7 @@
23
23
  "es-module-lexer": "^1.0.0",
24
24
  "esbuild": "^0.19.0",
25
25
  "fast-glob": "^3.0.0",
26
- "semver": "^7.6.2",
26
+ "semver": "^7.0.0",
27
27
  "sirv": "^2.0.0",
28
28
  "source-map-support": "^0.5.0"
29
29
  },
@@ -148,7 +148,7 @@
148
148
  },
149
149
  "peerDependencies": {
150
150
  "react-streaming": ">=0.3.42",
151
- "vite": ">=4.4.0"
151
+ "vite": ">=5.1.0"
152
152
  },
153
153
  "peerDependenciesMeta": {
154
154
  "react-streaming": {
@@ -208,12 +208,7 @@
208
208
  },
209
209
  "devDependencies": {
210
210
  "@biomejs/biome": "^1.5.3",
211
- "@brillout/import": "^0.2.3",
212
- "@brillout/json-serializer": "^0.5.8",
213
- "@brillout/picocolors": "^1.0.13",
214
211
  "@brillout/release-me": "^0.4.0",
215
- "@brillout/require-shim": "^0.1.2",
216
- "@brillout/vite-plugin-server-entry": "^0.4.0",
217
212
  "@types/estree": "^1.0.5",
218
213
  "@types/jest": "^29.5.11",
219
214
  "@types/node": "^20.10.5",
@@ -226,10 +221,11 @@
226
221
  "fast-glob": "^3.3.2",
227
222
  "react-streaming": "^0.3.42",
228
223
  "rimraf": "^5.0.5",
224
+ "semver": "^7.6.3",
229
225
  "sirv": "^2.0.4",
230
226
  "source-map-support": "^0.5.21",
231
227
  "typescript": "^5.4.5",
232
- "vite": "^5.3.5"
228
+ "vite": "^5.4.0"
233
229
  },
234
230
  "engines": {
235
231
  "node": ">=18.0.0"