vike 0.4.253-commit-332f31b → 0.4.254

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.
@@ -39,6 +39,7 @@ import { pluginViteConfigVikeExtensions } from './plugins/pluginViteConfigVikeEx
39
39
  import { pluginStripPointerImportAttribute } from './plugins/pluginStripPointerImportAttribute.js';
40
40
  import { getVikeConfigInternalEarly, isOnlyResolvingUserConfig } from '../api/resolveViteConfigFromUser.js';
41
41
  import './assertEnvVite.js';
42
+ import { isStorybook } from '../../utils/isStorybook.js';
42
43
  // We don't call this in ./onLoad.ts to avoid a cyclic dependency with utils.ts
43
44
  setGetClientEntrySrcDev(getClientEntrySrcDev);
44
45
  assertIsNotProductionRuntime();
@@ -114,7 +115,10 @@ function removeVitePlugin() {
114
115
  if (isVitest() && !isVikeCliOrApi()) {
115
116
  return true;
116
117
  }
117
- // TO-DO/eventually: also skip for other third party tools such as Storybook?
118
+ // https://github.com/vikejs/vike/issues/798#issuecomment-1531093835
119
+ if (isStorybook() && !isVikeCliOrApi()) {
120
+ return true;
121
+ }
118
122
  return false;
119
123
  }
120
124
  // Error upon wrong usage
@@ -1,23 +1,14 @@
1
1
  export { isViteCli };
2
2
  export { getViteConfigForBuildFromCli };
3
3
  export { getViteCommandFromCli };
4
- import { toPosixPath } from '../../../utils/path.js';
5
4
  import { assert } from '../../../utils/assert.js';
6
5
  import { isObject } from '../../../utils/isObject.js';
6
+ import { isToolCli } from '../../../utils/isToolCli.js';
7
7
  import { cac } from 'cac';
8
8
  import '../assertEnvVite.js';
9
9
  const desc = 'vike:vite-cli-simulation';
10
10
  function isViteCli() {
11
- let execPath = process.argv[1];
12
- assert(execPath);
13
- execPath = toPosixPath(execPath);
14
- return (
15
- // pnpm
16
- execPath.endsWith('/bin/vite.js') ||
17
- // npm & yarn
18
- execPath.endsWith('/.bin/vite') ||
19
- // Global install
20
- execPath.endsWith('/bin/vite'));
11
+ return isToolCli('vite');
21
12
  }
22
13
  function getViteCommandFromCli() {
23
14
  if (!isViteCli())
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.253-commit-332f31b";
1
+ export declare const PROJECT_VERSION: "0.4.254";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.253-commit-332f31b';
2
+ export const PROJECT_VERSION = '0.4.254';
@@ -0,0 +1,2 @@
1
+ export { isStorybook };
2
+ declare function isStorybook(): boolean;
@@ -0,0 +1,8 @@
1
+ export { isStorybook };
2
+ import { isToolCli } from './isToolCli.js';
3
+ function isStorybook() {
4
+ const TEST_CLI = isToolCli('storybook');
5
+ // https://github.com/storybookjs/storybook/pull/33938
6
+ const TEST_ENV = 'STORYBOOK' in process.env;
7
+ return TEST_ENV || TEST_CLI;
8
+ }
@@ -0,0 +1,2 @@
1
+ export { isToolCli };
2
+ declare function isToolCli(tool: 'vite' | 'storybook'): boolean;
@@ -0,0 +1,7 @@
1
+ export { isToolCli };
2
+ import { toPosixPath } from './path.js';
3
+ function isToolCli(tool) {
4
+ let execPath = process.argv[1];
5
+ execPath = toPosixPath(execPath);
6
+ return !!execPath.split('node_modules/').at(-1)?.startsWith(`${tool}/`);
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.253-commit-332f31b",
3
+ "version": "0.4.254",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {