@itcase/storybook-config 1.2.79 → 1.2.81

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.
Files changed (120) hide show
  1. package/dist/{FormSubmitWrapper-_VeLgVir.js → FormSubmitWrapper-Bv5qs18h.js} +10 -3
  2. package/dist/cjs/components/EmailTemplatePreview.js +1 -1
  3. package/dist/cjs/components/FormSubmitWrapper.js +1 -1
  4. package/dist/cjs/decorators/withFormSubmitDecorator.js +1 -2
  5. package/dist/cjs/decorators/withNextDecorator.js +1 -1
  6. package/dist/cjs/decorators/withUiDecorator.js +1 -1
  7. package/dist/cjs/decorators.js +2 -3
  8. package/dist/components/EmailTemplatePreview/index.d.ts +2 -0
  9. package/dist/components/EmailTemplatePreview/index.js +38 -0
  10. package/dist/components/EmailTemplatePreview.js +1 -1
  11. package/dist/components/FormSubmitWrapper/FormSubmitWrapper.d.ts +16 -0
  12. package/dist/components/FormSubmitWrapper/FormSubmitWrapper.js +88 -0
  13. package/dist/components/FormSubmitWrapper/autoSubmitForm.d.ts +2 -0
  14. package/dist/components/FormSubmitWrapper/autoSubmitForm.js +106 -0
  15. package/dist/components/FormSubmitWrapper/index.d.ts +2 -0
  16. package/dist/components/FormSubmitWrapper/index.js +2 -0
  17. package/dist/components/{FormSubmitWrapper-B2tMQZu2.js → FormSubmitWrapper-EwNkaMht.js} +10 -3
  18. package/dist/components/FormSubmitWrapper.js +1 -1
  19. package/dist/config/addons/addonThemes.d.ts +15 -0
  20. package/dist/config/addons/addonThemes.js +14 -15
  21. package/dist/config/addons/addonsNextJs.d.ts +2 -0
  22. package/dist/config/addons/addonsNextJs.js +8 -9
  23. package/dist/config/addons/addonsReactNative.d.ts +2 -0
  24. package/dist/config/addons/addonsReactNative.js +6 -7
  25. package/dist/config/addons/addonsReactNativeWeb.d.ts +2 -0
  26. package/dist/config/addons/addonsReactNativeWeb.js +2 -3
  27. package/dist/config/addons/addonsVite.d.ts +2 -0
  28. package/dist/config/addons/addonsVite.js +8 -9
  29. package/dist/config/addons/addonsWebpack.d.ts +18 -0
  30. package/dist/config/addons/addonsWebpack.js +26 -27
  31. package/dist/config/appearance/appearance.d.ts +1 -0
  32. package/dist/config/appearance/appearance.js +1 -1
  33. package/dist/config/backgrounds/backgrounds.d.ts +23 -0
  34. package/dist/config/backgrounds/backgrounds.js +22 -24
  35. package/dist/config/code/code.d.ts +8 -0
  36. package/dist/config/code/code.js +18 -22
  37. package/dist/config/config/mainConfigNextJsVite.d.ts +10 -0
  38. package/dist/config/config/mainConfigNextJsVite.js +35 -38
  39. package/dist/config/config/mainConfigReactNative.d.ts +9 -0
  40. package/dist/config/config/mainConfigReactNative.js +21 -23
  41. package/dist/config/config/mainConfigReactNativeWeb.d.ts +23 -0
  42. package/dist/config/config/mainConfigReactNativeWeb.js +42 -46
  43. package/dist/config/config/mainConfigVite.d.ts +9 -0
  44. package/dist/config/config/mainConfigVite.js +75 -80
  45. package/dist/config/config/mainConfigWebpack.d.ts +9 -0
  46. package/dist/config/config/mainConfigWebpack.js +39 -64
  47. package/dist/config/framework/frameworkNextJs.d.ts +4 -0
  48. package/dist/config/framework/frameworkNextJs.js +3 -4
  49. package/dist/config/framework/frameworkNextJsVite.d.ts +4 -0
  50. package/dist/config/framework/frameworkNextJsVite.js +3 -4
  51. package/dist/config/framework/frameworkReactNative.d.ts +4 -0
  52. package/dist/config/framework/frameworkReactNative.js +3 -4
  53. package/dist/config/framework/frameworkReactNativeWeb.d.ts +4 -0
  54. package/dist/config/framework/frameworkReactNativeWeb.js +3 -4
  55. package/dist/config/framework/frameworkVite.d.ts +4 -0
  56. package/dist/config/framework/frameworkVite.js +3 -4
  57. package/dist/config/framework/frameworkWebpack.d.ts +11 -0
  58. package/dist/config/framework/frameworkWebpack.js +9 -10
  59. package/dist/config/main/index.d.ts +26 -0
  60. package/dist/config/main/index.js +26 -53
  61. package/dist/config/msw/index.d.ts +2 -0
  62. package/dist/config/msw/index.js +2 -7
  63. package/dist/config/msw/mswHandlers.d.ts +5 -0
  64. package/dist/config/msw/mswHandlers.js +20 -24
  65. package/dist/config/ondevice/ondeviceBackgrounds.d.ts +8 -0
  66. package/dist/config/ondevice/ondeviceBackgrounds.js +8 -9
  67. package/dist/config/preview/index.d.ts +6 -0
  68. package/dist/config/preview/index.js +6 -13
  69. package/dist/config/refs/refs.d.ts +13 -0
  70. package/dist/config/refs/refs.js +12 -13
  71. package/dist/config/sourceLink/sourceLink.d.ts +35 -0
  72. package/dist/config/sourceLink/sourceLink.js +32 -36
  73. package/dist/config/static/staticDirsNextJs.d.ts +5 -0
  74. package/dist/config/static/staticDirsNextJs.js +5 -6
  75. package/dist/config/static/staticDirsReactNative.d.ts +2 -0
  76. package/dist/config/static/staticDirsReactNative.js +2 -3
  77. package/dist/config/static/staticDirsReactNativeWeb.d.ts +2 -0
  78. package/dist/config/static/staticDirsReactNativeWeb.js +2 -3
  79. package/dist/config/static/staticDirsVite.d.ts +5 -0
  80. package/dist/config/static/staticDirsVite.js +2 -3
  81. package/dist/config/static/staticDirsWebpack.d.ts +5 -0
  82. package/dist/config/static/staticDirsWebpack.js +2 -3
  83. package/dist/config/status/status.d.ts +21 -0
  84. package/dist/config/status/status.js +23 -24
  85. package/dist/config/users/authorization.d.ts +22 -0
  86. package/dist/config/users/authorization.js +6 -8
  87. package/dist/config/users/users.d.ts +18 -0
  88. package/dist/config/users/users.js +19 -21
  89. package/dist/config/viewport/viewport.d.ts +264 -0
  90. package/dist/config/viewport/viewport.js +23 -25
  91. package/dist/config/vite/getMediaProxyServerConfig.d.ts +13 -0
  92. package/dist/config/vite/getMediaProxyServerConfig.js +14 -16
  93. package/dist/decorators/index.d.ts +8 -0
  94. package/dist/decorators/index.js +8 -0
  95. package/dist/decorators/withClearStoresDecorator.d.ts +4 -0
  96. package/dist/decorators/withExtraProviders.d.ts +2 -0
  97. package/dist/decorators/withFigmaSourceLink.d.ts +5 -0
  98. package/dist/decorators/withFormSubmitDecorator.d.ts +2 -0
  99. package/dist/decorators/withFormSubmitDecorator.js +1 -2
  100. package/dist/decorators/withLayoutDecorator.d.ts +4 -0
  101. package/dist/decorators/withNextDecorator.d.ts +9 -0
  102. package/dist/decorators/withNextDecorator.js +1 -1
  103. package/dist/decorators/withUiDecorator.d.ts +5 -0
  104. package/dist/decorators/withUiDecorator.js +1 -1
  105. package/dist/decorators.js +2 -3
  106. package/dist/utils/getFigmaSourceLink.d.ts +2 -0
  107. package/dist/utils/getFigmaSourceLink.js +13 -14
  108. package/dist/utils/getStoryInfoBlocks.d.ts +2 -0
  109. package/dist/utils/getStoryInfoBlocks.js +45 -55
  110. package/dist/utils/handleMSWParameters.d.ts +8 -0
  111. package/dist/utils/handleMSWParameters.js +18 -27
  112. package/dist/utils/hasFormParameters.d.ts +2 -0
  113. package/dist/utils/hasFormParameters.js +6 -9
  114. package/dist/utils/index.d.ts +7 -0
  115. package/dist/utils/index.js +9 -17
  116. package/dist/utils/isVitestEnvironment.d.ts +2 -0
  117. package/dist/utils/isVitestEnvironment.js +2 -3
  118. package/dist/utils/storybookServerErrorOnSubmit.d.ts +2 -0
  119. package/dist/utils/storybookServerErrorOnSubmit.js +12 -19
  120. package/package.json +50 -43
