@itcase/storybook-config 1.3.8 → 1.3.12

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.
@@ -9,8 +9,9 @@ var withNextDecorator = require('./decorators/withNextDecorator.js');
9
9
  var withUiDecorator = require('./decorators/withUiDecorator.js');
10
10
  require('react');
11
11
  require('react/jsx-runtime');
12
- require('../isArray-DJguRq_2.js');
12
+ require('lodash-es/castArray');
13
13
  require('../FormSubmitWrapper-Bv5qs18h.js');
14
+ require('lodash-es/camelCase');
14
15
  require('@itcase/common');
15
16
  require('msw');
16
17
  require('@itcase/ui-core/context');
@@ -15,6 +15,8 @@ const MAIN_CONFIG_NEXTJS_VITE = {
15
15
  optimizeDeps: {
16
16
  ...config.optimizeDeps,
17
17
  exclude: ['react-native', ...(config.optimizeDeps?.exclude ?? [])],
18
+ // CJS packages (e.g. prop-types) need prebundling for ESM default import.
19
+ include: ['prop-types', ...(config.optimizeDeps?.include ?? [])],
18
20
  rolldownOptions: {
19
21
  ...config.optimizeDeps?.rolldownOptions,
20
22
  },
@@ -1,6 +1,7 @@
1
1
  import { mergeConfig } from 'vite';
2
2
  import svgr from 'vite-plugin-svgr';
3
3
  import { ADDONS_REACT_NATIVE_WEB } from '../addons/addonsReactNativeWeb.js';
4
+ import { reactNativeWebAliasPlugin } from '../vite/reactNativeWebAliasPlugin.js';
4
5
  const REACT_NATIVE_WEB_EXTENSIONS = [
5
6
  '.web.tsx',
6
7
  '.web.ts',
@@ -23,27 +24,23 @@ const MAIN_CONFIG_REACT_NATIVE_WEB = {
23
24
  plugins,
24
25
  }, {
25
26
  optimizeDeps: {
26
- esbuildOptions: {
27
- resolveExtensions: REACT_NATIVE_WEB_EXTENSIONS,
27
+ // SVG subpath exports (`/default/svg`) must not be prebundled; svgr handles them.
28
+ exclude: ['@itcase/icons-default', 'react-native'],
29
+ // prop-types is CJS; prebundle so `import x from 'prop-types'` works in Vite 8.
30
+ include: ['prop-types', 'react-native-web', 'react-native-svg'],
31
+ rolldownOptions: {
32
+ resolve: {
33
+ extensions: REACT_NATIVE_WEB_EXTENSIONS,
34
+ },
28
35
  },
29
- exclude: ['react-native'],
30
- include: ['react-native-web', 'react-native-svg'],
31
36
  },
32
- plugins: [svgr({ include: '**/*.svg' })],
37
+ plugins: [reactNativeWebAliasPlugin(), svgr({ include: '**/*.svg' })],
33
38
  resolve: {
34
- alias: [
35
- {
36
- // RN 0.87 re-exports this package from `react-native`, which
37
- // has no web equivalent on the react-native-web public API.
38
- find: '@react-native/assets-registry/registry',
39
- replacement: 'react-native-web/dist/modules/AssetRegistry',
40
- },
41
- {
42
- find: /^react-native$/,
43
- replacement: 'react-native-web',
44
- },
45
- ],
46
- dedupe: ['react', 'react-dom', 'react-native', 'react-native-web'],
39
+ alias: {
40
+ '@react-native/assets-registry/registry': 'react-native-web/dist/modules/AssetRegistry',
41
+ 'react-native': 'react-native-web',
42
+ },
43
+ dedupe: ['react', 'react-dom', 'react-native-web'],
47
44
  extensions: REACT_NATIVE_WEB_EXTENSIONS,
48
45
  },
49
46
  });
@@ -59,6 +59,8 @@ const MAIN_CONFIG_VITE = {
59
59
  },
60
60
  optimizeDeps: {
61
61
  ...config.optimizeDeps,
62
+ // CJS packages (e.g. prop-types) need prebundling for ESM default import.
63
+ include: ['prop-types', ...(config.optimizeDeps?.include ?? [])],
62
64
  rolldownOptions: {
63
65
  ...config.optimizeDeps?.rolldownOptions,
64
66
  },
@@ -0,0 +1,8 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Vite 8 / rolldown does not reliably apply RegExp `resolve.alias` entries.
4
+ * A string alias of `react-native` is also easy to lose when configs merge.
5
+ * Resolve the package (and its subpaths) in a pre plugin instead.
6
+ */
7
+ declare function reactNativeWebAliasPlugin(): Plugin;
8
+ export { reactNativeWebAliasPlugin };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Vite 8 / rolldown does not reliably apply RegExp `resolve.alias` entries.
3
+ * A string alias of `react-native` is also easy to lose when configs merge.
4
+ * Resolve the package (and its subpaths) in a pre plugin instead.
5
+ */
6
+ function reactNativeWebAliasPlugin() {
7
+ return {
8
+ name: 'itcase-react-native-web-alias',
9
+ async resolveId(id, importer, options) {
10
+ if (id === '@react-native/assets-registry/registry') {
11
+ return this.resolve('react-native-web/dist/modules/AssetRegistry', importer, { ...options, skipSelf: true });
12
+ }
13
+ if (id === 'react-native' || id.startsWith('react-native/')) {
14
+ return this.resolve(`react-native-web${id.slice('react-native'.length)}`, importer, { ...options, skipSelf: true });
15
+ }
16
+ return null;
17
+ },
18
+ enforce: 'pre',
19
+ };
20
+ }
21
+ export { reactNativeWebAliasPlugin };
@@ -1,63 +1,7 @@
1
1
  import 'react';
2
- import { r as requireIsArray, g as getDefaultExportFromCjs } from '../components/isArray-CPoGkdXv.js';
2
+ import castArray from 'lodash-es/castArray';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
- var castArray_1;
6
- var hasRequiredCastArray;
7
-
8
- function requireCastArray () {
9
- if (hasRequiredCastArray) return castArray_1;
10
- hasRequiredCastArray = 1;
11
- var isArray = requireIsArray();
12
-
13
- /**
14
- * Casts `value` as an array if it's not one.
15
- *
16
- * @static
17
- * @memberOf _
18
- * @since 4.4.0
19
- * @category Lang
20
- * @param {*} value The value to inspect.
21
- * @returns {Array} Returns the cast array.
22
- * @example
23
- *
24
- * _.castArray(1);
25
- * // => [1]
26
- *
27
- * _.castArray({ 'a': 1 });
28
- * // => [{ 'a': 1 }]
29
- *
30
- * _.castArray('abc');
31
- * // => ['abc']
32
- *
33
- * _.castArray(null);
34
- * // => [null]
35
- *
36
- * _.castArray(undefined);
37
- * // => [undefined]
38
- *
39
- * _.castArray();
40
- * // => []
41
- *
42
- * var array = [1, 2, 3];
43
- * console.log(_.castArray(array) === array);
44
- * // => true
45
- */
46
- function castArray() {
47
- if (!arguments.length) {
48
- return [];
49
- }
50
- var value = arguments[0];
51
- return isArray(value) ? value : [value];
52
- }
53
-
54
- castArray_1 = castArray;
55
- return castArray_1;
56
- }
57
-
58
- var castArrayExports = requireCastArray();
59
- var castArray = /*@__PURE__*/getDefaultExportFromCjs(castArrayExports);
60
-
61
5
  function withFigmaSourceLink() {
62
6
  const decorator = (Story, {
63
7
  parameters,