@@ -0,0 +1,23 @@
1
+ declare const BACKGROUNDS: {
2
+ baikal: {
3
+ name: string;
4
+ value: string;
5
+ };
6
+ dark: {
7
+ name: string;
8
+ value: string;
9
+ };
10
+ default: {
11
+ name: string;
12
+ value: string;
13
+ };
14
+ figma: {
15
+ name: string;
16
+ value: string;
17
+ };
18
+ light: {
19
+ name: string;
20
+ value: string;
21
+ };
22
+ };
23
+ export { BACKGROUNDS };
@@ -1,25 +1,23 @@
1
1
  const BACKGROUNDS = {
2
- default: {
3
- name: 'Default',
4
- value: 'none',
5
- },
6
- baikal: {
7
- name: 'Baikal',
8
- value: '#4CB7EA',
9
- },
10
- dark: {
11
- name: 'Dark',
12
- value: '#000000',
13
- },
14
- figma: {
15
- name: 'Figma',
16
- value: '#E5E5E5',
17
- },
18
- light: {
19
- name: 'Light',
20
- value: '#fff',
21
- },
22
- }
23
-
24
- export { BACKGROUNDS }
25
-
2
+ baikal: {
3
+ name: 'Baikal',
4
+ value: '#4CB7EA',
5
+ },
6
+ dark: {
7
+ name: 'Dark',
8
+ value: '#000000',
9
+ },
10
+ default: {
11
+ name: 'Default',
12
+ value: 'none',
13
+ },
14
+ figma: {
15
+ name: 'Figma',
16
+ value: '#E5E5E5',
17
+ },
18
+ light: {
19
+ name: 'Light',
20
+ value: '#fff',
21
+ },
22
+ };
23
+ export { BACKGROUNDS };
@@ -0,0 +1,8 @@
1
+ declare const CODE: {
2
+ codePanel: boolean;
3
+ source: {
4
+ type: string;
5
+ transform: (code: string, context: any) => string;
6
+ };
7
+ };
8
+ export { CODE };
@@ -1,24 +1,20 @@
1
1
  const CODE = {
2
- codePanel: true,
3
- source: {
4
- type: 'dynamic',
5
- transform: (code, context) => {
6
- const booleanProps = Object.entries(context.argTypes ?? {})
7
- .filter(
8
- ([, v]) => v?.control === 'boolean' || v?.type?.name === 'boolean',
9
- )
10
- .map(([name]) => name)
11
- let result = code
12
- for (const prop of booleanProps) {
13
- // badge → badge={true}, но не трогаем badge={...} и badgeValue
14
- result = result.replace(
15
- new RegExp(`(\\s)${prop}(?=[\\s/>])`, 'g'),
16
- `$1${prop}={true}`,
17
- )
18
- }
19
- return result
2
+ codePanel: true,
3
+ source: {
4
+ type: 'dynamic',
5
+ transform: (code, context) => {
6
+ const booleanProps = Object.entries(context.argTypes ?? {})
7
+ .filter(([, v]) => {
8
+ return v?.control === 'boolean' || v?.type?.name === 'boolean';
9
+ })
10
+ .map(([name]) => name);
11
+ let result = code;
12
+ for (const prop of booleanProps) {
13
+ // badge → badge={true}, но не трогаем badge={...} и badgeValue
14
+ result = result.replace(new RegExp(`(\\s)${prop}(?=[\\s/>])`, 'g'), `$1${prop}={true}`);
15
+ }
16
+ return result;
17
+ },
20
18
  },
21
- },
22
- }
23
-
24
- export { CODE }
19
+ };
20
+ export { CODE };
@@ -0,0 +1,10 @@
1
+ declare const MAIN_CONFIG_NEXTJS_VITE: {
2
+ env: (config: any) => any;
3
+ viteFinal: (config: any) => Promise<Record<string, any>>;
4
+ core: {
5
+ disableTelemetry: boolean;
6
+ disableWhatsNewNotifications: boolean;
7
+ };
8
+ tags: string[];
9
+ };
10
+ export { MAIN_CONFIG_NEXTJS_VITE };
@@ -1,39 +1,36 @@
1
- import svgr from 'vite-plugin-svgr'
2
-
3
- import { getMediaProxyServerConfig } from '../vite/getMediaProxyServerConfig.js'
4
-
1
+ import svgr from 'vite-plugin-svgr';
2
+ import { getMediaProxyServerConfig } from '../vite/getMediaProxyServerConfig.js';
5
3
  const MAIN_CONFIG_NEXTJS_VITE = {
6
- env: (config) => ({
7
- ...config,
8
- REST_BASE_URL: process.env.REST_BASE_URL,
9
- STORYBOOK_MODE: process.env.STORYBOOK_MODE || '',
10
- }),
11
- viteFinal: async (config) => {
12
- const { mergeConfig } = await import('vite')
13
- return mergeConfig(config, {
14
- css: {
15
- devSourcemap: true,
16
- },
17
- optimizeDeps: {
18
- ...config.optimizeDeps,
19
- exclude: ['react-native', ...(config.optimizeDeps?.exclude ?? [])],
20
- rolldownOptions: {
21
- ...config.optimizeDeps?.rolldownOptions,
22
- },
23
- },
24
- plugins: [svgr({ include: '**/*.svg' })],
25
- resolve: {
26
- ...config.resolve,
27
- tsconfigPaths: true,
28
- },
29
- ...getMediaProxyServerConfig(),
30
- })
31
- },
32
- core: {
33
- disableTelemetry: true,
34
- disableWhatsNewNotifications: true,
35
- },
36
- tags: ['autodocs'],
37
- }
38
-
39
- export { MAIN_CONFIG_NEXTJS_VITE }
4
+ env: (config) => ({
5
+ ...config,
6
+ REST_BASE_URL: process.env.REST_BASE_URL,
7
+ STORYBOOK_MODE: process.env.STORYBOOK_MODE || '',
8
+ }),
9
+ viteFinal: async (config) => {
10
+ const { mergeConfig } = await import('vite');
11
+ return mergeConfig(config, {
12
+ css: {
13
+ devSourcemap: true,
14
+ },
15
+ optimizeDeps: {
16
+ ...config.optimizeDeps,
17
+ exclude: ['react-native', ...(config.optimizeDeps?.exclude ?? [])],
18
+ rolldownOptions: {
19
+ ...config.optimizeDeps?.rolldownOptions,
20
+ },
21
+ },
22
+ plugins: [svgr({ include: '**/*.svg' })],
23
+ resolve: {
24
+ ...config.resolve,
25
+ tsconfigPaths: true,
26
+ },
27
+ ...getMediaProxyServerConfig(),
28
+ });
29
+ },
30
+ core: {
31
+ disableTelemetry: true,
32
+ disableWhatsNewNotifications: true,
33
+ },
34
+ tags: ['autodocs'],
35
+ };
36
+ export { MAIN_CONFIG_NEXTJS_VITE };
@@ -0,0 +1,9 @@
1
+ declare const MAIN_CONFIG_REACT_NATIVE: {
2
+ viteFinal: (config: any) => Promise<Record<string, any>>;
3
+ core: {
4
+ disableTelemetry: boolean;
5
+ disableWhatsNewNotifications: boolean;
6
+ };
7
+ tags: string[];
8
+ };
9
+ export { MAIN_CONFIG_REACT_NATIVE };
@@ -1,24 +1,22 @@
1
- import svgr from 'vite-plugin-svgr'
2
- import tsconfigPaths from 'vite-tsconfig-paths'
3
-
1
+ import svgr from 'vite-plugin-svgr';
2
+ import tsconfigPaths from 'vite-tsconfig-paths';
4
3
  const MAIN_CONFIG_REACT_NATIVE = {
5
- viteFinal: async (config) => {
6
- const { mergeConfig } = await import('vite')
7
- return mergeConfig(config, {
8
- css: {
9
- devSourcemap: true,
10
- },
11
- optimizeDeps: {
12
- exclude: ['react-native'],
13
- },
14
- plugins: [tsconfigPaths(), svgr({ include: '**/*.svg' })],
15
- })
16
- },
17
- core: {
18
- disableTelemetry: true,
19
- disableWhatsNewNotifications: true,
20
- },
21
- tags: ['autodocs'],
22
- }
23
-
24
- export { MAIN_CONFIG_REACT_NATIVE }
4
+ viteFinal: async (config) => {
5
+ const { mergeConfig } = await import('vite');
6
+ return mergeConfig(config, {
7
+ css: {
8
+ devSourcemap: true,
9
+ },
10
+ optimizeDeps: {
11
+ exclude: ['react-native'],
12
+ },
13
+ plugins: [tsconfigPaths(), svgr({ include: '**/*.svg' })],
14
+ });
15
+ },
16
+ core: {
17
+ disableTelemetry: true,
18
+ disableWhatsNewNotifications: true,
19
+ },
20
+ tags: ['autodocs'],
21
+ };
22
+ export { MAIN_CONFIG_REACT_NATIVE };
@@ -0,0 +1,23 @@
1
+ declare const MAIN_CONFIG_REACT_NATIVE_WEB: {
2
+ viteFinal: (viteConfig: any) => Promise<Record<string, any>>;
3
+ addons: string[];
4
+ core: {
5
+ disableTelemetry: boolean;
6
+ disableWhatsNewNotifications: boolean;
7
+ };
8
+ docs: {
9
+ autodocs: boolean;
10
+ };
11
+ framework: {
12
+ name: string;
13
+ };
14
+ stories: string[];
15
+ typescript: {
16
+ reactDocgen: string;
17
+ reactDocgenTypescriptOptions: {
18
+ propFilter: (prop: any) => boolean;
19
+ shouldExtractLiteralValuesFromEnum: boolean;
20
+ };
21
+ };
22
+ };
23
+ export { MAIN_CONFIG_REACT_NATIVE_WEB };
@@ -1,48 +1,44 @@
1
- import path from 'path'
2
- import { fileURLToPath } from 'url'
3
-
4
- import { mergeConfig } from 'vite'
5
- import babel from 'vite-plugin-babel'
6
-
7
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
8
-
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ import { mergeConfig } from 'vite';
4
+ import babel from 'vite-plugin-babel';
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
9
6
  const MAIN_CONFIG_REACT_NATIVE_WEB = {
10
- viteFinal: async (viteConfig) => {
11
- return mergeConfig(viteConfig, {
12
- plugins: [
13
- babel({
14
- babelConfig: {
15
- babelrc: false,
16
- configFile: path.resolve(__dirname, '../../../babel.config.js'),
17
- },
18
- }),
19
- ],
20
- })
21
- },
22
- addons: ['@storybook/addon-docs'],
23
- core: {
24
- disableTelemetry: true,
25
- disableWhatsNewNotifications: true,
26
- },
27
- docs: {
28
- autodocs: true,
29
- },
30
- framework: {
31
- name: '@storybook/react-native-web-vite',
32
- },
33
- stories: ['../stories/react-native/**/*.stories.?(ts|tsx|js|jsx)'],
34
- typescript: {
35
- reactDocgen: 'react-docgen-typescript',
36
- reactDocgenTypescriptOptions: {
37
- propFilter: (prop) => {
38
- if (prop.parent) {
39
- return !prop.parent.fileName.includes('node_modules')
40
- }
41
- return true
42
- },
43
- shouldExtractLiteralValuesFromEnum: true,
7
+ viteFinal: async (viteConfig) => {
8
+ return mergeConfig(viteConfig, {
9
+ plugins: [
10
+ babel({
11
+ babelConfig: {
12
+ babelrc: false,
13
+ configFile: path.resolve(__dirname, '../../../babel.config.js'),
14
+ },
15
+ }),
16
+ ],
17
+ });
44
18
  },
45
- },
46
- }
47
-
48
- export { MAIN_CONFIG_REACT_NATIVE_WEB }
19
+ addons: ['@storybook/addon-docs'],
20
+ core: {
21
+ disableTelemetry: true,
22
+ disableWhatsNewNotifications: true,
23
+ },
24
+ docs: {
25
+ autodocs: true,
26
+ },
27
+ framework: {
28
+ name: '@storybook/react-native-web-vite',
29
+ },
30
+ stories: ['../stories/react-native/**/*.stories.?(ts|tsx|js|jsx)'],
31
+ typescript: {
32
+ reactDocgen: 'react-docgen-typescript',
33
+ reactDocgenTypescriptOptions: {
34
+ propFilter: (prop) => {
35
+ if (prop.parent) {
36
+ return !prop.parent.fileName.includes('node_modules');
37
+ }
38
+ return true;
39
+ },
40
+ shouldExtractLiteralValuesFromEnum: true,
41
+ },
42
+ },
43
+ };
44
+ export { MAIN_CONFIG_REACT_NATIVE_WEB };
@@ -0,0 +1,9 @@
1
+ declare const MAIN_CONFIG_VITE: {
2
+ viteFinal: (config: any) => Promise<Record<string, any>>;
3
+ core: {
4
+ disableTelemetry: boolean;
5
+ disableWhatsNewNotifications: boolean;
6
+ };
7
+ tags: string[];
8
+ };
9
+ export { MAIN_CONFIG_VITE };
@@ -1,81 +1,76 @@
1
- import path from 'node:path'
2
-
3
- import svgr from 'vite-plugin-svgr'
4
-
5
- import { getMediaProxyServerConfig } from '../vite/getMediaProxyServerConfig.js'
6
-
1
+ import path from 'node:path';
2
+ import svgr from 'vite-plugin-svgr';
3
+ import { getMediaProxyServerConfig } from '../vite/getMediaProxyServerConfig.js';
7
4
  const MAIN_CONFIG_VITE = {
8
- viteFinal: async function (config) {
9
- const { mergeConfig } = await import('vite')
10
- const existingHmr = config.server?.hmr
11
- const existingWatch = config.server?.watch
12
- const projectRoot = process.cwd()
13
- const srcAlias = {
14
- find: 'src',
15
- replacement: path.join(projectRoot, 'src'),
16
- }
17
- const existingAlias = config.resolve?.alias
18
- const alias = Array.isArray(existingAlias)
19
- ? [...existingAlias, srcAlias]
20
- : existingAlias
21
- ? [existingAlias, srcAlias]
22
- : [srcAlias]
23
-
24
- return mergeConfig(config, {
25
- // Включаем source maps для отладки в DevTools
26
- // Для dev режима Vite автоматически генерирует source maps, но нужно явно указать
27
- build: {
28
- ...config.build,
29
- sourcemap: true,
30
- },
31
- css: {
32
- preprocessorOptions: {
33
- scss: {
34
- api: 'modern-compiler',
35
- },
36
- },
37
- },
38
- optimizeDeps: {
39
- ...config.optimizeDeps,
40
- rolldownOptions: {
41
- ...config.optimizeDeps?.rolldownOptions,
42
- },
43
- },
44
- plugins: [svgr({ include: '**/*.svg' })],
45
- resolve: {
46
- ...config.resolve,
47
- alias: alias,
48
- tsconfigPaths: true,
49
- },
50
- root: projectRoot,
51
- // Улучшаем HMR для более быстрого обновления и работы с DevTools
52
- server: {
53
- ...config.server,
54
- hmr: {
55
- ...(existingHmr && typeof existingHmr === 'object'
56
- ? existingHmr
57
- : {}),
58
- overlay: true,
59
- // Убеждаемся, что HMR работает правильно
60
- protocol: 'ws',
61
- },
62
- // Включаем source maps для dev сервера
63
- sourcemapIgnoreList: false,
64
- watch: {
65
- ...(existingWatch && typeof existingWatch === 'object'
66
- ? existingWatch
67
- : {}),
68
- usePolling: false,
69
- },
70
- ...getMediaProxyServerConfig().server,
71
- },
72
- })
73
- },
74
- core: {
75
- disableTelemetry: true,
76
- disableWhatsNewNotifications: true,
77
- },
78
- tags: ['autodocs'],
79
- }
80
-
81
- export { MAIN_CONFIG_VITE }
5
+ viteFinal: async function (config) {
6
+ const { mergeConfig } = await import('vite');
7
+ const existingHmr = config.server?.hmr;
8
+ const existingWatch = config.server?.watch;
9
+ const projectRoot = process.cwd();
10
+ const srcAlias = {
11
+ find: 'src',
12
+ replacement: path.join(projectRoot, 'src'),
13
+ };
14
+ const existingAlias = config.resolve?.alias;
15
+ const alias = Array.isArray(existingAlias)
16
+ ? [...existingAlias, srcAlias]
17
+ : existingAlias
18
+ ? [existingAlias, srcAlias]
19
+ : [srcAlias];
20
+ return mergeConfig(config, {
21
+ // Включаем source maps для отладки в DevTools
22
+ // Для dev режима Vite автоматически генерирует source maps, но нужно явно указать
23
+ build: {
24
+ ...config.build,
25
+ sourcemap: true,
26
+ },
27
+ css: {
28
+ preprocessorOptions: {
29
+ scss: {
30
+ api: 'modern-compiler',
31
+ },
32
+ },
33
+ },
34
+ optimizeDeps: {
35
+ ...config.optimizeDeps,
36
+ rolldownOptions: {
37
+ ...config.optimizeDeps?.rolldownOptions,
38
+ },
39
+ },
40
+ plugins: [svgr({ include: '**/*.svg' })],
41
+ resolve: {
42
+ ...config.resolve,
43
+ alias: alias,
44
+ tsconfigPaths: true,
45
+ },
46
+ root: projectRoot,
47
+ // Улучшаем HMR для более быстрого обновления и работы с DevTools
48
+ server: {
49
+ ...config.server,
50
+ hmr: {
51
+ ...(existingHmr && typeof existingHmr === 'object'
52
+ ? existingHmr
53
+ : {}),
54
+ overlay: true,
55
+ // Убеждаемся, что HMR работает правильно
56
+ protocol: 'ws',
57
+ },
58
+ // Включаем source maps для dev сервера
59
+ sourcemapIgnoreList: false,
60
+ watch: {
61
+ ...(existingWatch && typeof existingWatch === 'object'
62
+ ? existingWatch
63
+ : {}),
64
+ usePolling: false,
65
+ },
66
+ ...getMediaProxyServerConfig().server,
67
+ },
68
+ });
69
+ },
70
+ core: {
71
+ disableTelemetry: true,
72
+ disableWhatsNewNotifications: true,
73
+ },
74
+ tags: ['autodocs'],
75
+ };
76
+ export { MAIN_CONFIG_VITE };
@@ -0,0 +1,9 @@
1
+ declare const MAIN_CONFIG_WEBPACK: {
2
+ webpackFinal: (config: any) => Promise<any>;
3
+ core: {
4
+ disableTelemetry: boolean;
5
+ disableWhatsNewNotifications: boolean;
6
+ };
7
+ tags: string[];
8
+ };
9
+ export { MAIN_CONFIG_WEBPACK };